Mercurial > might-and-magic-trilogy
view mm7_1.cpp @ 180:d8aa322a19e5
VideoSound(work)
author | Ritor1 |
---|---|
date | Wed, 19 Dec 2012 18:04:28 +0600 |
parents | bf2956650e92 |
children |
line wrap: on
line source
/* This file has been generated by the Hex-Rays decompiler. Copyright (c) 2007-2011 Hex-Rays <info@hex-rays.com> Detected compiler: Visual C++ */ //#include <defs.h> #include "MM7.h" #include "MapInfo.h" #include "Game.h" #include "GUIWindow.h" #include "GUIFont.h" #include "GUIButton.h" #include "GUIProgressBar.h" #include "Party.h" #include "AudioPlayer.h" #include "Outdoor.h" #include "IndoorCamera.h" #include "Overlays.h" #include "Monsters.h" #include "Arcomage.h" #include "LOD.h" #include "Actor.h" #include "Allocator.h" #include "Events.h" #include "Viewport.h" #include "FrameTableInc.h" #include "Math.h" #include "LayingItem.h" #include "ObjectList.h" #include "Chest.h" #include "PaletteManager.h" #include "DecorationList.h" #include "SaveLoad.h" #include "stru123.h" #include "Time.h" #include "IconFrameTable.h" #include "stru179.h" #include "Awards.h" #include "Autonotes.h" #include "stru160.h" #include "stru279.h" #include "TurnEngine.h" #include "stru277.h" #include "Weather.h" #include "stru272.h" #include "stru298.h" #include "StorylineTextTable.h" #include "Events2D.h" #include "mm7_data.h" int __stdcall aWinProc(HWND hWnd, UINT Msg, WPARAM wParam, unsigned int lParam); int __stdcall InsertMM7CDDialogFunc(HWND hDlg, int a2, __int16 a3, int a4); bool __fastcall FindMM7CD(HWND hWnd, char *pCDDrive); bool __fastcall Initialize(HINSTANCE hInst, char *pCmdLine); void __cdecl FreeSavegameThumbnails() { for (int i = 0; i < 40; ++i) //pAllocator->FreeChunk(pSavegameThumbnails[i].pPixels); pSavegameThumbnails[i].Release(); } //----- (004196A0) -------------------------------------------------------- void __cdecl sub_4196A0() { GUIButton *i; // esi@2 GUIButton *j; // esi@7 if ( dword_507CC0 ) { dword_507CC0 = 0; for ( i = pGUIWindow_CurrentMenu->pControlsHead; i; i = i->pNext ) { if ( BYTE1(i->field_1C) & 0x80 ) GUIButton::_41D0D8(i); } for ( j = pGUIWindow_CurrentMenu->pControlsHead; j; j = j->pNext ) { if ( j->uControlID == 120 ) { j->uX = dword_50698C; j->uY = dword_506988; j->uZ = dword_506984; j->uW = dword_506980; pGUIWindow_CurrentMenu->_41D08F(1, 0, 0, 0); } } } } // 506980: using guessed type int dword_506980; // 506984: using guessed type int dword_506984; // 506988: using guessed type int dword_506988; // 50698C: using guessed type int dword_50698C; // 507CC0: using guessed type int dword_507CC0; //----- (00419719) -------------------------------------------------------- char __fastcall CharacterUI_SkillsTab_Draw(unsigned int uPlayerID) { unsigned int v1; // esi@1 Player *pPlayer; // ebp@1 unsigned int v3; // eax@1 signed int v4; // ecx@1 int v5; // edi@3 GUIWindow *v6; // ecx@3 int v7; // eax@4 GUIButton *v8; // edx@5 int v9; // eax@7 unsigned int v10; // ecx@9 unsigned __int16 v11; // ax@9 int v12; // eax@9 unsigned __int8 v13; // cf@12 unsigned __int8 v14; // zf@12 unsigned int v15; // eax@12 char *v16; // ecx@22 GUIWindow *v17; // ecx@33 int v18; // edx@34 GUIButton *v19; // eax@35 int v20; // edx@37 unsigned __int16 v21; // cx@39 unsigned int v22; // eax@39 int v23; // edi@39 unsigned int v24; // eax@42 char v25; // sf@52 char *v26; // ecx@52 int v27; // edi@63 GUIWindow *v28; // ecx@63 int v29; // edx@64 GUIButton *v30; // eax@65 int v31; // edx@67 unsigned int v32; // ecx@69 int v33; // eax@69 unsigned int v34; // eax@72 char *v35; // ecx@82 GUIWindow *v36; // ecx@93 int v37; // edx@94 GUIButton *v38; // eax@94 int v39; // edx@97 unsigned __int16 v40; // cx@99 unsigned int v41; // eax@99 int v42; // edi@99 unsigned int v43; // eax@102 char *v44; // ecx@112 char *v46; // [sp-Ch] [bp-4Ch]@19 char *v47; // [sp-Ch] [bp-4Ch]@49 char *v48; // [sp-Ch] [bp-4Ch]@79 char *v49; // [sp-Ch] [bp-4Ch]@109 unsigned int v50; // [sp-8h] [bp-48h]@19 unsigned int v51; // [sp-8h] [bp-48h]@49 unsigned int v52; // [sp-8h] [bp-48h]@79 unsigned int v53; // [sp-8h] [bp-48h]@109 int v54; // [sp-4h] [bp-44h]@19 int v55; // [sp-4h] [bp-44h]@49 int v56; // [sp-4h] [bp-44h]@79 int v57; // [sp-4h] [bp-44h]@109 unsigned int v58; // [sp+10h] [bp-30h]@9 unsigned int v59; // [sp+10h] [bp-30h]@39 unsigned int v60; // [sp+10h] [bp-30h]@69 unsigned int v61; // [sp+10h] [bp-30h]@99 int v62; // [sp+14h] [bp-2Ch]@4 int v63; // [sp+14h] [bp-2Ch]@34 int v64; // [sp+14h] [bp-2Ch]@64 int v65; // [sp+14h] [bp-2Ch]@94 signed int i; // [sp+18h] [bp-28h]@4 signed int v67; // [sp+18h] [bp-28h]@34 signed int v68; // [sp+18h] [bp-28h]@64 signed int v69; // [sp+18h] [bp-28h]@94 int v70; // [sp+1Ch] [bp-24h]@3 int v71; // [sp+1Ch] [bp-24h]@33 int v72; // [sp+1Ch] [bp-24h]@63 int v73; // [sp+1Ch] [bp-24h]@93 int uY; // [sp+20h] [bp-20h]@9 int uYa; // [sp+20h] [bp-20h]@33 int uYb; // [sp+20h] [bp-20h]@69 int uYc; // [sp+20h] [bp-20h]@93 unsigned int a5; // [sp+24h] [bp-1Ch]@1 unsigned int v79; // [sp+28h] [bp-18h]@1 int *v80; // [sp+2Ch] [bp-14h]@3 int *v81; // [sp+2Ch] [bp-14h]@33 int *v82; // [sp+2Ch] [bp-14h]@63 int *v83; // [sp+2Ch] [bp-14h]@93 unsigned int v84; // [sp+30h] [bp-10h]@1 int v85; // [sp+34h] [bp-Ch]@1 unsigned int v86; // [sp+38h] [bp-8h]@1 unsigned __int16 v87; // [sp+3Ch] [bp-4h]@9 char *v88; // [sp+3Ch] [bp-4h]@24 char *v89; // [sp+3Ch] [bp-4h]@54 unsigned __int16 v90; // [sp+3Ch] [bp-4h]@69 char *v91; // [sp+3Ch] [bp-4h]@84 char *v92; // [sp+3Ch] [bp-4h]@114 v1 = uPlayerID; a5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v84 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xAFu, 0xFFu); v85 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem; v86 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); v79 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); pPlayer = (Player *)&stru_AA1058[3].pSounds[6972 * v1 + 40552]; v3 = pIcons_LOD->LoadTexture("fr_skill", TEXTURE_16BIT_PALETTE); pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0)); v4 = v79; if ( !pPlayer->uSkillPoints ) v4 = 65535; sprintf( pTmpBuf, "%s ", pGlobalTXT_LocalizationStrings[206], // Skills for a5, pPlayer->pName, pGlobalTXT_LocalizationStrings[207], // Skill Points v4, pPlayer->uSkillPoints); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0); v5 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13;// Weapons, Level sprintf(pTmpBuf, "%s\r400%s", pGlobalTXT_LocalizationStrings[242], pGlobalTXT_LocalizationStrings[131]); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, v5, a5, pTmpBuf, 0, 0, 0); v6 = pGUIWindow_CurrentMenu; v70 = 0; v80 = dword_4E2A2C; do { v62 = *v80; v7 = 0; for ( i = 0; i < (signed int)v6->uNumControls; v7 = i++ + 1 ) { v8 = v6->pControlsHead; if ( v7 > 0 ) { do { v8 = v8->pNext; --v7; } while ( v7 ); } v9 = v8->field_1C; if ( SBYTE1(v9) >= 0 ) continue; BYTE1(v9) &= 0x7Fu; if ( v9 != v62 ) continue; v5 = v8->uY; v10 = pPlayer->uSkillPoints; ++v70; v11 = pPlayer->pActiveSkills[v62]; v87 = pPlayer->pActiveSkills[v62]; v12 = v11 & 0x3F; v58 = 0; uY = v12; if ( v10 >= v12 + 1 ) v58 = v84; if ( v85 == i ) { v13 = v10 < v12; v14 = v10 == v12; v15 = v86; if ( !(v13 | v14) ) v15 = v79; v58 = v15; } else { v15 = v58; } if ( HIBYTE(v87) & 1 ) { if ( !v15 ) v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v54 = uY; v50 = v58; v46 = pGlobalTXT_LocalizationStrings[96]; } else { if ( !(v87 & 0xC0) ) { sprintf(pTmpBuf, "%s\r400%2d", pSkillNames[v62], uY); goto LABEL_28; } v16 = pGlobalTXT_LocalizationStrings[432]; if ( (v87 & 0x80u) == 0 ) v16 = pGlobalTXT_LocalizationStrings[433]; v88 = v16; if ( !v15 ) v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v54 = uY; v50 = v58; v46 = v88; } sprintf(pTmpBuf, "%s ", pSkillNames[v62], v15, v46, v50, v54); LABEL_28: pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, v5, v58, pTmpBuf, 0, 0, 0); v6 = pGUIWindow_CurrentMenu; } ++v80; } while ( (signed int)v80 < (signed int)dword_4E2A50 ); if ( !v70 ) { v5 = v5 + LOBYTE(pFontLucida->uFontHeight) - 3; v6->DrawText(pFontLucida, 24, v5, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); } uYa = v5 + 2 * LOBYTE(pFontLucida->uFontHeight) - 10; sprintf(pTmpBuf, "%s\r400%s", pGlobalTXT_LocalizationStrings[138], pGlobalTXT_LocalizationStrings[131]); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, uYa, a5, pTmpBuf, 0, 0, 0); v17 = pGUIWindow_CurrentMenu; v71 = 0; v81 = _4E2A80_skills; do { v18 = 0; v67 = 0; v63 = *v81; while ( v67 < (signed int)v17->uNumControls ) { v19 = v17->pControlsHead; if ( v18 > 0 ) { do { v19 = v19->pNext; --v18; } while ( v18 ); } v20 = v19->field_1C; if ( SBYTE1(v20) >= 0 || (BYTE1(v20) &= 0x7Fu, v20 != v63) ) goto LABEL_59; ++v71; uYa = v19->uY; v21 = pPlayer->pActiveSkills[v63]; v22 = pPlayer->uSkillPoints; v23 = pPlayer->pActiveSkills[v63] & 0x3F; v59 = 0; if ( v22 >= v23 + 1 ) v59 = v84; if ( v85 == v67 ) { v13 = v22 < v23; v14 = v22 == v23; v24 = v86; if ( !(v13 | v14) ) v24 = v79; v59 = v24; } else { v24 = v59; } if ( HIBYTE(v21) & 1 ) { if ( !v24 ) v24 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v55 = v23; v51 = v59; v47 = pGlobalTXT_LocalizationStrings[96]; } else { if ( !(v21 & 0xC0) ) { sprintf(pTmpBuf, "%s\r400%2d", pSkillNames[v63], v23); goto LABEL_58; } v25 = (v21 & 0x80u) != 0; v26 = pGlobalTXT_LocalizationStrings[432]; if ( !v25 ) v26 = pGlobalTXT_LocalizationStrings[433]; v89 = v26; if ( !v24 ) v24 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v55 = v23; v51 = v59; v47 = v89; } sprintf(pTmpBuf, "%s ", pSkillNames[v63], v24, v47, v51, v55); LABEL_58: pGUIWindow_CurrentMenu->DrawText(pFontLucida, 24, uYa, v59, pTmpBuf, 0, 0, 0); v17 = pGUIWindow_CurrentMenu; LABEL_59: v18 = v67++ + 1; } ++v81; } while ( (signed int)v81 < (signed int)pAwardsTextColors ); if ( !v71 ) v17->DrawText( pFontLucida, 24, LOBYTE(pFontLucida->uFontHeight) + uYa - 3, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); v27 = 2 * LOBYTE(pFontLucida->uFontHeight) + 13; sprintf(pTmpBuf, "%s\r177%s", pGlobalTXT_LocalizationStrings[11], pGlobalTXT_LocalizationStrings[131]); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 248, v27, a5, pTmpBuf, 0, 0, 0); v28 = pGUIWindow_CurrentMenu; v72 = 0; v82 = dword_4E2A18; do { v29 = 0; v68 = 0; v64 = *v82; while ( v68 < (signed int)v28->uNumControls ) { v30 = v28->pControlsHead; if ( v29 > 0 ) { do { v30 = v30->pNext; --v29; } while ( v29 ); } v31 = v30->field_1C; if ( SBYTE1(v31) >= 0 || (BYTE1(v31) &= 0x7Fu, v31 != v64) ) goto LABEL_89; v27 = v30->uY; ++v72; v60 = 0; v90 = pPlayer->pActiveSkills[v64]; v32 = pPlayer->uSkillPoints; v33 = pPlayer->pActiveSkills[v64] & 0x3F; uYb = v33; if ( v32 >= v33 + 1 ) v60 = v84; if ( v85 == v68 ) { v13 = v32 < v33; v14 = v32 == v33; v34 = v86; if ( !(v13 | v14) ) v34 = v79; v60 = v34; } else { v34 = v60; } if ( (pPlayer->pActiveSkills[v64] >> 8) & 1 ) { if ( !v34 ) v34 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v56 = uYb; v52 = v60; v48 = pGlobalTXT_LocalizationStrings[96]; } else { if ( !(v90 & 0xC0) ) { sprintf(pTmpBuf, "%s\r177%2d", pSkillNames[v64], uYb); goto LABEL_88; } v35 = pGlobalTXT_LocalizationStrings[432]; if ( (v90 & 0x80u) == 0 ) v35 = pGlobalTXT_LocalizationStrings[433]; v91 = v35; if ( !v34 ) v34 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v56 = uYb; v52 = v60; v48 = v91; } sprintf(pTmpBuf, "%s ", pSkillNames[v64], v34, v48, v52, v56); LABEL_88: pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, v27, v60, pTmpBuf, 0, 0, 0); v28 = pGUIWindow_CurrentMenu; LABEL_89: v29 = v68++ + 1; } ++v82; } while ( (signed int)v82 < (signed int)dword_4E2A2C ); if ( !v72 ) { v27 = v27 + LOBYTE(pFontLucida->uFontHeight) - 3; v28->DrawText(pFontLucida, 248, v27, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); } uYc = v27 + 2 * LOBYTE(pFontLucida->uFontHeight) - 10; sprintf(pTmpBuf, "%s\r177%s", pGlobalTXT_LocalizationStrings[143], pGlobalTXT_LocalizationStrings[131]); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 248, uYc, a5, pTmpBuf, 0, 0, 0); v36 = pGUIWindow_CurrentMenu; v73 = 0; v83 = dword_4E2A50; do { v37 = 0; v69 = 0; v38 = (GUIButton *)*v83; v65 = *v83; while ( v69 < (signed int)v36->uNumControls ) { v38 = v36->pControlsHead; if ( v37 > 0 ) { do { v38 = v38->pNext; --v37; } while ( v37 ); } v39 = v38->field_1C; if ( SBYTE1(v39) >= 0 || (BYTE1(v39) &= 0x7Fu, v39 != v65) ) goto LABEL_119; ++v73; uYc = v38->uY; v40 = pPlayer->pActiveSkills[v65]; v41 = pPlayer->uSkillPoints; v42 = pPlayer->pActiveSkills[v65] & 0x3F; v61 = 0; if ( v41 >= v42 + 1 ) v61 = v84; if ( v85 == v69 ) { v13 = v41 < v42; v14 = v41 == v42; v43 = v86; if ( !(v13 | v14) ) v43 = v79; v61 = v43; } else { v43 = v61; } if ( HIBYTE(v40) & 1 ) { if ( !v43 ) v43 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v57 = v42; v53 = v61; v49 = pGlobalTXT_LocalizationStrings[96]; } else { if ( !(v40 & 0xC0) ) { sprintf(pTmpBuf, "%s\r177%2d", pSkillNames[v65], v42); goto LABEL_118; } v25 = (v40 & 0x80u) != 0; v44 = pGlobalTXT_LocalizationStrings[432]; if ( !v25 ) v44 = pGlobalTXT_LocalizationStrings[433]; v92 = v44; if ( !v43 ) v43 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v57 = v42; v53 = v61; v49 = v92; } sprintf(pTmpBuf, "%s ", pSkillNames[v65], v43, v49, v53, v57); LABEL_118: LOBYTE(v38) = pGUIWindow_CurrentMenu->DrawText(pFontLucida, 248, uYc, v61, pTmpBuf, 0, 0, 0); v36 = pGUIWindow_CurrentMenu; LABEL_119: v37 = v69++ + 1; } ++v83; } while ( (signed int)v83 < (signed int)_4E2A80_skills ); if ( !v73 ) LOBYTE(v38) = v36->DrawText( pFontLucida, 248, LOBYTE(pFontLucida->uFontHeight) + uYc - 3, 0, pGlobalTXT_LocalizationStrings[153], 0, 0, 0); return (char)v38; } //----- (0041A000) -------------------------------------------------------- unsigned int __fastcall CharacterUI_AwardsTab_Draw(unsigned int uPlayerID) { unsigned int v1; // esi@1 unsigned int v2; // ebx@1 unsigned int v3; // eax@1 unsigned int result; // eax@1 int v5; // eax@15 char *v6; // ebx@15 int v7; // eax@23 int v8; // eax@24 int v9; // eax@25 int v10; // eax@27 int v11; // eax@32 int v12; // eax@33 int v13; // eax@34 signed int v14; // eax@43 unsigned int v15; // eax@43 int v16; // eax@43 int v17; // [sp-4h] [bp-D4h]@16 char Source[100]; // [sp+Ch] [bp-C4h]@1 GUIWindow a1; // [sp+70h] [bp-60h]@1 unsigned int v20; // [sp+C4h] [bp-Ch]@15 int v21; // [sp+C8h] [bp-8h]@14 int v22; // [sp+CCh] [bp-4h]@40 v1 = uPlayerID; v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v3 = pIcons_LOD->LoadTexture("fr_award", TEXTURE_16BIT_PALETTE); pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v3 != -1 ? (int)&pIcons_LOD->pTextures[v3] : 0)); sprintf(pTmpBuf, "%s ", pGlobalTXT_LocalizationStrings[23], v2);// TODO check args sprintf( Source, pGlobalTXT_LocalizationStrings[429], &stru_AA1058[3].pSounds[6972 * v1 + 40720], pClassNames[stru_AA1058[3].pSounds[6972 * v1 + 40737]]); strcat(pTmpBuf, Source); strcat(pTmpBuf, "\xC" "00000"); 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 && dword_506520 + dword_506528 < dword_506524 ) result = dword_506528++ + 1; if ( dword_506548 && result ) { --result; dword_506528 = result; } if ( dword_50651C < 0 ) { result += dword_506520; dword_506528 = result; if ( (signed int)(dword_506520 + result) <= dword_506524 ) goto LABEL_14; result = dword_506524 - dword_506520; goto LABEL_13; } if ( dword_50651C > 0 ) { result -= dword_506520; dword_506528 = result; if ( (result & 0x80000000u) != 0 ) { result = 0; LABEL_13: dword_506528 = result; goto LABEL_14; } } LABEL_14: dword_506544 = 0; dword_506548 = 0; dword_506520 = 0; dword_50651C = 0; v21 = result; if ( (signed int)result < dword_506524 ) { while ( 1 ) { v5 = pStru179->field_0[v21]; v20 = 8 * pStru179->field_0[v21]; v6 = (char *)dword_723E80_award_related[v20 / 4]; if ( v5 != 1 ) break; v17 = pParty->uFine; LABEL_42: sprintf(pTmpBuf, v6, v17); v6 = pTmpBuf; LABEL_43: v14 = dword_723E84[v20 / 4]; ++dword_506520; v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat( pAwardsTextColors[3 * v14 % 6], pAwardsTextColors[3 * v14 % 6 + 1], pAwardsTextColors[3 * v14 % 6 + 2]); a1.DrawText(pFontArrus, 0, 0, v15, v6, 0, 0, 0); v16 = pFontArrus->CalcTextHeight(v6, &a1, 0, 0); result = v16 + a1.uFrameY + 4; if ( (signed int)result <= (signed int)a1.uFrameHeight ) { ++v21; a1.uFrameY = result; result = v21; if ( v21 < dword_506524 ) continue; } return result; } if ( (v5 < 85 || v5 > 91) && (v5 < 103 || v5 > 104) ) goto LABEL_43; if ( v5 > 89 ) { v11 = v5 - 90; if ( !v11 ) { v10 = (unsigned __int8)pParty->uNumArenaKnightWins; goto LABEL_40; } v12 = v11 - 1; if ( !v12 ) { v10 = (unsigned __int8)pParty->uNumArenaLordWins; goto LABEL_40; } v13 = v12 - 12; if ( !v13 ) { v10 = pParty->field_874; goto LABEL_40; } if ( v13 == 1 ) { v10 = pParty->field_878; goto LABEL_40; } } else { if ( v5 == 89 ) { v10 = (unsigned __int8)pParty->uNumArenaSquireWins; goto LABEL_40; } v7 = v5 - 85; if ( !v7 ) { v10 = pParty->uNumDeaths; goto LABEL_40; } v8 = v7 - 1; if ( !v8 ) { v10 = pParty->uNumBountiesCollected; goto LABEL_40; } v9 = v8 - 1; if ( !v9 ) { v10 = pParty->uNumPrisonTerms; goto LABEL_40; } if ( v9 == 1 ) { v10 = (unsigned __int8)pParty->uNumArenaPageWins; LABEL_40: v22 = v10; goto LABEL_41; } } LABEL_41: v17 = v22; goto LABEL_42; } return result; } // 50651C: using guessed type int dword_50651C; // 506520: using guessed type int dword_506520; // 506524: using guessed type int dword_506524; // 506528: using guessed type int dword_506528; // 506544: using guessed type int dword_506544; // 506548: using guessed type int dword_506548; // 723E80: using guessed type int dword_723E80_award_related[]; // 723E84: using guessed type int dword_723E84[]; //----- (0041A2C1) -------------------------------------------------------- unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels) { if ( (signed int)uNumPixels < 14 ) uNumPixels = 14; return ((signed int)(uNumPixels - 14) >> 5) + 1; } //----- (0041A2D1) -------------------------------------------------------- void __fastcall CharacterUI_InventoryTab_Draw(unsigned int uPlayerID, char a2) { Player *v2; // esi@1 char v3; // bl@1 unsigned int v4; // eax@2 ItemGen *v5; // ebx@5 unsigned int v6; // eax@6 Texture *v7; // esi@6 __int16 v8; // ax@6 signed int v9; // edi@6 signed int v10; // ecx@6 signed int v11; // edx@6 signed int v12; // eax@11 int v13; // eax@13 signed int v14; // edx@13 int v15; // eax@13 unsigned int v16; // ebx@15 unsigned int v17; // edi@15 Texture *v18; // ebx@24 double v19; // st7@26 const char *v20; // [sp-8h] [bp-40h]@20 Player *v21; // [sp+14h] [bp-24h]@1 int uTextureId; // [sp+18h] [bp-20h]@6 int *v23; // [sp+1Ch] [bp-1Ch]@1 int v24; // [sp+20h] [bp-18h]@5 ItemGen *v25; // [sp+24h] [bp-14h]@5 int v26; // [sp+28h] [bp-10h]@3 signed int v27; // [sp+2Ch] [bp-Ch]@3 int a2a; // [sp+30h] [bp-8h]@5 int a3; // [sp+34h] [bp-4h]@5 v23 = pRenderer->pActiveZBuffer; v2 = pPlayers[uPlayerID]; v3 = a2; v21 = pPlayers[uPlayerID]; pRenderer->DrawTextureIndexed( 8u, 8u, (Texture *)(uTextureID_507958 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507958] : 0)); if ( v3 ) { v4 = pIcons_LOD->LoadTexture("fr_strip", TEXTURE_16BIT_PALETTE); pRenderer->DrawTextureIndexed(8u, 0x131u, (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0)); } v27 = 0; v26 = (int)v2->pInventoryIndices; do { if ( *(int *)v26 > 0 ) { v24 = *(int *)v26 - 1; a3 = 32 * v27 / 14 + 17; v5 = &v2->pInventoryItems[v24]; a2a = 32 * v27 % 14 + 14; v25 = v5; if ( v5->uItemID ) { v6 = pIcons_LOD->LoadTexture( pItemsTable->pItems[v5->uItemID].pIconName, TEXTURE_16BIT_PALETTE); uTextureId = v6; v7 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); v8 = (v6 != -1 ? pIcons_LOD->pTextures[v6].uTextureWidth : 24); v9 = v7->uTextureHeight; v10 = v7->uTextureWidth; v11 = v7->uTextureWidth; if ( v10 < 14 ) v11 = 14; if ( (v11 - 14) >> 5 == 0 && v8 < 32 ) a2a += (32 - v10) / 2; v12 = v7->uTextureWidth; if ( v10 < 14 ) v12 = 14; v13 = v12 - 14; v14 = v7->uTextureHeight; LOBYTE(v13) = v13 & 0xE0; v15 = v13 + 32; if ( v9 < 14 ) v14 = 14; v16 = v5->uAttributes; v17 = a2a + ((v15 - v10) >> 1) + pSRZBufferLineOffsets[a3 + ((((v14 - 14) & 0xFFFFFFE0) - v9 + 32) >> 1)]; if ( !(v16 & 0xF0) ) { if ( v16 & 1 || pCurrentScreen != 13 ) { if ( v16 & 2 ) pRenderer->_4A6776(a2a, a3, v7); else pRenderer->DrawTextureTransparent(a2a, a3, v7); } else { pRenderer->DrawTransparentGreenShade(a2a, a3, v7); } goto LABEL_33; } if ( (unsigned __int8)(v16 & 0xF0) != 16 ) { if ( (unsigned __int8)(v16 & 0xF0) == 32 ) { v20 = "sp28a"; goto LABEL_24; } if ( (unsigned __int8)(v16 & 0xF0) == 64 ) { v20 = "sp30a"; goto LABEL_24; } if ( (unsigned __int8)(v16 & 0xF0) == 128 ) { v20 = "sp91a"; LABEL_24: v18 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v20, TEXTURE_16BIT_PALETTE)]; dword_50C9A8 -= pEventTimer->uTimeElapsed; if ( dword_50C9A8 <= 0 ) { dword_50C9A8 = 0; LOBYTE(v25->uAttributes) &= 0xFu; ptr_50C9A4 = 0; } v19 = (double)GetTickCount() * 0.1; pRenderer->_4A63E6(a2a, a3, v7, v18, (signed __int64)v19, 0, 255); LABEL_33: ZBuffer_Fill(&v23[v17], uTextureId, v24 + 1); v2 = v21; goto LABEL_34; } } v20 = "sptext01"; goto LABEL_24; } } LABEL_34: ++v27; v26 += 4; } while ( v27 < 126 ); } // 4E28F8: using guessed type int pCurrentScreen; // 507958: using guessed type int uTextureID_507958; // 50C9A8: using guessed type int dword_50C9A8; //----- (0041A556) -------------------------------------------------------- void __cdecl draw_leather() { pRenderer->DrawTextureIndexed( 8u, 8u, (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0)); } //----- (0041A57E) -------------------------------------------------------- char __cdecl 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 v0 = 0; v47 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v49 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0); v46 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0); v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE); pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v1 != -1 ? (int)&pIcons_LOD->pTextures[v1] : 0)); 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); 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 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(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->uClass], 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 ); v38 = GetPartyReputation(); if ( v38 >= 0 ) { v39 = v49; if ( v38 <= 5 ) v39 = 65535; } else { v39 = v46; } v40 = GetReputationString(v38); sprintf(pTmpBuf, "%s: ", pGlobalTXT_LocalizationStrings[180], v39, v40); pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0); v41 = pParty->GetPartyFame(); sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], v41);// Fame return pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0); } //----- (0041ABFD) -------------------------------------------------------- void __thiscall CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx) { unsigned int v1; // edi@1 unsigned int v2; // eax@6 Texture *v3; // ecx@6 GUIButton *v4; // eax@6 unsigned int v5; // eax@7 unsigned int v6; // eax@10 unsigned int v7; // eax@11 v1 = uPlayerIdx; if ( uPlayerIdx ) { pRenderer->ClearZBuffer(0, 479); switch ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] ) { case 0x64: // stats sub_4196A0(); sub_419379(); CharacterUI_StatsTab_Draw(v1); v7 = pIcons_LOD->LoadTexture("ib-cd1-d", TEXTURE_16BIT_PALETTE); v3 = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0); v4 = pCharacterScreen_StatsBtn; break; case 0x65: // skills if ( dword_507CC0 != uActiveCharacter ) { sub_4196A0(); sub_419401(); } sub_419379(); CharacterUI_SkillsTab_Draw(v1); v6 = pIcons_LOD->LoadTexture("ib-cd2-d", TEXTURE_16BIT_PALETTE); v3 = (Texture *)(v6 != -1 ? (int)&pIcons_LOD->pTextures[v6] : 0); v4 = pCharacterScreen_SkillsBtn; break; case 0x66: // awards sub_4196A0(); sub_419379(); sub_419220(); CharacterUI_AwardsTab_Draw(v1); v5 = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE); v3 = (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0); v4 = pCharacterScreen_AwardsBtn; break; default: if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] != 103 ) goto LABEL_13; sub_4196A0(); sub_419379(); CharacterUI_InventoryTab_Draw(v1, 0); v2 = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE); v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0); v4 = pCharacterScreen_InventoryBtn; break; } pRenderer->DrawTextureIndexed(v4->uX, v4->uY, v3); LABEL_13: if ( bRingsShownInCharScreen ) CharacterUI_DrawPaperdollWithRingOverlay(v1); else CharacterUI_DrawPaperdoll(v1); } } // 507CC0: using guessed type int dword_507CC0; // 5118E0: using guessed type int bRingsShownInCharScreen; //----- (0041AD6E) -------------------------------------------------------- void __cdecl GameUI_DrawRightPanelItems() { if ( (signed int)((pParty->uTimePlayed - qword_507CC8) >> 32) <= 0 && (((pParty->uTimePlayed - qword_507CC8) >> 32) & 0x80000000u) != 0i64 ) qword_507CC8 = 0i64; if ( (((pParty->uTimePlayed - qword_507CC8) >> 32) & 0x80000000u) == 0i64 && (!(SHIDWORD(pParty->uTimePlayed) < (LODWORD(pParty->uTimePlayed) < (unsigned int)qword_507CC8) + HIDWORD(qword_507CC8) | (pParty->uTimePlayed - qword_507CC8) >> 32 == 0) || (unsigned int)(LODWORD(pParty->uTimePlayed) - qword_507CC8) > 0x80) ) { qword_507CC8 = pParty->uTimePlayed; byte_50697C = byte_50697C == 0; if ( byte_50697C && pCurrentScreen != 5 ) { if ( bFlashQuestBook ) pRenderer->DrawTextureTransparent( 493u, 355u, (Texture *)(uTextureID_ib_td1_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td1_A] : 0)); if ( bFlashAutonotesBook ) pRenderer->DrawTextureTransparent( 527u, 353u, (Texture *)(uTextureID_ib_td2_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td2_A] : 0)); if ( bFlashHistoryBook ) pRenderer->DrawTextureTransparent( 600u, 361u, (Texture *)(uTextureID_ib_td5_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td5_A] : 0)); } else { pRenderer->DrawTextureRGB(468u, 0, pTexture_RightFrame); DrawHiredNPCs(); } } } //----- (0041AEBB) -------------------------------------------------------- void __cdecl GameUI_DrawFoodAndGold() { unsigned int v0; // ebx@2 unsigned int v1; // ebp@2 int v2; // esi@2 if ( uGameState != GAME_STATE_FINAL_WINDOW ) { v0 = uGameUIFontMain; v1 = uGameUIFontShadow; v2 = sub_44100D() != 0 ? 381 : 322; sprintf(pTmpBuf, "\r087%lu", pParty->uNumFoodRations); pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, v0, pTmpBuf, 0, 0, v1); sprintf(pTmpBuf, "\r028%lu", pParty->uNumGold); pPrimaryWindow->DrawText(pFontSmallnum, 0, v2, v0, pTmpBuf, 0, 0, v1); } } //----- (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; LABEL_9: v9 = v7; goto LABEL_10; } if ( v5 <= (signed int)(signed __int64)(v6 * 0.67) ) { v7 = uTextureID_mhp_yel; goto LABEL_9; } } LABEL_10: v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2; pRenderer->Clip(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52); pRenderer->DrawTextureIndexed( v8, v3->uFrameY + 32, (Texture *)(uTextureID_mhp_bd != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_bd] : 0)); pRenderer->Clip(v8, v3->uFrameY + 32, v8 + v10, v3->uFrameY + 52); pRenderer->DrawTextureIndexed( v8, v3->uFrameY + 34, (Texture *)(v9 != -1 ? (int)&pIcons_LOD->pTextures[v9] : 0)); pRenderer->ResetClip(); pRenderer->DrawTextureIndexed( v8 - 5, v3->uFrameY + 32, (Texture *)(uTextureID_mhp_capl != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_capl] : 0)); pRenderer->DrawTextureIndexed( v8 + v4, v3->uFrameY + 32, (Texture *)(uTextureID_mhp_capr != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_capr] : 0)); } //----- (0041B0C9) -------------------------------------------------------- void __cdecl 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 v0 = (Texture *)(uTextureID_BarGreen != -1 ? &pIcons_LOD->pTextures[uTextureID_BarGreen] : 0); v14 = (Texture *)(uTextureID_BarYellow != -1 ? &pIcons_LOD->pTextures[uTextureID_BarYellow] : 0); v13 = (Texture *)(uTextureID_BarRed != -1 ? &pIcons_LOD->pTextures[uTextureID_BarRed] : 0); v16 = 0; v10 = (Texture *)(uTextureID_BarBlue != -1 ? &pIcons_LOD->pTextures[uTextureID_BarBlue] : 0); v15 = (double)(uTextureID_BarGreen != -1 ? pIcons_LOD->pTextures[uTextureID_BarGreen].uTextureHeight : 26); do { v1 = &pParty->pPlayers[v16]; v11 = v1; if ( v1->sHealth <= 0 ) goto LABEL_24; v11 = &pParty->pPlayers[v16]; v2 = (double)v1->sHealth; v3 = v2 / (double)v1->GetMaxHealth(); if ( v3 <= 0.5 ) { if ( v3 <= 0.25 ) { if ( v3 <= 0.0 ) goto LABEL_24; if ( v16 == 2 || v16 == 3 ) v17 = 2; else v17 = 0; pRenderer->Clip( v17 + pHealthBarPos[v16], (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, v17 + pHealthBarPos[v16] + v13->uTextureWidth, v13->uTextureHeight + 402); v9 = v13; } else { if ( v16 == 2 || v16 == 3 ) v17 = 2; else v17 = 0; pRenderer->Clip( 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 > 1.0 ) v3 = 1.0; v4 = (signed __int64)((1.0 - v3) * v15); if ( v16 == 2 || v16 == 3 ) v17 = 2; else v17 = 0; pRenderer->Clip( v17 + pHealthBarPos[v16], v4 + 402, v17 + pHealthBarPos[v16] + v0->uTextureWidth, v0->uTextureHeight + 402); v9 = v0; } pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[v16], 0x192u, v9); pRenderer->ResetClip(); LABEL_24: v5 = v11; v12 = v11->sMana; if ( v12 > 0 ) { v6 = (double)v12; v7 = v6 / (double)v5->GetMaxMana(); if ( v7 > 1.0 ) v7 = 1.0; v8 = v16 == 2; pRenderer->Clip( (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); pRenderer->ResetClip(); } ++v16; } while ( v16 < 4 ); } //----- (0041B3B6) -------------------------------------------------------- void __cdecl draw_right_panel() { pRenderer->DrawTextureTransparent( pViewport->uViewportZ, 0, (Texture *)(uTextureID_right_panel != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_right_panel] : 0)); } //----- (0041B3E2) -------------------------------------------------------- void __cdecl 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); GameUI_DrawFoodAndGold(); GameUI_DrawRightPanelItems(); } //----- (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 ) { v6 = result->uControlParam; 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]; //----- (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; } // 5075E0: using guessed type int pVisibleWindowsIdxs[20]; //----- (0041B578) -------------------------------------------------------- void __cdecl MainMenuUI_LoadFontsAndSomeStuff() { pIcons_LOD->SetupPalettes(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); pPaletteManager->SetColorChannelInfo(pRenderer->uTargetRBits, pRenderer->uTargetGBits, pRenderer->uTargetBBits); pPaletteManager->RecalculateAll(); for (uint i = 0; i < 480; ++i) pSRZBufferLineOffsets[i] = 640 * i; pRenderer->ResetClip(); uTextureID_FONTPAL = pIcons_LOD->LoadTexture("FONTPAL", TEXTURE_16BIT_PALETTE); pFontArrus = LoadFont("arrus.fnt", "FONTPAL", 0); pFontLucida = LoadFont("lucida.fnt", "FONTPAL", 0); pFontCreate = LoadFont("create.fnt", "FONTPAL", 0); pFontSmallnum = LoadFont("smallnum.fnt", "FONTPAL", 0); pFontComic = LoadFont("comic.fnt", "FONTPAL", 0); pFontArrus->field_3 = 0; pFontLucida->field_3 = 0; pFontCreate->field_3 = 0; for (uint i = 0; i < 20; ++i) pWindowList[i].eWindowType = WINDOW_null; uNumVisibleWindows = -1; memset(pVisibleWindowsIdxs, 0, sizeof(pVisibleWindowsIdxs)); } //----- (0041B690) -------------------------------------------------------- void __cdecl MainMenuUI_Create() { unsigned int v0; // eax@1 unsigned int v1; // eax@1 unsigned int v2; // eax@1 unsigned int v3; // eax@1 unsigned int v4; // eax@1 unsigned int v5; // eax@1 Texture *v6; // ST78_4@1 const char *v7; // ST5C_4@1 unsigned __int8 v8; // al@1 //Texture *v9; // ST60_4@1 Texture *v10; // ST78_4@1 const char *v11; // ST5C_4@1 unsigned __int8 v12; // al@1 //Texture *v13; // ST60_4@1 unsigned int v14; // eax@1 Texture *v15; // ST78_4@1 const char *v16; // ST5C_4@1 unsigned __int8 v17; // al@1 //Texture *v18; // ST60_4@1 unsigned int uTextureID_ib_td4_A; // eax@1 Texture *v20; // ST78_4@1 const char *v21; // ST5C_4@1 unsigned __int8 v22; // al@1 //Texture *v23; // ST60_4@1 Texture *v24; // eax@1 Texture *v25; // esi@1 Texture *v26; // ST60_4@1 const char *v27; // ST5C_4@1 unsigned __int8 v28; // al@1 Texture *v29; // eax@1 Texture *v30; // esi@1 Texture *v31; // ST60_4@1 const char *v32; // ST5C_4@1 unsigned __int8 v33; // al@1 v0 = pIconsFrameTable->FindIcon("wizeyeC"); pIconsFrameTable->InitializeAnimation(v0); v1 = pIconsFrameTable->FindIcon("wizeyeB"); pIconsFrameTable->InitializeAnimation(v1); v2 = pIconsFrameTable->FindIcon("wizeyeA"); pIconsFrameTable->InitializeAnimation(v2); v3 = pIconsFrameTable->FindIcon("torchC"); pIconsFrameTable->InitializeAnimation(v3); v4 = pIconsFrameTable->FindIcon("torchB"); pIconsFrameTable->InitializeAnimation(v4); v5 = pIconsFrameTable->FindIcon("torchA"); pIconsFrameTable->InitializeAnimation(v5); pTextureIDs_pMapDirs[0] = pIcons_LOD->LoadTexture("MAPDIR8", TEXTURE_16BIT_PALETTE); pTextureIDs_pMapDirs[1] = pIcons_LOD->LoadTexture("MAPDIR1", TEXTURE_16BIT_PALETTE); pTextureIDs_pMapDirs[2] = pIcons_LOD->LoadTexture("MAPDIR2", TEXTURE_16BIT_PALETTE); pTextureIDs_pMapDirs[3] = pIcons_LOD->LoadTexture("MAPDIR3", TEXTURE_16BIT_PALETTE); pTextureIDs_pMapDirs[4] = pIcons_LOD->LoadTexture("MAPDIR4", TEXTURE_16BIT_PALETTE); pTextureIDs_pMapDirs[5] = pIcons_LOD->LoadTexture("MAPDIR5", TEXTURE_16BIT_PALETTE); pTextureIDs_pMapDirs[6] = pIcons_LOD->LoadTexture("MAPDIR6", TEXTURE_16BIT_PALETTE); pTextureIDs_pMapDirs[7] = pIcons_LOD->LoadTexture("MAPDIR7", TEXTURE_16BIT_PALETTE); uTextureID_BarBlue = pIcons_LOD->LoadTexture("ib-statB", TEXTURE_16BIT_PALETTE); uTextureID_BarGreen = pIcons_LOD->LoadTexture("ib-statG", TEXTURE_16BIT_PALETTE); uTextureID_BarYellow = pIcons_LOD->LoadTexture("ib-statY", TEXTURE_16BIT_PALETTE); uTextureID_BarRed = pIcons_LOD->LoadTexture("ib-statR", TEXTURE_16BIT_PALETTE); uTextureID_mhp_bd = pIcons_LOD->LoadTexture("mhp_bg", TEXTURE_16BIT_PALETTE); uTextureID_mhp_capl = pIcons_LOD->LoadTexture("mhp_capl", TEXTURE_16BIT_PALETTE); uTextureID_mhp_capr = pIcons_LOD->LoadTexture("mhp_capr", TEXTURE_16BIT_PALETTE); uTextureID_mhp_grn = pIcons_LOD->LoadTexture("mhp_grn", TEXTURE_16BIT_PALETTE); uTextureID_mhp_red = pIcons_LOD->LoadTexture("mhp_red", TEXTURE_16BIT_PALETTE); uTextureID_mhp_yel = pIcons_LOD->LoadTexture("mhp_yel", TEXTURE_16BIT_PALETTE); uTextureID_Leather = pIcons_LOD->LoadTexture("LEATHER", TEXTURE_16BIT_PALETTE); pTexture_Leather = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("ibground", TEXTURE_16BIT_PALETTE)]; uTextureID_x_x_u = pIcons_LOD->LoadTexture("x_x_u", TEXTURE_16BIT_PALETTE); uTextureID_BUTTDESC2 = pIcons_LOD->LoadTexture("BUTTESC2", TEXTURE_16BIT_PALETTE); uTextureID_x_ok_u = pIcons_LOD->LoadTexture("x_ok_u", TEXTURE_16BIT_PALETTE); uTextureID_BUTTYES2 = pIcons_LOD->LoadTexture("BUTTYES2", TEXTURE_16BIT_PALETTE); uTextureID_BUTTMAKE = pIcons_LOD->LoadTexture("BUTTMAKE", TEXTURE_16BIT_PALETTE); uTextureID_BUTTMAKE2 = pIcons_LOD->LoadTexture("BUTTMAKE2", TEXTURE_16BIT_PALETTE); pPrimaryWindow = GUIWindow::Create(0, 0, 640, 480, WINDOW_MainMenu, 0, 0); pPrimaryWindow->CreateButton(7u, 8u, 0x1CCu, 0x157u, 1, 0, 0xAu, 0, 0, "", 0); pPrimaryWindow->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); pPrimaryWindow->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); pPrimaryWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); pPrimaryWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0x28u, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); pPrimaryWindow->CreateButton(0x18u, 0x194u, 5u, 0x31u, 1, 93, 0, 1u, 0, "", 0); pPrimaryWindow->CreateButton(0x8Bu, 0x194u, 5u, 0x31u, 1, 93, 0, 2u, 0, "", 0); pPrimaryWindow->CreateButton(0xFFu, 0x194u, 5u, 0x31u, 1, 93, 0, 3u, 0, "", 0); pPrimaryWindow->CreateButton(0x172u, 0x194u, 5u, 0x31u, 1, 93, 0, 4u, 0, "", 0); pPrimaryWindow->CreateButton(0x61u, 0x194u, 5u, 0x31u, 1, 93, 0, 1u, 0, "", 0); pPrimaryWindow->CreateButton(0xD4u, 0x194u, 5u, 0x31u, 1, 93, 0, 2u, 0, "", 0); pPrimaryWindow->CreateButton(0x148u, 0x194u, 5u, 0x31u, 1, 93, 0, 3u, 0, "", 0); pPrimaryWindow->CreateButton(0x1BBu, 0x194u, 5u, 0x31u, 1, 93, 0, 4u, 0, "", 0); uTextureID_ib_td1_A = pIcons_LOD->LoadTexture("ib-td1-A", TEXTURE_16BIT_PALETTE); v6 = (Texture *)(uTextureID_ib_td1_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td1_A] : 0); v7 = pGlobalTXT_LocalizationStrings[174]; v8 = pKeyActionMap->GetActionVKey(INPUT_Quest); pBtn_Quests = pPrimaryWindow->CreateButton( 0x1EBu, 0x161u, v6->uTextureWidth, v6->uTextureHeight, 1, 0, 0xC8u, 0, v8, v7, v6, 0); uTextureID_ib_td2_A = pIcons_LOD->LoadTexture("ib-td2-A", TEXTURE_16BIT_PALETTE); v10 = (Texture *)(uTextureID_ib_td2_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td2_A] : 0); v11 = pGlobalTXT_LocalizationStrings[154]; v12 = pKeyActionMap->GetActionVKey(INPUT_Autonotes); pBtn_Autonotes = pPrimaryWindow->CreateButton( 0x20Fu, 0x161u, v10->uTextureWidth, v10->uTextureHeight, 1, 0, 0xC9u, 0, v12, v11, v10); v14 = pIcons_LOD->LoadTexture("ib-td3-A", TEXTURE_16BIT_PALETTE); v15 = (Texture *)(v14 != -1 ? (int)&pIcons_LOD->pTextures[v14] : 0); v16 = pGlobalTXT_LocalizationStrings[139]; v17 = pKeyActionMap->GetActionVKey(INPUT_Mapbook); pBtn_Maps = pPrimaryWindow->CreateButton( 0x222u, 0x161u, v15->uTextureWidth, v15->uTextureHeight, 1, 0, 0xCAu, 0, v17, v16, v15); uTextureID_ib_td4_A = pIcons_LOD->LoadTexture("ib-td4-A", TEXTURE_16BIT_PALETTE); v20 = (Texture *)(uTextureID_ib_td4_A != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_ib_td4_A] : 0); v21 = pGlobalTXT_LocalizationStrings[78]; v22 = pKeyActionMap->GetActionVKey(INPUT_TimeCal); pBtn_Calendar = pPrimaryWindow->CreateButton( 0x23Au, 0x161u, v20->uTextureWidth, v20->uTextureHeight, 1, 0, 0xCBu, 0, v22, v21, v20); uTextureID_ib_td5_A = pIcons_LOD->LoadTexture("ib-td5-A", TEXTURE_16BIT_PALETTE); pBtn_History = pPrimaryWindow->CreateButton( 0x258u, 0x169u, (uTextureID_ib_td5_A != -1 ? pIcons_LOD->pTextures[uTextureID_ib_td5_A].uTextureWidth : 24), (uTextureID_ib_td5_A != -1 ? pIcons_LOD->pTextures[uTextureID_ib_td5_A].uTextureHeight : 26), 1, 0, 0xE0u, 0, 0x48u, pGlobalTXT_LocalizationStrings[602], (Texture *)(uTextureID_ib_td5_A != -1 ? &pIcons_LOD->pTextures[uTextureID_ib_td5_A] : 0), 0); v24 = &pIcons_LOD->pTextures[uTextureID_507980]; v25 = (Texture *)(uTextureID_507980 != -1 ? (int)v24 : 0); bFlashHistoryBook = 0; v26 = (Texture *)(uTextureID_507980 != -1 ? (int)v24 : 0); bFlashAutonotesBook = 0; v27 = pGlobalTXT_LocalizationStrings[252]; bFlashQuestBook = 0; v28 = pKeyActionMap->GetActionVKey(INPUT_ZoomIn); dword_507A18 = pPrimaryWindow->CreateButton( 0x23Eu, 0x88u, v25->uTextureWidth, v25->uTextureHeight, 2, 0, 0x170u, 0, v28, v27, v26, 0); v29 = &pIcons_LOD->pTextures[uTextureID_507984]; v30 = (Texture *)(uTextureID_507984 != -1 ? (int)v29 : 0); v31 = (Texture *)(uTextureID_507984 != -1 ? (int)v29 : 0); v32 = pGlobalTXT_LocalizationStrings[251]; v33 = pKeyActionMap->GetActionVKey(INPUT_ZoomOut); dword_507A14 = pPrimaryWindow->CreateButton( 0x207u, 0x88u, v30->uTextureWidth, v30->uTextureHeight, 2, 0, 0x16Fu, 0, v33, v32, v31, 0); pPrimaryWindow->CreateButton(0x1E1u, 0, 0x99u, 0x43u, 1, 92, 0, 0, 0, "", 0); pPrimaryWindow->CreateButton(0x1EBu, 0x95u, 0x40u, 0x4Au, 1, 0, 0x86u, 0, 0x35u, "", 0); pPrimaryWindow->CreateButton(0x231u, 0x95u, 0x40u, 0x4Au, 1, 0, 0x87u, 0, 0x36u, "", 0); pPrimaryWindow->CreateButton(0x1DCu, 0x142u, 0x4Du, 0x11u, 1, 100, 0, 0, 0, "", 0); pPrimaryWindow->CreateButton(0x22Bu, 0x142u, 0x4Du, 0x11u, 1, 101, 0, 0, 0, "", 0); pBtn_CastSpell = pPrimaryWindow->CreateButton( 0x1DCu, 0x1C2u, (uTextureID_50797C != -1 ? pIcons_LOD->pTextures[uTextureID_50797C].uTextureWidth : 24), (uTextureID_50797C != -1 ? pIcons_LOD->pTextures[uTextureID_50797C].uTextureHeight : 26), 1, 0, 0x69u, 0, 0x43u, pGlobalTXT_LocalizationStrings[38], (Texture *)(uTextureID_50797C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50797C] : 0), 0); pBtn_Rest = pPrimaryWindow->CreateButton( 0x206u, 0x1C2u, (uTextureID_507978 != -1 ? pIcons_LOD->pTextures[uTextureID_507978].uTextureWidth : 24), (uTextureID_507978 != -1 ? pIcons_LOD->pTextures[uTextureID_507978].uTextureHeight : 26), 1, 0, 0x68u, 0, 0x52u, pGlobalTXT_LocalizationStrings[182], (Texture *)(uTextureID_507978 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507978] : 0), 0); pBtn_QuickReference = pPrimaryWindow->CreateButton( 0x230u, 0x1C2u, (dword_507974 != -1 ? pIcons_LOD->pTextures[dword_507974].uTextureWidth : 24), (dword_507974 != -1 ? pIcons_LOD->pTextures[dword_507974].uTextureHeight : 26), 1, 0, 0x6Au, 0, 0x5Au, pGlobalTXT_LocalizationStrings[173], (Texture *)(dword_507974 != -1 ? &pIcons_LOD->pTextures[dword_507974] : 0), 0); pBtn_GameSettings = pPrimaryWindow->CreateButton( 0x25Au, 0x1C2u, (uTextureID_507970 != -1 ? pIcons_LOD->pTextures[uTextureID_507970].uTextureWidth : 24), (uTextureID_507970 != -1 ? pIcons_LOD->pTextures[uTextureID_507970].uTextureHeight : 26), 1, 0, 0x6Bu, 0, 0, pGlobalTXT_LocalizationStrings[93], (Texture *)(uTextureID_507970 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507970] : 0), 0); pBtn_NPCLeft = pPrimaryWindow->CreateButton( 0x1D5u, 0xB2u, (uTextureID_507990 != -1 ? pIcons_LOD->pTextures[uTextureID_507990].uTextureWidth : 24), (uTextureID_507990 != -1 ? pIcons_LOD->pTextures[uTextureID_507990].uTextureHeight : 26), 1, 0, 0xBCu, 0, 0, "", (Texture *)(uTextureID_507990 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507990] : 0), 0); pBtn_NPCRight = pPrimaryWindow->CreateButton( 0x272u, 0xB2u, (uTextureID_50798C != -1 ? pIcons_LOD->pTextures[uTextureID_50798C].uTextureWidth : 24), (uTextureID_50798C != -1 ? pIcons_LOD->pTextures[uTextureID_50798C].uTextureHeight : 26), 1, 0, 0xBCu, 1u, 0, "", (Texture *)(uTextureID_50798C != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_50798C] : 0), 0); Load_isn_spells_21_27(); } //----- (0041C047) -------------------------------------------------------- void __cdecl GameUI_DrawStatusBar_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_StatusBar_TimedStringTimeLeft ) { v1 = GameUI_StatusBar_TimedString; } else { if ( !pStatusBarString[0] ) return; v1 = pStatusBarString; } 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) { 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_StatusBar_TimedStringTimeLeft) ) { if ( GameUI_StatusBar_TimedStringTimeLeft ) { for ( i = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString); i > 450; i = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString) ) byte_5C3427[strlen(GameUI_StatusBar_TimedString)] = 0; } else { strcpy(pStatusBarString, v1); for ( j = pFontLucida->GetLineWidth(pStatusBarString); j > 450; j = pFontLucida->GetLineWidth(pStatusBarString) ) GameUI_StatusBar_TimedString[strlen(pStatusBarString) + 199] = 0; } } } //----- (0041C179) -------------------------------------------------------- void __cdecl GameUI_DrawStatusBar() { unsigned int v0; // ebp@1 char *v1; // edi@5 int v2; // eax@5 unsigned int v3; // esi@5 size_t v4; // eax@6 GUIFont *v5; // ecx@6 int v6; // eax@9 size_t v7; // eax@10 GUIFont *v8; // ecx@10 char v9; // zf@12 unsigned int v10; // ST08_4@13 int v11; // eax@13 v0 = uGameUIFontShadow; if ( pStatusBarString[0] || GameUI_StatusBar_TimedStringTimeLeft || bForceDrawStatusBar ) { pRenderer->DrawTextureRGB(0, 352u, pTexture_StatusBar); if ( GameUI_StatusBar_TimedStringTimeLeft ) { v1 = GameUI_StatusBar_TimedString; v2 = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString); v3 = 450; while ( v2 > 450 ) { v4 = strlen(GameUI_StatusBar_TimedString); v5 = pFontLucida; byte_5C3427[v4] = 0; v2 = pFontLucida->GetLineWidth(GameUI_StatusBar_TimedString); } } else { v1 = pStatusBarString; v6 = pFontLucida->GetLineWidth(pStatusBarString); v3 = 450; while ( v6 > 450 ) { v7 = strlen(pStatusBarString); v8 = pFontLucida; GameUI_StatusBar_TimedString[v7 + 199] = 0; v6 = pFontLucida->GetLineWidth(pStatusBarString); } } v9 = *v1 == 0; bForceDrawStatusBar = 0; if ( !v9 ) { v10 = uGameUIFontMain; v11 = pFontLucida->AlignText_Center(v3, v1); pPrimaryWindow->DrawText(pFontLucida, v11 + 11, 357, v10, v1, 0, 0, v0); } } } // 5C35BC: using guessed type int bForceDrawStatusBar; //----- (0041CD4F) -------------------------------------------------------- bool __thiscall sub_41CD4F(unsigned int _this) { unsigned int v1; // edi@1 unsigned int v2; // eax@2 int v3; // esi@3 int v4; // ecx@10 GUIButton *v5; // eax@11 int v6; // edx@12 int v7; // ecx@20 char v8; // zf@21 GUIButton *v9; // ecx@24 int v10; // esi@24 int v11; // edx@26 int v12; // edx@28 int v13; // esi@32 GUIButton *v14; // eax@37 int v15; // edx@38 int v17; // ecx@50 int v18; // edx@50 GUIButton *v19; // ecx@54 int v20; // esi@54 int v21; // edx@56 int v22; // ecx@59 int v23; // edx@59 int v24; // ecx@60 int v25; // esi@63 unsigned int v26; // [sp+Ch] [bp-14h]@1 int v27; // [sp+10h] [bp-10h]@1 int v28; // [sp+14h] [bp-Ch]@10 int v29; // [sp+14h] [bp-Ch]@36 unsigned int uClickX; // [sp+18h] [bp-8h]@10 unsigned int uClickY; // [sp+1Ch] [bp-4h]@10 v1 = 0; v26 = _this; v27 = uNumVisibleWindows; if ( uNumVisibleWindows < 0 ) return 0; v2 = pMessageQueue_50CBD0->uNumMessages; while ( 1 ) { v3 = pVisibleWindowsIdxs[v27] - 1; if ( pWindowList[v3].field_44 == v1 ) goto LABEL_47; if ( v26 != 34 ) break; if ( pWindowList[v3].field_30 != v1 ) { pMouse->GetClickPos(&uClickX, &uClickY); v4 = pWindowList[v3].pStartingPosActiveItem; v29 = v4 + pWindowList[v3].pNumPresenceButton; if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) { while ( 1 ) { v14 = pWindowList[v3].pControlsHead; if ( v4 > 0 ) { v15 = v4; do { v14 = v14->pNext; --v15; } while ( v15 ); } if ( (signed int)uClickX >= (signed int)v14->uX && (signed int)uClickX <= (signed int)v14->uZ && (signed int)uClickY >= (signed int)v14->uY && (signed int)uClickY <= (signed int)v14->uW ) goto LABEL_66; ++v4; if ( v4 >= v29 ) { LABEL_45: v1 = 0; goto LABEL_46; } } } goto LABEL_46; } LABEL_47: --v27; if ( v27 < 0 ) return 0; } if ( v26 == 37 ) { v12 = pWindowList[v3].field_34; if ( pWindowList[v3].pCurrentPosActiveItem - pWindowList[v3].pStartingPosActiveItem - v12 >= 0 ) { v8 = pCurrentScreen == 21; pWindowList[v3].pCurrentPosActiveItem -= v12; if ( v8 ) { pAudioPlayer->PlaySound((SoundID)66, v1, v1, -1, v1, v1, v1, v1); v2 = pMessageQueue_50CBD0->uNumMessages; } } if ( pWindowList[v3].field_30 != v1 ) goto LABEL_47; v9 = pWindowList[v3].pControlsHead; v13 = pWindowList[v3].pCurrentPosActiveItem; if ( v13 > (signed int)v1 ) { do { v9 = v9->pNext; --v13; } while ( v13 ); } LABEL_26: v11 = v9->uControlParam; if ( (signed int)v2 < 40 ) { pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v9->uControlID; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v11; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; v2 = pMessageQueue_50CBD0->uNumMessages + 1; ++pMessageQueue_50CBD0->uNumMessages; } goto LABEL_47; } if ( v26 != 38 ) { if ( v26 == 39 ) { v7 = pWindowList[v3].pCurrentPosActiveItem + pWindowList[v3].field_34; if ( v7 < pWindowList[v3].pNumPresenceButton + pWindowList[v3].pStartingPosActiveItem ) { v8 = pCurrentScreen == 21; pWindowList[v3].pCurrentPosActiveItem = v7; if ( v8 ) { pAudioPlayer->PlaySound((SoundID)66, v1, v1, -1, v1, v1, v1, v1); v2 = pMessageQueue_50CBD0->uNumMessages; } } if ( pWindowList[v3].field_30 != v1 ) goto LABEL_47; v9 = pWindowList[v3].pControlsHead; v10 = pWindowList[v3].pCurrentPosActiveItem; if ( v10 > (signed int)v1 ) { do { v9 = v9->pNext; --v10; } while ( v10 ); } goto LABEL_26; } if ( v26 == 40 ) { v17 = pWindowList[v3].pStartingPosActiveItem; v18 = pWindowList[v3].pCurrentPosActiveItem; if ( v18 >= pWindowList[v3].pNumPresenceButton + v17 - 1 ) pWindowList[v3].pCurrentPosActiveItem = v17; else pWindowList[v3].pCurrentPosActiveItem = v18 + 1; if ( pWindowList[v3].field_30 != v1 ) return 1; v19 = pWindowList[v3].pControlsHead; v20 = pWindowList[v3].pCurrentPosActiveItem; if ( v20 > (signed int)v1 ) { do { v19 = v19->pNext; --v20; } while ( v20 ); } goto LABEL_56; } if ( v26 == 41 ) { pMouse->GetClickPos(&uClickX, &uClickY); v4 = pWindowList[v3].pStartingPosActiveItem; v28 = v4 + pWindowList[v3].pNumPresenceButton; if ( v4 < v4 + pWindowList[v3].pNumPresenceButton ) { while ( 1 ) { v5 = pWindowList[v3].pControlsHead; if ( v4 > 0 ) { v6 = v4; do { v5 = v5->pNext; --v6; } while ( v6 ); } if ( (signed int)uClickX >= (signed int)v5->uX && (signed int)uClickX <= (signed int)v5->uZ && (signed int)uClickY >= (signed int)v5->uY && (signed int)uClickY <= (signed int)v5->uW ) break; ++v4; if ( v4 >= v28 ) goto LABEL_45; } LABEL_66: pWindowList[v3].pCurrentPosActiveItem = v4; return 1; } LABEL_46: v2 = pMessageQueue_50CBD0->uNumMessages; goto LABEL_47; } goto LABEL_47; } v22 = pWindowList[v3].pCurrentPosActiveItem; v23 = pWindowList[v3].pStartingPosActiveItem; if ( v22 <= v23 ) v24 = pWindowList[v3].pNumPresenceButton + v23 - 1; else v24 = v22 - 1; v8 = pWindowList[v3].field_30 == v1; pWindowList[v3].pCurrentPosActiveItem = v24; if ( !v8 ) return 1; v19 = pWindowList[v3].pControlsHead; v25 = pWindowList[v3].pCurrentPosActiveItem; if ( v25 > (signed int)v1 ) { do { v19 = v19->pNext; --v25; } while ( v25 ); } LABEL_56: v21 = v19->uControlParam; if ( (signed int)v2 < 40 ) { pMessageQueue_50CBD0->pMessages[v2].eType = (UIMessageType)v19->uControlID; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v21; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; ++pMessageQueue_50CBD0->uNumMessages; } return 1; } //----- (0041D20D) -------------------------------------------------------- char __fastcall sub_41D20D_buff_remaining_time_string(int ecx0, GUIWindow *edx0, __int64 a3, GUIFont *a2) { unsigned int v4; // edi@1 unsigned int v5; // esi@1 unsigned int v6; // ebp@1 unsigned int v7; // ebx@1 signed __int64 v8; // ST34_8@1 signed __int64 v9; // kr00_8@1 char *v10; // eax@2 char *v11; // eax@7 char *v12; // eax@13 char *v13; // eax@19 int uY; // [sp+0h] [bp-20h]@1 GUIWindow *a1; // [sp+4h] [bp-1Ch]@1 signed __int64 v17; // [sp+10h] [bp-10h]@1 signed __int64 v18; // [sp+18h] [bp-8h]@1 unsigned int v19; // [sp+24h] [bp+4h]@1 a1 = edx0; uY = ecx0; v4 = (unsigned __int64)(signed __int64)((double)a3 * 0.234375) >> 32; v5 = (signed __int64)((double)a3 * 0.234375); v6 = (unsigned __int64)((signed __int64)((double)a3 * 0.234375) / 60) >> 32; v7 = (signed __int64)((double)a3 * 0.234375) / 60; v8 = (signed __int64)((double)a3 * 0.234375) / 60 / 60; v19 = (unsigned int)v8 / 0x18; v18 = (signed __int64)__PAIR__(v4, v5) % 60; v17 = (signed __int64)__PAIR__(v6, v7) % 60; v9 = v8 % 24; strcpy(pTmpBuf, "\r020"); if ( (unsigned int)v8 / 0x18 ) { v10 = pGlobalTXT_LocalizationStrings[57]; // Days if ( v19 <= 1 ) v10 = pGlobalTXT_LocalizationStrings[56]; // Day sprintf(pTmpBuf2, "%d %s ", v19, v10); strcat(pTmpBuf, pTmpBuf2); } if ( v9 ) { if ( v9 <= 1 ) v11 = pGlobalTXT_LocalizationStrings[109];// Hour else v11 = pGlobalTXT_LocalizationStrings[110];// Hours sprintf(pTmpBuf2, "%d %s ", v9, v11); strcat(pTmpBuf, pTmpBuf2); } if ( v17 && !v19 ) { if ( v17 <= 1 ) v12 = pGlobalTXT_LocalizationStrings[437];// Minute else v12 = pGlobalTXT_LocalizationStrings[436];// Minutes sprintf(pTmpBuf2, "%d %s ", v17, v12); strcat(pTmpBuf, pTmpBuf2); } if ( v18 && !v9 ) { if ( v18 <= 1 ) v13 = pGlobalTXT_LocalizationStrings[439];// Second else v13 = pGlobalTXT_LocalizationStrings[438];// Seconds sprintf(pTmpBuf2, "%d %s ", v18, v13); strcat(pTmpBuf, pTmpBuf2); } return a1->DrawText(a2, 32, uY, 0, pTmpBuf, 0, 0, 0); } //----- (0041D895) -------------------------------------------------------- void __thiscall GameUI_DrawItemInfo(ItemGen *ecx0) { ItemGen *v1; // esi@1 unsigned int v2; // eax@3 char *v3; // edi@5 unsigned int v4; // eax@5 unsigned int v5; // esi@5 signed int v6; // eax@5 int v7; // edx@5 ItemGen *v8; // ecx@10 unsigned int v9; // eax@12 char v10; // zf@16 ItemGen *v11; // eax@16 ItemGen *v12; // eax@25 unsigned int v13; // ecx@32 unsigned int v14; // eax@32 Render *v15; // edi@33 const char *v16; // eax@34 int v17; // eax@36 int v18; // esi@37 unsigned __int16 v19; // ax@37 char v20; // al@40 char v21; // al@44 char v22; // al@48 char v23; // al@51 int v24; // eax@52 int v25; // eax@57 int v26; // eax@60 int v27; // eax@67 const char *v28; // edi@69 int v29; // eax@70 char *v30; // edi@78 const char *v31; // eax@78 int v32; // ecx@81 unsigned int v33; // eax@81 int v34; // esi@81 const char *v35; // eax@85 const char *v36; // eax@87 unsigned int v37; // eax@109 unsigned int v38; // eax@109 int v39; // eax@113 GUIFont *v40; // edx@113 signed int v41; // [sp-20h] [bp-298h]@113 int v42; // [sp-1Ch] [bp-294h]@113 char *v43; // [sp-18h] [bp-290h]@46 unsigned int v44; // [sp-18h] [bp-290h]@113 int v45; // [sp-14h] [bp-28Ch]@46 const char *v46; // [sp-14h] [bp-28Ch]@58 char *v47; // [sp-14h] [bp-28Ch]@110 char *v48; // [sp-10h] [bp-288h]@46 const char *v49; // [sp-10h] [bp-288h]@56 char *v50; // [sp-10h] [bp-288h]@58 int v51; // [sp-10h] [bp-288h]@110 const char *v52; // [sp-Ch] [bp-284h]@36 int v53; // [sp-Ch] [bp-284h]@46 char *v54; // [sp-Ch] [bp-284h]@56 int v55; // [sp-Ch] [bp-284h]@58 int v56; // [sp-Ch] [bp-284h]@110 unsigned int v57; // [sp-8h] [bp-280h]@36 int v58; // [sp-8h] [bp-280h]@46 int v59; // [sp-8h] [bp-280h]@56 int v60; // [sp-8h] [bp-280h]@58 unsigned int v61; // [sp-8h] [bp-280h]@110 char a1[100]; // [sp+8h] [bp-270h]@40 char Dest[100]; // [sp+6Ch] [bp-20Ch]@40 char v64[100]; // [sp+D0h] [bp-1A8h]@40 char v65[120]; // [sp+134h] [bp-144h]@92 char Source[40]; // [sp+1ACh] [bp-CCh]@49 int v67; // [sp+1D4h] [bp-A4h]@91 int v68; // [sp+1D8h] [bp-A0h]@106 int v69; // [sp+1DCh] [bp-9Ch]@101 int v70; // [sp+1E0h] [bp-98h]@97 int v71; // [sp+1E8h] [bp-90h]@93 int v72; // [sp+1ECh] [bp-8Ch]@91 int var88; // [sp+1F0h] [bp-88h]@1 Texture *v73; // [sp+1F4h] [bp-84h]@5 unsigned int v75; // [sp+1F8h] [bp-80h]@5 char *v76; // [sp+1FCh] [bp-7Ch]@5 int v77; // [sp+200h] [bp-78h]@12 int v78; // [sp+204h] [bp-74h]@5 GUIWindow v79; // [sp+208h] [bp-70h]@2 POINT a2; // [sp+25Ch] [bp-1Ch]@2 int v81; // [sp+264h] [bp-14h]@5 GUIFont *v82; // [sp+268h] [bp-10h]@1 char *v83; // [sp+26Ch] [bp-Ch]@18 char *Str; // [sp+270h] [bp-8h]@65 ItemGen *_this; // [sp+274h] [bp-4h]@1 v1 = ecx0; _this = ecx0; var88 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v82 = pFontComic; if ( v1->uItemID ) { v79.Hint = 0; v79.uFrameWidth = 384; v79.uFrameHeight = 180; v79.uFrameY = 40; if ( pMouse->GetCursorPos(&a2)->x <= 320 ) v2 = pMouse->GetCursorPos(&a2)->x + 30; else v2 = pMouse->GetCursorPos(&a2)->x - v79.uFrameWidth - 30; v79.uFrameX = v2; v3 = (char *)&pItemsTable->pItems[_this->uItemID].pIconName; v76 = v3; v4 = pIcons_LOD->LoadTexture(*(const char **)v3, TEXTURE_16BIT_PALETTE); v5 = v4; v4 *= 72; v75 = v4; v73 = (struct Texture *)((char *)pIcons_LOD->pTextures + v4); v6 = 100 - *(unsigned __int16 *)((char *)&pIcons_LOD->pTextures[0].uTextureWidth + v4); v7 = v73->uTextureHeight; v78 = v6; v81 = 144 - v7; if ( v6 > 0 ) v78 = v6 >> 1; if ( v81 <= 0 ) v81 = 0; else v81 >>= 1; v8 = _this; if ( !v3[46] ) _this->uAttributes |= 1u; v9 = v8->uAttributes; v77 = 0; a2.y = v9 & 2; if ( pItemsTable->pItems[v8->uItemID].uEquipType == 18 ) v77 = v8->uAdditionalValue; if ( uActiveCharacter ) { if ( !(v9 & 1) ) { v10 = pPlayers[uActiveCharacter]->CanIdentify(_this) == 1; v11 = _this; if ( v10 ) _this->uAttributes |= 1u; v10 = (v11->uAttributes & 1) == 0; v83 = (char *)9; if ( v10 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[446], 2u); } else { v83 = (char *)8; if ( _this->GetValue() < 100 * (pPlayers[uActiveCharacter]->uLevel + 5) ) v83 = (char *)7; } if ( dword_4E455C ) { pPlayers[uActiveCharacter]->PlaySound((int)v83, 0); dword_4E455C = 0; } } _this->UpdateTempBonus(pParty->uTimePlayed); if ( a2.y ) { v10 = pPlayers[uActiveCharacter]->CanRepair(_this) == 1; v12 = _this; if ( v10 ) _this->uAttributes = _this->uAttributes & 0xFFFFFFFD | 1; v10 = (v12->uAttributes & 2) == 0; v83 = (char *)11; if ( v10 ) v83 = (char *)10; else ShowStatusBarString(pGlobalTXT_LocalizationStrings[448], 2u); if ( dword_4E455C ) { pPlayers[uActiveCharacter]->PlaySound((int)v83, 0); dword_4E455C = 0; } } } v13 = _this->uAttributes; v14 = _this->uAttributes & 1; a2.y = _this->uAttributes & 1; if ( v13 & 2 ) { v79.DrawMessageBox(0); //v15 = &; pRenderer->Clip( v79.uFrameX + 12, v79.uFrameY + 12, v79.uFrameX + v79.uFrameWidth - 12, v79.uFrameY + v79.uFrameHeight - 12); v79.uFrameWidth -= 24; v79.uFrameHeight -= 12; v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; pRenderer->_4A6776( v79.uFrameX + v78, v81 + v79.uFrameY + 30, (Texture *)(v5 != -1 ? (int)((char *)pIcons_LOD->pTextures + v75) : 0)); if ( a2.y ) v16 = _this->GetIdentifiedName(); else v16 = (const char *)*((int *)v76 + 2); v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, v16, 3u); v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[32], &v79, 0, 0); v57 = 3; v52 = pGlobalTXT_LocalizationStrings[32]; goto LABEL_37; } if ( !v14 ) { v79.DrawMessageBox(0); v15 = pRenderer; pRenderer->Clip( v79.uFrameX + 12, v79.uFrameY + 12, v79.uFrameX + v79.uFrameWidth - 12, v79.uFrameY + v79.uFrameHeight - 12); v79.uFrameWidth -= 24; v79.uFrameHeight -= 12; v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; pRenderer->DrawTextureTransparent( v79.uFrameX + v78, v81 + v79.uFrameY + 30, (Texture *)(v5 != -1 ? (int)((char *)pIcons_LOD->pTextures + v75) : 0)); v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, *((const char **)v76 + 2), 3u); v17 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[232], &v79, 0, 0); v57 = 3; v52 = pGlobalTXT_LocalizationStrings[232]; LABEL_37: v18 = v17 >> 1; v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x19u, 0x19u); v79.DrawTitleText(pFontArrus, 0x64u, ((signed int)v79.uFrameHeight >> 1) - v18, v19, v52, v57); goto LABEL_116; } sprintf(a1, pGlobalTXT_LocalizationStrings[463], *((int *)v3 + 2)); strcpy(Dest, ""); strcpy(v64, ""); v20 = v3[28]; if ( (unsigned __int8)v20 <= 1u ) { v58 = (unsigned __int8)v3[31]; v53 = (unsigned __int8)v3[30]; v48 = pGlobalTXT_LocalizationStrings[53]; v45 = (unsigned __int8)v3[32]; v43 = pGlobalTXT_LocalizationStrings[18]; } else { if ( v20 != 2 ) { if ( (unsigned __int8)v20 > 2u ) { if ( (unsigned __int8)v20 <= 0xBu ) { v21 = v3[30]; if ( v21 ) sprintf( Dest, "%s: +%d", pGlobalTXT_LocalizationStrings[11], (unsigned __int8)v21 + (unsigned __int8)v3[32]); } } goto LABEL_50; } v58 = (unsigned __int8)v3[31]; v53 = (unsigned __int8)v3[30]; v48 = pGlobalTXT_LocalizationStrings[53]; v45 = (unsigned __int8)v3[32]; v43 = pGlobalTXT_LocalizationStrings[203]; } sprintf(Dest, "%s: +%d %s: %dd%d", v43, v45, v48, v53, v58); v22 = v3[32]; if ( v22 ) { sprintf(Source, " +%d", (unsigned __int8)v22); strcat(Dest, Source); } LABEL_50: if ( v77 ) goto LABEL_65; v23 = v3[28]; if ( v23 == 14 ) { v24 = _this->_bonus_type; if ( v24 ) goto LABEL_56; LABEL_65: v79.uFrameWidth -= 12; a2.y = 3; v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; Str = (char *)(3 * (LOBYTE(pFontArrus->uFontHeight) + 8)); v83 = a1; do { if ( *v83 ) { v27 = v82->CalcTextHeight(v83, &v79, 100, 0); Str += v27 + 3; } v83 += 100; --a2.y; } while ( a2.y ); v28 = (const char *)*((int *)v3 + 3); if ( *v28 ) { v29 = pFontSmallnum->CalcTextHeight(v28, &v79, 100, 0); Str += v29; } v79.uFrameHeight = v73->uTextureHeight + v81 + 54; if ( (signed int)Str > (signed int)v79.uFrameHeight ) v79.uFrameHeight = (unsigned int)Str; if ( _this->uAttributes & 8 && (_this->uAdditionalValue || _this->_bonus_type) ) v79.uFrameHeight += LOBYTE(v82->uFontHeight); v83 = 0; if ( LOBYTE(pFontArrus->uFontHeight) ) { v79.uFrameWidth -= 24; v30 = (char *)LOBYTE(pFontArrus->uFontHeight); v31 = _this->GetIdentifiedName(); if ( pFontArrus->CalcTextHeight(v31, &v79, 0, 0) / (signed int)v30 ) v83 = v30; v79.uFrameWidth += 24; } v79.uFrameWidth += 12; v79.uFrameHeight += (unsigned int)v83; v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; v79.DrawMessageBox(0); v15 = pRenderer; pRenderer->Clip( v79.uFrameX + 12, v79.uFrameY + 12, v79.uFrameX + v79.uFrameWidth - 12, v79.uFrameY + v79.uFrameHeight - 12); v79.uFrameWidth -= 12; v32 = v73->uTextureHeight; v33 = v79.uFrameHeight; v79.uFrameHeight -= 12; v79.uFrameZ = v79.uFrameX + v79.uFrameWidth - 1; v79.uFrameW = v79.uFrameY + v79.uFrameHeight - 1; pRenderer->DrawTextureTransparent( v79.uFrameX + v78, v79.uFrameY + (signed int)(v33 - v32) / 2, (Texture *)(v5 != -1 ? (int)((char *)pIcons_LOD->pTextures + v75) : 0)); a2.y = 3; v34 = (int)(v83 + 35); Str = a1; do { if ( *Str ) { v79.DrawText(v82, 100, v34, 0, Str, 0, 0, 0); v34 += v82->CalcTextHeight(Str, &v79, 100, 0) + 3; } Str += 100; --a2.y; } while ( a2.y ); v35 = (const char *)*((int *)v76 + 3); if ( *v35 ) v79.DrawText(pFontSmallnum, 100, v34, 0, v35, 0, 0, 0); v79.uFrameX += 12; v79.uFrameWidth -= 24; v36 = _this->GetIdentifiedName(); v79.DrawTitleText(pFontArrus, 0, 0xCu, var88, v36, 3u); v79.uFrameWidth += 24; v79.uFrameX -= 12; if ( v77 ) { sprintf(pTmpBuf, "%s: %lu", pGlobalTXT_LocalizationStrings[465], v77); v40 = v82; v61 = 0; v56 = 0; v51 = 0; v47 = pTmpBuf; v44 = 0; v42 = v79.uFrameHeight - LOBYTE(v82->uFontHeight); v41 = 100; } else { if ( _this->uAttributes & 8 && (_this->uAdditionalValue || _this->_bonus_type) ) { sub_493F79((stru351 *)&v67, _this->uExpireTime - pParty->uTimePlayed); strcpy(pTmpBuf, "Duration:"); Str = (char *)(v72 - 1168); if ( v72 != 1168 ) { sprintf(v65, " %d:yr", v72 - 1168); strcat(pTmpBuf, v65); } if ( (((v71 || Str) && ((sprintf(v65, " %d:mo", v71), strcat(pTmpBuf, v65), v71) || Str) || v70) && ((sprintf(v65, " %d:dy", v70), strcat(pTmpBuf, v65), v71) || Str || v70) || v69) && ((sprintf(v65, " %d:hr", v69), strcat(pTmpBuf, v65), v71) || Str || v70 || v69) || v68 ) { sprintf(v65, " %d:mn", v68); strcat(pTmpBuf, v65); } v79.DrawText(v82, 100, v79.uFrameHeight - 2 * LOBYTE(v82->uFontHeight), 0, pTmpBuf, 0, 0, 0); } v37 = _this->GetValue(); sprintf(pTmpBuf, "%s: %lu", pGlobalTXT_LocalizationStrings[465], v37); v79.DrawText(v82, 100, v79.uFrameHeight - LOBYTE(v82->uFontHeight), 0, pTmpBuf, 0, 0, 0); v38 = _this->uAttributes; if ( BYTE1(v38) & 1 ) { v61 = 0; v56 = 0; v51 = 0; v47 = pGlobalTXT_LocalizationStrings[187]; } else { if ( !(BYTE1(v38) & 2) ) goto LABEL_116; v61 = 0; v56 = 0; v51 = 0; v47 = pGlobalTXT_LocalizationStrings[651]; } LOWORD(v38) = LOWORD(pRenderer->uTargetRMask); v44 = v38; v42 = v79.uFrameHeight - LOBYTE(v82->uFontHeight); v39 = v82->GetLineWidth(pTmpBuf); v40 = v82; v41 = v39 + 132; } v79.DrawText(v40, v41, v42, v44, v47, v51, v56, v61); LABEL_116: pRenderer->ResetClip(); if ( !areWeLoadingTexture ) { v73->Release(); pIcons_LOD->_40F9C5(); } return; } if ( v23 == 13 ) { v24 = pItemsTable->pItems[_this->uItemID].uDamageDice; LABEL_56: v59 = v24; v54 = pGlobalTXT_LocalizationStrings[449]; v49 = "%s: %d"; LABEL_64: sprintf(v64, v49, v54, v59); goto LABEL_65; } v25 = _this->_bonus_type; if ( v25 ) { v60 = _this->_bonus_strength; v55 = *((int *)&pItemsTable->pItems[799].uDamageMod + 5 * v25); v50 = pGlobalTXT_LocalizationStrings[210]; v46 = "%s: %s +%d"; } else { v26 = _this->uAdditionalValue; if ( !v26 ) { if ( _this->uNumCharges ) { v59 = _this->uNumCharges; v54 = pGlobalTXT_LocalizationStrings[464]; v49 = "%s: %lu"; goto LABEL_64; } goto LABEL_65; } v60 = _this->_bonus_strength; v55 = *((int *)&pItemsTable->pEnchantments[23].pName + 7 * v26); v50 = pGlobalTXT_LocalizationStrings[210]; v46 = "%s: %s"; } sprintf(v64, v46, v50, v55, v60); goto LABEL_65; } } // 4E455C: using guessed type int dword_4E455C; // 506128: using guessed type int areWeLoadingTexture; //----- (0041E360) -------------------------------------------------------- char *__fastcall MonsterPopup_Draw(unsigned int uActorID, GUIWindow *edx0) { unsigned int v2; // esi@1 Actor *v3; // esi@3 int v4; // eax@3 unsigned int v5; // ecx@3 NPCData *v6; // eax@3 unsigned __int16 v7; // cx@3 int v8; // eax@4 unsigned __int16 v9; // dx@4 SpriteFrame *v10; // edi@17 int v11; // esi@17 unsigned int v12; // ecx@17 Sprite *v13; // edi@18 int v14; // ecx@18 int v15; // edx@18 int v16; // edx@18 int v17; // eax@18 unsigned int v18; // ecx@19 unsigned int v19; // eax@21 char *v20; // esi@28 int v21; // edx@29 unsigned __int16 *v22; // ecx@29 int v23; // eax@29 int v24; // eax@32 int v25; // esi@32 char *v26; // edx@34 unsigned __int8 v27; // sf@36 unsigned __int8 v28; // of@36 int v29; // esi@40 char *v30; // ecx@40 int v31; // eax@40 int v32; // esi@43 unsigned __int16 v33; // ax@45 int v34; // edx@45 int v35; // eax@45 int v36; // eax@49 char *v37; // eax@52 int v38; // eax@55 unsigned __int16 v39; // ax@59 SpellBuff *v40; // eax@60 int v41; // edi@61 unsigned int v42; // eax@61 int v43; // eax@62 int v44; // eax@63 signed int v45; // edi@65 unsigned __int16 v46; // ax@73 Player *v47; // ecx@77 unsigned int v48; // eax@85 GUIFont *v49; // edi@90 int v50; // edi@90 SpellBuff *v51; // eax@91 char *v52; // ecx@98 char *v53; // ecx@101 char *v54; // ST0C_4@118 unsigned int v55; // eax@118 GUIFont *v56; // edi@124 unsigned __int8 v57; // al@128 int v58; // eax@132 Actor *v59; // ecx@133 unsigned __int8 v60; // dl@138 char *v61; // eax@145 char *v62; // eax@147 int v63; // eax@152 char *result; // eax@152 int v65; // eax@155 const char *v66; // [sp-10h] [bp-1FCh]@121 const char *v67; // [sp-10h] [bp-1FCh]@125 const char *v68; // [sp-10h] [bp-1FCh]@142 int v69; // [sp-Ch] [bp-1F8h]@121 char *v70; // [sp-Ch] [bp-1F8h]@125 char *v71; // [sp-Ch] [bp-1F8h]@142 char *v72; // [sp-8h] [bp-1F4h]@54 int v73; // [sp-8h] [bp-1F4h]@79 int v74; // [sp-8h] [bp-1F4h]@121 int v75; // [sp-8h] [bp-1F4h]@125 int v76; // [sp-8h] [bp-1F4h]@142 size_t v77; // [sp-4h] [bp-1F0h]@54 unsigned int v78; // [sp-4h] [bp-1F0h]@121 unsigned int v79; // [sp-4h] [bp-1F0h]@125 char *v80; // [sp-4h] [bp-1F0h]@142 char *v81; // [sp-4h] [bp-1F0h]@148 DDBLTFX Dst; // [sp+Ch] [bp-1E0h]@18 DDSURFACEDESC2 pDesc; // [sp+70h] [bp-17Ch]@18 RECT v84; // [sp+ECh] [bp-100h]@26 char *v85; // [sp+FCh] [bp-F0h]@145 char *v86; // [sp+100h] [bp-ECh]@145 char *v87; // [sp+104h] [bp-E8h]@145 char *v88; // [sp+108h] [bp-E4h]@145 char *v89; // [sp+10Ch] [bp-E0h]@145 char *v90; // [sp+110h] [bp-DCh]@145 char *v91; // [sp+114h] [bp-D8h]@145 char *v92; // [sp+118h] [bp-D4h]@145 char *v93; // [sp+11Ch] [bp-D0h]@145 char *v94; // [sp+120h] [bp-CCh]@145 char *v95; // [sp+124h] [bp-C8h]@127 char *v96; // [sp+128h] [bp-C4h]@127 char *v97; // [sp+12Ch] [bp-C0h]@127 char *v98; // [sp+130h] [bp-BCh]@127 char *v99; // [sp+134h] [bp-B8h]@127 char *v100; // [sp+138h] [bp-B4h]@127 char *v101; // [sp+13Ch] [bp-B0h]@127 char *v102; // [sp+140h] [bp-ACh]@127 char *v103; // [sp+144h] [bp-A8h]@127 char *v104; // [sp+148h] [bp-A4h]@127 char *v105; // [sp+14Ch] [bp-A0h]@127 RenderBillboardTransform_local0 v106; // [sp+150h] [bp-9Ch]@3 unsigned int v107; // [sp+1A0h] [bp-4Ch]@18 unsigned __int16 *v108; // [sp+1A4h] [bp-48h]@34 unsigned int v109; // [sp+1A8h] [bp-44h]@32 LPVOID v110; // [sp+1ACh] [bp-40h]@28 unsigned int v111; // [sp+1B0h] [bp-3Ch]@29 char **v112; // [sp+1B4h] [bp-38h]@3 IDirectDrawSurface *v222; // [sp+1B8h] [bp-34h]@18 unsigned __int8 v114; // [sp+1BFh] [bp-2Dh]@133 int v115; // [sp+1C0h] [bp-2Ch]@3 unsigned int v116; // [sp+1C4h] [bp-28h]@18 int i; // [sp+1C8h] [bp-24h]@18 Player *a2; // [sp+1CCh] [bp-20h]@28 int v119; // [sp+1D0h] [bp-1Ch]@18 SpellBuff *v120; // [sp+1D4h] [bp-18h]@18 Actor *v121; // [sp+1D8h] [bp-14h]@3 int a5; // [sp+1DCh] [bp-10h]@3 GUIWindow *a1; // [sp+1E0h] [bp-Ch]@1 int v124; // [sp+1E4h] [bp-8h]@18 char *a4; // [sp+1E8h] [bp-4h]@18 a1 = edx0; v2 = uActorID; static Actor pMonsterInfoUI_Doll; /*if ( !(bMonsterInfoUI_bDollInitialized & 1) ) { bMonsterInfoUI_bDollInitialized |= 1u; Actor::Actor(&pMonsterInfoUI_Doll); atexit(nullsub_3); }*/ v106.uParentBillboardID = -1; v3 = &pActors[v2]; v121 = v3; v4 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xFFu, 0x9Bu); v5 = v3->uNPC_ID; a5 = v4; v6 = GetNPCData(v5); v7 = v3->pMonsterInfo.uID; v112 = (char **)v6; v115 = byte_4E2B70[((signed __int16)v7 - 1) / 3] - 40; if ( v7 == pMonsterInfoUI_Doll.pMonsterInfo.uID ) { v9 = pMonsterInfoUI_Doll.uCurrentActionLength; } else { memcpy(&pMonsterInfoUI_Doll, v3, sizeof(pMonsterInfoUI_Doll)); pMonsterInfoUI_Doll.uCurrentActionAnimation = 7; pMonsterInfoUI_Doll.uCurrentActionTime = 0; v8 = rand(); v3 = v121; v9 = v8 % 256 + 128; pMonsterInfoUI_Doll.uCurrentActionLength = v8 % 256 + 128; } if ( (signed int)pMonsterInfoUI_Doll.uCurrentActionTime > (signed __int16)v9 ) { pMonsterInfoUI_Doll.uCurrentActionTime = 0; if ( pMonsterInfoUI_Doll.uCurrentActionAnimation == 7 || pMonsterInfoUI_Doll.uCurrentActionAnimation == 2 ) { pMonsterInfoUI_Doll.uCurrentActionAnimation = 0; pMonsterInfoUI_Doll.uCurrentActionLength = rand() % 128 + 128; } else { rand(); pMonsterInfoUI_Doll.uCurrentActionAnimation = 7; if ( (pMonsterInfoUI_Doll.pMonsterInfo.uID < 115 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 186) && (pMonsterInfoUI_Doll.pMonsterInfo.uID < 232 || pMonsterInfoUI_Doll.pMonsterInfo.uID > 249) && rand() % 30 < 100 ) pMonsterInfoUI_Doll.uCurrentActionAnimation = 2; pMonsterInfoUI_Doll.uCurrentActionLength = 8 * pSpriteFrameTable->pSpriteSFrames[v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation]].uAnimLength; } } v10 = pSpriteFrameTable->GetFrame( v3->pSpriteIDs[(signed __int16)pMonsterInfoUI_Doll.uCurrentActionAnimation], pMonsterInfoUI_Doll.uCurrentActionTime); v11 = 40 * v10->pHwSpriteIDs[0] + 7218180; v106.pTarget = pRenderer->pTargetSurface; v106.pTargetZ = pRenderer->pActiveZBuffer; v106.uTargetPitch = pRenderer->uTargetSurfacePitch; v12 = a1->uFrameY + 52; v106.uViewportX = a1->uFrameX + 13; v106.uViewportY = v12; v106.uViewportW = v12 + 128; v106.uViewportZ = v106.uViewportX + 128; v106.uScreenSpaceX = (signed int)(v106.uViewportX + 128 + v106.uViewportX) / 2; v106.field_10 = 65536; v106.field_14 = 65536; v106.uScreenSpaceY = v115 + v12 + *(short *)(v11 + 18); v106.pPalette = PaletteManager::Get_Dark_or_Red_LUT(v10->uPaletteIndex, 0, 1); v106.sZValue = 0; v106.uFlags = 0; pRenderer->Clip_v2(0, 0, 0x27Fu, 0x1DFu); pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportY - 1, a5); pRenderer->Line2D( v106.uViewportX + 129, v106.uViewportY - 1, v106.uViewportX + 129, v106.uViewportW + 1, a5); pRenderer->Line2D(v106.uViewportX + 129, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportW + 1, a5); pRenderer->Line2D(v106.uViewportX - 1, v106.uViewportW + 1, v106.uViewportX - 1, v106.uViewportY - 1, a5); if ( pRenderer->pRenderD3D ) { v13 = &pSprites_LOD->pHardwareSprites[v10->pHwSpriteIDs[0]]; v106.uScreenSpaceY = v115 + v106.uViewportY + v13->uBufferHeight; v222 = (IDirectDrawSurface *)v13->pTextureSurface; memset(&Dst, 0, 0x64u); Dst.dwSize = 100; Dst.dwFillColor = 0; memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; v222->GetSurfaceDesc((LPDDSURFACEDESC)&pDesc); v14 = v13->uBufferHeight; v120 = (SpellBuff *)v13->uBufferWidth; v107 = 0; v15 = v13->uAreaX; v119 = (signed int)v120 / 2; i = 0; a4 = (char *)(v106.uScreenSpaceX + v15 - (signed int)v120 / 2); v115 = v13->uAreaY; v16 = v13->uAreaWidth + (signed int)v120 / 2 + v15 - (int)v120; v124 = v106.uScreenSpaceY + v115 - v14; v17 = v13->uAreaHeight + v115 - v14; v116 = v106.uScreenSpaceX + v16; v119 = v106.uScreenSpaceY + v17; if ( (signed int)a4 < (signed int)v106.uViewportX ) { v18 = v106.uViewportX - (int)a4; a4 = (char *)v106.uViewportX; v107 = v18; } if ( v124 < (signed int)v106.uViewportY ) { v19 = v106.uViewportY - v124; v124 = v106.uViewportY; i = v19; } if ( (signed int)v116 > (signed int)v106.uViewportZ ) v116 = v106.uViewportZ; if ( v119 > (signed int)v106.uViewportW ) v119 = v106.uViewportW; pRenderer->FillRectFast( v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, pRenderer->uTargetBMask | pRenderer->uTargetGMask); pRenderer->FillRectFast( v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, pRenderer->uTargetBMask | pRenderer->uTargetGMask); v84.left = v106.uViewportX; v84.top = v106.uViewportY; v84.right = v106.uViewportZ; v84.bottom = v106.uViewportW; ErrD3D(pRenderer->pBackBuffer4->Blt(&v84, 0, 0, 16778240u, &Dst)); if ( pRenderer->uTargetGBits == 5 ) { memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; if ( !pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, 1u) ) goto LABEL_51; v20 = (char *)v124; v110 = pDesc.lpSurface; a2 = (Player *)v124; if ( v124 < v119 ) { v111 = 2 * pRenderer->uTargetSurfacePitch; v21 = (int)a4; v22 = &pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; v23 = i - v124; v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; v115 = i - v124; while ( 1 ) { v124 = v21; if ( v21 < (signed int)v116 ) { v24 = (int)&v20[v23]; v25 = v107 - v21; v109 = v24; for ( i = v107 - v21; ; v25 = i ) { v108 = (unsigned __int16 *)((pDesc.lPitch >> 1) * pDesc.dwHeight * v109 / v13->uAreaHeight); v26 = (char *)v108 + pDesc.dwWidth * (v25 + v124++) / v13->uAreaWidth; *v22 = *((short *)v110 + (int)v26); ++v22; if ( v124 >= (signed int)v116 ) break; } v23 = v115; } v22 = (unsigned __int16 *)((char *)v120 + v111); v20 = (char *)&a2->pConditions[0] + 1; v28 = __OFSUB__((int)&a2->pConditions[0] + 1, v119); v27 = (signed int)((char *)&a2->pConditions[0] + -v119 + 1) < 0; a2 = (Player *)((char *)a2 + 1); v120 = (SpellBuff *)((char *)v120 + v111); if ( !(v27 ^ v28) ) break; v21 = (int)a4; } } goto LABEL_37; } memset(&pDesc, 0, 0x7Cu); pDesc.dwSize = 124; if ( pRenderer->LockSurface_DDraw4((IDirectDrawSurface4 *)v222, &pDesc, 1u) ) { v108 = (unsigned __int16 *)pDesc.lpSurface; a2 = (Player *)v124; if ( v124 < v119 ) { v109 = 2 * pRenderer->uTargetSurfacePitch; v29 = (int)a4; v30 = (char *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; v31 = i - v124; v120 = (SpellBuff *)&pRenderer->pTargetSurface[(int)&a4[v124 * pRenderer->uTargetSurfacePitch]]; v115 = i - v124; while ( 1 ) { v124 = v29; if ( v29 < (signed int)v116 ) { v32 = v107 - (int)a4; v111 = (unsigned int)((char *)a2 + v31); for ( i = v107 - (int)a4; ; v32 = i ) { v110 = (LPVOID)((pDesc.lPitch >> 1) * pDesc.dwHeight * v111 / v13->uAreaHeight); v33 = v108[(int)((char *)v110 + pDesc.dwWidth * (v32 + v124) / v13->uAreaWidth)]; v34 = v33 & 0x1F | 2 * (unsigned __int16)(v108[(int)((char *)v110 + pDesc.dwWidth * (v32 + v124++) / v13->uAreaWidth)] & 0xFFE0); v35 = v124; *(short *)v30 = v34; v30 += 2; if ( v35 >= (signed int)v116 ) break; } v31 = v115; } a2 = (Player *)((char *)a2 + 1); v30 = (char *)v120 + v109; v120 = (SpellBuff *)((char *)v120 + v109); if ( (signed int)a2 >= v119 ) break; v29 = (int)a4; } } LABEL_37: v222->Unlock(0); goto LABEL_51; } } else { pRenderer->FillRectFast( v106.uViewportX, v106.uViewportY, v106.uViewportZ - v106.uViewportX, v106.uViewportW - v106.uViewportY, 0); v36 = v10->pHwSpriteIDs[0]; if ( v36 >= 0 ) pSprites_LOD->pSpriteHeaders[v36]._4ACC38(&v106, 0); } LABEL_51: if ( v121->uNPC_ID ) { v37 = v112[6]; if ( v37 ) { sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[429], *v112, aNPCProfessionNames[(signed int)v37]); goto LABEL_59; } v77 = 2000; v72 = *v112; } else { v38 = v121->dword_000334_unique_name; v77 = 2000; if ( v38 ) v72 = (char *)*(&pMonsterStats->pPlacement.uNumStrings + v38); else v72 = pMonsterStats->pInfos[v121->pMonsterInfo.uID].pName; } strncpy(pTmpBuf, v72, v77); LABEL_59: v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); a1->DrawTitleText(pFontComic, 0, 0xCu, v39, pTmpBuf, 3u); Actor::DrawHealthBar(v121, a1); v119 = 0; pMonsterInfoUI_Doll.uCurrentActionTime += pMiscTimer->uTimeElapsed; v115 = 0; v116 = 0; i = 0; v112 = 0; if ( !uActiveCharacter ) { v45 = 1; goto LABEL_84; } LOBYTE(v40) = pPlayers[uActiveCharacter]->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); v120 = v40; if ( !v40 ) goto LABEL_72; v41 = (unsigned __int8)v40 & 0x3F; v42 = SkillToMastery((unsigned __int16)v40) - 1; if ( !v42 ) { if ( v41 + 10 >= v121->pMonsterInfo.uLevel ) { v45 = 1; v119 = 1; goto LABEL_73; } goto LABEL_72; } v43 = v42 - 1; if ( !v43 ) { if ( 2 * v41 + 10 >= v121->pMonsterInfo.uLevel ) { v45 = 1; v119 = 1; v116 = 1; goto LABEL_73; } goto LABEL_72; } v44 = v43 - 1; if ( !v44 ) { if ( 3 * v41 + 10 >= v121->pMonsterInfo.uLevel ) { v45 = 1; v119 = 1; v116 = 1; i = 1; goto LABEL_73; } LABEL_72: v45 = 1; goto LABEL_73; } if ( v44 != 1 ) goto LABEL_72; v45 = 1; v119 = 1; v116 = 1; i = 1; v112 = (char **)1; LABEL_73: v46 = v121->uAIState; if ( v46 != 5 && v46 != 4 && !dword_507BF0_is_there_popup_onscreen && v120 ) { v47 = pPlayers[uActiveCharacter]; if ( v119 | v116 | i | (unsigned int)v112 ) { if ( v121->pMonsterInfo.uLevel >= v47->uLevel - 5 ) v73 = 105; else v73 = 104; } else { v73 = 106; } v47->PlaySound(v73, 0); } LABEL_84: a2 = pParty->pPlayers; do { LOBYTE(v48) = a2->GetActualSkillLevel(PLAYER_SKILL_MONSTER_ID); v111 = v48; v120 = (SpellBuff *)138; do { if ( (signed int)SkillToMastery(v111) >= 3 ) v115 = v45; v120 = (SpellBuff *)((char *)v120 - 1); } while ( v120 ); ++a2; } while ( (signed int)a2 < (signed int)pParty->pHirelings ); v49 = pFontSmallnum; a2 = (Player *)pFontSmallnum; a1->DrawText(pFontSmallnum, 12, 196, a5, pGlobalTXT_LocalizationStrings[631], 0, 0, 0); v50 = LOBYTE(v49->uFontHeight) + 193; if ( !v115 ) { v78 = 0; v74 = 0; v69 = 0; v66 = pGlobalTXT_LocalizationStrings[630]; goto LABEL_123; } a4 = 0; v51 = &v121->pActorBuffs[1]; v222 = 0; v120 = &v121->pActorBuffs[1]; do { if ( (signed __int64)v51->uExpireTime > 0 ) { switch ( (int)v51 ) { case 0u: v124 = 60; a4 = pGlobalTXT_LocalizationStrings[591]; break; case 1u: v124 = 82; a4 = pGlobalTXT_LocalizationStrings[649]; break; case 2u: v124 = 92; a4 = pGlobalTXT_LocalizationStrings[592]; break; case 3u: v124 = 63; a4 = pGlobalTXT_LocalizationStrings[4]; break; case 4u: v52 = pGlobalTXT_LocalizationStrings[220]; goto LABEL_100; case 5u: v52 = pGlobalTXT_LocalizationStrings[162]; LABEL_100: a4 = v52; v124 = 81; break; case 6u: v53 = pGlobalTXT_LocalizationStrings[593]; v124 = 35; goto LABEL_103; case 8u: v53 = pGlobalTXT_LocalizationStrings[608]; v124 = 62; LABEL_103: a4 = v53; break; case 7u: case 9u: a4 = 0; v124 = 0; goto LABEL_119; case 0xAu: v124 = 47; a4 = pGlobalTXT_LocalizationStrings[221]; break; case 0xBu: v124 = 66; a4 = pGlobalTXT_LocalizationStrings[607]; break; case 0xCu: v124 = 85; a4 = pGlobalTXT_LocalizationStrings[610]; break; case 0xDu: v124 = 86; a4 = pGlobalTXT_LocalizationStrings[609]; break; case 0xEu: v124 = 17; a4 = pGlobalTXT_LocalizationStrings[279]; break; case 0xFu: v124 = 38; a4 = pGlobalTXT_LocalizationStrings[442]; break; case 0x10u: v124 = 46; a4 = pGlobalTXT_LocalizationStrings[443]; break; case 0x11u: v124 = 51; a4 = pGlobalTXT_LocalizationStrings[440]; break; case 0x12u: v124 = 5; a4 = pGlobalTXT_LocalizationStrings[441]; break; case 0x13u: v124 = 95; a4 = pGlobalTXT_LocalizationStrings[229]; break; case 0x14u: v124 = 73; a4 = pGlobalTXT_LocalizationStrings[228]; break; default: a4 = 0; break; } if ( a4 ) { v54 = a4; v55 = GetSpellColor(v124); a1->DrawText((GUIFont *)a2, 28, v50, v55, v54, 0, 0, 0); v50 = v50 + BYTE5(a2->pConditions[0]) - 3; v51 = v120; } } LABEL_119: ++v51; v222 = (IDirectDrawSurface *)((char *)v222 + 1); v120 = v51; __debugbreak(); // fix condition } //while ( (signed int)((char *)&v222->lpVtbl + 1) < 22 ); while (true); if ( !a4 ) { v78 = 0; v74 = 0; v69 = 0; v66 = pGlobalTXT_LocalizationStrings[153]; LABEL_123: a1->DrawText((GUIFont *)a2, 28, v50, a5, v66, v69, v74, v78); } v56 = pFontSmallnum; a4 = (char *)v106.uViewportY; if ( v119 ) { sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[108], 0, v121->pMonsterInfo.uHP); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; v79 = v121->pMonsterInfo.uAC; v75 = 0; v70 = pGlobalTXT_LocalizationStrings[12]; v67 = "%s"; } else { sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[108], 0, pGlobalTXT_LocalizationStrings[630]); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v79 = (unsigned int)pGlobalTXT_LocalizationStrings[630]; v75 = 0; v70 = pGlobalTXT_LocalizationStrings[12]; a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; v67 = "%s"; } sprintf(pTmpBuf, v67, v70, v75, v79); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); a4 = &a4[LOBYTE(v56->uFontHeight) - 6] + LOBYTE(v56->uFontHeight); v95 = pGlobalTXT_LocalizationStrings[87]; v96 = pGlobalTXT_LocalizationStrings[6]; v97 = pGlobalTXT_LocalizationStrings[240]; v98 = pGlobalTXT_LocalizationStrings[70]; v99 = pGlobalTXT_LocalizationStrings[624]; v100 = pGlobalTXT_LocalizationStrings[138]; v101 = pGlobalTXT_LocalizationStrings[214]; v102 = pGlobalTXT_LocalizationStrings[142]; v103 = pGlobalTXT_LocalizationStrings[29]; v104 = pGlobalTXT_LocalizationStrings[133]; v105 = pGlobalTXT_LocalizationStrings[54]; if ( v116 ) { sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[18], 0, (&v95)[4 * v121->pMonsterInfo.uAttack1Type]); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; v57 = v121->pMonsterInfo.uAttack1DamageBonus; if ( v57 ) sprintf( pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[53], 0, v121->pMonsterInfo.uAttack1DamageDiceRolls, v121->pMonsterInfo.uAttack1DamageDiceSides, v57); else sprintf( pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[53], 0, v121->pMonsterInfo.uAttack1DamageDiceRolls, v121->pMonsterInfo.uAttack1DamageDiceSides); } else { sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[18], 0, pGlobalTXT_LocalizationStrings[630]); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; sprintf(pTmpBuf, "%s", pGlobalTXT_LocalizationStrings[53], 0, pGlobalTXT_LocalizationStrings[630]); } a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); a4 = &a4[v58 - 6] + v58; if ( !i ) { v80 = pGlobalTXT_LocalizationStrings[630]; v76 = 0; v71 = pGlobalTXT_LocalizationStrings[628]; v68 = "%s"; goto LABEL_144; } v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[628]; v59 = v121; v114 = v121->pMonsterInfo.uSpell1ID; if ( v114 && v121->pMonsterInfo.uSpell2ID ) v120 = (SpellBuff *)pGlobalTXT_LocalizationStrings[629]; if ( v114 ) { sprintf(pTmpBuf, "%s", v120, 0, pSpellStats->pInfos[v114].pShortName); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); a4 = &a4[v58 - 3]; v59 = v121; } v60 = v59->pMonsterInfo.uSpell2ID; if ( v60 ) { __debugbreak(); const char *fmt = "\xC\x25\x30\x35\x75\x9\x30\x36\x30\x25\x73\n"; sprintf(pTmpBuf, fmt, 0, pSpellStats->pInfos[v60].pShortName); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); a4 = &a4[v58 - 3]; v59 = v121; } if ( !v59->pMonsterInfo.uSpell1ID && !v59->pMonsterInfo.uSpell2ID ) { v80 = pGlobalTXT_LocalizationStrings[153]; v76 = 0; v71 = pGlobalTXT_LocalizationStrings[628]; v68 = "%s"; LABEL_144: sprintf(pTmpBuf, v68, v71, v76, v80); a1->DrawText(v56, 150, (int)a4, a5, pTmpBuf, 0, 0, 0); v58 = LOBYTE(v56->uFontHeight); a4 = &a4[v58 - 3]; } a4 = &a4[v58 - 3]; a1->DrawText(v56, 150, (int)a4, a5, pGlobalTXT_LocalizationStrings[626], 0, 0, 0); a4 = &a4[LOBYTE(v56->uFontHeight) - 3]; v85 = pGlobalTXT_LocalizationStrings[87]; v86 = pGlobalTXT_LocalizationStrings[6]; v87 = pGlobalTXT_LocalizationStrings[240]; v88 = pGlobalTXT_LocalizationStrings[70]; v89 = pGlobalTXT_LocalizationStrings[142]; v90 = pGlobalTXT_LocalizationStrings[214]; v91 = pGlobalTXT_LocalizationStrings[29]; v92 = pGlobalTXT_LocalizationStrings[133]; v93 = pGlobalTXT_LocalizationStrings[54]; v94 = pGlobalTXT_LocalizationStrings[624]; v96 = (char *)v121->pMonsterInfo.uResFire; v97 = (char *)v121->pMonsterInfo.uResAir; v98 = (char *)v121->pMonsterInfo.uResWater; v99 = (char *)v121->pMonsterInfo.uResEarth; v100 = (char *)v121->pMonsterInfo.uResMind; v101 = (char *)v121->pMonsterInfo.uResSpirit; v102 = (char *)v121->pMonsterInfo.uResBody; v103 = (char *)v121->pMonsterInfo.uResLight; v61 = (char *)v121->pMonsterInfo.uResPhysical; v104 = (char *)v121->pMonsterInfo.uResDark; v105 = v61; if ( v112 ) { v124 = 0; do { v62 = (&v96)[v124]; if ( v62 == (char *)200 ) { v81 = pGlobalTXT_LocalizationStrings[625]; } else { if ( v62 ) v81 = pGlobalTXT_LocalizationStrings[627]; else v81 = pGlobalTXT_LocalizationStrings[153]; } sprintf(pTmpBuf, "%s", (&v85)[v124], 0, v81); a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0); v63 = LOBYTE(v56->uFontHeight); v124 += 4; result = &a4[v63 - 3]; a4 = result; } while ( v124 < 40 ); } else { i = 0; do { sprintf(pTmpBuf, "%s", (&v85)[4 * i], 0, pGlobalTXT_LocalizationStrings[630]); a1->DrawText(v56, 170, (int)a4, a5, pTmpBuf, 0, 0, 0); v65 = LOBYTE(v56->uFontHeight); ++i; result = &a4[v65 - 3]; a4 = result; } while ( i < 10 ); } if ( (signed __int64)pParty->pPartyBuffs[3].uExpireTime > 0 ) { sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[650], v121->sCurrentHP); pFontSmallnum->GetLineWidth(pTmpBuf); result = a1->DrawTitleText( pFontSmallnum, 0, a1->uFrameHeight - LOBYTE(pFontSmallnum->uFontHeight) - 12, 0, pTmpBuf, 3u); } return result; } //----- (0041F54A) -------------------------------------------------------- void __cdecl LoadActualSkyFrame() { if ( pTexture_RestUI_CurrentSkyFrame ) pTexture_RestUI_CurrentSkyFrame->Release(); if ( pTexture_RestUI_CurrentHourglassFrame ) pTexture_RestUI_CurrentHourglassFrame->Release(); pIcons_LOD->_40F9C5(); sprintf(pTmpBuf, "TERRA%03d", pParty->uCurrentMinute / 6 + 10 * pParty->uCurrentHour); pTexture_RestUI_CurrentSkyFrame = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE)]; } //----- (0041F5BE) -------------------------------------------------------- void __cdecl Sleep6Hours() { if ( _506F18_num_hours_to_sleep < 6 ) { pParty->pPlayers[3].pConditions[2] = 0i64; pParty->pPlayers[2].pConditions[2] = 0i64; pParty->pPlayers[1].pConditions[2] = 0i64; pParty->pPlayers[0].pConditions[2] = 0i64; if ( _506F18_num_hours_to_sleep ) { Rest(_506F18_num_hours_to_sleep); _506F18_num_hours_to_sleep = 0; LoadActualSkyFrame(); } if ( dword_506F14 == 2 ) { pGUIWindow_CurrentMenu->Release(); pEventTimer->Resume(); if ( pTexture_RestUI_CurrentSkyFrame ) pTexture_RestUI_CurrentSkyFrame->Release(); if ( pTexture_RestUI_CurrentHourglassFrame ) pTexture_RestUI_CurrentHourglassFrame->Release(); pTexture_RestUI_CurrentHourglassFrame = 0; pTexture_RestUI_CurrentSkyFrame = 0; pIcons_LOD->_4114F2(); pIcons_LOD->_40F9C5(); pCurrentScreen = 0; viewparams->bRedrawGameUI = 1; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) { pOutdoor->UpdateSunlightVectors(); pOutdoor->UpdateFog(); } } dword_506F14 = 0; } else { Rest(6u); _506F18_num_hours_to_sleep -= 6; LoadActualSkyFrame(); } viewparams->bRedrawGameUI = 1; } //----- (0041F6C1) -------------------------------------------------------- void __cdecl RestUI_Initialize() { char *v0; // eax@10 if ( !dword_506F14 ) pAudioPlayer->StopChannels(-1, -1); if ( pCurrentScreen ) { pGUIWindow_CurrentMenu->Release(); pCurrentScreen = 0; viewparams->bRedrawGameUI = 1; } pEventTimer->Pause(); if ( dword_506F14 != 2 ) GUIWindow::Create(518u, 450u, 0, 0, (enum WindowType)90, (int)pBtn_Rest, 0); _506F18_num_hours_to_sleep = 0; dword_506F14 = 0; uRestUI_FoodRequiredToRest = 2; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) uRestUI_FoodRequiredToRest = pOutdoor->GetNumFoodRequiredToRestInCurrentPos( pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); if ( sub_476387() ) { v0 = (char *)&pParty->pPlayers[0].uClass; while ( *v0 != 31 ) { v0 += 6972; if ( (signed int)v0 >= (signed int)((char *)&pParty->pPickedItem.uExpireTime + 5) ) goto LABEL_15; } ++uRestUI_FoodRequiredToRest; } LABEL_15: if ( CheckHiredNPCSpeciality(0x1Du) ) --uRestUI_FoodRequiredToRest; if ( CheckHiredNPCSpeciality(0x1Eu) ) uRestUI_FoodRequiredToRest -= 2; if ( CheckHiredNPCSpeciality(0x30u) ) --uRestUI_FoodRequiredToRest; if ( uRestUI_FoodRequiredToRest < 1 ) uRestUI_FoodRequiredToRest = 1; if ( !_strcmpi(pCurrentMapName, "d29.blv") && (unsigned __int16)_449B57_test_bit(pParty->_award_bits, 98) ) uRestUI_FoodRequiredToRest = 0; ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; pCurrentScreen = 5; _507CD4_RestUI_hourglass_anim_controller = 0; uTextureID_RestUI_restmain = pIcons_LOD->LoadTexture("restmain", TEXTURE_16BIT_PALETTE); uTextureID_RestUI_restb1 = pIcons_LOD->LoadTexture("restb1", TEXTURE_16BIT_PALETTE); uTextureID_RestUI_restb2 = pIcons_LOD->LoadTexture("restb2", TEXTURE_16BIT_PALETTE); uTextureID_RestUI_restb3 = pIcons_LOD->LoadTexture("restb3", TEXTURE_16BIT_PALETTE); uTextureID_RestUI_restb4 = pIcons_LOD->LoadTexture("restb4", TEXTURE_16BIT_PALETTE); uTextureID_RestUI_restexit = pIcons_LOD->LoadTexture("restexit", TEXTURE_16BIT_PALETTE); LoadActualSkyFrame(); pGUIWindow_CurrentMenu = GUIWindow::Create(0, 0, 640u, 480u, (enum WindowType)16, 0, 0); pButton_RestUI_Exit = pGUIWindow_CurrentMenu->CreateButton( 280u, 297u, 154u, 37u, 1, 0, 0xA7u, 0, 0, "", (Texture *)(uTextureID_RestUI_restexit != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restexit] : 0), 0); pButton_RestUI_Main = pGUIWindow_CurrentMenu->CreateButton( 24u, 154u, 225u, 37u, 1, 0, 0x61u, 0, 0x52u, "", (Texture *)(uTextureID_RestUI_restb4 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb4] : 0), 0); pButton_RestUI_WaitUntilDawn = pGUIWindow_CurrentMenu->CreateButton( 61u, 232u, 154u, 33u, 1, 0, 0x6Du, 0, 0x44u, "", (Texture *)(uTextureID_RestUI_restb1 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb1] : 0), 0); pButton_RestUI_Wait1Hour = pGUIWindow_CurrentMenu->CreateButton( 61u, 264u, 154u, 33u, 1, 0, 0x60u, 0, 0x48u, "", (Texture *)(uTextureID_RestUI_restb2 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb2] : 0), 0); pButton_RestUI_Wait5Minutes = pGUIWindow_CurrentMenu->CreateButton( 61u, 296u, 154u, 33u, 1, 0, 0x5Fu, 0, 0x4Du, "", (Texture *)(uTextureID_RestUI_restb3 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restb3] : 0), 0); } //----- (0041FA01) -------------------------------------------------------- void __cdecl RestUI_Draw() { int v0; // esi@1 Player **ppPlayers; // ecx@1 Player *pPlayer; // eax@2 unsigned int v3; // eax@15 char v4; // al@17 bool v5; // eax@21 GUIButton Dst; // [sp+8h] [bp-DCh]@19 //double v7; // [sp+C4h] [bp-20h]@17 float v8; // [sp+CCh] [bp-18h]@17 __int64 v9; // [sp+D0h] [bp-14h]@17 unsigned int v10; // [sp+D8h] [bp-Ch]@9 __int16 a9[2]; // [sp+DCh] [bp-8h]@1 int a5; // [sp+E0h] [bp-4h]@1 v0 = 0; a5 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xAu, 0, 0); *(int *)a9 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE6u, 0xD6u, 0xC1u); ppPlayers = &pPlayers[1]; do { pPlayer = *ppPlayers; if ( !(*ppPlayers)->pConditions[14] && !pPlayer->pConditions[16] && pPlayer->sHealth > 0 ) ++v0; ++ppPlayers; } while ( (signed int)ppPlayers <= (signed int)&pPlayers[4] ); if ( v0 ) { pRenderer->DrawTextureIndexed( 8u, 8u, (Texture *)(uTextureID_RestUI_restmain != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_RestUI_restmain] : 0)); v10 = pParty->uCurrentHour; dword_506F1C = pGUIWindow_CurrentMenu->pCurrentPosActiveItem; if ( (signed int)pParty->uCurrentHour <= 12 ) { if ( !v10 ) v10 = 12; } else { v10 -= 12; } pRenderer->DrawTextureIndexed(16u, 26u, pTexture_RestUI_CurrentSkyFrame); if ( pTexture_RestUI_CurrentHourglassFrame ) { pTexture_RestUI_CurrentHourglassFrame->Release(); pIcons_LOD->_40F9C5(); } v3 = pEventTimer->uTimeElapsed + _507CD4_RestUI_hourglass_anim_controller; _507CD4_RestUI_hourglass_anim_controller += pEventTimer->uTimeElapsed; if ( (unsigned int)_507CD4_RestUI_hourglass_anim_controller >= 512 ) { v3 = 0; _507CD4_RestUI_hourglass_anim_controller = 0; } v9 = v3; v8 = (double)v3 * 0.001953125 * 120.0; //v7 = v8 + 6.7553994e15; HIDWORD(v9) = floorf(v8 + 0.5f);//LODWORD(v7); v4 = (int)floorf(v8 + 0.5f) % 256 + 1;//LOBYTE(v7) + 1; byte_4E2BC8 = v4; if ( (unsigned __int8)(v4) >= 0x78u ) { v4 = 1; byte_4E2BC8 = 1; } sprintf(pTmpBuf, "hglas%03d", (unsigned __int8)v4); pTexture_RestUI_CurrentHourglassFrame = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE)]; pRenderer->DrawTextureIndexed(0x10Bu, 0x9Fu, pTexture_RestUI_CurrentHourglassFrame); memset(&Dst, 0, 0xBCu); Dst.uX = 24; Dst.uY = 154; Dst.uWidth = 171; Dst.uHeight = 37; Dst.uZ = 194; Dst.uW = 190; Dst.pParent = pButton_RestUI_WaitUntilDawn->pParent; Dst.DrawLabel(pGlobalTXT_LocalizationStrings[183], pFontCreate, a5, *(int **)a9); Dst.pParent = 0; sprintf(pTmpBuf, "\r408%d", uRestUI_FoodRequiredToRest); pGUIWindow_CurrentMenu->DrawText(pFontCreate, 0, 164, a5, pTmpBuf, 0, 0, *(unsigned int *)a9); pButton_RestUI_WaitUntilDawn->DrawLabel( pGlobalTXT_LocalizationStrings[237], pFontCreate, a5, *(int **)a9); pButton_RestUI_Wait1Hour->DrawLabel(pGlobalTXT_LocalizationStrings[239], pFontCreate, a5, *(int **)a9); pButton_RestUI_Wait5Minutes->DrawLabel(pGlobalTXT_LocalizationStrings[238], pFontCreate, a5, *(int **)a9); pButton_RestUI_Exit->DrawLabel(pGlobalTXT_LocalizationStrings[81], pFontCreate, a5, *(int **)a9); memset(&Dst, 0, 0xBCu); Dst.uX = 45; Dst.uY = 199; Dst.uWidth = 185; Dst.uHeight = 30; Dst.uZ = 229; Dst.uW = 228; Dst.pParent = pButton_RestUI_WaitUntilDawn->pParent; Dst.DrawLabel(pGlobalTXT_LocalizationStrings[236], pFontCreate, a5, *(int **)a9); Dst.pParent = 0; v5 = pParty->uCurrentHour >= 0xC && pParty->uCurrentHour < 0x18; sprintf(pTmpBuf, "%d:%02d %s", v10, pParty->uCurrentMinute, aAMPMNames[v5]); pGUIWindow_CurrentMenu->DrawText(pFontCreate, 368, 168, a5, pTmpBuf, 0, 0, *(unsigned int *)a9); sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[56], pParty->uDaysPlayed + 1); pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 190, a5, pTmpBuf, 0, 0, *(unsigned int *)a9); sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[146], pParty->uCurrentMonth + 1); pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 222, a5, pTmpBuf, 0, 0, *(unsigned int *)a9); sprintf(pTmpBuf, "%s\r190%d", pGlobalTXT_LocalizationStrings[245], pParty->uCurrentYear); pGUIWindow_CurrentMenu->DrawText(pFontCreate, 350, 254, a5, pTmpBuf, 0, 0, *(unsigned int *)a9); if ( dword_506F14 ) Sleep6Hours(); } else { GUIWindow::Create( pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, (enum WindowType)96, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]); } } // 4E2BC8: using guessed type char byte_4E2BC8; // 506F14: using guessed type int dword_506F14; // 506F1C: using guessed type int dword_506F1C; // 50765C: using guessed type int uTextureID_RestUI_restmain; // 507CD4: using guessed type int 507CD4_RestUI_hourglass_anim_controller; //----- (0041FE71) -------------------------------------------------------- int Chest::CanPlaceItemAt(signed int a1, int a2, unsigned int uChestID) { int v3; // eax@1 unsigned int v4; // eax@1 Texture *v5; // ecx@1 signed int v6; // eax@1 signed int v7; // edi@3 signed int v8; // eax@3 int v9; // edi@3 int v10; // ebx@5 int v11; // esi@9 int v12; // edx@10 int v13; // ecx@11 char *v14; // eax@12 int v16; // [sp+Ch] [bp-Ch]@1 signed int v17; // [sp+10h] [bp-8h]@1 signed int v18; // [sp+14h] [bp-4h]@1 v17 = a1; v3 = pChests[uChestID].uChestBitmapID; v16 = pChestHeightsByType[v3]; v18 = pChestWidthsByType[v3]; v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[a2].pIconName, TEXTURE_16BIT_PALETTE); v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); v6 = (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureWidth : 24); if ( v6 < 14 ) v6 = 14; v7 = v6 - 14; v8 = v5->uTextureHeight; v9 = (v7 >> 5) + 1; if ( v8 < 14 ) v8 = 14; v10 = ((v8 - 14) >> 5) + 1; if ( !areWeLoadingTexture ) { v5->Release(); pIcons_LOD->_40F9C5(); } if ( v9 + v17 % v18 <= v18 && v10 + v17 / v18 <= v16 ) { v11 = 0; if ( v10 <= 0 ) return 1; v12 = 0; while ( 1 ) { v13 = 0; if ( v9 > 0 ) break; LABEL_15: v12 += v18; ++v11; if ( v11 >= v10 ) return 1; } v14 = (char *)&pChests[0].pInventoryIndices[v17 + v12 + 2662 * uChestID]; while ( !*(short *)v14 ) { ++v13; v14 += 2; if ( v13 >= v9 ) goto LABEL_15; } } return 0; } // 506128: using guessed type int areWeLoadingTexture; //----- (0041FF64) -------------------------------------------------------- int Chest::_41FF64(unsigned int uChestID) { unsigned int v1; // ecx@1 signed int result; // eax@1 int v3; // edx@1 ItemGen *pItem; // ecx@2 v1 = uChestID; result = 0; v3 = pChestWidthsByType[pChests[v1].uChestBitmapID] * pChestHeightsByType[pChests[v1].uChestBitmapID]; if ( v3 <= 0 ) { LABEL_5: result = -1; } else { pItem = pChests[v1].mm7__vector_pItems; while ( pItem->uItemID ) { ++result; ++pItem; if ( result >= v3 ) goto LABEL_5; } } return result; } //----- (0041FFA2) -------------------------------------------------------- int Chest::_41FFA2(int a1, ItemGen *a2, unsigned int uChestID) { int v3; // eax@1 ItemGen *v4; // edi@1 int v5; // esi@1 int result; // eax@11 unsigned int v7; // eax@12 int v8; // edx@12 int v9; // ecx@12 signed int v10; // eax@12 signed int v11; // edi@14 unsigned int v12; // esi@14 int v13; // edi@16 void *v14; // edi@21 int v15; // edi@21 int i; // ecx@21 ItemGen *Src; // [sp+Ch] [bp-18h]@1 signed int v18; // [sp+10h] [bp-14h]@2 int v19; // [sp+14h] [bp-10h]@1 int v20; // [sp+18h] [bp-Ch]@19 signed int v21; // [sp+1Ch] [bp-8h]@1 signed int v22; // [sp+20h] [bp-4h]@3 int v23; // [sp+20h] [bp-4h]@19 v21 = 0; v3 = pChests[uChestID].uChestBitmapID; v4 = a2; v5 = pChestWidthsByType[v3] * pChestHeightsByType[v3]; Src = a2; v19 = pChestWidthsByType[v3]; if ( a1 == -1 ) { v18 = _41FF64(uChestID); if ( v18 == -1 ) return 0; v22 = 0; if ( v5 > 0 ) { while ( !Chest::CanPlaceItemAt(v22, v4->uItemID, (unsigned int)pChestWindow->ptr_1C) ) { ++v22; if ( v22 >= v5 ) goto LABEL_8; } v21 = v22; } LABEL_8: if ( v22 == v5 ) { if ( uActiveCharacter ) pPlayers[uActiveCharacter]->PlaySound(15, 0); return 0; } v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v4->uItemID].pIconName, TEXTURE_16BIT_PALETTE); HIWORD(v8) = 0; v9 = v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0; v10 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); if ( v10 < 14 ) v10 = 14; v11 = *(short *)(v9 + 26); v12 = ((v10 - 14) >> 5) + 1; if ( v11 < 14 ) v11 = 14; v13 = ((v11 - 14) >> 5) + 1; if ( !areWeLoadingTexture ) { ((Texture *)v9)->Release(); pIcons_LOD->_40F9C5(); } if ( v13 > 0 ) { v23 = 0; v20 = v13; do { if ( (signed int)v12 > 0 ) { v14 = &pChests[0].pInventoryIndices[v21 + v23 + 2662 * uChestID]; LOWORD(v8) = -1 - v21; v8 <<= 16; LOWORD(v8) = -1 - v21; memset32(v14, v8, v12 >> 1); v15 = (int)((char *)v14 + 4 * (v12 >> 1)); for ( i = v12 & 1; i; --i ) { *(short *)v15 = v8; v15 += 2; } } v23 += v19; --v20; } while ( v20 ); } pChests[0].pInventoryIndices[v21 + 2662 * uChestID] = v18 + 1; memcpy(&pChests[uChestID].mm7__vector_pItems[v18], Src, 0x24u); result = v21 + 1; } else { result = 1; } return result; } // 506128: using guessed type int areWeLoadingTexture; //----- (0042013E) -------------------------------------------------------- unsigned int Chest::PlaceItemAt(unsigned int a1, unsigned int uItemIdx, unsigned int uChestID) { int v3; // esi@1 unsigned int v4; // ebx@1 int uItemID; // edi@1 int v6; // edx@4 unsigned int v7; // eax@5 Texture *v8; // ecx@5 signed int v9; // eax@5 signed int v10; // edi@7 unsigned int v11; // ebx@7 int v12; // edi@9 int v13; // edx@12 void *v14; // edi@14 int v15; // edi@14 int i; // ecx@14 unsigned int result; // eax@18 __int16 v18; // [sp+Ch] [bp-10h]@1 int v19; // [sp+10h] [bp-Ch]@11 int v20; // [sp+14h] [bp-8h]@12 unsigned int v21; // [sp+18h] [bp-4h]@1 v3 = 5324 * uChestID; v21 = a1; v4 = 5324 * uChestID + 36 * uItemIdx; v18 = uItemIdx; uItemID = *(unsigned int *)((char *)&pChests[0].mm7__vector_pItems[0].uItemID + v4); pItemsTable->SetSpecialBonus((ItemGen *)((char *)pChests[0].mm7__vector_pItems + v4)); if ( uItemID >= 135 && uItemID <= 159 && !*(int *)((char *)&pChests[0].mm7__vector_pItems[0].uNumCharges + v4) ) { v6 = rand() % 21 + 10; *(int *)((char *)&pChests[0].mm7__vector_pItems[0].uNumCharges + v4) = v6; *(&pChests[0].mm7__vector_pItems[0].uMaxCharges + v4) = v6; } v7 = pIcons_LOD->LoadTexture(pItemsTable->pItems[uItemID].pIconName, TEXTURE_16BIT_PALETTE); v8 = (Texture *)(v7 != -1 ? (int)&pIcons_LOD->pTextures[v7] : 0); v9 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); if ( v9 < 14 ) v9 = 14; v10 = v8->uTextureHeight; v11 = ((v9 - 14) >> 5) + 1; if ( v10 < 14 ) v10 = 14; v12 = ((v10 - 14) >> 5) + 1; if ( !areWeLoadingTexture ) { v8->Release(); pIcons_LOD->_40F9C5(); } v19 = pChestWidthsByType[*(unsigned __int16 *)((char *)&pChests[0].uChestBitmapID + v3)]; if ( v12 > 0 ) { v13 = 0; v20 = v12; do { if ( (signed int)v11 > 0 ) { v14 = &pChests[0].pInventoryIndices[v21 + v13 + 2662 * uChestID]; LOWORD(v3) = -1 - v21; v3 <<= 16; LOWORD(v3) = -1 - v21; memset32(v14, v3, v11 >> 1); v15 = (int)((char *)v14 + 4 * (v11 >> 1)); for ( i = v11 & 1; i; --i ) { *(short *)v15 = v3; v15 += 2; } } v13 += v19; --v20; } while ( v20 ); } result = v21 + 2662 * uChestID; pChests[0].pInventoryIndices[result] = v18 + 1; return result; } // 506128: using guessed type int areWeLoadingTexture; //----- (00420284) -------------------------------------------------------- char *Chest::_420284(unsigned int uChestID) { int v1; // ebx@1 unsigned int v2; // esi@1 unsigned int v3; // esi@1 int uChestArea; // edi@1 int v5; // eax@2 int v6; // ebx@11 char *result; // eax@18 char Dst[144]; // [sp+Ch] [bp-A0h]@1 int v9; // [sp+9Ch] [bp-10h]@10 unsigned int v10; // [sp+A0h] [bp-Ch]@1 unsigned int v11; // [sp+A4h] [bp-8h]@8 unsigned int *v12; // [sp+A8h] [bp-4h]@9 v1 = 0; v2 = uChestID; v10 = uChestID; pRenderer->ClearZBuffer(0, 479); v3 = v2; uChestArea = pChestWidthsByType[pChests[v3].uChestBitmapID] * pChestHeightsByType[pChests[v3].uChestBitmapID]; memset(Dst, 0, 0x90u); if ( uChestArea > 0 ) { do { do v5 = (unsigned __int8)rand(); while ( v5 >= uChestArea ); while ( Dst[v5] ) { ++v5; if ( v5 == uChestArea ) v5 = 0; } Dst[v5] = v1++; } while ( v1 < uChestArea ); } v11 = 0; if ( uChestArea > 0 ) { v12 = &pChests[v3].mm7__vector_pItems[0].uAttributes; do { v9 = *(v12 - 5); if ( v9 ) { v6 = 0; while ( !Chest::CanPlaceItemAt((unsigned __int8)Dst[v6], v9, v10) ) { ++v6; if ( v6 >= uChestArea ) goto LABEL_17; } Chest::PlaceItemAt((unsigned __int8)Dst[v6], v11, v10); if ( pChests[v3].uFlags & 4 ) *v12 |= 1u; } LABEL_17: ++v11; v12 += 9; } while ( (signed int)v11 < uChestArea ); } result = (char *)&pChests[v3].uFlags; pChests[v3].uFlags = pChests[v3].uFlags & 0xFFFB | 2; return result; } // 420284: using guessed type char Dst[144]; //----- (0042038D) -------------------------------------------------------- void __cdecl sub_42038D() { POINT *v0; // esi@2 int v1; // ecx@2 const char *v2; // eax@3 POINT v3; // [sp+0h] [bp-10h]@2 POINT a2; // [sp+8h] [bp-8h]@1 if ( pMouse->GetCursorPos(&a2)->y < 350 ) { v0 = pMouse->GetCursorPos(&a2); v1 = pRenderer->pActiveZBuffer[v0->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v3)->y]]; if ( v1 ) { auto _w = (ItemGen *)(&pOtherOverlayList->pOverlays[49].field_4 + 2662 * (unsigned int)pChestWindow->ptr_1C + 18 * *((short *)&pChests[0].mm7__vector_pItems[139].uExpireTime + v1 + 2662 * (unsigned int)pChestWindow->ptr_1C + 3)); v2 = _w->GetDisplayName(); sub_41C0B8_set_status_string(v2); } } } //----- (0042041E) -------------------------------------------------------- bool Chest::Open(unsigned int uChestID) { char *v1; // edi@5 unsigned int v2; // eax@8 GUIWindow *v3; // eax@15 int v5; // edx@16 int v6; // eax@16 ODMFace *v7; // eax@19 int v8; // edx@19 int v9; // edi@19 signed int v10; // ebx@19 int v11; // ecx@19 int v12; // eax@19 BLVFace *v13; // eax@20 int v14; // ebx@21 int v15; // edi@21 int v16; // ecx@22 __int64 v17; // qax@22 double v18; // st7@23 double v19; // st6@23 double v20; // st7@23 int v21; // ecx@26 char v22[12]; // ST4C_12@28 unsigned int *v23; // edi@28 unsigned __int16 v24; // di@28 signed int v25; // ecx@28 char *v26; // edx@29 unsigned __int16 v27; // ax@32 //LayingItem a1; // [sp+14h] [bp-B0h]@28 int v29; // [sp+84h] [bp-40h]@16 int v30; // [sp+88h] [bp-3Ch]@16 int v31; // [sp+8Ch] [bp-38h]@16 int v32; // [sp+90h] [bp-34h]@16 float v33; // [sp+94h] [bp-30h]@23 char *v34; // [sp+98h] [bp-2Ch]@5 int v35; // [sp+9Ch] [bp-28h]@16 Vec3_int_ pOut; // [sp+A0h] [bp-24h]@28 int a4; // [sp+ACh] [bp-18h]@1 int v38; // [sp+B0h] [bp-14h]@21 int sRotX; // [sp+B4h] [bp-10h]@23 float v40; // [sp+B8h] [bp-Ch]@23 float v41; // [sp+BCh] [bp-8h]@23 int sRotY; // [sp+C0h] [bp-4h]@8 a4 = uChestID; if ( (uChestID & 0x80000000u) != 0 || (signed int)uChestID >= 20 ) return 0; ++pIcons_LOD->uTexturePacksCount; if ( !pIcons_LOD->uNumPrevLoadedFiles ) pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; v1 = (char *)&pChests[uChestID].uFlags; v34 = v1; if ( !(*v1 & CHEST_ITEMS_PLACED) ) Chest::_420284(uChestID); if ( !uActiveCharacter ) return 0; *(float *)&sRotY = 0.0; v2 = pMapStats->GetMapInfo(pCurrentMapName); if ( !(*v1 & 1) || !v2 ) goto LABEL_12; if ( pPlayers[uActiveCharacter]->GetDisarmTrap() < 2 * pMapStats->pInfos[v2].field_2D ) { v29 = 811; v30 = 812; v31 = 813; v32 = 814; v5 = rand() % 4; v6 = dword_5B5920 >> 3; v35 = v5; if ( (dword_5B5920 & 7) == 5 ) { v16 = v6; v14 = pLevelDecorations[v6].vPosition.x; v38 = pLevelDecorations[v6].vPosition.y; v17 = pDecorationList->pDecorations[pLevelDecorations[v6].uDecorationDescID].uDecorationHeight; v15 = pLevelDecorations[v16].vPosition.z + (((signed int)v17 - HIDWORD(v17)) >> 1); } else { if ( (dword_5B5920 & 7) != 6 ) goto LABEL_12; if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor) { v7 = &pOutdoor->pBModels[dword_5B5920 >> 9].pFaces[(dword_5B5920 >> 3) & 0x3F]; v8 = v7->pBoundingBox.y1; v9 = v7->pBoundingBox.z2; v10 = v7->pBoundingBox.x1 + v7->pBoundingBox.x2; v11 = v7->pBoundingBox.y2; v12 = v7->pBoundingBox.z1; } else { v13 = &pIndoor->pFaces[v6]; v8 = v13->pBounding.y1; v9 = v13->pBounding.z2; v10 = v13->pBounding.x1 + v13->pBounding.x2; v11 = v13->pBounding.y2; v12 = v13->pBounding.z1; } v14 = v10 >> 1; v38 = (v8 + v11) >> 1; v15 = (v12 + v9) >> 1; } v18 = (double)pParty->vPosition.x - (double)v14; *(float *)&a4 = v18; v19 = (double)pParty->vPosition.y - (double)v38; v33 = v19; v41 = (double)pParty->sEyelevel + (double)pParty->vPosition.z - (double)v15; *(float *)&sRotY = v19 * v19; *(float *)&sRotX = v18 * v18; v20 = sqrt(v41 * v41 + *(float *)&sRotX + *(float *)&sRotY); v40 = v20; if ( v20 <= 1.0 ) { *(float *)&sRotX = 0.0; *(float *)&sRotY = 0.0; } else { sRotY = (signed __int64)sqrt(*(float *)&sRotX + *(float *)&sRotY); sRotX = stru_5C6E00->Atan2((signed __int64)*(float *)&a4, (signed __int64)v33); sRotY = stru_5C6E00->Atan2(sRotY, (signed __int64)v41); } v21 = 256; if ( v40 < 256.0 ) v21 = (signed __int64)v40 / 4; *(int *)&v22[8] = v15; *(_QWORD *)v22 = __PAIR__(v38, v14); Vec3_int_::Rotate(v21, sRotX, sRotY, *(Vec3_int_ *)v22, &pOut.x, &pOut.z, &pOut.y); v23 = (unsigned int *)(&v29 + v35); sub_42F7EB_DropItemAt(*v23, pOut.x, pOut.z, pOut.y, 0, 1, 0, 0x30u, 0); LayingItem a1; // [sp+14h] [bp-B0h]@28 //LayingItem::LayingItem(&a1); a1.stru_24.Reset(); v24 = *(short *)v23; v25 = 0; a1.field_50 = 0; a1.field_4C = 0; a1.field_48 = 0; a1.field_54 = 0; a1.uItemType = v24; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LABEL_32: v27 = 0; } else { v26 = (char *)&pObjectList->pObjects->uObjectID; while ( v24 != *(short *)v26 ) { ++v25; v26 += 56; if ( v25 >= (signed int)pObjectList->uNumObjects ) goto LABEL_32; } v27 = v25; } a1.uObjectDescID = v27; a1.vPosition.y = pOut.z; a1.vPosition.x = pOut.x; a1.vPosition.z = pOut.y; a1.uSoundID = 0; a1.uAttributes = 48; a1.uSectorID = pIndoor->GetSector(pOut.x, pOut.z, pOut.y); a1.uSpriteFrameID = 0; a1.field_58 = 0; a1.field_5C = 0; a1.uFacing = 0; a1.Create(0, 0, 0, 0); pAudioPlayer->PlaySound(SOUND_8, 0, 0, -1, 0, 0, 0, 0); a1._438E35(); *v34 &= 0xFEu; if ( uActiveCharacter && !qword_A750D8 && !dword_507CD8 ) { qword_A750D8 = 256i64; word_A750E0 = 5; word_A750E2 = uActiveCharacter; } pIcons_LOD->_4114F2(); dword_507CD8 = 0; return 0; } *v1 &= 0xFEu; sRotY = 1; LABEL_12: pAudioPlayer->StopChannels(-1, -1); pAudioPlayer->PlaySound((SoundID)208, 0, 0, -1, 0, 0, 0, 0); if ( *(float *)&sRotY != 0.0 ) { if ( !dword_507CD8 ) pPlayers[uActiveCharacter]->PlaySound(4, 0); } dword_507CD8 = 0; v3 = GUIWindow::Create(0, 0, 640u, 480u, WINDOW_Chest, a4, 0); pGUIWindow_CurrentMenu = v3; pChestWindow = v3; pBtn_ExitCancel = v3->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[79],// Exit (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0), 0); pChestWindow->CreateButton(7u, 8u, 460u, 343u, 1, 0, 0xCu, 0, 0, "", 0); pCurrentScreen = 10; pEventTimer->Pause(); return 1; } //----- (0042092D) -------------------------------------------------------- void Chest::DrawChestUI(unsigned int uChestID) { Render *v1; // edi@1 unsigned int v2; // ebx@1 unsigned int v3; // ebx@1 int v4; // eax@1 unsigned int v5; // eax@1 int v6; // ecx@3 unsigned int v7; // eax@4 Texture *v8; // esi@4 signed int v9; // ecx@4 signed int v10; // edx@4 signed int v11; // eax@4 int v12; // eax@6 int v13; // eax@6 unsigned int v14; // ST34_4@8 int v15; // edi@8 int *v16; // [sp+Ch] [bp-28h]@1 int v17; // [sp+10h] [bp-24h]@4 int v18; // [sp+14h] [bp-20h]@1 signed int v19; // [sp+18h] [bp-1Ch]@1 int v20; // [sp+1Ch] [bp-18h]@1 signed int v21; // [sp+20h] [bp-14h]@1 char *v22; // [sp+2Ch] [bp-8h]@2 signed int v23; // [sp+30h] [bp-4h]@1 v1 = pRenderer; v2 = uChestID; v16 = pRenderer->pActiveZBuffer; pRenderer->ClearZBuffer(0, 479); v3 = v2; v4 = pChests[v3].uChestBitmapID; v20 = pChestSmthn1ByType[v4]; v18 = pChestSmthn2ByType[v4]; v21 = pChestWidthsByType[v4]; v19 = pChestHeightsByType[v4]; sprintf(pTmpBuf, "chest%02d", pChestList->pChests[pChests[v3].uChestBitmapID].uTextureID); v5 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE); pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v5 != -1 ? (int)&pIcons_LOD->pTextures[v5] : 0)); v23 = 0; if ( v21 * v19 > 0 ) { v22 = (char *)pChests[v3].pInventoryIndices; do { v6 = *(short *)v22; if ( v6 > 0 ) { v17 = v18 + 32 * v23 / v19; v7 = pIcons_LOD->LoadTexture( pItemsTable->pItems[*(int *)((char *)&pOtherOverlayList->pOverlays[49].field_4 + 36 * v6 + v3 * 5324)].pIconName, TEXTURE_16BIT_PALETTE); v8 = (Texture *)(v7 != -1 ? &pIcons_LOD->pTextures[v7] : 0); v9 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); v10 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureHeight : 26); v11 = (v7 != -1 ? pIcons_LOD->pTextures[v7].uTextureWidth : 24); if ( v9 < 14 ) v11 = 14; v12 = v11 - 14; LOBYTE(v12) = v12 & 0xE0; v13 = v12 + 32; if ( (signed int)v8->uTextureHeight < 14 ) v10 = 14; v14 = v20 + 32 * v23 % v21 + ((v13 - v9) >> 1); v15 = v17 + ((((v10 - 14) & 0xFFFFFFE0) - v8->uTextureHeight + 32) >> 1); pRenderer->DrawTextureTransparent( v14, v17 + ((((v10 - 14) & 0xFFFFFFE0) - v8->uTextureHeight + 32) >> 1), v8); sub_40F92A(&v16[v14 + pSRZBufferLineOffsets[v15]], v8, v23 + 1); v1 = pRenderer; } ++v23; v22 += 2; } while ( v23 < v21 * v19 ); } pRenderer->DrawTextureIndexed( pBtn_ExitCancel->uX, pBtn_ExitCancel->uY, (Texture *)(uTextureID_506438 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_506438] : 0)); } //----- (00420B13) -------------------------------------------------------- void __fastcall sub_420B13(int a1, int a2) { void *v2; // eax@1 ItemGen *v3; // ebx@1 unsigned int v4; // eax@1 Texture *v5; // ecx@1 signed int v6; // eax@1 signed int v7; // edi@3 signed int v8; // eax@3 int v9; // edi@3 int v10; // eax@5 int v11; // esi@8 unsigned int v12; // ecx@10 void *v13; // edi@10 unsigned __int8 v14; // cf@10 int v15; // edi@10 int i; // ecx@10 int v17; // [sp+Ch] [bp-14h]@1 int v18; // [sp+10h] [bp-10h]@3 int v19; // [sp+14h] [bp-Ch]@1 void *v20; // [sp+18h] [bp-8h]@1 int v21; // [sp+1Ch] [bp-4h]@5 int v22; // [sp+1Ch] [bp-4h]@8 v19 = a2; v2 = pChestWindow->ptr_1C; v20 = v2; v2 = (void *)(5324 * (int)v2); v3 = (ItemGen *)((char *)v2 + 36 * a1 + (int)((char *)pChests + 4)); v17 = pChestWidthsByType[*(short *)((char *)v2 + (int)pChests)]; v4 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v3->uItemID].pIconName, TEXTURE_16BIT_PALETTE); v5 = (Texture *)(v4 != -1 ? (int)&pIcons_LOD->pTextures[v4] : 0); v6 = (v4 != -1 ? pIcons_LOD->pTextures[v4].uTextureWidth : 24); if ( v6 < 14 ) v6 = 14; v7 = v6 - 14; v8 = v5->uTextureHeight; v9 = (v7 >> 5) + 1; v18 = v9; if ( v8 < 14 ) v8 = 14; v10 = ((v8 - 14) >> 5) + 1; v21 = v10; if ( !areWeLoadingTexture ) { v5->Release(); pIcons_LOD->_40F9C5(); v10 = v21; } if ( v10 > 0 ) { v11 = 0; v22 = v10; do { if ( v9 > 0 ) { v12 = v9; v13 = &pChests[0].pInventoryIndices[v19 + v11 + 2662 * (int)v20]; v14 = v12 & 1; v12 >>= 1; memset(v13, 0, 4 * v12); v15 = (int)((char *)v13 + 4 * v12); for ( i = v14; i; --i ) { *(short *)v15 = 0; v15 += 2; } v9 = v18; } v11 += v17; --v22; } while ( v22 ); } v3->Reset(); } // 506128: using guessed type int areWeLoadingTexture; //----- (00420C05) -------------------------------------------------------- void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal) { unsigned int v2; // edi@1 int v3; // ebp@1 unsigned int v4; // esi@1 int v5; // ecx@6 NPCData *v6; // eax@6 signed int v7; // edx@8 signed int v8; // ebx@10 char *v9; // edi@11 signed int v10; // ecx@17 int v11; // eax@21 NPCData *v12; // ecx@21 unsigned int v13; // ecx@23 signed int v14; // [sp+Ch] [bp-4h]@6 v2 = 0; v3 = 0; v4 = uNumGold; if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal ) { if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 ) { sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold! } else { if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 2 ) pTmpBuf2[0] = 0; } } else { v14 = 0; v5 = 0; v6 = pParty->pHirelings; do { if ( v6->pName ) { v7 = v14++; pTmpBuf[v7] = v5; } ++v6; ++v5; } while ( (signed int)v6 < (signed int)&pParty->pPickedItem ); v8 = 0; if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) { v9 = (char *)pNPCStats->pNewNPCData; do { if ( v9[8] & 0x80 && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v9, pParty->pHirelings[0].pName)) && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v9, pParty->pHirelings[1].pName)) ) { v10 = v14++; pTmpBuf[v10] = v8 + 2; } ++v8; v9 += 76; } while ( v8 < (signed int)pNPCStats->uNumNewNPCs ); v2 = 0; } if ( v14 > 0 ) { do { v11 = (unsigned __int8)pTmpBuf[v2]; v12 = &pNPCStats->pNPCData[v11 + 499]; if ( (unsigned __int8)pTmpBuf[v2] < 2u ) v12 = &pParty->pHirelings[v11]; v13 = v12->uProfession; if ( v13 ) v3 += *(&pNPCStats->field_13A58 + 5 * v13); ++v2; } while ( (signed int)v2 < v14 ); } if ( CheckHiredNPCSpeciality(0x1Fu) ) v4 += (signed int)(10 * v4) / 100; if ( CheckHiredNPCSpeciality(0x20u) ) v4 += (signed int)(20 * v4) / 100; if ( CheckHiredNPCSpeciality(0x2Du) ) v4 += (signed int)(10 * v4) / 100; if ( v3 ) { v3 = (signed int)(v4 * v3 / 100) / 100; if ( v3 < 1 ) v3 = 1; sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[466], v4, v3);// You found %lu gold (followers take %lu)! } else { sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[467], v4);// You found %lu gold! } v2 = 0; } pParty->uNumGold += v4 - v3; pUIAnim_Gold->uAnimTime = v2; pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; if ( pTmpBuf2[0] ) ShowStatusBarString(pTmpBuf2, 2u); pAudioPlayer->PlaySound(SOUND_GoldReceived, v2, v2, -1, v2, v2, v2, v2); } //----- (00420E01) -------------------------------------------------------- void __cdecl sub_420E01() { void *v0; // edi@1 POINT *v1; // esi@2 int v2; // eax@2 int v3; // ebx@4 int v4; // esi@6 int v5; // ecx@6 //LayingItem v6; // [sp+Ch] [bp-80h]@1 char v7; // [sp+7Ch] [bp-10h]@2 POINT a2; // [sp+84h] [bp-8h]@2 LayingItem v6; // [sp+Ch] [bp-80h]@1 //LayingItem::LayingItem(&v6); v0 = pGUIWindow_CurrentMenu->ptr_1C; if ( pParty->pPickedItem.uItemID ) { if ( Chest::_41FFA2(-1, &pParty->pPickedItem, (unsigned int)pGUIWindow_CurrentMenu->ptr_1C) ) pMouse->RemoveHoldingItem(); } else { v1 = pMouse->GetCursorPos(&a2); v2 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v7)->y]] & 0xFFFF; if ( v2 ) { if ( v2 ) v3 = v2 - 1; else v3 = -1; v4 = pChests[0].pInventoryIndices[v3 + 2662 * (int)v0] - 1; v5 = 5324 * (int)v0 + 36 * v4; if ( pItemsTable->pItems[*(unsigned int *)((char *)&pChests[0].mm7__vector_pItems[0].uItemID + v5)].uEquipType == 18 ) { party_finds_gold(*(int *)((char *)&pChests[0].mm7__vector_pItems[0].uAdditionalValue + v5), 0); viewparams->bRedrawGameUI = 1; } else { pParty->SetHoldingItem((ItemGen *)((char *)pChests[0].mm7__vector_pItems + v5)); } sub_420B13(v4, v3); } } } //----- (00420EFF) -------------------------------------------------------- void __cdecl GameUI_WritePointedObjectStatusString() { int v1; // ebx@6 GUIWindow *v2; // edi@7 GUIButton *i; // ecx@11 Player *v4; // eax@19 char v5; // cl@19 unsigned int v6; // eax@19 int v7; // ecx@19 __int16 v8; // fps@23 unsigned __int8 v9; // c0@23 unsigned __int8 v10; // c3@23 enum UIMessageType v11; // esi@24 int v12; // edx@25 char *v13; // ecx@28 int v14; // eax@41 ItemGen *v15; // ecx@44 int v16; // ecx@46 const char *v17; // eax@49 signed int v18; // eax@55 signed int v19; // ecx@63 BLVFace *pFace; // eax@69 __int16 v21; // ax@70 const char *v22; // eax@72 LevelDecoration *v23; // ecx@75 LevelDecoration *v24; // esi@75 __int16 v25; // ax@75 const char *v26; // ecx@79 Actor *pActor; // ecx@82 char *v28; // esi@82 int v29; // eax@82 signed int v30; // ecx@88 const char *v31; // eax@91 __int16 v32; // fps@109 unsigned __int8 v33; // c0@109 unsigned __int8 v34; // c3@109 enum UIMessageType v35; // esi@110 int v36; // edx@111 enum UIMessageType v37; // edx@117 int v38; // ecx@118 const char *v39; // [sp-8h] [bp-E8h]@20 char *v40; // [sp-8h] [bp-E8h]@83 int v41; // [sp-4h] [bp-E4h]@20 char Str1[200]; // [sp+Ch] [bp-D4h]@129 unsigned int pX; // [sp+D4h] [bp-Ch]@1 unsigned int pY; // [sp+D8h] [bp-8h]@1 unsigned int v45; // [sp+DCh] [bp-4h]@21 v13 = nullptr; pMouse->uPointingObjectID = 0; pMouse->GetClickPos(&pX, &pY); if ( (pX & 0x80000000u) != 0 || (signed int)pX > 639 || (pY & 0x80000000u) != 0 || (signed int)pY > 479 ) return; if ( !pCurrentScreen ) { if ( (signed int)pX > 467 || (signed int)pY > 351 ) goto _click_on_game_ui; if ( pRenderer->pRenderD3D ) { v18 = pGame->pVisInstance->get_picked_object_zbuf_val(); if ( (signed int)pX < (signed int)pViewport->uScreenX || (signed int)pX > (signed int)pViewport->uScreenZ || (signed int)pY < (signed int)pViewport->uScreenY || (signed int)pY > (signed int)pViewport->uScreenW ) v18 = -1; if ( v18 == -1 ) goto LABEL_61; } else { v18 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; } pMouse->uPointingObjectID = (unsigned __int16)v18; v19 = (signed int)(unsigned __int16)v18 >> 3; if ( (v18 & 7) == OBJECT_Item ) { v30 = v19; if ( pObjectList->pObjects[pLayingItems[v30].uObjectDescID].uFlags & 0x10 ) goto LABEL_73; if ( v18 >= (signed int)0x2000000u || pParty->pPickedItem.uItemID ) { v22 = pLayingItems[v30].stru_24.GetDisplayName(); LABEL_93: v26 = v22; goto LABEL_87; } v31 = pLayingItems[v30].stru_24.GetDisplayName(); v28 = pTmpBuf; sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[470], v31);// "Get %s" } else { if ( (v18 & 7) != OBJECT_Actor ) { if ( (v18 & 7) == OBJECT_Decoration ) { v23 = &pLevelDecorations[v19]; v24 = v23; v25 = v23->field_16_event_id; if ( !v25 ) { if ( v23->IsInteractive() ) v26 = pNPCTopics[stru_5E4C90._decor_events[v24->_idx_in_stru123 - 75] + 379].pTopic; else v26 = pDecorationList->pDecorations[v24->uDecorationDescID].field_20; goto LABEL_87; } v22 = _444732_GetEventHintString(v25); if ( !v22 ) goto _return; goto LABEL_93; } if ( (v18 & 7) == 6 ) // bmodel { if ( v18 < (signed int)0x2000000u ) { if ( uCurrentlyLoadedLevelType != LEVEL_Indoor) { v21 = pOutdoor->pBModels[(signed int)(unsigned __int16)v18 >> 9].pFaces[v19 & 0x3F].sCogTriggeredID; goto LABEL_71; } pFace = &pIndoor->pFaces[v19]; if ( BYTE3(pFace->uAttributes) & 6 ) { v21 = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; LABEL_71: if ( !v21 || (v22 = _444732_GetEventHintString(v21)) == 0 ) goto LABEL_73; goto LABEL_93; } } LABEL_73: pMouse->uPointingObjectID = 0; goto LABEL_50; } LABEL_61: pMouse->uPointingObjectID = 0; goto _return; } if ( v18 >= 335544320 ) goto LABEL_61; pActor = &pActors[v19]; v28 = pTmpBuf; v29 = pActor->dword_000334_unique_name; if ( v29 ) v40 = (char *)*(&pMonsterStats->pPlacement.uNumStrings + v29); else v40 = pMonsterStats->pInfos[pActor->pMonsterInfo.uID].pName; strncpy(pTmpBuf, v40, 0x7D0u); } v26 = v28; LABEL_87: sub_41C0B8_set_status_string(v26); goto _return; } v1 = uNumVisibleWindows; if ( uNumVisibleWindows <= 0 ) { LABEL_38: if ( pCurrentScreen == 10 ) { sub_42038D(); goto _return; } if ( pCurrentScreen == 13 ) { if ( dword_F8B19C != 2 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) || v16 == -65536 ) goto _return; v15 = (ItemGen *)((char *)&pParty->pPickedItem + 36 * (v16 + 12 * (unsigned int)ptr_507BC0->ptr_1C) + 4); LABEL_49: v17 = v15->GetDisplayName(); sub_41C0B8_set_status_string(v17); LABEL_50: uLastPointedObjectID = 1; _return: if ( pMouse->uPointingObjectID == 0 ) { if ( uLastPointedObjectID != 0 ) { pStatusBarString[0] = 0; bForceDrawStatusBar = 1; } } uLastPointedObjectID = pMouse->uPointingObjectID; return; } if ( (signed int)pY < 350 ) { v14 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]]; if ( v14 == 0 || v14 == -65536 || (unsigned int)v14 >= 0x1388 ) goto _return; v15 = (ItemGen *)&pPlayers[uActiveCharacter]->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v14 + 5]; goto LABEL_49; } _click_on_game_ui: if ( (signed int)pX >= (signed int)pWindowList[0].uFrameX && (signed int)pX <= (signed int)pWindowList[0].uFrameZ && (signed int)pY >= (signed int)pWindowList[0].uFrameY && (signed int)pY <= (signed int)pWindowList[0].uFrameW ) { for ( i = pWindowList[0].pControlsHead; i != (GUIButton *)0; i = i->pNext ) { if ( i->uButtonType == 1 ) { if ( (signed int)pX >= (signed int)i->uX && (signed int)pX <= (signed int)i->uZ && (signed int)pY >= (signed int)i->uY && (signed int)pY <= (signed int)i->uW ) { v37 = (UIMessageType)i->field_1C; if ( v37 == 0 ) goto LABEL_28; v38 = i->uControlParam; if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = v37; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v38; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; } goto LABEL_131; } } else { if ( i->uButtonType == 2 ) { v45 = pX - i->uX; v45 = pY - i->uY; if (pX >= i->uX && pX <= i->uZ && pY >= i->uY && pY <= i->uW) //if ( (double)(signed int)i->uWidth != 0.0 ) //{ // if ( (double)(signed int)i->uHeight != 0.0 ) // { //UNDEF(v32); //if ( v33 | v34 ) { v35 = (UIMessageType)i->field_1C; if ( v35 != 0 ) { v36 = i->uControlParam; if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = v35; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v36; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; goto LABEL_27; } } goto LABEL_28; //} //} } } else { if ( i->uButtonType == 3 && (signed int)pX >= (signed int)i->uX && (signed int)pX <= (signed int)i->uZ && (signed int)pY >= (signed int)i->uY && (signed int)pY <= (signed int)i->uW ) goto LABEL_19; } } } } pMouse->uPointingObjectID = sub_46A99B(); goto _return; } while ( 1 ) // some other fullscreen ui { v2 = &pWindowList[pVisibleWindowsIdxs[v1] - 1]; if ( (signed int)pX >= (signed int)v2->uFrameX && (signed int)pX <= (signed int)v2->uFrameZ && (signed int)pY >= (signed int)v2->uFrameY && (signed int)pY <= (signed int)v2->uFrameW ) { for ( i = v2->pControlsHead; ; i = i->pNext ) { if ( !i ) break; if ( i->uButtonType == 1 ) { if ( (signed int)pX >= (signed int)i->uX && (signed int)pX <= (signed int)i->uZ && (signed int)pY >= (signed int)i->uY && (signed int)pY <= (signed int)i->uW ) { LABEL_24: v11 = (UIMessageType)i->field_1C; if ( v11 ) { v12 = i->uControlParam; if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = v11; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v12; *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; LABEL_27: ++pMessageQueue_50CBD0->uNumMessages; } } LABEL_28: v13 = i->pButtonName; _set_status_and_ret: sub_41C0B8_set_status_string(v13); LABEL_131: uLastPointedObjectID = 1; return; } } else { if ( i->uButtonType == 2 ) { v45 = pX - i->uX; v45 = pY - i->uY; if ( (double)(signed int)i->uWidth != 0.0 ) { if ( (double)(signed int)i->uHeight != 0.0 ) { //UNDEF(v8); if ( v9 | v10 ) goto LABEL_24; } } } else // click on skill { if ( i->uButtonType == 3 && (signed int)pX >= (signed int)i->uX && (signed int)pX <= (signed int)i->uZ && (signed int)pY >= (signed int)i->uY && (signed int)pY <= (signed int)i->uW ) { LABEL_19: v4 = pPlayers[uActiveCharacter]; v5 = LOBYTE(v4->pActiveSkills[i->uControlParam]); v6 = v4->uSkillPoints; v7 = (v5 & 0x3F) + 1; if ( v6 < v7 ) { v41 = v7 - v6; v39 = pGlobalTXT_LocalizationStrings[469];// "You need %d more Skill Points to advance here" } else { v41 = v7; v39 = pGlobalTXT_LocalizationStrings[468];// "Clicking here will spend %d Skill Points" } sprintf(Str1, v39, v41); v13 = Str1; goto _set_status_and_ret; } } } } } if ( v2->uFrameHeight == 480 ) break; --v1; if ( v1 <= 0 ) { goto LABEL_38; } } } //----- (00421626) -------------------------------------------------------- GUIWindow *GameUI_InitializeCharacterWindow(unsigned int _this) { unsigned int v1; // edi@1 GUIWindow *v2; // 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; v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_CharacterRecord, uActiveCharacter, 0); pCharacterScreen_StatsBtn = v2->CreateButton( pViewport->uViewportX + 12, pViewport->uViewportY + 308, (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureWidth : 24), (papredoll_dbrds[9] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[9]].uTextureHeight : 26), 1, 0, 0x73u, 0, 0x53u, pGlobalTXT_LocalizationStrings[216], (Texture *)(papredoll_dbrds[10] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[10]] : 0), papredoll_dbrds[9] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[9]] : 0, 0); pCharacterScreen_SkillsBtn = v2->CreateButton( pViewport->uViewportX + 102, pViewport->uViewportY + 308, (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureWidth : 24), (papredoll_dbrds[7] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[7]].uTextureHeight : 26), 1, 0, 0x72u, 0, 0x4Bu, pGlobalTXT_LocalizationStrings[205], (Texture *)(papredoll_dbrds[8] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[8]] : 0), papredoll_dbrds[7] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[7]] : 0, 0); pCharacterScreen_InventoryBtn = v2->CreateButton( pViewport->uViewportX + 192, pViewport->uViewportY + 308, (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureWidth : 24), (papredoll_dbrds[5] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[5]].uTextureHeight : 26), 1, 0, 0x74u, 0, 0x49u, pGlobalTXT_LocalizationStrings[120], (Texture *)(papredoll_dbrds[6] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[6]] : 0), papredoll_dbrds[5] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[5]] : 0, 0); pCharacterScreen_AwardsBtn = v2->CreateButton( pViewport->uViewportX + 282, pViewport->uViewportY + 308, (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureWidth : 24), (papredoll_dbrds[3] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[3]].uTextureHeight : 26), 1, 0, 0x75u, 0, 0x41u, pGlobalTXT_LocalizationStrings[22], (Texture *)(papredoll_dbrds[4] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[4]] : 0), papredoll_dbrds[3] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[3]] : 0, 0); pCharacterScreen_ExitBtn = v2->CreateButton( pViewport->uViewportX + 371, pViewport->uViewportY + 308, (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureWidth : 24), (papredoll_dbrds[1] != -1 ? pIcons_LOD->pTextures[papredoll_dbrds[1]].uTextureHeight : 26), 1, 0, 0xA8u, 0, 0, pGlobalTXT_LocalizationStrings[79], (Texture *)(papredoll_dbrds[2] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[2]] : 0), papredoll_dbrds[1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[1]] : 0, 0); v2->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, 0x78u, 0, 0, "", 0); pCharacterScreen_DetalizBtn = v2->CreateButton( 0x258u, 0x12Cu, 0x1Eu, 0x1Eu, 1, 0, 0x55u, 0, 0, pGlobalTXT_LocalizationStrings[64], 0); pCharacterScreen_DollBtn = v2->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, 0x85u, 0, 0, "", 0); v2->CreateButton(0x3Du, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); v2->CreateButton(0xB1u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); v2->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); v2->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); v2->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0); sub_419100(); return v2; } //----- (004219BE) -------------------------------------------------------- GUIWindow *stru277::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 = 23; v2 = GUIWindow::Create(0, 0, 640, 480, (WindowType)(WINDOW_HouseInterior|WINDOW_Options), v1, 0); pCharacterScreen_ExitBtn = v2->CreateButton( 394u, 318u, 75u, 33u, 1, 0, 0xA8u, 0, 0, pGlobalTXT_LocalizationStrings[79], (Texture *)(papredoll_dbrds[2] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[2]] : 0), papredoll_dbrds[1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbrds[1]] : 0, 0); v2->CreateButton(0, 0, 0x1DCu, 0x159u, 1, 122, 0x78u, 0, 0, "", 0); pCharacterScreen_DollBtn = v2->CreateButton(0x1DCu, 0, 0xA4u, 0x159u, 1, 0, 0x85u, 0, 0, "", 0); v2->CreateButton(61u, 424u, 0x1Fu, 0, 2, 94, 0x6Eu, 1u, 0x31u, "", 0); v2->CreateButton(177u, 424u, 0x1Fu, 0, 2, 94, 0x6Eu, 2u, 0x32u, "", 0); v2->CreateButton(292u, 424u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0); v2->CreateButton(407u, 424u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0); return v2; } //----- (00421B2C) -------------------------------------------------------- bool __cdecl sub_421B2C_PlaceInInventory_or_DropPickedItem() { unsigned int v0; // eax@2 Texture *v1; // ebx@2 int v2; // eax@3 Player *v3; // esi@5 int v4; // eax@6 unsigned __int16 v5; // dx@11 signed int v6; // eax@11 char *v7; // edi@12 __int16 v8; // ax@16 LayingItem a1; // [sp+4h] [bp-78h]@11 int v11; // [sp+74h] [bp-8h]@2 int v12; // [sp+78h] [bp-4h]@5 if ( !pParty->pPickedItem.uItemID ) return 1; v0 = pIcons_LOD->LoadTexture( pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); v1 = (Texture *)(v0 != -1 ? (int)&pIcons_LOD->pTextures[v0] : 0); v11 = areWeLoadingTexture; if ( uActiveCharacter && (v2 = pPlayers[uActiveCharacter]->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID)) != 0 ) { memcpy(&pPlayers[uActiveCharacter]->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5], &pParty->pPickedItem, 0x24u); } else { v12 = 0; v3 = pParty->pPlayers; while ( 1 ) { v4 = v3->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID); if ( v4 ) break; ++v12; ++v3; if ( (signed int)v3 >= (signed int)pParty->pHirelings ) goto LABEL_10; } memcpy(&pParty->pPlayers[v12].spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v4 + 5], &pParty->pPickedItem, 0x24u); pMouse->RemoveHoldingItem(); LABEL_10: if ( v12 != 4 ) goto LABEL_18; v5 = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; v6 = 0; a1.uItemType = pItemsTable->pItems[pParty->pPickedItem.uItemID].uSpriteID; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LABEL_15: LOWORD(v6) = 0; } else { v7 = (char *)&pObjectList->pObjects->uObjectID; while ( v5 != *(short *)v7 ) { ++v6; v7 += 56; if ( v6 >= (signed int)pObjectList->uNumObjects ) goto LABEL_15; } } a1.field_58 = 4; a1.uObjectDescID = v6; a1.vPosition.y = pParty->vPosition.y; a1.vPosition.x = pParty->vPosition.x; a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; a1.uSoundID = 0; a1.uFacing = 0; a1.uAttributes = 8; v8 = pIndoor->GetSector( pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z); a1.uSpriteFrameID = 0; a1.uSectorID = v8; memcpy(&a1.stru_24, &pParty->pPickedItem, sizeof(a1.stru_24)); a1.Create(pParty->sRotationY, 184, 200, 0); } pMouse->RemoveHoldingItem(); LABEL_18: if ( !v11 ) { v1->Release(); pIcons_LOD->_40F9C5(); } return 1; } //----- (00421D00) -------------------------------------------------------- void __fastcall GameUI_OnPlayerPortraitLeftClick(unsigned int uPlayerID) { unsigned int v1; // esi@1 int v2; // eax@2 Player *v3; // ecx@2 Player *v4; // ecx@5 unsigned int v5; // [sp-4h] [bp-10h]@21 v1 = uPlayerID; if ( pParty->pPickedItem.uItemID ) { v2 = pPlayers[uPlayerID]->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID); v3 = pPlayers[v1]; if ( v2 ) { memcpy(&v3->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v2 + 5], &pParty->pPickedItem, 0x24u); viewparams->bRedrawGameUI = 1; pMouse->RemoveHoldingItem(); return; } if ( v3->CanAct() ) { v4 = pPlayers[v1]; } else { if ( !pPlayers[uActiveCharacter]->CanAct() ) goto LABEL_9; v4 = pPlayers[uActiveCharacter]; } v4->PlaySound(15, 0); } LABEL_9: if ( !pCurrentScreen ) { viewparams->bRedrawGameUI = 1; if ( uActiveCharacter != v1 ) goto LABEL_27; v5 = 7; LABEL_22: pGUIWindow_CurrentMenu = GameUI_InitializeCharacterWindow(v5); return; } if ( pCurrentScreen == 8 ) return; if ( pCurrentScreen == 10 ) { LABEL_23: viewparams->bRedrawGameUI = 1; if ( uActiveCharacter == v1 ) { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; pCurrentScreen = 15; goto LABEL_28; } LABEL_27: if ( pPlayers[v1]->uTimeToRecovery ) return; goto LABEL_28; } if ( pCurrentScreen != 13 ) { if ( pCurrentScreen == 14 ) { LABEL_28: uActiveCharacter = v1; return; } if ( pCurrentScreen != 15 ) { viewparams->bRedrawGameUI = 1; uActiveCharacter = v1; if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 ) sub_419100(); return; } goto LABEL_23; } if ( ptr_507BC0->field_40 == 1 ) return; viewparams->bRedrawGameUI = 1; if ( uActiveCharacter != v1 ) goto LABEL_28; if ( dword_F8B19C == 2 || dword_F8B19C == 6 ) { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; v5 = 14; goto LABEL_22; } } // 4E28F8: using guessed type int pCurrentScreen; // F8B19C: using guessed type int dword_F8B19C; //----- (00421EA6) -------------------------------------------------------- void __cdecl sub_421EA6_OnInventoryLeftClick() { Player *v0; // ebx@1 signed int v1; // eax@2 signed int v2; // ecx@2 int v3; // eax@2 char v4; // sf@2 int v5; // eax@2 unsigned int v6; // eax@7 unsigned int v7; // esi@12 unsigned int v8; // eax@12 unsigned int v9; // eax@16 unsigned int v10; // eax@18 ItemGen this_; // [sp+Ch] [bp-3Ch]@1 POINT a2; // [sp+30h] [bp-18h]@4 unsigned int v13; // [sp+38h] [bp-10h]@13 unsigned int pY; // [sp+3Ch] [bp-Ch]@2 unsigned int pX; // [sp+40h] [bp-8h]@2 int a4; // [sp+44h] [bp-4h]@2 v0 = pPlayers[uActiveCharacter]; if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] != 103 || (pMouse->GetClickPos(&pX, &pY), v1 = pY - 17, v2 = pX - 14, pY = v1, pX = v2, v3 = 14 * (v1 >> 5), v2 >>= 5, v4 = v2 + v3 < 0, v5 = v2 + v3, a4 = v5, v4) || v5 > 126 || pMouse->GetCursorPos(&a2)->x >= 462 || pMouse->GetCursorPos(&a2)->x < 14 ) return; if ( unk_50C9A0 ) { v6 = v0->GetItemIDAtInventoryIndex(&a4); if ( v6 ) { *((char *)pGUIWindow_Settings->ptr_1C + 8) &= 0x7Fu; *((short *)pGUIWindow_Settings->ptr_1C + 2) = uActiveCharacter - 1; *((int *)pGUIWindow_Settings->ptr_1C + 3) = v6 - 1; *((short *)pGUIWindow_Settings->ptr_1C + 3) = a4; ptr_50C9A4 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v6 + 5]; unk_50C9A0 = 0; if ( pMessageQueue_50CBD0->uNumMessages ) pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; pMouse->SetCursorBitmap("MICON1"); dword_50C9D0 = 113; dword_50C9D4 = 0; dword_50C9D8 = 256; } return; } if ( ptr_50C9A4 ) return; v7 = pParty->pPickedItem.uItemID; v8 = v0->GetItemIDAtInventoryIndex(&a4); if ( !v7 ) { if ( !v8 ) return; memcpy(&pParty->pPickedItem, &v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v8 + 5], sizeof(pParty->pPickedItem)); v0->RemoveItemAtInventoryIndex(a4); v9 = pParty->pPickedItem.uItemID; goto LABEL_24; } v13 = v8; if ( v8 ) { a2.y = (LONG)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v8 + 5]; memcpy(&this_, (const void *)a2.y, sizeof(this_)); v0->RemoveItemAtInventoryIndex(a4); pX = v0->AddItem2(a4, &pParty->pPickedItem); if ( !pX ) { pX = v0->AddItem2(0xFFFFFFFFu, &pParty->pPickedItem); if ( !pX ) { v0->_49298B(&this_, v13 - 1, a4); memcpy((void *)a2.y, &this_, sizeof(ItemGen)); return; } } v9 = this_.uItemID; memcpy(&pParty->pPickedItem, &this_, sizeof(pParty->pPickedItem)); LABEL_24: pMouse->SetCursorBitmap(pItemsTable->pItems[v9].pIconName); return; } v10 = v0->AddItem(a4, v7); pX = v10; if ( v10 || (v10 = v0->AddItem(0xFFFFFFFFu, pParty->pPickedItem.uItemID), (pX = v10) != 0) ) { memcpy(&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * v10 + 5], &pParty->pPickedItem, 0x24u); pMouse->RemoveHoldingItem(); } } //----- (0042213C) -------------------------------------------------------- void __cdecl OnGameViewportClick() { signed int v0; // ebx@2 POINT *v1; // esi@3 signed int v2; // eax@9 BLVFace *v3; // eax@10 unsigned int v4; // eax@11 unsigned __int16 v5; // dx@14 signed int v6; // eax@14 char *v7; // esi@15 int *v8; // eax@19 int v9; // eax@19 unsigned int v10; // eax@19 int v11; // ecx@21 ODMFace *v12; // eax@22 LevelDecoration *v13; // esi@24 __int16 v14; // ax@25 int v15; // ecx@29 signed int v16; // edx@30 Actor *v17; // esi@30 int v18; // ebx@47 unsigned __int16 v19; // ax@50 const char *v20; // eax@51 signed int v21; // eax@58 ItemGen *v22; // esi@62 unsigned int v23; // eax@62 LayingItem a1; // [sp+Ch] [bp-80h]@1 POINT v25; // [sp+7Ch] [bp-10h]@3 POINT a2; // [sp+84h] [bp-8h]@3 if ( pRenderer->pRenderD3D ) { v0 = pGame->pVisInstance->get_picked_object_zbuf_val(); } else { v1 = pMouse->GetCursorPos(&a2); v0 = pRenderer->pActiveZBuffer[v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v25)->y]]; } if ( (v0 & 7) == 2 ) { a2.y = (signed int)(unsigned __int16)v0 >> 3; v21 = (signed int)(unsigned __int16)v0 >> 3; if ( !(pObjectList->pObjects[pLayingItems[v21].uObjectDescID].uFlags & 0x10) && a2.y < 1000 && pLayingItems[v21].uObjectDescID && (unsigned int)v0 < 0x2000000 ) { v22 = &pLayingItems[v21].stru_24; v23 = pLayingItems[v21].stru_24.uItemID; if ( pItemsTable->pItems[v23].uEquipType == 18 ) { party_finds_gold(v22->uAdditionalValue, 0); viewparams->bRedrawGameUI = 1; } else { sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[471], pItemsTable->pItems[v23].pUnidentifiedName); ShowStatusBarString(pTmpBuf2, 2u); if ( v22->uItemID == 506 ) _449B7E_toggle_bit(pParty->_award_bits, 184, 1u); if ( v22->uItemID == 455 ) _449B7E_toggle_bit(pParty->_award_bits, 185, 1u); if ( !pParty->AddItem(v22) ) pParty->SetHoldingItem(v22); } LayingItem::_42F933(a2.y); return; } goto LABEL_13; } if ( (v0 & 7) != 3 ) { if ( (v0 & 7) == 5 ) { v13 = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; if ( (signed int)(((unsigned int)v0 >> 16) - pDecorationList->pDecorations[v13->uDecorationDescID].uRadius) >= 512 ) goto LABEL_13; v14 = v13->field_16_event_id; if ( !v14 ) { if ( pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3].IsInteractive() ) { v15 = stru_5E4C90._decor_events[v13->_idx_in_stru123 - 75] + 380; _5C3420_pDecoration = &pLevelDecorations[(signed int)(unsigned __int16)v0 >> 3]; EventProcessor(v15, 0, 1); _5C3420_pDecoration = 0; } return; } v11 = v14; } else { if ( (v0 & 7) != 6 || (unsigned int)v0 >= 0x2000000 ) goto LABEL_13; v2 = (signed int)(unsigned __int16)v0 >> 3; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor) { v3 = &pIndoor->pFaces[v2]; if ( !(v3->uAttributes & 0x2000000) ) { LABEL_11: v4 = pParty->pPickedItem.uItemID; if ( pParty->pPickedItem.uItemID ) { LABEL_14: v5 = pItemsTable->pItems[v4].uSpriteID; v6 = 0; a1.uItemType = v5; if ( (signed int)pObjectList->uNumObjects <= 0 ) { LABEL_18: LOWORD(v6) = 0; } else { v7 = (char *)&pObjectList->pObjects->uObjectID; while ( v5 != *(short *)v7 ) { ++v6; v7 += 56; if ( v6 >= (signed int)pObjectList->uNumObjects ) goto LABEL_18; } } a1.uObjectDescID = v6; a1.vPosition.y = pParty->vPosition.y; a1.field_58 = 4; a1.vPosition.x = pParty->vPosition.x; a1.vPosition.z = pParty->sEyelevel + pParty->vPosition.z; a1.uSoundID = 0; a1.uFacing = 0; a1.uAttributes = 8; a1.uSectorID = pIndoor->GetSector( pParty->vPosition.x, pParty->vPosition.y, pParty->sEyelevel + pParty->vPosition.z); a1.uSpriteFrameID = 0; memcpy(&a1.stru_24, &pParty->pPickedItem, 0x24u); v8 = (int *)pMouse->GetCursorPos(&v25); v9 = UnprojectX(*v8); a1.Create(pParty->sRotationY + v9, 184, 200, 0); v10 = pIcons_LOD->LoadTexture( pItemsTable->pItems[pParty->pPickedItem.uItemID].pIconName, TEXTURE_16BIT_PALETTE); if (v10 != -1) pIcons_LOD->pTextures[v10].Release(); pMouse->RemoveHoldingItem(); pIcons_LOD->_40F9C5(); return; } ShowNothingHereStatus(); LABEL_13: v4 = pParty->pPickedItem.uItemID; if ( !pParty->pPickedItem.uItemID ) return; goto LABEL_14; } v11 = pIndoor->pFaceExtras[v3->uFaceExtraID].uEventID; } else { v12 = &pOutdoor->pBModels[(signed int)(unsigned __int16)v0 >> 9].pFaces[v2 & 0x3F]; if ( !(v12->uAttributes & 0x2000000) ) goto LABEL_11; v11 = v12->sCogTriggeredID; } } EventProcessor(v11, (unsigned __int16)v0, 1); return; } v16 = (signed int)(unsigned __int16)v0 >> 3; a2.y = v16; v17 = &pActors[v16]; if ( v17->uAIState == 5 ) { if ( (unsigned int)v0 < 0x2000000 ) { stru_50C198.LootActor(&pActors[v16]); return; } goto LABEL_13; } if ( GetAsyncKeyState(VK_SHIFT) >= 0 ) { if ( !v17->GetActorsRelation(0) && !(BYTE2(v17->uAttributes) & 8) ) { if ( (unsigned int)v0 >= 0x2000000 ) goto LABEL_13; if ( !v17->CanAct() ) return; v18 = a2.y; Actor::FaceObject(a2.y, 4u, 0, 0); if ( !v17->uNPC_ID ) { v19 = pNPCStats->pGroups_copy[v17->uGroup]; if ( v19 ) { v20 = pNPCStats->pCatchPhrases[v19]; if ( v20 ) { pParty->uFlags |= 2u; strcpy(byte_5B0938, v20); sub_4451A8_press_any_key(0, 0, 0); } } return; } if ( (signed int)pMessageQueue_50CBD0->uNumMessages >= 40 ) return; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)161; pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v18; LABEL_42: *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; ++pMessageQueue_50CBD0->uNumMessages; return; } if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) { pTurnEngine->field_18 |= 8u; return; } if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)23; goto LABEL_41; } } else { if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) { pParty->uFlags |= 8u; return; } if ( uActiveCharacter && sub_427769_spell(pPlayers[uActiveCharacter]->uQuickSpell) && (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) { pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)25; LABEL_41: pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 0; goto LABEL_42; } } } //----- (004226C2) -------------------------------------------------------- bool __cdecl sub_4226C2() { if ( pCurrentScreen && pCurrentScreen != 4 && pCurrentScreen != 17 ) { if ( pCurrentScreen == 18 ) return pVideoPlayer->pSmackerMovie != 0; if ( pCurrentScreen != 19 ) return 1; } return 0; } // 4E28F8: using guessed type int pCurrentScreen; //----- (004226EF) -------------------------------------------------------- void __fastcall SetUserInterface(int a1, bool bReplace) { int v2; // ecx@2 unsigned int v3; // eax@7 unsigned __int16 v4; // dx@7 unsigned __int16 v5; // cx@7 unsigned __int16 v6; // [sp-4h] [bp-14h]@7 if ( a1 ) { v2 = a1 - 1; if ( v2 ) { if ( v2 != 1 ) return; if ( bReplace ) { pTexture_RightFrame->Reload("ib-r-C.pcx"); pTexture_BottomFrame->Reload("ib-b-C.pcx"); pTexture_TopFrame->Reload("ib-t-C.pcx"); pTexture_LeftFrame->Reload("ib-l-C.pcx"); pTexture_StatusBar->Reload("IB-Foot-c.pcx"); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D8], "ib-autmask-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079B4], "IB-COMP-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507990], "IB-NPCLD-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50798C], "IB-NPCRD-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507980], "ib-autout-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507984], "ib-autin-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-C", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50797C], "ib-m1d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507978], "ib-m2d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507974], "ib-m3d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507970], "ib-m4d-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50796C], "isg-01-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507968], "isg-02-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507964], "isg-03-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-c", 2); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_506438], "ib-bcu-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-c", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-c", 2); pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-c", 2); } else { pTexture_RightFrame->Load("ib-r-C.pcx", 0); pTexture_BottomFrame->Load("ib-b-c.pcx", 0); pTexture_TopFrame->Load("ib-t-C.pcx", 0); pTexture_LeftFrame->Load("ib-l-C.pcx", 0); pTexture_StatusBar->Load("IB-Foot-c.pcx", 0); uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-C", TEXTURE_16BIT_PALETTE); dword_5079D8 = pIcons_LOD->LoadTexture("ib-autmask-c", TEXTURE_16BIT_PALETTE); dword_5079B4 = pIcons_LOD->LoadTexture("IB-COMP-C", TEXTURE_16BIT_PALETTE); dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-c", TEXTURE_16BIT_PALETTE); dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-c", TEXTURE_16BIT_PALETTE); dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-c", TEXTURE_16BIT_PALETTE); uTextureID_507990 = pIcons_LOD->LoadTexture("IB-NPCLD-C", TEXTURE_16BIT_PALETTE); uTextureID_50798C = pIcons_LOD->LoadTexture("IB-NPCRD-C", TEXTURE_16BIT_PALETTE); uTextureID_507980 = pIcons_LOD->LoadTexture("ib-autout-C", TEXTURE_16BIT_PALETTE); uTextureID_507984 = pIcons_LOD->LoadTexture("ib-autin-C", TEXTURE_16BIT_PALETTE); dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-C", TEXTURE_16BIT_PALETTE); uTextureID_50797C = pIcons_LOD->LoadTexture("ib-m1d-c", TEXTURE_16BIT_PALETTE); uTextureID_507978 = pIcons_LOD->LoadTexture("ib-m2d-c", TEXTURE_16BIT_PALETTE); dword_507974 = pIcons_LOD->LoadTexture("ib-m3d-c", TEXTURE_16BIT_PALETTE); uTextureID_507970 = pIcons_LOD->LoadTexture("ib-m4d-c", TEXTURE_16BIT_PALETTE); uTextureID_506438 = pIcons_LOD->LoadTexture("ib-bcu-c", TEXTURE_16BIT_PALETTE); dword_50796C = pIcons_LOD->LoadTexture("isg-01-c", TEXTURE_16BIT_PALETTE); dword_507968 = pIcons_LOD->LoadTexture("isg-02-c", TEXTURE_16BIT_PALETTE); dword_507964 = pIcons_LOD->LoadTexture("isg-03-c", TEXTURE_16BIT_PALETTE); dword_507960 = pIcons_LOD->LoadTexture("isg-04-c", TEXTURE_16BIT_PALETTE); uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc-c", TEXTURE_16BIT_PALETTE); uTextureID_507958 = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeC"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchC"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); } v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xC8u, 0, 0); v4 = 0; v6 = 0; v5 = 10; } else { if ( bReplace ) { pTexture_RightFrame->Reload("ib-r-a.pcx"); pTexture_BottomFrame->Reload("ib-b-a.pcx"); pTexture_TopFrame->Reload("ib-t-a.pcx"); pTexture_LeftFrame->Reload("ib-l-a.pcx"); pTexture_StatusBar->Reload("IB-Foot-a.pcx"); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D8], "ib-autmask-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079B4], "IB-COMP-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507990], "IB-NPCLD-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50798C], "IB-NPCRD-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507980], "ib-autout-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507984], "ib-autin-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50797C], "ib-m1d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507978], "ib-m2d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507974], "ib-m3d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507970], "ib-m4d-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50796C], "isg-01-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507968], "isg-02-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507964], "isg-03-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-a", 2); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_506438], "ib-bcu-a", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top", 2); pIcons_LOD->ReloadTexture(pTexture_591428, "endcap", 2); } else { pTexture_RightFrame->Load("ib-r-A.pcx", 0); pTexture_BottomFrame->Load("ib-b-A.pcx", 0); pTexture_TopFrame->Load("ib-t-A.pcx", 0); pTexture_LeftFrame->Load("ib-l-A.pcx", 0); pTexture_StatusBar->Load("IB-Foot-a.pcx", 0); uTextureID_right_panel = pIcons_LOD->LoadTexture("ib-mb-A", TEXTURE_16BIT_PALETTE); dword_5079D8 = pIcons_LOD->LoadTexture("ib-autmask-a", TEXTURE_16BIT_PALETTE); dword_5079B4 = pIcons_LOD->LoadTexture("IB-COMP-A", TEXTURE_16BIT_PALETTE); dword_5079D0 = pIcons_LOD->LoadTexture("IB-InitG-a", TEXTURE_16BIT_PALETTE); dword_5079C8 = pIcons_LOD->LoadTexture("IB-InitY-a", TEXTURE_16BIT_PALETTE); dword_5079CC = pIcons_LOD->LoadTexture("IB-InitR-a", TEXTURE_16BIT_PALETTE); uTextureID_507990 = pIcons_LOD->LoadTexture("IB-NPCLD-A", TEXTURE_16BIT_PALETTE); uTextureID_50798C = pIcons_LOD->LoadTexture("IB-NPCRD-A", TEXTURE_16BIT_PALETTE); dword_50C98C = pIcons_LOD->LoadTexture("IB-selec-A", TEXTURE_16BIT_PALETTE); uTextureID_50797C = pIcons_LOD->LoadTexture("ib-m1d-a", TEXTURE_16BIT_PALETTE); uTextureID_507978 = pIcons_LOD->LoadTexture("ib-m2d-a", TEXTURE_16BIT_PALETTE); dword_507974 = pIcons_LOD->LoadTexture("ib-m3d-a", TEXTURE_16BIT_PALETTE); uTextureID_507970 = pIcons_LOD->LoadTexture("ib-m4d-a", TEXTURE_16BIT_PALETTE); uTextureID_507980 = pIcons_LOD->LoadTexture("ib-autout-a", TEXTURE_16BIT_PALETTE); uTextureID_507984 = pIcons_LOD->LoadTexture("ib-autin-a", TEXTURE_16BIT_PALETTE); uTextureID_506438 = pIcons_LOD->LoadTexture("ib-bcu-a", TEXTURE_16BIT_PALETTE); dword_50796C = pIcons_LOD->LoadTexture("isg-01-a", TEXTURE_16BIT_PALETTE); dword_507968 = pIcons_LOD->LoadTexture("isg-02-a", TEXTURE_16BIT_PALETTE); dword_507964 = pIcons_LOD->LoadTexture("isg-03-a", TEXTURE_16BIT_PALETTE); dword_507960 = pIcons_LOD->LoadTexture("isg-04-a", TEXTURE_16BIT_PALETTE); uTextureID_50795C = pIcons_LOD->LoadTexture("evtnpc", TEXTURE_16BIT_PALETTE); uTextureID_507958 = pIcons_LOD->LoadTexture("fr_inven", TEXTURE_16BIT_PALETTE); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeA"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchA"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); uTextureID_Parchment = pIcons_LOD->LoadTexture("parchment", TEXTURE_16BIT_PALETTE); uTextureID_5076B4 = pIcons_LOD->LoadTexture("cornr_ll", TEXTURE_16BIT_PALETTE); uTextureID_5076B0 = pIcons_LOD->LoadTexture("cornr_lr", TEXTURE_16BIT_PALETTE); uTextureID_5076AC = pIcons_LOD->LoadTexture("cornr_ul", TEXTURE_16BIT_PALETTE); uTextureID_5076A8 = pIcons_LOD->LoadTexture("cornr_ur", TEXTURE_16BIT_PALETTE); uTextureID_5076A4 = pIcons_LOD->LoadTexture("edge_btm", TEXTURE_16BIT_PALETTE); uTextureID_5076A0 = pIcons_LOD->LoadTexture("edge_lf", TEXTURE_16BIT_PALETTE); uTextureID_50769C = pIcons_LOD->LoadTexture("edge_rt", TEXTURE_16BIT_PALETTE); uTextureID_507698 = pIcons_LOD->LoadTexture("edge_top", TEXTURE_16BIT_PALETTE); pTexture_591428 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("endcap", TEXTURE_16BIT_PALETTE)]; } v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xAu, 0, 0); v4 = 214; v5 = 230; v6 = 193; } } else { if ( bReplace ) { pTexture_RightFrame->Reload("ib-r-B.pcx"); pTexture_BottomFrame->Reload("ib-b-B.pcx"); pTexture_TopFrame->Reload("ib-t-B.pcx"); pTexture_LeftFrame->Reload("ib-l-B.pcx"); pTexture_StatusBar->Reload("IB-Foot-b.pcx"); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_right_panel], "ib-mb-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D8], "ib-autmask-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079B4], "IB-COMP-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079D0], "IB-InitG-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079C8], "IB-InitY-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_5079CC], "IB-InitR-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507990], "IB-NPCLD-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50798C], "IB-NPCRD-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507980], "ib-autout-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507984], "ib-autin-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50C98C], "IB-selec-B", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50797C], "ib-m1d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507978], "ib-m2d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507974], "ib-m3d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507970], "ib-m4d-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_50796C], "isg-01-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507968], "isg-02-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507964], "isg-03-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[dword_507960], "isg-04-b", 2); pUIAnim_WizardEye->uIconID = pIconsFrameTable->FindIcon("wizeyeB"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnim_WizardEye->uIconID); pUIAnum_Torchlight->uIconID = pIconsFrameTable->FindIcon("torchB"); pIconsFrameTable->InitializeAnimation((signed __int16)pUIAnum_Torchlight->uIconID); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_506438], "ib-bcu-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50795C], "evtnpc-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507958], "fr_inven-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_Parchment], "parchment", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B4], "cornr_ll-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076B0], "cornr_lr-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076AC], "cornr_ul-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A8], "cornr_ur-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A4], "edge_btm-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_5076A0], "edge_lf-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_50769C], "edge_rt-b", 2); pIcons_LOD->ReloadTexture(&pIcons_LOD->pTextures[uTextureID_507698], "edge_top-b", 2); pIcons_LOD->ReloadTexture(pTexture_591428, "endcap-b", 2); } v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0, 0xC8u); v5 = 255; v4 = 225; v6 = 255; } uGameUIFontMain = v3; uGameUIFontShadow = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(v5, v4, v6); } //----- (00423AEE) -------------------------------------------------------- void __cdecl reset_some_strus_flt_2Cs() { float *v0; // eax@1 signed int v1; // ecx@1 signed int v2; // edx@1 float *v3; // eax@3 signed int v4; // edx@3 float *v5; // eax@5 signed int v6; // edx@5 float *v7; // eax@7 signed int v8; // edx@7 float *v9; // eax@9 v0 = &array_50AC10[0].flt_2C; v1 = 50; v2 = 50; do { *v0 = 0.0; v0 += 12; --v2; } while ( v2 ); v3 = &array_50A2B0[0].flt_2C; v4 = 50; do { *v3 = 0.0; v3 += 12; --v4; } while ( v4 ); v5 = &array_509950[0].flt_2C; v6 = 50; do { *v5 = 0.0; v5 += 12; --v6; } while ( v6 ); v7 = &array_508FF0[0].flt_2C; v8 = 50; do { *v7 = 0.0; v7 += 12; --v8; } while ( v8 ); v9 = &array_508690[0].flt_2C; do { *v9 = 0.0; v9 += 12; --v1; } while ( v1 ); } //----- (00423B4A) -------------------------------------------------------- void __cdecl sub_423B4A() { float *v0; // eax@1 signed int v1; // ecx@1 v0 = &array_507D30[0].flt_2C; v1 = 50; do { *v0 = 0.0; v0 += 12; --v1; } while ( v1 ); } //----- (00423B5D) -------------------------------------------------------- int __fastcall sub_423B5D(unsigned int uFaceID) { BLVFace *v1; // ebx@1 Vec3_short_ *v2; // esi@1 //int v3; // ST28_4@1 __int16 v4; // ST2C_2@1 //signed int v5; // esi@1 //Vec3_short_ *v6; // eax@4 //signed int v7; // edi@5 //signed int v8; // eax@5 //signed int i_; // ecx@10 int v10; // eax@10 int v11; // edx@11 int v12; // ST28_4@12 signed int v13; // edx@12 signed __int64 v14; // qtt@12 int *v15; // ebx@12 int v16; // ST28_4@14 signed int v17; // eax@14 signed __int64 v18; // qtt@14 signed int v19; // edx@15 signed int v20; // edx@17 signed int v21; // ebx@19 signed int v22; // esi@20 int v23; // edi@21 int v24; // eax@21 int v25; // eax@22 int v26; // eax@22 signed int v27; // ST30_4@24 signed __int64 v28; // qtt@24 int v29; // ST18_4@25 int v30; // eax@26 int v31; // eax@27 int v32; // eax@27 signed int v33; // ST30_4@29 signed __int64 v34; // qtt@29 int v35; // ST30_4@30 signed int v36; // edi@31 unsigned int v37; // eax@31 bool v38; // edx@31 int v39; // ecx@31 int v40; // ecx@32 int v41; // esi@32 int v42; // eax@34 signed int v43; // ebx@41 unsigned int v44; // eax@41 signed int v45; // ecx@42 int v46; // esi@42 int v47; // eax@44 signed int v48; // edi@51 unsigned int v49; // eax@51 bool v50; // edx@51 int v51; // ecx@51 int v52; // ecx@52 signed int v53; // esi@52 int v54; // eax@54 int v55; // ebx@61 unsigned int v56; // eax@61 signed int v57; // ecx@62 int v58; // esi@62 int v59; // eax@64 char v61; // zf@72 signed int v62; // edx@75 int v63; // ecx@76 int v64; // esi@76 int v65; // ecx@83 //signed int v66; // [sp+14h] [bp-14h]@3 int v67; // [sp+14h] [bp-14h]@34 int v68; // [sp+14h] [bp-14h]@44 int v69; // [sp+14h] [bp-14h]@54 int v70; // [sp+14h] [bp-14h]@64 signed int v71; // [sp+14h] [bp-14h]@75 bool thisa; // [sp+18h] [bp-10h]@9 int thisb; // [sp+18h] [bp-10h]@12 int thisc; // [sp+18h] [bp-10h]@20 bool thisd; // [sp+18h] [bp-10h]@41 bool thise; // [sp+18h] [bp-10h]@61 int thisf; // [sp+18h] [bp-10h]@74 signed int v79; // [sp+1Ch] [bp-Ch]@9 int v80; // [sp+1Ch] [bp-Ch]@76 bool v81; // [sp+20h] [bp-8h]@10 bool v82; // [sp+20h] [bp-8h]@32 bool v83; // [sp+20h] [bp-8h]@42 bool v84; // [sp+20h] [bp-8h]@52 bool v85; // [sp+20h] [bp-8h]@62 //signed int i; // [sp+24h] [bp-4h]@9 signed int ia; // [sp+24h] [bp-4h]@19 signed int ib; // [sp+24h] [bp-4h]@31 signed int ic; // [sp+24h] [bp-4h]@41 signed int id; // [sp+24h] [bp-4h]@51 signed int ie; // [sp+24h] [bp-4h]@61 v1 = &pIndoor->pFaces[uFaceID]; //this = pGame->pIndoorCameraD3D; v2 = &pIndoor->pVertices[v1->pVertexIDs[0]]; //v3 = *(_DWORD *)&v2->x; v4 = v2->z; //v5 = 0; if ( v1->pFacePlane_old.vNormal.x * (v2->x - pBLVRenderParams->vPartyPos.x) + v1->pFacePlane_old.vNormal.y * (v2->y - pBLVRenderParams->vPartyPos.y) + v1->pFacePlane_old.vNormal.z * (v2->z - pBLVRenderParams->vPartyPos.z) < 0 ) { dword_50B700 = 1; } else { dword_50B700 = 0; if ( !(v1->uAttributes & 1) ) return 0; } //v66 = v1->uNumVertices; for (uint i = 0; i < v1->uNumVertices; ++i) { auto v6 = &pIndoor->pVertices[v1->pVertexIDs[i]]; pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( v6->x, v6->y, v6->z, &_50B924_view_transformed_xs[i], &_50B834_view_transformed_zs[i], &_50B744_view_transformed_ys[i], 0); } //v7 = v1->uNumVertices; //v8 = 0; if (v1->uNumVertices <= 0) return 0; bool bFound = false; for (uint i = 0; i < v1->uNumVertices; ++i) if (_50B924_view_transformed_xs[i] >= 0x80000u) { bFound = true; break; } if (!bFound) return 0; v79 = 0; _50B924_view_transformed_xs[v1->uNumVertices] = _50B924_view_transformed_xs[0]; _50B834_view_transformed_zs[v1->uNumVertices] = _50B834_view_transformed_zs[0]; _50B744_view_transformed_ys[v1->uNumVertices] = _50B744_view_transformed_ys[0]; thisa = _50B924_view_transformed_xs[0] >= 0x80000u; //int i = 1; for (uint i = 1; i < v1->uNumVertices; ++i) { v10 = _50B924_view_transformed_xs[i]; v81 = v10 >= (signed int)0x80000u; if ( thisa ^ v81 ) { v11 = _50B924_view_transformed_xs[i - 1]; if ( v10 >= (signed int)0x80000u ) { v12 = v10 - v11; v13 = 0x80000 - v11; LODWORD(v14) = v13 << 16; HIDWORD(v14) = v13 >> 16; v15 = &_50B744_view_transformed_ys[i - 1]; dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i] - _50B834_view_transformed_zs[i - 1]) * v14 / v12) >> 16) + _50B834_view_transformed_zs[i - 1]; thisb = (unsigned __int64)((_50B744_view_transformed_ys[i] - _50B744_view_transformed_ys[i - 1]) * v14 / v12) >> 16; } else { v16 = v11 - v10; v17 = 0x80000 - v10; LODWORD(v18) = v17 << 16; HIDWORD(v18) = v17 >> 16; v15 = &_50B744_view_transformed_ys[i]; dword_50B828[v79] = ((unsigned __int64)((_50B834_view_transformed_zs[i - 1] - _50B834_view_transformed_zs[i]) * v18 / v16) >> 16) + _50B834_view_transformed_zs[i]; thisb = (unsigned __int64)((_50B744_view_transformed_ys[i - 1] - _50B744_view_transformed_ys[i]) * v18 / v16) >> 16; } v19 = v79++; //v7 = v66; dword_50B738[v19] = thisb + *v15; dword_50B918[v19] = 0x80000u; } if ( v81 ) { v20 = v79++; dword_50B918[v20] = _50B924_view_transformed_xs[i]; dword_50B828[v20] = _50B834_view_transformed_zs[i]; dword_50B738[v20] = _50B744_view_transformed_ys[i]; } //++i; thisa = v81; } ia = 0; v21 = v79; dword_50B918[v79] = dword_50B918[0]; dword_50B828[v79] = dword_50B828[0]; for ( dword_50B738[v79] = dword_50B738[0]; ia < v79; dword_50BA08[v22] = pBLVRenderParams->uViewportCenterY - v35 ) { v22 = ia; thisc = abs(dword_50B918[ia]); if ( abs(dword_50B828[ia]) >> 13 <= thisc ) { v27 = dword_50B828[v22]; LODWORD(v28) = v27 << 16; HIDWORD(v28) = v27 >> 16; v26 = v28 / dword_50B918[v22]; v23 = 0; } else { v23 = 0; v24 = 0; if ( dword_50B828[v22] >= 0 ) { LOBYTE(v24) = dword_50B918[v22] >= 0; v26 = ((v24 - 1) & 0xFF800000) + 0x400000; } else { LOBYTE(v24) = dword_50B918[v22] >= 0; v25 = v24 - 1; v26 = (v25 & 0x800000) - 0x400000; } } v29 = dword_50B738[v22]; dword_50BAF4_xs[v22 + 1] = v26; if ( abs(v29) >> 13 <= thisc ) { v33 = dword_50B738[v22]; LODWORD(v34) = v33 << 16; HIDWORD(v34) = v33 >> 16; v32 = v34 / dword_50B918[v22]; } else { v30 = 0; if ( dword_50B738[v22] >= v23 ) { LOBYTE(v30) = dword_50B918[v22] >= v23; v32 = ((v30 - 1) & 0xFF800000) + 0x400000; } else { LOBYTE(v30) = dword_50B918[v22] >= v23; v31 = v30 - 1; v32 = (v31 & 0x800000) - 0x400000; } } dword_50BA08[v22] = v32; dword_50BAF4_xs[v22 + 1] = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BAF4_xs[v22 + 1]) >> 16; v35 = (unsigned __int64)(SHIWORD(pBLVRenderParams->field_40) * (signed __int64)dword_50BA08[v22]) >> 16; dword_50BAF4_xs[v22 + 1] = pBLVRenderParams->uViewportCenterX - dword_50BAF4_xs[v22 + 1]; ++ia; } v36 = 0; dword_50BAF4_xs[v21 + 1] = dword_50BAF4_xs[1]; dword_50BA08[v21] = dword_50BA08[0]; v37 = pBLVRenderParams->uViewportX; v38 = dword_50BAF4_xs[1] < (signed int)pBLVRenderParams->uViewportX; LOBYTE(v38) = dword_50BAF4_xs[1] >= (signed int)pBLVRenderParams->uViewportX; v39 = 1; ib = 1; if ( v79 < 1 ) return 0; do { v40 = v39; v41 = dword_50BAF4_xs[v40 + 1]; v82 = v41 >= (signed int)v37; if ( v38 ^ v82 ) { if ( v41 >= (signed int)v37 ) { v67 = (signed int)(v37 - dword_50BAF4_xs[v40]) * (signed __int64)(dword_50BA08[v40] - dword_50B9F8[v40 + 3]) / (v41 - dword_50BAF4_xs[v40]); v42 = dword_50B9F8[v40 + 3]; } else { v67 = (signed int)(v37 - v41) * (signed __int64)(dword_50B9F8[v40 + 3] - dword_50BA08[v40]) / (dword_50BAF4_xs[v40] - v41); v42 = dword_50BA08[v40]; } ++v36; dword_50B9F8[v36] = v67 + v42; v37 = pBLVRenderParams->uViewportX; dword_50BAE8_xs[v36] = pBLVRenderParams->uViewportX; } v38 = v82; if ( v82 ) { dword_50BAE8_xs[v36 + 1] = dword_50BAF4_xs[v40 + 1]; dword_50B9F8[v36++ + 1] = dword_50BA08[v40]; } v39 = ib++ + 1; } while ( ib <= v79 ); if ( !v36 || (v43 = 0, dword_50BAE8_xs[v36 + 1] = dword_50BAE8_xs[1], dword_50B9F8[v36 + 1] = dword_50B9F8[1], v44 = pBLVRenderParams->uViewportZ, thisd = dword_50BAE8_xs[1] <= (signed int)pBLVRenderParams->uViewportZ, ic = 1, v36 < 1) ) return 0; do { v45 = ic; v46 = dword_50BAE8_xs[ic + 1]; v83 = v46 <= (signed int)v44; if ( thisd ^ v83 ) { if ( v46 <= (signed int)v44 ) { v68 = (signed int)(v44 - dword_50BAE8_xs[v45]) * (signed __int64)(dword_50B9F8[v45 + 1] - dword_50B9F8[v45]) / (v46 - dword_50BAE8_xs[v45]); v47 = dword_50B9F8[v45]; } else { v68 = (signed int)(v44 - v46) * (signed __int64)(dword_50B9F8[v45] - dword_50B9F8[v45 + 1]) / (dword_50BAE8_xs[v45] - v46); v47 = dword_50B9F8[v45 + 1]; } ++v43; dword_50B9EC[v43] = v68 + v47; v44 = pBLVRenderParams->uViewportZ; dword_50BADC_xs[v43] = pBLVRenderParams->uViewportZ; } if ( v83 ) { dword_50BAE0[v43] = dword_50BAE8_xs[v45 + 1]; dword_50B9F0[v43++] = dword_50B9F8[v45 + 1]; } ++ic; thisd = v83; } while ( ic <= v36 ); if ( !v43 || (v48 = 0, dword_50BAE0[v43] = dword_50BAE0[0], dword_50B9F0[v43] = dword_50B9F0[0], v49 = pBLVRenderParams->uViewportY, v50 = dword_50B9F0[0] < (signed int)pBLVRenderParams->uViewportY, LOBYTE(v50) = dword_50B9F0[0] >= (signed int)pBLVRenderParams->uViewportY, v51 = 1, id = 1, v43 < 1) ) return 0; do { v52 = v51; v53 = dword_50B9F0[v52]; v84 = v53 >= (signed int)v49; if ( v50 ^ v84 ) { if ( v53 >= (signed int)v49 ) { v69 = (signed int)(v49 - dword_50B9EC[v52]) * (signed __int64)(dword_50BAE0[v52] - dword_50BADC_xs[v52]) / (v53 - dword_50B9EC[v52]); v54 = dword_50BADC_xs[v52]; } else { v69 = (signed int)(v49 - v53) * (signed __int64)(dword_50BADC_xs[v52] - dword_50BAE0[v52]) / (dword_50B9EC[v52] - v53); v54 = dword_50BAE0[v52]; } ++v48; dword_50BAD0[v48] = v69 + v54; v49 = pBLVRenderParams->uViewportY; dword_50B9E0_ys[v48] = pBLVRenderParams->uViewportY; } v50 = v84; if ( v84 ) { dword_50BAD4[v48] = dword_50BAE0[v52]; dword_50B9E0_ys[v48++ + 1] = dword_50B9F0[v52]; } v51 = id++ + 1; } while ( id <= v43 ); if ( !v48 || (v55 = 0, dword_50BAD4[v48] = dword_50BAD4[0], dword_50B9E0_ys[v48 + 1] = dword_50B9E0_ys[1], v56 = pBLVRenderParams->uViewportW, thise = dword_50B9E0_ys[1] <= (signed int)pBLVRenderParams->uViewportW, ie = 1, v48 < 1) ) return 0; do { v57 = ie; v58 = dword_50B9E0_ys[ie + 1]; v85 = v58 <= (signed int)v56; if ( thise ^ v85 ) { if ( v58 <= (signed int)v56 ) { v70 = (signed int)(v56 - dword_50B9E0_ys[v57]) * (signed __int64)(dword_50BAD4[v57] - dword_50BAD0[v57]) / (v58 - dword_50B9E0_ys[v57]); v59 = dword_50BAD0[v57]; } else { v70 = (signed int)(v56 - v58) * (signed __int64)(dword_50BAD0[v57] - dword_50BAD4[v57]) / (dword_50B9E0_ys[v57] - v58); v59 = dword_50BAD4[v57]; } ++v55; dword_50BAC4[v55] = v70 + v59; v56 = pBLVRenderParams->uViewportW; unk_50B9D4[v55] = pBLVRenderParams->uViewportW; } if ( v85 ) { dword_50BAC8[v55] = dword_50BAD4[v57]; dword_50B9D8_ys[v55++] = dword_50B9E0_ys[v57 + 1]; } ++ie; thise = v85; } while ( ie <= v48 ); if ( !v55 ) return 0; v61 = pRenderer->pRenderD3D == 0; dword_50BAC8[v55] = dword_50BAC8[0]; dword_50B9D8_ys[v55] = dword_50B9D8_ys[0]; if ( v61 && v55 > 3 ) { dword_50BAC8[v55 + 1] = dword_50BAC8[1]; dword_50B9D8_ys[v55 + 1] = dword_50B9D8_ys[1]; thisf = 2 * (dword_50B700 != 0) - 1; if ( v55 > 0 ) { v62 = 1; v71 = 1; do { v63 = v62 - 1; v64 = v62 + 1; v80 = v62 + 1; if ( v62 - 1 >= v55 ) v63 -= v55; if ( v62 >= v55 ) v62 -= v55; if ( v64 >= v55 ) v64 -= v55; if ( thisf * ((dword_50B9D8_ys[v64] - dword_50B9D8_ys[v63]) * (dword_50BAC8[v62] - dword_50BAC8[v63]) - (dword_50B9D8_ys[v62] - dword_50B9D8_ys[v63]) * (dword_50BAC8[v64] - dword_50BAC8[v63])) < 0 ) { v62 = v80; v71 = v80; } else { v62 = v71; v65 = v71; if ( v71 < v55 || (v65 = v71 - v55, v71 - v55 < v55) ) { memcpy(&dword_50B9D8_ys[v65], &dword_50B9D8_ys[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); memcpy(&dword_50BAC8[v65], &dword_50BAC8[v65 + 1], 4 * ((unsigned int)(4 * (v55 - v65)) >> 2)); } --v55; } } while ( v62 - 1 < v55 ); } dword_50BAC8[v55] = dword_50BAC8[0]; dword_50B9D8_ys[v55] = dword_50B9D8_ys[0]; } return v55; } //----- (00424579) -------------------------------------------------------- int __fastcall sub_424579(int uFaceID, stru320 *a2) { __debugbreak(); return 0; /*BLVFace *v2; // eax@1 Vec3_short_ *v3; // ebx@1 Vec3_short_ *v4; // esi@1 unsigned int v5; // esi@3 int v7; // ST1C_4@5 int v8; // ST1C_4@5 int v9; // ST1C_4@5 int v10; // ST1C_4@5 int v11; // esi@5 int v12; // ST1C_4@5 unsigned int v15; // ecx@8 unsigned int v19; // ecx@13 signed int v20; // ecx@16 signed int result; // eax@20 signed int v24; // edx@22 unsigned int v25; // [sp+Ch] [bp-1Ch]@3 float v26; // [sp+14h] [bp-14h]@3 float v27; // [sp+1Ch] [bp-Ch]@3 float v28; // [sp+20h] [bp-8h]@3 signed int v29; // [sp+24h] [bp-4h]@3 v2 = &pIndoor->pFaces[uFaceID]; v3 = pIndoor->pVertices; v4 = &pIndoor->pVertices[*v2->pVertexIDs]; if ( v2->pFacePlane_old.vNormal.x * ((signed __int16)*(int *)&v4->x - pBLVRenderParams->vPartyPos.x) + v2->pFacePlane_old.vNormal.y * ((signed __int16)(*(int *)&v4->x >> 16) - pBLVRenderParams->vPartyPos.y) + v2->pFacePlane_old.vNormal.z * (v4->z - pBLVRenderParams->vPartyPos.z) < 0 ) { dword_50B700 = 1; } else { dword_50B700 = 0; if ( !(v2->uAttributes & 1) ) return 0; } v29 = 0; v5 = v2->uNumVertices; __asm { fld pBLVRenderParams->fCosineY } v28 = pBLVRenderParams->fSineY; v26 = pBLVRenderParams->fCosineNegX; v27 = pBLVRenderParams->fSineNegX; v25 = v5; if ( (signed int)v5 > 0 ) { _ECX = (char *)&array_50AC10[0].vWorldPosition.z; do { v7 = v3[v2->pVertexIDs[v29]].x; __asm { fild [ebp+var_10] fstp dword ptr [ecx-8] } v8 = v3[v2->pVertexIDs[v29]].y; __asm { fild [ebp+var_10] fstp dword ptr [ecx-4] } v9 = v3[v2->pVertexIDs[v29]].z; __asm { fild [ebp+var_10] fstp dword ptr [ecx] } _ECX += 48; v10 = a2->pDeltaUV[0] + v2->pVertexUIDs[v29]; __asm { fild [ebp+var_10] fstp dword ptr [ecx-14h] } v11 = a2->pDeltaUV[1] + v2->pVertexVIDs[v29++]; v12 = v11; v5 = v25; __asm { fild [ebp+var_10] fstp dword ptr [ecx-10h] } } while ( v29 < (signed int)v25 ); } _EDX = (char *)&array_50AC10[0].vWorldViewPosition; if ( pBLVRenderParams->sPartyRotX ) { if ( (signed int)v5 > 0 ) { __asm { fild pBLVRenderParams->vPartyPos.x fild pBLVRenderParams->vPartyPos.y fild pBLVRenderParams->vPartyPos.z } _EAX = (char *)&array_50AC10[0].vWorldPosition.z; v15 = v5; do { __asm { fld dword ptr [eax-8] fsub st, st(3) fld dword ptr [eax-4] fsub st, st(3) fld st(1) fmul st, st(6) fld st(1) fmul [ebp+var_8] fsubp st(1), st fstp [ebp+var_4] fld dword ptr [eax] fsub st, st(3) } _EAX += 48; --v15; __asm { fstp [ebp+var_10] fld [ebp+var_4] fmul [ebp+var_14] fld [ebp+var_10] fmul [ebp+var_C] fsubp st(1), st fstp dword ptr [eax-2Ch] fld st(1) fmul [ebp+var_8] fld st(1) fmul st, st(7) faddp st(1), st fstp dword ptr [eax-28h] fstp st fstp st fld [ebp+var_4] fmul [ebp+var_C] fld [ebp+var_10] fmul [ebp+var_14] faddp st(1), st fstp dword ptr [eax-24h] } } while ( v15 ); LABEL_15: __asm { fstp st fstp st fstp st } goto LABEL_16; } } else { if ( (signed int)v5 > 0 ) { __asm { fild pBLVRenderParams->vPartyPos.x fild pBLVRenderParams->vPartyPos.y fild pBLVRenderParams->vPartyPos.z } _EAX = (char *)&array_50AC10[0].vWorldViewPosition; v19 = v5; do { __asm { fld dword ptr [eax-0Ch] fsub st, st(3) fld dword ptr [eax-8] fsub st, st(3) fld st(1) fmul st, st(6) fld st(1) fmul [ebp+var_8] fsubp st(1), st fstp dword ptr [eax] fld st(1) fmul [ebp+var_8] fld st(1) fmul st, st(7) } _EAX += 48; --v19; __asm { faddp st(1), st fstp dword ptr [eax-2Ch] fstp st fstp st fld dword ptr [eax-34h] fsub st, st(1) fstp dword ptr [eax-28h] } } while ( v19 ); goto LABEL_15; } } LABEL_16: v20 = 0; __asm { fstp st } if ( (signed int)v5 <= 0 ) return 0; do { __asm { fld dword ptr [edx] fcomp ds:flt_4D8524 fnstsw ax } if ( !(HIBYTE(_AX) & 1) ) break; ++v20; _EDX += 48; } while ( v20 < (signed int)v5 ); if ( v20 >= (signed int)v5 ) return 0; result = sr_424CD7(v5); if ( result > 0 ) { __asm { fild pBLVRenderParams->field_40 } _ECX = (char *)&array_507D30[0].vWorldViewPosition; v24 = result; __asm { fmul ds:flt_4D84A4 fild pBLVRenderParams->uViewportCenterX fild pBLVRenderParams->uViewportCenterY } do { __asm { fld1 fdiv dword ptr [ecx] } _ECX += 48; --v24; __asm { fld st fmul dword ptr [ecx-2Ch] fmul st, st(4) fsubr st, st(3) fstp dword ptr [ecx-24h] fmul dword ptr [ecx-28h] fmul st, st(3) fsubr st, st(1) fstp dword ptr [ecx-20h] } } while ( v24 ); __asm { fstp st fstp st fstp st } } memcpy(&array_507D30[result], array_507D30, sizeof(array_507D30[result])); return result;*/ } //----- (00424829) -------------------------------------------------------- bool sub_424829(int a1, BspRenderer_stru2 *a2, BspRenderer_stru2 *a3, int a4) { int v4; // edi@1 BspRenderer_stru2 *v5; // ebx@1 int v6; // eax@3 int v7; // esi@5 int v8; // edx@5 int v9; // ecx@6 int v10; // eax@12 int v11; // edi@13 int v12; // edx@18 int v13; // eax@22 int v14; // edi@28 int v15; // ecx@29 int v16; // edi@30 int v17; // edx@35 int v18; // eax@39 int v19; // eax@44 int v20; // ecx@44 int v21; // edi@45 int v22; // edi@46 __int16 *v23; // ecx@47 int v24; // edx@48 int v25; // eax@50 int v26; // eax@55 signed int v27; // edi@55 int v28; // edx@56 int v29; // edx@57 int v30; // eax@59 int v31; // eax@64 signed int v32; // edi@64 int v33; // edx@65 __int16 *v34; // eax@66 __int16 v35; // dx@66 __int16 v36; // dx@67 __int16 v37; // di@67 __int16 v38; // dx@67 BspRenderer_stru2 *v39; // ecx@69 int v40; // edx@69 int v41; // edi@70 __int16 *v42; // eax@76 __int16 *v43; // eax@81 __int16 *v45; // eax@87 int v46; // edx@87 __int16 v47; // cx@88 int v48; // eax@93 int v49; // esi@93 __int16 *v50; // ecx@94 int v51; // eax@95 int v52; // eax@97 int v53; // [sp+Ch] [bp-34h]@44 int v54; // [sp+10h] [bp-30h]@0 int v55; // [sp+14h] [bp-2Ch]@12 __int16 *v56; // [sp+14h] [bp-2Ch]@47 __int16 *v57; // [sp+14h] [bp-2Ch]@76 __int16 *v58; // [sp+14h] [bp-2Ch]@81 __int16 *v59; // [sp+14h] [bp-2Ch]@87 BspRenderer_stru2 *v60; // [sp+18h] [bp-28h]@1 int v61; // [sp+1Ch] [bp-24h]@29 int v62; // [sp+20h] [bp-20h]@0 signed int v63; // [sp+24h] [bp-1Ch]@3 signed int v64; // [sp+28h] [bp-18h]@3 int v65; // [sp+2Ch] [bp-14h]@5 int v66; // [sp+2Ch] [bp-14h]@39 int v67; // [sp+30h] [bp-10h]@22 int v68; // [sp+34h] [bp-Ch]@12 int v69; // [sp+34h] [bp-Ch]@29 int v70; // [sp+34h] [bp-Ch]@46 int v71; // [sp+34h] [bp-Ch]@75 int v72; // [sp+34h] [bp-Ch]@80 int v73; // [sp+38h] [bp-8h]@11 int v74; // [sp+3Ch] [bp-4h]@1 int a3a; // [sp+48h] [bp+8h]@76 int a3b; // [sp+48h] [bp+8h]@87 v4 = a1; v5 = a2; v74 = a1; v60 = a2; if ( !a1 || (!dword_50B700 ? (v64 = -1, v6 = 1, v63 = 1) : (v6 = 1, v63 = -1, v64 = 1), v7 = dword_50B9D8_ys[0], v65 = 0, v8 = dword_50B9D8_ys[0], a1 <= v6) ) return 0; do { v9 = dword_50B9D8_ys[v6]; if ( v9 >= v7 ) { if ( v9 > v8 ) v8 = dword_50B9D8_ys[v6]; } else { v65 = v6; v7 = dword_50B9D8_ys[v6]; } ++v6; } while ( v6 < v4 ); v73 = v8; if ( v8 == v7 ) return 0; v10 = v65; v68 = 0; v5->_viewport_space_y = v7; v5->_viewport_space_w = v8; v55 = v65; if ( v4 > 0 ) { v11 = v65; do { v10 += v64; if ( v10 < v74 ) { if ( v10 < 0 ) v10 += v74; } else { v10 -= v74; } v12 = dword_50B9D8_ys[v10]; if ( v12 <= dword_50B9D8_ys[v11] ) { v55 = v10; v11 = v10; } if ( v12 == v73 ) break; ++v68; } while ( v68 < v74 ); } v13 = v55 + v64; v67 = v55 + v64; if ( v55 + v64 < v74 ) { if ( v13 >= 0 ) goto LABEL_27; v13 += v74; } else { v13 -= v74; } v67 = v13; LABEL_27: if ( dword_50B9D8_ys[v13] != dword_50B9D8_ys[v55] ) { v14 = dword_50BAC8[v55]; v62 = v14 << 16; v54 = ((dword_50BAC8[v13] - v14) << 16) / (dword_50B9D8_ys[v13] - dword_50B9D8_ys[v55]); v5->array_18[v7] = LOWORD(dword_50BAC8[v55]); } v15 = v65; v69 = 0; v61 = v65; if ( v74 > 0 ) { v16 = v65; do { v15 += v63; if ( v15 < v74 ) { if ( v15 < 0 ) v15 += v74; } else { v15 -= v74; } v17 = dword_50B9D8_ys[v15]; if ( v17 <= dword_50B9D8_ys[v16] ) { v61 = v15; v16 = v15; } if ( v17 == v73 ) break; ++v69; } while ( v69 < v74 ); } v18 = v63 + v61; v66 = v63 + v61; if ( v63 + v61 < v74 ) { if ( v18 >= 0 ) goto LABEL_44; v18 += v74; } else { v18 -= v74; } v66 = v18; LABEL_44: v19 = v18; v20 = v61; v53 = dword_50B9D8_ys[v19] - dword_50B9D8_ys[v61]; if ( dword_50B9D8_ys[v19] != dword_50B9D8_ys[v61] ) { v21 = dword_50BAC8[v20]; v5 = v60; v61 = v21 << 16; v53 = ((dword_50BAC8[v19] - v21) << 16) / v53; v60->array_3D8[v73] = LOWORD(dword_50BAC8[v20]); } v22 = v7; v70 = v7; if ( v7 <= v73 ) { v56 = &v5->array_3D8[v7]; v23 = &v5->array_18[v7]; do { v24 = v67; if ( v22 < dword_50B9D8_ys[v67] || v22 == v73 ) goto LABEL_57; v25 = v64 + v67; v67 = v25; if ( v25 < v74 ) { if ( v25 >= 0 ) goto LABEL_55; v25 += v74; } else { v25 -= v74; } v67 = v25; LABEL_55: v26 = v25; v27 = dword_50B9D8_ys[v26] - dword_50B9D8_ys[v24]; if ( dword_50B9D8_ys[v26] - dword_50B9D8_ys[v24] > 0 ) { v28 = dword_50BAC8[v24]; v54 = ((dword_50BAC8[v26] - v28) << 16) / v27; v62 = v28 << 16; } LABEL_57: v29 = v66; if ( v70 >= dword_50B9D8_ys[v66] && v70 != v73 ) { v30 = v63 + v66; v66 += v63; if ( v66 >= v74 ) { v30 -= v74; goto LABEL_63; } if ( v30 < 0 ) { v30 += v74; LABEL_63: v66 = v30; } v31 = v30; v32 = dword_50B9D8_ys[v31] - dword_50B9D8_ys[v29]; if ( dword_50B9D8_ys[v31] - dword_50B9D8_ys[v29] > 0 ) { v33 = dword_50BAC8[v29]; v53 = ((dword_50BAC8[v31] - v33) << 16) / v32; v61 = v33 << 16; } } *(__int16 *)((char *)v56 + (int)(char *)v5->array_18 - (char *)v5->array_3D8) = HIWORD(v62); *v56 = HIWORD(v61); v34 = v23 + 480; v35 = v23[480]; if ( *v23 > v35 ) { v36 = *v23 ^ v35; v37 = *v34; *v23 = v36; v38 = v37 ^ v36; *v23 ^= v38; *v34 = v38; } ++v56; v62 += v54; v22 = v70 + 1; v61 += v53; ++v23; ++v70; } while ( v70 <= v73 ); } v39 = a3; v40 = v73; if ( v73 < a3->_viewport_space_y || (v41 = a3->_viewport_space_w, v7 > v41) ) return 0; if ( v7 < a3->_viewport_space_y ) v7 = a3->_viewport_space_y; if ( v73 > v41 ) { v40 = a3->_viewport_space_w; v73 = a3->_viewport_space_w; } v71 = v7; if ( v7 <= v40 ) { a3a = (char *)v5 - (char *)a3; v57 = &v5->array_18[v7]; v42 = &v39->array_3D8[v7]; do { if ( *(__int16 *)((char *)v42 + a3a) >= *(v42 - 480) && *v57 <= *v42 ) break; ++v57; ++v7; ++v71; ++v42; } while ( v71 <= v40 ); } v72 = v40; if ( v40 < v7 ) return 0; v58 = &v5->array_18[v40]; v43 = &v39->array_3D8[v40]; do { if ( *(__int16 *)((char *)v43 + (int)(char *)v5 - (char *)v39) >= *(v43 - 480) && *v58 <= *v43 ) break; --v58; --v40; --v72; --v43; v73 = v40; } while ( v72 >= v7 ); if ( v7 >= v40 ) return 0; a3b = (char *)v39 - (char *)v5; v59 = &v39->array_3D8[v7]; v45 = &v5->array_18[v7]; v46 = v73 - v7 + 1; do { v47 = *(__int16 *)((char *)v45 + a3b); if ( *v45 < v47 ) *v45 = v47; if ( v45[480] > *v59 ) v45[480] = *v59; ++v59; ++v45; --v46; } while ( v46 ); v5->_viewport_space_y = v7; v5->_viewport_space_w = v73; v5->field_8 = v5->array_18[v7]; v48 = v5->array_3D8[v7]; v5->field_10 = v7; v5->field_14 = v7; v49 = v7 + 1; v5->field_C = v48; if ( v49 <= v73 ) { v50 = &v5->array_3D8[v49]; do { v51 = *(v50 - 480); if ( v51 < v5->field_8 ) { v5->field_8 = v51; v5->field_10 = v49; } v52 = *v50; if ( v52 > v5->field_C ) { v5->field_C = v52; v5->field_14 = v49; } ++v49; ++v50; } while ( v49 <= v73 ); } return 1; } // 50B700: using guessed type int dword_50B700; //----- (00424CD7) -------------------------------------------------------- signed int __fastcall sr_424CD7(unsigned int uVertexID) { unsigned int v1; // edx@1 signed int v2; // edi@1 char *v3; // esi@4 char *v4; // ecx@4 unsigned int v5; // eax@4 char *v6; // edx@4 double v7; // st6@10 double v8; // st5@10 double v9; // st6@11 unsigned __int8 v10; // c2@15 unsigned __int8 v11; // c3@15 RenderVertexSoft *v12; // edi@22 char *v13; // eax@22 double v14; // st6@22 signed int result; // eax@24 unsigned int v16; // [sp+8h] [bp-28h]@4 bool v17; // [sp+Ch] [bp-24h]@6 char *v18; // [sp+10h] [bp-20h]@4 char *v19; // [sp+14h] [bp-1Ch]@4 signed int v20; // [sp+18h] [bp-18h]@1 RenderVertexSoft *v21; // [sp+1Ch] [bp-14h]@4 char *v22; // [sp+20h] [bp-10h]@4 char *v23; // [sp+24h] [bp-Ch]@4 char *v24; // [sp+28h] [bp-8h]@4 char *v25; // [sp+2Ch] [bp-4h]@4 v1 = uVertexID; memcpy(&array_50AC10[uVertexID], array_50AC10, sizeof(array_50AC10[uVertexID])); v2 = 0; v20 = 0; if ( array_50AC10[0].vWorldViewPosition.x >= 8.0 ) v2 = 1; if ( (signed int)(uVertexID + 1) <= 1 ) return 0; v3 = (char *)&array_507D30[0].vWorldViewPosition.z; v4 = (char *)&array_507D30[0].vWorldViewPosition.y; v5 = v1; v23 = (char *)&array_507D30[0].flt_20; v21 = array_507D30; v18 = (char *)&array_507D30[0].vWorldViewPosition.z; v19 = (char *)&array_507D30[0].vWorldViewPosition.y; v22 = (char *)&array_507D30[0].vWorldViewPosition; v24 = (char *)&array_507D30[0].v; v25 = (char *)&array_507D30[0].u; v6 = (char *)&array_50AC10[0].v; v16 = v5; do { v17 = *((float *)v6 + 5) >= 8.0; if ( v2 != v17 ) { if ( v17 ) { v7 = (8.0 - *((float *)v6 - 7)) / (*((float *)v6 + 5) - *((float *)v6 - 7)); *(float *)v4 = (*((float *)v6 + 6) - *((float *)v6 - 6)) * v7 + *((float *)v6 - 6); *(float *)v3 = (*((float *)v6 + 7) - *((float *)v6 - 5)) * v7 + *((float *)v6 - 5); *(float *)v25 = (*((float *)v6 + 11) - *((float *)v6 - 1)) * v7 + *((float *)v6 - 1); v8 = (*((float *)v6 + 12) - *(float *)v6) * v7 + *(float *)v6; } else { v9 = (8.0 - *((float *)v6 + 5)) / (*((float *)v6 - 7) - *((float *)v6 + 5)); *(float *)v4 = (*((float *)v6 - 6) - *((float *)v6 + 6)) * v9 + *((float *)v6 + 6); *(float *)v3 = (*((float *)v6 - 5) - *((float *)v6 + 7)) * v9 + *((float *)v6 + 7); *(float *)v25 = (*((float *)v6 - 1) - *((float *)v6 + 11)) * v9 + *((float *)v6 + 11); v8 = (*(float *)v6 - *((float *)v6 + 12)) * v9 + *((float *)v6 + 12); } *(float *)v24 = v8; *(float *)v22 = 8.0; *(int *)v23 = 0x3E000000u; if ( v2 ) { if ( 8.0 == *((float *)v6 - 7) && *(float *)v4 == *((float *)v6 - 6) ) { v10 = 0; v11 = *(float *)v3 == *((float *)v6 - 5); goto LABEL_19; } } else { if ( 8.0 == *((float *)v6 + 5) && *(float *)v4 == *((float *)v6 + 6) ) { v10 = 0; v11 = *(float *)v3 == *((float *)v6 + 7); LABEL_19: if ( v11 | v10 ) goto LABEL_21; goto LABEL_20; } } LABEL_20: ++v21; v22 += 48; v24 += 48; v25 += 48; v4 += 48; v3 += 48; ++v20; v23 += 48; v19 = v4; v18 = v3; } LABEL_21: if ( v17 ) { v12 = v21; v13 = v23; v19 += 48; v18 += 48; v14 = 1.0 / (*((float *)v6 + 5) + 0.0000001); ++v20; v25 += 48; v24 += 48; v22 += 48; ++v21; v23 += 48; memcpy(v12, v6 + 8, 0x30u); v4 = v19; v3 = v18; *(float *)v13 = v14; } v2 = v17; v6 += 48; --v16; } while ( v16 ); result = v20; if ( v20 < 3 ) return 0; return result; }