# HG changeset patch # User Ritor1 # Date 1366373488 -21600 # Node ID 23655ae9cd183dde52d7fad7bf8c76f792a86a0a # Parent 6daea87a3fe37025a28e4dcd93e1c7b7f81fd8a0# Parent 4dc2252e0b0369cdb92d7bbf1c197fa0d8b13550 Слияние diff -r 6daea87a3fe3 -r 23655ae9cd18 Events.cpp --- a/Events.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/Events.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -401,7 +401,7 @@ if ( v128 == 3 ) pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; if ( v128 == 13 ) - pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); + pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); } if (pAsyncMouse) pAsyncMouse->Resume(); @@ -424,7 +424,7 @@ if ( v128 == 3 ) pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; if ( v128 == 13 ) - pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); + pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); } if (pAsyncMouse) pAsyncMouse->Resume(); @@ -448,7 +448,7 @@ if ( v128 == 3 ) pGameLoadingUI_ProgressBar->uType = GUIProgressBar::TYPE_Fullscreen; if ( v128 == 13 ) - pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); + pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); } if (pAsyncMouse) pAsyncMouse->Resume(); @@ -865,7 +865,7 @@ { if ( *(int *)v69 && (int)&pPlayers[uActiveCharacter]->pInventoryItems[v69] == pValue ) { - *(&pPlayers[uActiveCharacter]->pEquipment.uOffHand + v68) = 0; + *(&pPlayers[uActiveCharacter]->pEquipment.uShield + v68) = 0; ++curr_seq_num; v4 = v124; break; @@ -893,7 +893,7 @@ if ( v73 >= 16 ) break; } - *(&pPlayers[i]->pEquipment.uOffHand + v73) = 0; + *(&pPlayers[i]->pEquipment.uShield + v73) = 0; } } if ( player_choose <= 3 ) diff -r 6daea87a3fe3 -r 23655ae9cd18 GUIWindow.cpp --- a/GUIWindow.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/GUIWindow.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -1995,7 +1995,7 @@ pWindow->CreateButton(0, 0, 0, 0, 1, 0, UIMSG_CycleCharacters, 0, 9u, "", 0); return pWindow; } - if (eWindowType == WINDOW_1F) + if (eWindowType == WINDOW_CastSpell_InInventory) { pMouse->SetCursorBitmap("MICON2"); pBtn_ExitCancel = pWindow->CreateButton(0x188u, 0x13Eu, 0x4Bu, 0x21u, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[34],// diff -r 6daea87a3fe3 -r 23655ae9cd18 GUIWindow.h --- a/GUIWindow.h Fri Apr 19 18:11:01 2013 +0600 +++ b/GUIWindow.h Fri Apr 19 18:11:28 2013 +0600 @@ -273,7 +273,7 @@ WINDOW_Transition = 26, WINDOW_1B = 0x1B, WINDOW_Scroll = 0x1E, - WINDOW_1F = 31, + WINDOW_CastSpell_InInventory = 31, WINDOW_FinalWindow = 0x46, WINDOW_50 = 0x50, WINDOW_59 = 0x59, @@ -474,7 +474,7 @@ unsigned int __fastcall GetSkillColor(unsigned int uPlayerClass, PLAYER_SKILL_TYPE uPlayerSkillType, signed int skill_level); const char *__fastcall CharacterUI_GetSkillDescText(unsigned int uPlayerID, PLAYER_SKILL_TYPE uPlayerSkillType); char __cdecl CharacterUI_SkillsTab_ShowHint(); -char __cdecl CharacterUI_StatsTab_ShowHint(); +void __cdecl CharacterUI_StatsTab_ShowHint(); char __fastcall CharacterUI_StatsTab_Draw(unsigned int uPlayerID); // idb diff -r 6daea87a3fe3 -r 23655ae9cd18 MM7.h --- a/MM7.h Fri Apr 19 18:11:01 2013 +0600 +++ b/MM7.h Fri Apr 19 18:11:28 2013 +0600 @@ -152,7 +152,7 @@ /* 372 */ #pragma pack(push, 1) -struct stru332 +/*struct stru332 { unsigned int texids[11]; int texid1; @@ -160,34 +160,34 @@ int texid3; int texid4; int texid5; -}; +};*/ #pragma pack(pop) -extern stru332 stru_511698[]; +extern int paperdoll_helm_texture[2][16]; /* 373 */ #pragma pack(push, 1) -struct stru333 +/*struct stru333 { unsigned int texids[5]; int texid1; int texid2; -}; +};*/ #pragma pack(pop) -extern stru333 stru_511718[]; +extern int paperdoll_belt_texture[2][7]; /* 374 */ #pragma pack(push, 1) -struct stru334 +struct stat_coord { - __int16 field_0; - __int16 field_2; - __int16 field_4; - __int16 field_6; + __int16 x; + __int16 y; + __int16 width; + __int16 height; }; #pragma pack(pop) -extern stru334 array_4E2940[26]; +extern stat_coord stat_string_coord[26]; /* 376 */ #pragma pack(push, 1) diff -r 6daea87a3fe3 -r 23655ae9cd18 Player.cpp --- a/Player.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/Player.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -256,8 +256,8 @@ v2 = &this->pEquipment; while ( 1 ) { - result = v2->uOffHand; - if ( v2->uOffHand ) + result = v2->uShield; + if ( v2->uShield ) { result = *(int *)&this->pInventoryItems[result-1]; if ( result ) @@ -1213,7 +1213,7 @@ if ( SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) >= 0 && (SHIDWORD(pParty->pPartyBuffs[13].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[13].uExpireTime) > 0) ) goto LABEL_10; - if ( v3->HasEnchantedItemEquipped(18) || v9->WearsItem(505, 3) || v10->WearsItem(530, 6) ) + if ( v3->HasEnchantedItemEquipped(18) || v3->WearsItem(505, 3) || v3->WearsItem(530, 6) ) goto LABEL_76; LABEL_40: v26 = 0; @@ -1540,7 +1540,7 @@ v4 = v2 + 1; v5 = (char *)this + 36 * v2; v6 = &byte_4E8394[pItemsTable->pItems[uItemID].uEquipType + 4]; - *(&this->pEquipment.uOffHand + (unsigned __int8)*v6) = v4; + *(&this->pEquipment.uShield + (unsigned __int8)*v6) = v4; *((int *)v5 + 133) = uItemID; v5[556] = *v6 + 1; } @@ -2787,7 +2787,7 @@ v7 = v6->uItemID; v8 = v6->uItemID; v9 = pItemsTable->pItems[v8].uDamageDice; - if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uOffHand ) + if ( pItemsTable->pItems[v8].uSkillType == PLAYER_SKILL_SPEAR && !v5->pEquipment.uShield ) ++v9; v30 = pItemsTable->pItems[v8].uDamageRoll; if ( v9 > 0 ) @@ -2855,7 +2855,7 @@ { if ( v5->HasItemEquipped((ITEM_EQUIP_TYPE)0) ) { - v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uOffHand-1]; + v15 = (ItemGen *)&v5->pInventoryItems[v5->pEquipment.uShield - 1]; v16 = v15->uItemID; v17 = v15->uItemID; if ( pItemsTable->pItems[v17].uEquipType != 4 ) @@ -3320,7 +3320,7 @@ } if ( resistance == 4 ) { - v14 = v3->pEquipment.uBody; + v14 = v3->pEquipment.uArmor; if ( v14 ) { if ( !(v3->field_1F5[36 * v14 + 15] & 2) ) @@ -3685,7 +3685,7 @@ } if ( v6 ) { - v7 = v3->pEquipment.uBody; + v7 = v3->pEquipment.uArmor; if ( v7 ) { v8 = &v3->field_1F5[36 * v7 + 15]; @@ -3815,9 +3815,9 @@ if ( HasItemEquipped((ITEM_EQUIP_TYPE)v14) ) { if ( v15 == EQUIP_ARMOUR ) - v46[v4++] = LOBYTE(v5->pEquipment.uBody) - 1; + v46[v4++] = LOBYTE(v5->pEquipment.uArmor) - 1; if ( (!v15 || v15 == 1) && GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v15) == 4 ) - v46[v4++] = *((char *)&v5->pEquipment.uOffHand + 4 * v15) - 1; + v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v15) - 1; } v14 = v15 + 1; } @@ -3833,7 +3833,7 @@ v46[v4++] = LOBYTE(v5->pEquipment.uBow) - 1; if ( (!v17 || v17 == 1) && (!GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) || GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v17) == 1) ) - v46[v4++] = *((char *)&v5->pEquipment.uOffHand + 4 * v17) - 1; + v46[v4++] = *((char *)&v5->pEquipment.uShield + 4 * v17) - 1; } v16 = v17 + 1; } @@ -4107,11 +4107,11 @@ } if (HasItemEquipped(EQUIP_OFF_HAND) && GetEquippedItemEquipType(EQUIP_OFF_HAND) != EQUIP_SHIELD) // ADD: shield check because shield recovery is added later and can be accidentally doubled { - auto v12 = &pInventoryItems[pEquipment.uOffHand - 1]; + auto v12 = &pInventoryItems[pEquipment.uShield - 1]; auto v12_desc = &pItemsTable->pItems[v12->uItemID]; if (base_recovery_times_per_weapon_type[v12_desc->uSkillType] > weapon_recovery) { - weapon = &pInventoryItems[pEquipment.uOffHand - 1]; + weapon = &pInventoryItems[pEquipment.uShield - 1]; weapon_desc = &pItemsTable->pItems[weapon->uItemID]; weapon_recovery = base_recovery_times_per_weapon_type[pItemsTable->pItems[weapon->uItemID].uSkillType]; } @@ -4121,7 +4121,7 @@ uint armour_recovery = 0; if ( HasItemEquipped(EQUIP_ARMOUR) ) { - auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uBody - 1].uItemID].uSkillType; + auto armour_skill_type = pItemsTable->pItems[pInventoryItems[pEquipment.uArmor - 1].uItemID].uSkillType; uint base_armour_recovery = base_recovery_times_per_weapon_type[armour_skill_type]; float armour_recovery_multipliers[4]; @@ -4164,7 +4164,7 @@ { float shield_recovery_multipliers[4] = {1, 0, 0, 0}; - auto shield = &pInventoryItems[pEquipment.uOffHand - 1]; + auto shield = &pInventoryItems[pEquipment.uShield - 1]; auto skill_type = pItemsTable->pItems[shield->uItemID].uSkillType; uint shield_base_recovery = base_recovery_times_per_weapon_type[skill_type]; @@ -4839,7 +4839,7 @@ { if ( !HasItemEquipped((ITEM_EQUIP_TYPE)v65) ) goto LABEL_361; - v31 = *(&v6->pEquipment.uOffHand + v65) - 1; + v31 = *(&v6->pEquipment.uShield + v65) - 1; if ( v3 == 9 ) { v32 = GetEquippedItemEquipType((ITEM_EQUIP_TYPE)v65); @@ -5411,7 +5411,7 @@ if ( v22 <= 2 ) { v23 = this->pInventoryItems[this->pEquipment.uMainHand].uItemID; - if ( v6->pEquipment.uOffHand || pItemsTable->pItems[v23].uSkillType != 4 ) + if ( v6->pEquipment.uShield || pItemsTable->pItems[v23].uSkillType != 4 ) { v24 = v23; v26 = pItemsTable->pItems[v23].uDamageRoll; @@ -5461,7 +5461,7 @@ } if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v19 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v19 < 0) || v19 > 2 ) return v5 + v62 + v61; - v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uOffHand-1]; + v20 = *(int *)&v6->pInventoryItems[v6->pEquipment.uShield - 1]; goto LABEL_365; } if ( attr == 27 ) @@ -5479,7 +5479,7 @@ if ( v9 <= 2 ) { v5 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageDice + pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uDamageMod; - if ( !v6->pEquipment.uOffHand ) + if ( !v6->pEquipment.uShield ) { if ( pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uMainHand].uItemID].uSkillType == 4 ) ++v5; @@ -5489,8 +5489,8 @@ } if ( a3 || !v6->HasItemEquipped(EQUIP_OFF_HAND) || (v12 = v6->GetEquippedItemEquipType(EQUIP_OFF_HAND), v12 < 0) || v12 > 2 ) return v5 + v62 + v61; - v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uOffHand].uItemID].uDamageMod; - v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uOffHand].uItemID].uDamageDice; + v14 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageMod; + v15 = pItemsTable->pItems[this->pInventoryItems[this->pEquipment.uShield].uItemID].uDamageDice; LABEL_88: v5 += v15 + v14; } @@ -6190,7 +6190,7 @@ v69 = &v2->pEquipment; do { - if ( !v69->uOffHand || (v42 = (int)((char *)v2 + 36 * v69->uOffHand), *(char *)(v42 + 516) & 2) ) + if ( !v69->uShield || (v42 = (int)((char *)v2 + 36 * v69->uShield), *(char *)(v42 + 516) & 2) ) goto LABEL_117; v43 = (PLAYER_SKILL_TYPE)pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; v44 = pItemsTable->pItems[*(int *)(v42 + 496)].uSkillType; diff -r 6daea87a3fe3 -r 23655ae9cd18 Player.h --- a/Player.h Fri Apr 19 18:11:01 2013 +0600 +++ b/Player.h Fri Apr 19 18:11:28 2013 +0600 @@ -330,10 +330,10 @@ { struct { - unsigned int uOffHand; + unsigned int uShield; unsigned int uMainHand; unsigned int uBow; - unsigned int uBody; + unsigned int uArmor; unsigned int uHelm; unsigned int uBelt; unsigned int uCloak; diff -r 6daea87a3fe3 -r 23655ae9cd18 Render.cpp --- a/Render.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/Render.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -10894,7 +10894,7 @@ } pMouse->bActive = 1; if ( pVideoPlayer->AnyMovieLoaded() ) - pVideoPlayer->_4BF73A(); + pVideoPlayer->SelectMovieType(); if ( BYTE1(dword_6BE364_game_settings_1) & 8 ) BYTE1(dword_6BE364_game_settings_1) &= 0xF7u; else diff -r 6daea87a3fe3 -r 23655ae9cd18 UICharacter.cpp --- a/UICharacter.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/UICharacter.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -1188,93 +1188,80 @@ { signed int pSex; // eax@1 unsigned int v6; // ecx@9 - int v7; // ecx@10 - unsigned int pMainHandNum4; // eax@14 - ItemGen *item_MainHand4; // eax@15 - int v10; // edx@15 - unsigned int pX_MainHand4; // edi@15 - unsigned int v14; // ebx@18 - Texture *v16; // ebp@27 - double v17; // st7@29 - int v18; // edi@30 - char *v19; // eax@30 - unsigned int pBowNum; // eax@37 - ItemGen *itemBow; // edi@38 - int pX_Bow; // ebx@38 - double v28; // st7@51 - char *v30; // eax@54 - unsigned int pCloakNum; // eax@59 - ItemGen *item_Cloak; // edx@60 - int v33; // eax@65 - int v34; // eax@74 - int v35; // ebx@74 - LODFile_IconsBitmaps *v38; // ecx@78 - Texture *v39; // edi@85 - double v40; // st7@87 - int v41; // edi@88 - unsigned int pBodyNum; // eax@93 - ItemGen *body; // edx@94 - int v45; // eax@98 - int v46; // eax@106 - int v48; // ebx@106 - LODFile_IconsBitmaps *v50; // ecx@110 - Texture *v51; // edi@117 - double v52; // st7@119 - int v53; // edi@120 - //Texture *pBodyTexture; // edi@121 - char *v55; // eax@122 - unsigned int pBootNum; // eax@127 - ItemGen *item_Boot; // edi@128 - int v59; // ebx@129 - int v60; // ecx@132 - int v61; // eax@134 - Texture *v63; // edi@145 - double v64; // st7@147 - int v65; // edi@148 - char *v66; // eax@148 - unsigned int pMainHandNum; // edx@155 - int v70; // edx@156 - unsigned int pBeltNum; // eax@160 - ItemGen *item_Belt; // edi@161 - int v73; // edx@163 - int v74; // ecx@168 - unsigned int v75; // ebx@170 - Texture *v77; // edi@181 - double v78; // st7@183 - int v79; // edi@184 - char *v80; // eax@184 - unsigned int pMainHandNum2; // eax@192 - int v83; // eax@193 - int pBodyNum2; // eax@197 - ItemGen *body2; // ecx@197 - int v87; // eax@197 - int v88; // eax@198 - int v89; // eax@199 - int v90; // edi@201 - int v91; // edi@213 - int v92; // ebx@213 - int v93; // edi@214 - int v94; // ebx@214 - int v95; // eax@214 - char *v96; // edi@226 - double v97; // st7@228 - int v98; // edi@229 - char *v99; // eax@229 - int v102; // edi@236 - int pX_armor; // eax@237 - int pY_armor; // ecx@237 - //int v105; // edx@237 - int v106; // edx@238 - int v107; // edx@239 - int v108; // edx@240 - int v109; // edi@250 - char *v110; // edx@250 - unsigned int pCloakNum2; // eax@259 - ItemGen *item_Cloak2; // eax@260 - int v114; // eax@265 - int v115; // eax@274 - int v116; // ebx@274 - unsigned int v117; // edi@274 + int v7; // ecx@10 + unsigned int pMainHandNum4; // eax@14 + ItemGen *item_MainHand4; // eax@15 + int v10; // edx@15 + unsigned int pX_MainHand4; // edi@15 + unsigned int v14; // ebx@18 + Texture *v16; // ebp@27 + double v17; // st7@29 + int v18; // edi@30 + char *v19; // eax@30 + unsigned int pBowNum; // eax@37 + ItemGen *itemBow; // edi@38 + int pX_Bow; // ebx@38 + double v28; // st7@51 + char *v30; // eax@54 + unsigned int pCloakNum; // eax@59 + ItemGen *item_Cloak; // edx@60 + int v33; // eax@65 + int v34; // eax@74 + int v35; // ebx@74 + LODFile_IconsBitmaps *v38; // ecx@78 + Texture *v39; // edi@85 + double v40; // st7@87 + int v41; // edi@88 + unsigned int pArmorNum; // eax@93 + ItemGen *item_Armor; // edx@94 + int v45; // eax@98 + int v48; // ebx@106 + LODFile_IconsBitmaps *v50; // ecx@110 + Texture *v51; // edi@117 + double v52; // st7@119 + int v53; // edi@120 + char *v55; // eax@122 + unsigned int pBootNum; // eax@127 + ItemGen *item_Boot; // edi@128 + int v59; // ebx@129 + int v60; // ecx@132 + Texture *v63; // edi@145 + double v64; // st7@147 + int v65; // edi@148 + char *v66; // eax@148 + unsigned int pMainHandNum; // edx@155 + int v70; // edx@156 + unsigned int pBeltNum; // eax@160 + ItemGen *item_Belt; // edi@161 + int v73; // edx@163 + unsigned int v75; // ebx@170 + Texture *v77; // edi@181 + double v78; // st7@183 + int v79; // edi@184 + char *v80; // eax@184 + unsigned int pMainHandNum2; // eax@192 + int v83; // eax@193 + int pArmorShoulderNum; // eax@197 + int v87; // eax@197 + int v88; // eax@198 + int v89; // eax@199 + int v94; // ebx@214 + int v95; // eax@214 + char *v96; // edi@226 + double v97; // st7@228 + int v98; // edi@229 + char *v99; // eax@229 + int pX_ArmorShoulder; // eax@237 + int pY_ArmorShoulder; // ecx@237 + int v106; // edx@238 + int v107; // edx@239 + int v108; // edx@240 + int v109; // edi@250 + char *v110; // edx@250 + unsigned int pCloakCollarNum; // eax@259 + ItemGen *item_CloakCollar; // eax@260 + int v114; // eax@265 + int v116; // ebx@274 double v118; // st7@286 int v119; // edi@287 char *v120; // eax@287 @@ -1282,7 +1269,6 @@ int pHelmNum; // ebx@297 ItemGen *item_Helm; // edi@298 int v125; // ecx@303 - int v126; // eax@312 unsigned int v127; // ebx@314 Texture *v129; // edi@325 double v130; // st7@327 @@ -1295,10 +1281,10 @@ double v141; // st7@350 int v142; // edi@351 char *v143; // eax@351 - unsigned int pOffHandNum; // eax@358 - ItemGen *item_OffHand; // eax@359 + unsigned int pShieldNum; // eax@358 + ItemGen *item_Shield; // eax@359 int v149; // edx@359 - int pX_OffHand; // ebx@362 + int pX_Shield; // ebx@362 int v151; // ecx@363 int v152; // ecx@364 unsigned int v153; // eax@370 @@ -1321,39 +1307,33 @@ char *v181; // [sp-8h] [bp-54h]@337 const char *v182; // [sp-8h] [bp-54h]@344 const char *v183; // [sp-8h] [bp-54h]@375 - //signed int v184; // [sp-4h] [bp-50h]@66 - //signed int v185; // [sp-4h] [bp-50h]@99 signed int v186; // [sp-4h] [bp-50h]@202 signed int v191; // [sp-4h] [bp-50h]@266 signed int v192; // [sp-4h] [bp-50h]@304 - unsigned int a3; // [sp+10h] [bp-3Ch]@7 int pY_MainHand4; // [sp+10h] [bp-3Ch]@15 int pY_Bow; // [sp+10h] [bp-3Ch]@38 unsigned int pY_Cloak; // [sp+10h] [bp-3Ch]@74 - unsigned int pY_Body; // [sp+10h] [bp-3Ch]@106 + unsigned int pY_Armor; // [sp+10h] [bp-3Ch]@106 int pY_Boot; // [sp+10h] [bp-3Ch]@129 int pY_Belt; // [sp+10h] [bp-3Ch]@168 unsigned int pY_shoulder; // [sp+10h] [bp-3Ch]@216 - unsigned int a3h; // [sp+10h] [bp-3Ch]@274 + unsigned int pY_CloakCollar; // [sp+10h] [bp-3Ch]@274 int pY_Helm; // [sp+10h] [bp-3Ch]@312 int pY_MainHand3; // [sp+10h] [bp-3Ch]@336 - int pY_OffHand; // [sp+10h] [bp-3Ch]@362 - signed int a2; // [sp+14h] [bp-38h]@7 + int pY_Shield; // [sp+10h] [bp-3Ch]@362 Texture *a2b; // [sp+14h] [bp-38h]@49 int pX_Cloak; // [sp+14h] [bp-38h]@74 - int pX_Body; // [sp+14h] [bp-38h]@106 + int pX_Armor; // [sp+14h] [bp-38h]@106 int pX_Boot; // [sp+14h] [bp-38h]@129 int pX_Belt; // [sp+14h] [bp-38h]@168 int pX_shoulder; // [sp+14h] [bp-38h]@214 - int a2h; // [sp+14h] [bp-38h]@274 + int pX_CloakCollar; // [sp+14h] [bp-38h]@274 Texture *a2i; // [sp+14h] [bp-38h]@284 int pX_Helm; // [sp+14h] [bp-38h]@312 int pX_MainHand3; // [sp+14h] [bp-38h]@336 - int v223; // [sp+1Ch] [bp-30h]@213 int pBodyComplection; // [sp+24h] [bp-28h]@6 unsigned int pBowTextureNum; // [sp+2Ch] [bp-20h]@38 signed int v245; // [sp+34h] [bp-18h]@361 - int uPlayerID_a; // [sp+38h] [bp-14h]@9 signed int IsDwarf; // [sp+40h] [bp-Ch]@4 pIcons_LOD->LoadTexture("sptext01", TEXTURE_16BIT_PALETTE); @@ -1370,7 +1350,70 @@ } pRenderer->ResetTextureClipRect(); pRenderer->DrawTextureIndexed(0x1D3u, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));// - if ( !IsPlayerWearingWatersuit[uPlayerID] ) + if ( IsPlayerWearingWatersuit[uPlayerID] )// + { + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, + (Texture *)(papredoll_dbods[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbods[uPlayerID - 1]] : 0)); + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(pPaperdoll_BodyX, pPaperdoll_BodyY, + (Texture *)(papredoll_dbods[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbods[uPlayerID - 1]] : 0), + pPlayers[uPlayerID]->pEquipment.uArmor); + v6 = pPlayers[uPlayerID]->pEquipment.uMainHand; + if ( !v6 || (v7 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[v6-1], pItemsTable->pItems[v7].uEquipType != 1) + && (pItemsTable->pItems[v7].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], + (Texture *)(papredoll_dlads[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlads[uPlayerID - 1]] : 0)); + pMainHandNum4 = pPlayers[uPlayerID]->pEquipment.uMainHand; + if ( pMainHandNum4 ) + { + item_MainHand4 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum4 - 1]; + pX_MainHand4 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipX; + pY_MainHand4 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipY; + if ( item_MainHand4->uItemID == 64 ) + v166 = "item64v1"; + else + v166 = pItemsTable->pItems[item_MainHand4->uItemID].pIconName; + v14 = pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE); + if ( !( item_MainHand4->uAttributes & 0xF0 ) ) + { + v18 = v14 + 1; + v19 = (char *)&pIcons_LOD->pTextures[v14]; + if ( item_MainHand4->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0)); + else + { + if ( item_MainHand4->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0)); + else + pRenderer->DrawTransparentGreenShade(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0)); + } + } + if ( item_MainHand4->uAttributes & 0xF0 ) + { + if ( ( item_MainHand4->uAttributes & 0xF0) != 16 ) + v167 = "sptext01"; + if ( ( item_MainHand4->uAttributes & 0xF0) == 32 ) + v167 = "sp28a"; + if ( (item_MainHand4->uAttributes & 0xF0) == 64 ) + v167 = "sp30a"; + if ( (item_MainHand4->uAttributes & 0xF0) == 128 ) + v167 = "sp91a"; + v16 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v167, TEXTURE_16BIT_PALETTE)]; + dword_50C9A8 -= pEventTimer->uTimeElapsed; + if ( dword_50C9A8 <= 0 ) + { + dword_50C9A8 = 0; + item_MainHand4->uAttributes &= 0xFu; + ptr_50C9A4 = 0; + } + v17 = (double)GetTickCount() * 0.1; + pRenderer->_4A63E6(pX_MainHand4, pY_MainHand4, (Texture *)(v14 != -1 ? (int)&pIcons_LOD->pTextures[v14] : 0), v16, (signed __int64)v17, 0, 255); + } + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0), pMainHandNum4); + } + } + else// { pBowNum = pPlayers[uPlayerID]->pEquipment.uBow; // if ( pBowNum ) @@ -1379,22 +1422,22 @@ pX_Bow = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][2][0] - pItemsTable->pItems[itemBow->uItemID].uEquipX; pY_Bow = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][2][1] - pItemsTable->pItems[itemBow->uItemID].uEquipY; pBowTextureNum = pIcons_LOD->LoadTexture(pItemsTable->pItems[itemBow->uItemID].pIconName, TEXTURE_16BIT_PALETTE); - if ( !(itemBow->uAttributes & 0xF0) ) + if ( !(itemBow->uAttributes & 0xF0) )// { if ( itemBow->uAttributes & 2 ) pRenderer->DrawTransparentRedShade(pX_Bow, pY_Bow, (Texture *)(pBowTextureNum != -1 ? (int)&pIcons_LOD->pTextures[pBowTextureNum] : 0)); else { v30 = (char *)&pIcons_LOD->pTextures[pBowTextureNum]; - if ( !(itemBow->uAttributes & 1) ) + if ( !(itemBow->uAttributes & 1) )// pRenderer->DrawTransparentGreenShade(pX_Bow, pY_Bow, (Texture *)(pBowTextureNum != -1 ? (int)v30 : 0)); - else + else // pRenderer->DrawTextureTransparent(pX_Bow, pY_Bow, (Texture *)(pBowTextureNum != -1 ? (int)v30 : 0)); } } else { - if ( (itemBow->uAttributes & 0xF0) == 16 )//(itemBow->uAttributes & 0xF0) - ??? + if ( (itemBow->uAttributes & 0xF0) == 16 ) v168 = "sptext01"; if ( (itemBow->uAttributes & 0xF0) == 32 ) v168 = "sp28a"; @@ -1443,10 +1486,9 @@ } if ( v33 >= 0 && v33 < 10 ) { - v34 = v33 + 10 * pBodyComplection; - v35 = paperdoll_array_511828[0][v34];//Texture_Cloak - pX_Cloak = pPaperdoll_BodyX + paperdoll_Cloak[0][v34][0]; - pY_Cloak = pPaperdoll_BodyY + paperdoll_Cloak[0][v34][1]; + v35 = paperdoll_cloak_texture[pBodyComplection][v33];//Texture_Cloak + pX_Cloak = pPaperdoll_BodyX + paperdoll_Cloak[pBodyComplection][v33][0]; + pY_Cloak = pPaperdoll_BodyY + paperdoll_Cloak[pBodyComplection][v33][1]; if ( !(item_Cloak->uAttributes & 0xF0) ) { v41 = v35 + 1; @@ -1482,11 +1524,11 @@ } pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY,// (Texture *)(papredoll_dbods[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbods[uPlayerID - 1]] : 0)); - pBodyNum = pPlayers[uPlayerID]->pEquipment.uBody;// - if ( pBodyNum ) + pArmorNum = pPlayers[uPlayerID]->pEquipment.uArmor;// + if ( pArmorNum ) { - body = &pPlayers[uPlayerID]->pInventoryItems[pBodyNum-1]; - switch ( body->uItemID ) + item_Armor = &pPlayers[uPlayerID]->pInventoryItems[pArmorNum - 1]; + switch ( item_Armor->uItemID ) { case 504: v45 = 15; @@ -1501,124 +1543,225 @@ v45 = 16; break; default: - v45 = body->uItemID - 66; + v45 = item_Armor->uItemID - 66; break; } if ( v45 >= 0 && v45 < 17 ) { - v46 = 17 * pBodyComplection + v45; - pX_Body = pPaperdoll_BodyX + paperdoll_Armor[0][v46][0]; - pY_Body = pPaperdoll_BodyY + paperdoll_Armor[0][v46][1]; - v48 = paperdoll_array_511290[0][v46][0];//Texture_Armor - if ( !(body->uAttributes & 0xF0) ) + pX_Armor = pPaperdoll_BodyX + paperdoll_Armor[pBodyComplection][v45][0]; + pY_Armor = pPaperdoll_BodyY + paperdoll_Armor[pBodyComplection][v45][1]; + v48 = paperdoll_armor_texture[pBodyComplection][v45][0]; + if ( !(item_Armor->uAttributes & 0xF0) ) { v53 = v48 + 1; - if ( body->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_Body, pY_Body, (Texture *)(v53 != 0 ? (int)&pIcons_LOD->pTextures[v48] : 0)); + if ( item_Armor->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(pX_Armor, pY_Armor, (Texture *)(v53 != 0 ? (int)&pIcons_LOD->pTextures[v48] : 0)); else { v55 = (char *)&pIcons_LOD->pTextures[v48]; - if ( !(body->uAttributes & 1) ) - pRenderer->DrawTransparentGreenShade(pX_Body, pY_Body, (Texture *)(v53 != 0 ? (int)v55 : 0)); + if ( !(item_Armor->uAttributes & 1) ) + pRenderer->DrawTransparentGreenShade(pX_Armor, pY_Armor, (Texture *)(v53 != 0 ? (int)v55 : 0)); else - pRenderer->DrawTextureTransparent(pX_Body, pY_Body, (Texture *)(v53 != 0 ? (int)v55 : 0)); + pRenderer->DrawTextureTransparent(pX_Armor, pY_Armor, (Texture *)(v53 != 0 ? (int)v55 : 0)); } } else { - if ( (body->uAttributes & 0xF0) == 16 ) + if ( (item_Armor->uAttributes & 0xF0) == 16 ) v170 = "sptext01"; - if ( (body->uAttributes & 0xF0) == 32 ) + if ( (item_Armor->uAttributes & 0xF0) == 32 ) v170 = "sp28a"; - if ( (body->uAttributes & 0xF0) == 64 ) + if ( (item_Armor->uAttributes & 0xF0) == 64 ) v170 = "sp30a"; - if ( (body->uAttributes & 0xF0) == 128 ) + if ( (item_Armor->uAttributes & 0xF0) == 128 ) v170 = "sp91a"; v51 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v170, TEXTURE_16BIT_PALETTE)]; dword_50C9A8 -= pEventTimer->uTimeElapsed; if ( dword_50C9A8 <= 0 ) { dword_50C9A8 = 0; - body->uAttributes &= 0xFu; + item_Armor->uAttributes &= 0xFu; ptr_50C9A4 = 0; } v52 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_Body, pY_Body, (Texture *)(v48 != -1 ? (int)&pIcons_LOD->pTextures[v48] : 0), v51, (signed __int64)v52, 0, 255); + pRenderer->_4A63E6(pX_Armor, pY_Armor, (Texture *)(v48 != -1 ? (int)&pIcons_LOD->pTextures[v48] : 0), v51, (signed __int64)v52, 0, 255); } - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_Body, pY_Body, (Texture *)(v53 != 0 ? (int)v55 : 0), pBodyNum); - } - pBootNum = pPlayers[uPlayerID]->pEquipment.uBoot;// - if ( pBootNum ) - { - item_Boot = &pPlayers[uPlayerID]->pInventoryItems[pBootNum - 1]; - switch ( item_Boot->uItemID ) + if ( pPlayers[uPlayerID]->pEquipment.uMainHand // + && (pPlayers[uPlayerID]->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_MAIN_HAND || + pPlayers[uPlayerID]->GetEquippedItemSkillType(EQUIP_MAIN_HAND) == EQUIP_SHIELD && + !pPlayers[uPlayerID]->pEquipment.uShield) ) { - case 529: - v60 = 5; - v59 = papredoll_flying_feet[pPlayers[uPlayerID]->uFace]; - break; - case 512: - v60 = 6; - v59 = dword_511638[pBodyComplection][5]; - break; - default: - v60 = item_Boot->uItemID - 115; - v59 = dword_511638[0][v60 + 6 * pBodyComplection]; - break; - } - if ( v60 >= 0 && v60 < 7 ) - { - v61 = v60 + 7 * pBodyComplection; - pY_Boot = pPaperdoll_BodyY + paperdoll_Boot[0][v61][1]; - pX_Boot = pPaperdoll_BodyX + paperdoll_Boot[0][v61][0]; - if ( !(item_Boot->uAttributes & 0xF0) ) + v94 = paperdoll_armor_texture[pBodyComplection][v45][2]; + if ( v94 == pIcons_LOD->FindTextureByName("pending") ) + { + v94 = paperdoll_armor_texture[pBodyComplection][v45][1]; + pX_shoulder = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][v45][0]; + pY_shoulder = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][v45][1]; + } + else { - v65 = v59 + 1; - v66 = (char *)&pIcons_LOD->pTextures[v59]; - if ( item_Boot->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0)); + pX_shoulder = pPaperdoll_BodyX + dword_4E5270[v45][0]; + pY_shoulder = pPaperdoll_BodyY + dword_4E5270[v45][1]; + } + if ( !(item_Armor->uAttributes & 0xF0) ) + { + v98 = v94 + 1; + v99 = (char *)&pIcons_LOD->pTextures[v94]; + if ( item_Armor->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0)); else { - if ( item_Boot->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0)); + if ( item_Armor->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0)); else - pRenderer->DrawTransparentGreenShade(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0)); + pRenderer->DrawTransparentGreenShade(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0)); } } else { - if ( (item_Boot->uAttributes & 0xF0) == 16 ) - v171 = "sptext01"; - if ( (item_Boot->uAttributes & 0xF0) == 32 ) - v171 = "sp28a"; - if ( (item_Boot->uAttributes & 0xF0) == 64 ) - v171 = "sp30a"; - if ( (item_Boot->uAttributes & 0xF0) == 128 ) - v171 = "sp91a"; - v63 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v171, TEXTURE_16BIT_PALETTE)]; - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) + if ( v94 != pIcons_LOD->FindTextureByName("pending") ) { - dword_50C9A8 = 0; - item_Boot->uAttributes &= 0xFu; - ptr_50C9A4 = 0; + if ( item_Armor->uAttributes & 0xF0 ) + { + if ( (item_Armor->uAttributes & 0xF0) == 16 ) + v173 = "sptext01"; + if ( (item_Armor->uAttributes & 0xF0) == 32 ) + v173 = "sp28a"; + if ( ( item_Armor->uAttributes & 0xF0) == 64 ) + v173 = "sp30a"; + if ( (item_Armor->uAttributes & 0xF0) == 128 ) + v173 = "sp91a"; + v96 = (char *)&pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v173, TEXTURE_16BIT_PALETTE)]; + dword_50C9A8 -= pEventTimer->uTimeElapsed; + if ( dword_50C9A8 <= 0 ) + { + dword_50C9A8 = 0; + item_Armor->uAttributes &= 0xFu; + ptr_50C9A4 = 0; + } + v97 = (double)GetTickCount(); + pRenderer->_4A63E6(pX_shoulder, pY_shoulder, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255); + } + } + } + } + else + { + v94 = paperdoll_armor_texture[pBodyComplection][v45][1]; + if ( v94 != pIcons_LOD->FindTextureByName("pending") ) + { + pX_ArmorShoulder = pPaperdoll_BodyX + paperdoll_shoulder[pBodyComplection][v45][0]; + pY_ArmorShoulder = pPaperdoll_BodyY + paperdoll_shoulder[pBodyComplection][v45][1]; + if ( !(item_Armor->uAttributes & 0xF0) ) + { + v109 = v94 + 1; + v110 = (char *)&pIcons_LOD->pTextures[v94]; + if ( item_Armor->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)(v109 != 0 ? (int)v110 : 0)); + else + { + if ( item_Armor->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)(v109 != 0 ? (int)v110 : 0)); + else + pRenderer->DrawTransparentGreenShade(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)(v109 != 0 ? (int)v110 : 0)); + } + } + else + { + if ( (item_Armor->uAttributes & 0xF0) == 16 ) + v178 = "sptext01"; + if ( (item_Armor->uAttributes & 0xF0) == 32 ) + v178 = "sp28a"; + if ( (item_Armor->uAttributes & 0xF0) == 64 ) + v178 = "sp30a"; + if ( (item_Armor->uAttributes & 0xF0) == 128 ) + v178 = "sp91a"; + v96 = (char *)&pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v178, TEXTURE_16BIT_PALETTE)]; + dword_50C9A8 -= pEventTimer->uTimeElapsed; + if ( dword_50C9A8 <= 0 ) + { + dword_50C9A8 = 0; + item_Armor->uAttributes &= 0xFu; + ptr_50C9A4 = 0; + } + v97 = (double)GetTickCount(); + pRenderer->_4A63E6(pX_ArmorShoulder, pY_ArmorShoulder, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255); } - v64 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_Boot, pY_Boot, (Texture *)(v59 != -1 ? (int)&pIcons_LOD->pTextures[v59] : 0), v63, (signed __int64)v64, 0, 255); } - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0), pBootNum); } + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(pX_Armor, pY_Armor, (Texture *)(v53 != 0 ? (int)v55 : 0), pArmorNum); + } + } + pBootNum = pPlayers[uPlayerID]->pEquipment.uBoot;// + if ( pBootNum ) + { + item_Boot = &pPlayers[uPlayerID]->pInventoryItems[pBootNum - 1]; + switch ( item_Boot->uItemID ) + { + case 529: + v60 = 5; + v59 = papredoll_flying_feet[pPlayers[uPlayerID]->uFace]; + break; + case 512: + v60 = 6; + v59 = paperdoll_boots_texture[pBodyComplection][5]; + break; + default: + v60 = item_Boot->uItemID - 115; + v59 = paperdoll_boots_texture[pBodyComplection][v60]; + break; } - pMainHandNum = pPlayers[uPlayerID]->pEquipment.uMainHand; - uPlayerID_a = 2 * pBodyComplection; - if ( !pMainHandNum || (v70 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[pMainHandNum -1], pItemsTable->pItems[v70].uEquipType != 1) - && (pItemsTable->pItems[v70].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uOffHand) ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], - pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], + if ( v60 >= 0 && v60 < 7 ) + { + pX_Boot = pPaperdoll_BodyX + paperdoll_Boot[pBodyComplection][v60][0]; + pY_Boot = pPaperdoll_BodyY + paperdoll_Boot[pBodyComplection][v60][1]; + if ( !(item_Boot->uAttributes & 0xF0) ) + { + v65 = v59 + 1; + v66 = (char *)&pIcons_LOD->pTextures[v59]; + if ( item_Boot->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0)); + else + { + if ( item_Boot->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0)); + else + pRenderer->DrawTransparentGreenShade(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0)); + } + } + else + { + if ( (item_Boot->uAttributes & 0xF0) == 16 ) + v171 = "sptext01"; + if ( (item_Boot->uAttributes & 0xF0) == 32 ) + v171 = "sp28a"; + if ( (item_Boot->uAttributes & 0xF0) == 64 ) + v171 = "sp30a"; + if ( (item_Boot->uAttributes & 0xF0) == 128 ) + v171 = "sp91a"; + v63 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v171, TEXTURE_16BIT_PALETTE)]; + dword_50C9A8 -= pEventTimer->uTimeElapsed; + if ( dword_50C9A8 <= 0 ) + { + dword_50C9A8 = 0; + item_Boot->uAttributes &= 0xFu; + ptr_50C9A4 = 0; + } + v64 = (double)GetTickCount() * 0.1; + pRenderer->_4A63E6(pX_Boot, pY_Boot, (Texture *)(v59 != -1 ? (int)&pIcons_LOD->pTextures[v59] : 0), v63, (signed __int64)v64, 0, 255); + } + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(pX_Boot, pY_Boot, (Texture *)(v65 != 0 ? (int)v66 : 0), pBootNum); + } + } + pMainHandNum = pPlayers[uPlayerID]->pEquipment.uMainHand; + if ( !pMainHandNum || (v70 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[pMainHandNum -1], pItemsTable->pItems[v70].uEquipType != 1) + && (pItemsTable->pItems[v70].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uShield) ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], + pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], (Texture *)(papredoll_dlads[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlads[uPlayerID - 1]] : 0)); - pBeltNum = pPlayers[uPlayerID]->pEquipment.uBelt;// + pBeltNum = pPlayers[uPlayerID]->pEquipment.uBelt;// if ( pBeltNum ) { item_Belt = &pPlayers[uPlayerID]->pInventoryItems[pBeltNum - 1]; @@ -1636,13 +1779,12 @@ } if ( v73 >= 0 && v73 < 7 ) { - v74 = 7 * pBodyComplection + v73; - pX_Belt = pPaperdoll_BodyX + paperdoll_Belt[0][v74][0]; - pY_Belt = pPaperdoll_BodyY + paperdoll_Belt[0][v74][1]; + pX_Belt = pPaperdoll_BodyX + paperdoll_Belt[pBodyComplection][v73][0]; + pY_Belt = pPaperdoll_BodyY + paperdoll_Belt[pBodyComplection][v73][1]; if ( IsDwarf != 1 || v73 == 5 ) - v75 = stru_511718[pBodyComplection].texids[v73]; + v75 = paperdoll_belt_texture[pBodyComplection][v73]; else - v75 = stru_511718[pBodyComplection - 2].texids[v73]; + v75 = paperdoll_belt_texture[pBodyComplection - 2][v73]; if ( !(item_Belt->uAttributes & 0xF0) ) { v79 = v75 + 1; @@ -1687,86 +1829,16 @@ { v83 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[pMainHandNum2 - 1]; if ( pItemsTable->pItems[v83].uEquipType == 1 - || pItemsTable->pItems[v83].uSkillType == 4 && !pPlayers[uPlayerID]->pEquipment.uOffHand ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[0][uPlayerID_a], - pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[0][uPlayerID_a + 1], + || pItemsTable->pItems[v83].uSkillType == 4 && !pPlayers[uPlayerID]->pEquipment.uShield ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], + pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], (Texture *)(papredoll_dlaus[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlaus[uPlayerID - 1]] : 0)); } - pBodyNum2 = pPlayers[uPlayerID]->pEquipment.uBody; - if ( pBodyNum2 ) + pCloakCollarNum = pPlayers[uPlayerID]->pEquipment.uCloak;// + if ( pCloakCollarNum ) { - body2 = &pPlayers[uPlayerID]->pInventoryItems[pBodyNum2 - 1]; - switch ( body2->uItemID ) - { - case 504: - v90 = 15; - break; - case 505: - v90 = 14; - break; - case 516: - v90 = 13; - break; - case 533: - v90 = 16; - break; - default: - v90 = body2->uItemID - 66; - break; - } - if ( v90 >= 0 && v90 < 17 ) - { - v102 = 17 * pBodyComplection + v90; - v94 = paperdoll_array_511290[0][v102][1]; - if ( v94 != pIcons_LOD->FindTextureByName("pending") ) - { - pX_armor = pPaperdoll_BodyX + paperdoll_shoulder[0][v102][0]; - pY_armor = pPaperdoll_BodyY + paperdoll_shoulder[0][v102][1]; - if ( !(body2->uAttributes & 0xF0) ) - { - v109 = v94 + 1; - v110 = (char *)&pIcons_LOD->pTextures[v94]; - if ( body2->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_armor, pY_armor, (Texture *)(v109 != 0 ? (int)v110 : 0)); - else - { - if ( body2->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(pX_armor, pY_armor, (Texture *)(v109 != 0 ? (int)v110 : 0)); - else - pRenderer->DrawTransparentGreenShade(pX_armor, pY_armor, (Texture *)(v109 != 0 ? (int)v110 : 0)); - } - } - else - { - if ( (item_Belt->uAttributes & 0xF0) == 16 ) - v178 = "sptext01"; - if ( (item_Belt->uAttributes & 0xF0) == 32 ) - v178 = "sp28a"; - if ( (item_Belt->uAttributes & 0xF0) == 64 ) - v178 = "sp30a"; - if ( (item_Belt->uAttributes & 0xF0) == 128 ) - v178 = "sp91a"; - v96 = (char *)&pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v178, TEXTURE_16BIT_PALETTE)]; - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) - { - dword_50C9A8 = 0; - body2->uAttributes &= 0xFu; - ptr_50C9A4 = 0; - } - v97 = (double)GetTickCount(); - pRenderer->_4A63E6(pX_armor, pY_armor, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255); - } - } - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_armor, pY_armor, (Texture *)(v109 != 0 ? (int)v110 : 0), pBodyNum2); - } - } - pCloakNum2 = pPlayers[uPlayerID]->pEquipment.uCloak; - if ( pCloakNum2 ) - { - item_Cloak2 = &pPlayers[uPlayerID]->pInventoryItems[pCloakNum2 - 1]; - switch ( item_Cloak2->uItemID ) + item_CloakCollar = &pPlayers[uPlayerID]->pInventoryItems[pCloakCollarNum - 1]; + switch ( item_CloakCollar->uItemID ) { case 525: v114 = 5; @@ -1784,52 +1856,49 @@ v114 = 9; break; default: - v114 = item_Cloak2->uItemID - 105; + v114 = item_CloakCollar->uItemID - 105; } if ( v114 >= 0 && v114 < 10 ) { - v115 = v114 + 10 * pBodyComplection; - v116 = dword_511788[v115]; - v115 *= 8; - v117 = pPaperdoll_BodyX + *(int *)((char *)&dword_4E56B0[v115][0]);//Cloak - a2h = pPaperdoll_BodyX + *(int *)((char *)&dword_4E56B0[v115][0]); - a3h = pPaperdoll_BodyY + *(int *)((char *)&dword_4E56B0[v115][1]); - if ( v116 == pIcons_LOD->FindTextureByName("pending") ) + v116 = paperdoll_cloak_collar_texture[pBodyComplection][v114]; + pX_CloakCollar = pPaperdoll_BodyX + paperdoll_CloakCollar[pBodyComplection][v114][0]; + pY_CloakCollar = pPaperdoll_BodyY + paperdoll_CloakCollar[pBodyComplection][v114][1]; + if ( v116 != pIcons_LOD->FindTextureByName("pending") ) { - if ( !(item_Cloak2->uAttributes & 0xF0) ) + if ( !(item_CloakCollar->uAttributes & 0xF0) ) { v119 = v116 + 1; v120 = (char *)&pIcons_LOD->pTextures[v116]; - if ( item_Cloak2->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(a2h, a3h, (Texture *)(v119 != 0 ? (int)v120 : 0)); + if ( item_CloakCollar->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(pX_CloakCollar, pY_CloakCollar, (Texture *)(v119 != 0 ? (int)v120 : 0)); else - pRenderer->DrawTextureTransparent(a2h, a3h, (Texture *)(v119 != 0 ? (int)v120 : 0)); + pRenderer->DrawTextureTransparent(pX_CloakCollar, pY_CloakCollar, (Texture *)(v119 != 0 ? (int)v120 : 0)); + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(pX_CloakCollar, pY_CloakCollar, (Texture *)(v119 != 0 ? (int)v120 : 0), pCloakCollarNum); } else { - if ( (item_Cloak2->uAttributes & 0xF0) == 16 ) + if ( (item_CloakCollar->uAttributes & 0xF0) == 16 ) v179 = "sptext01"; - if ( (item_Cloak2->uAttributes & 0xF0) == 32 ) + if ( (item_CloakCollar->uAttributes & 0xF0) == 32 ) v179 = "sp28a"; - if ( (item_Cloak2->uAttributes & 0xF0) == 64 ) + if ( (item_CloakCollar->uAttributes & 0xF0) == 64 ) v179 = "sp30a"; - if ( (item_Cloak2->uAttributes & 0xF0) == 128 ) + if ( (item_CloakCollar->uAttributes & 0xF0) == 128 ) v179 = "sp91a"; a2i = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v179, TEXTURE_16BIT_PALETTE)]; dword_50C9A8 -= pEventTimer->uTimeElapsed; if ( dword_50C9A8 <= 0 ) { dword_50C9A8 = 0; - item_Cloak2->uAttributes &= 0xFu; + item_CloakCollar->uAttributes &= 0xFu; ptr_50C9A4 = 0; } v118 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(v117, a3h, (Texture *)(v116 != -1 ? (int)&pIcons_LOD->pTextures[v116] : 0), a2i, (signed __int64)v118, 0, 255); + pRenderer->_4A63E6(pX_CloakCollar, pY_CloakCollar, (Texture *)(v116 != -1 ? (int)&pIcons_LOD->pTextures[v116] : 0), a2i, (signed __int64)v118, 0, 255); } } } - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(a2h, a3h, (Texture *)(v119 != 0 ? (int)v120 : 0), pCloakNum2); } if ( pPlayers[uPlayerID]->uFace == 12 || pPlayers[uPlayerID]->uFace == 13 ) { @@ -1839,35 +1908,61 @@ pPaperdoll_BodyY + pPaperdoll_Beards[2 * pPlayers[uPlayerID]->uFace - 23], (Texture *)(v122 != -1 ? (int)&pIcons_LOD->pTextures[v122] : 0)); } - pHelmNum = pPlayers[uPlayerID]->pEquipment.uHelm; - if ( pHelmNum ) + pHelmNum = pPlayers[uPlayerID]->pEquipment.uHelm;// + if ( pHelmNum ) + { + item_Helm = &pPlayers[uPlayerID]->pInventoryItems[pHelmNum-1]; + switch ( item_Helm->uItemID ) { - item_Helm = &pPlayers[uPlayerID]->pInventoryItems[pHelmNum-1]; - switch ( item_Helm->uItemID ) + case 521: + v125 = 11; + break; + case 522: + v125 = 12; + break; + case 523: + v125 = 13; + break; + case 532: + v125 = 14; + break; + case 544: + v125 = 15; + break; + default: + v125 = item_Helm->uItemID - 89; + } + if ( v125 >= 0 && v125 < 16 ) + { + pX_Helm = pPaperdoll_BodyX + paperdoll_Helm[pBodyComplection][v125][0]; + pY_Helm = pPaperdoll_BodyY + paperdoll_Helm[pBodyComplection][v125][1]; + if ( IsDwarf != 1 || item_Helm->uItemID != 92 ) + v127 = paperdoll_helm_texture[pSex][v125]; + else + v127 = papredoll_dbrds[11]; + if ( item_Helm->uAttributes & 0xF0 ) { - case 521: - v125 = 11; - break; - case 522: - v125 = 12; - break; - case 523: - v125 = 13; - break; - case 532: - v125 = 14; - break; - case 544: - v125 = 15; - break; - default: - v125 = item_Helm->uItemID - 89; + if ( (item_Helm->uAttributes & 0xF0) == 16 ) + v180 = "sptext01"; + if ( (item_Helm->uAttributes & 0xF0) == 32 ) + v180 = "sp28a"; + if ( (item_Helm->uAttributes & 0xF0) == 64 ) + v180 = "sp30a"; + if ( (item_Helm->uAttributes & 0xF0) == 128 ) + v180 = "sp91a"; + v129 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v180, TEXTURE_16BIT_PALETTE)]; + dword_50C9A8 -= pEventTimer->uTimeElapsed; + if ( dword_50C9A8 <= 0 ) + { + dword_50C9A8 = 0; + item_Helm->uAttributes &= 0xFu; + ptr_50C9A4 = 0; + } + v130 = (double)GetTickCount() * 0.1; + pRenderer->_4A63E6(pX_Helm, pY_Helm, (Texture *)(v127 != -1 ? (int)&pIcons_LOD->pTextures[v127] : 0), v129, (signed __int64)v130, 0, 255); } - if ( v125 >= 0 && v125 < 16 ) + else { - v126 = 2 * (v125 + 16 * pBodyComplection); - pX_Helm = pPaperdoll_BodyX + paperdoll_Helm[v126][0]; - pY_Helm = pPaperdoll_BodyY + paperdoll_Helm[v126][1]; v131 = v127 + 1; v132 = (char *)&pIcons_LOD->pTextures[v127]; if ( item_Helm->uAttributes & 2 ) @@ -1879,310 +1974,145 @@ else pRenderer->DrawTransparentGreenShade(pX_Helm, pY_Helm, (Texture *)(v131 != 0 ? (int)v132 : 0)); } - if ( IsDwarf != 1 || item_Helm->uItemID != 92 ) - v127 = stru_511698[0].texids[v125 + 16 * pSex]; + } + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(pX_Helm, pY_Helm, (Texture *)(v131 != 0 ? (int)v132 : 0), pHelmNum); + } + } + pMainHandNum3 = pPlayers[uPlayerID]->pEquipment.uMainHand;//weapon in right hand + if ( pMainHandNum3 ) + { + item_MainHand3 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum3 - 1]; + pX_MainHand3 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipX; + pY_MainHand3 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipY; + if ( item_MainHand3->uItemID == 64 ) + v181 = "item64v1"; + else + v181 = pItemsTable->pItems[item_MainHand3->uItemID].pIconName; + v138 = pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE); + if ( !(item_MainHand3->uAttributes & 0xF0) ) + { + v142 = v138 + 1; + v143 = (char *)&pIcons_LOD->pTextures[v138]; + if ( item_MainHand3->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0)); + else + { + if ( item_MainHand3->uAttributes & 1 ) + pRenderer->DrawTextureTransparent(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0)); else - v127 = papredoll_dbrds[11]; - if ( item_Helm->uAttributes & 0xF0 ) - { - if ( (item_Helm->uAttributes & 0xF0) == 16 ) - v180 = "sptext01"; - if ( (item_Helm->uAttributes & 0xF0) == 32 ) - v180 = "sp28a"; - if ( (item_Helm->uAttributes & 0xF0) == 64 ) - v180 = "sp30a"; - if ( (item_Helm->uAttributes & 0xF0) == 128 ) - v180 = "sp91a"; - v129 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v180, TEXTURE_16BIT_PALETTE)]; - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) - { - dword_50C9A8 = 0; - item_Helm->uAttributes &= 0xFu; - ptr_50C9A4 = 0; - } - v130 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_Helm, pY_Helm, (Texture *)(v127 != -1 ? (int)&pIcons_LOD->pTextures[v127] : 0), v129, (signed __int64)v130, 0, 255); - } - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_Helm, pY_Helm, (Texture *)(v131 != 0 ? (int)v132 : 0), pHelmNum); + pRenderer->DrawTransparentGreenShade(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0)); } } - pMainHandNum3 = pPlayers[uPlayerID]->pEquipment.uMainHand; - if ( pMainHandNum3 ) + else { - item_MainHand3 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum3 - 1]; - pX_MainHand3 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipX; - pY_MainHand3 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand3->uItemID].uEquipY; - if ( item_MainHand3->uItemID == 64 ) - v181 = "item64v1"; - else - v181 = pItemsTable->pItems[item_MainHand3->uItemID].pIconName; - v138 = pIcons_LOD->LoadTexture(v181, TEXTURE_16BIT_PALETTE); - if ( !(item_MainHand3->uAttributes & 0xF0) ) - { - v142 = v138 + 1; - v143 = (char *)&pIcons_LOD->pTextures[v138]; - if ( item_MainHand3->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0)); - else - { - if ( item_MainHand3->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0)); - else - pRenderer->DrawTransparentGreenShade(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0)); - } - } - else + if ( (item_MainHand3->uAttributes & 0xF0) == 16 ) + v182 = "sptext01"; + if ( (item_MainHand3->uAttributes & 0xF0) == 32 ) + v182 = "sp28a"; + if ( (item_MainHand3->uAttributes & 0xF0) == 64 ) + v182 = "sp30a"; + if ( (item_MainHand3->uAttributes & 0xF0) == 128 ) + v182 = "sp91a"; + v140 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v182, TEXTURE_16BIT_PALETTE)]; + dword_50C9A8 -= pEventTimer->uTimeElapsed; + if ( dword_50C9A8 <= 0 ) { - if ( (item_MainHand3->uAttributes & 0xF0) == 16 ) - v182 = "sptext01"; - if ( (item_MainHand3->uAttributes & 0xF0) == 32 ) - v182 = "sp28a"; - if ( (item_MainHand3->uAttributes & 0xF0) == 64 ) - v182 = "sp30a"; - if ( (item_MainHand3->uAttributes & 0xF0) == 128 ) - v182 = "sp91a"; - v140 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v182, TEXTURE_16BIT_PALETTE)]; - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) - { - dword_50C9A8 = 0; - item_MainHand3->uAttributes &= 0xFu; - ptr_50C9A4 = 0; - } - v141 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_MainHand3, pY_MainHand3, (Texture *)(v138 != -1 ? (int)&pIcons_LOD->pTextures[v138] : 0), v140, (signed __int64)v141, 0, 255); + dword_50C9A8 = 0; + item_MainHand3->uAttributes &= 0xFu; + ptr_50C9A4 = 0; } - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0), pMainHandNum3); + v141 = (double)GetTickCount() * 0.1; + pRenderer->_4A63E6(pX_MainHand3, pY_MainHand3, (Texture *)(v138 != -1 ? (int)&pIcons_LOD->pTextures[v138] : 0), v140, (signed __int64)v141, 0, 255); } - pOffHandNum = pPlayers[uPlayerID]->pEquipment.uOffHand; - if ( !pOffHandNum ) - goto LABEL_393; - item_OffHand = &pPlayers[uPlayerID]->pInventoryItems[pOffHandNum - 1]; - v149 = pItemsTable->pItems[item_OffHand->uItemID].uSkillType; - if ( v149 != 2 && v149 != 1 ) + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(pX_MainHand3, pY_MainHand3, (Texture *)(v142 != 0 ? (int)v143 : 0), pMainHandNum3); + } + pShieldNum = pPlayers[uPlayerID]->pEquipment.uShield;// + if ( pShieldNum ) + { + item_Shield = &pPlayers[uPlayerID]->pInventoryItems[pShieldNum - 1]; + v149 = pItemsTable->pItems[item_Shield->uItemID].uSkillType; + if ( v149 == 2 || v149 == 1 ) + { + v151 = item_Shield->uItemID - 400; + pX_Shield = 596; + v245 = 1; + switch ( item_Shield->uItemID ) + { + case 400: + pY_Shield = 86; + break; + case 403: + pY_Shield = 28; + break; + case 415: + pX_Shield = 595; + pY_Shield = 33; + break; + default: + pX_Shield = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item_Shield->uItemID].uEquipX; + pY_Shield = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item_Shield->uItemID].uEquipY; + break; + } + } + else { v245 = 0; - pX_OffHand = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item_OffHand->uItemID].uEquipX; - pY_OffHand = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item_OffHand->uItemID].uEquipY; - goto LABEL_370; + pX_Shield = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item_Shield->uItemID].uEquipX; + pY_Shield = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item_Shield->uItemID].uEquipY; + } + v153 = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_Shield->uItemID].pIconName, TEXTURE_16BIT_PALETTE); + if ( !(item_Shield->uAttributes & 0xF0) ) + { + if ( item_Shield->uAttributes & 2 ) + pRenderer->DrawTransparentRedShade(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)&pIcons_LOD->pTextures[v153] : 0)); + else + { + v160 = (char *)&pIcons_LOD->pTextures[v153]; + if ( !(item_Shield->uAttributes & 1) ) + pRenderer->DrawTransparentGreenShade(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)v160 : 0)); + else + pRenderer->DrawTextureTransparent(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)v160 : 0)); + } } - v151 = item_OffHand->uItemID - 400; - v245 = 1; - if ( v151 ) - { - v152 = v151 - 3; - if ( v152 ) - { - if ( v152 != 12 ) - { - pX_OffHand = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][0][0] - pItemsTable->pItems[item_OffHand->uItemID].uEquipX; - pY_OffHand = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][0][1] - pItemsTable->pItems[item_OffHand->uItemID].uEquipY; - goto LABEL_370; - } - pX_OffHand = 595; - pY_OffHand = 33; -LABEL_370: - v153 = pIcons_LOD->LoadTexture(pItemsTable->pItems[item_OffHand->uItemID].pIconName, TEXTURE_16BIT_PALETTE); - if ( !(item_OffHand->uAttributes & 0xF0) ) - { - if ( item_OffHand->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_OffHand, pY_OffHand, (Texture *)(v153 != -1 ? (int)&pIcons_LOD->pTextures[v153] : 0)); - else - { - v160 = (char *)&pIcons_LOD->pTextures[v153]; - if ( !(item_OffHand->uAttributes & 1) ) - pRenderer->DrawTransparentGreenShade(pX_OffHand, pY_OffHand, (Texture *)(v153 != -1 ? (int)v160 : 0)); - else - pRenderer->DrawTextureTransparent(pX_OffHand, pY_OffHand, (Texture *)(v153 != -1 ? (int)v160 : 0)); - } - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_OffHand, pY_OffHand, (Texture *)(v153 != -1 ? (int)&pIcons_LOD->pTextures[v153] : 0), pOffHandNum); - if ( v245 ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdollLeftEmptyHand[uPlayerID_a], - pPaperdoll_BodyY + pPaperdollLeftEmptyHand[uPlayerID_a + 1], - (Texture *)(papredoll_dlhs[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlhs[uPlayerID - 1]] : 0)); - goto LABEL_393; - } - else - { - if ( (item_OffHand->uAttributes & 0xF0) == 16 ) - v183 = "sptext01"; - if ( (item_OffHand->uAttributes & 0xF0) == 32 ) - v183 = "sp28a"; - if ( (item_OffHand->uAttributes & 0xF0) == 64 ) - v183 = "sp30a"; - if ( (item_OffHand->uAttributes & 0xF0) == 128 ) - v183 = "sp91a"; - v157 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v183, TEXTURE_16BIT_PALETTE)]; - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) - { - dword_50C9A8 = 0; - item_OffHand->uAttributes &= 0xFu; - ptr_50C9A4 = 0; - } - v158 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_OffHand, pY_OffHand, (Texture *)(v153 != -1 ? (int)&pIcons_LOD->pTextures[v153] : 0), - v157, (signed __int64)v158, 0, 255); - if ( v245 ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdollLeftEmptyHand[uPlayerID_a], - pPaperdoll_BodyY + pPaperdollLeftEmptyHand[uPlayerID_a + 1], - (Texture *)(papredoll_dlhs[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlhs[uPlayerID - 1]] : 0)); - goto LABEL_393; - } - } - pY_OffHand = 28; - } - else - { - pY_OffHand = 86; - } - pX_OffHand = 596; - goto LABEL_370; - } - if ( pPlayers[uPlayerID]->pEquipment.uMainHand - && (pPlayers[uPlayerID]->GetEquippedItemEquipType(EQUIP_MAIN_HAND) == EQUIP_MAIN_HAND || - pPlayers[uPlayerID]->GetEquippedItemSkillType(EQUIP_MAIN_HAND) == EQUIP_SHIELD && - !pPlayers[uPlayerID]->pEquipment.uOffHand) ) - { - v91 = 17 * pBodyComplection + v90; - v92 = v91; - v223 = paperdoll_array_511290[0][v91][2]; - if ( v223 == pIcons_LOD->FindTextureByName("pending") ) - { - v93 = 2 * v91; - v94 = paperdoll_array_511290[0][v92][1]; - pX_shoulder = pPaperdoll_BodyX + paperdoll_shoulder[0][0][v93]; - v95 = paperdoll_shoulder[0][0][v93 + 1]; - } - else - { - v94 = v223; - pX_shoulder = pPaperdoll_BodyX + dword_4E5270[2 * v91]; - v95 = dword_4E5270[2 * v91 + 1]; - } - pY_shoulder = pPaperdoll_BodyY + v95; - if ( !(body2->uAttributes & 0xF0) ) - { - v98 = v94 + 1; - v99 = (char *)&pIcons_LOD->pTextures[v94]; - if ( body2->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0)); - else - { - if ( body2->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0)); - else - pRenderer->DrawTransparentGreenShade(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0)); - } - } - else - { - if ( v94 != pIcons_LOD->FindTextureByName("pending") ) - { - if ( body2->uAttributes & 0xF0 )//v242 + 516 - { - if ( (body2->uAttributes & 0xF0) == 16 ) - v173 = "sptext01"; - if ( (body2->uAttributes & 0xF0) == 32 ) - v173 = "sp28a"; - if ( ( body2->uAttributes & 0xF0) == 64 ) - v173 = "sp30a"; - if ( (body2->uAttributes & 0xF0) == 128 ) - v173 = "sp91a"; - v96 = (char *)&pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v173, TEXTURE_16BIT_PALETTE)]; - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) - { - dword_50C9A8 = 0; - body2->uAttributes &= 0xFu; - ptr_50C9A4 = 0; - } - v97 = (double)GetTickCount(); - pRenderer->_4A63E6(pX_shoulder, pY_shoulder, (Texture *)(v94 != -1 ? (int)&pIcons_LOD->pTextures[v94] : 0), - (Texture *)v96, (signed __int64)(v97 * 0.1), 0, 255); - } - } - } - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_shoulder, pY_shoulder, (Texture *)(v98 != 0 ? (int)v99 : 0), pBodyNum2); - } - } - a3 = pPaperdoll_BodyY; - a2 = pPaperdoll_BodyX; - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX, pPaperdoll_BodyY, - (Texture *)(papredoll_dbods[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbods[uPlayerID - 1]] : 0)); - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(a2, a3, - (Texture *)(papredoll_dbods[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dbods[uPlayerID - 1]] : 0), - pPlayers[uPlayerID]->pEquipment.uBody); - uPlayerID_a = 2 * pBodyComplection; - v6 = pPlayers[uPlayerID]->pEquipment.uMainHand; - if ( !v6 || (v7 = *(int *)&pPlayers[uPlayerID]->pInventoryItems[v6-1], pItemsTable->pItems[v7].uEquipType != 1) - && (pItemsTable->pItems[v7].uSkillType != 4 || pPlayers[uPlayerID]->pEquipment.uOffHand) ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_LeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_LeftHand[pBodyComplection][1], - (Texture *)(papredoll_dlads[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlads[uPlayerID - 1]] : 0)); - pMainHandNum4 = pPlayers[uPlayerID]->pEquipment.uMainHand; - if ( pMainHandNum4 ) - { - item_MainHand4 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum4 - 1]; - pX_MainHand4 = pPaperdoll_BodyX + paperdoll_Weapon[pBodyComplection][1][0] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipX; - pY_MainHand4 = pPaperdoll_BodyY + paperdoll_Weapon[pBodyComplection][1][1] - pItemsTable->pItems[item_MainHand4->uItemID].uEquipY; - if ( item_MainHand4->uItemID == 64 ) - v166 = "item64v1"; - else - v166 = pItemsTable->pItems[item_MainHand4->uItemID].pIconName; - v14 = pIcons_LOD->LoadTexture(v166, TEXTURE_16BIT_PALETTE); - if ( !( item_MainHand4->uAttributes & 0xF0 ) ) - { - v18 = v14 + 1; - v19 = (char *)&pIcons_LOD->pTextures[v14]; - if ( item_MainHand4->uAttributes & 2 ) - pRenderer->DrawTransparentRedShade(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0)); - else - { - if ( item_MainHand4->uAttributes & 1 ) - pRenderer->DrawTextureTransparent(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0)); - else - pRenderer->DrawTransparentGreenShade(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0)); - } - } - if ( item_MainHand4->uAttributes & 0xF0 ) - { - if ( ( item_MainHand4->uAttributes & 0xF0) != 16 ) - v167 = "sptext01"; - if ( ( item_MainHand4->uAttributes & 0xF0) == 32 ) - v167 = "sp28a"; - if ( (item_MainHand4->uAttributes & 0xF0) == 64 ) - v167 = "sp30a"; - if ( (item_MainHand4->uAttributes & 0xF0) == 128 ) - v167 = "sp91a"; - v16 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v167, TEXTURE_16BIT_PALETTE)]; - dword_50C9A8 -= pEventTimer->uTimeElapsed; - if ( dword_50C9A8 <= 0 ) - { - dword_50C9A8 = 0; - item_MainHand4->uAttributes &= 0xFu; - ptr_50C9A4 = 0; - } - v17 = (double)GetTickCount() * 0.1; - pRenderer->_4A63E6(pX_MainHand4, pY_MainHand4, (Texture *)(v14 != -1 ? (int)&pIcons_LOD->pTextures[v14] : 0), v16, (signed __int64)v17, 0, 255); - } - if ( !bRingsShownInCharScreen ) - pRenderer->DrawMaskToZBuffer(pX_MainHand4, pY_MainHand4, (Texture *)(v18 != 0 ? (int)v19 : 0), pMainHandNum4); - } -LABEL_393: - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[uPlayerID_a], pPaperdoll_BodyY + pPaperdoll_RightHand[uPlayerID_a + 1], + else + { + if ( (item_Shield->uAttributes & 0xF0) == 16 ) + v183 = "sptext01"; + if ( (item_Shield->uAttributes & 0xF0) == 32 ) + v183 = "sp28a"; + if ( (item_Shield->uAttributes & 0xF0) == 64 ) + v183 = "sp30a"; + if ( (item_Shield->uAttributes & 0xF0) == 128 ) + v183 = "sp91a"; + v157 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(v183, TEXTURE_16BIT_PALETTE)]; + dword_50C9A8 -= pEventTimer->uTimeElapsed; + if ( dword_50C9A8 <= 0 ) + { + dword_50C9A8 = 0; + item_Shield->uAttributes &= 0xFu; + ptr_50C9A4 = 0; + } + v158 = (double)GetTickCount() * 0.1; + pRenderer->_4A63E6(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)&pIcons_LOD->pTextures[v153] : 0), v157, (signed __int64)v158, 0, 255); + if ( v245 ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdollLeftEmptyHand[pBodyComplection][0], + pPaperdoll_BodyY + pPaperdollLeftEmptyHand[pBodyComplection][1], + (Texture *)(papredoll_dlhs[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlhs[uPlayerID - 1]] : 0)); + } + if ( !bRingsShownInCharScreen ) + pRenderer->DrawMaskToZBuffer(pX_Shield, pY_Shield, (Texture *)(v153 != -1 ? (int)&pIcons_LOD->pTextures[v153] : 0), pShieldNum); + } + } + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_RightHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_RightHand[pBodyComplection][1], (Texture *)(papredoll_drhs[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_drhs[uPlayerID - 1]] : 0)); pMainHandNum5 = pPlayers[uPlayerID]->pEquipment.uMainHand; if ( pMainHandNum5 ) { - item_MainHand5 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum5-1]; - if ( pItemsTable->pItems[item_MainHand5->uItemID].uEquipType == 1 || pItemsTable->pItems[item_MainHand5->uItemID].uSkillType == 4 && !pPlayers[uPlayerID]->pEquipment.uOffHand ) - pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[0][uPlayerID_a], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[0][uPlayerID_a + 1], + item_MainHand5 = &pPlayers[uPlayerID]->pInventoryItems[pMainHandNum5 - 1]; + if ( pItemsTable->pItems[item_MainHand5->uItemID].uEquipType == 1 || pItemsTable->pItems[item_MainHand5->uItemID].uSkillType == 4 && !pPlayers[uPlayerID]->pEquipment.uShield ) + pRenderer->DrawTextureTransparent(pPaperdoll_BodyX + pPaperdoll_SecondLeftHand[pBodyComplection][0], pPaperdoll_BodyY + pPaperdoll_SecondLeftHand[pBodyComplection][1], (Texture *)(papredoll_dlhus[uPlayerID - 1] != -1 ? (int)&pIcons_LOD->pTextures[papredoll_dlhus[uPlayerID - 1]] : 0)); } if ( !bRingsShownInCharScreen )// @@ -2190,7 +2120,6 @@ pRenderer->DrawTextureTransparent(468, 0, (Texture *)(uTextureID_507B04 != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_507B04] : 0));// } - //----- (0043E825) -------------------------------------------------------- void __fastcall CharacterUI_DrawPaperdollWithRingOverlay(unsigned int uPlayerID) { @@ -2509,16 +2438,6 @@ char *v9; // ebx@16 char v10; // al@16 signed int v11; // edi@21 - Player *pPlayer3; // ebx@23 - //Player *pPlayer4; // edi@29 - //int v14; // ebp@29 - //stru331 *v15; // edi@65 - //signed int v16; // ebx@66 - //unsigned int v17; // eax@67 - //unsigned int *v18; // ecx@67 - //unsigned int *v19; // ebx@68 - //int v20; // edi@73 - int v21; // ebp@73 unsigned int v22; // eax@76 int v23; // ecx@76 unsigned int v24; // eax@78 @@ -2526,19 +2445,13 @@ int v26; // ebx@79 unsigned int v27; // eax@80 int v28; // ecx@80 - //int result; // eax@83 int v30; // [sp+10h] [bp-28h]@5 - //signed int v31; // [sp+10h] [bp-28h]@68 signed int v32; // [sp+10h] [bp-28h]@75 signed int v33; // [sp+10h] [bp-28h]@77 int v34; // [sp+10h] [bp-28h]@79 - //char *v35; // [sp+14h] [bp-24h]@65 - int v36; // [sp+14h] [bp-24h]@75 + int pItemTXTNum; // [sp+14h] [bp-24h]@75 int v37; // [sp+14h] [bp-24h]@77 signed int v38; // [sp+14h] [bp-24h]@79 - //unsigned int *v39; // [sp+18h] [bp-20h]@66 - int *v40; // [sp+18h] [bp-20h]@73 - //unsigned int *v41; // [sp+1Ch] [bp-1Ch]@73 int v42; // [sp+20h] [bp-18h]@6 int v43; // [sp+20h] [bp-18h]@73 char pContainer[128]; // [sp+24h] [bp-14h]@12 @@ -2616,216 +2529,152 @@ papredoll_dbrds[5] = pIcons_LOD->LoadTexture("ib-cd3-d", TEXTURE_16BIT_PALETTE); papredoll_dbrds[3] = pIcons_LOD->LoadTexture("ib-cd4-d", TEXTURE_16BIT_PALETTE); papredoll_dbrds[1] = pIcons_LOD->LoadTexture("ib-cd5-d", TEXTURE_16BIT_PALETTE); - v11 = 0; - do + for ( v11 = 0; v11 < 54; ++v11 )// test equipment { - byte_5111C0[v11] = 0; + party_has_equipment[v11] = 0; if ( pParty->pPickedItem.uItemID != v11 + 66 ) { - pPlayer3 = pParty->pPlayers; - while ( !sub_43EE15_player_has_item(v11 + 66, pPlayer3, 0) ) + for ( uint i = 0; i < 4; ++i) { - ++pPlayer3; - if ( (signed int)pPlayer3 >= (signed int)pParty->pHirelings ) - goto LABEL_28; + if ( Player_has_item(v11 + 66, &pParty->pPlayers[i], 0) ) + party_has_equipment[v11] = 1; } } - byte_5111C0[v11] = 1; -LABEL_28: - ++v11; } - while ( v11 < 54 ); memset(byte_5111F6, 0, 16); for (uint i = 0; i < 4; ++i) { auto player = pParty->pPlayers + i; - if (sub_43EE15_player_has_item(ITEM_ARTICACT_GOVERNONS_ARMOR, player, 1)) byte_5111F6[0] = 1; - if (sub_43EE15_player_has_item(ITEM_ARTIFACT_YORUBA, player, 1)) byte_5111F6[1] = 1; - if (sub_43EE15_player_has_item(ITEM_RELIC_HARECS_LEATHER, player, 1)) byte_5111F6[2] = 1; - if (sub_43EE15_player_has_item(ITEM_ARTIFACT_LEAGUE_BOOTS, player, 1)) byte_5111F6[3] = 1; - if (sub_43EE15_player_has_item(ITEM_RELIC_TALEDONS_HELM, player, 1)) byte_5111F6[4] = 1; - if (sub_43EE15_player_has_item(ITEM_RELIC_SCHOLARS_CAP, player, 1)) byte_5111F6[5] = 1; - if (sub_43EE15_player_has_item(ITEM_RELIC_PHYNAXIAN_CROWN, player, 1)) byte_5111F6[6] = 1; - if (sub_43EE15_player_has_item(ITEM_ARTIFACT_MINDS_EYE, player, 1)) byte_5111F6[7] = 1; - if (sub_43EE15_player_has_item(ITEM_RARE_SHADOWS_MASK, player, 1)) byte_5111F6[8] = 1; - if (sub_43EE15_player_has_item(ITEM_RILIC_TITANS_BELT, player, 1)) byte_5111F6[9] = 1; - if (sub_43EE15_player_has_item(ITEM_ARTIFACT_HEROS_BELT, player, 1)) byte_5111F6[10] = 1; - if (sub_43EE15_player_has_item(ITEM_RELIC_TWILIGHT, player, 1)) byte_5111F6[11] = 1; - if (sub_43EE15_player_has_item(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, player, 1)) byte_5111F6[12] = 1; - if (sub_43EE15_player_has_item(ITEM_RARE_SUN_CLOAK, player, 1)) byte_5111F6[13] = 1; - if (sub_43EE15_player_has_item(ITEM_RARE_MOON_CLOAK, player, 1)) byte_5111F6[14] = 1; - if (sub_43EE15_player_has_item(ITEM_RARE_VAMPIRES_CAPE, player, 1)) byte_5111F6[15] = 1; - if (sub_43EE15_player_has_item(ITEM_ELVEN_CHAINMAIL, player, 1)) byte_5111F6[16] = 1; + if (Player_has_item(ITEM_ARTICACT_GOVERNONS_ARMOR, player, 1)) byte_5111F6[0] = 1; + if (Player_has_item(ITEM_ARTIFACT_YORUBA, player, 1)) byte_5111F6[1] = 1; + if (Player_has_item(ITEM_RELIC_HARECS_LEATHER, player, 1)) byte_5111F6[2] = 1; + if (Player_has_item(ITEM_ARTIFACT_LEAGUE_BOOTS, player, 1)) byte_5111F6[3] = 1; + if (Player_has_item(ITEM_RELIC_TALEDONS_HELM, player, 1)) byte_5111F6[4] = 1; + if (Player_has_item(ITEM_RELIC_SCHOLARS_CAP, player, 1)) byte_5111F6[5] = 1; + if (Player_has_item(ITEM_RELIC_PHYNAXIAN_CROWN, player, 1)) byte_5111F6[6] = 1; + if (Player_has_item(ITEM_ARTIFACT_MINDS_EYE, player, 1)) byte_5111F6[7] = 1; + if (Player_has_item(ITEM_RARE_SHADOWS_MASK, player, 1)) byte_5111F6[8] = 1; + if (Player_has_item(ITEM_RILIC_TITANS_BELT, player, 1)) byte_5111F6[9] = 1; + if (Player_has_item(ITEM_ARTIFACT_HEROS_BELT, player, 1)) byte_5111F6[10] = 1; + if (Player_has_item(ITEM_RELIC_TWILIGHT, player, 1)) byte_5111F6[11] = 1; + if (Player_has_item(ITEM_ARTIFACT_CLOAK_OF_THE_SHEEP, player, 1)) byte_5111F6[12] = 1; + if (Player_has_item(ITEM_RARE_SUN_CLOAK, player, 1)) byte_5111F6[13] = 1; + if (Player_has_item(ITEM_RARE_MOON_CLOAK, player, 1)) byte_5111F6[14] = 1; + if (Player_has_item(ITEM_RARE_VAMPIRES_CAPE, player, 1)) byte_5111F6[15] = 1; + if (Player_has_item(ITEM_ELVEN_CHAINMAIL, player, 1)) byte_5111F6[16] = 1; } - - //v14 = 1; - //v15 = &stru_511698.field_2C; - //v35 = (char *)&stru_511718.field_18; for (uint i = 0; i < 2; ++i) { - //v16 = 0; - //v39 = (unsigned int *)(v35 - 24); - for (uint j = 0; j < 5; ++j) + for ( uint j = 0; j < 5; ++j )//Belt { - _43C91D_FormItemTextureFilename(pContainer, j + 100, i + 1, 0); - //v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - //++v16; - //v18 = v39; - //++v39; - //*v18 = v17; - stru_511718[i].texids[j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, j + 100, i + 1, 0); + paperdoll_belt_texture[i][j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); } - //while ( v16 < 5 ); - - //*(int *)v35 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 535, i + 1, 0); - stru_511718[i].texid2 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - - //v31 = 0; - //v19 = (unsigned int *)((char *)v15 - 44); - for (uint j = 0; j < 11; ++j) + GetItemTextureFilename(pContainer, 535, i + 1, 0); + paperdoll_belt_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + for ( uint j = 0; j < 11; ++j )//Helm { - _43C91D_FormItemTextureFilename(pContainer, j + 89, i + 1, 0); - //*v19 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - //++v19; - stru_511698[i].texids[j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, j + 89, i + 1, 0); + paperdoll_helm_texture[i][j] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); } - //while ( v31 < 11 ); - - _43C91D_FormItemTextureFilename(pContainer, 521, i + 1, 0); - stru_511698[i].texid1 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 522, i + 1, 0); - stru_511698[i].texid2 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 523, i + 1, 0); - stru_511698[i].texid3 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 532, i + 1, 0); - stru_511698[i].texid4 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 544, i + 1, 0); - stru_511698[i].texid5 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 521, i + 1, 0); + paperdoll_helm_texture[i][11] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 522, i + 1, 0); + paperdoll_helm_texture[i][12] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 523, i + 1, 0); + paperdoll_helm_texture[i][13] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 532, i + 1, 0); + paperdoll_helm_texture[i][14] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 544, i + 1, 0); + paperdoll_helm_texture[i][15] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); if ( _43ED6F_check_party_races(true) ) papredoll_dbrds[11] = pIcons_LOD->LoadTexture("item092v3", TEXTURE_16BIT_PALETTE); - //v35 += 28; - //++v14; - //++v15; } - //while ( v14 - 1 < 2 ); - v43 = 0; - //v20 = 1; - v40 = &dword_511638[0][5]; - v21 = (int)paperdoll_array_511290[0][13]; - //v41 = (unsigned int *)&stru_511718.texid1; for (uint i = 0; i < 4; ++i) { if ( sub_43EDB9_get_some_race_sex_relation_2(i) ) { - _43C91D_FormItemTextureFilename(pContainer, 524, i + 1, 0); - v32 = 66; - stru_511718[i].texid1 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - v36 = v21 - 152; - do - { - _43C91D_FormItemTextureFilename(pContainer, v32, i + 1, 0); - *(int *)(v36 - 4) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, v32, i + 1, 1); - *(int *)v36 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, v32, i + 1, 2); - v22 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - v23 = v36; - v36 += 12; - ++v32; - *(int *)(v23 + 4) = v22; - } - while ( v32 - 66 < 13 ); - _43C91D_FormItemTextureFilename(pContainer, 516, i + 1, 0); - *(int *)v21 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 516, i + 1, 1); - *(int *)(v21 + 4) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 516, i + 1, 2); - *(int *)(v21 + 8) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 505, i + 1, 0); - *(int *)(v21 + 12) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 505, i + 1, 1); - *(int *)(v21 + 16) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 505, i + 1, 2); - *(int *)(v21 + 20) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 504, i + 1, 0); - *(int *)(v21 + 24) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 504, i + 1, 1); - *(int *)(v21 + 28) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 504, i + 1, 2); - *(int *)(v21 + 32) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 533, i + 1, 0); - *(int *)(v21 + 36) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 533, i + 1, 1); - *(int *)(v21 + 40) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 533, i + 1, 2); - *(int *)(v21 + 44) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - v33 = 0; - v37 = (int)(v40 - 5); - do + GetItemTextureFilename(pContainer, 524, i + 1, 0); + paperdoll_belt_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);//Titans belt + pItemTXTNum = 66; + for ( v32 = 0; v32 < 13; ++v32 )//simple armor { - _43C91D_FormItemTextureFilename(pContainer, v33 + 115, i + 1, 0); - v24 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - ++v33; - v25 = v37; - v37 += 4; - *(int *)v25 = v24; + GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 0); + paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 1); + paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, pItemTXTNum, i + 1, 2); + paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + pItemTXTNum++; } - while ( v33 < 5 ); - _43C91D_FormItemTextureFilename(pContainer, 512, i + 1, 0); - v26 = v43; - v38 = 105; - v34 = v43; - *v40 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - do + GetItemTextureFilename(pContainer, 516, i + 1, 0);//artefacts + paperdoll_armor_texture[i][v32][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 516, i + 1, 1); + paperdoll_armor_texture[i][v32][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 516, i + 1, 2); + paperdoll_armor_texture[i][v32][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 505, i + 1, 0); + paperdoll_armor_texture[i][v32 + 1][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 505, i + 1, 1); + paperdoll_armor_texture[i][v32 + 1][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 505, i + 1, 2); + paperdoll_armor_texture[i][v32 + 1][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 504, i + 1, 0); + paperdoll_armor_texture[i][v32 + 2][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 504, i + 1, 1); + paperdoll_armor_texture[i][v32 + 2][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 504, i + 1, 2); + paperdoll_armor_texture[i][v32 + 2][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 533, i + 1, 0); + paperdoll_armor_texture[i][v32 + 3][0] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 533, i + 1, 1); + paperdoll_armor_texture[i][v32 + 3][1] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 533, i + 1, 2); + paperdoll_armor_texture[i][v32 + 3][2] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + for ( v33 = 0; v33 < 5; ++v33 )//boots { - _43C91D_FormItemTextureFilename(pContainer, v38, i + 1, 0); - *(int *)((char *)paperdoll_array_511828 + v34) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, v38, i + 1, 1); - v27 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - v28 = v34; - v34 += 4; - ++v38; - *(int *)((char *)dword_511788 + v28) = v27; + GetItemTextureFilename(pContainer, v33 + 115, i + 1, 0); + paperdoll_boots_texture[i][v33] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + } + GetItemTextureFilename(pContainer, 512, i + 1, 0); + paperdoll_boots_texture[i][v33] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + for ( v38 = 0; v38 < 5; ++v38 )//Cloak + { + GetItemTextureFilename(pContainer, v38 + 105, i + 1, 0); + paperdoll_cloak_texture[i][v38] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, v38 + 105, i + 1, 1); + paperdoll_cloak_collar_texture[i][v38] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); } - while ( v38 - 105 < 5 ); - _43C91D_FormItemTextureFilename(pContainer, 525, i + 1, 0); - *(int *)((char *)&paperdoll_array_511828[0][5] + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 530, i + 1, 0); - *(int *)((char *)&paperdoll_array_511828[0][6] + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 547, i + 1, 0); - *(int *)((char *)&paperdoll_array_511828[0][7] + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 548, i + 1, 0); - *(int *)((char *)&paperdoll_array_511828[0][8] + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 550, i + 1, 0); - *(int *)((char *)&paperdoll_array_511828[0][9] + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 525, i + 1, 1); - *(int *)((char *)&dword_51179C + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 530, i + 1, 1); - *(int *)((char *)&dword_5117A0 + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 547, i + 1, 1); - *(int *)((char *)&dword_5117A4 + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 548, i + 1, 1); - *(int *)((char *)&dword_5117A8 + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - _43C91D_FormItemTextureFilename(pContainer, 550, i + 1, 1); - *(int *)((char *)&dword_5117AC + v43) = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 525, i + 1, 0); + paperdoll_cloak_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 530, i + 1, 0); + paperdoll_cloak_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 547, i + 1, 0); + paperdoll_cloak_texture[i][7] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 548, i + 1, 0); + paperdoll_cloak_texture[i][8] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 550, i + 1, 0); + paperdoll_cloak_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 525, i + 1, 1); + paperdoll_cloak_collar_texture[i][5] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 530, i + 1, 1); + paperdoll_cloak_collar_texture[i][6] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 547, i + 1, 1); + paperdoll_cloak_collar_texture[i][7] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 548, i + 1, 1); + paperdoll_cloak_collar_texture[i][8] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + GetItemTextureFilename(pContainer, 550, i + 1, 1); + paperdoll_cloak_collar_texture[i][9] = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); } else { v26 = v43; } - //v41 += 7; - v40 += 6; - v21 += 204; - //++v20; - //result = v20 - 1; v43 = v26 + 40; } - //while ( v20 - 1 < 4 ); - //return result; } //----- (00419401) -------------------------------------------------------- diff -r 6daea87a3fe3 -r 23655ae9cd18 UIHouses.cpp --- a/UIHouses.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/UIHouses.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -569,7 +569,7 @@ uTextureID_507B04 = uTextureID_right_panel; if ( uNumDialogueNPCPortraits == 1 ) pDialogueNPCCount = 1; - pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); + pVideoPlayer->OpenHouseMovie(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); dword_5C35D4 = 1; if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) { @@ -673,7 +673,7 @@ int v39; // edx@235 int v40; // edi@243 unsigned __int64 v41; // qax@243 - void *v42; // eax@244 + //void *v42; // eax@244 signed int v43; // edi@244 int v44; // edx@244 int v45; // eax@246 @@ -697,9 +697,7 @@ pRenderer->ClearZBuffer(0, 479); //v3 = dword_F8B198; if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN) - { - v8 = window_SpeakInHouse; - } + v8 = window_SpeakInHouse; //else if (dialog_menu_id == HOUSE_DIALOGUE_MAIN) { @@ -725,7 +723,7 @@ pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x159u, WINDOW_MainMenu, 0, 0); pBtn_ExitCancel = pDialogueWindow->CreateButton(526, 445, 75, 33, 1, 0, UIMSG_Escape, 0, 0, pGlobalTXT_LocalizationStrings[74],// "End Conversation" pIcons_LOD->GetTexture(uTextureID_BUTTDESC2), 0); - pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); + pDialogueWindow->CreateButton(8, 8, 0x1C2, 0x140, 1, 0, UIMSG_BuyInShop_Identify_Repair, 0, 0, "", nullptr); // LABEL_10: //v3 = dword_F8B198; v8 = window_SpeakInHouse; @@ -770,137 +768,108 @@ //NEW switch(in_current_building_type) { - case 5: - case 6: - case 7: - case 8: - case 9: - case 10: - case 11: - case 12: - case 13: - case 14: - case 15: - case 16: - { - if ( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472] >= (signed __int64)pParty->uTimePlayed && - *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468] >= (signed __int64)pParty->uTimePlayed ) + case BildingType_FireGuild: + case BildingType_AirGuild: + case BildingType_WaterGuild: + case BildingType_EarthGuild: + case BildingType_SpiritGuild: + case BildingType_MindGuild: + case BildingType_BodyGuild: + case BildingType_LightGuild: + case BildingType_DarkGuild: + case BildingType_14: + case BildingType_15: + case BildingType_16: + { + if ( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472] >= (signed __int64)pParty->uTimePlayed && + *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44468] >= (signed __int64)pParty->uTimePlayed ) + { + v32 = 0; + do { - v32 = 0; - do - { - //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); - v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID; - if ( v33 ) - { - v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); - v8 = window_SpeakInHouse; - ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; - } - ++v32; - } - while ( v32 < 12 ); + //v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); + v33 = pParty->SpellBooksInGuilds[v8->par1C-139][v32].uItemID; + if ( v33 ) + { + v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); + v8 = window_SpeakInHouse; + ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; + } + ++v32; + } + while ( v32 < 12 ); + } + else + { + SpellBookGenerator(); + v30 = window_SpeakInHouse->ptr_1C; + v31 = pParty->uTimePlayed + (signed __int64)((double)(0xA8C000 + //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) + * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); + *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; + *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); + } + //return; + break; + } + case BildingType_TownHall: + { + if ( uMessageParam == 99 ) + { + v10 = (int)((char *)v8->ptr_1C - 102); + v56 = v10; + v11 = 8 * v10 + 11325428; + if ( pParty->field_3C.field_0[2 * v10 + 1] >= (signed __int64)pParty->uTimePlayed + && pParty->field_3C.field_0[2 * v10] >= (signed __int64)pParty->uTimePlayed ) + { + v13 = 0; } else { - SpellBookGenerator(); - v30 = window_SpeakInHouse->ptr_1C; - v31 = pParty->uTimePlayed - + (signed __int64)((double)(0xA8C000 - //* (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) - * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) - * 0.033333335); - *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44468] = v31; - *(int *)&stru_AA1058[3].pSounds[8 * (int)v30 + 44472] = HIDWORD(v31); - } - //return; - break; - } - case 17: - { - if ( uMessageParam == 99 ) - { - v10 = (int)((char *)v8->ptr_1C - 102); - v56 = v10; - v11 = 8 * v10 + 11325428; - if ( pParty->field_3C.field_0[2 * v10 + 1] >= (signed __int64)pParty->uTimePlayed - && pParty->field_3C.field_0[2 * v10] >= (signed __int64)pParty->uTimePlayed ) - { - v13 = 0; - } - else - { - v12 = v10; - v13 = 0; - pParty->field_75A[v12] = 0; - *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); - v14 = rand() % 258; - v15 = window_SpeakInHouse; - pParty->field_750[v12] = v14 + 1; - v16 = (int)((char *)v15->ptr_1C - 102); - if ( v16 ) - { - v17 = v16 - 1; - if ( v17 ) + v12 = v10; + v13 = 0; + pParty->field_75A[v12] = 0; + *(_QWORD *)v11 = (signed __int64)((double)(309657600 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); + v14 = rand() % 258; + v15 = window_SpeakInHouse; + pParty->field_750[v12] = v14 + 1; + v16 = (int)((char *)v15->ptr_1C - 102); + if ( v16 ) + { + v17 = v16 - 1; + if ( v17 ) + { + v18 = v17 - 1; + if ( v18 ) { - v18 = v17 - 1; - if ( v18 ) + v19 = v18 - 1; + if ( v19 ) { - v19 = v18 - 1; - if ( v19 ) - { - if ( v19 == 1 ) - { - while ( 1 ) - { - v20 = pParty->field_750[v12]; - if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) - { - if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) - && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) - && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) - && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) - && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) - && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) - && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) - && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) - && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) - && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) - && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) - && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) - && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) - && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) - && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) - && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) - && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) - && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) - break; - } - pParty->field_750[v12] = rand() % 258 + 1; - } - } - } - else + if ( v19 == 1 ) { while ( 1 ) { - v21 = pParty->field_750[v12]; - if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) + v20 = pParty->field_750[v12]; + if ( (unsigned __int16)v20 < 0x73u || (unsigned __int16)v20 > 0x84u ) { - if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) - && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) - && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) - && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) - && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) - && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) - && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) - && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) - && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) - && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) - && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) - && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) - && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) - && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) + if ( ((unsigned __int16)v20 < 0xE8u || (unsigned __int16)v20 > 0xF9u) + && ((unsigned __int16)v20 < 0x85u || (unsigned __int16)v20 > 0x96u) + && ((unsigned __int16)v20 < 0x97u || (unsigned __int16)v20 > 0xBAu) + && ((unsigned __int16)v20 < 0xBEu || (unsigned __int16)v20 > 0xC0u) + && ((unsigned __int16)v20 < 0xC4u || (unsigned __int16)v20 > 0xC6u) + && ((unsigned __int16)v20 < 0x2Bu || (unsigned __int16)v20 > 0x2Du) + && ((unsigned __int16)v20 < 0x6Du || (unsigned __int16)v20 > 0x6Fu) + && ((unsigned __int16)v20 < 0x46u || (unsigned __int16)v20 > 0x48u) + && ((unsigned __int16)v20 < 0x100u || (unsigned __int16)v20 > 0x102u) + && ((unsigned __int16)v20 < 0xD9u || (unsigned __int16)v20 > 0xDBu) + && ((unsigned __int16)v20 < 0xC7u || (unsigned __int16)v20 > 0xC9u) + && ((unsigned __int16)v20 < 0xE5u || (unsigned __int16)v20 > 0xE7u) + && ((unsigned __int16)v20 < 0xDFu || (unsigned __int16)v20 > 0xE1u) + && ((unsigned __int16)v20 < 0x5Bu || (unsigned __int16)v20 > 0x5Du) + && ((unsigned __int16)v20 < 0x49u || (unsigned __int16)v20 > 0x4Bu) + && ((unsigned __int16)v20 < 0xFDu || (unsigned __int16)v20 > 0xFFu) + && ((unsigned __int16)v20 < 0x61u || (unsigned __int16)v20 > 0x63u) + && ((unsigned __int16)v20 < 0x10u || (unsigned __int16)v20 > 0x12u) ) break; } pParty->field_750[v12] = rand() % 258 + 1; @@ -911,21 +880,24 @@ { while ( 1 ) { - v22 = pParty->field_750[v12]; - if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) + v21 = pParty->field_750[v12]; + if ( (unsigned __int16)v21 < 0x73u || (unsigned __int16)v21 > 0x84u ) { - if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) - && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) - && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) - && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) - && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) - && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) - && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) - && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) - && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) - && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) - && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) - break; + if ( ((unsigned __int16)v21 < 0xE8u || (unsigned __int16)v21 > 0xF9u) + && ((unsigned __int16)v21 < 0x85u || (unsigned __int16)v21 > 0x96u) + && ((unsigned __int16)v21 < 0x97u || (unsigned __int16)v21 > 0xBAu) + && ((unsigned __int16)v21 < 0xBEu || (unsigned __int16)v21 > 0xC0u) + && ((unsigned __int16)v21 < 0xC4u || (unsigned __int16)v21 > 0xC6u) + && ((unsigned __int16)v21 < 0x2Bu || (unsigned __int16)v21 > 0x2Du) + && ((unsigned __int16)v21 < 0x5Eu || (unsigned __int16)v21 > 0x60u) + && ((unsigned __int16)v21 < 0x43u || (unsigned __int16)v21 > 0x45u) + && ((unsigned __int16)v21 < 0x4Fu || (unsigned __int16)v21 > 0x51u) + && ((unsigned __int16)v21 < 0xC1u || (unsigned __int16)v21 > 0xC3u) + && ((unsigned __int16)v21 < 0x13u || (unsigned __int16)v21 > 0x15u) + && ((unsigned __int16)v21 < 0xFDu || (unsigned __int16)v21 > 0xFFu) + && ((unsigned __int16)v21 < 0x61u || (unsigned __int16)v21 > 0x63u) + && ((unsigned __int16)v21 < 0x6Au || (unsigned __int16)v21 > 0x6Cu) ) + break; } pParty->field_750[v12] = rand() % 258 + 1; } @@ -935,24 +907,21 @@ { while ( 1 ) { - v23 = pParty->field_750[v12]; - if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u ) + v22 = pParty->field_750[v12]; + if ( (unsigned __int16)v22 < 0x73u || (unsigned __int16)v22 > 0x84u ) { - if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) - && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) - && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) - && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) - && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) - && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) - && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) - && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u) - && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) - && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) - && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) - && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) - && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) - && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) - break; + if ( ((unsigned __int16)v22 < 0xE8u || (unsigned __int16)v22 > 0xF9u) + && ((unsigned __int16)v22 < 0x85u || (unsigned __int16)v22 > 0x96u) + && ((unsigned __int16)v22 < 0x97u || (unsigned __int16)v22 > 0xBAu) + && ((unsigned __int16)v22 < 0xBEu || (unsigned __int16)v22 > 0xC0u) + && ((unsigned __int16)v22 < 0xC4u || (unsigned __int16)v22 > 0xC6u) + && ((unsigned __int16)v22 < 0x2Bu || (unsigned __int16)v22 > 0x2Du) + && ((unsigned __int16)v22 < 0x31u || (unsigned __int16)v22 > 0x33u) + && ((unsigned __int16)v22 < 0x34u || (unsigned __int16)v22 > 0x36u) + && ((unsigned __int16)v22 < 0xFDu || (unsigned __int16)v22 > 0xFFu) + && ((unsigned __int16)v22 < 0x61u || (unsigned __int16)v22 > 0x63u) + && ((unsigned __int16)v22 < 0x1Cu || (unsigned __int16)v22 > 0x1Eu) ) + break; } pParty->field_750[v12] = rand() % 258 + 1; } @@ -962,88 +931,115 @@ { while ( 1 ) { - v24 = pParty->field_750[v12]; - if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) + v23 = pParty->field_750[v12]; + if ( (unsigned __int16)v23 < 0x73u || (unsigned __int16)v23 > 0x84u ) { - if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu) - && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) - && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) - && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) - && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) - && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) - && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) - && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) - && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) - && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) - && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) + if ( ((unsigned __int16)v23 < 0xE8u || (unsigned __int16)v23 > 0xF9u) + && ((unsigned __int16)v23 < 0x85u || (unsigned __int16)v23 > 0x96u) + && ((unsigned __int16)v23 < 0x97u || (unsigned __int16)v23 > 0xBAu) + && ((unsigned __int16)v23 < 0xBEu || (unsigned __int16)v23 > 0xC0u) + && ((unsigned __int16)v23 < 0xC4u || (unsigned __int16)v23 > 0xC6u) + && ((unsigned __int16)v23 < 0x2Bu || (unsigned __int16)v23 > 0x2Du) + && ((unsigned __int16)v23 < 0x52u || (unsigned __int16)v23 > 0x54u) + && ((unsigned __int16)v23 < 4u || (unsigned __int16)v23 > 6u) + && ((unsigned __int16)v23 < 0x37u || (unsigned __int16)v23 > 0x39u) + && ((unsigned __int16)v23 < 0x3Au || (unsigned __int16)v23 > 0x3Cu) + && ((unsigned __int16)v23 < 0x3Du || (unsigned __int16)v23 > 0x3Fu) + && ((unsigned __int16)v23 < 0xFDu || (unsigned __int16)v23 > 0xFFu) + && ((unsigned __int16)v23 < 0x61u || (unsigned __int16)v23 > 0x63u) + && ((unsigned __int16)v23 < 0xCDu || (unsigned __int16)v23 > 0xCFu) ) break; } pParty->field_750[v12] = rand() % 258 + 1; } } - v10 = v56; - } - v25 = v10; - v26 = pParty->field_750[v25]; - v27 = pParty->field_75A[v25] == v13; - word_F8B1A0 = pParty->field_750[v25]; - if ( v27 ) - { - //v1 = 0; - v27 = v26 == v13; - v29 = (int)pNPCTopics[351].pText; - if ( v27 ) - v29 = (int)pNPCTopics[353].pText; - dword_F8B1A4 = (char *)v29; } else { - if ( v26 != v13 ) + while ( 1 ) { - party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0); - v28 = pParty->pPlayers; - do + v24 = pParty->field_750[v12]; + if ( (unsigned __int16)v24 < 0x73u || (unsigned __int16)v24 > 0x84u ) { - v28->SetVariable(VAR_Award, 86); - ++v28; + if ( ((unsigned __int16)v24 < 0xEBu || (unsigned __int16)v24 > 0xFCu) + && ((unsigned __int16)v24 < 0x85u || (unsigned __int16)v24 > 0x96u) + && ((unsigned __int16)v24 < 0x97u || (unsigned __int16)v24 > 0xBAu) + && ((unsigned __int16)v24 < 0xBEu || (unsigned __int16)v24 > 0xC0u) + && ((unsigned __int16)v24 < 0xC4u || (unsigned __int16)v24 > 0xC6u) + && ((unsigned __int16)v24 < 0x2Bu || (unsigned __int16)v24 > 0x2Du) + && ((unsigned __int16)v24 < 0xCDu || (unsigned __int16)v24 > 0xCFu) + && ((unsigned __int16)v24 < 0x5Eu || (unsigned __int16)v24 > 0x60u) + && ((unsigned __int16)v24 < 0xFDu || (unsigned __int16)v24 > 0xFFu) + && ((unsigned __int16)v24 < 0x6Du || (unsigned __int16)v24 > 0x6Fu) + && ((unsigned __int16)v24 < 0x61u || (unsigned __int16)v24 > 0x63u) ) + break; } - while ( (signed int)v28 < (signed int)pParty->pHirelings ); - pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel; - pParty->field_750[v25] = v13; - pParty->field_75A[v25] = v13; + pParty->field_750[v12] = rand() % 258 + 1; } - //v1 = 0; - dword_F8B1A4 = pNPCTopics[352].pText; } + v10 = v56; } - else if ( uMessageParam == 100 ) + v25 = v10; + v26 = pParty->field_750[v25]; + v27 = pParty->field_75A[v25] == v13; + word_F8B1A0 = pParty->field_750[v25]; + if ( v27 ) { - pKeyActionMap->EnterText(1, 10, v8); + //v1 = 0; + v27 = v26 == v13; + v29 = (int)pNPCTopics[351].pText; + if ( v27 ) + v29 = (int)pNPCTopics[353].pText; + dword_F8B1A4 = (char *)v29; } - break; - } - case 22: + else { - if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) - pKeyActionMap->EnterText(1, 10, v8); - return; - break; + if ( v26 != v13 ) + { + party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)v26].uLevel, 0); + v28 = pParty->pPlayers; + do + { + v28->SetVariable(VAR_Award, 86); + ++v28; + } + while ( (signed int)v28 < (signed int)pParty->pHirelings ); + pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->field_750[v25]].uLevel; + pParty->field_750[v25] = v13; + pParty->field_75A[v25] = v13; + } + //v1 = 0; + dword_F8B1A4 = pNPCTopics[352].pText; } - case 1: - case 2: - case 3: - case 4: - case 21: - case 23: - case 30: - { - break; - } - default: - { - return; - break; - } + } + else if ( uMessageParam == HOUSE_DIALOGUE_TOWNHALL_100 ) + { + pKeyActionMap->EnterText(1, 10, v8); + } + break; + } + case BildingType_Bank: + { + if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) + pKeyActionMap->EnterText(1, 10, v8); + return; + break; + } + case BildingType_WeaponShop: + case BildingType_ArmorShop: + case BildingType_MagicShop: + case BildingType_AlchemistShop: + case BildingType_Tavern: + case BildingType_Temple: + case BildingType_Training: + { + break; + } + default: + { + return; + break; + } } /* @@ -1314,204 +1310,159 @@ //LABEL_196: switch ( uMessageParam ) { - case 96: - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - FillAviableSkillsToTeach(in_current_building_type); - break; - } - case 101: - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - sub_4B3A72(in_current_building_type); - break; - } - case 102: - case 103: - { - dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; - break; - } - case 104: - { - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + case HOUSE_DIALOGUE_LEARN_SKILLS: + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + FillAviableSkillsToTeach(in_current_building_type); + break; + } + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_MAIN: + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + sub_4B3A72(in_current_building_type); + break; + } + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RULES: + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_VICTORY_CONDITIONS: + { + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; + break; + } + case HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT: + { + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); + dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; + break; + } + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: + { + if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) + { + GenerateStandartShopItems(); + GenerateSpecialShopItems(); + pParty->field_3C.field_50[window_SpeakInHouse->par1C] = pParty->uTimePlayed + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) * 0.033333335); + } + if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_STANDARD ) + { + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)29; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = v1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = v1; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, 0, 0); - dialog_menu_id = HOUSE_DIALOGUE_TAVERN_ARCOMAGE_RESULT; + for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 ) + { + if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID ) + { + v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE); + ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; + } + } + } + if ( in_current_building_type == BildingType_WeaponShop ) + { + v48 = 0; + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) + { + do + { + if ( pParty->StandartItemsInShops[(int)window_SpeakInHouse->ptr_1C][v48].uItemID) + word_F8B158[v48] = rand() % (300 - ItemsInShopTexture[v48]->uTextureHeight); + ++v48; + } + while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ); + } + } + } + if ( uMessageParam == HOUSE_DIALOGUE_SHOP_BUY_SPECIAL ) + { + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) + { + for ( v43 = 0; v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType]; ++v43 ) + { + if ( pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID ) + { + v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v43].uItemID].pIconName, TEXTURE_16BIT_PALETTE); + ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; + } + } + } + if ( in_current_building_type == BildingType_WeaponShop ) + { + v53 = 0; + if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) + { + do + { + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v53].uItemID) + word_F8B158[v53] = rand() % (300 - ItemsInShopTexture[v53]->uTextureHeight); + ++v53; + } + while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType ] ); + } + } + } break; - } - case 2: - case 95: - { - if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) - { - GenerateStandartShopItems(); - GenerateSpecialShopItems(); - v8 = window_SpeakInHouse; - v40 = window_SpeakInHouse->par1C; - //v3 = dword_F8B198; - v41 = pParty->uTimePlayed - //+ (signed __int64)((double)(11059200 * (signed int)p2DEvents_minus1[26 * (unsigned int)ptr_507BC0->ptr_1C]) - + (signed __int64)((double)(11059200 * (signed int)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].field_1C) - * 0.033333335); - pParty->field_3C.field_50[v40] = v41; - } - v42 = v8->ptr_1C; - v43 = 0; - //v44 = p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]; - v44 = p2DEvents[(unsigned int)v8->ptr_1C - 1].uType; - if ( uMessageParam == 2 ) - { - if ( uItemsAmountPerShopType[v44] ) - { - do - { - v45 = pParty->StandartItemsInShops[(int)v42][v43].uItemID; - if ( v45 ) - { - v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; - } - v42 = v8->ptr_1C; - ++v43; - } - //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - if ( in_current_building_type == BildingType_WeaponShop ) - { - v47 = v8->ptr_1C; - v48 = 0; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) - { - do - { - // if ( pParty->field_777C[9 * (v48 + 12 * (int)v47)] ) - if ( pParty->StandartItemsInShops[(int)v47][v48].uItemID) - { - v49 = rand(); - v8 = window_SpeakInHouse; - word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight); - } - v47 = v8->ptr_1C; - ++v48; - } - //while ( v48 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v48 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - } - } - if ( uMessageParam == 95 ) - { - if ( uItemsAmountPerShopType[v44] ) - { - do - { - //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724]; - v50=pParty->SpecialItemsInShops[(unsigned int)v42][(signed int)v43].uItemID; - if ( v50 ) - { - v51 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v50].pIconName, TEXTURE_16BIT_PALETTE); - //v3 = dword_F8B198; - v8 = window_SpeakInHouse; - ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; - } - v42 = v8->ptr_1C; - ++v43; - } - //while ( v43 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v43 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ); - } - if ( in_current_building_type == BildingType_WeaponShop ) - { - v52 = v8->ptr_1C; - v53 = 0; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ) - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType] ) - { - do - { - // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID) - { - v54 = rand(); - v8 = window_SpeakInHouse; - word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight); - } - v52 = v8->ptr_1C; - ++v53; - } - //while ( v53 < (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)v8->ptr_1C]] ); - while ( v53 < (unsigned __int8)uItemsAmountPerShopType[p2DEvents[(unsigned int)v8->ptr_1C - 1].uType ] ); - } - } - } - break; - } - case 3: - case 4: - case 5: - { - dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; - sub_421B2C_PlaceInInventory_or_DropPickedItem(); - break; - } - case 94: - { - pDialogueWindow->eWindowType = WINDOW_MainMenu; - UI_CreateEndConversationButton(); - sub_4B3AD4(in_current_building_type); - break; - } - default: - { - if( uMessageParam >= 36 && uMessageParam <= 72 ) - { - //v35 = pPlayers[uActiveCharacter]; - //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); - v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); - v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; - if ( v37 < v36 / 3 ) - v37 = v36 / 3; - - //if (false) - if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam-36]) - //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) - { - //v38 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + uMessageParam); - if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) - { - if ( pParty->uNumGold < v37 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); - if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern ) - v39 = 4; - else - v39 = 2; - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39); - } - else - { - Party::TakeGold(v37); - dword_F8B1E4 = 1; - pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1; - pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0); - } - } - } - } - break; - } + } + case HOUSE_DIALOGUE_SHOP_SELL: + case HOUSE_DIALOGUE_SHOP_IDENTIFY: + case HOUSE_DIALOGUE_SHOP_REPAIR: + { + dialog_menu_id = (HOUSE_DIALOGUE_MENU)uMessageParam; + sub_421B2C_PlaceInInventory_or_DropPickedItem(); + break; + } + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + { + pDialogueWindow->eWindowType = WINDOW_MainMenu; + UI_CreateEndConversationButton(); + sub_4B3AD4(in_current_building_type); + break; + } + default: + { + if( uMessageParam >= HOUSE_DIALOGUE_36 && uMessageParam <= HOUSE_DIALOGUE_GUILD_LEARN_SKILL ) + { + //v35 = pPlayers[uActiveCharacter]; + //v36 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)v8->ptr_1C] * 500.0); + v36 = (signed __int64)(p2DEvents[(unsigned int)v8->ptr_1C - 1].flt_24 * 500.0); + v37 = v36 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( v37 < v36 / 3 ) + v37 = v36 / 3; + //if (false) + if(byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][uMessageParam-36]) + //if ( *(&byte_4ED94C[37 * v35->uClass] + v55) ) + { + //v38 = (int)(&pPlayers[uActiveCharacter]->uIntelligence + uMessageParam); + if ( !pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] ) + { + if ( pParty->uNumGold < v37 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2); + if ( in_current_building_type == BildingType_Training || in_current_building_type == BildingType_Tavern ) + v39 = 4; + else + v39 = 2; + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, (HouseSoundID)v39); + } + else + { + Party::TakeGold(v37); + dword_F8B1E4 = 1; + pPlayers[uActiveCharacter]->pActiveSkills[uMessageParam - 36] = 1; + pPlayers[uActiveCharacter]->PlaySound(SPEECH_78, 0); + } + } + } + } + break; + } } /* if ( uMessageParam != 95 && uMessageParam != 2 ) @@ -3915,291 +3866,350 @@ //----- (004BA928) -------------------------------------------------------- void __cdecl ArmorShopDialog() - { - Player *v0; // ebx@1 - signed int v1; // esi@8 - unsigned int v2; // eax@10 - ItemGen *v3; // eax@11 - unsigned __int8 v4; // dl@12 - char *v5; // ecx@12 - char *v6; // eax@13 - int v7; // ST08_4@15 - int v8; // eax@15 - signed int v9; // esi@17 - unsigned int v10; // eax@19 - char *v11; // edi@19 - int v12; // ST08_4@20 - int v13; // eax@20 - unsigned __int8 v14; // dl@20 - char *v15; // ecx@20 - char **v16; // edi@22 - int all_text_height; // ebx@22 - char **v18; // esi@22 - int v19; // eax@23 - GUIWindow *v20; // ecx@24 - int v21; // eax@24 - int v22; // edx@24 - int v23; // ebx@24 - unsigned __int8 v24; // sf@24 - GUIButton *control_button; // eax@26 - GUIButton *v26; // esi@26 - int v27; // eax@26 - unsigned int v28; // ecx@26 - int v29; // edx@26 +{ + signed int v1; // esi@8 + unsigned int v2; // eax@10 + ItemGen *v3; // eax@11 + char *v5; // ecx@12 + char *v6; // eax@13 + int v8; // eax@15 + signed int v9; // esi@17 + unsigned int v10; // eax@19 + char *v11; // edi@19 + int v12; // ST08_4@20 + int v13; // eax@20 + char *v15; // ecx@20 + char **v16; // edi@22 + int all_text_height; // ebx@22 + char **v18; // esi@22 + int v19; // eax@23 + GUIWindow *v20; // ecx@24 + int v21; // eax@24 + int v22; // edx@24 + int v23; // ebx@24 + unsigned __int8 v24; // sf@24 + GUIButton *pButton; // eax@26 + unsigned int v28; // ecx@26 + int v29; // edx@26 + signed int v31; // esi@31 + unsigned int v32; // eax@33 + int v33; // eax@34 + int v35; // eax@35 + char *v36; // edx@36 + GUIWindow *v37; // edi@42 + signed int v38; // esi@42 + unsigned int v39; // esi@44 + int v40; // eax@44 + unsigned int v41; // eax@45 + int v42; // eax@47 + int v43; // ecx@52 + int v46; // eax@54 + unsigned int v49; // ecx@56 + int v51; // eax@56 + int v53; // eax@60 + int textureH; // eax@60 + signed int textureW; // ebx@65 + Texture *v56; // eax@67 + unsigned int pY_item; // edi@68 + Texture *v58; // ST1C_4@68 + int v59; // eax@68 + int v60; // edi@69 + signed int v61; // ebx@73 + Texture *v62; // eax@75 + int v63; // edi@76 + Texture *v64; // ST1C_4@76 + unsigned int v65; // ST18_4@76 + int v66; // eax@76 + int v67; // edi@77 + signed int v68; // ecx@81 + const char *pStatusText; // ecx@91 + void *v72; // eax@95 + POINT *v73; // esi@97 + int v74; // ecx@97 + int v75; // eax@98 + int v76; // ecx@98 + ItemGen *selected_item; // ecx@99 + unsigned __int8 v78; // bl@104 + int v80; // ebx@105 + char **v81; // esi@105 + int v82; // eax@106 + int v86; // ebx@107 + int pTextHeight; // eax@109 + unsigned int v90; // ecx@109 + int pNumString; // edx@109 + unsigned __int16 pTextColor; // ax@109 + signed int v93; // edx@114 + POINT *v94; // edi@120 + __int32 v95; // ecx@120 + void *v96; // ST14_4@122 + unsigned __int8 v97; // bl@122 + ItemGen *v98; // ST10_4@122 + int v99; // eax@122 + char *v100; // eax@122 + const char *v101; // ST18_4@122 + unsigned __int16 v102; // ST14_2@122 + int v103; // eax@122 + signed int v104; // edi@123 + Texture *v105; // eax@125 + int v106; // ebx@126 + unsigned int v108; // ST18_4@126 + int v109; // eax@126 + int v110; // ebx@127 + GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 + unsigned int v112; // [sp-14h] [bp-118h]@13 + int v113; // [sp-14h] [bp-118h]@36 + unsigned int v115; // [sp-10h] [bp-114h]@13 + ItemGen *v116; // [sp-10h] [bp-114h]@20 + int v117; // [sp-10h] [bp-114h]@36 + unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 + char *v121; // [sp-8h] [bp-10Ch]@13 + int v122; // [sp-8h] [bp-10Ch]@20 + unsigned int v123; // [sp-4h] [bp-108h]@13 + __int64 *v124; // [sp-4h] [bp-108h]@20 + int v125; // [sp-4h] [bp-108h]@68 + int v126; // [sp-4h] [bp-108h]@76 + int v127; // [sp-4h] [bp-108h]@126 + POINT v128; // [sp+Ch] [bp-F8h]@8 + POINT v129; // [sp+14h] [bp-F0h]@18 + char v130; // [sp+1Ch] [bp-E8h]@120 + POINT a2; // [sp+24h] [bp-E0h]@8 + POINT v132; // [sp+2Ch] [bp-D8h]@120 + POINT v133; // [sp+34h] [bp-D0h]@17 + POINT v134; // [sp+3Ch] [bp-C8h]@97 + POINT v135; // [sp+44h] [bp-C0h]@31 + POINT v136; // [sp+4Ch] [bp-B8h]@97 + POINT v137; // [sp+54h] [bp-B0h]@17 + POINT v138; // [sp+5Ch] [bp-A8h]@32 + POINT v139; // [sp+64h] [bp-A0h]@17 + POINT v140; // [sp+6Ch] [bp-98h]@31 + POINT v141; // [sp+74h] [bp-90h]@8 + POINT v142; // [sp+7Ch] [bp-88h]@31 + POINT v143; // [sp+84h] [bp-80h]@9 + GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 + int v146; // [sp+E4h] [bp-20h]@24 + int pYellowColor; // [sp+E8h] [bp-1Ch]@1 + int pWhiteColor; // [sp+ECh] [bp-18h]@1 + __int32 pItemCount; // [sp+F0h] [bp-14h]@8 + int v152; // [sp+FCh] [bp-8h]@24 + int v153; // [sp+100h] [bp-4h]@44 + int th; + short text_color; + int pActiveButton; - signed int v31; // esi@31 - unsigned int v32; // eax@33 - int v33; // eax@34 - int v34; // ST08_4@35 - int v35; // eax@35 - char *v36; // edx@36 - GUIWindow *v37; // edi@42 - signed int v38; // esi@42 - unsigned int v39; // esi@44 - int v40; // eax@44 - unsigned int v41; // eax@45 - int v42; // eax@47 - int v43; // ecx@52 - GUIButton *v44; // eax@54 - GUIButton *v45; // esi@54 - int v46; // eax@54 - char *v47; // eax@56 - int v48; // eax@56 - unsigned int v49; // ecx@56 - int v50; // edx@56 - int v51; // eax@56 - unsigned __int16 v52; // ax@56 - int v53; // eax@60 - int textureH; // eax@60 - signed int textureW; // ebx@65 - Texture *v56; // eax@67 - unsigned int v57; // edi@68 - Texture *v58; // ST1C_4@68 - int v59; // eax@68 - int v60; // edi@69 - signed int v61; // ebx@73 - Texture *v62; // eax@75 - int v63; // edi@76 - Texture *v64; // ST1C_4@76 - unsigned int v65; // ST18_4@76 - int v66; // eax@76 - int v67; // edi@77 - signed int v68; // ecx@81 - SHORT v69; // bx@89 - bool v70; // eax@89 - const char *v71; // ecx@91 - void *v72; // eax@95 - POINT *v73; // esi@97 - int v74; // ecx@97 - int v75; // eax@98 - int v76; // ecx@98 - ItemGen *selected_item; // ecx@99 - unsigned __int8 v78; // bl@104 - char **v79; // edi@105 - int v80; // ebx@105 - char **v81; // esi@105 - int v82; // eax@106 - GUIWindow *v83; // ecx@107 - int v84; // eax@107 - int v85; // edx@107 - int v86; // ebx@107 - GUIButton *v87; // eax@109 - GUIButton *v88; // esi@109 - int v89; // eax@109 - unsigned int v90; // ecx@109 - int v91; // edx@109 - unsigned __int16 v92; // ax@109 - signed int v93; // edx@114 - POINT *v94; // edi@120 - __int32 v95; // ecx@120 - void *v96; // ST14_4@122 - unsigned __int8 v97; // bl@122 - ItemGen *v98; // ST10_4@122 - int v99; // eax@122 - char *v100; // eax@122 - const char *v101; // ST18_4@122 - unsigned __int16 v102; // ST14_2@122 - int v103; // eax@122 - signed int v104; // edi@123 - Texture *v105; // eax@125 - int v106; // ebx@126 - Texture *v107; // ST1C_4@126 - unsigned int v108; // ST18_4@126 - int v109; // eax@126 - int v110; // ebx@127 - GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 - unsigned int v112; // [sp-14h] [bp-118h]@13 - int v113; // [sp-14h] [bp-118h]@36 - ItemGen *v114; // [sp-10h] [bp-114h]@12 - unsigned int v115; // [sp-10h] [bp-114h]@13 - ItemGen *v116; // [sp-10h] [bp-114h]@20 - int v117; // [sp-10h] [bp-114h]@36 - void *v118; // [sp-Ch] [bp-110h]@12 - unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 - void *v120; // [sp-Ch] [bp-110h]@20 - char *v121; // [sp-8h] [bp-10Ch]@13 - int v122; // [sp-8h] [bp-10Ch]@20 - unsigned int v123; // [sp-4h] [bp-108h]@13 - __int64 *v124; // [sp-4h] [bp-108h]@20 - int v125; // [sp-4h] [bp-108h]@68 - int v126; // [sp-4h] [bp-108h]@76 - int v127; // [sp-4h] [bp-108h]@126 - POINT v128; // [sp+Ch] [bp-F8h]@8 - POINT v129; // [sp+14h] [bp-F0h]@18 - char v130; // [sp+1Ch] [bp-E8h]@120 - POINT a2; // [sp+24h] [bp-E0h]@8 - POINT v132; // [sp+2Ch] [bp-D8h]@120 - POINT v133; // [sp+34h] [bp-D0h]@17 - POINT v134; // [sp+3Ch] [bp-C8h]@97 - POINT v135; // [sp+44h] [bp-C0h]@31 - POINT v136; // [sp+4Ch] [bp-B8h]@97 - POINT v137; // [sp+54h] [bp-B0h]@17 - POINT v138; // [sp+5Ch] [bp-A8h]@32 - POINT v139; // [sp+64h] [bp-A0h]@17 - POINT v140; // [sp+6Ch] [bp-98h]@31 - POINT v141; // [sp+74h] [bp-90h]@8 - POINT v142; // [sp+7Ch] [bp-88h]@31 - POINT v143; // [sp+84h] [bp-80h]@9 - GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 - char *Str; // [sp+E0h] [bp-24h]@56 - int v146; // [sp+E4h] [bp-20h]@24 - int hilight_color; // [sp+E8h] [bp-1Ch]@1 - int m_text_color; // [sp+ECh] [bp-18h]@1 - __int32 v149; // [sp+F0h] [bp-14h]@8 - Player* _this; // [sp+F4h] [bp-10h]@1 - unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15 - int v152; // [sp+FCh] [bp-8h]@24 - int v153; // [sp+100h] [bp-4h]@44 - int th; - short text_color; - - v0 = pPlayers[uActiveCharacter]; - _this = pPlayers[uActiveCharacter]; - memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); - dialog_window.uFrameX = 483; - dialog_window.uFrameWidth = 148; - dialog_window.uFrameZ = 334; - m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - switch (dialog_menu_id) + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + pWhiteColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + pYellowColor = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + switch (dialog_menu_id) + { + case HOUSE_DIALOGUE_MAIN: + { + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + all_text_height = 0; + for( int i = 0; i < 4; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v146 = ( 174 - all_text_height ) / 4; + v23 = ( 174 - 4 * ( 174 - all_text_height ) / 4 - all_text_height ) / 2 - ( 174 - all_text_height ) / 4 / 2 + 138; + pNumString = 0; + if ( pDialogueWindow->pNumPresenceButton>=0 ) + { + for (pActiveButton = pDialogueWindow->pStartingPosActiveItem; pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++pActiveButton) + { + pButton = pDialogueWindow->GetControl(pActiveButton); + pButton->uY = v146 + v23; + pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + v23 = pButton->uY + pButton->uHeight - 1; + pButton->uW = v23; + pTextColor = pYellowColor; + if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) + pTextColor = pWhiteColor; + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, pTextColor, pShopOptions[pNumString], 3); + ++pNumString; + } + } + } + break; + case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture);// + textureW = 0; + v153 = 0; + for ( int i = 0; i < 8; ++i )// + { + if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) + { + textureW = ItemsInShopTexture[i]->uTextureWidth; + textureH = ItemsInShopTexture[i]->uTextureHeight; + if ( i >= 4 ) //low row + { + v60 = 90 - (textureW/2); + pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); + v59 = v60 + v153 + 80220; + } + else + { + pY_item = 98 - textureH; + v152 = 86 - (textureW/2); + pRenderer->DrawTextureTransparent(v152 + v153, pY_item, ItemsInShopTexture[i]); + v59 = v153 + v152 + 640 * pY_item; + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i + 1); + } + v153 += 105; + } + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + pItemCount = 0; + for ( int i = 0; i < 8; ++i ) + { + if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID ) + ++pItemCount; + } + if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) + pStatusText = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" + else + pStatusText = pGlobalTXT_LocalizationStrings[185];//"Steal item" + DrawTextAtStatusBar(pStatusText, 0); + if ( pItemCount != 0 ) + { + v73 = pMouse->GetCursorPos(&v136); + v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; + if ( !v74 ) + return; + pItemCount = v74 - 1; + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; + if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0) + v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; + else + v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" + v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); + return; + } + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: { - case HOUSE_DIALOGUE_MAIN: - { - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - - all_text_height = 0; - for(int i=0;i<4;++i) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v146 = (174 - all_text_height) / 4; - - v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; - int j=0; - if ( pDialogueWindow->pNumPresenceButton>=0 ) - { - th = 2; - for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) - { - control_button = pDialogueWindow->GetControl(v152); - control_button->uY = v146 + v23; - v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); - control_button->uHeight = v27; - v23 = control_button->uY + control_button->uHeight - 1; - control_button->uW = v23; - text_color = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != th ) - text_color = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); - ++th; - ++j; - } - } - } - break; - case HOUSE_DIALOGUE_SHOP_BUY_STANDARD: + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + v11 = 0; + v61 = 0; + v153 = 0; + do + { + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - textureW = 0; - v153 = 0; - for(int i=0; i<8; ++i) - { - if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) - { - textureW = ItemsInShopTexture[i]->uTextureWidth; - textureH = ItemsInShopTexture[i]->uTextureHeight; - if ( i >= 4 ) //low row - { - v60 = 90 - (textureW/2); - pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); - v59 = v60 + v153 + 80220; - } - else - { - v57 = 98 - textureH; - v152 = 86 - (textureW/2); - pRenderer->DrawTextureTransparent(v153 + v152, v57, ItemsInShopTexture[i]); - v59 = v153 + v152 + 640 * v57; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1); - } - v153 += 105; - - } - - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - - v149 = 0; - for(int i=0; i<8; ++i) - { - if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID) - ++v149; - - } - - v69 = GetAsyncKeyState(17); - v70 = _this->CanSteal(); - //Str = (char *)v70; - if ( v69 == 0 || v70 == 0 ) - { - v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" - } + v62 = ItemsInShopTexture[v61]; + if ( v61 >= 4 ) + { + v67 = 90 - ((signed int)v62->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); + v66 = v153 + v67 + 80220; + } + else + { + v63 = 98 - v62->uTextureHeight; + v64 = ItemsInShopTexture[v61]; + v65 = 98 - v62->uTextureHeight; + v152 = 86 - ((signed int)v62->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); + v66 = v152 + v153 + 640 * v63; + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); + } + v153 += 105; + ++v61; + } + while ( v61 < 8 ); + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v68 = 0; + pItemCount = 0; + do + { + // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID) + ++pItemCount; + ++v68; + } + while ( v68 < 6 ); + if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) + pStatusText = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" + else + pStatusText = pGlobalTXT_LocalizationStrings[185]; + DrawTextAtStatusBar(pStatusText, 0); + if ( (char *)pItemCount != 0 ) + { + v73 = pMouse->GetCursorPos(&v136); + v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; + if ( !v74 ) + return; + pItemCount = v74 - 1; + if ( dialog_menu_id == 2 ) + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; else - { - v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item" - } - DrawTextAtStatusBar(v71, 0); - if ( v149 != 0 ) - { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; - if ( !v74 ) - return; - v149 = v74 - 1; - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; - if ( v69 ==0 || v70 == 0) - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; - } - else - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" - } - v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); - return; - } - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; + if ( GetAsyncKeyState(17) == 0 || pPlayers[uActiveCharacter]->CanSteal() == 0 ) + v15 = (char *)pMerchantsBuyPhrases[pPlayers[uActiveCharacter]->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; + else + v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" + v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); return; + } + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" + all_text_height = 0; + for ( int i = 0; i < 3; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v152 = (174 - all_text_height) / 3; + v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; + v24 = -pDialogueWindow->pNumPresenceButton < 0; + pActiveButton = pDialogueWindow->pStartingPosActiveItem; + if ( v24 ^ pDialogueWindow->pStartingPosActiveItem > pDialogueWindow->pStartingPosActiveItem + pDialogueWindow->pNumPresenceButton ) + { + pNumString = 0; + do + { + pButton = pDialogueWindow->GetControl((unsigned int)pActiveButton); + pButton->uY = v152 + v86; + pTextHeight = pFontArrus->CalcTextHeight(pShopOptions[pNumString], &dialog_window, 0, 0); + v90 = pButton->uY; + pButton->uHeight = pTextHeight; + v86 = v90 + pTextHeight - 1; + pButton->uW = v86; + pTextColor = pYellowColor; + if ( pDialogueWindow->pCurrentPosActiveItem != pActiveButton ) + pTextColor = pWhiteColor; + dialog_window.DrawTitleText(pFontArrus, 0, v90, pTextColor, pShopOptions[pNumString], 3); + ++pNumString; + ++pActiveButton; } - break; + while ( (signed int)pActiveButton < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + return; + } + break; case HOUSE_DIALOGUE_SHOP_SELL: { draw_leather(); @@ -4207,389 +4217,221 @@ DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) return; - - if((v9 = pMouse->GetCursorPos(&v139)->x - 14, v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), + if((v9 = pMouse->GetCursorPos(&v139)->x - 14, pItemCount = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462 - || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) + || (v10 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v10) ) return; - - v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; - v13 = v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3); - v15 = (char *)pMerchantsSellPhrases[v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)]; + v116 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v10-1]; + v13 = pPlayers[uActiveCharacter]->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3); + v15 = (char *)pMerchantsSellPhrases[pPlayers[uActiveCharacter]->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)]; v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); + dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); return; } break; case HOUSE_DIALOGUE_SHOP_IDENTIFY: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v1 = pMouse->GetCursorPos(&a2)->x - 14; + pItemCount = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); + if ( pMouse->GetCursorPos(&v141)->x > 13 ) { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + if ( pMouse->GetCursorPos(&v143)->x < 462 ) + { + v2 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount); + if ( v2 ) { - v1 = pMouse->GetCursorPos(&a2)->x - 14; - v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); - if ( pMouse->GetCursorPos(&v141)->x > 13 ) - { - if ( pMouse->GetCursorPos(&v143)->x < 462 ) - { - v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); - if ( v2 ) - { - v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; - if (v3->Identified()) - { - v118 = window_SpeakInHouse->ptr_1C; - v4 = uActiveCharacter - 1; - v5 = "%24"; - v114 = v3; - } - else - { - v118 = window_SpeakInHouse->ptr_1C; - v114 = v3; - v7 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v8 = v0->_490EEE(v3, 2, v7, 4); - v4 = uPlayerID; - v5 = (char *)pMerchantsIdentifyPhrases[v8]; - } - v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v6, 3); - return; - } - } - } + v3 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v2-1]; + if (v3->Identified()) + v5 = "%24"; + else + { + v8 = pPlayers[uActiveCharacter]->_490EEE(v3, 2, (int)window_SpeakInHouse->ptr_1C, 4); + v5 = (char *)pMerchantsIdentifyPhrases[v8]; + } + v6 = BuilDialogueString(v5, uActiveCharacter - 1, v3, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v6, 3); + return; } + } } - break; + } + } + break; case HOUSE_DIALOGUE_SHOP_REPAIR: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) - return; - - if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, - v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) + return; + if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, + pItemCount = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), pMouse->GetCursorPos(&v140)->x <= 13) || pMouse->GetCursorPos(&v138)->x >= 462 - || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32) - || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) ) - return; - - - v120 = window_SpeakInHouse->ptr_1C; - v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5]; - v34 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5); - v14 = uPlayerID; - v15 = (char *)pMerchantsRepairPhrases[v35]; - v36 = BuilDialogueString(v15, v14, v116, (char *)v120, 5, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); + || (v32 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&pItemCount), v11 = 0, !v32) + || (v33 = 9 * v32, !(pPlayers[uActiveCharacter]->field_1F5[4 * v33 + 15] & 2)) ) + return; + v116 = &pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1]; + v35 = pPlayers[uActiveCharacter]->_490EEE(&pPlayers[uActiveCharacter]->pInventoryItems[v33 - 1], 2, (int)window_SpeakInHouse->ptr_1C, 5); + v15 = (char *)pMerchantsRepairPhrases[v35]; + v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *)window_SpeakInHouse->ptr_1C, 5, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, pWhiteColor, v36, 3); + return; + } + break; + case HOUSE_DIALOGUE_SHOP_6: //buy standart ??? + { + pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) return; - } - break; - case HOUSE_DIALOGUE_SHOP_6: //buy standart + pItemCount = 0; + for( int i = 0; i < 6 ; ++i ) + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) + ++pItemCount; + if ( pItemCount ) + { + v94 = pMouse->GetCursorPos(&v132); + pItemCount = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; + v95 = pItemCount; + if ( pItemCount && pItemCount != -65536 ) { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v149 = 0; - for(int i=0;i<6;++i) - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) - ++v149; - - - if ( v149 ) + --pItemCount; + v97 = uActiveCharacter - 1; + v99 = pPlayers[uActiveCharacter]->_490EEE(&pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2); + v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0); + v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, pWhiteColor, v100, 3); + } + v104 = 0; + v153 = 0; + do + { + //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) + { + v105 = ItemsInShopTexture[v104]; + if ( v104 >= 4 ) + { + v110 = 90 - ((signed int)v105->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); + v127 = v104 + 1; + v109 = v153 + v110 + 80220; + } + else { - v94 = pMouse->GetCursorPos(&v132); - v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; - v95 = v149; - if ( v149 && v149 != -65536 ) - { - --v149; - - v97 = uActiveCharacter - 1; - - v99 = _this->_490EEE( - &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2); - v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0); - v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); - dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, m_text_color, v100, 3); - } - v104 = 0; - v153 = 0; - do - { - //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) - { - v105 = ItemsInShopTexture[v104]; - if ( v104 >= 4 ) - { - v110 = 90 - ((signed int)v105->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); - v127 = v104 + 1; - v109 = v153 + v110 + 80220; - } - else - { - v106 = 98 - v105->uTextureHeight; - v107 = ItemsInShopTexture[v104]; - v108 = 98 - v105->uTextureHeight; - v152 = 86 - ((signed int)v105->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v108, v107); - v127 = v104 + 1; - v109 = v152 + v153 + 640 * v106; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); - } - v153 += 105; - ++v104; - } - while ( v104 < 8 ); - return; + v106 = 98 - v105->uTextureHeight; + v108 = 98 - v105->uTextureHeight; + v152 = 86 - ((signed int)v105->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v152 + v153, v108, ItemsInShopTexture[v104]); + v127 = v104 + 1; + v109 = v152 + v153 + 640 * v106; } - dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); - return; + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); + } + v153 += 105; + ++v104; } - break; - case HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT: + while ( v104 < 8 ); + return; + } + dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + case HOUSE_DIALOGUE_LEARN_SKILLS: + { + if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v152 = 0; + v37 = pDialogueWindow; + //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); + v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + pActiveButton = v38 * (100 - pPlayers[uActiveCharacter]->GetMerchant()) / 100; + if ( (signed int)pActiveButton < v38 / 3 ) + pActiveButton = v38 / 3; + v39 = v37->pStartingPosActiveItem; + v40 = v37->pNumPresenceButton; + v153 = 0; + if ( (signed int)v39 < (signed int)(v39 + v40) ) + { + do { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - v79 = pShopOptions; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" - - all_text_height = 0; - for(int i=0;i<3;++i) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v83 = pDialogueWindow; - v152 = (174 - all_text_height) / 3; - v84 = pDialogueWindow->pStartingPosActiveItem; - v85 = v84 + pDialogueWindow->pNumPresenceButton; - v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; - v24 = -pDialogueWindow->pNumPresenceButton < 0; - _this = (Player *)pDialogueWindow->pStartingPosActiveItem; - if ( v24 ^ __OFSUB__(v84, v85) ) - { + v41 = v37->GetControl(v39)->msg_param - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v41] && !pPlayers[uActiveCharacter]->pActiveSkills[v41] ) + { + v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); + v152 += v42; + ++v153; + } + ++v39; + } + while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); + if ( v153 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pActiveButton); + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3); + pActiveButton = (149 - v152) / v153; + if ( (149 - v152) / v153 > 32 ) + pActiveButton = 32; + v43 = (149 - v153 * (signed int)pActiveButton - v152) / 2 - (signed int)pActiveButton / 2 + 162; + v152 = v37->pStartingPosActiveItem; + v146 = v43; + if ( v152 < v152 + v37->pNumPresenceButton ) + { v153 = 2; do - { - v87 = v83->GetControl((unsigned int)_this); - v88 = v87; - v87->uY = v152 + v86; - v89 = pFontArrus->CalcTextHeight(*v79, &dialog_window, 0, 0); - v90 = v88->uY; - v91 = v153; - v88->uHeight = v89; - v86 = v90 + v89 - 1; - v88->uW = v86; - v92 = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != v91 ) - v92 = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u); - v83 = pDialogueWindow; - ++v153; - ++v79; - _this = (Player *)((char *)_this + 1); - } - while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - return; - } - break; - case HOUSE_DIALOGUE_SHOP_BUY_SPECIAL: - { - pRenderer->DrawTextureIndexed(8, 8, ShopTexture); - v11 = 0; - v61 = 0; - v153 = 0; - do { - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) - { - v62 = ItemsInShopTexture[v61]; - if ( v61 >= 4 ) - { - v67 = 90 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); - v66 = v153 + v67 + 80220; - } - else - { - v63 = 98 - v62->uTextureHeight; - v64 = ItemsInShopTexture[v61]; - v65 = 98 - v62->uTextureHeight; - v152 = 86 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); - v66 = v152 + v153 + 640 * v63; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); - } - v153 += 105; - ++v61; + pButton = v37->GetControl(v152); + v46 = pButton->msg_param - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayers[uActiveCharacter]->classType][v46] || pPlayers[uActiveCharacter]->pActiveSkills[v46] ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = (unsigned int)((char *)pActiveButton + v146); + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v46], &dialog_window, 0, 0); + v49 = pButton->uY; + pButton->uHeight = pTextHeight; + v51 = v49 + pTextHeight - 1; + pButton->uW = v51; + v146 = v51; + pTextColor = pYellowColor; + if ( pDialogueWindow->pCurrentPosActiveItem != v153 ) + pTextColor = pWhiteColor; + dialog_window.DrawTitleText(pFontArrus, 0, v49, pTextColor, pSkillNames[v46], 3); + } + v53 = v37->pStartingPosActiveItem; + ++v152; + textureH = v37->pNumPresenceButton + v53; + ++v153; } - while ( v61 < 8 ); - - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v68 = 0; - v149 = 0; - - do - { - // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) - if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID) - ++v149; - ++v68; - } - while ( v68 < 6 ); - - v69 = GetAsyncKeyState(17); - v70 = _this->CanSteal(); - Str = (char *)v70; - if ( v69 == 0 || (char *)v70 == 0 ) - { - v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" - } - else - { - v71 = pGlobalTXT_LocalizationStrings[185]; - } - DrawTextAtStatusBar(v71, 0); - if ( (char *)v149 != 0 ) - { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; - if ( !v74 ) - return; - v149 = v74 - 1; - - if ( dialog_menu_id == 2 ) - selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; - else - selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; - if ( v69 == 0 || Str == 0 ) - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; - } - else - { - v120 = window_SpeakInHouse->ptr_1C; - v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" - } - v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0); - v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); - return; - } - dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); - return; + while ( v152 < textureH ); + } + return; } - break; - case HOUSE_DIALOGUE_LEARN_SKILLS: - { - if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v152 = 0; - v37 = pDialogueWindow; - //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100); - if ( (signed int)_this < v38 / 3 ) - _this = (Player *)(v38 / 3); - v39 = v37->pStartingPosActiveItem; - v40 = v37->pNumPresenceButton; - v153 = 0; - if ( (signed int)v39 < (signed int)(v39 + v40) ) - { - do - { - v41 = v37->GetControl(v39)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] ) - { - v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); - v152 += v42; - ++v153; - } - ++v39; - } - while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); - if ( v153 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); - dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - _this = (Player *)((149 - v152) / v153); - if ( (149 - v152) / v153 > 32 ) - _this = (Player *)32; - v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162; - v152 = v37->pStartingPosActiveItem; - v146 = v43; - if ( v152 < v152 + v37->pNumPresenceButton ) - { - v153 = 2; - do - { - v44 = v37->GetControl(v152); - v45 = v44; - v46 = v44->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v46] || v0->pActiveSkills[v46] ) - { - v45->uW = 0; - v45->uHeight = 0; - v45->uY = 0; - } - else - { - v47 = pSkillNames[v46]; - v45->uY = (unsigned int)((char *)_this + v146); - Str = v47; - v48 = pFontArrus->CalcTextHeight(v47, &dialog_window, 0, 0); - v49 = v45->uY; - v50 = v153; - v45->uHeight = v48; - v51 = v49 + v48 - 1; - v45->uW = v51; - v146 = v51; - v52 = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != v50 ) - v52 = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u); - } - v53 = v37->pStartingPosActiveItem; - ++v152; - textureH = v37->pNumPresenceButton + v53; - ++v153; - } - while ( v152 < textureH ); - } - return; - } - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); //"Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, 0, v115, hilight_color, pTmpBuf, 3); - return; - } - break; } + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); //"Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, pYellowColor, pTmpBuf, 3); + return; } - - + break; + } +} //----- (004B5D7C) -------------------------------------------------------- void GuildDialog() @@ -4972,117 +4814,115 @@ v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); HIDWORD(v60) = v2; if ( dialog_menu_id != HOUSE_DIALOGUE_MAIN ) + { + if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL ) + { + if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE ) { - if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_HEAL ) + if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) + { + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { - if ( dialog_menu_id != HOUSE_DIALOGUE_TEMPLE_DONATE ) + v4 = pDialogueWindow; + v61 = pDialogueWindow; + v5 = window_SpeakInHouse->ptr_1C; + v66 = 0; + //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0); + v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); + v6 = v1->GetMerchant(); + v64 = (signed int)(v65 * (100 - v6)) / 100; + if ( v64 < (signed int)v65 / 3 ) + v64 = (signed int)v65 / 3; + v7 = v4->pStartingPosActiveItem; + v8 = v7 + v4->pNumPresenceButton; + v65 = 0; + v62 = v7; + if ( (signed int)v7 >= v8 ) + goto LABEL_78; + do + { + v9 = v4->GetControl(v62)->msg_param - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] ) { - - if ( dialog_menu_id == HOUSE_DIALOGUE_LEARN_SKILLS ) + v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); + v66 = (DDM_DLV_Header *)((char *)v66 + v10); + ++v65; + } + v11 = v4->pStartingPosActiveItem; + ++v62; + } + while ( (signed int)v62 < v4->pNumPresenceButton + v11 ); + if ( v65 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64); + v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + v64 = (149 - (signed int)v66) / (signed int)v65; + if ( v64 > 32 ) + v64 = 32; + v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162; + v12 = v61; + result = v61->pStartingPosActiveItem; + v13 = result + v61->pNumPresenceButton; + v62 = v61->pStartingPosActiveItem; + if ( result < v13 ) + { + v66 = (DDM_DLV_Header *)2; + while ( 1 ) + { + v14 = v12->GetControl(v62); + v15 = v14; + v16 = v14->msg_param - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] ) { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v4 = pDialogueWindow; - v61 = pDialogueWindow; - v5 = window_SpeakInHouse->ptr_1C; - v66 = 0; - //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0); - v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); - v6 = v1->GetMerchant(); - v64 = (signed int)(v65 * (100 - v6)) / 100; - if ( v64 < (signed int)v65 / 3 ) - v64 = (signed int)v65 / 3; - v7 = v4->pStartingPosActiveItem; - v8 = v7 + v4->pNumPresenceButton; - v65 = 0; - v62 = v7; - if ( (signed int)v7 >= v8 ) - goto LABEL_78; - do - { - v9 = v4->GetControl(v62)->msg_param - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] ) - { - v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); - v66 = (DDM_DLV_Header *)((char *)v66 + v10); - ++v65; - } - v11 = v4->pStartingPosActiveItem; - ++v62; - } - while ( (signed int)v62 < v4->pNumPresenceButton + v11 ); - if ( v65 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64); - v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v64 = (149 - (signed int)v66) / (signed int)v65; - if ( v64 > 32 ) - v64 = 32; - v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162; - v12 = v61; - result = v61->pStartingPosActiveItem; - v13 = result + v61->pNumPresenceButton; - v62 = v61->pStartingPosActiveItem; - if ( result < v13 ) - { - v66 = (DDM_DLV_Header *)2; - while ( 1 ) - { - v14 = v12->GetControl(v62); - v15 = v14; - v16 = v14->msg_param - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] ) - { - v15->uW = 0; - v15->uHeight = 0; - v15->uY = 0; - } - else - { - v17 = pSkillNames[v16]; - v15->uY = v64 + v65; - HIDWORD(v60) = (uint32)v17; - v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0); - v19 = v15->uY; - v15->uHeight = v18; - v20 = v19 + v18 - 1; - v15->uW = v20; - v65 = v20; - v21 = WORD2(v59); - if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 ) - v21 = WORD2(v58); - v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u); - } - result = (int)v61; - ++v62; - v66 = (DDM_DLV_Header *)((char *)v66 + 1); - if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem ) - break; - v12 = v61; - } - } - } - else - { + v15->uW = 0; + v15->uHeight = 0; + v15->uY = 0; + } + else + { + v17 = pSkillNames[v16]; + v15->uY = v64 + v65; + HIDWORD(v60) = (uint32)v17; + v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0); + v19 = v15->uY; + v15->uHeight = v18; + v20 = v19 + v18 - 1; + v15->uW = v20; + v65 = v20; + v21 = WORD2(v59); + if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 ) + v21 = WORD2(v58); + v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u); + } + result = (int)v61; + ++v62; + v66 = (DDM_DLV_Header *)((char *)v66 + 1); + if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem ) + break; + v12 = v61; + } + } + } + else + { LABEL_78: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v22 = WORD2(v59); - v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0); - v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); - } - } - } - return; - } - - // DONATION - //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; - v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - v25 = 0; - if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) - { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + v22 = WORD2(v59); + v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0); + v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); + } + } + } + return; + } + // DONATION + //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; + v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + v25 = 0; + if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) + { Party::TakeGold((signed __int64)v24); v26 = &pOutdoor->ddm; if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) @@ -5135,20 +4975,24 @@ ++byte_F8B1EF[uActiveCharacter]; v1->PlaySound(SPEECH_83, 0); ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!" - goto LABEL_46; - } - goto LABEL_55; - } + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); + return; + } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); + return; + } if ( !v1->_4B6FF9() ) return; v25 = 0; if ( pParty->uNumGold < v2 ) - { -LABEL_55: - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); - goto LABEL_46; - } + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + PlayHouseSound((unsigned int)window_SpeakInHouse->ptr_1C, HouseSound_NotEnoughMoney_TrainingSuccessful); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); + return; + } Party::TakeGold(v2); v35 = LODWORD(v1->pConditions[17]); v59 = v1->pConditions[14]; @@ -5169,7 +5013,11 @@ v1->uVoiceID = v38; ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37); } - goto LABEL_63; + pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); + v1->PlaySound(SPEECH_82, 0); + pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); + return; } v39 = v61; if ( (unsigned int)v61 | v35 ) @@ -5179,7 +5027,13 @@ else { if ( !v60 && !v58 && !v59 ) - goto LABEL_63; + { + pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); + v1->PlaySound(SPEECH_82, 0); + pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); + return; + } v1->field_1928 = v1->uFace; v1->field_1924 = v1->uVoiceID; v1->SetCondition(0x11u, 1); @@ -5191,13 +5045,11 @@ v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); } HIDWORD(v1->pConditions[17]) = (int)v39; -LABEL_63: pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); v1->PlaySound(SPEECH_82, 0); pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); -LABEL_46: pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); - return ; // void func + return; // void func } v63 = 1; v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); @@ -5636,18 +5488,9 @@ } } - - - - - - - - //----- (004B4FCF) -------------------------------------------------------- void MagicShopDialog() - { - Player *v0; // ebx@1 +{ int result; // eax@6 signed int v2; // esi@8 unsigned int v3; // ebx@10 @@ -5773,7 +5616,6 @@ int v122; int v114; - v0 = pPlayers[uActiveCharacter]; _this = pPlayers[uActiveCharacter]; memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); dialog_window.uFrameX = 483; @@ -5781,6 +5623,41 @@ dialog_window.uFrameZ = 334; m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) + { + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + all_text_height = 0; + for ( int i = 0; i < 4; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v146 = (174 - all_text_height) / 4; + v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; + int j = 0; + if ( pDialogueWindow->pNumPresenceButton>=0 ) + { + int th = 2; + for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) + { + control_button = pDialogueWindow->GetControl(v152); + control_button->uY = v146 + v23; + v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); + control_button->uHeight = v27; + v23 = control_button->uY + control_button->uHeight - 1; + control_button->uW = v23; + text_color = hilight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != th ) + text_color = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); + ++th; + ++j; + } + } + return; + } if ( dialog_menu_id > HOUSE_DIALOGUE_SHOP_REPAIR ) { if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT ) @@ -5856,7 +5733,15 @@ v35 = v34 + v31->pNumPresenceButton; v122 = 0; if ( (signed int)v34 >= v35 ) - goto LABEL_140; + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);// + // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." + v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, hilight_color, pTmpBuf, 3); + return; + } do { v36 = v31->GetControl(v34)->msg_param - 36; @@ -5871,19 +5756,13 @@ while ( (signed int)v34 < v31->pNumPresenceButton + v31->pStartingPosActiveItem ); if ( !v122 ) { -LABEL_140: sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);// // "Seek knowledge elsewhere %s the %s" strcat(pTmpBuf, "\n \n"); strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." - v30 = pTmpBuf; - v97 = 3; - v95 = pTmpBuf; - v92 = hilight_color; - v91 = 0; - v89 = 0; - v88 = &dialog_window; - goto LABEL_61; + v6 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, hilight_color, pTmpBuf, 3); + return; } sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); @@ -5951,7 +5830,7 @@ result = (int)pMouse->GetCursorPos(&v106), *(int *)result <= 13) || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462) - || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) + || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) ) return; v96 = 0; @@ -5963,96 +5842,9 @@ v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5); v9 = uPlayerID; v10 = (char *)pMerchantsRepairPhrases[v29]; - goto LABEL_35; - } - if ( dialog_menu_id == HOUSE_DIALOGUE_MAIN) - { - /* result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];// "Buy Standard" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];// "Buy Special" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];// "Display Inventory" - v14 = 0; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" - v15 = pShopOptions; - do - { - v16 = pFontArrus->CalcTextHeight(*v15, &dialogue_window, 0, 0); - ++v15; - v14 += v16; - } - while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); - v17 = pDialogueWindow; - v114 = (174 - v14) / 4; - result = pDialogueWindow->pStartingPosActiveItem; - v18 = result + pDialogueWindow->pNumPresenceButton; - v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - v122 = pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ __OFSUB__(result, v18) ) - { - v119 = (const char **)2; - _this = (Player *)pShopOptions; - do - { - v21 = v17->GetControl(v122); - v22 = (const char **)_this; - v21->uY = v114 + v19; - v23 = pFontArrus->CalcTextHeight(*v22, &dialogue_window, 0, 0); - v24 = v21->uY; - v25 = v119; - v21->uHeight = v23; - v19 = v24 + v23 - 1; - v21->uW = v19; - v26 = color2; - if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v25 ) - v26 = m_text_color; - dialogue_window.DrawTitleText(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u); - v17 = pDialogueWindow; - v119 = (const char **)((char *)v119 + 1); - _this = (Player *)((char *)_this + 4); - ++v122; - result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( v122 < result ); - } - }*/ - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - - all_text_height = 0; - for(int i=0;i<4;++i) - all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); - v146 = (174 - all_text_height) / 4; - - v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; - int j=0; - if ( pDialogueWindow->pNumPresenceButton>=0 ) - { - int th = 2; - for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) - { - control_button = pDialogueWindow->GetControl(v152); - control_button->uY = v146 + v23; - v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); - control_button->uHeight = v27; - v23 = control_button->uY + control_button->uHeight - 1; - control_button->uW = v23; - text_color = hilight_color; - if ( pDialogueWindow->pCurrentPosActiveItem != th ) - text_color = m_text_color; - dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); - ++th; - ++j; - } - } - - + v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); + v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3); return; } if ( dialog_menu_id != HOUSE_DIALOGUE_SHOP_BUY_STANDARD) @@ -6076,7 +5868,7 @@ result = (int)pMouse->GetCursorPos(&v103); if ( *(int *)result < 462 ) { - result = v0->GetItemIDAtInventoryIndex((int *)&v117); + result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117); v3 = 0; if ( result ) { @@ -6086,13 +5878,9 @@ if ( v4[20] & 1 ) { v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - v97 = 3; - v95 = v5; - v92 = m_text_color; v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101; - - dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); - return; + dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v5, 3); + return; } v93 = window_SpeakInHouse->ptr_1C; v90 = (ItemGen *)v4; @@ -6101,7 +5889,10 @@ v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4); v9 = uPlayerID; v10 = (char *)pMerchantsIdentifyPhrases[v8]; - goto LABEL_35; + v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); + v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3); + return; } } } @@ -6119,7 +5910,7 @@ result = (int)pMouse->GetCursorPos(&v105), *(int *)result <= 13) || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) - || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) + || (result = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) return; v96 = 0; v94 = 3; @@ -6130,17 +5921,9 @@ v13 = _this->_490EEE(v90, 3, v12, 3); v9 = uPlayerID; v10 = (char *)pMerchantsSellPhrases[v13]; -LABEL_35: v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); - v97 = 3; - v95 = v30; - v92 = m_text_color; - v91 = v3; - v89 = v3; - v88 = &dialog_window; -LABEL_61: - v6 = (174 - pFontArrus->CalcTextHeight(v30, v88, v89, v91)) / 2 + 138; - dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); + v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3); return; } } @@ -6282,7 +6065,7 @@ if ( result ) { v66 = 0; - v117 = 0;\ + v117 = 0; if ( dialog_menu_id == HOUSE_DIALOGUE_SHOP_BUY_STANDARD) { do @@ -6355,7 +6138,10 @@ v9 = uPlayerID; v10 = (char *)pMerchantsBuyPhrases[v75]; } - goto LABEL_35; + v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); + v6 = (174 - pFontArrus->CalcTextHeight(v30, &dialog_window, v3, v3)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, m_text_color, v30, 3); + return; } } return; diff -r 6daea87a3fe3 -r 23655ae9cd18 UIHouses.h --- a/UIHouses.h Fri Apr 19 18:11:01 2013 +0600 +++ b/UIHouses.h Fri Apr 19 18:11:28 2013 +0600 @@ -23,6 +23,8 @@ HOUSE_DIALOGUE_TRAININGHALL_TRAIN = 17, HOUSE_DIALOGUE_GUILD_BUY_BOOKS = 18, //... + HOUSE_DIALOGUE_36 = 36, + //.. HOUSE_DIALOGUE_GUILD_LEARN_SKILL = 72, //... HOUSE_DIALOGUE_SHOP_DISPLAY_EQUIPMENT = 94, diff -r 6daea87a3fe3 -r 23655ae9cd18 UIPopup.cpp --- a/UIPopup.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/UIPopup.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -1614,235 +1614,172 @@ } //----- (00418083) -------------------------------------------------------- -char __cdecl CharacterUI_StatsTab_ShowHint() - { - LONG _x; // esi@1 - Player *_y; // eax@1 - int v2; // edi@1 - __int16 *v3; // ecx@1 - LONG v4; // edx@2 - signed int v5; // edx@4 - char *v6; // ecx@9 - char *v7; // ebx@9 - unsigned int v8; // ebx@15 - unsigned __int64 v9; // kr00_8@15 - char *v10; // ST2C_4@15 - signed int v11; // eax@15 - char *v12; // ecx@17 - char *v13; // eax@20 - Player *v14; // esi@28 - int v15; // ebx@28 - int v16; // eax@33 - POINT a2; // [sp+Ch] [bp-24h]@1 - __int64 v19; // [sp+14h] [bp-1Ch]@15 - char *v20; // [sp+1Ch] [bp-14h]@13 - Player *v21; // [sp+20h] [bp-10h]@13 - unsigned int v22; // [sp+24h] [bp-Ch]@15 - int *v23; // [sp+28h] [bp-8h]@13 - const char *v24; // [sp+2Ch] [bp-4h]@10 +void __cdecl CharacterUI_StatsTab_ShowHint() + { + LONG _x; // esi@1 + LONG _y; // eax@1 + int pStringNum; // edi@1 + signed int pTextColor; // eax@15 + char *pHourWord; // ecx@17 + char *pDayWord; // eax@20 + int v15; // ebx@28 + int v16; // eax@33 + POINT a2; // [sp+Ch] [bp-24h]@1 + int pHour; // [sp+14h] [bp-1Ch]@15 + unsigned int pDay; // [sp+24h] [bp-Ch]@15 - _x = pMouse->GetCursorPos(&a2)->x; - _y = (Player *)pMouse->GetCursorPos(&a2)->y; - v2 = 0; - v3 = &array_4E2940[0].field_2; - while ( 1 ) - { - v4 = *(v3 - 1); - if ( _x >= v4 ) - { - if ( _x <= v4 + v3[1] ) - { - v5 = *v3; - if ( (signed int)_y >= v5 ) - { - if ( (signed int)_y <= v5 + v3[2] ) - break; - } - } - } - v3 += 4; - ++v2; - if ( (signed int)v3 >= (signed int)&off_4E2A12 ) - return (char)_y; - } - switch ( v2 ) - { - case 0: + _x = pMouse->GetCursorPos(&a2)->x; + _y = pMouse->GetCursorPos(&a2)->y; + for ( pStringNum = 0; pStringNum < (signed int)&off_4E2A12; ++pStringNum ) + { + if ( _x >= stat_string_coord[pStringNum].x && _x <= stat_string_coord[pStringNum].x + stat_string_coord[pStringNum].width ) + { + if ( _y >= stat_string_coord[pStringNum].y && _y <= stat_string_coord[pStringNum].y + stat_string_coord[pStringNum].height ) + break; + } + } + switch ( pStringNum ) + { + case 0:// Attributes case 1: case 2: case 3: case 4: case 5: case 6: - LOBYTE(_y) = 4 * v2; - v6 = aAttributeNames[v2]; - v7 = pAttributeDescriptions[v2]; - goto LABEL_46; - case 7: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[108]); - v7 = pHealthPointsAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[108]; - goto LABEL_47; - case 8: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[212]); - v7 = pSpellPointsAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[212]; - goto LABEL_47; - case 9: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[12]); - v7 = pArmourClassAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[12]; - goto LABEL_47; - case 10: - v24 = pGlobalTXT_LocalizationStrings[47]; - strcpy(pTmpBuf2, pPlayerConditionAttributeDescription); - v7 = pTmpBuf2; - v20 = pTmpBuf2; - strcat(pTmpBuf2, "\n"); - - extern unsigned int pConditionImportancyTable[18]; - v23 = (int *)pConditionImportancyTable; - _y = pPlayers[uActiveCharacter]; - v21 = pPlayers[uActiveCharacter]; - do - { - if ( _y->pConditions[*v23] ) - { - strcat(pTmpBuf2, " \n"); - v8 = *v23; - v9 = pParty->uTimePlayed - v21->pConditions[*v23]; - a2.x = LODWORD(pParty->uTimePlayed) - LODWORD(v21->pConditions[*v23]); - a2.y = HIDWORD(v9); - v19 = (signed __int64)((double)*(signed __int64 *)&a2 * 0.234375) / 60 / 60; - v22 = (unsigned int)v19 / 0x18; - v10 = aCharacterConditionNames[v8]; - v19 %= 24i64; - v11 = GetConditionDrawColor(v8); - sprintf(pTmpBuf, &byte_4E2DE8, v11, v10); - strcat(pTmpBuf2, pTmpBuf); - if ( v19 && v19 <= 1 ) - v12 = pGlobalTXT_LocalizationStrings[109]; - else - v12 = pGlobalTXT_LocalizationStrings[110]; - if ( !v22 || (v13 = pGlobalTXT_LocalizationStrings[56], v22 > 1) ) - v13 = pGlobalTXT_LocalizationStrings[57]; - sprintf(pTmpBuf, "%lu %s, %lu %s", v22, v13, v19, v12); - strcat(pTmpBuf2, pTmpBuf); - v7 = v20; - _y = v21; - } - ++v23; - } - while ( (signed int)v23 < (signed int)&unk_4EDF40 ); - goto LABEL_47; - case 11: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[172]); - v7 = pFastSpellAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[172]; - goto LABEL_47; - case 12: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[5]); - v7 = pPlayerAgeAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[5]; - goto LABEL_47; - case 13: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[131]); - v7 = pPlayerLevelAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[131]; - goto LABEL_47; - case 14: - v14 = pPlayers[uActiveCharacter]; - v24 = pGlobalTXT_LocalizationStrings[83]; - v15 = v14->uLevel; - do - { - if ( (signed __int64)v14->uExperience < (unsigned int)sub_4B46F8(v15) ) - break; - ++v15; - } - while ( v15 <= 10000 ); - pTmpBuf[0] = 0; - pTmpBuf2[0] = 0; - if ( v15 > v14->uLevel ) - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[147], v15); - v16 = sub_4B46F8(v15) - LODWORD(v14->uExperience); - sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[538], v16, v15 + 1); - strcat(pTmpBuf, "\n"); - strcat(pTmpBuf, pTmpBuf2); - LOBYTE(_y) = sprintf(pTmpBuf2, "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf); - v7 = pTmpBuf2; - goto LABEL_47; - case 15: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[587]); - v7 = pAttackBonusAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[587]; - goto LABEL_47; - case 16: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[588]); - v7 = pAttackDamageAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[588]; - goto LABEL_47; - case 17: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[589]); - v7 = pMissleBonusAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[589]; - goto LABEL_47; - case 18: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[590]); - v7 = pMissleDamageAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[590]; - goto LABEL_47; - case 19: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[87]); - v7 = pFireResistanceAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[87]; - goto LABEL_47; - case 20: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[6]); - v7 = pAirResistanceAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[6]; - goto LABEL_47; - case 21: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[240]); - v7 = pWaterResistanceAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[240]; - goto LABEL_47; - case 22: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[70]); - v7 = pEarthResistanceAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[70]; - goto LABEL_47; - case 23: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[142]); - v7 = pMindResistanceAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[142]; - goto LABEL_47; - case 24: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[29]); - v7 = pBodyResistanceAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[29]; - goto LABEL_47; - case 25: - LOBYTE(_y) = LOBYTE(pGlobalTXT_LocalizationStrings[207]); - v7 = pSkillPointsAttributeDescription; - v24 = pGlobalTXT_LocalizationStrings[207]; - goto LABEL_47; + if ( aAttributeNames[pStringNum] && pAttributeDescriptions[pStringNum] ) + sub_4179BC_draw_tooltip(aAttributeNames[pStringNum], pAttributeDescriptions[pStringNum]); + break; + case 7:// Health Points + if ( pGlobalTXT_LocalizationStrings[108] && pHealthPointsAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[108], pHealthPointsAttributeDescription); + break; + case 8:// Spell Points + if ( pGlobalTXT_LocalizationStrings[212] && pSpellPointsAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[212], pSpellPointsAttributeDescription); + break; + case 9:// Armor Class + if ( pGlobalTXT_LocalizationStrings[12] && pArmourClassAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[12], pArmourClassAttributeDescription); + break; + case 10:// Player Condition + strcpy(pTmpBuf2, pPlayerConditionAttributeDescription); + strcat(pTmpBuf2, "\n"); + extern unsigned int pConditionImportancyTable[18]; + for ( uint i = 0; i < 18; ++i ) + { + if ( pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]] ) + { + strcat(pTmpBuf2, " \n"); + pHour = pParty->uTimePlayed - pPlayers[uActiveCharacter]->pConditions[pConditionImportancyTable[i]]; + pHour = (unsigned int)((pHour * 0.234375) / 60 / 60); + pDay = (unsigned int)pHour / 24; + pHour %= 24i64; + pTextColor = GetConditionDrawColor(pConditionImportancyTable[i]); + sprintfex(pTmpBuf, format_4E2DE8, pTextColor, aCharacterConditionNames[pConditionImportancyTable[i]]); + strcat(pTmpBuf2, pTmpBuf); + if ( pHour && pHour <= 1 ) + pHourWord = pGlobalTXT_LocalizationStrings[109]; + else + pHourWord = pGlobalTXT_LocalizationStrings[110]; + if ( !pDay || (pDayWord = pGlobalTXT_LocalizationStrings[56], pDay > 1) ) + pDayWord = pGlobalTXT_LocalizationStrings[57]; + sprintfex(pTmpBuf, "%lu %s, %lu %s", pDay, pDayWord, pHour, pHourWord); + strcat(pTmpBuf2, pTmpBuf); + } + } + if ( pGlobalTXT_LocalizationStrings[47] && pTmpBuf2 ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[47], pTmpBuf2); + break; + case 11:// Fast Spell + if ( pGlobalTXT_LocalizationStrings[172] && pFastSpellAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[172], pFastSpellAttributeDescription); + break; + case 12:// Player Age + if ( pGlobalTXT_LocalizationStrings[5] && pPlayerAgeAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[5], pPlayerAgeAttributeDescription); + break; + case 13:// Player Level + if ( pGlobalTXT_LocalizationStrings[131] && pPlayerLevelAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[131], pPlayerLevelAttributeDescription); + break; + case 14://Experience + v15 = pPlayers[uActiveCharacter]->uLevel; + do + { + if ( (signed __int64)pPlayers[uActiveCharacter]->uExperience < (unsigned int)sub_4B46F8(v15) ) + break; + ++v15; + } + while ( v15 <= 10000 ); + pTmpBuf[0] = 0; + pTmpBuf2[0] = 0; + if ( v15 > pPlayers[uActiveCharacter]->uLevel ) + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[147], v15); + v16 = sub_4B46F8(v15) - LODWORD(pPlayers[uActiveCharacter]->uExperience); + sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[538], v16, v15 + 1); + strcat(pTmpBuf, "\n"); + strcat(pTmpBuf, pTmpBuf2); + sprintf(pTmpBuf2, "%s\n \n%s", pPlayerExperienceAttributeDescription, pTmpBuf); + if ( pGlobalTXT_LocalizationStrings[83] && pTmpBuf2 ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[83], pTmpBuf2); + break; + case 15:// Attack Bonus + if ( pGlobalTXT_LocalizationStrings[587] && pAttackBonusAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[587], pAttackBonusAttributeDescription); + break; + case 16:// Attack Damage + if ( pGlobalTXT_LocalizationStrings[588] && pAttackDamageAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[588], pAttackDamageAttributeDescription); + break; + case 17:// Missle Bonus + if ( pGlobalTXT_LocalizationStrings[589] && pMissleBonusAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[589], pMissleBonusAttributeDescription); + break; + case 18:// Missle Damage + if ( pGlobalTXT_LocalizationStrings[590] && pMissleDamageAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[590], pMissleDamageAttributeDescription); + break; + case 19:// Fire Resistance + if ( pGlobalTXT_LocalizationStrings[87] && pFireResistanceAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[87], pFireResistanceAttributeDescription); + break; + case 20:// Air Resistance + if ( pGlobalTXT_LocalizationStrings[6] && pAirResistanceAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[6], pAirResistanceAttributeDescription); + break; + case 21:// Water Resistance + if ( pGlobalTXT_LocalizationStrings[240] && pWaterResistanceAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[240], pWaterResistanceAttributeDescription); + break; + case 22:// Earth Resistance + if ( pGlobalTXT_LocalizationStrings[70] && pEarthResistanceAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[70], pEarthResistanceAttributeDescription); + break; + case 23:// Mind Resistance + if ( pGlobalTXT_LocalizationStrings[142] && pMindResistanceAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[142], pMindResistanceAttributeDescription); + break; + case 24:// Body Resistance + if ( pGlobalTXT_LocalizationStrings[29] && pBodyResistanceAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[29], pBodyResistanceAttributeDescription); + break; + case 25: // Skill Points + if ( pGlobalTXT_LocalizationStrings[207] && pSkillPointsAttributeDescription ) + sub_4179BC_draw_tooltip(pGlobalTXT_LocalizationStrings[207], pSkillPointsAttributeDescription); + break; case 26: - _y = (Player *)(4 * pPlayers[uActiveCharacter]->classType); - v6 = *(char **)((char *)_y->pConditions + (int)pClassNames); - v7 = *(char **)((char *)_y->pConditions + (int)pClassDescriptions); -LABEL_46: - v24 = v6; -LABEL_47: - if ( v24 && v7 ) - LOBYTE(_y) = sub_4179BC_draw_tooltip(v24, v7); - break; + __debugbreak; + //_y = (Player *)(4 * pPlayers[uActiveCharacter]->classType); + //v24 = *(char **)((char *)_y->pConditions + (int)pClassNames); + //v7 = *(char **)((char *)_y->pConditions + (int)pClassDescriptions); + //if ( v24 && v7 ) + //sub_4179BC_draw_tooltip(v24, v7); + break; default: - return (char)_y; - } - return (char)_y; - } - + break; + } +} //----- (00410B28) -------------------------------------------------------- void __thiscall DrawSpellDescriptionPopup(int spell_index) diff -r 6daea87a3fe3 -r 23655ae9cd18 VideoPlayer.cpp --- a/VideoPlayer.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/VideoPlayer.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -13,6 +13,7 @@ #include "Time.h" #include "Log.h" #include "UIHouses.h" +#include "texts.h" #include "MM7.h" #include "mm7_data.h" @@ -348,7 +349,7 @@ if ( a2 == 2 ) v4 = 0; ShowCursor(0); - pVideoPlayer->OpenMovie(pName, 0, ScreenSizeFlag); + pVideoPlayer->OpenGlobalMovie(pName, 0, ScreenSizeFlag); pVideoPlayer->bPlayingMovie = 1; pVideoPlayer->field_44 = v4; if ( pRenderer->pRenderD3D ) @@ -908,7 +909,7 @@ if ( !v4 ) { SetFilePointer(pVideoPlayer->hMightVid, pVideoPlayer->pMightVideoHeaders[v3].uFileOffset, 0, 0); - return SmackOpen(pVideoPlayer->hMightVid, 0x7140, -1); + return SmackOpen(pVideoPlayer->hMightVid, 0x7140, -1);//problem training house video in WinXP } } } @@ -928,7 +929,7 @@ } //----- (004BF28F) -------------------------------------------------------- -void VideoPlayer::_4BF28F(const char *pMovieName, unsigned int a3_1) +void VideoPlayer::OpenHouseMovie(const char *pMovieName, unsigned int a3_1) { VideoPlayer *v3; // esi@1 std::string *v4; // ecx@3 @@ -958,11 +959,10 @@ { v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:925"; v12 = "Unsupported Bink playback!"; -LABEL_6: - MessageBoxA(nullptr, v12, v15, 0); + MessageBoxA(nullptr, v12, v15, 0); return; } - sprintf(Str2, "%s.smk", pMovieName); + sprintfex(Str2, "%s.smk", pMovieName); v5 = OpenSmack(Str2); v3->pSmackerMovie = v5; if ( !v5 ) @@ -970,8 +970,8 @@ v3->Unload(); sprintf(pTmpBuf, "Can't load %s", &Str2); v15 = "E:\\WORK\\MSDEV\\MM7\\MM7\\Code\\Video.cpp:937"; - v12 = pTmpBuf; - goto LABEL_6; + MessageBoxA(nullptr, pTmpBuf, v15, 0); + return; } v16 = (int)pMovieName; v3->uMovieFormat = 1; @@ -1002,7 +1002,7 @@ } //----- (004BF411) -------------------------------------------------------- -void VideoPlayer::OpenMovie(const char *pFilename, unsigned int bLoop, int a4) +void VideoPlayer::OpenGlobalMovie(const char *pFilename, unsigned int bLoop, int a4) { VideoPlayer *pVideoPlayer; // esi@1 _BINK *pVideoOpen; // eax@2 @@ -1035,7 +1035,7 @@ else { Unload(); - sprintf(pVideoName, "%s.smk", pFilename); + sprintfex(pVideoName, "%s.smk", pFilename); v6 = OpenSmack(pVideoName); pVideoPlayer->pSmackerMovie = v6; if ( !v6 ) @@ -1140,7 +1140,7 @@ } //----- (004BF73A) -------------------------------------------------------- -void VideoPlayer::_4BF73A() +void VideoPlayer::SelectMovieType() { VideoPlayer *v1; // esi@1 int v2; // edi@1 @@ -1157,11 +1157,11 @@ if ( v4 ) { if ( v4 == 1 ) - OpenMovie(Source, v3, 1); + OpenGlobalMovie(Source, v3, 1); } else { - _4BF28F(Source, v3); + OpenHouseMovie(Source, v3); } } diff -r 6daea87a3fe3 -r 23655ae9cd18 VideoPlayer.h --- a/VideoPlayer.h Fri Apr 19 18:11:01 2013 +0600 +++ b/VideoPlayer.h Fri Apr 19 18:11:28 2013 +0600 @@ -145,11 +145,11 @@ void SmackUpdatePalette(HWND hWnd); _BINK *OpenBink(const char *pName); struct _SMACK *OpenSmack(const char *pFilename); - void _4BF28F(const char *pMovieName, unsigned int a3_1); + void OpenHouseMovie(const char *pMovieName, unsigned int a3_1);//0x4BF28F bool AnyMovieLoaded(); - void OpenMovie(const char *pFilename, unsigned int bLoop, int a4); + void OpenGlobalMovie(const char *pFilename, unsigned int bLoop, int a4); void _4BF5B2(); - void _4BF73A(); + void SelectMovieType();//0x4BF73A _BINKBUF *CreateBinkBuffer(HWND a1, unsigned int uWidth, unsigned int uHeight, char a4); static void __fastcall MovieLoop(const char *pMovieName, int a2, int a3, int a4); diff -r 6daea87a3fe3 -r 23655ae9cd18 mm7_1.cpp --- a/mm7_1.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/mm7_1.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -694,17 +694,8 @@ bRingsShownInCharScreen = 0; CharacterUI_LoadPaperdollTextures(); pCurrentScreen = SCREEN_CASTING; - v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_1F, v1, 0); - pCharacterScreen_ExitBtn = v2->CreateButton( - 394u, - 318u, - 75u, - 33u, - 1, - 0, - UIMSG_A8, - 0, - 0, + v2 = GUIWindow::Create(0, 0, 640, 480, WINDOW_CastSpell_InInventory, v1, 0); + pCharacterScreen_ExitBtn = v2->CreateButton(394, 318, 75, 33, 1, 0, UIMSG_A8, 0, 0, pGlobalTXT_LocalizationStrings[79], // Close (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, diff -r 6daea87a3fe3 -r 23655ae9cd18 mm7_2.cpp --- a/mm7_2.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/mm7_2.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -741,64 +741,40 @@ } //----- (004BC8D5) -------------------------------------------------------- -void SpellBookGenerator() - { - int v0; // esi@1 - int v1; // ebx@1 - signed int v2; // edi@1 - signed int v3; // eax@2 +void SpellBookGenerator()//for GuildDialogs +{ + int pItemNum; // esi@1 int v4; // esi@7 - GUIWindow *v5; // ebp@15 - Texture *result; // eax@15 - int v7; // [sp+10h] [bp-4h]@0 - - // v0 = v7; - v1 = window_SpeakInHouse->par1C - 139; - v2 = 0; - for(int i=0; i<12; ++i) - { - //v3 = p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]; - v3 = p2DEvents[window_SpeakInHouse->par1C - 1].uType; - if ( v3 >= 5 ) - { - if ( v3 <= 13 ) - { - v0 = rand() % word_4F0F30[(signed int)v1] - //+ 11 * p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C] - + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType - + 345; - } - else - { - if ( v3 == 14 ) - { - v4 = rand() % 4; - } - else if ( v3 == 15 ) - { - v4 = rand() % 3 + 4; - } - else if ( v3 == 16 ) - v4 = rand() % 2 + 7; - if( v3 <= 16 ) - v0 = rand() % word_4F0F30[(signed int)v1] + 11 * v4 + 400; - } - } - if ( v0 == 487 ) + + for( int i = 0; i < 12; ++i ) + { + if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType >= 5 ) + { + if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 13 ) + pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType + 345; + else + { + if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 14 ) + v4 = rand() % 4; + else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 15 ) + v4 = rand() % 3 + 4; + else if ( p2DEvents[window_SpeakInHouse->par1C - 1].uType == 16 ) + v4 = rand() % 2 + 7; + if( p2DEvents[window_SpeakInHouse->par1C - 1].uType <= 16 ) + pItemNum = rand() % word_4F0F30[(signed int)window_SpeakInHouse->par1C - 139] + 11 * v4 + 400; + } + } + if ( pItemNum == 487 ) { if ( !(unsigned __int16)_449B57_test_bit(pParty->_quest_bits, 239) ) - v0 = 486; - } - v5 = window_SpeakInHouse; - - ItemGen * _u = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i]; - _u->Reset(); - pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID= v0; + pItemNum = 486; + } + ItemGen * item_spellbook = &pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i]; + item_spellbook->Reset(); + pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].uItemID = pItemNum; pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][i].Identified(); - - ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pItemsTable->pItems[v0].pIconName, TEXTURE_16BIT_PALETTE)]; - } - + ItemsInShopTexture[i] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pItemsTable->pItems[pItemNum].pIconName, TEXTURE_16BIT_PALETTE)]; + } return; } @@ -9548,8 +9524,8 @@ _this.Reset(); v0 = pPlayers[uActiveCharacter]; v1 = v0->pEquipment.uMainHand; - v2 = v0->pEquipment.uOffHand; - v54 = v0->pEquipment.uOffHand; + v2 = v0->pEquipment.uShield; + v54 = v0->pEquipment.uShield; v53 = v1; if ( v1 && pItemsTable->pItems[*(int *)&v0->pInventoryItems[v1-1]].uEquipType == 1 ) v51 = v1; @@ -9654,7 +9630,7 @@ v9 = v52; pParty->pPickedItem.uBodyAnchor = v52 + 1; memcpy(&v0->pInventoryItems[v8], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v8])); - *(&v0->pEquipment.uOffHand + v9) = v8 + 1; + *(&v0->pEquipment.uShield + v9) = v8 + 1; pMouse->RemoveHoldingItem(); break; } @@ -9708,7 +9684,7 @@ v13 = v54 + 1; v14 = v51 == 0; memcpy((void *)(v12 + 532), &_this, 0x24u); - v0->pEquipment.uOffHand = v13; + v0->pEquipment.uShield = v13; if ( v14 ) return; } @@ -9722,7 +9698,7 @@ pParty->pPickedItem.uBodyAnchor = 1; v17 = v52 + 1; memcpy(&v0->pInventoryItems[v52], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v52])); - v0->pEquipment.uOffHand = v17; + v0->pEquipment.uShield = v17; pMouse->RemoveHoldingItem(); return; } @@ -9734,7 +9710,7 @@ _this.uBodyAnchor = 1; v16 = v52 + 1; memcpy(&v0->pInventoryItems[v52], &_this, sizeof(v0->pInventoryItems[v52])); - v0->pEquipment.uOffHand = v16; + v0->pEquipment.uShield = v16; } v0->pEquipment.uMainHand = 0; return; @@ -9790,7 +9766,7 @@ v21 = v54 + 1; v14 = v52 == 12; memcpy((void *)(v20 + 532), &_this, 0x24u); - v0->pEquipment.uOffHand = v21; + v0->pEquipment.uShield = v21; if ( !v14 ) return; v22 = _this.uItemID; @@ -9810,7 +9786,7 @@ pParty->pPickedItem.uBodyAnchor = 1; v50 = (unsigned int)&v0->pInventoryItems[v23]; memcpy(&v0->pInventoryItems[v23], &pParty->pPickedItem, sizeof(v0->pInventoryItems[v23])); - v0->pEquipment.uOffHand = v23 + 1; + v0->pEquipment.uShield = v23 + 1; pMouse->RemoveHoldingItem(); if ( v52 != 12 ) return; @@ -9863,7 +9839,7 @@ if ( v14 ) v50 = _this.uItemID; if ( v51 ) - v0->pEquipment.uOffHand = 0; + v0->pEquipment.uShield = 0; if ( v50 ) { __debugbreak(); // looks like offset in player's inventory and wand_lut much like case in 0042ECB5 @@ -9930,7 +9906,7 @@ _this.uBodyAnchor = 2; v30 = v52 + 1; memcpy(&v0->pInventoryItems[v52], &_this, sizeof(v0->pInventoryItems[v52])); - v0->pEquipment.uOffHand = 0; + v0->pEquipment.uShield = 0; v0->pEquipment.uMainHand = v30; } else diff -r 6daea87a3fe3 -r 23655ae9cd18 mm7_3.cpp --- a/mm7_3.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/mm7_3.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -6023,10 +6023,25 @@ array_50AC10[3].vWorldViewProjX = pViewport->uViewportBR_X; array_50AC10[3].vWorldViewProjY = pViewport->uViewportTL_Y; + //pParty->sRotationY / 2048.0f + + float t = (GetTickCount() % 96000) / 96000.0f; + array_50AC10[0].u = t - pParty->sRotationY / 1024.0f; + array_50AC10[0].v = t - pParty->sRotationX / 512.0f; + + array_50AC10[1].u = t - pParty->sRotationY / 1024.0f; + array_50AC10[1].v = 1 + t - pParty->sRotationX / 512.0f; + + array_50AC10[2].u = 1 + t - pParty->sRotationY / 1024.0f; + array_50AC10[2].v = 1 + t - pParty->sRotationX / 512.0f; + + array_50AC10[3].u = 1 + t - pParty->sRotationY / 1024.0f; + array_50AC10[3].v = t - pParty->sRotationX / 512.0f; + v36 = (double)(pViewport->uViewportBR_X - pViewport->uViewportTL_X) * 0.5; v33 = 65536 / (signed int)(v36 / tan(0.6457717418670654) + 0.5); - for (int i = 0; i < _this.uNumVertices; ++i) + for (uint i = 0; i < _this.uNumVertices; ++i) { v29 = floorf(array_50AC10[i].vWorldViewProjY + 0.5f); v39 = (unsigned __int64)(_this.ptr_38->field_14 * v33 * (v30 - v29)) / 65536; @@ -6096,14 +6111,16 @@ //array_50AC10[i].vWorldPosition.x = v36 / (_this.pTexture->uTextureHeight * 65536.0); //array_50AC10[i].vWorldPosition.y = 1.0 / (pOutdoorCamera->shading_dist_mist >> 16); //array_50AC10[i].vWorldPosition.z = v35 / (_this.pTexture->uTextureWidth * 65536.0); - array_50AC10[i]._rhw = 1.0;// / (pOutdoorCamera->shading_dist_mist >> 16); + //array_50AC10[i]._rhw = 1.0f / (v18 >> 16); //array_50AC10[i].u = (double)v35 / (65536.0 * _this.pTexture->uTextureWidth); //array_50AC10[i].v = (double)v36 / (65536.0 * _this.pTexture->uTextureHeight); - float t = (GetTickCount() % 96000) / 96000.0f; - array_50AC10[i].u += t; - array_50AC10[i].v += t; - if ( i == _this.uNumVertices - 1 ) - { + //float t = (GetTickCount() % 96000) / 96000.0f; + array_50AC10[i]._rhw = 1.0f; + //array_50AC10[i].u = t; + //array_50AC10[i].v = t; + } + //if ( i == _this.uNumVertices - 1 ) + //{ pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); array_50AC10[0].vWorldViewProjY = v38; @@ -6112,9 +6129,8 @@ array_50AC10[3].vWorldViewProjY = v38; pRenderer->DrawSkyPolygon(_this.uNumVertices, &_this, pBitmaps_LOD->pHardwareTextures[_this.uTileBitmapID]); - return; - } - } + //return; + //} } //----- (00479A53) -------------------------------------------------------- diff -r 6daea87a3fe3 -r 23655ae9cd18 mm7_4.cpp --- a/mm7_4.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/mm7_4.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -9133,8 +9133,8 @@ if ( v9 ) { if ( !v23 ) - //pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); - pVideoPlayer->_4BF28F(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); + //pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents_minus1___02[26 * v9]].field_0, 1u); + pVideoPlayer->OpenHouseMovie(pAnimatedRooms[p2DEvents[v9 - 1].uAnimationID].video_name, 1u); } else { diff -r 6daea87a3fe3 -r 23655ae9cd18 mm7_5.cpp --- a/mm7_5.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/mm7_5.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -3859,16 +3859,14 @@ if ( pUIMessageType == UIMSG_PlayerCreationClickPlus ) { GUIWindow::Create(613, 393, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnPlus, 1); - (&pPlayer[uPlayerCreationUI_SelectedCharacter])->IncreaseAttribute( - (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); + pPlayer[uPlayerCreationUI_SelectedCharacter].IncreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); pAudioPlayer->PlaySound((SoundID)20, 0, 0, -1, 0, 0, 0, 0); continue; } if ( pUIMessageType == UIMSG_PlayerCreationClickMinus ) { GUIWindow::Create(523, 393, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnMinus, 1); - (&pPlayer[uPlayerCreationUI_SelectedCharacter])->DecreaseAttribute( - (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); + pPlayer[uPlayerCreationUI_SelectedCharacter].DecreaseAttribute((pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7); pAudioPlayer->PlaySound((SoundID)23, 0, 0, -1, 0, 0, 0, 0); continue; } @@ -5006,7 +5004,7 @@ { if ( player->HasItemEquipped((ITEM_EQUIP_TYPE)v59) ) { - auto _s = (ItemGen *)&player->pInventoryItems[v57->uOffHand-1]; + auto _s = (ItemGen *)&player->pInventoryItems[v57->uShield - 1]; a4 = _s->_439DF3_get_additional_damage(&a2, &v62); if ( v62 && pMonster->sCurrentHP > 0 ) { @@ -5248,7 +5246,7 @@ v75 = v6->sHealth, !stru_50C198.ActorHitOrMiss(v7, v6)) ) return; - v8 = v6->pEquipment.uBody; + v8 = v6->pEquipment.uArmor; if ( !v8 || (v9 = (char *)v6 + 36 * v8, v9[516] & 2) || (v10 = pItemsTable->pItems[*((int *)v9 + 124)].uSkillType, v10 < 10) @@ -5486,7 +5484,7 @@ if ( v45->HasEnchantedItemEquipped(69) ) v77 >>= 1; if ( v45->HasItemEquipped(EQUIP_ARMOUR) - && *(_DWORD *)&v45->pInventoryItems[v45->pEquipment.uBody-1] == 504 ) + && *(_DWORD *)&v45->pInventoryItems[v45->pEquipment.uArmor-1] == 504 ) v77 >>= 1; v75 = 0; v47 = (int)&v45->pEquipment; @@ -5991,7 +5989,7 @@ } //----- (0043C91D) -------------------------------------------------------- -int __fastcall _43C91D_FormItemTextureFilename(char *a1, signed int a2, int a3, int a4) +int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder) { int result; // eax@2 char v5; // zf@3 @@ -6001,195 +5999,167 @@ signed int v9; // [sp-4h] [bp-10h]@69 result = 0; //BUG fn is void - if ( a2 <= 500 ) + if ( item_id <= 500 ) { //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0; - v5 = byte_5111C0[(a2 - 100) + 32 + 2] == 0; -LABEL_21: + v5 = party_has_equipment[(item_id - 100) + 32 + 2] == 0; + switch ( item_id ) + { + case 516: + v5 = byte_5111F6[2] == 0; + break; + case 505: + v5 = byte_5111F6[1] == 0; + break; + case 504: + v5 = byte_5111F6[0] == 0; + break; + case 533: + v5 = byte_5111F6[16] == 0; + break; + case 512: + v5 = byte_5111F6[3] == 0; + break; + case 521: + v5 = byte_5111F6[4] == 0; + break; + case 522: + v5 = byte_5111F6[5] == 0; + break; + case 523: + v5 = byte_5111F6[6] == 0; + break; + case 532: + v5 = byte_5111F6[7] == 0; + break; + case 544: + v5 = byte_5111F6[8] == 0; + break; + case 524: + v5 = byte_5111F6[9] == 0; + break; + case 535: + v5 = byte_5111F6[10] == 0; + break; + case 525: + v5 = byte_5111F6[11] == 0; + break; + case 530: + v5 = byte_5111F6[12] == 0; + break; + case 547: + v5 = byte_5111F6[13] == 0; + break; + case 548: + v5 = byte_5111F6[14] == 0; + break; + case 550: + v5 = byte_5111F6[15] == 0; + break; + default: + break; + } if ( v5 ) return result; result = 516; - if ( a2 < 66 || a2 > 78 ) - { - if ( a2 == 516 ) - goto LABEL_79; - if ( a2 != 504 && a2 != 505 && a2 != 533 ) - { - if ( (a2 < 100 || a2 > 104) && a2 != 524 && a2 != 535 ) - { - if ( a2 >= 115 && a2 <= 119 || a2 == 512 ) - { - if ( a2 == 512 ) - a2 = 312; - goto LABEL_87; - } - if ( (a2 < 89 || a2 > 99) && a2 != 521 && a2 != 522 && a2 != 523 && a2 != 532 && a2 != 544 ) + if ( item_id < 66 || item_id > 78 ) + { + if ( item_id == 516 ) + { + if ( !shoulder ) + return sprintf(pOut, "item%3.3dv%d", 234, index); + if ( shoulder == 1 ) + return sprintf(pOut, "item%3.3dv%da1", 234, index); + if ( shoulder == 2 ) + return sprintf(pOut, "item%3.3dv%da2", 234, index); + } + if ( item_id != 504 && item_id != 505 && item_id != 533 ) + { + if ( (item_id < 100 || item_id > 104) && item_id != 524 && item_id != 535 ) + { + if ( item_id >= 115 && item_id <= 119 || item_id == 512 ) + { + if ( item_id == 512 ) + item_id = 312; + return sprintf(pOut, "item%3.3dv%d", item_id, index); + } + if ( (item_id < 89 || item_id > 99) && item_id != 521 && item_id != 522 && item_id != 523 && item_id != 532 && item_id != 544 ) { result = 525; - if ( (a2 < 105 || a2 > 109) && a2 != 525 && a2 != 530 && a2 != 547 && a2 != 548 && a2 != 550 ) + if ( (item_id < 105 || item_id > 109) && item_id != 525 && item_id != 530 && item_id != 547 && item_id != 548 && item_id != 550 ) return result; - switch ( a2 ) + switch ( item_id ) { case 525: - a2 = 325; + item_id = 325; break; case 530: - a2 = 330; + item_id = 330; break; case 547: - a2 = 347; + item_id = 347; break; case 548: - a2 = 348; + item_id = 348; break; case 550: - a2 = 350; + item_id = 350; break; } - v8 = a3; - v7 = a2; - if ( !a4 ) - goto LABEL_88; -LABEL_91: - v6 = "item%3.3dv%da1"; - return sprintf(a1, v6, v7, v8); - } - if ( a2 == 521 ) - { - a2 = 239; - goto LABEL_87; - } - if ( a2 == 522 ) - { - a2 = 240; - goto LABEL_87; - } - if ( a2 == 523 ) - { - a2 = 241; - goto LABEL_87; - } - if ( a2 != 532 ) - { - if ( a2 == 544 ) - a2 = 344; - goto LABEL_87; - } - v9 = 93; - goto LABEL_70; - } - if ( a2 == 524 ) - { - a2 = 324; - goto LABEL_87; - } - if ( a2 == 535 ) - { - v9 = 104; -LABEL_70: - a2 = v9; - } -LABEL_87: - v8 = a3; - v7 = a2; -LABEL_88: - v6 = "item%3.3dv%d"; - return sprintf(a1, v6, v7, v8); - } - } - if ( a2 != 516 ) - { - switch ( a2 ) + if ( !shoulder ) + return sprintf(pOut, "item%3.3dv%d", item_id, index); + return sprintf(pOut, "item%3.3dv%da1", item_id, index); + } + if ( item_id == 521 ) + return sprintf(pOut, "item%3.3dv%d", 239, index); + if ( item_id == 522 ) + return sprintf(pOut, "item%3.3dv%d", 240, index); + if ( item_id == 523 ) + return sprintf(pOut, "item%3.3dv%d", 241, index); + if ( item_id != 532 ) + { + if ( item_id == 544 ) + item_id = 344; + return sprintf(pOut, "item%3.3dv%d", item_id, index); + } + return sprintf(pOut, "item%3.3dv%d", 93, index); + } + if ( item_id == 524 ) + return sprintf(pOut, "item%3.3dv%d", 324, index); + if ( item_id == 535 ) + item_id = 104; + return sprintf(pOut, "item%3.3dv%d", item_id, index); + } + } + if ( item_id != 516 ) + { + switch ( item_id ) { case 504: - a2 = 235; + item_id = 235; break; case 505: - a2 = 236; + item_id = 236; break; case 533: - a2 = 73; + item_id = 73; break; } -LABEL_86: - if ( a4 ) - { - if ( a4 != 1 ) - { - if ( a4 != 2 ) - return result; - v8 = a3; - v7 = a2; - v6 = "item%3.3dv%da2"; - return sprintf(a1, v6, v7, v8); - } - v8 = a3; - v7 = a2; - goto LABEL_91; - } - goto LABEL_87; - } -LABEL_79: - a2 = 234; - goto LABEL_86; - } - result = a2 - 504; - switch ( a2 ) - { - case 516: - v5 = byte_5111F6[2] == 0; - goto LABEL_21; - case 505: - v5 = byte_5111F6[1] == 0; - goto LABEL_21; - case 504: - v5 = byte_5111F6[0] == 0; - goto LABEL_21; - case 533: - v5 = byte_5111F6[16] == 0; - goto LABEL_21; - case 512: - v5 = byte_5111F6[3] == 0; - goto LABEL_21; - case 521: - v5 = byte_5111F6[4] == 0; - goto LABEL_21; - case 522: - v5 = byte_5111F6[5] == 0; - goto LABEL_21; - case 523: - v5 = byte_5111F6[6] == 0; - goto LABEL_21; - case 532: - v5 = byte_5111F6[7] == 0; - goto LABEL_21; - case 544: - v5 = byte_5111F6[8] == 0; - goto LABEL_21; - case 524: - v5 = byte_5111F6[9] == 0; - goto LABEL_21; - case 535: - v5 = byte_5111F6[10] == 0; - goto LABEL_21; - case 525: - v5 = byte_5111F6[11] == 0; - goto LABEL_21; - case 530: - v5 = byte_5111F6[12] == 0; - goto LABEL_21; - case 547: - v5 = byte_5111F6[13] == 0; - goto LABEL_21; - case 548: - v5 = byte_5111F6[14] == 0; - goto LABEL_21; - case 550: - v5 = byte_5111F6[15] == 0; - goto LABEL_21; - default: - return result; - } + if ( !shoulder ) + return sprintf(pOut, "item%3.3dv%d", item_id, index); + if ( shoulder == 1 ) + return sprintf(pOut, "item%3.3dv%da1", item_id, index); + if ( shoulder == 2 ) + return sprintf(pOut, "item%3.3dv%da2", item_id, index); + } + if ( !shoulder ) + return sprintf(pOut, "item%3.3dv%d", 234, index); + if ( shoulder == 1 ) + return sprintf(pOut, "item%3.3dv%da1", 234, index); + if ( shoulder == 2 ) + return sprintf(pOut, "item%3.3dv%da2", 234, index); + } + result = item_id - 504; return result; } @@ -6280,55 +6250,28 @@ // A750D8: using guessed type __int64 qword_A750D8; //----- (0043EE15) -------------------------------------------------------- -bool __fastcall sub_43EE15_player_has_item(unsigned int uItemID, Player *pPlayer, char a3) -{ - bool result; // eax@0 - signed int v4; // edi@3 - int *v5; // esi@3 - signed int v6; // edi@7 - bool *v7; // esi@7 - +bool __fastcall Player_has_item(unsigned int uItemID, Player *pPlayer, char a3) +{ if ( !a3 || pParty->pPickedItem.uItemID != uItemID ) { - v4 = 0; - v5 = pPlayer->pInventoryIndices; - while ( 1 ) - { - if ( *v5 ) - { - result = 9 * *v5; - if ( *(int *)&pPlayer->pInventoryItems[*v5-1] == uItemID ) - break; - } - ++v4; - ++v5; - if ( v4 >= 126 ) - { - v6 = 0; - v7 = (bool *)&pPlayer->pEquipment; - while ( 1 ) - { - result = *v7; - if ( *v7 ) - { - result *= 9; - if ( *(int *)&pPlayer->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] == uItemID ) - break; - } - ++v6; - ++v7; - if ( v6 >= 16 ) - { - LOBYTE(result) = 0; - return result; - } - } - break; - } - } - } - LOBYTE(result) = 1; - return result; + for ( uint i = 0; i < 126; ++i ) + { + if ( pPlayer->pInventoryIndices[i] > 0 ) + { + if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pInventoryIndices[i] - 1].uItemID == uItemID ) + return true; + } + } + for ( uint i = 0; i < 16; ++i ) + { + if ( pPlayer->pEquipment.pIndices[i] ) + { + if ( (unsigned int)pPlayer->pInventoryItems[pPlayer->pEquipment.pIndices[i] - 1].uItemID == uItemID ) + return true; + } + } + } + return false; } //----- (0043EE77) -------------------------------------------------------- @@ -6349,10 +6292,10 @@ v5 = 604; while ( 1 ) { - result = sub_43EE15_player_has_item(v5, *pPlayers, 0); + result = Player_has_item(v5, *pPlayers, 0); if ( !result ) break; - result = v6->pEquipment.uBody; + result = v6->pEquipment.uArmor; if ( !result ) break; result *= 9; @@ -6365,9 +6308,9 @@ } goto LABEL_6; } - result = sub_43EE15_player_has_item(604u, ::pPlayers[a1], 0); + result = Player_has_item(604u, ::pPlayers[a1], 0); if ( !result - || (result = v2->pEquipment.uBody) == 0 + || (result = v2->pEquipment.uArmor) == 0 || (result *= 9, *(int *)&v2->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5] != v3) ) { LABEL_6: @@ -10782,7 +10725,7 @@ sub_4606FE(); break; } - case WINDOW_1F: + case WINDOW_CastSpell_InInventory: { pRenderer->ClearZBuffer(0, 479); draw_leather(); diff -r 6daea87a3fe3 -r 23655ae9cd18 mm7_data.cpp --- a/mm7_data.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/mm7_data.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -287,9 +287,37 @@ 0x83, 0xD8, 0x1D, 0xBA, 0x58, 0x77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x7B, 0xD8, 0x23, 0xB8, 0x62, 0x77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -stru332 stru_511698[2]; -stru333 stru_511718[4]; -stru334 array_4E2940[26]; +int paperdoll_helm_texture[2][16]; +int paperdoll_belt_texture[2][7]; +stat_coord stat_string_coord[26] = //0x4E2940 +{ + {0x1A, 0x39, 0xDC, 0x12}, + {0x1A, 0x4A, 0xDC, 0x12}, + {0x1A, 0x5B, 0xDC, 0x12}, + {0x1A, 0x6C, 0xDC, 0x12}, + {0x1A, 0x7D, 0xDC, 0x12}, + {0x1A, 0x8E, 0xDC, 0x12}, + {0x1A, 0x9F, 0xDC, 0x12}, + {0x1A, 0xC6, 0xDC, 0x12}, + {0x1A, 0xD7, 0xDC, 0x12}, + {0x1A, 0xE8, 0xDC, 0x12}, + {0x1A, 0x10C, 0xDC, 0x12}, + {0x1A, 0x11E, 0xDC, 0x12}, + {0x111, 0x36, 0xBA, 0x12}, + {0x111, 0x47, 0xBA, 0x12}, + {0x111, 0x58, 0xBA, 0x12}, + {0x111, 0x7E, 0xBA, 0x12}, + {0x111, 0x8F, 0xBA, 0x12}, + {0x111, 0xA0, 0xBA, 0x12}, + {0x111, 0xB1, 0xBA, 0x12}, + {0x111, 0xCA, 0xBA, 0x12}, + {0x111, 0xDD, 0xBA, 0x12}, + {0x111, 0xF0, 0xBA, 0x12}, + {0x111, 0x103, 0xBA, 0x12}, + {0x111, 0x116, 0xBA, 0x12}, + {0x111, 0x129, 0xBA, 0x12}, + {0x13E, 0x12, 0x89, 0x12}, +}; stru348 stru_4E1890[13]; @@ -488,7 +516,7 @@ }; // weak __int16 RightClickPortraitXmin[4]={0x14, 0x83, 0xF2, 0x165}; __int16 RightClickPortraitXmax[4]={0x53, 0xC6, 0x138, 0x1A7}; -void *off_4E2A12; // weak +void *off_4E2A12; // stat_string_control_button_count int pArmorSkills[5]={ 9, 10, 11, 8, 30}; int pWeaponSkills[9]={3, 5, 2, 6, 4, 0, 1, 31, 7}; int pMiscSkills[12]={35, 33, 24, 21, 32, 36, 29, 25, 22, 26, 23, 34}; @@ -549,7 +577,7 @@ //const char *format_4E2DC8 = "\f%05d"; char aS[777]; // idb char aLuSLuS[777]; // idb -char byte_4E2DE8; // idb +const char *format_4E2DE8 = "\f%05d%s\f00000 - "; char asc_4E2DFC[3]; // idb const char *format_4E2E00 = "%s\f%05u\xD\r180%s\n"; // idb const char *format_4E2E10 = "%s\f%05u\t110%d\f00000 / %d\n"; @@ -692,7 +720,13 @@ 0x72, 0x91, 0x72, 0x91, 0, 0, 0x6E, 0x92, 0x6F, 0x91, 0, 0, 0, 0, 0x6E, 0x91, 0x71, 0x90, 0x72, 0x8D, 0x72, 0x90, 0x73, 0x93, 0x73, 0x90, 0x6F, 0x91, 0x73, 0x90, 0x72, 0x8D, 0x6E, 0x91, }; -int dword_4E5270[8]; +int dword_4E5270[4][2] = +{ + 0, 0, + 0x61, 0x67, + 0, 0, + 0x64, 0x69, +}; int paperdoll_Boot[4][7][2] = //4E5490 { 0xE, 0x11D, 0xD, 0x11D, 0xC, 0x10A, 0xA, 0xFF, 0xD, 0xF9, 0xD, 0x137, 0xC, 0x10E, @@ -707,7 +741,13 @@ 0x10, 0x8A, 0x9, 0x8B, 0x18, 0x98, 0x25, 0x91, 0x29, 0x90, 0x8, 0x8A, 0x9, 0x8B, 0x18, 0x98, 0x3, 0x91, 0x3, 0x90, 0x14, 0x92, 0x10, 0x92, 0x15, 0x98, 0x1F, 0x91, 0x22, 0x90, 0x8, 0x92, 0xC, 0x92, 0x15, 0x98, 0x3, 0x91, 0x3, 0x90, }; -int dword_4E56B0[64][2]; // weak +int paperdoll_CloakCollar[4][10][2] = //0x4E56B0 +{ + 0x11, 0x68, 0x34, 0x64, 0x21, 0x69, 0x1D, 0x67, 0x20, 0x67, 0x21, 0x68, 0x34, 0x64, 0x21, 0x69, 0x1D, 0x67, 0x1F, 0x67, + 0x13, 0x64, 0x35, 0x66, 0x29, 0x68, 0x1F, 0x68, 0x1F, 0x6A, 0x21, 0x6A, 0x2B, 0x66, 0x26, 0x68, 0x1F, 0x68, 0x1F, 0x6A, + 0, 0, 0x30, 0x87, 0x1E, 0x86, 0x1B, 0x86, 0x1C, 0x8A, 0x21, 0x87, 0x30, 0x87, 0x1E, 0x86, 0x1B, 0x86, 0x1C, 0x8A, + 0, 0, 0x38, 0x8A, 0x24, 0x8B, 0x1D, 0x8B, 0x21, 0x8C, 0x27, 0x8A, 0x34, 0x8A, 0x24, 0x8B, 0x25, 0x8B, 0x21, 0x8C, +}; //int dword_4E56B4; // weak int paperdoll_Belt[4][7][2] = //0x4E57F0 { @@ -716,7 +756,13 @@ 0x3B, 0xD5, 0x37, 0xD2, 0x31, 0xD5, 0x39, 0xD6, 0x37, 0xD8, 0x37, 0xD1, 0x37, 0xD8, 0x42, 0xD2, 0x3F, 0xD0, 0x3B, 0xD7, 0x3C, 0xD5, 0x3B, 0xD6, 0x3E, 0xCF, 0x36, 0xD6, }; -int paperdoll_Helm[64][2]; // HelmX 62 maybe array??? +int paperdoll_Helm[4][16][2] = //0x4E58D0 +{ + 0x3E, 0x1F, 0x41, 0x2C, 0x37, 0x2F, 0x31, 0x32, 0x37, 0x2A, 0x39, 0x28, 0x36, 0x34, 0x41, 0x38, 0x40, 0x31, 0x40, 0x21, 0x40, 0x31, 0x3C, 0x33, 0x3D, 0x24, 0x3A, 0x1A, 0x37, 0x2A, 0x41, 0x48, + 0x41, 0x1E, 0x42, 0x2B, 0x37, 0x2F, 0x34, 0x30, 0x39, 0x29, 0x3A, 0x26, 0x36, 0x34, 0x41, 0x37, 0x42, 0x32, 0x40, 0x21, 0x40, 0x31, 0x40, 0x2F, 0x3E, 0x22, 0x3B, 0x1A, 0x39, 0x29, 0x42, 0x47, + 0x3F, 0x47, 0x41, 0x56, 0x37, 0x59, 0x32, 0x5E, 0x37, 0x58, 0x39, 0x54, 0x34, 0x61, 0x40, 0x61, 0x41, 0x5D, 0x3E, 0x4F, 0x3E, 0x5B, 0x3D, 0x5B, 0x3F, 0x4C, 0x3B, 0x45, 0x37, 0x58, 0x41, 0x74, + 0x45, 0x45, 0x46, 0x54, 0x3A, 0x55, 0x38, 0x58, 0x3C, 0x54, 0x3F, 0x52, 0x39, 0x5B, 0x45, 0x5C, 0x47, 0x5C, 0x44, 0x4B, 0x44, 0x57, 0x43, 0x55, 0x44, 0x4A, 0x3E, 0x45, 0x3C, 0x54, 0x47, 0x70, +}; //int dword_4E58D4[777]; // HelmY 31 int pPaperdoll_Beards[4] = //0x4E5AD0 { @@ -737,14 +783,20 @@ 0x19, 0x8D, 0x20, 0x92, }; -int pPaperdoll_RightHand[8] = //fist +int pPaperdoll_RightHand[4][2] = //fist { 0x1E, 0x90, 0x22, 0x9E, 0x19, 0xBA, 0x1F, 0xB8, }; -int pPaperdollLeftEmptyHand[8]; +int pPaperdollLeftEmptyHand[4][2] = //0x4E5B40 +{ + 0x80, 0xCD, + 0x83, 0xC9, + 0x83, 0xD8, + 0x7B, 0xD8, +}; int pPaperdollRingsX[6] = {0x1EA, 0x21A, 0x248, 0x1EA, 0x21A, 0x248}; int pPaperdollRingsY[6] = {0x0CA, 0x0CA, 0x0CA, 0x0FA, 0x0FA, 0x0FA}; char aItem092v3[777]; // idb @@ -1616,25 +1668,26 @@ Vec3_int_ layingitem_vel_50FDFC; char pStartingMapName[777]; // idb unsigned __int8 IsPlayerWearingWatersuit[5]; -char byte_5111C0[54]; +char party_has_equipment[54]; char byte_5111F6[16]; unsigned int papredoll_dbrds[16]; unsigned int papredoll_drhs[4]; unsigned int papredoll_dlhus[4]; unsigned int papredoll_dlhs[4]; unsigned int papredoll_dbods[5]; -int paperdoll_array_511290[4][17][3]; +int paperdoll_armor_texture[4][17][3]; +//int paperdoll_array_51132C[165]; unsigned int papredoll_dlaus[5]; unsigned int papredoll_dlads[4]; int papredoll_flying_feet[777]; // idb -int dword_511638[4][6]; -int dword_511788[777]; // weak -int dword_51179C; // weak -int dword_5117A0; // weak -int dword_5117A4; // weak -int dword_5117A8; // weak -int dword_5117AC; // weak -int paperdoll_array_511828[4][10]; +int paperdoll_boots_texture[4][6];//0x511638 +int paperdoll_cloak_collar_texture[4][10]; // weak +//int dword_51179C; // weak +//int dword_5117A0; // weak +//int dword_5117A4; // weak +//int dword_5117A8; // weak +//int dword_5117AC; // weak +int paperdoll_cloak_texture[4][10]; int bRingsShownInCharScreen; // weak int _unused000; // weak diff -r 6daea87a3fe3 -r 23655ae9cd18 mm7_data.h --- a/mm7_data.h Fri Apr 19 18:11:01 2013 +0600 +++ b/mm7_data.h Fri Apr 19 18:11:28 2013 +0600 @@ -487,7 +487,7 @@ //extern const char *format_4E2DC8; extern char aS[]; // idb extern char aLuSLuS[]; // idb -extern char byte_4E2DE8; // idb +extern const char *format_4E2DE8; // idb extern char asc_4E2DFC[3]; // idb extern const char *format_4E2E00; // idb extern const char *format_4E2E10; // format text of resistance in Stats screen @@ -603,20 +603,20 @@ extern int pPaperdoll_BodyY; // weak extern int paperdoll_Armor[4][17][2]; extern int paperdoll_shoulder[4][17][2]; -extern int dword_4E5270[8]; +extern int dword_4E5270[4][2]; extern int paperdoll_Boot[4][7][2]; extern int paperdoll_Cloak[4][10][2]; -extern int dword_4E56B0[64][2]; // weak +extern int paperdoll_CloakCollar[4][10][2]; //extern int dword_4E56B4; // weak extern int paperdoll_Belt[4][7][2]; -extern int paperdoll_Helm[64][2]; // weak +extern int paperdoll_Helm[4][16][2]; //extern int dword_4E58D4[]; // weak extern int pPaperdoll_Beards[4]; // weak extern int dword_4E5AD4[]; // weak extern int pPaperdoll_LeftHand[4][2]; extern int pPaperdoll_SecondLeftHand[4][2]; -extern int pPaperdoll_RightHand[8]; -extern int pPaperdollLeftEmptyHand[8]; +extern int pPaperdoll_RightHand[4][2]; +extern int pPaperdollLeftEmptyHand[4][2]; extern int pPaperdollRingsX[6]; extern int pPaperdollRingsY[6]; extern char aItem092v3[]; // idb @@ -1088,25 +1088,26 @@ extern Vec3_int_ layingitem_vel_50FDFC; extern char pStartingMapName[]; // idb extern unsigned __int8 IsPlayerWearingWatersuit[5]; -extern char byte_5111C0[54]; +extern char party_has_equipment[54]; extern char byte_5111F6[]; extern unsigned int papredoll_dbrds[16]; extern unsigned int papredoll_drhs[4]; extern unsigned int papredoll_dlhus[4]; extern unsigned int papredoll_dlhs[4]; extern unsigned int papredoll_dbods[5]; -extern int paperdoll_array_511290[4][17][3]; +extern int paperdoll_armor_texture[4][17][3];//0x511290 +//extern int paperdoll_array_51132C[165]; extern unsigned int papredoll_dlaus[5]; extern unsigned int papredoll_dlads[4]; extern int papredoll_flying_feet[]; // idb -extern int dword_511638[4][6]; -extern int dword_511788[]; // weak -extern int dword_51179C; // weak -extern int dword_5117A0; // weak -extern int dword_5117A4; // weak -extern int dword_5117A8; // weak -extern int dword_5117AC; // weak -extern int paperdoll_array_511828[4][10]; +extern int paperdoll_boots_texture[4][6]; +extern int paperdoll_cloak_collar_texture[4][10]; // weak +//extern int dword_51179C; // weak +//extern int dword_5117A0; // weak +//extern int dword_5117A4; // weak +//extern int dword_5117A8; // weak +//extern int dword_5117AC; // weak +extern int paperdoll_cloak_texture[4][10]; extern int bRingsShownInCharScreen; // weak extern int _unused000; // weak @@ -1733,12 +1734,12 @@ // int __cdecl crt_deconstruct_43B9E3(); int __stdcall DirectInputMouse_enumerator(int, int); // weak void CharacterUI_LoadPaperdollTextures(); -int __fastcall _43C91D_FormItemTextureFilename(char *a1, signed int a2, int a3, int a4); +int __fastcall GetItemTextureFilename(char *pOut, signed int item_id, int index, int shoulder); void __fastcall CharacterUI_DrawPaperdoll(unsigned int uPlayerID); // idb void __fastcall CharacterUI_DrawPaperdollWithRingOverlay(unsigned int uPlayerID); // idb bool _43ED6F_check_party_races(bool b); bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int _this); -bool __fastcall sub_43EE15_player_has_item(unsigned int uItemID, struct Player *pPlayer, char a3); +bool __fastcall Player_has_item(unsigned int uItemID, struct Player *pPlayer, char a3); bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1); void __fastcall WetsuitOn(unsigned int uPlayerID); // idb unsigned int __fastcall WetsuitOff(unsigned int uPlayerID); diff -r 6daea87a3fe3 -r 23655ae9cd18 stru6.cpp --- a/stru6.cpp Fri Apr 19 18:11:01 2013 +0600 +++ b/stru6.cpp Fri Apr 19 18:11:28 2013 +0600 @@ -1298,7 +1298,7 @@ switch (uSpellID) { case SPELL_153: - __debugbreak(); // spell id == 153 wtf , curse probably ? happening when attacked by harpies + __debugbreak(); // spell id == 153 wtf , curse probably ? happening when attacked by harpies /disease(Ritor1)/ v6 = "zapp"; break;