diff mm7_3.cpp @ 783:b27dd658ea77

Taveling by foot fixed.
author Nomad
date Sun, 24 Mar 2013 21:14:28 +0200
parents c319601893af
children b3e08a496778
line wrap: on
line diff
--- a/mm7_3.cpp	Sun Mar 24 00:33:27 2013 +0200
+++ b/mm7_3.cpp	Sun Mar 24 21:14:28 2013 +0200
@@ -494,7 +494,7 @@
 
 
 //----- (0046ED1B) --------------------------------------------------------
-int _46ED1B_collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
+int collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID)
 {
   uint uFaceID = -1;
   int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID);
@@ -1503,23 +1503,23 @@
   v7 = x;
   v8 = y;
   *pSectorID = pIndoor->GetSector(x - 2, y, z + 40);
-  result = _46ED1B_collide_against_floor(v5, v8, z + 40, pSectorID, pFaceID);
+  result = collide_against_floor(v5, v8, z + 40, pSectorID, pFaceID);
   if ( result == -30000 || !*pSectorID )
   {
     *pSectorID = pIndoor->GetSector(v7 + 2, v8, z + 40);
-    result = _46ED1B_collide_against_floor(v7 + 2, v8, z + 40, pSectorID, pFaceID);
+    result = collide_against_floor(v7 + 2, v8, z + 40, pSectorID, pFaceID);
     if ( result == -30000 || !*pSectorID )
     {
       *pSectorID = pIndoor->GetSector(v7, v8 - 2, z + 40);
-      result = _46ED1B_collide_against_floor(v7, v8 - 2, z + 40, pSectorID, pFaceID);
+      result = collide_against_floor(v7, v8 - 2, z + 40, pSectorID, pFaceID);
       if ( result == -30000 || !*pSectorID )
       {
         *pSectorID = pIndoor->GetSector(v7, v8 + 2, z + 40);
-        result = _46ED1B_collide_against_floor(v7, v8 + 2, z + 40, pSectorID, pFaceID);
+        result = collide_against_floor(v7, v8 + 2, z + 40, pSectorID, pFaceID);
         if ( result == -30000 || !*pSectorID )
         {
           *pSectorID = pIndoor->GetSector(v7, v8, z + 140);
-          result = _46ED1B_collide_against_floor(v7, v8, z + 140, pSectorID, pFaceID);
+          result = collide_against_floor(v7, v8, z + 140, pSectorID, pFaceID);
         }
       }
     }
@@ -1619,7 +1619,7 @@
   v78 = 0;
   v71 = 0;
   bJumping = 0;
-  v80 = _46ED1B_collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
+  v80 = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
   if ( pParty->bFlying )
   {
     pParty->bFlying = false;
@@ -1971,7 +1971,7 @@
       uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16);
       v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16);
     }
-    v42 = _46ED1B_collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID);
+    v42 = collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID);
     if ( v42 == -30000 || v42 - new_party_z > 128 )
       return;
     if ( stru_721530.field_7C >= stru_721530.field_6C )
@@ -12420,7 +12420,7 @@
 
 
 //----- (00444C8F) --------------------------------------------------------
-GUIWindow *__cdecl UI_CreateTravelDialogue()
+void UI_CreateTravelDialogue()
 {
   //signed int v0; // eax@1
   unsigned int v1; // eax@6
@@ -12445,9 +12445,9 @@
 LABEL_6:*/
   switch (pParty->alignment)
   {
-    case PartyAlignment_Good:    sprintf(pContainer, "evt%02d-b", const_2());
-    case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2());
-    case PartyAlignment_Evil:    sprintf(pContainer, "evt%02d-c", const_2());
+    case PartyAlignment_Good:    sprintf(pContainer, "evt%02d-b", const_2()); break;
+    case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2());   break;
+    case PartyAlignment_Evil:    sprintf(pContainer, "evt%02d-c", const_2()); break;
     default: assert(false);
   }
 
@@ -12458,9 +12458,7 @@
     sprintf(sHouseName, pGlobalTXT_LocalizationStrings[410], pMapStats->pInfos[v1].pName);// "Leave %s"
   else
     strcpy(sHouseName, pGlobalTXT_LocalizationStrings[79]);// "Exit"
-  result = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, (int)sHouseName);
-  pDialogueWindow = result;
-  return result;
+  pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_ChangeLocation, 0, (int)sHouseName);
 }
 
 //----- (00444D80) --------------------------------------------------------
@@ -12488,7 +12486,6 @@
 {
   unsigned int v0; // edi@1
   MapInfo *v1; // edi@2
-  char *v2; // ST14_4@2
   signed int v3; // eax@2
   int v4; // eax@5
   const char *v5; // [sp-Ch] [bp-90h]@3
@@ -12504,17 +12501,15 @@
   pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background);
   pRenderer->DrawTextureTransparent(0x1D4u, 0, &pIcons_LOD->pTextures[uTextureID_507B04]);
   pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pTexture_outside);
-  pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, &pIcons_LOD->pTextures[uTextureID_x_x_u]);
-  pRenderer->DrawTextureIndexed(0x1DCu, 0x1C3u,
-    (Texture *)(uTextureID_x_ok_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_ok_u] : 0));
+  pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_x_u));
+  pRenderer->DrawTextureIndexed(0x1DCu, 0x1C3u, pIcons_LOD->GetTexture(uTextureID_x_ok_u));
   if ( v0 )
   {
     v1 = &pMapStats->pInfos[v0];
     v7.uFrameX = 493;
     v7.uFrameWidth = 126;
-    v2 = v1->pName;
     v7.uFrameZ = 366;
-    v7.DrawTitleText(pFontCreate, 0, 4u, 0, v2, 3u);
+    v7.DrawTitleText(pFontCreate, 0, 4u, 0, v1->pName, 3);
     v7.uFrameX = 483;
     v7.uFrameWidth = 148;
     v7.uFrameZ = 334;
@@ -12577,7 +12572,7 @@
     if ( pGUIWindow2->field_40 == 2 )
     {
       pGUIWindow2->field_40 = 0;
-      strcpy(GameUI_StatusBar_TimedString, (const char *)pKeyActionMap->pPressedKeysBuffer);
+      strcpy(GameUI_Footer_TimedString, (const char *)pKeyActionMap->pPressedKeysBuffer);
 LABEL_16:
       sub_4452BB();
       return;
@@ -12586,12 +12581,12 @@
       return;
     pGUIWindow2->field_40 = 0;
 LABEL_15:
-    memset(GameUI_StatusBar_TimedString, 0, 0xC8u);
+    memset(GameUI_Footer_TimedString, 0, 0xC8u);
     goto LABEL_16;
   }
   if ( pGUIWindow2->ptr_1C == (void *)26 )
   {
-    sprintf(Str, "%s %s", GameUI_StatusBar_TimedString, pKeyActionMap->pPressedKeysBuffer);
+    sprintf(Str, "%s %s", GameUI_Footer_TimedString, pKeyActionMap->pPressedKeysBuffer);
     v3 = pFontLucida->GetLineWidth(Str);
     pGUIWindow2->DrawText(pFontLucida, 13, 357, 0, Str, 0, 0, 0);
     pGUIWindow2->DrawFlashingInputCursor(v3 + 13, 357, pFontLucida);
@@ -13881,8 +13876,8 @@
 //----- (00448B45) --------------------------------------------------------
 void __thiscall GameUI_StatusBar_UpdateTimedString(unsigned int bForceHide)
 {
-  if ( bForceHide || GameUI_StatusBar_TimedStringTimeLeft && GetTickCount() >= GameUI_StatusBar_TimedStringTimeLeft )
-    GameUI_StatusBar_TimedStringTimeLeft = 0;
+  if ( bForceHide || GameUI_Footer_TimeLeft && GetTickCount() >= GameUI_Footer_TimeLeft )
+    GameUI_Footer_TimeLeft = 0;
 }
 
 //----- (00448B67) --------------------------------------------------------
@@ -14601,31 +14596,28 @@
 // 4EE088: using guessed type __int16 word_4EE088_sound_ids[];
 
 //----- (0044987B) --------------------------------------------------------
-char *__fastcall sub_44987B(const char *pMapName, unsigned int uStartingPointType)
+void sub_44987B(const char *pMapName, MapStartPoint start_point)
 {
   const char *v2; // edi@1
-  unsigned int v3; // ebx@1
-  char *result; // eax@3
 
   v2 = pMapName;
-  v3 = uStartingPointType;
   pAudioPlayer->StopChannels(-1, -1);
   pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_None);
   if ( _strcmpi(pCurrentMapName, v2) )
     SaveGame(1, 0);
+
   uGameState = 2;
-  result = strcpy(pCurrentMapName, v2);
-  uLevel_StartingPointType = v3;
-  return result;
+  strcpy(pCurrentMapName, v2);
+  uLevel_StartingPointType = start_point;
 }
 // 6BE35C: using guessed type int uLevel_StartingPointType;
 
 //----- (004498D5) --------------------------------------------------------
-void __thiscall TeleportToStartingPoint(unsigned int uPointType)
-{
-  unsigned int v1; // ecx@2
-  int v2; // ecx@3
-  int v3; // ecx@4
+void TeleportToStartingPoint(MapStartPoint point)
+{
+  //unsigned int v1; // ecx@2
+  //int v2; // ecx@3
+  //int v3; // ecx@4
   unsigned __int16 v4; // ax@11
   signed int v5; // ecx@12
   LevelDecoration *v6; // edx@13
@@ -14635,40 +14627,15 @@
   const char *v10; // [sp-4h] [bp-84h]@6
   char pName[128]; // [sp+8h] [bp-78h]@11
 
-  if ( uPointType )
-  {
-    v1 = uPointType - 1;
-    if ( v1 )
-    {
-      v2 = v1 - 1;
-      if ( v2 )
-      {
-        v3 = v2 - 1;
-        if ( v3 )
-        {
-          if ( v3 != 1 )
-            return;
-          v10 = "West Start";
-        }
-        else
-        {
-          v10 = "East Start";
-        }
-      }
-      else
-      {
-        v10 = "South Start";
-      }
-    }
-    else
-    {
-      v10 = "North Start";
-    }
-  }
-  else
-  {
-    v10 = "Party Start";
-  }
+  switch (point)
+  {
+    case MapStartPoint_Party: v10 = "Party Start"; break;
+    case MapStartPoint_North: v10 = "North Start"; break;
+    case MapStartPoint_South: v10 = "South Start"; break;
+    case MapStartPoint_East: v10 = "East Start";  break;
+    case MapStartPoint_West: v10 = "West Start";  break;
+  }
+
   strcpy(pName, v10);
   v4 = pDecorationList->GetDecorIdByName(pName);
   if ( v4 )
@@ -14872,18 +14839,18 @@
   int i; // eax@1
 
   v2 = uNumSeconds;
-  strcpy(GameUI_StatusBar_TimedString, pString);
-  GameUI_StatusBar_TimedStringTimeLeft = 1000 * v2 + GetTickCount();
-  for ( i = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString);
+  strcpy(GameUI_Footer_TimedString, pString);
+  GameUI_Footer_TimeLeft = 1000 * v2 + GetTickCount();
+  for ( i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString);
         i > 450;
-        i = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString) )
-    byte_5C3427[strlen(GameUI_StatusBar_TimedString)] = 0;
+        i = pFontLucida->GetLineWidth(GameUI_Footer_TimedString) )
+    byte_5C3427[strlen(GameUI_Footer_TimedString)] = 0;
 }
 
 //----- (0044C1D0) --------------------------------------------------------
 void __cdecl ShowNothingHereStatus()
 {
-  if ( !GameUI_StatusBar_TimedStringTimeLeft )
+  if ( !GameUI_Footer_TimeLeft )
     ShowStatusBarString(pGlobalTXT_LocalizationStrings[521], 2u);// Nothing here
 }
 
@@ -14910,7 +14877,7 @@
     dword_5B65BC = 0;
     dword_5B65C0 = 0;
     pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen;
-    sub_44987B("nwc.blv", 0);
+    sub_44987B("nwc.blv", MapStartPoint_Party);
     pCurrentScreen = SCREEN_GAME;
     result = 1;
   }
@@ -15392,7 +15359,7 @@
 // 4F75D8: using guessed type int ai_arrays_size;
 
 //----- (00401A91) --------------------------------------------------------
-void __cdecl sub_401A91_AI()
+void __cdecl UpdateActorAI()
 {
   //unsigned int v0; // esi@4
   int v1; // eax@7