# HG changeset patch # User Ritor1 # Date 1361445833 -21600 # Node ID 4a236657a0be13230ba55d6c729b0135101b540f # Parent b9aff98467e3a0905f07ad11aadf1478af2434d6 GameMenuButton fix diff -r b9aff98467e3 -r 4a236657a0be GUIWindow.h --- a/GUIWindow.h Thu Feb 21 10:07:51 2013 +0600 +++ b/GUIWindow.h Thu Feb 21 17:23:53 2013 +0600 @@ -212,7 +212,7 @@ UIMSG_68 = 0x68, UIMSG_69 = 0x69, UIMSG_QuickReference = 0x6A, - UIMSG_6B = 0x6B, + UIMSG_GameMenuButton = 0x6B, UIMSG_AlreadyResting = 0x6D, UIMSG_SelectCharacter = 0x6E, UIMSG_ChangeSoundVolume = 0x6F, diff -r b9aff98467e3 -r 4a236657a0be mm7_1.cpp --- a/mm7_1.cpp Thu Feb 21 10:07:51 2013 +0600 +++ b/mm7_1.cpp Thu Feb 21 17:23:53 2013 +0600 @@ -1744,36 +1744,12 @@ v24 = &pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn]; v28 = pKeyActionMap->GetActionVKey(INPUT_ZoomIn); - pBtn_ZoomIn = pPrimaryWindow->CreateButton( - 0x23Eu, - 0x88u, - v24->uTextureWidth, - v24->uTextureHeight, - 2, - 0, - 0x170u, - 0, - v28, - pGlobalTXT_LocalizationStrings[252], // Zoom In - v24, - 0); - + pBtn_ZoomIn = pPrimaryWindow->CreateButton(574, 136, v24->uTextureWidth, v24->uTextureHeight, 2, 0, 0x170u, 0, v28, pGlobalTXT_LocalizationStrings[252], // Zoom In + v24, 0); v29 = &pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut]; v33 = pKeyActionMap->GetActionVKey(INPUT_ZoomOut); - pBtn_ZoomOut = pPrimaryWindow->CreateButton( - 0x207u, - 0x88u, - v29->uTextureWidth, - v29->uTextureHeight, - 2, - 0, - 0x16Fu, - 0, - v33, - pGlobalTXT_LocalizationStrings[251], // Zoom Out - v29, - 0); - + pBtn_ZoomOut = pPrimaryWindow->CreateButton(519, 136, v29->uTextureWidth, v29->uTextureHeight, 2, 0, 0x16Fu, 0, v33, pGlobalTXT_LocalizationStrings[251], // Zoom Out + v29, 0); pPrimaryWindow->CreateButton(0x1E1u, 0, 0x99u, 0x43u, 1, 92, 0, 0, 0, "", 0); pPrimaryWindow->CreateButton(0x1EBu, 0x95u, 0x40u, 0x4Au, 1, 0, 0x86u, 0, 0x35u, "", 0); pPrimaryWindow->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, 0x87u, 0, 0x36u, "", 0); @@ -1782,74 +1758,38 @@ pBtn_CastSpell = pPrimaryWindow->CreateButton(0x1DCu, 0x1C2u, (uTextureID_Btn_CastSpell != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_CastSpell].uTextureWidth : 24), (uTextureID_Btn_CastSpell != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_CastSpell].uTextureHeight : 26), - 1, - 0, - 0x69u, - 0, - 0x43u, - pGlobalTXT_LocalizationStrings[38], + 1, 0, 0x69u, 0, 0x43u, pGlobalTXT_LocalizationStrings[38], (Texture *)(uTextureID_Btn_CastSpell != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_CastSpell] : 0), 0); pBtn_Rest = pPrimaryWindow->CreateButton(0x206u, 0x1C2u, (uTextureID_Btn_Rest != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_Rest].uTextureWidth : 24), (uTextureID_Btn_Rest != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_Rest].uTextureHeight : 26), - 1, - 0, - 0x68u, - 0, - 0x52u, - pGlobalTXT_LocalizationStrings[182], - (Texture *)(uTextureID_Btn_Rest != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_Rest] : 0), - 0); + 1, 0, 0x68u, 0, 0x52u, pGlobalTXT_LocalizationStrings[182], + (Texture *)(uTextureID_Btn_Rest != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_Rest] : 0), 0); pBtn_QuickReference = pPrimaryWindow->CreateButton(0x230u, 0x1C2u, (uTextureID_Btn_QuickReference != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_QuickReference].uTextureWidth : 24), (uTextureID_Btn_QuickReference != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_QuickReference].uTextureHeight : 26), - 1, - 0, - 0x6Au, - 0, - 0x5Au, - pGlobalTXT_LocalizationStrings[173], - (Texture *)(uTextureID_Btn_QuickReference != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_QuickReference] : 0), - 0); + 1, 0, 0x6Au, 0, 0x5Au, pGlobalTXT_LocalizationStrings[173], + (Texture *)(uTextureID_Btn_QuickReference != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_QuickReference] : 0), 0); pBtn_GameSettings = pPrimaryWindow->CreateButton(0x25Au, 0x1C2u, (uTextureID_Btn_GameSettings != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_GameSettings].uTextureWidth : 24), (uTextureID_Btn_GameSettings != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_GameSettings].uTextureHeight : 26), - 1, - 0, - 0x6Bu, - 0, - 0, - pGlobalTXT_LocalizationStrings[93], - (Texture *)(uTextureID_Btn_GameSettings != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings] : 0), - 0); + 1, 0, 0x6Bu, 0, 0, pGlobalTXT_LocalizationStrings[93], + (Texture *)(uTextureID_Btn_GameSettings != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Btn_GameSettings] : 0), 0); pBtn_NPCLeft = pPrimaryWindow->CreateButton(0x1D5u, 0xB2u, (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureWidth : 24), (uTextureID_Btn_NPCLeft != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft].uTextureHeight : 26), - 1, - 0, - 0xBCu, - 0, - 0, - "", - (Texture *)(uTextureID_Btn_NPCLeft != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft] : 0), - 0); + 1, 0, 0xBCu, 0, 0, "", + (Texture *)(uTextureID_Btn_NPCLeft != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCLeft] : 0), 0); pBtn_NPCRight = pPrimaryWindow->CreateButton(0x272u, 0xB2u, (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureWidth : 24), (uTextureID_Btn_NPCRight != -1 ? pIcons_LOD->pTextures[uTextureID_Btn_NPCRight].uTextureHeight : 26), - 1, - 0, - 0xBCu, - 1u, - 0, - "", - (Texture *)(uTextureID_Btn_NPCRight != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCRight] : 0), - 0); + 1, 0, 0xBCu, 1u, 0, "", + (Texture *)(uTextureID_Btn_NPCRight != -1 ? &pIcons_LOD->pTextures[uTextureID_Btn_NPCRight] : 0), 0); Load_isn_spells_21_27(); } - //----- (0041C047) -------------------------------------------------------- void __cdecl GameUI_DrawStatusBar_2() { diff -r b9aff98467e3 -r 4a236657a0be mm7_2.cpp --- a/mm7_2.cpp Thu Feb 21 10:07:51 2013 +0600 +++ b/mm7_2.cpp Thu Feb 21 17:23:53 2013 +0600 @@ -3704,12 +3704,12 @@ void __fastcall sub_4BCACC_bounties(signed int a1) { unsigned int v1; // edi@1 - signed int v2; // ebx@1 - signed int v3; // ecx@2 + //signed int v2; // ebx@1 + //signed int v3; // ecx@2 int v4; // eax@5 signed int v5; // esi@5 - Player *v6; // ecx@5 - signed int v7; // edx@5 + //Player *v6; // ecx@5 + //signed int v7; // edx@5 GUIWindow *v8; // esi@10 unsigned int v9; // eax@12 int v10; // esi@31 @@ -3757,65 +3757,51 @@ void *v52; // eax@260 signed int v53; // edi@260 int v54; // eax@262 - signed int v55; // [sp+10h] [bp-10h]@1 + //signed int v55; // [sp+10h] [bp-10h]@1 int v56; // [sp+14h] [bp-Ch]@31 v1 = 0; - v2 = a1; - v55 = a1; + //v2 = a1; + //v55 = a1; if ( !pDialogueWindow->pNumPresenceButton ) return; pRenderer->ClearZBuffer(0, 479); - v3 = dword_F8B198; + //v3 = dword_F8B198; if ( dword_F8B19C != 1 ) goto LABEL_13; if ( dword_F8B198 == 30 ) { - if ( v2 == 17 ) + if ( a1 == 17 ) { v4 = 0; v5 = 0; - v6 = pPlayers[uActiveCharacter]; - v7 = v6->uLevel; - if ( v7 > 0 ) + //v6 = pPlayers[uActiveCharacter]; + //v7 = pPlayers[uActiveCharacter]->uLevel; + if ( pPlayers[uActiveCharacter]->uLevel > 0 ) { do v4 += v5++ + 1; - while ( v5 < v7 ); - } - if ( v7 < (unsigned __int16)word_4F0866[(unsigned int)window_SpeakInHouse->ptr_1C] - && (signed __int64)v6->uExperience < 1000 * v4 ) + while ( v5 < pPlayers[uActiveCharacter]->uLevel ); + } + if ( pPlayers[uActiveCharacter]->uLevel < (unsigned __int16)word_4F0866[(unsigned int)window_SpeakInHouse->ptr_1C] + && (signed __int64)pPlayers[uActiveCharacter]->uExperience < 1000 * v4 ) return; } goto LABEL_9; } v8 = window_SpeakInHouse; if ( (dword_F8B198 == 27 || dword_F8B198 == 28) - && (v1 = 0, - *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + v2)] - + pParty->uDaysPlayed % 7)) - || dword_F8B198 != 23 - || v55 != 10 ) + && (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + a1)] + pParty->uDaysPlayed % 7)) + || dword_F8B198 != 23 || a1 != 10 ) { LABEL_9: pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, v1, v1); - pBtn_ExitCancel = pDialogueWindow->CreateButton( - 526, - 445, - 75, - 33, - 1, - v1, - 0x71u, - v1, - v1, - pGlobalTXT_LocalizationStrings[74],// "End Conversation" - (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), - v1); + pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, v1, 0x71u, v1, v1, pGlobalTXT_LocalizationStrings[74],// "End Conversation" + (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), v1); pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, v1, 0x51u, v1, v1, "", (Texture *)v1); LABEL_10: - v3 = dword_F8B198; + //v3 = dword_F8B198; v8 = window_SpeakInHouse; goto LABEL_11; } @@ -3826,35 +3812,35 @@ goto LABEL_10; } LABEL_11: - dword_F8B19C = v55; - if ( v3 < 19 ) - { - v9 = pIcons_LOD->LoadTexture(off_4F03B8[v3], TEXTURE_16BIT_PALETTE); - v3 = dword_F8B198; + dword_F8B19C = a1; + if ( dword_F8B198 < 19 ) + { + v9 = pIcons_LOD->LoadTexture(off_4F03B8[dword_F8B198], TEXTURE_16BIT_PALETTE); + //v3 = dword_F8B198; dword_F8B164 = &pIcons_LOD->pTextures[v9]; LABEL_13: v8 = window_SpeakInHouse; } - if ( v3 > 21 ) - { - if ( v3 == 22 ) + if ( dword_F8B198 > 21 ) + { + if ( dword_F8B198 == 22 ) { if ( dword_F8B19C >= 7 && dword_F8B19C <= 8 ) pKeyActionMap->EnterText(1, 10, v8); return; } - if ( v3 != 23 && v3 != 30 ) + if ( dword_F8B198 != 23 && dword_F8B198 != 30 ) return; } else { - if ( v3 != 21 ) - { - if ( v3 <= (signed int)v1 ) + if ( dword_F8B198 != 21 ) + { + if ( dword_F8B198 <= (signed int)v1 ) return; - if ( v3 > 4 ) - { - if ( v3 <= 16 ) + if ( dword_F8B198 > 4 ) + { + if ( dword_F8B198 <= 16 ) { if ( (signed __int64)__PAIR__( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472], @@ -3890,9 +3876,9 @@ } return; } - if ( v3 != 17 ) + if ( dword_F8B198 != 17 ) return; - if ( v55 == 99 ) + if ( a1 == 99 ) { v10 = (int)((char *)v8->ptr_1C - 102); v56 = v10; @@ -3906,9 +3892,7 @@ v12 = v10; v13 = 0; pParty->field_75A[v12] = 0; - *(_QWORD *)v11 = (signed __int64)((double)(309657600 - * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) - * 0.033333335); + *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); v14 = rand() % 258; v15 = window_SpeakInHouse; pParty->field_750[v12] = v14 + 1; @@ -4092,7 +4076,7 @@ } goto LABEL_196; } - if ( v55 == 100 ) + if ( a1 == 100 ) { pKeyActionMap->EnterText(1, 10, v8); goto LABEL_196; @@ -4100,10 +4084,10 @@ } } } - if ( v55 > 95 ) + if ( a1 > 95 ) { LABEL_196: - switch ( v55 ) + switch ( a1 ) { case 96: pDialogueWindow->eWindowType = WINDOW_MainMenu; @@ -4134,25 +4118,25 @@ } return; } - if ( v55 != 95 && v55 != 2 ) - { - if ( v55 == 3 ) + if ( a1 != 95 && a1 != 2 ) + { + if ( a1 == 3 ) { dword_F8B19C = 3; } else { - if ( v55 == 4 ) + if ( a1 == 4 ) { dword_F8B19C = 4; } else { - if ( v55 != 5 ) - { - if ( v55 > 35 ) - { - if ( v55 <= 72 ) + if ( a1 != 5 ) + { + if ( a1 > 35 ) + { + if ( a1 <= 72 ) { v35 = pPlayers[uActiveCharacter]; //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); @@ -4171,7 +4155,7 @@ if (false) //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) { - v38 = (int)(&v35->uIntelligence + v55); + v38 = (int)(&v35->uIntelligence + a1); if ( !*(short *)v38 ) { if ( pParty->uNumGold < v37 ) @@ -4195,7 +4179,7 @@ } else { - if ( v55 == 94 ) + if ( a1 == 94 ) { pDialogueWindow->eWindowType = WINDOW_MainMenu; sub_4BCA33(); @@ -4219,7 +4203,7 @@ sub_4B8F94(); v8 = window_SpeakInHouse; v40 = window_SpeakInHouse->ptr_1C; - v3 = dword_F8B198; + //v3 = dword_F8B198; v41 = pParty->uTimePlayed //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) @@ -4231,7 +4215,7 @@ v43 = 0; //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; - if ( v55 == 2 ) + if ( a1 == 2 ) { if ( _4F063C_smthn_by_2da_uType[v44] ) { @@ -4241,7 +4225,7 @@ if ( v45 ) { v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); - v3 = dword_F8B198; + //v3 = dword_F8B198; v8 = window_SpeakInHouse; dword_F8B168[v43] = &pIcons_LOD->pTextures[v46]; } @@ -4251,7 +4235,7 @@ //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); } - if ( v3 == 1 ) + if ( dword_F8B198 == 1 ) { v47 = v8->ptr_1C; v48 = 0; @@ -4284,7 +4268,7 @@ if ( v50 ) { v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE); - v3 = dword_F8B198; + //v3 = dword_F8B198; v8 = window_SpeakInHouse; dword_F8B168[v43] = &pIcons_LOD->pTextures[v51]; } @@ -4294,7 +4278,7 @@ //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); } - if ( v3 == 1 ) + if ( dword_F8B198 == 1 ) { v52 = v8->ptr_1C; v53 = 0; diff -r b9aff98467e3 -r 4a236657a0be mm7_4.cpp --- a/mm7_4.cpp Thu Feb 21 10:07:51 2013 +0600 +++ b/mm7_4.cpp Thu Feb 21 17:23:53 2013 +0600 @@ -9062,7 +9062,7 @@ //----- (004B1A2D) -------------------------------------------------------- void __cdecl sub_4B1A2D() { - Player *v0; // edi@1 + //Player *v0; // edi@1 POINT *v1; // esi@5 unsigned int v2; // eax@5 int v3; // ecx@5 @@ -9082,7 +9082,7 @@ POINT a2; // [sp+40h] [bp-Ch]@5 int v18; // [sp+48h] [bp-4h]@5 - v0 = pPlayers[uActiveCharacter]; + //v0 = pPlayers[uActiveCharacter]; if ( dword_F8B198 <= 0 ) return; if ( dword_F8B198 <= 4 ) @@ -9097,9 +9097,9 @@ v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos((POINT *)&v14)->y - 17) >> 5); if ( pMouse->GetCursorPos((POINT *)&v13)->x <= 13 || pMouse->GetCursorPos((POINT *)&v12)->x >= 462 - || (v9 = v0->GetItemIDAtInventoryIndex(&v18)) == 0 ) + || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 ) return; - v7 = (ItemGen *)&v0->pInventoryItems[v9-1]; + v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1]; LABEL_15: GameUI_DrawItemInfo(v7); return; diff -r b9aff98467e3 -r 4a236657a0be mm7_5.cpp --- a/mm7_5.cpp Thu Feb 21 10:07:51 2013 +0600 +++ b/mm7_5.cpp Thu Feb 21 17:23:53 2013 +0600 @@ -3225,7 +3225,7 @@ pGlobalTXT_LocalizationStrings[79],// "Exit" (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0); //, v179); continue; - case UIMSG_6B: + case UIMSG_GameMenuButton: if ( pCurrentScreen ) { pGUIWindow_CurrentMenu->Release(); @@ -3239,6 +3239,7 @@ free((void *)uNumSeconds); stru_506E40._40E55E("gamma.pcx", 0); GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_VoiceSwitcherButton, (int)pBtn_GameSettings, 0); + uNumVisibleWindows = uNumVisibleWindows - 1; //Ritor1: Insert //LABEL_453: if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; @@ -3993,7 +3994,7 @@ SetCurrentMenuID(MENU_10); continue; } - if ( pUIMessageType == UIMSG_6B )//unknow + if ( pUIMessageType == UIMSG_GameMenuButton )//unknow { __debugbreak(); if ( pCurrentScreen ) @@ -16707,7 +16708,7 @@ if ( pCurrentScreen == SCREEN_HOUSE ) { if ( (signed int)pY < 345 && (signed int)pX < 469 ) - sub_4B1A2D(); + sub_4B1A2D();//identify item in inventory goto LABEL_132; } if ( pCurrentScreen <= SCREEN_HOUSE )