# HG changeset patch # User Ritor1 # Date 1368536708 -21600 # Node ID 3ee391de04d50ea1a479e9625ad426bda22554d8 # Parent d5796c3186533a90abc4562a854c0d5bae5edce7# Parent 53109a1455fc7bd7f7356107a61a22c150dd0145 Слияние diff -r d5796c318653 -r 3ee391de04d5 Actor.cpp --- a/Actor.cpp Tue May 14 19:04:48 2013 +0600 +++ b/Actor.cpp Tue May 14 19:05:08 2013 +0600 @@ -34,6 +34,61 @@ stru319 stru_50C198; // idb + + + +//----- (0041AF52) -------------------------------------------------------- +void Actor::DrawHealthBar(Actor *a1, GUIWindow *a2) +{ + unsigned int v2; // eax@1 + GUIWindow *v3; // edi@1 + unsigned int v4; // esi@1 + signed int v5; // ebx@4 + double v6; // st7@5 + unsigned int v7; // eax@6 + unsigned int v8; // ebx@10 + unsigned int v9; // [sp+14h] [bp-Ch]@4 + unsigned int v10; // [sp+1Ch] [bp-4h]@4 + + v2 = a1->pMonsterInfo.uHP; + v3 = a2; + v4 = 25; + if ( (signed int)v2 > 25 ) + { + v4 = 200; + if ( (signed int)v2 < 200 ) + v4 = a1->pMonsterInfo.uHP; + } + v5 = a1->sCurrentHP; + v10 = v4; + v9 = uTextureID_mhp_grn; + if ( v5 < (signed int)v2 ) + { + v6 = (double)(signed int)v2; + v10 = (signed __int64)((double)(signed int)v4 / (double)(signed int)v2 * (double)a1->sCurrentHP); + if ( v5 <= (signed int)(signed __int64)(0.34 * v6) ) + { + v7 = uTextureID_mhp_red; + v9 = v7; + } + else if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) ) + { + v7 = uTextureID_mhp_yel; + v9 = v7; + } + } + v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2; + + pRenderer->SetTextureClipRect(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52); + pRenderer->DrawTextureIndexed(v8, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_bd)); + pRenderer->SetTextureClipRect(v8, v3->uFrameY + 32, v8 + v10, v3->uFrameY + 52); + pRenderer->DrawTextureIndexed(v8, v3->uFrameY + 34, pIcons_LOD->GetTexture(v9)); + + pRenderer->ResetTextureClipRect(); + pRenderer->DrawTextureIndexed(v8 - 5, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capl)); + pRenderer->DrawTextureIndexed(v8 + v4, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capr)); +} + //----- (00448A40) -------------------------------------------------------- void Actor::ToggleFlag(signed int uActorID, unsigned int uFlag, int bToggle) { diff -r d5796c318653 -r 3ee391de04d5 GUIWindow.cpp --- a/GUIWindow.cpp Tue May 14 19:04:48 2013 +0600 +++ b/GUIWindow.cpp Tue May 14 19:05:08 2013 +0600 @@ -76,6 +76,105 @@ + + + +//----- (0041B4E1) -------------------------------------------------------- +int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) +{ + unsigned __int8 v3; // bl@1 + int result; // eax@1 + int i; // edx@2 + GUIButton *j; // ecx@3 + int k; // edx@7 + GUIButton *l; // ecx@8 + unsigned __int8 v9; // [sp+4h] [bp-8h]@1 + char v10; // [sp+8h] [bp-4h]@1 + + v3 = uNewHotkey; + v10 = toupper(uOldHotkey); + result = toupper(v3); + v9 = result; + if ( bFirstCall ) + { + for ( i = uNumVisibleWindows; i >= 0; --i ) + { + result = 84 * pVisibleWindowsIdxs[i]; + //for ( j = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); j; j = j->pNext ) + for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) + j->field_28 = 0; + } + } + for ( k = uNumVisibleWindows; k >= 0; --k ) + { + result = 84 * pVisibleWindowsIdxs[k]; + //for ( l = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); l; l = l->pNext ) + for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) + { + LOBYTE(result) = v10; + if ( l->uHotkey == v10 ) + { + if ( !l->field_28 ) + { + LOBYTE(result) = v9; + l->field_28 = 1; + l->uHotkey = v9; + } + } + } + } + return result; +} + + + + +//----- (0041B438) -------------------------------------------------------- +GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) +{ + char v1; // al@1 + int v2; // esi@1 + char v3; // dl@1 + GUIWindow *v4; // ecx@2 + GUIButton *result; // eax@2 + //int v6; // edx@12 + + v1 = toupper(uHotkey); + v2 = uNumVisibleWindows; + v3 = v1; + if ( uNumVisibleWindows >= 0 ) + { + while ( 2 ) + { + v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1]; + for ( result = v4->pControlsHead; result; result = result->pNext ) + { + if ( result->uHotkey == v3 ) + { + pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0); + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)result->uControlID; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + return result; + } + } + if ( v4->uFrameX || v4->uFrameY || !(v4->uFrameWidth == 640 & v4->uFrameHeight == 480) ) + { + --v2; + if ( v2 >= 0 ) + continue; + } + break; + } + } + return 0; +} +// 5075E0: using guessed type int pVisibleWindowsIdxs[20]; + //----- (0041D73D) -------------------------------------------------------- char GUIWindow::_41D73D_draw_buff_tooltip() { @@ -555,11 +654,11 @@ pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, - 1, 0, UIMSG_AutonotesBook, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up" + 1, 0, UIMSG_ClickBooksBtn, 0xBu, 0, pGlobalTXT_LocalizationStrings[192],// "Scroll Up" pTex_tab_an_6b__zoom_on, 0); pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, - 1, 0, UIMSG_AutonotesBook, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down" + 1, 0, UIMSG_ClickBooksBtn, 0xAu, 0, pGlobalTXT_LocalizationStrings[193],// "Scroll Down" pTex_tab_an_7b__zoot_on, 0); num_achieved_awards = 0; memset(achieved_awards, 0, 4000); @@ -600,14 +699,14 @@ pTexture_50636C = pIcons_LOD->LoadTexturePtr("tab-an-8b", TEXTURE_16BIT_PALETTE); pTexture_506368 = pIcons_LOD->LoadTexturePtr("tab-an-8a", TEXTURE_16BIT_PALETTE); - pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, UIMSG_AutonotesBook, 11, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_6b__zoom_on, 0); - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, UIMSG_AutonotesBook, 10, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_7b__zoot_on, 0); - pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, UIMSG_AutonotesBook, 2, 0, pGlobalTXT_LocalizationStrings[85], pTexture_506394, 0); // "Potion Notes" - pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, UIMSG_AutonotesBook, 3, 0, pGlobalTXT_LocalizationStrings[137], pTexture_50638C, 0); // "Fountain Notes" - pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, UIMSG_AutonotesBook, 4, 0, pGlobalTXT_LocalizationStrings[8], pTexture_506384, 0); // "Obelisk Notes" - pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, UIMSG_AutonotesBook, 5, 0, pGlobalTXT_LocalizationStrings[141], pTexture_50637C, 0); // "Seer Notes" - pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0, UIMSG_AutonotesBook, 6, 0, pGlobalTXT_LocalizationStrings[123], pTexture_506374, 0); // "Miscellaneous Notes" - pBtn_Autonotes_Instructors = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0, UIMSG_AutonotesBook, 7, 0, pGlobalTXT_LocalizationStrings[662], pTexture_50636C, 0); // "Instructors" + pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_6b__zoom_on, 0); + pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_7b__zoot_on, 0); + pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[85], pTexture_506394, 0); // "Potion Notes" + pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 399, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[137], pTexture_50638C, 0); // "Fountain Notes" + pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[8], pTexture_506384, 0); // "Obelisk Notes" + pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[141], pTexture_50637C, 0); // "Seer Notes" + pBtn_Autonotes_Misc = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 264, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 6, 0, pGlobalTXT_LocalizationStrings[123], pTexture_506374, 0); // "Miscellaneous Notes" + pBtn_Autonotes_Instructors = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 302, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 7, 0, pGlobalTXT_LocalizationStrings[662], pTexture_50636C, 0); // "Instructors" v9 = pBtn_Autonotes_Instructors; v10 = dword_506528; @@ -649,12 +748,12 @@ pTexture_50637C = pIcons_LOD->LoadTexturePtr("tabWon", TEXTURE_16BIT_PALETTE); pTexture_506378 = pIcons_LOD->LoadTexturePtr("tabWoff", TEXTURE_16BIT_PALETTE); - pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, UIMSG_AutonotesBook, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_tab_an_6b__zoom_on, 0);// "Zoom In" - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, UIMSG_AutonotesBook, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_tab_an_7b__zoot_on, 0);// "Zoom Out" - pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, UIMSG_AutonotesBook, 2, 0, pGlobalTXT_LocalizationStrings[192], (Texture *)"", 0);// Scroll Up - pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, UIMSG_AutonotesBook, 3, 0, pGlobalTXT_LocalizationStrings[193], (Texture *)"", 0);// Scroll Down - pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, UIMSG_AutonotesBook, 4, 0, pGlobalTXT_LocalizationStrings[573], (Texture *)"", 0);// "Scroll Right" - pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, UIMSG_AutonotesBook, 5, 0, pGlobalTXT_LocalizationStrings[572], (Texture *)"", 0);// "Scroll Left" + pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 0, 0, pGlobalTXT_LocalizationStrings[251], pTex_tab_an_6b__zoom_on, 0);// "Zoom In" + pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 1, 0, pGlobalTXT_LocalizationStrings[252], pTex_tab_an_7b__zoot_on, 0);// "Zoom Out" + pBtn_Book_3 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 113, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 2, 0, pGlobalTXT_LocalizationStrings[192], (Texture *)"", 0);// Scroll Up + pBtn_Book_4 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 150, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 3, 0, pGlobalTXT_LocalizationStrings[193], (Texture *)"", 0);// Scroll Down + pBtn_Book_5 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 188, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 4, 0, pGlobalTXT_LocalizationStrings[573], (Texture *)"", 0);// "Scroll Right" + pBtn_Book_6 = v1->CreateButton(pViewport->uViewportTL_X + 397, pViewport->uViewportTL_Y + 226, 50, 34, 1, 0, UIMSG_ClickBooksBtn, 5, 0, pGlobalTXT_LocalizationStrings[572], (Texture *)"", 0);// "Scroll Left" } break; @@ -677,8 +776,8 @@ pTex_tab_an_6a__zoom_off = pIcons_LOD->LoadTexturePtr("tab-an-6a", TEXTURE_16BIT_PALETTE); pTex_tab_an_7a__zoot_off = pIcons_LOD->LoadTexturePtr("tab-an-7a", TEXTURE_16BIT_PALETTE); - pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, 1, 0, UIMSG_AutonotesBook, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_6b__zoom_on, 0); - pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, UIMSG_AutonotesBook, 10, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_7b__zoot_on, 0); + pBtn_Book_1 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 1, pTex_tab_an_6b__zoom_on->uTextureWidth, pTex_tab_an_6b__zoom_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 11, 0, pGlobalTXT_LocalizationStrings[192], pTex_tab_an_6b__zoom_on, 0); + pBtn_Book_2 = v1->CreateButton(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 38, pTex_tab_an_7b__zoot_on->uTextureHeight, pTex_tab_an_7b__zoot_on->uTextureHeight, 1, 0, UIMSG_ClickBooksBtn, 10, 0, pGlobalTXT_LocalizationStrings[193], pTex_tab_an_7b__zoot_on, 0); num_achieved_awards = 0; v26.uFrameX = 48; @@ -845,56 +944,7 @@ } -//----- (0041192C) -------------------------------------------------------- -void __cdecl InitializeBookTextures() -{ - //signed int v0; // ebp@3 - //Texture **v1; // ebx@3 - pAudioPlayer->StopChannels(-1, -1); - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); - pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE); - pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE); - pTexture_506448 = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); - ptr_506440 = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); - pTexture_50643C = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE); - //v0 = 1; - - static const char *texNames[9] = - { - "SBFB00", "SBAB00", "SBWB00", "SBEB00", - "SBSB00", "SBMB00", "SBBB00", "SBLB00", - }; - - pTexture_506444 = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE); - for (uint i = 0; i < 8; ++i) - { - pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE); - - sprintf(pTmpBuf, "tab%da", i+1); - pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE); - sprintf(pTmpBuf, "tab%db", i+1); - pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE); - } -} - -//----- (00411AAA) -------------------------------------------------------- -void __cdecl InitializeBookFonts() -{ - pAudioPlayer->StopChannels(-1, -1); - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); - pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE); - pBookFont = LoadFont("book.fnt", "FONTPAL", NULL); - pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL); - pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL); - pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); -} //----- (00411B59) -------------------------------------------------------- void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer) diff -r d5796c318653 -r 3ee391de04d5 GUIWindow.h --- a/GUIWindow.h Tue May 14 19:04:48 2013 +0600 +++ b/GUIWindow.h Tue May 14 19:05:08 2013 +0600 @@ -16,7 +16,7 @@ UIMSG_CHEST_ClickItem = 12, - UIMSG_E = 14, + UIMSG_MouseLeftClickInScreen = 14, UIMSG_F = 15, UIMSG_11 = 17, @@ -49,9 +49,9 @@ UIMSG_PlayerCreationClickOK = 66, UIMSG_PlayerCreationClickReset = 67, UIMSG_44 = 68, - UIMSG_CastSpell_SPIRIT_Preservation = 69, - UIMSG_CastSpell_SmallShot = 70, - UIMSG_AutonotesBook = 71, + UIMSG_CastSpell_Character_Big_Improvement = 69, + UIMSG_CastSpell_Shoot_Monster = 70, + UIMSG_ClickBooksBtn = 71, UIMSG_48 = 72, UIMSG_49 = 73, UIMSG_PlayerCreationRemoveUpSkill = 74, @@ -114,10 +114,10 @@ UIMSG_StartHireling2Dialogue = 135, UIMSG_SelectNPCDialogueOption = 136, - UIMSG_CastSpell_GreatShot = 140, - UIMSG_CastSpell_SPIRIT_Fate = 141, + UIMSG_CastSpell_Monster_Improvement = 140, + UIMSG_CastSpell_Character_Small_Improvement = 141, UIMSG_CastSpellFromBook = 142, - UIMSG_CastSpell_8F = 143, + UIMSG_HiredNPC_CastSpell = 143, UIMSG_PlayerCreation_VoicePrev = 144, UIMSG_PlayerCreation_VoiceNext = 145, UIMSG_92 = 146, @@ -268,6 +268,7 @@ WINDOW_SpellBook = 0x12, WINDOW_GreetingNPC = 19, WINDOW_Chest = 0x14, + WINDOW_22 = 0x16, WINDOW_SaveLoadButtons = 23, WINDOW_MainMenu_Load = 0x18, WINDOW_HouseInterior = 0x19, @@ -460,7 +461,30 @@ -void QuickRefDraw(); + + +void draw_leather(); + + + + +// game ui +void GameUI_DrawRightPanel(); +void GameUI_DrawRightPanelFrames(); +void GameUI_DrawRightPanelItems(); +void GameUI_QuickRef_Draw(); +void GameUI_DrawFoodAndGold(); +void GameUI_DrawLifeManaBars(); +void GameUI_DrawHiredNPCs(); +void GameUI_DrawPortraits(unsigned int _this); +void GameUI_Footer(); +void GameUI_Footer_2(); +void GameUI_SetFooterString(const char *pStr); +void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap); +void GameUI_DrawPartySpells(); +void GameUI_DrawTorchlightAndWizardEye(); +void GameUI_DrawCharacterSelectionFrame(); + @@ -471,21 +495,43 @@ -//character ui -unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level); +// character ui +struct GUIWindow *CharacterUI_Initialize(unsigned int _this); 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 +char CharacterUI_StatsTab_Draw(Player *player); +void CharacterUI_SkillsTab_CreateButtons(); void CharacterUI_SkillsTab_Draw(Player *player); -void CharacterUI_AwardsTab_Draw(unsigned int uPlayerID); // idb +void CharacterUI_AwardsTab_Draw(Player *player); void CharacterUI_InventoryTab_Draw(Player *player, bool a2); -void CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx); // idb +void CharacterUI_CharacterScreen_Draw(Player *player); +void CharacterUI_DrawPaperdoll(Player *player); +void CharacterUI_DrawPaperdollWithRingOverlay(Player *player); +void CharacterUI_ReleaseButtons(); + +unsigned int GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level); +//book ui +void BookUI_Draw(WindowType book); +void BookUI_Questbook_Draw(); +void BookUI_Autonotes_Draw(); +void BookUI_Map_Draw(); +void BookUI_Calendar_Draw(); + +void OnCloseSpellBook(); +void InitializeBookTextures(); +void InitializeBookFonts(); +void DrawSpellBookContent(); +void DrawBook_History(); +unsigned int __cdecl DrawLloydBeaconsScreen(); +void DrawTownPortalScreen(); +void LoadSpellbook(unsigned int uID); // idb +void DrawSpellDescriptionPopup(int spell_index); @@ -644,11 +690,26 @@ extern GUIButton *pCreationUI_BtnPressLeft[4]; extern GUIButton *pCreationUI_BtnPressRight[4]; +extern int uTextureID_GameUI_CharSelectionFrame; // 50C98C -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 +extern unsigned int ui_character_default_text_color; +extern unsigned int ui_character_skill_highlight_color; +extern unsigned int ui_character_header_text_color; +extern unsigned int ui_character_bonus_text_color; +extern unsigned int ui_character_bonus_text_color_neg; +extern unsigned int ui_character_skill_upgradeable_color; +extern unsigned int ui_character_skill_default_color; +extern unsigned int ui_character_award_color[6]; +extern unsigned int ui_game_minimap_outline_color; +extern unsigned int ui_game_minimap_actor_friendly_color; +extern unsigned int ui_game_minimap_actor_hostile_color; +extern unsigned int ui_game_minimap_actor_corpse_color; +extern unsigned int ui_game_minimap_decoration_color_1; +extern unsigned int ui_game_minimap_projectile_color; +extern unsigned int ui_game_minimap_treasure_color; +extern unsigned int ui_book_quests_title_color; +extern unsigned int ui_book_quests_text_color; +extern unsigned int ui_book_autonotes_title_color; +extern unsigned int ui_book_autonotes_text_color; +extern unsigned int ui_book_map_title_color; +extern unsigned int ui_book_map_coordinates_color; \ No newline at end of file diff -r d5796c318653 -r 3ee391de04d5 Game.cpp --- a/Game.cpp Tue May 14 19:04:48 2013 +0600 +++ b/Game.cpp Tue May 14 19:05:08 2013 +0600 @@ -160,12 +160,12 @@ GameUI_DrawPartySpells(); if (v4 || pParty->pHirelings[0].evt_C || pParty->pHirelings[1].evt_C ) - DrawHiredNPCs(); + GameUI_DrawHiredNPCs(); GameUI_DrawPortraits(v4); GameUI_DrawLifeManaBars(); GameUI_DrawCharacterSelectionFrame(); if ( sub_44100D() ) - draw_right_panel(); + GameUI_DrawRightPanel(); if ( !pVideoPlayer->AnyMovieLoaded() ) { pStru6Instance->DrawPlayerBuffAnims(); diff -r d5796c318653 -r 3ee391de04d5 Player.cpp --- a/Player.cpp Tue May 14 19:04:48 2013 +0600 +++ b/Player.cpp Tue May 14 19:05:08 2013 +0600 @@ -3273,9 +3273,9 @@ unsigned int result; // eax@2 if ( CanTrainToNextLevel() ) - result = TargetColor(0, 0xFFu, 0); + result = ui_character_bonus_text_color; else - result = 0; + result = ui_character_default_text_color; return result; } @@ -7708,7 +7708,7 @@ goto LABEL_187; /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -7785,19 +7785,20 @@ { _720984_unused = pParty->pPickedItem.uItemID; pMouse->RemoveHoldingItem(); - if ( dword_50C9E8 < 40 ) + /*if ( dword_50C9E8 < 40 ) { dword_50C9EC[3 * dword_50C9E8] = 146; dword_50C9EC[3 * dword_50C9E8 + 1] = v24; dword_50C9EC[3 * dword_50C9E8 + 2] = a2 - 1; ++dword_50C9E8; - } + }*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_92, 0, 0); if ( pCurrentScreen && pGUIWindow_CurrentMenu && pGUIWindow_CurrentMenu->eWindowType != WINDOW_null) //&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + /*pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages;*/ diff -r d5796c318653 -r 3ee391de04d5 Player.h --- a/Player.h Tue May 14 19:04:48 2013 +0600 +++ b/Player.h Tue May 14 19:05:08 2013 +0600 @@ -138,10 +138,10 @@ /* 339 */ enum CHARACTER_RACE { - CHARACTER_RACE_HUMAN = 0x0, - CHARACTER_RACE_ELF = 0x1, - CHARACTER_RACE_GOBLIN = 0x2, - CHARACTER_RACE_DWARF = 0x3, + CHARACTER_RACE_HUMAN = 0, + CHARACTER_RACE_ELF = 1, + CHARACTER_RACE_GOBLIN = 2, + CHARACTER_RACE_DWARF = 3, }; enum CHARACTER_ATTRIBUTE { diff -r d5796c318653 -r 3ee391de04d5 Render.cpp --- a/Render.cpp Tue May 14 19:04:48 2013 +0600 +++ b/Render.cpp Tue May 14 19:05:08 2013 +0600 @@ -887,7 +887,7 @@ int v21; // ecx@43 //char v22; // zf@44 int v23; // ecx@47 - int v24; // edi@52 + //int v24; // edi@52 int v25; // eax@54 int v26; // ecx@54 int v27; // eax@56 @@ -932,7 +932,7 @@ int v66; // edx@163 int v67; // ecx@164 int v68; // ecx@167 - int v69; // eax@173 + //int v69; // eax@173 int v70; // edi@178 //int v71; // eax@178 //int v72; // ecx@178 @@ -1132,7 +1132,7 @@ v21 = terrain_76DFC8[v17]; while ( 1 ) { - v125 = v21; + v125 = terrain_76DFC8[v17]; if ( v21 < v124 ) break; terrain_76DBC8[v16] = v21; @@ -1156,12 +1156,12 @@ ++v16; } v16 = 0; - v24 = terrain_76E3C8[v18]; + //v24 = terrain_76E3C8[v18]; v126 = 0; - if ( v120 > v24 ) + if ( v120 > terrain_76E3C8[v18] ) { v125 = v120; - memset32(terrain_76D5C8, v122, 4 * (v120 - v24 + 1)); + memset32(terrain_76D5C8, v122, 4 * (v120 - terrain_76E3C8[v18] + 1)); do { v25 = v126; @@ -1517,13 +1517,14 @@ default: break; } - v69 = v16 - 1; + //v69 = v16 - 1; ptr_801A08 = pVerticesSR_806210; ptr_801A04 = pVerticesSR_801A10; - v126 = v69; + //v126 = v69; + if ( v105 && v105 != 7 && v105 != 3 && v105 != 4 )// { - for ( i = v69; i >= 1; --i ) + for ( i = v16 - 1; i >= 1; --i ) { //v70 = i; //v71 = terrain_76D7C8[i];//88 @@ -1584,7 +1585,7 @@ } else { - for ( i = v69; i >= 1; --i ) + for ( i = v16 - 1; i >= 1; --i ) { //v86 = i; //v87 = terrain_76D5C8[i]; @@ -1655,6 +1656,7 @@ // 47FFC4: inconsistent fpu stack // 4D864C: using guessed type char byte_4D864C; + void Render::RenderTerrainD3D() // New function. It's temporary { char result; // al@3 @@ -10584,7 +10586,7 @@ } //----- (004A601E) -------------------------------------------------------- -void Render::_4A601E(signed int a2, signed int a3, Texture *pTexture, int a5) +void Render::ZBuffer_Fill_2(signed int a2, signed int a3, Texture *pTexture, int a5) { signed int v5; // edx@3 int v6; // ebx@3 diff -r d5796c318653 -r 3ee391de04d5 Render.h --- a/Render.h Tue May 14 19:04:48 2013 +0600 +++ b/Render.h Tue May 14 19:05:08 2013 +0600 @@ -342,7 +342,7 @@ void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4); void _4A5D33(unsigned int a2, unsigned int a3, int a4, int a5, RGBTexture *pTexture); void DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4); - void _4A601E(signed int a2, signed int a3, Texture *pTexture, int a5); + void ZBuffer_Fill_2(signed int a2, signed int a3, Texture *pTexture, int a5); void DrawMaskToZBuffer(signed int uOutX, unsigned int uOutY, Texture *pTexture, int zVal); void DrawTextureTransparent(unsigned int uX, unsigned int uY, Texture *pTexture); void _4A63E6(unsigned int a2, unsigned int a3, Texture *a4, Texture *a5, int a6, int a7, int a8); diff -r d5796c318653 -r 3ee391de04d5 UIBooks.cpp --- a/UIBooks.cpp Tue May 14 19:04:48 2013 +0600 +++ b/UIBooks.cpp Tue May 14 19:05:08 2013 +0600 @@ -46,6 +46,164 @@ + + + +//----- (00413CC6) -------------------------------------------------------- +void BookUI_Draw(WindowType book) +{ + pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); + switch (book) + { + case WINDOW_QuestBook: BookUI_Questbook_Draw(); break; + case WINDOW_AutonotesBook: BookUI_Autonotes_Draw(); break; + case WINDOW_MapsBook: BookUI_Map_Draw(); break; + case WINDOW_CalendarBook: BookUI_Calendar_Draw(); break; + case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break; + case WINDOW_TownPortal: DrawTownPortalScreen(); break; + case WINDOW_HistoryBook: DrawBook_History(); break; + } +} + + + +//----- (00413D6F) -------------------------------------------------------- +void BookUI_Calendar_Draw() +{ + unsigned int v0; // esi@1 + char *v1; // eax@5 + int v2; // ecx@5 + char *v3; // eax@6 + GUIWindow a1; // [sp+Ch] [bp-60h]@5 + unsigned int v6; // [sp+60h] [bp-Ch]@1 + int v7; // [sp+64h] [bp-8h]@1 + int a5; // [sp+68h] [bp-4h]@1 + + v0 = pParty->uCurrentHour; + v6 = pMapStats->GetMapInfo(pCurrentMapName); + a5 = TargetColor(0x4Bu, 0x4Bu, 0x4Bu); + pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13); + v7 = (unsigned __int8)pDayMoonPhase[pParty->uDaysPlayed]; + if ( (signed int)v0 <= 12 ) + { + if ( !v0 ) + v0 = 12; + } + else + { + v0 -= 12; + } + a1.uFrameX = game_viewport_x; + a1.uFrameY = game_viewport_y; + a1.uFrameWidth = game_viewport_width; + a1.uFrameHeight = game_viewport_height; + a1.uFrameZ = game_viewport_z; + a1.uFrameW = game_viewport_w; + a1.DrawTitleText(pBook2Font, 0, 0x16u, 0, pGlobalTXT_LocalizationStrings[186], 3u); + if ( pParty->uCurrentHour >= 12 ) + { + if ( pParty->uCurrentHour >= 24 ) + v2=0; + else + v2=1; + } + else + v2=0; + v1 = GetDayPart(); + sprintf( + pTmpBuf, + "%s\t100:\t110%d:%02d %s - %s", + pGlobalTXT_LocalizationStrings[526], + v0, + pParty->uCurrentMinute, + aAMPMNames[v2], + v1); + a1.DrawText(pBookFont, 70, 55, a5, pTmpBuf, 0, 0, 0); + sprintf( + pTmpBuf, + "%s\t100:\t110%d - %s", + pGlobalTXT_LocalizationStrings[56], + pParty->uDaysPlayed + 1, + aDayNames[pParty->uDaysPlayed % 7]); + a1.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, a5, pTmpBuf, 0, 0, 0); + sprintf( + pTmpBuf, + "%s\t100:\t110%d - %s", + pGlobalTXT_LocalizationStrings[146], + pParty->uCurrentMonth + 1, + aMonthNames[pParty->uCurrentMonth]); + a1.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, a5, pTmpBuf, 0, 0, 0); + sprintf(pTmpBuf, "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); + a1.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, a5, pTmpBuf, 0, 0, 0); + sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[v7]); + a1.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, a5, pTmpBuf, 0, 0, 0); + if ( v6 ) + v3 = pMapStats->pInfos[v6].pName; + else + v3 = "Unknown"; + sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], v3); + a1.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, a5, pTmpBuf, 0, 0, 0); +} + + + +//----- (0041192C) -------------------------------------------------------- +void InitializeBookTextures() +{ + //signed int v0; // ebp@3 + //Texture **v1; // ebx@3 + + pAudioPlayer->StopChannels(-1, -1); + + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + + pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); + pSpellBookPagesTextr_9 = pIcons_LOD->LoadTexturePtr("book", TEXTURE_16BIT_PALETTE); + pTexture_pagemask = pIcons_LOD->LoadTexturePtr("pagemask", TEXTURE_16BIT_PALETTE); + pTexture_506448 = pIcons_LOD->LoadTexturePtr("ib-m5-u", TEXTURE_16BIT_PALETTE); + ptr_506440 = pIcons_LOD->LoadTexturePtr("ib-m5-d", TEXTURE_16BIT_PALETTE); + pTexture_50643C = pIcons_LOD->LoadTexturePtr("ib-m6-u",TEXTURE_16BIT_PALETTE); + //v0 = 1; + + static const char *texNames[9] = + { + "SBFB00", "SBAB00", "SBWB00", "SBEB00", + "SBSB00", "SBMB00", "SBBB00", "SBLB00", + }; + + pTexture_506444 = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE); + for (uint i = 0; i < 8; ++i) + { + pSpellBookPagesTextr[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE); + + sprintf(pTmpBuf, "tab%da", i+1); + pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE); + sprintf(pTmpBuf, "tab%db", i+1); + pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE); + } +} + + + +//----- (00411AAA) -------------------------------------------------------- +void InitializeBookFonts() +{ + pAudioPlayer->StopChannels(-1, -1); + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); + pTexture_mapbordr = pIcons_LOD->LoadTexturePtr("mapbordr", TEXTURE_16BIT_PALETTE); + pBookFont = LoadFont("book.fnt", "FONTPAL", NULL); + pBook2Font = LoadFont("book2.fnt", "FONTPAL", NULL); + pAutonoteFont = LoadFont("autonote.fnt", "FONTPAL", NULL); + pSpellFont = LoadFont("spell.fnt", "FONTPAL", NULL); +} + + + //----- (00411300) -------------------------------------------------------- void LoadSpellbook(unsigned int spell_school) { @@ -85,7 +243,7 @@ } //----- (0041140B) -------------------------------------------------------- -GUIWindow *__cdecl sub_41140B() +GUIWindow *sub_41140B() { signed int v0; // esi@1 GUIButton *v1; // eax@3 @@ -120,7 +278,7 @@ } //----- (00411473) -------------------------------------------------------- -void __cdecl sub_411473() +void sub_411473() { pTexture_pagemask->Release(); pTexture_506448->Release(); @@ -137,7 +295,7 @@ //----- (00411597) -------------------------------------------------------- -void __cdecl OnCloseSpellBook() +void OnCloseSpellBook() { pAllocator->FreeChunk(pSpellFont); pSpellFont = 0; @@ -162,7 +320,7 @@ //----- (00412AF9) -------------------------------------------------------- void sub_412AF9() - { +{ int v0; // ecx@1 v0 = 0; @@ -174,7 +332,7 @@ } //----- (00412B58) -------------------------------------------------------- -void __cdecl DrawSpellBookContent() +void DrawSpellBookContent() { Player *v0; // ebx@1 int v1; // ebp@1 @@ -377,7 +535,7 @@ // 50654C: using guessed type int dword_50654C; //----- (00412E85) -------------------------------------------------------- -char __cdecl DrawBook_History() +void DrawBook_History() { unsigned int v0; // eax@3 unsigned int v1; // eax@7 @@ -396,7 +554,7 @@ GUIWindow a1; // [sp+8h] [bp-54h]@10 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_11); - if ( dword_506548 || !dword_506528 ) + if ( BtnUp_flag || !dword_506528 ) { v13 = pTex_tab_an_6a__zoom_off; v11 = pViewport->uViewportTL_Y + 2; @@ -409,7 +567,7 @@ v0 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v0, v11, v13); - if ( dword_506544 || dword_506528 + num_achieved_awards >= num_achieved_awards_2 ) + if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 ) { v14 = pTex_tab_an_7a__zoot_off; v12 = pViewport->uViewportTL_Y + 38; @@ -433,7 +591,7 @@ a1.uFrameZ = game_viewport_z; a1.uFrameW = game_viewport_w; if ( v3 ) - a1.DrawTitleText(pBook2Font, 0, 0x16u, 0, v3, 3u); + a1.DrawTitleText(pBook2Font, 0, 22, 0, v3, 3); } a1.uFrameX = 48; a1.uFrameY = 70; @@ -443,14 +601,14 @@ a1.uFrameZ = 407; a1.uFrameHeight = v4 * 264 / v4; a1.uFrameW = a1.uFrameHeight + 69; - if ( dword_506544 && dword_506528 + num_achieved_awards < num_achieved_awards_2 ) + if ( BtnDown_flag && dword_506528 + num_achieved_awards < num_achieved_awards_2 ) { pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); v5 = dword_50651C++; dword_506528 += num_achieved_awards; byte_506130[v5] = num_achieved_awards; } - if ( dword_506548 && dword_50651C ) + if ( BtnUp_flag && dword_50651C ) { pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); --dword_50651C; @@ -461,9 +619,9 @@ dword_506528 = 0; dword_50651C = 0; } - dword_506544 = 0; + BtnDown_flag = 0; v6 = achieved_awards[dword_506528]; - dword_506548 = 0; + BtnUp_flag = 0; num_achieved_awards = 0; //v7 = *pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); v7 = (int)pStorylineText->StoreLine[v6].pText;//*(&pStorylineText->field_0 + 3 * v6); @@ -477,15 +635,14 @@ if ( v7 ) { v9 = pAutonoteFont->_44C6C2(v8, &a1, 1u, (unsigned __int8)byte_5C6D50[dword_506528]); - LOBYTE(v8) = a1.DrawText(pAutonoteFont, 1, 0, 0, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, 0); + a1.DrawText(pAutonoteFont, 1, 0, 0, (const char *)v9, 0, a1.uFrameY + a1.uFrameHeight, 0); ++num_achieved_awards; } - return (char)v8; } //----- (00413126) -------------------------------------------------------- -void __cdecl DrawBook_Quests() +void BookUI_Questbook_Draw() { unsigned int v0; // eax@3 unsigned int v1; // eax@7 @@ -502,7 +659,7 @@ GUIWindow a1; // [sp+Ch] [bp-54h]@9 pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_CurrentBook); - if ( dword_506548 || !dword_506528 ) + if ( BtnUp_flag || !dword_506528 ) { v10 = pTex_tab_an_6a__zoom_off; v8 = pViewport->uViewportTL_Y + 2; @@ -515,7 +672,7 @@ v0 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v0, v8, v10); - if ( dword_506544 || dword_506528 + num_achieved_awards >= num_achieved_awards_2 ) + if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 ) { v11 = pTex_tab_an_7a__zoot_off; v9 = pViewport->uViewportTL_Y + 38; @@ -534,21 +691,22 @@ a1.uFrameY = game_viewport_y; a1.uFrameZ = game_viewport_z; a1.uFrameW = game_viewport_w; - a1.DrawTitleText(pBook2Font, 0, 0x16u, 0, pGlobalTXT_LocalizationStrings[174], 3u); + a1.DrawTitleText(pBook2Font, 0, 22, ui_book_quests_title_color, pGlobalTXT_LocalizationStrings[174], 3); //"Current Quests" + a1.uFrameX = 48; a1.uFrameY = 70; a1.uFrameWidth = 360; a1.uFrameHeight = 264; a1.uFrameZ = 407; a1.uFrameW = 333; - if ( dword_506544 && dword_506528 + num_achieved_awards < num_achieved_awards_2 ) + if ( BtnDown_flag && dword_506528 + num_achieved_awards < num_achieved_awards_2 ) { pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); v2 = dword_50651C++; dword_506528 += num_achieved_awards; byte_506130[v2] = num_achieved_awards; } - if ( dword_506548 && dword_50651C ) + if ( BtnUp_flag && dword_50651C ) { pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); --dword_50651C; @@ -560,15 +718,15 @@ dword_50651C = 0; dword_506528 = 0; } - dword_506544 = 0; - dword_506548 = 0; + BtnDown_flag = 0; + BtnUp_flag = 0; num_achieved_awards = 0; while ( v3 < num_achieved_awards_2 ) { v4 = achieved_awards[v3]; ++num_achieved_awards; v5 = pQuestTable[v4-1];//(&dword_722F10)[4 * v4]; - a1.DrawText(pAutonoteFont, 1, 0, 0, pQuestTable[v4-1], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0); + a1.DrawText(pAutonoteFont, 1, 0, ui_book_quests_text_color, pQuestTable[v4-1], 0, 0, 0);//(&dword_722F10)[4 * v4], 0, 0, 0); v6 = pAutonoteFont->CalcTextHeight(v5, &a1, 1, 0); v7 = a1.uFrameY + v6; if ( (signed int)(a1.uFrameY + v6) > (signed int)a1.uFrameHeight ) @@ -581,7 +739,7 @@ //----- (0041338E) -------------------------------------------------------- -void __cdecl DrawBook_Autonotes() +void BookUI_Autonotes_Draw() { unsigned int v0; // eax@3 unsigned int v1; // eax@7 @@ -620,7 +778,7 @@ v31 = 0; pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pTexture_AutonotesBook); - if ( dword_506548 || !dword_506528 ) + if ( BtnUp_flag || !dword_506528 ) { v24 = pTex_tab_an_6a__zoom_off; v17 = pViewport->uViewportTL_Y + 2; @@ -633,7 +791,7 @@ v0 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v0, v17, v24); - if ( dword_506544 || dword_506528 + num_achieved_awards >= num_achieved_awards_2 ) + if ( BtnDown_flag || dword_506528 + num_achieved_awards >= num_achieved_awards_2 ) { v25 = pTex_tab_an_7a__zoot_off; v18 = pViewport->uViewportTL_Y + 38; @@ -646,7 +804,7 @@ v1 = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(v1, v18, v25); - if ( !dword_506540 ) + if ( !Book_PageBtn3_flag )//Potions_page_flag { if (_506568_autonote_type != AUTONOTE_POTION_RECEPIE) { @@ -672,7 +830,7 @@ _506568_autonote_type = AUTONOTE_POTION_RECEPIE; pRenderer->DrawTextureTransparent(pViewport->uViewportTL_X + 398, pViewport->uViewportTL_Y + 113, pTexture_506394); LABEL_16: - if ( dword_50653C ) + if ( Book_PageBtn4_flag )//Fontains_page_flag { if ( _506568_autonote_type != v2 ) { @@ -696,7 +854,7 @@ v3 = pViewport->uViewportTL_X + 399; LABEL_22: pRenderer->DrawTextureTransparent(v3, v19, v26); - if ( dword_506538 ) + if ( Book_PageBtn5_flag )//Autonotes_Obelisks_page_flag { if ( _506568_autonote_type != AUTONOTE_OBELISK) { @@ -720,7 +878,7 @@ v4 = pViewport->uViewportTL_X + 397; LABEL_28: pRenderer->DrawTextureTransparent(v4, v20, v27); - if ( dword_506534 ) + if ( Book_PageBtn6_flag )//Autonotes_Seer_page_flag { if ( _506568_autonote_type != AUTONOTE_SEER) { @@ -744,7 +902,7 @@ v5 = pViewport->uViewportTL_X + 397; LABEL_34: pRenderer->DrawTextureTransparent(v5, v21, v28); - if ( dword_506530 ) + if ( Autonotes_Misc_page_flag ) { if ( _506568_autonote_type != AUTONOTE_MISC) { @@ -768,7 +926,7 @@ v6 = pViewport->uViewportTL_X + 397; LABEL_40: pRenderer->DrawTextureTransparent(v6, v22, v29); - if ( dword_50652C ) + if ( Autonotes_Instructors_page_flag ) { if ( _506568_autonote_type != AUTONOTE_TEACHER) { @@ -795,10 +953,11 @@ a1.uFrameWidth = game_viewport_width; a1.uFrameHeight = game_viewport_height; a1.uFrameX = game_viewport_x; - a1.uFrameY = game_viewport_z; + a1.uFrameY = game_viewport_y; a1.uFrameZ = game_viewport_z; a1.uFrameW = game_viewport_w; - a1.DrawTitleText(pBook2Font, 0, 0x16u, 0, pGlobalTXT_LocalizationStrings[154], 3u); + a1.DrawTitleText(pBook2Font, 0, 22, ui_book_autonotes_title_color, pGlobalTXT_LocalizationStrings[154], 3); // "Auto notes" + a1.uFrameX = 48; a1.uFrameY = 70; a1.uFrameWidth = 360; @@ -835,7 +994,7 @@ } else { - if ( dword_506544 ) + if ( BtnDown_flag ) { v10 = num_achieved_awards + dword_506528; if ( num_achieved_awards + dword_506528 < num_achieved_awards_2 ) @@ -846,7 +1005,7 @@ pAudioPlayer->PlaySound((SoundID)230, 0, 0, -1, 0, 0, 0, 0); } } - if ( dword_506548 && dword_50651C ) + if ( BtnUp_flag && dword_50651C ) { --dword_50651C; dword_506528 -= (unsigned __int8)byte_506130[dword_50651C]; @@ -859,15 +1018,15 @@ } } v12 = dword_506528; - dword_50652C = 0; - dword_506544 = 0; - dword_506548 = 0; + Autonotes_Instructors_page_flag = 0; + BtnDown_flag = 0; + BtnUp_flag = 0; num_achieved_awards = 0; - dword_506530 = 0; - dword_506534 = 0; - dword_506538 = 0; - dword_50653C = 0; - dword_506540 = 0; + Autonotes_Misc_page_flag = 0; + Book_PageBtn6_flag = 0;//Autonotes_Seer_page_flag + Book_PageBtn5_flag = 0;//Autonotes_Obelisks_page_flag + Book_PageBtn4_flag = 0;//Fontains_page_flag + Book_PageBtn3_flag = 0;//Potions_page_flag while ( v12 < num_achieved_awards_2 ) { v13 = achieved_awards[v12]; @@ -875,7 +1034,7 @@ //v14 = (&dword_723718_autonote_related)[8 * v13]; v14 = pAutonoteTxt[v13-1].pText; //a1.DrawText(pAutonoteFont, 1, 0, 0, (&dword_723718_autonote_related)[8 * v13], 0, 0, 0); - a1.DrawText(pAutonoteFont, 1, 0, 0, pAutonoteTxt[v13-1].pText, 0, 0, 0); + a1.DrawText(pAutonoteFont, 1, 0, ui_book_autonotes_text_color, pAutonoteTxt[v13-1].pText, 0, 0, 0); v15 = pAutonoteFont->CalcTextHeight(v14, &a1, 1, 0); v16 = a1.uFrameY + v15; if ( (signed int)(a1.uFrameY + v15) > (signed int)a1.uFrameHeight ) @@ -888,9 +1047,8 @@ //----- (00413980) -------------------------------------------------------- -void DrawBook_Maps() - { - +void BookUI_Map_Draw() +{ int v6; // eax@31 unsigned int map_id; // eax@35 Texture *buttnTxtr; // [sp-4h] [bp-DCh]@3 @@ -899,7 +1057,7 @@ unsigned int textrX, textrY; pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_12); - if ( dword_506548 || viewparams->field_2C / 128 >= 12 ) + if ( BtnUp_flag || viewparams->field_2C / 128 >= 12 ) { buttnTxtr = pTex_tab_an_6a__zoom_off; textrY = pViewport->uViewportTL_Y + 2; @@ -912,7 +1070,7 @@ textrX = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( dword_506544 || viewparams->field_2C / 128 <= 3 ) + if ( BtnDown_flag || viewparams->field_2C / 128 <= 3 ) { buttnTxtr = pTex_tab_an_7a__zoot_off; textrY = pViewport->uViewportTL_Y + 38; @@ -925,7 +1083,7 @@ textrX = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( dword_506540 ) + if ( Book_PageBtn3_flag ) { buttnTxtr = pTexture_506390; textrY = pViewport->uViewportTL_Y + 113; @@ -938,7 +1096,7 @@ textrX = pViewport->uViewportTL_X + 398; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( dword_50653C ) + if ( Book_PageBtn4_flag ) { buttnTxtr = pTexture_506388; textrY = pViewport->uViewportTL_X + 150; @@ -951,7 +1109,7 @@ textrX = pViewport->uViewportTL_Y + 399; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( dword_506538 ) + if ( Book_PageBtn5_flag ) { buttnTxtr = pTexture_506380; textrY = pViewport->uViewportTL_Y + 188; @@ -964,7 +1122,7 @@ textrX = pViewport->uViewportTL_X + 397; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( dword_506534 ) + if ( Book_PageBtn6_flag ) { buttnTxtr = pTexture_506378; textrY = pViewport->uViewportTL_Y + 226; @@ -977,27 +1135,27 @@ textrX = pViewport->uViewportTL_X + 397; } pRenderer->DrawTextureTransparent(textrX, textrY, buttnTxtr); - if ( dword_506544 ) + if ( BtnDown_flag ) viewparams->CenterOnParty2(); - if ( dword_506548 ) + if ( BtnUp_flag ) viewparams->CenterOnParty(); - if ( dword_506540 ) + if ( Book_PageBtn3_flag ) viewparams->_443219(); - if ( dword_50653C ) + if ( Book_PageBtn4_flag ) viewparams->_443231(); - if ( dword_506538 ) + if ( Book_PageBtn5_flag ) viewparams->_44323D(); - if ( dword_506534 ) + if ( Book_PageBtn6_flag ) viewparams->_443225(); - if ( dword_506548 | dword_506544 | dword_506540 | dword_50653C | dword_506538 | dword_506534 ) + if ( BtnUp_flag | BtnDown_flag | Book_PageBtn3_flag | Book_PageBtn4_flag | Book_PageBtn5_flag | Book_PageBtn6_flag ) pAudioPlayer->PlaySound(SOUND_Button2, 0, 0, -1, 0, 0, 0, 0); - dword_506548 = 0; - dword_506544 = 0; - dword_506534 = 0; - dword_506538 = 0; - dword_50653C = 0; - dword_506540 = 0; + BtnUp_flag = 0; + BtnDown_flag = 0; + Book_PageBtn6_flag = 0; + Book_PageBtn5_flag = 0; + Book_PageBtn4_flag = 0; + Book_PageBtn3_flag = 0; DrawBook_Map_sub(97, 49, 361, 313, 0); pRenderer->DrawTextureTransparent(75, 22, pTexture_mapbordr); map_window.uFrameWidth = game_viewport_width; @@ -1008,10 +1166,11 @@ map_window.uFrameW = game_viewport_w; map_id = pMapStats->GetMapInfo(pCurrentMapName); if ( map_id ) - map_window.DrawTitleText(pBook2Font, -14, 12, 0, pMapStats->pInfos[map_id].pName, 3); + map_window.DrawTitleText(pBook2Font, -14, 12, ui_book_map_title_color, pMapStats->pInfos[map_id].pName, 3); + map_window.uFrameX = 0; sprintf(party_coord, pGlobalTXT_LocalizationStrings[659], pParty->vPosition.x, pParty->vPosition.y); //"x: %d y: %d" - map_window.DrawTitleText(pFontComic, 0, 320, 0, party_coord, 0); + map_window.DrawTitleText(pFontComic, 0, 320, ui_book_map_coordinates_color, party_coord, 0); } //----- (00442955) -------------------------------------------------------- @@ -1518,19 +1677,3 @@ - -//----- (00413CC6) -------------------------------------------------------- -void DrawCurrentBook(unsigned int uBook) -{ - pRenderer->DrawTextureIndexed(471, 445, pIcons_LOD->GetTexture(uExitCancelTextureId)); - switch ((enum WindowType)uBook) - { - case WINDOW_LloydsBeacon: DrawLloydBeaconsScreen(); break; - case WINDOW_TownPortal: DrawTownPortalScreen(); break; - case WINDOW_QuestBook: DrawBook_Quests(); break; - case WINDOW_AutonotesBook: DrawBook_Autonotes(); break; - case WINDOW_MapsBook: DrawBook_Maps(); break; - case WINDOW_CalendarBook: DrawBook_Calendar(); break; - case WINDOW_HistoryBook: DrawBook_History(); break; - } -} diff -r d5796c318653 -r 3ee391de04d5 UICharacter.cpp --- a/UICharacter.cpp Tue May 14 19:04:48 2013 +0600 +++ b/UICharacter.cpp Tue May 14 19:05:08 2013 +0600 @@ -45,25 +45,160 @@ -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; + +int bRingsShownInCharScreen; // 5118E0 + + + +unsigned int ui_character_default_text_color; +unsigned int ui_character_skill_highlight_color; +unsigned int ui_character_header_text_color; +unsigned int ui_character_bonus_text_color; +unsigned int ui_character_bonus_text_color_neg; +unsigned int ui_character_skill_upgradeable_color; +unsigned int ui_character_skill_default_color; +unsigned int ui_character_award_color[6]; + +unsigned int ui_game_minimap_outline_color; +unsigned int ui_game_minimap_actor_friendly_color; +unsigned int ui_game_minimap_actor_hostile_color; +unsigned int ui_game_minimap_actor_corpse_color; +unsigned int ui_game_minimap_decoration_color_1; +unsigned int ui_game_minimap_projectile_color; +unsigned int ui_game_minimap_treasure_color; + +unsigned int ui_book_quests_title_color; +unsigned int ui_book_quests_text_color; +unsigned int ui_book_autonotes_title_color; +unsigned int ui_book_autonotes_text_color; +unsigned int ui_book_map_title_color; +unsigned int ui_book_map_coordinates_color; 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_character_default_text_color = TargetColor(255, 255, 255); + ui_character_header_text_color = TargetColor(255, 255, 155); + ui_character_bonus_text_color = TargetColor(0, 255, 0); + ui_character_bonus_text_color_neg = TargetColor(255, 0, 0); + + ui_character_skill_upgradeable_color = TargetColor(0, 175, 255); + ui_character_skill_default_color = TargetColor(255, 0, 0); + ui_character_skill_highlight_color = TargetColor(255, 0, 0); + + ui_character_award_color[0] = TargetColor(248, 108, 160); + ui_character_award_color[1] = TargetColor(112, 220, 248); + ui_character_award_color[2] = TargetColor(192, 192, 240); + ui_character_award_color[3] = TargetColor( 64, 244, 96); + ui_character_award_color[4] = TargetColor(232, 244, 96); + ui_character_award_color[5] = TargetColor(240, 252, 192); + + ui_game_minimap_outline_color = TargetColor(0, 0, 255); + ui_game_minimap_actor_friendly_color = TargetColor(0, 255, 0); + ui_game_minimap_actor_hostile_color = TargetColor(255, 0, 0); + ui_game_minimap_actor_corpse_color = TargetColor(255, 255, 0); + ui_game_minimap_decoration_color_1 = TargetColor(255, 255, 255); + ui_game_minimap_projectile_color = TargetColor(255, 0, 0); + ui_game_minimap_treasure_color = TargetColor(0, 0, 255); + + ui_book_quests_title_color = TargetColor(255, 255, 255); + ui_book_quests_text_color = TargetColor(255, 255, 255); + ui_book_autonotes_title_color = TargetColor(255, 255, 255); + ui_book_autonotes_text_color = TargetColor(255, 255, 255); + ui_book_map_title_color = TargetColor(255, 255, 255); + ui_book_map_coordinates_color = TargetColor(255, 255, 255); +} + + + + +//----- (00421626) -------------------------------------------------------- +GUIWindow *CharacterUI_Initialize(unsigned int _this) +{ + GUIWindow *pWindow; // edi@3 + + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + + pEventTimer->Pause(); + pAudioPlayer->StopChannels(-1, -1); + bRingsShownInCharScreen = false; + CharacterUI_LoadPaperdollTextures(); + pCurrentScreen = _this; - ui_color_text_skill_upgradeable = TargetColor(0, 175, 255); - ui_color_text_skill_not_upgradeable = TargetColor(255, 0, 0); + pWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_CharacterRecord, uActiveCharacter, 0); + pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308, + pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureWidth, + pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureHeight, + 1, 0, UIMSG_ClickStatsBtn, 0, 'S', pGlobalTXT_LocalizationStrings[216],// Stats + pIcons_LOD->GetTexture(papredoll_dbrds[10]), + pIcons_LOD->GetTexture(papredoll_dbrds[9]), 0); + pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308, + pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureWidth, + pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureHeight, + 1, 0, UIMSG_ClickSkillsBtn, 0, 'K', pGlobalTXT_LocalizationStrings[205],//Skills + pIcons_LOD->GetTexture(papredoll_dbrds[8]), + pIcons_LOD->GetTexture(papredoll_dbrds[7]), 0); + pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308, + pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureWidth, + pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureHeight, + 1, 0, UIMSG_ClickInventoryBtn, 0, 'I', pGlobalTXT_LocalizationStrings[120], //Inventory + pIcons_LOD->GetTexture(papredoll_dbrds[6]), + pIcons_LOD->GetTexture(papredoll_dbrds[5]), 0); + pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308, + pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureWidth, + pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureHeight, + 1, 0, UIMSG_ClickAwardsBtn, 0, 'A', pGlobalTXT_LocalizationStrings[22], //Awards + pIcons_LOD->GetTexture(papredoll_dbrds[4]), + pIcons_LOD->GetTexture(papredoll_dbrds[3]), 0); + pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308, + pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureWidth, + pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureHeight, + 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit + pIcons_LOD->GetTexture(papredoll_dbrds[2]), + pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0); + pWindow->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); + pCharacterScreen_DetalizBtn = pWindow->CreateButton(0x258u, 0x12Cu, 30, 30, 1, 0, UIMSG_ChangeDetaliz, 0, 0, pGlobalTXT_LocalizationStrings[64], 0); + pCharacterScreen_DollBtn = pWindow->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); + + pWindow->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); + pWindow->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); + pWindow->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); + pWindow->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); + + pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); + FillAwardsData(); + return pWindow; } +//----- (004219BE) -------------------------------------------------------- +GUIWindow *CastSpellInfo::sub_4219BE() +{ + GUIWindow *v2; // ebx@1 + + pEventTimer->Pause(); + pAudioPlayer->StopChannels(-1, -1); + bRingsShownInCharScreen = 0; + CharacterUI_LoadPaperdollTextures(); + pCurrentScreen = SCREEN_CASTING; + v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell_InInventory, (int)this, 0); + pCharacterScreen_ExitBtn = v2->CreateButton(394, 318, 75, 33, 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, + pGlobalTXT_LocalizationStrings[79], // Close + pIcons_LOD->GetTexture(papredoll_dbrds[2]), + pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0); + v2->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); + pCharacterScreen_DollBtn = v2->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); + + v2->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); + v2->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); + v2->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); + v2->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); + + return v2; +} + + + + 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) @@ -71,7 +206,7 @@ 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); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, x, y, ui_character_header_text_color, pTmpBuf, 0, 0, 0); int num_skills_drawn = 0; for (uint i = 0; i < skill_list_size; ++i) @@ -99,14 +234,14 @@ uint skill_color = 0; uint skill_mastery_color = 0; if (player->uSkillPoints > skill_level) - skill_color = ui_color_text_skill_upgradeable; + skill_color = ui_character_skill_upgradeable_color; if (pGUIWindow_CurrentMenu->pCurrentPosActiveItem == j) { if (player->uSkillPoints > skill_level) - skill_mastery_color = ui_color_text_bonus; + skill_mastery_color = ui_character_bonus_text_color; else - skill_mastery_color = ui_color_text_skill_not_upgradeable; + skill_mastery_color = ui_character_skill_default_color; skill_color = skill_mastery_color; } @@ -127,7 +262,7 @@ } if (!skill_mastery_color) - skill_mastery_color = ui_color_text_header; + skill_mastery_color = ui_character_header_text_color; sprintfex(pTmpBuf, "%s \f%05d%s\f%05d\r%03d%2d", pSkillNames[skill], skill_mastery_color, v46, skill_color, right_margin, skill_level); @@ -154,10 +289,10 @@ sprintfex(pTmpBuf, "%s \f%05d^Pv[%s]\f00000\r177%s: \f%05d%d\f00000", pGlobalTXT_LocalizationStrings[206], // Skills for - ui_color_text_header, + ui_character_header_text_color, player->pName, pGlobalTXT_LocalizationStrings[207], // Skill Points - player->uSkillPoints ? ui_color_text_bonus : ui_color_text_default, + player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, player->uSkillPoints); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0); @@ -182,27 +317,9 @@ - -unsigned int GetAwardColor(unsigned int priority) -{ - static unsigned __int8 pAwardsTextColors[6][3] = - { - {248, 108, 160}, - {112, 220, 248}, - {192, 192, 240}, - { 64, 244, 96}, - {232, 244, 96}, - {240, 252, 192} - }; - - return TargetColor(pAwardsTextColors[priority % 6][0], - pAwardsTextColors[priority % 6][1], - pAwardsTextColors[priority % 6][2]); -} - //----- (0041A000) -------------------------------------------------------- -void CharacterUI_AwardsTab_Draw(unsigned int uPlayerID) +void CharacterUI_AwardsTab_Draw(Player *player) { //unsigned int v1; // esi@1 //unsigned int v2; // ebx@1 @@ -227,28 +344,28 @@ //int v21; // [sp+C8h] [bp-8h]@14 //int v22; // [sp+CCh] [bp-4h]@40 - auto player = &pParty->pPlayers[uPlayerID - 1]; - //v1 = uPlayerID; - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE)); - sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], TargetColor(0xFF, 0xFF, 0x9B)); - sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]); - strcat(pTmpBuf, Source); - strcat(pTmpBuf, "\f00000"); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0); - result = dword_506528; - a1.uFrameX = 12; - a1.uFrameY = 48; - a1.uFrameWidth = 424; - a1.uFrameHeight = 290; - a1.uFrameZ = 435; - a1.uFrameW = 337; - if ( dword_506544 && num_achieved_awards + dword_506528 < num_achieved_awards_2 ) - result = dword_506528++ + 1; - if ( dword_506548 && result ) - { - --result; - dword_506528 = result; - } + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_award", TEXTURE_16BIT_PALETTE)); + sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], ui_character_header_text_color); + sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]); + strcat(pTmpBuf, Source); + strcat(pTmpBuf, "\f00000"); + + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0); + result = dword_506528; + a1.uFrameX = 12; + a1.uFrameY = 48; + a1.uFrameWidth = 424; + a1.uFrameHeight = 290; + a1.uFrameZ = 435; + a1.uFrameW = 337; + if (BtnDown_flag && num_achieved_awards + dword_506528 < num_achieved_awards_2) + result = dword_506528++ + 1; + if (BtnUp_flag && result) + { + --result; + dword_506528 = result; + } + if ( dword_50651C < 0 ) { result += num_achieved_awards; @@ -270,8 +387,8 @@ } } //LABEL_14: - dword_506544 = 0; - dword_506548 = 0; + BtnDown_flag = 0; + BtnUp_flag = 0; num_achieved_awards = 0; dword_50651C = 0; @@ -300,7 +417,7 @@ v6 = pTmpBuf; - a1.DrawText(pFontArrus, 0, 0, GetAwardColor(pAwards[v5].uPriority), v6, 0, 0, 0); + a1.DrawText(pFontArrus, 0, 0, ui_character_award_color[pAwards[v5].uPriority % 6], v6, 0, 0, 0); a1.uFrameY = pFontArrus->CalcTextHeight(v6, &a1, 0, 0) + a1.uFrameY + 4; if (a1.uFrameY > a1.uFrameHeight) break; @@ -322,94 +439,7 @@ return ((signed int)(uNumPixels - 14) >> 5) + 1; } -//----- (0041A2D1) -------------------------------------------------------- -void CharacterUI_InventoryTab_Draw(Player *player, bool a2) -{ - Texture *v7; // esi@6 - signed int v11; // edx@6 - int v13; // eax@13 - signed int v14; // edx@13 - int v15; // eax@13 - unsigned int v17; // edi@15 - Texture *pTexture; // ebx@24 - unsigned int uCellX; // [sp+30h] [bp-8h]@5 - unsigned int uCellY; // [sp+34h] [bp-4h]@5 - 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 (v11 < 14) - v11 = 14; - - if ( (v11 - 14) / 32 == 0 && v7->uTextureWidth < 32) - uCellX += (32 - v7->uTextureWidth) / 2; - v13 = v11 - 14; - LOBYTE(v13) = v13 & 0xE0; - v15 = v13 + 32; - v14 = v7->uTextureHeight; - if (v14 < 14 ) - v14 = 14; - 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); - - 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() @@ -417,265 +447,67 @@ pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather)); } - //----- (0041A57E) -------------------------------------------------------- - void QuickRefDraw() - { - unsigned int v0; // ebx@1 - //unsigned int v1; // eax@1 - Player *pPlayer; // ebp@2 - int v3; // eax@6 - int v4; // edi@6 - unsigned int v5; // eax@7 - unsigned int v6; // edi@9 - unsigned int v7; // edi@11 - signed int v8; // eax@13 - unsigned int v9; // eax@13 - unsigned int v10; // edi@13 - int v11; // eax@15 - unsigned int v12; // eax@15 - unsigned int v13; // edi@15 - int v14; // eax@17 - int v15; // ST18_4@17 - int v16; // ebx@17 - int v17; // eax@17 - unsigned int v18; // eax@17 - unsigned int v19; // edi@17 - int v20; // eax@19 - unsigned int v21; // edi@19 - char *v22; // eax@21 - unsigned int v23; // edi@21 - int v24; // eax@23 - unsigned int v25; // edi@23 - char *v26; // eax@25 - unsigned int v27; // edi@25 - int v28; // ecx@27 - char *v29; // eax@27 - signed int v30; // edx@27 - unsigned int v31; // edi@31 - unsigned int v32; // edi@33 - const char *v33; // ST10_4@35 - unsigned int v34; // eax@35 - unsigned int v35; // edi@35 - unsigned __int8 v36; // al@37 - char *v37; // eax@38 - int v38; // eax@41 - signed int v39; // edi@42 - char *v40; // eax@45 - unsigned int v41; // eax@45 - signed int v43; // [sp+10h] [bp-1Ch]@1 - unsigned int v44; // [sp+14h] [bp-18h]@2 - int v45; // [sp+18h] [bp-14h]@1 - unsigned int v46; // [sp+1Ch] [bp-10h]@1 - unsigned int v47; // [sp+20h] [bp-Ch]@1 - unsigned int v48; // [sp+24h] [bp-8h]@33 - //unsigned int v49; // [sp+28h] [bp-4h]@1 + +//----- (0041ABFD) -------------------------------------------------------- +void CharacterUI_CharacterScreen_Draw(Player *player) +{ + pRenderer->ClearZBuffer(0, 479); + switch (pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0]) + { + case WINDOW_CharacterWindow_Stats: // stats + CharacterUI_ReleaseButtons(); + sub_419379(); + CharacterUI_StatsTab_Draw(player); + pRenderer->DrawTextureIndexed(pCharacterScreen_StatsBtn->uX, + pCharacterScreen_StatsBtn->uY, + pIcons_LOD->LoadTexturePtr("ib-cd1-d", TEXTURE_16BIT_PALETTE)); + break; - v0 = 0; - v47 = TargetColor(0xFFu, 0xFFu, 0x9Bu); - //v49 = TargetColor(0xFFu, 0, 0); - v46 = TargetColor(0, 0xFFu, 0); - //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE); - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE)); - v43 = 0; - v45 = LOBYTE(pFontArrus->uFontHeight) + 1; - do - { - pPlayer = &pParty->pPlayers[v43]; - v44 = 94 * v43 + 89; - if ( v43 == v0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, v0, pGlobalTXT_LocalizationStrings[149], 60, v0);//Name - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, v47, pPlayer->pName, 84, v0); - if ( v43 == v0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, v0, pGlobalTXT_LocalizationStrings[131], 60, v0); //. - v3 = pPlayer->GetActualLevel(); - sprintf(pTmpBuf, "%lu", v3); - v4 = pPlayer->GetBaseLevel(); - if ( pPlayer->GetActualLevel() <= v4 ) - v5 = pPlayer->GetExperienceDisplayColor(); - else - v5 = TargetColor(0, 0xFFu, v0); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, v0); - v6 = v45 + 47; - if ( v43 == v0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, v0, pGlobalTXT_LocalizationStrings[41], 60, v0);// - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, v0, pClassNames[pPlayer->classType], 84, v0); - v7 = v45 + v6; - if ( v43 == v0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, v0, pGlobalTXT_LocalizationStrings[107], 60, v0);//. - sprintf(pTmpBuf, "%d", pPlayer->sHealth); - v8 = pPlayer->GetMaxHealth(); - v9 = UI_GetHealthManaStringColor(pPlayer->sHealth, v8); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf, 84, v0); - v10 = v45 + v7; - if ( v43 == v0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, v0, pGlobalTXT_LocalizationStrings[209], 60, v0);// - sprintf(pTmpBuf, "%d", pPlayer->sMana); - v11 = pPlayer->GetMaxMana(); - v12 = UI_GetHealthManaStringColor(pPlayer->sMana, v11); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf, 84, v0); - v13 = v45 + v10; - if ( v43 == v0 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, v0, pGlobalTXT_LocalizationStrings[0], 60, v0);// - v14 = pPlayer->GetActualAC(); - sprintf(pTmpBuf, "%d", v14); - v15 = v0; - v16 = pPlayer->GetBaseAC(); - v17 = pPlayer->GetActualAC(); - v18 = UI_GetHealthManaStringColor(v17, v16); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf, 84, v15); - v0 = 0; - v19 = v45 + v13; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);// - v20 = pPlayer->GetActualAttack(0); - sprintf(pTmpBuf, "%+d", v20); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf, 84, 0); - v21 = v45 + v19; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//. - v22 = pPlayer->GetMeleeDamageString(); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v21, 0, v22, 84, 0); - v23 = v45 + v21; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// - v24 = pPlayer->GetRangedAttack(); - sprintf(pTmpBuf, "%+d", v24); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf, 84, 0); - v25 = v45 + v23; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//. - v26 = pPlayer->GetRangedDamageString(); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v25, 0, v26, 84, 0); - v27 = v45 + v25; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v27, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);// - v28 = 0; - v29 = (char *)pPlayer->pActiveSkills; - v30 = 36; - do - { - if ( *(short *)v29 ) - ++v28; - v29 += 2; - --v30; - } - while ( v30 ); - sprintf(pTmpBuf, "%lu", v28); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf, 84, 0); - v31 = v45 + v27; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);// - sprintf(pTmpBuf, "%lu", pPlayer->uSkillPoints); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, pPlayer->uSkillPoints != 0 ? v46 : 0, pTmpBuf, 84, 0); - v32 = v45 + v31; - v48 = pPlayer->GetMajorConditionIdx(); - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v32, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//. - v33 = aCharacterConditionNames[v48]; - v34 = GetConditionDrawColor(v48); - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v32, v34, v33, 84, 0); - v35 = v45 + v32; - if ( !v43 ) - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v35, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//.. - v36 = pPlayer->uQuickSpell; - if ( v36 ) - v37 = pSpellStats->pInfos[v36].pShortName; - else - v37 = pGlobalTXT_LocalizationStrings[153];// - pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v35, 0, v37, 84, 0); - ++v43; - } - while ( v43 < 4 ); + case WINDOW_CharacterWindow_Skills: // skills + if (dword_507CC0 != uActiveCharacter) + { + CharacterUI_ReleaseButtons(); + CharacterUI_SkillsTab_CreateButtons(); + } + sub_419379(); + CharacterUI_SkillsTab_Draw(player); + pRenderer->DrawTextureIndexed(pCharacterScreen_SkillsBtn->uX, + pCharacterScreen_SkillsBtn->uY, + pIcons_LOD->LoadTexturePtr("ib-cd2-d", TEXTURE_16BIT_PALETTE)); + break; - v38 = GetPartyReputation(); - if ( v38 >= 0 ) - { - if ( v38 <= 5 ) - v39 = TargetColor(0xFF, 0xFF, 0xFF); - else - v39 = TargetColor(0xFF, 0, 0); - } - else - v39 = v46; - - v40 = GetReputationString(v38); - sprintf(pTmpBuf, "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0); - v41 = pParty->GetPartyFame(); - sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], v41);// Fame - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0); - } - - //----- (0041ABFD) -------------------------------------------------------- -void __thiscall CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx) -{ - unsigned int v2; // eax@6 - Texture *pTexture; // ecx@6 - GUIButton *pButton; // eax@6 - unsigned int v5; // eax@7 - unsigned int v6; // eax@10 - unsigned int v7; // eax@11 + case WINDOW_CharacterWindow_Awards: // awards + CharacterUI_ReleaseButtons(); + sub_419379(); + sub_419220(); + CharacterUI_AwardsTab_Draw(player); + pRenderer->DrawTextureIndexed(pCharacterScreen_AwardsBtn->uX, + pCharacterScreen_AwardsBtn->uY, + pIcons_LOD->LoadTexturePtr("ib-cd4-d", TEXTURE_16BIT_PALETTE)); + break; - if ( uPlayerIdx ) - { - pRenderer->ClearZBuffer(0, 479); - switch ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] ) - { - case WINDOW_CharacterWindow_Stats: // stats - sub_4196A0(); - sub_419379(); - CharacterUI_StatsTab_Draw(uPlayerIdx); - v7 = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE); - pTexture = pIcons_LOD->GetTexture(v7); - pButton = pCharacterScreen_StatsBtn; - pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture); - break; - case WINDOW_CharacterWindow_Skills: // skills - if ( dword_507CC0 != uActiveCharacter ) - { - sub_4196A0(); - CharacterUI_SkillScreen_Draw(); - } - sub_419379(); - CharacterUI_SkillsTab_Draw(pPlayers[uPlayerIdx]); - v6 = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE); - pTexture = pIcons_LOD->GetTexture(v6); - pButton = pCharacterScreen_SkillsBtn; - pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture); - break; - case WINDOW_CharacterWindow_Awards: // awards - sub_4196A0(); - sub_419379(); - sub_419220(); - CharacterUI_AwardsTab_Draw(uPlayerIdx); - v5 = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE); - pTexture = pIcons_LOD->GetTexture(v5); - pButton = pCharacterScreen_AwardsBtn; - pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture); - break; - case WINDOW_CharacterWindow_Inventory: // inventory and other - sub_4196A0(); - sub_419379(); - CharacterUI_InventoryTab_Draw(pPlayers[uPlayerIdx], false); - v2 = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE); - pTexture = pIcons_LOD->GetTexture(v2); - pButton = pCharacterScreen_InventoryBtn; - pRenderer->DrawTextureIndexed(pButton->uX, pButton->uY, pTexture); - break; - default: - break; - } - if ( bRingsShownInCharScreen ) - CharacterUI_DrawPaperdollWithRingOverlay(uPlayerIdx); - else - CharacterUI_DrawPaperdoll(uPlayerIdx); + case WINDOW_CharacterWindow_Inventory: // inventory and other + CharacterUI_ReleaseButtons(); + sub_419379(); + CharacterUI_InventoryTab_Draw(player, false); + pRenderer->DrawTextureIndexed(pCharacterScreen_InventoryBtn->uX, + pCharacterScreen_InventoryBtn->uY, + pIcons_LOD->LoadTexturePtr("ib-cd3-d", TEXTURE_16BIT_PALETTE)); + break; + + default: break; } + + if (bRingsShownInCharScreen) + CharacterUI_DrawPaperdollWithRingOverlay(player); + else + CharacterUI_DrawPaperdoll(player); } //----- (0043CC7C) -------------------------------------------------------- -void __fastcall CharacterUI_DrawPaperdoll(unsigned int uPlayerID) +void CharacterUI_DrawPaperdoll(Player *player) { - signed int pSex; // eax@1 + //signed int pSex; // eax@1 unsigned int v6; // ecx@9 int v7; // ecx@10 unsigned int pMainHandNum4; // eax@14 @@ -826,25 +658,33 @@ signed int IsDwarf; // [sp+40h] [bp-Ch]@4 pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE); - pSex = pPlayers[uPlayerID]->GetSexByVoice(); - if ( pPlayers[uPlayerID]->GetRace() && pPlayers[uPlayerID]->GetRace() != 1 && pPlayers[uPlayerID]->GetRace() != 2 ) + if (player->GetRace() == CHARACTER_RACE_DWARF) { IsDwarf = 1; - pBodyComplection = (pSex != 0) + 2; + pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 2 : 3; } else { IsDwarf = 0; - pBodyComplection = pSex != 0; + pBodyComplection = player->GetSexByVoice() == SEX_MALE ? 0 : 1; } + + int uPlayerID = 0; + for (uint i = 0; i < 4; ++i) + if (pPlayers[i + 1] == player) + { + uPlayerID = i + 1; + break; + } + pRenderer->ResetTextureClipRect(); - pRenderer->DrawTextureIndexed(0x1D3u, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));// + pRenderer->DrawTextureIndexed(467, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));// if ( IsPlayerWearingWatersuit[uPlayerID] )// { pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1])); if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), pPlayers[uPlayerID]->pEquipment.uArmor); - v6 = pPlayers[uPlayerID]->pEquipment.uMainHand; + pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, pIcons_LOD->GetTexture(papredoll_dbods[uPlayerID - 1]), player->pEquipment.uArmor); + v6 = player->pEquipment.uMainHand; if ( !v6 || (v7 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[v6-1], pItemsTable->pItems[v7].uEquipType != 1) && (pItemsTable->pItems[v7].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) ) pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], @@ -1423,7 +1263,7 @@ pX_Helm = pPaperdoll_BodyX + paperdoll_Helm[pBodyComplection][v125][0]; pY_Helm = pPaperdoll_BodyY + paperdoll_Helm[pBodyComplection][v125][1]; if ( IsDwarf != 1 || item_Helm->uItemID != 92 ) - v127 = paperdoll_helm_texture[pSex][v125]; + v127 = paperdoll_helm_texture[player->GetSexByVoice()][v125]; else v127 = papredoll_dbrds[11]; if ( item_Helm->uAttributes & 0xF0 ) @@ -1603,154 +1443,179 @@ pRenderer->DrawTextureTransparent(468, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop));// } -//----- (0043E825) -------------------------------------------------------- -void __fastcall CharacterUI_DrawPaperdollWithRingOverlay(unsigned int uPlayerID) + + + + + + +//----- (0041A2D1) -------------------------------------------------------- +void CharacterUI_InventoryTab_Draw(Player *player, bool a2) { - int v3; // ecx@1 - unsigned int pItemTextureNum; // ebx@3 - //int v9; // edi@17 - char v13; // sf@24 - unsigned __int8 v14; // of@24 - unsigned int pItemNum; // eax@25 - //int v20; // edi@40 - //int v21; // eax@41 - //int v33; // esi@61 - const char *spell_texture_name; // [sp-8h] [bp-38h]@8 - Texture *spell_texture; // [sp+10h] [bp-20h]@14 - int v41; // [sp+10h] [bp-20h]@26 - unsigned int pY_Ring; // [sp+14h] [bp-1Ch]@3 - unsigned int pX_Ring; // [sp+18h] [bp-18h]@3 - int v48; // [sp+24h] [bp-Ch]@1 - ItemGen *item; + Texture *v7; // esi@6 + signed int v11; // edx@6 + int v13; // eax@13 + signed int v14; // edx@13 + int v15; // eax@13 + unsigned int v17; // edi@15 + Texture *pTexture; // ebx@24 + unsigned int uCellX; // [sp+30h] [bp-8h]@5 + unsigned int uCellY; // [sp+34h] [bp-4h]@5 + + 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; - pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE); - CharacterUI_DrawPaperdoll(uPlayerID); - pRenderer->DrawTextureTransparent(0x1D9u, 0, pIcons_LOD->GetTexture(uTextureID_BACKHAND)); - pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop)); - pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX, pCharacterScreen_DetalizBtn->uY, pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)); - v3 = 0; - v48 = 0; - do - { - pItemNum = pPlayers[uPlayerID]->pEquipment.uRings[v3]; - if ( pPlayers[uPlayerID]->pEquipment.uRings[v3] ) + 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 (v11 < 14) + v11 = 14; + + if ( (v11 - 14) / 32 == 0 && v7->uTextureWidth < 32) + uCellX += (32 - v7->uTextureWidth) / 2; + v13 = v11 - 14; + LOBYTE(v13) = v13 & 0xE0; + v15 = v13 + 32; + v14 = v7->uTextureHeight; + if (v14 < 14 ) + v14 = 14; + v17 = uCellX + ((v15 - v7->uTextureWidth) >> 1) + pSRZBufferLineOffsets[uCellY + ((((v14 - 14) & 0xFFFFFFE0) - v7->uTextureHeight + 32) >> 1)]; + + if (item->uAttributes & 0xF0) { - item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1]; - pX_Ring = pPaperdollRingsX[v3]; - pY_Ring = pPaperdollRingsY[v3]; - pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); - if ( item->uAttributes & 0xF0 ) + switch (item->uAttributes & 0xF0) { - if ( (item->uAttributes & 0xF0) == 16 ) - spell_texture_name = "sptext01"; - if ( (item->uAttributes & 0xF0) == 32 ) - spell_texture_name = "sp28a"; - if ( (item->uAttributes & 0xF0) == 64 ) - spell_texture_name = "sp30a"; - if ( (item->uAttributes & 0xF0) == 128 ) - spell_texture_name = "sp91a"; - spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE); - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->uAttributes &= 0xFu; - ptr_50C9A4 = 0; - } - pRenderer->_4A63E6(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255); + 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; } - else - { - if (item->Broken()) - pRenderer->DrawTransparentRedShade(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum)); - else if (!item->Identified()) - pRenderer->DrawTransparentGreenShade(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum)); - else - pRenderer->DrawTextureTransparent(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum)); - pRenderer->_4A601E(pX_Ring, pY_Ring, pIcons_LOD->GetTexture(pItemTextureNum), pItemNum); - } - } - v3++; - pItemNum = pPlayers[uPlayerID]->pEquipment.uRings[v3]; - v14 = (v48 + 1) > 5; - v13 = v48 - 4 < 0; - v48++; - } - while ( (unsigned __int8)(v13 ^ v14) | (v48 == 4) ); - pItemNum = pPlayers[uPlayerID]->pEquipment.uAmulet; - if ( pItemNum ) - { - v41 = pPlayers[uPlayerID]->pEquipment.uAmulet; - item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1]; - pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); - if ( item->uAttributes & 0xF0 ) - { - if ( (item->uAttributes & 0xF0) == 16 ) - spell_texture_name = "sptext01"; - if ( (item->uAttributes & 0xF0) == 32 ) - spell_texture_name = "sp28a"; - if ( (item->uAttributes & 0xF0) == 64 ) - spell_texture_name = "sp30a"; - if ( (item->uAttributes & 0xF0) == 128 ) - spell_texture_name = "sp91a"; - spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE); _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) + if (_50C9A8_item_enchantment_timer <= 0) { _50C9A8_item_enchantment_timer = 0; - item->uAttributes &= 0xFu; + LOBYTE(item->uAttributes) &= 0xF; ptr_50C9A4 = 0; } - pRenderer->_4A63E6(493, 91, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255); + + pRenderer->_4A63E6(uCellX, uCellY, v7, pTexture, GetTickCount() * 0.1, 0, 255); + ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx); } else { - if (item->Broken()) - pRenderer->DrawTransparentRedShade(493, 91, pIcons_LOD->GetTexture(pItemTextureNum)); - else if (!item->Identified()) - pRenderer->DrawTransparentGreenShade(493, 91, pIcons_LOD->GetTexture(pItemTextureNum)); + if (item->Identified() || pCurrentScreen != SCREEN_HOUSE) + { + if (item->Broken()) + pRenderer->DrawTransparentRedShade(uCellX, uCellY, v7); + else + pRenderer->DrawTextureTransparent(uCellX, uCellY, v7); + } else - pRenderer->DrawTextureTransparent(493, 91, pIcons_LOD->GetTexture(pItemTextureNum)); + pRenderer->DrawTransparentGreenShade(uCellX, uCellY, v7); - pRenderer->_4A601E(493, 91, pIcons_LOD->GetTexture(pItemTextureNum), v41); + ZBuffer_Fill(&pRenderer->pActiveZBuffer[v17], item_texture_id, item_idx); + continue; } } - pItemNum = pPlayers[uPlayerID]->pEquipment.uGlove; - if ( !pItemNum ) - return; - item = &pPlayers[uPlayerID]->pInventoryItems[pItemNum - 1]; - pItemTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); - if ( !(item->uAttributes & 0xF0) ) +} + + + +static void CharacterUI_DrawItem(int x, int y, ItemGen *item, int id) +{ + auto item_texture = pIcons_LOD->LoadTexturePtr(pItemsTable->pItems[item->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + + if (item->uAttributes & 0xF0) // enchant animation { - if (item->Broken()) - pRenderer->DrawTransparentRedShade(586, 88, pIcons_LOD->GetTexture(pItemTextureNum)); - else if (!item->Identified()) - pRenderer->DrawTransparentGreenShade(586, 88, pIcons_LOD->GetTexture(pItemTextureNum)); - else - pRenderer->DrawTextureTransparent(586, 88, pIcons_LOD->GetTexture(pItemTextureNum)); + Texture *enchantment_texture = nullptr; + switch (item->uAttributes & 0xF0) + { + case ITEM_AURA_EFFECT_RED: enchantment_texture = pIcons_LOD->LoadTexturePtr("sptext01", TEXTURE_16BIT_PALETTE); break; + case ITEM_AURA_EFFECT_BLUE: enchantment_texture = pIcons_LOD->LoadTexturePtr("sp28a", TEXTURE_16BIT_PALETTE); break; + case ITEM_AURA_EFFECT_GREEN: enchantment_texture = pIcons_LOD->LoadTexturePtr("sp30a", TEXTURE_16BIT_PALETTE); break; + case ITEM_AURA_EFFECT_PURPLE: enchantment_texture = pIcons_LOD->LoadTexturePtr("sp91a", TEXTURE_16BIT_PALETTE); break; + } - pRenderer->_4A601E(586, 88,pIcons_LOD->GetTexture(pItemTextureNum), pItemNum); + _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; + if (_50C9A8_item_enchantment_timer <= 0) + { + _50C9A8_item_enchantment_timer = 0; + item->uAttributes &= 0xF; + ptr_50C9A4 = 0; + } + pRenderer->_4A63E6(x, y, item_texture, enchantment_texture, GetTickCount() * 0.1, 0, 255); } else { - if ( (item->uAttributes & 0xF0) == 16 ) - spell_texture_name = "sptext01"; - if ( (item->uAttributes & 0xF0) == 32 ) - spell_texture_name = "sp28a"; - if ( (item->uAttributes & 0xF0) == 64 ) - spell_texture_name = "sp30a"; - if ( (item->uAttributes & 0xF0) == 128 ) - spell_texture_name = "sp91a"; - spell_texture = pIcons_LOD->LoadTexturePtr(spell_texture_name, TEXTURE_16BIT_PALETTE); - _50C9A8_item_enchantment_timer -= pEventTimer->uTimeElapsed; - if ( _50C9A8_item_enchantment_timer <= 0 ) - { - _50C9A8_item_enchantment_timer = 0; - item->uAttributes &= 0xFu; - ptr_50C9A4 = 0; - } - pRenderer->_4A63E6(586, 88, pIcons_LOD->GetTexture(pItemTextureNum), spell_texture, GetTickCount() * 0.1, 0, 255); + if (item->Broken()) + pRenderer->DrawTransparentRedShade(x, y, item_texture); + else if (!item->Identified()) + pRenderer->DrawTransparentGreenShade(x, y, item_texture); + else + pRenderer->DrawTextureTransparent(x, y, item_texture); + + pRenderer->ZBuffer_Fill_2(x, y, item_texture, id); + } +} + + +//----- (0043E825) -------------------------------------------------------- +void CharacterUI_DrawPaperdollWithRingOverlay(Player *player) +{ + CharacterUI_DrawPaperdoll(player); + + pRenderer->DrawTextureTransparent(0x1D9u, 0, pIcons_LOD->GetTexture(uTextureID_BACKHAND)); + pRenderer->DrawTextureTransparent(0x1D4u, 0, pIcons_LOD->GetTexture(uTextureID_right_panel_loop)); + pRenderer->DrawTextureIndexed(pCharacterScreen_DetalizBtn->uX, + pCharacterScreen_DetalizBtn->uY, + pIcons_LOD->GetTexture(uTextureID_detaliz_close_button)); + + for (uint i = 0; i < 6; ++i) + { + if (!player->pEquipment.uRings[i]) + continue; + + static int pPaperdollRingsX[6] = {0x1EA, 0x21A, 0x248, 0x1EA, 0x21A, 0x248}; + static int pPaperdollRingsY[6] = {0x0CA, 0x0CA, 0x0CA, 0x0FA, 0x0FA, 0x0FA}; + + CharacterUI_DrawItem(pPaperdollRingsX[i], + pPaperdollRingsY[i], + &player->pInventoryItems[player->pEquipment.uRings[i] - 1], + player->pEquipment.uRings[i]); + } + + + if (player->pEquipment.uAmulet) + { + CharacterUI_DrawItem(493, 91, + &player->pInventoryItems[player->pEquipment.uAmulet - 1], + player->pEquipment.uAmulet); + } + + if (player->pEquipment.uGlove) + { + CharacterUI_DrawItem(586, 88, + &player->pInventoryItems[player->pEquipment.uGlove - 1], + player->pEquipment.uGlove); } } @@ -2010,8 +1875,8 @@ } //----- (00419401) -------------------------------------------------------- -void __cdecl CharacterUI_SkillScreen_Draw() - { +void CharacterUI_SkillsTab_CreateButtons() +{ unsigned int v0; // ecx@3 GUIButton *pButton; // eax@3 GUIFont *v2; // eax@8 @@ -2035,7 +1900,7 @@ a2 = 0; if ( dword_507CC0 ) - sub_4196A0(); + CharacterUI_ReleaseButtons(); v0 = uActiveCharacter; dword_507CC0 = uActiveCharacter; for ( pButton = pGUIWindow_CurrentMenu->pControlsHead; pButton; pButton = pButton->pNext ) @@ -2128,11 +1993,13 @@ pGUIWindow_CurrentMenu->_41D08F_set_keyboard_control_group(a2, 1, 0, a5); } + + //----- (00418511) -------------------------------------------------------- -char CharacterUI_StatsTab_Draw(unsigned int uPlayerID) +char CharacterUI_StatsTab_Draw(Player *player) { - Player *pPlayer; // edi@1 - unsigned int v4; // eax@2 + //Player *pPlayer; // edi@1 + //unsigned int v4; // eax@2 int v7; // ebp@4 int v8; // eax@4 unsigned int v9; // eax@4 @@ -2164,7 +2031,7 @@ unsigned int v60; // eax@8 unsigned int v62; // eax@8 signed int v64; // eax@8 - unsigned __int8 v66; // al@8 + //unsigned __int8 v66; // al@8 char *v67; // eax@9 signed int v70; // ebp@11 signed int v71; // eax@11 @@ -2208,203 +2075,202 @@ int v135; // [sp+18h] [bp-8h]@27 int v136; // [sp+18h] [bp-8h]@33 - pPlayer = &pParty->pPlayers[uPlayerID-1]; - pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_stats", TEXTURE_16BIT_PALETTE)); - sprintf(pTmpBuf, "\f%05d", TargetColor(0xFF, 0xFF, 0x9B)); - sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->classType]);//^Pi[%s] %s - strcat(pTmpBuf, pTmpBuf2); - if ( pPlayer->uSkillPoints ) - v4 = TargetColor(0, 0xFFu, 0); - else - v4 = 0xFFFFu; - sprintf(pTmpBuf2, "\f00000\r180%s: \f%05d%d\f00000\n\n\n", pGlobalTXT_LocalizationStrings[207], v4, pPlayer->uSkillPoints);//Skill points - strcat(pTmpBuf, pTmpBuf2); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf, 0, 0, 0); + //pPlayer = &pParty->pPlayers[uPlayerID-1]; + //pPlayer = player; + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("fr_stats", TEXTURE_16BIT_PALETTE)); + sprintf(pTmpBuf, "\f%05d", ui_character_header_text_color); + sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]);//"^Pi[%s] %s" / "%s the %s" + strcat(pTmpBuf, pTmpBuf2); + sprintfex(pTmpBuf2, "\f00000\r180%s: \f%05d%d\f00000\n\n\n", + pGlobalTXT_LocalizationStrings[207], // "Skill points" + player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, + player->uSkillPoints); + strcat(pTmpBuf, pTmpBuf2); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, 18, 0, pTmpBuf, 0, 0, 0); + + v10 = 53; + v7 = player->GetBaseStrength(); + v8 = player->GetActualMight(); + v9 = UI_GetHealthManaStringColor(v8, v7); + sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], v9, v8, v7);//Might + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); - v10 = 53; - v7 = pPlayer->GetBaseStrength(); - v8 = pPlayer->GetActualMight(); - v9 = UI_GetHealthManaStringColor(v8, v7); - sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[144], v9, v8, v7);//Might - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); + v10 += LOBYTE(pFontArrus->uFontHeight) - 2; + v13 = player->GetBaseIntelligence(); + v14 = player->GetActualIntelligence(); + v15 = UI_GetHealthManaStringColor(v14, v13); + sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], v15, v14, v13);//Intellect + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); + + v10 += LOBYTE(pFontArrus->uFontHeight) - 2; + v19 = player->GetBaseWillpower(); + v20 = player->GetActualWillpower(); + v21 = UI_GetHealthManaStringColor(v20, v19); + sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], v21, v20, v19);// + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); + + v10 += LOBYTE(pFontArrus->uFontHeight) - 2; + v25 = player->GetBaseEndurance(); + v26 = player->GetActualEndurance(); + v27 = UI_GetHealthManaStringColor(v26, v25); + sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], v27, v26, v25);// + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); + + v10 += LOBYTE(pFontArrus->uFontHeight) - 2; + v31 = player->GetBaseAccuracy(); + v32 = player->GetActualAccuracy(); + v33 = UI_GetHealthManaStringColor(v32, v31); + sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], v33, v32, v31); + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v13 = pPlayer->GetBaseIntelligence(); - v14 = pPlayer->GetActualIntelligence(); - v15 = UI_GetHealthManaStringColor(v14, v13); - sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[116], v15, v14, v13);//Intellect - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); - - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v19 = pPlayer->GetBaseWillpower(); - v20 = pPlayer->GetActualWillpower(); - v21 = UI_GetHealthManaStringColor(v20, v19); - sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[163], v21, v20, v19);// - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); - - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v25 = pPlayer->GetBaseEndurance(); - v26 = pPlayer->GetActualEndurance(); - v27 = UI_GetHealthManaStringColor(v26, v25); - sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[75], v27, v26, v25);// - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); - - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v31 = pPlayer->GetBaseAccuracy(); - v32 = pPlayer->GetActualAccuracy(); - v33 = UI_GetHealthManaStringColor(v32, v31); - sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[1], v33, v32, v31); - pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); - - v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v37 = pPlayer->GetBaseSpeed(); - v38 = pPlayer->GetActualSpeed(); + v37 = player->GetBaseSpeed(); + v38 = player->GetActualSpeed(); v39 = UI_GetHealthManaStringColor(v38, v37); sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n", pGlobalTXT_LocalizationStrings[211], v39, v38, v37); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v43 = pPlayer->GetBaseLuck(); - v44 = pPlayer->GetActualLuck(); + v43 = player->GetBaseLuck(); + v44 = player->GetActualLuck(); v45 = UI_GetHealthManaStringColor(v44, v43); sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[136], v45, v44, v43); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); a2 = "%s\f%05u\r424%d\f00000 /\t185%d\n"; v10 += 2 * LOBYTE(pFontArrus->uFontHeight) + 5; - if ( pPlayer->GetMaxHealth() >= 1000 ) + if ( player->GetMaxHealth() >= 1000 ) a2 = "%s\f%05u\r388%d\f00000 / %d\n"; - v49 = pPlayer->GetMaxHealth(); - v50 = UI_GetHealthManaStringColor(pPlayer->sHealth, v49); - sprintf(pTmpBuf, a2, pGlobalTXT_LocalizationStrings[108], v50, pPlayer->sHealth, v49); + v49 = player->GetMaxHealth(); + v50 = UI_GetHealthManaStringColor(player->sHealth, v49); + sprintf(pTmpBuf, a2, pGlobalTXT_LocalizationStrings[108], v50, player->sHealth, v49); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); a2a = "%s\f%05u\r424%d\f00000 /\t185%d\n"; v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - if ( pPlayer->GetMaxMana() >= 1000 ) + if ( player->GetMaxMana() >= 1000 ) a2a = "%s\f%05u\r388%d\f00000 / %d\n"; - v53 = pPlayer->GetMaxMana(); - v54 = UI_GetHealthManaStringColor(pPlayer->sMana, v53); - sprintf(pTmpBuf, a2a, pGlobalTXT_LocalizationStrings[212], v54, pPlayer->sMana, v53); + v53 = player->GetMaxMana(); + v54 = UI_GetHealthManaStringColor(player->sMana, v53); + sprintf(pTmpBuf, a2a, pGlobalTXT_LocalizationStrings[212], v54, player->sMana, v53); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v58 = pPlayer->GetBaseAC(); - v59 = pPlayer->GetActualAC(); + v58 = player->GetBaseAC(); + v59 = player->GetActualAC(); v60 = UI_GetHealthManaStringColor(v59, v58); sprintf(pTmpBuf, "%s\f%05u\r424%d\f00000 /\t185%d\n\n", pGlobalTXT_LocalizationStrings[12], v60, v59, v58); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 26, v10, 0, pTmpBuf, 0, 0, 0); v10 += 2 * LOBYTE(pFontArrus->uFontHeight) - 2; - v62 = pPlayer->GetMajorConditionIdx(); + v62 = player->GetMajorConditionIdx(); v64 = GetConditionDrawColor(v62); sprintf(pTmpBuf, "%s: \f%05d%s\n", pGlobalTXT_LocalizationStrings[47], v64, aCharacterConditionNames[v62]); pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf, 226, 0); v10 += LOBYTE(pFontArrus->uFontHeight) + - 1; - v66 = pPlayer->uQuickSpell; - if ( v66 ) - v67 = pSpellStats->pInfos[v66].pShortName; + if (player->uQuickSpell) + v67 = pSpellStats->pInfos[player->uQuickSpell].pShortName; else v67 = pGlobalTXT_LocalizationStrings[153]; sprintf(pTmpBuf, "%s: %s", pGlobalTXT_LocalizationStrings[172], v67); pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x1Au, v10, 0, pTmpBuf, 226, 0); v10 = 50; - v70 = pPlayer->GetBaseAge(); - v71 = pPlayer->GetActualAge(); + v70 = player->GetBaseAge(); + v71 = player->GetActualAge(); v72 = UI_GetHealthManaStringColor(v71, v70); sprintf(pTmpBuf, "%s\f%05u\t100%d\f00000 / %d\n", pGlobalTXT_LocalizationStrings[5], v72, v71, v70); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0); a2b = "%s\f%05u\t100%d\f00000 / %d\n"; v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - if ( pPlayer->GetBaseLevel() > 99 ) - a2b = format_4E2E68; - v75 = pPlayer->GetBaseLevel(); - v76 = pPlayer->GetActualLevel(); + if ( player->GetBaseLevel() > 99 ) + a2b = "%s\f%05u\t180%d\f00000 / %d\n"; + v75 = player->GetBaseLevel(); + v76 = player->GetActualLevel(); v77 = UI_GetHealthManaStringColor(v76, v75); sprintf(pTmpBuf, a2b, pGlobalTXT_LocalizationStrings[131], v77, v76, v75); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0); v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - if ( (signed __int64)pPlayer->uExperience <= 9999999 ) - v78 = pGlobalTXT_LocalizationStrings[83]; + if (player->uExperience <= 9999999) + v78 = pGlobalTXT_LocalizationStrings[83]; // "Experience" else - v78 = pGlobalTXT_LocalizationStrings[17]; - v81 = pPlayer->GetExperienceDisplayColor(); - sprintf(pTmpBuf, "%s\r180\f%05d%lu\f00000\n\n", v78, v81, LODWORD(pPlayer->uExperience)); + v78 = pGlobalTXT_LocalizationStrings[17]; // "Exp." + v81 = player->GetExperienceDisplayColor(); + sprintf(pTmpBuf, "%s\r180\f%05d%lu\f00000\n\n", v78, v81, LODWORD(player->uExperience)); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0); v10 += 2 * LOBYTE(pFontArrus->uFontHeight); - v83 = pPlayer->GetActualAttack(0); + v83 = player->GetActualAttack(0); sprintf(pTmpBuf, "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[18], v83); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0); v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v85 = pPlayer->GetMeleeDamageString(); + v85 = player->GetMeleeDamageString(); sprintf(pTmpBuf, "%s\t100 %s\n", pGlobalTXT_LocalizationStrings[53], v85); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0); v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v87 = pPlayer->GetRangedAttack(); + v87 = player->GetRangedAttack(); sprintf(pTmpBuf, "%s\t100%+d\n", pGlobalTXT_LocalizationStrings[203], v87); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0); v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v89 = pPlayer->GetRangedDamageString(); + v89 = player->GetRangedDamageString(); sprintf(pTmpBuf, "%s\t100 %s\n\n", pGlobalTXT_LocalizationStrings[53], v89); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0); a2c = format_4E2E10; v10 += 2 * LOBYTE(pFontArrus->uFontHeight) - 4; - v131 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE); - v90 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE); + v131 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE); + v90 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_FIRE); if ( v131 > 99 || v90 > 99 ) - a2c = format_4E2E68; + a2c = "%s\f%05u\t180%d\f00000 / %d\n"; v92 = UI_GetHealthManaStringColor(v131, v90); sprintf(pTmpBuf, a2c, pGlobalTXT_LocalizationStrings[87], v92, v131, v90); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0); a2d = format_4E2E10; v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v132 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR); - v93 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR); + v132 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_AIR); + v93 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_AIR); if ( v132 > 99 || v93 > 99 ) - a2d = format_4E2E68; + a2d = "%s\f%05u\t180%d\f00000 / %d\n"; v95 = UI_GetHealthManaStringColor(v132, v93); sprintf(pTmpBuf, a2d, pGlobalTXT_LocalizationStrings[6], v95, v132, v93); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0); a2e = format_4E2E10; v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v133 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER); - v96 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER); + v133 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_WATER); + v96 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_WATER); if ( v133 > 99 || v96 > 99 ) - a2e = format_4E2E68; + a2e = "%s\f%05u\t180%d\f00000 / %d\n"; v98 = UI_GetHealthManaStringColor(v133, v96); sprintf(pTmpBuf, a2e, pGlobalTXT_LocalizationStrings[240], v98, v133, v96); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0); a2f = format_4E2E10; v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v134 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH); - v99 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH); + v134 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH); + v99 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_EARTH); if ( v134 > 99 ) - a2f = format_4E2E68; + a2f = "%s\f%05u\t180%d\f00000 / %d\n"; v101 = UI_GetHealthManaStringColor(v134, v99); sprintf(pTmpBuf, a2f, pGlobalTXT_LocalizationStrings[70], v101, v134, v99); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 266, v10, 0, pTmpBuf, 0, 0, 0); a2g = format_4E2E10; v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v135 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND); - v102 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND); + v135 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_MIND); + v102 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_MIND); if ( v135 > 99 || v102 > 99 ) - a2g = format_4E2E68; + a2g = "%s\f%05u\t180%d\f00000 / %d\n"; v104 = UI_GetHealthManaStringColor(v135, v102); sprintf(pTmpBuf, a2g, pGlobalTXT_LocalizationStrings[142], v104, v135, v102); - if ( pPlayer->classType == PLAYER_CLASS_LICH && v102 == 200 ) + if ( player->classType == PLAYER_CLASS_LICH && v102 == 200 ) { v106 = UI_GetHealthManaStringColor(v135, 200); sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[142], v106, pGlobalTXT_LocalizationStrings[625]); @@ -2413,13 +2279,13 @@ a2h = format_4E2E10; v10 += LOBYTE(pFontArrus->uFontHeight) - 2; - v136 = pPlayer->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); - v107 = pPlayer->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); + v136 = player->GetActualResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); + v107 = player->GetBaseResistance(CHARACTER_ATTRIBUTE_RESIST_BODY); if ( v136 > 99 || v107 > 99 ) - a2h = format_4E2E68; + a2h = "%s\f%05u\t180%d\f00000 / %d\n"; v109 = UI_GetHealthManaStringColor(v136, v107); sprintf(pTmpBuf, a2h, pGlobalTXT_LocalizationStrings[29], v109, v136, v107); - if ( pPlayer->classType == PLAYER_CLASS_LICH && v107 == 200 ) + if ( player->classType == PLAYER_CLASS_LICH && v107 == 200 ) { v111 = UI_GetHealthManaStringColor(v136, 200); sprintf(pTmpBuf, format_4E2E00, pGlobalTXT_LocalizationStrings[29], v111, pGlobalTXT_LocalizationStrings[625]); @@ -2436,8 +2302,8 @@ num_achieved_awards = 0; memset(pTmpBuf2, 0, 0x7D0u); - dword_506544 = 0; - dword_506548 = 0; + BtnDown_flag = 0; + BtnUp_flag = 0; dword_50651C = 0; dword_506528 = 0; for (int i = 0; i < 105; ++i) diff -r d5796c318653 -r 3ee391de04d5 UIHouses.cpp --- a/UIHouses.cpp Tue May 14 19:04:48 2013 +0600 +++ b/UIHouses.cpp Tue May 14 19:05:08 2013 +0600 @@ -1335,7 +1335,7 @@ { /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_PlayArcomage; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; ++pMessageQueue_50CBD0->uNumMessages; @@ -2140,7 +2140,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -2236,7 +2236,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -5377,7 +5377,7 @@ /*result = pMessageQueue_50CBD0->uNumMessages; if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; diff -r d5796c318653 -r 3ee391de04d5 UIMainMenu.cpp --- a/UIMainMenu.cpp Tue May 14 19:04:48 2013 +0600 +++ b/UIMainMenu.cpp Tue May 14 19:05:08 2013 +0600 @@ -78,6 +78,20 @@ memset(pVisibleWindowsIdxs, 0, sizeof(pVisibleWindowsIdxs)); } +//----- (004415C5) -------------------------------------------------------- +void LoadPartyBuffIcons() +{ + for (uint i = 0; i < 14; ++i) + { + char filename[200]; + sprintf(filename, "isn-%02d", i + 1); + pTextureIDs_PartyBuffIcons[i] = pIcons_LOD->LoadTexture(filename, TEXTURE_16BIT_PALETTE); + } + + uIconIdx_FlySpell = pIconsFrameTable->FindIcon("spell21"); + uIconIdx_WaterWalk = pIconsFrameTable->FindIcon("spell27"); +} + //----- (0041B690) -------------------------------------------------------- void __cdecl MainMenuUI_Create() { diff -r d5796c318653 -r 3ee391de04d5 UISaveLoad.cpp --- a/UISaveLoad.cpp Tue May 14 19:04:48 2013 +0600 +++ b/UISaveLoad.cpp Tue May 14 19:05:08 2013 +0600 @@ -184,7 +184,7 @@ strcpy((char *)&pSavegameHeader + 100 * uLoadGameUI_SelectedSlot, (const char *)pKeyActionMap->pPressedKeysBuffer); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)83; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_SaveGame; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; diff -r d5796c318653 -r 3ee391de04d5 UiGame.cpp --- a/UiGame.cpp Tue May 14 19:04:48 2013 +0600 +++ b/UiGame.cpp Tue May 14 19:05:08 2013 +0600 @@ -48,8 +48,189 @@ +int uTextureID_GameUI_CharSelectionFrame; // 50C98C + + +//----- (0041A57E) -------------------------------------------------------- +void GameUI_QuickRef_Draw() +{ + //unsigned int v0; // ebx@1 + //unsigned int v1; // eax@1 + //Player *pPlayer; // ebp@2 + //int v3; // eax@6 + //int v4; // edi@6 + unsigned int v5; // eax@7 + unsigned int v6; // edi@9 + unsigned int v7; // edi@11 + //signed int v8; // eax@13 + unsigned int v9; // eax@13 + unsigned int v10; // edi@13 + //int v11; // eax@15 + unsigned int v12; // eax@15 + unsigned int v13; // edi@15 + //int v14; // eax@17 + //int v15; // ST18_4@17 + //int v16; // ebx@17 + //int v17; // eax@17 + unsigned int v18; // eax@17 + unsigned int v19; // edi@17 + //int v20; // eax@19 + unsigned int v21; // edi@19 + char *v22; // eax@21 + unsigned int v23; // edi@21 + //int v24; // eax@23 + unsigned int v25; // edi@23 + char *v26; // eax@25 + unsigned int v27; // edi@25 + int v28; // ecx@27 + char *v29; // eax@27 + signed int v30; // edx@27 + unsigned int v31; // edi@31 + unsigned int v32; // edi@33 + const char *v33; // ST10_4@35 + unsigned int v34; // eax@35 + unsigned int v35; // edi@35 + //unsigned __int8 v36; // al@37 + char *v37; // eax@38 + int v38; // eax@41 + signed int v39; // edi@42 + //char *v40; // eax@45 + //unsigned int v41; // eax@45 + signed int v43; // [sp+10h] [bp-1Ch]@1 + unsigned int v44; // [sp+14h] [bp-18h]@2 + int v45; // [sp+18h] [bp-14h]@1 + //unsigned int v46; // [sp+1Ch] [bp-10h]@1 + //unsigned int v47; // [sp+20h] [bp-Ch]@1 + unsigned int v48; // [sp+24h] [bp-8h]@33 + //unsigned int v49; // [sp+28h] [bp-4h]@1 + + //v0 = 0; + //v47 = TargetColor(0xFFu, 0xFFu, 0x9Bu); + //v49 = TargetColor(0xFFu, 0, 0); + //v46 = TargetColor(0, 0xFFu, 0); + //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE); + pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE)); + v43 = 0; + v45 = LOBYTE(pFontArrus->uFontHeight) + 1; + do + { + auto player = &pParty->pPlayers[v43]; + v44 = 94 * v43 + 89; + if ( v43 == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x12u, 0, pGlobalTXT_LocalizationStrings[149], 60, 0);//Name + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 94 * v43 + 89, 0x12u, ui_character_header_text_color, player->pName, 84, 0); + if ( v43 == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, 0x2Fu, 0, pGlobalTXT_LocalizationStrings[131], 60, 0); //. + sprintf(pTmpBuf, "%lu", player->GetActualLevel()); + if ( player->GetActualLevel() <= player->GetBaseLevel()) + v5 = player->GetExperienceDisplayColor(); + else + v5 = ui_character_bonus_text_color; + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, 0x2Fu, v5, pTmpBuf, 84, 0); + v6 = v45 + 47; + if ( v43 == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v45 + 47, 0, pGlobalTXT_LocalizationStrings[41], 60, 0);// + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v6, 0, pClassNames[player->classType], 84, 0); + v7 = v45 + v6; + if ( v43 == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v7, 0, pGlobalTXT_LocalizationStrings[107], 60, 0);//. + sprintf(pTmpBuf, "%d", player->sHealth); + v9 = UI_GetHealthManaStringColor(player->sHealth, player->GetMaxHealth()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v7, v9, pTmpBuf, 84, 0); + v10 = v45 + v7; + if ( v43 == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v10, 0, pGlobalTXT_LocalizationStrings[209], 60, 0);// + sprintf(pTmpBuf, "%d", player->sMana); + v12 = UI_GetHealthManaStringColor(player->sMana, player->GetMaxMana()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v10, v12, pTmpBuf, 84, 0); + v13 = v45 + v10; + if ( v43 == 0 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v13, 0, pGlobalTXT_LocalizationStrings[0], 60, 0);// + sprintf(pTmpBuf, "%d", player->GetActualAC()); + v18 = UI_GetHealthManaStringColor(player->GetActualAC(), player->GetBaseAC()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v13, v18, pTmpBuf, 84, 0); + v19 = v45 + v13; + if ( !v43 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v19, 0, pGlobalTXT_LocalizationStrings[18], 60, 0);// + sprintf(pTmpBuf, "%+d", player->GetActualAttack(0)); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v19, 0, pTmpBuf, 84, 0); + v21 = v45 + v19; + if ( !v43 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v21, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//. + v22 = player->GetMeleeDamageString(); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v21, 0, v22, 84, 0); + v23 = v45 + v21; + if ( !v43 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v23, 0, pGlobalTXT_LocalizationStrings[203], 60, 0);// + sprintf(pTmpBuf, "%+d", player->GetRangedAttack()); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v23, 0, pTmpBuf, 84, 0); + v25 = v45 + v23; + if ( !v43 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v25, 0, pGlobalTXT_LocalizationStrings[66], 60, 0);//. + v26 = player->GetRangedDamageString(); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v25, 0, v26, 84, 0); + v27 = v45 + v25; + if ( !v43 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v27, 0, pGlobalTXT_LocalizationStrings[205], 60, 0);// + v28 = 0; + v29 = (char *)player->pActiveSkills; + v30 = 36; + do + { + if ( *(short *)v29 ) + ++v28; + v29 += 2; + --v30; + } + while ( v30 ); + sprintf(pTmpBuf, "%lu", v28); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v27, 0, pTmpBuf, 84, 0); + v31 = v45 + v27; + if ( !v43 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v31, 0, pGlobalTXT_LocalizationStrings[168], 60, 0);// + sprintf(pTmpBuf, "%lu", player->uSkillPoints); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v31, player->uSkillPoints ? ui_character_bonus_text_color : ui_character_default_text_color, pTmpBuf, 84, 0); + v32 = v45 + v31; + v48 = player->GetMajorConditionIdx(); + if ( !v43 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v32, 0, pGlobalTXT_LocalizationStrings[45], 60, 0);//. + v33 = aCharacterConditionNames[v48]; + v34 = GetConditionDrawColor(v48); + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v32, v34, v33, 84, 0); + v35 = v45 + v32; + if ( !v43 ) + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, 0x16u, v35, 0, pGlobalTXT_LocalizationStrings[170], 60, 0);//.. + if (player->uQuickSpell) + v37 = pSpellStats->pInfos[player->uQuickSpell].pShortName; + else + v37 = pGlobalTXT_LocalizationStrings[153];// + pGUIWindow_CurrentMenu->DrawTextInRect(pFontArrus, v44, v35, 0, v37, 84, 0); + ++v43; + } + while ( v43 < 4 ); + + v38 = GetPartyReputation(); + if ( v38 >= 0 ) + { + if ( v38 <= 5 ) + v39 = ui_character_default_text_color; + else + v39 = ui_character_bonus_text_color_neg; + } + else + v39 = ui_character_bonus_text_color; + + sprintf(pTmpBuf, "%s: \f%05d%s\f00000", pGlobalTXT_LocalizationStrings[180], v39, GetReputationString(v38));//Reputation + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0); + + sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], pParty->GetPartyFame());// Fame + pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0); +} + + + //----- (0041AD6E) -------------------------------------------------------- -void __cdecl GameUI_DrawRightPanelItems() +void GameUI_DrawRightPanelItems() { if (GameUI_RightPanel_BookFlashTimer > pParty->uTimePlayed) GameUI_RightPanel_BookFlashTimer = 0; @@ -57,26 +238,25 @@ if (pParty->uTimePlayed - GameUI_RightPanel_BookFlashTimer > 128) { GameUI_RightPanel_BookFlashTimer = pParty->uTimePlayed; - byte_50697C = byte_50697C == 0; + + static bool byte_50697C = false; // 50697C + byte_50697C = !byte_50697C; if ( byte_50697C && pCurrentScreen != SCREEN_REST ) { - if ( bFlashQuestBook ) - pRenderer->DrawTextureTransparent(493, 355, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)); - if ( bFlashAutonotesBook ) - pRenderer->DrawTextureTransparent(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A)); - if ( bFlashHistoryBook ) - pRenderer->DrawTextureTransparent(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)); + if (bFlashQuestBook) pRenderer->DrawTextureTransparent(493, 355, pIcons_LOD->GetTexture(uTextureID_ib_td1_A)); + if (bFlashAutonotesBook) pRenderer->DrawTextureTransparent(527, 353, pIcons_LOD->GetTexture(uTextureID_ib_td2_A)); + if (bFlashHistoryBook) pRenderer->DrawTextureTransparent(600, 361, pIcons_LOD->GetTexture(uTextureID_ib_td5_A)); } else { - pRenderer->DrawTextureRGB(468u, 0, pTexture_RightFrame); - DrawHiredNPCs(); + pRenderer->DrawTextureRGB(468, 0, pTexture_RightFrame); + GameUI_DrawHiredNPCs(); } } } //----- (0041AEBB) -------------------------------------------------------- -void __cdecl GameUI_DrawFoodAndGold() +void GameUI_DrawFoodAndGold() { int v2; // esi@2 @@ -90,316 +270,122 @@ } } -//----- (0041AF52) -------------------------------------------------------- -void Actor::DrawHealthBar(Actor *a1, GUIWindow *a2) -{ - unsigned int v2; // eax@1 - GUIWindow *v3; // edi@1 - unsigned int v4; // esi@1 - signed int v5; // ebx@4 - double v6; // st7@5 - unsigned int v7; // eax@6 - unsigned int v8; // ebx@10 - unsigned int v9; // [sp+14h] [bp-Ch]@4 - unsigned int v10; // [sp+1Ch] [bp-4h]@4 - - v2 = a1->pMonsterInfo.uHP; - v3 = a2; - v4 = 25; - if ( (signed int)v2 > 25 ) - { - v4 = 200; - if ( (signed int)v2 < 200 ) - v4 = a1->pMonsterInfo.uHP; - } - v5 = a1->sCurrentHP; - v10 = v4; - v9 = uTextureID_mhp_grn; - if ( v5 < (signed int)v2 ) - { - v6 = (double)(signed int)v2; - v10 = (signed __int64)((double)(signed int)v4 / (double)(signed int)v2 * (double)a1->sCurrentHP); - if ( v5 <= (signed int)(signed __int64)(0.34 * v6) ) - { - v7 = uTextureID_mhp_red; - v9 = v7; - } - else if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) ) - { - v7 = uTextureID_mhp_yel; - v9 = v7; - } - } - v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2; - - pRenderer->SetTextureClipRect(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52); - pRenderer->DrawTextureIndexed(v8, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_bd)); - pRenderer->SetTextureClipRect(v8, v3->uFrameY + 32, v8 + v10, v3->uFrameY + 52); - pRenderer->DrawTextureIndexed(v8, v3->uFrameY + 34, pIcons_LOD->GetTexture(v9)); - - pRenderer->ResetTextureClipRect(); - pRenderer->DrawTextureIndexed(v8 - 5, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capl)); - pRenderer->DrawTextureIndexed(v8 + v4, v3->uFrameY + 32, pIcons_LOD->GetTexture(uTextureID_mhp_capr)); -} //----- (0041B0C9) -------------------------------------------------------- -void __cdecl GameUI_DrawLifeManaBars() +void GameUI_DrawLifeManaBars() { - Texture *v0; // ebx@1 - Player *v1; // ecx@2 - float v2; // ST38_4@3 double v3; // st7@3 - signed __int64 v4; // qax@6 - Player *v5; // ecx@24 - float v6; // ST30_4@25 double v7; // st7@25 - bool v8; // ST38_4@27 Texture *v9; // [sp-4h] [bp-30h]@10 Texture *v10; // [sp+Ch] [bp-20h]@1 - Player *v11; // [sp+10h] [bp-1Ch]@2 - int v12; // [sp+10h] [bp-1Ch]@24 - Texture *v13; // [sp+14h] [bp-18h]@1 - Texture *v14; // [sp+18h] [bp-14h]@1 - float v15; // [sp+1Ch] [bp-10h]@1 - signed int v16; // [sp+24h] [bp-8h]@1 - signed int v17; // [sp+28h] [bp-4h]@8 + + + v10 = pIcons_LOD->GetTexture(uTextureID_BarBlue); - v0 = pIcons_LOD->GetTexture(uTextureID_BarGreen); - v14 = pIcons_LOD->GetTexture(uTextureID_BarYellow); - v13 = pIcons_LOD->GetTexture(uTextureID_BarRed); - v16 = 0; - v10 = pIcons_LOD->GetTexture(uTextureID_BarBlue); - v15 = v0->uTextureHeight; - do + for (uint i = 0; i < 4; ++i) { - v1 = &pParty->pPlayers[v16]; - v11 = v1; - if ( v1->sHealth > 0 ) + auto player = pParty->pPlayers + i; + + if (player->sHealth > 0) { - v11 = &pParty->pPlayers[v16]; - v2 = (double)v1->sHealth; - v3 = v2 / (double)v1->GetMaxHealth(); - if( v3 > 0.5 ) - { - if ( v3 > 1.0 ) - v3 = 1.0; - v4 = (signed __int64)((1.0 - v3) * v15); - if ( v16 == 2 || v16 == 3 ) - v17 = 2; - else - v17 = 0; - pRenderer->SetTextureClipRect( - v17 + pHealthBarPos[v16], - v4 + 402, - v17 + pHealthBarPos[v16] + v0->uTextureWidth, - v0->uTextureHeight + 402); - v9 = v0; - } - else if ( v3 > 0.25 ) - { - if ( v16 == 2 || v16 == 3 ) - v17 = 2; - else - v17 = 0; - pRenderer->SetTextureClipRect( - v17 + pHealthBarPos[v16], - (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, - v17 + pHealthBarPos[v16] + v14->uTextureWidth, - v14->uTextureHeight + 402); - v9 = v14; - } - else if ( v3 > 0.0 ) - { - if ( v16 == 2 || v16 == 3 ) - v17 = 2; - else - v17 = 0; - pRenderer->SetTextureClipRect( - v17 + pHealthBarPos[v16], - (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, - v17 + pHealthBarPos[v16] + v13->uTextureWidth, - v13->uTextureHeight + 402); - v9 = v13; - } + int v17 = 0; + if (i == 2 || i == 3) + v17 = 2; + + v3 = (double)player->sHealth / (double)player->GetMaxHealth(); + if( v3 > 0.5 ) + { + if ( v3 > 1.0 ) + v3 = 1.0; + v9 = pIcons_LOD->GetTexture(uTextureID_BarGreen); + } + else if ( v3 > 0.25 ) + v9 = pIcons_LOD->GetTexture(uTextureID_BarYellow); + else if ( v3 > 0.0 ) + v9 = pIcons_LOD->GetTexture(uTextureID_BarRed); + + if( v3 > 0.0 ) { - pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[v16], 0x192u, v9); + pRenderer->SetTextureClipRect(v17 + pHealthBarPos[i], + (signed __int64)((1.0 - v3) * v9->uTextureHeight) + 402, + v17 + pHealthBarPos[i] + v9->uTextureWidth, + v9->uTextureHeight + 402); + + pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[i], 402, v9); pRenderer->ResetTextureClipRect(); } } - v5 = v11; - v12 = v11->sMana; - if ( v12 > 0 ) + + + if (player->sMana > 0) { - v6 = (double)v12; - v7 = v6 / (double)v5->GetMaxMana(); + v7 = player->sMana / (double)player->GetMaxMana(); if ( v7 > 1.0 ) v7 = 1.0; - v8 = v16 == 2; - pRenderer->SetTextureClipRect( - (v16 == 2) + pManaBarPos[v16], - (unsigned __int64)(signed __int64)((1.0 - v7) * v15) + 402, - v8 + pManaBarPos[v16] + v10->uTextureWidth, - v10->uTextureHeight + 402); - pRenderer->DrawTextureIndexed(v8 + pManaBarPos[v16], 0x192u, v10); + + int v17 = 0; + if (i == 2) + v17 = 1; + + pRenderer->SetTextureClipRect(v17 + pManaBarPos[i], + (signed __int64)((1.0 - v7) * v10->uTextureHeight) + 402, + v17 + pManaBarPos[i] + v10->uTextureWidth, + v10->uTextureHeight + 402); + pRenderer->DrawTextureIndexed(v17 + pManaBarPos[i], 402, v10); pRenderer->ResetTextureClipRect(); } - ++v16; } - while ( v16 < 4 ); } //----- (0041B3B6) -------------------------------------------------------- -void __cdecl draw_right_panel() +void GameUI_DrawRightPanel() { - pRenderer->DrawTextureTransparent(pViewport->uViewportBR_X, 0, pIcons_LOD->GetTexture(uTextureID_right_panel)); + pRenderer->DrawTextureTransparent(pViewport->uViewportBR_X, 0, + pIcons_LOD->GetTexture(uTextureID_right_panel)); } //----- (0041B3E2) -------------------------------------------------------- -void __cdecl GameUI_DrawRightPanelFrames() +void GameUI_DrawRightPanelFrames() { - pRenderer->DrawTextureRGB(0, 0, pTexture_TopFrame); - pRenderer->DrawTextureRGB(0, 8u, pTexture_LeftFrame); - pRenderer->DrawTextureRGB(468u, 0, pTexture_RightFrame); - pRenderer->DrawTextureRGB(0, 352u, pTexture_BottomFrame); + pRenderer->DrawTextureRGB(0, 0, pTexture_TopFrame); + pRenderer->DrawTextureRGB(0, 8, pTexture_LeftFrame); + pRenderer->DrawTextureRGB(468, 0, pTexture_RightFrame); + pRenderer->DrawTextureRGB(0, 352, pTexture_BottomFrame); GameUI_DrawFoodAndGold(); GameUI_DrawRightPanelItems(); } -//----- (0041B438) -------------------------------------------------------- -GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey) + +//----- (0041C047) -------------------------------------------------------- +void GameUI_Footer_2() { - char v1; // al@1 - int v2; // esi@1 - char v3; // dl@1 - GUIWindow *v4; // ecx@2 - GUIButton *result; // eax@2 - //int v6; // edx@12 - - v1 = toupper(uHotkey); - v2 = uNumVisibleWindows; - v3 = v1; - if ( uNumVisibleWindows >= 0 ) - { - while ( 2 ) - { - v4 = &pWindowList[pVisibleWindowsIdxs[v2] - 1]; - for ( result = v4->pControlsHead; result; result = result->pNext ) - { - if ( result->uHotkey == v3 ) - { - pMessageQueue_50CBD0->AddMessage(result->msg, result->msg_param, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)result->uControlID; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - return result; - } - } - if ( v4->uFrameX || v4->uFrameY || !(v4->uFrameWidth == 640 & v4->uFrameHeight == 480) ) - { - --v2; - if ( v2 >= 0 ) - continue; - } - break; - } - } - return 0; -} -// 5075E0: using guessed type int pVisibleWindowsIdxs[20]; + char *v1; // edx@2 + int v5; // eax@5 -//----- (0041B4E1) -------------------------------------------------------- -int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall) -{ - unsigned __int8 v3; // bl@1 - int result; // eax@1 - int i; // edx@2 - GUIButton *j; // ecx@3 - int k; // edx@7 - GUIButton *l; // ecx@8 - unsigned __int8 v9; // [sp+4h] [bp-8h]@1 - char v10; // [sp+8h] [bp-4h]@1 - - v3 = uNewHotkey; - v10 = toupper(uOldHotkey); - result = toupper(v3); - v9 = result; - if ( bFirstCall ) + pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); + if (GameUI_Footer_TimeLeft) + v1 = GameUI_Footer_TimedString; + else { - for ( i = uNumVisibleWindows; i >= 0; --i ) - { - result = 84 * pVisibleWindowsIdxs[i]; - //for ( j = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); j; j = j->pNext ) - for ( j = pWindowList[pVisibleWindowsIdxs[i] - 1].pControlsHead; j; j = j->pNext ) - j->field_28 = 0; - } + if (!pFooterString[0]) + return; + v1 = pFooterString; } - for ( k = uNumVisibleWindows; k >= 0; --k ) - { - result = 84 * pVisibleWindowsIdxs[k]; - //for ( l = *(GUIButton **)((char *)pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_ + result); l; l = l->pNext ) - for ( l = pWindowList[pVisibleWindowsIdxs[k] - 1].pControlsHead; l; l = l->pNext ) - { - LOBYTE(result) = v10; - if ( l->uHotkey == v10 ) - { - if ( !l->field_28 ) - { - LOBYTE(result) = v9; - l->field_28 = 1; - l->uHotkey = v9; - } - } - } - } - return result; + + v5 = pFontLucida->AlignText_Center(450, v1); + pPrimaryWindow->DrawText(pFontLucida, v5 + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow); } - - -//----- (0041C047) -------------------------------------------------------- -void __cdecl GameUI_Footer_2() - { - unsigned int v0; // eax@1 - char *v1; // edx@2 - unsigned int v2; // ST18_4@5 - const char *v3; // ST0C_4@5 - unsigned int v4; // ST08_4@5 - int v5; // eax@5 - - pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar); - if ( GameUI_Footer_TimeLeft ) - { - v1 = GameUI_Footer_TimedString; - } - else - { - if ( !pFooterString[0] ) - return; - v1 = pFooterString; - } - LOWORD(v0) = uGameUIFontShadow; - v2 = v0; - LOWORD(v0) = uGameUIFontMain; - v3 = v1; - v4 = v0; - v5 = pFontLucida->AlignText_Center(0x1C2u, v1); - pPrimaryWindow->DrawText(pFontLucida, v5 + 11, 357, v4, v3, 0, 0, v2); - } - //----- (0041C0B8) -------------------------------------------------------- -void __thiscall sub_41C0B8_set_status_string(const char *pStr) - { +void GameUI_SetFooterString(const char *pStr) +{ const char *v1; // esi@1 int i; // eax@7 int j; // eax@11 v1 = pStr; - if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(v1, 1u) && (*v1 || GameUI_Footer_TimeLeft) ) + if ( pStr && strcmp(pStr, "test") && !IsBadStringPtrA(v1, 1) && (*v1 || GameUI_Footer_TimeLeft) ) { if ( GameUI_Footer_TimeLeft ) { @@ -422,7 +408,7 @@ //----- (0041C179) -------------------------------------------------------- void GameUI_Footer() { - unsigned int v0; // ebp@1 + //unsigned int v0; // ebp@1 char *v1; // edi@5 int v2; // eax@5 unsigned int v3; // esi@5 @@ -432,10 +418,9 @@ size_t v7; // eax@10 GUIFont *v8; // ecx@10 char v9; // zf@12 - unsigned int v10; // ST08_4@13 + //unsigned int v10; // ST08_4@13 int v11; // eax@13 - v0 = uGameUIFontShadow; if ( pFooterString[0] || GameUI_Footer_TimeLeft || bForceDrawFooter ) { pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar); @@ -469,9 +454,8 @@ bForceDrawFooter = 0; if ( !v9 ) { - v10 = uGameUIFontMain; v11 = pFontLucida->AlignText_Center(v3, v1); - pPrimaryWindow->DrawText(pFontLucida, v11 + 11, 357, v10, v1, 0, 0, v0); + pPrimaryWindow->DrawText(pFontLucida, v11 + 11, 357, uGameUIFontMain, v1, 0, 0, uGameUIFontShadow); } } } @@ -594,7 +578,7 @@ //LABEL_93: v26 = v22; //goto LABEL_87; - sub_41C0B8_set_status_string(v26); + GameUI_SetFooterString(v26); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -626,7 +610,7 @@ else v26 = pDecorationList->pDecorations[v24->uDecorationDescID].field_20; //goto LABEL_87; - sub_41C0B8_set_status_string(v26); + GameUI_SetFooterString(v26); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -656,7 +640,7 @@ //goto LABEL_93; v26 = v22; //goto LABEL_87; - sub_41C0B8_set_status_string(v26); + GameUI_SetFooterString(v26); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -697,7 +681,7 @@ //goto LABEL_93; v26 = v22; //goto LABEL_87; - sub_41C0B8_set_status_string(v26); + GameUI_SetFooterString(v26); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -734,7 +718,7 @@ //goto LABEL_93; v26 = v22; //goto LABEL_87; - sub_41C0B8_set_status_string(v26); + GameUI_SetFooterString(v26); if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) @@ -802,7 +786,7 @@ } v26 = v28; //LABEL_87: - sub_41C0B8_set_status_string(v26); + GameUI_SetFooterString(v26); //goto _return; if ( pMouse->uPointingObjectID == 0 ) { @@ -846,7 +830,7 @@ //LABEL_28: v13 = pButton->pButtonName; //_set_status_and_ret: - sub_41C0B8_set_status_string(v13); + GameUI_SetFooterString(v13); //LABEL_131: uLastPointedObjectID = 1; return; @@ -868,7 +852,7 @@ pMessageQueue_50CBD0->AddMessage(pMessageType1, pButton->msg_param, 0); } v13 = pButton->pButtonName; - sub_41C0B8_set_status_string(v13); + GameUI_SetFooterString(v13); uLastPointedObjectID = 1; return; //} @@ -901,7 +885,7 @@ sprintf(Str1, v39, v41); v13 = Str1; //goto _set_status_and_ret; - sub_41C0B8_set_status_string(v13); + GameUI_SetFooterString(v13); uLastPointedObjectID = 1; return; } @@ -956,7 +940,7 @@ pItemGen = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 4); //LABEL_49: v17 = pItemGen->GetDisplayName(); - sub_41C0B8_set_status_string(v17); + GameUI_SetFooterString(v17); //LABEL_50: uLastPointedObjectID = 1; //_return: @@ -991,7 +975,7 @@ pItemGen = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v14-1]; //goto LABEL_49; v17 = pItemGen->GetDisplayName(); - sub_41C0B8_set_status_string(v17); + GameUI_SetFooterString(v17); uLastPointedObjectID = 1; if ( pMouse->uPointingObjectID == 0 ) { @@ -1024,7 +1008,7 @@ //goto LABEL_28; { v13 = pButton->pButtonName; - sub_41C0B8_set_status_string(v13); + GameUI_SetFooterString(v13); uLastPointedObjectID = 1; return; } @@ -1057,7 +1041,7 @@ //goto LABEL_28; v13 = pButton->pButtonName; - sub_41C0B8_set_status_string(v13); + GameUI_SetFooterString(v13); uLastPointedObjectID = 1; return; //} @@ -1090,7 +1074,7 @@ sprintf(Str1, v39, v41); v13 = Str1; //goto _set_status_and_ret; - sub_41C0B8_set_status_string(v13); + GameUI_SetFooterString(v13); uLastPointedObjectID = 1; return; } @@ -1115,30 +1099,18 @@ //----- (0044158F) -------------------------------------------------------- -void __cdecl GameUI_DrawCharacterSelectionFrame() +void GameUI_DrawCharacterSelectionFrame() { if ( uActiveCharacter ) - pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9, - 380, &pIcons_LOD->pTextures[dword_50C98C]); + pRenderer->DrawTextureTransparent(pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[uActiveCharacter - 1] - 9, 380, + pIcons_LOD->GetTexture(uTextureID_GameUI_CharSelectionFrame)); } -//----- (004415C5) -------------------------------------------------------- -void LoadPartyBuffIcons() - { - for (uint i = 0; i < 14; ++i) - { - char filename[200]; - sprintf(filename, "isn-%02d", i + 1); - pTextureIDs_PartyBuffIcons[i] = pIcons_LOD->LoadTexture(filename, TEXTURE_16BIT_PALETTE); - } - uIconIdx_FlySpell = pIconsFrameTable->FindIcon("spell21"); - uIconIdx_WaterWalk = pIconsFrameTable->FindIcon("spell27"); - } //----- (0044162D) -------------------------------------------------------- -void __cdecl GameUI_DrawPartySpells() - { +void GameUI_DrawPartySpells() +{ unsigned int v0; // ebp@1 //signed int v1; // edi@1 //int v2; // eax@2 @@ -1160,7 +1132,6 @@ { auto tex = pIcons_LOD->GetTexture(pTextureIDs_PartyBuffIcons[i]); //v3 = pTextureIDs_PartyBuffIcons[i]; - if (tex) pRenderer->_4A65CC(pPartySpellbuffsUI_XYs[i][0], pPartySpellbuffsUI_XYs[i][1], tex, tex, v0 + 20 * pPartySpellbuffsUI_smthns[i], 0, 63); @@ -1174,20 +1145,20 @@ if (pParty->FlyActive()) { if ( pParty->bFlying ) - v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID]; + v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, v0)->uTextureID); else - v7 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID]; + v7 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_FlySpell, 0)->uTextureID); if ( pRenderer->pRenderD3D ) - pRenderer->DrawTextureIndexed(8u, 8u, v7); + pRenderer->DrawTextureIndexed(8, 8, v7); else - pRenderer->DrawTextureTransparent(8u, 8u, v7); + pRenderer->DrawTextureTransparent(8, 8, v7); } if (pParty->WaterWalkActive()) { if ( pParty->uFlags & PARTY_FLAGS_1_STANDING_ON_WATER) - v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID]; + v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, v0)->uTextureID); else - v9 = &pIcons_LOD->pTextures[pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID]; + v9 = pIcons_LOD->GetTexture(pIconsFrameTable->GetFrame(uIconIdx_WaterWalk, 0)->uTextureID); if ( pRenderer->pRenderD3D ) pRenderer->DrawTextureIndexed(396u, 8u, v9); else @@ -1211,65 +1182,6 @@ } -//----- (00421626) -------------------------------------------------------- -GUIWindow *GameUI_InitializeCharacterWindow(unsigned int _this) -{ - unsigned int v1; // edi@1 - GUIWindow *pWindow; // edi@3 - - ++pIcons_LOD->uTexturePacksCount; - v1 = _this; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - pEventTimer->Pause(); - pAudioPlayer->StopChannels(-1, -1); - bRingsShownInCharScreen = 0; - CharacterUI_LoadPaperdollTextures(); - pCurrentScreen = v1; - - pWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_CharacterRecord, uActiveCharacter, 0); - pCharacterScreen_StatsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 12, pViewport->uViewportTL_Y + 308, - pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureWidth, - pIcons_LOD->GetTexture(papredoll_dbrds[9])->uTextureHeight, - 1, 0, UIMSG_ClickStatsBtn, 0, 'S', pGlobalTXT_LocalizationStrings[216],// Stats - pIcons_LOD->GetTexture(papredoll_dbrds[10]), - pIcons_LOD->GetTexture(papredoll_dbrds[9]), 0); - pCharacterScreen_SkillsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 102, pViewport->uViewportTL_Y + 308, - pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureWidth, - pIcons_LOD->GetTexture(papredoll_dbrds[7])->uTextureHeight, - 1, 0, UIMSG_ClickSkillsBtn, 0, 'K', pGlobalTXT_LocalizationStrings[205],//Skills - pIcons_LOD->GetTexture(papredoll_dbrds[8]), - pIcons_LOD->GetTexture(papredoll_dbrds[7]), 0); - pCharacterScreen_InventoryBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 192, pViewport->uViewportTL_Y + 308, - pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureWidth, - pIcons_LOD->GetTexture(papredoll_dbrds[5])->uTextureHeight, - 1, 0, UIMSG_ClickInventoryBtn, 0, 'I', pGlobalTXT_LocalizationStrings[120], //Inventory - pIcons_LOD->GetTexture(papredoll_dbrds[6]), - pIcons_LOD->GetTexture(papredoll_dbrds[5]), 0); - pCharacterScreen_AwardsBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 282, pViewport->uViewportTL_Y + 308, - pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureWidth, - pIcons_LOD->GetTexture(papredoll_dbrds[3])->uTextureHeight, - 1, 0, UIMSG_ClickAwardsBtn, 0, 'A', pGlobalTXT_LocalizationStrings[22], //Awards - pIcons_LOD->GetTexture(papredoll_dbrds[4]), - pIcons_LOD->GetTexture(papredoll_dbrds[3]), 0); - pCharacterScreen_ExitBtn = pWindow->CreateButton(pViewport->uViewportTL_X + 371, pViewport->uViewportTL_Y + 308, - pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureWidth, - pIcons_LOD->GetTexture(papredoll_dbrds[1])->uTextureHeight, - 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, pGlobalTXT_LocalizationStrings[79],//Exit - pIcons_LOD->GetTexture(papredoll_dbrds[2]), - pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0); - pWindow->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); - pCharacterScreen_DetalizBtn = pWindow->CreateButton(0x258u, 0x12Cu, 0x1Eu, 0x1Eu, 1, 0, UIMSG_ChangeDetaliz, 0, 0, pGlobalTXT_LocalizationStrings[64], 0); - pCharacterScreen_DollBtn = pWindow->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); - pWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); - pWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); - pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); - pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); - pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, '\t', "", 0); - FillAwardsData(); - return pWindow; -} - //----- (004921C1) -------------------------------------------------------- void GameUI_DrawPortraits(unsigned int _this) @@ -1475,16 +1387,16 @@ //signed int v57; // [sp-4h] [bp-58h]@54 //unsigned __int16 v58; // [sp-4h] [bp-58h]@77 unsigned __int16 v59; // [sp-4h] [bp-58h]@100 - unsigned __int16 v60; // [sp+10h] [bp-44h]@66 - unsigned int v61; // [sp+10h] [bp-44h]@85 - unsigned int v63; // [sp+14h] [bp-40h]@85 - unsigned int v65; // [sp+18h] [bp-3Ch]@85 + //unsigned __int16 v60; // [sp+10h] [bp-44h]@66 + //unsigned int v61; // [sp+10h] [bp-44h]@85 + //unsigned int v63; // [sp+14h] [bp-40h]@85 + //unsigned int v65; // [sp+18h] [bp-3Ch]@85 unsigned int lPitch; // [sp+20h] [bp-34h]@1 unsigned int lPitcha; // [sp+20h] [bp-34h]@23 char *lPitchb; // [sp+20h] [bp-34h]@106 unsigned int v69; // [sp+24h] [bp-30h]@23 signed int v70; // [sp+24h] [bp-30h]@37 - unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1 + //unsigned __int16 uBlue; // [sp+28h] [bp-2Ch]@1 signed int uBluea; // [sp+28h] [bp-2Ch]@37 int v73; // [sp+2Ch] [bp-28h]@30 int v76; // [sp+34h] [bp-20h]@91 @@ -1501,15 +1413,15 @@ float uWb; // [sp+60h] [bp+Ch]@30 unsigned int uWd; // [sp+60h] [bp+Ch]@95 float uZooma; // [sp+64h] [bp+10h]@117 - unsigned int flagsb; // [sp+68h] [bp+14h]@66 + //unsigned int flagsb; // [sp+68h] [bp+14h]@66 Actor *flagsc; // [sp+68h] [bp+14h]@86 - unsigned int flagsd; // [sp+68h] [bp+14h]@105 + //unsigned int flagsd; // [sp+68h] [bp+14h]@105 uCenterX = (uX + uZ) / 2; uCenterY = (uY + uW) / 2; lPitch = pRenderer->uTargetSurfacePitch; - TargetColor(0, 0, 0); - uBlue = TargetColor(0, 0, 0xFFu); + //TargetColor(0, 0, 0); + //uBlue = TargetColor(0, 0, 0xFFu); auto bWizardEyeActive = pParty->WizardEyeActive(); auto uWizardEyeSkillLevel = pParty->WizardEyeSkillLevel(); if (CheckHiredNPCSpeciality(Cartographer)) @@ -1678,7 +1590,7 @@ - ((signed int)(((unsigned int)((unsigned __int64)((signed int)uZoom * (signed __int64)pIndoor->pVertices[pOutline->uVertex2ID].y) >> 16) << 16) - uZoom * pParty->vPosition.y) >> 16), - uBlue); + ui_game_minimap_outline_color); } } @@ -1690,8 +1602,8 @@ uint arrow_idx = floorf(0.5f + 7 * angle); pRenderer->DrawTextureTransparent(uCenterX - 3, uCenterY - 3, pIcons_LOD->GetTexture(pTextureIDs_pMapDirs[arrow_idx])); - flagsb = TargetColor(0, 0, 255); - v60 = TargetColor(255, 0, 0); + //flagsb = TargetColor(0, 0, 255); + //v60 = TargetColor(255, 0, 0); if (bWizardEyeActive) { //uZe = 0; @@ -1718,24 +1630,23 @@ assert(uZoom >= 512); if (pObjectList->pObjects[object->uObjectDescID].uFlags & OBJECT_DESC_UNPICKABLE) { - pRenderer->RasterLine2D(v37, v38, - v37, v38, v60); + pRenderer->RasterLine2D(v37, v38, v37, v38, ui_game_minimap_projectile_color); } else if (uZoom > 512) { - pRenderer->RasterLine2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, flagsb); - pRenderer->RasterLine2D(v37, v38 - 2, v37, v38 + 1, flagsb); - pRenderer->RasterLine2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, flagsb); - pRenderer->RasterLine2D(v37 - 2, v38, v37 - 2, v38 + 1, flagsb); + pRenderer->RasterLine2D(v37 - 1, v38 - 1, v37 - 1, v38 + 1, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(v37, v38 - 2, v37, v38 + 1, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(v37 + 1, v38 - 1, v37 + 1, v38 + 1, ui_game_minimap_treasure_color); + pRenderer->RasterLine2D(v37 - 2, v38, v37 - 2, v38 + 1, ui_game_minimap_treasure_color); pRenderer->RasterLine2D(v37 + 2, v38, - v37 + 2, v38 + 1, flagsb); + v37 + 2, v38 + 1, ui_game_minimap_treasure_color); } else { pRenderer->RasterLine2D(v37 - 1, v38 - 1, - v37 - 1, v38, flagsb); + v37 - 1, v38, ui_game_minimap_treasure_color); pRenderer->RasterLine2D(v37, v38 - 1, - v37, v38, flagsb); + v37, v38, ui_game_minimap_treasure_color); } //LABEL_82: //LABEL_83: @@ -1750,9 +1661,9 @@ LABEL_85: - v63 = TargetColor(255, 0, 0); - v61 = TargetColor(0, 255, 0); - v65 = TargetColor(255, 255, 0); + //v63 = TargetColor(255, 0, 0); + //v61 = TargetColor(0, 255, 0); + //v65 = TargetColor(255, 255, 0); uZf = 0; if ( (signed int)uNumActors > 0 ) { @@ -1772,11 +1683,11 @@ { if ( v40 <= pRenderer->raster_clip_z && v41 >= pRenderer->raster_clip_y && v41 <= pRenderer->raster_clip_w ) { - uWd = v61; + uWd = ui_game_minimap_actor_friendly_color; if ( BYTE3(flagsc->uAttributes) & 1 ) - uWd = v63; - if ( flagsc->uAIState == 5 ) - uWd = v65; + uWd = ui_game_minimap_actor_hostile_color; + if ( flagsc->uAIState == Dead) + uWd = ui_game_minimap_actor_corpse_color; if ( (signed int)uZoom > 1024 ) { pRenderer->RasterLine2D(v40 - 1, v41 - 2, v40 - 1, v41 + 2, uWd); @@ -1812,7 +1723,7 @@ } - flagsd = TargetColor(255, 255, 255); + //flagsd = TargetColor(255, 255, 255); uZg = 0; if ( (signed int)uNumLevelDecorations > 0 ) { @@ -1834,14 +1745,14 @@ { v48 = v47 + 1; v49 = v47 - 1; - pRenderer->RasterLine2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, flagsd); - pRenderer->RasterLine2D(v46, v49, v46, v48, flagsd); - pRenderer->RasterLine2D(v46 + 1, v49, v46 + 1, v48, flagsd); + pRenderer->RasterLine2D(v46 - 1, v47 - 1, v46 - 1, v47 + 1, ui_game_minimap_decoration_color_1); + pRenderer->RasterLine2D(v46, v49, v46, v48, ui_game_minimap_decoration_color_1); + pRenderer->RasterLine2D(v46 + 1, v49, v46 + 1, v48, ui_game_minimap_decoration_color_1); v45 = lPitchb; } else { - pRenderer->RasterLine2D(v46, uCenterY - v77, v46, uCenterY - v77, flagsd); + pRenderer->RasterLine2D(v46, uCenterY - v77, v46, uCenterY - v77, ui_game_minimap_decoration_color_1); } } } @@ -1891,7 +1802,7 @@ //----- (00491F87) -------------------------------------------------------- -void __cdecl DrawHiredNPCs() +void GameUI_DrawHiredNPCs() { //int v6; // eax@15 char v7; // al@17 diff -r d5796c318653 -r 3ee391de04d5 Vis.cpp --- a/Vis.cpp Tue May 14 19:04:48 2013 +0600 +++ b/Vis.cpp Tue May 14 19:05:08 2013 +0600 @@ -537,7 +537,7 @@ if (!default_list.uNumPointers) return -1; - return get_object_zbuf_val(default_list.object_pointers[0]);//Click to the Rat in dragon cave result crash. Maybe object_pointers incorrect + return get_object_zbuf_val(default_list.object_pointers[0]); } //----- (004C1C0C) -------------------------------------------------------- diff -r d5796c318653 -r 3ee391de04d5 mm7_1.cpp --- a/mm7_1.cpp Tue May 14 19:04:48 2013 +0600 +++ b/mm7_1.cpp Tue May 14 19:05:08 2013 +0600 @@ -74,7 +74,7 @@ } //----- (004196A0) -------------------------------------------------------- -void __cdecl sub_4196A0() +void CharacterUI_ReleaseButtons() { GUIButton *i; // esi@2 GUIButton *j; // esi@7 @@ -510,7 +510,7 @@ _w = (ItemGen *)(&pChests[(unsigned int)pChestWindow->ptr_1C] -32 + 18 * *((short *)&pChests[(unsigned int)pChestWindow->ptr_1C].igChestItems[139].uExpireTime + v1 + 3)); v2 = _w->GetDisplayName(); - sub_41C0B8_set_status_string(v2); + GameUI_SetFooterString(v2); } } } @@ -671,32 +671,7 @@ } } -//----- (004219BE) -------------------------------------------------------- -GUIWindow *CastSpellInfo::sub_4219BE() -{ - int v1; // esi@1 - GUIWindow *v2; // ebx@1 - auto a4 = this; - v1 = (int)a4; - pEventTimer->Pause(); - pAudioPlayer->StopChannels(-1, -1); - bRingsShownInCharScreen = 0; - CharacterUI_LoadPaperdollTextures(); - pCurrentScreen = SCREEN_CASTING; - v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell_InInventory, v1, 0); - pCharacterScreen_ExitBtn = v2->CreateButton(394, 318, 75, 33, 1, 0, UIMSG_ClickExitCharacterWindowBtn, 0, 0, - pGlobalTXT_LocalizationStrings[79], // Close - pIcons_LOD->GetTexture(papredoll_dbrds[2]), - pIcons_LOD->GetTexture(papredoll_dbrds[1]), 0); - v2->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, UIMSG_InventoryLeftClick, 0, 0, "", 0); - pCharacterScreen_DollBtn = v2->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, UIMSG_ClickPaperdoll, 0, 0, "", 0); - v2->CreateButton( 61, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 1, '1', "", 0); - v2->CreateButton(177, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 2, '2', "", 0); - v2->CreateButton(292, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 3, '3', "", 0); - v2->CreateButton(407, 424, 31, 0, 2, 94, UIMSG_SelectCharacter, 4, '4', "", 0); - return v2; -} //----- (00421B2C) -------------------------------------------------------- bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem() @@ -838,7 +813,7 @@ } v5 = 7; //LABEL_22: - pGUIWindow_CurrentMenu = GameUI_InitializeCharacterWindow(v5); + pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5); return; } if ( pCurrentScreen == SCREEN_SPELL_BOOK ) @@ -908,7 +883,7 @@ pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; v5 = 14; //goto LABEL_22; - pGUIWindow_CurrentMenu = GameUI_InitializeCharacterWindow(v5); + pGUIWindow_CurrentMenu = CharacterUI_Initialize(v5); return; } } @@ -1254,7 +1229,7 @@ } /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) return; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)161; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_StartNPCDialogue; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v18; LABEL_42: *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; @@ -1270,7 +1245,7 @@ } /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)23; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack; goto LABEL_41; }*/ pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); @@ -1287,7 +1262,7 @@ { pMessageQueue_50CBD0->AddMessage(UIMSG_CastQuickSpell, 0, 0); /*&& (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)25; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_CastQuickSpell; LABEL_41: pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; goto LABEL_42;*/ @@ -1342,7 +1317,7 @@ pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-C", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-C", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-c", 2); @@ -1389,7 +1364,7 @@ uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE); uTextureID_Btn_ZoomIn = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE); uTextureID_Btn_ZoomOut = pIcons_LOD->LoadTexture("ib-autin-C", TEXTURE_16BIT_PALETTE); - dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE); + uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE); uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE); uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE); uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE); @@ -1430,7 +1405,7 @@ pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-a", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-a", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-a", 2); @@ -1472,7 +1447,7 @@ dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-a", TEXTURE_16BIT_PALETTE); uTextureID_Btn_NPCLeft = pIcons_LOD->LoadTexture("IB-NPCLD-A", TEXTURE_16BIT_PALETTE); uTextureID_Btn_NPCRight = pIcons_LOD->LoadTexture("IB-NPCRD-A", TEXTURE_16BIT_PALETTE); - dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE); + uTextureID_GameUI_CharSelectionFrame = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE); uTextureID_Btn_CastSpell = pIcons_LOD->LoadTexture("ib-m1d-a", TEXTURE_16BIT_PALETTE); uTextureID_Btn_Rest = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE); uTextureID_Btn_QuickReference = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE); @@ -1526,7 +1501,7 @@ pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_NPCRight], "IB-NPCRD-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomIn], "ib-autout-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_ZoomOut], "ib-autin-B", 2); - pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-B", 2); + pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_GameUI_CharSelectionFrame], "IB-selec-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_CastSpell], "ib-m1d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_Rest], "ib-m2d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Btn_QuickReference], "ib-m3d-b", 2); diff -r d5796c318653 -r 3ee391de04d5 mm7_2.cpp --- a/mm7_2.cpp Tue May 14 19:04:48 2013 +0600 +++ b/mm7_2.cpp Tue May 14 19:05:08 2013 +0600 @@ -96,7 +96,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -595,7 +595,7 @@ pParty->uFallSpeed = 0; /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -7247,7 +7247,7 @@ /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { v12 = window_SpeakInHouse == 0; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = !v12; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -10736,7 +10736,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_StartNPCDialogue, v12, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)161; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_StartNPCDialogue; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -11251,7 +11251,7 @@ else v24 = pDecorationList->pDecorations[v26->uDecorationDescID].field_20; LABEL_51: - sub_41C0B8_set_status_string(v24); + GameUI_SetFooterString(v24); return v19; } diff -r d5796c318653 -r 3ee391de04d5 mm7_3.cpp --- a/mm7_3.cpp Tue May 14 19:04:48 2013 +0600 +++ b/mm7_3.cpp Tue May 14 19:05:08 2013 +0600 @@ -4100,7 +4100,7 @@ //----- (00477C61) -------------------------------------------------------- int stru6_stru1_indoor_sw_billboard::sub_477C61() { - stru6_stru1_indoor_sw_billboard *v1; // ebx@1 + //stru6_stru1_indoor_sw_billboard *v1; // ebx@1 int v2; // ecx@2 int v3; // eax@3 double v4; // st7@4 @@ -4142,13 +4142,13 @@ float v41; // [sp+2Ch] [bp-4h]@6 float v42; // [sp+2Ch] [bp-4h]@9 - v1 = this; + //v1 = this; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) { v2 = 0; - if ( v1->field_10 > 0 ) - { - v3 = (int)&v1->field_14[1]; + if ( this->field_10 > 0 ) + { + v3 = (int)&this->field_14[1]; do { v4 = *(float *)(v3 - 4); @@ -4199,7 +4199,7 @@ *(float *)(v3 + 80) = v11; v3 += 16; } - while ( v2 < v1->field_10 ); + while ( v2 < this->field_10 ); } } else @@ -4244,7 +4244,7 @@ } while ( v31 ); } - v1->field_10 = 3; + this->field_10 = 3; return 1; } @@ -11484,7 +11484,7 @@ } //----- (0044100D) -------------------------------------------------------- -bool __cdecl sub_44100D() +bool sub_44100D() { return pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHARACTERS || pCurrentScreen > SCREEN_LOADGAME && pCurrentScreen <= SCREEN_E || diff -r d5796c318653 -r 3ee391de04d5 mm7_4.cpp --- a/mm7_4.cpp Tue May 14 19:04:48 2013 +0600 +++ b/mm7_4.cpp Tue May 14 19:05:08 2013 +0600 @@ -6707,7 +6707,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -6762,7 +6762,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -6825,7 +6825,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -8461,7 +8461,7 @@ /*result = pMessageQueue_50CBD0->uNumMessages; if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; *(&pMessageQueue_50CBD0->uNumMessages + result) = v5; diff -r d5796c318653 -r 3ee391de04d5 mm7_5.cpp --- a/mm7_5.cpp Tue May 14 19:04:48 2013 +0600 +++ b/mm7_5.cpp Tue May 14 19:05:08 2013 +0600 @@ -82,7 +82,7 @@ unsigned int v33; // eax@277 unsigned __int8 v34; // al@279 unsigned __int8 v35; // al@280 - GUIWindow *pWindow3; // ecx@332 + //GUIWindow *pWindow3; // ecx@332 int v37; // eax@341 int v38; // eax@358 SHORT v39; // ax@365 @@ -97,7 +97,7 @@ char v48; // zf@405 BLVFace *pBLVFace; // ecx@410 ODMFace *pODMFace; // ecx@412 - CastSpellInfo *v51; // ecx@415 + CastSpellInfo *pSpellInfo; // ecx@415 void *v52; // eax@424 __int16 v53; // ax@431 int v54; // eax@432 @@ -155,12 +155,6 @@ Player *pPlayer5; // ST78_4@758 unsigned int v107; // eax@758 unsigned int v108; // eax@758 - char *v109; // ST64_4@759 - Player *v110; // ST78_4@759 - int v111; // ST60_4@759 - int v112; // ST5C_4@759 - char *v113; // ST58_4@759 - signed int v114; // eax@759 unsigned int v115; // eax@764 int v116; // eax@776 POINT *pPoint3; // eax@777 @@ -975,35 +969,31 @@ back_to_game(); if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - if ( pCurrentScreen > SCREEN_CHEST_INVENTORY ) - { - if ( pCurrentScreen >= SCREEN_CHANGE_LOCATION && (pCurrentScreen <= SCREEN_INPUT_BLV || pCurrentScreen == SCREEN_QUICK_REFERENCE) ) - { + switch ( pCurrentScreen ) + { + case SCREEN_E: + __debugbreak(); + case SCREEN_NPC_DIALOGUE: + case SCREEN_CHEST: + case SCREEN_CHEST_INVENTORY: + case SCREEN_CHANGE_LOCATION: + case SCREEN_INPUT_BLV: + case SCREEN_QUICK_REFERENCE: if ( dword_50CDC8 ) - goto LABEL_232; + break; CloseWindowBackground(); uMessageParam = 1; - goto LABEL_232; - } - } - else - { - if ( pCurrentScreen >= SCREEN_E || pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_CHEST ) - { - if ( dword_50CDC8 ) - goto LABEL_232; - CloseWindowBackground(); - uMessageParam = 1; - goto LABEL_232; - } - if ( pCurrentScreen == SCREEN_HOUSE && !dword_50CDC8 && !dword_5C35C8 ) - { - CloseWindowBackground(); - dword_5C35C8 = 0; - uMessageParam = 1; - } - } -LABEL_232: + break; + case SCREEN_HOUSE: + if ( !dword_50CDC8 && !dword_5C35C8 ) + { + CloseWindowBackground(); + dword_5C35C8 = 0; + uMessageParam = 1; + break; + } + break; + } if ( !ptr_507BDC ) { pRenderer->ClearZBuffer(0, 479); @@ -1014,7 +1004,36 @@ if ( pCurrentScreen > SCREEN_67 ) { if ( pCurrentScreen == SCREEN_QUICK_REFERENCE ) - goto LABEL_321; + { + pIcons_LOD->_4114F2(); + if ( pGUIWindow_Settings ) + { + if ( pCurrentScreen == SCREEN_CHARACTERS ) + { + pMouse->SetCursorBitmap("MICON2"); + } + else + { + pGUIWindow_Settings->Release(); + pGUIWindow_Settings = 0; + pMouse->SetCursorBitmap("MICON1"); + GameUI_Footer_TimeLeft = 0; + unk_50C9A0 = 0; + back_to_game(); + } + } + if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) + uActiveCharacter = pParty->GetNextActiveCharacter(); + pGUIWindow_CurrentMenu->Release(); + if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) + window_SpeakInHouse = 0; + pGUIWindow_CurrentMenu = 0; + pEventTimer->Resume(); + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = 1; + pIcons_LOD->_4355F7(); + continue; + } } else { @@ -1380,7 +1399,36 @@ pVideoPlayer->Unload(); continue; case SCREEN_CHARACTERS: - goto LABEL_319; + CharacterUI_ReleaseButtons(); + sub_419379(); + pIcons_LOD->_4114F2(); + if ( pGUIWindow_Settings ) + { + if ( pCurrentScreen == SCREEN_CHARACTERS ) + { + pMouse->SetCursorBitmap("MICON2"); + } + else + { + pGUIWindow_Settings->Release(); + pGUIWindow_Settings = 0; + pMouse->SetCursorBitmap("MICON1"); + GameUI_Footer_TimeLeft = 0; + unk_50C9A0 = 0; + back_to_game(); + } + } + if ( (signed int)uActiveCharacter < 1 || (signed int)uActiveCharacter > 4 ) + uActiveCharacter = pParty->GetNextActiveCharacter(); + pGUIWindow_CurrentMenu->Release(); + if ( pGUIWindow_CurrentMenu == window_SpeakInHouse ) + window_SpeakInHouse = 0; + pGUIWindow_CurrentMenu = 0; + pEventTimer->Resume(); + pCurrentScreen = SCREEN_GAME; + viewparams->bRedrawGameUI = 1; + pIcons_LOD->_4355F7(); + continue; default: if ( pGUIWindow_Settings ) { @@ -1438,10 +1486,8 @@ pIcons_LOD->_4355F7(); continue; } -LABEL_319: - sub_4196A0(); + CharacterUI_ReleaseButtons(); sub_419379(); -LABEL_321: pIcons_LOD->_4114F2(); } if ( pGUIWindow_Settings ) @@ -1472,7 +1518,6 @@ pIcons_LOD->_4355F7(); continue; } - pWindow3 = pGUIWindow_Settings; if ( !pGUIWindow_Settings )//Draw Menu { dword_6BE138 = -1; @@ -1518,7 +1563,7 @@ stru_506E40._40E55E("gamma.pcx", 0); continue; } - pWindow3->Release(); + pGUIWindow_Settings->Release(); pGUIWindow_Settings = 0; pMouse->SetCursorBitmap("MICON1"); GameUI_Footer_TimeLeft = 0; @@ -1550,7 +1595,7 @@ pParty->field_709 = 0; } } - DrawHiredNPCs(); + GameUI_DrawHiredNPCs(); continue; case UIMSG_TransitionUI_Confirm: if ( pMessageQueue_50CBD0->uNumMessages ) @@ -1758,13 +1803,12 @@ v47 = pActors[v46].uAIState == Dead; if ( !v47 ) continue; - 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(); + pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; + LOBYTE(pSpellInfo->field_8) &= 0xBFu; + pSpellInfo->uPlayerID_2 = uMessageParam; + pSpellInfo->spell_target_pid = v44; + pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); + pGUIWindow_Settings->Release(); pGUIWindow_Settings = 0; pMouse->SetCursorBitmap("MICON1"); GameUI_Footer_TimeLeft = 0; @@ -1777,13 +1821,12 @@ v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0; if ( !v47 ) continue; - 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(); + pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; + LOBYTE(pSpellInfo->field_8) &= 0xBFu; + pSpellInfo->uPlayerID_2 = uMessageParam; + pSpellInfo->spell_target_pid = v44; + pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); + pGUIWindow_Settings->Release(); pGUIWindow_Settings = 0; pMouse->SetCursorBitmap("MICON1"); GameUI_Footer_TimeLeft = 0; @@ -1805,13 +1848,12 @@ if ( !(pODMFace->uAttributes & 0x02000000) || !pODMFace->sCogTriggeredID ) continue; v44 = uNumSeconds; - v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; - *((char *)v51 + 8) &= 0xBFu; - v51->uPlayerID_2 = uMessageParam; - v51->spell_target_pid = v44; - pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300); - pWindow3 = pGUIWindow_Settings; - pWindow3->Release(); + pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; + LOBYTE(pSpellInfo->field_8) &= 0xBFu; + pSpellInfo->uPlayerID_2 = uMessageParam; + pSpellInfo->spell_target_pid = v44; + pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); + pGUIWindow_Settings->Release(); pGUIWindow_Settings = 0; pMouse->SetCursorBitmap("MICON1"); GameUI_Footer_TimeLeft = 0; @@ -1826,22 +1868,21 @@ } if ( v48 ) continue; - 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(); + pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; + LOBYTE(pSpellInfo->field_8) &= 0xBFu; + pSpellInfo->uPlayerID_2 = uMessageParam; + pSpellInfo->spell_target_pid = v44; + pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); + pGUIWindow_Settings->Release(); pGUIWindow_Settings = 0; pMouse->SetCursorBitmap("MICON1"); GameUI_Footer_TimeLeft = 0; unk_50C9A0 = 0; back_to_game(); continue; - case UIMSG_CastSpell_SPIRIT_Preservation://and blessing, treatment paralysis, hand hammers(individual upgrade) - case UIMSG_CastSpell_SPIRIT_Fate: - case UIMSG_CastSpell_8F://??? + case UIMSG_CastSpell_Character_Big_Improvement://Preservation and blessing, treatment paralysis, hand hammers(individual upgrade) + case UIMSG_CastSpell_Character_Small_Improvement://Fate, cure + case UIMSG_HiredNPC_CastSpell: if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; if ( unk_50C9A0 ) @@ -1853,21 +1894,21 @@ { if ( pGUIWindow_Settings ) { - v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; + pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; switch ( uMessage ) { - case UIMSG_CastSpell_SPIRIT_Preservation: - LOBYTE(v51->field_8) &= 0xFDu; + case UIMSG_CastSpell_Character_Big_Improvement: + LOBYTE(pSpellInfo->field_8) &= 0xFDu; break; - case UIMSG_CastSpell_SPIRIT_Fate: - HIBYTE(v51->field_8) &= 0xFEu; + case UIMSG_CastSpell_Character_Small_Improvement: + HIBYTE(pSpellInfo->field_8) &= 0xFEu; break; - case UIMSG_CastSpell_8F: - HIBYTE(v51->field_8) &= 0xFDu; + case UIMSG_HiredNPC_CastSpell: + HIBYTE(pSpellInfo->field_8) &= 0xFDu; break; } - v51->uPlayerID_2 = uMessageParam; - pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300); + pSpellInfo->uPlayerID_2 = uMessageParam; + pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); pGUIWindow_Settings->Release(); pGUIWindow_Settings = 0; pEventTimer->Resume(); @@ -1905,7 +1946,7 @@ //goto LABEL_434; /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -1939,7 +1980,7 @@ continue; v173 = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(pPlayer->pInstalledBeacons[uMessageParam].field_18))].pName; sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s" - sub_41C0B8_set_status_string(pTmpBuf); + GameUI_SetFooterString(pTmpBuf); continue; } v59 = pMapStats->GetMapInfo(pCurrentMapName); @@ -1949,20 +1990,20 @@ if ( !*((int *)&pSavegameThumbnails->pPixels + 10 * uMessageParam) || !v59 ) { sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[476], thise);// "Set to %s" - sub_41C0B8_set_status_string(pTmpBuf); + GameUI_SetFooterString(pTmpBuf); continue; } v174 = pMapStats->pInfos[sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName; v158 = (unsigned int)thise; sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s" - sub_41C0B8_set_status_string(pTmpBuf); + GameUI_SetFooterString(pTmpBuf); continue; case UIMSG_CloseAfterInstallBeacon: dword_50CDC8 = 1; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages;*/ @@ -2108,12 +2149,10 @@ *((int *)v67 + 17) = 1; else pParty->pPlayers[(unsigned __int8)town_portal_caster_id].CanCastSpell(0x14u); -//LABEL_434: /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v0; -//LABEL_771: *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; }*/ @@ -2172,7 +2211,7 @@ if ( uMessageParam != 5 ) { sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v200); - sub_41C0B8_set_status_string(pTmpBuf); + GameUI_SetFooterString(pTmpBuf); continue; } v69 = pMapStats->pInfos[8].pName; @@ -2184,7 +2223,7 @@ v69 = pMapStats->pInfos[21].pName; } sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v69); - sub_41C0B8_set_status_string(pTmpBuf); + GameUI_SetFooterString(pTmpBuf); continue; } v68 = 210; @@ -2222,7 +2261,7 @@ //goto LABEL_519; { sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v200); - sub_41C0B8_set_status_string(pTmpBuf); + GameUI_SetFooterString(pTmpBuf); continue; } v69 = pMapStats->pInfos[8].pName; @@ -2234,7 +2273,7 @@ v69 = pMapStats->pInfos[21].pName; } sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v69); - sub_41C0B8_set_status_string(pTmpBuf); + GameUI_SetFooterString(pTmpBuf); continue; case UIMSG_ShowFinalWindow: sprintf(pFinalMessage, "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer." @@ -2247,9 +2286,8 @@ __debugbreak(); uGameState = GAME_STATE_PLAYING; strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2"); - goto LABEL_524; case UIMSG_DD: -LABEL_524: + __debugbreak(); sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer); memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216)); if ( v216.uPropCount == 1 ) @@ -2258,10 +2296,7 @@ v70 = atoi(v216.pProperties[0]); if ( v70 <= 0 || v70 >= 77 ) { -//LABEL_90: v1 = ""; -//LABEL_91: - //v0 = 1; continue; } v71 = v70; @@ -2284,9 +2319,7 @@ dword_6BE364_game_settings_1 |= 1u; uGameState = GAME_STATE_2; OnMapLeave(); - //goto LABEL_90; v1 = ""; - //v0 = 1; continue; } } @@ -2296,10 +2329,8 @@ else { if ( v216.uPropCount != 3 ) - //goto LABEL_90; { v1 = ""; - //v0 = 1; continue; } v74 = atoi(v216.pProperties[0]); @@ -2311,14 +2342,11 @@ if ( pIndoor->GetSector(v74, thisi, v75) ) { v77 = thisi; -//LABEL_544: pParty->vPosition.x = v74; pParty->vPosition.y = v77; pParty->vPosition.z = v76; pParty->uFallStartY = v76; - //goto LABEL_90; v1 = ""; - //v0 = 1; continue; } } @@ -2332,15 +2360,12 @@ if ( thisi > -32768 ) { if ( thisi < 32768 && v76 >= 0 && v76 < 10000 ) - //goto LABEL_544; { pParty->vPosition.x = v74; pParty->vPosition.y = v77; pParty->vPosition.z = v76; pParty->uFallStartY = v76; - //goto LABEL_90; v1 = ""; - //v0 = 1; continue; } } @@ -2351,9 +2376,7 @@ v73 = "Can't jump to that location!"; } ShowStatusBarString(v73, 6u); - //goto LABEL_90; v1 = ""; - //v0 = 1; continue; case UIMSG_CastQuickSpell: if ( bUnderwater == 1 ) @@ -2363,16 +2386,14 @@ continue; } if ( !uActiveCharacter || (pPlayer2 = pPlayers[uActiveCharacter], pPlayer2->uTimeToRecovery) ) - //goto LABEL_90; { v1 = ""; - //v0 = 1; continue; } _42777D_CastSpell_UseWand_ShootArrow(pPlayer2->uQuickSpell, uActiveCharacter - 1, 0, 0, uActiveCharacter); continue; - case UIMSG_CastSpell_SmallShot://FireBlow, Lightning, Ice Lightning, Swarm, - case UIMSG_CastSpell_GreatShot://??? + case UIMSG_CastSpell_Monster_Improvement: + case UIMSG_CastSpell_Shoot_Monster://FireBlow, Lightning, Ice Lightning, Swarm, if ( pRenderer->pRenderD3D ) { v81 = pGame->pVisInstance->get_picked_object_zbuf_val(); @@ -2391,24 +2412,22 @@ v1 = ""; continue; } - v51 = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; - if ( uMessage == UIMSG_CastSpell_SmallShot ) - { - LOBYTE(v51->field_8) &= 0xF7; + pSpellInfo = (CastSpellInfo *)pGUIWindow_Settings->ptr_1C; + if ( uMessage == UIMSG_CastSpell_Shoot_Monster ) + { + LOBYTE(pSpellInfo->field_8) &= 0xF7; } else { - if ( uMessage == UIMSG_CastSpell_GreatShot ) - HIBYTE(v51->field_8) &= 0xFEu; + if ( uMessage == UIMSG_CastSpell_Monster_Improvement ) + HIBYTE(pSpellInfo->field_8) &= 0xFEu; else - HIBYTE(v51->field_8) &= 0xFDu; - } - //goto LABEL_416; - v51->uPlayerID_2 = uMessageParam; - v51->spell_target_pid = v44; - pParty->pPlayers[v51->uPlayerID].SetRecoveryTime(300); - pWindow3 = pGUIWindow_Settings; - pWindow3->Release(); + HIBYTE(pSpellInfo->field_8) &= 0xFDu; + } + pSpellInfo->uPlayerID_2 = uMessageParam; + pSpellInfo->spell_target_pid = v44; + pParty->pPlayers[pSpellInfo->uPlayerID].SetRecoveryTime(300); + pGUIWindow_Settings->Release(); pGUIWindow_Settings = 0; pMouse->SetCursorBitmap("MICON1"); GameUI_Footer_TimeLeft = 0; @@ -2429,14 +2448,11 @@ case UIMSG_1B: __debugbreak(); if ( !uActiveCharacter ) - //goto LABEL_90; { v1 = ""; - //v0 = 1; continue; } if ( pParty->bTurnBasedModeOn != 1 ) - //goto LABEL_569; { if ( pActors[uMessageParam].uAIState == 5 ) stru_50C198.LootActor(&pActors[uMessageParam]); @@ -2445,15 +2461,12 @@ continue; } if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) - //goto LABEL_90; { v1 = ""; - //v0 = 1; continue; } if ( !(pTurnEngine->field_18 & 2) ) { -//LABEL_569: if ( pActors[uMessageParam].uAIState == 5 ) stru_50C198.LootActor(&pActors[uMessageParam]); else @@ -2463,27 +2476,21 @@ case UIMSG_Attack: if ( !uActiveCharacter ) - //goto LABEL_90; { v1 = ""; - //v0 = 1; continue; } if ( pParty->bTurnBasedModeOn != 1 ) - //goto LABEL_577; { _42ECB5_PlayerAttacksActor(); continue; } if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 3 ) - //goto LABEL_90; { v1 = ""; - //v0 = 1; continue; } if ( !(pTurnEngine->field_18 & 2) ) -//LABEL_577: _42ECB5_PlayerAttacksActor(); continue; case UIMSG_ExitRest: @@ -2547,7 +2554,6 @@ if ( !uActiveCharacter ) { v1 = ""; - //v0 = 1; continue; } pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); @@ -2575,7 +2581,6 @@ if ( !uActiveCharacter ) { v1 = ""; - //v0 = 1; continue; } pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0); @@ -2625,7 +2630,7 @@ dword_506F14 = 0; /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -2674,7 +2679,7 @@ v177 = pGlobalTXT_LocalizationStrings[484];// "Select a spell then click here to set a QuickSpell" strcpy(pTmpBuf, v177); } - sub_41C0B8_set_status_string(pTmpBuf); + GameUI_SetFooterString(pTmpBuf); continue; case UIMSG_SPellbook_ShowHightlightedSpellInfo: if ( !uActiveCharacter || (uNumSeconds = (unsigned int)pPlayers[uActiveCharacter], @@ -2694,8 +2699,7 @@ v161 = pGlobalTXT_LocalizationStrings[486]; } sprintfex(pTmpBuf, v161, v178); - sub_41C0B8_set_status_string(pTmpBuf); - //v0 = 1; + GameUI_SetFooterString(pTmpBuf); continue; case UIMSG_ClickInstallRemoveQuickSpellBtn: GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_PressedButton2, (int)pBtn_InstallRemoveSpell, 0); @@ -2792,13 +2796,14 @@ pCurrentScreen = SCREEN_GAME; pIcons_LOD->_4114F2(); v103 = quick_spell_at_page + 11 * player->lastOpenedSpellbookPage; - if ( dword_50C9E8 < 40 ) + /*if ( dword_50C9E8 < 40 ) { dword_50C9EC[3 * dword_50C9E8] = UIMSG_CastSpellFromBook; dword_50C9EC[3 * dword_50C9E8 + 1] = v103; dword_50C9EC[3 * dword_50C9E8 + 2] = uActiveCharacter - 1; ++dword_50C9E8; - } + }*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_CastSpellFromBook, v103, uActiveCharacter - 1); } else { @@ -2834,7 +2839,6 @@ if ( uActiveCharacter && !pPlayers[uActiveCharacter]->uTimeToRecovery ) { if ( !pCurrentScreen ) - //goto LABEL_693; { GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_PressedButton2, (int)pBtn_CastSpell, 0); pCurrentScreen = SCREEN_SPELL_BOOK; @@ -2897,7 +2901,7 @@ //LABEL_453: /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) continue; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; //goto LABEL_770; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; @@ -2912,11 +2916,11 @@ continue; case UIMSG_ClickAwardsUpBtn: GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Up, 0); - dword_506548 = 1; + BtnUp_flag = 1; continue; case UIMSG_ClickAwardsDownBtn: GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pBtn_Down, 0); - dword_506544 = 1; + BtnDown_flag = 1; continue; case UIMSG_ChangeDetaliz: bRingsShownInCharScreen ^= 1; @@ -2947,15 +2951,15 @@ continue; case UIMSG_ClickStatsBtn: pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100; - sub_4196A0(); + CharacterUI_ReleaseButtons(); sub_419379(); GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_StatsBtn, 0); continue; case UIMSG_ClickSkillsBtn: pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101; - sub_4196A0(); + CharacterUI_ReleaseButtons(); sub_419379(); - CharacterUI_SkillScreen_Draw(); + CharacterUI_SkillsTab_CreateButtons(); GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_SkillsBtn, 0); continue; case UIMSG_SkillUp: @@ -2984,7 +2988,7 @@ case UIMSG_ClickInventoryBtn: pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; sub_419379(); - sub_4196A0(); + CharacterUI_ReleaseButtons(); GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_InventoryBtn, 0); continue; case UIMSG_ClickExitCharacterWindowBtn: @@ -2992,63 +2996,65 @@ continue; case UIMSG_ClickAwardsBtn: sub_419379(); - sub_4196A0(); + CharacterUI_ReleaseButtons(); sub_419220(); pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 102; GUIWindow::Create(pCharacterScreen_AwardsBtn->uX, pCharacterScreen_AwardsBtn->uY, 0, 0, WINDOW_CharactersPressedButton, (int)pCharacterScreen_AwardsBtn, 0); FillAwardsData(); continue; - case UIMSG_AutonotesBook: + case UIMSG_ClickBooksBtn: switch ( uMessageParam ) { - default: - continue; - case 11: - dword_506548 = 1; - continue; - case 10: - dword_506544 = 1; - continue; - case 0: + case 11://Page UP + BtnUp_flag = 1; + pButton = pBtn_Book_2; + break; + case 10://Page DOWN + BtnDown_flag = 1; pButton = pBtn_Book_1; - dword_506544 = 1; break; - case 1: + case 0://Zoom plus + pButton = pBtn_Book_1; + BtnDown_flag = 1; + break; + case 1://Zoom minus pButton = pBtn_Book_2; - dword_506548 = 1; + BtnUp_flag = 1; break; - case 2: - dword_506540 = 1; + case 2://Potions + Book_PageBtn3_flag = 1; if ( dword_506364 ) continue; pButton = pBtn_Book_3; break; - case 3: - dword_50653C = 1; + case 3://fountains + Book_PageBtn4_flag = 1; if ( dword_506364 ) continue; pButton = pBtn_Book_4; break; - case 4: - dword_506538 = 1; + case 4://obelisks + Book_PageBtn5_flag = 1;//Autonotes_Obelisks_page_flag if ( dword_506364 ) continue; pButton = pBtn_Book_5; break; - case 5: - dword_506534 = 1; + case 5://seer + Book_PageBtn6_flag = 1;//Autonotes_Seer_page_flag if ( dword_506364 ) continue; pButton = pBtn_Book_6; break; - case 6: + case 6://misc pButton = pBtn_Autonotes_Misc; - dword_506530 = 1; + Autonotes_Misc_page_flag = 1; break; - case 7: + case 7://Instructors pButton = pBtn_Autonotes_Instructors; - dword_50652C = 1; + Autonotes_Instructors_page_flag = 1; break; + default: + continue; } GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, WINDOW_PressedButton, (int)pButton, 1); continue; @@ -3061,7 +3067,7 @@ v174 = (char *)pParty->uNumGoldInBank; v158 = pParty->uNumGold + pParty->uNumGoldInBank; sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[489], v158, v174);// "You have %d total gold, %d in the Bank" - sub_41C0B8_set_status_string(pTmpBuf); + GameUI_SetFooterString(pTmpBuf); continue; case UIMSG_ShowStatus_DateTime: pNPCData4 = (NPCData *)pParty->uCurrentHour; @@ -3078,11 +3084,11 @@ 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); - sub_41C0B8_set_status_string(pTmpBuf); + GameUI_SetFooterString(pTmpBuf); continue; case UIMSG_ShowStatus_Food: sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[501], pParty->uNumFoodRations); // "You have %lu food" - sub_41C0B8_set_status_string(pTmpBuf); + GameUI_SetFooterString(pTmpBuf); continue; case UIMSG_ShowStatus_Player: pPlayer5 = pPlayers[uMessageParam]; @@ -3090,20 +3096,16 @@ strcat(pTmpBuf, ": "); v107 = pPlayer5->GetMajorConditionIdx(); strcat(pTmpBuf, aCharacterConditionNames[v107]); - sub_41C0B8_set_status_string(pTmpBuf); + GameUI_SetFooterString(pTmpBuf); v108 = 8 * uMessageParam - 8; LOBYTE(v108) = v108 | 4; pMouse->uPointingObjectID = PID(OBJECT_Player,v108); continue; case UIMSG_ShowStatus_ManaHP: - v109 = pGlobalTXT_LocalizationStrings[212];// "Spell Points" - v110 = pPlayers[uMessageParam]; - v111 = v110->GetMaxMana(); - v112 = v110->sMana; - v113 = pGlobalTXT_LocalizationStrings[108];// "Hit Points" - v114 = v110->GetMaxHealth(); - sprintf(pTmpBuf, "%d / %d %s %d / %d %s", v110->sHealth, v114, v113, v112, v111, v109); - sub_41C0B8_set_status_string(pTmpBuf); + sprintf(pTmpBuf, "%d / %d %s %d / %d %s", pPlayers[uMessageParam]->sHealth, pPlayers[uMessageParam]->GetMaxHealth(), + pGlobalTXT_LocalizationStrings[108], pPlayers[uMessageParam]->sMana, pPlayers[uMessageParam]->GetMaxMana(), + pGlobalTXT_LocalizationStrings[212]); + GameUI_SetFooterString(pTmpBuf); continue; case UIMSG_CHEST_ClickItem: if ( pCurrentScreen == SCREEN_CHEST_INVENTORY ) @@ -3126,13 +3128,12 @@ } v115 = pMessageQueue_50CBD0->uNumMessages; if ( !pMessageQueue_50CBD0->uNumMessages ) - //goto LABEL_768; - { - pMessageQueue_50CBD0->AddMessage(UIMSG_E, 0, 0); + { + pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); /*if ( (signed int)v115 < 40 ) //goto LABEL_769; { - pMessageQueue_50CBD0->pMessages[v115].eType = (UIMessageType)14; + pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -3143,10 +3144,10 @@ if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) { pMessageQueue_50CBD0->uNumMessages = 1; - pMessageQueue_50CBD0->AddMessage(UIMSG_E, 0, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); /*v115 = v0; pMessageQueue_50CBD0->uNumMessages = v0; - pMessageQueue_50CBD0->pMessages[v115].eType = (UIMessageType)14; + pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; //goto LABEL_771; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; @@ -3155,19 +3156,18 @@ } v115 = 0; pMessageQueue_50CBD0->uNumMessages = 0; - pMessageQueue_50CBD0->AddMessage(UIMSG_E, 0, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_MouseLeftClickInScreen, 0, 0); /*if ( (signed int)v115 < 40 ) //goto LABEL_769; { - pMessageQueue_50CBD0->pMessages[v115].eType = (UIMessageType)14; + pMessageQueue_50CBD0->pMessages[v115].eType = UIMSG_MouseLeftClickInScreen; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; continue; }*/ continue; - case UIMSG_E: - __debugbreak();// UIMSG_MouseLeftClickInGame + case UIMSG_MouseLeftClickInScreen:// UIMSG_MouseLeftClickInGame if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; OnGameViewportClick(); @@ -3190,7 +3190,7 @@ case UIMSG_54: __debugbreak(); pButton2 = (GUIButton *)uMessageParam; - GUIWindow::Create(0, 0, 0, 0, (WindowType)22, (int)pButton2, 0); + GUIWindow::Create(0, 0, 0, 0, WINDOW_22, (int)pButton2, 0); continue; case UIMSG_Game_Action: if ( pMessageQueue_50CBD0->uNumMessages ) @@ -3201,7 +3201,7 @@ if ( pCurrentScreen ) continue; pParty->uFlags |= 2u; - GUIWindow::Create(0x207u, 0x88u, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomOut, 0); + GUIWindow::Create(519, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomOut, 0); uNumSeconds = 131072; v118 = 2 * viewparams->uMinimapZoom; ++viewparams->field_28; @@ -3231,7 +3231,7 @@ if ( pCurrentScreen ) continue; pParty->uFlags |= 2u; - GUIWindow::Create(0x23Eu, 0x88u, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomIn, 0); + GUIWindow::Create(574, 136, 0, 0, WINDOW_PressedButton2, (int)pBtn_ZoomIn, 0); uNumSeconds = 32768; v118 = (unsigned __int64)((signed __int64)(signed int)viewparams->uMinimapZoom << 15) >> 16; --viewparams->field_28; @@ -9971,86 +9971,8 @@ return pGlobalTXT_LocalizationStrings[567]; } -//----- (00413D6F) -------------------------------------------------------- -char __cdecl DrawBook_Calendar() -{ - unsigned int v0; // esi@1 - char *v1; // eax@5 - int v2; // ecx@5 - char *v3; // eax@6 - GUIWindow a1; // [sp+Ch] [bp-60h]@5 - unsigned int v6; // [sp+60h] [bp-Ch]@1 - int v7; // [sp+64h] [bp-8h]@1 - int a5; // [sp+68h] [bp-4h]@1 - - v0 = pParty->uCurrentHour; - v6 = pMapStats->GetMapInfo(pCurrentMapName); - a5 = TargetColor(0x4Bu, 0x4Bu, 0x4Bu); - pRenderer->DrawTextureIndexed(pViewport->uViewportTL_X, pViewport->uViewportTL_Y, pSpellBookPagesTextr_13); - v7 = (unsigned __int8)pDayMoonPhase[pParty->uDaysPlayed]; - if ( (signed int)v0 <= 12 ) - { - if ( !v0 ) - v0 = 12; - } - else - { - v0 -= 12; - } - a1.uFrameX = game_viewport_x; - a1.uFrameY = game_viewport_y; - a1.uFrameWidth = game_viewport_width; - a1.uFrameHeight = game_viewport_height; - a1.uFrameZ = game_viewport_z; - a1.uFrameW = game_viewport_w; - a1.DrawTitleText(pBook2Font, 0, 0x16u, 0, pGlobalTXT_LocalizationStrings[186], 3u); - if ( pParty->uCurrentHour >= 12 ) - { - if ( pParty->uCurrentHour >= 24 ) - v2=0; - else - v2=1; - } - else - v2=0; - v1 = GetDayPart(); - sprintf( - pTmpBuf, - "%s\t100:\t110%d:%02d %s - %s", - pGlobalTXT_LocalizationStrings[526], - v0, - pParty->uCurrentMinute, - aAMPMNames[v2], - v1); - a1.DrawText(pBookFont, 70, 55, a5, pTmpBuf, 0, 0, 0); - sprintf( - pTmpBuf, - "%s\t100:\t110%d - %s", - pGlobalTXT_LocalizationStrings[56], - pParty->uDaysPlayed + 1, - aDayNames[pParty->uDaysPlayed % 7]); - a1.DrawText(pBookFont, 70, 2 * LOBYTE(pBookFont->uFontHeight) + 49, a5, pTmpBuf, 0, 0, 0); - sprintf( - pTmpBuf, - "%s\t100:\t110%d - %s", - pGlobalTXT_LocalizationStrings[146], - pParty->uCurrentMonth + 1, - aMonthNames[pParty->uCurrentMonth]); - a1.DrawText(pBookFont, 70, 4 * LOBYTE(pBookFont->uFontHeight) + 43, a5, pTmpBuf, 0, 0, 0); - sprintf(pTmpBuf, "%s\t100:\t110%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); - a1.DrawText(pBookFont, 70, 6 * LOBYTE(pBookFont->uFontHeight) + 37, a5, pTmpBuf, 0, 0, 0); - sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[530], aMoonPhaseNames[v7]); - a1.DrawText(pBookFont, 70, 8 * LOBYTE(pBookFont->uFontHeight) + 31, a5, pTmpBuf, 0, 0, 0); - if ( v6 ) - v3 = pMapStats->pInfos[v6].pName; - else - v3 = "Unknown"; - sprintf(pTmpBuf, "%s\t100:\t110%s", pGlobalTXT_LocalizationStrings[531], v3); - return a1.DrawText(pBookFont, 70, 10 * LOBYTE(pBookFont->uFontHeight) + 25, a5, pTmpBuf, 0, 0, 0); -} - //----- (00413FF1) -------------------------------------------------------- -void __cdecl SetMonthNames() +void SetMonthNames() { aMonthNames[0] = pGlobalTXT_LocalizationStrings[415]; aMonthNames[1] = pGlobalTXT_LocalizationStrings[416]; @@ -10067,7 +9989,7 @@ } //----- (0041406F) -------------------------------------------------------- -void __cdecl SetDayNames() +void SetDayNames() { aDayNames[0] = pGlobalTXT_LocalizationStrings[145]; aDayNames[1] = pGlobalTXT_LocalizationStrings[230]; @@ -10079,7 +10001,7 @@ } //----- (004140BB) -------------------------------------------------------- -void __cdecl SetSpellSchoolNames() +void SetSpellSchoolNames() { aSpellSchoolNames[0] = pGlobalTXT_LocalizationStrings[87]; aSpellSchoolNames[1] = pGlobalTXT_LocalizationStrings[6]; @@ -10093,7 +10015,7 @@ } //----- (0041411B) -------------------------------------------------------- -void __cdecl SetAttributeNames() +void SetAttributeNames() { aAttributeNames[0] = pGlobalTXT_LocalizationStrings[144]; aAttributeNames[1] = pGlobalTXT_LocalizationStrings[116]; @@ -10105,13 +10027,13 @@ } //----- (00414162) -------------------------------------------------------- -void __cdecl uGameUIFontMain_initialize() +void uGameUIFontMain_initialize() { uGameUIFontMain = TargetColor(0xAu, 0, 0); } //----- (00414174) -------------------------------------------------------- -void __cdecl uGameUIFontShadow_initialize() +void uGameUIFontShadow_initialize() { uGameUIFontShadow = TargetColor(0xE6u, 214u, 193u); } @@ -10247,7 +10169,7 @@ } case WINDOW_CharacterRecord: { - CharacterUI_CharacterScreen_Draw(uActiveCharacter); + CharacterUI_CharacterScreen_Draw(pPlayers[uActiveCharacter]); continue; } case WINDOW_Options: @@ -10257,7 +10179,7 @@ } case WINDOW_Book: { - DrawCurrentBook((unsigned int)pWindow->ptr_1C); + BookUI_Draw((WindowType)(int)pWindow->ptr_1C); continue; } case WINDOW_Dialogue: @@ -10267,7 +10189,7 @@ } case WINDOW_QuickReference: { - QuickRefDraw(); + GameUI_QuickRef_Draw(); continue; } case WINDOW_Rest: @@ -10349,7 +10271,7 @@ pRenderer->ClearZBuffer(0, 479); draw_leather(); CharacterUI_InventoryTab_Draw(pPlayers[uActiveCharacter], true); - CharacterUI_DrawPaperdoll(uActiveCharacter); + CharacterUI_DrawPaperdoll(pPlayers[uActiveCharacter]); pRenderer->DrawTextureTransparent(pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, pIcons_LOD->GetTexture(uTextureID_x_x_u)); continue; } @@ -10912,7 +10834,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -10988,7 +10910,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -11304,7 +11226,7 @@ { /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)27; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_1B; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v6 >> 3; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; diff -r d5796c318653 -r 3ee391de04d5 mm7_6.cpp --- a/mm7_6.cpp Tue May 14 19:04:48 2013 +0600 +++ b/mm7_6.cpp Tue May 14 19:05:08 2013 +0600 @@ -2275,10 +2275,10 @@ if ( pGUIWindow_Settings ) return; pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); - pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Preservation, 0, 49, "", 0); - pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Preservation, 1, 50, "", 0); - pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Preservation, 2, 51, "", 0); - pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_SPIRIT_Preservation, 3, 52, "", 0); + pGUIWindow_Settings->CreateButton(52, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 0, 49, "", 0); + pGUIWindow_Settings->CreateButton(165, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 1, 50, "", 0); + pGUIWindow_Settings->CreateButton(280, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 2, 51, "", 0); + pGUIWindow_Settings->CreateButton(390, 422, 35, 0, 2, 0, UIMSG_CastSpell_Character_Big_Improvement, 3, 52, "", 0); sub_421B2C_PlaceInInventory_or_DropPickedItem(); return; } @@ -2288,7 +2288,7 @@ return; pGUIWindow_Settings = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell, (int)&pCastSpellInfo[result], 0); - pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_SmallShot, 0, 0, "", 0); + pGUIWindow_Settings->CreateButton(game_viewport_x, game_viewport_y, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Shoot_Monster, 0, 0, "", 0); sub_421B2C_PlaceInInventory_or_DropPickedItem(); return; } @@ -2320,11 +2320,11 @@ 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_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); + pGUIWindow_Settings->CreateButton(0x34u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 0, 0x31u, "", 0); + pGUIWindow_Settings->CreateButton(0xA5u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 1, 0x32u, "", 0); + pGUIWindow_Settings->CreateButton(0x118u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 2, 0x33u, "", 0); + pGUIWindow_Settings->CreateButton(0x186u, 0x1A6u, 0x23u, 0, 2, 0, UIMSG_CastSpell_Character_Small_Improvement, 3, 0x34u, "", 0); + pGUIWindow_Settings->CreateButton(8, 8, game_viewport_width, game_viewport_height, 1, 0, UIMSG_CastSpell_Monster_Improvement, 0, 0, "", NULL); sub_421B2C_PlaceInInventory_or_DropPickedItem(); } if ( HIBYTE(a5) & 2 && !pGUIWindow_Settings ) @@ -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_CastSpell_8F, 4, 0x35u, "", 0); - pGUIWindow_Settings->CreateButton(0x231u, 149, 64, 74, 1, 0, UIMSG_CastSpell_8F, 5, 0x36u, "", 0); + pGUIWindow_Settings->CreateButton(491, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 4, 0x35u, "", 0); + pGUIWindow_Settings->CreateButton(561, 149, 64, 74, 1, 0, UIMSG_HiredNPC_CastSpell, 5, 0x36u, "", 0); } } } @@ -2426,7 +2426,7 @@ unsigned __int8 v14; // zf@53 //unsigned int v15; // edx@53 //signed int v16; // eax@53 - Player *v17; // esi@70 + //Player *v17; // esi@70 //int v18; // eax@72 //int v19; // eax@74 Player *v20; // eax@74 @@ -2485,10 +2485,10 @@ //__int16 v73; // ST1C_2@222 //__int16 v74; // ST18_2@222 //stru6 *v75; // eax@222 - int v76; // ecx@223 - int v77; // ecx@224 - int v78; // ecx@225 - int v79; // eax@227 + //int v76; // ecx@223 + //int v77; // ecx@224 + //int v78; // ecx@225 + //int v79; // eax@227 //int v80; // eax@232 //__int16 v81; // ST18_2@245 //stru6 *v82; // eax@245 @@ -2500,7 +2500,7 @@ //__int16 v88; // ST18_2@245 //stru6 *v89; // eax@245 double v90; // st7@245 - int v91; // eax@250 + //int v91; // eax@250 Player *v92; // eax@255 //__int16 v93; // ST18_2@260 //stru6 *v94; // eax@260 @@ -2510,10 +2510,10 @@ //stru6 *v98; // eax@260 //__int16 v99; // ST18_2@260 //stru6 *v100; // eax@260 - int v101; // ecx@261 - int v102; // ecx@262 - int v103; // ecx@263 - int v104; // eax@265 + //int v101; // ecx@261 + //int v102; // ecx@262 + //int v103; // ecx@263 + //int v104; // eax@265 int v105; // edi@271 //__int16 v106; // ST18_2@272 //stru6 *v107; // eax@272 @@ -2532,10 +2532,10 @@ //int v120; // eax@286 //int v121; // eax@286 signed int v122; // eax@286 - int v123; // ecx@288 - int v124; // ecx@289 - int v125; // ecx@290 - int v126; // eax@292 + //int v123; // ecx@288 + //int v124; // ecx@289 + //int v125; // ecx@290 + //int v126; // eax@292 int v127; // eax@296 //__int16 v128; // ST18_2@303 //stru6 *v129; // eax@303 @@ -2547,9 +2547,9 @@ //stru6 *v135; // eax@303 //unsigned __int64 v136; // qax@304 //char *v137; // ecx@304 - int v138; // ecx@305 + //int v138; // ecx@305 int v139; // ecx@306 - int v140; // eax@308 + //int v140; // eax@308 //__int16 v141; // ST18_2@311 //stru6 *v142; // eax@311 //__int16 v143; // ST18_2@311 @@ -2566,10 +2566,10 @@ int v154; // eax@322 int v155; // eax@323 int v156; // eax@323 - int v157; // eax@326 + //int v157; // eax@326 double v158; // st7@326 double v159; // st6@326 - signed __int64 v160; // qtt@334 + //signed __int64 v160; // qtt@334 //int v161; // eax@339 int v162; // edi@340 //int v163; // eax@340 @@ -2579,10 +2579,10 @@ //stru6 *v167; // eax@340 signed int v168; // edi@343 int v169; // eax@344 - int v170; // ecx@346 - int v171; // ecx@347 - int v172; // ecx@348 - int v173; // edi@350 + //int v170; // ecx@346 + //int v171; // ecx@347 + //int v172; // ecx@348 + //int v173; // edi@350 signed int v174; // edi@355 //__int16 v175; // ST18_2@357 //stru6 *v176; // eax@357 @@ -2602,8 +2602,8 @@ //const char *v190; // ecx@377 signed int v191; // edi@379 int v192; // ecx@382 - int v193; // ecx@383 - int v194; // ecx@384 + //int v193; // ecx@383 + //int v194; // ecx@384 int v195; // eax@386 int v196; // eax@387 //__int16 v197; // ST18_2@395 @@ -2628,13 +2628,13 @@ double v216; // st7@415 double v217; // st6@415 signed __int64 v218; // qtt@423 - int v219; // ecx@425 - int v220; // ecx@426 - int v221; // edi@428 + //int v219; // ecx@425 + //int v220; // ecx@426 + //int v221; // edi@428 Player *v222; // edi@434 char v223; // al@438 - int v224; // ecx@442 - int v225; // ecx@443 + //int v224; // ecx@442 + //int v225; // ecx@443 //int v226; // eax@451 int v227; // esi@453 unsigned int v228; // edi@454 @@ -2682,7 +2682,7 @@ char *v270; // eax@531 char v271; // al@531 char v272; // cf@534 - float v273; // esi@541 + //float v273; // esi@541 char v274; // al@541 int v275; // edx@544 int k; // esi@544 @@ -2729,9 +2729,9 @@ const char *v317; // ecx@617 Player *v318; // ecx@619 unsigned int v319; // edi@627 - int v320; // ecx@629 - int v321; // ecx@630 - int v322; // edi@632 + //int v320; // ecx@629 + //int v321; // ecx@630 + //int v322; // edi@632 int v323; // edi@635 char *v324; // eax@635 Player *v325; // ecx@640 @@ -2748,18 +2748,18 @@ //stru6 *v336; // eax@658 //__int16 v337; // ST18_2@658 //stru6 *v338; // eax@658 - int v339; // ecx@659 - int v340; // ecx@660 - int v341; // eax@663 + //int v339; // ecx@659 + //int v340; // ecx@660 + //int v341; // eax@663 signed int v342; // edi@668 signed int v343; // edi@670 unsigned __int64 v344; // ST08_8@670 //__int16 v345; // ST1C_2@671 //__int16 v346; // ST18_2@671 //stru6 *v347; // eax@671 - int v348; // ecx@672 - int v349; // ecx@673 - int v350; // edi@676 + //int v348; // ecx@672 + //int v349; // ecx@673 + //int v350; // edi@676 Player *v351; // edi@680 //__int16 v352; // ST18_2@685 //stru6 *v353; // eax@685 @@ -2784,7 +2784,7 @@ int v372; // ecx@710 int v373; // eax@715 int v374; // eax@717 - Player *v375; // edi@717 + //Player *v375; // edi@717 int v376; // eax@717 Player *v377; // ecx@719 int v378; // ecx@721 @@ -2802,27 +2802,27 @@ //__int16 v390; // ST18_2@740 //stru6 *v391; // eax@740 int v392; // ecx@742 - int v393; // ecx@743 - int v394; // ecx@744 - int v395; // edi@747 + //int v393; // ecx@743 + //int v394; // ecx@744 + //int v395; // edi@747 int v396; // eax@752 int v397; // eax@757 int v398; // eax@757 int v399; // eax@757 - char *v400; // esi@757 + //char *v400; // esi@757 //Game *v401; // ecx@759 //__int16 v402; // ST1C_2@759 //__int16 v403; // ST18_2@759 //stru6 *v404; // eax@759 - int v405; // ecx@761 - int v406; // ecx@762 - int v407; // edi@765 + //int v405; // ecx@761 + //int v406; // ecx@762 + //int v407; // edi@765 //__int16 v408; // ST1C_2@769 //__int16 v409; // ST18_2@769 //stru6 *v410; // eax@769 - int v411; // ecx@772 - int v412; // ecx@773 - int v413; // edi@775 + //int v411; // ecx@772 + //int v412; // ecx@773 + //int v413; // edi@775 //__int16 v414; // ST1C_2@781 //__int16 v415; // ST18_2@781 //stru6 *v416; // eax@781 @@ -2851,18 +2851,18 @@ //stru6 *v439; // eax@843 int v440; // eax@843 int v441; // eax@847 - int v442; // ecx@850 - int v443; // ecx@851 - int v444; // eax@853 + //int v442; // ecx@850 + //int v443; // ecx@851 + //int v444; // eax@853 signed int v445; // edi@857 int v446; // ecx@862 LevelDecoration *v447; // edi@864 __int16 v448; // ax@864 char *v449; // esi@870 int v450; // eax@870 - int v451; // ecx@875 - int v452; // ecx@876 - int v453; // edi@878 + //int v451; // ecx@875 + //int v452; // ecx@876 + //int v453; // edi@878 //__int16 v454; // ST1C_2@884 //__int16 v455; // ST18_2@884 //stru6 *v456; // eax@884 @@ -2873,16 +2873,16 @@ Actor *v461; // eax@897 unsigned __int16 v462; // cx@897 signed int v463; // edx@897 - int v464; // ecx@905 - int v465; // ecx@906 - int v466; // edi@909 + //int v464; // ecx@905 + //int v465; // ecx@906 + //int v466; // edi@909 //__int16 v467; // ST1C_2@913 //__int16 v468; // ST18_2@913 //stru6 *v469; // eax@913 int v470; // edi@913 int v471; // eax@917 int v472; // eax@917 - char *v473; // esi@918 + //char *v473; // esi@918 //__int16 v474; // ST18_2@920 //stru6 *v475; // eax@920 //__int16 v476; // ST18_2@920 @@ -2924,14 +2924,14 @@ //int v512; // eax@946 SpellBuff *v513; // edi@946 int v514; // ecx@950 - int v515; // ecx@951 + //int v515; // ecx@951 int v516; // eax@953 //int v517; // eax@956 Actor *v518; // edx@957 __int16 v519; // cx@958 - int v520; // ecx@968 - int v521; // ecx@969 - int v522; // eax@971 + //int v520; // ecx@968 + //int v521; // ecx@969 + //int v522; // eax@971 //__int16 v523; // ST18_2@975 //stru6 *v524; // eax@975 //__int16 v525; // ST18_2@975 @@ -2957,11 +2957,11 @@ //__int16 v545; // ST18_2@991 //stru6 *v546; // eax@991 //__int16 v547; // ST18_2@991 - stru6 *v548; // eax@991 + //stru6 *v548; // eax@991 double v549; // st7@991 unsigned __int16 v550; // di@991 int v551; // ecx@993 - int v552; // ecx@994 + //int v552; // ecx@994 Player *v553; // edi@1001 //__int16 v554; // ST18_2@1002 //stru6 *v555; // eax@1002 @@ -3003,7 +3003,7 @@ char v591; // al@1048 int v592; // esi@1052 int v593; // ecx@1057 - int v594; // ecx@1058 + //int v594; // ecx@1058 //int v595; // eax@1064 int v596; // esi@1066 unsigned int v597; // edi@1067 @@ -3087,7 +3087,7 @@ const char *v675; // [sp+4h] [bp-E80h]@800 int v676; // [sp+4h] [bp-E80h]@807 int v677; // [sp+4h] [bp-E80h]@861 - int v678; // [sp+4h] [bp-E80h]@997 + //int v678; // [sp+4h] [bp-E80h]@997 int v679; // [sp+14h] [bp-E70h]@515 AIDirection a3; // [sp+C94h] [bp-1F0h]@21 int v681[4]; // [sp+CB0h] [bp-1D4h]@1137 @@ -3162,8 +3162,6 @@ LODWORD(v733) = 0; v723 = 0; v727 = 0.0; - //n = 0; - //while ( 1 ) for(n = 0; n < 10; ++n) { pCastSpell = &this[n]; @@ -3219,7 +3217,7 @@ if (pCastSpell->forced_spell_skill_level) { v11 = pCastSpell->forced_spell_skill_level; - v723 = v11 & 0x3F; + v723 = v11 & 0x3F; // 6 bytes v2 = v723; } else @@ -3253,21 +3251,7 @@ v11 = pPlayer->pActiveSkills[LODWORD(v725)]; } - if ( HIBYTE(v11) & 1 ) - { - v731 = 4; - } - else - { - if ( (v11 & 0x80u) == 0 ) - { - v731 = ((v11 & 0x40) != 0) + 1; - } - else - { - v731 = 3; - } - } + v731 = SkillToMastery(v11); if (pCastSpell->forced_spell_skill_level) uRequiredMana = 0; @@ -3317,17 +3301,17 @@ assert(false && "Unknown spell effect #101 (prolly flaming bow arrow"); case SPELL_BOW_ARROW: { - v17 = pPlayer; + //v17 = pPlayer; _this = (ItemGen *)1; if ( (signed int)SkillToMastery(pPlayer->pActiveSkills[PLAYER_SKILL_BOW]) >= 3 ) _this = (ItemGen *)2; - sRecoveryTime = v17->GetAttackRecoveryTime(true); + sRecoveryTime = pPlayer->GetAttackRecoveryTime(true); pSpellSprite.stru_24.Reset(); pSpellSprite.spell_level = v2; pSpellSprite.spell_id = pCastSpell->spellnum; pSpellSprite.spell_skill = v731; pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - if ( v17->WearsItem(510, 2) ) + if ( pPlayer->WearsItem(510, 2) ) pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(0xBD6u); pSpellSprite.vPosition.x = pParty->vPosition.x; pSpellSprite.vPosition.y = pParty->vPosition.y; @@ -3655,7 +3639,24 @@ pSpellSprite.vPosition.y = pParty->vPosition.y; v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 2; v660 = pParty->vPosition.y; - goto LABEL_153; + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.vPosition.z = v51; + v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.uSectorID = v52; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + if ( pParty->bTurnBasedModeOn == 1 ) + LOBYTE(pSpellSprite.uAttributes) |= 4u; + v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; + if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) + ++pTurnEngine->field_1C; + LODWORD(v727) = 1; + break; } case SPELL_LIGHT_SUNRAY: { @@ -3678,7 +3679,23 @@ v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v660 = pParty->vPosition.y; - goto LABEL_153; + pSpellSprite.uAttributes = 0; + pSpellSprite.vPosition.x = pParty->vPosition.x; + pSpellSprite.vPosition.z = v51; + v52 = pIndoor->GetSector(pParty->vPosition.x, v660, v671); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.uSectorID = v52; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + if ( pParty->bTurnBasedModeOn == 1 ) + LOBYTE(pSpellSprite.uAttributes) |= 4u; + v659 = pObjectList->pObjects[(signed __int16)pSpellSprite.uObjectDescID].uSpeed; + if ( pSpellSprite.Create(v715.uYawAngle, v715.uPitchAngle, v659, pCastSpell->uPlayerID + 1) != -1 && pParty->bTurnBasedModeOn == 1 ) + ++pTurnEngine->field_1C; + LODWORD(v727) = 1; } break; } @@ -3701,32 +3718,33 @@ v672 = 0; *(short *)(v55 + 150) = 0; v661 = (Actor *)v55; - goto LABEL_165; + pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); + LODWORD(v727) = 1; + break; } case SPELL_EARTH_SLOW: { if ( v731 == 2 ) { v57 = 300 * v2; - } - else - { - if ( v731 == 3 ) - { + amount = 2; + } + else if ( v731 == 3 ) + { amount = 4; v57 = 300 * v2; - goto LABEL_174; - } - if ( v731 == 4 ) - { + } + else if ( v731 == 4 ) + { v57 = 300 * v2; amount = 8; - goto LABEL_174; - } + } + else + { v57 = 180 * v2; - } - amount = 2; - LABEL_174: + amount = 2; + } +// LABEL_174: LODWORD(v733) = v57; if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; @@ -3749,7 +3767,9 @@ *((char *)&pActors[0].uAttributes + v59 + 2) |= 8u; v672 = 0; v661 = (Actor *)LODWORD(v718); - goto LABEL_165; + pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); + LODWORD(v727) = 1; + break; } case SPELL_MIND_CHARM: { @@ -3783,7 +3803,29 @@ pSpellSprite.spell_skill = v731; v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); v61 = PID_ID(a2); - goto LABEL_1086; + v600 = pActors[v61].vPosition.y; + v601 = pActors[v61].vPosition.x; + pSpellSprite.uObjectDescID = v60; + pSpellSprite.vPosition.x = v601; + v602 = pActors[v61].uActorHeight; + v603 = pActors[v61].vPosition.z; + pSpellSprite.vPosition.y = v600; + v676 = v603 + v602; + v665 = v600; + pSpellSprite.vPosition.z = v603 + v602; + v657 = v601; + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + LOBYTE(pSpellSprite.uAttributes) |= 0x80u; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); + LODWORD(v727) = 1; + break; } case SPELL_DARK_SHRINKING_RAY: { @@ -3840,7 +3882,7 @@ if ( !v65 ) { amount = 12; - LABEL_195: +// LABEL_195: LODWORD(v733) = 3600 * v2; } else if ( v65 == 1 ) @@ -3850,7 +3892,7 @@ } } } - LABEL_196: +// LABEL_196: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; v730c = &pParty->pPlayers[pCastSpell->uPlayerID_2].pInventoryItems[a2]; @@ -3925,36 +3967,12 @@ case SPELL_MIND_PROTECTION_FROM_MIND: case SPELL_BODY_PROTECTION_FROM_BODY: { - v76 = v731 - 1; LODWORD(v733) = 3600 * v2; - if ( v76 ) - { - v77 = v76 - 1; - if ( v77 ) - { - v78 = v77 - 1; - if ( v78 ) - { - if ( v78 != 1 ) - goto LABEL_232; - v79 = 4 * v2; - } - else - { - v79 = 3 * v2; - } - } - else - { - v79 = 2 * v2; - } - amount = v79; - } - else - { - amount = v2; - } -LABEL_232: + if ( v731 > 0 && v731 <= 4) + { + amount = v731 * v2; + } +//LABEL_232: //v80 = v3->spellnum; switch (pCastSpell->spellnum) { @@ -3993,73 +4011,56 @@ } case SPELL_FIRE_HASTE: { - if ( v731 <= 0 ) - goto LABEL_254; - if ( v731 <= 2 ) - { - v91 = 60 * (v2 + 60); - } - else - { - if ( v731 == 3 ) - { - v91 = 180 * (v2 + 20); - } - else - { - if ( v731 != 4 ) - goto LABEL_254; - v91 = 240 * (v2 + 15); - } - } - LODWORD(v733) = v91; - LABEL_254: + if ( v731 == 1 || v731 == 2 ) + { + LODWORD(v733) = 60 * (v2 + 60); + } + else if ( v731 == 3 ) + { + LODWORD(v733) = 180 * (v2 + 20); + } + else if ( v731 == 4 ) + { + LODWORD(v733) = 240 * (v2 + 15); + } if ( pPlayer->CanCastSpell(uRequiredMana) ) { v92 = pParty->pPlayers;//[0].pConditions[1]; LODWORD(v727) = 1; do { - if ( v92->pConditions ) - LODWORD(v727) = 0; - ++v92; + if ( v92->pConditions ) + LODWORD(v727) = 0; + ++v92; } while ( v92 <= &pParty->pPlayers[3] ); if (LODWORD(v727)) { - pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); - - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); + pParty->pPartyBuffs[PARTY_BUFF_HASTE].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, 0, 0, 0); + + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 0); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 1); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 2); + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, 3); } } break; } case SPELL_SPIRIT_BLESS: { - v101 = v731 - 1; - if ( v101 && (v102 = v101 - 1) != 0 ) - { - v103 = v102 - 1; - if ( v103 ) - { - if ( v103 != 1 ) - goto LABEL_269; - v104 = 3600 * (v2 + 1); - } - else - { - v104 = 900 * (v2 + 4); - } - } - else - { - v104 = 300 * (v2 + 12); - } - LODWORD(v733) = v104; - LABEL_269: + if ( v731 == 1 || v731 == 2 ) + { + LODWORD(v733) = 300 * (v2 + 12); + } + else if ( v731 == 3 ) + { + LODWORD(v733) = 900 * (v2 + 4); + } + else if ( v731 == 4 ) + { + LODWORD(v733) = 3600 * (v2 + 1); + } +// LABEL_269: amount = v2 + 5; if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; @@ -4170,28 +4171,21 @@ case SPELL_AIR_SHIELD: case SPELL_EARTH_STONESKIN: case SPELL_SPIRIT_HEROISM: - { - v123 = v731 - 1; - if ( v123 && (v124 = v123 - 1) != 0 ) - { - v125 = v124 - 1; - if ( v125 ) - { - if ( v125 != 1 ) - goto LABEL_296; - v126 = 3600 * (v2 + 1); - } - else - { - v126 = 900 * (v2 + 4); - } - } - else - { - v126 = 300 * (v2 + 12); - } - LODWORD(v733) = v126; - LABEL_296: + { + if( v731 == 1 || v731 == 2 ) + { + LODWORD(v733) = 300 * (v2 + 12); + } + else if ( v731 == 3 ) + { + LODWORD(v733) = 900 * (v2 + 4); + } + else if ( v731 == 4 ) + { + LODWORD(v733) = 3600 * (v2 + 1); + } + +// LABEL_296: v127 = pCastSpell->spellnum; if ( v127 == 17 ) { @@ -4227,12 +4221,10 @@ } case SPELL_FIRE_IMMOLATION: { - v138 = v731 - 2; - if ( v138 && (v139 = v138 - 1) != 0 && v139 == 1 ) - v140 = 600 * v2; + if ( v731 == 4 && v139 == 1 ) + LODWORD(v733) = 600 * v2; else - v140 = 60 * v2; - LODWORD(v733) = v140; + LODWORD(v733) = 60 * v2; if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; @@ -4301,16 +4293,18 @@ *(float *)&v721 = v159; a2 = rand() % 1000; *((float *)&v733 + 1) = (double)(rand() % 1000) + *(float *)&y - *(float *)&v732; - v725 = v159 * v159; + //v725 = v159 * v159; *(float *)&_this = v158 * v158; - if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) + //if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v725) <= 1.0 ) + if ( sqrt(*((float *)&v733 + 1) * *((float *)&v733 + 1) + *(float *)&_this + v159 * v159) <= 1.0 ) { LODWORD(v687) = 0; HIDWORD(v687) = 0; } else { - x = (signed __int64)sqrt(*(float *)&_this + v725); + //x = (signed __int64)sqrt(*(float *)&_this + v725); + x = (signed __int64)sqrt(*(float *)&_this + v159 * v159); v687 = __PAIR__( stru_5C6E00->Atan2(x, (signed __int64)*((float *)&v733 + 1)), stru_5C6E00->Atan2((signed __int64)v718, (signed __int64)*(float *)&v721)); @@ -4416,24 +4410,19 @@ } case SPELL_AIR_FEATHER_FALL: { - v170 = v731 - 1; - if ( !v170 ) - { - v173 = 300 * v2; - goto LABEL_353; - } - v171 = v170 - 1; - if ( !v171 ) - { - v173 = 600 * v2; - goto LABEL_353; - } - v172 = v171 - 1; - if ( !v172 || v172 == 1 ) - { - v173 = 3600 * v2; - LABEL_353: - LODWORD(v733) = v173; + if ( v731 == 1 ) + { + LODWORD(v733) = 300 * v2; + } + else if ( v731 == 2 ) + { + LODWORD(v733) = 600 * v2; + } + else if ( v731 == 3 || v731 == 4 ) + { + LODWORD(v733) = 3600 * v2; + //LABEL_353: + //LODWORD(v733) = v173; } if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; @@ -4541,39 +4530,32 @@ case SPELL_AIR_INVISIBILITY: { v192 = v731 - 1; - if ( !v192 ) + if ( v731 == 1 ) { amount = v2; - //goto LABEL_391; - v195 = 600 * v2; - goto LABEL_392; - } - v193 = v192 - 1; - if ( !v193 ) + LODWORD(v733) = 600 * v2; + } + else if ( v731 == 2 ) { v196 = 2 * v2; - //LABEL_389: amount = v196; - //LABEL_391: - v195 = 600 * v2; - goto LABEL_392; - } - v194 = v193 - 1; - if ( !v194 ) + LODWORD(v733) = 600 * v2; + } + else if ( v731 == 3 ) { v196 = 3 * v2; //goto LABEL_389; amount = v196; - v195 = 600 * v2; - goto LABEL_392; - } - if ( v194 != 1 ) - goto LABEL_393; + LODWORD(v733) = 600 * v2; + } + else if ( v731 == 4 ) + { amount = 4 * v2; v195 = 3600 * v2; - LABEL_392: +// LABEL_392: LODWORD(v733) = v195; - LABEL_393: + } +// LABEL_393: if (pParty->uFlags & (PARTY_FLAGS_1_ALERT_RED | PARTY_FLAGS_1_ALERT_YELLOW)) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[638], 2); // There are hostile creatures nearby! @@ -4719,31 +4701,16 @@ } case SPELL_WATER_AWAKEN: - { - v219 = v731 - 2; - if ( v219 ) - { - v220 = v219 - 1; - if ( v220 ) - { - if ( v220 == 1 ) - { - amount = 0; - goto LABEL_433; - } - v221 = 180 * v2; - } - else - { - v221 = 86400 * v2; - } - } - else - { - v221 = 3600 * v2; - } - amount = v221; - LABEL_433: + { + if ( v731 == 1 ) + amount = 180 * v2; + else if ( v731 == 2) + amount = 3600 * v2; + else if ( v731 == 3 ) + amount = 86400 * v2; + else if ( v731 == 4 ) + amount = 0; +// LABEL_433: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; v222 = pParty->pPlayers; @@ -4779,27 +4746,15 @@ } } case SPELL_WATER_POISON_SPRAY: - { - v224 = v731 - 2; - if ( v224 ) - { - v225 = v224 - 1; - if ( v225 ) - { - if ( v225 == 1 ) - amount = 7; - else - amount = 1; - } - else - { + { + if ( v731 == 1 ) + amount = 1; + else if ( v731 == 2 ) + amount = 3; + else if ( v731 == 3 ) amount = 5; - } - } - else - { - amount = 3; - } + else if ( v731 == 4 ) + amount = 7; if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; HIDWORD(v733) = (signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360; @@ -4814,7 +4769,7 @@ v51 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v671 = pParty->vPosition.z + (signed int)pParty->uPartyHeight / 3; v660 = pParty->vPosition.y; - LABEL_153: +// LABEL_153: pSpellSprite.uAttributes = 0; pSpellSprite.vPosition.x = pParty->vPosition.x; pSpellSprite.vPosition.z = v51; @@ -4927,25 +4882,21 @@ { v241 = (double)v723 * 0.0099999998 + 0.5; } - else - { - if ( v731 == 3 ) - { + else if ( v731 == 3 ) + { v241 = (double)v723 * 0.0099999998 + 0.69999999; - } - else - { - if ( v731 != 4 ) - { - v241 = 0.0; - goto LABEL_484; - } + } + else if ( v731 == 4 ) + { v241 = (double)v723 * 0.0099999998 + 0.80000001; - } + } + else + { + v241 = 0.0; } if ( v241 > 1.0 ) v241 = 1.0; -LABEL_484: +//LABEL_484: v732 = (unsigned __int8)v240[25]; v242 = (signed __int64)((double)v732 * v241); v243 = y; @@ -5029,24 +4980,26 @@ v254 = rand(); v255 = 10;//pItemsTable->field_116D8[17]; v256 = 10;//pItemsTable->field_116D8[16]; -LABEL_611: +//LABEL_611: *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); -LABEL_612: +//LABEL_612: _this->uItemID |= 0x20u; _50C9A8_item_enchantment_timer = 256; LODWORD(v727) = 1; break; } - goto LABEL_616; } -LABEL_613: + else + { +//LABEL_613: v316 = _this->uItemID; if ( !(BYTE1(v316) & 2) ) { LOBYTE(v316) = v316 | 2; _this->uItemID = v316; } + } } } } @@ -5055,17 +5008,17 @@ } } } -LABEL_616: +//LABEL_616: if ( LODWORD(v727) == 0 ) { - v317 = pGlobalTXT_LocalizationStrings[428]; - if ( v730 == 0 ) - v317 = pGlobalTXT_LocalizationStrings[585]; - ShowStatusBarString(v317, 2u); - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; - pCastSpell->spellnum = 0; - v318->PlaySound(SPEECH_43, 0); + v317 = pGlobalTXT_LocalizationStrings[428]; + if ( v730 == 0 ) + v317 = pGlobalTXT_LocalizationStrings[585]; + ShowStatusBarString(v317, 2u); + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; + pCastSpell->spellnum = 0; + v318->PlaySound(SPEECH_43, 0); } break; } @@ -5073,87 +5026,125 @@ { if ( v731 == 3 ) { - v245 = (int)&v244[36 * a2 + 532]; - v269 = *(int *)v245; - if ( *(int *)v245 > 134 - || *(int *)(v245 + 12) != 0 - || *(int *)(v245 + 4) != 0 - || *(int *)(v245 + 8) != 0 - || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) ) - goto LABEL_616; - v270 = (char *)&pItemsTable->pItems[v269].pIconName; - LODWORD(v725) = (int)v270; - v271 = v270[28]; - if ( v271 && v271 != 1 && v271 != 2 ) - v272 = ((ItemGen *)v245)->GetValue() < 0x1C2; - else - v272 = ((ItemGen *)v245)->GetValue() < 0xFA; - if ( v272 ) - { - uRequiredMana = 1; - v730 = 0; - } - if ( rand() % 100 >= SHIDWORD(v733) ) - uRequiredMana = 1; - if (uRequiredMana) - goto LABEL_613; - v273 = v725; - v274 = *(char *)(LODWORD(v725) + 28); - if ( v274 == 0 | v274 == 1 | v274 == 2 | v274 == 3 | v274 == 4 | v274 == 5 | v274 == 6 | v274 == 7 | v274 == 8 | v274 == 9 | v274 == 10 | v274 == 11 ) - { - if ( rand() % 100 < 80 - && !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) + v245 = (int)&v244[36 * a2 + 532]; + v269 = *(int *)v245; + if ( *(int *)v245 > 134 + || *(int *)(v245 + 12) != 0 + || *(int *)(v245 + 4) != 0 + || *(int *)(v245 + 8) != 0 + || (_this = (ItemGen *)(v245 + 20), *(char *)(v245 + 20) & 2) ) { - v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; - *(int *)(v245 + 4) = 0; - for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; - ; - k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType - + 1] ) + if ( LODWORD(v727) == 0 ) + { + v317 = pGlobalTXT_LocalizationStrings[428]; + if ( v730 == 0 ) + v317 = pGlobalTXT_LocalizationStrings[585]; + ShowStatusBarString(v317, 2u); + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; + pCastSpell->spellnum = 0; + v318->PlaySound(SPEECH_43, 0); + } + break; + } + v270 = (char *)&pItemsTable->pItems[v269].pIconName; + LODWORD(v725) = (int)v270; + v271 = v270[28]; + if ( v271 && v271 != 1 && v271 != 2 ) + v272 = ((ItemGen *)v245)->GetValue() < 0x1C2; + else + v272 = ((ItemGen *)v245)->GetValue() < 0xFA; + if ( v272 ) { - ++*(int *)(v245 + 4); - if ( k >= v275 ) + uRequiredMana = 1; + v730 = 0; + } + if ( rand() % 100 >= SHIDWORD(v733) ) + uRequiredMana = 1; + if (uRequiredMana) + { + v316 = _this->uItemID; + if ( !(BYTE1(v316) & 2) ) + { + LOBYTE(v316) = v316 | 2; + _this->uItemID = v316; + } + if ( LODWORD(v727) == 0 ) + { + v317 = pGlobalTXT_LocalizationStrings[428]; + if ( v730 == 0 ) + v317 = pGlobalTXT_LocalizationStrings[585]; + ShowStatusBarString(v317, 2u); + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; + pCastSpell->spellnum = 0; + v318->PlaySound(SPEECH_43, 0); + } break; } - v254 = rand(); - v255 = 10;//pItemsTable->field_116D8[19]; - v256 = 10;//pItemsTable->field_116D8[18]; - goto LABEL_611; - } - v277 = pItemsTable->pSpecialEnchantments_count; - v278 = 0; - v725 = 0.0; - HIDWORD(v733) = 0; - if ( pItemsTable->pSpecialEnchantments_count > 0 ) + //v273 = v725; + v274 = *(char *)(LODWORD(v725) + 28); + if ( v274 == 0 | v274 == 1 | v274 == 2 | v274 == 3 | v274 == 4 | v274 == 5 | v274 == 6 | v274 == 7 | v274 == 8 | v274 == 9 | v274 == 10 | v274 == 11 ) { - v730 = (int)&v679; - do - { - v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); - if ( !v279 || v279 == 1 ) + if ( rand() % 100 < 80 + //&& !(*(char *)(LODWORD(v273) + 28) == 0 | *(char *)(LODWORD(v273) + 28) == 1 | *(char *)(LODWORD(v273) + 28) == 2) ) + && !(*(char *)(LODWORD(v725) + 28) == 0 | *(char *)(LODWORD(v725) + 28) == 1 | *(char *)(LODWORD(v725) + 28) == 2) ) { - v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType - + 4] - + v278 * 28); - LODWORD(v725) += v280; - if ( v280 ) - { - v281 = v730; - v730 += 4; - *(int *)v281 = HIDWORD(v733); - } + v275 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; + *(int *)(v245 + 4) = 0; + for ( k = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; + ; + k += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + + 1] ) + { + ++*(int *)(v245 + 4); + if ( k >= v275 ) + break; + } + v254 = rand(); + v255 = 10;//pItemsTable->field_116D8[19]; + v256 = 10;//pItemsTable->field_116D8[18]; + *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); + _this->uItemID |= 0x20u; + + _50C9A8_item_enchantment_timer = 256; + LODWORD(v727) = 1; + break; } - ++HIDWORD(v733); - ++v278; - } - while ( SHIDWORD(v733) < v277 ); - } - v282 = rand() % SLODWORD(v725); - v283 = v679; - *(int *)(v245 + 12) = v679; - v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; - v285 = v282 + 1; - if ( v284 < v285 ) + v277 = pItemsTable->pSpecialEnchantments_count; + v278 = 0; + v725 = 0.0; + HIDWORD(v733) = 0; + if ( pItemsTable->pSpecialEnchantments_count > 0 ) + { + v730 = (int)&v679; + do + { + v279 = LOBYTE(pItemsTable->pSpecialEnchantments[v278 + 1].pBonusStatement); + if ( !v279 || v279 == 1 ) + { + v280 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + + 4] + + v278 * 28); + LODWORD(v725) += v280; + if ( v280 ) + { + v281 = v730; + v730 += 4; + *(int *)v281 = HIDWORD(v733); + } + } + ++HIDWORD(v733); + ++v278; + } + while ( SHIDWORD(v733) < v277 ); + } + v282 = rand() % SLODWORD(v725); + v283 = v679; + *(int *)(v245 + 12) = v679; + v284 = pItemsTable->pSpecialEnchantments[v283].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; + v285 = v282 + 1; + if ( v284 < v285 ) { for ( l = &v679; ; l = (int *)v732 ) { @@ -5167,112 +5158,168 @@ break; } } - ++*(int *)(v245 + 12); - goto LABEL_612; - } + ++*(int *)(v245 + 12); + _this->uItemID |= 0x20u; + + _50C9A8_item_enchantment_timer = 256; + LODWORD(v727) = 1; + break; + } } else { - __debugbreak(); // v726 is most probably the caster, filled in case 54 - if ( v731 != 4 - || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) - || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 - || v726->pInventoryItems[a2].uEnchantmentType != 0 - || v726->pInventoryItems[a2]._bonus_strength != 0 - || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) - goto LABEL_616; - v247 = (char *)&pItemsTable->pItems[v246].pIconName; - LODWORD(v725) = (int)v247; - v248 = v247[28]; - if ( v248 && v248 != 1 && v248 != 2 ) - v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2; - else - v249 = v726->pInventoryItems[a2].GetValue() < 0xFA; - if ( v249 ) - { - uRequiredMana = 1; - v730 = 0; - } - if ( rand() % 100 >= SHIDWORD(v733) ) - uRequiredMana = 1; - if (uRequiredMana) - goto LABEL_613; - v250 = v725; - v251 = *(char *)(LODWORD(v725) + 28); - if ( v251 == 0 | v251 == 1 | v251 == 2 | v251 == 3 | v251 == 4 | v251 == 5 | v251 == 6 | v251 == 7 | v251 == 8 | v251 == 9 | v251 == 10 | v251 == 11 ) - { - if ( rand() % 100 < 80 - && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) + __debugbreak(); // v726 is most probably the caster, filled in case 54 + if ( v731 != 4 + || (v245 = (int)&v726->pInventoryItems[a2], v246 = *(int *)v245, *(int *)v245 > 134) + || v726->pInventoryItems[a2].uSpecEnchantmentType != 0 + || v726->pInventoryItems[a2].uEnchantmentType != 0 + || v726->pInventoryItems[a2]._bonus_strength != 0 + || (_this = (ItemGen *)((char *)&v726->pInventoryItems[a2] + 20), v726->pInventoryItems[a2].Broken()) ) { - v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; - *(int *)(v245 + 4) = 0; - for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; - ; - m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType - + 1] ) + if ( LODWORD(v727) == 0 ) + { + v317 = pGlobalTXT_LocalizationStrings[428]; + if ( v730 == 0 ) + v317 = pGlobalTXT_LocalizationStrings[585]; + ShowStatusBarString(v317, 2u); + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; + pCastSpell->spellnum = 0; + v318->PlaySound(SPEECH_43, 0); + } + break; + } + v247 = (char *)&pItemsTable->pItems[v246].pIconName; + LODWORD(v725) = (int)v247; + v248 = v247[28]; + if ( v248 && v248 != 1 && v248 != 2 ) + v249 = v726->pInventoryItems[a2].GetValue() < 0x1C2; + else + v249 = v726->pInventoryItems[a2].GetValue() < 0xFA; + if ( v249 ) { - ++*(int *)(v245 + 4); - if ( m >= v252 ) + uRequiredMana = 1; + v730 = 0; + } + if ( rand() % 100 >= SHIDWORD(v733) ) + uRequiredMana = 1; + if (uRequiredMana) + { + v316 = _this->uItemID; + if ( !(BYTE1(v316) & 2) ) + { + LOBYTE(v316) = v316 | 2; + _this->uItemID = v316; + } + if ( LODWORD(v727) == 0 ) + { + v317 = pGlobalTXT_LocalizationStrings[428]; + if ( v730 == 0 ) + v317 = pGlobalTXT_LocalizationStrings[585]; + ShowStatusBarString(v317, 2u); + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; + pCastSpell->spellnum = 0; + v318->PlaySound(SPEECH_43, 0); + } break; } - v254 = rand(); - v255 = 10;// pItemsTable->field_116D8[21]; - v256 = 10;//pItemsTable->field_116D8[20]; - goto LABEL_611; - } - v257 = pItemsTable->pSpecialEnchantments_count; - v258 = 0; - v725 = 0.0; - HIDWORD(v733) = 0; - if ( pItemsTable->pSpecialEnchantments_count > 0 ) + v250 = v725; + v251 = *(char *)(LODWORD(v725) + 28); + if ( v251 == 0 | v251 == 1 | v251 == 2 | v251 == 3 | v251 == 4 | v251 == 5 | v251 == 6 | v251 == 7 | v251 == 8 | v251 == 9 | v251 == 10 | v251 == 11 ) { - v730 = (int)&v679; - do - { - v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); - if ( !v259 || v259 == 1 ) + if ( rand() % 100 < 80 + && !(*(char *)(LODWORD(v250) + 28) == 0 | *(char *)(LODWORD(v250) + 28) == 1 | *(char *)(LODWORD(v250) + 28) == 2) ) + { + v252 = rand() % 10;//pItemsTable->field_116D8[pItemsTable->pItems[*(int *)v245].uEquipType]; + *(int *)(v245 + 4) = 0; + for ( m = pItemsTable->pEnchantments[0].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + 1]; + ; + m += pItemsTable->pEnchantments[*(int *)(v245 + 4)].to_item[pItemsTable->pItems[*(int *)v245].uEquipType + + 1] ) { - v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType - + 4] - + v258 * 28); - LODWORD(v725) += v260; - if ( v260 ) + ++*(int *)(v245 + 4); + if ( m >= v252 ) + break; + } + v254 = rand(); + v255 = 10;// pItemsTable->field_116D8[21]; + v256 = 10;//pItemsTable->field_116D8[20]; + *(int *)(v245 + 8) = v256 + v254 % (v255 - v256 + 1); + _this->uItemID |= 0x20u; + + _50C9A8_item_enchantment_timer = 256; + LODWORD(v727) = 1; + break; + } + v257 = pItemsTable->pSpecialEnchantments_count; + v258 = 0; + v725 = 0.0; + HIDWORD(v733) = 0; + if ( pItemsTable->pSpecialEnchantments_count > 0 ) { - v261 = v730; - v730 += 4; - *(int *)v261 = HIDWORD(v733); - } + v730 = (int)&v679; + do + { + v259 = LOBYTE(pItemsTable->pSpecialEnchantments[v258 + 1].pBonusStatement); + if ( !v259 || v259 == 1 ) + { + v260 = *(&pItemsTable->pSpecialEnchantments[0].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + + 4] + + v258 * 28); + LODWORD(v725) += v260; + if ( v260 ) + { + v261 = v730; + v730 += 4; + *(int *)v261 = HIDWORD(v733); + } + } + ++HIDWORD(v733); + ++v258; + } + while ( SHIDWORD(v733) < v257 ); } - ++HIDWORD(v733); - ++v258; - } - while ( SHIDWORD(v733) < v257 ); - } - v262 = rand() % SLODWORD(v725); - v263 = v679; - *(int *)(v245 + 12) = v679; - v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; - v265 = v262 + 1; - if ( v264 < v265 ) - { - for ( ii = &v679; ; ii = (int *)v732 ) - { - v267 = (int)(ii + 1); - v732 = v267; - v268 = *(int *)v267; - *(int *)(v245 + 12) = v268; - v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType - + 4]; - if ( v264 >= v265 ) + v262 = rand() % SLODWORD(v725); + v263 = v679; + *(int *)(v245 + 12) = v679; + v264 = pItemsTable->pSpecialEnchantments[v263].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + 4]; + v265 = v262 + 1; + if ( v264 < v265 ) + { + for ( ii = &v679; ; ii = (int *)v732 ) + { + v267 = (int)(ii + 1); + v732 = v267; + v268 = *(int *)v267; + *(int *)(v245 + 12) = v268; + v264 += pItemsTable->pSpecialEnchantments[v268].to_item_apply[pItemsTable->pItems[*(int *)v245].uEquipType + + 4]; + if ( v264 >= v265 ) + break; + } + } + ++*(int *)(v245 + 12); + _this->uItemID |= 0x20u; + + _50C9A8_item_enchantment_timer = 256; + LODWORD(v727) = 1; break; } - } - ++*(int *)(v245 + 12); - goto LABEL_612; - } } //v1 = 0; - goto LABEL_616; + if ( LODWORD(v727) == 0 ) + { + v317 = pGlobalTXT_LocalizationStrings[428]; + if ( v730 == 0 ) + v317 = pGlobalTXT_LocalizationStrings[585]; + ShowStatusBarString(v317, 2u); + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; + pCastSpell->spellnum = 0; + v318->PlaySound(SPEECH_43, 0); + } + break; } v289 = (ItemGen *)&v244[36 * a2 + 532]; _this = v289; @@ -5286,7 +5333,20 @@ || v291 == 1 || v291 == 2 || _this->Broken()) - goto LABEL_616; + { + if ( LODWORD(v727) == 0 ) + { + v317 = pGlobalTXT_LocalizationStrings[428]; + if ( v730 == 0 ) + v317 = pGlobalTXT_LocalizationStrings[585]; + ShowStatusBarString(v317, 2u); + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + v318 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; + pCastSpell->spellnum = 0; + v318->PlaySound(SPEECH_43, 0); + } + break; + } if ( _this->GetValue() < 0x1C2 ) uRequiredMana = 1; if ( rand() % 100 >= SHIDWORD(v733) ) @@ -5434,23 +5494,12 @@ } case SPELL_EARTH_STONE_TO_FLESH: { - v320 = v731 - 2; - if ( !v320 ) - goto LABEL_632; - v321 = v320 - 1; - if ( v321 ) - { - if ( v321 == 1 ) - goto LABEL_634; -LABEL_632: - v322 = 3600 * v2; - } - else - { - v322 = 86400 * v2; - } - amount = v322; -LABEL_634: + __debugbreak(); // missing GM ? + if ( v731 == 1 || v731 == 2) + amount = 3600 * v2; + if ( v731 == 3 ) + amount = 86400 * v2; +//LABEL_634: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; v323 = pCastSpell->uPlayerID_2; @@ -5471,7 +5520,9 @@ v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); v656 = 15; v325 = &pParty->pPlayers[v323]; - goto LABEL_641; + v325->DiscardConditionIfLastsLongerThan(v656, v663); + LODWORD(v727) = 1; + break; } case SPELL_EARTH_ROCK_BLAST: { @@ -5572,30 +5623,15 @@ case SPELL_SPIRIT_FATE: { LODWORD(v733) = 300; - v339 = v731 - 2; - if ( v339 ) - { - v340 = v339 - 1; - if ( v340 ) - { - if ( v340 != 1 ) - { - amount = v2; - goto LABEL_667; - } - v341 = 6 * v2; - } - else - { - v341 = 4 * v2; - } - } - else - { - v341 = 2 * v2; - } - amount = v341; -LABEL_667: + if ( v731 == 1 ) + amount = v2; + else if( v731 == 2 ) + amount = 2 * v2; + else if( v731 == 3 ) + amount = 4 * v2; + else if( v731 == 4) + amount = 6 * v2; +//LABEL_667: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; v342 = pCastSpell->spell_target_pid; @@ -5616,7 +5652,7 @@ BYTE2(pActors[v343].uAttributes) |= 8u; v672 = 0; v661 = &pActors[v343]; -LABEL_165: +//LABEL_165: pGame->GetStru6()->_4A7E89_sparkles_on_actor_after_it_casts_buff(v661, v672); } LODWORD(v727) = 1; @@ -5624,26 +5660,13 @@ } case SPELL_SPIRIT_REMOVE_CURSE: { - v348 = v731 - 2; - if ( !v348 ) - goto LABEL_677; - v349 = v348 - 1; - if ( v349 ) - { - if ( v349 == 1 ) - { + if ( v731 == 1 || v731 == 2 ) + amount = 3600 * v2; + else if( v731 == 3) + amount = 86400 * v2; + else if ( v731 == 4 ) amount = 0; - goto LABEL_679; - } -LABEL_677: - v350 = 3600 * v2; - } - else - { - v350 = 86400 * v2; - } - amount = v350; -LABEL_679: +//LABEL_679: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; v351 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; @@ -5786,7 +5809,9 @@ (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); } v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; - goto LABEL_720; + v377->SetCondition(1, 0); + LODWORD(v727) = 1; + break; } case SPELL_SPIRIT_SHARED_LIFE: { @@ -5847,29 +5872,15 @@ case SPELL_SPIRIT_RESSURECTION: { v392 = v731 - 1; - if ( !v392 ) - { - v395 = 180 * v2; - amount = v395; - goto LABEL_751; - } - v393 = v392 - 1; - if ( !v393 ) - { - v395 = 10800 * v2; - amount = v395; - goto LABEL_751; - } - v394 = v393 - 1; - if ( !v394 ) - { - v395 = 259200 * v2; - amount = v395; - goto LABEL_751; - } - if ( v394 == 1 ) + if ( v731 == 1 ) + amount = 180 * v2; + else if ( v731 == 2 ) + amount = 10800 * v2; + else if ( v731 == 3 ) + amount = 259200 * v2; + else if ( v731 == 4 ) amount = 0; -LABEL_751: +//LABEL_751: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; v396 = pCastSpell->uPlayerID_2; @@ -5911,26 +5922,13 @@ } case SPELL_MIND_CURE_PARALYSIS: { - v405 = v731 - 2; - if ( !v405 ) - goto LABEL_766; - v406 = v405 - 1; - if ( v406 ) - { - if ( v406 == 1 ) - { + if ( v731 == 1 || v731 == 2 ) + amount = 3600 * v2; + else if ( v731 == 4 ) amount = 0; - goto LABEL_768; - } -LABEL_766: - v407 = 3600 * v2; - } - else - { - v407 = 86400 * v2; - } - amount = v407; -LABEL_768: + else if( v731 == 3 ) + amount = 86400 * v2; +//LABEL_768: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; @@ -5952,35 +5950,21 @@ v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); v656 = 12; v325 = &pParty->pPlayers[v323]; - goto LABEL_641; - + v325->DiscardConditionIfLastsLongerThan(v656, v663); + LODWORD(v727) = 1; + break; } case SPELL_MIND_REMOVE_FEAR: - { - v411 = v731 - 2; - if ( v411 ) - { - v412 = v411 - 1; - if ( v412 ) - { - if ( v412 == 1 ) - { + { + if( v731 == 1) + amount = 180 * v2; + else if( v731 == 2 ) + amount = 3600 * v2; + else if( v731 == 3) + amount = 86400 * v2; + else if( v731 == 4 ) amount = 0; - goto LABEL_780; - } - v413 = 180 * v2; - } - else - { - v413 = 86400 * v2; - } - } - else - { - v413 = 3600 * v2; - } - amount = v413; -LABEL_780: +//LABEL_780: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; @@ -6002,196 +5986,267 @@ v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); v656 = 3; v325 = &pParty->pPlayers[v323]; - goto LABEL_641; - } + v325->DiscardConditionIfLastsLongerThan(v656, v663); + LODWORD(v727) = 1; + break; + } case SPELL_MIND_TELEPATHY: - { - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - if (PID_TYPE(a2) != OBJECT_Actor) - { + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + if (PID_TYPE(a2) != OBJECT_Actor) + { + LODWORD(v727) = 1; + break; + } + v417 = (int)&pActors[PID_ID(a2)]; + v730 = v417; + if ( !(*(char *)(v417 + 38) & 0x80) ) + { + ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); + v417 = v730; + } + v418 = *(int *)(v417 + 672); + HIDWORD(v733) = 0; + if ( pItemsTable->pItems[v418].uEquipType == 18 ) + HIDWORD(v733) = *(int *)(v417 + 684); + + //ItemGen::ItemGen(&v683); + v683.Reset(); + + v419 = *(short *)(v730 + 180); + if (v419) + { + v683.uItemID = v419; + //goto LABEL_799; + } + else + { + v420 = 0; + v421 = v730 + 564; + while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) + { + ++v420; + v421 += 36; + if ( v420 >= 4 ) + break; + } + if ( v420 < 4 ) + { + memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); + v2 = v723; + //v1 = 0; + } + } +// LABEL_799: + if ( HIDWORD(v733) != 0 ) + { + v675 = (const char *)HIDWORD(v733); + if (v683.uItemID) + { + v422 = v683.GetDisplayName(); + sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); + ShowStatusBarString(pTmpBuf2, 2u); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = *(short *)(v730 + 142); + pSpellSprite.vPosition.y = *(short *)(v730 + 144); + v676 = *(short *)(v730 + 138); + v665 = pSpellSprite.vPosition.y; + pSpellSprite.vPosition.z = *(short *)(v730 + 138); + v657 = pSpellSprite.vPosition.x; + } + else + { + v664 = "%d gold"; + sprintf(pTmpBuf2, v664, v675); + ShowStatusBarString(pTmpBuf2, 2u); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = *(short *)(v730 + 142); + pSpellSprite.vPosition.y = *(short *)(v730 + 144); + v676 = *(short *)(v730 + 138); + v665 = pSpellSprite.vPosition.y; + pSpellSprite.vPosition.z = *(short *)(v730 + 138); + v657 = pSpellSprite.vPosition.x; + } + } + else + { + if (v683.uItemID) + { + v675 = v683.GetDisplayName(); + v664 = "(%s)"; + sprintf(pTmpBuf2, v664, v675); + ShowStatusBarString(pTmpBuf2, 2u); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = *(short *)(v730 + 142); + pSpellSprite.vPosition.y = *(short *)(v730 + 144); + v676 = *(short *)(v730 + 138); + v665 = pSpellSprite.vPosition.y; + pSpellSprite.vPosition.z = *(short *)(v730 + 138); + v657 = pSpellSprite.vPosition.x; + } + else + { + strcpy(pTmpBuf2, "nothing"); + ShowStatusBarString(pTmpBuf2, 2u); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.vPosition.x = *(short *)(v730 + 142); + pSpellSprite.vPosition.y = *(short *)(v730 + 144); + v676 = *(short *)(v730 + 138); + v665 = pSpellSprite.vPosition.y; + pSpellSprite.vPosition.z = *(short *)(v730 + 138); + v657 = pSpellSprite.vPosition.x; + } + } + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + LOBYTE(pSpellSprite.uAttributes) |= 0x80u; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); LODWORD(v727) = 1; break; } - v417 = (int)&pActors[PID_ID(a2)]; - v730 = v417; - if ( !(*(char *)(v417 + 38) & 0x80) ) - { - ((Actor *)v417)->SetRandomGoldIfTheresNoItem(); - v417 = v730; - } - v418 = *(int *)(v417 + 672); - HIDWORD(v733) = 0; - if ( pItemsTable->pItems[v418].uEquipType == 18 ) - HIDWORD(v733) = *(int *)(v417 + 684); - - //ItemGen::ItemGen(&v683); - v683.Reset(); - - v419 = *(short *)(v730 + 180); - if (v419) - { - v683.uItemID = v419; - goto LABEL_799; - } - v420 = 0; - v421 = v730 + 564; - while ( !*(int *)v421 || pItemsTable->pItems[*(int *)v421].uEquipType == 18 ) - { - ++v420; - v421 += 36; - if ( v420 >= 4 ) - goto LABEL_799; - } - memcpy(&v683, (const void *)(v730 + 36 * v420 + 564), sizeof(v683)); - v2 = v723; - //v1 = 0; -LABEL_799: - if ( HIDWORD(v733) != 0 ) - { - v675 = (const char *)HIDWORD(v733); - if (v683.uItemID) - { - v422 = v683.GetDisplayName(); - sprintf(pTmpBuf2, "(%s), and %d gold", v422, v675); - ShowStatusBarString(pTmpBuf2, 2u); - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->spellnum; - pSpellSprite.spell_level = v2; - pSpellSprite.spell_skill = v731; - pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - pSpellSprite.vPosition.x = *(short *)(v730 + 142); - pSpellSprite.vPosition.y = *(short *)(v730 + 144); - v676 = *(short *)(v730 + 138); - v665 = pSpellSprite.vPosition.y; - pSpellSprite.vPosition.z = *(short *)(v730 + 138); - v657 = pSpellSprite.vPosition.x; - goto LABEL_1087; - } - v664 = "%d gold"; - sprintf(pTmpBuf2, v664, v675); - ShowStatusBarString(pTmpBuf2, 2u); - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->spellnum; - pSpellSprite.spell_level = v2; - pSpellSprite.spell_skill = v731; - pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - pSpellSprite.vPosition.x = *(short *)(v730 + 142); - pSpellSprite.vPosition.y = *(short *)(v730 + 144); - v676 = *(short *)(v730 + 138); - v665 = pSpellSprite.vPosition.y; - pSpellSprite.vPosition.z = *(short *)(v730 + 138); - v657 = pSpellSprite.vPosition.x; - goto LABEL_1087; - } - if (v683.uItemID) - { - v675 = v683.GetDisplayName(); - v664 = "(%s)"; - sprintf(pTmpBuf2, v664, v675); - ShowStatusBarString(pTmpBuf2, 2u); + case SPELL_MIND_BERSERK: + { + v423 = v731 - 2; + if ( !v423 ) + v425 = 300 * v2; + else + { + v424 = v423 - 1; + if ( v424 ) + { + if ( v424 == 1 ) + v425 = 3600 * v2; + else +//LABEL_813: + v425 = 300 * v2; + } + else + { + v425 = 600 * v2; + } + } + amount = v425; + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + v426 = PID_ID(a2); + if (PID_TYPE(a2) != OBJECT_Actor) + { + LODWORD(v727) = 1; + break; + } + v730 = 836 * v426; + if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) + { + pActors[v426].pActorBuffs[1].Reset(); + pActors[v426].pActorBuffs[12].Reset(); + pActors[v426].pActorBuffs[9].Apply( + pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), + v731, 0, 0, 0); + pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; + } pSpellSprite.stru_24.Reset(); pSpellSprite.spell_id = pCastSpell->spellnum; pSpellSprite.spell_level = v2; pSpellSprite.spell_skill = v731; - pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - pSpellSprite.vPosition.x = *(short *)(v730 + 142); - pSpellSprite.vPosition.y = *(short *)(v730 + 144); - v676 = *(short *)(v730 + 138); - v665 = pSpellSprite.vPosition.y; - pSpellSprite.vPosition.z = *(short *)(v730 + 138); - v657 = pSpellSprite.vPosition.x; - goto LABEL_1087; - } - strcpy(pTmpBuf2, "nothing"); - ShowStatusBarString(pTmpBuf2, 2u); - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->spellnum; - pSpellSprite.spell_level = v2; - pSpellSprite.spell_skill = v731; - pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - pSpellSprite.vPosition.x = *(short *)(v730 + 142); - pSpellSprite.vPosition.y = *(short *)(v730 + 144); - v676 = *(short *)(v730 + 138); - v665 = pSpellSprite.vPosition.y; - pSpellSprite.vPosition.z = *(short *)(v730 + 138); - v657 = pSpellSprite.vPosition.x; - goto LABEL_1087; - } - case SPELL_MIND_BERSERK: - { - v423 = v731 - 2; - if ( !v423 ) - goto LABEL_813; - v424 = v423 - 1; - if ( v424 ) - { - if ( v424 == 1 ) - v425 = 3600 * v2; - else -LABEL_813: - v425 = 300 * v2; - } - else - { - v425 = 600 * v2; - } - amount = v425; - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - v426 = PID_ID(a2); - if (PID_TYPE(a2) != OBJECT_Actor) - { + v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + v61 = v426; + v600 = pActors[v61].vPosition.y; + v601 = pActors[v61].vPosition.x; + pSpellSprite.uObjectDescID = v60; + pSpellSprite.vPosition.x = v601; + v602 = pActors[v61].uActorHeight; + v603 = pActors[v61].vPosition.z; + pSpellSprite.vPosition.y = v600; + v676 = v603 + v602; + v665 = v600; + pSpellSprite.vPosition.z = v603 + v602; + v657 = v601; + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + LOBYTE(pSpellSprite.uAttributes) |= 0x80u; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); LODWORD(v727) = 1; break; } - v730 = 836 * v426; - if ( stru_50C198.GetMagicalResistance(&pActors[v426], 7u) ) - { - pActors[v426].pActorBuffs[1].Reset(); - pActors[v426].pActorBuffs[12].Reset(); - pActors[v426].pActorBuffs[9].Apply( - pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), - v731, 0, 0, 0); - pActors[v426].pMonsterInfo.uHostilityType = MonsterInfo::Hostility_Long; - } - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->spellnum; - pSpellSprite.spell_level = v2; - pSpellSprite.spell_skill = v731; - v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - v61 = v426; - goto LABEL_1086; - - } case SPELL_MIND_ENSLAVE: - { - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - amount = 600 * v2; - if (PID_TYPE(a2) != OBJECT_Actor) - { + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + amount = 600 * v2; + if (PID_TYPE(a2) != OBJECT_Actor) + { + LODWORD(v727) = 1; + break; + } + v730 = 836 * PID_ID(a2); + if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) + break; + if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) + { + pActors[PID_ID(a2)].pActorBuffs[9].Reset(); + pActors[PID_ID(a2)].pActorBuffs[1].Reset(); + pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), + v731, 0, 0, 0); + } + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + v61 = PID_ID(a2); + v600 = pActors[v61].vPosition.y; + v601 = pActors[v61].vPosition.x; + pSpellSprite.uObjectDescID = v60; + pSpellSprite.vPosition.x = v601; + v602 = pActors[v61].uActorHeight; + v603 = pActors[v61].vPosition.z; + pSpellSprite.vPosition.y = v600; + v676 = v603 + v602; + v665 = v600; + pSpellSprite.vPosition.z = v603 + v602; + v657 = v601; + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + LOBYTE(pSpellSprite.uAttributes) |= 0x80u; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); LODWORD(v727) = 1; break; } - v730 = 836 * PID_ID(a2); - if ( MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) - break; - if ( stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 7u) ) - { - pActors[PID_ID(a2)].pActorBuffs[9].Reset(); - pActors[PID_ID(a2)].pActorBuffs[1].Reset(); - pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(amount << 7) * 0.033333335), - v731, 0, 0, 0); - } - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->spellnum; - pSpellSprite.spell_level = v2; - pSpellSprite.spell_skill = v731; - v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - v61 = PID_ID(a2); - goto LABEL_1086; - } case SPELL_MIND_MASS_FEAR: { v428 = v731 - 2; @@ -6266,7 +6321,7 @@ (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335)); } v377 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; -LABEL_720: +//LABEL_720: v377->SetCondition(1, 0); } LODWORD(v727) = 1; @@ -6274,23 +6329,12 @@ } case SPELL_EARTH_TELEKINESIS: { - v442 = v731 - 2; - if ( !v442 ) - goto LABEL_855; - v443 = v442 - 1; - if ( v443 ) - { - if ( v443 == 1 ) - v444 = 4 * v2; - else -LABEL_855: - v444 = 2 * v2; - } - else - { - v444 = 3 * v2; - } - amount = v444; + if ( v731 == 1 || v731 == 2 ) + amount = 2 * v2; + else if( v731 == 3 ) + amount = 3 * v2; + else if ( v731 == 4 ) + amount = 4 * v2; if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; v445 = PID_ID(a2); @@ -6362,30 +6406,15 @@ } case SPELL_BODY_CURE_WEAKNESS: { - v451 = v731 - 2; - if ( v451 ) - { - v452 = v451 - 1; - if ( v452 ) - { - if ( v452 == 1 ) - { - amount = 0; - goto LABEL_883; - } - v453 = 180 * v2; - } - else - { - v453 = 86400 * v2; - } - } - else - { - v453 = 3600 * v2; - } - amount = v453; -LABEL_883: + if ( v731 == 1 ) + amount = 180 * v2; + else if( v731 == 2 ) + amount = 3600 * v2; + else if( v731 == 3 ) + amount = 86400 * v2; + else if ( v731 == 4 ) + amount = 0; +//LABEL_883: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; @@ -6407,8 +6436,10 @@ v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - (double)(amount << 7) * 0.033333335); v656 = 1; v325 = &pParty->pPlayers[v323]; - goto LABEL_641; - } + v325->DiscardConditionIfLastsLongerThan(v656, v663); + LODWORD(v727) = 1; + break; + } case SPELL_BODY_FIRST_AID: { v457 = v731 - 2; @@ -6469,26 +6500,13 @@ } case SPELL_BODY_CURE_POISON: { - v464 = v731 - 2; - if ( !v464 ) - goto LABEL_910; - v465 = v464 - 1; - if ( v465 ) - { - if ( v465 == 1 ) - { + if ( v731 == 1 || v731 == 2 ) + amount = 3600 * v2; + else if( v731 == 3) + amount = 86400 * v2; + else if ( v731 == 4 ) amount = 0; - goto LABEL_912; - } -LABEL_910: - v466 = 3600 * v2; - } - else - { - v466 = 86400 * v2; - } - amount = v466; -LABEL_912: +//LABEL_912: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; @@ -6523,9 +6541,11 @@ (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); v656 = 10; - goto LABEL_937; - - } + v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; + v325->DiscardConditionIfLastsLongerThan(v656, v663); + LODWORD(v727) = 1; + break; + } case SPELL_BODY_PROTECTION_FROM_MAGIC: { amount = v2; @@ -6611,9 +6631,9 @@ (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2)); v663 = (signed __int64)((double)(signed __int64)pParty->uTimePlayed - *(float *)&a2); v656 = 11; -LABEL_937: +//LABEL_937: v325 = &pParty->pPlayers[pCastSpell->uPlayerID_2]; -LABEL_641: +//LABEL_641: v325->DiscardConditionIfLastsLongerThan(v656, v663); } LODWORD(v727) = 1; @@ -6700,28 +6720,21 @@ case SPELL_LIGHT_SUMMON_ELEMENTAL: { v514 = v731 - 2; - if ( !v514 ) - goto LABEL_955; - v515 = v514 - 1; - if ( v515 ) - { - if ( v515 == 1 ) + if ( v731 == 1 || v731 == 2 ) + { + v516 = 300 * v2; + amount = 1; + } + else if( v731 == 3 ) + { + v516 = 900 * v2; + amount = 3; + } + else if ( v731 == 4 ) { v516 = 900 * v2; amount = 5; } - else - { -LABEL_955: - v516 = 300 * v2; - amount = 1; - } - } - else - { - v516 = 900 * v2; - amount = 3; - } v733 = __PAIR__(0, v516); if ( (signed int)uNumActors > 0 ) @@ -6753,30 +6766,21 @@ } case SPELL_LIGHT_DAY_OF_THE_GODS: { - v520 = v731 - 2; - if ( !v520 ) - goto LABEL_973; - v521 = v520 - 1; - if ( v521 ) - { - if ( v521 == 1 ) - { - LODWORD(v733) = 18000 * v2; - v522 = 5 * v2 + 10; - } - else - { -LABEL_973: + if ( v731 == 1 || v731 == 2 ) + { LODWORD(v733) = 10800 * v2; - v522 = 3 * v2 + 10; - } - } - else + amount = 3 * v2 + 10; + } + else if( v731 == 3 ) { LODWORD(v733) = 14400 * v2; - v522 = 4 * v2 + 10; - } - amount = v522; + amount = 4 * v2 + 10; + } + else if ( v731 == 4 ) + { + LODWORD(v733) = 18000 * v2; + amount = 5 * v2 + 10; + } if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; @@ -6887,27 +6891,22 @@ case SPELL_LIGHT_HOUR_OF_POWER: { v551 = v731 - 2; - if ( !v551 ) - goto LABEL_998; - v552 = v551 - 1; - if ( v552 ) - { - if ( v552 == 1 ) - { + if ( v731 == 1 || v731 == 2 ) + { + HIDWORD(v733) = 4; + amount = 4; + } + else if( v731 == 3 ) + { + HIDWORD(v733) = 12; + amount = 12; + } + else if( v731 == 4 ) + { amount = 15; HIDWORD(v733) = 20; - goto LABEL_1000; - } -LABEL_998: - v678 = 4; - } - else - { - v678 = 12; - } - amount = v678; - HIDWORD(v733) = v678; -LABEL_1000: + } +//LABEL_1000: if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; y = (char *)(60 * (v2 * HIDWORD(v733) + 60)); @@ -7138,21 +7137,12 @@ case SPELL_DARK_SHARPMETAL: { v593 = v731 - 2; - if ( !v593 ) - goto LABEL_1062; - v594 = v593 - 1; - if ( v594 ) - { - if ( v594 == 1 ) + if( v731 == 1 || v731 == 2 ) + amount = 5; + else if( v731 == 3 ) + amount = 7; + else if( v731 == 4 ) amount = 9; - else -LABEL_1062: - amount = 5; - } - else - { - amount = 7; - } if ( !pPlayer->CanCastSpell(uRequiredMana) ) break; auto _v726 = ((signed int)(60 * stru_5C6E00->uIntegerDoublePi) / 360); @@ -7200,320 +7190,316 @@ } case SPELL_DARK_CONTROL_UNDEAD: - { - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - if ( v731 == 1 || v731 == 2 ) - { - v598 = 180 * v2; - LODWORD(v733) = v598; - goto LABEL_1082; - } - if ( v731 == 3 ) - { - v598 = 300 * v2; - LODWORD(v733) = v598; - goto LABEL_1082; - } - if ( v731 == 4 ) - LODWORD(v733) = 29030400; -LABEL_1082: - if (PID_TYPE(a2) != OBJECT_Actor) - { + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + if ( v731 == 1 || v731 == 2 ) + { + v598 = 180 * v2; + LODWORD(v733) = v598; + } + else if ( v731 == 3 ) + { + v598 = 300 * v2; + LODWORD(v733) = v598; + } + else if ( v731 == 4 ) + LODWORD(v733) = 29030400; +// LABEL_1082: + if (PID_TYPE(a2) != OBJECT_Actor) + { + LODWORD(v727) = 1; + break; + } + v730 = 836 * PID_ID(a2); + if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) + break; + if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->spellnum = 0; + continue; + } + pActors[PID_ID(a2)].pActorBuffs[9].Reset(); + pActors[PID_ID(a2)].pActorBuffs[1].Reset(); + pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), + v731, 0, 0, 0); + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + v61 = PID_ID(a2); +// LABEL_1086: + v600 = pActors[v61].vPosition.y; + v601 = pActors[v61].vPosition.x; + pSpellSprite.uObjectDescID = v60; + pSpellSprite.vPosition.x = v601; + v602 = pActors[v61].uActorHeight; + v603 = pActors[v61].vPosition.z; + pSpellSprite.vPosition.y = v600; + v676 = v603 + v602; + v665 = v600; + pSpellSprite.vPosition.z = v603 + v602; + v657 = v601; +// LABEL_1087: + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.spell_target_pid = a2; + pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); + pSpellSprite.uFacing = LOWORD(v715.uYawAngle); + LOBYTE(pSpellSprite.uAttributes) |= 0x80u; + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); LODWORD(v727) = 1; break; } - v730 = 836 * PID_ID(a2); - if ( !MonsterStats::BelongsToSupertype(pActors[PID_ID(a2)].pMonsterInfo.uID, MONSTER_SUPERTYPE_UNDEAD) ) - break; - if ( !stru_50C198.GetMagicalResistance(&pActors[PID_ID(a2)], 0xAu) ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->spellnum = 0; - continue; - } - pActors[PID_ID(a2)].pActorBuffs[9].Reset(); - pActors[PID_ID(a2)].pActorBuffs[1].Reset(); - pActors[PID_ID(a2)].pActorBuffs[12].Apply(pParty->uTimePlayed + (signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), - v731, 0, 0, 0); - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->spellnum; - pSpellSprite.spell_level = v2; - pSpellSprite.spell_skill = v731; - v60 = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - v61 = PID_ID(a2); -LABEL_1086: - v600 = pActors[v61].vPosition.y; - v601 = pActors[v61].vPosition.x; - pSpellSprite.uObjectDescID = v60; - pSpellSprite.vPosition.x = v601; - v602 = pActors[v61].uActorHeight; - v603 = pActors[v61].vPosition.z; - pSpellSprite.vPosition.y = v600; - v676 = v603 + v602; - v665 = v600; - pSpellSprite.vPosition.z = v603 + v602; - v657 = v601; -LABEL_1087: - pSpellSprite.uAttributes = 0; - pSpellSprite.uSectorID = pIndoor->GetSector(v657, v665, v676); - pSpellSprite.uSpriteFrameID = 0; - pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); - pSpellSprite.spell_target_pid = a2; - pSpellSprite.field_60_distance_related_prolly_lod = LOBYTE(v715.uDistance); - pSpellSprite.uFacing = LOWORD(v715.uYawAngle); - LOBYTE(pSpellSprite.uAttributes) |= 0x80u; - pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); - pSpellSprite.Create(0, 0, 0, pCastSpell->uPlayerID + 1); - LODWORD(v727) = 1; - break; - } case SPELL_DARK_SACRIFICE: - { - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - HIDWORD(v733) = 0; - memset(&achieved_awards, 0, 4000); - _this = 0; - v605 = (char *)pParty->pHirelings; - do - { - if ( *(int *)v605) - { - v606 = HIDWORD(v733)++; - achieved_awards[v606] = (AwardType)(int)((char *)&_this->uItemID + 1); - } - _this = (ItemGen *)((char *)_this + 1); - v605 += 76; - } - while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); - _this = 0; - if ( (signed int)pNPCStats->uNumNewNPCs > 0) - { - v730 = (int)pNPCStats->pNewNPCData; - __debugbreak(); // data offset - HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + HIDWORD(v733) = 0; + memset(&achieved_awards, 0, 4000); + _this = 0; + v605 = (char *)pParty->pHirelings; do { - if ( *(char *)(v730 + 8) & 0x80 - && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) - && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) - { - v607 = HIDWORD(v733); - HIDWORD(v733) += 4; - *(int *)v607 = (int)_this + 3; - } - _this = (ItemGen *)((char *)_this + 1); - v730 += 76; - } - while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); - } - v608 = pCastSpell->uPlayerID_2; - if ( v608 != 4 && v608 != 5 - || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) - || v609 >= 3 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->spellnum = 0; - continue; - } - v610 = 76 * v609; - *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; - v611 = pIconsFrameTable->FindIcon("spell96"); - *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); - *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; - v612 = pParty->pPlayers; - do - { - v612->sHealth = v612->GetMaxHealth(); - v612->sMana = v612->GetMaxMana(); - ++v612; - } - while ( v612 <= &pParty->pPlayers[3] ); - v613 = &pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) - v613 = &pIndoor->dlv; - v613->uReputation += 15; - if ( v613->uReputation > 10000 ) - v613->uReputation = 10000; - LODWORD(v727) = 1; - break; - } - case SPELL_DARK_PAIN_REFLECTION: - { - if ( v731 <= 0 ) - goto LABEL_1119; - if ( v731 <= 3 ) - { - v614 = 300 * (v2 + 12); - } - else - { - if ( v731 != 4 ) - goto LABEL_1119; - v614 = 900 * (v2 + 4); - } - LODWORD(v733) = v614; -LABEL_1119: - v615 = v2 + 5; - amount = v615; - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - if ( v731 != 3 && v731 != 4 ) - { - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); - - pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v615, v716, 0); + if ( *(int *)v605) + { + v606 = HIDWORD(v733)++; + achieved_awards[v606] = (AwardType)(int)((char *)&_this->uItemID + 1); + } + _this = (ItemGen *)((char *)_this + 1); + v605 += 76; + } + while ( (signed int)v605 < (signed int)&pParty->pPickedItem ); + _this = 0; + if ( (signed int)pNPCStats->uNumNewNPCs > 0) + { + v730 = (int)pNPCStats->pNewNPCData; + __debugbreak(); // data offset + HIDWORD(v733) = 4 * HIDWORD(v733) + 6043152; + do + { + if ( *(char *)(v730 + 8) & 0x80 + && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v730, pParty->pHirelings[0].pName)) + && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v730, pParty->pHirelings[1].pName)) ) + { + v607 = HIDWORD(v733); + HIDWORD(v733) += 4; + *(int *)v607 = (int)_this + 3; + } + _this = (ItemGen *)((char *)_this + 1); + v730 += 76; + } + while ( (signed int)this < (signed int)pNPCStats->uNumNewNPCs ); + } + v608 = pCastSpell->uPlayerID_2; + if ( v608 != 4 && v608 != 5 + || (v609 = (signed int)*(&pFontCChar + v608 + (unsigned __int8)pParty->field_709), v609 <= 0) + || v609 >= 3 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->spellnum = 0; + continue; + } + v610 = 76 * v609; + *((int *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + 19 * v609) = 0; + v611 = pIconsFrameTable->FindIcon("spell96"); + *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[4].uBeaconTime + v610 + 4) = pIconsFrameTable->GetIconAnimLength(v611); + *(int *)((char *)&pParty->pPlayers[3].pInstalledBeacons[3].field_18 + v610) = 1; + v612 = pParty->pPlayers; + do + { + v612->sHealth = v612->GetMaxHealth(); + v612->sMana = v612->GetMaxMana(); + ++v612; + } + while ( v612 <= &pParty->pPlayers[3] ); + v613 = &pOutdoor->ddm; + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor) + v613 = &pIndoor->dlv; + v613->uReputation += 15; + if ( v613->uReputation > 10000 ) + v613->uReputation = 10000; LODWORD(v727) = 1; break; } - a2 = 0; - v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); - v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; - do - { - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); - v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); - ++a2; - ++v619; - } - while ( v619 <= &pParty->pPlayers[3] ); - LODWORD(v727) = 1; - break; - } - case SPELL_DARK_SOULDRINKER: - { - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - pGame->GetIndoorCamera(); - v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); - HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); - v707.x = 0; - v707.y = 0; - v707.z = 0; - pSpellSprite.stru_24.Reset(); - pSpellSprite.spell_id = pCastSpell->spellnum; - pSpellSprite.spell_level = v2; - pSpellSprite.spell_skill = v731; - pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); - pSpellSprite.uAttributes = 0; - pSpellSprite.uSectorID = 0; - pSpellSprite.uSpriteFrameID = 0; - pSpellSprite.field_60_distance_related_prolly_lod = 0; - pSpellSprite.uFacing = 0; - pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); - pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); - a2 = 0; - int _v726 = 0; - if ( SHIDWORD(v733) > 0 ) - { - _v726 = (HIDWORD(v733) * (7 * v2 + 25)); + case SPELL_DARK_PAIN_REFLECTION: + { + if ( v731 > 0 && v731 <= 4 ) + { + if ( v731 <= 3 ) + { + v614 = 300 * (v2 + 12); + } + if ( v731 == 4 ) + { + v614 = 900 * (v2 + 4); + } + LODWORD(v733) = v614; + } + v615 = v2 + 5; + amount = v615; + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + if ( v731 != 3 && v731 != 4 ) + { + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, pCastSpell->uPlayerID_2); + + pParty->pPlayers[pCastSpell->uPlayerID_2].pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335), v731, v615, v716, 0); + LODWORD(v727) = 1; + break; + } + a2 = 0; + v717 = (signed int)(signed __int64)((double)(signed int)((int)v733 << 7) * 0.033333335); + v619 = pParty->pPlayers;//[0].pPlayerBuffs[10]; do { - v625 = dword_50BF30[a2]; - pSpellSprite.vPosition.x = pActors[v625].vPosition.x; - pSpellSprite.vPosition.y = pActors[v625].vPosition.y; - //v732 = pActors[v625].uActorHeight; - pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); - pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); - v627 = pSpellSprite.Create(0, 0, 0, 0); - v628 = a2; - DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); - a2 = v628 + 1; - } - while ( v628 + 1 < SHIDWORD(v733) ); - } - v730 = 0; - v629 = 1; - do - { - v630 = pPlayers[v629]; - if ( !v630->pConditions[2] - && !v630->pConditions[12] - && !v630->pConditions[13] - && !v630->pConditions[14] - && !v630->pConditions[15] - && !v630->pConditions[16] ) - { - v631 = v730++; - v681[v631] = v629; - } - ++v629; - } - while ( v629 <= 4 ); - v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); - HIDWORD(v733) = 0; - if ( v730 > 0 ) - { + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, a2); + v619->pPlayerBuffs[PLAYER_BUFF_PAIN_REFLECTION].Apply(pParty->uTimePlayed + v717, v731, amount, v716, 0); + ++a2; + ++v619; + } + while ( v619 <= &pParty->pPlayers[3] ); + LODWORD(v727) = 1; + break; + } + case SPELL_DARK_SOULDRINKER: + { + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + pGame->GetIndoorCamera(); + v623 = (signed __int64)pGame->pIndoorCameraD3D->GetPickDepth(); + HIDWORD(v733) = sub_46A6AC((int)dword_50BF30, 100, v623); + v707.x = 0; + v707.y = 0; + v707.z = 0; + pSpellSprite.stru_24.Reset(); + pSpellSprite.spell_id = pCastSpell->spellnum; + pSpellSprite.spell_level = v2; + pSpellSprite.spell_skill = v731; + pSpellSprite.uObjectDescID = pObjectList->ObjectIDByItemID(pSpellSprite.uType); + pSpellSprite.uAttributes = 0; + pSpellSprite.uSectorID = 0; + pSpellSprite.uSpriteFrameID = 0; + pSpellSprite.field_60_distance_related_prolly_lod = 0; + pSpellSprite.uFacing = 0; + pSpellSprite.spell_caster_pid = PID(OBJECT_Player, pCastSpell->uPlayerID); + pSpellSprite.uSoundID = LOWORD(pCastSpell->sound_id); + a2 = 0; + int _v726 = 0; + if ( SHIDWORD(v733) > 0 ) + { + _v726 = (HIDWORD(v733) * (7 * v2 + 25)); + do + { + v625 = dword_50BF30[a2]; + pSpellSprite.vPosition.x = pActors[v625].vPosition.x; + pSpellSprite.vPosition.y = pActors[v625].vPosition.y; + //v732 = pActors[v625].uActorHeight; + pSpellSprite.vPosition.z = pActors[v625].vPosition.z - (unsigned int)(signed __int64)((double)pActors[v625].uActorHeight * unk_4D8548); + pSpellSprite.spell_target_pid = PID(OBJECT_Actor, dword_50BF30[a2]); + v627 = pSpellSprite.Create(0, 0, 0, 0); + v628 = a2; + DamageMonsterFromParty(PID(OBJECT_Item, v627), dword_50BF30[a2], &v707); + a2 = v628 + 1; + } + while ( v628 + 1 < SHIDWORD(v733) ); + } + v730 = 0; + v629 = 1; do { - //v632 = 4 * v681[HIDWORD(v733)] + 10965188; - v726 = pPlayers[v681[HIDWORD(v733)]]; - //v633 = pPlayers[v681[HIDWORD(v733)]]; - v726->sHealth += v732; - //v726 = *(Player **)v632; - //v634 = v726->GetMaxHealth(); - if ( v726->sHealth > v726->GetMaxHealth()) - v726->sHealth = v726->GetMaxHealth(); - v635 = HIDWORD(v733); - - pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); - HIDWORD(v733) = v635 + 1; - } - while ( v635 + 1 < v730 ); - } - pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); + v630 = pPlayers[v629]; + if ( !v630->pConditions[2] + && !v630->pConditions[12] + && !v630->pConditions[13] + && !v630->pConditions[14] + && !v630->pConditions[15] + && !v630->pConditions[16] ) + { + v631 = v730++; + v681[v631] = v629; + } + ++v629; + } + while ( v629 <= 4 ); + v732 = (signed __int64)((double)(signed int)_v726 / (double)v730); + HIDWORD(v733) = 0; + if ( v730 > 0 ) + { + do + { + //v632 = 4 * v681[HIDWORD(v733)] + 10965188; + v726 = pPlayers[v681[HIDWORD(v733)]]; + //v633 = pPlayers[v681[HIDWORD(v733)]]; + v726->sHealth += v732; + //v726 = *(Player **)v632; + //v634 = v726->GetMaxHealth(); + if ( v726->sHealth > v726->GetMaxHealth()) + v726->sHealth = v726->GetMaxHealth(); + v635 = HIDWORD(v733); + + pGame->GetStru6()->SetPlayerBuffAnim(pCastSpell->spellnum, WORD2(v733)); + HIDWORD(v733) = v635 + 1; + } + while ( v635 + 1 < v730 ); + } + pGame->GetStru6()->FadeScreen__like_Turn_Undead_and_mb_Armageddon(0, 0x40u); LODWORD(v727) = 1; break; } case SPELL_DARK_ARMAGEDDON: { - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->spellnum = 0; - continue; - } - v640 = v731 - 2; - if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) - amount = 3; - if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed - pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); - pCastSpell->spellnum = 0; - continue; - } - if ( !pPlayer->CanCastSpell(uRequiredMana) ) - break; - pParty->armageddon_timer = 256; - pParty->field_16140 = v2; - ++pPlayer->uNumArmageddonCasts; - if ( pParty->bTurnBasedModeOn == 1 ) - ++pTurnEngine->field_1C; - auto _v726 = 50; - do - { - v642 = rand() % 4096 - 2048; - v643 = rand(); - v721 = v642 + pParty->vPosition.x; - y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); - v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); - v644 = rand(); - sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); - --_v726; - } - while ( _v726 != 0 ); + if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[499], 2); // Can't cast Armageddon indoors! + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->spellnum = 0; + continue; + } + v640 = v731 - 2; + if ( !v640 || (v641 = v640 - 1) == 0 || (amount = 4, v641 != 1) ) + amount = 3; + if ( pPlayer->uNumArmageddonCasts >= amount || pParty->armageddon_timer > 0 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[428], 2); // Spell failed + pAudioPlayer->PlaySound(SOUND_PlayerCantCastSpell, 0, 0, -1, 0, 0, 0, 0); + pCastSpell->spellnum = 0; + continue; + } + if ( !pPlayer->CanCastSpell(uRequiredMana) ) + break; + pParty->armageddon_timer = 256; + pParty->field_16140 = v2; + ++pPlayer->uNumArmageddonCasts; + if ( pParty->bTurnBasedModeOn == 1 ) + ++pTurnEngine->field_1C; + auto _v726 = 50; + do + { + v642 = rand() % 4096 - 2048; + v643 = rand(); + v721 = v642 + pParty->vPosition.x; + y = (char *)(pParty->vPosition.y + v643 % 4096 - 2048); + v732 = GetTerrainHeightsAroundParty2(v642 + pParty->vPosition.x, (int)y, (int *)&v710, 0); + v644 = rand(); + sub_42F7EB_DropItemAt(0xFE6u, v721, (int)y, v732 + 16, v644 % 500 + 500, 1, 0, 0, 0); + --_v726; + } + while ( _v726 != 0 ); LODWORD(v727) = 1; break; } default: - break; + break; } if ( pCastSpell->field_8 & 0x20 ) { @@ -7542,22 +7528,13 @@ pPlayer->PlaySound(SPEECH_49, 0); if ( v727 != 0.0 ) pAudioPlayer->PlaySound((SoundID)word_4EE088_sound_ids[pCastSpell->spellnum], 0, 0, -1, 0, pCastSpell->sound_id, 0, 0); - pCastSpell->spellnum = 0; - v2 = v723; - continue; } } pCastSpell->spellnum = 0; v2 = v723; continue; - -//LABEL_1166: -// ++n; -// if ( n >= 10 ) -// return; } - } //----- (0042EB42) -------------------------------------------------------- __int16 ObjectList::ObjectIDByItemID(unsigned __int16 uItemID) @@ -7614,7 +7591,7 @@ CASE(UIMSG_PlayerCreationSelectClass) CASE(UIMSG_PlayerCreationClickOK) CASE(UIMSG_PlayerCreationClickReset) - CASE(UIMSG_AutonotesBook) + CASE(UIMSG_ClickBooksBtn) CASE(UIMSG_PlayerCreationRemoveUpSkill) CASE(UIMSG_PlayerCreationRemoveDownSkill) CASE(UIMSG_SPellbook_ShowHightlightedSpellInfo) @@ -8529,27 +8506,13 @@ //----- (0042FC4E) -------------------------------------------------------- void __cdecl ProcessInputActions() { - ActionQueue *pActionQueue; // esi@7 - //Keyboard *v3; // ecx@8 char v4; // al@9 - ActionQueue *v5; // ecx@19 - Player *v6; // ecx@86 - Player *v7; // esi@100 char v8; // bl@100 unsigned __int16 v9; // ax@102 int v10; // eax@103 - unsigned int v11; // eax@127 - signed int v12; // esi@157 - Keyboard *v13; // ecx@158 char v14; // al@159 unsigned int v15; // eax@168 - void *v16; // esi@177 - int v17; // [sp-14h] [bp-1Ch]@8 PartyAction partyAction; // [sp-14h] [bp-1Ch]@20 - PartyAction partyAction_; // [sp-14h] [bp-1Ch]@54 - //__int16 v20; // [sp-14h] [bp-1Ch]@60 - int v21; // [sp-14h] [bp-1Ch]@68 - int v22; // [sp-Ch] [bp-14h]@158 InputAction inputAction; // [sp+0h] [bp-8h]@7 int v24; // [sp+4h] [bp-4h]@87 @@ -8571,18 +8534,50 @@ } //pParty->uFlags2 |= PARTY_FLAGS_2_RUNNING; -//LABEL_6: + for ( uint i = 0; i < 30; ++i ) + { + if ( pKeyActionMap->pToggleTypes[i] ) + v14 = pGame->pKeyboardInstance->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[i]); + else + v14 = pGame->pKeyboardInstance->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[i]); + if ( v14 && i == 9 ) + { + if ( !pCurrentScreen ) + { + pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); + continue; + } + if ( pCurrentScreen == SCREEN_NPC_DIALOGUE || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) + { + v15 = pMessageQueue_50CBD0->uNumMessages; + if ( pMessageQueue_50CBD0->uNumMessages ) + { + v15 = 0; + if ( pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].field_8 ) + { + v15 = 1; + pMessageQueue_50CBD0->uNumMessages = 0; + pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + continue; + } + pMessageQueue_50CBD0->uNumMessages = 0; + } + //pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); + } + } + } if ( !pEventTimer->bPaused ) { - inputAction = (InputAction)0; - pActionQueue = pPartyActionQueue; - while ( 1 ) + for ( uint i = 0; i < 30; ++i ) { - v17 = pKeyActionMap->pVirtualKeyCodesMapping[inputAction]; - if ( pKeyActionMap->pToggleTypes[inputAction] ) - v4 = pKeyboard->WasKeyPressed(v17); + inputAction = (InputAction)i; + if ( pKeyActionMap->pToggleTypes[(InputAction)i] ) + v4 = pKeyboard->WasKeyPressed(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); else - v4 = pKeyboard->IsKeyBeingHeld(v17); + v4 = pKeyboard->IsKeyBeingHeld(pKeyActionMap->pVirtualKeyCodesMapping[(InputAction)i]); if ( v4 ) { switch ( inputAction ) @@ -8591,104 +8586,77 @@ if (pCurrentScreen != SCREEN_GAME) break; if (!pParty->bTurnBasedModeOn) - //goto _do_move_forward; { - v5 = pActionQueue; if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) partyAction = PARTY_RunForward; else partyAction = PARTY_WalkForward; - //goto _add_action_and_continue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; } if (pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) { pTurnEngine->uActionPointsLeft -= 26; -//_do_move_forward: - v5 = pActionQueue; if ( pParty->uFlags2 & PARTY_FLAGS_2_RUNNING) partyAction = PARTY_RunForward; else partyAction = PARTY_WalkForward; - //goto _add_action_and_continue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; } break; case INPUT_MoveBackwards: - //__debugbreak(); if (pCurrentScreen != SCREEN_GAME) break; if (!pParty->bTurnBasedModeOn) - //goto _do_move_backwards; { - v5 = pActionQueue; if ( pParty->uFlags2 & 2 ) partyAction = PARTY_RunBackward; else partyAction = PARTY_WalkBackward; - //goto _add_action_and_continue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; } if ( pTurnEngine->field_4 != 1 && pTurnEngine->field_4 != 2 && pTurnEngine->uActionPointsLeft > 0 ) { pTurnEngine->uActionPointsLeft -= 26; -//_do_move_backwards: - v5 = pActionQueue; if ( pParty->uFlags2 & 2 ) partyAction = PARTY_RunBackward; else partyAction = PARTY_WalkBackward; - //goto _add_action_and_continue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; } break; case INPUT_StrafeLeft: - //__debugbreak(); if (pCurrentScreen != SCREEN_GAME) break; if (!pParty->bTurnBasedModeOn) - //goto _do_strafe_left; { partyAction = PARTY_StrafeLeft; - //goto _add_action_and_continue_; - v5 = pActionQueue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; } if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) break; pTurnEngine->uActionPointsLeft -= 26; -//_do_strafe_left: partyAction = PARTY_StrafeLeft; - //goto _add_action_and_continue_; - v5 = pActionQueue; - v5->Add(partyAction); - break; + pPartyActionQueue->Add(partyAction); + break; case INPUT_StrafeRight: - //__debugbreak(); if (pCurrentScreen != SCREEN_GAME) break; if (!pParty->bTurnBasedModeOn) - //goto _do_strafe_right; { partyAction = PARTY_StrafeRight; - //goto _add_action_and_continue_; - v5 = pActionQueue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; } if ( pTurnEngine->field_4 == 1 || pTurnEngine->field_4 == 2 || pTurnEngine->uActionPointsLeft <= 0 ) break; pTurnEngine->uActionPointsLeft -= 26; -//_do_strafe_right: partyAction = PARTY_StrafeRight; - //goto _add_action_and_continue_; - v5 = pActionQueue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; case INPUT_TurnLeft: if (pCurrentScreen != SCREEN_GAME) @@ -8701,16 +8669,16 @@ break; pTurnEngine->uActionPointsLeft -= 26; } - partyAction_ = PARTY_StrafeLeft; + partyAction = PARTY_StrafeLeft; } else { if ( pParty->uFlags2 & 2 ) - partyAction_ = PARTY_FastTurnLeft; + partyAction = PARTY_FastTurnLeft; else - partyAction_ = PARTY_TurnLeft; + partyAction = PARTY_TurnLeft; } - pActionQueue->Add(partyAction_); + pPartyActionQueue->Add(partyAction); if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) { pWeather->OnPlayerTurn(10); @@ -8727,29 +8695,26 @@ break; pTurnEngine->uActionPointsLeft -= 26; } - v21 = PARTY_StrafeRight; + partyAction = PARTY_StrafeRight; } else { if ( pParty->uFlags2 & 2 ) - v21 = PARTY_FastTurnRight; + partyAction = PARTY_FastTurnRight; else - v21 = PARTY_TurnRight; + partyAction = PARTY_TurnRight; } - pActionQueue->Add((PartyAction)v21); + pPartyActionQueue->Add(partyAction); if (uCurrentlyLoadedLevelType == LEVEL_Outdoor && pWeather->bRenderSnow) { pWeather->OnPlayerTurn(-10); } break; case INPUT_Jump: - //__debugbreak(); if (pCurrentScreen != SCREEN_GAME || pParty->bTurnBasedModeOn) break; partyAction = (PartyAction)12; - //goto _add_action_and_continue_; - v5 = pActionQueue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; case INPUT_Yell: if (!pCurrentScreen && uActiveCharacter) @@ -8759,21 +8724,18 @@ } break; case INPUT_Pass: - //__debugbreak(); if ( pCurrentScreen ) break; if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) - //goto LABEL_118; { pTurnEngine->field_18 |= 8u; break; } if ( uActiveCharacter ) { - v6 = pPlayers[uActiveCharacter]; - if ( !v6->uTimeToRecovery ) + if ( !pPlayers[uActiveCharacter]->uTimeToRecovery ) { - v24 = v6->GetAttackRecoveryTime(false); + v24 = pPlayers[uActiveCharacter]->GetAttackRecoveryTime(false); if ( !pParty->bTurnBasedModeOn ) pPlayers[uActiveCharacter]->SetRecoveryTime((signed __int64)(flt_6BE3A4_debug_recmod1 * (double)v24 * 2.133333333333333)); pCastSpellInfo->_427D48(uActiveCharacter); @@ -8781,8 +8743,7 @@ } } break; - case INPUT_Combat: - //__debugbreak(); + case INPUT_Combat://if press ENTER if (pCurrentScreen == SCREEN_GAME) { if (pParty->bTurnBasedModeOn) @@ -8801,87 +8762,66 @@ } break; case INPUT_CastReady: - //__debugbreak(); if (pCurrentScreen != SCREEN_GAME) break; if (pParty->bTurnBasedModeOn && pTurnEngine->field_4 == 3) - //goto LABEL_118; { pTurnEngine->field_18 |= 8u; break; } if ( !uActiveCharacter ) break; - v7 = pPlayers[uActiveCharacter]; - v8 = v7->uQuickSpell; + v8 = pPlayers[uActiveCharacter]->uQuickSpell; if ( !v8 || bUnderwater - || ((v9 = v7->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), - v10 > v7->sMana) ) + || ((v9 = pPlayers[uActiveCharacter]->pActiveSkills[(unsigned __int8)v8 / 11 + 12], !(HIBYTE(v9) & 1)) ? + ((v9 & 0x80u) == 0 ? (!(v9 & 0x40) ? (v10 = *(&pSpellDatas[0].uNormalLevelMana + 10 * (unsigned __int8)v8)) : + (v10 = *(&pSpellDatas[0].uExpertLevelMana + 10 * (unsigned __int8)v8))) : + (v10 = *(&pSpellDatas[0].uMasterLevelMana + 10 * (unsigned __int8)v8))) : + (v10 = *(&pSpellDatas[0].uMagisterLevelMana + 10 * (unsigned __int8)v8)), + v10 > pPlayers[uActiveCharacter]->sMana) ) { - pActionQueue = pPartyActionQueue; -LABEL_120: + pPartyActionQueue = pPartyActionQueue; pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); break; - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Attack; - //goto _send_message; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - break; - }*/ } else { - pActionQueue = pPartyActionQueue; - if ( dword_50C9E8 < 40 ) + /*if ( dword_50C9E8 < 40 ) { dword_50C9EC[3 * dword_50C9E8] = 25; dword_50C9EC[3 * dword_50C9E8 + 1] = 0; dword_50C9EC[3 * dword_50C9E8 + 2] = 0; ++dword_50C9E8; - } + }*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_CastQuickSpell, 0, 0); } break; case INPUT_Attack: - //__debugbreak(); if (pCurrentScreen != SCREEN_GAME) break; - if (!pParty->bTurnBasedModeOn || pTurnEngine->field_4 != 3) - goto LABEL_120; -//LABEL_118: - pTurnEngine->field_18 |= 8u; + if (pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3) + { + pTurnEngine->field_18 |= 8u; + break; + } + pMessageQueue_50CBD0->AddMessage(UIMSG_Attack, 0, 0); break; case INPUT_EventTrigger: if (pCurrentScreen == SCREEN_GAME) { - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) - break; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Game_Action; - //goto _send_message; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - break;*/ pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); break; } if ( pCurrentScreen == SCREEN_NPC_DIALOGUE ) { - v11 = pMessageQueue_50CBD0->uNumMessages; if ( pMessageQueue_50CBD0->uNumMessages ) { - v11 = 0; pMessageQueue_50CBD0->uNumMessages = 0; if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) { - v11 = 1; pMessageQueue_50CBD0->uNumMessages = 1; -//LABEL_132: - pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; -//_send_message: + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = UIMSG_Escape; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; @@ -8889,188 +8829,90 @@ } break; } - /*if ( (signed int)v11 < 40 ) - //goto LABEL_132; - { - pMessageQueue_50CBD0->pMessages[v11].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - break; - }*/ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); } break; case INPUT_CharCycle: - //__debugbreak(); - if ( pCurrentScreen == SCREEN_SPELL_BOOK - || dword_50C9E8 >= 40 ) + if ( pCurrentScreen == SCREEN_SPELL_BOOK )// || dword_50C9E8 >= 40 ) break; - dword_50C9EC[3 * dword_50C9E8] = 176; - //goto LABEL_155; + /*dword_50C9EC[3 * dword_50C9E8] = 176; dword_50C9EC[3 * dword_50C9E8 + 1] = 0; dword_50C9EC[3 * dword_50C9E8 + 2] = 0; - ++dword_50C9E8; + ++dword_50C9E8;*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_CycleCharacters, 0, 0); break; case INPUT_LookUp: - //__debugbreak(); if ( pEventTimer->bPaused ) break; partyAction = (PartyAction)7; - //goto _add_action_and_continue_; - v5 = pActionQueue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; case INPUT_CenterView: - //__debugbreak(); if ( pEventTimer->bPaused ) break; partyAction = (PartyAction)9; - //goto _add_action_and_continue_; - v5 = pActionQueue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; case INPUT_LookDown: - //__debugbreak(); if ( pEventTimer->bPaused ) break; partyAction = (PartyAction)8; - //goto _add_action_and_continue_; - v5 = pActionQueue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; case INPUT_FlyUp: - //__debugbreak(); - if ( pCurrentScreen - || pEventTimer->bPaused ) + if ( pCurrentScreen || pEventTimer->bPaused ) break; partyAction = (PartyAction)13; - //goto _add_action_and_continue_; - v5 = pActionQueue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; case INPUT_Land: - //__debugbreak(); - if ( pCurrentScreen - || pEventTimer->bPaused ) + if ( pCurrentScreen || pEventTimer->bPaused ) break; partyAction = (PartyAction)15; - //goto _add_action_and_continue_; - v5 = pActionQueue; - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); break; case INPUT_FlyDown: - //__debugbreak(); if ( !pCurrentScreen && !pEventTimer->bPaused ) { partyAction = (PartyAction)14; -//_add_action_and_continue_: - v5 = pActionQueue; -//_add_action_and_continue: - v5->Add(partyAction); + pPartyActionQueue->Add(partyAction); } break; case INPUT_ZoomIn: - //__debugbreak(); - if ( dword_50C9E8 >= 40 ) + /*if ( dword_50C9E8 >= 40 ) break; dword_50C9EC[3 * dword_50C9E8] = 367; - //goto LABEL_155; dword_50C9EC[3 * dword_50C9E8 + 1] = 0; dword_50C9EC[3 * dword_50C9E8 + 2] = 0; - ++dword_50C9E8; + ++dword_50C9E8;*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_ClickZoomOutBtn, 0, 0); break; case INPUT_ZoomOut: - //__debugbreak(); - if ( dword_50C9E8 < 40 ) + /*if ( dword_50C9E8 < 40 ) { dword_50C9EC[3 * dword_50C9E8] = 368; -//LABEL_155: dword_50C9EC[3 * dword_50C9E8 + 1] = 0; dword_50C9EC[3 * dword_50C9E8 + 2] = 0; ++dword_50C9E8; - } + }*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_ClickZoomInBtn, 0, 0); break; case INPUT_AlwaysRun: bAlwaysRun = bAlwaysRun == 0; break; default: - //__debugbreak(); break; } } - inputAction = (InputAction)((int)inputAction + 1); - if ( (signed int)inputAction >= 30 ) - goto LABEL_176; } } - v12 = 0; - do - { - v22 = pKeyActionMap->pVirtualKeyCodesMapping[v12]; - v13 = pGame->pKeyboardInstance; - if ( pKeyActionMap->pToggleTypes[v12] ) - v14 = v13->WasKeyPressed(v22); - else - v14 = v13->IsKeyBeingHeld(v22); - if ( v14 && v12 == 9 ) - { - if ( !pCurrentScreen ) - { - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) - goto LABEL_175; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)404; - //goto LABEL_174; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages;*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Game_Action, 0, 0); - goto LABEL_175; - } - if ( pCurrentScreen == SCREEN_NPC_DIALOGUE - || pCurrentScreen == SCREEN_BRANCHLESS_NPC_DIALOG ) - { - v15 = pMessageQueue_50CBD0->uNumMessages; - if ( pMessageQueue_50CBD0->uNumMessages ) - { - v15 = 0; - if ( pMessageQueue_50CBD0->pMessages[0].field_8 ) - { - v15 = 1; - pMessageQueue_50CBD0->uNumMessages = 0; - //goto LABEL_173; - pMessageQueue_50CBD0->pMessages[v15].eType = UIMSG_Escape; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - goto LABEL_175; - } - pMessageQueue_50CBD0->uNumMessages = 0; - } - /*if ( (signed int)v15 >= 40 ) - goto LABEL_175; -//LABEL_173: - pMessageQueue_50CBD0->pMessages[v15].eType = (UIMessageType)113; -//LABEL_174: - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages;*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0); - goto LABEL_175; - } - } -LABEL_175: - ++v12; - } - while ( v12 < 30 ); -LABEL_176: if (pGame->pKeyboardInstance->bUsingAsynKeyboard) { AsyncKeyboard::LeaveCriticalSection(); - v16 = pAsyncKeyboard; + //v16 = pAsyncKeyboard; AsyncKeyboard::EnterCriticalSection(); - memset((char *)v16 + 521, 0, 0x100u); + memset((char *)pAsyncKeyboard + 521, 0, 0x100u); AsyncKeyboard::LeaveCriticalSection(); } } diff -r d5796c318653 -r 3ee391de04d5 mm7_data.cpp --- a/mm7_data.cpp Tue May 14 19:04:48 2013 +0600 +++ b/mm7_data.cpp Tue May 14 19:05:08 2013 +0600 @@ -544,7 +544,6 @@ char aS100S[777]; // idb char aS100D[777]; // idb char aS180[6]; // idb -const char *format_4E2E68 = "%s\f%05u\t180%d\f00000 / %d\n"; char aS_6[2]; // idb char aSS_0[777]; // idb char aS_5[4]; // idb @@ -754,8 +753,6 @@ 0x83, 0xD8, 0x7B, 0xD8, }; -int pPaperdollRingsX[6] = {0x1EA, 0x21A, 0x248, 0x1EA, 0x21A, 0x248}; -int pPaperdollRingsY[6] = {0x0CA, 0x0CA, 0x0CA, 0x0FA, 0x0FA, 0x0FA}; char aItem092v3[777]; // idb char aIbCd5D[777]; // idb char aItem281pc02d[777]; // idb @@ -1491,14 +1488,14 @@ unsigned int uExitCancelTextureId; int dword_50651C; // weak int dword_506528; // weak -int dword_50652C; // weak -int dword_506530; // weak -int dword_506534; // weak -int dword_506538; // weak -int dword_50653C; // weak -int dword_506540; // weak -int dword_506544; // weak -int dword_506548; // weak +int Autonotes_Instructors_page_flag; // dword_50652C +int Autonotes_Misc_page_flag; //dword_506530 +int Book_PageBtn6_flag; //dword_506534 +int Book_PageBtn5_flag; //dword_506538 +int Book_PageBtn4_flag; // dword_50653C +int Book_PageBtn3_flag; //dword_506540 +int BtnDown_flag; //BtnDown_flag +int BtnUp_flag; //BtnUp_flag int quick_spell_at_page; // weak char byte_506550; // weak char *aMoonPhaseNames[5]; @@ -1508,7 +1505,6 @@ //unsigned __int8 bMonsterInfoUI_bDollInitialized; char *aSpellNames[44]; int pMainScreenNum; // weak -char byte_50697C; // weak int dword_506980; // weak int dword_506984; // weak int dword_506988; // weak @@ -1598,13 +1594,12 @@ unsigned int uIconID_TurnStop; unsigned int uIconID_TurnHour; int uIconID_CharacterFrame; // idb -int dword_50C98C; // weak unsigned int uIconID_TurnStart; int dword_50C994; // weak int dword_50C998_turnbased_icon_1A; // weak int uSpriteID_Spell11; // idb _UNKNOWN unk_50C9A0; // weak -int _50C9A8_item_enchantment_timer; // weak +int _50C9A8_item_enchantment_timer = 0; // weak int dword_50C9AC; // weak int dword_50C9D0; // weak int dword_50C9D4; // weak @@ -1633,13 +1628,7 @@ int papredoll_flying_feet[777]; // idb int paperdoll_boots_texture[4][6];//0x511638 int paperdoll_cloak_collar_texture[4][10]; // weak -//int dword_51179C; // weak -//int dword_5117A0; // weak -//int dword_5117A4; // weak -//int dword_5117A8; // weak -//int dword_5117AC; // weak int paperdoll_cloak_texture[4][10]; -int bRingsShownInCharScreen; // weak int _unused000; // weak unsigned __int16 pOdmMinimap[117][137]; diff -r d5796c318653 -r 3ee391de04d5 mm7_data.h --- a/mm7_data.h Tue May 14 19:04:48 2013 +0600 +++ b/mm7_data.h Tue May 14 19:05:08 2013 +0600 @@ -461,7 +461,6 @@ extern char aS100S[]; // idb extern char aS100D[]; // idb extern char aS180[6]; // idb -extern const char *format_4E2E68; // format 2 text of resistance in Stats screen extern char aS_6[2]; // idb extern char aSS_0[]; // idb extern char aS_5[4]; // idb @@ -582,8 +581,6 @@ extern int pPaperdoll_SecondLeftHand[4][2]; extern int pPaperdoll_RightHand[4][2]; extern int pPaperdollLeftEmptyHand[4][2]; -extern int pPaperdollRingsX[6]; -extern int pPaperdollRingsY[6]; extern char aItem092v3[]; // idb extern char aIbCd5D[]; // idb extern char aItem281pc02d[]; // idb @@ -919,14 +916,14 @@ extern unsigned int uExitCancelTextureId; extern int dword_50651C; // weak extern int dword_506528; // weak -extern int dword_50652C; // weak -extern int dword_506530; // weak -extern int dword_506534; // weak -extern int dword_506538; // weak -extern int dword_50653C; // weak -extern int dword_506540; // weak -extern int dword_506544; // weak -extern int dword_506548; // weak +extern int Autonotes_Instructors_page_flag; // dword_50652C +extern int Autonotes_Misc_page_flag; //dword_506530 +extern int Book_PageBtn6_flag; //dword_506534 +extern int Book_PageBtn5_flag; //dword_506538 +extern int Book_PageBtn4_flag; //dword_50653C +extern int Book_PageBtn3_flag; //dword_506540 +extern int BtnDown_flag; //BtnDown_flag +extern int BtnUp_flag; //BtnUp_flag extern int quick_spell_at_page; // weak extern char byte_506550; // weak extern char *aMoonPhaseNames[5]; @@ -936,7 +933,6 @@ //extern unsigned __int8 bMonsterInfoUI_bDollInitialized; extern char *aSpellNames[44]; extern int pMainScreenNum; // weak -extern char byte_50697C; // weak extern int dword_506980; // weak extern int dword_506984; // weak extern int dword_506988; // weak @@ -1026,7 +1022,6 @@ extern unsigned int uIconID_TurnStop; extern unsigned int uIconID_TurnHour; extern int uIconID_CharacterFrame; // idb -extern int dword_50C98C; // weak extern unsigned int uIconID_TurnStart; extern int dword_50C994; // weak extern int dword_50C998_turnbased_icon_1A; // weak @@ -1550,26 +1545,12 @@ void __fastcall ZBuffer_DoFill(int *pZBuffer, Texture *pTex, int uZValue); void __fastcall sub_40F92A(int *pZBuffer, struct Texture *a2, int a3); // idb void __cdecl SetMoonPhaseNames(); -void DrawSpellDescriptionPopup(int spell_index); signed int __fastcall sub_410D99_get_map_index(int a1); -unsigned int __cdecl DrawLloydBeaconsScreen(); -void DrawTownPortalScreen(); -void LoadSpellbook(unsigned int uID); // idb struct GUIWindow *__cdecl sub_41140B(); void __cdecl sub_411473(); -void __cdecl OnCloseSpellBook(); -void __cdecl InitializeBookTextures(); -void __cdecl InitializeBookFonts(); void __fastcall LoadThumbnailLloydTexture(unsigned int uSlot, unsigned int uPlayer); void sub_412AF9(); -void DrawSpellBookContent(); -char DrawBook_History(); -void DrawBook_Quests(); -void DrawBook_Autonotes(); -void DrawBook_Maps(); -void DrawCurrentBook(unsigned int uBook); // idb char *GetDayPart(); -char DrawBook_Calendar(); void SetAttributeNames(); void uGameUIFontMain_initialize(); void uGameUIFontShadow_initialize(); @@ -1596,24 +1577,13 @@ void FillAwardsData(); void sub_419220(); void sub_419379(); -void CharacterUI_SkillScreen_Draw(); -void sub_4196A0(); unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels); -void __cdecl draw_leather(); -void __cdecl GameUI_DrawRightPanelItems(); -void __cdecl GameUI_DrawFoodAndGold(); -void __cdecl GameUI_DrawLifeManaBars(); -void __cdecl draw_right_panel(); -void __cdecl GameUI_DrawRightPanelFrames(); struct GUIButton *__fastcall GUI_HandleHotkey(unsigned __int8 uHotkey); // idb int __fastcall GUI_ReplaceHotkey(unsigned __int8 uOldHotkey, unsigned __int8 uNewHotkey, char bFirstCall); void __cdecl MainMenuUI_LoadFontsAndSomeStuff(); void __cdecl MainMenuUI_Create(); -void __cdecl GameUI_Footer_2(); -void __thiscall sub_41C0B8_set_status_string(const char *pStr); // idb -void __cdecl GameUI_Footer(); +char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, struct GUIWindow *edx0, __int64 a3, struct GUIFont *a2); 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); void __cdecl nullsub_3(); // idb @@ -1626,7 +1596,6 @@ 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 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 @@ -1687,8 +1656,6 @@ int __stdcall DirectInputMouse_enumerator(int, int); // weak void CharacterUI_LoadPaperdollTextures(); int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder); -void __fastcall CharacterUI_DrawPaperdoll(unsigned int uPlayerID); // idb -void __fastcall CharacterUI_DrawPaperdollWithRingOverlay(unsigned int uPlayerID); // idb bool _43ED6F_check_party_races(bool b); bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int _this); bool __fastcall Player_has_item(unsigned int uItemID, struct Player *pPlayer, char a3); @@ -1709,12 +1676,8 @@ void __fastcall sub_4406BC(unsigned int node_id, unsigned int uFirstNode); // idb void __fastcall sub_440BED(struct IndoorLocation_drawstru *_this); bool sub_44100D(); -void GameUI_DrawTorchlightAndWizardEye(); -void GameUI_DrawCharacterSelectionFrame(); void LoadPartyBuffIcons(); -void GameUI_DrawPartySpells(); __int16 __fastcall sub_441A4E(int a1); -void GameUI_DrawMinimap(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW, unsigned int uZoom, unsigned int bRedrawOdmMinimap); void DrawBook_Map_sub(unsigned int tl_x, unsigned int tl_y, unsigned int br_x, int br_y, int _48074); // idb void Initialize2DA(); @@ -1955,8 +1918,6 @@ void LoadPlayerPortraintsAndVoices(); int __fastcall ReloadPlayerPortraits(int, int); // weak 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 _493938_regenerate();