comparison mm7_5.cpp @ 1458:934074e7fcc1

ModalWindow __thiscall and __cdecl removed Some random renames & refactors
author Nomad
date Wed, 21 Aug 2013 14:26:36 +0200
parents bfe342ae0c1f
children 2ca62c9e7b3c
comparison
equal deleted inserted replaced
1457:9dc33590f93e 1458:934074e7fcc1
49 #include "UI\UIHouses.h" 49 #include "UI\UIHouses.h"
50 #include "Lights.h" 50 #include "Lights.h"
51 #include "Lights.h" 51 #include "Lights.h"
52 52
53 //----- (004304E7) -------------------------------------------------------- 53 //----- (004304E7) --------------------------------------------------------
54 void __cdecl GameUI_MsgProc() 54 void GameUI_MsgProc()
55 { 55 {
56 //signed int v0; // edi@6 56 //signed int v0; // edi@6
57 //char *v1; // esi@6 57 //char *v1; // esi@6
58 unsigned int v2; // edx@7 58 unsigned int v2; // edx@7
59 Actor *pActor; // ecx@13 59 Actor *pActor; // ecx@13
888 byte_6BE388_graphicsmode = 1; 888 byte_6BE388_graphicsmode = 1;
889 } 889 }
890 MM7Initialization(); 890 MM7Initialization();
891 continue; 891 continue;
892 } 892 }
893 ModalWindow(pNPCTopics[453].pText, 0); 893 ModalWindow(pNPCTopics[453].pText, UIMSG_0);
894 continue; 894 continue;
895 case UIMSG_GameMenu_ReturnToGame: 895 case UIMSG_GameMenu_ReturnToGame:
896 pGUIWindow_CurrentMenu->Release(); 896 pGUIWindow_CurrentMenu->Release();
897 pEventTimer->Resume(); 897 pEventTimer->Resume();
898 pCurrentScreen = SCREEN_GAME; 898 pCurrentScreen = SCREEN_GAME;
981 uMessageParam = 1; 981 uMessageParam = 1;
982 break; 982 break;
983 } 983 }
984 break; 984 break;
985 } 985 }
986 if ( !ptr_507BDC ) 986 if ( !pModalWindow )
987 { 987 {
988 pRenderer->ClearZBuffer(0, 479); 988 pRenderer->ClearZBuffer(0, 479);
989 viewparams->bRedrawGameUI = 1; 989 viewparams->bRedrawGameUI = 1;
990 viewparams->field_48 = 1; 990 viewparams->field_48 = 1;
991 if ( pCurrentScreen ) 991 if ( pCurrentScreen )
1390 case SCREEN_VIDEO: 1390 case SCREEN_VIDEO:
1391 pVideoPlayer->Unload(); 1391 pVideoPlayer->Unload();
1392 continue; 1392 continue;
1393 case SCREEN_CHARACTERS: 1393 case SCREEN_CHARACTERS:
1394 CharacterUI_ReleaseButtons(); 1394 CharacterUI_ReleaseButtons();
1395 sub_419379(); 1395 ReleaseAwardsScrollBar();
1396 pIcons_LOD->RemoveTexturesPackFromTextureList(); 1396 pIcons_LOD->RemoveTexturesPackFromTextureList();
1397 if ( pGUIWindow_Settings ) 1397 if ( pGUIWindow_Settings )
1398 { 1398 {
1399 if ( pCurrentScreen == SCREEN_CHARACTERS ) 1399 if ( pCurrentScreen == SCREEN_CHARACTERS )
1400 { 1400 {
1477 viewparams->bRedrawGameUI = true; 1477 viewparams->bRedrawGameUI = true;
1478 pIcons_LOD->RemoveTexturesFromTextureList(); 1478 pIcons_LOD->RemoveTexturesFromTextureList();
1479 continue; 1479 continue;
1480 } 1480 }
1481 CharacterUI_ReleaseButtons(); 1481 CharacterUI_ReleaseButtons();
1482 sub_419379(); 1482 ReleaseAwardsScrollBar();
1483 pIcons_LOD->RemoveTexturesPackFromTextureList(); 1483 pIcons_LOD->RemoveTexturesPackFromTextureList();
1484 } 1484 }
1485 if ( pGUIWindow_Settings ) 1485 if ( pGUIWindow_Settings )
1486 { 1486 {
1487 if ( pCurrentScreen == SCREEN_CHARACTERS ) 1487 if ( pCurrentScreen == SCREEN_CHARACTERS )
1563 GameUI_Footer_TimeLeft = 0; 1563 GameUI_Footer_TimeLeft = 0;
1564 unk_50C9A0 = 0; 1564 unk_50C9A0 = 0;
1565 back_to_game(); 1565 back_to_game();
1566 continue; 1566 continue;
1567 } 1567 }
1568 sub_41426F(); 1568 ModalWindow_Release();
1569 continue; 1569 continue;
1570 case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel 1570 case UIMSG_ScrollNPCPanel://Right and Left button for NPCPanel
1571 if ( uMessageParam ) 1571 if ( uMessageParam )
1572 { 1572 {
1573 GUIWindow::Create(626, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCRight, 0); 1573 GUIWindow::Create(626, 179, 0, 0, WINDOW_PressedButton2, (int)pBtn_NPCRight, 0);
2247 continue; 2247 continue;
2248 case UIMSG_ShowFinalWindow: 2248 case UIMSG_ShowFinalWindow:
2249 sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." 2249 sprintfex(pFinalMessage.data(), "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer."
2250 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." 2250 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."
2251 pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team." 2251 pGlobalTXT_LocalizationStrings[167]);// "- The Might and Magic VII Development Team."
2252 ModalWindow(pFinalMessage.data(), 196); 2252 ModalWindow(pFinalMessage.data(), UIMSG_OnFinalWindowClose);
2253 uGameState = GAME_STATE_FINAL_WINDOW; 2253 uGameState = GAME_STATE_FINAL_WINDOW;
2254 continue; 2254 continue;
2255 case UIMSG_C4: 2255 case UIMSG_OnFinalWindowClose:
2256 __debugbreak(); 2256 __debugbreak();
2257 uGameState = GAME_STATE_PLAYING; 2257 uGameState = GAME_STATE_PLAYING;
2258 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); 2258 strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2");
2259 __debugbreak(); // missed break/continue?
2259 case UIMSG_DD: 2260 case UIMSG_DD:
2260 __debugbreak(); 2261 __debugbreak();
2261 sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer); 2262 sprintf(pTmpBuf.data(), "%s", pKeyActionMap->pPressedKeysBuffer);
2262 memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); 2263 memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216));
2263 if ( v216.uPropCount == 1 ) 2264 if ( v216.uPropCount == 1 )
2477 case UIMSG_RestWindow: 2478 case UIMSG_RestWindow:
2478 if ( pMessageQueue_50CBD0->uNumMessages ) 2479 if ( pMessageQueue_50CBD0->uNumMessages )
2479 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; 2480 pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
2480 if ( pCurrentScreen ) 2481 if ( pCurrentScreen )
2481 continue; 2482 continue;
2482 if ( sub_42F4DA() ) 2483 if ( _42F4DA_check_actor_proximity() )
2483 { 2484 {
2484 if ( pParty->bTurnBasedModeOn == 1 ) 2485 if ( pParty->bTurnBasedModeOn == 1 )
2485 { 2486 {
2486 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" 2487 ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
2487 continue; 2488 continue;
2883 OnPaperdollLeftClick(); 2884 OnPaperdollLeftClick();
2884 continue; 2885 continue;
2885 case UIMSG_ClickStatsBtn: 2886 case UIMSG_ClickStatsBtn:
2886 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; 2887 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;
2887 CharacterUI_ReleaseButtons(); 2888 CharacterUI_ReleaseButtons();
2888 sub_419379(); 2889 ReleaseAwardsScrollBar();
2889 GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0); 2890 GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0);
2890 continue; 2891 continue;
2891 case UIMSG_ClickSkillsBtn: 2892 case UIMSG_ClickSkillsBtn:
2892 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101; 2893 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101;
2893 CharacterUI_ReleaseButtons(); 2894 CharacterUI_ReleaseButtons();
2894 sub_419379(); 2895 ReleaseAwardsScrollBar();
2895 CharacterUI_SkillsTab_CreateButtons(); 2896 CharacterUI_SkillsTab_CreateButtons();
2896 GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0); 2897 GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0);
2897 continue; 2898 continue;
2898 case UIMSG_SkillUp: 2899 case UIMSG_SkillUp:
2899 pPlayer4 = pPlayers[uActiveCharacter]; 2900 pPlayer4 = pPlayers[uActiveCharacter];
2918 } 2919 }
2919 ShowStatusBarString(v87, 2); 2920 ShowStatusBarString(v87, 2);
2920 continue; 2921 continue;
2921 case UIMSG_ClickInventoryBtn: 2922 case UIMSG_ClickInventoryBtn:
2922 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; 2923 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
2923 sub_419379(); 2924 ReleaseAwardsScrollBar();
2924 CharacterUI_ReleaseButtons(); 2925 CharacterUI_ReleaseButtons();
2925 GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0); 2926 GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0);
2926 continue; 2927 continue;
2927 case UIMSG_ClickExitCharacterWindowBtn: 2928 case UIMSG_ClickExitCharacterWindowBtn:
2928 GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0); 2929 GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, WINDOW_ExitCharacterWindow, (int)pCharacterScreen_ExitBtn, 0);
2929 continue; 2930 continue;
2930 case UIMSG_ClickAwardsBtn: 2931 case UIMSG_ClickAwardsBtn:
2931 sub_419379(); 2932 ReleaseAwardsScrollBar();
2932 CharacterUI_ReleaseButtons(); 2933 CharacterUI_ReleaseButtons();
2933 CreateAwardsScrollBar(); 2934 CreateAwardsScrollBar();
2934 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; 2935 pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102;
2935 GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0); 2936 GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0);
2936 FillAwardsData(); 2937 FillAwardsData();
3236 } 3237 }
3237 pCastSpellInfo.data()->_427E01_cast_spell(); 3238 pCastSpellInfo.data()->_427E01_cast_spell();
3238 } 3239 }
3239 3240
3240 //----- (004356FF) -------------------------------------------------------- 3241 //----- (004356FF) --------------------------------------------------------
3241 void __cdecl back_to_game() 3242 void back_to_game()
3242 { 3243 {
3243 dword_507BF0_is_there_popup_onscreen = 0; 3244 dword_507BF0_is_there_popup_onscreen = 0;
3244 dword_4E455C = 1; 3245 dword_4E455C = 1;
3245 dword_50CDCC = 0; 3246 dword_50CDCC = 0;
3246 if ( pGUIWindow_ScrollWindow ) 3247 if ( pGUIWindow_ScrollWindow )
3249 pEventTimer->Resume(); 3250 pEventTimer->Resume();
3250 viewparams->bRedrawGameUI = 1; 3251 viewparams->bRedrawGameUI = 1;
3251 } 3252 }
3252 3253
3253 //----- (00435748) -------------------------------------------------------- 3254 //----- (00435748) --------------------------------------------------------
3254 void __cdecl GUI_MainMenuMessageProc() 3255 void GUI_MainMenuMessageProc()
3255 { 3256 {
3256 Player *pPlayer; // ebx@2 3257 Player *pPlayer; // ebx@2
3257 void *v3; // edi@21 3258 void *v3; // edi@21
3258 signed int v4; // eax@29 3259 signed int v4; // eax@29
3259 int v5; // ecx@29 3260 int v5; // ecx@29
3418 break; 3419 break;
3419 case UIMSG_ChangeCursor: 3420 case UIMSG_ChangeCursor:
3420 pMouse->SetCursorBitmap("MICON2"); 3421 pMouse->SetCursorBitmap("MICON2");
3421 break; 3422 break;
3422 case UIMSG_3A: 3423 case UIMSG_3A:
3423 SetCurrentMenuID(MENU_10); 3424 SetCurrentMenuID(MENU_DebugBLVLevel);
3424 break; 3425 break;
3425 case UIMSG_LoadGame: 3426 case UIMSG_LoadGame:
3426 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) 3427 if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot])
3427 break; 3428 break;
3428 SetCurrentMenuID(MENU_LoadingProcInMainMenu); 3429 SetCurrentMenuID(MENU_LoadingProcInMainMenu);
3477 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0); 3478 GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnNew, 0);
3478 SetCurrentMenuID(MENU_LoadingProcInMainMenu); 3479 SetCurrentMenuID(MENU_LoadingProcInMainMenu);
3479 break; 3480 break;
3480 case UIMSG_AE: 3481 case UIMSG_AE:
3481 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); 3482 GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0);
3482 SetCurrentMenuID(MENU_10); 3483 SetCurrentMenuID(MENU_DebugBLVLevel);
3483 break; 3484 break;
3484 case UIMSG_Escape: 3485 case UIMSG_Escape:
3485 if ( ptr_507BDC ) 3486 if ( pModalWindow )
3486 { 3487 {
3487 sub_41426F(); 3488 ModalWindow_Release();
3488 break; 3489 break;
3489 } 3490 }
3490 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) ) 3491 if ( !(BYTE1(dword_6BE364_game_settings_1) & 0x40) )
3491 break; 3492 break;
3492 v15 = 1; 3493 v15 = 1;
3577 while ( pMessageQueue_50CBD0->uNumMessages ); 3578 while ( pMessageQueue_50CBD0->uNumMessages );
3578 } 3579 }
3579 } 3580 }
3580 3581
3581 //----- (00436427) -------------------------------------------------------- 3582 //----- (00436427) --------------------------------------------------------
3582 double __cdecl get_shading_dist_mist() 3583 double get_shading_dist_mist()
3583 { 3584 {
3584 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) 3585 if (uCurrentlyLoadedLevelType == LEVEL_Outdoor)
3585 return (double)pOutdoorCamera->shading_dist_mist; 3586 return (double)pOutdoorCamera->shading_dist_mist;
3586 else 3587 else
3587 return 16192.0; 3588 return 16192.0;
4624 int v28; // [sp+8h] [bp-14h]@14 4625 int v28; // [sp+8h] [bp-14h]@14
4625 int v29; // [sp+10h] [bp-Ch]@14 4626 int v29; // [sp+10h] [bp-Ch]@14
4626 signed int a3a; // [sp+24h] [bp+8h]@14 4627 signed int a3a; // [sp+24h] [bp+8h]@14
4627 int a4a; // [sp+28h] [bp+Ch]@2 4628 int a4a; // [sp+28h] [bp+Ch]@2
4628 4629
4630 __debugbreak();
4631
4629 v4 = a4; 4632 v4 = a4;
4630 v5 = a4->uAttributes; 4633 v5 = a4->uAttributes;
4631 if ( v5 & 0x100 ) 4634 if ( v5 & 0x100 )
4632 { 4635 {
4633 v6 = 0; 4636 v6 = 0;
4756 signed __int64 v23; // qtt@22 4759 signed __int64 v23; // qtt@22
4757 bool result; // eax@25 4760 bool result; // eax@25
4758 int v25; // [sp+14h] [bp-8h]@14 4761 int v25; // [sp+14h] [bp-8h]@14
4759 int a4a; // [sp+28h] [bp+Ch]@2 4762 int a4a; // [sp+28h] [bp+Ch]@2
4760 signed int a5a; // [sp+2Ch] [bp+10h]@14 4763 signed int a5a; // [sp+2Ch] [bp+10h]@14
4764
4765 __debugbreak();
4761 4766
4762 v5 = a4; 4767 v5 = a4;
4763 v6 = a4->uAttributes; 4768 v6 = a4->uAttributes;
4764 v7 = 0; 4769 v7 = 0;
4765 if ( v6 & 0x100 ) 4770 if ( v6 & 0x100 )
4893 return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) + 4898 return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) +
4894 LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) + 4899 LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) +
4895 LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8)); 4900 LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8));
4896 } 4901 }
4897 4902
4898 //----- (0040DFA7) --------------------------------------------------------
4899 int __stdcall retzero_sub_40DFA7(int a1)
4900 {
4901 return 0;
4902 }
4903 // 40DFA7: using guessed type int __stdcall retzero_sub_40DFA7(int);
4904
4905 4903
4906 4904
4907 //----- (0040F82D) -------------------------------------------------------- 4905 //----- (0040F82D) --------------------------------------------------------
4908 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) 4906 void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue)
4909 { 4907 {
4962 free(v12); 4960 free(v12);
4963 } 4961 }
4964 } 4962 }
4965 4963
4966 //----- (0040F92A) -------------------------------------------------------- 4964 //----- (0040F92A) --------------------------------------------------------
4967 void __fastcall sub_40F92A(int *pZBuffer, Texture *a2, int a3) 4965 void __fastcall ZBuffer_DoFill2(int *pZBuffer, Texture *a2, int a3)
4968 { 4966 {
4969 Texture *v3; // esi@1 4967 Texture *v3; // esi@1
4970 void *v4; // eax@3 4968 void *v4; // eax@3
4971 int *v5; // edi@5 4969 int *v5; // edi@5
4972 int v6; // ecx@6 4970 int v6; // ecx@6
5003 free(v4); 5001 free(v4);
5004 } 5002 }
5005 } 5003 }
5006 5004
5007 //----- (00410D99) -------------------------------------------------------- 5005 //----- (00410D99) --------------------------------------------------------
5008 signed int __fastcall sub_410D99_get_map_index(int a1) 5006 int __fastcall sub_410D99_get_map_index(int a1)
5009 { 5007 {
5010 int v1; // edi@1 5008 int v1; // edi@1
5011 signed int v2; // ebp@1 5009 signed int v2; // ebp@1
5012 const char **v3; // esi@2 5010 const char **v3; // esi@2
5013 char *v4; // ebx@2 5011 char *v4; // ebx@2