Mercurial > mm7
changeset 169:d1dde383af89
Merge
author | Nomad |
---|---|
date | Thu, 14 Feb 2013 14:03:17 +0200 |
parents | ee11772d0ad2 (current diff) 90521fb9766c (diff) |
children | 91fa025e6ca6 6416ded80dcf |
files | Render.cpp Render.h mm7_1.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_6.cpp |
diffstat | 22 files changed, 1579 insertions(+), 1140 deletions(-) [+] |
line wrap: on
line diff
--- a/AudioPlayer.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/AudioPlayer.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -90,7 +90,7 @@ do { sprintf(pSoundName, "%s", pSounds[v2].pSoundName); - // pSoundList->pSounds[v2].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)0xFFFFFFFF, pSounds[v2].uSoundID); Ritor1: it's error - result: no sound + // pSoundList->pSounds[v2].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)0xFFFFFFFF, pSounds[v2].uSoundID); //Ritor1: it's error - result: no sound pSoundDesc = &pSoundList->pSounds[v2]; if ( pSoundList->pSounds[v2].eType != SOUND_DESC_SYSTEM || (sprintf(pSoundName, "%s", pSounds[v2].pSoundName), pSoundList->pSounds[v2].pSoundData[0] = ::LoadSound(pSoundName, (SoundData *)0xFFFFFFFF, pSounds[v2].uSoundID), @@ -870,7 +870,7 @@ goto LABEL_184; } v76 = a3; - if ( (a3 & 7) == OBJECT_BLVDoor) + if ( (a3 & 7) == 1 ) { if ( uCurrentlyLoadedLevelType != LEVEL_Indoor ) goto LABEL_184; @@ -890,7 +890,7 @@ AIL_set_sample_pan(pMixerChannel5->hSample, v80); goto LABEL_184; } - if ( (a3 & 7) == OBJECT_Item) + if ( (a3 & 7) == 2 ) { pLayingItem4 = &pLayingItems[a3 >> 3]; if ( !GetSoundStrengthByDistanceFromParty(pLayingItem4->vPosition.x, pLayingItem4->vPosition.y, pLayingItem4->vPosition.z) ) @@ -898,7 +898,7 @@ } else { - if ( (a3 & 7) == OBJECT_Actor) + if ( (a3 & 7) == 3 ) { pActor3 = &pActors[a3 >> 3]; if ( !GetSoundStrengthByDistanceFromParty(pActor3->vPosition.x, pActor3->vPosition.y, pActor3->vPosition.z) ) @@ -910,7 +910,7 @@ AIL_set_sample_pan(pMixerChannel5->hSample, v80); goto LABEL_184; } - if ( (a3 & 7) != OBJECT_Decoration) + if ( (a3 & 7) != 5 ) { LABEL_184: if ( uNumRepeats ) @@ -922,7 +922,7 @@ AIL_start_sample(v85); if ( sPlaybackRate ) AIL_set_sample_playback_rate(pMixerChannel5->hSample, sPlaybackRate); - if ( (v76 & 7) == OBJECT_Player) + if ( (v76 & 7) == 4 ) AIL_sample_ms_position(pMixerChannel5->hSample, &sLastTrackLengthMS, 0); return; } @@ -978,7 +978,7 @@ _4ABE55(pMixerChannel4); goto LABEL_150; } - if ( (a3 & 7) == OBJECT_Item) + if ( (a3 & 7) == 2 ) { varC = 5; v96 = 7; @@ -986,7 +986,7 @@ } else { - if ( (a3 & 7) == OBJECT_Actor) + if ( (a3 & 7) == 3 ) { *(float *)&varC = 0.0; pActor2 = &pActors[a3 >> 3]; @@ -1000,9 +1000,9 @@ return; goto LABEL_123; } - if ( (a3 & 7) != OBJECT_Decoration) + if ( (a3 & 7) != 5 ) { - if ( (a3 & 7) == OBJECT_BModel) + if ( (a3 & 7) == 6 ) { varC = 8; v96 = 9; @@ -1048,7 +1048,7 @@ v21 = (double)pParty->sEyelevel + (double)pParty->vPosition.z; goto LABEL_47; } - if ( (a3 & 7) == OBJECT_Item) + if ( (a3 & 7) == 2 ) { v22 = pAudioPlayer->uNum3DSamples; if ( v22 < 16 ) @@ -1065,7 +1065,7 @@ } else { - if ( (a3 & 7) == OBJECT_Actor) + if ( (a3 & 7) == 3 ) { v18 = pAudioPlayer->uNum3DSamples; v12 = 0; @@ -1081,10 +1081,10 @@ v21 = (double)v100; goto LABEL_47; } - if ( (a3 & 7) != OBJECT_Decoration) + if ( (a3 & 7) != 5 ) { v13 = pAudioPlayer->uNum3DSamples; - if ( (a3 & 7) == OBJECT_BModel) + if ( (a3 & 7) == 6 ) { if ( v13 >= 16 ) { @@ -1256,7 +1256,7 @@ AIL_set_3D_sample_loop_count(*(int *)v42, v86); if ( PartyX == -1 ) { - if ( (a3 & 7) == OBJECT_BLVDoor) + if ( (a3 & 7) == 1 ) { if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { @@ -1306,13 +1306,13 @@ } return; } - if ( (a3 & 7) == OBJECT_Item) + if ( (a3 & 7) == 2 ) { pLayingItem2 = &pLayingItems[a3 >> 3]; } else { - if ( (a3 & 7) == OBJECT_Actor) + if ( (a3 & 7) == 3 ) { pActor = &pActors[a3 >> 3]; v46 = pActor->vPosition.y; @@ -1322,7 +1322,7 @@ v47 = (double)uNumRepeatsb; goto LABEL_101; } - if ( (a3 & 7) != OBJECT_Decoration) + if ( (a3 & 7) != 5 ) { pRenderVertexSoft.vWorldPosition.x = (double)pParty->vPosition.x; v43 = (double)pParty->vPosition.y; @@ -1603,7 +1603,7 @@ while ( 1 ) { v31 = v30->dword_000004; - if ( (v30->dword_000004 & 7) == OBJECT_BLVDoor) + if ( (v30->dword_000004 & 7) == 1 ) { if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { @@ -1633,12 +1633,12 @@ } else { - if ( (v30->dword_000004 & 7) == OBJECT_Item) + if ( (v30->dword_000004 & 7) == 2 ) { v32 = &pLayingItems[v31 >> 3]; goto LABEL_53; } - if ( (v30->dword_000004 & 7) == OBJECT_Actor) + if ( (v30->dword_000004 & 7) == 3 ) { v33 = &pActors[v31 >> 3]; v34 = GetSoundStrengthByDistanceFromParty(v33->vPosition.x, v33->vPosition.y, v33->vPosition.z); @@ -1758,8 +1758,7 @@ signed int v2; // eax@1 v2 = stru_5C6E00->uDoublePiMask & (stru_5C6E00->Atan2(a1 - pParty->vPosition.x, a2 - pParty->vPosition.y) - - stru_5C6E00->uIntegerHalfPi - - pParty->sRotationY); + - stru_5C6E00->uIntegerHalfPi - pParty->sRotationY); if ( v2 > (signed int)stru_5C6E00->uIntegerPi ) v2 = 2 * stru_5C6E00->uIntegerPi - v2; return (v2 >> 3) - (v2 >> 10);
--- a/GUIWindow.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/GUIWindow.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -474,7 +474,7 @@ pAudioPlayer->StopChannels(-1, -1); InitializeBookFonts(); v1->CreateButton(0x1DBu, 0x1BDu, 0x9Eu, 0x22u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], 0); - pCurrentScreen = 3; + pCurrentScreen = SCREEN_BOOKS; dword_506524 = 0; dword_506528 = 0; dword_50651C = 0; @@ -1056,10 +1056,7 @@ v1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureTransparent( - 0x1D4u, - 0, - (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); + pRenderer->DrawTextureTransparent(0x1D4u, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); if ( array_5913D8[6] != (NPCData *)uNumDialogueNPCPortraits || !uHouse_ExitPic ) { w.uFrameWidth = 130; @@ -1073,14 +1070,9 @@ v3 = 2 * LOBYTE(pFontCreate->uFontHeight) - 6 - pFontCreate->CalcTextHeight(v2, &w, 0, 0); if ( v3 < 0 ) v3 = 0; - v18.DrawTitleText( - pFontCreate, - 0x1EAu, - v3 / 2 + 4, - v1, + v18.DrawTitleText(pFontCreate, 0x1EAu, v3 / 2 + 4, v1, //(const char *)p2DEvents_minus1_::04[13 * (unsigned int)ptr_507BC0->ptr_1C], - p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].pName, - 3u); + p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].pName, 3); } } v18.uFrameWidth += 8; @@ -1099,10 +1091,7 @@ w.uFrameZ = 457; v5 = pFontArrus->CalcTextHeight(ptr_F8B1E8, &w, 13, 0); v6 = v5 + 7; - pRenderer->_4A6A68( - 8u, - 352 - (v5 + 7), - (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), + pRenderer->_4A6A68(8, 352 - (v5 + 7), (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v5 + 7)); pRenderer->DrawTextureIndexed(8u, 347 - v6, pTexture_591428); v7 = FitTextInAWindow(ptr_F8B1E8, pFontArrus, &w, 0xDu, 0); @@ -1113,14 +1102,11 @@ goto LABEL_58; while ( 1 ) { - pRenderer->DrawTextureIndexed( - *(&_4E5E50_transui_x + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4, - *(&_4E5EE0_transui_y + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4, + pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4, + *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6) - 4, (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); - pRenderer->DrawTextureIndexed( - *(&_4E5E50_transui_x + v8 + 6 * uNumDialogueNPCPortraits - 6), - *(&_4E5EE0_transui_y + v8 + 6 * uNumDialogueNPCPortraits - 6), - pDialogueNPCPortraits[v8]); + pRenderer->DrawTextureIndexed(*(&pNPCPortraits_x + v8 + 6 * uNumDialogueNPCPortraits - 6), + *(&pNPCPortraits_y + v8 + 6 * uNumDialogueNPCPortraits - 6), pDialogueNPCPortraits[v8]); if ( uNumDialogueNPCPortraits < 4 ) break; LABEL_57: @@ -1156,12 +1142,10 @@ goto LABEL_56; } v4 = (char *)array_5913D8[6] - 1; - pRenderer->DrawTextureIndexed( - _4E5E50_transui_x - 4, - _4E5EE0_transui_y - 4, + pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, (Texture *)(uTextureID_50795C != -1 ? &pIcons_LOD->pTextures[uTextureID_50795C] : 0)); - pRenderer->DrawTextureIndexed(_4E5E50_transui_x, _4E5EE0_transui_y, pDialogueNPCPortraits[(signed int)v4]); - if ( pCurrentScreen == 14 ) + pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pDialogueNPCPortraits[(signed int)v4]); + if ( pCurrentScreen == SCREEN_E ) { CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); goto LABEL_58; @@ -1172,9 +1156,7 @@ } else { - sprintf( - pTmpBuf, - pGlobalTXT_LocalizationStrings[429], + sprintf( pTmpBuf, pGlobalTXT_LocalizationStrings[429], //p2DEvents_minus1_::08[13 * (unsigned int)ptr_507BC0->ptr_1C], p2DEvents[(unsigned int)ptr_507BC0->ptr_1C - 1].pProprieterName, //p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C]); @@ -1250,10 +1232,7 @@ LABEL_58: if ( array_5913D8[6] == (NPCData *)uNumDialogueNPCPortraits && uHouse_ExitPic ) { - pRenderer->DrawTextureIndexed( - 0x22Cu, - 0x1C3u, - (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); + pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); v16 = (Texture *)(uTextureID_x_ok_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_ok_u] : 0); v14 = 451; v12 = 476; @@ -1857,9 +1836,9 @@ case WINDOW_Book: pWindow->InitializeBookView(); break; - case WINDOW_A: + case WINDOW_Dialogue: pMainScreenNum = pCurrentScreen; - pCurrentScreen = 4; + pCurrentScreen = SCREEN_NPC_DIALOGUE; pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79], //"Exit" (Texture *)(uTextureID_506438 != -1 ? &pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); if ( pWindow->ptr_1C != (void *)1 ) @@ -1957,12 +1936,12 @@ break; case WINDOW_ChangeLocation: pMainScreenNum = pCurrentScreen; - pCurrentScreen = 17; + pCurrentScreen = SCREEN_CHANGE_LOCATION; pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, 0x5Bu, 0, 0x4Eu, pGlobalTXT_LocalizationStrings[156],//Остаться в этой области (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0); pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, 0x5Au, 0, 0x59u, pWindow->Hint, (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); - pWindow->CreateButton(_4E5E50_transui_x, _4E5EE0_transui_y, 0x3Fu, 0x49u, 1, 0, 0x5Au, 1u, 0x20u, pWindow->Hint, 0, 0, 0); + pWindow->CreateButton(pNPCPortraits_x, pNPCPortraits_y, 0x3Fu, 0x49u, 1, 0, 0x5Au, 1u, 0x20u, pWindow->Hint, 0, 0, 0); pWindow->CreateButton(8u, 8u, 0x1CCu, 0x158u, 1, 0, 0x5Au, 1u, 0, pWindow->Hint, 0); break; case WINDOW_SpellBook: // окно книги заклов @@ -1972,7 +1951,7 @@ case WINDOW_GreetingNPC: // окно приветствия НПС pMainScreenNum = pCurrentScreen; pKeyActionMap->EnterText(0, 15, pWindow); - pCurrentScreen = 19; + pCurrentScreen = SCREEN_BRANCHLESS_NPC_DIALOG; break; } return pWindow; @@ -1987,7 +1966,7 @@ } if (eWindowType == WINDOW_HouseInterior) { - pCurrentScreen = 13; + pCurrentScreen = SCREEN_HOUSE; pBtn_ExitCancel = pWindow->CreateButton(0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[80],//Выйти из здания (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); v25 = uNumDialogueNPCPortraits; @@ -2013,8 +1992,8 @@ v29 = pGlobalTXT_LocalizationStrings[435];//Побеседовать с ^Pt[%s] } sprintf(&byte_591180[100 * v26], v29, v30); - array_5913D8[v26 + 7] = (NPCData *)pWindow->CreateButton(*(&_4E5E50_transui_x + v26 + 6 * uNumDialogueNPCPortraits - 6), - *(&_4E5EE0_transui_y + v26 + 6 * uNumDialogueNPCPortraits - 6), + array_5913D8[v26 + 7] = (NPCData *)pWindow->CreateButton(*(&pNPCPortraits_x + v26 + 6 * uNumDialogueNPCPortraits - 6), + *(&pNPCPortraits_y + v26 + 6 * uNumDialogueNPCPortraits - 6), 0x3Fu, 0x49u, 1, 0, 0x19Au, v26, 0, &byte_591180[100 * v26], 0, 0, 0); ++v26; v25 = uNumDialogueNPCPortraits; @@ -2029,15 +2008,15 @@ } else { - if (eWindowType == WINDOW_1A) + if (eWindowType == WINDOW_Transition) { pMainScreenNum = pCurrentScreen; - pCurrentScreen = 18; + pCurrentScreen = SCREEN_INPUT_BLV; pBtn_ExitCancel = pWindow->CreateButton(0x236u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, 0x19Cu, 0, 0x4Eu, pGlobalTXT_LocalizationStrings[34],//Отмена (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0); pBtn_YES = pWindow->CreateButton(0x1E6u, 0x1BDu, 0x4Bu, 0x21u, 1, 0, 0x19Bu, 0, 0x59u, pWindow->Hint, (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); - pWindow->CreateButton(_4E5E50_transui_x, _4E5EE0_transui_y, 0x3Fu, 0x49u, 1, 0, 0x19Bu, 1, 0x20u, pWindow->Hint, 0); + pWindow->CreateButton(pNPCPortraits_x, pNPCPortraits_y, 0x3Fu, 0x49u, 1, 0, 0x19Bu, 1, 0x20u, pWindow->Hint, 0); pWindow->CreateButton(8u, 8u, 0x1CCu, 0x158u, 1, 0, 0x19Bu, 1u, 0, pWindow->Hint, 0); return pWindow; } @@ -2049,7 +2028,7 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2u);//Выберите цель return pWindow; } - if (eWindowType == WINDOW_1E) + if (eWindowType == WINDOW_Scroll) //goto LABEL_62; { pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); @@ -2067,7 +2046,7 @@ ShowStatusBarString(pGlobalTXT_LocalizationStrings[39], 2);//Выбрать цель ++pIcons_LOD->uTexturePacksCount; pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - pCurrentScreen = 23; + pCurrentScreen = SCREEN_CASTING; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; }
--- a/GUIWindow.h Thu Feb 14 13:58:34 2013 +0200 +++ b/GUIWindow.h Thu Feb 14 14:03:17 2013 +0200 @@ -15,15 +15,21 @@ MENU_FINISHED = 0x4, MENU_5 = 0x5, MENU_CREATEPARTY = 0x6, - MENU_7 = 0x7, - MENU_Credits = 0x8, - MENU_LOAD = 0x9, + MENU_NAMEPANELESC = 0x7, + MENU_CREDITSPROC = 0x8, + MENU_LOADINGPROC = 0x9, MENU_10 = 0xA, + MENU_CREDITSCLOSE = 0xB, }; - - +enum DIALOGUE_TYPE +{ + DIALOGUE_ARENA_WELCOME = 0x89, + DIALOGUE_ARENA_FIGHT_NOT_OVER_YET = 0x90, + DIALOGUE_ARENA_REWARD = 0x91, + DIALOGUE_ARENA_ALREADY_WON = 0x92, +}; @@ -38,20 +44,20 @@ WINDOW_CharacterRecord = 0x4, WINDOW_Options = 0x6, WINDOW_Book = 0x9, - WINDOW_A = 0xA, //10, - WINDOW_C = 0xC, //12, - WINDOW_10 = 0x10, //16, - WINDOW_ChangeLocation = 0x11, //17, - WINDOW_SpellBook = 0x12, //18, - WINDOW_GreetingNPC = 0x13, //19, + WINDOW_Dialogue = 0xA, + WINDOW_QuickReference = 0xC, + WINDOW_Rest = 0x10, + WINDOW_ChangeLocation = 0x11, + WINDOW_SpellBook = 0x12, + WINDOW_GreetingNPC = 0x13, WINDOW_Chest = 0x14, WINDOW_17 = 0x17, WINDOW_MainMenu_Load = 0x18, WINDOW_HouseInterior = 0x19, - WINDOW_1A = 0x1A, //26, - WINDOW_1B = 0x1B, //27, - WINDOW_1E = 0x1E, //30, - WINDOW_1F = 0x1F, //31, + WINDOW_Transition = 0x1A, + WINDOW_1B = 0x1B, + WINDOW_Scroll = 0x1E, + WINDOW_1F = 0x1F, WINDOW_FinalWindow = 0x46, WINDOW_50 = 0x50, WINDOW_59 = 0x59, @@ -136,8 +142,17 @@ { UIMSG_00 = 0x0, UIMSG_ChangeGameState = 0x5, + UIMSG_A = 0xA, + UIMSG_C = 0xC, + UIMSG_E = 0xE, + UIMSG_F = 0xF, UIMSG_11 = 0x11, + UIMSG_17 = 0x17, + UIMSG_19 = 0x19, + UIMSG_1B = 0x1B, + UIMSG_1C = 0x1C, UIMSG_PlayArcomage = 0x1D, + UIMSG_33 = 0x33, UIMSG_MainMenu_ShowPartyCreationWnd = 0x36, UIMSG_MainMenu_ShowLoadWindow = 0x37, UIMSG_ShowCredits = 0x38, @@ -150,38 +165,74 @@ UIMSG_PlayerCreationSelectClass = 0x41, UIMSG_PlayerCreationClickOK = 0x42, UIMSG_PlayerCreationClickReset = 0x43, + UIMSG_45 = 0x45, + UIMSG_46 = 0x46, + UIMSG_AutonotesBook = 0x47, UIMSG_PlayerCreationRemoveUpSkill = 0x4A, UIMSG_PlayerCreationRemoveDownSkill = 0x4B, - UIMSG_4B = 0x4B, + UIMSG_4E = 0x4E, + UIMSG_4F = 0x4F, + UIMSG_51 = 0x51, UIMSG_LoadGame = 0x52, UIMSG_SaveGame = 0x53, + UIMSG_54 = 0x54, + UIMSG_55 = 0x55, + UIMSG_56 = 0x56, + UIMSG_57 = 0x57, + UIMSG_58 = 0x58, + UIMSG_5A = 0x5A, + UIMSG_5B = 0x5B, UIMSG_ShowStatus_DateTime = 0x5C, UIMSG_ShowStatus_ManaHP = 0x5D, UIMSG_ShowStatus_Player = 0x5E, + UIMSG_Wait5Minutes = 0x5F, + UIMSG_Wait1Hour = 0x60, + UIMSG_61 = 0x61, UIMSG_ShowStatus_Food = 0x64, UIMSG_ShowStatus_Funds = 0x65, + UIMSG_68 = 0x68, + UIMSG_69 = 0x69, UIMSG_QuickReference = 0x6A, UIMSG_6B = 0x6B, + UIMSG_AlreadyResting = 0x6D, UIMSG_SelectCharacter = 0x6E, UIMSG_ChangeSoundVolume = 0x6F, UIMSG_ChangeMusicVolume = 0x70, UIMSG_Escape = 0x71, + UIMSG_72 = 0x72, + UIMSG_73 = 0x73, + UIMSG_74 = 0x74, + UIMSG_75 = 0x75, UIMSG_PlayerCreationSelectQuality = 0x76, + UIMSG_InventoryLeftClick = 0x78, UIMSG_SkillUp = 0x79, + UIMSG_7A = 0x7A, + UIMSG_7B = 0x7B, UIMSG_StartNewGame = 0x7C, UIMSG_Game_OpenLoadGameDialog = 0x7D, + UIMSG_Game_OpenSaveGameDialog = 0x7E, UIMSG_Game_OpenOptionsDialog = 0x7F, + UIMSG_80 = 0x80, UIMSG_SetGraphicsMode = 0x83, UIMSG_Quit = 0x84, + UIMSG_85 = 0x85, + UIMSG_86 = 0x86, + UIMSG_87 = 0x87, + UIMSG_88 = 0x88, + UIMSG_8C = 0x8C, + UIMSG_8D = 0x8D, + UIMSG_8E = 0x8E, + UIMSG_8F = 0x8F, UIMSG_PlayerCreationVoiceBack = 0x90, UIMSG_PlayerCreationVoiceForward = 0x91, + UIMSG_92 = 0x92, UIMSG_StartNPCDialogue = 0xA1, UIMSG_ArrowUp = 0xA2, UIMSG_DownArrow = 0xA3, UIMSG_LoadSlot = 0xA4, UIMSG_SelectLoadSlot = 0xA5, UIMSG_Cancel = 0xA6, - UIMSG_A7 = 0xA7, + UIMSG_ExitRest = 0xA7, UIMSG_A8 = 0xA8, UIMSG_A9 = 0xA9, UIMSG_AA = 0xAA, @@ -229,19 +280,63 @@ UIMSG_D4 = 0xD4, UIMSG_D5 = 0xD5, UIMSG_D6 = 0xD6, + UIMSG_DD = 0xDD, UIMSG_OpenHistoryBook = 0xE0, UIMSG_ToggleAlwaysRun = 0xE1, UIMSG_ToggleFlipOnExit = 0xE2, + UIMSG_16F = 0x16F, + UIMSG_170 = 0x170, + UIMSG_194 = 0x194, + UIMSG_195 = 0x195, UIMSG_OpenRestUI = 0x199, + UIMSG_19A = 0x19A, + UIMSG_19B = 0x19B, + UIMSG_19C = 0x19C, UIMSG_OpenKeyMappingOptions = 0x19F, + UIMSG_1A0 = 0x1A0, + UIMSG_1A1 = 0x1A1, UIMSG_ResetKeyMapping = 0x1A2, + UIMSG_1A3 = 0x1A3, UIMSG_OpenVideoOptions = 0x1A5, UIMSG_ToggleBloodsplats = 0x1A6, UIMSG_ToggleColoredLights = 0x1A7, UIMSG_ToggleTint = 0x1A8, + UIMSG_1A9 = 0x1A9, }; - +enum CURRENT_SCREEN +{ + SCREEN_GAME = 0x0, + SCREEN_MENU = 0x1, + SCREEN_OPTIONS = 0x2, + SCREEN_BOOKS = 0x3, + SCREEN_NPC_DIALOGUE = 0x4, + SCREEN_REST = 0x5, + SCREEN_CHARACTERS = 0x7, + SCREEN_SPELL_BOOK = 0x8, + SCREEN_CREATORS = 0x9, + SCREEN_CHEST = 0xA, + SCREEN_SAVEGAME = 0xB, + SCREEN_LOADGAME = 0xC, + SCREEN_HOUSE = 0xD, + SCREEN_E = 0xE, + SCREEN_F = 0xF, + SCREEN_VIDEO = 0x10, + SCREEN_CHANGE_LOCATION = 0x11, + SCREEN_INPUT_BLV = 0x12, + SCREEN_BRANCHLESS_NPC_DIALOG = 0x13, + SCREEN_PARTY_CREATION = 0x15, + SCREEN_PRESS_ESCAPE_MESSAGE = 0x16, + SCREEN_CASTING = 0x17, + SCREEN_19 = 0x19, + SCREEN_KEYBOARD_OPTIONS = 0x1A, + SCREEN_1B = 0x1B, + SCREEN_VIDEO_OPTIONS = 0x1C, + SCREEN_63 = 0x63, + SCREEN_64 = 0x64, + SCREEN_67 = 0x67, + SCREEN_QUICK_REFERENCE = 0x68, +};
--- a/Game.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/Game.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -210,7 +210,7 @@ MSG Msg; // [sp+28h] [bp-3Ch]@20 char Source[64]; // [sp+44h] [bp-20h]@76 - bLoading = uCurrentMenuID == MENU_LOAD; + bLoading = uCurrentMenuID == MENU_LOADINGPROC; SetCurrentMenuID((MENU_STATE)-1); if (bLoading) { @@ -248,7 +248,7 @@ dword_6BE364_game_settings_1 |= 0x80; dword_6BE340 = 2; // uGame_if_0_else_ui_id__11_save__else_load__8_drawSpellInfoPopup__22_final_window__26_keymapOptions__2_options__28_videoOptions = 0; - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; if (pAsyncMouse) pAsyncMouse->Resume(); if (pGame->pKeyboardInstance->bUsingAsynKeyboard && pAsyncKeyboard ) @@ -326,7 +326,7 @@ v16 = 0; viewparams->bRedrawGameUI = true; } - //pAudioPlayer->_4AAFCF();//Ritor1: it's temporarily, game crash + //pAudioPlayer->_4AAFCF();//Ritor1: it's temporarily, game crash. decorations sounds if (uGameState == 1) //goto LABEL_96; { @@ -490,7 +490,7 @@ } break; } - pCurrentScreen = 16;//окно видео ролика + pCurrentScreen = SCREEN_VIDEO; sub_491E3A(); }
--- a/GameUIs.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/GameUIs.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -48,7 +48,7 @@ if ( uDialogueType_ ) { pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0)); - if ( pCurrentScreen == 11 )//save or load + if ( pCurrentScreen == SCREEN_SAVEGAME ) { v1 = uTextureID_save_up; v2 = uTextureID_LS_saveU; @@ -124,7 +124,7 @@ //LABEL_24: pLODFile.FreeSubIndexAndIO(); - if ( pCurrentScreen == 11 ) // save/load screen + if ( pCurrentScreen == SCREEN_SAVEGAME ) { v6 = pIcons_LOD->LoadTexture("x_d", TEXTURE_16BIT_PALETTE); v10 = (TEXTURE_TYPE)2; @@ -192,7 +192,7 @@ 8u, 8u, (Texture *)(uTextureID_loadsave != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_loadsave] : 0)); - if ( pCurrentScreen == 11 ) + if ( pCurrentScreen == SCREEN_SAVEGAME ) { v0 = uTextureID_save_up; v1 = uTextureID_LS_saveU;
--- a/Keyboard.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/Keyboard.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -816,12 +816,12 @@ } if ( a1 == VK_LEFT ) { - v3 = ascii_4E2D48; + v3 = "LEFT"; goto LABEL_53; } if ( a1 == VK_RIGHT ) { - v3 = ascii_4E2D40; + v3 = "RIGHT"; goto LABEL_53; } if ( a1 == VK_RETURN ) @@ -970,6 +970,7 @@ { void *v2; // esi@2 char v3; // bl@2 + bool result; if (bUsingAsynKeyboard) { @@ -982,7 +983,9 @@ return v3;*/ } else - return (GetAsyncKeyState(vKey) & 0x8001) != 0; + //return (GetAsyncKeyState(vKey) & 0x8001) != 0; + result = GetAsyncKeyState(vKey); + return result; } //----- (0045B0CE) -------------------------------------------------------- @@ -992,7 +995,7 @@ char v3; // bl@2 bool result; // eax@2 - if ( LOBYTE(this->bUsingAsynKeyboard) ) + if ( this->bUsingAsynKeyboard ) { __debugbreak(); /*v2 = pAsyncKeyboard; @@ -1003,8 +1006,8 @@ } else { - LOWORD(result) = GetAsyncKeyState(vKey); - LOBYTE(result) = result & 1; + result = GetAsyncKeyState(vKey); + //LOBYTE(result) = result & 1; } return result; }
--- a/Outdoor.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/Outdoor.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -141,7 +141,7 @@ pRenderer->PrepareDecorationsRenderList_ODM(); pRenderer->DrawLayingItems_Shooting_Magic_ODM(); - pRenderer->TransformBillboardsAndSetPalettesODM();//Ritor1: do comment to test + pRenderer->TransformBillboardsAndSetPalettesODM(); sub_485F53((Vec2_int_ *)unnamed_6BE060); }
--- a/Player.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/Player.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -7688,7 +7688,7 @@ v21 = v67; goto LABEL_83; } - if ( pCurrentScreen == 23 ) + if ( pCurrentScreen == SCREEN_CASTING ) return; if ( !pParty->pPlayers[a2-1].CanAct() )//if ( !((Player *)&stru_AA1058[3].pSounds[6972 * a2 + 40552])->CanAct() ) goto LABEL_89; @@ -7704,7 +7704,7 @@ pMouse->RemoveHoldingItem(); pGUIWindow_CurrentMenu->Release(); pIcons_LOD->_4114F2(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; _42777D_CastSpell_UseWand_ShootArrow(v24, a2 - 1, 0x85u, 1, 0); }
--- a/Render.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/Render.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -1764,8 +1764,8 @@ uStartX = 0, uEndX = 128; uStartZ = 64 - 16, uEndZ = 128; } -// uStartX = 0, uEndX = 128; -// uStartZ = 0, uEndZ = 128; + uStartX = 0, uEndX = 128; + uStartZ = 0, uEndZ = 128; static RenderVertexSoft pTerrainVertices[128 * 128]; for (unsigned int z = uStartZ; z < uEndZ; ++z) { @@ -7172,7 +7172,7 @@ if (pRenderD3D) { pGame->draw_debug_outlines(); - DoRenderBillboards_D3D(); //Ritor1: it's temporarily + DoRenderBillboards_D3D(); pGame->pStru6Instance->RenderSpecialEffects(); pRenderD3D->pDevice->EndScene(); }
--- a/Render.h Thu Feb 14 13:58:34 2013 +0200 +++ b/Render.h Thu Feb 14 14:03:17 2013 +0200 @@ -70,6 +70,11 @@ unsigned __int16 uPaletteSubindex; unsigned int uTintColor; SpriteFrame *pSpriteFrame; + + inline float GetFloatZ() const + { + return LOWORD(sZValue) / 65535.0f + (float)HIWORD(sZValue); + } }; #pragma pack(pop)
--- a/SaveLoad.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/SaveLoad.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -191,7 +191,7 @@ pGUIWindow_CurrentMenu->Release(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = true; @@ -325,7 +325,7 @@ strcpy(pDir.pFilename, "image.pcx"); pRenderer->_49F5A2((int)pScreenshot, 150, 112, DstBuf, 1000000, (int)&pDir.uDataSize); free(pScreenshot); - if (pCurrentScreen == 11) //SaveScreen + if (pCurrentScreen == SCREEN_SAVEGAME) { pRenderer->DrawTextureIndexed(8, 8, (Texture *)(uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0)); pRenderer->DrawTextureIndexed(0x12, 0x8D, (Texture *)(uTextureID_save_up != -1 ? &pIcons_LOD->pTextures[uTextureID_save_up] : 0)); @@ -614,7 +614,7 @@ int bNotArena; // [sp+2Ch] [bp-8h]@1 unsigned int v6; // [sp+30h] [bp-4h]@1 - __debugbreak(); + //__debugbreak(); v1 = uSlot; v6 = uSlot; @@ -636,7 +636,7 @@ } GUI_UpdateWindows(); pGUIWindow_CurrentMenu->Release(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; v3 = pSavegameThumbnails; viewparams->bRedrawGameUI = 1; do
--- a/VideoPlayer.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/VideoPlayer.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -293,7 +293,7 @@ unsigned int uTrackEndMS; // [sp+38h] [bp-4h]@8 pVideoPlayer->bStopBeforeSchedule = false; - pVideoPlayer->field_40 = 0; + pVideoPlayer->pResetflag = 0; bGameoverLoop = 1; if ( !bNoVideo ) { @@ -360,7 +360,7 @@ pRenderer->ClearTarget(0); pRenderer->EndScene(); } - pCurrentScreen = 16; //окно видео ролика + pCurrentScreen = SCREEN_VIDEO; if ( pVideoPlayer->uMovieFormat == 2 ) { if ( pVideoPlayer->pBinkMovie ) @@ -419,11 +419,11 @@ } } if ( uGameState == GAME_FINISHED ) - pCurrentScreen = 0;//MainMenuScreen + pCurrentScreen = SCREEN_GAME; pVideoPlayer->bPlayingMovie = 0; ShowCursor(1); - if ( pCurrentScreen == 16 )//окно видео ролика - pCurrentScreen = 0; + if ( pCurrentScreen == SCREEN_VIDEO ) + pCurrentScreen = SCREEN_GAME; } } @@ -1168,6 +1168,6 @@ void VideoPlayer::PlayDeathMovie() { bStopBeforeSchedule = 0; - field_40 = 0; + pResetflag = 0; pGame->pCShow->PlayMovie(MOVIE_Death, 1); } \ No newline at end of file
--- a/VideoPlayer.h Thu Feb 14 13:58:34 2013 +0200 +++ b/VideoPlayer.h Thu Feb 14 14:03:17 2013 +0200 @@ -121,7 +121,7 @@ { //RGBTexture::RGBTexture(&pVideoPlayer->pVideoFrame); bStopBeforeSchedule = false; - field_40 = 0; + pResetflag = 0; byte_F8BC0C = 0; //pBinkMovie = nullptr; } @@ -129,7 +129,7 @@ virtual ~VideoPlayer() { bStopBeforeSchedule = false; - field_40 = 0; + pResetflag = 0; pVideoFrame.Release(); } @@ -162,7 +162,7 @@ int field_34; MovieHeader *pMightVideoHeaders; MovieHeader *pMagicVideoHeaders; - int field_40; + int pResetflag; int field_44; unsigned int uNumMightVideoHeaders; unsigned int uNumMagicVideoHeaders;
--- a/Vis.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/Vis.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -1410,6 +1410,7 @@ memcpy(&v12, &v5[v8], sizeof(v12)); memcpy(&v5[v8], v15, sizeof(v5[v8])); memcpy(v15, &v12, 0x20u); + //__debugbreak(); SortVerticesByX(v5, uStart, v8 - 1); SortVerticesByX(a2, v8 + 1, uEnd); } @@ -1425,114 +1426,112 @@ int i; // ecx@2 int v8; // esi@3 int v9; // esi@5 - RenderVertexSoft *v10; // eax@8 + //RenderVertexSoft *v10; // eax@8 + const void *v10; RenderVertexSoft v11; // [sp+4h] [bp-6Ch]@8 RenderVertexSoft v12; // [sp+34h] [bp-3Ch]@2 - float v13; // [sp+4Ch] [bp-24h]@4 + //float v13; // [sp+4Ch] [bp-24h]@4 int v14; // [sp+64h] [bp-Ch]@7 - Vis *thisa; // [sp+68h] [bp-8h]@1 - RenderVertexSoft *v16; // [sp+6Ch] [bp-4h]@2 - - //__debugbreak(); + //Vis *thisa; // [sp+68h] [bp-8h]@1 + void *thisa; + //RenderVertexSoft *v16; // [sp+6Ch] [bp-4h]@2 + const void *v16; - result = sRight; thisa = this; - if ( sRight > sLeft ) + if (sRight <= sLeft) + return true; + v5 = pArray; + v16 = &pArray[sRight]; + v6 = sLeft - 1; + memcpy(&v12, &pArray[sRight], sizeof(v12)); + for ( i = sRight; ; i = v14 ) { - v5 = pArray; - v16 = &pArray[sRight]; - v6 = sLeft - 1; - memcpy(&v12, &pArray[sRight], sizeof(v12)); - for ( i = sRight; ; i = v14 ) + v8 = (int)&v5[v6].vWorldViewProjX; + do { - v8 = (int)&v5[v6].vWorldViewProjX; - do - { - v8 += 48; - ++v6; - } - while ( *(float *)v8 < (double)v13 ); - v9 = (int)&v5[i].vWorldViewProjX; - do - { - v9 -= 48; - --i; - } - while ( *(float *)v9 > (double)v13 ); - v14 = i; - if ( v6 >= i ) - break; - v10 = &v5[i]; - memcpy(&v11, &pArray[v6], sizeof(v11)); - v5 = pArray; - memcpy(&pArray[v6], v10, sizeof(pArray[v6])); - memcpy(v10, &v11, 0x30u); + v8 += 48; + ++v6; + } + while ( *(float *)v8 < v12.vWorldViewProjX); + v9 = (int)&v5[i].vWorldViewProjX; + do + { + v9 -= 48; + --i; } - memcpy(&v11, &v5[v6], sizeof(v11)); - memcpy(&v5[v6], v16, sizeof(v5[v6])); - memcpy(v16, &v11, 0x30u); - sort_objects_2(v5, sLeft, v6 - 1); - sort_objects_2(pArray, v6 + 1, sRight); + while ( *(float *)v9 > v12.vWorldViewProjX); + v14 = i; + if ( v6 >= i ) + break; + v10 = &v5[i]; + memcpy(&v11, &pArray[v6], sizeof(v11)); + v5 = pArray; + memcpy(&pArray[v6], v10, sizeof(pArray[v6])); + memcpy((void *)v10, &v11, sizeof(0x30u)); } + memcpy(&v11, &v5[v6], sizeof(v11)); + memcpy(&v5[v6], v16, sizeof(v5[v6])); + memcpy((void *)v16, &v11, sizeof(0x30u)); + sort_objects_2(v5, sLeft, v6 - 1); + sort_objects_2(pArray, v6 + 1, sRight); return true; } //----- (004C297E) -------------------------------------------------------- bool Vis::sort_objects_3(RenderVertexSoft *pArray, int sLeft, int sRight) { - bool result; // eax@1 + //bool result; // eax@1 RenderVertexSoft *v5; // edx@2 int v6; // ebx@2 int i; // ecx@2 int v8; // esi@3 int v9; // esi@5 - RenderVertexSoft *v10; // eax@8 - char v11; // [sp+4h] [bp-6Ch]@8 + //RenderVertexSoft *v10; // eax@8 + const void *v10; + //char v11; // [sp+4h] [bp-6Ch]@8 + RenderVertexSoft v11; RenderVertexSoft v12; // [sp+34h] [bp-3Ch]@2 - float v13; // [sp+50h] [bp-20h]@4 + //float v13; // [sp+50h] [bp-20h]@4 int v14; // [sp+64h] [bp-Ch]@7 - Vis *thisa; // [sp+68h] [bp-8h]@1 + //Vis *thisa; // [sp+68h] [bp-8h]@1 RenderVertexSoft *v16; // [sp+6Ch] [bp-4h]@2 - result = sRight; - thisa = this; - if ( sRight > sLeft ) + if (sRight <= sLeft) + return true; + v5 = pArray; + v16 = &pArray[sRight]; + v6 = sLeft - 1; + memcpy(&v12, &pArray[sRight], sizeof(v12)); + for ( i = sRight; ; i = v14 ) { - v5 = pArray; - v16 = &pArray[sRight]; - v6 = sLeft - 1; - memcpy(&v12, &pArray[sRight], sizeof(v12)); - for ( i = sRight; ; i = v14 ) + v8 = (int)&v5[v6].vWorldViewProjY; + do + { + v8 += 48; + ++v6; + } + while ( *(float *)v8 < v12.vWorldViewProjY); + v9 = (int)&v5[v6].vWorldViewProjY; + do { - v8 = (int)&v5[v6].vWorldViewProjY; - do - { - v8 += 48; - ++v6; - } - while ( *(float *)v8 < (double)v13 ); - v9 = (int)&v5[i].vWorldViewProjY; - do - { - v9 -= 48; - --i; - } - while ( *(float *)v9 > (double)v13 ); - v14 = i; - if ( v6 >= i ) - break; - v10 = &v5[i]; - memcpy(&v11, &pArray[v6], 0x30u); - v5 = pArray; - memcpy(&pArray[v6], v10, sizeof(pArray[v6])); - memcpy(v10, &v11, 0x30u); + v9 -= 48; + --i; } - memcpy(&v11, &v5[v6], 0x30u); - memcpy(&v5[v6], v16, sizeof(v5[v6])); - memcpy(v16, &v11, 0x30u); - sort_objects_3(v5, sLeft, v6 - 1); - sort_objects_3(pArray, v6 + 1, sRight); + while ( *(float *)v9 > v12.vWorldViewProjY); + v14 = i; + if ( v6 >= i ) + break; + v10 = &v5[i]; + memcpy(&v11, &pArray[v6], sizeof(0x30)); + v5 = pArray; + memcpy(&pArray[v6], v10, sizeof(pArray[v6])); + memcpy((void *)v10, &v11, sizeof(0x30)); } + memcpy(&v11, &v5[v6], sizeof(0x30)); + memcpy(&v5[v6], v16, sizeof(v5[v6])); + memcpy((void *)v16, &v11, sizeof(0x30)); + sort_objects_3(v5, sLeft, v6 - 1); + sort_objects_3(pArray, v6 + 1, sRight); return true; } @@ -1758,232 +1757,162 @@ //----- (004C091D) -------------------------------------------------------- bool Vis::DoesRayIntersectBillboard(float fDepth, unsigned int uD3DBillboardIdx) { - unsigned int v3; // esi@3 - bool result; // eax@3 - int v5; // ecx@4 - double v6; // st7@4 - __int16 v7; // fps@4 - double v8; // st7@4 - unsigned __int8 v9; // c0@4 - char v10; // c2@4 - unsigned __int8 v11; // c3@4 - Vis_stru1_stru0 *v12; // eax@10 - __int16 v13; // fps@16 - double v14; // st7@16 - char v15; // c0@16 - char v16; // c2@16 - char v17; // c3@16 - double v18; // st7@18 - double v19; // st6@18 - double v20; // st4@18 - float v21; // ST0C_4@22 - float v22; // ST08_4@22 - signed int v23; // eax@27 - double v24; // st7@32 - double v25; // st6@32 - float v26; // eax@32 - double v27; // st7@36 - double v28; // st6@36 - __int16 v29; // fps@36 - char v30; // c0@36 - char v31; // c2@36 - char v32; // c3@36 - double v33; // st6@37 - __int16 v34; // fps@37 - char v35; // c0@37 - char v36; // c2@37 - char v37; // c3@37 - __int16 v38; // fps@38 - double v39; // st6@38 - unsigned __int8 v40; // c0@38 - char v41; // c2@38 - unsigned __int8 v42; // c3@38 - __int16 v43; // fps@39 - double v44; // st6@39 - char v45; // c0@39 - char v46; // c2@39 - char v47; // c3@39 - Vis *v48; // esi@40 - float v49; // ST08_4@40 - Vis_stru1_stru0 *v50; // eax@45 - RenderVertexSoft pRay[2]; // [sp+20h] [bp-DCh]@5 - RenderVertexSoft a3[2]; // [sp+80h] [bp-7Ch]@22 - float v53; // [sp+E0h] [bp-1Ch]@33 - float v54; // [sp+E4h] [bp-18h]@32 - float fBillboardCenterX; // [sp+E8h] [bp-14h]@5 - float fBillboardCenterY; // [sp+ECh] [bp-10h]@5 - unsigned int v57; // [sp+F0h] [bp-Ch]@5 - float v58; // [sp+F4h] [bp-8h]@17 - Vis *thisa; // [sp+F8h] [bp-4h]@1 - signed int a3a; // [sp+108h] [bp+Ch]@17 - float a3b; // [sp+108h] [bp+Ch]@32 - - thisa = this; + int v3; // eax@3 + //signed int v5; // ecx@4 + //float v6; // ST04_4@6 + //float v7; // ST00_4@7 + int v8; // eax@10 + unsigned int v9; // eax@12 + int v10; // eax@17 + double v11; // st6@18 + double v12; // st7@18 + double v13; // st4@18 + float v14; // ST0C_4@22 + float v15; // ST08_4@22 + //float v16; // ST04_4@23 + //float v17; // ST00_4@24 + signed int v18; // eax@27 + unsigned int v19; // eax@29 + double v20; // st6@32 + double v21; // st7@32 + int v22; // eax@32 + double v23; // st7@36 + //void *v24; // esi@40 + float v25; // ST08_4@40 + //float v26; // ST04_4@41 + //float v27; // ST00_4@42 + int v28; // eax@45 + unsigned int v29; // eax@47 + char result; // al@48 + struct RenderVertexSoft pPickingRay[2]; + //int v31; // [sp+20h] [bp-DCh]@5 + struct RenderVertexSoft local_80[2]; + //int v32; // [sp+80h] [bp-7Ch]@22 + float v33; // [sp+E0h] [bp-1Ch]@33 + float v34; // [sp+E4h] [bp-18h]@32 + int v35; // [sp+E8h] [bp-14h]@5 + int v36; // [sp+ECh] [bp-10h]@5 + unsigned int v37; // [sp+F0h] [bp-Ch]@5 + float v38; // [sp+F4h] [bp-8h]@17 + //void *v39; // [sp+F8h] [bp-4h]@1 + signed int v40; // [sp+108h] [bp+Ch]@17 + float v41; // [sp+108h] [bp+Ch]@32 static Vis_stru1 Vis_static_stru_F91E10; - Vis_static_stru_F91E10.uNumPointers = 0; - v3 = uD3DBillboardIdx; - result = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].uParentBillboardID; - if ( result != -1 - && (v5 = pBillboardRenderList[result].sZValue, - v6 = (double)(unsigned __int16)pBillboardRenderList[result].sZValue, - result = v5 >> 16, - v8 = v6 * 0.000015259022 + (double)(v5 >> 16), - //UNDEF(v7), - v9 = v8 < fDepth, - v10 = 0, - v11 = v8 == fDepth, - //BYTE1(result) = HIBYTE(v7), - v9 | v11) ) + v3 = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].uParentBillboardID; + if (v3 == -1) + return false; + if (pBillboardRenderList[v3].GetFloatZ() > fDepth) { - LOWORD(v5) = 0; - v57 = v5; - GetPolygonCenter( - pRenderer->pBillboardRenderListD3D[v3].pQuards, - 4u, - &fBillboardCenterX, - &fBillboardCenterY); - CastPickRay(pRay, fBillboardCenterX, fBillboardCenterY, fDepth); - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - PickIndoor(fDepth, pRay, &Vis_static_stru_F91E10, &a5); +LABEL_49: + return false; + } + else + { + v37 = pBillboardRenderList[v3].sZValue & 0xFFFF0000; + GetPolygonCenter(pRenderer->pBillboardRenderListD3D[v3].pQuards, 4, (float *)&v35, (float *)&v36); + this->CastPickRay(pPickingRay, *(float *)&v35, *(float *)&v36, fDepth); + if (uCurrentlyLoadedLevelType == 1) + PickIndoor(fDepth, pPickingRay, &Vis_static_stru_F91E10, &a5); else - PickOutdoor(fDepth, pRay, &Vis_static_stru_F91E10, &a5, 0); + PickOutdoor(fDepth, pPickingRay, &Vis_static_stru_F91E10, &a5, 0); Vis_static_stru_F91E10.create_object_pointers(0); sort_object_pointers(Vis_static_stru_F91E10.array_1804, 0, Vis_static_stru_F91E10.uNumPointers - 1); - HIWORD(result) = HIWORD(Vis_static_stru_F91E10.uNumPointers); - if ( Vis_static_stru_F91E10.uNumPointers - && ((signed int)Vis_static_stru_F91E10.uNumPointers <= 0 ? (v12 = 0) : (v12 = Vis_static_stru_F91E10.array_1804[0]), - result = v12->sZValue, - LOWORD(result) = 0, - result <= v57) - || (double)(signed int)pViewport->uScreenX > fBillboardCenterX - || (double)(signed int)pViewport->uScreenZ < fBillboardCenterX - || (double)(signed int)pViewport->uScreenY > fBillboardCenterY - || (v14 = (double)(signed int)pViewport->uScreenW, - //UNDEF(v13), - v15 = v14 < fBillboardCenterY, - v16 = 0, - v17 = v14 == fBillboardCenterY, - //BYTE1(result) = HIBYTE(v13), - v14 < fBillboardCenterY) ) + if (Vis_static_stru_F91E10.uNumPointers) { - a3a = 0; - result = (bool)&pRenderer->pBillboardRenderListD3D[v3].pQuards[0].pos.y; - - __debugbreak(); - { - LODWORD(v58) = (int)((char *)&pRenderer + v3 * 156 + 1062620);// pBillboardRenderListD3D+0x0C - } - + if (Vis_static_stru_F91E10.uNumPointers <= 0) + v8 = 0; + else v8 = (int)Vis_static_stru_F91E10.array_1804; + v9 = *(_DWORD *)(v8 + 4); + LOWORD(v9) = 0; + if (v9 > v37) + return 1; + } + else if ((double)(pViewport->uScreenX) <= *(float *)&v35 && + (double)pViewport->uScreenZ >= *(float *)&v35 && + (double)pViewport->uScreenY <= *(float *)&v36 && + (double)pViewport->uScreenW >= *(float *)&v36) + return 1; + v40 = 0; + v10 = (int)&pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[0].pos.y; + LODWORD(v38) = (int)&pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[0].pos.y; while ( 1 ) { - v18 = *(float *)(result - 4); - v19 = *(float *)result; - v20 = *(float *)(result - 4); + v12 = *(float *)(v10 - 4); + v11 = *(float *)v10; + v13 = *(float *)(v10 - 4); Vis_static_stru_F91E10.uNumPointers = 0; - if ( v20 >= (double)(signed int)pViewport->uScreenX ) + if ( v13 >= (double)(pViewport->uScreenX)) { - if ( v18 <= (double)(signed int)pViewport->uScreenZ - && v19 >= (double)(signed int)pViewport->uScreenY - && v19 <= (double)(signed int)pViewport->uScreenW ) + if ( v12 <= (double)pViewport->uScreenZ ) { - v21 = v19; - v22 = v18; - CastPickRay(a3, v22, v21, fDepth); - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - PickIndoor(fDepth, a3, &Vis_static_stru_F91E10, &a5); - else - PickOutdoor(fDepth, a3, &Vis_static_stru_F91E10, &a5, 0); - Vis_static_stru_F91E10.create_object_pointers(0); - sort_object_pointers( - Vis_static_stru_F91E10.array_1804, - 0, - Vis_static_stru_F91E10.uNumPointers - 1); - result = Vis_static_stru_F91E10.uNumPointers; - if ( !Vis_static_stru_F91E10.uNumPointers ) - break; - v23 = (signed int)(Vis_static_stru_F91E10.uNumPointers <= 0 ? 0 : Vis_static_stru_F91E10.array_1804[0]); - result = *(int *)(v23 + 4); - LOWORD(result) = 0; - if ( result > v57 ) - break; + if ( v11 >= (double)pViewport->uScreenY ) + { + if ( v11 <= (double)pViewport->uScreenW ) + { + v14 = v11; + v15 = v12; + CastPickRay(local_80, SLODWORD(v15), v14, fDepth); + if ( uCurrentlyLoadedLevelType == 1 ) + PickIndoor(fDepth, local_80, &Vis_static_stru_F91E10, &a5); + else + PickOutdoor(fDepth, local_80, &Vis_static_stru_F91E10, &a5, 0); + Vis_static_stru_F91E10.create_object_pointers(0); + sort_object_pointers(Vis_static_stru_F91E10.array_1804, 0, Vis_static_stru_F91E10.uNumPointers - 1); + if ( !Vis_static_stru_F91E10.uNumPointers ) + break; + v18 = Vis_static_stru_F91E10.uNumPointers <= 0 ? 0 : (int)Vis_static_stru_F91E10.array_1804; + v19 = *(_DWORD *)(v18 + 4); + LOWORD(v19) = 0; + if ( v19 > v37 ) + break; + } + } } } - ++a3a; - result = LODWORD(v58) + 32; - LODWORD(v58) += 32; - if ( a3a >= 4 ) + ++v40; + v10 = LODWORD(v38) + 32; + LODWORD(v38) += 32; + if ( v40 >= 4 ) { - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) - goto LABEL_49; - v24 = pRenderer->pBillboardRenderListD3D[v3].pQuards[0].pos.x; - v25 = pRenderer->pBillboardRenderListD3D[v3].pQuards[3].pos.x; - v26 = pRenderer->pBillboardRenderListD3D[v3].pQuards[0].pos.y; - v54 = pRenderer->pBillboardRenderListD3D[v3].pQuards[3].pos.x; - v58 = v26; - result = LODWORD(pRenderer->pBillboardRenderListD3D[v3].pQuards[1].pos.y); - a3b = pRenderer->pBillboardRenderListD3D[v3].pQuards[1].pos.y; - if ( v24 > v25 ) + if ( uCurrentlyLoadedLevelType != 2 ) + return false; + v21 = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[0].pos.x; + v20 = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[3].pos.x; + v22 = *(int *)(&pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[0].pos.y); + v34 = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[3].pos.x; + LODWORD(v38) = v22; + v41 = pRenderer->pBillboardRenderListD3D[uD3DBillboardIdx].pQuards[1].pos.y; + if ( v21 > v20 ) { - v53 = v24; - v24 = v54; - v25 = v53; + v33 = v21; + v21 = v34; + v20 = v33; } - if ( v58 > (double)a3b ) - a3b = v58; - if ( (Vis_static_stru_F91E10.uNumPointers = 0, - v27 = (v25 - v24) * 0.5, - v28 = (double)(signed int)pViewport->uScreenX, - //UNDEF(v29), - v30 = v27 < v28, - v31 = 0, - v32 = v27 == v28, - BYTE1(result) = HIBYTE(v29), - v27 < v28) - || (v33 = (double)(signed int)pViewport->uScreenZ, - //UNDEF(v34), - v35 = v27 < v33, - v36 = 0, - v37 = v27 == v33, - BYTE1(result) = HIBYTE(v34), - v27 > v33) - || (v39 = (double)(signed int)pViewport->uScreenY, - //UNDEF(v38), - v40 = v39 < a3b, - v41 = 0, - v42 = v39 == a3b, - BYTE1(result) = HIBYTE(v38), - !(v40 | v42)) - || (v44 = (double)(signed int)pViewport->uScreenW, - //UNDEF(v43), - v45 = v44 < a3b, - v46 = 0, - v47 = v44 == a3b, - BYTE1(result) = HIBYTE(v43), - v44 < a3b) - || ((v48 = thisa, v49 = v27, CastPickRay(a3, v49, a3b, fDepth), uCurrentlyLoadedLevelType != LEVEL_Indoor) ? PickOutdoor(fDepth, a3, &Vis_static_stru_F91E10, &a5, 0) : PickIndoor(fDepth, a3, &Vis_static_stru_F91E10, &a5), - (Vis_static_stru_F91E10.create_object_pointers(0), - sort_object_pointers( - Vis_static_stru_F91E10.array_1804, - 0, - Vis_static_stru_F91E10.uNumPointers - 1), - (result = Vis_static_stru_F91E10.uNumPointers) != 0) - && ((signed int)Vis_static_stru_F91E10.uNumPointers <= 0 ? (v50 = 0) : (v50 = Vis_static_stru_F91E10.array_1804[0]), - result = v50->sZValue, - LOWORD(result) = 0, - result <= v57)) ) - goto LABEL_49; + if ( v38 > (double)v41 ) + v41 = v38; + Vis_static_stru_F91E10.uNumPointers = 0; + v23 = (v20 - v21) * 0.5; + if ( v23 < (double)(pViewport->uScreenX) + || v23 > (double)pViewport->uScreenZ + || (double)pViewport->uScreenY > v41 + || (double)pViewport->uScreenW < v41 + || ((v25 = v23, CastPickRay(local_80, SLODWORD(v25), v41, fDepth), uCurrentlyLoadedLevelType != 1) ? + (PickOutdoor(fDepth, local_80, &Vis_static_stru_F91E10, &a5, 0)) : + (PickIndoor(fDepth, local_80, &Vis_static_stru_F91E10, &a5)), + (Vis_static_stru_F91E10.create_object_pointers(0), + sort_object_pointers(Vis_static_stru_F91E10.array_1804, 0, Vis_static_stru_F91E10.uNumPointers - 1), + Vis_static_stru_F91E10.uNumPointers) + && (Vis_static_stru_F91E10.uNumPointers <= 0 ? (v28 = 0) : (v28 = (int)Vis_static_stru_F91E10.array_1804), + v29 = *(_DWORD *)(v28 + 4), + LOWORD(v29) = 0, + v29 <= v37)) ) + return false; break; } } - } - LOBYTE(result) = 1; - } - else - { -LABEL_49: - return false; + result = 1; } return result; }
--- a/mm7_1.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/mm7_1.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -883,7 +883,7 @@ if ( !(v16 & 0xF0) ) { if ( v16 & 1 - || pCurrentScreen != 13 ) + || pCurrentScreen != SCREEN_HOUSE ) { if ( v16 & 2 ) pRenderer->_4A6776(uCellX, uCellY, v7); @@ -1257,8 +1257,7 @@ //----- (0041AD6E) -------------------------------------------------------- void __cdecl GameUI_DrawRightPanelItems() { - if ( (signed int)((pParty->uTimePlayed - qword_507CC8) >> 32) <= 0 - && (((pParty->uTimePlayed - qword_507CC8) >> 32) & 0x80000000u) != 0i64 ) + if ( (signed int)((pParty->uTimePlayed - qword_507CC8) >> 32) <= 0 && (((pParty->uTimePlayed - qword_507CC8) >> 32) & 0x80000000u) != 0i64 ) qword_507CC8 = 0i64; if ( (((pParty->uTimePlayed - qword_507CC8) >> 32) & 0x80000000u) == 0i64 && (!(SHIDWORD(pParty->uTimePlayed) < (LODWORD(pParty->uTimePlayed) < (unsigned int)qword_507CC8) @@ -1267,24 +1266,14 @@ { qword_507CC8 = pParty->uTimePlayed; byte_50697C = byte_50697C == 0; - if ( byte_50697C - && pCurrentScreen != 5 ) + if ( byte_50697C && pCurrentScreen != SCREEN_REST ) { if ( bFlashQuestBook ) - pRenderer->DrawTextureTransparent( - 493u, - 355u, - (Texture *)(uTextureID_ib_td1_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td1_A] : 0)); + pRenderer->DrawTextureTransparent(493, 355, (Texture *)(uTextureID_ib_td1_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td1_A] : 0)); if ( bFlashAutonotesBook ) - pRenderer->DrawTextureTransparent( - 527u, - 353u, - (Texture *)(uTextureID_ib_td2_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td2_A] : 0)); + pRenderer->DrawTextureTransparent(527, 353, (Texture *)(uTextureID_ib_td2_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td2_A] : 0)); if ( bFlashHistoryBook ) - pRenderer->DrawTextureTransparent( - 600u, - 361u, - (Texture *)(uTextureID_ib_td5_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td5_A] : 0)); + pRenderer->DrawTextureTransparent(600, 361, (Texture *)(uTextureID_ib_td5_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td5_A] : 0)); } else { @@ -2088,7 +2077,7 @@ v12 = pWindowList[v3].field_34; if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) { - v8 = pCurrentScreen == 21; + v8 = pCurrentScreen == SCREEN_PARTY_CREATION; pWindowList[v3].pCurrentPosActiveItem -= v12; if ( v8 ) { @@ -2128,7 +2117,7 @@ v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34; if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem ) { - v8 = pCurrentScreen == 21; + v8 = pCurrentScreen == SCREEN_PARTY_CREATION; pWindowList[v3].pCurrentPosActiveItem = v7; if ( v8 ) { @@ -3672,7 +3661,7 @@ pTexture_RestUI_CurrentSkyFrame = 0; pIcons_LOD->_4114F2(); pIcons_LOD->_40F9C5(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) { @@ -3701,7 +3690,7 @@ if ( pCurrentScreen ) { pGUIWindow_CurrentMenu->Release(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; } pEventTimer->Pause(); @@ -3740,7 +3729,7 @@ ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pCurrentScreen = 5; + pCurrentScreen = SCREEN_REST; _507CD4_RestUI_hourglass_anim_controller = 0; uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE); uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE); @@ -4550,7 +4539,7 @@ (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); pChestWindow->CreateButton(7u, 8u, 460u, 343u, 1, 0, 0xCu, 0, 0, "", 0); - pCurrentScreen = 10; + pCurrentScreen = SCREEN_CHEST; pEventTimer->Pause(); return 1; } @@ -5213,7 +5202,7 @@ if ( uNumVisibleWindows <= 0 ) { LABEL_38: - if ( pCurrentScreen == 10 ) // ChestScreen + if ( pCurrentScreen == SCREEN_CHEST ) { sub_42038D(); //goto _return; @@ -5228,7 +5217,7 @@ uLastPointedObjectID = pMouse->uPointingObjectID; return; } - if ( pCurrentScreen == 13 ) // HouseScreen + if ( pCurrentScreen == SCREEN_HOUSE ) { if ( dword_F8B19C != 2 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) @@ -5616,7 +5605,7 @@ pAudioPlayer->StopChannels(-1, -1); bRingsShownInCharScreen = 0; CharacterUI_LoadPaperdollTextures(); - pCurrentScreen = 23; + pCurrentScreen = SCREEN_CASTING; v2 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|WINDOW_Options), v1, 0); pCharacterScreen_ExitBtn = v2->CreateButton( 394u, @@ -5786,16 +5775,16 @@ pGUIWindow_CurrentMenu = GameUI_InitializeCharacterWindow(v5); return; } - if ( pCurrentScreen == 8 ) + if ( pCurrentScreen == SCREEN_SPELL_BOOK ) return; - if ( pCurrentScreen == 10 ) + if ( pCurrentScreen == SCREEN_CHEST ) { //LABEL_23: viewparams->bRedrawGameUI = 1; if ( uActiveCharacter == v1 ) { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - pCurrentScreen = 15; + pCurrentScreen = SCREEN_F; //goto LABEL_28; uActiveCharacter = v1; return; @@ -5807,15 +5796,15 @@ uActiveCharacter = v1; return; } - if ( pCurrentScreen != 13 ) - { - if ( pCurrentScreen == 14 ) + if ( pCurrentScreen != SCREEN_HOUSE ) + { + if ( pCurrentScreen == SCREEN_E ) { //LABEL_28: uActiveCharacter = v1; return; } - if ( pCurrentScreen != 15 ) + if ( pCurrentScreen != SCREEN_F ) { viewparams->bRedrawGameUI = 1; uActiveCharacter = v1; @@ -5828,7 +5817,7 @@ if ( uActiveCharacter == v1 ) { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - pCurrentScreen = 15; + pCurrentScreen = SCREEN_F; //goto LABEL_28; uActiveCharacter = v1; return; @@ -6216,12 +6205,12 @@ bool __cdecl sub_4226C2() { if ( pCurrentScreen - && pCurrentScreen != 4 - && pCurrentScreen != 17 ) - { - if ( pCurrentScreen == 18 ) + && pCurrentScreen != SCREEN_NPC_DIALOGUE + && pCurrentScreen != SCREEN_CHANGE_LOCATION ) + { + if ( pCurrentScreen == SCREEN_INPUT_BLV ) return pVideoPlayer->pSmackerMovie != 0; - if ( pCurrentScreen != 19 ) + if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) return 1; } return 0;
--- a/mm7_2.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/mm7_2.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -4400,20 +4400,8 @@ v3 = byte_591180; do { - array_5913D8[v2 + 7] = (NPCData *)ptr_507BC0->CreateButton( - *(&_4E5E50_transui_x + v2 + 6 * v1 - 6), - *(&_4E5EE0_transui_y + v2 + 6 * v1 - 6), - 0x3Fu, - 0x49u, - 1, - 0, - 0x19Au, - v2, - 0, - v3, - 0, - 0, - 0); + array_5913D8[v2 + 7] = (NPCData *)ptr_507BC0->CreateButton(*(&pNPCPortraits_x + v2 + 6 * v1 - 6), *(&pNPCPortraits_y + v2 + 6 * v1 - 6), + 0x3Fu, 0x49u, 1, 0, 0x19Au, v2, 0, v3, 0, 0, 0); v1 = uNumDialogueNPCPortraits; ++v2; v3 += 100; @@ -4518,7 +4506,7 @@ v0 = pPlayers[uActiveCharacter]; v77 = pPlayers[uActiveCharacter]; - if ( pCurrentScreen == 14 ) + if ( pCurrentScreen == SCREEN_E ) goto LABEL_73; if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -5101,7 +5089,7 @@ pRenderer->ClearBlack(); pRenderer->EndScene(); pRenderer->Present(); - pVideoPlayer->field_40 = 0; + pVideoPlayer->pResetflag = 0; _449B57_test_bit(pParty->_award_bits, 99); _this.Load("winbg.pcx", 2); pRenderer->BeginScene(); @@ -11439,7 +11427,7 @@ GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0xFF); GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0x9B); pRenderer->BeginScene(); - if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LOAD ) + if ( GetCurrentMenuID() != MENU_SAVELOAD && GetCurrentMenuID() != MENU_LOADINGPROC ) { pRenderer->DrawTextureIndexed(8, 8, uTextureID_loadsave != -1 ? &pIcons_LOD->pTextures[uTextureID_loadsave] : 0); if ( a4 ) @@ -11542,7 +11530,7 @@ if ( pGUIWindow_CurrentMenu->field_40 == 3 ) pGUIWindow_CurrentMenu->field_40 = 0; } - if (GetCurrentMenuID() == MENU_LOAD) + if (GetCurrentMenuID() == MENU_LOADINGPROC) { //v18 = pGlobalTXT_LocalizationStrings[135]; v19 = pFontSmallnum->AlignText_Center(0xBA, pGlobalTXT_LocalizationStrings[135]);//"Загрузка" @@ -12038,7 +12026,7 @@ GUIButton *pButton2; // [sp+0h] [bp-3Ch]@27 GUIWindow *pWindow; // [sp+4h] [bp-38h]@11 - pCurrentScreen = 0; // окно Главное меню + pCurrentScreen = SCREEN_GAME; if (pAsyncMouse) pAsyncMouse->Resume(); if ( LOBYTE(pGame->pKeyboardInstance->bUsingAsynKeyboard) && pAsyncKeyboard ) @@ -12049,8 +12037,8 @@ ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); // создание окна - auto pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); // создание кнопок + pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); + auto pNew = pIcons_LOD->LoadTexturePtr("title_new", TEXTURE_16BIT_PALETTE); pMainMenu_BtnNew = pWindow_MainMenu->CreateButton(495, 172, pNew->uTextureWidth, pNew->uTextureHeight, 1, 0, UIMSG_MainMenu_ShowPartyCreationWnd, 0, 78, "", pNew, 0); auto pLoad = pIcons_LOD->LoadTexturePtr("title_load", TEXTURE_16BIT_PALETTE); @@ -12072,21 +12060,21 @@ POINT pt; pMouse->GetCursorPos(&pt); pWindow = pWindow_MainMenu; - if ( GetCurrentMenuID() == MENU_SAVELOAD)//если меню загрузки - { - if ( pCurrentScreen != 12 )//если не окно загрузки игры + if ( GetCurrentMenuID() == MENU_SAVELOAD) + { + if ( pCurrentScreen != SCREEN_LOADGAME ) { pTexture_PCX.Release(); pTexture_PCX.Load("lsave640.pcx", 0); pGUIWindow2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); - pCurrentScreen = 12; //окно загрузки игры - GameUI_DrawLoadMenu(0);//процесс прорисовки окна Загрузка + pCurrentScreen = SCREEN_LOADGAME; + GameUI_DrawLoadMenu(0); } pWindow = pGUIWindow_CurrentMenu; } MSG msg; - while ( PeekMessageA(&msg, 0, 0, 0, PM_REMOVE) )//ожидание сообщения из внешнего источника + while ( PeekMessageA(&msg, 0, 0, 0, PM_REMOVE) ) { if (msg.message == WM_QUIT) Game_DeinitializeAndTerminate(0); @@ -12103,18 +12091,18 @@ pRenderer->DrawTextureRGB(0, 0, &pTexture_PCX); if (pAsyncMouse) pAsyncMouse->_46B736_consume_click_lists(1); - GUI_MainMenuMessageProc();//процедура проверки сообщений поступающих из внешних устройств для всей группы вступительных окон + GUI_MainMenuMessageProc(); GUI_UpdateWindows(); if (pAsyncMouse) pAsyncMouse->_46B736_consume_click_lists(1); - if (GetCurrentMenuID() != MENU_MAIN)// если не Главное меню - { - if (GetCurrentMenuID() == MENU_LOAD)// если меню Загрузка + if (GetCurrentMenuID() != MENU_MAIN) + { + if (GetCurrentMenuID() == MENU_LOADINGPROC) { pIcons_LOD->_4114F2(); pGUIWindow_CurrentMenu->Release(); pGUIWindow_CurrentMenu = 0; - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; } } @@ -12497,7 +12485,7 @@ goto LABEL_104; } if ( pCurrentScreen - && pCurrentScreen != 21 ) + && pCurrentScreen != SCREEN_PRESS_ESCAPE_MESSAGE ) return 0; } if ( !viewparams->field_4C ) @@ -13485,6 +13473,7 @@ pParty = new Party; + memset(&pParty->pHirelings, 0, sizeof(pParty->pHirelings)); pParty->uWalkSpeed = GetPrivateProfileIntW(L"debug", L"walkspeed", 384, pMM6IniFile); pParty->uDefaultEyelevel = GetPrivateProfileIntW(L"party", L"eyelevel", 160, pMM6IniFile); pParty->sEyelevel = pParty->uDefaultEyelevel; @@ -13978,54 +13967,59 @@ Log::Warning(L"MM: entering main loop"); while ( 1 ) { - MainMenu_Loop(); // прорисовка Главного меню и тут же прорисовка меню Загрузка + MainMenu_Loop(); uGameState = 0; //LABEL_21: while ( 1 ) { switch (uGameState) { - case GAME_FINISHED: // выход из игры + case GAME_FINISHED: pGame->Deinitialize(); - return true; // выход из функции MM_Main в Win_Main - } - if (GetCurrentMenuID() == MENU_FINISHED) // меню Выход + return true; + } + if (GetCurrentMenuID() == MENU_FINISHED) { uGameState = GAME_FINISHED; - continue; // в начало цикла - } - if (GetCurrentMenuID() == MENU_NEWGAME) // меню Новая игра + continue; + } + if (GetCurrentMenuID() == MENU_NEWGAME) { if ( pAudioPlayer->hAILRedbook ) - AIL_redbook_stop(pAudioPlayer->hAILRedbook); // остановить музыку - pParty->Reset(); // сброс группы + AIL_redbook_stop(pAudioPlayer->hAILRedbook); + pParty->Reset(); for (uint k = 0; k < 50; ++k) pOtherOverlayList->pOverlays[k].Reset(); - strcpy(pCurrentMapName, pStartingMapName); // текущая карта - pParty->CreateDefaultParty(0); // создать группу по умолчанию + strcpy(pCurrentMapName, pStartingMapName); + pParty->CreateDefaultParty(0); PlayerCreationUI_Initialize(); - if ( PlayerCreationUI_Loop() ) //процесс создания группы + if ( PlayerCreationUI_Loop() ) { DeleteCCharFont(); - break;// выход из цикла + break; } DeleteCCharFont(); bFlashQuestBook = true; - pGame->pCShow->PlayMovie(MOVIE_Emerald, 0); //заставка - Autosave(); //автосохранение - //goto LABEL_48; - pGame->Loop(); // процесс игры - break; // выход из цикла - } - if (GetCurrentMenuID() == MENU_CREDITS) // меню Создатели + pGame->pCShow->PlayMovie(MOVIE_Emerald, 0); + Autosave(); + pGame->Loop(); + if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU ) + { + SetCurrentMenuID(MENU_NEWGAME); + uGameState = 0; + continue; + } + break; + } + if (GetCurrentMenuID() == MENU_CREDITS) { if ( pAudioPlayer->hAILRedbook ) - AIL_redbook_stop(pAudioPlayer->hAILRedbook);// отключить звук + AIL_redbook_stop(pAudioPlayer->hAILRedbook); extern MENU_STATE __cdecl CreditsMenu__Loop(); - CreditsMenu__Loop(); // процесс воспроизведения окна Создатели + CreditsMenu__Loop(); break; } - if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LOAD) //??? неизвестно что это + if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LOADINGPROC) { uGameState = 0; } @@ -14061,7 +14055,7 @@ pAsyncKeyboard->Resume(); }*/ //LABEL_48: - pGame->Loop(); //game + pGame->Loop(); LABEL_49: if ( uGameState == 3 ) __debugbreak(); @@ -14072,7 +14066,7 @@ uGameState = 0; continue; }*/ - if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU )//press NewGame button out GameMenu window + if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU ) { SetCurrentMenuID(MENU_NEWGAME); uGameState = 0; @@ -14374,10 +14368,11 @@ case MENU_FINISHED: return L"MENU_FINISHED"; case MENU_5: return L"MENU_5"; case MENU_CREATEPARTY: return L"MENU_CREATEPARTY"; - case MENU_7: return L"MENU_7"; - case MENU_Credits: return L"MENU_Credits"; - case MENU_LOAD: return L"MENU_LOAD"; + case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC"; + case MENU_CREDITSPROC: return L"MENU_CREDITSPROC"; + case MENU_LOADINGPROC: return L"MENU_LOADINGPROC"; case MENU_10: return L"MENU_10"; + case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE"; default: return L"unk"; }; }; @@ -14991,7 +14986,7 @@ } //----- (00467FB6) -------------------------------------------------------- -char __cdecl sub_467FB6() +char __cdecl CreateScrollWindow() { unsigned int v0; // eax@1 char *v1; // ST18_4@3 @@ -15821,7 +15816,7 @@ } if ( v5 & 0x100000 || (v6 = pIndoor->pFaceExtras[v4->uFaceExtraID].uEventID) == 0 ) return 1; - if ( pCurrentScreen != 19 ) + if ( pCurrentScreen != SCREEN_BRANCHLESS_NPC_DIALOG ) goto LABEL_13; break; } @@ -16345,7 +16340,7 @@ UI_CreateTravelDialogue(); } } - //UpdateActors_ODM();Ritor1: it's temporarily + UpdateActors_ODM(); _46CC4B_check_event_triggers(); }
--- a/mm7_3.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/mm7_3.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -959,7 +959,7 @@ signed int v60; // eax@107 int v61; // eax@124 Vec3_int_ v62; // [sp+Ch] [bp-44h]@42 - char v63; // [sp+18h] [bp-38h]@64 + int v63; // [sp+18h] [bp-38h]@64 int v64; // [sp+1Ch] [bp-34h]@64 int v65; // [sp+20h] [bp-30h]@2 int v66; // [sp+24h] [bp-2Ch]@2 @@ -1337,8 +1337,8 @@ v70 = v0->vVelocity.z; v70 = (unsigned __int64)(v71 * (signed __int64)(signed int)v70) >> 16; ++v69; - v54 = __OFSUB__(v69, 100); - v10 = ((v69 - 100) & 0x80000000u) != 0; + v54 = v69 < 100; + v10 = (v69 - 100) < 0; v0->vVelocity.z = v70; if ( !(v10 ^ v54) ) break; @@ -4138,10 +4138,6 @@ } } - - - - //----- (0047531C) -------------------------------------------------------- bool __fastcall sub_47531C(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10) { @@ -13777,13 +13773,13 @@ //----- (0044100D) -------------------------------------------------------- bool __cdecl sub_44100D() { - return pCurrentScreen == 4 - || pCurrentScreen == 7 - || pCurrentScreen > 12 - && (pCurrentScreen <= 14 - || pCurrentScreen > 16 - && (pCurrentScreen <= 18 - || pCurrentScreen == 23)); + return pCurrentScreen == SCREEN_NPC_DIALOGUE + || pCurrentScreen == SCREEN_CHARACTERS + || pCurrentScreen > SCREEN_LOADGAME + && (pCurrentScreen <= SCREEN_E + || pCurrentScreen > SCREEN_VIDEO + && (pCurrentScreen <= SCREEN_INPUT_BLV + || pCurrentScreen == SCREEN_CASTING)); } // 4E28F8: using guessed type int pCurrentScreen; @@ -13796,16 +13792,16 @@ IconFrame *v3; // eax@19 if ( !pCurrentScreen - || pCurrentScreen == 1 - || pCurrentScreen == 2 - || pCurrentScreen == 5 - || pCurrentScreen == 8 - || pCurrentScreen == 10 - || pCurrentScreen == 11 - || pCurrentScreen == 12 - || pCurrentScreen == 15 - || pCurrentScreen == 3 - || pCurrentScreen == 19 ) + || pCurrentScreen == SCREEN_MENU + || pCurrentScreen == SCREEN_OPTIONS + || pCurrentScreen == SCREEN_REST + || pCurrentScreen == SCREEN_SPELL_BOOK + || pCurrentScreen == SCREEN_CHEST + || pCurrentScreen == SCREEN_SAVEGAME + || pCurrentScreen == SCREEN_LOADGAME + || pCurrentScreen == SCREEN_F + || pCurrentScreen == SCREEN_BOOKS + || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) { if ( SHIDWORD(pParty->pPartyBuffs[16].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[16].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[16].uExpireTime)) ) @@ -13896,7 +13892,7 @@ } while ( v1 < 14 ); if ( !pCurrentScreen - || pCurrentScreen == 4 ) + || pCurrentScreen == SCREEN_NPC_DIALOGUE ) { if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 ) { @@ -14512,7 +14508,7 @@ //----- (00442955) -------------------------------------------------------- -int __fastcall DrawSpellbook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074) +int __fastcall DrawBook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074) { int v5; // ebx@1 int v6; // edi@1 @@ -16100,7 +16096,7 @@ //----- (00444A51) -------------------------------------------------------- char *__cdecl TransitionUI_Draw() { - MapInfo *v0; // esi@5 + MapInfo *pMapInfo; // esi@5 char *v1; // eax@6 char *result; // eax@12 std::string v3; // [sp-18h] [bp-84h]@11 @@ -16117,31 +16113,19 @@ v10 = pMapStats->GetMapInfo(pCurrentMapName); v9 = IndoorLocation::GetLocationIndex(dword_591164_teleport_map_name); pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureIndexed( - _4E5E50_transui_x - 4, - _4E5EE0_transui_y - 4, - (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); - pRenderer->DrawTextureIndexed(_4E5E50_transui_x, _4E5EE0_transui_y, pTexture_outside); + pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pTexture_outside); uTextureID_507B04 = uTextureID_right_panel; - pRenderer->DrawTextureTransparent( - 0x1D4u, - 0, - (Texture *)(uTextureID_right_panel != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel] : 0)); - pRenderer->DrawTextureIndexed( - 0x22Cu, - 0x1C3u, - (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); - pRenderer->DrawTextureIndexed( - 0x1DCu, - 0x1C3u, - (Texture *)(uTextureID_x_ok_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_ok_u] : 0)); + pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_right_panel != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel] : 0)); + pRenderer->DrawTextureIndexed(556, 451, (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); + pRenderer->DrawTextureIndexed(476, 451, (Texture *)(uTextureID_x_ok_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_ok_u] : 0)); if ( (pVideoPlayer->AnyMovieLoaded() || v9) && *dword_591164_teleport_map_name != 48 ) v10 = pMapStats->GetMapInfo(dword_591164_teleport_map_name); - v0 = &pMapStats->pInfos[v10]; + pMapInfo = &pMapStats->pInfos[v10]; v8.uFrameX = 493; v8.uFrameWidth = 126; v8.uFrameZ = 366; - v8.DrawTitleText(pFontCreate, 0, 5u, 0, v0->pName, 3u); + v8.DrawTitleText(pFontCreate, 0, 5u, 0, pMapInfo->pName, 3); v8.uFrameX = 483; v8.uFrameWidth = 148; v8.uFrameZ = 334; @@ -16153,9 +16137,11 @@ { if ( v10 ) { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[409], v0->pName);// "Do you wish to leave %s?" - v1 = pTmpBuf; - goto LABEL_12; + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[409], pMapInfo->pName);// "Do you wish to leave %s?" + v4 = (212 - pFontCreate->CalcTextHeight(pTmpBuf, &v8, 0, 0)) / 2 + 101; + result = v8.DrawTitleText(pFontCreate, 0, v4, 0, pTmpBuf, 3); + dword_5B5924 = 1; + return result; } v1 = ""; } @@ -16164,12 +16150,8 @@ MessageBoxW(nullptr, L"No transition text found!", L"E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Events.cpp:1410", 0); v1 = ""; } -LABEL_12: - v7 = 3; - v6 = v1; - v5 = 0; v4 = (212 - pFontCreate->CalcTextHeight(v1, &v8, 0, 0)) / 2 + 101; - result = v8.DrawTitleText(pFontCreate, 0, v4, v5, v6, v7); + result = v8.DrawTitleText(pFontCreate, 0, v4, 0, v1, 3); dword_5B5924 = 1; return result; } @@ -16252,7 +16234,7 @@ pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); pRenderer->DrawTextureTransparent(0x1D4u, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); - pRenderer->DrawTextureIndexed(_4E5E50_transui_x, _4E5EE0_transui_y, pTexture_outside); + pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pTexture_outside); pRenderer->DrawTextureIndexed(0x22Cu, 0x1C3u, (Texture *)(uTextureID_x_x_u != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); pRenderer->DrawTextureIndexed(0x1DCu, 0x1C3u, @@ -16418,10 +16400,10 @@ //----- (00445350) -------------------------------------------------------- void __cdecl DrawDialogueUI() { - NPCData *v0; // ebx@2 + NPCData *pNPC; // ebx@2 int v1; // eax@2 unsigned __int16 v2; // di@2 - unsigned int v3; // eax@2 + //unsigned int v3; // eax@2 char *v4; // esi@3 int v5; // eax@11 char *v6; // ecx@13 @@ -16466,7 +16448,7 @@ unsigned int v45; // ecx@104 unsigned __int16 *v46; // edx@104 unsigned __int16 v47; // ax@104 - char pFont; // [sp+4h] [bp-110h]@39 + GUIWindow pWindow; // [sp+4h] [bp-110h]@39 int v49; // [sp+Ch] [bp-108h]@39 int v50; // [sp+14h] [bp-100h]@39 GUIWindow v51; // [sp+58h] [bp-BCh]@2 @@ -16480,7 +16462,7 @@ if ( !pDialogueWindow ) return; memcpy(&v51, pDialogueWindow, sizeof(v51)); - v0 = GetNPCData(uDialogue_SpeakingActorNPC_ID); + pNPC = GetNPCData(uDialogue_SpeakingActorNPC_ID); v1 = sub_445C8B(uDialogue_SpeakingActorNPC_ID); v51.uFrameWidth -= 10; v51.uFrameZ -= 10; @@ -16488,47 +16470,81 @@ GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0x15u, 0x99u, 0xE9u); - pRenderer->DrawTextureIndexed(0x1DDu, 0, pTexture_Dialogue_Background); - pRenderer->DrawTextureTransparent( - 0x1D4u, - 0, - (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); - pRenderer->DrawTextureIndexed( - _4E5E50_transui_x - 4, - _4E5EE0_transui_y - 4, - (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); - pRenderer->DrawTextureIndexed(_4E5E50_transui_x, _4E5EE0_transui_y, pDialogueNPCPortraits[0]); - v3 = v0->uProfession; - if ( v3 ) - { - v4 = pTmpBuf; - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], v0->pName, aNPCProfessionNames[v3]); - } - else - { - strcpy(pTmpBuf, v0->pName); - v4 = pTmpBuf; - } - v51.DrawTitleText(pFontArrus, 0x1E3u, 0x70u, v2, v4, 3u); + pRenderer->DrawTextureIndexed(477, 0, pTexture_Dialogue_Background); + pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x - 4, pNPCPortraits_y - 4, (Texture *)(uTextureID_50795C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50795C] : 0)); + pRenderer->DrawTextureIndexed(pNPCPortraits_x, pNPCPortraits_y, pDialogueNPCPortraits[0]); + if ( pNPC->uProfession ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], pNPC->pName, aNPCProfessionNames[pNPC->uProfession]);//^Pi[%s] %s + } + else + { + strcpy(pTmpBuf, pNPC->pName); + } + v51.DrawTitleText(pFontArrus, 483, 112, v2, pTmpBuf, 3); pParty->GetPartyFame(); if ( (signed int)uDialogueType > 89 ) { if ( uDialogueType == 90 ) { - v7 = pGlobalTXT_LocalizationStrings[577]; // "Get back in there you wimps:" - goto LABEL_37; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[577], &pWindow, 13, 0) + 7;//"Get back in there you wimps:" + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pGlobalTXT_LocalizationStrings[577], &pWindow, 13, 0) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pGlobalTXT_LocalizationStrings[577], pFontArrus, &pWindow, 0xDu, 0); + pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); + goto LABEL_42; } if ( uDialogueType == 91 ) { sprintf(v4, pGlobalTXT_LocalizationStrings[576], dword_F8B1B4);// "Congratulations on your win: here's your stuff: %u gold." pInString = v4; v8 = 0; - goto LABEL_39; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; } if ( uDialogueType == 92 ) { v7 = pGlobalTXT_LocalizationStrings[582]; // "You already won this trip to the Arena:" - goto LABEL_37; + v8 = 0; + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; } } else @@ -16536,12 +16552,46 @@ if ( uDialogueType == 89 ) { v7 = pGlobalTXT_LocalizationStrings[574]; // "Welcome to the Arena of Life and Death. Remember, you are only allowed one arena combat per visit. To fight an arena battle, select the option that best describes your abilities and return to me- if you survive:" - goto LABEL_37; + v8 = 0; + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; } if ( uDialogueType == 13 ) { - v5 = 5 * v0->uProfession; - goto LABEL_18; + v5 = 5 * pNPC->uProfession; + v6 = (char *)*(&pNPCStats->field_13A64 + v5); + v8 = 0; + v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; } if ( (signed int)uDialogueType > 18 ) { @@ -16549,44 +16599,103 @@ { if ( uDialogueType == 77 ) { - v5 = 5 * v0->uProfession; + v5 = 5 * pNPC->uProfession; if ( byte_F8B1EC ) { - v6 = (char *)*(&pNPCStats->field_13A5C + 5 * v0->uProfession); - goto LABEL_19; - } - if ( v0->uFlags & 0x80 ) - { - v6 = (char *)*(&pNPCStats->field_13A68 + 5 * v0->uProfession); -LABEL_19: + v6 = (char *)*(&pNPCStats->field_13A5C + 5 * pNPC->uProfession); + v8 = 0; + v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; + } + if ( pNPC->uFlags & 0x80 ) + { + v6 = (char *)*(&pNPCStats->field_13A68 + 5 * pNPC->uProfession); v8 = 0; v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); -LABEL_38: pInString = v7; - goto LABEL_39; - } -LABEL_18: + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; + } v6 = (char *)*(&pNPCStats->field_13A64 + v5); - goto LABEL_19; + v8 = 0; + v7 = sub_495461(v6, uActiveCharacter - 1, 0, 0, 0, 0); + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; } goto LABEL_24; } if ( byte_5B0938[0] ) goto LABEL_24; v7 = (char *)ptr_F8B1E8; -LABEL_37: v8 = 0; - goto LABEL_38; + pInString = v7; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; + pOutString = pFontArrus; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + if ( 352 - v12 < 8 ) + { + pOutString = pFontCreate; + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); + pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); + pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); + goto LABEL_42; } } LABEL_24: if ( *(int *)v54 == 1 ) { - v11 = v0->greet; + v11 = pNPC->greet; v8 = 0; if ( v11 ) { - v10 = (char *)*(&pNPCStats->field_17884 + ((v0->uFlags & 3) == 2) + 2 * v11); + v10 = (char *)*(&pNPCStats->field_17884 + ((pNPC->uFlags & 3) == 2) + 2 * v11); goto LABEL_32; } } @@ -16595,32 +16704,28 @@ if ( *(int *)v54 == 2 ) { v8 = 0; - if ( v0->uFlags & 0x80 ) - v9 = (char *)*(&pNPCStats->field_13A68 + 5 * v0->uProfession); - else - v9 = (char *)*(&pNPCStats->field_13A64 + 5 * v0->uProfession); + if ( pNPC->uFlags & 0x80 ) + v9 = (char *)*(&pNPCStats->field_13A68 + 5 * pNPC->uProfession); + else + v9 = (char *)*(&pNPCStats->field_13A64 + 5 * pNPC->uProfession); //"Invalid String Passed" v10 = sub_495461(v9, uActiveCharacter - 1, 0, 0, 0, 0); LABEL_32: pInString = v10; if ( v10 == (char *)v8 ) goto LABEL_42; -LABEL_39: - v49 = 460; - v50 = 452; + pWindow.uFrameWidth = 460; + pWindow.uFrameZ = 452; pOutString = pFontArrus; - v12 = pFontArrus->CalcTextHeight(pInString, (GUIWindow *)&pFont, 13, v8) + 7; + v12 = pFontArrus->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; if ( 352 - v12 < 8 ) { pOutString = pFontCreate; - v12 = pFontCreate->CalcTextHeight(pInString, (GUIWindow *)&pFont, 13, v8) + 7; - } - pRenderer->_4A6A68( - 8u, - 352 - v12, - (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), + v12 = pFontCreate->CalcTextHeight(pInString, &pWindow, 13, v8) + 7; + } + pRenderer->_4A6A68(8, 352 - v12, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v12); pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); - v13 = FitTextInAWindow(pInString, pOutString, (GUIWindow *)&pFont, 0xDu, v8); + v13 = FitTextInAWindow(pInString, pOutString, &pWindow, 0xDu, v8); pDialogueWindow->DrawText(pOutString, 13, 354 - v12, v8, v13, v8, v8, v8); goto LABEL_42; } @@ -16657,7 +16762,10 @@ if ( v29 ) { if ( v29 != 1 ) - goto LABEL_71; + { + v24 = ""; + goto LABEL_79; + } v24 = pGlobalTXT_LocalizationStrings[581]; } else @@ -16682,10 +16790,9 @@ } else { - if ( v0->uFlags & 0x80 ) - { -LABEL_59: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], v0->pName); + if ( pNPC->uFlags & 0x80 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName); v24 = pTmpBuf; goto LABEL_79; } @@ -16696,9 +16803,9 @@ { if ( v16 == 24 ) { - v23 = v0->evtf; + v23 = pNPC->evtf; LABEL_63: - v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; + v24 = pNPCTopics[v23-1].pTopic;//(&dword_721660)[8 * v23]; if ( !v24 ) { v24 = ""; @@ -16709,7 +16816,7 @@ v17 = v16 - 9; if ( !v17 ) { - v24 = (const char *)sub_445308(v0->uProfession); + v24 = (const char *)sub_445308(pNPC->uProfession); goto LABEL_79; } v18 = v17 - 4; @@ -16718,38 +16825,41 @@ v19 = v18 - 6; if ( !v19 ) { - v23 = v0->bDrawSomeAnim; + v23 = pNPC->bDrawSomeAnim; goto LABEL_63; } v20 = v19 - 1; if ( !v20 ) { - v23 = v0->_anim_current_time; + v23 = pNPC->_anim_current_time; goto LABEL_63; } v21 = v20 - 1; if ( !v21 ) { - v23 = v0->_anim_end_time; + v23 = pNPC->_anim_end_time; goto LABEL_63; } v22 = v21 - 1; if ( !v22 ) { - v23 = v0->evtd; + v23 = pNPC->evtd; goto LABEL_63; } if ( v22 == 1 ) { - v23 = v0->evte; + v23 = pNPC->evte; goto LABEL_63; } -LABEL_71: v24 = ""; goto LABEL_79; } - if ( v0->uFlags & 0x80 ) - goto LABEL_59; + if ( pNPC->uFlags & 0x80 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[408], pNPC->pName); + v24 = pTmpBuf; + goto LABEL_79; + } v24 = pGlobalTXT_LocalizationStrings[122]; } LABEL_79: @@ -16830,10 +16940,7 @@ while ( (signed int)v41 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); } } - pRenderer->DrawTextureIndexed( - 0x1D7u, - 0x1BDu, - (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0)); + pRenderer->DrawTextureIndexed(471, 445, (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0)); } //----- (004459F9) -------------------------------------------------------- @@ -17471,7 +17578,14 @@ { case EVENT_CheckSeason: if ( !sub_4465DF_check_season(_evt->v5) ) - goto LABEL_291; + { + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } v11 = _evt->v6; goto LABEL_130; case EVENT_ShowMovie: @@ -17482,7 +17596,7 @@ if ( pVideoPlayer->field_54 ) pVideoPlayer->Unload(); pVideoPlayer->bStopBeforeSchedule = 0; - pVideoPlayer->field_40 = 0; + pVideoPlayer->pResetflag = 0; if (pAsyncMouse) pAsyncMouse->Suspend(); v128 = pCurrentScreen; @@ -17498,16 +17612,47 @@ { pParty->uAlignment = 0; v18 = 0; -LABEL_23: LOBYTE(v17) = 1; SetUserInterface(v18, v17); - goto LABEL_28; + if ( !v15 || v128 == 3 ) + { + pCurrentScreen = v128; + if ( v128 == 3 ) + pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; + if ( v128 == 13 ) + pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); + } + if (pAsyncMouse) + pAsyncMouse->Resume(); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( !_strcmpi(v16, "arbiter evil") ) { v18 = 2; pParty->uAlignment = 2; - goto LABEL_23; + LOBYTE(v17) = 1; + SetUserInterface(v18, v17); + if ( !v15 || v128 == 3 ) + { + pCurrentScreen = v128; + if ( v128 == 3 ) + pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; + if ( v128 == 13 ) + pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].field_0, 1u); + } + if (pAsyncMouse) + pAsyncMouse->Resume(); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( !_strcmpi(v16, "pcout01") ) // moving to harmondale from emerald isle { @@ -17515,7 +17660,6 @@ pParty->RestAndHeal(); pParty->field_764 = 0; } -LABEL_28: if ( !v15 || v128 == 3 ) { pCurrentScreen = v128; @@ -17526,7 +17670,12 @@ } if (pAsyncMouse) pAsyncMouse->Resume(); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_CheckSkill: v19 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((unsigned int)_evt->v10 << 8)) << 8)) << 8); if ( v127 < 0 ) @@ -17558,9 +17707,15 @@ { ++v20; if ( v20 >= 4 ) - goto LABEL_291; + { + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } } -LABEL_50: v11 = _evt->v11; goto LABEL_130; } @@ -17574,8 +17729,16 @@ v138 = v24 & 0x80; v139 = v24 & 0x100; if ( (v24 & 0x3F) >= v19 && *(&v136 + _evt->v6) ) - goto LABEL_50; - goto LABEL_291; + { + v11 = _evt->v11; + goto LABEL_130; + } + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SpeakNPC: if ( a3 ) { @@ -17593,7 +17756,12 @@ bDialogueUI_InitializeActor_NPC_ID = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ChangeEvent: v25 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((unsigned int)_evt->v8 << 8)) << 8)) << 8); if ( v25 ) @@ -17606,13 +17774,23 @@ stru_5E4C90._decor_events[_5C3420_pDecoration->_idx_in_stru123 - 75] = 0; LOBYTE(v26->field_2) |= 0x20u; } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetNPCGreeting: v27 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); v28 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); pNPCStats->pNewNPCData[v27].uFlags &= 0xFFFFFFFCu; pNPCStats->pNewNPCData[v27].greet = v28; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetNPCTopic: v29 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); v30 = _evt->v10 + ((_evt->v11 + ((_evt->v12 + ((uint)_evt->v13 << 8)) << 8)) << 8); @@ -17680,26 +17858,47 @@ } } } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_NPCSetItem: - sub_448518_npc_set_item( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13); - goto LABEL_291; + sub_448518_npc_set_item(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetActorItem: - Actor::GiveItem( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13); - goto LABEL_291; + Actor::GiveItem(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetNPCGroupNews: pNPCStats->pGroups_copy[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)] = _evt->v9 + ((uint)_evt->v10 << 8); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetActorGroup: __debugbreak(); *(&pActors[0].uGroup + 0x11000000 * _evt->v8 + 209 * (_evt->v5 + ((_evt->v6 + ((uint)_evt->v7 << 8)) << 8))) = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ChangeGroup: v38 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); v39 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); @@ -17710,14 +17909,19 @@ v41 = pActors;//[0].uGroup; do { - if ( v41->uGroup == v38 ) - v41->uGroup = v39; + if ( v41->uGroup == v38 ) + v41->uGroup = v39; ++v41; --v40; } while ( v40 ); } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ChangeGroupAlly: v42 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); v43 = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); @@ -17728,14 +17932,19 @@ v45 = pActors;//[0].uAlly; do { - if ( v45->uGroup == v42 ) - v45->uAlly = v43; + if ( v45->uGroup == v42 ) + v45->uAlly = v43; ++v45; --v44; } while ( v44 ); } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_MoveNPC: pNPCStats->pNewNPCData[_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8)].house = _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8); if ( ptr_507BC0 ) @@ -17776,11 +17985,21 @@ pVideoPlayer->bLoopPlaying = 0; } } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_Jmp: //v124 = -1; v122 = _evt->v5 - 1; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ShowFace: v50 = _evt->v5; if ( (unsigned __int8)v50 <= 3u ) @@ -17788,25 +18007,41 @@ v117 = 0; v113 = _evt->v6; v53 = (unsigned __int8)v50; - goto LABEL_108; + v52 = &pParty->pPlayers[v53]; + v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( v50 == 4 ) { v117 = 0; v113 = _evt->v6; v52 = pPlayers[uActiveCharacter]; - goto LABEL_109; + v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( v50 != 5 ) { v117 = 0; v113 = _evt->v6; v53 = rand() % 4; -LABEL_108: v52 = &pParty->pPlayers[v53]; -LABEL_109: v52->PlayEmotion((CHARACTER_EXPRESSION_ID)v113, v117); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } v51 = pParty->pPlayers; do @@ -17815,7 +18050,7 @@ ++v51; } while ( (signed int)v51 < (signed int)pParty->pHirelings ); -LABEL_291: +//LABEL_291: ++v122; //v4 = v124; //v5 = pSomeEVT; @@ -17847,7 +18082,12 @@ v56 = &pParty->pPlayers[v57]; LABEL_120: v56->PlaySound(v114, v118); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } v55 = pParty->pPlayers; do @@ -17856,22 +18096,33 @@ ++v55; } while ( (signed int)v55 < (signed int)pParty->pHirelings ); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ForPartyMember: v127 = _evt->v5; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SummonItem: - sub_42F7EB_DropItemAt( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + sub_42F7EB_DropItemAt(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13 + ((_evt->v14 + ((_evt->v15 + ((uint)_evt->v16 << 8)) << 8)) << 8), _evt->v17 + ((_evt->v18 + ((_evt->v19 + ((uint)_evt->v20 << 8)) << 8)) << 8), _evt->v21 + ((_evt->v22 + ((_evt->v23 + ((uint)_evt->v24 << 8)) << 8)) << 8), - _evt->v25, - _evt->v26, - 0, - 0); - goto LABEL_291; + _evt->v25, _evt->v26, 0, 0); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_Compare: v58 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); if ( v127 == 5 ) @@ -17880,16 +18131,20 @@ v59 = pParty->pPlayers; while ( 1 ) { - LOBYTE(v60) = v59->CompareVariable( - (enum VariableType)(_evt->v5 - + ((uint)_evt->v6 << 8)), - v58); + LOBYTE(v60) = v59->CompareVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v58); if ( v60 ) break; ++v130; ++v59; if ( (signed int)v59 >= (signed int)pParty->pHirelings ) - goto LABEL_291; + { + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } } LABEL_129: v11 = _evt->v11; @@ -17926,7 +18181,12 @@ LABEL_140: if ( v62 ) goto LABEL_129; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_IsActorAlive: v62 = IsActorAlive( _evt->v5, @@ -17941,7 +18201,12 @@ if ( (void *)pParty->pPickedItem.uItemID == v63 ) { pMouse->RemoveHoldingItem(); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } v65 = 0; v66 = pPlayers[uActiveCharacter]; @@ -17951,7 +18216,12 @@ if ( *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v67 + 5] == v63 ) { v66->RemoveItemAtInventoryIndex(v65); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } ++v65; v67 += 4; @@ -17964,7 +18234,12 @@ if ( *(int *)v69 && *(void **)&v66->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * *(int *)v69 + 5] == v63 ) { *(&v66->pEquipment.uOffHand + v68) = 0; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } ++v68; v69 += 4; @@ -18006,7 +18281,14 @@ LABEL_170: v125 += 4; if ( v125 > (signed int)&pPlayers[4] ) - goto LABEL_291; + { + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } } } v75 = v127; @@ -18021,10 +18303,13 @@ if ( v127 == 6 ) goto LABEL_180; LABEL_183: - ((Player *)v6)->SubtractVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v63); - goto LABEL_291; + ((Player *)v6)->SubtractVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v63); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( uActiveCharacter ) { @@ -18050,7 +18335,12 @@ ++v76; } while ( (signed int)v76 < (signed int)pParty->pHirelings ); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_Set: v77 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); v78 = v127; @@ -18065,10 +18355,13 @@ if ( v127 == 6 ) goto LABEL_194; LABEL_197: - ((Player *)v6)->SetVariable( - (enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), - v77); - goto LABEL_291; + ((Player *)v6)->SetVariable((enum VariableType)(_evt->v5 + ((uint)_evt->v6 << 8)), v77); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( uActiveCharacter ) { @@ -18094,7 +18387,12 @@ ++v79; } while ( (signed int)v79 < (signed int)pParty->pHirelings ); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_Add: v80 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); v81 = v127; @@ -18142,7 +18440,12 @@ v83 = _evt->v5 + ((uint)_evt->v6 << 8); if ( v83 == 21 || v83 == 22 || v83 == 23 || v83 == 24 ) viewparams->bRedrawGameUI = 1; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_InputString: if ( !dword_597F18 ) { @@ -18174,16 +18477,15 @@ LABEL_131: v122 = v11 - 1; } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_RandomGoTo: //v124 = -1; - v11 = (unsigned __int8)*(&_evt->v5 - + rand() - % ((_evt->v5 != 0) - + (_evt->v6 != 0) - + (_evt->v7 != 0) - + (_evt->v8 != 0) - + (_evt->v9 != 0) + v11 = (unsigned __int8)*(&_evt->v5 + rand() % ((_evt->v5 != 0) + (_evt->v6 != 0) + (_evt->v7 != 0) + (_evt->v8 != 0) + (_evt->v9 != 0) + (_evt->v10 != 0))); goto LABEL_131; case EVENT_ReceiveDamage: @@ -18199,7 +18501,14 @@ if ( v86 == 4 ) { if ( !uActiveCharacter ) - goto LABEL_291; + { + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } v119 = _evt->v6; v88 = pPlayers[uActiveCharacter]; v115 = _evt->v7 + ((_evt->v8 + ((_evt->v9 + ((uint)_evt->v10 << 8)) << 8)) << 8); @@ -18214,7 +18523,12 @@ v88 = &pParty->pPlayers[v89]; LABEL_234: v88->ReceiveDamage(v115, v119); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } v87 = pParty->pPlayers; do @@ -18223,53 +18537,92 @@ ++v87; } while ( (signed int)v87 < (signed int)pParty->pHirelings ); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ToggleIndoorLight: pIndoor->ToggleLight(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetFacesBit: - sub_44892E_set_faces_bit( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13); - goto LABEL_291; + sub_44892E_set_faces_bit(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ToggleChestFlag: - Chest::ToggleFlag( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13); - goto LABEL_291; + Chest::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ToggleActorFlag: - Actor::ToggleFlag( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), - _evt->v13); - goto LABEL_291; + Actor::ToggleFlag(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), + _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ToggleActorGroupFlag: ToggleActorGroupFlag( _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9 + ((_evt->v10 + ((_evt->v11 + ((uint)_evt->v12 << 8)) << 8)) << 8), _evt->v13); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetSnow: if ( !_evt->v5 ) pWeather->bRenderSnow = _evt->v6 != 0; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_StatusText: v90 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); if ( _5C3420_pDecoration ) { if ( _5C3420_pDecoration == (LevelDecoration *)1 ) { - ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; - goto LABEL_291; + ptr_F8B1E8 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } if ( a3 == 1 ) { v91 = pNPCTopics[v90-1].pText;//(&dword_721664)[8 * v90]; -LABEL_248: +//LABEL_248: ShowStatusBarString(v91, 2u); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } } else @@ -18277,10 +18630,21 @@ if ( a3 == 1 ) { v91 = &pLevelStr[pLevelStrOffsets[v90]]; - goto LABEL_248; - } - } - goto LABEL_291; + ShowStatusBarString(v91, 2u); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; + } + } + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ShowMessage: v92 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); if ( _5C3420_pDecoration ) @@ -18293,50 +18657,80 @@ { strcpy(byte_5B0938, &pLevelStr[pLevelStrOffsets[v92]]); } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_CastSpell: - sub_448DF8_cast_spell( - _evt->v5, - _evt->v6, - _evt->v7, - _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), + sub_448DF8_cast_spell(_evt->v5, _evt->v6, _evt->v7, _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8), _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8), _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8), _evt->v28 + ((_evt->v29 + ((_evt->v30 + ((uint)_evt->v31 << 8)) << 8)) << 8)); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetTexture: sub_44861E_set_texture(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), (char *)&_evt->v9); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SetSprite: - SetDecorationSprite( - _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), - _evt->v9, - (char *)&_evt->v10); - goto LABEL_291; + SetDecorationSprite(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8), _evt->v9, (char *)&_evt->v10); + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SummonMonsters: - sub_448CF4_spawn_monsters( - _evt->v5, - _evt->v6, - _evt->v7, + sub_448CF4_spawn_monsters(_evt->v5, _evt->v6, _evt->v7, _evt->v8 + ((_evt->v9 + ((_evt->v10 + ((uint)_evt->v11 << 8)) << 8)) << 8), _evt->v12 + ((_evt->v13 + ((_evt->v14 + ((uint)_evt->v15 << 8)) << 8)) << 8), _evt->v16 + ((_evt->v17 + ((_evt->v18 + ((uint)_evt->v19 << 8)) << 8)) << 8), _evt->v20 + ((_evt->v21 + ((_evt->v22 + ((uint)_evt->v23 << 8)) << 8)) << 8), _evt->v24 + ((_evt->v25 + ((_evt->v26 + ((uint)_evt->v27 << 8)) << 8)) << 8)); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_MouseOver: case EVENT_LocationName: --v122; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_ChangeDoorState: sub_449A49_door_switch_animation(_evt->v5, _evt->v6); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_OpenChest: if ( !Chest::Open(_evt->v5) ) goto LABEL_301; - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_MoveToMap: v94 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); v135 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); @@ -18351,16 +18745,7 @@ { if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) pRenderer->_49FD3A(); - sub_444839_move_map( - _evt->v29, - _evt->v30, - v135, - v132, - v126, - v129, - v95, - v134, - (char *)&_evt->v31); + sub_444839_move_map(_evt->v29, _evt->v30, v135, v132, v126, v129, v95, v134, (char *)&_evt->v31); dword_5C3418 = uEventID; dword_5C341C = v122 + 1; goto LABEL_301; @@ -18418,7 +18803,7 @@ pGameLoadingUI_ProgressBar->uType = (GUIProgressBar::Type)((_5C3420_pDecoration == 0) + 1); sub_44987B(v99, 0); v133 = 1; - if ( pCurrentScreen == 13 ) + if ( pCurrentScreen == SCREEN_HOUSE ) { if ( uGameState == 2 ) { @@ -18431,7 +18816,7 @@ ptr_507BC0 = 0; if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; array_5913D8[6] = 0; pDialogueWindow->Release(); @@ -18442,7 +18827,12 @@ goto LABEL_302; } } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_PlaySound: v120 = 0; v116 = 0; @@ -18462,7 +18852,12 @@ if ( v102 ) item.uItemID = v102; pParty->SetHoldingItem(&item); - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_SpeakInHouse: v103 = _evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8); if ( EnterHouse((enum HOUSE_TYPE)(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8))) ) @@ -18481,7 +18876,12 @@ ptr_507BC0->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); ptr_507BC0->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); } - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; case EVENT_PressAnyKey: v121 = 33; v105 = v122 + 1; @@ -18489,7 +18889,12 @@ case EVENT_Exit: goto LABEL_301; default: - goto LABEL_291; + ++v122; + //v4 = v124; + //v5 = pSomeEVT; + //v6 = v123; + //v7 = ""; + break; } } //++v4; @@ -19921,7 +20326,7 @@ dword_5B65C0 = 0; pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; sub_44987B("nwc.blv", 0); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; result = 1; } return result;
--- a/mm7_4.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/mm7_4.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -3059,7 +3059,7 @@ for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) { - if (pNPCStats->pNewNPCData[i].uFlags & 0x80) + if (pNPCStats->pNewNPCData[i].uFlags == 128) { if (!pParty->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, pParty->pHirelings[0].pName)) { @@ -4178,7 +4178,7 @@ v51 = v65; if ( v65 ) goto LABEL_135; - if ( pCurrentScreen != 5 ) + if ( pCurrentScreen != SCREEN_REST ) { v52 = (signed int)&pPlayers[1]; while ( 1 ) @@ -4194,13 +4194,13 @@ *(int *)(v53 + 20) = 0; v51 = 1; LABEL_135: - if ( pCurrentScreen != 5 + if ( pCurrentScreen != SCREEN_REST && (!v51 || dword_5C35C0) ) uGameState = 8; } if ( uActiveCharacter ) { - if ( pCurrentScreen != 5 ) + if ( pCurrentScreen != SCREEN_REST ) { v54 = pPlayers[uActiveCharacter]; if ( v54->pConditions[2] @@ -5450,7 +5450,7 @@ { pGUIWindow_CurrentMenu->field_40 = 0; pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, pOrder, 124, 0, player->pName, 130, 0); - SetCurrentMenuID(MENU_7); + SetCurrentMenuID(MENU_NAMEPANELESC); } } else @@ -5705,7 +5705,7 @@ ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pCurrentScreen = 21;//окно Создания группы + pCurrentScreen = SCREEN_PARTY_CREATION; uPlayerCreationUI_ArrowAnim = 0; uPlayerCreationUI_SkySliderPos = 0; uPlayerCreationUI_SelectedCharacter = 0; @@ -6207,8 +6207,8 @@ free(pString); pWindow_MainMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, (int)ptr); pWindow_MainMenu->CreateButton(0, 0, 0, 0, 1, 0, 0x71u, 0, 0x1Bu, "", 0); - pCurrentScreen = 9; // окно Credits - SetCurrentMenuID(MENU_Credits); + pCurrentScreen = SCREEN_CREATORS; + SetCurrentMenuID(MENU_CREDITSPROC); do { while ( PeekMessageA(&Msg, 0, 0, 0, 1) ) @@ -6236,11 +6236,11 @@ if ( a5 >= (signed __int16)pTexture2.uHeight ) SetCurrentMenuID(MENU_MAIN); pRenderer->Present(); - pCurrentScreen = 0;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc() + pCurrentScreen = SCREEN_GAME;//Ritor1: temporarily, must be corrected GUI_MainMenuMessageProc() GUI_MainMenuMessageProc(); } } - while ( GetCurrentMenuID() == MENU_Credits ); + while ( GetCurrentMenuID() == MENU_CREDITSPROC ); pAudioPlayer->_4AA258(1); pAllocator->FreeChunk(ptr); pAllocator->FreeChunk(pFontQuick); @@ -9670,7 +9670,8 @@ } Party::TakeGold(v21); } - LOBYTE(v2->uFlags) |= 0x80u; + //LOBYTE(v2->uFlags) |= 0x80u; + v2->uFlags = 128; pParty->field_709 = 0; sub_44A56A(); if ( pParty->pHirelings[0].pName ) @@ -11081,42 +11082,20 @@ { NPCData *v0; // ST40_4@1 signed int v1; // edi@1 - GUIWindow *v2; // ecx@1 - + //GUIWindow *v2; // ecx@1 + + __debugbreak(); v0 = GetNPCData(uDialogue_SpeakingActorNPC_ID); v1 = 0; pDialogueWindow->eWindowType = WINDOW_MainMenu; pDialogueWindow->Release(); - v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_A, 1, 0); - pDialogueWindow = v2; + pDialogueWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_Dialogue, 1, 0); if ( *(&pNPCStats->field_13A5C + 5 * v0->uProfession) ) { - v2->CreateButton( - 0x1E0u, - 0xA0u, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0x88u, - 0x4Du, - 0, - pGlobalTXT_LocalizationStrings[407], - 0); + pDialogueWindow->CreateButton(480, 160, 140, 28, 1, 0, 136, 77, 0, pGlobalTXT_LocalizationStrings[407], 0); v1 = 1; } - pDialogueWindow->CreateButton( - 0x1E0u, - 30 * v1 + 160, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0x88u, - 0x4Cu, - 0, - pGlobalTXT_LocalizationStrings[406], - 0); + pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, 136, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);//Нанять pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); } @@ -11310,8 +11289,8 @@ (Texture *)(uTextureID_BUTTYES2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTYES2] : 0), 0); pDialogueWindow->CreateButton( - _4E5E50_transui_x, - _4E5EE0_transui_y, + pNPCPortraits_x, + pNPCPortraits_y, 63u, 73u, 1,
--- a/mm7_5.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/mm7_5.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -332,8 +332,8 @@ //goto _actor_init_dlg; pActor->InitializeDialogue(v0); continue; - case UIMSG_Quit|0x2: - case 0x87: + case UIMSG_86: + case UIMSG_87: if ( bNoNPCHiring != 1 && !pCurrentScreen ) { if ( pMessageQueue_50CBD0->uNumMessages ) @@ -382,19 +382,19 @@ } } continue; - case 0x51: + case UIMSG_51: sub_4BDB56_buy_skill____(); continue; case UIMSG_AF: sub_4B2001(uMessageParam); continue; - case 0x195: + case UIMSG_195: sub_4BCACC_bounties(uMessageParam); continue; - case 0x88: + case UIMSG_88: sub_4BC49B(uMessageParam); continue; - case 0x19A: + case UIMSG_19A: _4B4224_UpdateNPCTopics(uMessageParam); continue; case UIMSG_StartNewGame: @@ -407,7 +407,7 @@ pGUIWindow_CurrentMenu->Release(); uGameState = 4; LABEL_188: - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; } else @@ -425,7 +425,7 @@ if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); - pCurrentScreen = 12; + pCurrentScreen = SCREEN_LOADGAME; GameUI_DrawLoadMenu(v0); continue; case UIMSG_Quit: @@ -436,7 +436,7 @@ if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; if ( !uMessageParam ) pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0); @@ -451,11 +451,11 @@ //goto _release_tex_and_continue; stru_506E40.Release(); continue; - case 0x80: + case UIMSG_80: pIcons_LOD->_40F9C5(); pIcons_LOD->_4114F2(); pGUIWindow_CurrentMenu->Release(); - pCurrentScreen = 2; + pCurrentScreen = SCREEN_OPTIONS; v162 = 0; v148 = 0; pWindowType = (WindowType)8; @@ -517,7 +517,7 @@ case UIMSG_SelectLoadSlot: if ( pGUIWindow_CurrentMenu->field_40 == v0 ) pKeyActionMap->_459ED1(0); - if ( pCurrentScreen != 11 || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam ) + if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam ) { v10 = pSaveListPosition + uMessageParam; if ( dword_6BE138 == pSaveListPosition + uMessageParam ) @@ -572,9 +572,9 @@ //goto _release_tex_and_continue; stru_506E40.Release(); continue; - case UIMSG_StartNewGame|0x2: + case UIMSG_Game_OpenSaveGameDialog: pGUIWindow_CurrentMenu->Release(); - pCurrentScreen = 11; + pCurrentScreen = SCREEN_SAVEGAME; GameUI_DrawSaveMenu(); continue; case UIMSG_Game_OpenOptionsDialog: @@ -582,7 +582,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); viewparams->field_48 = v0; - pCurrentScreen = 2; + pCurrentScreen = SCREEN_OPTIONS; 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); @@ -670,7 +670,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); viewparams->field_48 = 1; - pCurrentScreen = 26; + pCurrentScreen = SCREEN_KEYBOARD_OPTIONS; 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); @@ -707,7 +707,7 @@ continue; //default: //continue; - case UIMSG_ResetKeyMapping|0x1: + case UIMSG_1A3: if ( dword_506E68 != -1 ) goto LABEL_623; v14 = uMessageParam; @@ -753,10 +753,10 @@ v130 = 0; v127 = 219; goto _play_sound_and_continue; - case 0x1A0: + case UIMSG_1A0: dword_506F08 = v0; continue; - case UIMSG_StartNPCDialogue|0x100: + case UIMSG_1A1: dword_506F08 = 2; continue; case UIMSG_OpenVideoOptions: @@ -764,7 +764,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); viewparams->field_48 = v0; - pCurrentScreen = 28; + pCurrentScreen = SCREEN_VIDEO_OPTIONS; 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); @@ -817,11 +817,11 @@ } } continue; - case UIMSG_ToggleTint|0x1: + case UIMSG_1A9: if ( uMessageParam == 4 ) { - --uGammaPos; - if ( (uGammaPos & 0x80000000u) != 0 ) + //--uGammaPos; + if ( (uGammaPos -- -1) < 0 ) { uGammaPos = 0; //goto LABEL_128; @@ -1117,7 +1117,7 @@ } ModalWindow(pNPCTopics[453].pText, 0); continue; - case UIMSG_SkillUp|0x2: + case UIMSG_7B: pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); goto LABEL_188; @@ -1192,9 +1192,9 @@ back_to_game(); if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - if ( pCurrentScreen > 15 ) - { - if ( pCurrentScreen >= 17 && (pCurrentScreen <= 18 || pCurrentScreen == 104) ) + if ( pCurrentScreen > SCREEN_F ) + { + if ( pCurrentScreen >= SCREEN_CHANGE_LOCATION && (pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_QUICK_REFERENCE) ) { //LABEL_229: if ( dword_50CDC8 ) @@ -1207,7 +1207,7 @@ } else { - if ( pCurrentScreen >= 14 || pCurrentScreen == 4 || pCurrentScreen == 10 ) + if ( pCurrentScreen >= SCREEN_E || pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHEST ) { //goto LABEL_229; if ( dword_50CDC8 ) @@ -1217,7 +1217,7 @@ uMessageParam = v0; goto LABEL_232; } - if ( pCurrentScreen == 13 && !dword_50CDC8 && !dword_5C35C8 ) + if ( pCurrentScreen == SCREEN_HOUSE && !dword_50CDC8 && !dword_5C35C8 ) { CloseWindowBackground(); dword_5C35C8 = 0; @@ -1234,18 +1234,18 @@ viewparams->field_48 = v0; if ( pCurrentScreen ) { - if ( pCurrentScreen > 103 ) + if ( pCurrentScreen > SCREEN_67 ) { - if ( pCurrentScreen == 104 ) + if ( pCurrentScreen == SCREEN_QUICK_REFERENCE ) goto LABEL_321; } else { - if ( pCurrentScreen < 100 ) + if ( pCurrentScreen < SCREEN_64 ) { switch ( pCurrentScreen ) { - case 23: + case SCREEN_CASTING: pIcons_LOD->_4114F2(); if ( some_active_character ) { @@ -1267,7 +1267,7 @@ //goto LABEL_322; if ( pGUIWindow_Settings ) { - if ( pCurrentScreen == 7 ) + if ( pCurrentScreen == SCREEN_CHARACTERS ) { pMouse->SetCursorBitmap("MICON2"); } @@ -1288,11 +1288,11 @@ ptr_507BC0 = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; pIcons_LOD->_4355F7(); continue; - case 3: + case SCREEN_BOOKS: pBooksWindow->Release(); //crt_deconstruct_ptr_6A0118(); pBooksWindow = 0; @@ -1300,7 +1300,7 @@ //goto LABEL_322; if ( pGUIWindow_Settings ) { - if ( pCurrentScreen == 7 ) + if ( pCurrentScreen == SCREEN_CHARACTERS ) { pMouse->SetCursorBitmap("MICON2"); } @@ -1321,39 +1321,39 @@ ptr_507BC0 = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; pIcons_LOD->_4355F7(); continue; - case 11: - case 12: + case SCREEN_SAVEGAME: + case SCREEN_LOADGAME: pIcons_LOD->_4114F2(); //crt_deconstruct_ptr_6A0118(); //goto LABEL_291; stru_506E40.Release(); break; - case 15: - pCurrentScreen = 10; + case SCREEN_F: + pCurrentScreen = SCREEN_CHEST; continue; - case 10: + case SCREEN_CHEST: pWindow2 = pChestWindow; //goto LABEL_249; pWindow2->Release(); pIcons_LOD->_4114F2(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; pEventTimer->Resume(); continue; - case 25: + case SCREEN_19: pWindow2 = ptr_507BC8; //LABEL_249: pWindow2->Release(); pIcons_LOD->_4114F2(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; pEventTimer->Resume(); continue; - case 2: + case SCREEN_OPTIONS: thisa = (signed int)&uTextureID_507C60; do { @@ -1408,7 +1408,7 @@ //LABEL_291: stru_506E40.Release(); break; - case 1: + case SCREEN_MENU: pIcons_LOD->_40F9C5(); pIcons_LOD->_4114F2(); pIcons_LOD->_40F9C5(); @@ -1416,7 +1416,7 @@ //goto LABEL_291; stru_506E40.Release(); break; - case 28: + case SCREEN_VIDEO_OPTIONS: if ( pRenderer->pRenderD3D ) { WriteWindowsRegistryInt("Colored Lights", pRenderer->bUseColoredLights); @@ -1435,7 +1435,7 @@ WriteWindowsRegistryInt(v31, v30); stru_506E40.Release(); break; - case 26: + case SCREEN_KEYBOARD_OPTIONS: v197 = 1; v32 = 0; while ( *((char *)word_506E6C + v32) != 1 ) @@ -1486,7 +1486,7 @@ } } goto LABEL_623; - case 5: + case SCREEN_REST: if ( dword_506F14 ) { Rest(_506F18_num_hours_to_sleep); @@ -1507,7 +1507,7 @@ //goto LABEL_322; if ( pGUIWindow_Settings ) { - if ( pCurrentScreen == 7 ) + if ( pCurrentScreen == SCREEN_CHARACTERS ) { pMouse->SetCursorBitmap("MICON2"); } @@ -1528,16 +1528,16 @@ ptr_507BC0 = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; pIcons_LOD->_4355F7(); continue; - case 14: + case SCREEN_E: pGUIWindow_CurrentMenu->Release(); - pCurrentScreen = 13; + pCurrentScreen = SCREEN_HOUSE; pIcons_LOD->_4114F2(); continue; - case 13: + case SCREEN_HOUSE: if ( uDialogueType ) uDialogueType = 0; if ( uGameState == 2 ) @@ -1557,7 +1557,7 @@ //goto LABEL_322; if ( pGUIWindow_Settings ) { - if ( pCurrentScreen == 7 ) + if ( pCurrentScreen == SCREEN_CHARACTERS ) { pMouse->SetCursorBitmap("MICON2"); } @@ -1578,11 +1578,11 @@ ptr_507BC0 = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; pIcons_LOD->_4355F7(); continue; - case 18: + case SCREEN_INPUT_BLV: if ( uCurrentHouse_Animation == 153 ) HousePlaySomeSound(0x99u, 3); pVideoPlayer->Unload(); @@ -1596,7 +1596,7 @@ dword_5B65CC = 0; } goto LABEL_317; - case 4: + case SCREEN_NPC_DIALOGUE: //LABEL_306: if ( dword_5B65CC ) { @@ -1607,11 +1607,11 @@ dword_5B65CC = 0; } goto LABEL_317; - case 19: + case SCREEN_BRANCHLESS_NPC_DIALOG: memset(GameUI_StatusBar_TimedString, 0, 0xC8u); sub_4452BB(); goto LABEL_317; - case 17: + case SCREEN_CHANGE_LOCATION: if ( pParty->vPosition.x < -22528 ) pParty->vPosition.x = -22528; if ( pParty->vPosition.x > 22528 ) @@ -1621,16 +1621,16 @@ if ( pParty->vPosition.y > 22528 ) pParty->vPosition.y = 22528; goto LABEL_317; - case 16: + case SCREEN_VIDEO: pVideoPlayer->Unload(); continue; - case 7: + case SCREEN_CHARACTERS: goto LABEL_319; default: //goto LABEL_322; if ( pGUIWindow_Settings ) { - if ( pCurrentScreen == 7 ) + if ( pCurrentScreen == SCREEN_CHARACTERS ) { pMouse->SetCursorBitmap("MICON2"); } @@ -1651,7 +1651,7 @@ ptr_507BC0 = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; pIcons_LOD->_4355F7(); continue; @@ -1659,7 +1659,7 @@ //goto LABEL_322; if ( pGUIWindow_Settings ) { - if ( pCurrentScreen == 7 ) + if ( pCurrentScreen == SCREEN_CHARACTERS ) { pMouse->SetCursorBitmap("MICON2"); } @@ -1680,7 +1680,7 @@ ptr_507BC0 = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; pIcons_LOD->_4355F7(); continue; @@ -1694,7 +1694,7 @@ //LABEL_322: if ( pGUIWindow_Settings ) { - if ( pCurrentScreen == 7 ) + if ( pCurrentScreen == SCREEN_CHARACTERS ) { pMouse->SetCursorBitmap("MICON2"); } @@ -1715,7 +1715,7 @@ ptr_507BC0 = 0; pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; pIcons_LOD->_4355F7(); continue; @@ -1801,7 +1801,7 @@ } DrawHiredNPCs(); continue; - case UIMSG_OpenRestUI|0x2: + case UIMSG_19B: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; dword_50CDC8 = v0; @@ -1862,7 +1862,7 @@ if ( !_strcmpi(byte_6BE3B0, "d05.blv") ) pParty->uTimePlayed += 1474560i64; continue; - case 0x19C: + case UIMSG_19C: CloseWindowBackground(); pVideoPlayer->Unload(); sub_44603D(); @@ -1872,7 +1872,7 @@ v39 = GetAsyncKeyState(VK_SHIFT); v40 = CycleCharacter(v39); goto LABEL_421; - case UIMSG_LoadGame|0x8: + case UIMSG_5A: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; dword_50CDC8 = v0; @@ -1895,7 +1895,7 @@ pParty->vPosition.y = 22528; LABEL_317: sub_44603D(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; } else { @@ -1968,11 +1968,11 @@ sub_461103(); pEventTimer->Resume(); viewparams->bRedrawGameUI = 1; - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; pGameLoadingUI_ProgressBar->Release(); } goto LABEL_422; - case UIMSG_SaveGame|0x8: + case UIMSG_5B: goto LABEL_387; case UIMSG_BE: if ( pRenderer->pRenderD3D ) @@ -2083,9 +2083,9 @@ unk_50C9A0 = 0; back_to_game(); continue; - case UIMSG_ChangeGameState|0x40: - case 0x8D: - case 0x8F: + case UIMSG_45: + case UIMSG_8D: + case UIMSG_8F: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; if ( unk_50C9A0 ) @@ -2506,7 +2506,7 @@ uGameState = 0; strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); goto LABEL_524; - case UIMSG_D5|0x8: + case UIMSG_DD: LABEL_524: sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer); memcpy(&v216, texture_frame_table_txt_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); @@ -2613,7 +2613,7 @@ v1 = ""; v0 = 1; continue; - case 0x19: + case UIMSG_19: if ( bUnderwater == 1 ) goto LABEL_682; if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) ) @@ -2631,8 +2631,8 @@ //goto LABEL_679; _42777D_CastSpell_UseWand_ShootArrow(v79, v80, v147, v159, v175); continue; - case 0x46: - case UIMSG_Quit|0x8: + case UIMSG_46: + case UIMSG_8C: if ( pRenderer->pRenderD3D ) { v81 = pGame->pVisInstance->get_picked_object_zbuf_val(); @@ -2677,7 +2677,7 @@ unk_50C9A0 = 0; back_to_game(); continue; - case 0x1C: + case UIMSG_1C: if ( !uActiveCharacter || pCurrentScreen ) //goto LABEL_90; { @@ -2686,10 +2686,10 @@ continue; } ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)104, uMessageParam, 0); - pCurrentScreen = 25; + pCurrentScreen = SCREEN_19; pEventTimer->Pause(); continue; - case 0x1B: + case UIMSG_1B: if ( !uActiveCharacter ) //goto LABEL_90; { @@ -2747,7 +2747,7 @@ //LABEL_577: _42ECB5_PlayerAttacksActor(); continue; - case UIMSG_A7: + case UIMSG_ExitRest: v163 = (int)pGlobalTXT_LocalizationStrings[81];// "Exit Rest" pButton = pButton_RestUI_Exit; pButton2 = pButton_RestUI_Exit; @@ -2760,7 +2760,7 @@ v133 = 0; GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163); continue; - case UIMSG_ShowStatus_Player|0x1: + case UIMSG_Wait5Minutes: if ( dword_506F14 == 2 ) //goto LABEL_621; { @@ -2772,7 +2772,7 @@ dword_506F14 = v0; _506F18_num_hours_to_sleep = 5; continue; - case 0x60: + case UIMSG_Wait1Hour: if ( dword_506F14 == 2 ) //goto LABEL_621; { @@ -2800,7 +2800,7 @@ pParty->pPlayers[1].pConditions[2] = pParty->uTimePlayed; pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed; continue; - case 0x68: + case UIMSG_68: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; if ( pCurrentScreen ) @@ -2865,7 +2865,7 @@ v176 = 0; v160 = 13; goto LABEL_619; - case 0x61: + case UIMSG_61: if ( dword_506F14 ) //goto LABEL_621; { @@ -2945,7 +2945,7 @@ pParty->pPlayers[0].pConditions[2] = pParty->uTimePlayed; } continue; - case UIMSG_ShowStatus_Funds|0x8: + case UIMSG_AlreadyResting: if ( dword_506F14 == 2 ) { //LABEL_621: @@ -2958,7 +2958,7 @@ dword_506F14 = v0; _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute; continue; - case 0x4E: + case UIMSG_4E: if ( dword_50654C && byte_506550 ) { v173 = pSpellStats->pInfos[dword_50654C + 11 * pPlayers[uActiveCharacter]->pNumSpellBookPage].pName; @@ -2977,7 +2977,7 @@ //_set_status_string_pTmpBuf_and_continue: sub_41C0B8_set_status_string(pTmpBuf); continue; - case 0x4F: + case UIMSG_4F: if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter], !*(char *)(uNumSeconds + 11 * *(char *)(uNumSeconds + 6734) + uMessageParam + 402)) ) continue; @@ -2999,7 +2999,7 @@ //goto LABEL_91; v0 = 1; continue; - case 0x58: + case UIMSG_58: GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, (enum WindowType)90, (int)pBtn_InstallRemoveSpell, 0); if ( !uActiveCharacter ) continue; @@ -3025,7 +3025,7 @@ pPlayer10->PlaySound(12, 0); byte_506550 = 0; continue; - case 0x33: + case UIMSG_33: if ( !uActiveCharacter ) continue; pPlayer3 = pPlayers[uActiveCharacter]; @@ -3083,7 +3083,7 @@ v130 = 0; v127 = rand() % 2 + 204; goto _play_sound_and_continue; - case UIMSG_SaveGame|0x4: + case UIMSG_57: if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->pNumSpellBookPage ) continue; sub_41140B(); @@ -3098,7 +3098,7 @@ v130 = 0; v127 = rand() % 2 + 204; goto _play_sound_and_continue; - case UIMSG_LoadGame|0x4: + case UIMSG_56: if ( pTurnEngine->field_4 != 3 ) { if ( uActiveCharacter ) @@ -3111,7 +3111,7 @@ pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); viewparams->bRedrawGameUI = v0; - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; pIcons_LOD->_4114F2(); v103 = dword_50654C + 11 * *(char *)(uNumSeconds + 6734); if ( dword_50C9E8 < 40 ) @@ -3131,7 +3131,7 @@ } } continue; - case 0x8E: + case UIMSG_8E: if ( pTurnEngine->field_4 == 3 ) continue; v175 = 0; @@ -3142,7 +3142,7 @@ v79 = uMessageParam; _42777D_CastSpell_UseWand_ShootArrow(v79, v80, v147, v159, v175); continue; - case 0x92: + case UIMSG_92: if ( pTurnEngine->field_4 != 3 ) { v175 = 0; @@ -3155,7 +3155,7 @@ _42777D_CastSpell_UseWand_ShootArrow(v79, v80, v147, v159, v175); } continue; - case 0x69: + case UIMSG_69: if ( pTurnEngine->field_4 == 3 ) continue; if ( bUnderwater == 1 ) @@ -3186,22 +3186,22 @@ //goto LABEL_693; { GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, (enum WindowType)90, (int)pBtn_CastSpell, 0); - pCurrentScreen = 8; + pCurrentScreen = SCREEN_SPELL_BOOK; 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); viewparams->field_48 = v0; continue; } - if ( pCurrentScreen != 5 - && pCurrentScreen != 7 - && (pCurrentScreen <= 99 - || pCurrentScreen > 103) ) + if ( pCurrentScreen != SCREEN_REST + && pCurrentScreen != SCREEN_CHARACTERS + && (pCurrentScreen <= SCREEN_63 + || pCurrentScreen > SCREEN_67) ) { pGUIWindow_CurrentMenu->Release(); //LABEL_693: GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, (enum WindowType)90, (int)pBtn_CastSpell, 0); - pCurrentScreen = 8; + pCurrentScreen = SCREEN_SPELL_BOOK; 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); @@ -3223,19 +3223,19 @@ viewparams->bRedrawGameUI = v0; pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); - pCurrentScreen = 104; + pCurrentScreen = SCREEN_QUICK_REFERENCE; pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, (enum WindowType)12, 5, 0); papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, v0, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79],// "Exit" (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0); //, v179); continue; - case 0x6B: + case UIMSG_6B: if ( pCurrentScreen ) { pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v0; } stru_506E40.Release(); @@ -3268,7 +3268,7 @@ //LABEL_709: dword_506544 = v0; continue; - case 0x55: + case UIMSG_55: bRingsShownInCharScreen ^= v0; GUIButton::_41D0D8(pCharacterScreen_DetalizBtn); GUIButton::_41D0D8(pCharacterScreen_DollBtn); @@ -3291,10 +3291,10 @@ 0); pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, v0, 0, 0x85u, 0, 0, v1, 0); goto LABEL_422; - case UIMSG_Quit|0x1: + case UIMSG_85: OnPaperdollLeftClick(); continue; - case UIMSG_Escape|0x2: + case UIMSG_73: pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; sub_4196A0(); sub_419379(); @@ -3310,7 +3310,7 @@ v133 = 0; GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163); continue; - case UIMSG_ChangeMusicVolume|0x2: + case UIMSG_72: pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101; sub_4196A0(); sub_419379(); @@ -3358,7 +3358,7 @@ //_draw_status_string_and_continue: ShowStatusBarString(v87, 2u); continue; - case UIMSG_ChangeMusicVolume|0x4: + case UIMSG_74: pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; sub_419379(); sub_4196A0(); @@ -3388,7 +3388,7 @@ v133 = 0; GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163); continue; - case UIMSG_Escape|0x4: + case UIMSG_75: sub_419379(); sub_4196A0(); sub_419220(); @@ -3397,7 +3397,7 @@ (int)pCharacterScreen_AwardsBtn, 0); sub_419100(); continue; - case 71://0x47: + case UIMSG_AutonotesBook: switch ( uMessageParam ) { default: @@ -3517,18 +3517,18 @@ sprintf(pTmpBuf, "%d / %d %s %d / %d %s", v110->sHealth, v114, v113, v112, v111, v109); sub_41C0B8_set_status_string(pTmpBuf); continue; - case 0xC: - if ( pCurrentScreen == 15 ) + case UIMSG_C: + if ( pCurrentScreen == SCREEN_F ) { sub_421EA6_OnInventoryLeftClick(); continue; } sub_420E01(); continue; - case UIMSG_ChangeMusicVolume|0x8: + case UIMSG_InventoryLeftClick: sub_421EA6_OnInventoryLeftClick(); continue; - case 0xA: + case UIMSG_A: if ( !pRenderer->pRenderD3D ) //goto LABEL_772; { @@ -3578,13 +3578,13 @@ continue; } continue; - case 0xE: + case UIMSG_E: //LABEL_772: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; OnGameViewportClick(); continue; - case 0xF: + case UIMSG_F: if ( pRenderer->pRenderD3D ) { LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val(); @@ -3605,7 +3605,7 @@ v133 = 0; GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163); continue; - case 0x54: + case UIMSG_54: v163 = 0; pButton2 = (GUIButton *)uMessageParam; pWindowType1 = (WindowType)22; @@ -3618,12 +3618,12 @@ //LABEL_733: GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163); continue; - case 0x194: + case UIMSG_194: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; OnPressSpace(); continue; - case UIMSG_ChangeSoundVolume|0x100: + case UIMSG_16F: if ( pCurrentScreen ) continue; pParty->uFlags |= 2u; @@ -3646,7 +3646,7 @@ goto LABEL_789; viewparams->field_28 = 11; goto LABEL_788; - case UIMSG_ChangeMusicVolume|0x100: + case UIMSG_170: if ( pCurrentScreen ) continue; pParty->uFlags |= 2u; @@ -3790,25 +3790,25 @@ pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, &pSex); switch (pUIMessageType) // For buttons of window MainMenu { - case UIMSG_MainMenu_ShowPartyCreationWnd:// Окно создания группы + case UIMSG_MainMenu_ShowPartyCreationWnd: { GUIWindow::Create(495, 172, 0, 0, WINDOW_5A, (int)pMainMenu_BtnNew, 0); SetCurrentMenuID(MENU_NEWGAME); } continue; - case UIMSG_MainMenu_ShowLoadWindow:// Окно Загрузка + case UIMSG_MainMenu_ShowLoadWindow: { GUIWindow::Create(495, 227, 0, 0, WINDOW_5A, (int)pMainMenu_BtnLoad, 0); SetCurrentMenuID(MENU_SAVELOAD); } continue; - case UIMSG_ShowCredits:// Окно Создатели + case UIMSG_ShowCredits: { GUIWindow::Create(495, 282, 0, 0, WINDOW_5A, (int)pMainMenu_BtnCredits, 0); SetCurrentMenuID(MENU_CREDITS); } continue; - case UIMSG_ExitToWindows:// Окно Выход + case UIMSG_ExitToWindows: { GUIWindow::Create(495, 337, 0, 0, WINDOW_5A, (int)pMainMenu_BtnExit, 0); SetCurrentMenuID(MENU_FINISHED); @@ -3818,19 +3818,19 @@ switch (pUIMessageType) // For buttons of window LoadGame { - case UIMSG_LoadGame:// Процесс загрузки + case UIMSG_LoadGame: { if (!pSavegameUsedSlots[uLoadGameUI_SelectedSlot]) continue; - SetCurrentMenuID(MENU_LOAD); - continue; - } - case UIMSG_SelectLoadSlot: // Выбранный слот сохранёнки + SetCurrentMenuID(MENU_LOADINGPROC); + continue; + } + case UIMSG_SelectLoadSlot: { //main menu save/load wnd clicking on savegame lines if (pGUIWindow_CurrentMenu->field_40 == 1) pKeyActionMap->_459ED1(0); - if ( pCurrentScreen != 11 || uLoadGameUI_SelectedSlot != uNum + pSaveListPosition ) + if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != uNum + pSaveListPosition ) { //load clicked line v26 = uNum + pSaveListPosition; @@ -3851,12 +3851,12 @@ } continue; } - case UIMSG_LoadSlot: // Нажатие на слот в окне Загрузка + case UIMSG_LoadSlot: { GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, WINDOW_5E, (int)pBtnLoadSlot, 0); continue; } - case UIMSG_DownArrow://нажатие стрелки вниз + case UIMSG_DownArrow: { ++pSaveListPosition; if ( pSaveListPosition >= uNum ) @@ -3864,23 +3864,21 @@ if ( pSaveListPosition < 1 ) pSaveListPosition = 0; pWindow = pGUIWindow_CurrentMenu; - v8 = pGUIWindow_CurrentMenu->uFrameY + 323; - GUIWindow::Create(pWindow->uFrameX + 215, v8, 0, 0, (WindowType)90, (int)pBtnDownArrow, 0); - continue; - } - case UIMSG_Cancel:// Нажатие кнопки Отмена + GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 323, 0, 0, (WindowType)90, (int)pBtnDownArrow, 0); + continue; + } + case UIMSG_Cancel: { GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 350, pGUIWindow_CurrentMenu->uFrameY + 302, 61, 28, (WindowType)95, (int)pBtnCancel, 0); continue; } - case UIMSG_ArrowUp:// Кнопка Вверх + case UIMSG_ArrowUp: { --pSaveListPosition; if ( pSaveListPosition < 0 ) pSaveListPosition = 0; pWindow = pGUIWindow_CurrentMenu; - v8 = pGUIWindow_CurrentMenu->uFrameY + 197; - GUIWindow::Create(pWindow->uFrameX + 215, v8, 0, 0, (WindowType)90, (int)pBtnArrowUp, 0); + GUIWindow::Create(pWindow->uFrameX + 215, pGUIWindow_CurrentMenu->uFrameY + 197, 0, 0, (WindowType)90, (int)pBtnArrowUp, 0); continue; } } @@ -3889,7 +3887,7 @@ { if ( pUIMessageType > UIMSG_DownArrow ) { - if ( pUIMessageType == UIMSG_SelectFacePlayerBack ) // Выбор лица персонажа кнопка назад + if ( pUIMessageType == UIMSG_SelectFacePlayerBack ) { pPlayer = &pParty->pPlayers[uNum]; v12 = (char)((int)pPlayer->uFace - 1) < 0; @@ -3912,7 +3910,7 @@ //v1 = (char *)pParty->pPlayers; continue; } - if ( pUIMessageType == UIMSG_SelectFacePlayerForward ) // выбор лица персонажа кнопка вперёд + if ( pUIMessageType == UIMSG_SelectFacePlayerForward ) { pPlayer = &pParty->pPlayers[uNum]; v20 = (char)((int)pPlayer->uFace + 1) % 20; @@ -3937,7 +3935,7 @@ { __debugbreak(); GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnNew, 0); - SetCurrentMenuID(MENU_LOAD); + SetCurrentMenuID(MENU_LOADINGPROC); continue; } if ( pUIMessageType != UIMSG_AE )//unknow @@ -3946,11 +3944,7 @@ continue; } 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; - SetCurrentMenuID((MENU_STATE)v2); + SetCurrentMenuID(MENU_10); continue; } if ( pUIMessageType == UIMSG_6B )//unknow @@ -3960,14 +3954,13 @@ { pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; } GUIWindow::Create(602, 450, 0, 0, (enum WindowType)92, (int)pBtn_GameSettings, 0); if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; - //goto LABEL_93; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -3986,26 +3979,19 @@ pVideoPlayer->bStopBeforeSchedule = 1; viewparams->bRedrawGameUI = 1; viewparams->field_48 = 1; - if ( !GetCurrentMenuID() || GetCurrentMenuID() == 6 || GetCurrentMenuID() == 7 ) - { - v17 = pCurrentScreen; + if ( !GetCurrentMenuID() || GetCurrentMenuID() == MENU_CREATEPARTY || GetCurrentMenuID() == MENU_NAMEPANELESC ) + { LABEL_83: - if ( v17 == 16 ) - pVideoPlayer->FastForwardToFrame(pVideoPlayer->field_40); - if (GetCurrentMenuID() == MENU_7) - { - v40 = 6; - //goto LABEL_89; - v2 = v40; - SetCurrentMenuID((MENU_STATE)v2); + if ( pCurrentScreen == SCREEN_VIDEO ) + pVideoPlayer->FastForwardToFrame(pVideoPlayer->pResetflag); + if (GetCurrentMenuID() == MENU_NAMEPANELESC) + { + SetCurrentMenuID(MENU_CREATEPARTY); continue; } - if (GetCurrentMenuID() == MENU_Credits) - { - v40 = 11; - //goto LABEL_89; - v2 = v40; - SetCurrentMenuID((MENU_STATE)v2); + if (GetCurrentMenuID() == MENU_CREDITSPROC) + { + SetCurrentMenuID(MENU_CREDITSCLOSE); continue; } if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) @@ -4020,10 +4006,9 @@ continue; } v16 = GetCurrentMenuID() == 8; - v17 = pCurrentScreen; if ( v16 && !pCurrentScreen ) goto LABEL_83; - if ( pCurrentScreen == 12 ) + if ( pCurrentScreen == SCREEN_LOADGAME ) { pIcons_LOD->_4114F2(); //crt_deconstruct_ptr_6A0118(); @@ -4036,24 +4021,24 @@ pGUIWindow2->Release(); pGUIWindow2 = 0; pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v15; continue; } - if ( pCurrentScreen == 16 ) + if ( pCurrentScreen == SCREEN_VIDEO ) { pVideoPlayer->Unload(); } else { - if ( pCurrentScreen != 27 ) + if ( pCurrentScreen != SCREEN_1B ) //goto LABEL_81; { pGUIWindow_CurrentMenu->Release(); pGUIWindow2->Release(); pGUIWindow2 = 0; pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = v15; continue; } @@ -4095,9 +4080,8 @@ do { pCurrentPlayer->uVoiceID = (signed int)(pCurrentPlayer->uVoiceID + 1) % 20; - v10 = pCurrentPlayer->GetSexByVoice(); - } - while ( v10 != pSex ); + } + while ( pCurrentPlayer->GetSexByVoice() != pSex ); pButton = pCreationUI_BtnPressRight2[uNum]; GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, (enum WindowType)92, (int)pButton, 1); pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0); @@ -4111,12 +4095,11 @@ if ( pUIMessageType == UIMSG_PlayerCreationRemoveDownSkill ) { uPlayerCreationUI_SelectedCharacter = uNum; - v41 = 3; + //v41 = 3; //v1 = (char *)pParty->pPlayers; - v5 = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 + pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum; - pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5; - pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41) + pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(3) + 3486 * uPlayerCreationUI_SelectedCharacter] = 0; continue; } @@ -4203,9 +4186,7 @@ break; case UIMSG_3A://unknow __debugbreak(); - v40 = 10; - v2 = v40; - SetCurrentMenuID((MENU_STATE)v2); + SetCurrentMenuID(MENU_10); break; } } @@ -6165,11 +6146,10 @@ //----- (0043AA99) -------------------------------------------------------- void __fastcall Vec3_int_::Rotate(int sDepth, int sRotY, int sRotX, Vec3_int_ v, int *outx, int *outy, int *outz) { - int v7; // ebx@1 +/* int v7; // ebx@1 int v8; // ST14_4@1 int v9; // edi@1 int anglea; // [sp+20h] [bp+8h]@1 - v7 = sRotX; v8 = sDepth; v9 = sRotY; @@ -6179,7 +6159,17 @@ + ((unsigned __int64)(stru_5C6E00->SinCos(v9 - stru_5C6E00->uIntegerHalfPi) * (signed __int64)anglea) >> 16); *outz = v.z - + ((unsigned __int64)(stru_5C6E00->SinCos(v7 - stru_5C6E00->uIntegerHalfPi) * (signed __int64)v8) >> 16); + + ((unsigned __int64)(stru_5C6E00->SinCos(v7 - stru_5C6E00->uIntegerHalfPi) * (signed __int64)v8) >> 16);*/ + + float cosf_x = cosf(3.14159265f * sRotX / 1024.0f), + cosf_y = cosf(3.14159265f * sRotY / 1024.0f), + sinf_x = sinf(3.14159265f * sRotX / 1024.0f), + sinf_y = sinf(3.14159265f * sRotY / 1024.0f); + + *outx = v.x + ((unsigned __int64)((double)sDepth * cosf_y * cosf_x) >> 16); + *outy = v.y + ((unsigned __int64)((double)sDepth * sinf_y * cosf_x) >> 16); + *outz = v.z + ((unsigned __int64)((double)sDepth * sinf_x) >> 16); + } //----- (0043AB61) -------------------------------------------------------- @@ -13288,7 +13278,7 @@ } //----- (00412B58) -------------------------------------------------------- -void __cdecl sub_412B58() +void __cdecl DrawSpellBookContent() { Player *v0; // ebx@1 int v1; // ebp@1 @@ -13306,7 +13296,7 @@ signed int v13; // ecx@18 unsigned int v14; // esi@18 unsigned int v15; // edi@18 - Texture *v16; // eax@21 + Texture *pPageTexture; // eax@21 unsigned int v17; // [sp-Ch] [bp-2Ch]@8 unsigned int v18; // [sp-Ch] [bp-2Ch]@15 unsigned int v19; // [sp-8h] [bp-28h]@8 @@ -13390,7 +13380,7 @@ { if ( v0->pNumSpellBookPage == v13 ) { - v16 = pTextures_tabs[v13][1]; + pPageTexture = pTextures_tabs[v13][1]; switch ( v13 ) { case 0: @@ -13430,7 +13420,7 @@ } else { - v16 = pTextures_tabs[v13][0]; + pPageTexture = pTextures_tabs[v13][0]; switch ( v13 ) { case 0: @@ -13476,7 +13466,7 @@ break; } } - pRenderer->DrawTextureTransparent(v14, v15, v16); + pRenderer->DrawTextureTransparent(v14, v15, pPageTexture); v13 = v25; } a2.x += 2; @@ -14113,13 +14103,13 @@ viewparams->_443231(); if ( dword_506538 ) viewparams->_44323D(); - v6 = dword_506534; + //v6 = dword_506534; if ( dword_506534 ) { viewparams->_443225(); - v6 = dword_506534; - } - if ( dword_506548 | dword_506544 | dword_506540 | dword_50653C | dword_506538 | v6 ) + //v6 = dword_506534; + } + if ( dword_506548 | dword_506544 | dword_506540 | dword_50653C | dword_506538 | dword_506534 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); dword_506548 = 0; dword_506544 = 0; @@ -14127,8 +14117,8 @@ dword_506538 = 0; dword_50653C = 0; dword_506540 = 0; - DrawSpellbook_Map_sub(0x61u, 0x31u, 0x169u, 313, 0); - pRenderer->DrawTextureTransparent(0x4Bu, 0x16u, pTexture_mapbordr); + DrawBook_Map_sub(97, 49, 361, 313, 0); + pRenderer->DrawTextureTransparent(75, 22, pTexture_mapbordr); v22.uFrameWidth = 460; v22.uFrameHeight = 344; v22.uFrameX = 8; @@ -14354,7 +14344,7 @@ dword_506F0C[0] = pCurrentScreen; result = GUIWindow::Create(0, 0, 640, 480, WINDOW_FinalWindow, v3, (int)v2); ptr_507BDC = result; - pCurrentScreen = 22; + pCurrentScreen = SCREEN_PRESS_ESCAPE_MESSAGE; return result; } // 4E28F8: using guessed type int pCurrentScreen; @@ -15033,7 +15023,7 @@ if ( pHint && pHint != (char *)1 ) pGUIButton3->DrawLabel(pHint, pFontCreate, 0, 0); pWindow->Release(); - if (pCurrentScreen == 11)//окно сохранения игры + if (pCurrentScreen == SCREEN_SAVEGAME) pMessageQueue_50CBD0->SendMessage(UIMSG_SaveGame, 0, 0); else pMessageQueue_50CBD0->SendMessage(UIMSG_LoadGame, 0, 0); @@ -15082,15 +15072,15 @@ v38 = v37 - 2; if ( v38 )//pWindowType > 105 { - if ( v38 == 1 )//pWindowType == 106 (0x6A) WINDOW_VideoOptions + if ( pWindowType == WINDOW_VideoOptions ) GameMenuUI_DrawVideoOptions(); } - else//pWindowType == 105 (0x69) WINDOW_KeyMappingOptions + else if ( pWindowType == WINDOW_KeyMappingOptions ) { GameMenuUI_DrawKeyBindings(); } } - else//pWindowType == 103 (0x67) WINDOW_67 + else//pWindowType == WINDOW_67 { pWindow->DrawMessageBox(0); pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); @@ -15100,7 +15090,7 @@ ItemGen2.Reset(); pWindow->Release(); pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; v39 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); if ( v39 > 0 ) @@ -15140,7 +15130,7 @@ pGUIWindow2->Release(); continue; } - if ( pWindow->Hint != (char *)1 )//pWindowType == 97 (0x61) WINDOW_61 + if ( pWindow->Hint != (char *)1 )//pWindowType == WINDOW_61 pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); v32 = pWindow->ptr_1C; pRenderer->DrawTextureIndexed(pWindow->uFrameX, pWindow->uFrameY, *((Texture **)v32 + 16)); @@ -15179,7 +15169,7 @@ if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) //goto LABEL_151; { - pMessageQueue_50CBD0->pMessages[pNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pNumMessages].eType = (UIMessageType)113; //0x71 pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -15191,7 +15181,7 @@ if ( v14 )//pWindowType > 80 { v15 = v14 - 9; - if ( !v15 )//pWindowType == 89 (0x59) WINDOW_59 + if ( pWindowType == WINDOW_59) { pWindow->DrawMessageBox(0); pWindow->DrawText(pFontLucida, 10, 20, 0, "Making item number", 0, 0, 0); @@ -15201,7 +15191,7 @@ pItemGen.Reset(); pWindow->Release(); pEventTimer->Resume(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; viewparams->bRedrawGameUI = 1; v26 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); if ( v26 > 0 ) @@ -15228,7 +15218,7 @@ continue; } v16 = v15 - 1; - if ( !v16 )// pWindowType == 90 (0x5A) WINDOW_5A + if ( pWindowType == WINDOW_5A ) // Press buttons in title menu and in game, and escape in game { if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); @@ -15279,7 +15269,7 @@ continue; } v17 = v16 - 1; - if ( !v17 )//pWindowType == 91 (0x5B) WINDOW_5B + if ( pWindowType == WINDOW_5B )//Change button in Character window { if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); @@ -15304,7 +15294,7 @@ continue; } v18 = v17 - 1; - if ( !v18 )//pWindowType == 92 (0x5C) WINDOW_5C + if ( pWindowType == WINDOW_5C ) // Change page in AutonotesBook { if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); @@ -15324,7 +15314,7 @@ continue; } v19 = v18 - 1; - if ( !v19 )//pWindowType == 93 (0x5D) WINDOW_5D + if ( pWindowType == WINDOW_5D ) { if ( pWindow->Hint != (char *)1 ) pAudioPlayer->PlaySound((SoundID)75, 0, 0, -1, 0, 0, 0, 0); @@ -15337,7 +15327,7 @@ continue; } } - else//pWindowType == 80 (0x50) WINDOW_50 + else if ( pWindowType == WINDOW_50 ) { v27 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); if ( ptr_507BD0->field_40 == 1 ) @@ -15362,7 +15352,7 @@ } pEventTimer->Resume(); ptr_507BD0->Release(); - pCurrentScreen = 0; + pCurrentScreen = SCREEN_GAME; //goto LABEL_114; viewparams->bRedrawGameUI = 1; continue; @@ -15380,7 +15370,7 @@ } else { - if ( pWindowType == 70 ) // 0x46 WINDOW_FinalWindow + if ( pWindowType == WINDOW_FinalWindow ) { sub_41420D_press_esc(); continue; @@ -15395,7 +15385,7 @@ v13 = v12 - 4; if ( v13 )//pWindowType > 30 { - if ( v13 == 1 ) //pWindowType == 31 (0x1F) WINDOW_1F + if ( pWindowType == WINDOW_1F) { pRenderer->ClearZBuffer(0, 479); draw_leather(); @@ -15405,12 +15395,12 @@ (Texture *)(uTextureID_x_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); } } - else// pWindowType == 30 (0x1E) WINDOW_1E - { - sub_467FB6(); - } - } - else //pWindowType == 26 (0x1A) WINDOW_1A + else if( pWindowType == WINDOW_Scroll) + { + CreateScrollWindow(); + } + } + else if ( pWindowType == WINDOW_Transition ) { TransitionUI_Draw(); } @@ -15430,20 +15420,20 @@ //if ( v9 == 1 ) //pWindowType == 24 (0x18) WINDOW_MainMenu_Load // sub_4606F7(); } - else//pWindowType == 23 (0x17) WINDOW_17 + else if ( pWindowType == WINDOW_17 ) { sub_4606FE(); } } - else//pWindowType == 20 (0x14) WINDOW_Chest - { - if ( pCurrentScreen == 10 ) + else if ( pWindowType == WINDOW_Chest ) + { + if ( pCurrentScreen == SCREEN_CHEST ) { Chest::DrawChestUI((unsigned int)pWindow->ptr_1C); } else { - if ( pCurrentScreen == 15 ) + if ( pCurrentScreen == SCREEN_F ) { pRenderer->ClearZBuffer(0, 479); draw_leather(); @@ -15454,7 +15444,7 @@ } } } - else//pWindowType == 19 (0x13) WINDOW_GreetingNPC + else if (pWindowType == WINDOW_GreetingNPC ) { DrawBranchlessDialogueUI(); } @@ -15491,9 +15481,9 @@ } continue; } - if ( pWindowType == 18 ) //(0x12) WINDOW_SpellBook - { - sub_412B58(); + if ( pWindowType == WINDOW_SpellBook ) + { + DrawSpellBookContent(); } else { @@ -15505,21 +15495,21 @@ v6 = v5 - 4; if ( v6 )//pWindowType > 16 { - if ( v6 == 1 )//pWindowType == 17 (0x11) WINDOW_ChangeLocation + if ( pWindowType == WINDOW_ChangeLocation ) TravelUI_Draw(); } - else//pWindowType == 16 (0x10) WINDOW_10 + else if ( pWindowType == WINDOW_Rest ) { RestUI_Draw(); } } - else// pWindowType == 12 (0xC) WINDOW_C + else if (pWindowType == WINDOW_QuickReference ) { QuickRefDraw(); } continue; } - if ( pWindowType != 10 ) + if ( pWindowType != 10 ) //pWindowType == 10 { v2 = pWindowType - 3; if ( v2 )//pWindowType > 3 @@ -15530,15 +15520,15 @@ v4 = v3 - 2; if ( v4 )//pWindowType > 6 { - if ( v4 == 3 )//pWindowType == 9 (0x9) WINDOW_Book + if ( pWindowType == WINDOW_Book ) SellectDrawBook((unsigned int)pWindow->ptr_1C); } - else//pWindowType == 6 (0x6) WINDOW_Options + else if (pWindowType == WINDOW_Options) { sub_414F82_DrawGameOptions(); } } - else//pWindowType == 4 (0x4) WINDOW_CharacterRecord + else if (pWindowType == WINDOW_CharacterRecord) { CharacterUI_CharacterScreen_Draw(uActiveCharacter); } @@ -16160,7 +16150,7 @@ unsigned int pX; // [sp+70h] [bp-8h]@3 unsigned int pY; // [sp+74h] [bp-4h]@3 - if ( pCurrentScreen == 16 )//окно видео ролика + if ( pCurrentScreen == SCREEN_VIDEO ) return; if ( _this ) { @@ -16198,9 +16188,9 @@ //while ( v1 < 4 ); } pEventTimer->Pause(); - if ( pCurrentScreen <= 10 ) - { - if ( pCurrentScreen == 10 )//окно ящика + if ( pCurrentScreen <= SCREEN_CHEST ) + { + if ( pCurrentScreen == SCREEN_CHEST ) { __debugbreak(); if ( !pPlayers[uActiveCharacter]->CanAct() ) @@ -16229,11 +16219,11 @@ { if ( pCurrentScreen ) { - if ( pCurrentScreen != 3 ) - { - if ( pCurrentScreen != 7 ) - { - if ( pCurrentScreen == 8 )//окно книги заклов + if ( pCurrentScreen != SCREEN_BOOKS ) + { + if ( pCurrentScreen != SCREEN_CHARACTERS ) + { + if ( pCurrentScreen == SCREEN_SPELL_BOOK ) { if ( dword_507B00_spell_info_to_draw_in_popup ) DrawSpellDescriptionPopup((void *)(dword_507B00_spell_info_to_draw_in_popup - 1)); @@ -16241,7 +16231,7 @@ goto LABEL_132; } LABEL_119: - if ( (signed int)pX > 467 && pCurrentScreen != 14 ) + if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E ) { identify_item(); goto LABEL_132; @@ -16379,19 +16369,19 @@ GameUI_DrawItemInfo(v8); goto LABEL_132; } - if ( pCurrentScreen == 13 )//окно дома + if ( pCurrentScreen == SCREEN_HOUSE ) { if ( (signed int)pY < 345 && (signed int)pX < 469 ) sub_4B1A2D(); goto LABEL_132; } - if ( pCurrentScreen <= 13 ) + if ( pCurrentScreen <= SCREEN_HOUSE ) goto LABEL_132; - if ( pCurrentScreen <= 15 ) + if ( pCurrentScreen <= SCREEN_F ) goto LABEL_119; - if ( pCurrentScreen != 21 ) - { - v11 = pCurrentScreen == 23; + if ( pCurrentScreen != SCREEN_PARTY_CREATION ) + { + v11 = pCurrentScreen == SCREEN_CASTING; if ( !v11 ) goto LABEL_132; identify_item(); @@ -16501,7 +16491,7 @@ unsigned int pY; // [sp+18h] [bp-4h]@7 pXY_ = pXY; - if ( pCurrentScreen == 16 + if ( pCurrentScreen == SCREEN_VIDEO || sub_4637E0_is_there_popup_onscreen() ) return; if ( pGUIWindow2 && pGUIWindow2->ptr_1C == (void *)33 )
--- a/mm7_6.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/mm7_6.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -8943,17 +8943,29 @@ if ( pCurrentScreen ) break; if (!pParty->bTurnBasedModeOn) - goto _do_move_forward; - if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) + //goto _do_move_forward; { - pTurnEngine->uActionPointsLeft -= 26; -_do_move_forward: v5 = pActionQueue; if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) partyAction = PARTY_RunForward; else partyAction = PARTY_WalkForward; - goto _add_action_and_continue; + //goto _add_action_and_continue; + v5->Add(partyAction); + break; + } + if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) + { + pTurnEngine->uActionPointsLeft -= 26; +//_do_move_forward: + v5 = pActionQueue; + if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) + partyAction = PARTY_RunForward; + else + partyAction = PARTY_WalkForward; + //goto _add_action_and_continue; + v5->Add(partyAction); + break; } break; case INPUT_MoveBackwards: @@ -8968,7 +8980,9 @@ partyAction = PARTY_RunBackward; else partyAction = PARTY_WalkBackward; - goto _add_action_and_continue; + //goto _add_action_and_continue; + v5->Add(partyAction); + break; } if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) { @@ -8979,7 +8993,9 @@ partyAction = PARTY_RunBackward; else partyAction = PARTY_WalkBackward; - goto _add_action_and_continue; + //goto _add_action_and_continue; + v5->Add(partyAction); + break; } break; case INPUT_StrafeLeft: @@ -8990,14 +9006,20 @@ //goto _do_strafe_left; { partyAction = PARTY_StrafeLeft; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; } if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) break; pTurnEngine->uActionPointsLeft -= 26; //_do_strafe_left: partyAction = PARTY_StrafeLeft; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_StrafeRight: //__debugbreak(); if ( pCurrentScreen ) @@ -9006,14 +9028,20 @@ //goto _do_strafe_right; { partyAction = PARTY_StrafeRight; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; } if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) break; pTurnEngine->uActionPointsLeft -= 26; //_do_strafe_right: partyAction = PARTY_StrafeRight; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_TurnLeft: if ( pCurrentScreen ) break; @@ -9038,7 +9066,9 @@ if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) { v20 = 10; - goto LABEL_75; + //goto LABEL_75; + pWeather->_4C2F0B(v20); + break; } break; case INPUT_TurnRight: @@ -9065,7 +9095,7 @@ if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) { v20 = -10; -LABEL_75: +//LABEL_75: pWeather->_4C2F0B(v20); } break; @@ -9075,7 +9105,10 @@ || pParty->bTurnBasedModeOn) break; partyAction = (PartyAction)12; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_Yell: //__debugbreak(); if ( !pCurrentScreen @@ -9152,7 +9185,11 @@ if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)23; - goto _send_message; + //goto _send_message; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + break; } } else @@ -9182,9 +9219,13 @@ if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) break; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)404; - goto _send_message; + //goto _send_message; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + break; } - if ( pCurrentScreen == 4 ) + if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) { v11 = pMessageQueue_50CBD0->uNumMessages; if ( pMessageQueue_50CBD0->uNumMessages ) @@ -9193,9 +9234,9 @@ { v11 = 1; pMessageQueue_50CBD0->uNumMessages = 1; -LABEL_132: +//LABEL_132: pMessageQueue_50CBD0->pMessages[v11].eType = (UIMessageType)113; -_send_message: +//_send_message: pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -9205,57 +9246,83 @@ pMessageQueue_50CBD0->uNumMessages = 0; } if ( (signed int)v11 < 40 ) - goto LABEL_132; + //goto LABEL_132; + { + pMessageQueue_50CBD0->pMessages[v11].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + break; + } } break; case INPUT_CharCycle: //__debugbreak(); - if ( pCurrentScreen == 8 + if ( pCurrentScreen == SCREEN_SPELL_BOOK || dword_50C9E8 >= 40 ) break; dword_50C9EC[3 * dword_50C9E8] = 176; - goto LABEL_155; + //goto LABEL_155; + dword_50C9F0[3 * dword_50C9E8] = 0; + *(&dword_50C9E8 + 3 * dword_50C9E8 + 3) = 0; + ++dword_50C9E8; + break; case INPUT_LookUp: //__debugbreak(); if ( pEventTimer->bPaused ) break; partyAction = (PartyAction)7; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_CenterView: //__debugbreak(); if ( pEventTimer->bPaused ) break; partyAction = (PartyAction)9; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_LookDown: //__debugbreak(); if ( pEventTimer->bPaused ) break; partyAction = (PartyAction)8; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_FlyUp: //__debugbreak(); if ( pCurrentScreen || pEventTimer->bPaused ) break; partyAction = (PartyAction)13; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_Land: //__debugbreak(); if ( pCurrentScreen || pEventTimer->bPaused ) break; partyAction = (PartyAction)15; - goto _add_action_and_continue_; + //goto _add_action_and_continue_; + v5 = pActionQueue; + v5->Add(partyAction); + break; case INPUT_FlyDown: //__debugbreak(); if ( !pCurrentScreen && !pEventTimer->bPaused ) { partyAction = (PartyAction)14; -_add_action_and_continue_: +//_add_action_and_continue_: v5 = pActionQueue; -_add_action_and_continue: +//_add_action_and_continue: v5->Add(partyAction); } break; @@ -9264,13 +9331,17 @@ if ( dword_50C9E8 >= 40 ) break; dword_50C9EC[3 * dword_50C9E8] = 367; - goto LABEL_155; + //goto LABEL_155; + dword_50C9F0[3 * dword_50C9E8] = 0; + *(&dword_50C9E8 + 3 * dword_50C9E8 + 3) = 0; + ++dword_50C9E8; + break; case INPUT_ZoomOut: //__debugbreak(); if ( dword_50C9E8 < 40 ) { dword_50C9EC[3 * dword_50C9E8] = 368; -LABEL_155: +//LABEL_155: dword_50C9F0[3 * dword_50C9E8] = 0; *(&dword_50C9E8 + 3 * dword_50C9E8 + 3) = 0; ++dword_50C9E8; @@ -9311,8 +9382,8 @@ ++pMessageQueue_50CBD0->uNumMessages; goto LABEL_175; } - if ( pCurrentScreen == 4 - || pCurrentScreen == 19 ) + if ( pCurrentScreen == SCREEN_NPC_DIALOGUE + || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) { v15 = pMessageQueue_50CBD0->uNumMessages; if ( pMessageQueue_50CBD0->uNumMessages )
--- a/mm7_data.cpp Thu Feb 14 13:58:34 2013 +0200 +++ b/mm7_data.cpp Thu Feb 14 14:03:17 2013 +0200 @@ -736,9 +736,9 @@ char aBardataC[10]; // weak char aLoadprog[777]; // idb char aLoadingD_pcx[777]; // idb -int _4E5E50_transui_x; // idb +int pNPCPortraits_x = 521; // idb int dword_4E5EC8[777]; // weak -int _4E5EE0_transui_y; // idb +int pNPCPortraits_y = 38; // idb const char *pHouse_ExitPictures[11]; char *_4E6BDC_loc_names[11]; char aOutside[777]; // idb
--- a/mm7_data.h Thu Feb 14 13:58:34 2013 +0200 +++ b/mm7_data.h Thu Feb 14 14:03:17 2013 +0200 @@ -683,9 +683,9 @@ extern char aBardataC[10]; // weak extern char aLoadprog[]; // idb extern char aLoadingD_pcx[]; // idb -extern int _4E5E50_transui_x; // idb +extern int pNPCPortraits_x; // idb extern int dword_4E5EC8[]; // weak -extern int _4E5EE0_transui_y; // idb +extern int pNPCPortraits_y; // idb extern const char *pHouse_ExitPictures[11]; extern char *_4E6BDC_loc_names[11]; extern char aOutside[]; // idb @@ -1835,7 +1835,7 @@ void __cdecl InitializeBookFonts(); void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer); void __cdecl sub_412AF9(); -void __cdecl sub_412B58(); +void __cdecl DrawSpellBookContent(); char __cdecl DrawBook_History(); void __cdecl DrawBook_Quests(); void __cdecl DrawBook_Autonotes(); @@ -2001,7 +2001,7 @@ void GameUI_DrawPartySpells(); __int16 __fastcall sub_441A4E(int a1); void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap); -int __fastcall DrawSpellbook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074); // idb +int __fastcall DrawBook_Map_sub(unsigned int x, unsigned int y, unsigned int a4, int a5, int _48074); // idb int __cdecl Initialize2DA(); unsigned int __fastcall LoadEventsToBuffer(const char *pContainerName, char *a2, unsigned int uBufferSize); void __cdecl Initialize_GlobalEVT(); @@ -2143,7 +2143,7 @@ void __thiscall sub_467E7F_EquipBody(unsigned int uEquipType); // idb void __fastcall sub_467F48(signed int a1); void __cdecl free_book_subwindow(); -char __cdecl sub_467FB6(); +char __cdecl CreateScrollWindow(); void __cdecl OnPaperdollLeftClick(); int __thiscall UnprojectX(int x); int __thiscall UnprojectY(int _this);