diff mm7_3.cpp @ 150:d92c78ab54fe

Слияние
author Ritor1
date Tue, 12 Feb 2013 10:17:35 +0600
parents 2b0c652cc165 8b8fd4d83fdc
children 9abdd40a107b
line wrap: on
line diff
--- a/mm7_3.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/mm7_3.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -1483,11 +1483,11 @@
       {
         _46E44E_collide_against_faces_and_portals(0);
         _46E0B2_collide_against_decorations();
-        if ( (v1->field_58 & 7) != 4 )
+        if ( (v1->field_58 & 7) != OBJECT_Player)
           _46EF01_collision_chech_player(1);
         v13 = v1->field_58;
         v42 = v8;
-        if ( (v13 & 7) == 3 )
+        if ( (v13 & 7) == OBJECT_Actor)
         {
           if ( (signed int)uNumActors > v8 )
           {
@@ -1575,7 +1575,7 @@
       if ( v2->uFlags & 0x40 && !_46BFFA_check_object_intercept(uLayingItemID_, stru_721530.uFaceID) )
         return;
       v15 = (signed int)stru_721530.uFaceID >> 3;
-      if ( (stru_721530.uFaceID & 7) == 5 )
+      if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration)
       {
         v40 = sub_452A9E(v1->vVelocity.x * v1->vVelocity.x + v1->vVelocity.y * v1->vVelocity.y);
         v23 = stru_5C6E00->Atan2(
@@ -1593,7 +1593,7 @@
       }
       else
       {
-        if ( (stru_721530.uFaceID & 7) != 6 )
+        if ( (stru_721530.uFaceID & 7) != OBJECT_BModel)
           goto LABEL_64;
         stru_721530.field_84 = (signed int)stru_721530.uFaceID >> 3;
         v16 = &pIndoor->pFaces[v15];
@@ -1987,9 +1987,9 @@
       v58 = v16;
       v18 = WorldPosToGridCellX(v17);
       _46E26D_collide_against_sprites(v18, v58);
-      if ( (v1->field_58 & 7) != 4 )
+      if ( (v1->field_58 & 7) != OBJECT_Player)
         _46EF01_collision_chech_player(0);
-      if ( (v1->field_58 & 7) == 3 )
+      if ( (v1->field_58 & 7) == OBJECT_Actor)
       {
         v19 = v1->field_58 >> 3;
         if ( v19 >= 0 )
@@ -2094,9 +2094,9 @@
           return;
       }
       v30 = (signed int)stru_721530.uFaceID >> 3;
-      if ( (stru_721530.uFaceID & 7) == 5 )
+      if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration)
         break;
-      if ( (stru_721530.uFaceID & 7) == 6 )
+      if ( (stru_721530.uFaceID & 7) == OBJECT_BModel)
       {
         v31 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9];
         v32 = &v31->pFaces[v30 & 0x3F];
@@ -2814,7 +2814,7 @@
     uSectorID = stru_721530.uSectorID;
     stru_721530.field_70 += stru_721530.field_7C;
     auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + new_party_z;
-    if ( (stru_721530.uFaceID & 7) == 3 )
+    if ( (stru_721530.uFaceID & 7) == OBJECT_Actor)
     {
       if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0
         && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime)) )
@@ -2822,7 +2822,7 @@
       viewparams->bRedrawGameUI = 1;
       goto LABEL_152;
     }
-    if ( (stru_721530.uFaceID & 7) == 5 )
+    if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration)
     {
       v53 = sub_452A9E(v2 * v2 + v1 * v1);
       v80 = v53;
@@ -2835,7 +2835,7 @@
     }
     else
     {
-      if ( (stru_721530.uFaceID & 7) == 6 )
+      if ( (stru_721530.uFaceID & 7) == OBJECT_BModel)
       {
         v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3];
         v45 = v44->uPolygonType;
@@ -2998,8 +2998,8 @@
   int v1; // edi@1
   int v2; // ebx@1
   int v3; // eax@14
-  Player **v4; // esi@21
-  int v5; // eax@24
+  //Player **v4; // esi@21
+  //int v5; // eax@24
   int v6; // esi@45
   ODMFace *v7; // ecx@45
   //unsigned int v8; // eax@71
@@ -3026,16 +3026,16 @@
   //signed __int64 v29; // qax@98
   //unsigned int v30; // eax@103
   int v31; // eax@130
-  int v32; // ecx@141
+  //int v32; // ecx@141
   signed int v33; // eax@143
   int v34; // esi@143
-  unsigned int v35; // esi@147
+  int v35; // esi@147
   int v36; // eax@155
   signed int v37; // esi@159
   signed int v38; // eax@159
   signed int i; // esi@159
   int v40; // esi@162
-  Player **v41; // esi@172
+  //Player **v41; // esi@172
   bool v42; // eax@180
   signed int v43; // ecx@184
   signed int v44; // edx@184
@@ -3183,28 +3183,24 @@
     v3 = pParty->uFallStartY;
   if ( v3 - v123 > 512 && !bFeatherFall && v123 <= v111 + 1 )
   {
-    if ( BYTE1(pParty->uFlags) & 1 )
-    {
-      BYTE1(pParty->uFlags) &= 0xFEu;
-    }
-    else
-    {
-      v4 = &pPlayers[1];                        // receive falling damage
-      do
-      {
-        if ( !(*v4)->HasEnchantedItemEquipped(72) && !(*v4)->WearsItem(529, 8) )
-        {
-          v105 = (*v4)->GetMaxHealth();
-          (*v4)->ReceiveDamage(
-            (signed int)((pParty->uFallStartY - v123) * (unsigned __int64)(signed __int64)((double)v105 * 0.1)) / 256,
+    if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
+    {
+      pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
+    }
+    else for (int _i = 0; _i < 4; ++_i)     // receive falling damage
+    {
+      auto player = pParty->pPlayers + _i;
+
+      if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) )
+      {
+        player->ReceiveDamage(
+            (signed int)((pParty->uFallStartY - v123) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256,
             4);
-          v5 = (*v4)->GetActualEndurance();
-          v105 = 20 - (*v4)->_48EA1B_get_static_effect(v5);
-          (*v4)->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
-        }
-        ++v4;
-      }
-      while ( (signed int)v4 <= (signed int)&pPlayers[4] );
+        v105 = 20 - player->_48EA1B_get_static_effect(player->GetActualEndurance());
+        player->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333));
+      }
+      //}
+      //while ( (signed int)v4 <= (signed int)&pPlayers[4] );
     }
   }
   v109 = -1;
@@ -3224,7 +3220,7 @@
   v101 = v123 - v111 <= 32;
   if ( bWalkSound && pParty->field_6F8 > 0 )
     pParty->field_6F8 -= pEventTimer->uTimeElapsed;
-  if ( !bUnderwater
+  if (!bUnderwater
     && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0
     && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) < 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0) )
     pParty->bFlying = false;
@@ -3262,9 +3258,9 @@
                                                                     * stru_5C6E00->uIntegerPi)
                                                        / 180)) >> 16);*/
   __int64 dturn = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) / 180)) >> 16;
-  while ( pPartyActionQueue->uNumActions )
-  {
-    switch ( pPartyActionQueue->Next() )
+  while (pPartyActionQueue->uNumActions)
+  {
+    switch (pPartyActionQueue->Next())
     {
       case PARTY_FlyUp:
       {
@@ -3388,6 +3384,7 @@
       case PARTY_StrafeRight:
       {
         *(float *)&v128 = pParty->uWalkSpeed;
+
         float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0);
         int dx = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
         v2 += 3 * dx / 4;
@@ -3402,7 +3399,7 @@
       break;
 
       case PARTY_WalkForward:
-        {
+      {
         *(float *)&v128 = _walk_speed;
 
         float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
@@ -3413,9 +3410,12 @@
         
         int dy = sin_y * pParty->uWalkSpeed * fWalkSpeedMultiplier;
         v1 += dy;
+
         v128 = v1;
         v124 = 1;
+      }
       break;
+
       case PARTY_RunForward:
       {
         *(float *)&v128 = _walk_speed;
@@ -3452,6 +3452,7 @@
       }
       break;
 
+
       case PARTY_WalkBackward:
       {
         *(float *)&v128 = _walk_speed;
@@ -3470,6 +3471,7 @@
       }
       break;
 
+
       case PARTY_RunBackward:
       {
         float sin_y = sinf(2 * 3.141592653589 * _angle_y / 2048.0),
@@ -3491,86 +3493,31 @@
 
           v128 = v1;
           v124 = 1;
-          break;
-        }
-        v25 = stru_5C6E00->SinCos(_angle_y);
-        v26 = (double)_walk_speed;
-        v114 = v25;
-        *(float *)&v128 = v26;
-        v129 = (unsigned __int64)(v25
-                                * (signed __int64)(signed int)(2
-                                                             * (unsigned __int64)(signed __int64)(v26
-                                                                                                * fWalkSpeedMultiplier))) >> 16;
-        v2 += v129;
-        v114 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
-        v129 = (unsigned __int64)((signed int)v114
-                                * (signed __int64)(signed int)(2
-                                                             * (unsigned __int64)(signed __int64)(*(float *)&v128
-                                                                                                * fWalkSpeedMultiplier))) >> 16;
-        v1 += v129;
-        v114 = 1;
-        v128 = v1;
-        break;
-
-      case PARTY_RunBackward:
-        v27 = stru_5C6E00->SinCos(_angle_y);
-        v28 = (double)_walk_speed;
-        v126 = v27;
-        *(float *)&v128 = v28;
-        v29 = (signed __int64)(v28 * fBackwardWalkSpeedMultiplier);
-        if ( pParty->bFlying )
-        {
-          v129 = (unsigned __int64)(v126 * (signed __int64)(4 * (signed int)v29)) >> 16;
-          v2 -= v129;
-          v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
-          v129 = (unsigned __int64)(v126
-                                  * (signed __int64)(signed int)(4
-                                                               * (unsigned __int64)(signed __int64)(*(float *)&v128
-                                                                                                  * fBackwardWalkSpeedMultiplier))) >> 16;
-          v1 -= v129;
-LABEL_93:
-          v128 = v1;
-        }
-        else
-        {
-          v129 = (unsigned __int64)(v126 * (signed __int64)(signed int)v29) >> 16;
-          v2 -= v129;
-          v126 = stru_5C6E00->SinCos(_angle_y - stru_5C6E00->uIntegerHalfPi);
-          v129 = (unsigned __int64)(v126
-                                  * (signed __int64)(signed int)(signed __int64)(*(float *)&v128
-                                                                               * fBackwardWalkSpeedMultiplier)) >> 16;
-          v1 -= v129;
-//LABEL_86:
-          v128 = v1;
-          v124 = 1;
-        }
-        break;
+        }
+      }
+      break;
+
+      
+      case PARTY_CenterView:
+        _angle_x = 0;
+      break;
+
       case PARTY_LookUp:
         _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
         if ( _angle_x > 128 )
           _angle_x = 128;
-        v30 = uActiveCharacter;
-        if ( !uActiveCharacter )
-          goto LABEL_118;
-        v95 = 0;
-        v93 = 63;
-        goto _play_player_sound;
+        if (uActiveCharacter)
+          pPlayers[uActiveCharacter]->PlaySound(63, 0);
+      break;
+
       case PARTY_LookDown:
         _angle_x += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
         if ( _angle_x < -128 )
           _angle_x = -128;
-        v30 = uActiveCharacter;
-        if ( uActiveCharacter )
-        {
-          v95 = 0;
-          v93 = 64;
-_play_player_sound:
-          pPlayers[v30]->PlaySound(v93, v95);
-        }
-        goto LABEL_118;
-      case PARTY_CenterView:
-        _angle_x = 0;
-        goto LABEL_118;
+        if (uActiveCharacter)
+          pPlayers[uActiveCharacter]->PlaySound(64, 0);
+      break;
+
       case PARTY_Jump:
         if ( (!partyAtHighSlope || v108) && !bJumping && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) )
         {
@@ -3578,20 +3525,23 @@
           bJumping = 1;
           v121 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v121);
         }
-        goto LABEL_118;
+      break;
+
       default:
-        goto LABEL_118;
+        assert(false);
+
       case PARTY_Land:
-        if ( pParty->bFlying )
-        {
-          BYTE1(pParty->uFlags) |= 1u;
+        if (pParty->bFlying)
+        {
+          pParty->uFlags |= PARTY_FLAGS_1_LANDING;
           pParty->uFallSpeed = 0;
         }
-        pParty->bFlying = 0;
+        pParty->bFlying = false;
         pPartyActionQueue->uNumActions = 0;
-        goto LABEL_123;
-    }
-  }
+      break;
+    }
+  }
+
 LABEL_123:
   pParty->sRotationY = _angle_y;
   pParty->sRotationX = _angle_x;
@@ -3606,8 +3556,7 @@
       v123 = v113 + v129;
       if ( v127 )
         v123 = v113;
-      if ( SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) >= 0
-        && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime)) )
+      if (pParty->FlyActive())
         stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu;
       pParty->uFallStartY = v123;
       goto LABEL_141;
@@ -3621,27 +3570,25 @@
   if ( pParty->bFlying )
     goto LABEL_130;
   v113 = v123;
-  if ( SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) >= 0
-    && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime)) )
+  if (pParty->FlyActive())
     stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;
+
 LABEL_141:
-  v32 = 0;
-  if ( bJumping && !pParty->bFlying )
+  if (bJumping && !pParty->bFlying)
   {
     v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength());
     v34 = v121 + 2 * v33;
     v121 += 2 * v33;
-    goto LABEL_149;
-  }
-  if ( !partyAtHighSlope )
+    goto LABEL_164;
+  }
+  if (!partyAtHighSlope)
   {
     v34 = v121;
-LABEL_149:
-    if ( bJumping == v32 )
+    if (!bJumping)
       goto LABEL_150;
     goto LABEL_164;
   }
-  if ( !bJumping )
+  if (!bJumping)
   {
     if ( v108 )
       goto LABEL_150;
@@ -3653,41 +3600,39 @@
     ODM_GetTerrainNormalAt(v116, v117, &v98);
     v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength();
     v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16;
-    v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v98.x) >> 16);
-    v2 += (int)v127;
-    v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v98.y) >> 16);
-    v1 += (int)v127;
+    v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16;
+    v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16;
+    v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16);
     v128 = v1;
-    v127 = (BSPModel *)((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16);
-    v34 = (int)((char *)v127 + v35);
-    v32 = 0;
     v121 = v34;
-    goto LABEL_149;
+    if (!bJumping)
+      goto LABEL_150;
+    goto LABEL_164;
   }
   v34 = v121;
+
 LABEL_164:
-  if ( !bUnderwater && v34 <= v32 )
+  if ( !bUnderwater && v34 <= 0)
   {
     if ( v34 < -500
       && !pParty->bFlying
       && pParty->vPosition.z - v111 > 1000
-      && SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0
-      && (SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0 || !LODWORD(pParty->pPartyBuffs[5].uExpireTime)) )
-    {
-      v41 = &pPlayers[1];
-      do
-      {
-        if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(529, 8) && (*v41)->CanAct() )
-          (*v41)->PlaySound(66, 0);
-        ++v41;
-      }
-      while ( (signed int)v41 <= (signed int)&pPlayers[4] );
-    }
-    goto LABEL_151;
-  }
+      && !pParty->FeatherFallActive())
+    { // falling scream
+      for (int i = 0; i < 4; ++i)
+      {
+        auto player = pParty->pPlayers + i;
+        if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) && player->CanAct())
+          player->PlaySound(66, 0);
+      }
+    }
+  }
+  else
+  {
 LABEL_150:
   pParty->uFallStartY = v123;
-LABEL_151:
+  }
+
   if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope )
   {
     *(float *)&v128 = 0.0;
@@ -3800,15 +3745,15 @@
     v117 = _angle_y;
     v45 = stru_721530.uFaceID;
     v123 = v40;
-    if ( (stru_721530.uFaceID & 7) == 3 )
-    {
-      if ( SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) >= 0
-        && (SHIDWORD(pParty->pPartyBuffs[11].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[11].uExpireTime)) )
-        pParty->pPartyBuffs[11].Reset();
+    if ( (stru_721530.uFaceID & 7) == OBJECT_Actor)
+    {
+      if (pParty->Invisible())
+        pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
+
       viewparams->bRedrawGameUI = 1;
       goto LABEL_234;
     }
-    if ( (stru_721530.uFaceID & 7) == 5 )
+    if ( (stru_721530.uFaceID & 7) == OBJECT_Decoration)
     {
       v56 = sub_452A9E(v2 * v2 + v128 * v128);
       v118 = v56;
@@ -3829,7 +3774,7 @@
     }
     else
     {
-      if ( (stru_721530.uFaceID & 7) == 6 )
+      if ( (stru_721530.uFaceID & 7) == OBJECT_BModel)
       {
         pParty->bFlying = 0;
         v46 = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9];
@@ -13612,30 +13557,21 @@
 
 
 //----- (00441D38) --------------------------------------------------------
-void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int flags)
+void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap)
 {
   int uHeight; // ebx@6
-  //unsigned int v9; // edx@9
-  //unsigned int v10; // ebx@10
   __int16 v11; // cx@11
-  //BLVFace *v12; // ecx@17
-  //unsigned int v13; // ecx@21
   unsigned int v14; // ebx@23
   int v15; // eax@23
-  //unsigned int *v16; // ecx@28
   __int16 v17; // di@30
   double v18; // st7@30
   float v19; // ST38_4@30
   double v20; // st7@30
   double v21; // st6@30
   double v22; // st5@33
-  //unsigned __int16 *v26; // edx@37
   signed int v27; // eax@37
   unsigned __int16 *v28; // ecx@37
   signed int v29; // edi@40
-  //int v30; // eax@42
-  //unsigned __int16 *v31; // ebx@43
-  //signed int v32; // edi@46
   signed int v33; // ebx@50
   unsigned int v34; // eax@50
   signed int v35; // ecx@50
@@ -13653,7 +13589,6 @@
   int v47; // eax@108
   unsigned int v48; // ebx@114
   unsigned int v49; // ST64_4@114
-  //double v50; // ST20_8@117
   unsigned int v51; // [sp-10h] [bp-64h]@79
   unsigned int v52; // [sp-10h] [bp-64h]@100
   unsigned int v53; // [sp-Ch] [bp-60h]@79
@@ -13665,9 +13600,7 @@
   unsigned __int16 v59; // [sp-4h] [bp-58h]@100
   unsigned __int16 v60; // [sp+10h] [bp-44h]@66
   unsigned int v61; // [sp+10h] [bp-44h]@85
-  //unsigned __int16 *v62; // [sp+14h] [bp-40h]@30
   unsigned int v63; // [sp+14h] [bp-40h]@85
-  //int v64; // [sp+18h] [bp-3Ch]@39
   unsigned int v65; // [sp+18h] [bp-3Ch]@85
   unsigned int lPitch; // [sp+20h] [bp-34h]@1
   unsigned int lPitcha; // [sp+20h] [bp-34h]@23
@@ -13677,34 +13610,24 @@
   unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1
   signed int uBluea; // [sp+28h] [bp-2Ch]@37
   int v73; // [sp+2Ch] [bp-28h]@30
-  //unsigned __int8 *v74; // [sp+30h] [bp-24h]@30
   int v76; // [sp+34h] [bp-20h]@91
   int v77; // [sp+34h] [bp-20h]@108
-  //signed int v78; // [sp+38h] [bp-1Ch]@37
   int v79; // [sp+38h] [bp-1Ch]@72
-  //signed int a2b; // [sp+40h] [bp-14h]@41
   char *a2c; // [sp+40h] [bp-14h]@68
-  //int a3a; // [sp+44h] [bp-10h]@40
   signed int uCenterY; // [sp+48h] [bp-Ch]@1
   signed int uCenterX; // [sp+4Ch] [bp-8h]@1
-  //signed int uZb; // [sp+5Ch] [bp+8h]@27
   signed int uWidth; // [sp+5Ch] [bp+8h]@30
-  //signed int uZd; // [sp+5Ch] [bp+8h]@45
   signed int uZe; // [sp+5Ch] [bp+8h]@67
   signed int uZf; // [sp+5Ch] [bp+8h]@85
   signed int uZg; // [sp+5Ch] [bp+8h]@105
   unsigned int uWa; // [sp+60h] [bp+Ch]@23
   float uWb; // [sp+60h] [bp+Ch]@30
-  //unsigned __int16 *uWc; // [sp+60h] [bp+Ch]@37
   unsigned int uWd; // [sp+60h] [bp+Ch]@95
   float uZooma; // [sp+64h] [bp+10h]@117
-  //signed int flagsa; // [sp+68h] [bp+14h]@42
   unsigned int flagsb; // [sp+68h] [bp+14h]@66
   Actor *flagsc; // [sp+68h] [bp+14h]@86
   unsigned int flagsd; // [sp+68h] [bp+14h]@105
 
-  //a3 = uY;
-  //a2 = uX;
   uCenterX = (uX + uZ) / 2;
   uCenterY = (uY + uW) / 2;
   lPitch = pRenderer->uTargetSurfacePitch;
@@ -13760,78 +13683,46 @@
 
       default: assert(false);
     }
-//LABEL_37:
-    //v23 = v20 * 65536.0;
-    //v24 = v23 + 6.7553994e15;
+    assert(sizeof(pOdmMinimap) == 137 * 117 * sizeof(short));
+
     v70 = floorf(v20 * 65536.0 + 0.5f);//LODWORD(v24);
-    //uWe = uWb * 65536.0;
-    //v25 = uWe + 6.7553994e15;
-    //v78 = v70;
     uBluea = floorf(uWb * 65536.0 + 0.5f);//LODWORD(v25);
     v27 = uBluea >> 16;
     v28 = &pRenderer->pTargetSurface[uX + uY * lPitch];
-    if ( flags && pMapLod0)
-    {
-      auto pMinimap = (unsigned __int16 *)_56EFD8_minimap;
-      //if ( v74 )
-      //{
+    if (pMapLod0 && bRedrawOdmMinimap)
+    {
+      assert(uWidth == 137 && uHeight == 117);
+      //auto pMinimap = (unsigned __int16 *)pOdmMinimap;
+
         auto mapWidth = pIcons_LOD->pTextures[viewparams->uTextureID_LocationMap].uTextureWidth;
-        //if ( uHeight > 0 )
-        //{
-          //a3a = uHeight;
+
           v29 = v70 >> 16;
-          //do
+
           for (int y = 0; y < uHeight; ++y)
           {
-            //a2b = 0;
-            //if ( uWidth > 0 )
-            //{
               auto pMapLod0Line = &pMapLod0[v27 * mapWidth];
-              //flagsa = uWidth;
-              //a2b = uWidth;
               for (int x = 0; x < uWidth; ++x)
-              //do
-              {
-                //v31 = uWc;
-                //++uWc;
-                *pMinimap++ = pPal[pMapLod0Line[v29]];
-                //v78 += v73;
+              {
+                //*pMinimap++ = pPal[pMapLod0Line[v29]];
+                pOdmMinimap[y][x] = pPal[pMapLod0Line[v29]];
                 v29 = (v70 + x * v73) >> 16;
-                //--flagsa;
-              }
-              //while ( flagsa );
-            //}
-            //v78 = v70;
+              }
+
             v29 = v70 >> 16;
             v28 += 137 - uWidth;
             uBluea += v73;
             v27 = uBluea >> 16;
-            //--a3a;
-          }
-          //while ( a3a );
-        //}
-      //}
-    }
-
-    auto pMinimap = (unsigned __int16 *)_56EFD8_minimap;
-    //uZd = 117;
-    //do
+          }
+    }
+
     for (int y = 0; y < 117; ++y)
     {
-      //v32 = 137;
-      //do
       for (int x = 0; x < 137; ++x)
       {
-        *v28++ = *pMinimap++;
-        //++v28;
-        //++v26;
-        //--v32;
-      }
-      //while ( v32 );
+        *v28++ = pOdmMinimap[y][x];
+      }
       v28 += lPitch - 137;
-      //--uZd;
-    }
-    //while ( uZd );
+    }
     uNumBlueFacesInBLVMinimap = 0;
   }
   else
@@ -16392,7 +16283,7 @@
         do
         {
           v30 = *v55;
-          if ( *v55 == 5 || v30 == 11 || v30 == 19 || (v31 = *((int *)v55 + 159)) != 0 && (v31 & 7) == 4 )
+          if ( *v55 == Dead || v30 == Removed || v30 == Disabled || (v31 = *((int *)v55 + 159)) != 0 && (v31 & 7) == OBJECT_Player)
             ++pInString;
           v55 += 418;
           --*(int *)v54;
@@ -20492,12 +20383,12 @@
         v21->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
       a2 = *v20;
       v76 = a2 & 7;
-      if ( (a2 & 7) == 3 )
+      if ( (a2 & 7) == OBJECT_Actor)
         v80 = 0.5;
       else
         v80 = 1.0;
       v22 = v21->uAIState;
-      if ( v22 == 4 || v22 == 5 || v22 == 11 || v22 == 19 || v22 == 17 )
+      if ( v22 == Dying || v22 == Dead || v22 == Removed || v22 == Disabled || v22 == Summoned)
         goto LABEL_254;
       if ( !v21->sCurrentHP )
         Actor::Die(uActorID);
@@ -21015,7 +20906,7 @@
     v2 = this->pQueue;
     do
     {
-      if ( (v2->uPackedID & 7) == 3 )
+      if ( (v2->uPackedID & 7) == OBJECT_Actor )
       {
         v3 = &pActors[v2->uPackedID >> 3];
         v4 = &pActors[v2->uPackedID >> 3];
@@ -21027,7 +20918,7 @@
           LOBYTE(v3->uAttributes) &= 0x7Fu;
         }
       }
-      if ( (v2->uPackedID & 7) == 4 )
+      if ( (v2->uPackedID & 7) == OBJECT_Player)
       {
         v5 = &pParty->pPlayers[v2->uPackedID >> 3];
         if ( v5->pConditions[14]
@@ -21063,7 +20954,7 @@
           v10 = v7->field_4;
           if ( v9 < v10
             || v9 == v10
-            && ((v11 = v8->uPackedID & 7, v11 == 4) && (v7->uPackedID & 7) == 3
+            && ((v11 = v8->uPackedID & 7, v11 == OBJECT_Player) && (v7->uPackedID & 7) == OBJECT_Actor
              || v11 == (v7->uPackedID & 7) && (v8->uPackedID & 0xFFFFFFF8) < (v7->uPackedID & 0xFFFFFFF8)) )
           {
             v12 = v7->uPackedID;
@@ -21092,7 +20983,7 @@
   }
   v1->uActorQueueSize = v19;
   result = v1->pQueue[0].uPackedID;
-  if ( (v1->pQueue[0].uPackedID & 7) == 4 )
+  if ( (v1->pQueue[0].uPackedID & 7) == OBJECT_Player)
   {
     result = (result >> 3) + 1;
     uActiveCharacter = result;
@@ -21109,7 +21000,7 @@
     v17 = v1->pQueue;
     do
     {
-      if ( (v17->uPackedID & 7) == 4 )
+      if ( (v17->uPackedID & 7) == OBJECT_Player)
         pParty->pPlayers[v17->uPackedID >> 3].uTimeToRecovery = (signed __int64)((double)v17->field_4 * 0.46875);
       ++v22;
       ++v17;