diff mm7_2.cpp @ 1052:d48c762de563

-nomarg
author Nomad
date Thu, 23 May 2013 18:26:05 +0200
parents 05c62d166182
children cbb1baa606aa
line wrap: on
line diff
--- a/mm7_2.cpp	Thu May 23 14:08:26 2013 +0200
+++ b/mm7_2.cpp	Thu May 23 18:26:05 2013 +0200
@@ -3820,33 +3820,31 @@
   MonsterDesc *v8; // edi@16
   unsigned __int16 v9; // ax@16
   int v10; // ebx@16
-  int v11; // edi@16
-  int v12; // eax@16
-  int v13; // ecx@16
-  int v14; // ebx@16
+  //int v11; // edi@16
+  //int v12; // eax@16
+  //int v13; // ecx@16
+  //int v14; // ebx@16
   const char *v15; // [sp-4h] [bp-24h]@2
-  unsigned __int16 v16; // [sp+0h] [bp-20h]@1
-  int v17; // [sp+4h] [bp-1Ch]@1
+  //unsigned __int16 v16; // [sp+0h] [bp-20h]@1
+  //int v17; // [sp+4h] [bp-1Ch]@1
   unsigned int uFaceID; // [sp+8h] [bp-18h]@16
   int v19; // [sp+Ch] [bp-14h]@16
   size_t v20; // [sp+10h] [bp-10h]@6
   int v21; // [sp+14h] [bp-Ch]@14
-  int v22; // [sp+18h] [bp-8h]@14
+  //int v22; // [sp+18h] [bp-8h]@14
   unsigned int v23; // [sp+1Ch] [bp-4h]@6
 
-  v16 = a2;
-  v17 = a1;
+  //v16 = a2;
+  //v17 = a1;
   if ( a2 == 4 )
   {
     v15 = "Elemental Light C";
   }
-  else
-  {
-    if ( a2 == 3 )
+  else if ( a2 == 3 )
       v15 = "Elemental Light B";
     else
       v15 = "Elemental Light A";
-  }
+
   v23 = pMonsterList->GetMonsterIDByName(v15);
   v3 = 0;
   v20 = uNumActors;
@@ -3855,7 +3853,7 @@
     v4 = pActors;//[0].uAIState;
     while ( v4->uAIState != Removed )
     {
-      ++v3;
+      ++v3; 
       ++v4;
       if ( v3 >= (signed int)uNumActors )
         break;
@@ -3866,7 +3864,7 @@
   if ( v20 != uNumActors || (result = uNumActors + 1, (signed int)(uNumActors + 1) < 500) )
   {
     v21 = 0;
-    v22 = pParty->vPosition.z;
+    //v22 = pParty->vPosition.z;
     if ( uCurrentlyLoadedLevelType == LEVEL_Indoor )
       v21 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
     v6 = &pActors[v20];
@@ -3886,22 +3884,21 @@
     v6->pMonsterInfo.uExp = 0;
     v6->uMovementSpeed = v9;
     v10 = rand() % 2048;
-    v11 = ((unsigned __int64)(stru_5C6E00->Cos(v10) * (signed __int64)v19) >> 16) + pParty->vPosition.x;
+    //v11 = pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v10), v19);
     uFaceID = stru_5C6E00->Sin(v10);
-    v23 = (unsigned __int64)(uFaceID * (signed __int64)v19) >> 16;
-    v12 = pParty->vPosition.y;
-    v13 = (unsigned __int64)(uFaceID * (signed __int64)v19) >> 16;
-    v6->vInitialPosition.x = v11;
-    v14 = v13 + v12;
-    LOWORD(v12) = v22;
-    v6->vInitialPosition.z = v22;
-    v6->vPosition.z = v12;
-    LOWORD(v12) = v21;
-    v6->vPosition.x = v11;
-    v6->vInitialPosition.y = v14;
-    v6->vPosition.y = v14;
+    //v12 = pParty->vPosition.y;
+    //v13 = fixpoint_sub0(uFaceID, v19);
+    //v14 = pParty->vPosition.y + fixpoint_sub0(uFaceID, v19);
+    //LOWORD(v12) = v22;
+    v6->vInitialPosition.x = pParty->vPosition.x + fixpoint_sub0(stru_5C6E00->Cos(v10), v19);
+    v6->vPosition.x = v6->vInitialPosition.x;
+    v6->vInitialPosition.y = pParty->vPosition.y + fixpoint_sub0(uFaceID, v19);
+    v6->vPosition.y = v6->vInitialPosition.y;
+    v6->vInitialPosition.z = pParty->vPosition.z;
+    v6->vPosition.z = v6->vInitialPosition.z;
+    //LOWORD(v12) = v21;
     v6->uTetherDistance = 256;
-    v6->uSectorID = v12;
+    v6->uSectorID = v21;
     v6->PrepareSprites(0);
     v6->pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Friendly;
     v6->uAlly = 9999;
@@ -3911,19 +3908,17 @@
     v6->uCurrentActionLength = 256;
     v6->UpdateAnimation();
     if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor
-      || (v22 = pParty->vPosition.z,
-          result = pIndoor->GetSector(v11, v14, pParty->vPosition.z),
+      || (result = pIndoor->GetSector(v6->vPosition.x, v6->vPosition.y, v6->vPosition.z),
           result == v21)
-      && (result = BLV_GetFloorLevel(v11, v14, v22, result, &uFaceID), result != -30000)
-      && (result = abs(result - v22), result <= 1024) )
+      && (result = BLV_GetFloorLevel(v6->vPosition.x, v6->vPosition.y, v6->vPosition.z, result, &uFaceID), result != -30000)
+      && (result = abs(result - pParty->vPosition.z), result <= 1024) )
     {
       if ( v20 == uNumActors )
         ++uNumActors;
-      v6->uSummonerID = PID(OBJECT_Player,v17);
-      result = v6->pActorBuffs[2].Apply(
-                 pParty->uTimePlayed + (signed __int64)((double)(a3 << 7) * 0.033333335),
-                 v16,
-                 v17,
+      v6->uSummonerID = PID(OBJECT_Player, a1);
+      result = v6->pActorBuffs[2].Apply(pParty->uTimePlayed + (a3 * 128) / 30.0f,
+                 a2,
+                 a1,
                  0,
                  0);
     }
@@ -7207,14 +7202,6 @@
         if ( wParam == VK_ESCAPE )
         {
           pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, window_SpeakInHouse != 0, 0);
-          /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 )
-          {
-            v12 = window_SpeakInHouse == 0;
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape;
-            pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = !v12;
-            *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0;
-            ++pMessageQueue_50CBD0->uNumMessages;
-          }*/
           return 0;
         }
         if ( wParam <= VK_HOME )
@@ -7231,7 +7218,7 @@
           SendMessageA(hWnd, WM_COMMAND, v37, v38);
           return 0;
         }
-        if ( pCurrentScreen
+        if ( pCurrentScreen != SCREEN_GAME
           && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE )
           return 0;
       }
@@ -9322,7 +9309,7 @@
   char test[1024];
   sprintfex(test, "^Pi[%s]: знахар^R[ь;ка;]", "Золтан");
 
-
+  bool bNoMargareth = false;
   if (pCmdLine && *pCmdLine)
   {
     if (wcsstr(pCmdLine, L"-usedefs"))
@@ -9349,6 +9336,8 @@
       bNoCD = true;
     if (wcsstr(pCmdLine, L"-new_sky"))
       new_sky = true;
+    if (wcsstr(pCmdLine, L"-nomarg"))
+      bNoMargareth = true;
   }
 
 
@@ -9424,6 +9413,9 @@
           bFlashQuestBook = true;
           pGame->pCShow->PlayMovie(MOVIE_Emerald, 0);
           SaveNewGame();
+
+          if (bNoMargareth)
+            _449B7E_toggle_bit(pParty->_quest_bits, PARTY_QUEST_EMERALD_MARGARETH_OFF, 1);
           pGame->Loop();
 
           if (uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU)