Mercurial > might-and-magic-trilogy
diff mm7_5.cpp @ 87:c0cf9393af64
Слияние
author | Ritor1 |
---|---|
date | Mon, 29 Oct 2012 09:28:08 +0600 |
parents | b39bdc150e90 |
children | 51a5b0dc3f30 |
line wrap: on
line diff
--- a/mm7_5.cpp Mon Oct 22 09:20:49 2012 +0600 +++ b/mm7_5.cpp Mon Oct 29 09:28:08 2012 +0600 @@ -304,9 +304,12 @@ if ( pMessageQueue_50CBD0->uNumMessages ) { v0 = 1; - v1 = nullstring; + v1 = ""; while ( 2 ) { + if ( !pMessageQueue_50CBD0->uNumMessages ) + break; + pMessageQueue_50CBD0->PopMessage(&uMessage, &uMessageParam, (int *)&v199); switch ( uMessage ) { @@ -330,7 +333,7 @@ case UIMSG_Quit|0x2: case 0x87: if ( bNoNPCHiring != 1 - && !uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + && !pCurrentScreen ) { if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; @@ -403,7 +406,7 @@ pGUIWindow_CurrentMenu->Release(); uGameState = 4; LABEL_188: - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; viewparams->bRedrawGameUI = v0; } else @@ -421,7 +424,7 @@ if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 12; + pCurrentScreen = 12; GameUI_DrawLoadMenu(v0); goto _continue; case UIMSG_Quit: @@ -432,7 +435,7 @@ if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; viewparams->bRedrawGameUI = v0; if ( !uMessageParam ) pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0); @@ -449,7 +452,7 @@ pIcons_LOD->_40F9C5(); pIcons_LOD->_4114F2(); pGUIWindow_CurrentMenu->Release(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 2; + pCurrentScreen = 2; v162 = 0; v148 = 0; v141 = (WindowType)8; @@ -496,7 +499,7 @@ case UIMSG_A5: if ( pGUIWindow_CurrentMenu->field_40 == v0 ) pKeyActionMap->_459ED1(0); - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 11 + if ( pCurrentScreen != 11 || uLoadGameUI_SelectedSlot != dword_6A0C9C + uMessageParam ) { v10 = dword_6A0C9C + uMessageParam; @@ -554,7 +557,7 @@ goto _release_tex_and_continue; case UIMSG_StartNewGame|0x2: pGUIWindow_CurrentMenu->Release(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 11; + pCurrentScreen = 11; GameUI_DrawSaveMenu(); goto _continue; case UIMSG_Game_OpenOptionsDialog: @@ -562,7 +565,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); viewparams->field_48 = v0; - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 2; + pCurrentScreen = 2; uTextureID_507C60 = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE); uTextureID_507C6C = pIcons_LOD->LoadTexture("con_16x", TEXTURE_16BIT_PALETTE); uTextureID_507C68 = pIcons_LOD->LoadTexture("con_32x", TEXTURE_16BIT_PALETTE); @@ -779,32 +782,32 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); viewparams->field_48 = 1; - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 26; + pCurrentScreen = 26; uTextureID_507BF4 = pIcons_LOD->LoadTexture("optkb", TEXTURE_16BIT_PALETTE); uTextureID_507BF8 = pIcons_LOD->LoadTexture("optkb_h", TEXTURE_16BIT_PALETTE); uTextureID_507BFC = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); uTextureID_507C00 = pIcons_LOD->LoadTexture("optkb_1", TEXTURE_16BIT_PALETTE); uTextureID_507C04 = pIcons_LOD->LoadTexture("optkb_2", TEXTURE_16BIT_PALETTE); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_KeyMappingOptions, 0, 0); - pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, 0x71u, 0, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, 0x1A0u, 0, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, 0x1A1u, 0, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(127u, 0x144u, 0x6Cu, 0x14u, 1, 0, 0x1A2u, 0, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(19u, 0x144u, 0x6Cu, 0x14u, 1, 0, 0x7Fu, 0, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 0x94u, 0x46u, 0x13u, 1, 0, 0x1A3u, 0, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 0xA7u, 0x46u, 0x13u, 1, 0, 0x1A3u, 1u, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 0xBAu, 0x46u, 0x13u, 1, 0, 0x1A3u, 2u, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 0xCDu, 0x46u, 0x13u, 1, 0, 0x1A3u, 3u, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 224u, 70u, 19u, 1, 0, 0x1A3u, 4u, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 243u, 70u, 0x13u, 1, 0, 0x1A3u, 5u, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(129u, 262u, 70u, 0x13u, 1, 0, 0x1A3u, 6u, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 148u, 70u, 0x13u, 1, 0, 0x1A3u, 7u, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 167u, 70u, 0x13u, 1, 0, 0x1A3u, 8u, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, 0x1A3u, 9u, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, 0x1A3u, 0xAu, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, 0x1A3u, 0xBu, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, 0x1A3u, 0xCu, 0, nullstring, 0); - pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, 0x1A3u, 0xDu, 0, nullstring, 0); + pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, 0x71u, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(19u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, 0x1A0u, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(127u, 0x12Eu, 0x6Cu, 0x14u, 1, 0, 0x1A1u, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(127u, 0x144u, 0x6Cu, 0x14u, 1, 0, 0x1A2u, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(19u, 0x144u, 0x6Cu, 0x14u, 1, 0, 0x7Fu, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129u, 0x94u, 0x46u, 0x13u, 1, 0, 0x1A3u, 0, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129u, 0xA7u, 0x46u, 0x13u, 1, 0, 0x1A3u, 1u, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129u, 0xBAu, 0x46u, 0x13u, 1, 0, 0x1A3u, 2u, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129u, 0xCDu, 0x46u, 0x13u, 1, 0, 0x1A3u, 3u, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129u, 224u, 70u, 19u, 1, 0, 0x1A3u, 4u, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129u, 243u, 70u, 0x13u, 1, 0, 0x1A3u, 5u, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(129u, 262u, 70u, 0x13u, 1, 0, 0x1A3u, 6u, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350u, 148u, 70u, 0x13u, 1, 0, 0x1A3u, 7u, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350u, 167u, 70u, 0x13u, 1, 0, 0x1A3u, 8u, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350u, 186u, 70u, 0x13u, 1, 0, 0x1A3u, 9u, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350u, 205u, 70u, 0x13u, 1, 0, 0x1A3u, 0xAu, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350u, 224u, 70u, 0x13u, 1, 0, 0x1A3u, 0xBu, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350u, 243u, 70u, 0x13u, 1, 0, 0x1A3u, 0xCu, 0, "", 0); + pGUIWindow_CurrentMenu->CreateButton(350u, 262u, 70u, 0x13u, 1, 0, 0x1A3u, 0xDu, 0, "", 0); dword_506E68 = -1; dword_506F08 = 1; memset(word_506E6C, 0, 0x1Cu); @@ -871,7 +874,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); viewparams->field_48 = v0; - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 28; + pCurrentScreen = 28; uTextureID_507C10 = pIcons_LOD->LoadTexture("optvid", TEXTURE_16BIT_PALETTE); uTextureID_507C14 = pIcons_LOD->LoadTexture("opvdH-bs", TEXTURE_16BIT_PALETTE); uTextureID_507C18 = pIcons_LOD->LoadTexture("opvdH-cl", TEXTURE_16BIT_PALETTE); @@ -1184,7 +1187,7 @@ case UIMSG_OpenQuestBook: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + if ( pCurrentScreen ) pGUIWindow_CurrentMenu->Release(); pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); @@ -1195,7 +1198,7 @@ case UIMSG_OpenAutonotes: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + if ( pCurrentScreen ) pGUIWindow_CurrentMenu->Release(); pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); @@ -1206,11 +1209,11 @@ case UIMSG_OpenMapBook: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + if ( pCurrentScreen ) pGUIWindow_CurrentMenu->Release(); pEventTimer->Pause(); viewparams->sPartyPosX = pParty->vPosition.x; - viewparams->sPartyPosZ = pParty->vPosition.z; + viewparams->sPartyPosZ = pParty->vPosition.y; pAudioPlayer->StopChannels(-1, -1); v26 = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Book, uMessage, 0); v27 = 353; @@ -1221,7 +1224,7 @@ case UIMSG_OpenCalendar: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + if ( pCurrentScreen ) pGUIWindow_CurrentMenu->Release(); pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); @@ -1237,7 +1240,7 @@ case UIMSG_OpenHistoryBook: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + if ( pCurrentScreen ) pGUIWindow_CurrentMenu->Release(); pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); @@ -1249,11 +1252,11 @@ back_to_game(); if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions > 15 ) - { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions >= 17 - && (uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions <= 18 - || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 104) ) + if ( pCurrentScreen > 15 ) + { + if ( pCurrentScreen >= 17 + && (pCurrentScreen <= 18 + || pCurrentScreen == 104) ) { LABEL_229: if ( dword_50CDC8 ) @@ -1264,11 +1267,11 @@ } else { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions >= 14 - || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 4 - || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 10 ) + if ( pCurrentScreen >= 14 + || pCurrentScreen == 4 + || pCurrentScreen == 10 ) goto LABEL_229; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 13 + if ( pCurrentScreen == 13 && !dword_50CDC8 && !dword_5C35C8 ) { @@ -1285,18 +1288,18 @@ pRenderer->ClearZBuffer(0, 479); viewparams->bRedrawGameUI = v0; viewparams->field_48 = v0; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) - { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions > 103 ) + if ( pCurrentScreen ) + { + if ( pCurrentScreen > 103 ) { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 104 ) + if ( pCurrentScreen == 104 ) goto LABEL_321; } else { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions < 100 ) + if ( pCurrentScreen < 100 ) { - switch ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + switch ( pCurrentScreen ) { case 23: pIcons_LOD->_4114F2(); @@ -1330,7 +1333,7 @@ //crt_deconstruct_ptr_6A0118(); goto LABEL_291; case 15: - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 10; + pCurrentScreen = 10; goto _continue; case 10: v29 = ptr_507BB8; @@ -1340,7 +1343,7 @@ LABEL_249: v29->Release(); pIcons_LOD->_4114F2(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; viewparams->bRedrawGameUI = v0; pEventTimer->Resume(); goto _continue; @@ -1481,7 +1484,7 @@ goto LABEL_322; case 14: pGUIWindow_CurrentMenu->Release(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 13; + pCurrentScreen = 13; pIcons_LOD->_4114F2(); goto _continue; case 13: @@ -1527,10 +1530,10 @@ pParty->vPosition.x = -22528; if ( pParty->vPosition.x > 22528 ) pParty->vPosition.x = 22528; - if ( pParty->vPosition.z < -22528 ) - pParty->vPosition.z = -22528; - if ( pParty->vPosition.z > 22528 ) - pParty->vPosition.z = 22528; + if ( pParty->vPosition.y < -22528 ) + pParty->vPosition.y = -22528; + if ( pParty->vPosition.y > 22528 ) + pParty->vPosition.y = 22528; goto LABEL_317; case 16: pVideoPlayer->Unload(); @@ -1551,7 +1554,7 @@ LABEL_322: if ( ptr_507BD4 ) { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 7 ) + if ( pCurrentScreen == 7 ) { pMouse->SetCursorBitmap("MICON2"); } @@ -1572,7 +1575,7 @@ ptr_507BC0 = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; viewparams->bRedrawGameUI = v0; pIcons_LOD->_4355F7(); goto _continue; @@ -1585,7 +1588,7 @@ pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); ++pIcons_LOD->uTexturePacksCount; - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = v0; + pCurrentScreen = v0; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)3, 0, 0); @@ -1687,8 +1690,6 @@ } sub_41426F(); _continue: - if ( !pMessageQueue_50CBD0->uNumMessages ) - break; continue; case UIMSG_BC: if ( uMessageParam ) @@ -1738,12 +1739,12 @@ } if ( dword_591178_teleporty ) { - pParty->vPosition.z = dword_591178_teleporty; + pParty->vPosition.y = dword_591178_teleporty; _5B65AC_npcdata_fame_or_other = dword_591178_teleporty; } if ( dword_591174_teleportz ) { - pParty->vPosition.y = dword_591174_teleportz; + pParty->vPosition.z = dword_591174_teleportz; _5B65B0_npcdata_rep_or_other = dword_591174_teleportz; pParty->uFallStartY = dword_591174_teleportz; } @@ -1799,7 +1800,7 @@ v195 = (NPCData *)GetTravelTime(); strcpy(pOutdoor->pLevelFilename, pCurrentMapName); if ( bUnderwater != 1 && pParty->bFlying - || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.z, &pOut, 20) != v0 ) + || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, &pOut, 20) != v0 ) { viewparams->bRedrawGameUI = v0; LABEL_387: @@ -1808,13 +1809,13 @@ pParty->vPosition.x = -22528; if ( pParty->vPosition.x > 22528 ) pParty->vPosition.x = 22528; - if ( pParty->vPosition.z < -22528 ) - pParty->vPosition.z = -22528; - if ( pParty->vPosition.z > 22528 ) - pParty->vPosition.z = 22528; + if ( pParty->vPosition.y < -22528 ) + pParty->vPosition.y = -22528; + if ( pParty->vPosition.y > 22528 ) + pParty->vPosition.y = 22528; LABEL_317: sub_44603D(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; } else { @@ -1882,12 +1883,12 @@ OnMapLoad(); pOutdoor->SetFog(); TeleportToStartingPoint(uLevel_StartingPointType); - pParty->vPosition.y = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.z, (int *)&v213, 0); - pParty->uFallStartY = pParty->vPosition.y; + pParty->vPosition.z = GetTerrainHeightsAroundParty2(pParty->vPosition.x, pParty->vPosition.y, (int *)&v213, 0); + pParty->uFallStartY = pParty->vPosition.z; sub_461103(); pEventTimer->Resume(); viewparams->bRedrawGameUI = 1; - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; pGameLoadingUI_ProgressBar->Release(); } goto LABEL_422; @@ -1932,7 +1933,7 @@ if ( uCurrentlyLoadedLevelType != v0 ) { v50 = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F]; - if ( !(BYTE3(v50->uFaceAttributes) & 2) || !v50->sCogTriggeredID ) + if ( !(v50->uAttributes & 0x02000000) || !v50->sCogTriggeredID ) goto _continue; v44 = uNumSeconds; goto LABEL_415; @@ -2081,7 +2082,7 @@ v158 = (unsigned int)thise; v146 = pGlobalTXT_LocalizationStrings[475];// "Set %s over %s" _sprintex_draw_status_and_continue: - sprintfex(pTmpBuf, v146, v158, v174); + sprintf(pTmpBuf, v146, v158, v174); goto _set_status_string_pTmpBuf_and_continue; case UIMSG_B5: dword_50CDC8 = v0; @@ -2133,9 +2134,9 @@ else { pParty->vPosition.x = v195->uFlags; - pParty->vPosition.z = v195->fame; - pParty->vPosition.y = v195->rep; - pParty->uFallStartY = pParty->vPosition.y; + pParty->vPosition.y = v195->fame; + pParty->vPosition.z = v195->rep; + pParty->uFallStartY = pParty->vPosition.z; pParty->sRotationY = LOWORD(v195->house); pParty->sRotationX = HIWORD(v195->house); } @@ -2164,8 +2165,8 @@ v195->pName = (char *)v62; v61->uPortraitID = HIDWORD(v62); v61->uFlags = pParty->vPosition.x; - v61->fame = pParty->vPosition.z; - v61->rep = pParty->vPosition.y; + v61->fame = pParty->vPosition.y; + v61->rep = pParty->vPosition.z; LOWORD(v61->house) = LOWORD(pParty->sRotationY); HIWORD(v61->house) = LOWORD(pParty->sRotationX); if ( (signed int)pGames_LOD->uNumSubIndices / 2 <= 0 ) @@ -2208,9 +2209,9 @@ if ( v64 == stru_4ECBB8[uMessageParam].uMapInfoID ) { pParty->vPosition.x = stru_4ECBB8[v65].pos.x; - pParty->vPosition.z = stru_4ECBB8[v65].pos.y; - pParty->vPosition.y = stru_4ECBB8[v65].pos.z; - pParty->uFallStartY = pParty->vPosition.y; + pParty->vPosition.y = stru_4ECBB8[v65].pos.y; + pParty->vPosition.z = stru_4ECBB8[v65].pos.z; + pParty->uFallStartY = pParty->vPosition.z; pParty->sRotationY = stru_4ECBB8[v65].rot_y; pParty->sRotationX = stru_4ECBB8[v65].rot_x; } @@ -2230,7 +2231,7 @@ _5B65B8_npcdata_hiword_house_or_other = v66; UpdateActors(); } - v67 = pGUIWindow_CurrentMenu->str_48; + v67 = pGUIWindow_CurrentMenu->Hint; if ( v67 ) *((int *)v67 + 17) = v0; else @@ -2351,7 +2352,7 @@ if ( v70 <= 0 || v70 >= 77 ) { LABEL_90: - v1 = nullstring; + v1 = ""; LABEL_91: v0 = 1; goto _continue; @@ -2397,8 +2398,8 @@ v77 = thisi; LABEL_544: pParty->vPosition.x = v74; - pParty->vPosition.z = v77; - pParty->vPosition.y = v76; + pParty->vPosition.y = v77; + pParty->vPosition.z = v76; pParty->uFallStartY = v76; goto LABEL_90; } @@ -2466,10 +2467,10 @@ goto LABEL_416; case 0x1C: if ( !uActiveCharacter - || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + || pCurrentScreen ) goto LABEL_90; ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)104, uMessageParam, 0); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 25; + pCurrentScreen = 25; pEventTimer->Pause(); goto _continue; case 0x1B: @@ -2544,7 +2545,7 @@ case 0x68: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + if ( pCurrentScreen ) goto _continue; if ( sub_42F4DA() ) goto LABEL_594; @@ -2670,10 +2671,10 @@ case 0x4E: if ( dword_50654C && byte_506550 ) { - v173 = pSpellStats->pInfos[dword_50654C + 11 * pPlayers[uActiveCharacter]->field_1A4E].pName; + v173 = pSpellStats->pInfos[dword_50654C + 11 * pPlayers[uActiveCharacter]->pNumSpellBookPage].pName; v157 = pGlobalTXT_LocalizationStrings[483]; _sprintex_2args_draw_status_and_continue: - sprintfex(pTmpBuf, v157, v173); + sprintf(pTmpBuf, v157, v173); } else { @@ -2726,7 +2727,7 @@ v127 = 203; goto _play_sound_and_continue; } - v99 = dword_50654C + 11 * pPlayers[uActiveCharacter]->field_1A4E; + v99 = dword_50654C + 11 * pPlayers[uActiveCharacter]->pNumSpellBookPage; pPlayers[uActiveCharacter]->uQuickSpell = v99; stru_A750F8[uActiveCharacter + 3]._494836(v99, uActiveCharacter); if ( uActiveCharacter ) @@ -2745,7 +2746,7 @@ { if ( *(short *)thisl ) { - if ( v100->field_1A4E == v101 ) + if ( v100->pNumSpellBookPage == v101 ) uAction = (int)v195; v102 = (int)v195; v195 = (NPCData *)((char *)v195 + 1); @@ -2770,13 +2771,13 @@ uAction = 0; } sub_41140B(); - pPlayers[uActiveCharacter]->field_1A4E = LOBYTE(v217[uAction]); + pPlayers[uActiveCharacter]->pNumSpellBookPage = LOBYTE(v217[uAction]); goto LABEL_661; case UIMSG_SaveGame|0x4: - if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->field_1A4E ) + if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->pNumSpellBookPage ) goto _continue; sub_41140B(); - pPlayers[uActiveCharacter]->field_1A4E = uMessageParam; + pPlayers[uActiveCharacter]->pNumSpellBookPage = uMessageParam; LABEL_661: pGUIWindow_CurrentMenu->_411621(); LABEL_662: @@ -2802,7 +2803,7 @@ pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); viewparams->bRedrawGameUI = v0; - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; pIcons_LOD->_4114F2(); v103 = dword_50654C + 11 * *(char *)(uNumSeconds + 6734); if ( dword_50C9E8 < 40 ) @@ -2869,17 +2870,17 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; if ( uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery ) { - if ( !uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + if ( !pCurrentScreen ) goto LABEL_693; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 5 - && uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 7 - && (uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions <= 99 - || uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions > 103) ) + if ( pCurrentScreen != 5 + && pCurrentScreen != 7 + && (pCurrentScreen <= 99 + || pCurrentScreen > 103) ) { pGUIWindow_CurrentMenu->Release(); LABEL_693: GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, (enum WindowType)90, (int)ptr_5079F8, 0); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 8; + pCurrentScreen = 8; pEventTimer->Pause(); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)18, 0, 0); pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); @@ -2892,7 +2893,7 @@ case 0x6A: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + if ( pCurrentScreen ) pGUIWindow_CurrentMenu->Release(); ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) @@ -2901,7 +2902,7 @@ viewparams->bRedrawGameUI = v0; pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 104; + pCurrentScreen = 104; pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)12, 5, 0); papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); ptr_5076F4 = pGUIWindow_CurrentMenu->CreateButton( @@ -2920,11 +2921,11 @@ v179); goto _continue; case 0x6B: - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + if ( pCurrentScreen ) { pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; viewparams->bRedrawGameUI = v0; } stru_506E40.Release(); @@ -3154,7 +3155,7 @@ } if ( pParty->uCurrentHour < 0xC || (uNumSeconds = v0, pParty->uCurrentHour >= 0x18) ) uNumSeconds = 0; - sprintfex( + sprintf( pTmpBuf, "%d:%02d%s %s %d %s %d", v195, @@ -3171,7 +3172,7 @@ goto _sprintex_2args_draw_status_and_continue; case UIMSG_ShowStatus_Player: v106 = pPlayers[uMessageParam]; - sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v106->pName, pClassNames[v106->uClass]);// "%s the %s" + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v106->pName, pClassNames[v106->uClass]);// "%s the %s" strcat(pTmpBuf, ": "); v107 = v106->GetMajorConditionIdx(); strcat(pTmpBuf, aCharacterConditionNames[v107]); @@ -3187,10 +3188,10 @@ v112 = v110->sMana; v113 = pGlobalTXT_LocalizationStrings[108];// "Hit Points" v114 = v110->GetMaxHealth(); - sprintfex(pTmpBuf, "%d / %d %s %d / %d %s", v110->sHealth, v114, v113, v112, v111, v109); + sprintf(pTmpBuf, "%d / %d %s %d / %d %s", v110->sHealth, v114, v113, v112, v111, v109); goto _set_status_string_pTmpBuf_and_continue; case 0xC: - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 15 ) + if ( pCurrentScreen == 15 ) goto LABEL_762; sub_420E01(); goto _continue; @@ -3260,7 +3261,7 @@ OnPressSpace(); goto _continue; case UIMSG_ChangeSoundVolume|0x100: - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + if ( pCurrentScreen ) goto _continue; pParty->uFlags |= 2u; GUIWindow::Create(0x207u, 0x88u, 0, 0, (enum WindowType)90, (int)dword_507A14, 0); @@ -3283,7 +3284,7 @@ viewparams->field_28 = 11; goto LABEL_788; case UIMSG_ChangeMusicVolume|0x100: - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + if ( pCurrentScreen ) goto _continue; pParty->uFlags |= 2u; GUIWindow::Create(0x23Eu, 0x88u, 0, 0, (enum WindowType)90, (int)dword_507A18, 0); @@ -3363,7 +3364,7 @@ dword_50CDCC = 0; if ( ptr_507BC4 ) free_book_subwindow(); - if ( !uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions + if ( !pCurrentScreen && !ptr_507BD4 ) pEventTimer->Resume(); viewparams->bRedrawGameUI = 1; @@ -3400,7 +3401,7 @@ unsigned int v26; // ecx@127 unsigned int v27; // eax@129 unsigned __int8 v28; // of@129 - SoundID v29; // [sp-2Ch] [bp-3Ch]@36 + SoundID pSoundID; // [sp-2Ch] [bp-3Ch]@36 signed int v30; // [sp-28h] [bp-38h]@36 unsigned int v31; // [sp-24h] [bp-34h]@36 signed int v32; // [sp-20h] [bp-30h]@36 @@ -3415,18 +3416,20 @@ signed int v41; // [sp-10h] [bp-20h]@29 int v42; // [sp-10h] [bp-20h]@36 int v43; // [sp-10h] [bp-20h]@56 - unsigned __int8 uClass[4]; // [sp+4h] [bp-Ch]@3 - UIMessageType v45; // [sp+8h] [bp-8h]@3 + int uNum; // [sp+4h] [bp-Ch]@3 + UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3 int v46; // [sp+Ch] [bp-4h]@3 + Player *pPlayer; if ( pMessageQueue_50CBD0->uNumMessages ) { //v0 = pAudioPlayer; v1 = (char *)pParty->pPlayers; + pPlayer = pParty->pPlayers; do { - pMessageQueue_50CBD0->PopMessage(&v45, (int *)uClass, &v46); - switch (v45) + pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, &v46); + switch (pUIMessageType) { case UIMSG_MainMenu_ShowPartyCreationWnd: { @@ -3467,19 +3470,18 @@ } - switch (v45) + switch (pUIMessageType) { case UIMSG_A5: // WINDOW_5A { //main menu save/load wnd clicking on savegame lines if (pGUIWindow_CurrentMenu->field_40 == 1) pKeyActionMap->_459ED1(0); - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 11 - || uLoadGameUI_SelectedSlot != *(int *)uClass + dword_6A0C9C ) + if ( pCurrentScreen != 11 || uLoadGameUI_SelectedSlot != uNum + dword_6A0C9C ) { //load clicked line - v26 = *(int *)uClass + dword_6A0C9C; - if ( dword_6BE138 == *(int *)uClass + dword_6A0C9C ) + v26 = uNum + dword_6A0C9C; + if ( dword_6BE138 == uNum + dword_6A0C9C ) { pMessageQueue_50CBD0->SendMessage(UIMSG_A4, 0, 0); pMessageQueue_50CBD0->SendMessage(UIMSG_LoadGame, 0, 0); @@ -3502,18 +3504,17 @@ case UIMSG_A4: { - GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, - pGUIWindow_CurrentMenu->uFrameY + 302, + GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_5E, (int)ptr_69BD64, 0); } continue; } - if ( (signed int)v45 > 75 ) - { - if ( v45 > UIMSG_A3 ) - { - if ( v45 == UIMSG_A6 ) + if ( (signed int)pUIMessageType > UIMSG_PlayerCreationRemoveDownSkill ) + { + if ( pUIMessageType > UIMSG_A3 ) + { + if ( pUIMessageType == UIMSG_A6 ) { v43 = 0; v39 = (int)ptr_69BD60; @@ -3525,106 +3526,73 @@ GUIWindow::Create(v18, v8, v33, v35, v37, v39, v43); continue; } - if ( v45 == UIMSG_AB ) - { - v23 = (char *)&pParty->pPlayers[*(int *)uClass]; - v24 = (int)(v23 + 186); - v12 = (char)(v23[186] - 1) < 0; - --*(char *)v24; + if ( pUIMessageType == UIMSG_SelectFacePlayerBack ) + { + pPlayer = &pParty->pPlayers[uNum]; + v12 = (char)((int)pPlayer->uFace - 1) < 0; + --pPlayer->uFace; if ( v12 ) - *(char *)v24 = 19; - *((int *)v23 + 1608) = *(char *)v24; - ((Player *)v23)->SetInitialStats(); - ((Player *)v23)->SetSexByVoice(); - ((Player *)v23)->RandomizeName(); - v25 = *(int *)uClass; - pGUIWindow_CurrentMenu->field_2C_focus_id = (pGUIWindow_CurrentMenu->field_2C_focus_id - - pGUIWindow_CurrentMenu->field_38) - % 7 - + pGUIWindow_CurrentMenu->field_38 - + 7 * *(int *)uClass; + pPlayer->uFace = 19; + pPlayer->uVoiceID = pPlayer->uFace; + pPlayer->SetInitialStats(); + pPlayer->SetSexByVoice(); + pPlayer->RandomizeName(); + v25 = uNum; + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) + % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; uPlayerCreationUI_SelectedCharacter = v25; - GUIWindow::Create( - pCreationUI_BtnPressLeft[v25]->uX, - pCreationUI_BtnPressLeft[v25]->uY, - 0, - 0, - (enum WindowType)92, - (int)pCreationUI_BtnPressLeft[v25], - 1); + GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0, + (enum WindowType)92, (int)pCreationUI_BtnPressLeft[v25], 1); //v0 = pAudioPlayer; pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0.0, 0); - v22 = (Player *)v23; - goto LABEL_117; - } - if ( v45 == UIMSG_AC ) - { - v19 = (int)&v1[6972 * *(int *)uClass]; - v20 = (char)(*(char *)(v19 + 186) + 1) % 20; - *(char *)(v19 + 186) = v20; - *(int *)(v19 + 6432) = v20; - ((Player *)v19)->SetInitialStats(); - ((Player *)v19)->SetSexByVoice(); - ((Player *)v19)->RandomizeName(); - v21 = *(int *)uClass; - pGUIWindow_CurrentMenu->field_2C_focus_id = (pGUIWindow_CurrentMenu->field_2C_focus_id - - pGUIWindow_CurrentMenu->field_38) - % 7 - + pGUIWindow_CurrentMenu->field_38 - + 7 * *(int *)uClass; - uPlayerCreationUI_SelectedCharacter = v21; - GUIWindow::Create( - pCreationUI_BtnPressRight[v21]->uX, - pCreationUI_BtnPressRight[v21]->uY, - 0, - 0, - (enum WindowType)92, - (int)pCreationUI_BtnPressRight[v21], - 1); - //v0 = pAudioPlayer; - pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); - v22 = (Player *)v19; -LABEL_117: + v22 = pPlayer; v22->PlaySound(102, 0); v1 = (char *)pParty->pPlayers; continue; } - if ( v45 == UIMSG_AD ) - { - GUIWindow::Create( - pMainMenu_BtnNew->uX, - pMainMenu_BtnNew->uY, - 0, - 0, - (enum WindowType)90, - (int)pMainMenu_BtnNew, - 0); + if ( pUIMessageType == UIMSG_SelectFacePlayerForward ) + { + pPlayer = &pParty->pPlayers[uNum]; + v20 = (char)((int)pPlayer->uFace + 1) % 20; + pPlayer->uFace = v20; + pPlayer->uVoiceID = v20; + pPlayer->SetInitialStats(); + pPlayer->SetSexByVoice(); + pPlayer->RandomizeName(); + v21 = uNum; + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) + % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; + uPlayerCreationUI_SelectedCharacter = v21; + GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, (enum WindowType)92, + (int)pCreationUI_BtnPressRight[v21], 1); + //v0 = pAudioPlayer; + pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); + v22 = pPlayer; + v22->PlaySound(102, 0); + v1 = (char *)pParty->pPlayers; + continue; + } + if ( pUIMessageType == UIMSG_AD ) + { + GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnNew, 0); SetCurrentMenuID(MENU_LOAD); continue; } - if ( v45 != 174 ) + if ( pUIMessageType != UIMSG_AE ) continue; - GUIWindow::Create( - pMainMenu_BtnExit->uX, - pMainMenu_BtnExit->uY, - 0, - 0, - (enum WindowType)90, - (int)pMainMenu_BtnExit, - 0); + GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnExit, 0); LABEL_114: v40 = 10; LABEL_89: v2 = v40; -LABEL_90: SetCurrentMenuID((MENU_STATE)v2); continue; } - if ( v45 == UIMSG_A3 ) + if ( pUIMessageType == UIMSG_A3 ) { ++dword_6A0C9C; - if ( dword_6A0C9C >= *(int *)uClass ) - dword_6A0C9C = *(int *)uClass - 1; + if ( dword_6A0C9C >= uNum ) + dword_6A0C9C = uNum - 1; if ( dword_6A0C9C < 1 ) dword_6A0C9C = 0; v7 = pGUIWindow_CurrentMenu; @@ -3633,22 +3601,22 @@ v8 = pGUIWindow_CurrentMenu->uFrameY + 323; goto LABEL_105; } - if ( v45 == 107 ) - { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + if ( pUIMessageType == UIMSG_6B ) + { + if ( pCurrentScreen ) { pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; viewparams->bRedrawGameUI = 1; } - GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, (enum WindowType)92, (int)ptr_5079F0, 0); + GUIWindow::Create(602, 450, 0, 0, (enum WindowType)92, (int)ptr_5079F0, 0); if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CloseBook; goto LABEL_93; } - if ( v45 == UIMSG_CloseBook ) + if ( pUIMessageType == UIMSG_CloseBook ) { if ( ptr_507BDC ) { @@ -3663,7 +3631,7 @@ viewparams->field_48 = 1; if ( !GetCurrentMenuID() || GetCurrentMenuID() == 6 || GetCurrentMenuID() == 7 ) { - v17 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; + v17 = pCurrentScreen; LABEL_83: if ( v17 == 16 ) pVideoPlayer->FastForwardToFrame(pVideoPlayer->field_40); @@ -3689,16 +3657,15 @@ continue; } v16 = GetCurrentMenuID() == 8; - v17 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; - if ( v16 - && !uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) + v17 = pCurrentScreen; + if ( v16 && !pCurrentScreen ) goto LABEL_83; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 12 ) + if ( pCurrentScreen == 12 ) { pIcons_LOD->_4114F2(); //crt_deconstruct_ptr_6A0118(); - stru_506F20.Release(); - stru_506F20.Load("title.pcx", 0); + pTexture_PCX.Release(); + pTexture_PCX.Load("title.pcx", 0); SetCurrentMenuID(MENU_MAIN); v15 = 1; LABEL_81: @@ -3706,32 +3673,28 @@ pGUIWindow2->Release(); pGUIWindow2 = 0; pEventTimer->Resume(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; viewparams->bRedrawGameUI = v15; continue; } - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 16 ) + if ( pCurrentScreen == 16 ) { pVideoPlayer->Unload(); } else { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 27 ) + if ( pCurrentScreen != 27 ) goto LABEL_81; //VideoPlayer::dtor(); } } else { - if ( v45 == 118 ) - { - v14 = *(int *)uClass; - pGUIWindow_CurrentMenu->field_2C_focus_id = (pGUIWindow_CurrentMenu->field_2C_focus_id - - pGUIWindow_CurrentMenu->field_38) - % 7 - + pGUIWindow_CurrentMenu->field_38 - + 7 * *(int *)uClass; - uPlayerCreationUI_SelectedCharacter = v14; + if ( pUIMessageType == UIMSG_PlayerCreationSelectQuality ) + { + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) + % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; + uPlayerCreationUI_SelectedCharacter = uNum; LABEL_36: v42 = 0; v38 = 0; @@ -3740,14 +3703,14 @@ v32 = -1; v31 = 0; v30 = 0; - v29 = (SoundID)66; + pSoundID = (SoundID)66; LABEL_40: - pAudioPlayer->PlaySound(v29, v30, v31, v32, v34, v36, v38, v42); + pAudioPlayer->PlaySound(pSoundID, v30, v31, v32, v34, v36, v38, v42); continue; } - if ( v45 == 144 ) - { - v9 = (Player *)&v1[6972 * *(int *)uClass]; + if ( pUIMessageType == UIMSG_PlayerCreationVoiceBack ) + { + v9 = &pPlayer[uNum]; v46 = v9->GetSexByVoice(); do { @@ -3757,12 +3720,12 @@ v13 = v9->GetSexByVoice(); } while ( v13 != v46 ); - v11 = pCreationUI_BtnPressLeft2[*(int *)uClass]; + v11 = pCreationUI_BtnPressLeft2[uNum]; goto LABEL_60; } - if ( v45 == 145 ) - { - v9 = (Player *)&v1[6972 * *(int *)uClass]; + if ( pUIMessageType == UIMSG_PlayerCreationVoiceForward ) + { + v9 = &pPlayer[uNum]; v46 = v9->GetSexByVoice(); do { @@ -3770,14 +3733,14 @@ v10 = v9->GetSexByVoice(); } while ( v10 != v46 ); - v11 = pCreationUI_BtnPressRight2[*(int *)uClass]; + v11 = pCreationUI_BtnPressRight2[uNum]; LABEL_60: GUIWindow::Create(v11->uX, v11->uY, 0, 0, (enum WindowType)92, (int)v11, 1); pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); v9->PlaySound(102, 0); continue; } - if ( v45 == UIMSG_A2 ) + if ( pUIMessageType == UIMSG_A2 ) { --dword_6A0C9C; if ( dword_6A0C9C < 0 ) @@ -3787,34 +3750,29 @@ v39 = (int)ptr_69BD5C; v8 = pGUIWindow_CurrentMenu->uFrameY + 197; LABEL_105: - v37 = (WindowType)90; - v35 = 0; - v33 = 0; - v18 = v7->uFrameX + 215; - GUIWindow::Create(v18, v8, v33, v35, v37, v39, v43); + GUIWindow::Create(v7->uFrameX + 215, v8, 0, 0, (WindowType)90, v39, v43); continue; } } } else { - if ( v45 == 75 ) - { - uPlayerCreationUI_SelectedCharacter = *(int *)uClass; + if ( pUIMessageType == UIMSG_PlayerCreationRemoveDownSkill ) + { + uPlayerCreationUI_SelectedCharacter = uNum; v41 = 3; v1 = (char *)pParty->pPlayers; - v5 = (pGUIWindow_CurrentMenu->field_2C_focus_id - pGUIWindow_CurrentMenu->field_38) % 7 - + pGUIWindow_CurrentMenu->field_38 - + 7 * *(int *)uClass; + v5 = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 + + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; goto LABEL_44; } - if ( (signed int)v45 > 60 ) - { - if ( v45 == 62 ) - { - GUIWindow::Create(0x265u, 0x189u, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnPlus, 1); - ((Player *)&v1[6972 * uPlayerCreationUI_SelectedCharacter])->IncreaseAttribute( - (pGUIWindow_CurrentMenu->field_2C_focus_id - pGUIWindow_CurrentMenu->field_38) % 7); + if ( (signed int)pUIMessageType > UIMSG_3C ) + { + if ( pUIMessageType == UIMSG_PlayerCreationClickPlus ) + { + GUIWindow::Create(613, 393, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnPlus, 1); + (&pPlayer[uPlayerCreationUI_SelectedCharacter])->IncreaseAttribute( + (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); v42 = 0; v38 = 0; v36 = 0; @@ -3822,14 +3780,14 @@ v32 = -1; v31 = 0; v30 = 0; - v29 = (SoundID)20; + pSoundID = (SoundID)20; goto LABEL_40; } - if ( v45 == 63 ) - { - GUIWindow::Create(0x20Bu, 0x189u, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnMinus, 1); - ((Player *)&v1[6972 * uPlayerCreationUI_SelectedCharacter])->DecreaseAttribute( - (pGUIWindow_CurrentMenu->field_2C_focus_id - pGUIWindow_CurrentMenu->field_38) % 7); + if ( pUIMessageType == UIMSG_PlayerCreationClickMinus ) + { + GUIWindow::Create(523, 393, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnMinus, 1); + (&pPlayer[uPlayerCreationUI_SelectedCharacter])->DecreaseAttribute( + (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); v42 = 0; v38 = 0; v36 = 0; @@ -3837,14 +3795,13 @@ v32 = -1; v31 = 0; v30 = 0; - v29 = (SoundID)23; + pSoundID = (SoundID)23; goto LABEL_40; } - if ( v45 == 64 ) - { - auto _t = (Player *)&v1[6972 * uPlayerCreationUI_SelectedCharacter]; - v6 = _t->GetSkillIdxByOrder( - *(int *)uClass + 4); + if ( pUIMessageType == UIMSG_PlayerCreationSelectActiveSkill ) + { + auto _t = &pPlayer[uPlayerCreationUI_SelectedCharacter]; + v6 = _t->GetSkillIdxByOrder(uNum + 4); if ( _t->GetSkillIdxByOrder(3) == 37 ) pParty->pPlayers[0].pActiveSkills[v6 + 3486 * uPlayerCreationUI_SelectedCharacter] = 1; v42 = 0; @@ -3854,40 +3811,40 @@ v32 = -1; v31 = 0; v30 = 0; - v29 = (SoundID)24; + pSoundID = (SoundID)24; goto LABEL_40; } - if ( v45 == 65 ) - { - ((Player *)&v1[6972 * uPlayerCreationUI_SelectedCharacter])->Reset(uClass[0]); + if ( pUIMessageType == UIMSG_PlayerCreationSelectClass ) + { + (&pPlayer[uPlayerCreationUI_SelectedCharacter])->Reset(uNum); goto LABEL_36; } - if ( v45 == 66 ) - { - GUIWindow::Create(0x244u, 0x1AFu, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnOK, 0); + if ( pUIMessageType == UIMSG_PlayerCreationClickOK ) + { + GUIWindow::Create(580, 431, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnOK, 0); if ( PlayerCreation_ComputeAttributeBonus() || !sub_4908DE() ) GameUI_StatusBar_TimedStringTimeLeft = GetTickCount() + 4000; else uGameState = 6; continue; } - if ( v45 == 67 ) - { - GUIWindow::Create(0x20Fu, 0x1AFu, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnReset, 0); + if ( pUIMessageType == UIMSG_PlayerCreationClickReset ) + { + GUIWindow::Create(527, 431, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnReset, 0); pParty->Reset(); } else { - if ( v45 == 74 ) - { - uPlayerCreationUI_SelectedCharacter = *(int *)uClass; - v4 = pGUIWindow_CurrentMenu->field_2C_focus_id - pGUIWindow_CurrentMenu->field_38; - v46 = pGUIWindow_CurrentMenu->field_38; + if ( pUIMessageType == UIMSG_PlayerCreationRemoveUpSkill ) + { + uPlayerCreationUI_SelectedCharacter = uNum; + v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem; + v46 = pGUIWindow_CurrentMenu->pStartingPosActiveItem; v41 = 2; - v5 = v4 % 7 + v46 + 7 * *(int *)uClass; + v5 = v4 % 7 + v46 + 7 * uNum; LABEL_44: - pGUIWindow_CurrentMenu->field_2C_focus_id = v5; - pParty->pPlayers[0].pActiveSkills[((Player *)&v1[6972 * uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; + pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; continue; } @@ -3895,12 +3852,12 @@ } else { - switch ( v45 ) + switch ( pUIMessageType ) { case 60: pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0); - v3 = *(void **)uClass; - uPlayerCreationUI_SelectedCharacter = *(int *)uClass; + v3 = (void *)uNum; + uPlayerCreationUI_SelectedCharacter = uNum; pKeyActionMap->_459E5A(0, 15, pGUIWindow_CurrentMenu); pGUIWindow_CurrentMenu->ptr_1C = v3; break; @@ -3911,7 +3868,7 @@ pMouse->SetCursorBitmap("MICON2"); break; default: - if ( v45 == 58 ) + if ( pUIMessageType == 58 ) goto LABEL_114; break; } @@ -3947,17 +3904,13 @@ } //----- (0043648F) -------------------------------------------------------- -void __thiscall Vec3_short__to_RenderVertexSoft(RenderVertexSoft *_this, Vec3_short_ *a2) -{ - signed int v2; // edx@1 - double v3; // st7@1 - +void Vec3_short__to_RenderVertexSoft(RenderVertexSoft *_this, Vec3_short_ *a2) +{ _this->flt_2C = 0.0; - v2 = a2->y; - v3 = (double)a2->z; - _this->vWorldPosition.x = (double)a2->x; - _this->vWorldPosition.y = (double)v2; - _this->vWorldPosition.z = v3; + + _this->vWorldPosition.x = a2->x; + _this->vWorldPosition.y = a2->y; + _this->vWorldPosition.z = a2->z; } //----- (004369DB) -------------------------------------------------------- @@ -4713,18 +4666,18 @@ if ( v8 == 1 ) { v9 = *(short *)v1; - v10 = pParty->vPosition.z - *((short *)v1 - 100); + v10 = pParty->vPosition.y - *((short *)v1 - 100); a1 = pParty->vPosition.x - *((short *)v1 - 200); v48 = v10; if ( a1 * a1 + v10 * v10 - + ((signed int)(pParty->vPosition.y + pParty->uPartyHeight) >> (1 - v9)) - * ((signed int)(pParty->vPosition.y + pParty->uPartyHeight) >> (1 - v9)) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) + + ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) + * ((signed int)(pParty->vPosition.z + pParty->uPartyHeight) >> (1 - v9)) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) { v11.z = *(short *)v1; v11.y = *((short *)v1 - 100); v11.x = *((short *)v1 - 200); - if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y + pParty->sEyelevel, v11) ) + if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v11) ) { v12 = stru_50C198.which_player_would_attack(&pActors[v39]); DamagePlayerFromMonster(*((short *)v1 - 300), stru_50FE08.field_450[v43], pVelocity, v12); @@ -4772,16 +4725,16 @@ } else { - v23 = pParty->vPosition.z - *((short *)v1 - 100); + v23 = pParty->vPosition.y - *((short *)v1 - 100); v24 = ((signed int)pParty->uPartyHeight >> 1) - *(short *)v1; a1 = pParty->vPosition.x - *((short *)v1 - 200); v48 = v23; - if ( a1 * a1 + v23 * v23 + (pParty->vPosition.y + v24) * (pParty->vPosition.y + v24) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) + if ( a1 * a1 + v23 * v23 + (pParty->vPosition.z + v24) * (pParty->vPosition.z + v24) < (unsigned int)((*((short *)v1 + 100) + 32) * (*((short *)v1 + 100) + 32)) ) { v25.z = *(short *)v1; v25.y = *((short *)v1 - 100); v25.x = *((short *)v1 - 200); - if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.z, pParty->vPosition.y + pParty->sEyelevel, v25) ) + if ( sub_407A1C(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z + pParty->sEyelevel, v25) ) { v26 = 0; v27 = (char *)&pParty->pPlayers[0].pConditions[15]; @@ -5011,9 +4964,9 @@ v9 = (LayingItem *)uDamageAmount; v50 = pParty->vPosition.x - *(int *)(uDamageAmount + 4); v55 = abs(v50); - pMonsterName = (char *)(pParty->vPosition.z - v9->vPosition.y); + pMonsterName = (char *)(pParty->vPosition.y - v9->vPosition.y); v51 = (unsigned __int64 *)abs((int)pMonsterName); - pPlayerName = (char *)(pParty->vPosition.y - v9->vPosition.z); + pPlayerName = (char *)(pParty->vPosition.z - v9->vPosition.z); v52 = abs((int)pPlayerName); v61 = v55; v10 = v55; @@ -6398,7 +6351,7 @@ v15->field_C = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); _43C91D_FormItemTextureFilename(pContainer, 544, v14, 0); v15->field_10 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - if ( sub_43ED6F_get_some_race_sex_relation(1u) ) + if ( _43ED6F_check_party_races(true) ) papredoll_dbrds[11] = pIcons_LOD->LoadTexture("item092v3", TEXTURE_16BIT_PALETTE); v35 += 28; ++v14; @@ -6555,9 +6508,11 @@ int v8; // [sp-4h] [bp-10h]@61 signed int v9; // [sp-4h] [bp-10h]@69 + result = 0; //BUG fn is void if ( a2 <= 500 ) { - v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0; + //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0; + v5 = byte_5111C0[(a2 - 100) + 32 + 2] == 0; LABEL_21: if ( v5 ) return result; @@ -8691,37 +8646,26 @@ //----- (0043ED6F) -------------------------------------------------------- -bool __thiscall sub_43ED6F_get_some_race_sex_relation(unsigned int a1) -{ - unsigned int v1; // ebp@1 - Player **v2; // ebx@1 - Player *v3; // esi@2 - enum CHARACTER_RACE v4; // edi@2 - bool result; // eax@2 - char v6; // zf@5 - - v1 = a1; - v2 = &pPlayers[1]; - while ( 1 ) - { - v3 = *v2; - v4 = v3->GetRace(); - result = v3->GetSexByVoice(); - if ( v4 && v4 != CHARACTER_RACE_ELF && v4 != CHARACTER_RACE_GOBLIN ) - v6 = v1 == 1; +bool _43ED6F_check_party_races(bool a1) +{ + bool v6; // zf@5 + + for (uint i = 0; i < 4; ++i) + { + auto player = pParty->pPlayers + i; + auto race = player->GetRace(); + + if (race != CHARACTER_RACE_HUMAN && + race != CHARACTER_RACE_ELF && + race != CHARACTER_RACE_GOBLIN) + v6 = a1 == 1; else - v6 = v1 == 0; - if ( v6 ) - break; - ++v2; - if ( (signed int)v2 >= (signed int)&qword_A750D8 ) - { - LOBYTE(result) = 0; - return result; - } - } - LOBYTE(result) = 1; - return result; + v6 = !a1; + + if (v6) + return true; + } + return false; } // A750D8: using guessed type __int64 qword_A750D8; @@ -8957,120 +8901,79 @@ //----- (0043F333) -------------------------------------------------------- -int stru170::RenderWalls() -{ - signed int result; // eax@1 - unsigned __int8 v2; // zf@1 - unsigned __int8 v3; // sf@1 - stru170_stru0 *v4; // edx@2 - int v5; // eax@3 +void stru170::MakeVisibleSectorList() +{ int v6; // ebx@3 - char *v7; // esi@4 - signed int v8; // [sp+0h] [bp-4h]@1 - - result = 0; - v2 = this->std__vector_000FA8 == 0; - v3 = (this->std__vector_000FA8 & 0x80000000u) != 0; - this->field_53730 = 0; - v8 = 0; - if ( !(v3 | v2) ) - { - v4 = this->field_FA8; - do - { - v5 = this->field_53730; + + uNumVisibleNotEmptySectors = 0; + for (uint i = 0; i < std__vector_000FA8; ++i) + { v6 = 0; - if ( v5 <= 0 ) + if (!uNumVisibleNotEmptySectors) { LABEL_7: - this->pSectorIDs_toDrawDecorationsFrom[v5] = v4->uSectorID; - ++this->field_53730; + pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = field_FA8[i].uSectorID; } else { - v7 = (char *)this->pSectorIDs_toDrawDecorationsFrom; - while ( *(short *)v7 != v4->uSectorID ) + while (pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[v6] != field_FA8[i].uSectorID ) { ++v6; - v7 += 2; - if ( v6 >= v5 ) - goto LABEL_7; - } - } - ++v8; - ++v4; - result = v8; - } - while ( v8 < (signed int)this->std__vector_000FA8 ); - } - return result; + if ( v6 >= uNumVisibleNotEmptySectors) + { + pVisibleSectorIDs_toDrawDecorsActorsEtcFrom[uNumVisibleNotEmptySectors++] = field_FA8[i].uSectorID; + continue; + } + } + } + } } //----- (0043F515) -------------------------------------------------------- -void __cdecl MessWithBillboards_BLV() -{ - signed int v0; // edi@1 - char *v1; // esi@2 - - v0 = 0; - if ( (signed int)uNumBillboardsToDraw > 0 ) - { - v1 = (char *)&pBillboardRenderList[0].field_2A; - do - { - if ( *(v1 - 12) & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !*((short *)v1 - 7) ) - *(short *)v1 = 0; - else - *(short *)v1 = sub_43F55F((RenderBillboard *)(v1 - 42), -1); - ++v0; - v1 += 52; - } - while ( v0 < (signed int)uNumBillboardsToDraw ); +void MessWithBillboards_BLV() +{ + for (uint i = 0; i < uNumBillboardsToDraw; ++i) + { + auto p = pBillboardRenderList + i; + + if (p->field_1E & 2 || uCurrentlyLoadedLevelType == LEVEL_Indoor && !p->uIndoorSectorID) + p->uPaletteSubindex = 0; + else + p->uPaletteSubindex = _43F55F_get_billboard_light_level(p, -1); } } //----- (0043F55F) -------------------------------------------------------- -signed int __fastcall sub_43F55F(RenderBillboard *a1, signed int a2) -{ - RenderBillboard *v2; // eax@1 +int __fastcall _43F55F_get_billboard_light_level(RenderBillboard *a1, int uBaseLightLevel) +{ signed int v3; // ecx@2 - float v4; // ST08_4@6 - float v5; // ST04_4@6 - float v6; // ST00_4@6 - - v2 = a1; + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { v3 = pIndoor->pSectors[a1->uIndoorSectorID].uMinAmbientLightLevel; } else { - if ( a2 == -1 ) - v3 = a1->field_2A; + if ( uBaseLightLevel == -1 ) + v3 = a1->uPaletteSubindex; else - v3 = a2; - } - v4 = (double)v2->field_24; - v5 = (double)v2->field_22; - v6 = (double)v2->field_20; - return sub_43F5C8(v3, v2->uIndoorSectorID, v6, v5, v4); + v3 = uBaseLightLevel; + } + return _43F5C8_get_point_light_level_with_respect_to_lights(v3, a1->uIndoorSectorID, a1->some_x, a1->some_y, a1->some_z); } //----- (0043F5C8) -------------------------------------------------------- -signed int __fastcall sub_43F5C8(signed int a1, int a2, float a3, float a4, float a5) +int __fastcall _43F5C8_get_point_light_level_with_respect_to_lights(unsigned int uBaseLightLevel, int uSectorID, float x, float y, float z) { int v5; // esi@1 signed int v6; // edi@1 - char *v7; // ebx@2 int v8; // eax@6 int v9; // ebx@6 unsigned int v10; // ecx@6 unsigned int v11; // edx@9 unsigned int v12; // edx@11 signed int v13; // ecx@12 - BLVSector *v14; // esi@17 - int v15; // ecx@17 BLVLightMM7 *v16; // esi@20 int v17; // ebx@21 int v18; // eax@24 @@ -9080,7 +8983,6 @@ unsigned int v22; // edx@27 unsigned int v23; // edx@29 signed int v24; // ecx@30 - char *v25; // esi@34 int v26; // ebx@35 int v27; // eax@38 int v28; // ebx@38 @@ -9089,53 +8991,41 @@ unsigned int v31; // edx@41 unsigned int v32; // edx@43 signed int v33; // ecx@44 - int v35; // [sp+Ch] [bp-18h]@4 - BLVSector *v36; // [sp+Ch] [bp-18h]@17 int v37; // [sp+Ch] [bp-18h]@37 int v38; // [sp+10h] [bp-14h]@5 int v39; // [sp+10h] [bp-14h]@23 int v40; // [sp+10h] [bp-14h]@36 - int v41; // [sp+14h] [bp-10h]@3 int v42; // [sp+14h] [bp-10h]@22 unsigned int v43; // [sp+18h] [bp-Ch]@12 unsigned int v44; // [sp+18h] [bp-Ch]@30 unsigned int v45; // [sp+18h] [bp-Ch]@44 - char *v46; // [sp+1Ch] [bp-8h]@2 - int v47; // [sp+1Ch] [bp-8h]@17 - int v48; // [sp+20h] [bp-4h]@1 - int v49; // [sp+20h] [bp-4h]@17 - int v50; // [sp+20h] [bp-4h]@33 - - v48 = 0; - v5 = a2; - v6 = a1; - if ( uNumMobileLightsApplied > 0 ) - { - v7 = (char *)&pMobileLights[0].uRadius; - v46 = (char *)&pMobileLights[0].uRadius; - do - { - v41 = abs((signed __int64)((double)*((short *)v7 - 3) - a3)); - if ( v41 <= *(short *)v7 ) - { - v35 = abs((signed __int64)((double)*((short *)v7 - 2) - a4)); - if ( v35 <= *(short *)v7 ) - { - v38 = abs((signed __int64)((double)*((short *)v7 - 1) - a5)); - if ( v38 <= *(short *)v7 ) - { - v8 = v41; - v9 = v35; - v10 = v38; - if ( v41 < v35 ) - { - v8 = v35; - v9 = v41; - } - if ( v8 < v38 ) + + v6 = uBaseLightLevel; + for (uint i = 0; i < pMobileLightsStack->uNumLightsActive; ++i) + { + auto p = pMobileLightsStack->pLights + i; + + auto distX = abs(p->vPosition.x - x); + if ( distX <= p->uRadius) + { + auto distY = abs(p->vPosition.y - y); + if ( distY <= p->uRadius) + { + auto distZ = abs(p->vPosition.z - z); + if ( distZ <= p->uRadius) + { + v8 = distX; + v9 = distY; + v10 = distZ; + if (distX < distY) + { + v8 = distY; + v9 = distX; + } + if ( v8 < distZ ) { v11 = v8; - v8 = v38; + v8 = distZ; v10 = v11; } if ( v9 < (signed int)v10 ) @@ -9144,41 +9034,31 @@ v10 = v9; v9 = v12; } - v43 = ((unsigned int)(11 * v9) >> 5) + (v10 >> 2) + v8; - v13 = *(short *)v46; + v43 = ((unsigned int)(11 * v9) / 32) + (v10 / 4) + v8; + v13 = p->uRadius; if ( (signed int)v43 < v13 ) - v6 = v6 + ((unsigned __int64)(30i64 * (signed int)(v43 << 16) / v13) >> 16) - 30; - v7 = v46; - } - } - } - ++v48; - v7 += 18; - v46 = v7; - } - while ( v48 < uNumMobileLightsApplied ); - } + v6 += ((unsigned __int64)(30i64 * (signed int)(v43 << 16) / v13) >> 16) - 30; + } + } + } + } + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) { - v14 = &pIndoor->pSectors[v5]; - v15 = 0; - v49 = 0; - v36 = v14; - v47 = v14->uNumLights; - if ( v14->uNumLights > 0 ) - { - while ( 1 ) - { - v16 = &pIndoor->pLights[*(&v14->pLights->vPosition.x + v15)]; - if ( !(v16->uAtributes & 8) ) - { - v17 = abs((signed __int64)((double)v16->vPosition.x - a3)); + auto pSector = pIndoor->pSectors + uSectorID; + + for (uint i = 0; i < pSector->uNumLights; ++i) + { + v16 = pIndoor->pLights + pSector->pLights[i]; + if (~v16->uAtributes & 8) + { + v17 = abs(v16->vPosition.x - x); if ( v17 <= v16->uRadius ) { - v42 = abs((signed __int64)((double)v16->vPosition.y - a4)); + v42 = abs(v16->vPosition.y - y); if ( v42 <= v16->uRadius ) { - v39 = abs((signed __int64)((double)v16->vPosition.z - a5)); + v39 = abs(v16->vPosition.z - z); if ( v39 <= v16->uRadius ) { v18 = v17; @@ -9205,32 +9085,25 @@ v44 = ((unsigned int)(11 * v19) >> 5) + (v20 >> 2) + v18; v24 = v16->uRadius; if ( (signed int)v44 < v24 ) - v6 = v6 + ((unsigned __int64)(30i64 * (signed int)(v44 << 16) / v24) >> 16) - 30; + v6 += ((unsigned __int64)(30i64 * (signed int)(v44 << 16) / v24) >> 16) - 30; } } } } - v15 = v49++ + 1; - if ( v49 >= v47 ) - break; - v14 = v36; - } - } - } - v50 = 0; - if ( uNumStationaryLightsApplied > 0 ) - { - v25 = (char *)&pStationaryLights[0].uRadius; - do - { - v26 = abs((signed __int64)((double)*((short *)v25 - 3) - a3)); - if ( v26 <= *(short *)v25 ) - { - v40 = abs((signed __int64)((double)*((short *)v25 - 2) - a4)); - if ( v40 <= *(short *)v25 ) - { - v37 = abs((signed __int64)((double)*((short *)v25 - 1) - a5)); - if ( v37 <= *(short *)v25 ) + } + } + + for (uint i = 0; i < pStationaryLightsStack->uNumLightsActive; ++i) + { + auto p = pStationaryLightsStack->pLights + i; + v26 = abs(p->vPosition.x - x); + if ( v26 <= p->uRadius) + { + v40 = abs(p->vPosition.y - y); + if ( v40 <= p->uRadius) + { + v37 = abs(p->vPosition.z - z); + if ( v37 <= p->uRadius) { v27 = v26; v28 = v40; @@ -9254,17 +9127,14 @@ v28 = v32; } v45 = ((unsigned int)(11 * v28) >> 5) + (v29 >> 2) + v27; - v33 = *(short *)v25; + v33 = p->uRadius; if ( (signed int)v45 < v33 ) - v6 = v6 + ((unsigned __int64)(30i64 * (signed int)(v45 << 16) / v33) >> 16) - 30; - } - } - } - ++v50; - v25 += 12; - } - while ( v50 < uNumStationaryLightsApplied ); - } + v6 += ((unsigned __int64)(30i64 * (signed int)(v45 << 16) / v33) >> 16) - 30; + } + } + } + } + if ( v6 <= 31 ) { if ( v6 < 0 ) @@ -9276,7 +9146,6 @@ } return v6; } -// 519AB4: using guessed type int uNumStationaryLightsApplied; //----- (00406051) -------------------------------------------------------- __int16 stru262_TurnBased::StartTurn() @@ -9483,7 +9352,7 @@ if ( (signed __int16)v6 == 4 ) { v3 = 0; - v5->uAIState = 5; + v5->uAIState = Dead; v5->uCurrentActionTime = 0; v5->uCurrentActionLength = 0; v5->UpdateAnimation(); @@ -10235,7 +10104,7 @@ { v6->uCurrentActionTime = 0; v6->uCurrentActionLength = 0; - v6->uAIState = 5; + v6->uAIState = Dead; v6->UpdateAnimation(); } if ( !thisa->_406D10(a2) ) @@ -10506,11 +10375,11 @@ v5->uCurrentActionTime += pMiscTimer->uTimeElapsed; if ( (signed int)v5->uCurrentActionTime >= v5->uCurrentActionLength ) { - if ( v5->uAIState == 4 ) + if (v5->uAIState == Dying) { v5->uCurrentActionTime = 0; v5->uCurrentActionLength = 0; - v5->uAIState = 5; + v5->uAIState = Dead; v5->UpdateAnimation(); return; } @@ -10660,10 +10529,10 @@ else { v18 = pParty->vPosition.x; - v17 = pParty->sEyelevel + pParty->vPosition.y; - v60 = pParty->vPosition.z; - v44 = pParty->sEyelevel + pParty->vPosition.y; - v43 = pParty->vPosition.z; + v17 = pParty->sEyelevel + pParty->vPosition.z; + v60 = pParty->vPosition.y; + v44 = pParty->sEyelevel + pParty->vPosition.z; + v43 = pParty->vPosition.y; } v19 = pIndoor->GetSector(v18, v43, v44); } @@ -10981,7 +10850,7 @@ signed int a5a; // [sp+2Ch] [bp+10h]@14 v5 = a4; - v6 = a4->uFaceAttributes; + v6 = a4->uAttributes; v7 = 0; if ( v6 & 0x100 ) { @@ -11350,7 +11219,7 @@ sDepthb = 0; for ( i = 116 * v59; sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->field_C + v61) - + 2 * *(__int16 *)((char *)&pIndoor->pSectors->field_4 + v61); + + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v61); ++sDepthb ) { v62 = &pIndoor->pFaces[(*(unsigned __int16 **)((char *)&v60->pWalls + v61))[sDepthb]]; @@ -11504,7 +11373,7 @@ v162 = 0; v112 = v89; if ( *(__int16 *)((char *)&pIndoor->pSectors->field_C + v89) - + 2 * *(__int16 *)((char *)&pIndoor->pSectors->field_4 + v89) > 0 ) + + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 ) break; LABEL_148: ++a5c; @@ -11584,7 +11453,7 @@ v88 = pIndoor->pSectors; ++v162; if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->field_C + v89) - + 2 * *(__int16 *)((char *)&pIndoor->pSectors->field_4 + v89) ) + + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) ) goto LABEL_148; } } @@ -11915,7 +11784,7 @@ } //----- (00408896) -------------------------------------------------------- -char *__cdecl UpdateLayingItems() +void UpdateLayingItems() { unsigned int v0; // edi@1 char *v1; // esi@1 @@ -11931,14 +11800,9 @@ ++v0; } while ( (signed int)v1 < (signed int)((char *)&pObjectList->uNumObjects + 2) ); - result = (char *)&array_5118E8.pElements[0].field_C; - do - { - *(short *)result = 0; - result += 24; - } - while ( (signed int)result < (signed int)&pBillboardRenderList[0].field_4 ); - return result; + + for (uint i = 0; i < 100; ++i) + array_5118E8.pElements[i].field_C_time_left = 0; } //----- (004088E9) -------------------------------------------------------- @@ -12190,14 +12054,14 @@ if ( bSolidFill ) { for ( i = v3->y; (signed int)i <= v3->w; ++i ) - pRenderer->FillRect(v3->x, i, v3->z, i, v4); - } - else - { - pRenderer->FillRect(v3->x, v3->y, v3->z, v3->y, v4); - pRenderer->FillRect(v3->z, v3->y, v3->z, v3->w, v4); - pRenderer->FillRect(v3->z, v3->w, v3->x, v3->w, v4); - pRenderer->FillRect(v3->x, v3->w, v3->x, v3->y, v4); + pRenderer->Line2D(v3->x, i, v3->z, i, v4); + } + else + { + pRenderer->Line2D(v3->x, v3->y, v3->z, v3->y, v4); + pRenderer->Line2D(v3->z, v3->y, v3->z, v3->w, v4); + pRenderer->Line2D(v3->z, v3->w, v3->x, v3->w, v4); + pRenderer->Line2D(v3->x, v3->w, v3->x, v3->y, v4); } pRenderer->EndScene(); } @@ -12646,7 +12510,7 @@ v1 = pPlayers[uActiveCharacter]; v10 = _this; - v2 = &pSpellStats->pInfos[(signed int)((char *)_this + 11 * v1->field_1A4E) + 1]; + v2 = &pSpellStats->pInfos[(signed int)((char *)_this + 11 * v1->pNumSpellBookPage) + 1]; if ( pMouse->GetCursorPos(&a2)->y <= 250 ) v3 = pMouse->GetCursorPos(&a2)->y + 30; else @@ -12657,7 +12521,7 @@ a1.uFrameX = 90; a1.uFrameZ = 417; a1.uFrameW = v3 + 67; - a1.str_48 = 0; + a1.Hint = 0; a2.y = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[431]); v13 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[433]); v12 = pFontSmallnum->GetLineWidth(pGlobalTXT_LocalizationStrings[432]); @@ -12694,7 +12558,7 @@ if ( (signed int)a1.uFrameHeight < 150 ) a1.uFrameHeight = 150; a1.uFrameWidth = 460; - a1._415551(0); + a1.DrawMessageBox(0); a1.uFrameWidth -= 12; a1.uFrameHeight -= 12; v7 = v2->pName; @@ -12705,14 +12569,14 @@ a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0); a1.uFrameWidth = 108; a1.uFrameZ = a1.uFrameX + 107; - a1.DrawText2(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->field_1A4E + 12], 3u); + a1.DrawText2(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->pNumSpellBookPage + 12], 3u); sprintfex( pTmpBuf, "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].field_14 - + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->field_1A4E + 12]) >> 6) - + 10 * (int)((char *)v10 + 11 * v1->field_1A4E))); + + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->pNumSpellBookPage + 12]) >> 6) + + 10 * (int)((char *)v10 + 11 * v1->pNumSpellBookPage))); a1.DrawText2(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3u); dword_507B00_spell_info_to_draw_in_popup = 0; } @@ -13127,7 +12991,7 @@ //----- (00411473) -------------------------------------------------------- void __cdecl sub_411473() { - char *v0; // esi@1 + Texture **v0; // esi@1 Texture **v1; // edi@1 Texture *v2; // ecx@2 Texture *v3; // ecx@2 @@ -13135,7 +12999,7 @@ pTexture_pagemask->Release(); pTexture_506448->Release(); pTexture_50643C->Release(); - v0 = &pTextures_tabs[0][0].pName[4]; + v0 = &pTextures_tabs[0][1]; v1 = pTextures_5064A0; do { @@ -13224,7 +13088,7 @@ sub_412AF9(); v0 = pPlayers[uActiveCharacter]; - v1 = 11 * v0->field_1A4E; + v1 = 11 * v0->pNumSpellBookPage; v2 = pIcons_LOD->FindTextureByName("Pending"); v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0); pRenderer->ClearZBuffer(0, 479); @@ -13250,14 +13114,14 @@ } if ( v6->pLevelOfDetail0 ) { - v7 = 2 * (12 * v0->field_1A4E + (unsigned __int8)*(&byte_4E2430[12 * v0->field_1A4E] + v4)); + v7 = 2 * (12 * v0->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2430[12 * v0->pNumSpellBookPage + v4])); v19 = pViewport->uViewportY + dword_4E20D0[v7 + 1]; v17 = pViewport->uViewportX + dword_4E20D0[v7]; if ( BYTE1(v6->pBits) & 2 ) pRenderer->DrawTextureTransparent(v17, v19, v6); else pRenderer->DrawTextureIndexed(v17, v19, v6); - v8 = 2 * (12 * v0->field_1A4E + (unsigned __int8)*(&byte_4E2430[12 * v0->field_1A4E] + v4)); + v8 = 2 * (12 * v0->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2430[12 * v0->pNumSpellBookPage] + v4)); pRenderer->_4A612A(dword_4E20D0[v8], dword_4E20D0[v8 + 1], (Texture *)v23[0], v4); } } @@ -13274,7 +13138,7 @@ if ( v11->pLevelOfDetail0 ) { v21 = dword_5063D8[v10]; - v12 = 2 * (12 * v0->field_1A4E + (unsigned __int8)*(&byte_4E2430[12 * v0->field_1A4E] + v10)); + v12 = 2 * (12 * v0->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2430[12 * v0->pNumSpellBookPage] + v10)); v20 = pViewport->uViewportY + dword_4E20D0[v12 + 1]; v18 = pViewport->uViewportX + dword_4E20D0[v12]; if ( BYTE1(v11->pBits) & 2 ) @@ -13292,9 +13156,9 @@ { if ( *(short *)a2.x ) { - if ( v0->field_1A4E == v13 ) - { - v16 = *(Texture **)&pTextures_tabs[0][0].pName[8 * v13 + 4]; + if ( v0->pNumSpellBookPage == v13 ) + { + v16 = pTextures_tabs[v13][1]; switch ( v13 ) { case 0: @@ -13334,7 +13198,7 @@ } else { - v16 = *(Texture **)&pTextures_tabs[0][0].pName[8 * v13]; + v16 = pTextures_tabs[v13][0]; switch ( v13 ) { case 0: @@ -14039,7 +13903,7 @@ if ( v7 ) v22.DrawText2(pBook2Font, 0xFFFFFFF2u, 0xCu, 0, pMapStats->pInfos[v7].pName, 3u); v22.uFrameX = 0; - sprintfex(Str, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.z); + sprintfex(Str, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.y); return v22.DrawText2(pFontComic, 0, 0x140u, 0, Str, 0); } @@ -14245,28 +14109,28 @@ v2 = pStr; v3 = a4; pEventTimer->Pause(); - dword_506F0C[0] = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; + dword_506F0C[0] = pCurrentScreen; result = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, v3, (int)v2); ptr_507BDC = result; - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 22; + pCurrentScreen = 22; return result; } -// 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; +// 4E28F8: using guessed type int pCurrentScreen; //----- (0041420D) -------------------------------------------------------- void __cdecl sub_41420D_press_esc() { GUIWindow v0; // [sp+4h] [bp-54h]@1 - sprintfex(pTmpBuf2, "%s\n \n%s", ptr_507BDC->str_48, pGlobalTXT_LocalizationStrings[61]);// Press Escape - v0.str_48 = pTmpBuf2; + sprintfex(pTmpBuf2, "%s\n \n%s", ptr_507BDC->Hint, pGlobalTXT_LocalizationStrings[61]);// Press Escape + v0.Hint = pTmpBuf2; v0.uFrameWidth = 400; v0.uFrameHeight = 100; v0.uFrameX = 120; v0.uFrameY = 140; v0.uFrameZ = 519; v0.uFrameW = 239; - v0._415551(0); + v0.DrawMessageBox(0); } //----- (0041426F) -------------------------------------------------------- @@ -14284,10 +14148,10 @@ } v0->Release(); ptr_507BDC = 0; - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = dword_506F0C[0]; + pCurrentScreen = dword_506F0C[0]; pEventTimer->Resume(); } -// 4E28F8: using guessed type int uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions; +// 4E28F8: using guessed type int pCurrentScreen; //----- (004142D3) -------------------------------------------------------- char __cdecl GameMenuUI_DrawKeyBindings() @@ -14835,7 +14699,7 @@ Dst.uFrameY = 470 - Dst.uFrameHeight; Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; Dst.uFrameW = 469; - Dst._415551(0); + Dst.DrawMessageBox(0); Dst.uFrameWidth -= 24; Dst.uFrameX += 12; Dst.uFrameY += 12; @@ -14851,8 +14715,8 @@ //----- (004156F0) -------------------------------------------------------- void __cdecl GUI_UpdateWindows() { - GUIWindow *v0; // esi@4 - unsigned int v1; // eax@4 + GUIWindow *pWindow; // esi@4 + unsigned int pWindowType; // eax@4 int v2; // eax@10 int v3; // eax@11 int v4; // eax@12 @@ -14909,10 +14773,10 @@ for ( i = 1; i <= uNumVisibleWindows; ++i ) { //v0 = (GUIWindow *)&pWindowList_at_506F50_minus1_indexing[21 * pVisibleWindowsIdxs[i]]; - v0 = &pWindowList[pVisibleWindowsIdxs[i] - 1]; - v1 = v0->eWindowType; - - switch (v0->eWindowType) + pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; + pWindowType = pWindow->eWindowType; + + switch (pWindow->eWindowType) { case WINDOW_MainMenu_Load: GameUI_MainMenu_DrawLoad(); @@ -14920,16 +14784,16 @@ case WINDOW_5E: // window that initiates savegame loading { - if (v0->str_48 != (char *)1) + if (pWindow->Hint != (char *)1) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); - auto v20 = (GUIButton *)v0->ptr_1C; - pRenderer->DrawTextureIndexed(v0->uFrameX, v0->uFrameY, v20->pTextures[0]); - v21 = v0->str_48; + auto v20 = (GUIButton *)pWindow->ptr_1C; + pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, v20->pTextures[0]); + v21 = pWindow->Hint; viewparams->bRedrawGameUI = 1; if ( v21 && v21 != (char *)1 ) v20->DrawLabel(v21, pFontCreate, 0, 0); - v0->Release(); - if (uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 11) + pWindow->Release(); + if (pCurrentScreen == 11) pMessageQueue_50CBD0->SendMessage(UIMSG_SaveGame, 0, 0); else pMessageQueue_50CBD0->SendMessage(UIMSG_LoadGame, 0, 0); @@ -14938,22 +14802,22 @@ } - if ( (signed int)v1 > 70 ) - { - if ( (signed int)v1 > 95 ) - { - v33 = v1 - 96; + if ( (signed int)pWindowType > 70 ) + { + if ( (signed int)pWindowType > 95 ) + { + v33 = pWindowType - 96; if ( !v33 ) { - if ( v0->str_48 != (char *)1 ) + if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); - v42 = (GUIButton *)v0->ptr_1C; - pRenderer->DrawTextureIndexed(v0->uFrameX, v0->uFrameY, v42->pTextures[0]); - v43 = v0->str_48; + v42 = (GUIButton *)pWindow->ptr_1C; + pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, v42->pTextures[0]); + v43 = pWindow->Hint; viewparams->bRedrawGameUI = 1; if ( v43 && v43 != (char *)1 ) v42->DrawLabel(v43, pFontCreate, 0, 0); - v0->Release(); + pWindow->Release(); if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; v41 = pMessageQueue_50CBD0->uNumMessages; @@ -14990,15 +14854,15 @@ } else { - v0->_415551(0); - v0->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); - v0->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); + pWindow->DrawMessageBox(0); + pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); + pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); if ( !pKeyActionMap->field_204 ) { v51.Reset(); - v0->Release(); + pWindow->Release(); pEventTimer->Resume(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; viewparams->bRedrawGameUI = 1; v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); if ( v39 > 0 ) @@ -15010,9 +14874,9 @@ } continue; } - v46 = (Texture *)*((_DWORD *)v0->ptr_1C + 15); - v45 = v0->uFrameY; - v44 = v0->uFrameX; + v46 = (Texture *)*((_DWORD *)pWindow->ptr_1C + 15); + v45 = pWindow->uFrameY; + v44 = pWindow->uFrameX; LABEL_18: pRenderer->DrawTextureIndexed(v44, v45, v46); LABEL_114: @@ -15028,51 +14892,51 @@ Dst.uHeight = 37; Dst.pParent = pButton_RestUI_WaitUntilDawn->pParent; pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); - pRenderer->DrawTextureIndexed(v0->uFrameX, v0->uFrameY, *((Texture **)v0->ptr_1C + 15)); + pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 15)); viewparams->bRedrawGameUI = 1; Dst.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, 0, 0); Dst.pParent = 0; goto LABEL_134; } - if ( v0->str_48 != (char *)1 ) + if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); - v32 = v0->ptr_1C; - pRenderer->DrawTextureIndexed(v0->uFrameX, v0->uFrameY, *((Texture **)v32 + 16)); + v32 = pWindow->ptr_1C; + pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)v32 + 16)); goto LABEL_138; } - if ( v1 == 95 ) - { - if ( v0->str_48 != (char *)1 ) + if ( pWindowType == 95 ) + { + if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); - v32 = v0->ptr_1C; - pRenderer->DrawTextureTransparent(v0->uFrameX, v0->uFrameY, *((Texture **)v32 + 15)); + v32 = pWindow->ptr_1C; + pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)v32 + 15)); LABEL_138: - v40 = v0->str_48; + v40 = pWindow->Hint; viewparams->bRedrawGameUI = 1; if ( v40 && v40 != (char *)1 ) ((GUIButton *)v32)->DrawLabel(v40, pFontCreate, 0, 0); - v0->Release(); + pWindow->Release(); LABEL_142: v41 = pMessageQueue_50CBD0->uNumMessages; if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) goto LABEL_151; continue; } - v14 = v1 - 80; + v14 = pWindowType - 80; if ( v14 ) { v15 = v14 - 9; if ( !v15 ) { - v0->_415551(0); - v0->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); - v0->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); + pWindow->DrawMessageBox(0); + pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); + pWindow->DrawText(pFontLucida, 10, 40, 0, (const char *)pKeyActionMap->pPressedKeysBuffer, 0, 0, 0); if ( !pKeyActionMap->field_204 ) { _this.Reset(); - v0->Release(); + pWindow->Release(); pEventTimer->Resume(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; viewparams->bRedrawGameUI = 1; v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); if ( v26 > 0 ) @@ -15101,9 +14965,9 @@ v16 = v15 - 1; if ( !v16 ) { - if ( v0->str_48 != (char *)1 ) + if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); - v22 = (GUIButton *)v0->ptr_1C; + v22 = (GUIButton *)pWindow->ptr_1C; if ( (v22->uX & 0x80000000u) == 0 ) { if ( (signed int)v22->uX <= 640 ) @@ -15119,7 +14983,7 @@ } } } - v23 = v0->str_48; + v23 = pWindow->Hint; viewparams->bRedrawGameUI = 1; if ( v23 ) { @@ -15127,20 +14991,20 @@ goto LABEL_82; } LABEL_134: - v28 = v0; + v28 = pWindow; goto LABEL_110; } v17 = v16 - 1; if ( !v17 ) { - if ( v0->str_48 != (char *)1 ) + if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); - v22 = (GUIButton *)v0->ptr_1C; + v22 = (GUIButton *)pWindow->ptr_1C; v47 = v22->pTextures[1]; LABEL_94: - pRenderer->DrawTextureIndexed(v0->uFrameX, v0->uFrameY, v47); + pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, v47); LABEL_80: - v23 = v0->str_48; + v23 = pWindow->Hint; viewparams->bRedrawGameUI = 1; if ( v23 ) { @@ -15154,18 +15018,18 @@ v18 = v17 - 1; if ( !v18 ) { - if ( v0->str_48 != (char *)1 ) + if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); - v22 = (GUIButton *)v0->ptr_1C; - pRenderer->DrawTextureTransparent(v0->uFrameX, v0->uFrameY, v22->pTextures[0]); + v22 = (GUIButton *)pWindow->ptr_1C; + pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, v22->pTextures[0]); goto LABEL_80; } v19 = v18 - 1; if ( !v19 ) { - if ( v0->str_48 != (char *)1 ) + if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); - pRenderer->DrawTextureTransparent(v0->uFrameX, v0->uFrameY, *((Texture **)v0->ptr_1C + 16)); + pRenderer->DrawTextureTransparent(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)pWindow->ptr_1C + 16)); viewparams->bRedrawGameUI = 1; goto LABEL_134; } @@ -15175,7 +15039,7 @@ v27 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); if ( ptr_507BD0->field_40 == 1 ) { - ptr_507BD0->_415551(0); + ptr_507BD0->DrawMessageBox(0); ptr_507BD0->DrawText( pFontCreate, 30, @@ -15193,7 +15057,7 @@ if ( ptr_507BD0->field_40 == 2 ) { v29 = pMessageQueue_50CBD0->uNumMessages; - v0->field_40 = 0; + pWindow->field_40 = 0; if ( (signed int)v29 < 40 ) { pMessageQueue_50CBD0->pMessages[v29].eType = (UIMessageType)(int)ptr_507BD0->ptr_1C; @@ -15203,12 +15067,12 @@ } pEventTimer->Resume(); ptr_507BD0->Release(); - uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; + pCurrentScreen = 0; goto LABEL_114; } if ( ptr_507BD0->field_40 == 3 ) { - v0->field_40 = 0; + pWindow->field_40 = 0; pEventTimer->Resume(); v28 = ptr_507BD0; LABEL_110: @@ -15219,16 +15083,16 @@ } else { - if ( v1 == 70 ) + if ( pWindowType == 70 ) { sub_41420D_press_esc(); continue; } - if ( (signed int)v1 > 18 ) - { - if ( (signed int)v1 > 25 ) - { - v12 = v1 - 26; + if ( (signed int)pWindowType > 18 ) + { + if ( (signed int)pWindowType > 25 ) + { + v12 = pWindowType - 26; if ( v12 ) { v13 = v12 - 4; @@ -15257,9 +15121,9 @@ } continue; } - if ( v1 != 25 ) - { - v7 = v1 - 19; + if ( pWindowType != 25 ) + { + v7 = pWindowType - 19; if ( v7 ) { v8 = v7 - 1; @@ -15278,13 +15142,13 @@ } else { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 10 ) + if ( pCurrentScreen == 10 ) { - Chest::DrawChestUI((unsigned int)v0->ptr_1C); + Chest::DrawChestUI((unsigned int)pWindow->ptr_1C); } else { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 15 ) + if ( pCurrentScreen == 15 ) { pRenderer->ClearZBuffer(0, 479); draw_leather(); @@ -15324,15 +15188,15 @@ } goto LABEL_142; } - if ( v1 == 18 ) + if ( pWindowType == 18 ) { sub_412B58(); } else { - if ( (signed int)v1 > 10 ) - { - v5 = v1 - 12; + if ( (signed int)pWindowType > 10 ) + { + v5 = pWindowType - 12; if ( v5 ) { v6 = v5 - 4; @@ -15352,9 +15216,9 @@ } continue; } - if ( v1 != 10 ) - { - v2 = v1 - 3; + if ( pWindowType != 10 ) + { + v2 = pWindowType - 3; if ( v2 ) { v3 = v2 - 1; @@ -15364,7 +15228,7 @@ if ( v4 ) { if ( v4 == 3 ) - DrawSpellbook((unsigned int)v0->ptr_1C); + DrawSpellbook((unsigned int)pWindow->ptr_1C); } else { @@ -15482,7 +15346,7 @@ if ( !v0->CanAct() ) { sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[427], v0->pName, pGlobalTXT_LocalizationStrings[541]); - v43.str_48 = pTmpBuf; + v43.Hint = pTmpBuf; v43.uFrameWidth = 384; v43.uFrameHeight = 180; v43.uFrameY = 40; @@ -15491,7 +15355,7 @@ else v38 = pMouse->GetCursorPos(&a2)->x - 414; v43.uFrameX = v38; - v43._415551(0); + v43.DrawMessageBox(0); return; } --pOut.z; @@ -15695,7 +15559,7 @@ v42 = (int *)&a2.y; v41 = (int *)&y.y; v40 = (int *)&pOut; - v39.z = pParty->vPosition.y + pParty->sEyelevel; + v39.z = pParty->vPosition.z + pParty->sEyelevel; } else { @@ -15769,7 +15633,7 @@ v42 = (int *)&a2.y; v41 = (int *)&y.y; v40 = (int *)&pOut; - v39.z = pParty->vPosition.y + pParty->sEyelevel; + v39.z = pParty->vPosition.z + pParty->sEyelevel; } *(_QWORD *)&v39.x = *(_QWORD *)&pParty->vPosition.x; Vec3_int_::Rotate(64, pParty->sRotationY, pParty->sRotationX, v39, v40, v41, v42); @@ -15898,9 +15762,9 @@ { lpsz = (LPCSTR)*(&pNPCStats->field_13A64 + 5 * v6->uProfession); if ( !lpsz ) - lpsz = nullstring; - } - a1.str_48 = 0; + lpsz = ""; + } + a1.Hint = 0; a1.uFrameX = 38; a1.uFrameY = 60; a1.uFrameWidth = 276; @@ -15912,7 +15776,7 @@ a1.uFrameHeight = 130; a1.uFrameWidth = 400; a1.uFrameZ = a1.uFrameX + 399; - a1._415551(0); + a1.DrawMessageBox(0); sprintfex(pTmpBuf2, "NPC%03d", v6->uPortraitID); v8 = pIcons_LOD->LoadTexture(pTmpBuf2, TEXTURE_16BIT_PALETTE); pRenderer->DrawTextureIndexed( @@ -15980,7 +15844,7 @@ unsigned int pX; // [sp+70h] [bp-8h]@3 unsigned int pY; // [sp+74h] [bp-4h]@3 - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 16 ) + if ( pCurrentScreen == 16 ) return; if ( _this ) { @@ -16019,10 +15883,11 @@ while ( v1 < 4 ); } pEventTimer->Pause(); - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions <= 10 ) - { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 10 ) - { + if ( pCurrentScreen <= 10 ) + { + if ( pCurrentScreen == 10 ) + { + __debugbreak(); if ( !pPlayers[uActiveCharacter]->CanAct() ) { sprintfex( @@ -16030,7 +15895,7 @@ pGlobalTXT_LocalizationStrings[427], pPlayers[uActiveCharacter]->pName, pGlobalTXT_LocalizationStrings[541]); - a1.str_48 = pTmpBuf; + a1.Hint = pTmpBuf; a1.uFrameWidth = 384; a1.uFrameHeight = 180; a1.uFrameY = 40; @@ -16054,13 +15919,13 @@ } else { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions ) - { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 3 ) - { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 7 ) - { - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 8 ) + if ( pCurrentScreen ) + { + if ( pCurrentScreen != 3 ) + { + if ( pCurrentScreen != 7 ) + { + if ( pCurrentScreen == 8 ) { if ( dword_507B00_spell_info_to_draw_in_popup ) DrawSpellDescriptionPopup((void *)(dword_507B00_spell_info_to_draw_in_popup - 1)); @@ -16069,7 +15934,7 @@ } LABEL_119: if ( (signed int)pX > 467 - && uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 14 ) + && pCurrentScreen != 14 ) { LABEL_126: identify_item(); @@ -16098,7 +15963,7 @@ || (signed int)pX > (signed int)pViewport->uViewportZ || (signed int)pY < (signed int)pViewport->uViewportY || (signed int)pY > (signed int)pViewport->uViewportW - || (v2 = (char *)sub_444564(), (a1.str_48 = v2) == 0) ) + || (v2 = (char *)sub_444564(), (a1.Hint = v2) == 0) ) goto LABEL_132; v30 = (double)(pFontArrus->GetLineWidth(v2) + 32); v27 = v30 + 6.7553994e15; @@ -16108,20 +15973,21 @@ a1.uFrameY = pY + 5; goto LABEL_41; } - if ( (GetCurrentMenuID() & 0x80000000u) == 0 ) + if (GetCurrentMenuID() > 0) goto LABEL_132; + if ( (signed int)pY > (signed int)pViewport->uViewportW ) { a1.ptr_1C = (void *)((signed int)pX / 118); if ( (signed int)pX / 118 < 4 ) { - a1.str_48 = 0; + a1.Hint = 0; a1.uFrameWidth = 400; a1.uFrameHeight = 200; a1.uFrameX = 38; a1.uFrameY = 60; pAudioPlayer->StopChannels(-1, -1); - a1._41D3B7(); + a1.DrawQuickCharRecord(); } goto LABEL_132; } @@ -16131,7 +15997,7 @@ { if ( (signed int)pX >= 476 && (signed int)pX <= 636 && (signed int)pY >= 240 && (signed int)pY <= 300 ) { - a1.str_48 = 0; + a1.Hint = 0; a1.uFrameWidth = 400; a1.uFrameHeight = 200; a1.uFrameX = 38; @@ -16155,7 +16021,7 @@ sub_416B01(v3); goto LABEL_132; } - a1.str_48 = _4443D5_GetMinimapRightClickText(); + a1.Hint = _4443D5_GetMinimapRightClickText(); a1.uFrameWidth = 256; a1.uFrameX = 130; a1.uFrameY = 140; @@ -16163,10 +16029,10 @@ a1.uFrameHeight = 64; pAudioPlayer->StopChannels(-1, -1); LABEL_42: - a1._415551(0); + a1.DrawMessageBox(0); goto LABEL_132; } - a1.str_48 = 0; + a1.Hint = 0; a1.uFrameWidth = 320; a1.uFrameHeight = 320; v4 = pX - 350; @@ -16185,13 +16051,13 @@ { if ( pRenderer->uNumSceneBegins ) { - a1._415551(1); + a1.DrawMessageBox(1); MonsterPopup_Draw(v6 >> 3, &a1); } else { pRenderer->BeginScene(); - a1._415551(1); + a1.DrawMessageBox(1); MonsterPopup_Draw(v6 >> 3, &a1); pRenderer->EndScene(); } @@ -16206,22 +16072,22 @@ GameUI_DrawItemInfo(v8); goto LABEL_132; } - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 13 ) + if ( pCurrentScreen == 13 ) { if ( (signed int)pY < 345 && (signed int)pX < 469 ) sub_4B1A2D(); goto LABEL_132; } - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions <= 13 ) + if ( pCurrentScreen <= 13 ) goto LABEL_132; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions <= 15 ) + if ( pCurrentScreen <= 15 ) goto LABEL_119; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions != 21 ) - { - v11 = uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 23; + if ( pCurrentScreen != 21 ) + { + v11 = pCurrentScreen == 23; goto LABEL_125; } - a1.str_48 = 0; + a1.Hint = 0; v12 = pGUIWindow_CurrentMenu->pControlsHead; if ( !v12 ) goto LABEL_132; @@ -16240,7 +16106,7 @@ { if ( v15 == 65 ) { - a1.str_48 = pClassDescriptions[v12->uControlParam]; + a1.Hint = pClassDescriptions[v12->uControlParam]; v14 = pClassNames[v12->uControlParam]; } else @@ -16258,7 +16124,7 @@ v18 = pParty->pPlayers[uPlayerCreationUI_SelectedCharacter].GetSkillIdxByOrder( v12->uControlParam + 4); v14 = pSkillNames[v18]; - a1.str_48 = pSkillDesc[v18]; + a1.Hint = pSkillDesc[v18]; v13 = pY; } goto LABEL_117; @@ -16273,7 +16139,7 @@ } goto LABEL_116; } - a1.str_48 = pAttributeDescriptions[(signed int)v12->uControlParam % 7]; + a1.Hint = pAttributeDescriptions[(signed int)v12->uControlParam % 7]; v14 = aAttributeNames[(signed int)v12->uControlParam % 7]; } goto LABEL_117; @@ -16305,7 +16171,7 @@ v14 = pParty->pPlayers[v20].pName; v19 = pClassDescriptions[pParty->pPlayers[v20].uClass]; LABEL_116: - a1.str_48 = v19; + a1.Hint = v19; goto LABEL_117; } goto LABEL_117; @@ -16317,14 +16183,14 @@ goto LABEL_117; v22 = CharacterUI_GetSkillDescText(v12->uControlParam, (enum PLAYER_SKILL_TYPE)v21); strcpy(pTmpBuf2, v22); - a1.str_48 = pTmpBuf2; + a1.Hint = pTmpBuf2; v14 = pSkillNames[pY]; LABEL_112: - v23 = a1.str_48; - if ( a1.str_48 ) - { - v24 = a1.str_48; - a1.str_48 = 0; + v23 = a1.Hint; + if ( a1.Hint ) + { + v24 = a1.Hint; + a1.Hint = 0; a1.uFrameWidth = 384; a1.uFrameHeight = 256; a1.uFrameX = 128; @@ -16334,7 +16200,7 @@ + 24; a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1; a1.uFrameW = a1.uFrameY + a1.uFrameHeight - 1; - a1._415551(0); + a1.DrawMessageBox(0); a1.uFrameX += 12; a1.uFrameWidth -= 24; a1.uFrameY += 12; @@ -16370,7 +16236,7 @@ unsigned int pY; // [sp+18h] [bp-4h]@7 pXY_ = pXY; - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions == 16 + if ( pCurrentScreen == 16 || sub_4637E0_is_there_popup_onscreen() ) return; if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 ) @@ -16391,7 +16257,7 @@ y = pY; x = pX; } - if ( uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions + if ( pCurrentScreen || !dword_507B98_ctrl_pressed ) goto LABEL_30; v4 = GetCurrentMenuID(); @@ -16528,7 +16394,7 @@ } //----- (004178FE) -------------------------------------------------------- -unsigned int __fastcall sub_4178FE(signed int a1, signed int a2) +unsigned int __fastcall UI_GetHealthManaStringColor(signed int a1, signed int a2) { unsigned __int16 v2; // dx@2 unsigned __int16 v3; // cx@2 @@ -16625,7 +16491,7 @@ Dst.uFrameHeight = pFontSmallnum->CalcTextHeight(v2, &Dst, 24, 0) + 2 * LOBYTE(pFontLucida->uFontHeight) + 24; Dst.uFrameZ = Dst.uFrameX + Dst.uFrameWidth - 1; Dst.uFrameW = Dst.uFrameY + Dst.uFrameHeight - 1; - Dst._415551(0); + Dst.DrawMessageBox(0); Dst.uFrameX += 12; Dst.uFrameWidth -= 24; Dst.uFrameY += 12; @@ -17286,14 +17152,14 @@ v4 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); else v4 = 0xFFFFu; - sprintfex(pTmpBuf2, &byte_4E2F14, pGlobalTXT_LocalizationStrings[207], v4, pPlayer->uSkillPoints); + sprintfex(pTmpBuf2, "\xC" "00000\xD" "180%s: \xC%05d%d\xC" "00000\n\n\n", pGlobalTXT_LocalizationStrings[207], v4, pPlayer->uSkillPoints); strcat(pTmpBuf, pTmpBuf2); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf, 0, 0, 0); v5 = pPlayer->GetBaseStrength(); v6 = pPlayer->GetActualMight(); v7 = pPlayer->GetBaseStrength(); v8 = pPlayer->GetActualMight(); - v9 = sub_4178FE(v8, v7); + v9 = UI_GetHealthManaStringColor(v8, v7); sprintfex(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[144], v9, v6, v5); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 53, 0, pTmpBuf, 0, 0, 0); v10 = LOBYTE(pFontArrus->uFontHeight) + 51; @@ -17301,7 +17167,7 @@ v12 = pPlayer->GetActualIntelligence(); v13 = pPlayer->GetBaseIntelligence(); v14 = pPlayer->GetActualIntelligence(); - v15 = sub_4178FE(v14, v13); + v15 = UI_GetHealthManaStringColor(v14, v13); sprintfex(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[116], v15, v12, v11); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); v16 = LOBYTE(pFontArrus->uFontHeight) + v10 - 2; @@ -17309,7 +17175,7 @@ v18 = pPlayer->GetActualWillpower(); v19 = pPlayer->GetBaseWillpower(); v20 = pPlayer->GetActualWillpower(); - v21 = sub_4178FE(v20, v19); + v21 = UI_GetHealthManaStringColor(v20, v19); sprintfex(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[163], v21, v18, v17); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v16, 0, pTmpBuf, 0, 0, 0); v22 = LOBYTE(pFontArrus->uFontHeight) + v16 - 2; @@ -17317,7 +17183,7 @@ v24 = pPlayer->GetActualEndurance(); v25 = pPlayer->GetBaseEndurance(); v26 = pPlayer->GetActualEndurance(); - v27 = sub_4178FE(v26, v25); + v27 = UI_GetHealthManaStringColor(v26, v25); sprintfex(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[75], v27, v24, v23); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v22, 0, pTmpBuf, 0, 0, 0); v28 = LOBYTE(pFontArrus->uFontHeight) + v22 - 2; @@ -17325,7 +17191,7 @@ v30 = pPlayer->GetActualAccuracy(); v31 = pPlayer->GetBaseAccuracy(); v32 = pPlayer->GetActualAccuracy(); - v33 = sub_4178FE(v32, v31); + v33 = UI_GetHealthManaStringColor(v32, v31); sprintfex(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[1], v33, v30, v29); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v28, 0, pTmpBuf, 0, 0, 0); v34 = LOBYTE(pFontArrus->uFontHeight) + v28 - 2; @@ -17333,7 +17199,7 @@ v36 = pPlayer->GetActualSpeed(); v37 = pPlayer->GetBaseSpeed(); v38 = pPlayer->GetActualSpeed(); - v39 = sub_4178FE(v38, v37); + v39 = UI_GetHealthManaStringColor(v38, v37); sprintfex(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[211], v39, v36, v35); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v34, 0, pTmpBuf, 0, 0, 0); v40 = LOBYTE(pFontArrus->uFontHeight) + v34 - 2; @@ -17341,7 +17207,7 @@ v42 = pPlayer->GetActualLuck(); v43 = pPlayer->GetBaseLuck(); v44 = pPlayer->GetActualLuck(); - v45 = sub_4178FE(v44, v43); + v45 = UI_GetHealthManaStringColor(v44, v43); sprintfex(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[136], v45, v42, v41); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v40, 0, pTmpBuf, 0, 0, 0); a2 = "%s"; @@ -17351,7 +17217,7 @@ v47 = pPlayer->GetMaxHealth(); v48 = pPlayer->sHealth; v49 = pPlayer->GetMaxHealth(); - v50 = sub_4178FE(pPlayer->sHealth, v49); + v50 = UI_GetHealthManaStringColor(pPlayer->sHealth, v49); sprintfex(pTmpBuf, a2, pGlobalTXT_LocalizationStrings[108], v50, v48, v47); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v46, 0, pTmpBuf, 0, 0, 0); a2a = "%s"; @@ -17361,7 +17227,7 @@ v51 = pPlayer->GetMaxMana(); v52 = pPlayer->sMana; v53 = pPlayer->GetMaxMana(); - v54 = sub_4178FE(pPlayer->sMana, v53); + v54 = UI_GetHealthManaStringColor(pPlayer->sMana, v53); sprintfex(pTmpBuf, a2a, pGlobalTXT_LocalizationStrings[212], v54, v52, v51); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, uY, 0, pTmpBuf, 0, 0, 0); v55 = LOBYTE(pFontArrus->uFontHeight) + uY - 2; @@ -17369,7 +17235,7 @@ v57 = pPlayer->GetActualAC(); v58 = pPlayer->GetBaseAC(); v59 = pPlayer->GetActualAC(); - v60 = sub_4178FE(v59, v58); + v60 = UI_GetHealthManaStringColor(v59, v58); sprintfex(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[12], v60, v57, v56); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v55, 0, pTmpBuf, 0, 0, 0); v61 = v55 + 2 * LOBYTE(pFontArrus->uFontHeight) - 2; @@ -17390,7 +17256,7 @@ v69 = pPlayer->GetActualAge(); v70 = pPlayer->GetBaseAge(); v71 = pPlayer->GetActualAge(); - v72 = sub_4178FE(v71, v70); + v72 = UI_GetHealthManaStringColor(v71, v70); sprintfex(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[5], v72, v69, v68); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, 50, 0, pTmpBuf, 0, 0, 0); a2b = "%s"; @@ -17401,7 +17267,7 @@ v74 = pPlayer->GetActualLevel(); v75 = pPlayer->GetBaseLevel(); v76 = pPlayer->GetActualLevel(); - v77 = sub_4178FE(v76, v75); + v77 = UI_GetHealthManaStringColor(v76, v75); sprintfex(pTmpBuf, a2b, pGlobalTXT_LocalizationStrings[131], v77, v74, v73); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYa, 0, pTmpBuf, 0, 0, 0); uYb = uYa + LOBYTE(pFontArrus->uFontHeight) - 2; @@ -17437,7 +17303,7 @@ if ( v131 > 99 || v90 > 99 ) a2c = format_4E2E68; v91 = v90; - v92 = sub_4178FE(v131, v90); + v92 = UI_GetHealthManaStringColor(v131, v90); sprintfex(pTmpBuf, a2c, pGlobalTXT_LocalizationStrings[87], v92, v131, v91); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYc, 0, pTmpBuf, 0, 0, 0); a2d = format_4E2E10; @@ -17447,7 +17313,7 @@ if ( v132 > 99 || v93 > 99 ) a2d = format_4E2E68; v94 = v93; - v95 = sub_4178FE(v132, v93); + v95 = UI_GetHealthManaStringColor(v132, v93); sprintfex(pTmpBuf, a2d, pGlobalTXT_LocalizationStrings[6], v95, v132, v94); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYd, 0, pTmpBuf, 0, 0, 0); a2e = format_4E2E10; @@ -17457,7 +17323,7 @@ if ( v133 > 99 || v96 > 99 ) a2e = format_4E2E68; v97 = v96; - v98 = sub_4178FE(v133, v96); + v98 = UI_GetHealthManaStringColor(v133, v96); sprintfex(pTmpBuf, a2e, pGlobalTXT_LocalizationStrings[240], v98, v133, v97); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYe, 0, pTmpBuf, 0, 0, 0); a2f = format_4E2E10; @@ -17467,7 +17333,7 @@ if ( v134 > 99 ) a2f = format_4E2E68; v100 = v99; - v101 = sub_4178FE(v134, v99); + v101 = UI_GetHealthManaStringColor(v134, v99); sprintfex(pTmpBuf, a2f, pGlobalTXT_LocalizationStrings[70], v101, v134, v100); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYf, 0, pTmpBuf, 0, 0, 0); a2g = format_4E2E10; @@ -17478,12 +17344,12 @@ if ( v135 > 99 || v102 > 99 ) a2g = format_4E2E68; v103 = v102; - v104 = sub_4178FE(v135, v102); + v104 = UI_GetHealthManaStringColor(v135, v102); sprintfex(pTmpBuf, a2g, pGlobalTXT_LocalizationStrings[142], v104, v135, v103); if ( pPlayer->uClass == 35 && v137 == 200 ) { v105 = pGlobalTXT_LocalizationStrings[625]; - v106 = sub_4178FE(v135, 200); + v106 = UI_GetHealthManaStringColor(v135, 200); sprintfex(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[142], v106, v105); } pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYg, 0, pTmpBuf, 0, 0, 0); @@ -17495,12 +17361,12 @@ if ( v136 > 99 || v107 > 99 ) a2h = format_4E2E68; v108 = v107; - v109 = sub_4178FE(v136, v107); + v109 = UI_GetHealthManaStringColor(v136, v107); sprintfex(pTmpBuf, a2h, pGlobalTXT_LocalizationStrings[29], v109, v136, v108); if ( pPlayer->uClass == 35 && v138 == 200 ) { v110 = pGlobalTXT_LocalizationStrings[625]; - v111 = sub_4178FE(v136, 200); + v111 = UI_GetHealthManaStringColor(v136, 200); sprintfex(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[29], v111, v110); } return pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, uYh, 0, pTmpBuf, 0, 0, 0); @@ -17622,7 +17488,7 @@ 0xA9u, 0, 0, - nullstring, + "", (Texture *)(uTextureID_ar_up_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_up] : 0), uTextureID_ar_up_dn != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_dn] : 0, 0); @@ -17636,7 +17502,7 @@ 0xAAu, 0, 0, - nullstring, + "", (Texture *)(uTextureID_ar_dn_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_up] : 0), uTextureID_ar_dn_dn != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_dn] : 0, 0); @@ -17650,7 +17516,7 @@ 0xC0u, 0, 0, - nullstring, + "", 0); } } @@ -17753,7 +17619,7 @@ 0x79u, *v14, 0, - nullstring, + "", 0); v2 = pFontLucida; } @@ -17781,7 +17647,7 @@ 0x79u, *v15, 0, - nullstring, + "", 0); v2 = pFontLucida; } @@ -17809,7 +17675,7 @@ 0x79u, *v16, 0, - nullstring, + "", 0); v2 = pFontLucida; } @@ -17837,7 +17703,7 @@ 0x79u, *v17, 0, - nullstring, + "", 0); v2 = pFontLucida; }