changeset 1412:182d58b2a34c

Harmondale falling under terrain fixed
author Nomad
date Sat, 27 Jul 2013 14:28:14 +0200
parents 2423bc2af692
children 3881d2f94eb1
files GUIWindow.h Outdoor.cpp mm7_3.cpp mm7_5.cpp mm7_data.h
diffstat 5 files changed, 16 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.h	Fri Jul 26 23:35:34 2013 +0200
+++ b/GUIWindow.h	Sat Jul 27 14:28:14 2013 +0200
@@ -19,7 +19,7 @@
   UIMSG_MouseLeftClickInScreen = 14,
   UIMSG_F = 15,
 
-  UIMSG_11 = 17,
+  UIMSG_ChangeCursor = 17,
 
   UIMSG_Attack = 23,
 
--- a/Outdoor.cpp	Fri Jul 26 23:35:34 2013 +0200
+++ b/Outdoor.cpp	Sat Jul 27 14:28:14 2013 +0200
@@ -3334,6 +3334,7 @@
     odm_floor_level[0] = odm_floor_level[v27];
   return odm_floor_level[0];
 }
+
 //not sure if right- or left-handed coordinate space assumed, so this could be normal of inverse normal
 // for a right-handed system, that would be an inverse normal
 //----- (0046DCC8) --------------------------------------------------------
--- a/mm7_3.cpp	Fri Jul 26 23:35:34 2013 +0200
+++ b/mm7_3.cpp	Sat Jul 27 14:28:14 2013 +0200
@@ -5975,16 +5975,17 @@
 // 6BE3C4: using guessed type char bUnderwater;
 
 //----- (0047F44B) --------------------------------------------------------
-unsigned int __stdcall WorldPosToGridCellX(signed int sWorldPosX)
+unsigned int WorldPosToGridCellX(int sWorldPosX)
 {
-  return (sWorldPosX / 512) + 64;
+  return (sWorldPosX >> 9) + 64; // sar is in original exe, resulting -880 / 512 = -1
+                                 //                               and -880 sar 9 = -2
 }
-// 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int);
 
 //----- (0047F458) --------------------------------------------------------
-unsigned int __stdcall WorldPosToGridCellZ(signed int sWorldPosZ)
+unsigned int WorldPosToGridCellZ(int sWorldPosZ)
 {
-  return 64 - (sWorldPosZ / 512);
+  return 64 - (sWorldPosZ >> 9); // sar is in original exe, resulting -880 / 512 = -1
+                                 //                               and -880 sar 9 = -2
 }
 
 //----- (0047F469) --------------------------------------------------------
--- a/mm7_5.cpp	Fri Jul 26 23:35:34 2013 +0200
+++ b/mm7_5.cpp	Sat Jul 27 14:28:14 2013 +0200
@@ -2265,7 +2265,7 @@
           GameUI_SetFooterString(pTmpBuf.data());
           continue;
         case UIMSG_ShowFinalWindow:
-          sprintf(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer."
+          sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer."
             pGlobalTXT_LocalizationStrings[118],// "We hope that you've enjoyed playing Might and Magic VII as much as we did making it. We have saved this screen as MM7_WIN.PCX in your MM7 directory. You can print it out as proof of your accomplishment."
             pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team."   
           ModalWindow(pFinalMessage.data(), 196);
@@ -3435,7 +3435,7 @@
         case UIMSG_ChangeGameState:
           uGameState = GAME_FINISHED;
           break;
-        case UIMSG_11:
+        case UIMSG_ChangeCursor:
           pMouse->SetCursorBitmap("MICON2");
           break;
         case UIMSG_3A:
@@ -3583,6 +3583,7 @@
           break;
         case UIMSG_PlayerCreationRemoveDownSkill:
           uPlayerCreationUI_SelectedCharacter = pParam;
+          __debugbreak();
           pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7
              + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * pParam;
           pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3)
@@ -3599,13 +3600,10 @@
 //----- (00436427) --------------------------------------------------------
 double __cdecl get_shading_dist_mist()
 {
-  double result; // st7@2
-
-  if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor)
-    result = (double)pOutdoorCamera->shading_dist_mist;
+  if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
+    return (double)pOutdoorCamera->shading_dist_mist;
   else
-    result = 16192.0;
-  return result;
+    return 16192.0;
 }
 
 //----- (0043648F) --------------------------------------------------------
--- a/mm7_data.h	Fri Jul 26 23:35:34 2013 +0200
+++ b/mm7_data.h	Sat Jul 27 14:28:14 2013 +0200
@@ -1379,8 +1379,8 @@
 unsigned int GetLevelFogColor();
 int __fastcall sub_47C3D7_get_fog_related_stuff(int a1, int a2, float a3);
 signed int __fastcall GetActorTintColor(int max_dim, int min_dim, float distance, int a4, struct RenderBillboard *a5);
-unsigned int __stdcall WorldPosToGridCellX(int); // weak
-unsigned int __stdcall WorldPosToGridCellZ(int); // weak
+unsigned int WorldPosToGridCellX(int); // weak
+unsigned int WorldPosToGridCellZ(int); // weak
 int __stdcall GridCellToWorldPosX(int); // weak
 int __stdcall GridCellToWorldPosZ(int); // weak
 void __cdecl loc_48118F(); // idb