Mercurial > mm7
changeset 989:bb37d33934b0
Слияние
author | Ritor1 |
---|---|
date | Mon, 13 May 2013 09:39:58 +0600 |
parents | af2472c5842e (current diff) 9e132060ada3 (diff) |
children | 087a9af8e0ec |
files | Render.cpp |
diffstat | 40 files changed, 1518 insertions(+), 2052 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Mon May 13 09:39:49 2013 +0600 +++ b/Actor.cpp Mon May 13 09:39:58 2013 +0600 @@ -246,7 +246,7 @@ || pNPCInfo->uProfession > 38 && (pNPCInfo->uProfession <= 43 || pNPCInfo->uProfession == 52)) ) { pDialogueWindow->CreateButton(480, 250, 140, LOBYTE(pFontArrus->uFontHeight) - 3, 1, 0, UIMSG_SelectNPCDialogueOption, 9, 0, "", 0); - pDialogueWindow->_41D08F(4, 1, 0, 1); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); } } }
--- a/AudioPlayer.h Mon May 13 09:39:49 2013 +0600 +++ b/AudioPlayer.h Mon May 13 09:39:58 2013 +0600 @@ -75,6 +75,7 @@ { SOUND_Invalid = 0, SOUND_EnteringAHouse = 0x6, + SOUND_7 = 7, SOUND_8 = 0x8, SOUND_27 = 0x1B, SOUND_Button = 66,
--- a/Autonotes.h Mon May 13 09:39:49 2013 +0600 +++ b/Autonotes.h Mon May 13 09:39:58 2013 +0600 @@ -6,21 +6,20 @@ /* 351 */ enum AUTONOTE_TYPE : __int32 { - AUTONOTE_POTION_RECEPIE = 0x0, - AUTONOTE_STAT_HINT = 0x1, - AUTONOTE_OBELISK = 0x2, - AUTONOTE_SEER = 0x3, - AUTONOTE_MISC = 0x4, - AUTONOTE_TEACHER = 0x5, + AUTONOTE_POTION_RECEPIE = 0, + AUTONOTE_STAT_HINT = 1, + AUTONOTE_OBELISK = 2, + AUTONOTE_SEER = 3, + AUTONOTE_MISC = 4, + AUTONOTE_TEACHER = 5, }; /* 350 */ #pragma pack(push, 1) struct Autonote { - const char *pText; - enum AUTONOTE_TYPE eType; + const char *pText; + AUTONOTE_TYPE eType; }; #pragma pack(pop) extern Autonote pAutonoteTxt[195]; // weak -
--- a/Chest.cpp Mon May 13 09:39:49 2013 +0600 +++ b/Chest.cpp Mon May 13 09:39:58 2013 +0600 @@ -242,7 +242,7 @@ pChestWindow = pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_Chest, uChestID, 0); pBtn_ExitCancel = pChestWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79], pIcons_LOD->GetTexture(uExitCancelTextureId), 0);// Exit - pChestWindow->CreateButton( 7, 8, 460, 343, 1, 0, UIMSG_C, 0, 0, "", 0); + pChestWindow->CreateButton( 7, 8, 460, 343, 1, 0, UIMSG_CHEST_ClickItem, 0, 0, "", 0); pCurrentScreen = SCREEN_CHEST; pEventTimer->Pause();
--- a/Events.cpp Mon May 13 09:39:49 2013 +0600 +++ b/Events.cpp Mon May 13 09:39:58 2013 +0600 @@ -1320,7 +1320,7 @@ v133 = 1; if ( pCurrentScreen == SCREEN_HOUSE ) { - if ( uGameState == 2 ) + if ( uGameState == GAME_STATE_2 ) { pAudioPlayer->StopChannels(-1, -1); dialog_menu_id = HOUSE_DIALOGUE_NULL;
--- a/GUIWindow.cpp Mon May 13 09:39:49 2013 +0600 +++ b/GUIWindow.cpp Mon May 13 09:39:58 2013 +0600 @@ -276,7 +276,7 @@ } //----- (0041D08F) -------------------------------------------------------- -void GUIWindow::_41D08F(int a2, int a3, int a4, int a5) +void GUIWindow::_41D08F_set_keyboard_control_group(int a2, int a3, int a4, int a5) { if ( a2 ) { @@ -285,7 +285,7 @@ this->field_34 = a4; this->pCurrentPosActiveItem = a5; this->pStartingPosActiveItem = a5; - this->field_44 = 1; + this->receives_keyboard_input = true; } else { @@ -294,7 +294,7 @@ this->field_34 = a4; this->pCurrentPosActiveItem = 0; this->pStartingPosActiveItem = 0; - this->field_44 = 0; + this->receives_keyboard_input = false; } } @@ -577,6 +577,8 @@ num_achieved_awards_2 = v12; } break; + + case WINDOW_AutonotesBook: { pTexture_AutonotesBook = pIcons_LOD->LoadTexturePtr("sbautnot", TEXTURE_16BIT_PALETTE); @@ -612,7 +614,7 @@ num_achieved_awards = 0; while ( v10 < 196 ) { - if ( dword_506568 == pAutonoteTxt[v10-1].eType)//dword_72371C[2 * v10] ) + if ( _506568_autonote_type == pAutonoteTxt[v10-1].eType)//dword_72371C[2 * v10] ) { //v25 = (&dword_723718_autonote_related)[8 * (signed __int16)v10]; v25 = (char *)pAutonoteTxt[v10-1].pText; @@ -962,7 +964,7 @@ CreateButton(0, 0, 0, 0, 1, 0, UIMSG_33, 0, '\t', "", 0); if ( a2 ) - _41D08F(a2, 0, 0, 0); + _41D08F_set_keyboard_control_group(a2, 0, 0, 0); if (pPlayer->pActiveSkills[PLAYER_SKILL_FIRE]) CreateButton(399, 10, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 0, 0, aSpellSchoolNames[0], 0); if (pPlayer->pActiveSkills[PLAYER_SKILL_AIR]) CreateButton(399, 46, 50, 36, 1, 0, UIMSG_OpenSpellbookPage, 1, 0, aSpellSchoolNames[1], 0); @@ -1110,7 +1112,7 @@ pRenderer->DrawTextureIndexed(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], pDialogueNPCPortraits[(signed int)v4]); if ( pCurrentScreen == SCREEN_E ) { - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) { pRenderer->DrawTextureIndexed(556, 451, &pIcons_LOD->pTextures[uTextureID_x_x_u]); @@ -1158,7 +1160,7 @@ GuildDialog(); break; case BildingType_18: - __debugbreak; //What over the dialog? + __debugbreak(); //What over the dialog? sub_4B6478(); break; case BildingType_TownHall: @@ -1183,7 +1185,7 @@ JailDialog(); break; default: - __debugbreak;//New BildingType + __debugbreak();//New BildingType break; } } @@ -1755,7 +1757,7 @@ pWindow->uFrameY = uY; pWindow->uFrameHeight = uHeight; pWindow->eWindowType = eWindowType; - pWindow->field_44 = 0; + pWindow->receives_keyboard_input = false; ++uNumVisibleWindows; pWindow->numVisibleWindows = uNumVisibleWindows; pVisibleWindowsIdxs[uNumVisibleWindows] = uNextFreeWindowID + 1; @@ -1857,14 +1859,14 @@ num_menu_buttons = 2; } } - pWindow->_41D08F(num_menu_buttons, 1, 0, 1); + pWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 1); } break; case WINDOW_ChangeLocation: pMainScreenNum = pCurrentScreen; pCurrentScreen = SCREEN_CHANGE_LOCATION; - pBtn_ExitCancel = pWindow->CreateButton( 566, 445, 75, 33, 1, 0, UIMSG_5B, 0, 'N', pGlobalTXT_LocalizationStrings[156], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// + pBtn_ExitCancel = pWindow->CreateButton( 566, 445, 75, 33, 1, 0, UIMSG_CHANGE_LOCATION_ClickCencelBtn, 0, 'N', pGlobalTXT_LocalizationStrings[156], pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0);// pBtn_YES = pWindow->CreateButton( 486, 445, 75, 33, 1, 0, UIMSG_OnTravelByFoot, 0, 'Y', pWindow->Hint, pIcons_LOD->GetTexture(uTextureID_BUTTYES2), 0); pWindow->CreateButton(pNPCPortraits_x[0][0], pNPCPortraits_y[0][0], 63, 73, 1, 0, UIMSG_OnTravelByFoot, 1, ' ', pWindow->Hint, 0, 0, 0); pWindow->CreateButton( 8, 8, 460, 344, 1, 0, UIMSG_OnTravelByFoot, 1, 0, pWindow->Hint, 0);
--- a/GUIWindow.h Mon May 13 09:39:49 2013 +0600 +++ b/GUIWindow.h Mon May 13 09:39:58 2013 +0600 @@ -14,7 +14,7 @@ UIMSG_MouseLeftClickInGame = 10, - UIMSG_C = 12, + UIMSG_CHEST_ClickItem = 12, UIMSG_E = 14, UIMSG_F = 15, @@ -70,7 +70,7 @@ UIMSG_ClickInstallRemoveQuickSpellBtn = 88, UIMSG_OnTravelByFoot = 90, - UIMSG_5B = 91, + UIMSG_CHANGE_LOCATION_ClickCencelBtn = 91, UIMSG_ShowStatus_DateTime = 92, UIMSG_ShowStatus_ManaHP = 93, UIMSG_ShowStatus_Player = 94, @@ -115,9 +115,9 @@ UIMSG_SelectNPCDialogueOption = 136, UIMSG_CastSpell_GreatShot = 140, - UIMSG_CastSpell_8D = 141, + UIMSG_CastSpell_SPIRIT_Fate = 141, UIMSG_CastSpellFromBook = 142, - UIMSG_8F = 143, + UIMSG_CastSpell_8F = 143, UIMSG_PlayerCreation_VoicePrev = 144, UIMSG_PlayerCreation_VoiceNext = 145, UIMSG_92 = 146, @@ -212,18 +212,18 @@ /* 251 */ enum MENU_STATE : __int32 { - MENU_MAIN = 0x0, - MENU_NEWGAME = 0x1, - MENU_CREDITS = 0x2, - MENU_SAVELOAD = 0x3, - MENU_FINISHED = 0x4, - MENU_5 = 0x5, - MENU_CREATEPARTY = 0x6, - MENU_NAMEPANELESC = 0x7, - MENU_CREDITSPROC = 0x8, - MENU_LoadingProcInMainMenu = 0x9, - MENU_10 = 0xA, - MENU_CREDITSCLOSE = 0xB, + MENU_MAIN = 0, + MENU_NEWGAME = 1, + MENU_CREDITS = 2, + MENU_SAVELOAD = 3, + MENU_EXIT_GAME = 4, + MENU_5 = 5, + MENU_CREATEPARTY = 6, + MENU_NAMEPANELESC = 7, + MENU_CREDITSPROC = 8, + MENU_LoadingProcInMainMenu = 9, + MENU_10 = 10, + MENU_CREDITSCLOSE = 11, }; @@ -330,7 +330,7 @@ void DrawMessageBox(int arg0); GUIButton *GetControl(unsigned int uID); void Release(); - void _41D08F(int a2, int a3, int a4, int a5); + void _41D08F_set_keyboard_control_group(int a2, int a3, int a4, int a5); void DrawQuickCharRecord(); char _41D73D_draw_buff_tooltip(); @@ -356,7 +356,7 @@ int pStartingPosActiveItem; int numVisibleWindows; int field_40; - int field_44; + int receives_keyboard_input; char *Hint; GUIButton *pControlsHead; GUIButton *pControlsTail; @@ -386,7 +386,7 @@ SCREEN_LOADGAME = 0xC, SCREEN_HOUSE = 0xD, SCREEN_E = 0xE, - SCREEN_F = 0xF, + SCREEN_CHEST_INVENTORY = 0xF, SCREEN_VIDEO = 0x10, SCREEN_CHANGE_LOCATION = 0x11, SCREEN_INPUT_BLV = 0x12, @@ -472,11 +472,15 @@ //character ui -unsigned int __fastcall GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level); -const char *__fastcall CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType); -char __cdecl CharacterUI_SkillsTab_ShowHint(); -void __cdecl CharacterUI_StatsTab_ShowHint(); -char __fastcall CharacterUI_StatsTab_Draw(unsigned int uPlayerID); // idb +unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level); +const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType); +char CharacterUI_SkillsTab_ShowHint(); +void CharacterUI_StatsTab_ShowHint(); +char CharacterUI_StatsTab_Draw(unsigned int uPlayerID); // idb +void CharacterUI_SkillsTab_Draw(Player *player); +void CharacterUI_AwardsTab_Draw(unsigned int uPlayerID); // idb +void CharacterUI_InventoryTab_Draw(Player *player, bool a2); +void CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx); // idb @@ -638,4 +642,13 @@ extern GUIButton *pCreationUI_BtnPressRight2[4]; extern GUIButton *pCreationUI_BtnPressLeft2[4]; extern GUIButton *pCreationUI_BtnPressLeft[4]; -extern GUIButton *pCreationUI_BtnPressRight[4]; \ No newline at end of file +extern GUIButton *pCreationUI_BtnPressRight[4]; + + +extern unsigned int ui_color_text_default; +extern unsigned int ui_color_text_highlight; +extern unsigned int ui_color_text_header; +extern unsigned int ui_color_text_bonus; +extern unsigned int ui_color_text_bonus_neg; +extern unsigned int ui_color_text_skill_upgradeable; +extern unsigned int ui_color_text_skill_not_upgradeable; \ No newline at end of file
--- a/Game.cpp Mon May 13 09:39:49 2013 +0600 +++ b/Game.cpp Mon May 13 09:39:58 2013 +0600 @@ -256,17 +256,17 @@ signed int pNewNPCsCount; // ecx@58 char *pFlags; // eax@59 Player *pPlayer; // esi@65 - OtherOverlay *pOtherOverlay; // esi@67 - signed int v8; // edi@67 - int pPlayerNum; // edi@69 + //OtherOverlay *pOtherOverlay; // esi@67 + //signed int v8; // edi@67 + //int pPlayerNum; // edi@69 int *pHealth; // esi@71 - signed int v11; // esi@78 - int v12; // eax@83 + //signed int v11; // esi@78 + //int v12; // eax@83 const char *pLocationName; // [sp-4h] [bp-68h]@74 bool bLoading; // [sp+10h] [bp-54h]@1 - signed int bLoadinga; // [sp+10h] [bp-54h]@19 + //signed int bLoadinga; // [sp+10h] [bp-54h]@19 signed int v16; // [sp+14h] [bp-50h]@8 - int v17[4]; // [sp+18h] [bp-4Ch]@80 + //int v17[4]; // [sp+18h] [bp-4Ch]@80 MSG Msg; // [sp+28h] [bp-3Ch]@20 char Source[64]; // [sp+44h] [bp-20h]@76 @@ -276,7 +276,7 @@ { pParty->Reset(); dword_6BE340 = 0; - uGameState = 0; + uGameState = GAME_STATE_PLAYING; LoadGame(uLoadGameUI_SelectedSlot); } @@ -314,7 +314,8 @@ pAsyncKeyboard->Resume(); if ( pRenderer->pRenderD3D ) pGame->pVisInstance->_4C1A02(); - bLoadinga = 0; + + bool game_finished = false; do { while ( PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE) ) @@ -349,7 +350,7 @@ pMouse->_469EA4(); pRenderer->EndScene(); } - if ( pVideoPlayer->pBinkMovie && !BinkWait(pVideoPlayer->pBinkMovie) ) + else if ( pVideoPlayer->pBinkMovie && !BinkWait(pVideoPlayer->pBinkMovie) ) { pRenderer->BeginScene(); pMouse->DrawCursorToTarget(); @@ -357,13 +358,12 @@ pMouse->_469EA4(); pRenderer->EndScene(); } + + pEventTimer->Update(); + pMiscTimer->Update(); static int gtc_old = GetTickCount(); int gtc = GetTickCount(); - auto evt_old = pEventTimer->uStartTime, - msc_old = pMiscTimer->uStartTime; - pEventTimer->Update(); - pMiscTimer->Update(); Log::Warning(L"Evt/Msc/GTC dt: %u/%u/%u", pEventTimer->uTimeElapsed, pMiscTimer->uTimeElapsed, gtc - gtc_old); gtc_old = gtc; @@ -373,7 +373,7 @@ pMiscTimer->Resume(); if ( pEventTimer->bTackGameTime && !pParty->bTurnBasedModeOn ) pEventTimer->bTackGameTime = 0; - if ( !pEventTimer->bPaused && !uGameState ) + if ( !pEventTimer->bPaused && uGameState == GAME_STATE_PLAYING) { if ( !pEventTimer->bTackGameTime ) _494035_timed_effects__water_walking_damage__etc(); @@ -393,44 +393,46 @@ viewparams->bRedrawGameUI = true; } pAudioPlayer->UpdateSounds(); - if (uGameState == 1) + if (uGameState == GAME_FINISHED) //goto LABEL_96; { - bLoadinga = 1; + game_finished = true; continue; } - if (uGameState == 2) + if (uGameState == GAME_STATE_2) { pAudioPlayer->StopChannels(-1, -1); PrepareWorld(0); - uGameState = 0; + uGameState = GAME_STATE_PLAYING; continue; } - if ( (signed int)uGameState <= 2 ) + if ( (signed int)uGameState <= GAME_STATE_2 ) //goto LABEL_85; { pGame->Draw(); continue; } - if ( (signed int)uGameState <= 5 || uGameState == 7 ) + if ( (signed int)uGameState <= GAME_STATE_5 || uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU ) { //LABEL_96: - bLoadinga = 1; + game_finished = true; continue; } - if ( uGameState != 8 ) + if ( uGameState != GAME_STATE_PARTY_DIED ) { - if ( uGameState != 9 ) + if ( uGameState != GAME_STATE_FINAL_WINDOW ) { //LABEL_85: pGame->Draw(); - continue; } - pRenderer->BeginScene(); - GUI_UpdateWindows(); - pRenderer->EndScene(); - //goto LABEL_89; - pRenderer->Present(); + else + { + pRenderer->BeginScene(); + GUI_UpdateWindows(); + pRenderer->EndScene(); + //goto LABEL_89; + pRenderer->Present(); + } continue; } pAudioPlayer->StopChannels(-1, -1);// @@ -465,17 +467,9 @@ pParty->uTimePlayed += 0x276000ui64; LOWORD(pParty->uFlags) &= ~0x204; pParty->SetGold(0); - pOtherOverlay = pOtherOverlayList->pOverlays; - v8 = 50; - do - { - pOtherOverlay->Reset(); - ++pOtherOverlay; - --v8; - } - while ( v8 ); + pOtherOverlayList->Reset(); memset(pParty->pPartyBuffs, 0, 0x140u); - pPlayerNum = 1; + if ( pParty->bTurnBasedModeOn == 1 ) { pTurnEngine->End(1); @@ -493,7 +487,7 @@ uActiveCharacter = 1; } // while ( (signed int)pHealth < (signed int)&pParty->field_871C[567] ); - if ( (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 136) ) + if (_449B57_test_bit(pParty->_quest_bits, PARTY_QUEST_FINISHED_EMERALD_ISLE)) { pParty->vPosition.x = -17331; // respawn in harmondale pParty->vPosition.y = 12547; @@ -527,31 +521,35 @@ PrepareWorld(1); } InitializeActors(); - v11 = 0; - do + + + int num_conscious_players = 0; + int conscious_players_ids[4] = {-1, -1, -1, -1}; + for (int v11 = 0; v11 < 4; ++v11) { - if ( pPlayers[pPlayerNum]->CanAct() ) - v17[v11++] = pPlayerNum; - ++pPlayerNum; + if (pPlayers[v11 + 1]->CanAct()) + conscious_players_ids[num_conscious_players++] = v11; } - while ( pPlayerNum <= 4 ); - if ( v11 ) + if (num_conscious_players) { - v12 = rand(); - pPlayers[v17[v12 % v11]]->PlaySound(SPEECH_99, 0); + int idx = conscious_players_ids[rand() % num_conscious_players]; + assert(idx >= 0); + pPlayers[idx + 1]->PlaySound(SPEECH_99, 0); } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[524], 2u);// "Once again you've cheated death!.." " ! " - uGameState = 0; + uGameState = GAME_STATE_PLAYING; } - while ( !bLoadinga ); + while (!game_finished); + dword_6BE340 = 0; pEventTimer->Pause(); ResetCursor_Palettes_LODs_Level_Audio_SFT_Windows(); - if ( uGameState == 3 ) + if ( uGameState == GAME_STATE_3 ) { sub_491E3A(); LoadPlayerPortraintsAndVoices(); - uGameState = 0; + uGameState = GAME_STATE_PLAYING; pIcons_LOD->dword_11B84 = pIcons_LOD->uNumLoadedFiles; bLoading = true; continue;
--- a/Game.h Mon May 13 09:39:49 2013 +0600 +++ b/Game.h Mon May 13 09:39:58 2013 +0600 @@ -27,17 +27,17 @@ /* 320 */ enum GAME_STATE { - GAME_STATE_0 = 0x0, - GAME_FINISHED = 0x1, - GAME_STATE_2 = 0x2, - GAME_STATE_3 = 0x3, - GAME_STATE_NEWGAME_OUT_GAMEMENU = 0x4, - GAME_STATE_5 = 0x5, - GAME_STATE_6 = 0x6, + GAME_STATE_PLAYING = 0, + GAME_FINISHED = 1, + GAME_STATE_2 = 2, + GAME_STATE_3 = 3, + GAME_STATE_NEWGAME_OUT_GAMEMENU = 4, + GAME_STATE_5 = 5, + GAME_STATE_STARTING_NEW_GAME = 6, GAME_STATE_GAME_QUITTING_TO_MAIN_MENU = 7, - GAME_STATE_8 = 0x8, - GAME_STATE_FINAL_WINDOW = 0x9, - GAME_STATE_A = 0xA + GAME_STATE_PARTY_DIED = 8, + GAME_STATE_FINAL_WINDOW = 9, + GAME_STATE_A = 10 };
--- a/Items.cpp Mon May 13 09:39:49 2013 +0600 +++ b/Items.cpp Mon May 13 09:39:58 2013 +0600 @@ -2314,7 +2314,7 @@ ++dword_F8B1DC; CreateButtonInColumn(i+1, v29); } - pDialogueWindow->_41D08F(i, 1, 0, 2); + pDialogueWindow->_41D08F_set_keyboard_control_group(i, 1, 0, 2); dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; }
--- a/Items.h Mon May 13 09:39:49 2013 +0600 +++ b/Items.h Mon May 13 09:39:58 2013 +0600 @@ -10,6 +10,10 @@ ITEM_IDENTIFIED = 0x1, ITEM_BROKEN = 0x2, ITEM_TEMP_BONUS = 0x8, + ITEM_AURA_EFFECT_RED = 0x10, + ITEM_AURA_EFFECT_BLUE = 0x20, + ITEM_AURA_EFFECT_GREEN = 0x40, + ITEM_AURA_EFFECT_PURPLE = 0x80, ITEM_STOLEN = 0x100, ITEM_ENCHANTED = 0x200, };
--- a/LOD.cpp Mon May 13 09:39:49 2013 +0600 +++ b/LOD.cpp Mon May 13 09:39:58 2013 +0600 @@ -1001,7 +1001,7 @@ strcpy(pHeader->pSignature, "LOD"); pHeader->LODSize = 100; pHeader->uNumIndices = 1; - pDir->pFilename[15] = 0; + pDir->field_F = 0; pDir->uDataSize = 0; pDir->uOfsetFromSubindicesStart = 288; strcpy(pLODName, lod_name); @@ -1430,8 +1430,7 @@ //----- (00461FD4) ---LODFile_sub_461FD4---text:004632EA -------------------------------------------------- int LODWriteableFile::FixDirectoryOffsets() - { - LOD::Directory Lindx; +{ int total_size; // edi@1 int temp_offset; // ecx@5 FILE *tmp_file; // eax@9 @@ -1455,9 +1454,10 @@ tmp_file = fopen(Filename, "wb+"); if ( tmp_file ) - { + { fwrite((const void *)&header, sizeof(LOD::FileHeader), 1, tmp_file); - Lindx.Reset(); + + LOD::Directory Lindx; strcpy(Lindx.pFilename, "chapter"); Lindx.uOfsetFromSubindicesStart=uOffsetToSubIndex; //10h 16 Lindx.uDataSize=sizeof(LOD::Directory) * uNumSubDirs + total_size; //14h 20 @@ -1501,47 +1501,29 @@ //----- (00461F71) -------------------------------------------------------- bool LOD::File::AppendDirectory(LOD::Directory *pDir, const void *pData) { - if ( uNumSubDirs < 299 ) - { - memcpy(&pSubIndices[uNumSubDirs], pDir, sizeof(LOD::Directory)); - ++uNumSubDirs; - fwrite(pData, 1u, pDir->uDataSize, pOutputFileHandle); - return true; - } - else - { - MessageBoxA(0, "Unable to append item!", "LOD::File", 0x30u); - return false; - } + assert(uNumSubDirs < 299); + + memcpy(&pSubIndices[uNumSubDirs++], pDir, sizeof(LOD::Directory)); + fwrite(pData, 1, pDir->uDataSize, pOutputFileHandle); + return true; } //----- (00461F1E) -------------------------------------------------------- int LODWriteableFile::CreateTempFile() { - int result; // eax@2 - FILE *pFile; // eax@5; - if ( isFileOpened ) + if (!isFileOpened) + return 1; + + if (pIOBuffer && uIOBufferSize ) { - if (pIOBuffer && uIOBufferSize ) - { - uCurrentIndexDir = 0; - uNumSubDirs = 0; - pFile = fopen("lodapp.tmp", "wb+"); - pOutputFileHandle = pFile; - result =pFile? 1:7; - - } - else - { - result = 5; - } + uCurrentIndexDir = 0; + uNumSubDirs = 0; + pOutputFileHandle = fopen("lodapp.tmp", "wb+"); + return pOutputFileHandle ? 1 : 7; } else - { - result = 1; - } - return result; + return 5; } @@ -1566,8 +1548,7 @@ //----- (00461B48) -------------------------------------------------------- unsigned int LODWriteableFile::Write(const LOD::Directory *pDir, const void *pDirData, int a4) - { - LOD::Directory Lindx; +{ char Filename[256]; char NewFilename[256]; FILE *tmp_file; @@ -1631,8 +1612,9 @@ size_correction=0; else size_correction=pSubIndices[insert_index].uDataSize; + //create chapter index - Lindx.Reset(); + LOD::Directory Lindx; strcpy(Lindx.pFilename, "chapter"); Lindx.dword_000018=0; Lindx.word_00001E=0; @@ -1723,39 +1705,34 @@ //----- (00461A43) -------------------------------------------------------- bool LODWriteableFile::LoadFile(const char *pFilename, bool bWriting) - { - LOD::Directory lod_indx ; +{ + if (bWriting & 1) + pFile = fopen(pFilename, "rb"); + else + pFile = fopen(pFilename, "rb+"); + if (!pFile) + return false; - if (bWriting & 1) - pFile = fopen(pFilename, "rb"); - else - pFile = fopen(pFilename, "rb+"); - if (!pFile) - return false; + strcpy(pLODName, pFilename); + fread(&header, sizeof(LOD::FileHeader), 1, pFile); + + LOD::Directory lod_indx; + fread( &lod_indx,sizeof(LOD::Directory), 1, pFile); - strcpy(pLODName, pFilename); - fread(&header, sizeof(LOD::FileHeader), 1, pFile); - lod_indx.Reset(); - fread( &lod_indx,sizeof(LOD::Directory), 1, pFile); - fseek(pFile, 0, SEEK_SET); - isFileOpened = true; - strcpy(pContainerName, "chapter"); - uCurrentIndexDir = 0; - uLODDataSize = lod_indx.uDataSize; - uNumSubDirs = lod_indx.uNumSubIndices; - uOffsetToSubIndex = lod_indx.uOfsetFromSubindicesStart; - fseek(pFile, uOffsetToSubIndex, SEEK_SET); + fseek(pFile, 0, SEEK_SET); + isFileOpened = true; + strcpy(pContainerName, "chapter"); + uCurrentIndexDir = 0; + uLODDataSize = lod_indx.uDataSize; + uNumSubDirs = lod_indx.uNumSubIndices; + assert(uNumSubDirs <= 300); - if (uNumSubDirs > 300) - { - MessageBoxW(0, L"LODchapterPages exceed 300", L"LODFile", MB_ICONEXCLAMATION); - fclose(pFile); - return false; - } + uOffsetToSubIndex = lod_indx.uOfsetFromSubindicesStart; + fseek(pFile, uOffsetToSubIndex, SEEK_SET); - fread(pSubIndices, sizeof(LOD::Directory), uNumSubDirs, pFile); - return true; - } + fread(pSubIndices, sizeof(LOD::Directory), uNumSubDirs, pFile); + return true; +} //----- (00461A11) -------------------------------------------------------- @@ -1859,17 +1836,6 @@ } -//----- (004617B6) -------------------------------------------------------- -void LOD::FileHeader::Reset() -{ - this->pSignature[0] = 0; - this->LodVersion[0] = 0; - this->LodDescription[0] = 0; - this->LODSize = 0; - this->dword_0000A8 = 0; - this->uNumIndices = 0; -} - //----- (00461790) -------------------------------------------------------- LOD::File::~File() { @@ -1903,22 +1869,6 @@ } -//----- (00461743) -------------------------------------------------------- -LOD::Directory *LOD::Directory::Reset() -{ - LOD::Directory *result; // eax@1 - - result = this; - this->pFilename[0] = 0; - this->uOfsetFromSubindicesStart = 0; - this->uDataSize = 0; - this->dword_000018 = 0; - this->uNumSubIndices = 0; - this->word_00001E = 0; - return result; -} - - //----- (0046172B) -------------------------------------------------------- LOD::Directory::Directory() {
--- a/LOD.h Mon May 13 09:39:49 2013 +0600 +++ b/LOD.h Mon May 13 09:39:58 2013 +0600 @@ -19,6 +19,7 @@ #pragma pack(push, 1) struct FileHeader { + //----- (004617B6) -------------------------------------------------------- inline FileHeader() { memset(pSignature, 0, 4); @@ -26,10 +27,15 @@ memset(LodDescription, 0, 80); memset(array_0000B0, 0, 28); memset(array_0000CC, 0, 52); + + pSignature[0] = 0; + LodVersion[0] = 0; + LodDescription[0] = 0; + LODSize = 0; + dword_0000A8 = 0; + uNumIndices = 0; } - void Reset(); - char pSignature[4]; char LodVersion[80]; //char field_C[32]; @@ -48,10 +54,9 @@ struct Directory { Directory(); - Directory *Reset(); - - char pFilename[16]; + char pFilename[15]; + char field_F; unsigned int uOfsetFromSubindicesStart; unsigned int uDataSize; int dword_000018;
--- a/Mouse.cpp Mon May 13 09:39:49 2013 +0600 +++ b/Mouse.cpp Mon May 13 09:39:58 2013 +0600 @@ -254,8 +254,8 @@ //----- (00469C0D) -------------------------------------------------------- void *Mouse::DoAllocCursorMem() { - return malloc(4 * (this->uCursorTextureID != -1 ? pIcons_LOD->pTextures[this->uCursorTextureID].uTextureWidth : 24) - * (this->uCursorTextureID != -1 ? pIcons_LOD->pTextures[this->uCursorTextureID].uTextureHeight : 26)); + auto tex = pIcons_LOD->GetTexture(uCursorTextureID); + return malloc(4 * tex->uTextureWidth * tex->uTextureHeight); } //----- (00469C39) -------------------------------------------------------- @@ -1331,7 +1331,7 @@ { pGame->PickMouse(512.0, *v4, *(int *)(v2 + 16), 0, &a3, &a4); if ( GetCurrentMenuID() == 6 ) - sub_41CD4F(0x29u); + UI_OnKeyDown(VK_SELECT); UI_OnMouseLeftClick((int *)(v2 + 12)); } else
--- a/Outdoor.cpp Mon May 13 09:39:49 2013 +0600 +++ b/Outdoor.cpp Mon May 13 09:39:58 2013 +0600 @@ -127,19 +127,22 @@ { pRenderer->DrawSkyD3D(); pRenderer->DrawBuildingsD3D(); - pRenderer->RenderTerrainD3D();//pRenderer->DrawBezierTerrain();// Ritor1: temporarily lag + pRenderer->RenderTerrainD3D(); + //pRenderer->DrawBezierTerrain();// Ritor1: temporarily lag } } else if (pRenderer->pRenderD3D) { pRenderer->DrawSkyD3D(); pRenderer->DrawBuildingsD3D(); - pRenderer->RenderTerrainD3D();//pRenderer->DrawBezierTerrain();// Ritor1: temporarily lag + pRenderer->RenderTerrainD3D(); + //pRenderer->DrawBezierTerrain();// Ritor1: temporarily lag } else { pRenderer->DrawBuildingsSW(); - pRenderer->RenderTerrainD3D();//pRenderer->DrawBezierTerrain();// Ritor1: temporarily lag + pRenderer->RenderTerrainD3D(); + //pRenderer->DrawBezierTerrain();// Ritor1: temporarily lag sr_sub_486F92_MessWithEdgesAndSpans(); pOutdoorCamera->_487355(); }
--- a/Party.h Mon May 13 09:39:49 2013 +0600 +++ b/Party.h Mon May 13 09:39:58 2013 +0600 @@ -11,6 +11,7 @@ enum PARTY_QUEST_BITS: unsigned __int32 { PARTY_QUEST_EVENMORN_MAP_FOUND = 64, + PARTY_QUEST_FINISHED_EMERALD_ISLE = 136, PARTY_QUEST_FOUNTAIN_HARMONDALE = 206, PARTY_QUEST_FOUNTAIN_NIGHON = 207, PARTY_QUEST_FOUNTAIN_PIERPONT = 208,
--- a/Player.cpp Mon May 13 09:39:49 2013 +0600 +++ b/Player.cpp Mon May 13 09:39:58 2013 +0600 @@ -1360,20 +1360,18 @@ //----- (00492528) -------------------------------------------------------- bool Player::CanFitItem(unsigned int uSlot, unsigned int uItemID) { - unsigned int v3; // eax@1 + //unsigned int v3; // eax@1 Texture *v4; // esi@1 unsigned int v5; // ebx@1 signed int v6; // edi@5 int *v7; // ecx@6 signed int v8; // edx@7 int *v9; // eax@8 - Player *v11; // [sp+Ch] [bp-4h]@1 + //Player *v11; // [sp+Ch] [bp-4h]@1 unsigned int uItemIDa; // [sp+1Ch] [bp+Ch]@1 - v11 = this; - v3 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); - v4 = (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0); - v5 = GetSizeInInventorySlots(v3 != -1 ? pIcons_LOD->pTextures[v3].uTextureWidth : 24); + v4 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); + v5 = GetSizeInInventorySlots(v4->uTextureWidth); uItemIDa = GetSizeInInventorySlots(v4->uTextureHeight); if ( !areWeLoadingTexture ) { @@ -1385,7 +1383,7 @@ v6 = 0; if ( (signed int)uItemIDa <= 0 ) return 1; - v7 = &v11->pInventoryIndices[uSlot]; + v7 = &pInventoryIndices[uSlot]; while ( 1 ) { v8 = 0; @@ -1435,7 +1433,7 @@ ItemGen *v4; // eax@1 int result; // eax@8 unsigned int v6; // ebx@10 - unsigned int v7; // eax@10 + //unsigned int v7; // eax@10 Texture *v8; // esi@10 void *v9; // esi@13 unsigned int v10; // [sp+0h] [bp-Ch]@10 @@ -1467,9 +1465,8 @@ else { v6 = uItemID; - v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); - v8 = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0); - v10 = GetSizeInInventorySlots(v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); + v8 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); + v10 = GetSizeInInventorySlots(v8->uTextureWidth); uItemIDa = GetSizeInInventorySlots(v8->uTextureHeight); if ( !areWeLoadingTexture ) { @@ -1523,6 +1520,8 @@ char *v5; // eax@6 char *v6; // esi@6 + __debugbreak(); // sub is definetly broken + v2 = 0; v3 = this->pInventoryItems; while ( v3->uItemID ) @@ -1647,7 +1646,7 @@ signed int v3; // ebx@1 ItemGen *v4; // eax@1 int result; // eax@6 - unsigned int v6; // eax@7 + //unsigned int v6; // eax@7 Texture *v7; // esi@7 unsigned int v8; // edx@9 void *v9; // esi@10 @@ -1675,11 +1674,8 @@ } else { - v6 = pIcons_LOD->LoadTexture( - pItemsTable->pItems[Src->uItemID].pIconName, - TEXTURE_16BIT_PALETTE); - v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); - v10 = GetSizeInInventorySlots(v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24); + v7 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[Src->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + v10 = GetSizeInInventorySlots(v7->uTextureWidth); v11 = GetSizeInInventorySlots(v7->uTextureHeight); if ( !areWeLoadingTexture ) { @@ -1711,17 +1707,15 @@ //----- (0049298B) -------------------------------------------------------- bool Player::_49298B(ItemGen *a2, int a3, int a4) { - Player *v4; // ebx@1 - unsigned int v5; // eax@1 + //Player *v4; // ebx@1 + //unsigned int v5; // eax@1 Texture *v6; // esi@1 void *v7; // esi@4 unsigned int v9; // [sp+Ch] [bp-4h]@1 unsigned int a2a; // [sp+18h] [bp+8h]@1 - v4 = this; - v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE); - v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); - v9 = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24); + v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[a2->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + v9 = GetSizeInInventorySlots(v6->uTextureWidth); a2a = GetSizeInInventorySlots(v6->uTextureHeight); if ( !areWeLoadingTexture ) { @@ -1730,7 +1724,7 @@ } if ( (signed int)a2a > 0 ) { - v7 = &v4->pInventoryIndices[a4]; + v7 = &pInventoryIndices[a4]; do { if ( (signed int)v9 > 0 ) @@ -1740,7 +1734,7 @@ } while ( a2a ); } - v4->pInventoryIndices[a4] = a3 + 1; + pInventoryIndices[a4] = a3 + 1; return 1; } @@ -1752,7 +1746,7 @@ int *pIndices; // edi@1 ItemGen *v3; // ecx@1 unsigned int v4; // esi@1 - unsigned int v5; // eax@1 + //unsigned int v5; // eax@1 Texture *v6; // esi@1 unsigned int result; // eax@1 unsigned int v8; // ebp@1 @@ -1763,9 +1757,8 @@ v3 = &this->pInventoryItems[*pIndices-1]; v4 = v3->uItemID; v3->Reset(); - v5 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE); - v6 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); - uSlota = GetSizeInInventorySlots(v5 != -1 ? pIcons_LOD->pTextures[v5].uTextureWidth : 24); + v6 = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[v4].pIconName, TEXTURE_16BIT_PALETTE); + uSlota = GetSizeInInventorySlots(v6->uTextureWidth); result = GetSizeInInventorySlots(v6->uTextureHeight); v8 = result; if ( !areWeLoadingTexture ) @@ -2174,7 +2167,7 @@ signed int v8; // [sp-4h] [bp-10h]@4 v1 = this; - LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); + v2 = (char)GetActualSkillLevel(PLAYER_SKILL_PERCEPTION); v3 = v1->pActiveSkills[26]; v4 = v2 & 0x3F; v5 = v1->pActiveSkills[26] & 0x3F; @@ -2380,7 +2373,7 @@ unsigned int v3; // ecx@4 signed int v4; // edx@4 char *v5; // eax@8 - unsigned int v6; // eax@10 + //unsigned int v6; // eax@10 Texture *v7; // ebx@10 signed int v8; // esi@10 Player *v9; // edi@11 @@ -2422,8 +2415,7 @@ v5 = pItemsTable->pItems[v2].pIconName; if ( v5 ) { - v6 = pIcons_LOD->LoadTexture(v5, TEXTURE_16BIT_PALETTE); - v7 = (Texture *)(v6 != -1 ? &pIcons_LOD->pTextures[v6] : 0); + v7 = pIcons_LOD->LoadTexturePtr(v5, TEXTURE_16BIT_PALETTE); v21 = areWeLoadingTexture; v8 = 0; while ( 1 ) @@ -8481,7 +8473,7 @@ v20->PlaySound(SPEECH_96, 0); v21 = pAutonoteTxt[var_value-1].eType;// dword_72371C[2 * a3]; bFlashAutonotesBook = 1; - dword_506568 = v21; + _506568_autonote_type = v21; } _449B7E_toggle_bit(pParty->_autonote_bits, var_value, 1u); v31 = 1; @@ -9280,7 +9272,7 @@ v23->PlaySound(SPEECH_96, 0); v24 = pAutonoteTxt[val-1].eType;//dword_72371C[2 * val]; bFlashAutonotesBook = 1; - dword_506568 = v24; + _506568_autonote_type = v24; } _449B7E_toggle_bit(pParty->_autonote_bits, val, 1u); v3 = 1;
--- a/Render.cpp Mon May 13 09:39:49 2013 +0600 +++ b/Render.cpp Mon May 13 09:39:58 2013 +0600 @@ -208,7 +208,7 @@ } //----- (00487389) -------------------------------------------------------- -__int16 Render::ExecOutdoorDrawSW() +void Render::ExecOutdoorDrawSW() { unsigned __int16 *v0; // ebx@1 unsigned int v1; // esi@1 @@ -227,7 +227,7 @@ int v14; // ecx@37 int v15; // eax@40 Texture *v16; // ebp@51 - unsigned int v17; // eax@51 + //unsigned int v17; // eax@51 int v18; // eax@54 char v19; // al@56 unsigned int v20; // eax@57 @@ -315,8 +315,7 @@ while ( 1 ) { v16 = v4->pTexture; - v17 = pBitmaps_LOD->LoadTexture("wtrtyl"); - v4->pTexture = (Texture *)(v17 != -1 ? (int)&pBitmaps_LOD->pTextures[v17] : 0); + v4->pTexture = pBitmaps_LOD->LoadTexturePtr("wtrtyl"); if ( pOutdoorCamera->outdoor_no_wavy_water ) sr_sub_48408A_prolly_odm_water_no_waves(v3); else @@ -549,12 +548,19 @@ } v9 = pOutdoorCamera->uNumSpans; unnamed_6BE060[0] = pOutdoorCamera->uNumSpans; - if ( pOutdoorCamera->numStru148s >= 1999 - || (array_77EC08[1999]._48607B(&stru_8019C8), - array_77EC08[1999].ptr_38->_48694B(), - v2 = (stru148 *)&pBitmaps_LOD->pTextures[pOutdoor->uMainTile_BitmapID], - (array_77EC08[1999].pTexture = (Texture *)(pOutdoor->uMainTile_BitmapID != -1 ? (int)v2 : 0)) == 0) ) - return (signed __int16)v2; + if (pOutdoorCamera->numStru148s >= 1999) + return; + + array_77EC08[1999]._48607B(&stru_8019C8); + array_77EC08[1999].ptr_38->_48694B(); + + if (pOutdoor->uMainTile_BitmapID == -1) + { + array_77EC08[1999].pTexture = nullptr; + return; + } + else + array_77EC08[1999].pTexture = pBitmaps_LOD->GetTexture(pOutdoor->uMainTile_BitmapID); array_77EC08[1999].dimming_level = 23 - (-20 * pOutdoor->vSunlight.z >> 16); if ( array_77EC08[1999].dimming_level > 20 ) array_77EC08[1999].dimming_level = 20; @@ -570,10 +576,14 @@ sin((double)pIndoorCamera->sRotationX * 0.0030664064); array_77EC08[1999]._48607B(&stru_8019C8); array_77EC08[1999].ptr_38->_48694B(); - v2 = (stru148 *)&pBitmaps_LOD->pTextures[pOutdoor->uSky_TextureID]; - array_77EC08[1999].pTexture = (Texture *)(pOutdoor->uSky_TextureID != -1 ? (int)v2 : 0); - if ( !(pOutdoor->uSky_TextureID != -1 ? (int)v2 : 0) ) - return (signed __int16)v2; + + if (pOutdoor->uSky_TextureID == -1) + { + array_77EC08[1999].pTexture = nullptr; + return; + } + else + array_77EC08[1999].pTexture = pBitmaps_LOD->GetTexture(pOutdoor->uSky_TextureID); array_77EC08[1999].dimming_level = 0; v11 = stru_5C6E00->Sin(pIndoorCamera->sRotationX + 16); array_77EC08[1999].v_18.y = 0; @@ -591,7 +601,7 @@ v2 = (stru148 *)*(short *)PaletteManager::Get_Mist_or_Red_LUT(array_77EC08[1999].pTexture->palette_id2, 31, 1); a1b = (unsigned int)v2; if ( (signed int)v9 <= 0 ) - return (signed __int16)v2; + return; v29 = v9; while ( 1 ) { @@ -630,7 +640,7 @@ --v29; --v9; if ( !v9 ) - return (signed __int16)v2; + return; } } if ( (signed int)v9 > 0 ) @@ -675,7 +685,6 @@ } while ( v9 ); } - return (signed __int16)v2; } //----- (00485044) -------------------------------------------------------- @@ -865,8 +874,8 @@ int v8; // eax@4 unsigned int v9; // eax@6 int v10; // eax@7 - int v11; // ebx@9 - int v12; // edi@9 + //int v11; // ebx@9 + //int v12; // edi@9 int v13; // eax@21 int v14; // eax@31 int v15; // edi@33 @@ -876,7 +885,7 @@ int v19; // eax@36 int v20; // eax@39 int v21; // ecx@43 - char v22; // zf@44 + //char v22; // zf@44 int v23; // ecx@47 int v24; // edi@52 int v25; // eax@54 @@ -925,32 +934,32 @@ int v68; // ecx@167 int v69; // eax@173 int v70; // edi@178 - int v71; // eax@178 - int v72; // ecx@178 - int x; // ebx@180 - int v74; // eax@182 + //int v71; // eax@178 + //int v72; // ecx@178 + //int x; // ebx@180 + //int v74; // eax@182 int v75; // eax@184 IndoorCameraD3D *pIndoorCameraD3D_3; // ecx@184 int uStartZ; // ecx@184 int v79; // ebx@185 int v127; // esi@185 int v86; // edi@196 - int v87; // eax@196 - int v88; // ecx@196 - int v89; // eax@198 - int v90; // ecx@200 + //int v87; // eax@196 + //int v88; // ecx@196 + //int v89; // eax@198 + //int v90; // ecx@200 int v92; // ebx@203 - int v93; // ST08_4@204 + //int v93; // ST08_4@204 int v97; // ST08_4@204 float result; // eax@212 - struct - { - char v102[4]; // [sp+Ch] [bp-68h]@191 - __int16 v103; // [sp+10h] [bp-64h]@190 - __int16 v104; // [sp+12h] [bp-62h]@190 - } v102; + //struct + //{ + int v106; // [sp+Ch] [bp-68h]@191 + int v103; // [sp+10h] [bp-64h]@190 + int v104; // [sp+12h] [bp-62h]@190 + //} v102; int v105; // [sp+1Ch] [bp-58h]@1 - int v106; // [sp+20h] [bp-54h]@3 + int v107; // [sp+20h] [bp-54h]@3 int uEndZ; // [sp+24h] [bp-50h]@3 int v108; // [sp+28h] [bp-4Ch]@9 int v109; // [sp+2Ch] [bp-48h]@9 @@ -961,7 +970,7 @@ int v114; // [sp+40h] [bp-34h]@9 int v115; // [sp+44h] [bp-30h]@9 int v116; // [sp+48h] [bp-2Ch]@9 - int v117; // [sp+4Ch] [bp-28h]@9 + //int v117; // [sp+4Ch] [bp-28h]@9 int v118; // [sp+50h] [bp-24h]@9 int v119; // [sp+54h] [bp-20h]@1 int v120; // [sp+58h] [bp-1Ch]@1 @@ -1005,8 +1014,8 @@ else v10 = stru_5C6E00->pTanTable[v9]; v108 = abs(v10); - v11 = v124; - v12 = v123; + //v11 = v124; + //v12 = v123; v114 = 0; v115 = 0; pIndoorCameraD3D_4 = 0; @@ -1017,13 +1026,13 @@ v109 = (uEndZ >= 0 ? 1: -1);//2 * (v107 >= 0) - 1; uEndZ = (v111 >= 0 ? 1: -1);//2 * (v111 >= 0) - 1; terrain_76E1C8[0] = 65535; - //v116 = 1; + uint _i = 1; v106 = (v6 >= 0 ? 1: -1);//2 * (v6 >= 0) - 1; - //v117 = 1; + uint j = 1; terrain_76E3C8[0] = 65535; terrain_76DDC8[0] = 65535; terrain_76DFC8[0] = 65535; - for( v116=1; v116 < 128; v116++) + for( _i = 1; _i < 128; _i++) { if ( v112 >= 0x10000 ) { @@ -1039,22 +1048,22 @@ } else { - v11 += v110; + v124 += v110; v115 += v112; if ( v112 + v115 >= 65536 ) { - v12 += v109; + v123 += v109; v115 = (unsigned __int16)v115; } } - if ( v11 < i || v11 > v120 || v12 < v122 || v12 > v119 ) + if ( v124 < _i || v124 > v120 || v123 < v122 || v123 > v119 ) break; //v13 = v116++; - terrain_76E3C8[v116] = v11; - terrain_76E1C8[v116] = v12; - } - - for( v117=1; v117 < 128; v117++ ) + terrain_76E3C8[_i] = v124; + terrain_76E1C8[_i] = v123; + } + + for( j = 1; j < 128; j++ ) { if ( v108 >= 65536 ) { @@ -1079,7 +1088,7 @@ } //if ( v117 >= 128 ) //break; - if ( v126 < i ) + if ( v126 < _i ) break; if ( v126 > v120 ) break; @@ -1088,27 +1097,27 @@ break; if ( v118 > v119 ) break; - terrain_76DFC8[v117] = v126; - terrain_76DDC8[v117] = v14; + terrain_76DFC8[j] = v126; + terrain_76DDC8[j] = v14; } v16 = 0; v126 = 0; - v17 = v117 - 1; - v18 = v116 - 1; + v17 = j - 1; + v18 = _i - 1; switch ( v105 ) { case 0: case 7: { - v116 = terrain_76DFC8[v17]; - if ( v120 > v116 ) + //v116 = terrain_76DFC8[v17]; + if ( v120 > terrain_76DFC8[v17] ) { v125 = v120; - memset32(terrain_76D9C8, v119 + 1, 4 * (v120 - v116 + 1)); + memset32(terrain_76D9C8, v119 + 1, 4 * (v120 - terrain_76DFC8[v17] + 1)); v19 = v120; do terrain_76DBC8[v126++] = v19--; - while ( v19 >= v116 ); + while ( v19 >= terrain_76DFC8[v17] ); if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 + 127] ) { do @@ -1127,9 +1136,9 @@ if ( v21 < v124 ) break; terrain_76DBC8[v16] = v21; - v22 = terrain_76DDC8[v17] == 65535; + //v22 = terrain_76DDC8[v17] == 65535; terrain_76D9C8[v16] = terrain_76DDC8[v17] + 1; - if ( v22 ) + if ( terrain_76DDC8[v17] == 65535 ) { terrain_76D9C8[v16] = v123 + 1; break; @@ -1201,18 +1210,18 @@ case 1: case 2: { - v116 = terrain_76DDC8[v17]; - if ( v122 < v116 ) + //v116 = terrain_76DDC8[v17]; + if ( v122 < terrain_76DDC8[v17] ) { v106 = v122; - memset32(terrain_76DBC8, v120 + 1, 4 * (v116 - v122 + 1)); + memset32(terrain_76DBC8, v120 + 1, 4 * (terrain_76DDC8[v17] - v122 + 1)); v32 = v122; do { v33 = v126++; terrain_76D9C8[v33] = v32++; } - while ( v32 <= v116 ); + while ( v32 <= terrain_76DDC8[v17] ); if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) { do @@ -1228,10 +1237,10 @@ v125 = terrain_76DDC8[v17]; while ( v35 <= v123 ) { - v22 = terrain_76DFC8[v17] == 65535; + //v22 = terrain_76DFC8[v17] == 65535; terrain_76DBC8[v16] = terrain_76DFC8[v17] + 1; terrain_76D9C8[v16] = v125; - if ( v22 ) + if ( terrain_76DFC8[v17] == 65535 ) { terrain_76DBC8[v16] = v124 + 1; break; @@ -1304,15 +1313,15 @@ case 5: case 6: { - v116 = terrain_76DDC8[v17]; - if ( v119 > v116 ) + //v116 = terrain_76DDC8[v17]; + if ( v119 > terrain_76DDC8[v17] ) { v106 = v119; - memset32(terrain_76DBC8, i, 4 * (v119 - v116 + 1)); + memset32(terrain_76DBC8, i, 4 * (v119 - terrain_76DDC8[v17] + 1)); v45 = v119; do terrain_76D9C8[v126++] = v45--; - while ( v45 >= v116 ); + while ( v45 >= terrain_76DDC8[v17] ); if ( terrain_76DDC8[v17] == terrain_76DBC8[v17 -1] ) { do @@ -1328,10 +1337,10 @@ v125 = terrain_76DDC8[v17]; while ( v47 >= v123 ) { - v22 = terrain_76DFC8[v17] == 65535; + //v22 = terrain_76DFC8[v17] == 65535; terrain_76DBC8[v16] = terrain_76DFC8[v17]; terrain_76D9C8[v16] = v125; - if ( v22 ) + if ( terrain_76DFC8[v17] == 65535 ) { terrain_76DBC8[v16] = v124; break; @@ -1403,18 +1412,18 @@ case 3: case 4: { - v116 = terrain_76DFC8[v17]; - if ( i < v116 ) + //v116 = terrain_76DFC8[v17]; + if ( i < terrain_76DFC8[v17] ) { v106 = i; - memset32(terrain_76D9C8, v122, 4 * (v116 - i + 1)); + memset32(terrain_76D9C8, v122, 4 * (terrain_76DFC8[v17] - i + 1)); v56 = i; do { v57 = v126++; terrain_76DBC8[v57] = v56++; } - while ( v56 <= v116 ); + while ( v56 <= terrain_76DFC8[v17] ); if ( terrain_76DFC8[v17] == terrain_76DDC8[v17 -1] ) { do @@ -1485,7 +1494,7 @@ v67 = terrain_76E1C8[v18]; terrain_76D7C8[v16] = v66; terrain_76D5C8[v16] = v67 + 1; - if ( v67 == 65535 ) + if ( terrain_76E1C8[v18] == 65535 ) { v31 = v123 + 1; terrain_76D5C8[v16] = v31; @@ -1517,26 +1526,26 @@ for ( i = v69; i >= 1; --i ) { //v70 = i; - v71 = terrain_76D7C8[i];//88 - v72 = terrain_76DBC8[i];//0 - if ( v71 < v72 )//swap - { - terrain_76DBC8[i] = v71; - terrain_76D7C8[i] = v72; - } - x = terrain_76DBC8[i];//0 + //v71 = terrain_76D7C8[i];//88 + //v72 = terrain_76DBC8[i];//0 + if ( terrain_76D7C8[i] < terrain_76DBC8[i] )//swap + { + terrain_76DBC8[i] = terrain_76D7C8[i]; + terrain_76D7C8[i] = terrain_76DBC8[i]; + } + //x = terrain_76DBC8[i];//0 v111 = 0; - if ( x <= 0 ) - x = -x; - v74 = terrain_76D7C8[i]; - if ( v74 <= 0 ) - v74 = -v74; - v75 = v74 + 2; + if ( terrain_76DBC8[i] <= 0 ) + terrain_76DBC8[i] = -terrain_76DBC8[i]; + //v74 = terrain_76D7C8[i]; + if ( terrain_76D7C8[i] <= 0 ) + terrain_76D7C8[i] = -terrain_76D7C8[i]; + v75 = terrain_76D7C8[i] + 2; //pIndoorCameraD3D_3 = pGame->pIndoorCameraD3D; uEndZ = v75; //pIndoorCameraD3D_4 = pIndoorCameraD3D_3; - uStartZ = x - 2; - if ( x - 2 < v75 ) + uStartZ = terrain_76DBC8[i] - 2; + if ( terrain_76DBC8[i] - 2 < v75 ) { v127 = 0; //v79 = (v73 - 66) << 9; @@ -1545,10 +1554,10 @@ v111 = v75 - uStartZ; for (int z = uStartZ; z < uEndZ; ++z) { - ptr_801A08[v127].vWorldPosition.x = (-64 + x) * 512;//pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512; + ptr_801A08[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512;//pTerrainVertices[z * 128 + x].vWorldPosition.x = (-64 + (signed)x) * 512; ptr_801A08[v127].vWorldPosition.y = (64 - terrain_76D9C8[i]) * 512; ptr_801A08[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i]); - ptr_801A04[v127].vWorldPosition.x = (-64 + x) * 512; + ptr_801A04[v127].vWorldPosition.x = (-64 + terrain_76DBC8[i]) * 512; ptr_801A04[v127].vWorldPosition.y = (63 - terrain_76D9C8[i]) * 512; ptr_801A04[v127].vWorldPosition.z = pOutdoor->GetHeightOnTerrain( z, terrain_76D9C8[i] + 1); if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) @@ -1565,57 +1574,58 @@ } //while ( v116 < v107 ); } - v102.v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[i]); - v102.v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[i]); + v103 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[i]); + v104 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[i]); if ( pRenderer->pRenderD3D )//Ritor1: do comment to test - Render::RenderTerrainD3D();//Render::DrawTerrainD3D(v111, 0, (int)&v102); + Render::DrawTerrainD3D(v111, 0, v103, v104);//Render::RenderTerrainD3D(); else - Render::DrawTerrainSW(v111, 0, (int)&v102); - } - } -/* else + Render::DrawTerrainSW(v111, 0, v103, v104); + } + } + else { for ( i = v69; i >= 1; --i ) { - v86 = i; - v87 = terrain_76D5C8[i]; - v88 = terrain_76D9C8[i]; - if ( v87 < v88 ) - { - terrain_76D9C8[v86] = v87; - terrain_76D5C8[v86] = v88; - } - v89 = terrain_76D9C8[v86]; + //v86 = i; + //v87 = terrain_76D5C8[i]; + //v88 = terrain_76D9C8[i]; + if ( terrain_76D5C8[i] < terrain_76D9C8[i] ) + { + terrain_76D9C8[i] = terrain_76D5C8[i]; + terrain_76D5C8[i] = terrain_76D9C8[i]; + } + //v89 = terrain_76D9C8[i]; v111 = 0; - if ( v89 <= 0 ) - v89 = -v89; - v90 = terrain_76D5C8[v86]; - if ( v90 <= 0 ) - v90 = -v90; + if ( terrain_76D9C8[i] <= 0 ) + terrain_76D9C8[i] = -terrain_76D9C8[i]; + //v90 = terrain_76D5C8[i]; + if ( terrain_76D5C8[i] <= 0 ) + terrain_76D5C8[i] = -terrain_76D5C8[i]; pIndoorCameraD3D_4 = pGame->pIndoorCameraD3D; - v107 = v90 + 2; - if ( v89 - 2 < v90 + 2 ) + v107 = terrain_76D5C8[i] + 2; + if ( terrain_76D9C8[i] - 2 < terrain_76D5C8[i] + 2 ) { v86 = 0; - v116 = v89 - 2; - v92 = (66 - v89) << 9; - pHeight = (66 - v89) << 9; - v111 = v90 + 2 - (v89 - 2); - do - { - v93 = v116; - v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 64) << 9; - *(float *)((char *)&ptr_801A08->vWorldPosition.x + v86) = (double)v106; - *(float *)&pHeight = (double)pHeight; - *(float *)((char *)&ptr_801A08->vWorldPosition.y + v86) = *(float *)&pHeight; - v106 = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86), v93); - v97 = v116; - *(float *)((char *)&ptr_801A08->vWorldPosition.z + v86) = (double)v106; - v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 63) << 9; - *(float *)((char *)&ptr_801A04->vWorldPosition.x + v86) = (double)v106; - *(float *)((char *)&ptr_801A04->vWorldPosition.y + v86) = *(float *)&pHeight; - pHeight = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86) + 1, v97); - *(float *)((char *)&ptr_801A04->vWorldPosition.z + v86) = (double)pHeight; + //v116 = terrain_76D9C8[i] - 2; + v92 = (66 - terrain_76D9C8[i]) << 9; + //pHeight = (66 - terrain_76D9C8[i]) << 9; + v111 = terrain_76D5C8[i] + 2 - (terrain_76D9C8[i] - 2); + //do + for ( v116 = terrain_76D9C8[i] - 2; v116 < v107; ++v116 ) + { + //v93 = v116; + //v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 64) << 9; + ptr_801A08[v86].vWorldPosition.x = terrain_76DBC8[v86] - 64 << 9; + //*(float *)&pHeight = (double)pHeight; + ptr_801A08[v86].vWorldPosition.y = v92; + //v106 = ; + //v97 = v116; + ptr_801A08[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86], v116); + //v106 = (*(int *)((char *)terrain_76DBC8 + v86) - 63) << 9; + ptr_801A04[v86].vWorldPosition.x = terrain_76DBC8[v86] - 63 << 9; + ptr_801A04[v86].vWorldPosition.y = v92; + //pHeight = pOutdoor->GetHeightOnTerrain(*(int *)((char *)terrain_76DBC8 + v86) + 1, v97); + ptr_801A04[v86].vWorldPosition.z = pOutdoor->GetHeightOnTerrain(terrain_76DBC8[v86] + 1, v116); if ( !byte_4D864C || !(pGame->uFlags & 0x80) ) { pIndoorCameraD3D_4->ViewTransform((RenderVertexSoft *)(char *)ptr_801A08 + v86, 1); @@ -1625,19 +1635,19 @@ } v92 -= 512; v86 += 48; - ++v116; - pHeight = v92; - } - while ( v116 < v107 ); + //++v116; + //pHeight = v92; + } + //while ( v116 < v107 ); } v103 = abs((int)pIndoorCamera->uMapGridCellX - terrain_76DBC8[v86]); v104 = abs((int)pIndoorCamera->uMapGridCellZ - terrain_76D9C8[v86]); if ( pRenderer->pRenderD3D ) - Render::DrawTerrainD3D(v111, 1, (int)&v102); + Render::DrawTerrainD3D(v111, 1, v103, v104); else - Render::DrawTerrainSW(v111, 1, (int)&v102); - } - }*/ + Render::DrawTerrainSW(v111, 1, v103, v104); + } + } result = v126; pOutdoorCamera->field_40 = v126; return result; @@ -1830,9 +1840,9 @@ } //----- (0048034E) -------------------------------------------------------- -void Render::DrawTerrainD3D(int a1, int a2, int a3) -{ - int v3; // esi@1 +void Render::DrawTerrainD3D(int a1, int a2, int a3, int unk4) +{ + //int v3; // esi@1 int v4; // edi@1 int v5; // ebx@2 int v6; // eax@2 @@ -1906,10 +1916,10 @@ unsigned int v73; // eax@150 int v74; // eax@154 unsigned int v75; // eax@158 - unsigned int v76; // [sp-10h] [bp-E0h]@61 + //unsigned int v76; // [sp-10h] [bp-E0h]@61 int v77; // [sp-Ch] [bp-DCh]@61 IDirect3DTexture2 *v78; // [sp-8h] [bp-D8h]@61 - int v79; // [sp-4h] [bp-D4h]@61 + //int v79; // [sp-4h] [bp-D4h]@61 int v80; // [sp+0h] [bp-D0h]@59 int v81; // [sp+0h] [bp-D0h]@109 int v82; // [sp+54h] [bp-7Ch]@1 @@ -1953,24 +1963,24 @@ static stru154 static_sub_0048034E_stru_154; static stru154 stru_76D5A8; - v3 = a1; + //v3 = a1; v82 = a2; - v83 = *(/*short **/_WORD *)(a3 + 4); - X = abs(*(/*short **/_WORD *)(a3 + 6)); + v83 = a3; + X = abs(unk4); v4 = 0; v88 = 0; - v84 = v3 - 1; + v84 = a1 - 1; v90 = (float)pOutdoor->vSunlight.x / 65536.0; v91 = (float)pOutdoor->vSunlight.y / 65536.0; v92 = (float)pOutdoor->vSunlight.z / 65536.0; - if ( v3 - 1 > 0 ) + if ( a1 - 1 > 0 ) { while ( 1 ) { v5 = abs(X);//v5 = 13108 v6 = abs(v83);//v6 = 13108 --X; - __debugbreak(); // uncoment & refactor following large if + //__debugbreak(); // uncoment & refactor following large if v93 = (int)&stru_76E5C8[(v5 << 7) + v6]; /*if ( !v93->field_0 || ((v7 = 48 * v4, v8 = &pVerticesSR_806210[v4], a2 = v8, !v82) ? (v9 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7), v10 = &pVerticesSR_806210[1] + v7) : (v9 = &pVerticesSR_806210[1] + v7, v10 = (RenderVertexSoft *)((char *)&pVerticesSR_801A10 + v7)), @@ -2403,12 +2413,12 @@ v80 = true; } //v79 = 0; - //v78 = pBitmaps_LOD->pHardwareTextures[v75]; + v78 = pBitmaps_LOD->pHardwareTextures[v75]; v71->pTexture = (Texture *)&pBitmaps_LOD->pHardwareTextures[v75];// Ritor1: It's temporary //v77 = (int)v71; //v76 = v71->uNumVertices; //goto LABEL_161; - pRenderer->DrawTerrainPolygon(v76, (stru148 *)v71, v78, v79, v80); + pRenderer->DrawTerrainPolygon(v71->uNumVertices, (stru148 *)v71, v78, 0, v80); goto LABEL_162; } v38 = (stru148 *)v71; @@ -2427,7 +2437,7 @@ // 76D5C0: using guessed type char static_sub_0048034E_byte_76D5C0__init_flag; //----- (00481212) -------------------------------------------------------- -void Render::DrawTerrainSW(int a1, int a2, int a3) +void Render::DrawTerrainSW(int a1, int a2, int a3, int a4) { int v3; // esi@1 int v4; // ecx@1 @@ -2541,8 +2551,8 @@ //v4 = *(short *)(a3 + 4); //v5 = *(short *)(a3 + 6); v85 = a2; - v86 = *(_WORD *)(a3 + 4); //v4; - X = abs(*(_WORD *)(a3 + 6)); //v5 + v86 = a3; //v4; + X = abs(a4); //v5 v6 = 0; v90 = 0; v81 = v3 - 1;
--- a/Render.h Mon May 13 09:39:49 2013 +0600 +++ b/Render.h Mon May 13 09:39:58 2013 +0600 @@ -365,9 +365,9 @@ void TransformBillboardsAndSetPalettesODM(); float DrawBezierTerrain(); void RenderTerrainD3D(); - void DrawTerrainD3D(int a1, int edx0, int a3); - void DrawTerrainSW(int a1, int a2, int a3); - __int16 ExecOutdoorDrawSW(); + void DrawTerrainD3D(int a1, int edx0, int a3, int unk4); + void DrawTerrainSW(int a1, int a2, int a3, int a4); + void ExecOutdoorDrawSW(); void ChangeBetweenWinFullscreenModes(); void DrawBillboardList_BLV();
--- a/SaveLoad.cpp Mon May 13 09:39:49 2013 +0600 +++ b/SaveLoad.cpp Mon May 13 09:39:58 2013 +0600 @@ -229,7 +229,7 @@ //----- (0045F469) -------------------------------------------------------- void SaveGame( bool IsAutoSAve, bool NotSaveWorld ) - { +{ unsigned short *pScreenshot; // edi@5 int text_pos; // eax@6 FILE *pLLoidFile; // edi@24 @@ -250,7 +250,6 @@ ODMHeader odm_data; // [sp+218h] [bp-58h]@30 int res; // [sp+224h] [bp-4Ch]@30 int pPositionZ; // [sp+228h] [bp-48h]@2 - LOD::Directory pLodDirectory; // [sp+22Ch] [bp-44h]@2 size_t Size; // [sp+250h] [bp-20h]@26 char *uncompressed_buff; // [sp+258h] [bp-18h]@2 unsigned int compressed_block_size; // [sp+260h] [bp-10h]@23 @@ -261,7 +260,8 @@ return; uncompressed_buff = (char*)malloc(1000000); - pLodDirectory.Reset(); + + LOD::Directory pLodDirectory; // [sp+22Ch] [bp-44h]@2 pPositionX = pParty->vPosition.x; pPositionY = pParty->vPosition.y; pPositionZ = pParty->vPosition.z;
--- a/Spells.cpp Mon May 13 09:39:49 2013 +0600 +++ b/Spells.cpp Mon May 13 09:39:58 2013 +0600 @@ -232,79 +232,57 @@ //----- (00458585) -------------------------------------------------------- void SpellBuff::Reset() { - - this->uSkill = 0; - this->uPower = 0; - this->uExpireTime = 0i64; - this->uCaster = 0; - this->uFlags = 0; - if ( this->uOverlayID ) + uSkill = 0; + uPower = 0; + uExpireTime = 0i64; + uCaster = 0; + uFlags = 0; + if (uOverlayID) { - ((OtherOverlay *)&stru_5E4C90._decor_events[20 * this->uOverlayID + 105])->Reset(); + pOtherOverlayList->pOverlays[uOverlayID - 1].Reset(); pOtherOverlayList->bRedraw = true; - this->uOverlayID = 0; + uOverlayID = 0; } } //----- (004585CA) -------------------------------------------------------- signed int SpellBuff::_4585CA(__int64 a2) { - signed int result; // eax@3 - - if ( this->uExpireTime && (signed __int64)this->uExpireTime < a2 ) + if (uExpireTime && uExpireTime < a2) { - this->uExpireTime = 0i64; - this->uPower = 0; - this->uSkill = 0; - this->uOverlayID = 0; - result = 1; + uExpireTime = 0; + uPower = 0; + uSkill = 0; + uOverlayID = 0; + return true; } - else - { - result = 0; - } - return result; + return false; } //----- (004584E0) -------------------------------------------------------- -signed int SpellBuff::Apply(unsigned __int64 uExpireTime, unsigned __int16 uSkillLevel, unsigned __int16 uPower, int a5, unsigned __int8 a6) +bool SpellBuff::Apply(unsigned __int64 uExpireTime, unsigned __int16 uSkillLevel, unsigned __int16 uPower, int uOverlayID, unsigned __int8 caster) { - SpellBuff *v6; // esi@1 - signed int result; // eax@3 - int v8; // eax@4 + if (this->uExpireTime && uExpireTime < this->uExpireTime) + return false; - v6 = this; - if ( this->uExpireTime && (signed __int64)uExpireTime < (signed __int64)this->uExpireTime ) - { - result = 0; - } - else + this->uSkill = uSkillLevel; + this->uPower = uPower; + this->uExpireTime = uExpireTime; + if (this->uOverlayID && this->uOverlayID != uOverlayID) { - this->uSkill = uSkillLevel; - this->uPower = uPower; - LOWORD(v8) = this->uOverlayID; - this->uExpireTime = uExpireTime; - if ( (short)v8 ) - { - v8 = (unsigned __int16)v8; - if ( (unsigned __int16)v8 != a5 ) - { - ((OtherOverlay *)&stru_5E4C90._decor_events[20 * v8 + 105])->Reset(); - pOtherOverlayList->bRedraw = true; - v6->uOverlayID = 0; - } - } - v6->uOverlayID = a5; - v6->uCaster = a6; - result = 1; + pOtherOverlayList->pOverlays[this->uOverlayID - 1].Reset(); + pOtherOverlayList->bRedraw = true; + this->uOverlayID = 0; } - return result; + this->uOverlayID = uOverlayID; + this->uCaster = caster; + + return true; } //----- (0045384A) -------------------------------------------------------- void SpellStats::Initialize() - { - +{ int decode_step; char* test_string; bool break_loop;
--- a/Spells.h Mon May 13 09:39:49 2013 +0600 +++ b/Spells.h Mon May 13 09:39:58 2013 +0600 @@ -155,7 +155,7 @@ uFlags = 0; } - signed int Apply(unsigned __int64 uExpireTime, unsigned __int16 uSkillLevel, unsigned __int16 uPower, int a5, unsigned __int8 a6); + bool Apply(unsigned __int64 uExpireTime, unsigned __int16 uSkillLevel, unsigned __int16 uPower, int uOverlayID, unsigned __int8 caster); void Reset(); signed int _4585CA(__int64 a2); bool NotExpired();
--- a/Texture.cpp Mon May 13 09:39:49 2013 +0600 +++ b/Texture.cpp Mon May 13 09:39:58 2013 +0600 @@ -128,7 +128,7 @@ unsigned int uTextureID_ib_td5_A; unsigned int uTextureID_ib_td2_A; // weak unsigned int uTextureID_ib_td1_A; -int uTextureID_507958; // weak +int uTextureID_CharacterUI_InventoryBackground; // weak int uTextureID_50795C; // weak @@ -277,12 +277,12 @@ for ( i = uIconID; ; ++i ) { v3->pTextures[i].uTextureID = pBitmaps_LOD->LoadTexture(v3->pTextures[i].pTextureName, TEXTURE_DEFAULT); - auto pTex = (v3->pTextures[i].uTextureID != -1 ? &pBitmaps_LOD->pTextures[v3->pTextures[i].uTextureID] : 0); - if (pTex) - pTex->palette_id2 = pPaletteManager->LoadPalette(pTex->palette_id1); + + if (v3->pTextures[i].uTextureID != -1); + pBitmaps_LOD->pTextures[v3->pTextures[i].uTextureID].palette_id2 = pPaletteManager->LoadPalette(pBitmaps_LOD->pTextures[v3->pTextures[i].uTextureID].palette_id1); //result = (unsigned int)v3->pTextures; //if ( !(*(char *)(result + i * 20 + 18) & 1) ) - if( v3->pTextures[i].uFlags&1) + if( v3->pTextures[i].uFlags & 1) break; } }
--- a/Texture.h Mon May 13 09:39:49 2013 +0600 +++ b/Texture.h Mon May 13 09:39:58 2013 +0600 @@ -231,7 +231,7 @@ extern unsigned int uTextureID_ib_td5_A; extern unsigned int uTextureID_ib_td2_A; // weak extern unsigned int uTextureID_ib_td1_A; -extern int uTextureID_507958; // weak +extern int uTextureID_CharacterUI_InventoryBackground; // weak extern int uTextureID_50795C; // weak
--- a/UIBooks.cpp Mon May 13 09:39:49 2013 +0600 +++ b/UIBooks.cpp Mon May 13 09:39:58 2013 +0600 @@ -208,7 +208,7 @@ v0 = pPlayers[uActiveCharacter]; v1 = 11 * v0->lastOpenedSpellbookPage; v2 = pIcons_LOD->FindTextureByName("Pending"); - v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0); + v3 = pIcons_LOD->GetTexture(v2); pRenderer->ClearZBuffer(0, 479); v4 = 1; if ( __OFSUB__(v1, v1 + 11) ^ 1 ) @@ -648,7 +648,7 @@ pRenderer->DrawTextureTransparent(v1, v18, v25); if ( !dword_506540 ) { - if ( dword_506568 ) + if (_506568_autonote_type != AUTONOTE_POTION_RECEPIE) { pRenderer->DrawTextureTransparent( pViewport->uViewportTL_X + 408, @@ -659,7 +659,7 @@ } goto LABEL_14; } - if ( !dword_506568 ) + if (_506568_autonote_type == AUTONOTE_POTION_RECEPIE) { LABEL_14: v2 = 1; @@ -669,12 +669,12 @@ v31 = 1; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); LABEL_15: - dword_506568 = 0; + _506568_autonote_type = AUTONOTE_POTION_RECEPIE; pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394); LABEL_16: if ( dword_50653C ) { - if ( dword_506568 != v2 ) + if ( _506568_autonote_type != v2 ) { v31 = v2; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); @@ -682,7 +682,7 @@ } else { - if ( dword_506568 != v2 ) + if ( _506568_autonote_type != v2 ) { v26 = pTexture_506388; v19 = pViewport->uViewportTL_Y + 150; @@ -691,14 +691,14 @@ } } v26 = pTexture_50638C; - dword_506568 = v2; + _506568_autonote_type = v2; v19 = pViewport->uViewportTL_Y + 150; v3 = pViewport->uViewportTL_X + 399; LABEL_22: pRenderer->DrawTextureTransparent(v3, v19, v26); if ( dword_506538 ) { - if ( dword_506568 != 2 ) + if ( _506568_autonote_type != AUTONOTE_OBELISK) { v31 = v2; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); @@ -706,7 +706,7 @@ } else { - if ( dword_506568 != 2 ) + if ( _506568_autonote_type != AUTONOTE_OBELISK) { v27 = pTexture_506380; v20 = pViewport->uViewportTL_Y + 188; @@ -715,14 +715,14 @@ } } v27 = pTexture_506384; - dword_506568 = 2; + _506568_autonote_type = AUTONOTE_OBELISK; v20 = pViewport->uViewportTL_Y + 188; v4 = pViewport->uViewportTL_X + 397; LABEL_28: pRenderer->DrawTextureTransparent(v4, v20, v27); if ( dword_506534 ) { - if ( dword_506568 != 3 ) + if ( _506568_autonote_type != AUTONOTE_SEER) { v31 = v2; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); @@ -730,7 +730,7 @@ } else { - if ( dword_506568 != 3 ) + if ( _506568_autonote_type != AUTONOTE_SEER) { v28 = pTexture_506378; v21 = pViewport->uViewportTL_Y + 226; @@ -739,14 +739,14 @@ } } v28 = pTexture_50637C; - dword_506568 = 3; + _506568_autonote_type = AUTONOTE_SEER; v21 = pViewport->uViewportTL_Y + 226; v5 = pViewport->uViewportTL_X + 397; LABEL_34: pRenderer->DrawTextureTransparent(v5, v21, v28); if ( dword_506530 ) { - if ( dword_506568 != 4 ) + if ( _506568_autonote_type != AUTONOTE_MISC) { v31 = v2; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); @@ -754,7 +754,7 @@ } else { - if ( dword_506568 != 4 ) + if ( _506568_autonote_type != AUTONOTE_MISC) { v29 = pTexture_506370; v22 = pViewport->uViewportTL_Y + 263; @@ -763,14 +763,14 @@ } } v29 = pTexture_506374; - dword_506568 = 4; + _506568_autonote_type = AUTONOTE_MISC; v22 = pViewport->uViewportTL_Y + 264; v6 = pViewport->uViewportTL_X + 397; LABEL_40: pRenderer->DrawTextureTransparent(v6, v22, v29); if ( dword_50652C ) { - if ( dword_506568 != 5 ) + if ( _506568_autonote_type != AUTONOTE_TEACHER) { v31 = v2; pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); @@ -778,7 +778,7 @@ } else { - if ( dword_506568 != 5 ) + if ( _506568_autonote_type != AUTONOTE_TEACHER) { v30 = pTexture_506368; v23 = pViewport->uViewportTL_Y + 302; @@ -787,7 +787,7 @@ } } v30 = pTexture_50636C; - dword_506568 = 5; + _506568_autonote_type = AUTONOTE_TEACHER; v23 = pViewport->uViewportTL_Y + 302; v7 = pViewport->uViewportTL_X + 397; LABEL_46: @@ -815,7 +815,7 @@ do { //if ( dword_72371C[2 * v8] == dword_506568 ) - if ( pAutonoteTxt[v8-1].eType == dword_506568 ) + if ( pAutonoteTxt[v8-1].eType == _506568_autonote_type ) { //v32 = (&dword_723718_autonote_related)[8 * (signed __int16)v8]; v32 = (char *)pAutonoteTxt[v8-1].pText; @@ -1379,7 +1379,7 @@ else v50 = 1; } - pRenderer->DrawTransparentRedShade(v47, v49, (Texture *)(pTextureIDs_pMapDirs[v50] != -1 ? (int)&pIcons_LOD->pTextures[pTextureIDs_pMapDirs[v50]] : 0)); + pRenderer->DrawTransparentRedShade(v47, v49, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[v50])); } result = TargetColor(0xFFu, 0xFFu, 0xFFu); v95 = 0;
--- a/UICharacter.cpp Mon May 13 09:39:49 2013 +0600 +++ b/UICharacter.cpp Mon May 13 09:39:58 2013 +0600 @@ -45,514 +45,143 @@ +unsigned int ui_color_text_default; +unsigned int ui_color_text_highlight; +unsigned int ui_color_text_header; +unsigned int ui_color_text_bonus; +unsigned int ui_color_text_bonus_neg; +unsigned int ui_color_text_skill_upgradeable; +unsigned int ui_color_text_skill_not_upgradeable; +void set_default_ui_skin() +{ + ui_color_text_default = TargetColor(255, 255, 255); + ui_color_text_highlight = TargetColor(255, 0, 0); + ui_color_text_header = TargetColor(255, 255, 155); + ui_color_text_bonus = TargetColor(0, 255, 0); + ui_color_text_bonus_neg = TargetColor(255, 0, 0); + + ui_color_text_skill_upgradeable = TargetColor(0, 175, 255); + ui_color_text_skill_not_upgradeable = TargetColor(255, 0, 0); +} + + + +static int CharacterUI_SkillsTab_Draw__DrawSkillTable(Player *player, int x, int y, int *skill_list, int skill_list_size, int right_margin, const char *skill_group_name) +{ + int y_offset = y; + + sprintf(pTmpBuf, "%s\r%03d%s", skill_group_name, right_margin, pGlobalTXT_LocalizationStrings[131]); //"Level" + pGUIWindow_CurrentMenu->DrawText(pFontArrus, x, y, ui_color_text_header, pTmpBuf, 0, 0, 0); + + int num_skills_drawn = 0; + for (uint i = 0; i < skill_list_size; ++i) + { + auto skill = (PLAYER_SKILL_TYPE)skill_list[i]; + for (uint j = 0; j < pGUIWindow_CurrentMenu->uNumControls; ++j) + { + auto v8 = pGUIWindow_CurrentMenu->pControlsHead; + + for (int v7 = j; v7 > 0; --v7) + v8 = v8->pNext; + + auto v9 = v8->field_1C; + if ((short)(v8->field_1C) >= 0) + continue; + if ( (v9 & 0x7FFF) != skill ) + continue; + + ++num_skills_drawn; + y_offset = v8->uY; + + auto skill_value = player->pActiveSkills[skill]; + auto skill_level = skill_value & 0x3F; + + uint skill_color = 0; + uint skill_mastery_color = 0; + if (player->uSkillPoints > skill_level) + skill_color = ui_color_text_skill_upgradeable; + + if (pGUIWindow_CurrentMenu->pCurrentPosActiveItem == j) + { + if (player->uSkillPoints > skill_level) + skill_mastery_color = ui_color_text_bonus; + else + skill_mastery_color = ui_color_text_skill_not_upgradeable; + skill_color = skill_mastery_color; + } + + if (SkillToMastery(skill_value) == 1) + { + sprintfex(pTmpBuf, "%s\r%03d%2d", pSkillNames[skill], right_margin, skill_level); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf, 0, 0, 0); + } + else + { + const char *v46 = nullptr; + + switch (SkillToMastery(skill_value)) + { + case 4: v46 = pGlobalTXT_LocalizationStrings[96]; break; // "Grand" + case 3: v46 = pGlobalTXT_LocalizationStrings[432]; break; // Master + case 2: v46 = pGlobalTXT_LocalizationStrings[433]; break; // Expert + } + + if (!skill_mastery_color) + skill_mastery_color = ui_color_text_header; + + + sprintfex(pTmpBuf, "%s \f%05d%s\f%05d\r%03d%2d", pSkillNames[skill], skill_mastery_color, v46, skill_color, right_margin, skill_level); + pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, v8->uY, skill_color, pTmpBuf, 0, 0, 0); + } + } + } + + if (!num_skills_drawn) + { + y_offset += LOBYTE(pFontLucida->uFontHeight) - 3; + pGUIWindow_CurrentMenu->DrawText(pFontLucida, x, y_offset, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); //"None" + } + + return y_offset; +} + //----- (00419719) -------------------------------------------------------- -char __fastcall CharacterUI_SkillsTab_Draw(unsigned int uPlayerID) - { - unsigned int v1; // esi@1 - Player *pPlayer; // ebp@1 - unsigned int v3; // eax@1 - signed int v4; // ecx@1 - int v5; // edi@3 - GUIWindow *v6; // ecx@3 - int v7; // eax@4 - GUIButton *v8; // edx@5 - int v9; // eax@7 - unsigned int v10; // ecx@9 - unsigned __int16 v11; // ax@9 - int v12; // eax@9 - unsigned __int8 v13; // cf@12 - unsigned __int8 v14; // zf@12 - unsigned int v15; // eax@12 - char *v16; // ecx@22 - GUIWindow *v17; // ecx@33 - int v18; // edx@34 - GUIButton *v19; // eax@35 - int v20; // edx@37 - unsigned __int16 v21; // cx@39 - unsigned int v22; // eax@39 - int v23; // edi@39 - unsigned int v24; // eax@42 - char v25; // sf@52 - char *v26; // ecx@52 - int v27; // edi@63 - GUIWindow *v28; // ecx@63 - int v29; // edx@64 - GUIButton *v30; // eax@65 - int v31; // edx@67 - unsigned int v32; // ecx@69 - int v33; // eax@69 - unsigned int v34; // eax@72 - char *v35; // ecx@82 - GUIWindow *v36; // ecx@93 - int v37; // edx@94 - GUIButton *v38; // eax@94 - int v39; // edx@97 - unsigned __int16 v40; // cx@99 - unsigned int v41; // eax@99 - int v42; // edi@99 - unsigned int v43; // eax@102 - char *v44; // ecx@112 - char *v46; // [sp-Ch] [bp-4Ch]@19 - char *v47; // [sp-Ch] [bp-4Ch]@49 - char *v48; // [sp-Ch] [bp-4Ch]@79 - char *v49; // [sp-Ch] [bp-4Ch]@109 - unsigned int v50; // [sp-8h] [bp-48h]@19 - unsigned int v51; // [sp-8h] [bp-48h]@49 - unsigned int v52; // [sp-8h] [bp-48h]@79 - unsigned int v53; // [sp-8h] [bp-48h]@109 - int v54; // [sp-4h] [bp-44h]@19 - int v55; // [sp-4h] [bp-44h]@49 - int v56; // [sp-4h] [bp-44h]@79 - int v57; // [sp-4h] [bp-44h]@109 - unsigned int v58; // [sp+10h] [bp-30h]@9 - unsigned int v59; // [sp+10h] [bp-30h]@39 - unsigned int v60; // [sp+10h] [bp-30h]@69 - unsigned int v61; // [sp+10h] [bp-30h]@99 - int v62; // [sp+14h] [bp-2Ch]@4 - int v63; // [sp+14h] [bp-2Ch]@34 - int v64; // [sp+14h] [bp-2Ch]@64 - int v65; // [sp+14h] [bp-2Ch]@94 - signed int i; // [sp+18h] [bp-28h]@4 - signed int v67; // [sp+18h] [bp-28h]@34 - signed int v68; // [sp+18h] [bp-28h]@64 - signed int v69; // [sp+18h] [bp-28h]@94 - int v70; // [sp+1Ch] [bp-24h]@3 - int v71; // [sp+1Ch] [bp-24h]@33 - int v72; // [sp+1Ch] [bp-24h]@63 - int v73; // [sp+1Ch] [bp-24h]@93 - int uY; // [sp+20h] [bp-20h]@9 - int uYa; // [sp+20h] [bp-20h]@33 - int uYb; // [sp+20h] [bp-20h]@69 - int uYc; // [sp+20h] [bp-20h]@93 - unsigned int a5; // [sp+24h] [bp-1Ch]@1 - unsigned int v79; // [sp+28h] [bp-18h]@1 - int *v80; // [sp+2Ch] [bp-14h]@3 - int *v81; // [sp+2Ch] [bp-14h]@33 - int *v82; // [sp+2Ch] [bp-14h]@63 - int *v83; // [sp+2Ch] [bp-14h]@93 - unsigned int v84; // [sp+30h] [bp-10h]@1 - int v85; // [sp+34h] [bp-Ch]@1 - unsigned int v86; // [sp+38h] [bp-8h]@1 - unsigned __int16 v87; // [sp+3Ch] [bp-4h]@9 - char *v88; // [sp+3Ch] [bp-4h]@24 - char *v89; // [sp+3Ch] [bp-4h]@54 - unsigned __int16 v90; // [sp+3Ch] [bp-4h]@69 - char *v91; // [sp+3Ch] [bp-4h]@84 - char *v92; // [sp+3Ch] [bp-4h]@114 +void CharacterUI_SkillsTab_Draw(Player *player) +{ + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_skill", TEXTURE_16BIT_PALETTE)); + + sprintfex(pTmpBuf, "%s \f%05d^Pv[%s]\f00000\r177%s: \f%05d%d\f00000", + pGlobalTXT_LocalizationStrings[206], // Skills for + ui_color_text_header, + player->pName, + pGlobalTXT_LocalizationStrings[207], // Skill Points + player->uSkillPoints ? ui_color_text_bonus : ui_color_text_default, + player->uSkillPoints); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0); - v1 = uPlayerID; - a5 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - v84 = TargetColor(0, 0xAFu, 0xFFu); - v85 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem; - v86 = TargetColor(0xFFu, 0, 0); - v79 = TargetColor(0, 0xFFu, 0); - pPlayer = &pParty->pPlayers[v1-1]; - v3 = pIcons_LOD->LoadTexture("fr_skill", TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(v3)); - v4 = v79; - if ( !pPlayer->uSkillPoints ) - v4 = 65535; - sprintf( - pTmpBuf, - "%s \f%05d%s\f00000\r177%s: \f%05d%d\f00000", - pGlobalTXT_LocalizationStrings[206], // Skills for - a5, - pPlayer->pName, - pGlobalTXT_LocalizationStrings[207], // Skill Points - v4, - pPlayer->uSkillPoints); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0); - v5 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;// Weapons, Level - sprintf(pTmpBuf, "%s\r400%s", pGlobalTXT_LocalizationStrings[242], pGlobalTXT_LocalizationStrings[131]); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, v5, a5, pTmpBuf, 0, 0, 0); - v6 = pGUIWindow_CurrentMenu; - v70 = 0; - v80 = pWeaponSkills; - do - { - v62 = *v80; - v7 = 0; - for ( i = 0; i < (signed int)v6->uNumControls; v7 = i++ + 1 ) - { - v8 = v6->pControlsHead; - if ( v7 > 0 ) - { - do - { - v8 = v8->pNext; - --v7; - } - while ( v7 ); - } - v9 = v8->field_1C; - if ( SBYTE1(v9) >= 0 ) - continue; - BYTE1(v9) &= 0x7Fu; - if ( v9 != v62 ) - continue; - v5 = v8->uY; - v10 = pPlayer->uSkillPoints; - ++v70; - v11 = pPlayer->pActiveSkills[v62]; - v87 = pPlayer->pActiveSkills[v62]; - v12 = v11 & 0x3F; - v58 = 0; - uY = v12; - if ( v10 >= v12 + 1 ) - v58 = v84; - if ( v85 == i ) - { - v13 = v10 < v12; - v14 = v10 == v12; - v15 = v86; - if ( !(v13 | v14) ) - v15 = v79; - v58 = v15; - } - else - { - v15 = v58; - } - if ( HIBYTE(v87) & 1 ) - { - if ( !v15 ) - v15 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - v54 = uY; - v50 = v58; - v46 = pGlobalTXT_LocalizationStrings[96]; - } - else - { - if ( !(v87 & 0xC0) ) - { - sprintf(pTmpBuf, "%s\r400%2d", pSkillNames[v62], uY); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, v5, v58, pTmpBuf, 0, 0, 0); - v6 = pGUIWindow_CurrentMenu; - continue; - } - v16 = pGlobalTXT_LocalizationStrings[432]; - if ( (v87 & 0x80u) == 0 ) - v16 = pGlobalTXT_LocalizationStrings[433]; - v88 = v16; - if ( !v15 ) - v15 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - v54 = uY; - v50 = v58; - v46 = v88; - } - sprintf(pTmpBuf, "%s ", pSkillNames[v62], v15, v46, v50, v54); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, v5, v58, pTmpBuf, 0, 0, 0); - v6 = pGUIWindow_CurrentMenu; - } - ++v80; - } - while ( v80 <= &pWeaponSkills[8]); - if ( !v70 ) - { - v5 = v5 + LOBYTE(pFontLucida->uFontHeight) - 3; - v6->DrawText(pFontLucida, 24, v5, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); - } - uYa = v5 + 2 * LOBYTE(pFontLucida->uFontHeight) - 10; - sprintf(pTmpBuf, "%s\r400%s", pGlobalTXT_LocalizationStrings[138], pGlobalTXT_LocalizationStrings[131]); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, uYa, a5, pTmpBuf, 0, 0, 0); - v17 = pGUIWindow_CurrentMenu; - v71 = 0; - v81 = pMagicSkills; - do - { - v18 = 0; - v67 = 0; - v63 = *v81; - while ( v67 < (signed int)v17->uNumControls ) - { - v19 = v17->pControlsHead; - if ( v18 > 0 ) - { - do - { - v19 = v19->pNext; - --v18; - } - while ( v18 ); - } - v20 = v19->field_1C; - if ( SBYTE1(v20) >= 0 || (BYTE1(v20) &= 0x7Fu, v20 != v63) ) - { - v18 = v67++ + 1; - continue; - } - ++v71; - uYa = v19->uY; - v21 = pPlayer->pActiveSkills[v63]; - v22 = pPlayer->uSkillPoints; - v23 = pPlayer->pActiveSkills[v63] & 0x3F; - v59 = 0; - if ( v22 >= v23 + 1 ) - v59 = v84; - if ( v85 == v67 ) - { - v13 = v22 < v23; - v14 = v22 == v23; - v24 = v86; - if ( !(v13 | v14) ) - v24 = v79; - v59 = v24; - } - else - { - v24 = v59; - } - if ( HIBYTE(v21) & 1 ) - { - if ( !v24 ) - v24 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - v55 = v23; - v51 = v59; - v47 = pGlobalTXT_LocalizationStrings[96]; - } - else - { - if ( !(v21 & 0xC0) ) - { - sprintf(pTmpBuf, "%s\r400%2d", pSkillNames[v63], v23); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, uYa, v59, pTmpBuf, 0, 0, 0); - v17 = pGUIWindow_CurrentMenu; - v18 = v67++ + 1; - continue; - } - v25 = (v21 & 0x80u) != 0; - v26 = pGlobalTXT_LocalizationStrings[432]; - if ( !v25 ) - v26 = pGlobalTXT_LocalizationStrings[433]; - v89 = v26; - if ( !v24 ) - v24 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - v55 = v23; - v51 = v59; - v47 = v89; - } - sprintf(pTmpBuf, "%s ", pSkillNames[v63], v24, v47, v51, v55); - //LABEL_58: - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, uYa, v59, pTmpBuf, 0, 0, 0); - v17 = pGUIWindow_CurrentMenu; - //LABEL_59: - v18 = v67++ + 1; - } - ++v81; - } - while ( v81 <= &pMagicSkills[8]); - if ( !v71 ) - v17->DrawText( - pFontLucida, - 24, - LOBYTE(pFontLucida->uFontHeight) + uYa - 3, - 0, - pGlobalTXT_LocalizationStrings[153], - 0, - 0, - 0); - v27 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13; - sprintf(pTmpBuf, "%s\r177%s", pGlobalTXT_LocalizationStrings[11], pGlobalTXT_LocalizationStrings[131]); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 248, v27, a5, pTmpBuf, 0, 0, 0); - v28 = pGUIWindow_CurrentMenu; - v72 = 0; - v82 = pArmorSkills; - do - { - v29 = 0; - v68 = 0; - v64 = *v82; - while ( v68 < (signed int)v28->uNumControls ) - { - v30 = v28->pControlsHead; - if ( v29 > 0 ) - { - do - { - v30 = v30->pNext; - --v29; - } - while ( v29 ); - } - v31 = v30->field_1C; - if ( SBYTE1(v31) >= 0 || (BYTE1(v31) &= 0x7Fu, v31 != v64) ) - { - v29 = v68++ + 1; - continue; - } - v27 = v30->uY; - ++v72; - v60 = 0; - v90 = pPlayer->pActiveSkills[v64]; - v32 = pPlayer->uSkillPoints; - v33 = pPlayer->pActiveSkills[v64] & 0x3F; - uYb = v33; - if ( v32 >= v33 + 1 ) - v60 = v84; - if ( v85 == v68 ) - { - v13 = v32 < v33; - v14 = v32 == v33; - v34 = v86; - if ( !(v13 | v14) ) - v34 = v79; - v60 = v34; - } - else - { - v34 = v60; - } - if ( (pPlayer->pActiveSkills[v64] >> 8) & 1 ) - { - if ( !v34 ) - v34 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - v56 = uYb; - v52 = v60; - v48 = pGlobalTXT_LocalizationStrings[96]; - } - else - { - if ( !(v90 & 0xC0) ) - { - sprintf(pTmpBuf, "%s\r177%2d", pSkillNames[v64], uYb); - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, v27, v60, pTmpBuf, 0, 0, 0); - v28 = pGUIWindow_CurrentMenu; - v29 = v68++ + 1; - continue; - } - v35 = pGlobalTXT_LocalizationStrings[432]; - if ( (v90 & 0x80u) == 0 ) - v35 = pGlobalTXT_LocalizationStrings[433]; - v91 = v35; - if ( !v34 ) - v34 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - v56 = uYb; - v52 = v60; - v48 = v91; - } - sprintf(pTmpBuf, "%s ", pSkillNames[v64], v34, v48, v52, v56); - //LABEL_88: - pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, v27, v60, pTmpBuf, 0, 0, 0); - v28 = pGUIWindow_CurrentMenu; - //LABEL_89: - v29 = v68++ + 1; - } - ++v82; - } - while ( v82 <= &pArmorSkills[4]); - if ( !v72 ) - { - v27 = v27 + LOBYTE(pFontLucida->uFontHeight) - 3; - v28->DrawText(pFontLucida, 248, v27, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); - } - uYc = v27 + 2 * LOBYTE(pFontLucida->uFontHeight) - 10; - sprintf(pTmpBuf, "%s\r177%s", pGlobalTXT_LocalizationStrings[143], pGlobalTXT_LocalizationStrings[131]); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 248, uYc, a5, pTmpBuf, 0, 0, 0); - v36 = pGUIWindow_CurrentMenu; - v73 = 0; - v83 = pMiscSkills; - do - { - v37 = 0; - v69 = 0; - v38 = (GUIButton *)*v83; - v65 = *v83; - while ( v69 < (signed int)v36->uNumControls ) - { - v38 = v36->pControlsHead; - if ( v37 > 0 ) - { - do - { - v38 = v38->pNext; - --v37; - } - while ( v37 ); - } - v39 = v38->field_1C; - if ( SBYTE1(v39) >= 0 || (BYTE1(v39) &= 0x7Fu, v39 != v65) ) - { - //goto LABEL_119; - v37 = v69++ + 1; - continue; - } - ++v73; - uYc = v38->uY; - v40 = pPlayer->pActiveSkills[v65]; - v41 = pPlayer->uSkillPoints; - v42 = pPlayer->pActiveSkills[v65] & 0x3F; - v61 = 0; - if ( v41 >= v42 + 1 ) - v61 = v84; - if ( v85 == v69 ) - { - v13 = v41 < v42; - v14 = v41 == v42; - v43 = v86; - if ( !(v13 | v14) ) - v43 = v79; - v61 = v43; - } - else - { - v43 = v61; - } - if ( HIBYTE(v40) & 1 ) - { - if ( !v43 ) - v43 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - v57 = v42; - v53 = v61; - v49 = pGlobalTXT_LocalizationStrings[96]; - } - else - { - if ( !(v40 & 0xC0) ) - { - sprintf(pTmpBuf, "%s\r177%2d", pSkillNames[v65], v42); - LOBYTE(v38) = pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, uYc, v61, pTmpBuf, 0, 0, 0); - v36 = pGUIWindow_CurrentMenu; - v37 = v69++ + 1; - continue; - } - v25 = (v40 & 0x80u) != 0; - v44 = pGlobalTXT_LocalizationStrings[432]; - if ( !v25 ) - v44 = pGlobalTXT_LocalizationStrings[433]; - v92 = v44; - if ( !v43 ) - v43 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - v57 = v42; - v53 = v61; - v49 = v92; - } - sprintf(pTmpBuf, "%s ", pSkillNames[v65], v43, v49, v53, v57); - LOBYTE(v38) = pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, uYc, v61, pTmpBuf, 0, 0, 0); - v36 = pGUIWindow_CurrentMenu; - v37 = v69++ + 1; - } - ++v83; - } - while ( v83 <= &pMiscSkills[11]); - if ( !v73 ) - LOBYTE(v38) = v36->DrawText( - pFontLucida, - 248, - LOBYTE(pFontLucida->uFontHeight) + uYc - 3, - 0, - pGlobalTXT_LocalizationStrings[153], - 0, - 0, - 0); - return (char)v38; + int y = 2 * LOBYTE(pFontLucida->uFontHeight) + 13; + y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 24, y, pWeaponSkills, 9, 400, pGlobalTXT_LocalizationStrings[242]); // "Weapons" + + y += 2 * LOBYTE(pFontLucida->uFontHeight) - 10; + CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 24, y, pMagicSkills, 9, 400, pGlobalTXT_LocalizationStrings[138]); // "Magic" + + y = 2 * LOBYTE(pFontLucida->uFontHeight) + 13; + y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 248, y, pArmorSkills, 5, 177, pGlobalTXT_LocalizationStrings[11]); // "Armor" + + y += 2 * LOBYTE(pFontLucida->uFontHeight) - 10; + y = CharacterUI_SkillsTab_Draw__DrawSkillTable(player, 248, y, pMiscSkills, 12, 177, pGlobalTXT_LocalizationStrings[143]); //"Misc" } + + + + unsigned int GetAwardColor(unsigned int priority) { @@ -685,201 +314,109 @@ - //----- (0041A2C1) -------------------------------------------------------- - unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels) - { - if ( (signed int)uNumPixels < 14 ) - uNumPixels = 14; - return ((signed int)(uNumPixels - 14) >> 5) + 1; - } +//----- (0041A2C1) -------------------------------------------------------- +unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels) +{ + if ( (signed int)uNumPixels < 14 ) + uNumPixels = 14; + return ((signed int)(uNumPixels - 14) >> 5) + 1; +} - //----- (0041A2D1) -------------------------------------------------------- - void __fastcall CharacterUI_InventoryTab_Draw(unsigned int uPlayerID, char a2) - { - Player *pPlayer; // esi@1 - char v3; // bl@1 - unsigned int v4; // eax@2 - ItemGen *pItem; // ebx@5 - unsigned int v6; // eax@6 +//----- (0041A2D1) -------------------------------------------------------- +void CharacterUI_InventoryTab_Draw(Player *player, bool a2) +{ Texture *v7; // esi@6 - __int16 v8; // ax@6 - signed int v9; // edi@6 - signed int v10; // ecx@6 signed int v11; // edx@6 - signed int v12; // eax@11 int v13; // eax@13 signed int v14; // edx@13 int v15; // eax@13 - unsigned int v16; // ebx@15 unsigned int v17; // edi@15 Texture *pTexture; // ebx@24 - double v19; // st7@26 - const char *v20; // [sp-8h] [bp-40h]@20 - Player *pPlayer2; // [sp+14h] [bp-24h]@1 - int uTextureId; // [sp+18h] [bp-20h]@6 - int *v23; // [sp+1Ch] [bp-1Ch]@1 - int v24; // [sp+20h] [bp-18h]@5 - ItemGen *pItem2; // [sp+24h] [bp-14h]@5 - int v26; // [sp+28h] [bp-10h]@3 - unsigned int uCellID; // [sp+2Ch] [bp-Ch]@3 unsigned int uCellX; // [sp+30h] [bp-8h]@5 unsigned int uCellY; // [sp+34h] [bp-4h]@5 - v23 = pRenderer->pActiveZBuffer; - pPlayer = pPlayers[uPlayerID]; - v3 = a2; - pPlayer2 = pPlayers[uPlayerID]; - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_507958)); - if ( v3 ) - { - v4 = pIcons_LOD->LoadTexture("fr_strip", TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(8u, 0x131u, pIcons_LOD->GetTexture(v4)); - } - uCellID = 0; - v26 = (int)pPlayer->pInventoryIndices; - do - { - if ( *(int *)v26 > 0 ) - { - v24 = *(int *)v26 - 1; - uCellY = 32 * (uCellID / 14) + 17; - pItem = &pPlayer->pInventoryItems[v24]; - uCellX = 32 * (uCellID % 14) + 14; - pItem2 = pItem; - if ( pItem->uItemID ) - { - v6 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pItem->uItemID].pIconName, TEXTURE_16BIT_PALETTE); - uTextureId = v6; - v7 = pIcons_LOD->GetTexture(v6); - v8 = v7->uTextureWidth; - v9 = v7->uTextureHeight; - v10 = v7->uTextureWidth; + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_CharacterUI_InventoryBackground)); + if (a2) + pRenderer->DrawTextureIndexed(8, 305, pIcons_LOD->LoadTexturePtr("fr_strip", TEXTURE_16BIT_PALETTE)); + + int i = 0; + for (uint i = 0; i < 126; ++i) + { + int v26 = (int)(player->pInventoryIndices + i); + + if (player->pInventoryIndices[i] <= 0) + continue; + + int item_idx = player->pInventoryIndices[i]; + auto item = &player->pInventoryItems[item_idx - 1]; + if (!item->uItemID) + continue; + + uCellY = 32 * (i / 14) + 17; + uCellX = 32 * (i % 14) + 14; + + uint item_texture_id = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + v7 = pIcons_LOD->GetTexture(item_texture_id); + v11 = v7->uTextureWidth; - if ( v10 < 14 ) + if (v11 < 14) v11 = 14; - if ( (v11 - 14) >> 5 == 0 && v8 < 32 ) - uCellX += (32 - v10) / 2; - v12 = v7->uTextureWidth; - if ( v10 < 14 ) - v12 = 14; - v13 = v12 - 14; - v14 = v7->uTextureHeight; + + if ( (v11 - 14) / 32 == 0 && v7->uTextureWidth < 32) + uCellX += (32 - v7->uTextureWidth) / 2; + v13 = v11 - 14; LOBYTE(v13) = v13 & 0xE0; v15 = v13 + 32; - if ( v9 < 14 ) + v14 = v7->uTextureHeight; + if (v14 < 14 ) v14 = 14; - v16 = pItem->uAttributes; - v17 = uCellX + ((v15 - v10) >> 1) + pSRZBufferLineOffsets[uCellY + ((((v14 - 14) & 0xFFFFFFE0) - v9 + 32) >> 1)]; - if ( !(v16 & 0xF0) ) - { - if (pItem->Identified() || pCurrentScreen != SCREEN_HOUSE ) - { - if (pItem->Broken()) - pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7); - else - pRenderer->DrawTextureTransparent(uCellX, uCellY, v7); - } - else - { - pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7); - } - ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1); - pPlayer = pPlayer2; - //goto LABEL_34; - ++uCellID; - v26 += 4; - continue; - } - if ( (unsigned __int8)(v16 & 0xF0) != 16 ) - { - if ( (unsigned __int8)(v16 & 0xF0) == 32 ) - { - v20 = "sp28a"; - pTexture = pIcons_LOD->LoadTexturePtr(v20, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) - { - dword_50C9A8 = 0; - LOBYTE(pItem2->uAttributes) &= 0xFu; - ptr_50C9A4 = 0; - } - v19 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255); - ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1); - pPlayer = pPlayer2; - //goto LABEL_34; - ++uCellID; - v26 += 4; - continue; - } - if ( (unsigned __int8)(v16 & 0xF0) == 64 ) - { - v20 = "sp30a"; - pTexture = pIcons_LOD->LoadTexturePtr(v20, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) - { - dword_50C9A8 = 0; - LOBYTE(pItem2->uAttributes) &= 0xFu; - ptr_50C9A4 = 0; - } - v19 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255); - ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1); - pPlayer = pPlayer2; - //goto LABEL_34; - ++uCellID; - v26 += 4; - continue; - } - if ( (unsigned __int8)(v16 & 0xF0) == 128 ) - { - v20 = "sp91a"; - pTexture = pIcons_LOD->LoadTexturePtr(v20, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) - { - dword_50C9A8 = 0; - LOBYTE(pItem2->uAttributes) &= 0xFu; - ptr_50C9A4 = 0; - } - v19 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255); - ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1); - pPlayer = pPlayer2; - //goto LABEL_34; - ++uCellID; - v26 += 4; - continue; - } - } - v20 = "sptext01"; - pTexture = pIcons_LOD->LoadTexturePtr(v20, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) - { - dword_50C9A8 = 0; - LOBYTE(pItem2->uAttributes) &= 0xFu; - ptr_50C9A4 = 0; - } - v19 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, (signed __int64)v19, 0, 255); - ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1); - pPlayer = pPlayer2; - } - } - //LABEL_34: - ++uCellID; - v26 += 4; - } - while ( uCellID < 126 ); - } + v17 = uCellX + ((v15 - v7->uTextureWidth) >> 1) + pSRZBufferLineOffsets[uCellY + ((((v14 - 14) & 0xFFFFFFE0) - v7->uTextureHeight + 32) >> 1)]; + + + if (!(item->uAttributes & 0xF0)) + { + if (item->Identified() || pCurrentScreen != SCREEN_HOUSE) + { + if (item->Broken()) + pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7); + else + pRenderer->DrawTextureTransparent(uCellX, uCellY, v7); + } + else + pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7); - //----- (0041A556) -------------------------------------------------------- - void __cdecl draw_leather() - { - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather)); - } + ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx); + continue; + } + else + { + switch (item->uAttributes & 0xF0) + { + case ITEM_AURA_EFFECT_RED: pTexture = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break; + case ITEM_AURA_EFFECT_BLUE: pTexture = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE); break; + case ITEM_AURA_EFFECT_GREEN: pTexture = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE); break; + case ITEM_AURA_EFFECT_PURPLE: pTexture = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE); break; + } + + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if (_50C9A8_item_enchantment_timer <= 0) + { + _50C9A8_item_enchantment_timer = 0; + LOBYTE(item->uAttributes) &= 0xF; + ptr_50C9A4 = 0; + } + + pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, GetTickCount() * 0.1, 0, 255); + ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx); + } + } +} + +//----- (0041A556) -------------------------------------------------------- +void draw_leather() +{ + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather)); +} //----- (0041A57E) -------------------------------------------------------- void QuickRefDraw() @@ -1101,7 +638,7 @@ CharacterUI_SkillScreen_Draw(); } sub_419379(); - CharacterUI_SkillsTab_Draw(uPlayerIdx); + CharacterUI_SkillsTab_Draw(pPlayers[uPlayerIdx]); v6 = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE); pTexture = pIcons_LOD->GetTexture(v6); pButton = pCharacterScreen_SkillsBtn; @@ -1120,7 +657,7 @@ case WINDOW_CharacterWindow_Inventory: // inventory and other sub_4196A0(); sub_419379(); - CharacterUI_InventoryTab_Draw(uPlayerIdx, 0); + CharacterUI_InventoryTab_Draw(pPlayers[uPlayerIdx], false); v2 = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE); pTexture = pIcons_LOD->GetTexture(v2); pButton = pCharacterScreen_InventoryBtn; @@ -1349,10 +886,10 @@ if ( (item_MainHand4->uAttributes & 0xF0) == 128 ) v167 = "sp91a"; v16 = pIcons_LOD->LoadTexturePtr(v167, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item_MainHand4->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -1396,10 +933,10 @@ if ( (itemBow->uAttributes & 0xF0) == 128 ) v168 = "sp91a"; a2b = pIcons_LOD->LoadTexturePtr(v168, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; itemBow->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -1458,10 +995,10 @@ if ( (item_Cloak->uAttributes & 0xF0) == 128 ) v169 = "sp91a"; v39 = pIcons_LOD->LoadTexturePtr(v169, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item_Cloak->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -1526,10 +1063,10 @@ if ( (item_Armor->uAttributes & 0xF0) == 128 ) v170 = "sp91a"; v51 = pIcons_LOD->LoadTexturePtr(v170, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item_Armor->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -1582,10 +1119,10 @@ if ( (item_Armor->uAttributes & 0xF0) == 128 ) v173 = "sp91a"; v96 = (char *)pIcons_LOD->LoadTexturePtr(v173, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item_Armor->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -1627,10 +1164,10 @@ if ( (item_Armor->uAttributes & 0xF0) == 128 ) v178 = "sp91a"; v96 = (char *)pIcons_LOD->LoadTexturePtr(v178, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item_Armor->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -1691,10 +1228,10 @@ if ( (item_Boot->uAttributes & 0xF0) == 128 ) v171 = "sp91a"; v63 = pIcons_LOD->LoadTexturePtr(v171, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item_Boot->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -1762,10 +1299,10 @@ if ( (item_Belt->uAttributes & 0xF0) == 128 ) v172 = "sp91a"; v77 = pIcons_LOD->LoadTexturePtr(v172, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item_Belt->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -1837,10 +1374,10 @@ if ( (item_CloakCollar->uAttributes & 0xF0) == 128 ) v179 = "sp91a"; a2i = pIcons_LOD->LoadTexturePtr(v179, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item_CloakCollar->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -1901,10 +1438,10 @@ if ( (item_Helm->uAttributes & 0xF0) == 128 ) v180 = "sp91a"; v129 = pIcons_LOD->LoadTexturePtr(v180, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item_Helm->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -1965,10 +1502,10 @@ if ( (item_MainHand3->uAttributes & 0xF0) == 128 ) v182 = "sp91a"; v140 = pIcons_LOD->LoadTexturePtr(v182, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item_MainHand3->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -2037,10 +1574,10 @@ if ( (item_Shield->uAttributes & 0xF0) == 128 ) v183 = "sp91a"; v157 = pIcons_LOD->LoadTexturePtr(v183, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item_Shield->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -2114,10 +1651,10 @@ if ( (item->uAttributes & 0xF0) == 128 ) spell_texture_name = "sp91a"; spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -2159,10 +1696,10 @@ if ( (item->uAttributes & 0xF0) == 128 ) spell_texture_name = "sp91a"; spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -2207,10 +1744,10 @@ if ( (item->uAttributes & 0xF0) == 128 ) spell_texture_name = "sp91a"; spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE); - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if ( _50C9A8_item_enchantment_timer <= 0 ) { - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; item->uAttributes &= 0xFu; ptr_50C9A4 = 0; } @@ -2589,11 +2126,11 @@ } while ( v17 <= &pMiscSkills[11] ); if ( a2 ) - pGUIWindow_CurrentMenu->_41D08F(a2, 1, 0, a5); + pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(a2, 1, 0, a5); } //----- (00418511) -------------------------------------------------------- -char __fastcall CharacterUI_StatsTab_Draw(unsigned int uPlayerID) +char CharacterUI_StatsTab_Draw(unsigned int uPlayerID) { Player *pPlayer; // edi@1 unsigned int v4; // eax@2
--- a/UIHouses.cpp Mon May 13 09:39:49 2013 +0600 +++ b/UIHouses.cpp Mon May 13 09:39:58 2013 +0600 @@ -24,6 +24,7 @@ #include "Log.h" #include "MM7.h" #include "mm7_data.h" +#include "Game.h" int uHouse_ExitPic; // weak @@ -1902,7 +1903,7 @@ dword_5B65BC = 0; _5B65B4_npcdata_loword_house_or_other = v5->arrival_rot_y; v11 = *((int *)v5 + 3); - uGameState = 2; + uGameState = GAME_STATE_2; _5B65A8_npcdata_uflags_or_other = v11; _5B65AC_npcdata_fame_or_other = v5->arrival_y; _5B65B0_npcdata_rep_or_other = v5->arrival_z; @@ -3016,7 +3017,7 @@ case HOUSE_DIALOGUE_SHOP_SELL: { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) return; @@ -3035,7 +3036,7 @@ case HOUSE_DIALOGUE_SHOP_IDENTIFY: { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) return; @@ -3063,7 +3064,7 @@ case HOUSE_DIALOGUE_SHOP_REPAIR: { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) return; @@ -3084,7 +3085,7 @@ case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];//sell pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];//identify pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];//repair @@ -3574,7 +3575,7 @@ case HOUSE_DIALOGUE_SHOP_SELL: { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) return; @@ -3592,7 +3593,7 @@ case HOUSE_DIALOGUE_SHOP_IDENTIFY: { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) return; @@ -3618,7 +3619,7 @@ case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; all_text_height = 0; @@ -4172,7 +4173,7 @@ case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" @@ -4210,7 +4211,7 @@ case HOUSE_DIALOGUE_SHOP_SELL: { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) return; @@ -4230,7 +4231,7 @@ case HOUSE_DIALOGUE_SHOP_IDENTIFY: { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -4264,7 +4265,7 @@ case HOUSE_DIALOGUE_SHOP_REPAIR: { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) return; @@ -5902,7 +5903,7 @@ if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell" pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify" pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair" @@ -5941,7 +5942,7 @@ if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_SELL) { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() || (v11 = pMouse->GetCursorPos(&v107)->x - 14, @@ -5961,7 +5962,7 @@ if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_IDENTIFY) { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -5998,7 +5999,7 @@ if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_REPAIR) { draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() || (pTextHeight = pMouse->GetCursorPos(&v110)->x - 14,
--- a/UIOptions.cpp Mon May 13 09:39:49 2013 +0600 +++ b/UIOptions.cpp Mon May 13 09:39:58 2013 +0600 @@ -369,9 +369,9 @@ switch (uTurnSpeed) { - default: pRenderer->DrawTextureIndexed(BtnTurnCoord[0], 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])); - case 64: pRenderer->DrawTextureIndexed(BtnTurnCoord[1], 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])); - case 128: pRenderer->DrawTextureIndexed(BtnTurnCoord[2], 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])); + case 64: pRenderer->DrawTextureIndexed(BtnTurnCoord[1], 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])); break; + case 128: pRenderer->DrawTextureIndexed(BtnTurnCoord[2], 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])); break; + default: pRenderer->DrawTextureIndexed(BtnTurnCoord[0], 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])); break; } if (bWalkSound) pRenderer->DrawTextureIndexed( 20, 303, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound));
--- a/UIPartyCreation.cpp Mon May 13 09:39:49 2013 +0600 +++ b/UIPartyCreation.cpp Mon May 13 09:39:58 2013 +0600 @@ -132,7 +132,7 @@ return result; } //----- (00495B39) -------------------------------------------------------- -void __cdecl PlayerCreationUI_Draw() +void PlayerCreationUI_Draw() { int pTextCenter; // eax@3 IconFrame *pFrame; // eax@3 @@ -185,7 +185,18 @@ pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos, 2, pTexture_MAKESKY); pRenderer->DrawTextureIndexed(uPlayerCreationUI_SkySliderPos - 640, 2, pTexture_MAKESKY); pRenderer->DrawTextureTransparent(0, 0, pTexture_MAKETOP); + uPlayerCreationUI_SelectedCharacter = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) / 7; + switch (uPlayerCreationUI_SelectedCharacter) + { + case 0: pX = 12; break; + case 1: pX = 171; break; + case 2: pX = 329; break; + case 3: pX = 488; break; + default: + assert(false && "Invalid selected character"); + } + pTextCenter = pFontCChar->AlignText_Center(640, pGlobalTXT_LocalizationStrings[51]); pGUIWindow_CurrentMenu->DrawText(pFontCChar, pTextCenter + 1, 0, 0, pGlobalTXT_LocalizationStrings[51], 0, 0, 0); pRenderer->DrawTextureTransparent(17, 35, pPlayerPortraits[pParty->pPlayers[0].uFace]); @@ -193,31 +204,14 @@ pRenderer->DrawTextureTransparent(335, 35, pPlayerPortraits[pParty->pPlayers[2].uFace]); pRenderer->DrawTextureTransparent(494, 35, pPlayerPortraits[pParty->pPlayers[3].uFace]); pFrame = pIconsFrameTable->GetFrame(uIconID_CharacterFrame, pEventTimer->uStartTime); - switch ( uPlayerCreationUI_SelectedCharacter ) - { - case 0: - pX = 12; - break; - case 1: - pX = 171; - break; - case 2: - pX = 329; - break; - case 3: - pX = 488; - break; - default: - assert(false);//if click "Knight" crash - //pX = v123; - break; - } + pRenderer->DrawTextureTransparent(pX, 29, &pIcons_LOD->pTextures[pFrame->uTextureID]); uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->pCurrentPosActiveItem); uPlayerCreationUI_ArrowAnim = 19 - (GetTickCount() % 500) / 25; pRenderer->DrawTextureTransparent(uPosActiveItem->uZ - 4, uPosActiveItem->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim]); pRenderer->DrawTextureTransparent(uPosActiveItem->uX - 12, uPosActiveItem->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim]); + memset(pText, 0, 200); strcpy(pText, pGlobalTXT_LocalizationStrings[205]);// "Skills" uNumLet = strlen(pText) - 1; @@ -605,10 +599,10 @@ } while ( (signed int)uXb < 640 ); - pGUIWindow_CurrentMenu->CreateButton( 5, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 0, 0x31u, "", 0); - pGUIWindow_CurrentMenu->CreateButton(163, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 1, 0x32u, "", 0); - pGUIWindow_CurrentMenu->CreateButton(321, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 2, 0x33u, "", 0); - pGUIWindow_CurrentMenu->CreateButton(479, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 3, 0x34u, "", 0); + pGUIWindow_CurrentMenu->CreateButton( 5, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 0, '1', "", 0); + pGUIWindow_CurrentMenu->CreateButton(163, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 1, '2', "", 0); + pGUIWindow_CurrentMenu->CreateButton(321, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 2, '3', "", 0); + pGUIWindow_CurrentMenu->CreateButton(479, 21, 153, 365, 1, 0, UIMSG_PlayerCreation_SelectAttribute, 3, '4', "", 0); uXc = 23; uControlParamc = 2; @@ -625,7 +619,8 @@ uXc += 158; } while ( (signed int)uControlParamc < 30 ); - pGUIWindow_CurrentMenu->_41D08F(28, 0, 7, 40); + pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(28, 0, 7, 40); + pGUIWindow_CurrentMenu->CreateButton(323, 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0, 0, "", 0); pGUIWindow_CurrentMenu->CreateButton(323, v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0xC, 0, "", 0); pGUIWindow_CurrentMenu->CreateButton(323, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x14, 0, "", 0); @@ -635,6 +630,7 @@ pGUIWindow_CurrentMenu->CreateButton(453, 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 0x10, 0, "", 0); pGUIWindow_CurrentMenu->CreateButton(453, v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 8, 0, "", 0); pGUIWindow_CurrentMenu->CreateButton(453, 2 * v0 + 417, 65, v0, 1, 0, UIMSG_PlayerCreationSelectClass, 4, 0, "", 0); + uControlParamd = 0; do { @@ -646,6 +642,7 @@ ++uControlParamd; } while ( uControlParamd < 9 ); + pPlayerCreationUI_BtnOK = pGUIWindow_CurrentMenu->CreateButton(580, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickOK, 0, 0xD, "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE), 0); pPlayerCreationUI_BtnReset = pGUIWindow_CurrentMenu->CreateButton(527, 431, 51, 39, 1, 0, UIMSG_PlayerCreationClickReset, 0, 0x43, "", pIcons_LOD->GetTexture(uTextureID_BUTTMAKE2), 0); pPlayerCreationUI_BtnMinus = pGUIWindow_CurrentMenu->CreateButton(523, 393, 20, 35, 1, 0, UIMSG_PlayerCreationClickMinus, 0, 0x2D, "", pTexture_buttminu, 0); @@ -656,16 +653,16 @@ // 4E28F8: using guessed type int pCurrentScreen; //----- (0049750E) -------------------------------------------------------- -void __cdecl DeleteCCharFont() +void DeleteCCharFont() { pAllocator->FreeChunk(pFontCChar); pFontCChar = 0; } //----- (00497526) -------------------------------------------------------- -bool __cdecl PlayerCreationUI_Loop() +bool PlayerCreationUI_Loop() { //RGBTexture *pTexture; // ebx@1 - UINT v1; // esi@1 + //UINT v1; // esi@1 unsigned int v2; // ecx@3 LONG uMouseX; // edi@6 LONG uMouseY; // eax@6 @@ -694,7 +691,6 @@ //Player *pPlayer; //pTexture = &pTexture_PCX; - v1 = 0; v26 = 0; pTexture_PCX.Release(); pTexture_PCX.Load("makeme.pcx", 0); @@ -706,7 +702,7 @@ SetCurrentMenuID((MENU_STATE)v2); while ( GetCurrentMenuID() == MENU_CREATEPARTY ) { - if ( pAsyncMouse != (void *)v1 ) + if (pAsyncMouse) pAsyncMouse->_46B736_consume_click_lists(1); uMouseX = pMouse->GetCursorPos(&v25)->x; uMouseY = pMouse->GetCursorPos(&v25)->y; @@ -730,7 +726,7 @@ while ( pControlsHead != (GUIButton *)v1 ); }*/ - while ( PeekMessageA(&Msg, (HWND)v1, v1, v1, PM_REMOVE) ) + while ( PeekMessageA(&Msg, 0, 0, 0, PM_REMOVE) ) { if ( Msg.message == WM_QUIT ) Game_DeinitializeAndTerminate(0); @@ -749,20 +745,20 @@ GUI_UpdateWindows(); pRenderer->EndScene(); pRenderer->Present(); - if ( uGameState == 1 ) + if ( uGameState == GAME_FINISHED )//if click Esc in PlayerCreation Window { v26 = 1; - v2 = 0; + //v2 = 0; //goto LABEL_27; - SetCurrentMenuID((MENU_STATE)v2); + SetCurrentMenuID(MENU_MAIN); continue; } - if ( uGameState == 6 ) + if ( uGameState == GAME_STATE_STARTING_NEW_GAME )//if click OK in PlayerCreation Window { - uGameState = v1; - v2 = 1; + uGameState = GAME_STATE_PLAYING; + //v2 = 1; //goto LABEL_27; - SetCurrentMenuID((MENU_STATE)v2); + SetCurrentMenuID(MENU_NEWGAME); continue; } } @@ -771,6 +767,7 @@ pGUIWindow_CurrentMenu->Release(); pIcons_LOD->_4114F2(); + int v1 = 0; memset(v20, 0, 32); do { @@ -893,7 +890,7 @@ for (uint k = 0; k < 138; k++) { - if (&player->pInventoryItems[k]) + if (player->pInventoryItems[k].uItemID) player->pInventoryItems[k].SetIdentified(); } }
--- a/UIPopup.cpp Mon May 13 09:39:49 2013 +0600 +++ b/UIPopup.cpp Mon May 13 09:39:58 2013 +0600 @@ -1395,7 +1395,7 @@ //----- (00417BB5) -------------------------------------------------------- -const char *__fastcall CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType) +const char *CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType) { //enum PLAYER_SKILL_TYPE v2; // esi@1 //unsigned int v3; // ebx@1 @@ -1735,7 +1735,7 @@ sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription); break; case 26: - __debugbreak; + __debugbreak(); //_y = (Player *)(4 * pPlayers[uActiveCharacter]->classType); //v24 = *(char **)((char *)_y->pConditions + (int)pClassNames); //v7 = *(char **)((char *)_y->pConditions + (int)pClassDescriptions); @@ -1848,7 +1848,7 @@ ItemGen *v8; // ecx@70 unsigned int v9; // eax@72 unsigned int v10; // eax@76 - char v11; // zf@83 + //char v11; // zf@83 GUIButton *pButton; // esi@84 unsigned int v13; // ecx@85 char *pStr; // edi@85 @@ -2079,7 +2079,7 @@ } case SCREEN_CHARACTERS: case SCREEN_E: - case SCREEN_F: + case SCREEN_CHEST_INVENTORY: { if ( (signed int)pX > 467 && pCurrentScreen != SCREEN_E ) { @@ -2096,11 +2096,10 @@ CharacterUI_SkillsTab_ShowHint(); } else - { - v11 = pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103;//2DEvent - CharacerScreenInventory - if ( v11 ) - identify_item(); - } + { + if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 103 )//2DEvent - CharacerScreenInventory + identify_item(); + } break; } case SCREEN_SPELL_BOOK:
--- a/UiGame.cpp Mon May 13 09:39:49 2013 +0600 +++ b/UiGame.cpp Mon May 13 09:39:58 2013 +0600 @@ -1871,7 +1871,7 @@ || pCurrentScreen == SCREEN_CHEST || pCurrentScreen == SCREEN_SAVEGAME || pCurrentScreen == SCREEN_LOADGAME - || pCurrentScreen == SCREEN_F + || pCurrentScreen == SCREEN_CHEST_INVENTORY || pCurrentScreen == SCREEN_BOOKS || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) {
--- a/mm7_1.cpp Mon May 13 09:39:49 2013 +0600 +++ b/mm7_1.cpp Mon May 13 09:39:58 2013 +0600 @@ -99,273 +99,266 @@ j->uY = dword_506988; j->uZ = dword_506984; j->uW = dword_506980; - pGUIWindow_CurrentMenu->_41D08F(1, 0, 0, 0); + pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0); } } } } //----- (0041CD4F) -------------------------------------------------------- -bool __thiscall sub_41CD4F(unsigned int _this) +bool UI_OnKeyDown(unsigned int vkKey) { - unsigned int v1; // edi@1 - unsigned int v2; // eax@2 + //unsigned int v1; // edi@1 + //unsigned int v2; // eax@2 int v3; // esi@3 int v4; // ecx@10 - GUIButton *v5; // eax@11 + GUIButton *pButton; // eax@11 int v6; // edx@12 int v7; // ecx@20 char v8; // zf@21 - GUIButton *v9; // ecx@24 + //GUIButton *v9; // ecx@24 int v10; // esi@24 //int v11; // edx@26 int v12; // edx@28 int v13; // esi@32 - GUIButton *v14; // eax@37 + //GUIButton *v14; // eax@37 int v15; // edx@38 int v17; // ecx@50 int v18; // edx@50 - GUIButton *v19; // ecx@54 + //GUIButton *v19; // ecx@54 int v20; // esi@54 //int v21; // edx@56 int v22; // ecx@59 int v23; // edx@59 int v24; // ecx@60 int v25; // esi@63 - unsigned int v26; // [sp+Ch] [bp-14h]@1 - int v27; // [sp+10h] [bp-10h]@1 + //unsigned int v26; // [sp+Ch] [bp-14h]@1 + //int v27; // [sp+10h] [bp-10h]@1 int v28; // [sp+14h] [bp-Ch]@10 int v29; // [sp+14h] [bp-Ch]@36 unsigned int uClickX; // [sp+18h] [bp-8h]@10 unsigned int uClickY; // [sp+1Ch] [bp-4h]@10 - v1 = 0; - v26 = _this; - v27 = uNumVisibleWindows; + //v1 = 0; + //v27 = uNumVisibleWindows; if ( uNumVisibleWindows < 0 ) - return 0; - v2 = pMessageQueue_50CBD0->uNumMessages; - while ( 1 ) + return false; + //v2 = pMessageQueue_50CBD0->uNumMessages; + for (int i = uNumVisibleWindows; i >= 0; --i) + //while ( 1 ) { - v3 = pVisibleWindowsIdxs[v27] - 1; - if ( pWindowList[v3].field_44 != v1 ) - { - switch(v26) - { - case VK_LEFT: - { - v12 = pWindowList[v3].field_34; - if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) - { - v8 = pCurrentScreen == SCREEN_PARTY_CREATION; - pWindowList[v3].pCurrentPosActiveItem -= v12; - if ( v8 ) - { - pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); - v2 = pMessageQueue_50CBD0->uNumMessages; - } - } - if ( pWindowList[v3].field_30 != v1 ) - { - break; - } - v9 = pWindowList[v3].pControlsHead; - v13 = pWindowList[v3].pCurrentPosActiveItem; - if ( v13 > (signed int)v1 ) - { - do - { - v9 = v9->pNext; - --v13; - } - while ( v13 ); - } + v3 = pVisibleWindowsIdxs[i] - 1; + if (!pWindowList[v3].receives_keyboard_input) + continue; - pMessageQueue_50CBD0->AddMessage(v9->msg, v9->msg_param, v1); - break; - } - case VK_RIGHT: - { - v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34; - if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem ) - { - v8 = pCurrentScreen == SCREEN_PARTY_CREATION; - pWindowList[v3].pCurrentPosActiveItem = v7; - if ( v8 ) - { - pAudioPlayer->PlaySound(SOUND_Button, v1, v1, -1, v1, v1, v1, v1); - v2 = pMessageQueue_50CBD0->uNumMessages; - } - } - if ( pWindowList[v3].field_30 != v1 ) - { - break; - } - v9 = pWindowList[v3].pControlsHead; - v10 = pWindowList[v3].pCurrentPosActiveItem; - if ( v10 > (signed int)v1 ) - { - do - { - v9 = v9->pNext; - --v10; - } - while ( v10 ); - } - pMessageQueue_50CBD0->AddMessage(v9->msg, v9->msg_param, v1); - break; - } - case VK_DOWN: - { - v17 = pWindowList[v3].pStartingPosActiveItem; - v18 = pWindowList[v3].pCurrentPosActiveItem; - if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 ) - pWindowList[v3].pCurrentPosActiveItem = v17; - else - pWindowList[v3].pCurrentPosActiveItem = v18 + 1; - if ( pWindowList[v3].field_30 != v1 ) - return 1; - v19 = pWindowList[v3].pControlsHead; - v20 = pWindowList[v3].pCurrentPosActiveItem; - if ( v20 > (signed int)v1 ) - { - do - { - v19 = v19->pNext; - --v20; - } - while ( v20 ); - } - pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, v1); - return 1; - } - case VK_SELECT: - { - pMouse->GetClickPos(&uClickX, &uClickY); - v4 = pWindowList[v3].pStartingPosActiveItem; - v28 = v4 + pWindowList[v3].pNumPresenceButton; - if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) - { - while ( 1 ) - { - v5 = pWindowList[v3].pControlsHead; - if ( v4 > 0 ) - { - v6 = v4; - do - { - v5 = v5->pNext; - --v6; - } - while ( v6 ); - } - if ( (signed int)uClickX >= (signed int)v5->uX - && (signed int)uClickX <= (signed int)v5->uZ - && (signed int)uClickY >= (signed int)v5->uY - && (signed int)uClickY <= (signed int)v5->uW ) - break; - ++v4; - if ( v4 >= v28 ) - { - v1 = 0; - v2 = pMessageQueue_50CBD0->uNumMessages; - --v27; - if ( v27 < 0 ) - return 0; - continue; - } - } - pWindowList[v3].pCurrentPosActiveItem = v4; - return 1; - } - v2 = pMessageQueue_50CBD0->uNumMessages; - break; - } - case VK_UP: - { - v22 = pWindowList[v3].pCurrentPosActiveItem; - v23 = pWindowList[v3].pStartingPosActiveItem; - if ( v22 <= v23 ) - v24 = pWindowList[v3].pNumPresenceButton + v23 - 1; - else - v24 = v22 - 1; - v8 = pWindowList[v3].field_30 == v1; - pWindowList[v3].pCurrentPosActiveItem = v24; - if ( !v8 ) - return 1; - v19 = pWindowList[v3].pControlsHead; - v25 = pWindowList[v3].pCurrentPosActiveItem; - if ( v25 > (signed int)v1 ) - { - do - { - v19 = v19->pNext; - --v25; - } - while ( v25 ); - } - - pMessageQueue_50CBD0->AddMessage(v19->msg, v19->msg_param, v1); - return 1; - } - case VK_NEXT: - { - if ( pWindowList[v3].field_30 != v1 ) - { - pMouse->GetClickPos(&uClickX, &uClickY); - v4 = pWindowList[v3].pStartingPosActiveItem; - v29 = v4 + pWindowList[v3].pNumPresenceButton; - if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) - { - while ( 1 ) - { - v14 = pWindowList[v3].pControlsHead; - if ( v4 > 0 ) - { - v15 = v4; - do - { - v14 = v14->pNext; - --v15; - } - while ( v15 ); - } - if ( (signed int)uClickX >= (signed int)v14->uX - && (signed int)uClickX <= (signed int)v14->uZ - && (signed int)uClickY >= (signed int)v14->uY - && (signed int)uClickY <= (signed int)v14->uW ) - { - pWindowList[v3].pCurrentPosActiveItem = v4; - return 1; - } - ++v4; - if ( v4 >= v29 ) - { - v1 = 0; - v2 = pMessageQueue_50CBD0->uNumMessages; - break; - } - } - } - else - { - v2 = pMessageQueue_50CBD0->uNumMessages; - } - } - break; - } - default: - { - break; - } - - } - } - --v27; - if ( v27 < 0 ) - return 0; + switch (vkKey) + { + case VK_LEFT: + { + v12 = pWindowList[v3].field_34; + if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) + { + v8 = pCurrentScreen == SCREEN_PARTY_CREATION; + pWindowList[v3].pCurrentPosActiveItem -= v12; + if ( v8 ) + { + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + //v2 = pMessageQueue_50CBD0->uNumMessages; + } + } + if ( pWindowList[v3].field_30 != 0 ) + { + break; + } + pButton = pWindowList[v3].pControlsHead; + v13 = pWindowList[v3].pCurrentPosActiveItem; + if ( v13 > 0) + { + do + { + pButton = pButton->pNext; + --v13; + } + while ( v13 ); + } + pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0); + break; + } + case VK_RIGHT: + { + v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34; + if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem ) + { + v8 = pCurrentScreen == SCREEN_PARTY_CREATION; + pWindowList[v3].pCurrentPosActiveItem = v7; + if ( v8 ) + { + pAudioPlayer->PlaySound(SOUND_Button, 0, 0, -1, 0, 0, 0, 0); + //v2 = pMessageQueue_50CBD0->uNumMessages; + } + } + if ( pWindowList[v3].field_30 != 0 ) + { + break; + } + pButton = pWindowList[v3].pControlsHead; + v10 = pWindowList[v3].pCurrentPosActiveItem; + if ( v10 > 0) + { + do + { + pButton = pButton->pNext; + --v10; + } + while ( v10 ); + } + pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0); + break; + } + case VK_DOWN: + { + v17 = pWindowList[v3].pStartingPosActiveItem; + v18 = pWindowList[v3].pCurrentPosActiveItem; + if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 ) + pWindowList[v3].pCurrentPosActiveItem = v17; + else + pWindowList[v3].pCurrentPosActiveItem = v18 + 1; + if ( pWindowList[v3].field_30 != 0 ) + return true; + pButton = pWindowList[v3].pControlsHead; + v20 = pWindowList[v3].pCurrentPosActiveItem; + if ( v20 > 0) + { + do + { + pButton = pButton->pNext; + --v20; + } + while ( v20 ); + } + pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0); + return true; + } + case VK_SELECT: + { + pMouse->GetClickPos(&uClickX, &uClickY); + v4 = pWindowList[v3].pStartingPosActiveItem; + v28 = v4 + pWindowList[v3].pNumPresenceButton; + if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) + { + while ( 1 ) + { + pButton = pWindowList[v3].pControlsHead; + if ( v4 > 0 ) + { + v6 = v4; + do + { + pButton = pButton->pNext; + --v6; + } + while ( v6 ); + } + if ( (signed int)uClickX >= (signed int)pButton->uX//test for StatsTab in PlayerCreation Window + && (signed int)uClickX <= (signed int)pButton->uZ + && (signed int)uClickY >= (signed int)pButton->uY + && (signed int)uClickY <= (signed int)pButton->uW ) + break; + ++v4; + if ( v4 >= v28 ) + { + //v1 = 0; + //v2 = pMessageQueue_50CBD0->uNumMessages; + //--i; + //if ( i < 0 ) + return false; + //continue; + } + } + pWindowList[v3].pCurrentPosActiveItem = v4; + return true; + } + //v2 = pMessageQueue_50CBD0->uNumMessages; + break; + } + case VK_UP: + { + v22 = pWindowList[v3].pCurrentPosActiveItem; + v23 = pWindowList[v3].pStartingPosActiveItem; + if ( v22 <= v23 ) + v24 = pWindowList[v3].pNumPresenceButton + v23 - 1; + else + v24 = v22 - 1; + v8 = pWindowList[v3].field_30 == 0; + pWindowList[v3].pCurrentPosActiveItem = v24; + if ( !v8 ) + return true; + pButton = pWindowList[v3].pControlsHead; + v25 = pWindowList[v3].pCurrentPosActiveItem; + if ( v25 > 0) + { + do + { + pButton = pButton->pNext; + --v25; + } + while ( v25 ); + } + pMessageQueue_50CBD0->AddMessage(pButton->msg, pButton->msg_param, 0); + return true; + } + case VK_NEXT: + { + if ( pWindowList[v3].field_30 != 0 ) + { + pMouse->GetClickPos(&uClickX, &uClickY); + v4 = pWindowList[v3].pStartingPosActiveItem; + v29 = v4 + pWindowList[v3].pNumPresenceButton; + if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) + { + while ( 1 ) + { + pButton = pWindowList[v3].pControlsHead; + if ( v4 > 0 ) + { + v15 = v4; + do + { + pButton = pButton->pNext; + --v15; + } + while ( v15 ); + } + if ( (signed int)uClickX >= (signed int)pButton->uX + && (signed int)uClickX <= (signed int)pButton->uZ + && (signed int)uClickY >= (signed int)pButton->uY + && (signed int)uClickY <= (signed int)pButton->uW ) + { + pWindowList[v3].pCurrentPosActiveItem = v4; + return true; + } + ++v4; + if ( v4 >= v29 ) + { + //v1 = 0; + //v2 = pMessageQueue_50CBD0->uNumMessages; + break; + } + } + } + else + { + //v2 = pMessageQueue_50CBD0->uNumMessages; + } + } + break; + } + default: + { + break; + } + } } - } //----- (0041D20D) -------------------------------------------------------- @@ -632,7 +625,7 @@ } //----- (00420E01) -------------------------------------------------------- -void __cdecl sub_420E01() +void __cdecl OnChestLeftClick() { int chest_id; // edi@1 POINT *v1; // esi@2 @@ -857,7 +850,7 @@ if ( uActiveCharacter == uPlayerID ) { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - pCurrentScreen = SCREEN_F; + pCurrentScreen = SCREEN_CHEST_INVENTORY; //goto LABEL_28; uActiveCharacter = uPlayerID; return; @@ -877,7 +870,7 @@ uActiveCharacter = uPlayerID; return; } - if ( pCurrentScreen != SCREEN_F ) + if ( pCurrentScreen != SCREEN_CHEST_INVENTORY ) { viewparams->bRedrawGameUI = true; uActiveCharacter = uPlayerID; @@ -890,7 +883,7 @@ if ( uActiveCharacter == uPlayerID ) { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - pCurrentScreen = SCREEN_F; + pCurrentScreen = SCREEN_CHEST_INVENTORY; //goto LABEL_28; uActiveCharacter = uPlayerID; return; @@ -923,7 +916,7 @@ // F8B19C: using guessed type int dword_F8B19C; //----- (00421EA6) -------------------------------------------------------- -void __cdecl sub_421EA6_OnInventoryLeftClick() +void __cdecl OnInventoryLeftClick() { Player *v0; // ebx@1 signed int v1; // eax@2 @@ -1327,6 +1320,9 @@ unsigned __int16 v6; // [sp-4h] [bp-14h]@7 + extern void set_default_ui_skin(); + set_default_ui_skin(); + if (align == PartyAlignment_Evil) { if ( bReplace ) @@ -1364,7 +1360,7 @@ pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-c", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2); @@ -1404,7 +1400,7 @@ uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE); uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE); uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE); - uTextureID_507958 = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); + uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); @@ -1449,7 +1445,7 @@ pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2); @@ -1489,7 +1485,7 @@ uTextureID_PlayerBuff_Hammerhands = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE); uTextureID_PlayerBuff_PainReflection = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE); uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE); - uTextureID_507958 = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); + uTextureID_CharacterUI_InventoryBackground = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); @@ -1545,7 +1541,7 @@ pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uExitCancelTextureId], "ib-bcu-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-b", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-b", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_CharacterUI_InventoryBackground], "fr_inven-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-b", 2);
--- a/mm7_2.cpp Mon May 13 09:39:49 2013 +0600 +++ b/mm7_2.cpp Mon May 13 09:39:58 2013 +0600 @@ -293,7 +293,7 @@ pIcons_LOD->GetTexture(uExitCancelTextureId), 0); pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, UIMSG_0, 0x53u, 0, "", 0); - pDialogueWindow->_41D08F(1, 1, 0, 2); + pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); dialog_menu_id = HOUSE_DIALOGUE_OTHER; v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed ) @@ -438,7 +438,7 @@ pDialogueWindow->CreateButton(0x1E0u, 0xBEu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x56u, 0, "", 0); pDialogueWindow->CreateButton(0x1E0u, 0xDCu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x57u, 0, "", 0); pDialogueWindow->CreateButton(0x1E0u, 0xFAu, 0x8Cu, 0x1Eu, 1, 0, UIMSG_SelectNPCDialogueOption, 0x58u, 0, "", 0); - pDialogueWindow->_41D08F(4, 1, 0, 1); + pDialogueWindow->_41D08F_set_keyboard_control_group(4, 1, 0, 1); } } // F8B1B4: using guessed type int dword_F8B1B4; @@ -907,7 +907,7 @@ if ( pCurrentScreen == SCREEN_E ) { - sub_421EA6_OnInventoryLeftClick(); + OnInventoryLeftClick(); return; } if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) @@ -921,7 +921,7 @@ case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; - sub_421EA6_OnInventoryLeftClick(); + OnInventoryLeftClick(); break; } case HOUSE_DIALOGUE_GUILD_BUY_BOOKS: @@ -5440,28 +5440,17 @@ } //----- (00458244) -------------------------------------------------------- -unsigned int __fastcall SkillToMastery(unsigned __int16 a1) -{ - unsigned int result; // eax@1 - - result = 1; // Normal - if ( HIBYTE(a1) & 1 ) - { - result = 4; // Grandmaster - } - else - { - if ( (a1 & 0x80u) == 0 ) - { - if ( a1 & 0x40 ) - result = 2; // Expert - } - else - { - result = 3; // Master - } - } - return result; +unsigned int SkillToMastery(unsigned int value) +{ + switch (value & 0x1C0) + { + case 0x100: return 4; // Grandmaster + case 0x80: return 3; // Master + case 0x40: return 2; // Expert + case 0x00: return 1; // Normal + default: + assert(false); + } } //----- (0045828B) -------------------------------------------------------- @@ -6283,10 +6272,6 @@ void SaveNewGame() { FILE *v3; // eax@7 - LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3 - LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4 - LOD::Directory save_game_dir; // [sp+12Ch] [bp-4Ch]@9 - LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3 void *pSave; // [sp+170h] [bp-8h]@3 if ( pVideoPlayer->AnyMovieLoaded() ) @@ -6294,21 +6279,24 @@ pSave = pAllocator->AllocNamedChunk(0, 1000000, 0); pNew_LOD->CloseWriteFile(); remove("data\\new.lod"); - this_.Reset(); + + LOD::FileHeader this_; // [sp+Ch] [bp-16Ch]@3 strcpy(this_.LodVersion, "MMVII"); strcpy(this_.LodDescription, "newmaps for MMVII"); this_.LODSize = 100; this_.dword_0000A8 = 0; + + LOD::Directory a3; // [sp+14Ch] [bp-2Ch]@3 a3.dword_000018 = 0; a3.word_00001E = 0; strcpy(a3.pFilename, "current"); pNew_LOD->CreateNewLod(&this_, &a3, "data\\new.lod"); - if ( pNew_LOD->LoadFile("data\\new.lod", 0) ) + if (pNew_LOD->LoadFile("data\\new.lod", false)) { pNew_LOD->CreateTempFile(); pNew_LOD->uNumSubDirs = 0; - pDir.Reset(); - + + LOD::Directory pDir; // [sp+10Ch] [bp-6Ch]@4 for (int i = pGames_LOD->uNumSubDirs / 2; i < pGames_LOD->uNumSubDirs; ++i) { memcpy(&pDir, &pGames_LOD->pSubIndices[i], sizeof(pDir)); @@ -6316,11 +6304,13 @@ fread(pSave, pGames_LOD->pSubIndices[i].uDataSize, 1, v3); pNew_LOD->AppendDirectory(&pDir, pSave); } - save_game_dir.Reset(); + + LOD::Directory save_game_dir; // [sp+12Ch] [bp-4Ch]@9 strcpy(pSavegameHeader[0].pLocationName, "out01.odm"); strcpy(save_game_dir.pFilename, "header.bin"); - save_game_dir.uDataSize = 100; + save_game_dir.uDataSize = sizeof(SavegameHeader); pNew_LOD->AppendDirectory(&save_game_dir, &pSavegameHeader[0]); + pNew_LOD->FixDirectoryOffsets(); pParty->vPrevPosition.y = 0; pParty->vPrevPosition.x = 12552; @@ -6792,7 +6782,7 @@ int v25; // eax@171 int v26; // eax@172 char v27; // al@174 - bool v28; // ebx@201 + //bool v28; // ebx@201 char v29; // dl@209 char v30; // cl@210 bool v31; // ebx@211 @@ -7014,7 +7004,6 @@ case WM_SIZING: return 1; case WM_LBUTTONDOWN: - v28 = 0; if ( pArcomageGame->bGameInProgress ) { if (pAsyncMouse) @@ -7023,13 +7012,8 @@ ArcomageGame::OnMouseClick(0, 1); return DefWindowProcA(hWnd, Msg, wParam, lParam); } - if ( pVideoPlayer->pVideoFrame.pPixels ) - pVideoPlayer->bStopBeforeSchedule = 1; - if ( !pAsyncMouse ) - pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); - if (GetCurrentMenuID() != MENU_CREATEPARTY) - goto LABEL_230; - goto LABEL_229; + goto __handle_mouse_click; + case WM_RBUTTONDOWN: v31 = 0; if ( !pArcomageGame->bGameInProgress ) @@ -7097,8 +7081,8 @@ v30 = 1; ArcomageGame::OnMouseClick(v30, v29); return DefWindowProcA(hWnd, Msg, wParam, lParam); + case WM_LBUTTONDBLCLK: - v28 = 0; if ( pArcomageGame->bGameInProgress ) { if (pAsyncMouse) @@ -7107,34 +7091,31 @@ pArcomageGame->stru1.field_0 = 7; return DefWindowProcA(hWnd, Msg, wParam, lParam); } + +__handle_mouse_click: if ( pVideoPlayer->pVideoFrame.pPixels ) pVideoPlayer->bStopBeforeSchedule = 1; + if ( !pAsyncMouse ) pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); - if ( uCurrentMenuID != 6 ) - goto LABEL_230; - if ( !pAsyncMouse ) - { -LABEL_229: - sub_41CD4F(0x29u); -LABEL_230: - if ( pAsyncMouse == (void *)v28 ) - pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); - } - if ( pGame != (Game *)v28 ) - { - if ( pAsyncMouse != (void *)v28 ) - //goto _def_wnd_proc; - return DefWindowProcA(hWnd, Msg, wParam, lParam); - pGame->PickMouse(512.0, (unsigned __int16)lParam, lParam >> 16, v28, &vis_sprite_filter_3, &vis_door_filter); - } - if ( pAsyncMouse == (void *)v28 ) - { + + if (GetCurrentMenuID() != MENU_CREATEPARTY) + pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); + else + { + UI_OnKeyDown(VK_SELECT); + pMouse->SetMouseClick((unsigned __int16)lParam, lParam >> 16); + } + + if (!pAsyncMouse) + { + if (pGame) + pGame->PickMouse(512.0, (unsigned __int16)lParam, lParam >> 16, false, &vis_sprite_filter_3, &vis_door_filter); + UI_OnMouseLeftClick(0); - return DefWindowProcA(hWnd, Msg, wParam, lParam); - } - //goto _def_wnd_proc; + } return DefWindowProcA(hWnd, Msg, wParam, lParam); + case WM_RBUTTONDBLCLK: v31 = 0; if ( !pArcomageGame->bGameInProgress ) @@ -7292,7 +7273,7 @@ return 0; } if ( !viewparams->field_4C ) - sub_41CD4F(wParam); + UI_OnKeyDown(wParam); return 0; } pArcomageGame->stru1.field_0 = 1; @@ -9391,7 +9372,7 @@ //bool v9; // edx@16 //OtherOverlay *v10; // esi@44 //signed int v11; // edi@44 - unsigned int v12; // ecx@56 + //unsigned int v12; // ecx@56 HANDLE v13; // eax@68 unsigned int startms; // [sp+8h] [bp-24h]@55 RECT Rect; // [sp+Ch] [bp-20h]@15 @@ -9473,21 +9454,17 @@ while ( 1 ) { MainMenu_Loop(); - uGameState = 0; + uGameState = GAME_STATE_PLAYING; //LABEL_21: while ( 1 ) { - switch (uGameState) - { - case GAME_FINISHED: - pGame->Deinitialize(); - return true; - } - if (GetCurrentMenuID() == MENU_FINISHED) - { - uGameState = GAME_FINISHED; - continue; - } + if (uGameState == GAME_FINISHED || + GetCurrentMenuID() == MENU_EXIT_GAME) + { + pGame->Deinitialize(); + return true; + } + if (GetCurrentMenuID() == MENU_NEWGAME) { if ( pAudioPlayer->hAILRedbook ) @@ -9508,13 +9485,17 @@ pGame->pCShow->PlayMovie(MOVIE_Emerald, 0); SaveNewGame(); pGame->Loop(); - if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU ) + + if (uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU) { SetCurrentMenuID(MENU_NEWGAME); - uGameState = 0; + uGameState = GAME_STATE_PLAYING; continue; } - break; + else if (uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU) + break; + + assert(false && "Invalid game state"); } if (GetCurrentMenuID() == MENU_CREDITS) { @@ -9526,7 +9507,7 @@ } if (GetCurrentMenuID() == MENU_5 || GetCurrentMenuID() == MENU_LoadingProcInMainMenu) { - uGameState = 0; + uGameState = GAME_STATE_PLAYING; } else { @@ -9561,24 +9542,22 @@ //LABEL_48: pGame->Loop(); LABEL_49: - if ( uGameState == 3 ) - { - v12 = 5; - SetCurrentMenuID((MENU_STATE)v12); - //goto LABEL_21; - uGameState = 0; + if ( uGameState == GAME_STATE_3 ) + { + SetCurrentMenuID(MENU_5); + uGameState = GAME_STATE_PLAYING; continue; } if ( uGameState == GAME_STATE_NEWGAME_OUT_GAMEMENU ) { SetCurrentMenuID(MENU_NEWGAME); - uGameState = 0; + uGameState = GAME_STATE_PLAYING; continue; } if ( uGameState == GAME_STATE_GAME_QUITTING_TO_MAIN_MENU)// from the loaded game { pAudioPlayer->StopChannels(-1, -1); - uGameState = 0; + uGameState = GAME_STATE_PLAYING; break; } } @@ -9856,20 +9835,20 @@ { switch (m) { - case -1: return L"-1"; - case MENU_MAIN: return L"MENU_MAIN"; - case MENU_NEWGAME: return L"MENU_NEWGAME"; - case MENU_CREDITS: return L"MENU_CREDITS"; - case MENU_SAVELOAD: return L"MENU_SAVELOAD"; - case MENU_FINISHED: return L"MENU_FINISHED"; - case MENU_5: return L"MENU_5"; - case MENU_CREATEPARTY: return L"MENU_CREATEPARTY"; + case -1: return L"-1"; + case MENU_MAIN: return L"MENU_MAIN"; + case MENU_NEWGAME: return L"MENU_NEWGAME"; + case MENU_CREDITS: return L"MENU_CREDITS"; + case MENU_SAVELOAD: return L"MENU_SAVELOAD"; + case MENU_EXIT_GAME: return L"MENU_EXIT_GAME"; + case MENU_5: return L"MENU_5"; + case MENU_CREATEPARTY: return L"MENU_CREATEPARTY"; case MENU_NAMEPANELESC: return L"MENU_NAMEPANELESC"; - case MENU_CREDITSPROC: return L"MENU_CREDITSPROC"; + case MENU_CREDITSPROC: return L"MENU_CREDITSPROC"; case MENU_LoadingProcInMainMenu: return L"MENU_LoadingProcInMainMenu"; - case MENU_10: return L"MENU_10"; + case MENU_10: return L"MENU_10"; case MENU_CREDITSCLOSE: return L"MENU_CREDITSCLOSE"; - default: return L"unk"; + default: return L"unk"; }; }; void SetCurrentMenuID(MENU_STATE uMenu)
--- a/mm7_3.cpp Mon May 13 09:39:49 2013 +0600 +++ b/mm7_3.cpp Mon May 13 09:39:58 2013 +0600 @@ -12873,7 +12873,7 @@ while ( (signed int)v41 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); } } - pRenderer->DrawTextureIndexed(471, 445, (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : 0)); + pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); } //----- (00445C8B) -------------------------------------------------------- @@ -14341,7 +14341,7 @@ if ( _strcmpi(pCurrentMapName, v2) ) SaveGame(1, 0); - uGameState = 2; + uGameState = GAME_STATE_2; strcpy(pCurrentMapName, v2); uLevel_StartingPointType = start_point; }
--- a/mm7_4.cpp Mon May 13 09:39:49 2013 +0600 +++ b/mm7_4.cpp Mon May 13 09:39:58 2013 +0600 @@ -2794,7 +2794,7 @@ LABEL_135: if ( pCurrentScreen != SCREEN_REST && (!v51 || dword_5C35C0) ) - uGameState = 8; + uGameState = GAME_STATE_PARTY_DIED; } if ( uActiveCharacter ) { @@ -7351,11 +7351,9 @@ pInString = (char *)*(&pNPCStats->field_17884 + ((v10 & 3) == 2) + 2 * v9); v11 = pFontArrus->CalcTextHeight(pInString, &a1, 13, 0); v12 = v11 + 7; - pRenderer->_4A6A68( - 8u, - 352 - (v11 + 7), - (Texture *)(uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0), - (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - (v11 + 7)); + pRenderer->_4A6A68(8, 352 - (v11 + 7), + pIcons_LOD->GetTexture(uTextureID_Leather), + pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - (v11 + 7)); pRenderer->DrawTextureIndexed(8u, 347 - v12, pTexture_591428); v13 = FitTextInAWindow(pInString, pFontArrus, &a1, 0xDu, 0); pDialogueWindow->DrawText(pFontArrus, 13, 354 - v12, 0, v13, 0, 0, 0); @@ -7556,11 +7554,9 @@ v47 = pFontCreate; v48 = pFontCreate->CalcTextHeight(current_npc_text, &w, 13, 0) + 7; } - pRenderer->_4A6A68( - 8u, - 352 - v48, - (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0), - (uTextureID_Leather != -1 ? pIcons_LOD->pTextures[uTextureID_Leather].uTextureHeight : 26) - v48); + pRenderer->_4A6A68(8, 352 - v48, + pIcons_LOD->GetTexture(uTextureID_Leather), + pIcons_LOD->GetTexture(uTextureID_Leather)->uTextureHeight - v48); pRenderer->DrawTextureIndexed(8u, 347 - v48, pTexture_591428); v49 = FitTextInAWindow(current_npc_text, v47, &w, 0xDu, 0); a1.DrawText(v47, 13, 354 - v48, 0, v49, 0, 0, 0); @@ -7590,7 +7586,7 @@ CreateButtonInColumn(2, 0x68u); } } - pDialogueWindow->_41D08F(num_buttons, 1, 0, 2); + pDialogueWindow->_41D08F_set_keyboard_control_group(num_buttons, 1, 0, 2); dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; } // F8B1E0: using guessed type int dword_F8B1E0; @@ -7605,13 +7601,13 @@ CreateButtonInColumn(0, 3u); CreateButtonInColumn(1, 4u); CreateButtonInColumn(2, 5u); - pDialogueWindow->_41D08F(3, 1, 0, 2); + pDialogueWindow->_41D08F_set_keyboard_control_group(3, 1, 0, 2); } if ( a1 == 4 ) { CreateButtonInColumn(0, 3u); CreateButtonInColumn(1, 4u); - pDialogueWindow->_41D08F(2, 1, 0, 2); + pDialogueWindow->_41D08F_set_keyboard_control_group(2, 1, 0, 2); } } dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; @@ -7724,7 +7720,7 @@ v10 = 1; v9 = v4; LABEL_42: - pDialogueWindow->_41D08F(v9, v10, v11, v17); + pDialogueWindow->_41D08F_set_keyboard_control_group(v9, v10, v11, v17); goto LABEL_43; } v4 = 2; @@ -7835,7 +7831,7 @@ v1 = 1; } pDialogueWindow->CreateButton(480, 30 * v1 + 160, 140, 30, 1, 0, UIMSG_SelectNPCDialogueOption, 76, 0, pGlobalTXT_LocalizationStrings[406], 0);// - pDialogueWindow->_41D08F(v1 + 1, 1, 0, 1); + pDialogueWindow->_41D08F_set_keyboard_control_group(v1 + 1, 1, 0, 1); } //----- (004B3EF0) -------------------------------------------------------- @@ -7849,7 +7845,7 @@ pBtn_ExitCancel = pDialogueWindow->CreateButton(471, 445, 169, 35, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34], pIcons_LOD->GetTexture(uExitCancelTextureId), 0); // Cancel pDialogueWindow->CreateButton( 0, 0, 0, 0, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", 0); pDialogueWindow->CreateButton(480, 160, 140, 30, 1, 0, UIMSG_ClickNPCTopic, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); - pDialogueWindow->_41D08F(1, 1, 0, 2); + pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); dialog_menu_id = HOUSE_DIALOGUE_OTHER; } // F8B19C: using guessed type int dword_F8B19C; @@ -7873,7 +7869,7 @@ if ( contract_approved ) v2 = pGlobalTXT_LocalizationStrings[535]; pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Fu, 0, v2, 0); - pDialogueWindow->_41D08F(1, 1, 0, 2); + pDialogueWindow->_41D08F_set_keyboard_control_group(1, 1, 0, 2); dialog_menu_id = HOUSE_DIALOGUE_OTHER; } // F8B19C: using guessed type int dword_F8B19C; @@ -7902,7 +7898,7 @@ } pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x4Cu, 0, pGlobalTXT_LocalizationStrings[406], 0); //"Hire" - pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); + pDialogueWindow->_41D08F_set_keyboard_control_group(v0 + 1, 1, 0, 2); dialog_menu_id = HOUSE_DIALOGUE_OTHER; } @@ -8015,7 +8011,7 @@ pDialogueWindow->CreateButton( 0x1E0u, 30 * num_menu_buttons++ + 160, 0x8Cu, 0x1Eu, 1, 0, UIMSG_ClickNPCTopic, 0x18u, 0, "", 0); } } - pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); + pDialogueWindow->_41D08F_set_keyboard_control_group(num_menu_buttons, 1, 0, 2); dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; } dialog_menu_id = HOUSE_DIALOGUE_MAIN;
--- a/mm7_5.cpp Mon May 13 09:39:49 2013 +0600 +++ b/mm7_5.cpp Mon May 13 09:39:58 2013 +0600 @@ -46,7 +46,7 @@ //----- (004304E7) -------------------------------------------------------- void __cdecl GameUI_MsgProc() { - signed int v0; // edi@6 + //signed int v0; // edi@6 char *v1; // esi@6 unsigned int v2; // edx@7 Actor *pActor; // ecx@13 @@ -76,8 +76,8 @@ unsigned int v27; // edx@204 unsigned int v28; // ecx@204 GUIWindow *pWindow2; // ecx@248 - int v30; // edx@258 - const char *v31; // ecx@262 + //int v30; // edx@258 + //const char *v31; // ecx@262 signed int v32; // eax@269 unsigned int v33; // eax@277 unsigned __int8 v34; // al@279 @@ -97,7 +97,7 @@ char v48; // zf@405 BLVFace *pBLVFace; // ecx@410 ODMFace *pODMFace; // ecx@412 - void *v51; // ecx@415 + CastSpellInfo *v51; // ecx@415 void *v52; // eax@424 __int16 v53; // ax@431 int v54; // eax@432 @@ -214,10 +214,10 @@ //int v165; // [sp+0h] [bp-5FCh]@107 int v166; // [sp+0h] [bp-5FCh]@121 int v167; // [sp+0h] [bp-5FCh]@135 - int v168; // [sp+0h] [bp-5FCh]@149 + //int v168; // [sp+0h] [bp-5FCh]@149 int v169; // [sp+0h] [bp-5FCh]@165 int v170; // [sp+0h] [bp-5FCh]@204 - signed int v171; // [sp+0h] [bp-5FCh]@259 + //signed int v171; // [sp+0h] [bp-5FCh]@259 KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287 char *v173; // [sp+0h] [bp-5FCh]@444 char *v174; // [sp+0h] [bp-5FCh]@449 @@ -286,7 +286,7 @@ } if ( pMessageQueue_50CBD0->uNumMessages ) { - v0 = 1; + //v0 = 1; v1 = ""; while ( 2 ) { @@ -297,7 +297,7 @@ switch ( uMessage ) { case UIMSG_ChangeGameState: - uGameState = v0; + uGameState = GAME_FINISHED; continue; case UIMSG_PlayArcomage: pVideoPlayer->_4BF5B2(); @@ -307,13 +307,13 @@ case UIMSG_StartNPCDialogue: if ( !uActiveCharacter ) continue; - viewparams->field_48 = v0; + viewparams->field_48 = 1; if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; dword_5B65D0_dialogue_actor_npc_id = pActors[uMessageParam].sNPC_ID; pActor = &pActors[uMessageParam]; //goto _actor_init_dlg; - pActor->InitializeDialogue(v0); + pActor->InitializeDialogue(1); continue; case UIMSG_StartHireling1Dialogue: case UIMSG_StartHireling2Dialogue: @@ -366,7 +366,7 @@ memset(&actor, 0, 0x344u); actor.sNPC_ID += -1 - (unsigned __int8)pParty->field_709 - hireling_idx; pActor = &actor; - pActor->InitializeDialogue(v0); + pActor->InitializeDialogue(1); } } continue; @@ -394,9 +394,9 @@ if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); - uGameState = 4; + uGameState = GAME_STATE_NEWGAME_OUT_GAMEMENU; pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; } else { @@ -413,7 +413,7 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); pCurrentScreen = SCREEN_LOADGAME; - GameUI_DrawLoadMenu(v0); + GameUI_DrawLoadMenu(1); continue; case UIMSG_Quit: if ( dword_6BE138 == 132 || uMessageParam ) @@ -424,10 +424,10 @@ pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; if ( !uMessageParam ) pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 0, 0, -1, 0, 0, 0, 0); - uGameState = 7; + uGameState = GAME_STATE_GAME_QUITTING_TO_MAIN_MENU; } else { @@ -438,6 +438,7 @@ stru_506E40.Release(); continue; case UIMSG_80: + __debugbreak(); pIcons_LOD->_40F9C5(); pIcons_LOD->_4114F2(); pGUIWindow_CurrentMenu->Release(); @@ -463,7 +464,7 @@ GUIWindow::Create(241, 302, 106, 42, WINDOW_SaveLoadBtn, (int)pBtnLoadSlot, 0); continue; case UIMSG_SelectLoadSlot: - if ( pGUIWindow_CurrentMenu->field_40 == v0 ) + if ( pGUIWindow_CurrentMenu->field_40 == 1 ) pKeyActionMap->_459ED1(0); if ( pCurrentScreen != SCREEN_SAVEGAME || uLoadGameUI_SelectedSlot != pSaveListPosition + uMessageParam ) { @@ -505,12 +506,12 @@ if ( pSavegameUsedSlots[uLoadGameUI_SelectedSlot] ) { LoadGame(uLoadGameUI_SelectedSlot); - uGameState = 3; + uGameState = GAME_STATE_3; } stru_506E40.Release(); continue; case UIMSG_SaveGame: - if ( pGUIWindow_CurrentMenu->field_40 == v0 ) + if ( pGUIWindow_CurrentMenu->field_40 == 1 ) { pKeyActionMap->_459ED1(0); strcpy((char *)&pSavegameHeader[uLoadGameUI_SelectedSlot], (const char *)pKeyActionMap->pPressedKeysBuffer); @@ -527,7 +528,7 @@ if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); - viewparams->field_48 = v0; + viewparams->field_48 = 1; pCurrentScreen = SCREEN_OPTIONS; options_menu_skin.uTextureID_Background = pIcons_LOD->LoadTexture("ControlBG", TEXTURE_16BIT_PALETTE); @@ -555,48 +556,48 @@ pGUIWindow_CurrentMenu->CreateButton(22, 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureWidth, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[2])->uTextureHeight, - v0, 0, UIMSG_SetTurnSpeed, 0x80, 0, v1, 0); + 1, 0, UIMSG_SetTurnSpeed, 0x80, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(93, 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureWidth, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[1])->uTextureHeight, - v0, 0, UIMSG_SetTurnSpeed, 0x40u, 0, v1, 0); + 1, 0, UIMSG_SetTurnSpeed, 0x40u, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(164, 270, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureWidth, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_TurnSpeed[0])->uTextureHeight, - v0, 0, UIMSG_SetTurnSpeed, 0, 0, v1, 0); + 1, 0, UIMSG_SetTurnSpeed, 0, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(20, 303, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureWidth, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_WalkSound)->uTextureHeight, - v0, 0, UIMSG_ToggleWalkSound, 0, 0, v1, 0); + 1, 0, UIMSG_ToggleWalkSound, 0, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(128, 303, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureWidth, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ShowDamage)->uTextureHeight, - v0, 0, UIMSG_ToggleShowDamage, 0, 0, v1, 0); + 1, 0, UIMSG_ToggleShowDamage, 0, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(20, 325, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureWidth, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_AlwaysRun)->uTextureHeight, - v0, 0, UIMSG_ToggleAlwaysRun, 0, 0, v1, 0); + 1, 0, UIMSG_ToggleAlwaysRun, 0, 0, v1, 0); pGUIWindow_CurrentMenu->CreateButton(128, 325, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureWidth, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_FlipOnExit)->uTextureHeight, - v0, 0, UIMSG_ToggleFlipOnExit, 0, 0, v1, 0); - - pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, v0, 0, UIMSG_ChangeSoundVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); - pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, v0, 0, UIMSG_ChangeSoundVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); - pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, v0, 0, UIMSG_ChangeSoundVolume, 0, 0, v1, 0); - - pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, v0, 0, UIMSG_ChangeMusicVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); - pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, v0, 0, UIMSG_ChangeMusicVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); - pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, v0, 0, UIMSG_ChangeMusicVolume, 0, 0, v1, 0); - - pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, v0, 0, UIMSG_ChangeVoiceVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); - pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, v0, 0, UIMSG_ChangeVoiceVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); - pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, v0, 0, UIMSG_ChangeVoiceVolume, 0, 0, v1, 0); - - pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, v0, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game" - pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, v0, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, v1, 0); - pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, v0, 0, UIMSG_OpenVideoOptions, 0, 86, v1, 0); + 1, 0, UIMSG_ToggleFlipOnExit, 0, 0, v1, 0); + + pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); + pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 162, 16, 16, 1, 0, UIMSG_ChangeSoundVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); + pGUIWindow_CurrentMenu->CreateButton(263, 162, 172, 17, 1, 0, UIMSG_ChangeSoundVolume, 0, 0, v1, 0); + + pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); + pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 216, 16, 16, 1, 0, UIMSG_ChangeMusicVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); + pGUIWindow_CurrentMenu->CreateButton(263, 216, 172, 17, 1, 0, UIMSG_ChangeMusicVolume, 0, 0, v1, 0); + + pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(243, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 4, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowLeft), 0); + pBtn_SliderRight = pGUIWindow_CurrentMenu->CreateButton(435, 270, 16, 16, 1, 0, UIMSG_ChangeVoiceVolume, 5, 0, v1, pIcons_LOD->GetTexture(options_menu_skin.uTextureID_ArrowRight), 0); + pGUIWindow_CurrentMenu->CreateButton(263, 270, 172, 17, 1, 0, UIMSG_ChangeVoiceVolume, 0, 0, v1, 0); + + pGUIWindow_CurrentMenu->CreateButton(241, 302, 214, 40, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[619], 0); // "Return to Game" + pGUIWindow_CurrentMenu->CreateButton( 19, 140, 214, 40, 1, 0, UIMSG_OpenKeyMappingOptions, 0, 0x4Bu, v1, 0); + pGUIWindow_CurrentMenu->CreateButton( 19, 194, 214, 40, 1, 0, UIMSG_OpenVideoOptions, 0, 86, v1, 0); continue; case UIMSG_OpenKeyMappingOptions://Open @@ -636,7 +637,7 @@ //*(_WORD *)KeyButtonArray[28] = 0; memcpy(pPrevVirtualCidesMapping, pKeyActionMap->pVirtualKeyCodesMapping, 0x78u); v1 = ""; - v0 = 1; + //v0 = 1; continue; case UIMSG_ChangeKeyButton: if ( dword_506E68 != -1 ) @@ -645,10 +646,10 @@ continue; } v14 = uMessageParam; - if ( KeyboardPageNum != v0 ) + if ( KeyboardPageNum != 1 ) v14 = uMessageParam + 14; dword_506E68 = v14; - pKeyActionMap->EnterText(0, v0, pGUIWindow_CurrentMenu); + pKeyActionMap->EnterText(0, 1, pGUIWindow_CurrentMenu); continue; case UIMSG_ResetKeyMapping: v197 = 1; @@ -662,7 +663,7 @@ if ( v197 ) { v16 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); - GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v16, v0); + GUI_ReplaceHotkey(LOBYTE(pPrevVirtualCidesMapping[uAction]), v16, 1); v197 = 0; } else @@ -681,7 +682,7 @@ pAudioPlayer->PlaySound((SoundID)219, 0, 0, -1, 0, 0, 0, 0); continue; case UIMSG_SelectKeyPage1: - KeyboardPageNum = v0; + KeyboardPageNum = 1; continue; case UIMSG_SelectKeyPage2: KeyboardPageNum = 2; @@ -690,7 +691,7 @@ if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pGUIWindow_CurrentMenu->Release(); - viewparams->field_48 = v0; + viewparams->field_48 = 1; pCurrentScreen = SCREEN_VIDEO_OPTIONS; uTextureID_507C10 = pIcons_LOD->LoadTexture("optvid", TEXTURE_16BIT_PALETTE); uTextureID_507C14 = pIcons_LOD->LoadTexture("opvdH-bs", TEXTURE_16BIT_PALETTE); @@ -712,16 +713,16 @@ uTextureID_507C54 = pIcons_LOD->LoadTexture("opvdG-cl", TEXTURE_16BIT_PALETTE); uTextureID_507C58 = pIcons_LOD->LoadTexture("opvdG-tn", TEXTURE_16BIT_PALETTE); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_VideoOptions, 0, 0); - pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, v0, 0, UIMSG_Escape, 0, 0, v1, 0); + pGUIWindow_CurrentMenu->CreateButton(0xF1u, 0x12Eu, 0xD6u, 0x28u, 1, 0, UIMSG_Escape, 0, 0, v1, 0); if ( pRenderer->pRenderD3D ) { - pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, v0, 0, UIMSG_ToggleBloodsplats, 0, 0, v1, 0); - pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, v0, 0, UIMSG_ToggleColoredLights, 0, 0, v1, 0); - pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, v0, 0, UIMSG_ToggleTint, 0, 0, v1, 0); + pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x118u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleBloodsplats, 0, 0, v1, 0); + pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x12Eu, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleColoredLights, 0, 0, v1, 0); + pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x144u, 0xD6u, 0x12u, 1, 0, UIMSG_ToggleTint, 0, 0, v1, 0); } if ( !pRenderer->bWindowMode ) { - v0 = 1; + //v0 = 1; if ( GammaController::IsGammaSupported() ) { pBtn_SliderLeft = pGUIWindow_CurrentMenu->CreateButton(0x15u, 0xA1u, 0x10u, 0x10u, 1, 0, UIMSG_1A9, 4u, 0, v1, pIcons_LOD->GetTexture(uTextureID_507C20), 0); @@ -731,6 +732,7 @@ } continue; case UIMSG_1A9: + __debugbreak(); if ( uMessageParam == 4 ) { //--uGammaPos; @@ -742,7 +744,7 @@ } v19 = (double)(signed int)uGammaPos * 0.1 + 0.6; pGame->pGammaController->Initialize(v19); - GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, v0); + GUIWindow::Create(21, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1); pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); continue; } @@ -753,7 +755,7 @@ { v21 = (double)(signed int)uGammaPos * 0.1 + 0.6; pGame->pGammaController->Initialize(v21); - GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, v0); + GUIWindow::Create(213, 161, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1); pAudioPlayer->PlaySound((SoundID)21, 0, 0, -1, 0, 0, 0, 0); continue; } @@ -782,7 +784,7 @@ --uMusicVolimeMultiplier; if ( (char)uMusicVolimeMultiplier < 1 ) uMusicVolimeMultiplier = 0; - GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, v0); + GUIWindow::Create(243, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1); if ( uMusicVolimeMultiplier ) pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); @@ -793,7 +795,7 @@ ++uMusicVolimeMultiplier; if ( (char)uMusicVolimeMultiplier > 9 ) uMusicVolimeMultiplier = 9; - GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, v0); + GUIWindow::Create(435, 0xD8u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1); if ( uMusicVolimeMultiplier ) pAudioPlayer->PlaySound(SOUND_Bell, -1, 0, -1, 0, 0, pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f, 0); pAudioPlayer->SetMusicVolume(pSoundVolumeLevels[(char)uMusicVolimeMultiplier] * 64.0f); @@ -812,7 +814,7 @@ --uSoundVolumeMultiplier; if ( (char)uSoundVolumeMultiplier < 1 ) uSoundVolumeMultiplier = 0; - GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, v0); + GUIWindow::Create(243, 162, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1); pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); continue; @@ -822,10 +824,10 @@ ++uSoundVolumeMultiplier; if ( (char)uSoundVolumeMultiplier > 8 ) uSoundVolumeMultiplier = 9; - v168 = v0; + //v168 = 1; v24 = 435; //v154 = (int)pBtn_SliderRight; - GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, v168); + GUIWindow::Create(v24, 0xA2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1); pAudioPlayer->SetMasterVolume(pSoundVolumeLevels[uSoundVolumeMultiplier] * 128.0f); pAudioPlayer->PlaySound((SoundID)218, -1, 0, -1, 0, 0, 0, 0); continue; @@ -854,7 +856,7 @@ --uVoicesVolumeMultiplier; if ( (char)uVoicesVolumeMultiplier < 1 ) uVoicesVolumeMultiplier = 0; - GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, v0); + GUIWindow::Create(243, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderLeft, 1); if ( !uVoicesVolumeMultiplier ) continue; pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); @@ -865,7 +867,7 @@ ++uVoicesVolumeMultiplier; if ( (char)uVoicesVolumeMultiplier > 8 ) uVoicesVolumeMultiplier = 9; - GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, v0); + GUIWindow::Create(435, 270, 0, 0, WINDOW_PressedButton2, (int)pBtn_SliderRight, 1); if ( !uVoicesVolumeMultiplier ) continue; pAudioPlayer->PlaySound((SoundID)5788, -1, 0, -1, 0, 0, pSoundVolumeLevels[uVoicesVolumeMultiplier] * 128.0f, 0); @@ -911,7 +913,7 @@ pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; stru_506E40.Release(); continue; case UIMSG_OpenQuestBook: @@ -973,14 +975,14 @@ back_to_game(); if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - if ( pCurrentScreen > SCREEN_F ) + if ( pCurrentScreen > SCREEN_CHEST_INVENTORY ) { if ( pCurrentScreen >= SCREEN_CHANGE_LOCATION && (pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_QUICK_REFERENCE) ) { if ( dword_50CDC8 ) goto LABEL_232; CloseWindowBackground(); - uMessageParam = v0; + uMessageParam = 1; goto LABEL_232; } } @@ -991,22 +993,22 @@ if ( dword_50CDC8 ) goto LABEL_232; CloseWindowBackground(); - uMessageParam = v0; + uMessageParam = 1; goto LABEL_232; } if ( pCurrentScreen == SCREEN_HOUSE && !dword_50CDC8 && !dword_5C35C8 ) { CloseWindowBackground(); dword_5C35C8 = 0; - uMessageParam = v0; + uMessageParam = 1; } } LABEL_232: if ( !ptr_507BDC ) { pRenderer->ClearZBuffer(0, 479); - viewparams->bRedrawGameUI = v0; - viewparams->field_48 = v0; + viewparams->bRedrawGameUI = 1; + viewparams->field_48 = 1; if ( pCurrentScreen ) { if ( pCurrentScreen > SCREEN_67 ) @@ -1036,7 +1038,7 @@ if ( ptr_50C9A4 && ptr_50C9A4->uItemID ) { LOBYTE(ptr_50C9A4->uAttributes) &= 0xFu; - dword_50C9A8 = 0; + _50C9A8_item_enchantment_timer = 0; ptr_50C9A4 = 0; } if ( pGUIWindow_Settings ) @@ -1055,7 +1057,7 @@ back_to_game(); } } - if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) + if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) @@ -1063,7 +1065,7 @@ pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; pIcons_LOD->_4355F7(); continue; case SCREEN_BOOKS: @@ -1087,7 +1089,7 @@ back_to_game(); } } - if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) + if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) @@ -1095,7 +1097,7 @@ pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; pIcons_LOD->_4355F7(); continue; case SCREEN_SAVEGAME: @@ -1104,7 +1106,7 @@ //crt_deconstruct_ptr_6A0118(); stru_506E40.Release(); break; - case SCREEN_F: + case SCREEN_CHEST_INVENTORY: pCurrentScreen = SCREEN_CHEST; continue; case SCREEN_CHEST: @@ -1112,20 +1114,20 @@ pWindow2->Release(); pIcons_LOD->_4114F2(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; pEventTimer->Resume(); continue; case SCREEN_19: + __debugbreak(); pWindow2 = ptr_507BC8; pWindow2->Release(); pIcons_LOD->_4114F2(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; pEventTimer->Resume(); continue; case SCREEN_OPTIONS://Close options_menu_skin.Relaease(); - pIcons_LOD->_40F9C5(); WriteWindowsRegistryInt("soundflag", (char)uSoundVolumeMultiplier); WriteWindowsRegistryInt("musicflag", (char)uMusicVolimeMultiplier); @@ -1137,19 +1139,13 @@ WriteWindowsRegistryInt("FlipOnExit", bFlipOnExit); if ( !uTurnSpeed ) { - v171 = 3; - v30 = v171; - v31 = "TurnDelta"; - WriteWindowsRegistryInt(v31, v30); + WriteWindowsRegistryInt("TurnDelta", 3); stru_506E40.Release(); break; } if ( uTurnSpeed == 64 ) { - v171 = 2; - v30 = v171; - v31 = "TurnDelta"; - WriteWindowsRegistryInt(v31, v30); + WriteWindowsRegistryInt("TurnDelta", 2); stru_506E40.Release(); break; } @@ -1158,9 +1154,7 @@ stru_506E40.Release(); break; } - v30 = v0; - v31 = "TurnDelta"; - WriteWindowsRegistryInt(v31, v30); + WriteWindowsRegistryInt("TurnDelta", 1); stru_506E40.Release(); break; case SCREEN_MENU: @@ -1182,9 +1176,9 @@ stru_506E40.Release(); break; } - v30 = uGammaPos; - v31 = "GammaPos"; - WriteWindowsRegistryInt(v31, v30); + //v30 = uGammaPos; + //v31 = "GammaPos"; + WriteWindowsRegistryInt("GammaPos", uGammaPos); stru_506E40.Release(); break; case SCREEN_KEYBOARD_OPTIONS://Return to game @@ -1214,7 +1208,7 @@ if ( v197 ) { v34 = pKeyActionMap->GetActionVKey((enum InputAction)uAction); - GUI_ReplaceHotkey(v34, LOBYTE(pPrevVirtualCidesMapping[uAction]), v0); + GUI_ReplaceHotkey(v34, LOBYTE(pPrevVirtualCidesMapping[uAction]), 1); v197 = 0; } else @@ -1223,8 +1217,8 @@ GUI_ReplaceHotkey(v35, LOBYTE(pPrevVirtualCidesMapping[uAction]), 0); } } - if ( uAction && uAction != 2 && uAction != 3 && uAction != v0 && uAction != 25 && uAction != 26 ) - pKeyToggleType = (KeyToggleType)v0; + if ( uAction && uAction != 2 && uAction != 3 && uAction != 1 && uAction != 25 && uAction != 26 ) + pKeyToggleType = (KeyToggleType)1; else pKeyToggleType = (KeyToggleType)0; pKeyActionMap->SetKeyMapping(uAction, pPrevVirtualCidesMapping[uAction], pKeyToggleType); @@ -1254,7 +1248,7 @@ pIcons_LOD->_4114F2(); _506F18_num_hours_to_sleep = 0; dword_506F14 = 0; - dword_507B94 = v0; + dword_507B94 = 1; if ( pGUIWindow_Settings ) { if ( pCurrentScreen == SCREEN_CHARACTERS ) @@ -1271,7 +1265,7 @@ back_to_game(); } } - if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) + if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) @@ -1279,10 +1273,11 @@ pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; pIcons_LOD->_4355F7(); continue; case SCREEN_E: + __debugbreak(); pGUIWindow_CurrentMenu->Release(); pCurrentScreen = SCREEN_HOUSE; pIcons_LOD->_4114F2(); @@ -1290,7 +1285,7 @@ case SCREEN_HOUSE: if ( uDialogueType ) uDialogueType = 0; - if ( uGameState == 2 ) + if ( uGameState == GAME_STATE_2 ) { while ( sub_4BD8B5() ) ; @@ -1301,7 +1296,7 @@ continue; } sub_4B1D27(); - pAudioPlayer->PlaySound((SoundID)(SOUND_EnteringAHouse|0x1), 814, 0, -1, 0, 0, 0, 0); + pAudioPlayer->PlaySound(SOUND_7, 814, 0, -1, 0, 0, 0, 0); pVideoPlayer->Unload(); pGUIWindow_CurrentMenu = window_SpeakInHouse; if ( pGUIWindow_Settings ) @@ -1320,7 +1315,7 @@ back_to_game(); } } - if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) + if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) @@ -1328,10 +1323,10 @@ pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; pIcons_LOD->_4355F7(); continue; - case SCREEN_INPUT_BLV: + case SCREEN_INPUT_BLV://click escape if ( uCurrentHouse_Animation == 153 ) PlayHouseSound(0x99u, HouseSound_Greeting_2); pVideoPlayer->Unload(); @@ -1340,25 +1335,35 @@ pParty->field_709 = 0; LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; Party__CountHirelings(); - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; dword_5B65CC = 0; } - goto LABEL_317; - case SCREEN_NPC_DIALOGUE: + DialogueEnding(); + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = 1; + continue; + case SCREEN_NPC_DIALOGUE://click escape if ( dword_5B65CC ) { pParty->field_709 = 0; LOBYTE(pNPCStats->pNewNPCData[dword_5B65CC].uFlags) &= 0x7Fu; Party__CountHirelings(); - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; dword_5B65CC = 0; } - goto LABEL_317; - case SCREEN_BRANCHLESS_NPC_DIALOG: + //goto LABEL_317; + DialogueEnding(); + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = 1; + continue; + case SCREEN_BRANCHLESS_NPC_DIALOG://click escape memset(GameUI_Footer_TimedString, 0, 0xC8u); sub_4452BB(); - goto LABEL_317; - case SCREEN_CHANGE_LOCATION: + DialogueEnding(); + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = 1; + continue; + case SCREEN_CHANGE_LOCATION://click escape if ( pParty->vPosition.x < -22528 ) pParty->vPosition.x = -22528; if ( pParty->vPosition.x > 22528 ) @@ -1367,7 +1372,10 @@ pParty->vPosition.y = -22528; if ( pParty->vPosition.y > 22528 ) pParty->vPosition.y = 22528; - goto LABEL_317; + DialogueEnding(); + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = 1; + continue; case SCREEN_VIDEO: pVideoPlayer->Unload(); continue; @@ -1390,7 +1398,7 @@ back_to_game(); } } - if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) + if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) @@ -1398,7 +1406,7 @@ pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; pIcons_LOD->_4355F7(); continue; } @@ -1418,7 +1426,7 @@ back_to_game(); } } - if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) + if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) @@ -1426,7 +1434,7 @@ pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; pIcons_LOD->_4355F7(); continue; } @@ -1452,7 +1460,7 @@ back_to_game(); } } - if ( (signed int)uActiveCharacter < v0 || (signed int)uActiveCharacter > 4 ) + if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) uActiveCharacter = pParty->GetNextActiveCharacter(); pGUIWindow_CurrentMenu->Release(); if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) @@ -1460,7 +1468,7 @@ pGUIWindow_CurrentMenu = 0; pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; pIcons_LOD->_4355F7(); continue; } @@ -1468,11 +1476,11 @@ if ( !pGUIWindow_Settings )//Draw Menu { dword_6BE138 = -1; - GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, v0); + GUIWindow::Create(0x25Au, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_GameSettings, 1); pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); ++pIcons_LOD->uTexturePacksCount; - pCurrentScreen = v0; + pCurrentScreen = 1; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_OptionsButtons, 0, 0); @@ -1483,26 +1491,26 @@ uTextureID_Controls1 = pIcons_LOD->LoadTexture("controls1", TEXTURE_16BIT_PALETTE); uTextureID_Resume1 = pIcons_LOD->LoadTexture("resume1", TEXTURE_16BIT_PALETTE); uTextureID_Quit1 = pIcons_LOD->LoadTexture("quit1", TEXTURE_16BIT_PALETTE); - pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, v0, 0, UIMSG_StartNewGame, 0, 0x4Eu, + pBtn_NewGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0x9Bu, 0xD6u, 0x28u, 1, 0, UIMSG_StartNewGame, 0, 0x4Eu, pGlobalTXT_LocalizationStrings[614],// "New Game" pIcons_LOD->GetTexture(uTextureID_New1), 0); - pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, v0, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u, + pBtn_SaveGame = pGUIWindow_CurrentMenu->CreateButton(0x13u, 0xD1u, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenSaveGameDialog, 0, 0x53u, pGlobalTXT_LocalizationStrings[615],// "Save Game" pIcons_LOD->GetTexture(uTextureID_Save1), 0); - pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, v0, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu, + pBtn_LoadGame = pGUIWindow_CurrentMenu->CreateButton(19, 263, 0xD6u, 0x28u, 1, 0, UIMSG_Game_OpenLoadGameDialog, 0, 0x4Cu, pGlobalTXT_LocalizationStrings[616],// "Load Game" pIcons_LOD->GetTexture(uTextureID_Load1), 0); - pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, v0, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u, + pBtn_GameControls = pGUIWindow_CurrentMenu->CreateButton(241, 155, 214, 40, 1, 0, UIMSG_Game_OpenOptionsDialog, 0, 0x43u, pGlobalTXT_LocalizationStrings[617],// ""Sound, Keyboard, Game Options:"" pIcons_LOD->GetTexture(uTextureID_Controls1), 0); - pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, v0, 0, UIMSG_Quit, 0, 0x51u, + pBtn_QuitGame = pGUIWindow_CurrentMenu->CreateButton(241, 209, 214, 40, 1, 0, UIMSG_Quit, 0, 0x51u, pGlobalTXT_LocalizationStrings[618],// "Quit" pIcons_LOD->GetTexture(uTextureID_Quit1), 0); - pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, v0, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u, + pBtn_Resume = pGUIWindow_CurrentMenu->CreateButton(241, 263, 214, 40, 1, 0, UIMSG_GameMenu_ReturnToGame, 0, 0x52u, pGlobalTXT_LocalizationStrings[619],// "Return to Game" pIcons_LOD->GetTexture(uTextureID_Resume1), 0); - pGUIWindow_CurrentMenu->_41D08F(6, v0, 0, 0); - viewparams->field_48 = v0; + pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(6, 1, 0, 0); + viewparams->field_48 = 1; stru_506E40.Release(); uNumSeconds = (unsigned int)MakeScreenshot(155, 117); pRenderer->SavePCXImage("gamma.pcx", (char *)uNumSeconds, 155, 117); @@ -1547,12 +1555,12 @@ case UIMSG_TransitionUI_Confirm: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - dword_50CDC8 = v0; + dword_50CDC8 = 1; sub_42FBDD(); PlayHouseSound(uCurrentHouse_Animation, HouseSound_NotEnoughMoney_TrainingSuccessful); pVideoPlayer->Unload(); DialogueEnding(); - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; if ( dword_59117C_teleportx | dword_591178_teleporty | dword_591174_teleportz | dword_591170_teleport_directiony | dword_59116C_teleport_directionx | dword_591168_teleport_speedz ) { if ( dword_59117C_teleportx ) @@ -1599,7 +1607,7 @@ else { start_event_seq_number = dword_5C341C; - EventProcessor(dword_5C3418, 0, v0); + EventProcessor(dword_5C3418, 0, 1); } start_event_seq_number = 0; if ( !_strcmpi(byte_6BE3B0, "d05.blv") ) @@ -1610,25 +1618,24 @@ pVideoPlayer->Unload(); DialogueEnding(); start_event_seq_number = 0; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; continue; case UIMSG_CycleCharacters: v39 = GetAsyncKeyState(VK_SHIFT); uActiveCharacter = CycleCharacter(v39); - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; continue; case UIMSG_OnTravelByFoot: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - dword_50CDC8 = v0; + dword_50CDC8 = 1; sub_42FBDD(); pNPCData4 = (NPCData *)GetTravelTime(); strcpy(pOutdoor->pLevelFilename, pCurrentMapName); if ( bUnderwater != 1 && pParty->bFlying - || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != v0 ) - { - viewparams->bRedrawGameUI = v0; -LABEL_387: + || pOutdoor->GetTravelDestination(pParty->vPosition.x, pParty->vPosition.y, pOut, 20) != 1 ) + { + viewparams->bRedrawGameUI = 1; CloseWindowBackground(); if ( pParty->vPosition.x < -22528 ) pParty->vPosition.x = -22528; @@ -1638,7 +1645,6 @@ pParty->vPosition.y = -22528; if ( pParty->vPosition.y > 22528 ) pParty->vPosition.y = 22528; -LABEL_317: DialogueEnding(); pCurrentScreen = SCREEN_GAME; } @@ -1646,12 +1652,12 @@ { pParty->field_6E4 = 0; pParty->field_6E0 = 0; - pCastSpellInfo->_427D48(v0); + pCastSpellInfo->_427D48(1); DialogueEnding(); pEventTimer->Pause(); pGameLoadingUI_ProgressBar->Initialize(GUIProgressBar::TYPE_Box); ++pGameLoadingUI_ProgressBar->uProgressMax; - SaveGame(v0, 0); + SaveGame(1, 0); pGameLoadingUI_ProgressBar->Progress(); RestAndHeal(1440 * (signed int)pNPCData4); if ( pParty->uNumFoodRations ) @@ -1662,7 +1668,7 @@ pPlayer7 = pParty->pPlayers; do { - pPlayer7->SetCondition(v0, 0); + pPlayer7->SetCondition(1, 0); ++pPlayer7; } while ( (signed int)pPlayer7 < (signed int)pParty->pHirelings ); @@ -1675,7 +1681,7 @@ pPlayer8 = pParty->pPlayers; do { - pPlayer8->SetCondition(v0, 0); + pPlayer8->SetCondition(1, 0); ++pPlayer8; } while ( (signed int)pPlayer8 < (signed int)pParty->pHirelings ); @@ -1701,7 +1707,6 @@ } if ( !_strcmpi(pCurrentMapName, "out15.odm") || !_strcmpi(pCurrentMapName, "d47.blv") ) bNoNPCHiring = 1; - v0 = 1; PrepareToLoadODM(1u, (OutdoorCamera *)1); pAudioPlayer->SetMapEAX(); bDialogueUI_InitializeActor_NPC_ID = 0; @@ -1716,11 +1721,24 @@ pCurrentScreen = SCREEN_GAME; pGameLoadingUI_ProgressBar->Release(); } - viewparams->bRedrawGameUI = v0; - continue; - case UIMSG_5B: - goto LABEL_387; - case UIMSG_CastSpell_BE: + viewparams->bRedrawGameUI = 1; + continue; + case UIMSG_CHANGE_LOCATION_ClickCencelBtn: + CloseWindowBackground(); + if ( pParty->vPosition.x < -22528 ) + pParty->vPosition.x = -22528; + if ( pParty->vPosition.x > 22528 ) + pParty->vPosition.x = 22528; + if ( pParty->vPosition.y < -22528 ) + pParty->vPosition.y = -22528; + if ( pParty->vPosition.y > 22528 ) + pParty->vPosition.y = 22528; + DialogueEnding(); + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = 1; + continue; + case UIMSG_CastSpell_BE://??? + __debugbreak(); if ( pRenderer->pRenderD3D ) { LOWORD(v42) = pGame->pVisInstance->get_picked_object_zbuf_val(); @@ -1740,11 +1758,11 @@ v47 = pActors[v46].uAIState == Dead; if ( !v47 ) continue; - v51 = pGUIWindow_Settings->ptr_1C; - *((char *)v51 + 8) &= 0xBFu; - *((short *)v51 + 2) = uMessageParam; - *((int *)v51 + 3) = v44; - pParty->pPlayers[*((short *)v51 + 1)].SetRecoveryTime(300); + v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; + LOBYTE(v51->field_8) &= 0xBFu; + v51->uPlayerID_2 = uMessageParam; + v51->spell_target_pid = v44; + pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300); pWindow3 = pGUIWindow_Settings; pWindow3->Release(); pGUIWindow_Settings = 0; @@ -1759,11 +1777,11 @@ v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0; if ( !v47 ) continue; - v51 = pGUIWindow_Settings->ptr_1C; - *((char *)v51 + 8) &= 0xBFu; - *((short *)v51 + 2) = uMessageParam; - *((int *)v51 + 3) = v44; - pParty->pPlayers[*((short *)v51 + 1)].SetRecoveryTime(300); + v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; + LOBYTE(v51->field_8) &= 0xBFu; + v51->uPlayerID_2 = uMessageParam; + v51->spell_target_pid = v44; + pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300); pWindow3 = pGUIWindow_Settings; pWindow3->Release(); pGUIWindow_Settings = 0; @@ -1781,18 +1799,17 @@ { if ( v45 != 6 ) continue; - if ( uCurrentlyLoadedLevelType != v0 ) + if ( uCurrentlyLoadedLevelType != 1 ) { pODMFace = &pOutdoor->pBModels[v44 >> 9].pFaces[v46 & 0x3F]; if ( !(pODMFace->uAttributes & 0x02000000) || !pODMFace->sCogTriggeredID ) continue; v44 = uNumSeconds; - //goto LABEL_415; - v51 = pGUIWindow_Settings->ptr_1C; + v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; *((char *)v51 + 8) &= 0xBFu; - *((short *)v51 + 2) = uMessageParam; - *((int *)v51 + 3) = v44; - pParty->pPlayers[*((short *)v51 + 1)].SetRecoveryTime(300); + v51->uPlayerID_2 = uMessageParam; + v51->spell_target_pid = v44; + pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300); pWindow3 = pGUIWindow_Settings; pWindow3->Release(); pGUIWindow_Settings = 0; @@ -1809,15 +1826,12 @@ } if ( v48 ) continue; -//LABEL_415: - v51 = pGUIWindow_Settings->ptr_1C; - *((char *)v51 + 8) &= 0xBFu; -//LABEL_416: - *((short *)v51 + 2) = uMessageParam; - *((int *)v51 + 3) = v44; - pParty->pPlayers[*((short *)v51 + 1)].SetRecoveryTime(300); + v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; + LOBYTE(v51->field_8) &= 0xBFu; + v51->uPlayerID_2 = uMessageParam; + v51->spell_target_pid = v44; + pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300); pWindow3 = pGUIWindow_Settings; -//LABEL_333: pWindow3->Release(); pGUIWindow_Settings = 0; pMouse->SetCursorBitmap("MICON1"); @@ -1825,35 +1839,35 @@ unk_50C9A0 = 0; back_to_game(); continue; - case UIMSG_CastSpell_SPIRIT_Preservation: - case UIMSG_CastSpell_8D: - case UIMSG_8F: + case UIMSG_CastSpell_SPIRIT_Preservation://and blessing, treatment paralysis, hand hammers(individual upgrade) + case UIMSG_CastSpell_SPIRIT_Fate: + case UIMSG_CastSpell_8F://??? if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; if ( unk_50C9A0 ) { uActiveCharacter = uMessageParam; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; } else { if ( pGUIWindow_Settings ) { - v52 = pGUIWindow_Settings->ptr_1C; + v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; switch ( uMessage ) { - case 69: - *((char *)v52 + 8) &= 0xFDu; + case UIMSG_CastSpell_SPIRIT_Preservation: + LOBYTE(v51->field_8) &= 0xFDu; break; - case 141: - *((char *)v52 + 9) &= 0xFEu; + case UIMSG_CastSpell_SPIRIT_Fate: + HIBYTE(v51->field_8) &= 0xFEu; break; - case 143: - *((char *)v52 + 9) &= 0xFDu; + case UIMSG_CastSpell_8F: + HIBYTE(v51->field_8) &= 0xFDu; break; } - *((short *)v52 + 2) = uMessageParam; - pParty->pPlayers[*((short *)v52 + 1)].SetRecoveryTime(300); + v51->uPlayerID_2 = uMessageParam; + pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300); pGUIWindow_Settings->Release(); pGUIWindow_Settings = 0; pEventTimer->Resume(); @@ -1864,12 +1878,13 @@ } continue; case UIMSG_BF: - dword_50CDC8 = v0; + __debugbreak(); + dword_50CDC8 = 1; sub_42FBDD(); - SaveGame(v0, 0); + SaveGame(1, 0); strcpy(pCurrentMapName, pMapStats->pInfos[uHouse_ExitPic].pFilename); - dword_6BE364_game_settings_1 |= v0; - uGameState = 2; + dword_6BE364_game_settings_1 |= 1; + uGameState = GAME_STATE_2; //v53 = p2DEvents_minus1_::30[26 * (unsigned int)ptr_507BC0->ptr_1C]; v53 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1]._quest_related; if ( v53 < 0 ) @@ -1895,7 +1910,7 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v0, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); continue; case UIMSG_OnCastTownPortal: @@ -1943,8 +1958,7 @@ sub_41C0B8_set_status_string(pTmpBuf); continue; case UIMSG_CloseAfterInstallBeacon: - dword_50CDC8 = v0; - //goto LABEL_453; + dword_50CDC8 = 1; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; @@ -1976,17 +1990,17 @@ { if ( _strcmpi(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]) ) { - SaveGame(v0, 0); + SaveGame(1, 0); OnMapLeave(); strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[HIWORD(pNPCData4->uProfession)]); - dword_6BE364_game_settings_1 |= v0; - uGameState = 2; + dword_6BE364_game_settings_1 |= 1; + uGameState = GAME_STATE_2; _5B65A8_npcdata_uflags_or_other = pNPCData4->uFlags; _5B65AC_npcdata_fame_or_other = pNPCData4->fame; _5B65B0_npcdata_rep_or_other = pNPCData4->rep; _5B65B4_npcdata_loword_house_or_other = LOWORD(pNPCData4->Location2D); _5B65B8_npcdata_hiword_house_or_other = HIWORD(pNPCData4->Location2D); - dword_5B65C0 = v0; + dword_5B65C0 = 1; } else { @@ -1997,7 +2011,7 @@ pParty->sRotationY = LOWORD(pNPCData4->Location2D); pParty->sRotationX = HIWORD(pNPCData4->Location2D); } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v0, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; @@ -2061,7 +2075,7 @@ if ( uMessageParam != 5 ) { LABEL_486: - SaveGame(v0, 0); + SaveGame(1, 0); v64 = pMapStats->GetMapInfo(pCurrentMapName); v65 = uMessageParam; if ( v64 == TownPortalList[uMessageParam].uMapInfoID ) @@ -2075,12 +2089,12 @@ } else { - SaveGame(v0, 0); + SaveGame(1, 0); OnMapLeave(); - dword_6BE364_game_settings_1 |= v0; - uGameState = 2; + dword_6BE364_game_settings_1 |= 1; + uGameState = GAME_STATE_2; strcpy(pCurrentMapName, pMapStats->pInfos[TownPortalList[uMessageParam].uMapInfoID].pFilename); - dword_5B65C0 = v0; + dword_5B65C0 = 1; _5B65A8_npcdata_uflags_or_other = TownPortalList[uMessageParam].pos.x; _5B65AC_npcdata_fame_or_other = TownPortalList[uMessageParam].pos.y; _5B65B0_npcdata_rep_or_other = TownPortalList[uMessageParam].pos.z; @@ -2091,7 +2105,7 @@ } v67 = pGUIWindow_CurrentMenu->Hint; if ( v67 ) - *((int *)v67 + 17) = v0; + *((int *)v67 + 17) = 1; else pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u); //LABEL_434: @@ -2103,7 +2117,7 @@ *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v0, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); continue; } v63 = 210; @@ -2230,8 +2244,8 @@ uGameState = GAME_STATE_FINAL_WINDOW; continue; case UIMSG_C4: - __debugbreak; - uGameState = 0; + __debugbreak(); + uGameState = GAME_STATE_PLAYING; strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); goto LABEL_524; case UIMSG_DD: @@ -2247,7 +2261,7 @@ //LABEL_90: v1 = ""; //LABEL_91: - v0 = 1; + //v0 = 1; continue; } v71 = v70; @@ -2268,11 +2282,11 @@ { strcpy(pCurrentMapName, (const char *)&pGames_LOD->pSubIndices[(int)pNPCData3]); dword_6BE364_game_settings_1 |= 1u; - uGameState = 2; + uGameState = GAME_STATE_2; OnMapLeave(); //goto LABEL_90; v1 = ""; - v0 = 1; + //v0 = 1; continue; } } @@ -2285,7 +2299,7 @@ //goto LABEL_90; { v1 = ""; - v0 = 1; + //v0 = 1; continue; } v74 = atoi(v216.pProperties[0]); @@ -2304,7 +2318,7 @@ pParty->uFallStartY = v76; //goto LABEL_90; v1 = ""; - v0 = 1; + //v0 = 1; continue; } } @@ -2326,7 +2340,7 @@ pParty->uFallStartY = v76; //goto LABEL_90; v1 = ""; - v0 = 1; + //v0 = 1; continue; } } @@ -2339,7 +2353,7 @@ ShowStatusBarString(v73, 6u); //goto LABEL_90; v1 = ""; - v0 = 1; + //v0 = 1; continue; case UIMSG_CastQuickSpell: if ( bUnderwater == 1 ) @@ -2352,13 +2366,13 @@ //goto LABEL_90; { v1 = ""; - v0 = 1; + //v0 = 1; continue; } _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter); continue; - case UIMSG_CastSpell_SmallShot://FireBlow, Lightning, Ice Lightning, Swarm, hand hammer - case UIMSG_CastSpell_GreatShot://Fireball, Spraying poison and other + case UIMSG_CastSpell_SmallShot://FireBlow, Lightning, Ice Lightning, Swarm, + case UIMSG_CastSpell_GreatShot://??? if ( pRenderer->pRenderD3D ) { v81 = pGame->pVisInstance->get_picked_object_zbuf_val(); @@ -2373,28 +2387,26 @@ v44 = (unsigned __int16)v81; v84 = v83 >> 16; if ( PID_TYPE(v44) != 3 || v84 >= 5120 ) - //goto LABEL_90; - { + { v1 = ""; - v0 = 1; continue; } - v51 = pGUIWindow_Settings->ptr_1C; - if ( uMessage == 70 ) - { - *((char *)v51 + 8) &= 0xF7u; + v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; + if ( uMessage == UIMSG_CastSpell_SmallShot ) + { + LOBYTE(v51->field_8) &= 0xF7; } else { - if ( uMessage == 140 ) - *((char *)v51 + 9) &= 0xFEu; + if ( uMessage == UIMSG_CastSpell_GreatShot ) + HIBYTE(v51->field_8) &= 0xFEu; else - *((char *)v51 + 9) &= 0xFDu; + HIBYTE(v51->field_8) &= 0xFDu; } //goto LABEL_416; - *((short *)v51 + 2) = uMessageParam; - *((int *)v51 + 3) = v44; - pParty->pPlayers[*((short *)v51 + 1)].SetRecoveryTime(300); + v51->uPlayerID_2 = uMessageParam; + v51->spell_target_pid = v44; + pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300); pWindow3 = pGUIWindow_Settings; pWindow3->Release(); pGUIWindow_Settings = 0; @@ -2404,11 +2416,10 @@ back_to_game(); continue; case UIMSG_1C: + __debugbreak(); if ( !uActiveCharacter || pCurrentScreen ) - //goto LABEL_90; { v1 = ""; - v0 = 1; continue; } ptr_507BC8 = GUIWindow::Create(0, 0, 640, 480, WINDOW_68, uMessageParam, 0); @@ -2416,14 +2427,15 @@ pEventTimer->Pause(); continue; case UIMSG_1B: + __debugbreak(); if ( !uActiveCharacter ) //goto LABEL_90; { v1 = ""; - v0 = 1; + //v0 = 1; continue; } - if ( pParty->bTurnBasedModeOn != v0 ) + if ( pParty->bTurnBasedModeOn != 1 ) //goto LABEL_569; { if ( pActors[uMessageParam].uAIState == 5 ) @@ -2432,11 +2444,11 @@ Actor::StealFrom(uMessageParam); continue; } - if ( pTurnEngine->field_4 == v0 || pTurnEngine->field_4 == 3 ) + if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) //goto LABEL_90; { v1 = ""; - v0 = 1; + //v0 = 1; continue; } if ( !(pTurnEngine->field_18 & 2) ) @@ -2454,20 +2466,20 @@ //goto LABEL_90; { v1 = ""; - v0 = 1; + //v0 = 1; continue; } - if ( pParty->bTurnBasedModeOn != v0 ) + if ( pParty->bTurnBasedModeOn != 1 ) //goto LABEL_577; { _42ECB5_PlayerAttacksActor(); continue; } - if ( pTurnEngine->field_4 == v0 || pTurnEngine->field_4 == 3 ) + if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) //goto LABEL_90; { v1 = ""; - v0 = 1; + //v0 = 1; continue; } if ( !(pTurnEngine->field_18 & 2) ) @@ -2486,7 +2498,7 @@ } GUIWindow::Create(pButton_RestUI_Wait5Minutes->uX, pButton_RestUI_Wait5Minutes->uY, 0, 0, WINDOW_PressedButton2, (int)pButton_RestUI_Wait5Minutes, (int)pGlobalTXT_LocalizationStrings[238]);// "Wait 5 Minutes" - dword_506F14 = v0; + dword_506F14 = 1; _506F18_num_hours_to_sleep = 5; continue; case UIMSG_Wait1Hour: @@ -2498,7 +2510,7 @@ } GUIWindow::Create(pButton_RestUI_Wait1Hour->uX, pButton_RestUI_Wait1Hour->uY, 0, 0, WINDOW_PressedButton2, (int)pButton_RestUI_Wait1Hour, (int)pGlobalTXT_LocalizationStrings[239]);// "Wait 1 Hour" - dword_506F14 = v0; + dword_506F14 = 1; _506F18_num_hours_to_sleep = 60; continue; case UIMSG_RentRoom: @@ -2523,7 +2535,7 @@ continue; if ( sub_42F4DA() ) { - if ( pParty->bTurnBasedModeOn == v0 ) + if ( pParty->bTurnBasedModeOn == 1 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" continue; @@ -2535,13 +2547,13 @@ if ( !uActiveCharacter ) { v1 = ""; - v0 = 1; + //v0 = 1; continue; } pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); continue; } - if ( pParty->bTurnBasedModeOn == v0 ) + if ( pParty->bTurnBasedModeOn == 1 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" continue; @@ -2551,7 +2563,7 @@ RestUI_Initialize(); continue; } - if ( pParty->bTurnBasedModeOn == v0 ) + if ( pParty->bTurnBasedModeOn == 1 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!" continue; @@ -2563,7 +2575,7 @@ if ( !uActiveCharacter ) { v1 = ""; - v0 = 1; + //v0 = 1; continue; } pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); @@ -2599,7 +2611,7 @@ if ( v93 > v92 ) pNPCData4 = (NPCData *)((v93 > v92 + pMapInfo->EncM2percent) + 2); else - pNPCData4 = (NPCData *)v0; + pNPCData4 = (NPCData *)1; if ( !sub_45063B(pMapInfo, (int)pNPCData4) ) pNPCData4 = 0; if ( pNPCData4 ) @@ -2645,7 +2657,7 @@ GUIWindow::Create(pButton_RestUI_WaitUntilDawn->uX, pButton_RestUI_WaitUntilDawn->uY, 0, 0, WINDOW_PressedButton2, (int)pButton_RestUI_WaitUntilDawn, (int)pGlobalTXT_LocalizationStrings[237]);// "Wait until Dawn" v97 = _494820_training_time(pParty->uCurrentHour); - dword_506F14 = v0; + dword_506F14 = 1; _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute; continue; case UIMSG_HintSelectRemoveQuickSpellBtn: @@ -2683,7 +2695,7 @@ } sprintfex(pTmpBuf, v161, v178); sub_41C0B8_set_status_string(pTmpBuf); - v0 = 1; + //v0 = 1; continue; case UIMSG_ClickInstallRemoveQuickSpellBtn: GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0); @@ -2705,6 +2717,7 @@ byte_506550 = 0; continue; case UIMSG_33: + __debugbreak(); if ( !uActiveCharacter ) continue; pPlayer3 = pPlayers[uActiveCharacter]; @@ -2775,7 +2788,7 @@ { pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; pCurrentScreen = SCREEN_GAME; pIcons_LOD->_4114F2(); v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage; @@ -2802,8 +2815,9 @@ continue; case UIMSG_92: + __debugbreak(); if ( pTurnEngine->field_4 != 3 ) - _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, v0, 0); + _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, 1, 0); continue; case UIMSG_SpellBookWindow: if ( pTurnEngine->field_4 == 3 ) @@ -2827,7 +2841,7 @@ pEventTimer->Pause(); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); - viewparams->field_48 = v0; + viewparams->field_48 = 1; continue; } if ( pCurrentScreen != SCREEN_REST @@ -2841,7 +2855,7 @@ pEventTimer->Pause(); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_SpellBook, 0, 0); pAudioPlayer->PlaySound((SoundID)48, 0, 0, -1, 0, 0, 0, 0); - viewparams->field_48 = v0; + viewparams->field_48 = 1; continue; } } @@ -2856,15 +2870,15 @@ if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; GUIWindow::Create(0x230u, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_QuickReference, 0); - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; pEventTimer->Pause(); pAudioPlayer->StopChannels(-1, -1); pCurrentScreen = SCREEN_QUICK_REFERENCE; pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640, 480, WINDOW_QuickReference, 5, 0); papredoll_dbrds[2] = pIcons_LOD->LoadTexture("BUTTEXI1", TEXTURE_16BIT_PALETTE); - pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, v0, 0, UIMSG_Escape, 0, 0, + pBtn_ExitCancel = pGUIWindow_CurrentMenu->CreateButton(0x187u, 0x13Cu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[79],// "Exit" - (Texture *)(uTextureID_BUTTDESC2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BUTTDESC2] : 0), 0); //, v179); + pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); //, v179); continue; case UIMSG_GameMenuButton: if ( pCurrentScreen ) @@ -2872,7 +2886,7 @@ pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); pCurrentScreen = SCREEN_GAME; - viewparams->bRedrawGameUI = v0; + viewparams->bRedrawGameUI = 1; } stru_506E40.Release(); uNumSeconds = (unsigned int)MakeScreenshot(155, 117); @@ -2891,26 +2905,27 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); continue; case UIMSG_C0: - dword_50651C = v0; + __debugbreak(); + dword_50651C = 1; if ( pMouse->GetCursorPos(&v211)->y > 178 ) dword_50651C = -1; continue; case UIMSG_ClickAwardsUpBtn: GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0); - dword_506548 = v0; + dword_506548 = 1; continue; case UIMSG_ClickAwardsDownBtn: GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0); - dword_506544 = v0; + dword_506544 = 1; continue; case UIMSG_ChangeDetaliz: - bRingsShownInCharScreen ^= v0; + bRingsShownInCharScreen ^= 1; pCharacterScreen_DetalizBtn->Release(); pCharacterScreen_DollBtn->Release(); if ( bRingsShownInCharScreen ) { - v128 = (uTextureID_detaliz_close_button != -1 ? pIcons_LOD->pTextures[uTextureID_detaliz_close_button].uTextureHeight : 26); - v125 = (uTextureID_detaliz_close_button != -1 ? pIcons_LOD->pTextures[uTextureID_detaliz_close_button].uTextureWidth : 24); + v128 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureHeight; + v125 = pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)->uTextureWidth; v123 = 445; v121 = 470; } @@ -2921,11 +2936,11 @@ v123 = 300; v121 = 600; } - pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, v0, 0, UIMSG_ChangeDetaliz, 0, 0, + pCharacterScreen_DetalizBtn = pGUIWindow_CurrentMenu->CreateButton(v121, v123, v125, v128, 1, 0, UIMSG_ChangeDetaliz, 0, 0, pGlobalTXT_LocalizationStrings[64],// "Detail Toggle" 0); - pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, v0, 0, UIMSG_ClickPaperdoll, 0, 0, v1, 0); - viewparams->bRedrawGameUI = v0; + pCharacterScreen_DollBtn = pGUIWindow_CurrentMenu->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, v1, 0); + viewparams->bRedrawGameUI = 1; continue; case UIMSG_ClickPaperdoll: OnPaperdollLeftClick(); @@ -2989,53 +3004,53 @@ default: continue; case 11: - dword_506548 = v0; + dword_506548 = 1; continue; case 10: - dword_506544 = v0; + dword_506544 = 1; continue; case 0: pButton = pBtn_Book_1; - dword_506544 = v0; + dword_506544 = 1; break; case 1: pButton = pBtn_Book_2; - dword_506548 = v0; + dword_506548 = 1; break; case 2: - dword_506540 = v0; + dword_506540 = 1; if ( dword_506364 ) continue; pButton = pBtn_Book_3; break; case 3: - dword_50653C = v0; + dword_50653C = 1; if ( dword_506364 ) continue; pButton = pBtn_Book_4; break; case 4: - dword_506538 = v0; + dword_506538 = 1; if ( dword_506364 ) continue; pButton = pBtn_Book_5; break; case 5: - dword_506534 = v0; + dword_506534 = 1; if ( dword_506364 ) continue; pButton = pBtn_Book_6; break; case 6: pButton = pBtn_Autonotes_Misc; - dword_506530 = v0; + dword_506530 = 1; break; case 7: pButton = pBtn_Autonotes_Instructors; - dword_50652C = v0; + dword_50652C = 1; break; } - GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, v0); + GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); continue; case UIMSG_SelectCharacter: if ( pMessageQueue_50CBD0->uNumMessages ) @@ -3059,7 +3074,7 @@ { pNPCData4 = (NPCData *)((char *)pNPCData4 - 12); } - if ( pParty->uCurrentHour < 0xC || (uNumSeconds = v0, pParty->uCurrentHour >= 0x18) ) + if ( pParty->uCurrentHour < 0xC || (uNumSeconds = 1, pParty->uCurrentHour >= 0x18) ) uNumSeconds = 0; sprintf(pTmpBuf, "%d:%02d%s %s %d %s %d", pNPCData4, pParty->uCurrentMinute, aAMPMNames[uNumSeconds], aDayNames[pParty->uDaysPlayed % 7], 7 * pParty->uCurrentMonthWeek + pParty->uDaysPlayed % 7 + 1, aMonthNames[pParty->uCurrentMonth], pParty->uCurrentYear); @@ -3090,16 +3105,16 @@ sprintf(pTmpBuf, "%d / %d %s %d / %d %s", v110->sHealth, v114, v113, v112, v111, v109); sub_41C0B8_set_status_string(pTmpBuf); continue; - case UIMSG_C: - if ( pCurrentScreen == SCREEN_F ) - { - sub_421EA6_OnInventoryLeftClick(); + case UIMSG_CHEST_ClickItem: + if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) + { + OnInventoryLeftClick(); continue; } - sub_420E01(); + OnChestLeftClick(); continue; case UIMSG_InventoryLeftClick: - sub_421EA6_OnInventoryLeftClick(); + OnInventoryLeftClick(); continue; case UIMSG_MouseLeftClickInGame: if ( !pRenderer->pRenderD3D ) @@ -3127,7 +3142,7 @@ } if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) { - pMessageQueue_50CBD0->uNumMessages = v0; + pMessageQueue_50CBD0->uNumMessages = 1; pMessageQueue_50CBD0->AddMessage(UIMSG_E, 0, 0); /*v115 = v0; pMessageQueue_50CBD0->uNumMessages = v0; @@ -3151,12 +3166,14 @@ continue; }*/ continue; - case UIMSG_E:// UIMSG_MouseLeftClickInGame + case UIMSG_E: + __debugbreak();// UIMSG_MouseLeftClickInGame if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; OnGameViewportClick(); continue; case UIMSG_F: + __debugbreak(); if ( pRenderer->pRenderD3D ) { LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val(); @@ -3171,6 +3188,7 @@ GUIWindow::Create(0, 0, 0, 0, WINDOW_F, (int)pButton2, 0); continue; case UIMSG_54: + __debugbreak(); pButton2 = (GUIButton *)uMessageParam; GUIWindow::Create(0, 0, 0, 0, (WindowType)22, (int)pButton2, 0); continue; @@ -3341,7 +3359,7 @@ break; case UIMSG_ExitToWindows: GUIWindow::Create(495, 337, 0, 0, WINDOW_PressedButton2, (int)pMainMenu_BtnExit, 0); - SetCurrentMenuID(MENU_FINISHED); + SetCurrentMenuID(MENU_EXIT_GAME); break; case UIMSG_PlayerCreation_SelectAttribute: pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) @@ -3435,7 +3453,7 @@ if ( PlayerCreation_ComputeAttributeBonus() || !PlayerCreation_Chose4Skills() ) GameUI_Footer_TimeLeft = GetTickCount() + 4000; else - uGameState = 6; + uGameState = GAME_STATE_STARTING_NEW_GAME; break; case UIMSG_PlayerCreationClickReset: GUIWindow::Create(527, 431, 0, 0, WINDOW_PressedButton2, (int)pPlayerCreationUI_BtnReset, 0); @@ -3459,7 +3477,7 @@ pGUIWindow_CurrentMenu->ptr_1C = v3; break; case UIMSG_ChangeGameState: - uGameState = 1; + uGameState = GAME_FINISHED; break; case UIMSG_11: pMouse->SetCursorBitmap("MICON2"); @@ -9223,7 +9241,7 @@ //----- (0040DEF3) -------------------------------------------------------- unsigned short TargetColor( unsigned __int16 r, unsigned __int16 g, unsigned __int16 b ) - { +{ return ((unsigned int)b >> (8 - LOBYTE(pRenderer->uTargetBBits))) | pRenderer->uTargetGMask & (g << (LOBYTE(pRenderer->uTargetGBits) + LOBYTE(pRenderer->uTargetBBits) - 8)) | pRenderer->uTargetRMask & (r << (LOBYTE(pRenderer->uTargetGBits) + LOBYTE(pRenderer->uTargetRBits) + LOBYTE(pRenderer->uTargetBBits) - 8)); @@ -9450,7 +9468,8 @@ //----- (0040F82D) -------------------------------------------------------- void __fastcall ZBuffer_Fill(int *pZBuffer, int uTextureId, int iZValue) { - ZBuffer_DoFill(pZBuffer, (Texture *)(uTextureId != -1 ? (int)&pIcons_LOD->pTextures[uTextureId] : 0), iZValue); + assert(uTextureId != -1); + ZBuffer_DoFill(pZBuffer, pIcons_LOD->GetTexture(uTextureId), iZValue); } //----- (0040F845) -------------------------------------------------------- @@ -10201,17 +10220,18 @@ int v39; // eax@129 unsigned int pNumMessages; // eax@142 GUIButton *pGUIButton; // ebp@146 - unsigned int pX; // [sp-1Ch] [bp-124h]@17 - unsigned int pY; // [sp-18h] [bp-120h]@17 - Texture *pTexture; // [sp-14h] [bp-11Ch]@17 - Texture *pTexture2; // [sp-14h] [bp-11Ch]@86 + //unsigned int pX; // [sp-1Ch] [bp-124h]@17 + //unsigned int pY; // [sp-18h] [bp-120h]@17 + //Texture *pTexture; // [sp-14h] [bp-11Ch]@17 + //Texture *pTexture2; // [sp-14h] [bp-11Ch]@86 int i; // [sp+0h] [bp-108h]@3 ItemGen pItemGen; // [sp+4h] [bp-104h]@98 GUIButton GUIButton2; // [sp+28h] [bp-E0h]@133 ItemGen ItemGen2; // [sp+E4h] [bp-24h]@129 if (GetCurrentMenuID() != MENU_CREATEPARTY) - sub_41CD4F(34); + UI_OnKeyDown(VK_NEXT); + for ( i = 1; i <= uNumVisibleWindows; ++i ) { pWindow = &pWindowList[pVisibleWindowsIdxs[i] - 1]; @@ -10220,10 +10240,8 @@ { case WINDOW_OptionsButtons: { - pTexture = (Texture *)(uTextureID_Options != -1 ? &pIcons_LOD->pTextures[uTextureID_Options] : 0); - pY = pViewport->uViewportTL_Y; - pX = pViewport->uViewportTL_X; - pRenderer->DrawTextureIndexed(pX, pY, pTexture); + pRenderer->DrawTextureIndexed(pViewport->uViewportTL_Y, + pViewport->uViewportTL_X, pIcons_LOD->GetTexture(uTextureID_Options)); viewparams->bRedrawGameUI = 1; continue; } @@ -10278,13 +10296,12 @@ { Chest::DrawChestUI((unsigned int)pWindow->ptr_1C); } - else if ( pCurrentScreen == SCREEN_F ) + else if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) { pRenderer->ClearZBuffer(0, 479); draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, - (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0)); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); + pRenderer->DrawTextureIndexed(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uExitCancelTextureId)); } continue; } @@ -10331,10 +10348,9 @@ { pRenderer->ClearZBuffer(0, 479); draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); CharacterUI_DrawPaperdoll(uActiveCharacter); - pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, - (Texture *)(uTextureID_x_x_u != -1 ? &pIcons_LOD->pTextures[uTextureID_x_x_u] : 0)); + pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u)); continue; } case WINDOW_FinalWindow: @@ -10557,9 +10573,8 @@ case WINDOW_BooksWindow: { pButton = (GUIButton *)pWindow->ptr_1C; - pY = pWindow->uFrameY; - pX = pWindow->uFrameX; - pRenderer->DrawTextureIndexed(pX, pY, pButton->pTextures[0]); + pRenderer->DrawTextureIndexed(pWindow->uFrameY, + pWindow->uFrameX, pButton->pTextures[0]); viewparams->bRedrawGameUI = 1; continue; } @@ -10784,7 +10799,7 @@ HIDWORD(v27->uExpireTime) = HIDWORD(v32); v27->uAttributes = v32; } - dword_50C9A8 = 256; + _50C9A8_item_enchantment_timer = 256; goto LABEL_92; } v36 = (70.0 - (double)pParty->pPickedItem.uEnchantmentType) * 0.01; @@ -11462,7 +11477,7 @@ } //----- (00417AD4) -------------------------------------------------------- -unsigned int __fastcall GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) +unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level) { int v8; // eax@10 int v12; // eax@14 @@ -11529,14 +11544,18 @@ i->uX = 0; } } - pBtn_Up = pGUIWindow_CurrentMenu->CreateButton(438, 46, (uTextureID_ar_up_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_up_up].uTextureWidth : 24), - (uTextureID_ar_up_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_up_up].uTextureHeight : 26), - 1, 0, UIMSG_ClickAwardsUpBtn, 0, 0, "", (Texture *)(uTextureID_ar_up_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_up] : 0), - uTextureID_ar_up_dn != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_up_dn] : 0, 0); - pBtn_Down = pGUIWindow_CurrentMenu->CreateButton(438, 292, (uTextureID_ar_dn_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_dn_up].uTextureWidth : 24), - (uTextureID_ar_dn_up != -1 ? pIcons_LOD->pTextures[uTextureID_ar_dn_up].uTextureHeight : 26), - 1, 0, UIMSG_ClickAwardsDownBtn, 0, 0, "", (Texture *)(uTextureID_ar_dn_up != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_up] : 0), - uTextureID_ar_dn_dn != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ar_dn_dn] : 0, 0); + pBtn_Up = pGUIWindow_CurrentMenu->CreateButton(438, 46, + pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_ar_up_up)->uTextureHeight, + 1, 0, UIMSG_ClickAwardsUpBtn, 0, 0, "", + pIcons_LOD->GetTexture(uTextureID_ar_up_up), + pIcons_LOD->GetTexture(uTextureID_ar_up_dn), 0); + pBtn_Down = pGUIWindow_CurrentMenu->CreateButton(438, 292, + pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureWidth, + pIcons_LOD->GetTexture(uTextureID_ar_dn_up)->uTextureHeight, + 1, 0, UIMSG_ClickAwardsDownBtn, 0, 0, "", + pIcons_LOD->GetTexture(uTextureID_ar_dn_up), + pIcons_LOD->GetTexture(uTextureID_ar_dn_dn), 0); ptr_507BA4 = pGUIWindow_CurrentMenu->CreateButton(440, 62, 16, 232, 1, 0, UIMSG_C0, 0, 0, "", 0); } } @@ -11564,10 +11583,10 @@ pButton->uY = dword_506988; pButton->uZ = dword_506984; pButton->uW = dword_506980; - pGUIWindow_CurrentMenu->_41D08F(1, 0, 0, 0); - } - } - } -} - - + pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(1, 0, 0, 0); + } + } + } +} + +
--- a/mm7_6.cpp Mon May 13 09:39:49 2013 +0600 +++ b/mm7_6.cpp Mon May 13 09:39:58 2013 +0600 @@ -2320,10 +2320,10 @@ if ( pGUIWindow_Settings ) return; pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); - pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_8D, 0, 0x31u, "", 0); - pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_8D, 1, 0x32u, "", 0); - pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_8D, 2, 0x33u, "", 0); - pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_8D, 3, 0x34u, "", 0); + pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Fate, 0, 0x31u, "", 0); + pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Fate, 1, 0x32u, "", 0); + pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Fate, 2, 0x33u, "", 0); + pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Fate, 3, 0x34u, "", 0); pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_GreatShot, 0, 0, "", NULL); sub_421B2C_PlaceInInventory_or_DropPickedItem(); } @@ -2340,8 +2340,8 @@ pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight)->uTextureHeight, 1, 0, UIMSG_ScrollNPCPanel, 1, 0, "", pIcons_LOD->GetTexture(uTextureID_Btn_NPCRight), 0); - pGUIWindow_Settings->CreateButton(0x1EBu, 149, 64, 74, 1, 0, UIMSG_8F, 4, 0x35u, "", 0); - pGUIWindow_Settings->CreateButton(0x231u, 149, 64, 74, 1, 0, UIMSG_8F, 5, 0x36u, "", 0); + pGUIWindow_Settings->CreateButton(0x1EBu, 149, 64, 74, 1, 0, UIMSG_CastSpell_8F, 4, 0x35u, "", 0); + pGUIWindow_Settings->CreateButton(0x231u, 149, 64, 74, 1, 0, UIMSG_CastSpell_8F, 5, 0x36u, "", 0); } } } @@ -3874,7 +3874,7 @@ v69->uAttributes |= 8u; } v69->uAttributes |= 0x10u; - dword_50C9A8 = 256; + _50C9A8_item_enchantment_timer = 256; LODWORD(v727) = 1; break; } @@ -4964,7 +4964,7 @@ continue; } *((int *)v243 + 5) |= 0x40u; - dword_50C9A8 = 256; + _50C9A8_item_enchantment_timer = 256; LODWORD(v727) = 1; break; } @@ -5034,7 +5034,7 @@ LABEL_612: _this->uItemID |= 0x20u; - dword_50C9A8 = 256; + _50C9A8_item_enchantment_timer = 256; LODWORD(v727) = 1; break; } @@ -5386,7 +5386,7 @@ + rand() % 10;//(pItemsTable->field_116D8[19] - pItemsTable->field_116D8[18] + 1); } v294->uAttributes |= 0x20u; - dword_50C9A8 = 256; + _50C9A8_item_enchantment_timer = 256; LODWORD(v727) = 1; break; } @@ -7131,7 +7131,7 @@ *(int *)(v592 + 20) |= 8u; } *(char *)(v592 + 20) |= 0x80u; - dword_50C9A8 = 256; + _50C9A8_item_enchantment_timer = 256; LODWORD(v727) = 1; break; }
--- a/mm7_data.cpp Mon May 13 09:39:49 2013 +0600 +++ b/mm7_data.cpp Mon May 13 09:39:58 2013 +0600 @@ -507,10 +507,10 @@ __int16 RightClickPortraitXmin[4]={0x14, 0x83, 0xF2, 0x165}; __int16 RightClickPortraitXmax[4]={0x53, 0xC6, 0x138, 0x1A7}; void *off_4E2A12; // stat_string_control_button_count -int pArmorSkills[5]={ 9, 10, 11, 8, 30}; -int pWeaponSkills[9]={3, 5, 2, 6, 4, 0, 1, 31, 7}; -int pMiscSkills[12]={35, 33, 24, 21, 32, 36, 29, 25, 22, 26, 23, 34}; -int pMagicSkills[9]={12, 13, 14, 15, 16, 17, 18, 19, 20}; +int pArmorSkills[5] = {PLAYER_SKILL_LEATHER, PLAYER_SKILL_CHAIN, PLAYER_SKILL_PLATE, PLAYER_SKILL_SHIELD, PLAYER_SKILL_DODGE}; +int pWeaponSkills[9] = {PLAYER_SKILL_AXE, PLAYER_SKILL_BOW, PLAYER_SKILL_DAGGER, PLAYER_SKILL_MACE, PLAYER_SKILL_SPEAR, PLAYER_SKILL_STAFF, PLAYER_SKILL_SWORD, PLAYER_SKILL_UNARMED, PLAYER_SKILL_BLASTER}; +int pMiscSkills[12] = {PLAYER_SKILL_ALCHEMY, PLAYER_SKILL_ARMSMASTER, PLAYER_SKILL_BODYBUILDING, PLAYER_SKILL_ITEM_ID, PLAYER_SKILL_MONSTER_ID, PLAYER_SKILL_LEARNING, PLAYER_SKILL_TRAP_DISARM, PLAYER_SKILL_MEDITATION, PLAYER_SKILL_MERCHANT, PLAYER_SKILL_PERCEPTION, PLAYER_SKILL_REPAIR, PLAYER_SKILL_STEALING}; +int pMagicSkills[9] = {PLAYER_SKILL_FIRE, PLAYER_SKILL_AIR, PLAYER_SKILL_WATER, PLAYER_SKILL_EARTH, PLAYER_SKILL_SPIRIT, PLAYER_SKILL_MIND, PLAYER_SKILL_BODY, PLAYER_SKILL_LIGHT, PLAYER_SKILL_DARK}; unsigned int pHealthBarPos[4] = {22, 137, 251, 366}; unsigned int pManaBarPos[4] = {102, 217, 331, 447}; char _4E2AD8_ui_colors[72]; @@ -1502,7 +1502,7 @@ int quick_spell_at_page; // weak char byte_506550; // weak char *aMoonPhaseNames[5]; -int dword_506568; // weak +int _506568_autonote_type; // weak char bRecallingBeacon; // weak int uLastPointedObjectID; // weak //unsigned __int8 bMonsterInfoUI_bDollInitialized; @@ -1604,7 +1604,7 @@ int dword_50C998_turnbased_icon_1A; // weak int uSpriteID_Spell11; // idb _UNKNOWN unk_50C9A0; // weak -int dword_50C9A8; // weak +int _50C9A8_item_enchantment_timer; // weak int dword_50C9AC; // weak int dword_50C9D0; // weak int dword_50C9D4; // weak
--- a/mm7_data.h Mon May 13 09:39:49 2013 +0600 +++ b/mm7_data.h Mon May 13 09:39:58 2013 +0600 @@ -930,7 +930,7 @@ extern int quick_spell_at_page; // weak extern char byte_506550; // weak extern char *aMoonPhaseNames[5]; -extern int dword_506568; // weak +extern int _506568_autonote_type; // 506568 extern char bRecallingBeacon; // weak extern int uLastPointedObjectID; // weak //extern unsigned __int8 bMonsterInfoUI_bDollInitialized; @@ -1032,7 +1032,7 @@ extern int dword_50C998_turnbased_icon_1A; // weak extern int uSpriteID_Spell11; // idb extern _UNKNOWN unk_50C9A0; // weak -extern int dword_50C9A8; // weak +extern int _50C9A8_item_enchantment_timer; // weak extern int dword_50C9AC; // weak extern int dword_50C9D0; // weak extern int dword_50C9D4; // weak @@ -1594,16 +1594,12 @@ signed int __thiscall GetConditionDrawColor(unsigned int uConditionIdx); // idb char __fastcall sub_4179BC_draw_tooltip(const char *a1, const char *a2); // idb void FillAwardsData(); -void __cdecl sub_419220(); -void __cdecl sub_419379(); -void __cdecl CharacterUI_SkillScreen_Draw(); -void __cdecl sub_4196A0(); -char __fastcall CharacterUI_SkillsTab_Draw(unsigned int uPlayerID); // idb -void CharacterUI_AwardsTab_Draw(unsigned int uPlayerID); // idb +void sub_419220(); +void sub_419379(); +void CharacterUI_SkillScreen_Draw(); +void sub_4196A0(); unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels); -void __fastcall CharacterUI_InventoryTab_Draw(unsigned int uPlayerID, char a2); void __cdecl draw_leather(); -void __thiscall CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx); // idb void __cdecl GameUI_DrawRightPanelItems(); void __cdecl GameUI_DrawFoodAndGold(); void __cdecl GameUI_DrawLifeManaBars(); @@ -1616,7 +1612,7 @@ void __cdecl GameUI_Footer_2(); void __thiscall sub_41C0B8_set_status_string(const char *pStr); // idb void __cdecl GameUI_Footer(); -bool __thiscall sub_41CD4F(unsigned int _this); +bool UI_OnKeyDown(unsigned int vkKey); char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2); void GameUI_DrawItemInfo(struct ItemGen* inspect_item); // idb void MonsterPopup_Draw(unsigned int uActorID, struct GUIWindow *edx0); @@ -1628,14 +1624,14 @@ void __cdecl sub_42038D(); void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal); // idb -void __cdecl sub_420E01(); +void OnChestLeftClick(); void __cdecl GameUI_WritePointedObjectStatusString(); struct GUIWindow *__thiscall GameUI_InitializeCharacterWindow(unsigned int _this); struct GUIWindow *__thiscall sub_4219BE(void *a4); bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem(); void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID); // idb -void __cdecl sub_421EA6_OnInventoryLeftClick(); -void __cdecl OnGameViewportClick(); +void OnInventoryLeftClick(); +void OnGameViewportClick(); bool PauseGameDrawing(); void SetUserInterface(enum PartyAlignment alignment, bool bReplace); void __cdecl reset_some_strus_flt_2Cs(); @@ -1793,7 +1789,7 @@ int __cdecl j_SetSomeItemsNames(); -unsigned int __fastcall SkillToMastery(unsigned __int16 a1); +unsigned int SkillToMastery(unsigned int skill_value); unsigned int __fastcall GetSpellColor(signed int a1); void *__thiscall unknown_vdtor_6(void *_this, bool a2); unsigned short * MakeScreenshot(signed int width, signed int height); @@ -1956,33 +1952,33 @@ int _48B561_mess_with_scaling_along_z(/*int a1, */float a2); signed int __cdecl PlayerCreation_Chose4Skills(); signed int __cdecl PlayerCreation_ComputeAttributeBonus(); -void __cdecl LoadPlayerPortraintsAndVoices(); +void LoadPlayerPortraintsAndVoices(); int __fastcall ReloadPlayerPortraits(int, int); // weak -void __cdecl sub_491E3A(); -void __cdecl DrawHiredNPCs(); +void sub_491E3A(); +void DrawHiredNPCs(); void __thiscall GameUI_DrawPortraits(unsigned int _this); signed int __thiscall CycleCharacter(unsigned int _this); void __fastcall Rest(unsigned int uHoursToSleep); -int __cdecl _493938_regenerate(); +int _493938_regenerate(); void sub_493F79(struct stru351_summoned_item *_this, __int64 a2); -void __cdecl _494035_timed_effects__water_walking_damage__etc(); +void _494035_timed_effects__water_walking_damage__etc(); unsigned int __fastcall _494820_training_time(unsigned int a1); char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2); char * GetReputationString(signed int a1); char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, struct ItemGen *a3, char *a4, int a5, __int64 *a6); -void __cdecl PlayerCreationUI_Draw(); -void __cdecl PlayerCreationUI_Initialize(); -void __cdecl DeleteCCharFont(); -bool __cdecl PlayerCreationUI_Loop(); -void __cdecl loc_49B785(); // idb +void PlayerCreationUI_Draw(); +void PlayerCreationUI_Initialize(); +void DeleteCCharFont(); +bool PlayerCreationUI_Loop(); +void loc_49B785(); // idb unsigned int __fastcall GetMaxMipLevels(unsigned int uDim); -bool __cdecl CheckTextureStages(); -bool __cdecl AreRenderSurfacesOk(); +bool CheckTextureStages(); +bool AreRenderSurfacesOk(); unsigned int BlendColors(unsigned int c1, unsigned int c2); // weak -void __cdecl DoRenderBillboards_D3D(); +void DoRenderBillboards_D3D(); int __fastcall sr_4A46E6_draw_particle_segment(unsigned int x, signed int y, signed int z, int a4, unsigned int lightColor); -void __cdecl Present_ColorKey(); -void __cdecl Present_NoColorKey(); +void Present_ColorKey(); +void Present_NoColorKey(); int __thiscall sub_4A7063(unsigned int uDiffuse, float a2); // idb struct SoundHeader *__fastcall FindSound_BinSearch(unsigned int uStart, unsigned int uEnd, const char *pName); struct SoundData *LoadSound(const char *pSoundName, struct SoundData *pOutBuff, unsigned int uID);
--- a/stru6.cpp Mon May 13 09:39:49 2013 +0600 +++ b/stru6.cpp Mon May 13 09:39:58 2013 +0600 @@ -1286,11 +1286,6 @@ PlayerBuffAnim *v4; // esi@1 const char *v6; // [sp-4h] [bp-10h]@2 - //v3 = this; - //v4 = &array_0[uPlayerID]; - //v4[32].uSpellIconID_ = 0; pPlayerBuffs[]::field_4 - //v4[32].uSpellID = uSpellID; pPlayerBuffs[]::bRender - v4 = &pPlayerBuffs[uPlayerID]; v4->uSpellAnimTimeElapsed = 0; v4->bRender = uSpellID != 0; @@ -1298,7 +1293,6 @@ switch (uSpellID) { case SPELL_DISEASE: - //__debugbreak(); // spell id == 153 wtf , curse probably ? happening when attacked by harpies /disease(Ritor1)/ v6 = "zapp"; break; @@ -1367,16 +1361,12 @@ case SPELL_BODY_PROTECTION_FROM_MAGIC: v6 = "spell75"; break; default: - //v4[32].uSpellID = 0; v4->bRender = false; return; } - //v4[33].uSpellIconID = pIconsFrameTable->FindIcon(v6); v4->uSpellIconID = pIconsFrameTable->FindIcon(v6); - //if ( v4[32].uSpellID ) if (v4->bRender) - //v3->array_0[(signed __int16)uPlayerID + 33].uSpellAnimLength = 8 * pIconsFrameTable->pIcons[v4[33].uSpellIconID].uAnimLength; v4->uSpellAnimTime = 8 * pIconsFrameTable->pIcons[v4->uSpellIconID].uAnimLength; }