Mercurial > might-and-magic-trilogy
diff GUIWindow.cpp @ 2:2ca04ccb612a
NoCD, main menu, various
author | Nomad |
---|---|
date | Wed, 10 Oct 2012 14:21:15 +0200 |
parents | 8b8875f5b359 |
children | 540178ef9b18 |
line wrap: on
line diff
--- a/GUIWindow.cpp Tue Oct 09 13:09:08 2012 +0200 +++ b/GUIWindow.cpp Wed Oct 10 14:21:15 2012 +0200 @@ -362,7 +362,7 @@ v1 = this; if ( !this ) return; - v2 = this->uWindowType; + v2 = this->eWindowType; if ( (signed int)v2 > 18 ) { v5 = v2 - 19; @@ -452,7 +452,7 @@ v1->pControlsHead = 0; v1->pControlsTail = 0; v1->uNumControls = 0; - v1->uWindowType = 0; + v1->eWindowType = WINDOW_null; v10 = v1->field_3C; v11 = uNumVisibleWindows; while ( v10 < v11 ) @@ -2123,11 +2123,11 @@ //----- (0041C432) -------------------------------------------------------- -GUIWindow *GUIWindow::Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, unsigned int uWindowType, int a4, int a5) +GUIWindow *GUIWindow::Create(unsigned int uX, unsigned int uY, unsigned int uWidth, unsigned int uHeight, WindowType eWindowType, int a4, int a5) { unsigned int uNextFreeWindowID; // ebp@1 - int *v8; // eax@1 - GUIWindow *pWindow; // esi@4 + //int *v8; // eax@1 + //GUIWindow *pWindow; // esi@4 int v10; // eax@4 unsigned int v11; // ebx@15 NPCData *v12; // ebp@15 @@ -2152,16 +2152,14 @@ int a4a; // [sp+20h] [bp+10h]@15 uNextFreeWindowID = 0; - v8 = (int *)&pWindowList[0].uWindowType; - do + for (uNextFreeWindowID = 0; uNextFreeWindowID < 20; ++uNextFreeWindowID) { - if ( !*v8 ) + if (pWindowList[uNextFreeWindowID].eWindowType == WINDOW_null) break; - v8 += 21; - ++uNextFreeWindowID; } - while ( (signed int)v8 < (signed int)&pVisibleWindowsIdxs[6] ); - pWindow = &pWindowList[uNextFreeWindowID]; + + + auto pWindow = &pWindowList[uNextFreeWindowID]; pWindow->uFrameWidth = uWidth; pWindow->uFrameZ = uX + uWidth - 1; pWindow->uFrameW = uY + uHeight - 1; @@ -2172,21 +2170,21 @@ ++v10; pWindow->uFrameY = uY; pWindow->uFrameHeight = uHeight; - pWindow->uWindowType = uWindowType; + pWindow->eWindowType = eWindowType; pWindow->field_44 = 0; uNumVisibleWindows = v10; pWindow->field_3C = v10; pVisibleWindowsIdxs[v10] = uNextFreeWindowID + 1; - if ( (signed int)uWindowType <= 20 ) + if ( (signed int)eWindowType <= 20 ) { - if ( uWindowType != 20 ) + if (eWindowType != WINDOW_Chest) { - switch ( uWindowType ) + switch (eWindowType) { - case 9u: + case WINDOW_Book: pWindow->InitializeBookView(); break; - case 0xAu: + case WINDOW_A: dword_506978 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 4; ptr_5076F4 = pWindow->CreateButton( @@ -2199,8 +2197,8 @@ 0x71u, 0, 0, - pGlobalTXT_LocalizationStrings[79], - (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), + pGlobalTXT_LocalizationStrings[79], //"Exit" + (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); if ( pWindow->ptr_1C != (void *)1 ) { @@ -2211,7 +2209,7 @@ { if ( v12->joins ) { - pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, 0x88u, 0xDu, 0, nullstring, 0); + pWindow->CreateButton(0x1E0u, 0x82u, 0x8Cu, v11, 1, 0, 0x88u, 0xDu, 0, "", 0); a4a = 1; } v13 = (void *)v12->bDrawSomeAnim; @@ -2383,7 +2381,7 @@ pWindow->_41D08F(a4a, 1, 0, 1); } break; - case 0x11u: + case WINDOW_11: dword_506978 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 17; ptr_5076F4 = pWindow->CreateButton( @@ -2428,11 +2426,11 @@ 0); pWindow->CreateButton(8u, 8u, 0x1CCu, 0x158u, 1, 0, 0x5Au, 1u, 0, pWindow->str_48, 0); break; - case 0x12u: + case WINDOW_12: InitializeBookTextures(); pWindow->_411621(); break; - case 0x13u: + case WINDOW_13: dword_506978 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; pKeyActionMap->_459E5A(0, 15, pWindow); uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 19; @@ -2448,7 +2446,7 @@ pWindow->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, nullstring, 0); return pWindow; } - if ( uWindowType == 25 ) + if (eWindowType == WINDOW_HouseInterior) { uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 13; ptr_5076F4 = pWindow->CreateButton( @@ -2514,7 +2512,7 @@ } else { - if ( uWindowType == 26 ) + if (eWindowType == WINDOW_1A) { dword_506978 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 18; @@ -2559,7 +2557,7 @@ pWindow->CreateButton(8u, 8u, 0x1CCu, 0x158u, 1, 0, 0x19Bu, 1u, 0, pWindow->str_48, 0); return pWindow; } - if ( uWindowType == 27 ) + if (eWindowType == WINDOW_1B) { pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); @@ -2567,9 +2565,9 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2u); return pWindow; } - if ( uWindowType == 30 ) + if (eWindowType == WINDOW_1E) goto LABEL_62; - if ( uWindowType == 31 ) + if (eWindowType == WINDOW_1F) { pMouse->SetCursorBitmap("MICON2"); ptr_5076F4 = pWindow->CreateButton(