diff mm7_2.cpp @ 1458:934074e7fcc1

ModalWindow __thiscall and __cdecl removed Some random renames & refactors
author Nomad
date Wed, 21 Aug 2013 14:26:36 +0200
parents 5c95f2246c2a
children 2ca62c9e7b3c
line wrap: on
line diff
--- a/mm7_2.cpp	Wed Aug 14 00:40:51 2013 +0400
+++ b/mm7_2.cpp	Wed Aug 21 14:26:36 2013 +0200
@@ -296,7 +296,7 @@
 }
 
 //----- (004BBCDD) --------------------------------------------------------
-void __cdecl sub_4BBCDD()
+void  sub_4BBCDD()
 {
   signed int v0; // ebp@3
   Actor *v1; // eax@4
@@ -387,7 +387,7 @@
 }
 
 //----- (004BC109) --------------------------------------------------------
-void __cdecl ArenaFight()
+void  ArenaFight()
 {
   int v0; // edi@1
   char *v1; // eax@7
@@ -598,7 +598,7 @@
 }
 
 //----- (004BD8B5) --------------------------------------------------------
-signed int __cdecl sub_4BD8B5()
+signed int  sub_4BD8B5()
 {
   int v0; // eax@4
   int v1; // eax@29
@@ -694,7 +694,7 @@
 }
 
 //----- (004BF91E) --------------------------------------------------------
-unsigned int __thiscall GameOverMenu(void *ecx0)
+unsigned int  GameOverMenu(void *ecx0)
 {
   char *v1; // eax@2
   unsigned int result; // eax@3
@@ -1962,7 +1962,7 @@
 // 5C6DF8: using guessed type int dword_5C6DF8;
 
 //----- (00450DA3) --------------------------------------------------------
-int __cdecl GetAlertStatus()
+int  GetAlertStatus()
 {
   int result; // eax@2
 
@@ -3034,7 +3034,7 @@
 // 6BE35C: using guessed type int uLevel_StartingPointType;
 
 //----- (00461103) --------------------------------------------------------
-void __cdecl sub_461103()
+void  sub_461103()
 {
   //GUIProgressBar *v0; // ebx@1
   //signed int v1; // ebp@1
@@ -3206,7 +3206,7 @@
 }
 
 //----- (004613C4) --------------------------------------------------------
-int __cdecl sub_4613C4()
+int  sub_4613C4()
 {
   unsigned __int16 v0; // ax@1
   size_t v1; // ecx@1
@@ -3267,7 +3267,7 @@
 
 OPENFILENAMEA ofn;
 //----- (0046271C) --------------------------------------------------------
-void __cdecl crt_init_globals_46271C()
+void CreateDefaultBLVLevel()
 {
   ofn.lStructSize = 0x4Cu;
   ofn.hwndOwner = hWnd;
@@ -3378,7 +3378,7 @@
       }
       else
       {
-        if ( !ptr_507BDC )// ???
+        if ( !pModalWindow )// ???
         {
           pButton = pWindow->pControlsHead;
           for ( pButton = pWindow->pControlsHead; pButton; pButton = pButton->pNext )
@@ -3448,6 +3448,7 @@
   
   switch (Msg)
   {
+    case WM_SIZING:  return 1;
     case WM_SETTEXT: return DefWindowProcW(hWnd, Msg, wParam, lParam);
     case WM_CHAR:
     {
@@ -3456,6 +3457,14 @@
     }
     return DefWindowProcA(hWnd, Msg, wParam, lParam);
 
+
+    case WM_DEVICECHANGE:
+    {
+      if (wParam == 0x8000)          // CD or some device has been inserted - notify InsertCD dialog
+        PostMessageA(hInsertCDWindow, WM_USER + 1, 0, 0);
+      return 0;
+    }
+
     case WM_COMMAND:
     {
       switch (wParam)
@@ -3640,12 +3649,6 @@
   {
     switch ( Msg )
     {
-      case WM_DEVICECHANGE:
-        if ( wParam == 0x8000 )
-          PostMessageA(hInsertCDWindow, WM_CHOOSEFONT_GETLOGFONT, 0, 0);
-        return 0;
-      case WM_SIZING:
-        return 1;
       case WM_LBUTTONDOWN:
         if ( pArcomageGame->bGameInProgress )
         {
@@ -3763,7 +3766,6 @@
         if ( !pGame )
           //goto _def_wnd_proc;
           return DefWindowProcA(hWnd, Msg, wParam, lParam);
-        sub_417871(0);
         return DefWindowProcA(hWnd, Msg, wParam, lParam);
       case WM_MOUSEMOVE:
         if ( pArcomageGame->bGameInProgress )
@@ -3846,14 +3848,14 @@
       }
       if ( wParam >= VK_LEFT && wParam <= VK_DOWN )
       {
-        if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE )
+        if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_MODAL_WINDOW )
         {
           if ( !viewparams->field_4C )
             UI_OnKeyDown(wParam);
           return 0;
         }
       }
-      if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE )
+      if ( pCurrentScreen != SCREEN_GAME && pCurrentScreen != SCREEN_MODAL_WINDOW )
         return 0;
     }
 
@@ -4023,7 +4025,7 @@
 }
 
 //----- (00464479) --------------------------------------------------------
-void __cdecl ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows()
+void  ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows()
 {
   int v0; // esi@9
 
@@ -4056,11 +4058,8 @@
 }
 
 //----- (004646F0) --------------------------------------------------------
-void PrepareWorld(unsigned int this_)
+void PrepareWorld(unsigned int _0_box_loading_1_fullscreen)
 {
-  unsigned int v1; // ebx@1
-
-  v1 = this_;
   if ( pRenderer->pRenderD3D )
     pGame->pVisInstance->_4C1A02();
   pEventTimer->Pause();
@@ -4068,13 +4067,13 @@
   pParty->uFlags = 2;
   pCastSpellInfo.data()->_427D48(1);
   ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
-  DoPrepareWorld(0, (v1 == 0) + 1);
+  DoPrepareWorld(0, (_0_box_loading_1_fullscreen == 0) + 1);
   pMiscTimer->Resume();
   pEventTimer->Resume();
 }
 
 //----- (00464761) --------------------------------------------------------
-void __thiscall Game_DeinitializeAndTerminate(int exitCode)
+void  Game_DeinitializeAndTerminate(int exitCode)
 {
   int v1; // esi@1
   HANDLE v2; // eax@1
@@ -4109,22 +4108,22 @@
 // 6BE3A0: using guessed type float flt_6BE3A0;
 
 //----- (00464839) --------------------------------------------------------
-char __cdecl Is_out15odm_underwater()
+char  Is_out15odm_underwater()
 {
   return _stricmp(pCurrentMapName.data(), "out15.odm") == 0;
 }
 
 //----- (00464851) --------------------------------------------------------
-void __cdecl SetUnderwaterFog()
+void  SetUnderwaterFog()
 {
   day_fogrange_1 = 50;
   day_fogrange_2 = 5000;
 }
 
 //----- (00464866) --------------------------------------------------------
-void __fastcall DoPrepareWorld(unsigned int bLoading, int a2)
+void DoPrepareWorld(unsigned int bLoading, int _1_fullscreen_loading_2_box)
 {
-  int v2; // esi@1
+  //int v2; // esi@1
   char *v3; // eax@1
   //char *v4; // eax@1
   unsigned int v5; // eax@3
@@ -4133,11 +4132,11 @@
   char Str1[20]; // [sp+Ch] [bp-18h]@1
   unsigned int v9; // [sp+20h] [bp-4h]@1
 
-  v2 = a2;
   v9 = bLoading;
   ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows();
   pDecalBuilder->Reset(0);
-  pGameLoadingUI_ProgressBar->Initialize((GUIProgressBar::Type)v2);
+  pGameLoadingUI_ProgressBar->Initialize(_1_fullscreen_loading_2_box == 1 ? GUIProgressBar::TYPE_Fullscreen :
+                                                                            GUIProgressBar::TYPE_Box);
   strcpy(Str1, pCurrentMapName.data());
   v3 = strtok(Str1, ".");
   strcpy(Str1, v3);
@@ -5087,7 +5086,7 @@
 }
 
 //----- (00465D0B) --------------------------------------------------------
-void __cdecl SecondaryInitialization()
+void  SecondaryInitialization()
 {
   __int16 v4; // ax@4
   signed int v5; // esi@5
@@ -5456,13 +5455,16 @@
         }
         else
         {
-          if (GetCurrentMenuID() == MENU_10)
+          if (GetCurrentMenuID() == MENU_DebugBLVLevel)
 		  {
 			  pMouse->Activate(0);
 
 			  pParty->Reset();
 			  pParty->CreateDefaultParty(1);
-			  crt_init_globals_46271C();
+
+              extern void CreateDefaultBLVLevel();
+			  CreateDefaultBLVLevel();
+
 			  extern OPENFILENAMEA ofn;
 			  if ( !GetOpenFileNameA((LPOPENFILENAMEA)&ofn) )
 			  {
@@ -5509,7 +5511,7 @@
 }
 
 //----- (004637E0) --------------------------------------------------------
-char __cdecl sub_4637E0_is_there_popup_onscreen()
+char  sub_4637E0_is_there_popup_onscreen()
 {
   return dword_507BF0_is_there_popup_onscreen == 1;
 }
@@ -5659,7 +5661,7 @@
 }
 
 //----- (004666D5) --------------------------------------------------------
-void __cdecl MM7Initialization()
+void  MM7Initialization()
 {
   if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor )
   {
@@ -5705,7 +5707,7 @@
 }
 
 //----- (00466B8C) --------------------------------------------------------
-int __cdecl AbortWithError()
+int  AbortWithError()
 {
   if ( !aborting_app )
   {
@@ -5754,7 +5756,7 @@
     case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC";
     case MENU_CREDITSPROC:  return L"MENU_CREDITSPROC";
     case MENU_LoadingProcInMainMenu: return L"MENU_LoadingProcInMainMenu";
-    case MENU_10:           return L"MENU_10";
+    case MENU_DebugBLVLevel:           return L"MENU_DebugBLVLevel";
     case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE";
     default:                return L"unk";
   };
@@ -6013,7 +6015,7 @@
 }
 
 //----- (0046A99B) --------------------------------------------------------
-int __cdecl sub_46A99B()
+int  sub_46A99B()
 {
   int v0; // ebx@1
   signed int v1; // ecx@1
@@ -6219,7 +6221,7 @@
 }
 
 //----- (0046BDA8) --------------------------------------------------------
-unsigned int __cdecl GetGravityStrength()
+unsigned int  GetGravityStrength()
 {
   int v0; // eax@1
 
@@ -6229,7 +6231,7 @@
 }
 
 //----- (0046BDC0) --------------------------------------------------------
-void __cdecl UpdateUserInput_and_MapSpecificStuff()
+void  UpdateUserInput_and_MapSpecificStuff()
 {
   if ( dword_6BE364_game_settings_1 & 0x80 )
   {