changeset 150:d92c78ab54fe

Слияние
author Ritor1
date Tue, 12 Feb 2013 10:17:35 +0600
parents 2b0c652cc165 (current diff) b099dd069171 (diff)
children 9abdd40a107b
files AudioPlayer.cpp Game.cpp Keyboard.cpp Render.cpp mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp
diffstat 26 files changed, 416 insertions(+), 521 deletions(-) [+]
line wrap: on
line diff
--- a/Actor.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/Actor.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -2143,7 +2143,7 @@
   }
   else
   {
-    if ( (edx0 & 7) == 3 )
+    if ( (edx0 & 7) == OBJECT_Actor)
     {
       v8 = edx0 >> 3;
       v6 = (AIDirection *)pActors[v8].vPosition.x;
@@ -2152,7 +2152,7 @@
     }
     else
     {
-      if ( (edx0 & 7) == 4 )
+      if ( (edx0 & 7) == OBJECT_Player)
       {
         v6 = (AIDirection *)pParty->vPosition.x;
         v7 = (AIDirection *)pParty->vPosition.y;
@@ -2176,7 +2176,7 @@
       v13 = 0;
       if ( !arg0 )
       {
-        v14 = Actor::GetDirectionInfo(8 * v24 | 3, a2, &a3, 0);
+        v14 = Actor::GetDirectionInfo(8 * v24 | OBJECT_Actor, a2, &a3, 0);
         v12 = &v20;
         memcpy(&v20, v14, sizeof(v20));
         v13 = 0;
@@ -2542,7 +2542,7 @@
   v22 = uActorID;
   v3 = &pActors[uActorID];
   a2 = edx0;
-  if ( (edx0 & 7) == 3 )
+  if ( (edx0 & 7) == OBJECT_Actor)
   {
     v6 = edx0 >> 3;
     v4 = (AIDirection *)pActors[v6].vPosition.x;
@@ -2551,7 +2551,7 @@
   }
   else
   {
-    if ( (edx0 & 7) == 4 )
+    if ( (edx0 & 7) == OBJECT_Player)
     {
       v4 = (AIDirection *)pParty->vPosition.x;
       v5 = (AIDirection *)pParty->vPosition.y;
@@ -2573,7 +2573,7 @@
     v10 = 0;
     if ( !pDir )
     {
-      v11 = Actor::GetDirectionInfo(8 * v22 | 3, a2, &a3, 0);
+      v11 = Actor::GetDirectionInfo(8 * v22 | OBJECT_Actor, a2, &a3, 0);
       v9 = &v18;
       memcpy(&v18, v11, sizeof(v18));
       v10 = 0;
@@ -2654,7 +2654,7 @@
   v22 = uActorID;
   v3 = &pActors[uActorID];
   a2 = edx0;
-  if ( (edx0 & 7) == 3 )
+  if ( (edx0 & 7) == OBJECT_Actor)
   {
     v6 = edx0 >> 3;
     v4 = (AIDirection *)pActors[v6].vPosition.x;
@@ -2663,7 +2663,7 @@
   }
   else
   {
-    if ( (edx0 & 7) == 4 )
+    if ( (edx0 & 7) == OBJECT_Player)
     {
       v4 = (AIDirection *)pParty->vPosition.x;
       v5 = (AIDirection *)pParty->vPosition.y;
@@ -2685,7 +2685,7 @@
     v10 = 0;
     if ( !pDir )
     {
-      v11 = Actor::GetDirectionInfo(8 * v22 | 3, a2, &a3, 0);
+      v11 = Actor::GetDirectionInfo(8 * v22 | OBJECT_Actor, a2, &a3, 0);
       v9 = &v18;
       memcpy(&v18, v11, sizeof(v18));
       v10 = 0;
@@ -2765,7 +2765,7 @@
   v21 = uActorID;
   v3 = &pActors[uActorID];
   a2 = edx0;
-  if ( (edx0 & 7) == 3 )
+  if ( (edx0 & 7) == OBJECT_Actor)
   {
     v6 = edx0 >> 3;
     v4 = (AIDirection *)pActors[v6].vPosition.x;
@@ -2774,7 +2774,7 @@
   }
   else
   {
-    if ( (edx0 & 7) == 4 )
+    if ( (edx0 & 7) == OBJECT_Player)
     {
       v4 = (AIDirection *)pParty->vPosition.x;
       v5 = (AIDirection *)pParty->vPosition.y;
@@ -2796,7 +2796,7 @@
     v10 = 0;
     if ( !pDir )
     {
-      v11 = Actor::GetDirectionInfo(8 * v21 | 3, a2, &a3, 0);
+      v11 = Actor::GetDirectionInfo(8 * v21 | OBJECT_Actor, a2, &a3, 0);
       v9 = &v17;
       memcpy(&v17, v11, sizeof(v17));
       v10 = 0;
@@ -2861,7 +2861,7 @@
   v21 = uActorID;
   v3 = &pActors[uActorID];
   a2 = edx0;
-  if ( (edx0 & 7) == 3 )
+  if ( (edx0 & 7) == OBJECT_Actor)
   {
     v6 = edx0 >> 3;
     v4 = pActors[v6].vPosition.x;
@@ -2870,7 +2870,7 @@
   }
   else
   {
-    if ( (edx0 & 7) == 4 )
+    if ( (edx0 & 7) == OBJECT_Player)
     {
       v4 = pParty->vPosition.x;
       v5 = pParty->vPosition.y;
@@ -2900,7 +2900,7 @@
     v11 = 0;
     if ( !pDir )
     {
-      v12 = Actor::GetDirectionInfo(8 * v21 | 3, a2, &a3, 0);
+      v12 = Actor::GetDirectionInfo(8 * v21 | OBJECT_Actor, a2, &a3, 0);
       v10 = &v18;
       memcpy(&v18, v12, sizeof(v18));
       v11 = 0;
@@ -3483,7 +3483,7 @@
     memcpy(&a3, Actor::GetDirectionInfo(v7, 4u, &v10, 0), sizeof(a3));
     memcpy(&v13, &a3, sizeof(v13));
     if ( MonsterStats::BelongsToSupertype(v5->pMonsterInfo.uID, MONSTER_SUPERTYPE_TREANT)
-      || (a2 & 7) == 3 && (double)(signed int)v13.uDistance < 307.2 )
+      || (a2 & 7) == OBJECT_Actor && (double)(signed int)v13.uDistance < 307.2 )
     {
       if ( !uActionLength )
         uActionLength = 256;
--- a/Actor.h	Tue Feb 12 10:17:11 2013 +0600
+++ b/Actor.h	Tue Feb 12 10:17:35 2013 +0600
@@ -40,8 +40,8 @@
 /*  361 */
 enum ACTOR_BUFF_INDEX
 {
-  ACTOR_BUFF_STONED = 0x5,
-  ACTOR_BUFF_PARALYZED = 0x6,
+  ACTOR_BUFF_STONED = 5,
+  ACTOR_BUFF_PARALYZED = 6,
 };
 
 
@@ -52,7 +52,7 @@
 enum ObjectType
 {
   OBJECT_unk0 = 0x0,
-  OBJECT_unk1 = 0x1,
+  OBJECT_BLVDoor = 0x1,
   OBJECT_Item = 0x2,
   OBJECT_Actor = 0x3,
   OBJECT_Player = 0x4,
@@ -88,16 +88,16 @@
   Fleeing = 0x7,
   Stunned = 0x8,
   Fidgeting = 0x9,
-  Interacting = 0xA,
-  Removed = 0xB,
+  Interacting = 10,
+  Removed = 11,
   AttackingRanged2 = 0xC,
   AttackingRanged3 = 0xD,
   Stoned = 0xE,
   Paralyzed = 0xF,
-  Resurrected = 0x10,
-  Summoned = 0x11,
-  AttackingRanged4 = 0x12,
-  Disabled = 0x13,
+  Resurrected = 16,
+  Summoned = 17,
+  AttackingRanged4 = 18,
+  Disabled = 19,
 };
 
 /*  265 */
--- a/AudioPlayer.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/AudioPlayer.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -870,7 +870,7 @@
           goto LABEL_184;
         }
         v76 = a3;
-        if ( (a3 & 7) == 1 )
+        if ( (a3 & 7) == OBJECT_BLVDoor)
         {
           if ( uCurrentlyLoadedLevelType != LEVEL_Indoor )
             goto LABEL_184;
@@ -890,7 +890,7 @@
           AIL_set_sample_pan(pMixerChannel5->hSample, v80);
           goto LABEL_184;
         }
-        if ( (a3 & 7) == 2 )
+        if ( (a3 & 7) == OBJECT_Item)
         {
           pLayingItem4 = &pLayingItems[a3 >> 3];
           if ( !GetSoundStrengthByDistanceFromParty(pLayingItem4->vPosition.x, pLayingItem4->vPosition.y, pLayingItem4->vPosition.z) )
@@ -898,7 +898,7 @@
         }
         else
         {
-          if ( (a3 & 7) == 3 )
+          if ( (a3 & 7) == OBJECT_Actor)
           {
             pActor3 = &pActors[a3 >> 3];
             if ( !GetSoundStrengthByDistanceFromParty(pActor3->vPosition.x, pActor3->vPosition.y, pActor3->vPosition.z) )
@@ -910,7 +910,7 @@
             AIL_set_sample_pan(pMixerChannel5->hSample, v80);
 			goto LABEL_184;
           }
-          if ( (a3 & 7) != 5 )
+          if ( (a3 & 7) != OBJECT_Decoration)
           {
 LABEL_184:
             if ( uNumRepeats )
@@ -922,7 +922,7 @@
             AIL_start_sample(v85);
             if ( sPlaybackRate )
               AIL_set_sample_playback_rate(pMixerChannel5->hSample, sPlaybackRate);
-            if ( (v76 & 7) == 4 )
+            if ( (v76 & 7) == OBJECT_Player)
               AIL_sample_ms_position(pMixerChannel5->hSample, &sLastTrackLengthMS, 0);
             return;
           }
@@ -978,7 +978,7 @@
       _4ABE55(pMixerChannel4);
       goto LABEL_150;
     }
-    if ( (a3 & 7) == 2 )
+    if ( (a3 & 7) == OBJECT_Item)
     {
       varC = 5;
       v96 = 7;
@@ -986,7 +986,7 @@
     }
     else
     {
-      if ( (a3 & 7) == 3 )
+      if ( (a3 & 7) == OBJECT_Actor)
       {
         *(float *)&varC = 0.0;
         pActor2 = &pActors[a3 >> 3];
@@ -1000,9 +1000,9 @@
           return;
         goto LABEL_123;
       }
-      if ( (a3 & 7) != 5 )
+      if ( (a3 & 7) != OBJECT_Decoration)
       {
-        if ( (a3 & 7) == 6 )
+        if ( (a3 & 7) == OBJECT_BModel)
         {
           varC = 8;
           v96 = 9;
@@ -1048,7 +1048,7 @@
     v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z;
     goto LABEL_47;
   }
-  if ( (a3 & 7) == 2 )
+  if ( (a3 & 7) == OBJECT_Item)
   {
     v22 = pAudioPlayer->uNum3DSamples;
     if ( v22 < 16 )
@@ -1065,7 +1065,7 @@
   }
   else
   {
-    if ( (a3 & 7) == 3 )
+    if ( (a3 & 7) == OBJECT_Actor)
     {
       v18 = pAudioPlayer->uNum3DSamples;
       v12 = 0;
@@ -1081,10 +1081,10 @@
       v21 = (double)v100;
       goto LABEL_47;
     }
-    if ( (a3 & 7) != 5 )
+    if ( (a3 & 7) != OBJECT_Decoration)
     {
       v13 = pAudioPlayer->uNum3DSamples;
-      if ( (a3 & 7) == 6 )
+      if ( (a3 & 7) == OBJECT_BModel)
       {
         if ( v13 >= 16 )
         {
@@ -1256,7 +1256,7 @@
       AIL_set_3D_sample_loop_count(*(int *)v42, v86);
       if ( PartyX == -1 )
       {
-        if ( (a3 & 7) == 1 )
+        if ( (a3 & 7) == OBJECT_BLVDoor)
         {
           if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
           {
@@ -1306,13 +1306,13 @@
           }
           return;
         }
-        if ( (a3 & 7) == 2 )
+        if ( (a3 & 7) == OBJECT_Item)
         {
           pLayingItem2 = &pLayingItems[a3 >> 3];
         }
         else
         {
-          if ( (a3 & 7) == 3 )
+          if ( (a3 & 7) == OBJECT_Actor)
           {
             pActor = &pActors[a3 >> 3];
             v46 = pActor->vPosition.y;
@@ -1322,7 +1322,7 @@
             v47 = (double)uNumRepeatsb;
             goto LABEL_101;
           }
-          if ( (a3 & 7) != 5 )
+          if ( (a3 & 7) != OBJECT_Decoration)
           {
             pRenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x;
             v43 = (double)pParty->vPosition.y;
@@ -1603,7 +1603,7 @@
         while ( 1 )
         {
           v31 = v30->dword_000004;
-          if ( (v30->dword_000004 & 7) == 1 )
+          if ( (v30->dword_000004 & 7) == OBJECT_BLVDoor)
           {
             if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
             {
@@ -1633,12 +1633,12 @@
           }
           else
           {
-            if ( (v30->dword_000004 & 7) == 2 )
+            if ( (v30->dword_000004 & 7) == OBJECT_Item)
             {
               v32 = &pLayingItems[v31 >> 3];
               goto LABEL_53;
             }
-            if ( (v30->dword_000004 & 7) == 3 )
+            if ( (v30->dword_000004 & 7) == OBJECT_Actor)
             {
               v33 = &pActors[v31 >> 3];
               v34 = GetSoundStrengthByDistanceFromParty(v33->vPosition.x, v33->vPosition.y, v33->vPosition.z);
--- a/GUIWindow.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/GUIWindow.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -978,7 +978,7 @@
   LoadSpellbook(pPlayer->pNumSpellBookPage);
   v3 = 0;
   a2 = 0;
-  v7 = (int)(&pPlayer->spellbook.pFireSpellbook + pPlayer->pNumSpellBookPage);
+  v7 = (int)&pPlayer->spellbook.pChapters[pPlayer->pNumSpellBookPage];
   do
   {
     if ( *(char *)(v7 + v3) )
--- a/Game.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/Game.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -50,10 +50,10 @@
 //----- (0044103C) --------------------------------------------------------
 void Game::Draw()
 {
-  float v2; // ST24_4@11
+  //float v2; // ST24_4@11
   //double v3; // ST28_8@11
   int v4; // edi@26
-  int v5; // eax@35
+  //int v5; // eax@35
 
   uFlags2 &= 0xFFFFFFFDu;
   if ( pParty->_497FC5_check_party_perception_against_level() )
@@ -96,7 +96,7 @@
     {
       if ( pRenderer->pRenderD3D )
       {
-        v2 = (double)(((signed int)pMiscTimer->uTotalGameTimeElapsed >> 2) & 0x1F) * 0.032258064 * 6.0;
+        float v2 = (double)(((signed int)pMiscTimer->uTotalGameTimeElapsed >> 2) & 0x1F) * 0.032258064 * 6.0;
         //v3 = v2 + 6.7553994e15;
         //pRenderer->field_1036A8_bitmapid = LODWORD(v3);
         pRenderer->field_1036A8_bitmapid = floorf(v2 + 0.5f);
@@ -121,8 +121,8 @@
   pRenderer->BeginScene();
   if (pRenderer->pRenderD3D)
     pMouse->DrawCursorToTarget();
-  if (pOtherOverlayList->field_3EC)
-    viewparams->bRedrawGameUI = 1;
+  if (pOtherOverlayList->bRedraw)
+    viewparams->bRedrawGameUI = true;
   v4 = viewparams->bRedrawGameUI;
   GameUI_DrawStatusBar();
   if (!viewparams->bRedrawGameUI)
@@ -140,15 +140,17 @@
     GameUI_DrawMinimap(488, 16, 625, 133, viewparams->uMinimapZoom, pParty->uFlags & 2);
     if (v4)
     {
-      if ( !sub_4226C2() && pRenderer->pRenderD3D)
+      if ( !sub_4226C2() && pRenderer->pRenderD3D) // clear game viewport with transparent color
         pRenderer->FillRectFast(pViewport->uViewportX, pViewport->uViewportY, pViewport->uViewportZ - pViewport->uViewportX,
-          pViewport->uViewportW - pViewport->uViewportY + 1, pRenderer->uTargetGMask | pRenderer->uTargetBMask);//0x0000FFFF/*pRenderer->uTargetGMask | pRenderer->uTargetBMask*/ - white window
+                                pViewport->uViewportW - pViewport->uViewportY + 1,
+                                pRenderer->uTargetGMask | pRenderer->uTargetBMask);
       viewparams->field_48 = 0;
     }
   }
-  v5 = pOtherOverlayList->field_3EC;
-  pOtherOverlayList->field_3EC = 0;
-  viewparams->bRedrawGameUI = v5;
+
+  viewparams->bRedrawGameUI = pOtherOverlayList->bRedraw;
+  pOtherOverlayList->bRedraw = 0;
+
   GameUI_DrawPartySpells();
   if (v4 || pParty->pHirelings[0]._anim_end_time || pParty->pHirelings[1]._anim_end_time )
     DrawHiredNPCs();
--- a/Indoor.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/Indoor.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -4221,11 +4221,11 @@
             v0->uSectorID = LOWORD(stru_721530.uSectorID);
             stru_721530.field_70 += stru_721530.field_7C;
             v37 = v36 >> 3;
-            if ( (v36 & 7) != 3 )
+            if ( (v36 & 7) != OBJECT_Actor)
             {
-              if ( (v36 & 7) != 4 )
+              if ( (v36 & 7) != OBJECT_Player)
               {
-                if ( (v36 & 7) == 5 )
+                if ( (v36 & 7) == OBJECT_Decoration)
                 {
                   _this = sub_452A9E(v0->vVelocity.x * v0->vVelocity.x + v0->vVelocity.y * v0->vVelocity.y);
                   v45 = stru_5C6E00->Atan2(
@@ -4242,7 +4242,7 @@
                   v0->vVelocity.y = WORD1(v48);
                   goto LABEL_119;
                 }
-                if ( (v36 & 7) == 6 )
+                if ( (v36 & 7) == OBJECT_BModel)
                 {
                   stru_721530.field_84 = v36 >> 3;
                   v38 = &pIndoor->pFaces[v37];
--- a/Keyboard.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/Keyboard.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -953,7 +953,6 @@
 //----- (0045B06E) --------------------------------------------------------
 bool Keyboard::IsShiftHeld()
 {
-
   if (bUsingAsynKeyboard)
   {
     if ( pAsyncKeyboard->_45B4EC(0x2Au) )
--- a/Outdoor.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/Outdoor.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -126,17 +126,20 @@
     pOutdoor->_47EF60(v5, v4, 1);
   }
   pGame->uFlags2 &= 0xFFFFFFFEu;
-  if ( pRenderer->pRenderD3D && pRenderer->bUsingSpecular )
+  if (pRenderer->pRenderD3D && pRenderer->bUsingSpecular)
     pGame->pLightmapBuilder->uFlags |= 1u;
   else
     pGame->pLightmapBuilder->uFlags &= 0xFFFFFFFEu;
+
   uNumDecorationsDrawnThisFrame = 0;
   _unused000 = 0;
   uNumSpritesDrawnThisFrame = 0;
   uNumBillboardsToDraw = 0;
-  DrawActors();
-  if ( !pOutdoorCamera->bDoNotRenderDecorations )
+
+  PrepareActorsDrawList();
+  if (!pOutdoorCamera->bDoNotRenderDecorations)
     pRenderer->DrawDecorations();
+
   pRenderer->DrawLayingItems_Shooting_Magic_ODM();
   pRenderer->TransformBillboardsAndSetPalettesODM();//Ritor1: do comment to test
   sub_485F53((Vec2_int_ *)unnamed_6BE060);
@@ -2894,16 +2897,16 @@
 }
 
 //----- (0047B42C) --------------------------------------------------------
-unsigned int OutdoorLocation::DrawActors()
+void OutdoorLocation::PrepareActorsDrawList()
 {
   unsigned int result; // eax@1
-  Actor *v1; // edi@2
-  __int16 v2; // ax@3
-  int v3; // esi@5
+  //Actor *v1; // edi@2
+  //__int16 v2; // ax@3
+  int z; // esi@5
   float v4; // ST48_4@8
-  double v5; // ST38_8@8
-  float v6; // ST48_4@10
-  double v7; // ST30_8@10
+  //double v5; // ST38_8@8
+  //float v6; // ST48_4@10
+  //double v7; // ST30_8@10
   unsigned int v8; // eax@11
   int v9; // edx@11
   __int16 v10; // dx@11
@@ -2925,7 +2928,7 @@
   int v26; // ST54_4@45
   int v27; // ecx@45
   RenderBillboard *v28; // esi@45
-  __int16 v29; // ax@46
+  //__int16 v29; // ax@46
   unsigned __int8 v30; // zf@46
   unsigned __int8 v31; // sf@46
   signed __int16 v32; // ax@49
@@ -2933,8 +2936,8 @@
   int v34; // ecx@54
   MonsterDesc *v35; // edx@54
   int v36; // ecx@54
-  unsigned __int8 v37; // zf@54
-  unsigned __int8 v38; // sf@54
+  //unsigned __int8 v37; // zf@54
+  //unsigned __int8 v38; // sf@54
   unsigned int v39; // [sp-8h] [bp-68h]@23
   unsigned int v40; // [sp-4h] [bp-64h]@23
   int v41; // [sp+24h] [bp-3Ch]@11
@@ -2950,70 +2953,64 @@
   int v51; // [sp+34h] [bp-2Ch]@41
   int v52; // [sp+34h] [bp-2Ch]@50
   int v53; // [sp+38h] [bp-28h]@36
-  int v54; // [sp+3Ch] [bp-24h]@2
+  //int v54; // [sp+3Ch] [bp-24h]@2
   int y; // [sp+40h] [bp-20h]@5
   int x; // [sp+44h] [bp-1Ch]@5
   int v57; // [sp+48h] [bp-18h]@45
   int v58; // [sp+4Ch] [bp-14h]@45
-  signed int v59; // [sp+50h] [bp-10h]@1
+  //signed int v59; // [sp+50h] [bp-10h]@1
   int X; // [sp+54h] [bp-Ch]@36
-  __int16 v61; // [sp+58h] [bp-8h]@5
+  //__int16 v61; // [sp+58h] [bp-8h]@5
   signed __int16 v62; // [sp+5Ch] [bp-4h]@25
 
-  result = 0;
-  v59 = 0;
-  if ( (signed int)uNumActors > 0 )
+  //result = 0;
+  //v59 = 0;
+  for (int i = 0; i < uNumActors; ++i)
   {
-    v54 = 0;
-    v1 = pActors;//[0].vPosition.z;
-    do
-    {
-	  v2 = v1->uAIState;
-	  v1->uAttributes &= 0xFFFFFFF7u;
-      if ( v2 == 11 || v2 == 19 )
-        goto LABEL_58;
-	  v3 = v1->vPosition.z;
+    //v54 = 0;
+    //v1 = pActors;//[0].vPosition.z;
+    //do
+    //{
+    auto actor = pActors + i;
+	  //v2 = actor->uAIState;
+
+	actor->uAttributes &= 0xFFFFFFF7u;
+    if (actor->uAIState == Removed || actor->uAIState == Disabled)
+      continue;
+
+	  z = actor->vPosition.z;
       v49 = 0;
-	  x = v1->vPosition.x;
-	  y = v1->vPosition.y;
-	  v61 = v1->vPosition.z;
-      if ( v2 == 17 )
+	  x = actor->vPosition.x;
+	  y = actor->vPosition.y;
+      if (actor->uAIState == Summoned)
       {
-		if ( (v1->uSummonerID & 7) != 3 || pActors[v1->uSummonerID >> 3].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 )
+		if ((actor->uSummonerID & 7) != OBJECT_Actor ||
+             pActors[actor->uSummonerID >> 3].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 )
         {
-			v6 = (double)v1->uActorHeight * 0.5;
-          v7 = v6 + 6.7553994e15;
-          v3 += LODWORD(v7);
-          v61 = v3;
+          z += floorf(actor->uActorHeight * 0.5f + 0.5f);
         }
         else
         {
           v49 = 1;
-		  pGame->pStru6Instance->_4A7F74(v1->vPosition.x, v1->vPosition.y, v3);
-          v4 = (1.0 - (double)*(signed int *)(v1 + 38) / (double)*((short *)v1 + 7))
-			  * (double)(2 * (signed int)v1->uActorHeight);
-          v5 = v4 + 6.7553994e15;
-          v3 -= LODWORD(v5);
-          v61 = v3;
-          if ( v3 > v1->vPosition.z )
-          {
-            v61 = v1->vPosition.z;
-            v3 = v1->vPosition.z;
-          }
+		  pGame->pStru6Instance->_4A7F74(actor->vPosition.x, actor->vPosition.y, z);
+          v4 = (1.0 - (double)actor->uCurrentActionTime / (double)actor->uCurrentActionLength) *
+			   (double)(2 * actor->uActorHeight);
+          z -= floorf(v4 + 0.5f);
+          if ( z > actor->vPosition.z )
+            z = actor->vPosition.z;
         }
       }
-      v8 = stru_5C6E00->Atan2(
-             v1->vPosition.x - pIndoorCamera->pos.x,
-             v1->vPosition.y - pIndoorCamera->pos.y);
-	  LOWORD(v9) = v1->uYawAngle;
+      v8 = stru_5C6E00->Atan2(actor->vPosition.x - pIndoorCamera->pos.x,
+                              actor->vPosition.y - pIndoorCamera->pos.y);
+	  LOWORD(v9) = actor->uYawAngle;
       v41 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v9 - v8) >> 8) & 7;
-	  v10 = v1->uCurrentActionAnimation;
+	  v10 = actor->uCurrentActionAnimation;
       if ( pParty->bTurnBasedModeOn )
       {
         if ( v10 != 1 )
         {
 LABEL_17:
-			v12 = v1->uCurrentActionTime;
+			v12 = actor->uCurrentActionTime;
           goto LABEL_18;
         }
         v11 = pMiscTimer->uTotalGameTimeElapsed;
@@ -3024,11 +3021,11 @@
           goto LABEL_17;
         v11 = pEventTimer->uTotalGameTimeElapsed;
       }
-      v12 = v54 + v11;
+      v12 = 32 * i + v11;
 LABEL_18:
-      if ( (signed __int64)v1->pActorBuffs[5].uExpireTime > 0 || (signed __int64)v1->pActorBuffs[6].uExpireTime > 0 )
+      if ( (signed __int64)actor->pActorBuffs[5].uExpireTime > 0 || (signed __int64)actor->pActorBuffs[6].uExpireTime > 0 )
         v12 = 0;
-	  v13 = v1->uAIState;
+	  v13 = actor->uAIState;
       if ( v13 == 17 && !v49 )
       {
         v40 = v12;
@@ -3038,7 +3035,7 @@
         goto LABEL_25;
       }
       v40 = v12;
-	  v39 = v1->pSpriteIDs[v10];
+	  v39 = actor->pSpriteIDs[v10];
       if ( v13 != 16 )
         goto LABEL_24;
       v14 = pSpriteFrameTable->GetFrameBy_x(v39, v12);
@@ -3057,7 +3054,7 @@
       if ( v15->uGlowRadius )
       {
         //LOBYTE(v16) = byte_4E94D3;
-        pMobileLightsStack->AddLight(x, y, v3, 0, v15->uGlowRadius, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3);
+        pMobileLightsStack->AddLight(x, y, z, 0, v15->uGlowRadius, 0xFFu, 0xFFu, 0xFFu, byte_4E94D3);
       }
       v17 = (x - pIndoorCamera->pos.x) << 16;
       if ( pIndoorCamera->sRotationX )
@@ -3067,13 +3064,13 @@
             + ((unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16);
         v50 = (unsigned __int64)(v17 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16;
         v53 = (unsigned __int64)(v18 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16;
-        v44 = (v3 - pIndoorCamera->pos.z) << 16;
+        v44 = (z - pIndoorCamera->pos.z) << 16;
         v19 = ((unsigned __int64)(v44 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16)
             + ((unsigned __int64)(v47 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16);
         X = ((unsigned __int64)(v44 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_sine) >> 16)
           + ((unsigned __int64)(v47 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16);
         if ( v19 < 262144 || v19 > pOutdoorCamera->shading_dist_mist << 16 )
-          goto LABEL_58;
+          continue;
         v20 = v53 - v50;
         v42 = v53 - v50;
         v21 = ((unsigned __int64)(v44 * (signed __int64)pOutdoorCamera->camera_rotation_x_int_cosine) >> 16)
@@ -3086,12 +3083,12 @@
         v22 = (unsigned __int64)(v48 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16;
         X = v22 + v51;
         if ( v22 + v51 < 262144 || v22 + v51 > pOutdoorCamera->shading_dist_mist << 16 )
-          goto LABEL_58;
+          continue;
         v23 = (unsigned __int64)(((x - pIndoorCamera->pos.x) << 16)
                                * (signed __int64)pOutdoorCamera->camera_rotation_y_int_sine) >> 16;
         v20 = ((unsigned __int64)(v48 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v23;
         v42 = ((unsigned __int64)(v48 * (signed __int64)pOutdoorCamera->camera_rotation_y_int_cosine) >> 16) - v23;
-        v21 = (v3 - pIndoorCamera->pos.z) << 16;
+        v21 = (z - pIndoorCamera->pos.z) << 16;
       }
       v45 = v21;
       v24 = abs(v20);
@@ -3111,24 +3108,23 @@
         v46 = pViewport->uScreenCenterY - ((signed int)(((unsigned __int64)(v25 / X * v45) >> 16) + 32768) >> 16);
         result = uNumBillboardsToDraw;
         v28 = &pBillboardRenderList[uNumBillboardsToDraw];
-        if ( (signed int)uNumBillboardsToDraw >= 500 )
-          return result;
+        if (uNumBillboardsToDraw >= 500)
+          return;
         ++uNumBillboardsToDraw;
         ++uNumSpritesDrawnThisFrame;
-		v1->uAttributes |= 8u;
+		actor->uAttributes |= 8u;
         v28->uHwSpriteID = v15->pHwSpriteIDs[v41];
-        v29 = v15->uPaletteIndex;
         v28->uIndoorSectorID = 0;
-        v28->uPalette = v29;
+        v28->uPalette = v15->uPaletteIndex;
         v28->field_0 = (unsigned __int64)(v15->scale * (signed __int64)v58) >> 16;
-        v30 = HIDWORD(v1->pActorBuffs[3].uExpireTime) == 0;
-        v31 = SHIDWORD(v1->pActorBuffs[3].uExpireTime) < 0;
+        v30 = HIDWORD(actor->pActorBuffs[3].uExpireTime) == 0;
+        v31 = SHIDWORD(actor->pActorBuffs[3].uExpireTime) < 0;
         v28->field_4 = (unsigned __int64)(v15->scale * (signed __int64)v57) >> 16;
-        if ( v31 || v31 | v30 && LODWORD(v1->pActorBuffs[3].uExpireTime) <= 0u )
+        if ( v31 || v31 | v30 && LODWORD(actor->pActorBuffs[3].uExpireTime) <= 0u )
         {
-          if ( (signed __int64)v1->pActorBuffs[10].uExpireTime > 0i64 )
+          if ( (signed __int64)actor->pActorBuffs[10].uExpireTime > 0i64 )
           {
-            v52 = (unsigned __int64)(pGame->pStru6Instance->_4A806F(v1)
+            v52 = (unsigned __int64)(pGame->pStru6Instance->_4A806F(actor)
                                    * (signed __int64)v28->field_4) >> 16;
 LABEL_53:
             LOWORD(v27) = v43;
@@ -3137,44 +3133,42 @@
         }
         else
         {
-          v32 = v1->pActorBuffs[3].uPower;
+          v32 = actor->pActorBuffs[3].uPower;
           if ( v32 )
           {
-            v33 = v1->pActorBuffs[3].uPower;
+            v33 = actor->pActorBuffs[3].uPower;
             v28->field_0 = (unsigned __int64)(65536 / (unsigned __int16)v32 * (signed __int64)v28->field_0) >> 16;
             v52 = (unsigned __int64)(65536 / v33 * (signed __int64)v28->field_4) >> 16;
             goto LABEL_53;
           }
         }
         v28->uScreenSpaceX = v27;
+        v28->uScreenSpaceY = v46;
         v28->some_x = x;
-        v28->uScreenSpaceY = v46;
         v28->some_y = y;
-        v28->some_z = v61;
+        v28->some_z = z;
         HIWORD(v34) = HIWORD(X);
         LOWORD(v34) = 0;
         v28->uPaletteSubindex = 0;
-        v28->sZValue = v34 + (8 * v59 | 3);
-        v28->field_14 = v59;
+        v28->sZValue = v34 + (8 * i | OBJECT_Actor);
+        v28->field_14_actor_id = i;
         v35 = pMonsterList->pMonsters;
-		v36 = v1->pMonsterInfo.uID;
-        v37 = HIDWORD(v1->pActorBuffs[5].uExpireTime) == 0;
-        v38 = SHIDWORD(v1->pActorBuffs[5].uExpireTime) < 0;
+		v36 = actor->pMonsterInfo.uID;
         v28->field_1E = v62 | 0x200;
         v28->pSpriteFrame = v15;
         v28->uTintColor = *((int *)&v35[v36] - 36);
-        if ( !v38 && (!(v38 | v37) || LODWORD(v1->pActorBuffs[5].uExpireTime)) )
+        if (actor->pActorBuffs[ACTOR_BUFF_STONED].uExpireTime > 0)
           v28->field_1E = v62 | 0x200;
       }
-LABEL_58:
-      ++v59;
-      v54 += 32;
-      result = v59;
-      ++v1;
-    }
-    while ( v59 < (signed int)uNumActors );
+//LABEL_58:
+      //++v59;
+      //v54 += 32;
+      //result = v59;
+      //++v1;
+    //}
+    //while ( v59 < (signed int)uNumActors );
   }
-  return result;
+  //return result;
 }
 // 4E94D3: using guessed type char byte_4E94D3;
 // 5187E4: using guessed type int uNumSpritesDrawnThisFrame;
--- a/Outdoor.h	Tue Feb 12 10:17:11 2013 +0600
+++ b/Outdoor.h	Tue Feb 12 10:17:35 2013 +0600
@@ -140,7 +140,7 @@
   }
 
   void ExecDraw(unsigned int bRedraw);
-  unsigned int DrawActors();
+  void PrepareActorsDrawList();
   void CreateDebugLocation();
   void Release();
   bool Load(const char *pFilename, ODMFace *File, size_t a4, int thisa);
--- a/Overlays.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/Overlays.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -38,7 +38,7 @@
 {
   signed int v6; // edx@1
   OtherOverlayList *v7; // eax@1
-  signed int result; // eax@4
+  //signed int result; // eax@4
   signed int v9; // esi@6
   __int16 v10; // dx@9
   __int16 v11; // dx@11
@@ -81,9 +81,9 @@
   v7->pOverlays[0].field_6 = v11;
   v7->pOverlays[0].field_10 = a5;
   v7->pOverlays[0].field_E = a6;
-  result = 1;
-  this->field_3EC = 1;
-  return result;
+
+  bRedraw = true;
+  return true;
 }
 
 //----- (00441964) --------------------------------------------------------
--- a/Overlays.h	Tue Feb 12 10:17:11 2013 +0600
+++ b/Overlays.h	Tue Feb 12 10:17:35 2013 +0600
@@ -25,7 +25,7 @@
 struct OtherOverlayList
 {
   inline OtherOverlayList():  //----- (0045848D)
-    field_3E8(0), field_3EC(0)
+    field_3E8(0), bRedraw(false)
   {}
     
   int _4418B1(int a2, int a3, int a4, int a5);
@@ -34,7 +34,7 @@
 
   OtherOverlay pOverlays[50];
   int field_3E8;
-  int field_3EC;
+  int bRedraw;
 };
 #pragma pack(pop)
 
--- a/Party.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/Party.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -97,7 +97,7 @@
   v12 = 0;
   if ( pParty->bTurnBasedModeOn == 1 )
   {
-    if ( pTurnEngine->field_4 != 2 || (pTurnEngine->pQueue[0].uPackedID & 7) != 4 )
+    if ( pTurnEngine->field_4 != 2 || (pTurnEngine->pQueue[0].uPackedID & 7) != OBJECT_Player)
       return 0;
     v2 = pTurnEngine->pQueue[0].uPackedID >> 3;
     return v2 + 1;
--- a/Party.h	Tue Feb 12 10:17:11 2013 +0600
+++ b/Party.h	Tue Feb 12 10:17:35 2013 +0600
@@ -14,7 +14,11 @@
 
 
 /*  355 */
-enum PARTY_FLAGS_2 : __int32
+enum PARTY_FLAGS_1: __int32
+{
+  PARTY_FLAGS_1_LANDING = 0x100,
+};
+enum PARTY_FLAGS_2: __int32
 {
   PARTY_FLAGS_2_RUNNING = 0x2,
 };
@@ -174,6 +178,7 @@
   inline bool ImmolationActive()     {return pPartyBuffs[PARTY_BUFF_IMMOLATION].uExpireTime > 0;}
   inline bool ImmolationSkillLevel() {return pPartyBuffs[PARTY_BUFF_IMMOLATION].uSkill;}
   inline bool FeatherFallActive()    {return pPartyBuffs[PARTY_BUFF_FEATHER_FALL].uExpireTime > 0;}
+  inline bool Invisible()            {return pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime > 0;}
 
 
   int field_0;
--- a/Render.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/Render.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -2938,7 +2938,7 @@
 //----- (0047BACF) --------------------------------------------------------
 void Render::TransformBillboardsAndSetPalettesODM()
 {
-  int v0; // edi@1
+  //int v0; // edi@1
   char *v1; // esi@2
   unsigned int v2; // edx@3
   int v3; // eax@3
@@ -2954,7 +2954,7 @@
   int v13; // eax@14
   RenderBillboardTransform_local0 billboard; // [sp+4h] [bp-60h]@1
   int v15; // [sp+54h] [bp-10h]@13
-  int v16; // [sp+58h] [bp-Ch]@1
+  //int v16; // [sp+58h] [bp-Ch]@1
   int v17; // [sp+5Ch] [bp-8h]@2
   int v18; // [sp+60h] [bp-4h]@13
 
@@ -2966,20 +2966,22 @@
   billboard.uViewportY = pViewport->uViewportY;
   billboard.uViewportZ = pViewport->uViewportZ - 1;
   billboard.uViewportW = pViewport->uViewportW;
-  v0 = 0;
+  //v0 = 0;
   pOutdoorCamera->uNumBillboards = uNumBillboardsToDraw;
-  v16 = 0;
-  if ( (signed int)uNumBillboardsToDraw > 0 )
-  {
+
+  //v16 = 0;
+  for (int i = 0; i < uNumBillboardsToDraw; ++i)
+  {
+    auto pBillboard = pBillboardRenderList + i;
     v17 = 0;
-    v1 = (char *)&pBillboardRenderList[0].uScreenSpaceY;
-    do
-    {
-      billboard.uScreenSpaceX = *((short *)v1 - 1);
+    v1 = (char *)&pBillboardRenderList[i].uScreenSpaceY;
+    //do
+    //{
+      billboard.uScreenSpaceX = pBillboard->uScreenSpaceX;
       v2 = *((short *)v1 - 5);
-      billboard.uScreenSpaceY = *(short *)v1;
+      billboard.uScreenSpaceY = pBillboard->uScreenSpaceY;
       v3 = *((int *)v1 - 10);
-      billboard.uParentBillboardID = v0;
+      billboard.uParentBillboardID = i;
       v4 = *((int *)v1 + 1);
       billboard.field_10 = v3;
       v5 = *((int *)v1 - 9);
@@ -3022,11 +3024,11 @@
         }
       }
       v17 += 5;
-      v0 = v16 + 1;
+      //v0 = v16 + 1;
       v1 += 52;
-      ++v16;
-    }
-    while ( v16 < (signed int)uNumBillboardsToDraw );
+      //++v16;
+    //}
+    //while ( v16 < (signed int)uNumBillboardsToDraw );
   }
 }
 
--- a/Render.h	Tue Feb 12 10:17:11 2013 +0600
+++ b/Render.h	Tue Feb 12 10:17:35 2013 +0600
@@ -57,7 +57,7 @@
   float fov_x;
   float fov_y;
   int sZValue;
-  int field_14;
+  int field_14_actor_id;
   unsigned __int16 uHwSpriteID;
   __int16 uPalette;
   __int16 uIndoorSectorID;
--- a/Spells.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/Spells.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -51,7 +51,7 @@
   if ( v2 )
   {
     ((OtherOverlay *)&stru_5E4C90._decor_events[20 * v2 + 105])->Reset();
-    pOtherOverlayList->field_3EC = 1;
+    pOtherOverlayList->bRedraw = true;
     v1->uOverlayID = 0;
   }
 }
@@ -100,7 +100,7 @@
       if ( (unsigned __int16)v8 != a5 )
       {
         ((OtherOverlay *)&stru_5E4C90._decor_events[20 * v8 + 105])->Reset();
-        pOtherOverlayList->field_3EC = 1;
+        pOtherOverlayList->bRedraw = true;
         v6->uOverlayID = 0;
       }
     }
--- a/mm7_1.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/mm7_1.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -4395,7 +4395,7 @@
     v5 = rand() % 4;
     v6 = dword_5B5920 >> 3;
     v35 = v5;
-    if ( (dword_5B5920 & 7) == 5 )
+    if ( (dword_5B5920 & 7) == OBJECT_Decoration)
     {
       v16 = v6;
       v14 = pLevelDecorations[v6].vPosition.x;
@@ -4405,7 +4405,7 @@
     }
     else
     {
-      if ( (dword_5B5920 & 7) != 6 )
+      if ( (dword_5B5920 & 7) != OBJECT_BModel)
         goto LABEL_12;
       if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
       {
@@ -5052,7 +5052,7 @@
           uLastPointedObjectID = pMouse->uPointingObjectID;
           return;
         }
-        if ( (v18 & 7) == 6 )                   // bmodel
+        if ( (v18 & 7) == OBJECT_BModel)
         {
           if ( v18 < (signed int)0x2000000u )
           {
@@ -5992,7 +5992,7 @@
     v1 = pMouse->GetCursorPos(&a2);
     v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v25)->y]];
   }
-  if ( (v0 & 7) == 2 )
+  if ( (v0 & 7) == OBJECT_Item)
   {
     a2.y = (signed int)(unsigned __int16)v0 >> 3;
     v21 = (signed int)(unsigned __int16)v0 >> 3;
@@ -6024,9 +6024,9 @@
     }
     goto LABEL_13;
   }
-  if ( (v0 & 7) != 3 )
-  {
-    if ( (v0 & 7) == 5 )
+  if ( (v0 & 7) != OBJECT_Actor)
+  {
+    if ( (v0 & 7) == OBJECT_Decoration)
     {
       v13 = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3];
       if ( (signed int)(((unsigned int)v0 >> 16) - pDecorationList->pDecorations[v13->uDecorationDescID].uRadius) >= 512 )
@@ -6047,7 +6047,7 @@
     }
     else
     {
-      if ( (v0 & 7) != 6 || (unsigned int)v0 >= 0x2000000 )
+      if ( (v0 & 7) != OBJECT_BModel || (unsigned int)v0 >= 0x2000000 )
         goto LABEL_13;
       v2 = (signed int)(unsigned __int16)v0 >> 3;
       if ( uCurrentlyLoadedLevelType == LEVEL_Indoor)
--- a/mm7_2.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/mm7_2.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -3249,7 +3249,7 @@
 		  do
 		  {
 			v2 = v1->uAIState;
-			if ( v1->uAIState == 5 || v2 == 11 || v2 == 19 || (v3 = v1->uSummonerID) != 0 && (v3 & 7) == 4 )
+			if ( v1->uAIState == Dead || v2 == Removed || v2 == Disabled || (v3 = v1->uSummonerID) != 0 && (v3 & 7) == OBJECT_Player)
 			  ++v0;
 			++v1;
 			--v7;
@@ -15598,7 +15598,7 @@
         }
         while ( v6 < v22 );
       }
-      if ( (v7 & 7) == 5 )
+      if ( (v7 & 7) == OBJECT_Decoration)
       {
         v16 = (unsigned int)v7 >> 3;
         if ( (signed int)(((unsigned int)*v21 >> 16)
@@ -15697,7 +15697,7 @@
   v2 = a1;
   switch ( a1 & 7 )
   {
-    case 2:
+    case OBJECT_Item:
       v17 = a1 >> 3;
       v26 = a1 >> 3;
       v18 = a1 >> 3;
@@ -15730,7 +15730,8 @@
       }
       LayingItem::_42F933(v21);
       break;
-    case 3:
+
+    case OBJECT_Actor:
       v12 = a1 >> 3;
       v13 = &pActors[a1 >> 3];
       v14 = v13->uAIState;
@@ -15772,7 +15773,8 @@
         }
       }
       break;
-    case 5:
+
+    case OBJECT_Decoration:
       v8 = &pLevelDecorations[a1 >> 3];
       v9 = v8->field_16_event_id;
       if ( v9 )
@@ -15792,10 +15794,11 @@
         _5C3420_pDecoration = 0;
       }
       break;
+
     default:
-      if ( (a1 & 7) != 6 )
-      {
-    MessageBoxW(nullptr, L"Warning: Invalid ID reached!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Mouse.cpp:2020", 0);
+      if ( (a1 & 7) != OBJECT_BModel)
+      {
+        MessageBoxW(nullptr, L"Warning: Invalid ID reached!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Mouse.cpp:2020", 0);
         return 1;
       }
       if ( uCurrentlyLoadedLevelType != LEVEL_Indoor )
@@ -15866,7 +15869,7 @@
           v6 = ((v12 - v4 - 1) >> 1) + 1;
           do
           {
-            if ( (*(char *)v5 & 7) == 3 )
+            if ( (*(char *)v5 & 7) == OBJECT_Actor)
             {
               if ( *v5 <= a3 << 16 )
               {
@@ -15937,7 +15940,7 @@
       v3 = pRenderer->GetParentBillboardID(a1a);
       v4 = pBillboardRenderList[v3].sZValue;
       v5 = (unsigned __int16)pBillboardRenderList[v3].sZValue;
-      if ( (v5 & 7) == 3 )
+      if ( (v5 & 7) == OBJECT_Actor)
       {
         if ( v4 <= (unsigned int)(a3 << 16) )
         {
@@ -16196,7 +16199,7 @@
   {
     v19 = dword_720020_zvalues[v18] & 0xFFFF;
     v20 = (dword_720020_zvalues[v18] & 0xFFFFu) >> 3;
-    if ( (dword_720020_zvalues[v18] & 7) == 2 )
+    if ( (dword_720020_zvalues[v18] & 7) == OBJECT_Item)
     {
       if ( v20 >= 0x3E8 )
         return 0;
@@ -16209,16 +16212,16 @@
       }
       goto LABEL_41;
     }
-    if ( (dword_720020_zvalues[v18] & 7) == 3 )
+    if ( (dword_720020_zvalues[v18] & 7) == OBJECT_Actor)
     {
       if ( v20 >= 0xBB8 )
         return 0;
       v24 = (const char *)&pActors[v20];
       goto LABEL_51;
     }
-    if ( (dword_720020_zvalues[v18] & 7) == 5 )
+    if ( (dword_720020_zvalues[v18] & 7) == OBJECT_Decoration)
       break;
-    if ( (dword_720020_zvalues[v18] & 7) == 6 )
+    if ( (dword_720020_zvalues[v18] & 7) == OBJECT_BModel)
     {
       if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
       {
@@ -16550,14 +16553,14 @@
   v3 = &pObjectList->pObjects[v2->uObjectDescID];
   v145 = a2;
   v151 = a2 & 7;
-  if ( (a2 & 7) == 3 )
-  {
-    if ( (v2->field_58 & 7) == 3 && !pActors[v2->field_58 >> 3].GetActorsRelation(&pActors[a2 >> 3]) )
+  if ( (a2 & 7) == OBJECT_Actor)
+  {
+    if ( (v2->field_58 & 7) == OBJECT_Actor && !pActors[v2->field_58 >> 3].GetActorsRelation(&pActors[a2 >> 3]) )
       return 1;
   }
   else
   {
-    if ( (a2 & 7) == 4 && (v2->field_58 & 7) == 4 )
+    if ( (a2 & 7) == OBJECT_Player && (v2->field_58 & 7) == OBJECT_Player)
       return 1;
   }
   if ( pParty->bTurnBasedModeOn == 1 )
@@ -16569,7 +16572,7 @@
       v2->uAttributes = v5 & 0xFFFB;
     }
   }
-  if ( v151 == 6 && (v2->field_58 & 7) != 4 )
+  if ( v151 == OBJECT_BModel && (v2->field_58 & 7) != OBJECT_Player)
     BYTE2(pActors[v2->field_58 >> 3].uAttributes) |= 4u;
   v6 = v2->uItemType;
   v7 = v2->uItemType;
@@ -16626,7 +16629,7 @@
             break;
         }
         v138 = 1;
-        if ( v151 != 3 )
+        if ( v151 != OBJECT_Actor)
         {
           if ( v6 != 9030 || v2->field_50 != 4 )
             goto LABEL_246;
--- 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;
--- a/mm7_4.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/mm7_4.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -1265,7 +1265,7 @@
             do
             {
               v4 = *v3;
-              if ( (v4 & 7) == 5 )
+              if ( (v4 & 7) == OBJECT_Decoration)
               {
                 v5 = &pLevelDecorations[(signed __int16)v4 >> 3];
                 if ( !(v5->field_2 & 0x20) )
@@ -3235,7 +3235,7 @@
   {
     if ( pTurnEngine->field_4 != 1 )
     {
-      if ( (pTurnEngine->pQueue[0].uPackedID & 7) == 4 )
+      if ( (pTurnEngine->pQueue[0].uPackedID & 7) == OBJECT_Player)
       {
         //v14 = 0;
         if ( pTurnEngine->uActorQueueSize > 0 )
@@ -3245,7 +3245,7 @@
           {
             auto pElem = pTurnEngine->pQueue + i;
 
-            if ( (pElem->uPackedID & 7) != 4 )
+            if ( (pElem->uPackedID & 7) != OBJECT_Player)
               break;
             v16 = dword_5079D0;
             if ( pParty->uFlags & 0x10 )
--- a/mm7_5.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/mm7_5.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -5221,7 +5221,7 @@
   v61 = 0;
   v59 = 0;
   v62 = 0;
-  if ( (a1 & 7) == 2 )
+  if ( (a1 & 7) == OBJECT_Item)
   {
     v4 = &pLayingItems[a1 >> 3];
     uDamageAmount = (int)v4;
@@ -6302,7 +6302,7 @@
   a2 = uObjID;
   if ( !pActors[uActorID].IsAlive() )
   {
-    if ( (a2 & 7) == 2 )
+    if ( (a2 & 7) == OBJECT_Item)
     {
       v4 = &pLayingItems[(signed int)a2 >> 3];
       v5 = v4->field_48;
@@ -6361,7 +6361,7 @@
   v4 = 0;
   uActorID = a2;
   v17 = a1;
-  if ( (a1 & 7) == 2 )
+  if ( (a1 & 7) == OBJECT_Item)
   {
     v5 = &pLayingItems[a1 >> 3];
     v4 = v5->field_60_distance_related_prolly_lod;
@@ -9446,7 +9446,7 @@
     while ( 1 )
     {
       v5 = v16->uPackedID;
-      if ( (v16->uPackedID & 7) == 4 )
+      if ( (v16->uPackedID & 7) == OBJECT_Player)
         break;
 LABEL_8:
       ++v17;
@@ -9489,7 +9489,7 @@
         v8 = v1->pQueue;
         do
         {
-          if ( (v8->uPackedID & 7) == 3 && ai_array_4F7DB0_actor_ids[v20] == v8->uPackedID >> 3 )
+          if ( (v8->uPackedID & 7) == OBJECT_Actor && ai_array_4F7DB0_actor_ids[v20] == v8->uPackedID >> 3 )
             break;
           ++v18;
           ++v8;
@@ -9568,7 +9568,7 @@
   _404544();
   v2 = v1->pQueue;
   v3 = 0;
-  if ( (v1->pQueue[0].uPackedID & 7) == 4 )
+  if ( (v1->pQueue[0].uPackedID & 7) == OBJECT_Player)
     uActiveCharacter = (v1->pQueue[0].uPackedID >> 3) + 1;
   else
     uActiveCharacter = 0;
@@ -9587,7 +9587,7 @@
     goto LABEL_27;
   do
   {
-    if ( (v2->uPackedID & 7) != 4 )
+    if ( (v2->uPackedID & 7) != OBJECT_Player)
     {
       v5 = &pActors[v2->uPackedID >> 3];
       LOWORD(v6) = v5->uAIState;
@@ -9645,7 +9645,7 @@
     v9 = v1->pQueue;
     do
     {
-      if ( (v9->uPackedID & 7) != 4 )
+      if ( (v9->uPackedID & 7) != OBJECT_Player)
       {
         v10 = v9->uPackedID >> 3;
         v11 = pActors[v10].uAIState;
@@ -9697,7 +9697,7 @@
   v4 = v1->pQueue[0].field_4;
   if ( v4 )
   {
-    if ( (v1->pQueue[0].uPackedID & 7) == 4 )
+    if ( (v1->pQueue[0].uPackedID & 7) == OBJECT_Player)
     {
       v5 = v1->uActorQueueSize;
       while ( 1 )
@@ -9778,7 +9778,7 @@
 
   v2 = this;
   v3 = *(&this->field_0 + 4 * (a2 + 2));
-  if ( (*((char *)&this->field_0 + 16 * (a2 + 2)) & 7) == 4 )
+  if ( (*((char *)&this->field_0 + 16 * (a2 + 2)) & 7) == OBJECT_Player)
   {
     v4 = v3 >> 3;
     v5 = (char *)&pParty->pTurnBasedPlayerRecoveryTimes[v3 >> 3];
@@ -9796,7 +9796,7 @@
   }
   v2->pQueue[a2].field_4 = v6;
   v2->_404544();
-  if ( (v2->pQueue[0].uPackedID & 7) == 4 )
+  if ( (v2->pQueue[0].uPackedID & 7) == OBJECT_Player)
     uActiveCharacter = (v2->pQueue[0].uPackedID >> 3) + 1;
   else
     uActiveCharacter = 0;
@@ -9844,11 +9844,11 @@
     {
       if ( !*(int *)v1 )
       {
-        if ( (*(v1 - 4) & 7) == 4 )
+        if ( (*(v1 - 4) & 7) == OBJECT_Player)
           return;
         v2 = &pActors[*((int *)v1 - 1) >> 3];
         v3 = v2->uAIState;
-        if ( !v3 || v3 == 9 || v3 == 7 )
+        if (v3 == Standing || v3 == Fleeing || v3 == Fidgeting)
         {
           v4 = pMonsterStats->pInfos[v2->pMonsterInfo.uID].uRecoveryTime;
           *(int *)v1 = v4;
@@ -9875,7 +9875,7 @@
   v1 = this;
   LOWORD(v2) = _404544();
   if ( v1->pQueue[0].field_4 <= 0
-    || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, (v1->pQueue[0].uPackedID & 7) != 4) ? (uActiveCharacter = 0) : (v2 = (v2 >> 3) + 1, uActiveCharacter = v2),
+    || ((_4063A1(), v2 = v1->pQueue[0].uPackedID, (v1->pQueue[0].uPackedID & 7) != OBJECT_Player) ? (uActiveCharacter = 0) : (v2 = (v2 >> 3) + 1, uActiveCharacter = v2),
         viewparams->bRedrawGameUI = 1,
         v1->pQueue[0].field_4 <= 0) )
   {
@@ -9886,7 +9886,7 @@
       do
       {
         v2 = *(int *)v4;
-        if ( (*(char *)v4 & 7) == 4 || *(int *)(v4 + 4) > 0 )
+        if ( (*(char *)v4 & 7) == OBJECT_Player || *(int *)(v4 + 4) > 0 )
           break;
         if ( *(int *)(v4 + 8) <= 0 )
         {
@@ -9944,7 +9944,7 @@
   v1 = (TurnBased_QueueElem *)((char *)this + 16 * (a2 + 2));
   v28 = v1;
   v3 = v1->uPackedID;
-  if ( (v1->uPackedID & 7) != 4 )
+  if ( (v1->uPackedID & 7) != OBJECT_Player)
   {
     v4 = v3 >> 3;                               // turn based only stuff
     a2a = dword_4F6E08[v3 >> 3];
@@ -10108,7 +10108,7 @@
           v9 = 0;
           v20 = 0;
         }
-        if ( (v22 & 7) == 3 )
+        if ( (v22 & 7) == OBJECT_Actor)
           v10 = (unsigned __int8)*(&byte_5C8D1A[89
                                               * (pMonsterStats->pInfos[pActors[v22 >> 3].pMonsterInfo.uID].uID - 1)
                                               / 3]
@@ -10241,7 +10241,7 @@
     while ( 1 )
     {
       v5 = v10->uPackedID;
-      if ( (v10->uPackedID & 7) == 3 )
+      if ( (v10->uPackedID & 7) == OBJECT_Actor)
       {
         v8 = dword_4F6E08[v5 >> 3];
         memcpy(&v7, Actor::GetDirectionInfo(v5, v8, &a3, v2), sizeof(v7));
@@ -10280,7 +10280,7 @@
     v2 = this->pQueue;
     do
     {
-      if ( (v2->uPackedID & 7) == 3 )
+      if ( (v2->uPackedID & 7) == OBJECT_Actor)
       {
         v3 = v2->uPackedID >> 3;
         v8 = v3;
@@ -10335,7 +10335,7 @@
     {
       v4 = v14->uPackedID;
       a1 = v14->uPackedID;
-      if ( (a1 & 7) != 4 )
+      if ( (a1 & 7) != OBJECT_Player)
       {
         v5 = v4 >> 3;
         v12 = v5;
@@ -10419,7 +10419,7 @@
   unsigned int a2a; // [sp+5Ch] [bp+8h]@7
 
   v2 = *(&this->field_0 + 4 * (a2 + 2));
-  if ( (v2 & 7) == 4 )
+  if ( (v2 & 7) == OBJECT_Player)
     return 0;
   v3 = v2 >> 3;
   uActorID = v3;
@@ -10613,7 +10613,7 @@
     v14 = this->pQueue;
     do
     {
-      if ( (v3->uPackedID & 7) != 4 )
+      if ( (v3->uPackedID & 7) != OBJECT_Player)
       {
         v4 = v3->uPackedID >> 3;
         uActorID = v4;
@@ -16361,9 +16361,9 @@
       else
         v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
       v6 = (unsigned __int16)v5;
-      if ( (v6 & 7) != 2 )
-      {
-        if ( (v6 & 7) == 3 )
+      if ( (v6 & 7) != OBJECT_Item)
+      {
+        if ( (v6 & 7) == OBJECT_Actor)
         {
           if ( pRenderer->uNumSceneBegins )
           {
@@ -16493,7 +16493,7 @@
 }
 
 //----- (004175C0) --------------------------------------------------------
-void __thiscall UI_OnMouseLeftClick(int *pXY)
+void UI_OnMouseLeftClick(int *pXY)
 {
   int *pXY_; // esi@1
   signed int y; // eax@7
@@ -16600,7 +16600,7 @@
   else
     v5 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]];
   v6 = (unsigned __int16)v5;
-  if ( (v5 & 7) == 3
+  if ( (v5 & 7) == OBJECT_Actor
     && uActiveCharacter
     && v5 < 33554432
     && pPlayers[uActiveCharacter]->CanAct()
--- a/mm7_6.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/mm7_6.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -3324,7 +3324,7 @@
       v666 = v1;
     a2 = stru_50C198.FindClosesActor(5120, 1, v666);
     v6 = pMouse->uPointingObjectID;
-    if ( pMouse->uPointingObjectID != v1 && (v6 & 7) == 3 && pActors[v6 >> 3].CanAct() )
+    if ( pMouse->uPointingObjectID != v1 && (v6 & 7) == OBJECT_Actor && pActors[v6 >> 3].CanAct() )
     {
       v4 = pMouse->uPointingObjectID;
 LABEL_18:
@@ -3333,9 +3333,9 @@
     a1.uItemType = stru_4E3ACC[v3->spellnum].uItemType;
     if ( (short)a1.uItemType != (short)v1 )
     {
-      if ( (a2 & 7) == 3 )
+      if ( (a2 & 7) == OBJECT_Actor)
       {
-        memcpy(&v715, Actor::GetDirectionInfo((8 * v3->uPlayerID + 8) | 4, a2, &a3, 0), sizeof(v715));
+        memcpy(&v715, Actor::GetDirectionInfo((8 * v3->uPlayerID + 8) | OBJECT_Player, a2, &a3, 0), sizeof(v715));
         v2 = v723;
         v1 = 0;
       }
@@ -3672,7 +3672,7 @@
           goto LABEL_83;
         if ( a2 == v1 )
           goto LABEL_200;
-        if ( (a2 & 7) != 3 )
+        if ( (a2 & 7) != OBJECT_Actor)
           goto LABEL_1056;
         v699 = v1;
         v698 = v1;
@@ -3750,7 +3750,7 @@
         v47 = v38;
         goto LABEL_139;
       case 79:
-        if ( !pPlayer->CanCastSpell(uRequiredMana) || a2 == v1 || (a2 & 7) != 3 )
+        if ( !pPlayer->CanCastSpell(uRequiredMana) || a2 == v1 || (a2 & 7) != OBJECT_Actor)
           goto LABEL_83;
         v730 = a2 >> 3;
         v693 = v1;
@@ -3855,7 +3855,7 @@
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto LABEL_83;
         if ( a2 == v1
-          || (a2 & 7) != 3
+          || (a2 & 7) != OBJECT_Actor
           || (v730 = a2 >> 3,
               v721 = (int)&pActors[a2 >> 3],
               !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 9u)) )
@@ -3897,7 +3897,7 @@
         LODWORD(v733) = v57;
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto LABEL_83;
-        if ( (a2 & 7) != 3
+        if ( (a2 & 7) != OBJECT_Actor
           || (v721 = 836 * (a2 >> 3),
               LODWORD(v718) = (int)&pActors[a2 >> 3],
               !stru_50C198.GetMagicalResistance(&pActors[a2 >> 3], 3u)) )
@@ -4324,7 +4324,7 @@
 		while ( v730b <= &pParty->pPlayers[3] );
         goto LABEL_1056;
       case 52:
-        if ( pPlayer->CanCastSpell(uRequiredMana) && a2 != v1 && (a2 & 7) == 3 )
+        if ( pPlayer->CanCastSpell(uRequiredMana) && a2 != v1 && (a2 & 7) == OBJECT_Actor)
         {
           v730 = a2 >> 3;
           v112 = &pActors[a2 >> 3];
@@ -4511,7 +4511,7 @@
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto LABEL_83;
         LODWORD(v725) = a2 & 7;
-        if ( (a2 & 7) == 3 )
+        if ( (a2 & 7) == OBJECT_Actor)
         {
           v152 = a2 >> 3;
           uRequiredMana = pActors[v152].vPosition.x;
@@ -5820,7 +5820,7 @@
           v27 = (char *)&pParty->pPlayers[v3->uPlayerID_2].pPlayerBuffs[4];
           goto LABEL_104;
         }
-        if ( (v342 & 7) == 3 )
+        if ( (v342 & 7) == OBJECT_Actor)
         {
           v343 = v342 >> 3;
           HIDWORD(v344) = v1 + ((pParty->uTimePlayed + 1280) >> 32);
@@ -6211,7 +6211,7 @@
       case 59:
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto LABEL_83;
-        if ( a2 == v1 || (a2 & 7) != 3 )
+        if ( a2 == v1 || (a2 & 7) != OBJECT_Actor)
           goto LABEL_1056;
         v417 = (int)&pActors[a2 >> 3];
         v730 = v417;
@@ -6303,7 +6303,7 @@
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto LABEL_83;
         v426 = a2 >> 3;
-        if ( (a2 & 7) != 3 )
+        if ( (a2 & 7) != OBJECT_Actor)
           goto LABEL_1056;
         v730 = 836 * v426;
         if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) )
@@ -6331,7 +6331,7 @@
           goto LABEL_83;
         amount = 600 * v2;
         v427 = a2 >> 3;
-        if ( (a2 & 7) != 3 )
+        if ( (a2 & 7) != OBJECT_Actor)
           goto LABEL_1056;
         v730 = 836 * v427;
         if ( MonsterStats::BelongsToSupertype(pActors[v427].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
@@ -6464,7 +6464,7 @@
         if ( !pPlayer->CanCastSpell(uRequiredMana) )
           goto LABEL_83;
         v445 = a2 >> 3;
-        if ( (a2 & 7) == 2 )
+        if ( (a2 & 7) == OBJECT_Item)
         {
           v449 = (char *)&pLayingItems[v445].stru_24;
           v450 = *(int *)v449;
@@ -6484,15 +6484,15 @@
         }
         else
         {
-          if ( (a2 & 7) == 3 )
+          if ( (a2 & 7) == OBJECT_Actor)
           {
             stru_50C198.LootActor(&pActors[v445]);
           }
           else
           {
-            if ( (a2 & 7) != 5 )
+            if ( (a2 & 7) != OBJECT_Decoration)
             {
-              if ( (a2 & 7) != 6 )
+              if ( (a2 & 7) != OBJECT_BModel)
                 goto LABEL_1056;
               dword_507CD8 = 1;
               v677 = 1;
@@ -6607,7 +6607,7 @@
         }
         else
         {
-          if ( (v460 & 7) == 3 )
+          if ( (v460 & 7) == OBJECT_Actor)
           {
             v461 = &pActors[v460 >> 3];
             v462 = v461->uAIState;
@@ -7431,7 +7431,7 @@
           LODWORD(v733) = 29030400;
 LABEL_1082:
         v599 = a2 >> 3;
-        if ( (a2 & 7) != 3 )
+        if ( (a2 & 7) != OBJECT_Actor)
           goto LABEL_1056;
         v730 = 836 * v599;
         if ( !MonsterStats::BelongsToSupertype(pActors[v599].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) )
@@ -7916,12 +7916,12 @@
     v29 = 0;
     v28 = 0;
     v7 = pMouse->uPointingObjectID;
-    if ( (pMouse->uPointingObjectID & 7) != 3 || (v34 = pMouse->uPointingObjectID, !pActors[v7 >> 3].CanAct()) )
+    if ( (pMouse->uPointingObjectID & 7) != OBJECT_Actor || (v34 = pMouse->uPointingObjectID, !pActors[v7 >> 3].CanAct()) )
       v34 = stru_50C198.FindClosesActor(5120, 0, 0);
     a3.z = 0;
     a3.y = 0;
     a3.x = 0;
-    if ( (v34 & 7) == 3 )
+    if ( (v34 & 7) == OBJECT_Actor)
     {
       a2 = v34 >> 3;
       v8 = &pActors[v34 >> 3];
@@ -8174,7 +8174,7 @@
             {
               v22 = *v28;
               v11 = *v28 & 0xFFFF;
-              if ( (*(char *)v28 & 7) == 3 )
+              if ( (*(char *)v28 & 7) == OBJECT_Actor)
               {
                 v12 = &pActors[(unsigned int)v11 >> 3];
                 v13 = v12->uAIState;
@@ -8921,7 +8921,7 @@
       pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
   }
 
-  pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
+  //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING;
 LABEL_6:
   if ( !pEventTimer->bPaused )
   {
@@ -8949,7 +8949,7 @@
               pTurnEngine->uActionPointsLeft -= 26;
 _do_move_forward:
               v5 = pActionQueue;
-              if ( pParty->uFlags2 & 2 )
+              if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING)
                 partyAction = PARTY_RunForward;
               else
                 partyAction = PARTY_WalkForward;
@@ -9115,7 +9115,7 @@
             {
               if (pParty->bTurnBasedModeOn)
               {
-                if ( pTurnEngine->field_4 == 3 || (pTurnEngine->pQueue[0].uPackedID & 7) == 4 )
+                if ( pTurnEngine->field_4 == OBJECT_Actor || (pTurnEngine->pQueue[0].uPackedID & 7) == OBJECT_Player)
                 {
                   pParty->bTurnBasedModeOn = 0;
                   pTurnEngine->End(true);
--- a/mm7_data.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/mm7_data.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -1466,7 +1466,7 @@
 int bRingsShownInCharScreen; // weak
 int _unused000; // weak
 
-unsigned __int16 _56EFD8_minimap[117][137];
+unsigned __int16 pOdmMinimap[117][137];
 unsigned int uNumBlueFacesInBLVMinimap;
 unsigned __int16 pBlueFacesInBLVMinimapIDs[50];
 int pTextureIDs_isns[14];
--- a/mm7_data.h	Tue Feb 12 10:17:11 2013 +0600
+++ b/mm7_data.h	Tue Feb 12 10:17:35 2013 +0600
@@ -1310,7 +1310,7 @@
 extern int bRingsShownInCharScreen; // weak
 extern int _unused000; // weak
 
-extern unsigned __int16 _56EFD8_minimap[117][137];
+extern unsigned __int16 pOdmMinimap[117][137];
 extern unsigned int uNumBlueFacesInBLVMinimap;
 extern unsigned __int16 pBlueFacesInBLVMinimapIDs[50];
 extern int pTextureIDs_isns[14];
@@ -1858,7 +1858,7 @@
 void __cdecl identify_item();
 void __thiscall sub_416B01(void *_this);
 void __thiscall sub_416D62_ShowPopupWindow_MonsterRecord_ItemInfo_etcsub_416D62(struct Vec2_int_ *_this);
-void __thiscall UI_OnMouseLeftClick(int *pXY); // idb
+void UI_OnMouseLeftClick(int *pXY); // idb
 void __thiscall sub_417871(int *pXY);
 void __cdecl sub_4178C4();
 void __cdecl sub_4178E1();
@@ -2000,7 +2000,7 @@
 void Load_isn_spells_21_27();
 void GameUI_DrawPartySpells();
 __int16 __fastcall sub_441A4E(int a1);
-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 __fastcall DrawSpellbook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074); // idb
 int __cdecl Initialize2DA();
 unsigned int __fastcall LoadEventsToBuffer(const char *pContainerName, char *a2, unsigned int uBufferSize);
--- a/stru6.cpp	Tue Feb 12 10:17:11 2013 +0600
+++ b/stru6.cpp	Tue Feb 12 10:17:35 2013 +0600
@@ -595,11 +595,11 @@
 }
 
 //----- (004A7E89) --------------------------------------------------------
-int stru6::_4A7E89_sparkles_on_actor_after_it_casts_buff(Actor *pActor, unsigned int uDiffuse)
+void stru6::_4A7E89_sparkles_on_actor_after_it_casts_buff(Actor *pActor, unsigned int uDiffuse)
 {
   Actor *v3; // edi@1
   int v4; // ebx@3
-  int result; // eax@5
+  //int result; // eax@5
   Particle_ Dst; // [sp+Ch] [bp-6Ch]@1
   int v7; // [sp+74h] [bp-4h]@2
   signed int pActora; // [sp+80h] [bp+8h]@1
@@ -632,7 +632,6 @@
     --pActora;
   }
   while ( pActora );
-  return result;
 }
 
 //----- (004A7F74) --------------------------------------------------------
@@ -1633,7 +1632,7 @@
       {
         v7 = pIconsFrameTable->GetFrame(*((int *)v2 + 2), v3);
         pRenderer->DrawTextureTransparent(*v1, 0x181u, &pIcons_LOD->pTextures[v7->uTextureID]);
-        pOtherOverlayList->field_3EC = 1;
+        pOtherOverlayList->bRedraw = true;
       }
       else
       {
--- a/stru6.h	Tue Feb 12 10:17:11 2013 +0600
+++ b/stru6.h	Tue Feb 12 10:17:35 2013 +0600
@@ -128,7 +128,7 @@
   void _4A7A66_miltiple_spell_collision_partifles___like_after_sparks_or_lightning(LayingItem *a1, unsigned int uDiffuse, unsigned int uTextureID, float a4);
   void _4A7C07(struct LayingItem *a2);
   void AddProjectile(struct LayingItem *a2, int a3, unsigned int uTextureID);
-  int _4A7E89_sparkles_on_actor_after_it_casts_buff(struct Actor *pActor, unsigned int uDiffuse);
+  void _4A7E89_sparkles_on_actor_after_it_casts_buff(struct Actor *pActor, unsigned int uDiffuse);
   void _4A7F74(int x, int y, int z);
   int _4A806F(struct Actor *pActor);
   void _4A80DC_some_stuff_sw(struct LayingItem *a2);