Mercurial > mm7
changeset 506:9b4bdf6089af
Слияние
author | Ritor1 |
---|---|
date | Tue, 26 Feb 2013 18:48:05 +0600 |
parents | 81410c3feebc (current diff) 5b6e2021c6fe (diff) |
children | 542ea7a55b17 |
files | Player.cpp mm7_4.cpp |
diffstat | 14 files changed, 1607 insertions(+), 1868 deletions(-) [+] |
line wrap: on
line diff
--- a/Events.cpp Tue Feb 26 18:47:30 2013 +0600 +++ b/Events.cpp Tue Feb 26 18:48:05 2013 +0600 @@ -26,6 +26,7 @@ #include "Events2D.h" #include "Weather.h" #include "Party.h" +#include "MM7.h" @@ -607,7 +608,7 @@ sub_4BD8B5(); window_SpeakInHouse->Release(); pParty->uFlags &= 0xFFFFFFFDu; - if ( EnterHouse((enum HOUSE_TYPE)170) ) + if ( EnterHouse(HOUSE_DARK_GUILD_PIT) ) { pAudioPlayer->StopChannels(-1, -1); window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 170, 0); @@ -722,7 +723,7 @@ window_SpeakInHouse->Release(); pParty->uFlags &= 0xFFFFFFFDu; GlobalEventInfo = 1; - if ( EnterHouse((enum HOUSE_TYPE)165) ) + if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) { pAudioPlayer->PlaySound((SoundID)0, 0, 0, -1, 0, 0, 0, 0); v47 = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0); @@ -837,7 +838,7 @@ { ++curr_seq_num; v4 = v124; - + //v6 = v123; //v7 = ""; break; @@ -1536,7 +1537,7 @@ //v7 = ""; break; case EVENT_SpeakInHouse: - if ( EnterHouse((enum HOUSE_TYPE)(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8))) ) + if ( EnterHouse((enum HOUSE_ID)(_evt->v5 + ((_evt->v6 + ((_evt->v7 + ((uint)_evt->v8 << 8)) << 8)) << 8))) ) { if ( pRenderer->pRenderD3D && !pRenderer->bWindowMode ) pRenderer->_49FD3A();
--- a/GUIWindow.cpp Tue Feb 26 18:47:30 2013 +0600 +++ b/GUIWindow.cpp Tue Feb 26 18:48:05 2013 +0600 @@ -1070,9 +1070,9 @@ v18.uFrameZ += 8; if ( !pDialogueNPCCount ) { - if ( dword_F8B198 == 31 ) + if ( in_current_bilding_type == BildingType_Jail ) { - sub_4B4F4F(); + JailDialog(); goto LABEL_58; } if ( ptr_F8B1E8 ) @@ -1151,73 +1151,62 @@ //p2DEvents_minus1__10[13 * (unsigned int)ptr_507BC0->ptr_1C]); p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].pProprieterTitle); v18.DrawTitleText(pFontCreate, 0x1E3u, 0x71u, v19, pTmpBuf, 3u); - if ( dword_F8B198 <= 18 ) - { - switch ( dword_F8B198 ) + switch ( in_current_bilding_type ) { - case 18: - sub_4B6478(); - break; - case 1: + case BildingType_WeaponShop: WeaponShopDialog(); break; - case 2: + case BildingType_ArmorShop: ArmorShopDialog(); break; - case 3: + case BildingType_MagicShop: MagicShopDialog(); break; - case 4: + case BildingType_AlchemistShop: AlchemistDialog(); break; + 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_Dark: + //case BildingType_14: + //case BildingType_15: + //case BildingType_16: + GuildDialog(); + break; + case BildingType_18: + __debugbreak; //What over the dialog? + sub_4B6478(); + break; + case BildingType_TownHall: + TownHallDialog(); + break; + case BildingType_Tavern: + TavernDialog(); + break; + case BildingType_Bank: + BankDialog(); + break; + case BildingType_Temple: + TampleDialog(); + break; + case BildingType_Stables: + TravelByTransport(); + break; + case BildingType_Training: + TrainingDialog(); + break; + case BildingType_Jail: + JailDialog(); + break; default: - if ( dword_F8B198 > 4 ) - { - if ( dword_F8B198 <= 16 ) - { - GuildDialog(); - } - else - { - if ( dword_F8B198 == 17 ) - sub_4B7911(); - } - } break; } - goto LABEL_58; - } - switch ( dword_F8B198 ) - { - case 21: - TavernDialog(); - break; - case 22: - _4B7D7E_bank(); - break; - case 23: - TampleDialog(); - break; - default: - if ( dword_F8B198 <= 26 ) - break; - if ( dword_F8B198 <= 28 ) - { - TravelByTransport(); - } - else - { - if ( dword_F8B198 != 30 ) - { - if ( dword_F8B198 != 31 ) - break; - sub_4B4F4F(); - goto LABEL_58; - } - TrainingDialog(); - } - break; - } } LABEL_58: if ( pDialogueNPCCount == uNumDialogueNPCPortraits && uHouse_ExitPic ) @@ -1233,8 +1222,8 @@ //----- (004B1854) -------------------------------------------------------- -char *GUIWindow::_4B1854(__int64 a2) -{ +void GUIWindow::DrawCurrentTime( __int64 a2 ) + { unsigned int v2; // edi@1 unsigned int v3; // esi@1 unsigned int v4; // ebp@1 @@ -1263,7 +1252,7 @@ v16 = (signed __int64)__PAIR__(v4, v5) % 60; v7 = v6 % 24; strcpy(pTmpBuf, pGlobalTXT_LocalizationStrings[532]); - if ( (unsigned int)v6 / 0x18 ) + if ( (unsigned int)v6 /24 ) { v8 = pGlobalTXT_LocalizationStrings[57]; if ( v18 <= 1 ) @@ -1283,24 +1272,24 @@ if ( v16 && !v18 ) { if ( v16 <= 1 ) - v10 = pGlobalTXT_LocalizationStrings[437]; + v10 = pGlobalTXT_LocalizationStrings[437];//"Minute" else - v10 = pGlobalTXT_LocalizationStrings[436]; + v10 = pGlobalTXT_LocalizationStrings[436]; //"Minutes" sprintf(pTmpBuf2, "%d %s ", v16, v10); strcat(pTmpBuf, pTmpBuf2); } if ( v17 && !v7 ) { if ( v17 <= 1 ) - v11 = pGlobalTXT_LocalizationStrings[439]; + v11 = pGlobalTXT_LocalizationStrings[439]; //"Second" else - v11 = pGlobalTXT_LocalizationStrings[438]; + v11 = pGlobalTXT_LocalizationStrings[438]; //"Seconds" sprintf(pTmpBuf2, "%d %s ", v17, v11); strcat(pTmpBuf, pTmpBuf2); } v12 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); v13 = pFontArrus->CalcTextHeight(pTmpBuf, v15, 0, 0); - return v15->DrawTitleText(pFontArrus, 0, (212 - v13) / 2 + 101, v12, pTmpBuf, 3u); + v15->DrawTitleText(pFontArrus, 0, (212 - v13) / 2 + 101, v12, pTmpBuf, 3u); }
--- a/GUIWindow.h Tue Feb 26 18:47:30 2013 +0600 +++ b/GUIWindow.h Tue Feb 26 18:48:05 2013 +0600 @@ -114,7 +114,7 @@ char DrawText(GUIFont *a2, signed int uX, int uY, unsigned int uFontColor, const char *Str, int a7, int a8, unsigned int uFontShadowColor); char *DrawTitleText(GUIFont *a2, unsigned int uHorizontalMargin, unsigned int uVerticalMargin, unsigned __int16 uDefaultColor, const char *pInString, unsigned int uLineSpacing); - char *_4B1854(__int64 a2); + void DrawCurrentTime(__int64 a2); void HouseDialogManager(); void OpenSpellBook(); void InitializeBookView(); @@ -157,6 +157,38 @@ /* 296 */ +enum BildingType +{ + BildingType_WeaponShop = 0x1, + BildingType_ArmorShop = 0x2, + BildingType_MagicShop = 0x3, + BildingType_AlchemistShop = 0x4, + BildingType_FireGuild = 0x5, + BildingType_AirGuild = 0x6, + BildingType_WaterGuild = 0x7, + BildingType_EarthGuild = 0x8, + BildingType_SpiritGuild = 0x9, + BildingType_MindGuild = 0xA, + BildingType_BodyGuild = 0xB, + BildingType_LightGuild = 0xC, + BildingType_Dark = 0xD, + BildingType_14 = 0xE, + BildingType_15 = 0xF, + BildingType_16 = 0x10, + BildingType_TownHall = 0x11, + BildingType_18 = 0x12, + BildingType_19 = 0x13, + BildingType_20 = 0x14, + BildingType_Tavern = 0x15, + BildingType_Bank = 0x16, + BildingType_Temple = 0x17, + BildingType_1A = 0x1A, + BildingType_Stables = 0x1B, + BildingType_Boats = 0x1C, + BildingType_House = 0x1D, + BildingType_Training = 0x1E, + BildingType_Jail = 0x1F, +}; enum UIMessageType { UIMSG_00 = 0x0,
--- a/Indoor.cpp Tue Feb 26 18:47:30 2013 +0600 +++ b/Indoor.cpp Tue Feb 26 18:48:05 2013 +0600 @@ -3482,40 +3482,40 @@ //----- (0046F228) -------------------------------------------------------- void __cdecl BLV_UpdateDoors() { - int v0; // ebx@1 - int v1; // edi@1 - BLVDoor *v2; // esi@3 - unsigned __int16 v3; // ax@3 - unsigned int v4; // ecx@5 - int v5; // eax@8 - int v6; // ecx@8 - int v7; // eax@12 - int v8; // eax@16 - unsigned __int8 v9; // zf@18 - char v10; // sf@18 - unsigned __int8 v11; // of@18 - int v12; // edi@19 - int v13; // ecx@19 - __int16 v14; // ax@19 + //int v0; // ebx@1 + //int v1; // edi@1 + //BLVDoor *v2; // esi@3 + //unsigned __int16 v3; // ax@3 + //unsigned int v4; // ecx@5 + //int v5; // eax@8 + //int v6; // ecx@8 + //int v7; // eax@12 + //int v8; // eax@16 + //unsigned __int8 v9; // zf@18 + //char v10; // sf@18 + //unsigned __int8 v11; // of@18 + //int v12; // edi@19 + //int v13; // ecx@19 + //__int16 v14; // ax@19 BLVFace *v15; // ebx@24 - unsigned __int16 *v16; // ecx@24 + //unsigned __int16 *v16; // ecx@24 Vec3_short_ *v17; // esi@24 int v18; // eax@24 int v19; // edx@24 signed int v20; // eax@24 - Vec3_short_ *v21; // ecx@24 - double v22; // st7@24 - double v23; // st6@24 + //Vec3_short_ *v21; // ecx@24 + //double v22; // st7@24 + //double v23; // st6@24 int v24; // esi@25 int v25; // eax@25 - BLVDoor *v26; // edi@25 + //BLVDoor *v26; // edi@25 signed __int64 v27; // qtt@27 BLVFaceExtra *v28; // esi@32 int v29; // ecx@34 int v30; // edx@34 unsigned __int64 v31; // qax@34 int v32; // eax@34 - unsigned __int16 *v33; // eax@35 + //unsigned __int16 *v33; // eax@35 Vec3_short_ *v34; // eax@35 int v35; // ecx@35 int v36; // edx@35 @@ -3523,291 +3523,298 @@ signed int v38; // edx@35 int v39; // eax@35 int v40; // edx@35 - unsigned __int8 v41; // cf@35 - unsigned __int16 *v42; // edi@36 + //unsigned __int8 v41; // cf@35 + //unsigned __int16 *v42; // edi@36 Vec3_short_ *v43; // edi@36 - int v44; // ecx@36 - int v45; // edi@36 - int v46; // ecx@36 - __int16 *v47; // edx@44 - int v48; // ecx@44 + //int v44; // ecx@36 + //int v45; // edi@36 + //int v46; // ecx@36 + //__int16 *v47; // edx@44 + //int v48; // ecx@44 unsigned int v49; // ecx@46 unsigned __int16 v50; // ax@48 unsigned int v51; // eax@51 unsigned __int16 v52; // ax@54 int v53; // ecx@57 - int v54; // edx@57 + //int v54; // edx@57 unsigned __int64 v55; // qax@57 int v56; // ecx@58 int v57; // eax@58 - int v58; // eax@59 - SoundID v59; // [sp-24h] [bp-88h]@12 - signed int v60; // [sp-20h] [bp-84h]@12 - unsigned int v61; // [sp-1Ch] [bp-80h]@12 - signed int v62; // [sp-18h] [bp-7Ch]@12 - signed int v63; // [sp-14h] [bp-78h]@12 - int v64; // [sp-10h] [bp-74h]@12 - unsigned int v65; // [sp-Ch] [bp-70h]@12 - int v66; // [sp-8h] [bp-6Ch]@12 - int v67; // [sp+8h] [bp-5Ch]@31 - int v68; // [sp+Ch] [bp-58h]@34 - int v69; // [sp+10h] [bp-54h]@34 - int v70; // [sp+14h] [bp-50h]@31 - int v71; // [sp+18h] [bp-4Ch]@34 - int v72; // [sp+1Ch] [bp-48h]@34 + //int v58; // eax@59 + //SoundID v59; // [sp-24h] [bp-88h]@12 + //signed int v60; // [sp-20h] [bp-84h]@12 + //unsigned int v61; // [sp-1Ch] [bp-80h]@12 + //signed int v62; // [sp-18h] [bp-7Ch]@12 + //signed int v63; // [sp-14h] [bp-78h]@12 + //int v64; // [sp-10h] [bp-74h]@12 + //unsigned int v65; // [sp-Ch] [bp-70h]@12 + //int v66; // [sp-8h] [bp-6Ch]@12 + Vec3_int_ v67; + //int v67; // [sp+8h] [bp-5Ch]@31 + //int v68; // [sp+Ch] [bp-58h]@34 + //int v69; // [sp+10h] [bp-54h]@34 + Vec3_int_ v70; + //int v70; // [sp+14h] [bp-50h]@31 + //int v71; // [sp+18h] [bp-4Ch]@34 + //int v72; // [sp+1Ch] [bp-48h]@34 int v73; // [sp+20h] [bp-44h]@24 - __int16 v74; // [sp+24h] [bp-40h]@24 + //__int16 v74; // [sp+24h] [bp-40h]@24 int v75; // [sp+28h] [bp-3Ch]@36 int v76; // [sp+2Ch] [bp-38h]@36 int v77; // [sp+30h] [bp-34h]@36 - int v78; // [sp+34h] [bp-30h]@36 - int v79; // [sp+38h] [bp-2Ch]@19 - unsigned int v80; // [sp+3Ch] [bp-28h]@2 - int v81; // [sp+40h] [bp-24h]@1 + //int v78; // [sp+34h] [bp-30h]@36 + //int v79; // [sp+38h] [bp-2Ch]@19 + //unsigned int v80; // [sp+3Ch] [bp-28h]@2 + //int v81; // [sp+40h] [bp-24h]@1 int v82; // [sp+44h] [bp-20h]@35 int v83; // [sp+48h] [bp-1Ch]@34 int v84; // [sp+4Ch] [bp-18h]@34 int v85; // [sp+50h] [bp-14h]@19 SoundID eDoorSoundID; // [sp+54h] [bp-10h]@1 - BLVDoor *v87; // [sp+58h] [bp-Ch]@3 + //BLVDoor *v87; // [sp+58h] [bp-Ch]@3 int v88; // [sp+5Ch] [bp-8h]@18 int v89; // [sp+60h] [bp-4h]@6 - v0 = 0; - v1 = 0; + //v0 = 0; + //v1 = 0; eDoorSoundID = (SoundID)pDoorSoundIDsByLocationID[dword_6BE13C_uCurrentlyLoadedLocationID]; - v81 = 0; - if ( pIndoor->uNumDoors > 0 ) + //v81 = 0; + //if ( pIndoor->uNumDoors > 0 ) + for (uint i = 0; i < pIndoor->uNumDoors; ++i) { - v80 = 0; - do - { - v2 = &pIndoor->pDoors[v80 / 0x50]; - v87 = &pIndoor->pDoors[v80 / 0x50]; - v3 = pIndoor->pDoors[v80 / 0x50].uState; - if ( v3 == (short)v0 || v3 == 2 ) + auto door = pIndoor->pDoors + i; + //v80 = 0; + //do + //{ + //v2 = &pIndoor->pDoors[v80 / 0x50]; + //v87 = &pIndoor->pDoors[v80 / 0x50]; + //v3 = door->uState; + if (door->uState == BLVDoor::Closed || door->uState == BLVDoor::Open) { - v2->uAttributes &= 0xFFFFFFFDu; + door->uAttributes &= 0xFFFFFFFDu; goto LABEL_62; } - v2->uTimeSinceTriggered += pEventTimer->uTimeElapsed; - v4 = v2->uTimeSinceTriggered; - if ( v2->uState == 1 ) + door->uTimeSinceTriggered += pEventTimer->uTimeElapsed; + //v4 = door->uTimeSinceTriggered; + if (door->uState == BLVDoor::Opening) { - v89 = (signed int)(v4 * v2->uCloseSpeed) / 128; - if ( v89 >= v2->uMoveLength ) + v89 = (signed int)(door->uTimeSinceTriggered * door->uCloseSpeed) / 128; + if ( v89 >= door->uMoveLength ) { - v89 = v2->uMoveLength; - v2->uState = BLVDoor::Open; + v89 = door->uMoveLength; + door->uState = BLVDoor::Open; LABEL_10: - if ( !(v2->uAttributes & 6) && v2->uNumVertices != (short)v0 ) + if ( !(door->uAttributes & 6) && door->uNumVertices != 0) { - v66 = v0; - v65 = v0; - v64 = v0; - v7 = 8 * v1; - v63 = v0; - v62 = -1; - LOBYTE(v7) = 8 * v1 | 1; - v61 = v0; - v60 = v7; - v59 = (SoundID)((int)eDoorSoundID + 1); -LABEL_17: - pAudioPlayer->PlaySound(v59, v60, v61, v62, v63, v64, v65, v66); - goto LABEL_18; + //v66 = 0; + //v65 = 0; + //v64 = 0; + //v7 = 8 * i | OBJECT_BLVDoor; + //v63 = 0; + //v62 = -1; + //LOBYTE(v7) = 8 * i | OBJECT_BLVDoor; + //v61 = 0; + //v60 = 8 * i | OBJECT_BLVDoor; + //v59 = (SoundID)((int)eDoorSoundID + 1); +//LABEL_17: + pAudioPlayer->PlaySound((SoundID)((int)eDoorSoundID + 1), 8 * i | OBJECT_BLVDoor, 0, -1, 0, 0, 0, 0); + //goto LABEL_18; } goto LABEL_18; } } else { - v5 = (signed int)(v4 * v2->uOpenSpeed) / 128; - v6 = v2->uMoveLength; - if ( v5 >= v6 ) + auto v5 = (signed int)(door->uTimeSinceTriggered * door->uOpenSpeed) / 128; + //v6 = door->uMoveLength; + if ( v5 >= door->uMoveLength) { - v89 = v0; - v2->uState = (BLVDoor::State)v0; + v89 = 0; + door->uState = BLVDoor::Closed; goto LABEL_10; } - v89 = v6 - v5; + v89 = door->uMoveLength - v5; } - if ( !(v2->uAttributes & 6) && v2->uNumVertices != (short)v0 ) + if ( !(door->uAttributes & 6) && door->uNumVertices) { - v66 = v0; - v65 = v0; - v64 = v0; - v8 = 8 * v1; - v63 = v0; - v62 = -1; - LOBYTE(v8) = 8 * v1 | 1; - v61 = 1; - v60 = v8; - v59 = eDoorSoundID; - goto LABEL_17; + //v66 = 0; + //v65 = 0; + //v64 = 0; + //v8 = 8 * i | OBJECT_BLVDoor; + //v63 = 0; + //v62 = -1; + //LOBYTE(v8) = 8 * v1 | 1; + //v61 = 1; + //v60 = 8 * i | OBJECT_BLVDoor; + //v59 = eDoorSoundID; + pAudioPlayer->PlaySound(eDoorSoundID, 8 * i | OBJECT_BLVDoor, 1, -1, 0, 0, 0, 0); + //goto LABEL_18; } LABEL_18: - v11 = __OFSUB__(v2->uNumVertices, (short)v0); - v9 = v2->uNumVertices == (short)v0; - v10 = (signed __int16)(v2->uNumVertices - v0) < 0; - v88 = v0; - if ( !((unsigned __int8)(v10 ^ v11) | v9) ) + //v11 = __OFSUB__(v2->uNumVertices, 0); + //v9 = v2->uNumVertices == 0; + //v10 = (signed __int16)(v2->uNumVertices - 0) < 0; + //v88 = 0; + //if (door->uNumVertices > 0) + for (uint j = 0; j < door->uNumVertices; ++j) { - do - { - v12 = v88; - v13 = v2->pVertexIDs[v88]; - v85 = v89; - v79 = v2->vDirection.x; - v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; - v13 *= 6; - *(__int16 *)((char *)&pIndoor->pVertices->x + v13) = ((unsigned int)(v79 * v89) >> 16) + v2->pXOffsets[v88]; - v85 = v89; - v79 = v2->vDirection.y; - v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; - *(__int16 *)((char *)&pIndoor->pVertices->y + v13) = ((unsigned int)(v79 * v89) >> 16) + v2->pYOffsets[v12]; - v85 = v89; - v79 = v2->vDirection.z; - v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; - v14 = ((unsigned int)(v79 * v89) >> 16) + v2->pZOffsets[v12]; - ++v88; - *(__int16 *)((char *)&pIndoor->pVertices->z + v13) = v14; - } - while ( v88 < v2->uNumVertices ); - v1 = v81; + //do + //{ + //v12 = v88; + //v13 = door->pVertexIDs[v88]; + //v85 = v89; + //v79 = door->vDirection.x; + //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; + //v13 *= 6; + pIndoor->pVertices[door->pVertexIDs[j]].x = ((unsigned int)(door->vDirection.x * v89) >> 16) + door->pXOffsets[j]; + //v85 = v89; + //v79 = door->vDirection.y; + //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; + pIndoor->pVertices[door->pVertexIDs[j]].y = ((unsigned int)(door->vDirection.y * v89) >> 16) + door->pYOffsets[j]; + //v85 = v89; + //v79 = door->vDirection.z; + //v85 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; + //v14 = ((unsigned int)(door->vDirection.z * v89) >> 16) + door->pZOffsets[j]; + pIndoor->pVertices[door->pVertexIDs[j]].z = ((unsigned int)(door->vDirection.z * v89) >> 16) + door->pZOffsets[j]; + //++v88; + //} + //while ( v88 < door->uNumVertices ); + //v1 = v81; } - v11 = __OFSUB__(v2->uNumFaces, (short)v0); - v9 = v2->uNumFaces == (short)v0; - v10 = (signed __int16)(v2->uNumFaces - v0) < 0; - v88 = v0; - if ( !((unsigned __int8)(v10 ^ v11) | v9) ) + //v11 = __OFSUB__(v2->uNumFaces, 0); + //v9 = v2->uNumFaces == 0; + //v10 = (signed __int16)(v2->uNumFaces - 0) < 0; + v88 = 0; + if (door->uNumFaces > 0) { while ( 1 ) { - v15 = &pIndoor->pFaces[v2->pFaceIDs[v88]]; - v16 = v15->pVertexIDs; - v17 = &pIndoor->pVertices[*v16]; + v15 = &pIndoor->pFaces[door->pFaceIDs[v88]]; + //v16 = v15->pVertexIDs; + v17 = &pIndoor->pVertices[v15->pVertexIDs[0]]; v18 = v15->pFacePlane_old.vNormal.y; v73 = *(int *)&v17->x; - v74 = v17->z; + //v74 = v17->z; v19 = v15->pFacePlane_old.vNormal.z; - v20 = -(v19 * v74 + (signed __int16)v73 * v15->pFacePlane_old.vNormal.x + SHIWORD(v73) * v18); + v20 = -(v19 * (int)v17->z + (signed __int16)v73 * v15->pFacePlane_old.vNormal.x + SHIWORD(v73) * v18); v15->pFacePlane_old.dist = v20; - v21 = &pIndoor->pVertices[*v16]; - v79 = v21->x; - v22 = (double)v79; - v23 = (double)v21->y; - v79 = v21->z; - v15->pFacePlane.dist = -((double)v79 * v15->pFacePlane.vNormal.z - + v23 * v15->pFacePlane.vNormal.y - + v22 * v15->pFacePlane.vNormal.x); + //v21 = &pIndoor->pVertices[v15->pVertexIDs[0]]; + //v79 = v21->x; + //v22 = (double)v21->x; + //v23 = (double)v21->y; + //v79 = v21->z; + v15->pFacePlane.dist = -((double)v17->z * v15->pFacePlane.vNormal.z + + (double)v17->y * v15->pFacePlane.vNormal.y + + (double)v17->x * v15->pFacePlane.vNormal.x); if ( v19 ) { v24 = abs(v20 >> 15); v25 = abs(v15->pFacePlane_old.vNormal.z); - v26 = v87; + //v26 = v87; if ( v24 > v25 ) Abortf( "Door Error\ndoor id: %i\nfacet no: %i\n\nOverflow dividing facet->d [%i] by facet->nz [%i]", - v87->uDoorID, - v87->pFaceIDs[v88], + door->uDoorID, + door->pFaceIDs[v88], v15->pFacePlane_old.dist, v15->pFacePlane_old.vNormal.z); - v79 = v15->pFacePlane_old.vNormal.z; - v85 = v15->pFacePlane_old.dist; - LODWORD(v27) = v85 << 16; - HIDWORD(v27) = v85 >> 16; - v85 = v27 / v79; - v15->zCalc3 = -(v27 / v79); + //v79 = v15->pFacePlane_old.vNormal.z; + //v85 = v15->pFacePlane_old.dist; + LODWORD(v27) = v15->pFacePlane_old.dist << 16; + HIDWORD(v27) = v15->pFacePlane_old.dist >> 16; + //v85 = v27 / v15->pFacePlane_old.vNormal.z; + v15->zCalc3 = -v27 / v15->pFacePlane_old.vNormal.z; } - else + /*else { v26 = v87; - } + }*/ if ( BYTE2(v15->uAttributes) & 4 || pRenderer->pRenderD3D ) - v15->_get_normals((Vec3_int_ *)&v70, (Vec3_int_ *)&v67); + v15->_get_normals(&v70, &v67); v28 = &pIndoor->pFaceExtras[v15->uFaceExtraID]; if ( !pRenderer->pRenderD3D ) { if ( !(BYTE2(v15->uAttributes) & 4) ) goto LABEL_59; - v79 = v26->vDirection.x; - v83 = (unsigned __int64)(v79 * (signed __int64)v70) >> 16; - v85 = v71; - v79 = v26->vDirection.y; - v85 = (unsigned __int64)(v79 * (signed __int64)v71) >> 16; - v84 = v72; - v79 = v26->vDirection.z; - v84 = (unsigned __int64)(v79 * (signed __int64)v72) >> 16; - v79 = v83 + v85 + ((unsigned __int64)(v79 * (signed __int64)v72) >> 16); + //v79 = door->vDirection.x; + v83 = (unsigned __int64)(door->vDirection.x * (signed __int64)v70.x) >> 16; + //v85 = v71; + //v79 = door->vDirection.y; + v85 = (unsigned __int64)(door->vDirection.y * (signed __int64)v70.y) >> 16; + //v84 = v72; + //v79 = door->vDirection.z; + v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v70.z) >> 16; + //v79 = v83 + v85 + v84; v29 = v89; - v83 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; - v28->sTextureDeltaU = -((unsigned int)(v79 * v89) >> 16); - v79 = v26->vDirection.x; - v85 = (unsigned __int64)(v79 * (signed __int64)v67) >> 16; - v83 = v68; - v79 = v26->vDirection.y; - v83 = (unsigned __int64)(v79 * (signed __int64)v68) >> 16; - v84 = v69; - v79 = v26->vDirection.z; - v84 = (unsigned __int64)(v79 * (signed __int64)v69) >> 16; - v30 = v83 + ((unsigned __int64)(v79 * (signed __int64)v69) >> 16); - v79 = v85 + v30; - v31 = (v85 + v30) * (signed __int64)v29; - v83 = v31 >> 16; + //v83 = (unsigned __int64)(v79 * (signed __int64)v89) >> 16; + v28->sTextureDeltaU = -((v83 + v85 + v84) * (signed __int64)v89) >> 16; + //v79 = door->vDirection.x; + v85 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; + //v83 = v68; + //v79 = door->vDirection.y; + v83 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; + //v84 = v69; + //v79 = door->vDirection.z; + v84 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; + //v30 = v83 + v84; + //v79 = v85 + v30; + v31 = (v85 + v83 + v84) * (signed __int64)v29; + //v83 = v31 >> 16; v32 = v31 >> 16; goto LABEL_58; } v28->sTextureDeltaU = 0; v28->sTextureDeltaV = 0; - v33 = v15->pVertexIDs; - v85 = 1; - v34 = &pIndoor->pVertices[*v33]; + //v33 = v15->pVertexIDs; + //v85 = 1; + v34 = &pIndoor->pVertices[v15->pVertexIDs[0]]; v35 = v34->z; v36 = v34->y; v82 = v34->x; - v79 = v36; - v37 = v70 * v82 + v71 * v36 + v72 * v35; - v38 = v67 * v82 + v68 * v36 + v35 * v69; + //v79 = v36; + v37 = v70.x * v82 + v70.y * v36 + v70.z * v35; + v38 = v67.x * v82 + v67.y * v36 + v67.z * v35; v39 = v37 >> 16; *v15->pVertexUIDs = v39; v40 = v38 >> 16; *v15->pVertexVIDs = v40; - v41 = v15->uNumVertices < 1u; - v9 = v15->uNumVertices == 1; - v83 = v40; + //v41 = v15->uNumVertices < 1u; + //v9 = v15->uNumVertices == 1; + //v83 = v40; v84 = v39; v82 = v40; - if ( !(v41 | v9) ) + //if (v15->uNumVertices > 1) + for (uint j = 1; j < v15->uNumVertices; ++j) { - do - { - v42 = v15->pVertexIDs; - v75 = 2 * v85; - v43 = &pIndoor->pVertices[v42[v85]]; - v79 = v43->z; - v44 = v43->y; - v45 = v43->x; - v78 = v44; - v76 = (v72 * v79 + v70 * v45 + v71 * v44) >> 16; - v46 = (v67 * v45 + v68 * v44 + v79 * v69) >> 16; - v77 = v46; + //do + //{ + //v42 = v15->pVertexIDs; + //v75 = 2 * v85; + v43 = &pIndoor->pVertices[v15->pVertexIDs[j]]; + //v79 = v43->z; + //v44 = v43->y; + //v45 = v43->x; + //v78 = v43->y; + v76 = ((__int64)v70.z * v43->z + (__int64)v70.x * v43->x + (__int64)v70.y * v43->y) >> 16; + //v46 = (v67 * v45 + v68 * v44 + v79 * v69) >> 16; + v77 = ((__int64)v67.x * v43->x + (__int64)v67.y * v43->y + (__int64)v43->z * v67.z) >> 16; if ( v76 < v39 ) v39 = v76; - if ( v46 < v40 ) - v83 = v46; + if ( v77 < v40 ) + v40 = v77; if ( v76 > v84 ) v84 = v76; - if ( v46 > v82 ) - v82 = v46; - v47 = v15->pVertexUIDs; - v48 = v75; - ++v85; - *(unsigned __int16 *)((char *)v47 + v75) = v76; - *(unsigned __int16 *)((char *)v15->pVertexVIDs + v48) = v77; - v40 = v83; - } - while ( v85 < v15->uNumVertices ); - v26 = v87; + if ( v77 > v82 ) + v82 = v77; + //v40 = v83; + //v47 = v15->pVertexUIDs; + //v48 = v75; + //++v85; + v15->pVertexUIDs[j] = v76; + v15->pVertexVIDs[j] = v77; + //} + //while ( v85 < v15->uNumVertices ); + //v26 = v87; } v49 = v15->uAttributes; if ( BYTE1(v49) & 0x10 ) @@ -3836,61 +3843,61 @@ } if ( BYTE2(v15->uAttributes) & 4 ) { - v75 = v26->vDirection.x; - v84 = (unsigned __int64)(v75 * (signed __int64)v70) >> 16; - v82 = v71; - v75 = v26->vDirection.y; - v82 = (unsigned __int64)(v75 * (signed __int64)v71) >> 16; - v83 = v72; - v75 = v26->vDirection.z; - v83 = (unsigned __int64)(v75 * (signed __int64)v72) >> 16; - v75 = v84 + v82 + ((unsigned __int64)(v75 * (signed __int64)v72) >> 16); + //v75 = door->vDirection.x; + v84 = (unsigned __int64)(door->vDirection.x * (signed __int64)v70.x) >> 16; + //v82 = v71; + //v75 = door->vDirection.y; + v82 = (unsigned __int64)(door->vDirection.y * (signed __int64)v70.y) >> 16; + //v83 = v72; + //v75 = door->vDirection.z; + v83 = (unsigned __int64)(door->vDirection.z * (signed __int64)v70.z) >> 16; + v75 = v84 + v82 + v83; v53 = v89; v82 = (unsigned __int64)(v75 * (signed __int64)v89) >> 16; - v28->sTextureDeltaU = -((unsigned int)(v75 * v89) >> 16); - v75 = v26->vDirection.x; - v84 = (unsigned __int64)(v75 * (signed __int64)v67) >> 16; - v82 = v68; - v75 = v26->vDirection.y; - v82 = (unsigned __int64)(v75 * (signed __int64)v68) >> 16; - v83 = v69; - v75 = v26->vDirection.z; - v83 = (unsigned __int64)(v75 * (signed __int64)v69) >> 16; - v54 = v82 + ((unsigned __int64)(v75 * (signed __int64)v69) >> 16); - v75 = v84 + v54; - v55 = (v84 + v54) * (signed __int64)v53; - v82 = v55 >> 16; + v28->sTextureDeltaU = -v82; + //v75 = door->vDirection.x; + v84 = (unsigned __int64)(door->vDirection.x * (signed __int64)v67.x) >> 16; + //v82 = v68; + //v75 = door->vDirection.y; + v82 = (unsigned __int64)(door->vDirection.y * (signed __int64)v67.y) >> 16; + //v83 = v69; + //v75 = door->vDirection.z; + v83 = (unsigned __int64)(door->vDirection.z * (signed __int64)v67.z) >> 16; + //v54 = v82 + v83; + v75 = v84 + v82 + v83; + v55 = v75 * (signed __int64)v53; + //v82 = v55 >> 16; v32 = v55 >> 16; LABEL_58: v56 = v88; v57 = -v32; v28->sTextureDeltaV = v57; - v28->sTextureDeltaU += v26->pDeltaUs[v56]; - v28->sTextureDeltaV = v57 + v26->pDeltaVs[v56]; + v28->sTextureDeltaU += door->pDeltaUs[v56]; + v28->sTextureDeltaV = v57 + door->pDeltaVs[v56]; } LABEL_59: - v58 = v26->uNumFaces; + //v58 = door->uNumFaces; ++v88; - if ( v88 >= v58 ) + if ( v88 >= door->uNumFaces) { - v1 = v81; - v0 = 0; + //v1 = v81; + //v0 = 0; goto LABEL_62; } - v2 = v87; + //v2 = v87; } - LOWORD(v39) = v84 - + ((signed __int16)v39 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v39].uTextureWidth : 24); + LOWORD(v39) = v84 + ((signed __int16)v39 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v39].uTextureWidth : 24); LABEL_50: v28->sTextureDeltaU -= v39; goto LABEL_51; } LABEL_62: - v80 += 80; - ++v1; - v81 = v1; - } - while ( v1 < pIndoor->uNumDoors ); + ; + //v80 += 80; + //++v1; + //v81 = v1; + //} + //while ( v1 < pIndoor->uNumDoors ); } } // 6BE13C: using guessed type int dword_6BE13C_uCurrentlyLoadedLocationID;
--- a/Items.cpp Tue Feb 26 18:47:30 2013 +0600 +++ b/Items.cpp Tue Feb 26 18:48:05 2013 +0600 @@ -44,7 +44,7 @@ { 2, { 30, 26, 26, 26 }}, { 2, { 28, 25, 28, 29 }}}; -ITEM_VARIATION shopArmr_variation_ord[30] ={ +ITEM_VARIATION shopArmr_variation_ord[28] ={ { 1, { 35, 35, 38, 38 }}, { 1, { 31, 31, 31, 34 }}, { 1, { 35, 35, 38, 38 }}, @@ -77,29 +77,60 @@ unsigned __int16 shopMagic_treasure_lvl[14]= {0, 1, 1, 2, 2, 4, 4, 3, 2, 2, 2, 2, 2, 2}; -unsigned __int16 shopAlch_treasure_lvl[13]= {0, 1, 1, 2, 2, 3, 3, 4, 4, 2, 2, 2, 2}; +unsigned __int16 shopAlch_treasure_lvl[13] = {0, 1, 1, 2, 2, 3, 3, 4, 4, 2, 2, 2, 2}; ITEM_VARIATION shopWeap_variation_spc[15]={ { 0, { 0, 0, 0, 0 }}, -{ 2, { 25, 30, 20, 20}}, -{ 2, { 23, 24, 28, 20}}, -{ 3, { 23, 24, 25, 20}}, -{ 3, { 27, 27, 26, 26}}, -{ 5, { 23, 26, 28, 27}}, -{ 5, { 23, 26, 28, 27}}, -{ 4, { 30, 24, 20, 20}}, -{ 3, { 20, 20, 20, 20}}, -{ 4, { 27, 27, 26, 26}}, -{ 4, { 28, 28, 25, 25}}, -{ 4, { 23, 23, 24, 24}}, -{ 4, { 24, 24, 27, 20}}, -{ 4, { 30, 26, 26, 26}}, -{ 4, { 28, 25, 28, 29}}}; + { 2, { 25, 30, 20, 20}}, + { 2, { 23, 24, 28, 20}}, + { 3, { 23, 24, 25, 20}}, + { 3, { 27, 27, 26, 26}}, + { 5, { 23, 26, 28, 27}}, + { 5, { 23, 26, 28, 27}}, + { 4, { 30, 24, 20, 20}}, + { 3, { 20, 20, 20, 20}}, + { 4, { 27, 27, 26, 26}}, + { 4, { 28, 28, 25, 25}}, + { 4, { 23, 23, 24, 24}}, + { 4, { 24, 24, 27, 20}}, + { 4, { 30, 26, 26, 26}}, + { 4, { 28, 25, 28, 29}}}; - +ITEM_VARIATION shopArmr_variation_spc[28]={ + { 2, { 35, 35, 38, 38 }}, + { 2, { 31, 31, 31, 34 }}, + { 2, { 35, 35, 38, 38 }}, + { 2, { 31, 31, 32, 34 }}, + { 3, { 35, 35, 38, 38 }}, + { 3, { 31, 32, 32, 33 }}, + { 3, { 35, 35, 38, 38 }}, + { 3, { 31, 31, 32, 32 }}, + { 5, { 35, 35, 38, 38 }}, + { 5, { 31, 32, 33, 34 }}, + { 5, { 35, 35, 38, 38 }}, + { 5, { 31, 32, 33, 34 }}, + { 4, { 35, 35, 38, 38 }}, + { 4, { 31, 31, 31, 31 }}, + { 3, { 35, 35, 38, 38 }}, + { 3, { 31, 32, 34, 34 }}, + { 4, { 35, 35, 38, 38 }}, + { 4, { 31, 31, 32, 33 }}, + { 4, { 35, 35, 38, 38 }}, + { 4, { 32, 32, 33, 34 }}, + { 4, { 35, 35, 38, 38 }}, + { 4, { 31, 31, 31, 32 }}, + { 4, { 35, 35, 38, 38 }}, + { 4, { 32, 32, 32, 32 }}, + { 4, { 35, 35, 38, 38 }}, + { 4, { 34, 34, 34, 34 }}, + { 5, { 35, 35, 38, 38 }}, + { 5, { 33, 33, 33, 33 }} + }; -unsigned __int16 shopMagicSpc_treasure_lvl[14]= {0, 2, 2, 3, 3, 5, 5, 4, 3, 3, 3, 3, 3, 3}; +unsigned __int16 shopMagicSpc_treasure_lvl[14] = {0, 2, 2, 3, 3, 5, 5, 4, 3, 3, 3, 3, 3, 3}; +unsigned __int16 shopAlchSpc_treasure_lvl[13] = {0, 2, 2, 3, 3, 4, 4, 5, 5, 3, 2, 2, 2}; +int sub_4BE571(int a1, int *a2, int a3, int a4); ItemGen *ptr_50C9A4; @@ -1960,20 +1991,6 @@ //----- (004B8F94) -------------------------------------------------------- void GenerateSpecialShopItems() { - /*GUIWindow *v0; // edi@1 - signed int v1; // ebp@1 - int v2; // ebx@1 - signed int v3; // esi@1 - int v4; // eax@3 - int v5; // ebx@3 - int v6; // ecx@3 - bool v7; // eax@5 - bool v8; // ST1C_4@5 - int v9; // eax@5 - int v10; // eax@10 - void *result; // eax@15 - signed int v12; // [sp-4h] [bp-18h]@7*/ - signed int item_count; signed int shop_index; int treasure_lvl; @@ -1995,8 +2012,8 @@ mdf =0; if (item_count > 3) ++mdf; - treasure_lvl = shopArmr_variation_ord[2*(shop_index-15)+mdf].treasure_level; - item_class =shopArmr_variation_ord[2*(shop_index-15)+mdf].item_class[rand() % 4]; + treasure_lvl = shopArmr_variation_spc[2*(shop_index-15)+mdf].treasure_level; + item_class =shopArmr_variation_spc[2*(shop_index-15)+mdf].item_class[rand() % 4]; } else if (shop_index<=41) //magic shop { @@ -2007,92 +2024,21 @@ { if (item_count<6) { - pParty->SpecialItemsInShop[shop_index][item_count].Reset(); - pParty->SpecialItemsInShop[shop_index][item_count].uItemID = rand() % 32 + 740; //mscrool + pParty->SpecialItemsInShops[shop_index][item_count].Reset(); + pParty->SpecialItemsInShops[shop_index][item_count].uItemID = rand() % 32 + 740; //mscrool continue; } else { - treasure_lvl = shopAlch_treasure_lvl[shop_index-41]; + treasure_lvl = shopAlchSpc_treasure_lvl[shop_index-41]; item_class = 44; //potion } } - pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->SpecialItemsInShop[shop_index][item_count]); - pParty->SpecialItemsInShop[shop_index][item_count].SetIdentified(); //identified + pItemsTable->GenerateItem(treasure_lvl, item_class, &pParty->SpecialItemsInShops[shop_index][item_count]); + pParty->SpecialItemsInShops[shop_index][item_count].SetIdentified(); //identified } } pParty->InTheShopFlags[shop_index] = 0; - - - -/* - - v0 = window_SpeakInHouse; - v1 = 0; - v2 = (int)&window_SpeakInHouse->ptr_1C; - v3 = (signed int)window_SpeakInHouse->ptr_1C; - //if ( _4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * (unsigned int)ptr_507BC0->ptr_1C]] ) - if ( uItemsAmountPerShopType[p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].uType] ) - { - while ( v3 > 14 ) - { - if ( v3 <= 28 ) - { - v7 = v1 > 3; - v8 = v7; - v9 = 5 * (v7 + 2 * v3 - 30); - v3 = (signed int)v0->ptr_1C; - v5 = word_4F06D8[v9]; - v6 = word_4F05AE[5 * (v8 + 2 * v3) + rand() % 4]; - goto LABEL_13; - } - if ( v3 <= 41 ) - { - v5 = word_4F07B6[v3]; - v12 = 22; - goto LABEL_12; - } - if ( v3 <= 53 ) - { - if ( v1 >= 6 ) - { - v5 = word_4F07B6[v3 + 1]; - v12 = 44; -LABEL_12: - v6 = v12; -LABEL_13: - pItemsTable->GenerateItem(v5, v6,&pParty->SpecialItemsInShop[v3][v1]);//(ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]); - v0 = window_SpeakInHouse; - v2 = (int)&window_SpeakInHouse->ptr_1C; - // pParty->field_C59C[9 * (v1 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 729] = 1; - pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v1].uAttributes= 1; - goto LABEL_14; - } - // auto _a = (ItemGen *)&pParty->field_C59C[9 * (v1 + 12 * v3) + 724]; - auto _a =&pParty->SpecialItemsInShop[v3][v1]; - _a->Reset(); - // v2 = (int)&v0->ptr_1C; - //v10 = rand(); - // v0 = window_SpeakInHouse; - // pParty->field_C59C[9 * (v1 + 12 * *(int *)v2) + 724] = v10 % 32 + 740; - pParty->SpecialItemsInShop[(int)v0->ptr_1C][v1].uItemID= rand() % 32 + 740; - } -LABEL_14: - v3 = *(int *)v2; - ++v1; - //if ( v1 >= (unsigned __int8)_4F063C_smthn_by_2da_uType[p2DEvents_minus1___00[26 * *(int *)v2]] ) - if ( v1 >= (unsigned __int8)uItemsAmountPerShopType[p2DEvents[*(int *)v2 - 1].uType] ) - goto LABEL_15; - } - v4 = 5 * v3; - v3 = (signed int)v0->ptr_1C; - v5 = word_4F063E[v4]; - v6 = word_4F063E[5 * v3 + rand() % 4 + 1]; - goto LABEL_13; - } -LABEL_15: - result = v0->ptr_1C; - pParty->InTheShopFlags[(int)v0->ptr_1C] = 0;*/ } @@ -2298,383 +2244,166 @@ // 4505CC: using guessed type int var_A0[32]; //----- (004B3703) -------------------------------------------------------- - int sub_4B3703( int _this ) +void FillAviableSkillsToTeach( int _this ) + { + char *v30; // ecx@65 + unsigned int v29; // edx@56 + int v15; // ecx@19 + int v33; // [sp-4h] [bp-2Ch]@23 + int v34; // [sp-4h] [bp-2Ch]@43 + int v21; // ecx@34 + int v35[5]; // [sp+Ch] [bp-1Ch]@8 + int v37=0; // [sp+24h] [bp-4h]@1* + int i=0; + + dword_F8B1DC = 0; + + switch (_this) { - signed int v1; // edi@1 - int v2; // eax@1 - int v3; // ecx@1 - signed int v4; // ebx@1 - int v5; // ecx@2 - int v6; // ecx@3 - int v7; // ecx@4 - int v8; // ecx@5 - int v9; // ecx@6 - signed int v10; // ebx@13 - signed int v11; // edi@14 - signed int v12; // esi@15 - unsigned int v13; // ecx@16 - int v14; // ecx@16 - int v15; // ecx@17 - int v16; // ecx@19 - int v17; // ecx@20 - int v18; // ecx@21 - signed int v19; // esi@32 - char *v20; // ecx@33 - int v21; // ecx@34 - int v22; // ecx@36 - int v23; // ecx@37 - int v24; // ecx@38 - int v25; // ecx@39 - int v26; // ecx@40 - int v27; // ecx@41 - int *v28; // esi@54 - unsigned int v29; // edx@56 - char *v30; // ecx@65 - int v31; // ecx@106 - int result; // eax@107 - int v33; // [sp-4h] [bp-2Ch]@23 - int v34; // [sp-4h] [bp-2Ch]@43 - int v35[5]; // [sp+Ch] [bp-1Ch]@8 - int a2; // [sp+20h] [bp-8h]@1 - int v37; // [sp+24h] [bp-4h]@1 + case 1: //shop weapon + for (int i=0; i<2; ++i) + { + for (int j=0; j<4; ++j) + { + if ( i ) + v21 = shopWeap_variation_spc[(unsigned int)window_SpeakInHouse->ptr_1C].item_class[j]; + else + v21 = shopWeap_variation_ord[(unsigned int)window_SpeakInHouse->ptr_1C].item_class[j]; - //need fixing - __debugbreak(); - v1 = 0; - v2 = 0; - v3 = _this - 1; - a2 = 0; - v37 = 0; - dword_F8B1DC = 0; - v4 = 2; - if ( !v3 ) - { - while ( 1 ) - { - v19 = 1; - do + switch (v21) { - v20 = (char *)window_SpeakInHouse->ptr_1C + 4 * (unsigned int)window_SpeakInHouse->ptr_1C + v19; - /*if ( v1 ) - v21 = word_4F063E[(signed int)v20]; - else - v21 = word_4F0404[(signed int)v20 - 4];//word_4F03FE[(signed int)v20];*/ - v22 = v21 - 23; - if ( v22 ) - { - v23 = v22 - 1; - if ( v23 ) - { - v24 = v23 - 1; - if ( v24 ) - { - v25 = v24 - 1; - if ( v25 ) - { - v26 = v25 - 1; - if ( v26 ) - { - v27 = v26 - 1; - if ( v27 ) - { - if ( v27 != v4 ) - goto LABEL_51; - v34 = 36; - } - else - { - v34 = 42; - } - } - else - { - v34 = 41; - } - } - else - { - v34 = 40; - } - } - else - { - v34 = 39; - } - } - else - { - v34 = 38; - } - } - else - { - v34 = 37; - } - v37 = sub_4BE571(v34, v35, v37, 5); - v2 = dword_F8B1DC; - v4 = 2; -LABEL_51: - ++v19; - } - while ( v19 <= 4 ); - ++v1; - if ( v1 >= v4 ) - goto LABEL_53; + case 23: v34 = 37; break; + case 24: v34 = 38; break; + case 25: v34 = 39; break; + case 26: v34 = 40; break; + case 27: v34 = 41; break; + case 28: v34 = 42; break; + case 30: v34 = 36; break; + default: + continue; + } + v37 = sub_4BE571(v34, v35, v37, 5); } } - v5 = (int)(v3 - 1); - if ( !v5 ) + break; + case 2: //shop armor + + for (int i=0; i<2; ++i) { - v10 = 0; - while ( 1 ) + for (int j=0; j<2; ++j) { - v11 = 0; - do + for (int k=0; k<4; ++k) { - v12 = 1; - do + if ( i ) + v15 = shopArmr_variation_spc[(unsigned int)window_SpeakInHouse->ptr_1C-15+j].item_class[k]; + else + v15 = shopArmr_variation_ord[(unsigned int)window_SpeakInHouse->ptr_1C-15+j].item_class[k]; + switch (v15) { - v13 = v11 + 2 * (unsigned int)window_SpeakInHouse->ptr_1C - 30; - v14 = v12 + 4 * v13 + v13; - /* if ( v10 ) - v15 = word_4F06D8[v14]; - else - v15 = word_4F0498[v14];*/ - v16 = v15 - 31; - if ( v16 ) - { - v17 = v16 - 1; - if ( v17 ) - { - v18 = v17 - 1; - if ( v18 ) - { - if ( v18 != 1 ) - goto LABEL_28; - v33 = 44; - } - else - { - v33 = 47; - } - } - else - { - v33 = 46; - } - } - else - { - v33 = 45; - } - v37 = sub_4BE571(v33, v35, v37, 5); - v2 = dword_F8B1DC; -LABEL_28: - ++v12; + case 31: v33 = 45; break; + case 32: v33 = 46; break; + case 33: v33 = 47; break; + case 34: v33 = 44; break; + default: + continue; } - while ( v12 <= 4 ); - ++v11; + v37 = sub_4BE571(v33, v35, v37, 5); } - while ( v11 < 2 ); - ++v10; - if ( v10 >= 2 ) - goto LABEL_53; } } - v6 = v5 - 1; - if ( v6 ) - { - v7 = v6 - 1; - if ( v7 ) - { - v8 = v7 - 17; - if ( v8 ) - { - v9 = v8 - 2; - if ( v9 ) - { - if ( v9 == 7 ) - { - v37 = 2; - v35[0] = 69; - v35[1] = 60; - } - } - else - { - v37 = 3; - v35[0] = 67; - v35[1] = 66; - v35[2] = 58; - } - } - else - { - v37 = 3; - v35[0] = 70; - v35[1] = 65; - v35[2] = 62; - } - } - else - { - v37 = 2; - v35[0] = 71; - v35[1] = 68; - } - } - else - { - v37 = 2; - v35[0] = 57; - v35[1] = 59; - } -LABEL_53: - if ( v37 > 0 ) + break; + case 3: //shop magic + v37 = 2; + v35[0] = 57; + v35[1] = 59; + break; + case 4: //shop alchemist + v37 = 2; + v35[0] = 71; + v35[1] = 68; + break; + case 21: //tavern + v37 = 3; + v35[0] = 70; + v35[1] = 65; + v35[2] = 62; + break; + case 23: //temple + v37 = 3; + v35[0] = 67; + v35[1] = 66; + v35[2] = 58; + break; + case 30: ///trainig + v37 = 2; + v35[0] = 69; + v35[1] = 60; + break; + } + for(i=0;i<v37;++i) + { + v29=v35[i]; + switch(v29) { - v28 = v35; - while ( 1 ) - { - v29 = *v28; - if ( *v28 <= 47 ) - break; - if ( (signed int)v29 <= 66 ) - { - if ( v29 == 66 ) - { - v30 = pSkillNames[30]; - goto LABEL_106; - } - if ( v29 == 57 ) - { - v30 = pSkillNames[21]; - goto LABEL_106; - } - if ( v29 == 58 ) - { - v30 = pSkillNames[22]; - goto LABEL_106; - } - if ( v29 == 60 ) - { - v30 = pSkillNames[24]; - goto LABEL_106; - } - if ( v29 == 62 ) - { - v30 = pSkillNames[26]; - goto LABEL_106; - } - if ( v29 == 65 ) - { - v30 = pSkillNames[29]; - goto LABEL_106; - } - goto LABEL_100; - } - switch ( v29 ) - { - case 0x43u: - v30 = pSkillNames[31]; - break; - case 0x44u: - v30 = pSkillNames[32]; - break; - case 0x45u: - v30 = pSkillNames[33]; - break; - case 0x46u: - v30 = pSkillNames[34]; - break; - default: - if ( v29 != 71 ) - goto LABEL_100; - v30 = pSkillNames[35]; - break; - } -LABEL_106: - pShopOptions[v2] = v30; - v31 = a2++; - dword_F8B1DC = v2 + 1; - sub_4B36CC(v31, v29); - ++v28; - if ( a2 >= v37 ) - goto LABEL_107; - v2 = dword_F8B1DC; - } - if ( *v28 == 47 ) - { - v30 = pSkillNames[11]; - goto LABEL_106; - } - if ( (signed int)v29 > 40 ) - { - if ( v29 == 41 ) - { - v30 = pSkillNames[5]; - goto LABEL_106; - } - if ( v29 == 42 ) - { - v30 = pSkillNames[6]; - goto LABEL_106; - } - if ( v29 == 44 ) - { - v30 = pSkillNames[8]; - goto LABEL_106; - } - if ( v29 == 45 ) - { - v30 = pSkillNames[9]; - goto LABEL_106; - } - if ( v29 == 46 ) - { - v30 = pSkillNames[10]; - goto LABEL_106; - } - } - else - { - if ( v29 == 40 ) - { - v30 = pSkillNames[4]; - goto LABEL_106; - } - if ( v29 == 5 ) - { - v30 = pSkillNames[23]; - goto LABEL_106; - } - if ( v29 == 36 ) - { - v30 = pSkillNames[0]; - goto LABEL_106; - } - if ( v29 == 37 ) - { - v30 = pSkillNames[1]; - goto LABEL_106; - } - if ( v29 == 38 ) - { - v30 = pSkillNames[2]; - goto LABEL_106; - } - if ( v29 == 39 ) - { - v30 = pSkillNames[3]; - goto LABEL_106; - } - } -LABEL_100: + case 40 :v30 = pSkillNames[4]; break; + case 5 : v30 = pSkillNames[23]; break; + case 36 :v30 = pSkillNames[0]; break; + case 37 :v30 = pSkillNames[1]; break; + case 38 :v30 = pSkillNames[2]; break; + case 39 :v30 = pSkillNames[3]; break; + case 41 :v30 = pSkillNames[5]; break; + case 42 :v30 = pSkillNames[6]; break; + case 44 :v30 = pSkillNames[8]; break; + case 45 :v30 = pSkillNames[9]; break; + case 46 :v30 = pSkillNames[10]; break; + case 47 :v30 = pSkillNames[11]; break; + case 66 :v30 = pSkillNames[30]; break; + case 57 :v30 = pSkillNames[21]; break; + case 58 :v30 = pSkillNames[22]; break; + case 60 :v30 = pSkillNames[24]; break; + case 62 :v30 = pSkillNames[26]; break; + case 65 :v30 = pSkillNames[29]; break; + case 67:v30 = pSkillNames[31]; break; + case 68:v30 = pSkillNames[32]; break; + case 69:v30 = pSkillNames[33]; break; + case 70:v30 = pSkillNames[34]; break; + case 71:v30 = pSkillNames[35]; break; + default: v30 = pGlobalTXT_LocalizationStrings[127]; //"No Text!" - goto LABEL_106; } -LABEL_107: - pDialogueWindow->_41D08F(a2, 1, 0, 2); - result = pDialogueWindow->pNumPresenceButton; - dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; + pShopOptions[dword_F8B1DC] = v30; + ++dword_F8B1DC; + CreateButtonInColumn(i+1, v29); + } + pDialogueWindow->_41D08F(i, 1, 0, 2); + dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; + } + + //----- (004BE571) -------------------------------------------------------- +int sub_4BE571(int a1, int *a2, int a3, int a4) + { + int result; // eax@1 + int i; // esi@3 + + result = a3; + if ( a3 < a4 ) + { + for ( i = 0; i < a3; ++i ) + { + if ( a1 == a2[i] ) + break; + } + if ( i == a3 ) + { + a2[a3] = a1; + result = a3 + 1; + } return result; } + else + { + return a4; + } + } + +
--- a/MM7.h Tue Feb 26 18:47:30 2013 +0600 +++ b/MM7.h Tue Feb 26 18:48:05 2013 +0600 @@ -163,14 +163,16 @@ /* 349 */ -enum HOUSE_TYPE +enum HOUSE_ID { HOUSE_SMITH_EMERALD_ISLE = 1, HOUSE_BODY_GUILD_NOVICE_EMERALD_ISLE = 163, - HOUSE_186 = 186, + HOUSE_BODY_GUILD_ERATHIA = 165, + HOUSE_DARK_GUILD_PIT = 170, + HOUSE_LORD_AND_JUDGE = 186, HOUSE_JAIL = 187, - HOUSE_600 = 600, - HOUSE_601 = 601 + HOUSE_600 = 600,//??? + HOUSE_601 = 601//??? };
--- a/Overlays.cpp Tue Feb 26 18:47:30 2013 +0600 +++ b/Overlays.cpp Tue Feb 26 18:48:05 2013 +0600 @@ -152,12 +152,8 @@ //----- (00458D97) -------------------------------------------------------- void OverlayList::InitializeSprites() { - OverlayList *v1; // esi@1 - signed int i; // edi@1 - - v1 = this; - for ( i = 0; i < (signed int)v1->uNumOverlays; ++i ) - pSpriteFrameTable->InitializeSprite(v1->pOverlays[i].uSpriteFramesetID); + for (uint i = 0; i < uNumOverlays; ++i) + pSpriteFrameTable->InitializeSprite(pOverlays[i].uSpriteFramesetID); } //----- (00458DBC) --------------------------------------------------------
--- a/Party.h Tue Feb 26 18:47:30 2013 +0600 +++ b/Party.h Tue Feb 26 18:48:05 2013 +0600 @@ -113,7 +113,8 @@ struct Party_stru0 { int field_0[20]; - int field_50[170]; + // int field_50[170]; + __int64 field_50[85]; int _shop_ban_times[82]; int field_440[44]; int field_4F0[38]; @@ -273,7 +274,7 @@ ItemGen pPickedItem; unsigned int uFlags; ItemGen StandartItemsInShops[53][12]; - ItemGen SpecialItemsInShop[53][12]; //D0EC + ItemGen SpecialItemsInShops[53][12]; //D0EC int field_12A5C[2117]; char field_14B70[5000]; char field_15EF8[250];
--- a/Player.cpp Tue Feb 26 18:47:30 2013 +0600 +++ b/Player.cpp Tue Feb 26 18:48:05 2013 +0600 @@ -7984,9 +7984,9 @@ case VAR_QBits_QuestsDone: v13 = 0x80u >> (pValue - 1) % 8; v14 = pParty->_award_bits[(pValue - 1) >> 3]; - if ( !(v13 & v14) ) - return false; - return true; + if ( v13 & v14 ) + return true; + return false; case VAR_PlayerItemInHands: v15 = 0; v16 = v3->pInventoryItems;
--- a/VideoPlayer.cpp Tue Feb 26 18:47:30 2013 +0600 +++ b/VideoPlayer.cpp Tue Feb 26 18:48:05 2013 +0600 @@ -13,6 +13,7 @@ #include "Time.h" #include "Log.h" +#include "MM7.h" #include "mm7_data.h" @@ -1123,7 +1124,7 @@ sub_4BD8B5(); window_SpeakInHouse->Release(); pParty->uFlags &= 0xFFFFFFFDu; - if ( EnterHouse((enum HOUSE_TYPE)165) ) + if ( EnterHouse(HOUSE_BODY_GUILD_ERATHIA) ) { pAudioPlayer->PlaySound(SOUND_Invalid, 0, 0, -1, 0, 0, 0, 0); window_SpeakInHouse = GUIWindow::Create(0, 0, 640, 480, WINDOW_HouseInterior, 165, 0);
--- a/mm7_2.cpp Tue Feb 26 18:47:30 2013 +0600 +++ b/mm7_2.cpp Tue Feb 26 18:48:05 2013 +0600 @@ -56,7 +56,7 @@ //----- (004B4F4F) -------------------------------------------------------- -char *__cdecl sub_4B4F4F() +char *__cdecl JailDialog() { const char *v0; // esi@1 const char *v1; // ST10_4@1 @@ -104,7 +104,7 @@ //----- (004B7911) -------------------------------------------------------- -void __cdecl sub_4B7911() +void __cdecl TownHallDialog() { GUIWindow *v0; // eax@4 int v1; // eax@10 @@ -288,7 +288,7 @@ // F8B1A0: using guessed type __int16 word_F8B1A0; //----- (004B7D7E) -------------------------------------------------------- -void __cdecl _4B7D7E_bank() +void __cdecl BankDialog() { GUIWindow *v0; // eax@4 int v1; // ecx@5 @@ -1210,7 +1210,7 @@ { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - sub_4B46A5(pGlobalTXT_LocalizationStrings[198], 0); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) { @@ -1311,7 +1311,7 @@ { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - sub_4B46A5(pGlobalTXT_LocalizationStrings[199], 0); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) { @@ -1349,7 +1349,7 @@ { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - sub_4B46A5(pGlobalTXT_LocalizationStrings[197], 0); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) { @@ -1417,13 +1417,13 @@ if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID); { v49 = word_F8B158[(signed int)v48]; - v50 = dword_F8B168[(signed int)v48]; + v50 = ItemsInShopTexture[(signed int)v48]; v49 += 30; v51 = 60 - ((signed int)v50->uTextureWidth >> 1); pRenderer->DrawTextureTransparent(v51 + v108, v49, v50); sub_40F92A( &pRenderer->pActiveZBuffer[v51 + v108 + 640 * v49], - dword_F8B168[(signed int)v109], + ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); v48 = v109; } @@ -1440,15 +1440,15 @@ do { // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) - if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) { v52 = word_F8B158[(signed int)v109] + 30; - v53 = dword_F8B168[(signed int)v109]; + v53 = ItemsInShopTexture[(signed int)v109]; v54 = 60 - ((signed int)v53->uTextureWidth >> 1); pRenderer->DrawTextureTransparent(v54 + v108, word_F8B158[(signed int)v109] + 30, v53); sub_40F92A( &pRenderer->pActiveZBuffer[v54 + v108 + 640 * v52], - dword_F8B168[(signed int)v109], + ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); } v109 = (const char **)((char *)v109 + 1); @@ -1477,7 +1477,7 @@ do { // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) ++v106.x; ++v55; } @@ -1496,7 +1496,7 @@ if ( dword_F8B19C != 2 ) v58 = pGlobalTXT_LocalizationStrings[196]; } - sub_4B46A5(v58, 0); + DrawTextAtStatusBar(v58, 0); if ( v106.x ) { v59 = pMouse->GetCursorPos(&v91); @@ -1509,7 +1509,7 @@ // v62 = 9 * (v60 + 12 * v61); v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; if ( dword_F8B19C != 2 ) - v63 = &pParty->SpecialItemsInShop[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; + v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; if ( !v56 || !Str ) { v85 = 0; @@ -1532,11 +1532,8 @@ } else { - result = v101._4B1854( - __PAIR__( - pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C + 1], - pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) - - pParty->uTimePlayed); + v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + result =0; //added } } return result; @@ -1732,7 +1729,7 @@ { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - sub_4B46A5(pGlobalTXT_LocalizationStrings[199], 0); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( !result || (v43 = pMouse->GetCursorPos(&v99)->x - 14, @@ -1757,7 +1754,7 @@ { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - sub_4B46A5(pGlobalTXT_LocalizationStrings[197], 0); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( !result || (v36 = pMouse->GetCursorPos(&a2)->x - 14, @@ -1957,7 +1954,7 @@ // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID); { - v46 = dword_F8B168[v114]; + v46 = ItemsInShopTexture[v114]; v47 = 152 - v46->uTextureHeight; if ( (signed int)v47 < 1 ) v47 = 0; @@ -1966,7 +1963,7 @@ { if ( v114 == 5 ) { - v49 = dword_F8B168[5]->uTextureWidth; + v49 = ItemsInShopTexture[5]->uTextureWidth; if ( (signed int)v48 > 457 - v49 ) v48 = 457 - v49; } @@ -1977,7 +1974,7 @@ v48 = 18; } pRenderer->DrawTextureTransparent(v48, v47, v46); - sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], dword_F8B168[v114], v114 + 1); + sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); } ++v114; } @@ -1988,7 +1985,7 @@ // if ( pParty->field_777C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114+1].uItemID); { - v50 = dword_F8B168[v114 + 6]; + v50 = ItemsInShopTexture[v114 + 6]; v51 = 308 - v50->uTextureHeight; if ( (signed int)v51 < 1 ) v51 = 0; @@ -1997,7 +1994,7 @@ { if ( v114 == 5 ) { - v53 = dword_F8B168[11]->uTextureWidth; + v53 = ItemsInShopTexture[11]->uTextureWidth; if ( (signed int)v52 > 457 - v53 ) v52 = 457 - v53; } @@ -2008,7 +2005,7 @@ v52 = 18; } pRenderer->DrawTextureTransparent(v52, v51, v50); - sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], dword_F8B168[v114 + 6], v114 + 7); + sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); } ++v114; } @@ -2019,9 +2016,9 @@ do { //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) - { - v54 = dword_F8B168[v114]; + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v114].uItemID) + { + v54 = ItemsInShopTexture[v114]; v55 = 152 - v54->uTextureHeight; if ( (signed int)v55 < 1 ) v55 = 0; @@ -2030,7 +2027,7 @@ { if ( v114 == 5 ) { - v57 = dword_F8B168[5]->uTextureWidth; + v57 = ItemsInShopTexture[5]->uTextureWidth; if ( (signed int)v56 > 457 - v57 ) v56 = 457 - v57; } @@ -2041,7 +2038,7 @@ v56 = 18; } pRenderer->DrawTextureTransparent(v56, v55, v54); - sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], dword_F8B168[v114], v114 + 1); + sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); } ++v114; } @@ -2050,9 +2047,9 @@ do { // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) //weak - if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid - { - v58 = dword_F8B168[v114 + 6]; + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v114].uItemID) //not itemid + { + v58 = ItemsInShopTexture[v114 + 6]; v59 = 308 - v58->uTextureHeight; if ( (signed int)v59 < 1 ) v59 = 0; @@ -2061,7 +2058,7 @@ { if ( v114 == 5 ) { - v61 = dword_F8B168[11]->uTextureWidth; + v61 = ItemsInShopTexture[11]->uTextureWidth; if ( (signed int)v60 > 457 - v61 ) v60 = 457 - v61; } @@ -2072,7 +2069,7 @@ v60 = 18; } pRenderer->DrawTextureTransparent(v60, v59, v58); - sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], dword_F8B168[v114 + 6], v114 + 7); + sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); } ++v114; } @@ -2099,7 +2096,7 @@ do { //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) ++v109; ++v62; } @@ -2118,13 +2115,12 @@ if ( dword_F8B19C != 2 ) v65 = pGlobalTXT_LocalizationStrings[196]; } - sub_4B46A5(v65, 0); + DrawTextAtStatusBar(v65, 0); if ( !v109 ) - return (POINT *)v104._4B1854( - __PAIR__( - pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C + 1], - pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) - - pParty->uTimePlayed); + { + v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return 0; + } v66 = pMouse->GetCursorPos(&v98); result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) @@ -2135,7 +2131,7 @@ // v69 = 9 * (v67 + 12 * v68); v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; if ( dword_F8B19C != 2 ) - v70 = &pParty->SpecialItemsInShop[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; + v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; if ( !v63 || !Str ) { v93 = 0; @@ -2163,704 +2159,766 @@ //----- (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 v17; // 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 *v25; // eax@26 - GUIButton *v26; // esi@26 - int v27; // eax@26 - unsigned int v28; // ecx@26 - Player *v29; // edx@26 - unsigned __int16 v30; // ax@26 - 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 v54; // eax@60 - signed int v55; // 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 *v77; // 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 - char 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 v144; // [sp+8Ch] [bp-78h]@1 - char *Str; // [sp+E0h] [bp-24h]@56 - int v146; // [sp+E4h] [bp-20h]@24 - int v147; // [sp+E8h] [bp-1Ch]@1 - int v148; // [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 - - v0 = pPlayers[uActiveCharacter]; - _this = pPlayers[uActiveCharacter]; - memcpy(&v144, window_SpeakInHouse, sizeof(v144)); - v144.uFrameX = 483; - v144.uFrameWidth = 148; - v144.uFrameZ = 334; - v148 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v147 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - if ( dword_F8B19C > 5 ) - { - if ( dword_F8B19C == 6 ) - { - pRenderer->DrawTextureIndexed(8u, 8u, dword_F8B164); - sub_4B46A5(pGlobalTXT_LocalizationStrings[195], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v149 = 0; - v93 = 0; - do - { - // if ( pParty->field_C59C[9 * (v93 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID) - ++v149; - ++v93; - } - while ( v93 < 8 ); - if ( v149 ) - { - v94 = pMouse->GetCursorPos(&v132); - v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; - v95 = v149; - if ( v149 && v149 != -65536 ) - { - --v149; - v96 = window_SpeakInHouse->ptr_1C; - v97 = uActiveCharacter - 1; - // v98 = (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724]; - v99 = _this->_490EEE( - &pParty->SpecialItemsInShop[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724], - 2, - (int)window_SpeakInHouse->ptr_1C, - 2); - v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], v97, v98, (char *)v96, 2, 0); - v101 = v100; - v102 = v148; - v103 = pFontArrus->CalcTextHeight(v100, &v144, 0, 0); - v144.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, v102, v101, 3u); - } - v104 = 0; - v153 = 0; - do - { - //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v104].uItemID) - { - v105 = dword_F8B168[v104]; - if ( v104 >= 4 ) - { - v110 = 90 - ((signed int)v105->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, dword_F8B168[v104]); - v127 = v104 + 1; - v109 = v153 + v110 + 80220; - } - else - { - v106 = 98 - v105->uTextureHeight; - v107 = dword_F8B168[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], dword_F8B168[v104], v127); - } - v153 += 105; - ++v104; - } - while ( v104 < 8 ); - return; - } - v72 = window_SpeakInHouse->ptr_1C; - goto LABEL_96; - } - if ( dword_F8B19C == 94 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - v79 = pShopOptions; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; - v80 = 0; - v81 = pShopOptions; - do - { - v82 = pFontArrus->CalcTextHeight(*v81, &v144, 0, 0); - ++v81; - v80 += v82; - } - while ( (signed int)v81 < (signed int)&pShopOptions[3] ); - v83 = pDialogueWindow; - v152 = (174 - v80) / 3; - v84 = pDialogueWindow->pStartingPosActiveItem; - v85 = v84 + pDialogueWindow->pNumPresenceButton; - v86 = (3 * (58 - v152) - v80) / 2 - v152 / 2 + 138; - v24 = -pDialogueWindow->pNumPresenceButton < 0; - _this = (Player *)pDialogueWindow->pStartingPosActiveItem; - if ( v24 ^ __OFSUB__(v84, v85) ) - { - v153 = 2; - do - { - v87 = v83->GetControl((unsigned int)_this); - v88 = v87; - v87->uY = v152 + v86; - v89 = pFontArrus->CalcTextHeight(*v79, &v144, 0, 0); - v90 = v88->uY; - v91 = v153; - v88->uHeight = v89; - v86 = v90 + v89 - 1; - v88->uW = v86; - v92 = v147; - if ( pDialogueWindow->pCurrentPosActiveItem != v91 ) - v92 = v148; - v144.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; - } - if ( dword_F8B19C != 95 ) - { - if ( dword_F8B19C != 96 || !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)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] ) - { - v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &v144, 0, 0); - v152 += v42; - ++v153; - } - ++v39; - } - while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); - if ( v153 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); - v144.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->uControlParam - 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, &v144, 0, 0); - v49 = v45->uY; - v50 = v153; - v45->uHeight = v48; - v51 = v49 + v48 - 1; - v45->uW = v51; - v146 = v51; - v52 = v147; - if ( pDialogueWindow->pCurrentPosActiveItem != v50 ) - v52 = v148; - v144.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u); - } - v53 = v37->pStartingPosActiveItem; - ++v152; - v54 = v37->pNumPresenceButton + v53; - ++v153; - } - while ( v152 < v54 ); - } - return; - } - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v11 = 0; - v36 = pTmpBuf; - v123 = 3; - v121 = pTmpBuf; - v119 = v147; - v117 = 0; - v113 = 0; - v111 = &v144; -LABEL_63: - v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; - v112 = (unsigned int)v11; -LABEL_14: - v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); - return; - } -LABEL_64: - pRenderer->DrawTextureIndexed(8u, 8u, dword_F8B164); - if ( dword_F8B19C == 2 ) - { - v55 = 0; - v153 = 0; - do - { - // if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID); - { - v56 = dword_F8B168[v55]; - if ( v55 >= 4 ) - { - v60 = 90 - ((signed int)v56->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v60 + v153 - 420, 0x7Eu, dword_F8B168[v55]); - v125 = v55 + 1; - v59 = v60 + v153 + 80220; - } - else - { - v57 = 98 - v56->uTextureHeight; - v58 = dword_F8B168[v55]; - v152 = 86 - ((signed int)v56->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v152, v57, v58); - v125 = v55 + 1; - v59 = v153 + v152 + 640 * v57; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], dword_F8B168[v55], v125); - } - v153 += 105; - ++v55; - } - while ( v55 < 8 ); - v11 = 0; - } - else - { - v11 = 0; - v61 = 0; - v153 = 0; - do - { - // if ( (char *)pParty->field_C59C[9 * (v61 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) - if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID) - { - v62 = dword_F8B168[v61]; - if ( v61 >= 4 ) - { - v67 = 90 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, dword_F8B168[v61]); - v126 = v61 + 1; - v66 = v153 + v67 + 80220; - } - else - { - v63 = 98 - v62->uTextureHeight; - v64 = dword_F8B168[v61]; - v65 = 98 - v62->uTextureHeight; - v152 = 86 - ((signed int)v62->uTextureWidth >> 1); - pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); - v126 = v61 + 1; - v66 = v152 + v153 + 640 * v63; - } - ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], dword_F8B168[v61], v126); - v11 = 0; - } - v153 += 105; - ++v61; - } - while ( v61 < 8 ); - } - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v68 = 0; - v149 = (__int32)v11; - if ( dword_F8B19C == 2 ) - { - do - { - // if ( (char *)pParty->field_777C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] != v11 ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v68].uItemID); - ++v149; - ++v68; - } - while ( v68 < 6 ); - } - else - { - do - { - // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) - if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID) - ++v149; - ++v68; - } - while ( v68 < 6 ); - } - v69 = GetAsyncKeyState(17); - v70 = _this->CanSteal(); - Str = (char *)v70; - if ( v69 == (short)v11 || (char *)v70 == v11 ) - { - v71 = pGlobalTXT_LocalizationStrings[195]; - if ( dword_F8B19C != 2 ) - v71 = pGlobalTXT_LocalizationStrings[196]; - } - else - { - v71 = pGlobalTXT_LocalizationStrings[185]; - } - sub_4B46A5(v71, 0); - if ( (char *)v149 != v11 ) - { - v73 = pMouse->GetCursorPos(&v136); - v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; - if ( !v74 ) - return; - v149 = v74 - 1; - v75 = (int)window_SpeakInHouse->ptr_1C; - v76 = 9 * (v74 - 1 + 12 * v75); - if ( dword_F8B19C == 2 ) - v77 = (ItemGen *)&pParty->StandartItemsInShops[v76]; - else - v77 = &pParty->SpecialItemsInShop[(int)75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; - if ( v69 == (short)v11 || Str == v11 ) - { - v124 = (__int64 *)v11; - v122 = 2; - v120 = window_SpeakInHouse->ptr_1C; - v116 = v77; - v78 = uActiveCharacter - 1; - v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(v77, 2, v75, 2)]; - v14 = v78; - } - else - { - v124 = (__int64 *)v11; - v122 = 2; - v120 = window_SpeakInHouse->ptr_1C; - v116 = v77; - v15 = pGlobalTXT_LocalizationStrings[181]; - v14 = uActiveCharacter - 1; - } -LABEL_36: - v36 = BuilDialogueString(v15, v14, v116, (char *)v120, v122, v124); - v123 = 3; - v121 = v36; - v119 = v148; - v117 = (int)v11; - v113 = (int)v11; - v111 = &v144; - goto LABEL_63; - } - v72 = window_SpeakInHouse->ptr_1C; -LABEL_96: - v144._4B1854( - __PAIR__(pParty->field_3C.field_50[2 * (int)v72 + 1], pParty->field_3C.field_50[2 * (int)v72]) - - pParty->uTimePlayed); - return; - } - if ( dword_F8B19C == 5 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - sub_4B46A5(pGlobalTXT_LocalizationStrings[198], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() - || (v31 = pMouse->GetCursorPos(&v135)->x - 14, - v149 = (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; - v124 = 0; - v122 = 5; - 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]; - goto LABEL_36; - } - if ( dword_F8B19C == 1 ) - { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v16 = pShopOptions; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; - v17 = 0; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - v18 = pShopOptions; - do - { - v19 = pFontArrus->CalcTextHeight(*v18, &v144, 0, 0); - ++v18; - v17 += v19; - } - while ( (signed int)v18 < (signed int)&unk_F8B1C8 ); - v20 = pDialogueWindow; - v146 = (174 - v17) / 4; - v21 = pDialogueWindow->pStartingPosActiveItem; - v22 = v21 + pDialogueWindow->pNumPresenceButton; - v23 = (174 - 4 * (174 - v17) / 4 - v17) / 2 - (174 - v17) / 4 / 2 + 138; - v24 = -pDialogueWindow->pNumPresenceButton < 0; - v152 = pDialogueWindow->pStartingPosActiveItem; - if ( v24 ^ __OFSUB__(v21, v22) ) - { - _this = (Player *)2; - do - { - v25 = v20->GetControl(v152); - v26 = v25; - v25->uY = v146 + v23; - v27 = pFontArrus->CalcTextHeight(*v16, &v144, 0, 0); - v28 = v26->uY; - v29 = _this; - v26->uHeight = v27; - v23 = v28 + v27 - 1; - v26->uW = v23; - v30 = v147; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v29 ) - v30 = v148; - v144.DrawTitleText(pFontArrus, 0, v28, v30, *v16, 3u); - v20 = pDialogueWindow; - _this = (Player *)((char *)_this + 1); - ++v16; - ++v152; - } - while ( v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - } - return; - } - if ( dword_F8B19C == 2 ) - goto LABEL_64; - if ( dword_F8B19C == 3 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - sub_4B46A5(pGlobalTXT_LocalizationStrings[199], 0); - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() - || (v9 = pMouse->GetCursorPos(&v139)->x - 14, - v149 = (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) ) - return; - v124 = 0; - v122 = 3; - v120 = window_SpeakInHouse->ptr_1C; - v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; - v12 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v13 = v0->_490EEE(v116, 2, v12, 3); - v14 = uPlayerID; - v15 = (char *)pMerchantsSellPhrases[v13]; - goto LABEL_36; - } - if ( dword_F8B19C == 4 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - sub_4B46A5(pGlobalTXT_LocalizationStrings[197], 0); - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - 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); - v123 = 3; - v121 = v6; - v119 = v148; - v115 = (174 - pFontArrus->CalcTextHeight(v6, &v144, 0, 0)) / 2 + 138; - v112 = 0; - goto LABEL_14; - } - } - } - } - } -} + { + 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 v17; // 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 *v25; // eax@26 + GUIButton *v26; // esi@26 + int v27; // eax@26 + unsigned int v28; // ecx@26 + Player *v29; // edx@26 + unsigned __int16 v30; // ax@26 + 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 v54; // eax@60 + signed int v55; // 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 *v77; // 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 v144; // [sp+8Ch] [bp-78h]@1 + char *Str; // [sp+E0h] [bp-24h]@56 + int v146; // [sp+E4h] [bp-20h]@24 + int v147; // [sp+E8h] [bp-1Ch]@1 + int v148; // [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; + + v0 = pPlayers[uActiveCharacter]; + _this = pPlayers[uActiveCharacter]; + memcpy(&v144, window_SpeakInHouse, sizeof(v144)); + v144.uFrameX = 483; + v144.uFrameWidth = 148; + v144.uFrameZ = 334; + v148 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + v147 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + switch (dword_F8B19C) + { + case 1: //prepare shop text + { + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v16 = pShopOptions; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; + v17 = 0; + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + for(int i=0;i<4;++i) + { + v19 = pFontArrus->CalcTextHeight(pShopOptions[i], &v144, 0, 0); + v17 += v19; + } + v20 = pDialogueWindow; + v146 = (174 - v17) / 4; + v21 = pDialogueWindow->pStartingPosActiveItem; + v22 = v21 + pDialogueWindow->pNumPresenceButton; + v23 = (174 - 4 * (174 - v17) / 4 - v17) / 2 - (174 - v17) / 4 / 2 + 138; + v24 = -pDialogueWindow->pNumPresenceButton < 0; + v152 = pDialogueWindow->pStartingPosActiveItem; + if ( v24 ^ __OFSUB__(v21, v22) ) + { + th = 2; + do + { + v25 = v20->GetControl(v152); + v26 = v25; + v25->uY = v146 + v23; + v27 = pFontArrus->CalcTextHeight(*v16, &v144, 0, 0); + v28 = v26->uY; + v29 = _this; + v26->uHeight = v27; + v23 = v28 + v27 - 1; + v26->uW = v23; + v30 = v147; + if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v29 ) + v30 = v148; + v144.DrawTitleText(pFontArrus, 0, v28, v30, *v16, 3u); + v20 = pDialogueWindow; + ++th; + ++v16; + ++v152; + } + while ( v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + } + } + break; + case 2: //buy standart + { + pRenderer->DrawTextureIndexed(8u, 8u, dword_F8B164); + v55 = 0; + v153 = 0; + for(int i=0; i<8; ++i) + { + // if ( pParty->field_777C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][i].uItemID); + { + v56 = ItemsInShopTexture[v55]; + if ( i >= 4 ) + { + v60 = 90 - ((signed int)v56->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); + v59 = v60 + v153 + 80220; + } + else + { + v57 = 98 - v56->uTextureHeight; + v58 = ItemsInShopTexture[i]; + v152 = 86 - ((signed int)v56->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v153 + v152, v57, v58); + v59 = v153 + v152 + 640 * v57; + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1); + } + v153 += 105; + + } + + v11 = 0; + 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 ( (char *)pParty->field_777C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] != v11 ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][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" + } + 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; + v75 = (int)window_SpeakInHouse->ptr_1C; + v77 = &pParty->StandartItemsInShops[(int)v75][v74-1]; + if ( v69 ==0 || v70 == 0) + { + v120 = window_SpeakInHouse->ptr_1C; + v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(v77, 2, v75, 2)]; + } + else + { + v120 = window_SpeakInHouse->ptr_1C; + v15 = pGlobalTXT_LocalizationStrings[181]; + } + v36 = BuilDialogueString(v15, uActiveCharacter - 1, v77, (char *)v120, 2, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &v144, 0, 0)) / 2 + 138; + v144.DrawTitleText(pFontArrus, 0, v115, v148, v36, 3); + return; + } + v72 = window_SpeakInHouse->ptr_1C; + v144.DrawCurrentTime( pParty->field_3C.field_50[(int)v72]- pParty->uTimePlayed); + return; + } + break; + case 3: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() + || (v9 = pMouse->GetCursorPos(&v139)->x - 14, + v149 = (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) ) + return; + v124 = 0; + v122 = 3; + v120 = window_SpeakInHouse->ptr_1C; + v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; + v12 = (int)window_SpeakInHouse->ptr_1C; + uPlayerID = uActiveCharacter - 1; + v13 = v0->_490EEE(v116, 2, v12, 3); + v14 = uPlayerID; + v15 = (char *)pMerchantsSellPhrases[v13]; + v36 = BuilDialogueString(v15, v14, v116, (char *)v120, v122, v124); + v123 = 3; + v121 = v36; + v119 = v148; + v117 = (int)v11; + v113 = (int)v11; + v111 = &v144; + v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; + v112 = (unsigned int)v11; + v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); + return; + } + break; + case 4: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + 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); + v123 = 3; + v121 = v6; + v119 = v148; + v115 = (174 - pFontArrus->CalcTextHeight(v6, &v144, 0, 0)) / 2 + 138; + v112 = 0; + v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); + return; + } + } + } + } + } + break; + case 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() + || (v31 = pMouse->GetCursorPos(&v135)->x - 14, + v149 = (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; + v124 = 0; + v122 = 5; + 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, v122, v124); + v123 = 3; + v121 = v36; + v119 = v148; + v117 = (int)v11; + v113 = (int)v11; + v111 = &v144; + v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; + v112 = (unsigned int)v11; + v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); + return; + } + break; + case 6: + { + pRenderer->DrawTextureIndexed(8u, 8u, dword_F8B164); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v149 = 0; + v93 = 0; + do + { + // if ( pParty->field_C59C[9 * (v93 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v93].uItemID) + ++v149; + ++v93; + } + while ( v93 < 8 ); + if ( v149 ) + { + v94 = pMouse->GetCursorPos(&v132); + v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; + v95 = v149; + if ( v149 && v149 != -65536 ) + { + --v149; + v96 = window_SpeakInHouse->ptr_1C; + v97 = uActiveCharacter - 1; + // v98 = (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724]; + v99 = _this->_490EEE( + &pParty->SpecialItemsInShops[(int)v96][v95-1],// (ItemGen *)&pParty->field_C59C[9 * (v95 - 1 + 12 * (int)v96) + 724], + 2, + (int)window_SpeakInHouse->ptr_1C, + 2); + v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], v97, v98, (char *)v96, 2, 0); + v101 = v100; + v102 = v148; + v103 = pFontArrus->CalcTextHeight(v100, &v144, 0, 0); + v144.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, v102, v101, 3u); + } + v104 = 0; + v153 = 0; + do + { + //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][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; + } + v72 = window_SpeakInHouse->ptr_1C; + v144.DrawCurrentTime(pParty->field_3C.field_50[(int)v72]- pParty->uTimePlayed); + return; + } + break; + case 94: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + v79 = pShopOptions; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; + pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; + v80 = 0; + v81 = pShopOptions; + do + { + v82 = pFontArrus->CalcTextHeight(*v81, &v144, 0, 0); + ++v81; + v80 += v82; + } + while ( (signed int)v81 < (signed int)&pShopOptions[3] ); + v83 = pDialogueWindow; + v152 = (174 - v80) / 3; + v84 = pDialogueWindow->pStartingPosActiveItem; + v85 = v84 + pDialogueWindow->pNumPresenceButton; + v86 = (3 * (58 - v152) - v80) / 2 - v152 / 2 + 138; + v24 = -pDialogueWindow->pNumPresenceButton < 0; + _this = (Player *)pDialogueWindow->pStartingPosActiveItem; + if ( v24 ^ __OFSUB__(v84, v85) ) + { + v153 = 2; + do + { + v87 = v83->GetControl((unsigned int)_this); + v88 = v87; + v87->uY = v152 + v86; + v89 = pFontArrus->CalcTextHeight(*v79, &v144, 0, 0); + v90 = v88->uY; + v91 = v153; + v88->uHeight = v89; + v86 = v90 + v89 - 1; + v88->uW = v86; + v92 = v147; + if ( pDialogueWindow->pCurrentPosActiveItem != v91 ) + v92 = v148; + v144.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 95: //buy spesial + { + + pRenderer->DrawTextureIndexed(8u, 8u, dword_F8B164); + + v11 = 0; + v61 = 0; + v153 = 0; + do + { + // if ( (char *)pParty->field_C59C[9 * (v61 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v61].uItemID) + { + v62 = ItemsInShopTexture[v61]; + if ( v61 >= 4 ) + { + v67 = 90 - ((signed int)v62->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); + v126 = v61 + 1; + 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); + v126 = v61 + 1; + v66 = v152 + v153 + 640 * v63; + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v126); + v11 = 0; + } + v153 += 105; + ++v61; + } + while ( v61 < 8 ); + + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v68 = 0; + v149 = (__int32)v11; + + do + { + // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v68].uItemID) + ++v149; + ++v68; + } + while ( v68 < 6 ); + + v69 = GetAsyncKeyState(17); + v70 = _this->CanSteal(); + Str = (char *)v70; + if ( v69 == (short)v11 || (char *)v70 == v11 ) + { + v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" + } + else + { + v71 = pGlobalTXT_LocalizationStrings[185]; + } + DrawTextAtStatusBar(v71, 0); + if ( (char *)v149 != v11 ) + { + v73 = pMouse->GetCursorPos(&v136); + v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; + if ( !v74 ) + return; + v149 = v74 - 1; + v75 = (int)window_SpeakInHouse->ptr_1C; + v76 = 9 * (v74 - 1 + 12 * v75); + if ( dword_F8B19C == 2 ) + v77 = (ItemGen *)&pParty->StandartItemsInShops[(int)75][v74-1]; + else + v77 = &pParty->SpecialItemsInShops[(int)v75][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; + if ( v69 == (short)v11 || Str == v11 ) + { + v124 = (__int64 *)v11; + v122 = 2; + v120 = window_SpeakInHouse->ptr_1C; + v116 = v77; + v78 = uActiveCharacter - 1; + v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(v77, 2, v75, 2)]; + v14 = v78; + } + else + { + v124 = (__int64 *)v11; + v122 = 2; + v120 = window_SpeakInHouse->ptr_1C; + v116 = v77; + v15 = pGlobalTXT_LocalizationStrings[181]; + v14 = uActiveCharacter - 1; + } + v36 = BuilDialogueString(v15, v14, v116, (char *)v120, v122, v124); + v123 = 3; + v121 = v36; + v119 = v148; + v117 = (int)v11; + v113 = (int)v11; + v111 = &v144; + v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; + v112 = (unsigned int)v11; + v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); + return; + } + v72 = window_SpeakInHouse->ptr_1C; + v144.DrawCurrentTime( pParty->field_3C.field_50[(int)v72]- pParty->uTimePlayed); + return; + } + + break; + case 96: + 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)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] ) + { + v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &v144, 0, 0); + v152 += v42; + ++v153; + } + ++v39; + } + while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); + if ( v153 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); + v144.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->uControlParam - 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, &v144, 0, 0); + v49 = v45->uY; + v50 = v153; + v45->uHeight = v48; + v51 = v49 + v48 - 1; + v45->uW = v51; + v146 = v51; + v52 = v147; + if ( pDialogueWindow->pCurrentPosActiveItem != v50 ) + v52 = v148; + v144.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u); + } + v53 = v37->pStartingPosActiveItem; + ++v152; + v54 = v37->pNumPresenceButton + v53; + ++v153; + } + while ( v152 < v54 ); + } + return; + } + } + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + v11 = 0; + v36 = pTmpBuf; + v123 = 3; + v121 = pTmpBuf; + v119 = v147; + v117 = 0; + v113 = 0; + v111 = &v144; + v115 = (174 - pFontArrus->CalcTextHeight(v36, v111, v113, v117)) / 2 + 138; + v112 = (unsigned int)v11; + v144.DrawTitleText(pFontArrus, v112, v115, v119, v121, v123); + return; + break; + + } + + } //----- (004BB756) -------------------------------------------------------- signed int __fastcall sub_4BB756(signed int a1) @@ -3699,7 +3757,7 @@ //v3 = dword_F8B198; if ( dword_F8B19C != 1 ) goto LABEL_13; - if ( dword_F8B198 == 30 ) + if ( in_current_bilding_type == BildingType_Training ) { if ( uMessageParam == 17 ) { @@ -3720,9 +3778,9 @@ goto LABEL_9; } v8 = window_SpeakInHouse; - if ( (dword_F8B198 == 27 || dword_F8B198 == 28) + if ( (in_current_bilding_type == BildingType_Stables || in_current_bilding_type == BildingType_Boats) && (v1 = 0, *(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + uMessageParam)] + pParty->uDaysPlayed % 7)) - || dword_F8B198 != 23 || uMessageParam != 10 ) + || in_current_bilding_type != BildingType_Temple || uMessageParam != BildingType_MindGuild ) { LABEL_9: pDialogueWindow->Release(); @@ -3743,34 +3801,34 @@ } LABEL_11: dword_F8B19C = uMessageParam; - if ( dword_F8B198 < 19 ) - { - v9 = pIcons_LOD->LoadTexture(off_4F03B8[dword_F8B198], TEXTURE_16BIT_PALETTE); + if ( in_current_bilding_type < BildingType_19 ) + { + v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_bilding_type], TEXTURE_16BIT_PALETTE); //v3 = dword_F8B198; dword_F8B164 = &pIcons_LOD->pTextures[v9]; LABEL_13: v8 = window_SpeakInHouse; } - if ( dword_F8B198 > 21 ) - { - if ( dword_F8B198 == 22 ) + if ( in_current_bilding_type > BildingType_Tavern ) + { + if ( in_current_bilding_type == BildingType_Bank ) { if ( dword_F8B19C >= 7 && dword_F8B19C <= 8 ) pKeyActionMap->EnterText(1, 10, v8); return; } - if ( dword_F8B198 != 23 && dword_F8B198 != 30 ) + if ( in_current_bilding_type != BildingType_Temple && in_current_bilding_type != BildingType_Training ) return; } else { - if ( dword_F8B198 != 21 ) - { - if ( dword_F8B198 <= (signed int)v1 ) + if ( in_current_bilding_type != BildingType_Tavern ) + { + if ( in_current_bilding_type <= (signed int)v1 ) return; - if ( dword_F8B198 > 4 ) - { - if ( dword_F8B198 <= 16 ) + if ( in_current_bilding_type > BildingType_AlchemistShop ) + { + if ( in_current_bilding_type <= BildingType_16 ) { if ( (signed __int64)__PAIR__( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)v8->ptr_1C + 44472], @@ -3782,11 +3840,9 @@ v33 = *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v32 + 12 * (unsigned int)v8->ptr_1C)); if ( v33 ) { - v34 = pIcons_LOD->LoadTexture( - pItemsTable->pItems[v33].pIconName, - TEXTURE_16BIT_PALETTE); + v34 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v33].pIconName, TEXTURE_16BIT_PALETTE); v8 = window_SpeakInHouse; - dword_F8B168[v32] = &pIcons_LOD->pTextures[v34]; + ItemsInShopTexture[v32] = &pIcons_LOD->pTextures[v34]; } ++v32; } @@ -3806,7 +3862,7 @@ } return; } - if ( dword_F8B198 != 17 ) + if ( in_current_bilding_type != BildingType_TownHall ) return; if ( uMessageParam == 99 ) { @@ -4022,12 +4078,12 @@ case 96: pDialogueWindow->eWindowType = WINDOW_MainMenu; UI_CreateEndConversationButton(); - sub_4B3703(dword_F8B198); + FillAviableSkillsToTeach(in_current_bilding_type); break; case 101: pDialogueWindow->eWindowType = WINDOW_MainMenu; UI_CreateEndConversationButton(); - sub_4B3A72(dword_F8B198); + sub_4B3A72(in_current_bilding_type); break; case 102: dword_F8B19C = 102; @@ -4092,7 +4148,7 @@ if ( pParty->uNumGold < v37 ) { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - if ( dword_F8B198 == 30 || dword_F8B198 == 21 ) + if ( in_current_bilding_type == BildingType_Training || in_current_bilding_type == BildingType_Tavern ) v39 = 4; else v39 = 2; @@ -4114,7 +4170,7 @@ { pDialogueWindow->eWindowType = WINDOW_MainMenu; UI_CreateEndConversationButton(); - sub_4B3AD4(dword_F8B198); + sub_4B3AD4(in_current_bilding_type); } } } @@ -4126,9 +4182,7 @@ sub_421B2C_PlaceInInventory_or_DropPickedItem(); return; } - if ( (signed __int64)__PAIR__( - pParty->field_3C.field_50[2 * (unsigned int)v8->ptr_1C + 1], - pParty->field_3C.field_50[2 * (unsigned int)v8->ptr_1C]) < (signed __int64)pParty->uTimePlayed ) + if ( pParty->field_3C.field_50[(unsigned int)v8->ptr_1C] < (signed __int64)pParty->uTimePlayed ) { GenerateStandartShopItems(); GenerateSpecialShopItems(); @@ -4158,7 +4212,7 @@ v46 = pIcons_LOD->LoadTexture(pItemsTable->pItems[v45].pIconName, TEXTURE_16BIT_PALETTE); //v3 = dword_F8B198; v8 = window_SpeakInHouse; - dword_F8B168[v43] = &pIcons_LOD->pTextures[v46]; + ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v46]; } v42 = v8->ptr_1C; ++v43; @@ -4166,7 +4220,7 @@ //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 ( dword_F8B198 == 1 ) + if ( in_current_bilding_type == BildingType_WeaponShop ) { v47 = v8->ptr_1C; v48 = 0; @@ -4180,7 +4234,7 @@ { v49 = rand(); v8 = window_SpeakInHouse; - word_F8B158[v48] = v49 % (300 - dword_F8B168[v48]->uTextureHeight); + word_F8B158[v48] = v49 % (300 - ItemsInShopTexture[v48]->uTextureHeight); } v47 = v8->ptr_1C; ++v48; @@ -4197,13 +4251,13 @@ do { //v50 = pParty->field_C59C[9 * (v43 + 12 * (int)v42) + 724]; - v50=pParty->SpecialItemsInShop[(unsigned int)v42][(signed int)v43].uItemID; + 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; - dword_F8B168[v43] = &pIcons_LOD->pTextures[v51]; + ItemsInShopTexture[v43] = &pIcons_LOD->pTextures[v51]; } v42 = v8->ptr_1C; ++v43; @@ -4211,7 +4265,7 @@ //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 ( dword_F8B198 == 1 ) + if ( in_current_bilding_type == BildingType_WeaponShop ) { v52 = v8->ptr_1C; v53 = 0; @@ -4221,11 +4275,11 @@ do { // if ( pParty->field_C59C[9 * (v53 + 12 * (int)v52) + 724] ) - if (pParty->SpecialItemsInShop[(unsigned int)v52][v53].uItemID) + if (pParty->SpecialItemsInShops[(unsigned int)v52][v53].uItemID) { v54 = rand(); v8 = window_SpeakInHouse; - word_F8B158[v53] = v54 % (300 - dword_F8B168[v53]->uTextureHeight); + word_F8B158[v53] = v54 % (300 - ItemsInShopTexture[v53]->uTextureHeight); } v52 = v8->ptr_1C; ++v53; @@ -4280,7 +4334,7 @@ { UI_CreateEndConversationButton(); dword_F8B19C = 94; - sub_4B3AD4(dword_F8B198); + sub_4B3AD4(in_current_bilding_type); } else { @@ -4289,13 +4343,13 @@ pVideoPlayer->_4BF5B2(); LABEL_28: dword_F8B19C = 1; - sub_4B3B42(dword_F8B198); + sub_4B3B42(in_current_bilding_type); return 1; } pVideoPlayer->_4BF5B2(); UI_CreateEndConversationButton(); dword_F8B19C = 101; - sub_4B3A72(dword_F8B198); + sub_4B3A72(in_current_bilding_type); } return 1; } @@ -4458,7 +4512,7 @@ { ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" v13 = window_SpeakInHouse->ptr_1C; - if ( dword_F8B198 == 30 ) + if ( in_current_bilding_type == BildingType_Training ) v55 = 4; else v55 = 2; @@ -4539,8 +4593,8 @@ } else { - _this =&pParty->SpecialItemsInShop[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724]; - v32 = &pParty->SpecialItemsInShop[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; + _this =&pParty->SpecialItemsInShops[(int)v30][v29-1]; //(ItemGen *)&pParty->field_C59C[v31 + 724]; + v32 = &pParty->SpecialItemsInShops[(int)v30][v29-1];//(ItemGen *)&pParty->field_C59C[v31 + 724]; } //v33 = p2DEvents_minus1__20[13 * (signed int)v30]; v33 = p2DEvents[(signed int)v30 - 1].fPriceMultiplier; @@ -4941,33 +4995,6 @@ } // F8B5E8: using guessed type FrameTableTxtLine stru_F8B5E8; -//----- (004BE571) -------------------------------------------------------- -int __fastcall sub_4BE571(int a1, int *a2, int a3, int a4) -{ - int result; // eax@1 - int i; // esi@3 - - result = a3; - if ( a3 < a4 ) - { - for ( i = 0; i < a3; ++i ) - { - if ( a1 == a2[i] ) - break; - } - if ( i == a3 ) - { - a2[a3] = a1; - result = a3 + 1; - } - } - else - { - result = a4; - } - return result; -} - //----- (004BF91E) -------------------------------------------------------- @@ -7815,9 +7842,9 @@ //----- (0044FFD8) -------------------------------------------------------- int MapInfo::SpawnRandomTreasure(SpawnPointMM7 *a2) { - MapInfo *v2; // ebx@1 - SpawnPointMM7 *v3; // esi@1 - int v4; // eax@1 + //MapInfo *v2; // ebx@1 + //SpawnPointMM7 *v3; // esi@1 + //int v4; // eax@1 int v5; // edx@1 int v6; // eax@1 int v7; // ecx@1 @@ -7840,69 +7867,66 @@ unsigned __int16 v24; // dx@29 char *v25; // ecx@30 unsigned __int16 v26; // ax@33 - int v27; // ecx@35 - int v28; // eax@35 - int v29; // esi@35 - __int16 v30; // ax@35 + //int v27; // ecx@35 + //int v28; // eax@35 + //int v29; // esi@35 + //__int16 v30; // ax@35 LayingItem a1a; // [sp+Ch] [bp-7Ch]@1 - int v32; // [sp+7Ch] [bp-Ch]@1 - int v33; // [sp+80h] [bp-8h]@1 + //int v32; // [sp+7Ch] [bp-Ch]@1 + //int v33; // [sp+80h] [bp-8h]@1 int v34; // [sp+84h] [bp-4h]@1 - __debugbreak(); - - auto a1 = this; - - v2 = a1; - v3 = a2; - v4 = rand(); + //auto a1 = this; + //v2 = a1; + //v3 = a2; + //v4 = rand(); v34 = 0; - v5 = v4 % 100; + v5 = rand() % 100; // v6 = 2 * (v2->Treasure_prob + 7 * v3->uIndex) - 14; - v7 = (unsigned __int8)byte_4E8168[v3->uIndex-1][2*v2->Treasure_prob]; - v8 = (unsigned __int8)byte_4E8168[v3->uIndex-1][2*v2->Treasure_prob+1]; - v32 = v5; - v33 = v7; + v7 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob]; + v8 = (unsigned __int8)byte_4E8168[a2->uIndex - 1][2 * Treasure_prob + 1]; + //v32 = v5; + //v33 = v7; v9 = rand(); - v10 = v8 - v33 + 1; + v10 = v8 - v7 + 1; v12 = v9; result = v9 / v10; - v13 = v33 + (unsigned __int64)(v12 % v10); + v13 = v7 + (unsigned __int64)(v12 % v10); if ( v13 < 7 ) { - if ( v32 < 20 ) + if ( v5 < 20 ) return result; - if ( v32 >= 60 ) - { - v19 = v3->vPosition.z; - v20 = v3->vPosition.y; - v21 = v3->vPosition.x; + if ( v5 >= 60 ) + { + v19 = a2->vPosition.z; + v20 = a2->vPosition.y; + v21 = a2->vPosition.x; v22 = rand(); return sub_450521_ProllyDropItemAt(v13, v22 % 27 + 20, v21, v20, v19, 0); } - if ( v3->uIndex == 1 ) + if ( a2->uIndex == 1 ) { v14 = rand() % 51 + 50; } else { - if ( v3->uIndex != 2 ) - { - if ( v3->uIndex == 3 ) + if ( a2->uIndex != 2 ) + { + if ( a2->uIndex == 3 ) { v14 = rand() % 301 + 200; } else { - if ( v3->uIndex != 4 ) - { - if ( v3->uIndex == 5 ) + if ( a2->uIndex != 4 ) + { + if ( a2->uIndex == 5 ) { v14 = rand() % 1001 + 1000; } else { - if ( v3->uIndex != 6 ) + if ( a2->uIndex != 6 ) { LABEL_20: v15 = 0; @@ -7972,24 +7996,21 @@ } a1a.uObjectDescID = v26; a1a.stru_24.Reset(); + LABEL_35: - v27 = v3->vPosition.y; - v28 = v3->vPosition.x; - v29 = v3->vPosition.z; - a1a.vPosition.y = v27; + a1a.vPosition.y = a2->vPosition.y; a1a.uAttributes = 0; a1a.uSoundID = 0; a1a.uFacing = 0; - a1a.vPosition.z = v29; - a1a.vPosition.x = v28; + a1a.vPosition.z = a2->vPosition.z; + a1a.vPosition.x = a2->vPosition.x; a1a.field_50 = 0; a1a.field_4C = 0; a1a.field_48 = 0; - v30 = pIndoor->GetSector(v28, v27, v29); a1a.field_5C = 0; a1a.field_58_pid = 0; a1a.uSpriteFrameID = 0; - a1a.uSectorID = v30; + a1a.uSectorID = pIndoor->GetSector(a2->vPosition.x, a2->vPosition.y, a2->vPosition.z);; return a1a.Create(0, 0, 0, 0); } @@ -13312,7 +13333,7 @@ } } else - Log::Warning(L"MM init: failed"); + Log::Warning(L"MM init: failed"); pGame->Deinitialize(); }
--- a/mm7_4.cpp Tue Feb 26 18:47:30 2013 +0600 +++ b/mm7_4.cpp Tue Feb 26 18:48:05 2013 +0600 @@ -9069,20 +9069,20 @@ ItemGen *v7; // ecx@13 signed int v8; // esi@17 unsigned int v9; // eax@19 - char v10; // [sp+8h] [bp-44h]@12 - char v11; // [sp+10h] [bp-3Ch]@12 - char v12; // [sp+18h] [bp-34h]@18 - char v13; // [sp+20h] [bp-2Ch]@17 - char v14; // [sp+28h] [bp-24h]@17 - char v15; // [sp+30h] [bp-1Ch]@17 - char v16; // [sp+38h] [bp-14h]@5 + POINT v10; // [sp+8h] [bp-44h]@12 + POINT v11; // [sp+10h] [bp-3Ch]@12 + POINT v12; // [sp+18h] [bp-34h]@18 + POINT v13; // [sp+20h] [bp-2Ch]@17 + POINT v14; // [sp+28h] [bp-24h]@17 + POINT v15; // [sp+30h] [bp-1Ch]@17 + POINT v16; // [sp+38h] [bp-14h]@5 POINT a2; // [sp+40h] [bp-Ch]@5 int v18; // [sp+48h] [bp-4h]@5 //v0 = pPlayers[uActiveCharacter]; - if ( dword_F8B198 <= 0 ) + if ( in_current_bilding_type <= 0 ) return; - if ( dword_F8B198 <= 4 ) + if ( in_current_bilding_type <= BildingType_AlchemistShop ) { if ( dword_F8B19C != 2 ) { @@ -9090,10 +9090,10 @@ return; if ( dword_F8B19C <= 5 || dword_F8B19C == 94 ) { - v8 = pMouse->GetCursorPos((POINT *)&v15)->x - 14; - v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos((POINT *)&v14)->y - 17) >> 5); - if ( pMouse->GetCursorPos((POINT *)&v13)->x <= 13 - || pMouse->GetCursorPos((POINT *)&v12)->x >= 462 + v8 = pMouse->GetCursorPos(&v15)->x - 14; + v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); + if ( pMouse->GetCursorPos(&v13)->x <= 13 + || pMouse->GetCursorPos(&v12)->x >= 462 || (v9 = pPlayers[uActiveCharacter]->GetItemIDAtInventoryIndex(&v18)) == 0 ) return; v7 = (ItemGen *)&pPlayers[uActiveCharacter]->pInventoryItems[v9-1]; @@ -9104,8 +9104,8 @@ if ( dword_F8B19C != 95 ) return; } - v4 = pMouse->GetCursorPos((POINT *)&v11); - v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v10)->y]] & 0xFFFF; + v4 = pMouse->GetCursorPos(&v11); + v5 = pRenderer->pActiveZBuffer[v4->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v10)->y]] & 0xFFFF; v18 = v5; if ( !v5 ) return; @@ -9113,13 +9113,13 @@ v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); if ( dword_F8B19C != 2 ) // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; - v7 =&pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; + v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; goto LABEL_15; } - if ( dword_F8B198 <= 16 && dword_F8B19C == 18 ) + if ( in_current_bilding_type <= BildingType_16 && dword_F8B19C == BildingType_18 ) { v1 = pMouse->GetCursorPos(&a2); - v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v16)->y]; + v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; v3 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; v18 = pRenderer->pActiveZBuffer[v2] & 0xFFFF; if ( v18 ) @@ -9180,19 +9180,19 @@ int v6; // esi@20 int v7[4]; // [sp+Ch] [bp-10h]@12 - if ( dword_F8B198 > 0 ) + if ( in_current_bilding_type > 0 ) { v0 = 3; - if ( dword_F8B198 > 3 ) - { - if ( dword_F8B198 == 22 ) + if ( in_current_bilding_type > BildingType_MagicShop ) + { + if ( in_current_bilding_type == BildingType_Bank ) { if ( !dword_F8B1E4 ) return; } else { - if ( dword_F8B198 != 23 ) + if ( in_current_bilding_type != BildingType_Temple ) return; } v1 = (unsigned int)window_SpeakInHouse->ptr_1C; @@ -9638,7 +9638,7 @@ strcpy(v22, v24); pParty->field_709 = 0; sub_44A56A(); - PrepareHouse((HOUSE_TYPE)(int)window_SpeakInHouse->ptr_1C); + PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); dword_F8B19C = 1; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); @@ -10350,94 +10350,61 @@ //----- (004B36CC) -------------------------------------------------------- -GUIButton *__fastcall sub_4B36CC(int a1, unsigned int a2) -{ - return pDialogueWindow->CreateButton( - 0x1E0u, - 30 * a1 + 146, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0x195u, - a2, - 0, - "", - 0); +void CreateButtonInColumn( int column_pos, unsigned int control_id ) + { + pDialogueWindow->CreateButton( 480, 30 * column_pos + 146, 140, 30, 1, 0, 0x195u, control_id, 0, "", 0); } //----- (004B3A72) -------------------------------------------------------- -int __thiscall sub_4B3A72(int a1) -{ - int v1; // esi@1 - int result; // eax@4 - - v1 = 0; +void sub_4B3A72( int a1 ) + { + int num_buttons; // esi@1 + + num_buttons = 0; if ( a1 == 21 ) { - sub_4B36CC(0, 0x66u); - v1 = 2; - sub_4B36CC(1, 0x67u); - if ( pParty->HasItem(0x28Bu) ) - { - v1 = 3; - sub_4B36CC(2, 0x68u); - } - } - pDialogueWindow->_41D08F(v1, 1, 0, 2); - result = pDialogueWindow->pNumPresenceButton; + CreateButtonInColumn(0, 0x66u); + num_buttons = 2; + CreateButtonInColumn(1, 0x67u); + if ( pParty->HasItem(651) ) //Arcomage Deck + { + num_buttons = 3; + CreateButtonInColumn(2, 0x68u); + } + } + pDialogueWindow->_41D08F(num_buttons, 1, 0, 2); dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; - return result; } // F8B1E0: using guessed type int dword_F8B1E0; //----- (004B3AD4) -------------------------------------------------------- -int __fastcall sub_4B3AD4(signed int a1) -{ - int result; // eax@7 - int v2; // [sp-10h] [bp-10h]@4 - int v3; // [sp-Ch] [bp-Ch]@4 - int v4; // [sp-8h] [bp-8h]@4 - int v5; // [sp-4h] [bp-4h]@4 - +void sub_4B3AD4( signed int a1 ) + { if ( a1 > 0 ) { if ( a1 <= 3 ) { - sub_4B36CC(0, 3u); - sub_4B36CC(1, 4u); - sub_4B36CC(2, 5u); - v5 = 2; - v4 = 0; - v3 = 1; - v2 = 3; - goto LABEL_6; + CreateButtonInColumn(0, 3u); + CreateButtonInColumn(1, 4u); + CreateButtonInColumn(2, 5u); + pDialogueWindow->_41D08F(3, 1, 0, 2); } if ( a1 == 4 ) { - sub_4B36CC(0, 3u); - sub_4B36CC(1, 4u); - v5 = 2; - v4 = 0; - v3 = 1; - v2 = 2; -LABEL_6: - pDialogueWindow->_41D08F(v2, v3, v4, v5); - goto LABEL_7; - } - } -LABEL_7: - result = pDialogueWindow->pNumPresenceButton; + CreateButtonInColumn(0, 3u); + CreateButtonInColumn(1, 4u); + pDialogueWindow->_41D08F(2, 1, 0, 2); + } + } dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; - return result; } // F8B1E0: using guessed type int dword_F8B1E0; //----- (004B3B42) -------------------------------------------------------- -int __fastcall sub_4B3B42(signed int a1) -{ +void sub_4B3B42( signed int a1 ) + { int v1; // ecx@18 int v2; // ecx@19 int v3; // ecx@20 @@ -10462,11 +10429,11 @@ { if ( a1 == 23 ) { - sub_4B36CC(0, 0xAu); - sub_4B36CC(1, 0xBu); + CreateButtonInColumn(0, 0xAu); + CreateButtonInColumn(1, 0xBu); v14 = 96; LABEL_41: - sub_4B36CC(2, v14); + CreateButtonInColumn(2, v14); v17 = 2; v11 = 0; v10 = 1; @@ -10479,31 +10446,31 @@ { if ( a1 != 30 ) goto LABEL_43; - sub_4B36CC(0, 0x11u); + CreateButtonInColumn(0, 0x11u); v16 = 96; goto LABEL_37; } - sub_4B36CC(0, 0x69u); - sub_4B36CC(1, 0x6Au); - sub_4B36CC(2, 0x6Bu); + CreateButtonInColumn(0, 0x69u); + CreateButtonInColumn(1, 0x6Au); + CreateButtonInColumn(2, 0x6Bu); v12 = 108; } else { if ( a1 == 22 ) { - sub_4B36CC(0, 7u); + CreateButtonInColumn(0, 7u); v16 = 8; goto LABEL_37; } v1 = a1 - 14; if ( !v1 ) { - sub_4B36CC(0, 0x12u); - sub_4B36CC(1, 0x30u); - sub_4B36CC(2, 0x31u); - sub_4B36CC(3, 0x32u); - sub_4B36CC(4, 0x33u); + CreateButtonInColumn(0, 0x12u); + CreateButtonInColumn(1, 0x30u); + CreateButtonInColumn(2, 0x31u); + CreateButtonInColumn(3, 0x32u); + CreateButtonInColumn(4, 0x33u); v17 = 2; v11 = 0; v10 = 1; @@ -10518,10 +10485,10 @@ { if ( v3 != 4 ) goto LABEL_43; - sub_4B36CC(0, 0xFu); - sub_4B36CC(1, 0x10u); + CreateButtonInColumn(0, 0xFu); + CreateButtonInColumn(1, 0x10u); v4 = 3; - sub_4B36CC(2, 0x60u); + CreateButtonInColumn(2, 0x60u); v5 = (signed int)window_SpeakInHouse->ptr_1C; if ( v5 < 108 || v5 > 120 ) goto LABEL_28; @@ -10532,7 +10499,7 @@ else { v4 = 1; - sub_4B36CC(0, 0x63u); + CreateButtonInColumn(0, 0x63u); if ( !pParty->uFine ) { LABEL_28: @@ -10548,16 +10515,16 @@ v7 = 1; v6 = 100; } - sub_4B36CC(v7, v6); + CreateButtonInColumn(v7, v6); goto LABEL_28; } - sub_4B36CC(0, 0x12u); - sub_4B36CC(1, 0x34u); - sub_4B36CC(2, 0x35u); + CreateButtonInColumn(0, 0x12u); + CreateButtonInColumn(1, 0x34u); + CreateButtonInColumn(2, 0x35u); v12 = 54; } LABEL_39: - sub_4B36CC(3, v12); + CreateButtonInColumn(3, v12); v17 = 2; v11 = 0; v10 = 1; @@ -10566,10 +10533,10 @@ } if ( a1 == 13 ) { - sub_4B36CC(0, 0x12u); + CreateButtonInColumn(0, 0x12u); v16 = 56; LABEL_37: - sub_4B36CC(1, v16); + CreateButtonInColumn(1, v16); v17 = 2; v11 = 0; v10 = 1; @@ -10582,56 +10549,54 @@ case 2: case 3: case 4: - sub_4B36CC(0, 2u); - sub_4B36CC(1, 0x5Fu); - sub_4B36CC(2, 0x5Eu); + CreateButtonInColumn(0, 2u); + CreateButtonInColumn(1, 0x5Fu); + CreateButtonInColumn(2, 0x5Eu); v12 = 96; goto LABEL_39; case 5: - sub_4B36CC(0, 0x12u); + CreateButtonInColumn(0, 0x12u); v13 = 48; goto LABEL_9; case 6: - sub_4B36CC(0, 0x12u); + CreateButtonInColumn(0, 0x12u); v13 = 49; goto LABEL_9; case 7: - sub_4B36CC(0, 0x12u); + CreateButtonInColumn(0, 0x12u); v13 = 50; goto LABEL_9; case 8: - sub_4B36CC(0, 0x12u); + CreateButtonInColumn(0, 0x12u); v13 = 51; LABEL_9: - sub_4B36CC(1, v13); + CreateButtonInColumn(1, v13); v14 = 72; goto LABEL_41; case 9: - sub_4B36CC(0, 0x12u); + CreateButtonInColumn(0, 0x12u); v15 = 52; goto LABEL_13; case 10: - sub_4B36CC(0, 0x12u); + CreateButtonInColumn(0, 0x12u); v15 = 53; goto LABEL_13; case 11: - sub_4B36CC(0, 0x12u); + CreateButtonInColumn(0, 0x12u); v15 = 54; LABEL_13: - sub_4B36CC(1, v15); + CreateButtonInColumn(1, v15); v14 = 61; goto LABEL_41; case 12: - sub_4B36CC(0, 0x12u); + CreateButtonInColumn(0, 0x12u); v16 = 55; goto LABEL_37; default: break; } LABEL_43: - result = pDialogueWindow->pNumPresenceButton; dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; - return result; } // F8B1E0: using guessed type int dword_F8B1E0; @@ -10816,7 +10781,7 @@ pDialogueWindow->CreateButton(8u, 8u, 0x1C2u, 0x140u, 1, 0, 0x51u, 0, 0, "", 0); if ( pDialogueNPCCount == 1 && dword_591080 ) { - sub_4B3B42(dword_F8B198); + sub_4B3B42(in_current_bilding_type); } else { @@ -10891,17 +10856,12 @@ //----- (004B46A5) -------------------------------------------------------- -char __fastcall sub_4B46A5(const char *Str, int a5) -{ - const char *v2; // esi@1 - int v3; // edi@1 +char __fastcall DrawTextAtStatusBar(const char *sText, int font_color) +{ int v4; // eax@1 - - v2 = Str; - v3 = a5; - pRenderer->DrawTextureRGB(0, 0x160u, pTexture_StatusBar); - v4 = pFontLucida->AlignText_Center(0x1C2u, v2); - return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, v3, v2, 0, 0, 0); + pRenderer->DrawTextureRGB(0, 352, pTexture_StatusBar); + v4 = pFontLucida->AlignText_Center(450, sText); + return pPrimaryWindow->DrawText(pFontLucida, v4 + 11, 357, font_color, sText, 0, 0, 0); } //----- (004B46F8) -------------------------------------------------------- @@ -11611,7 +11571,7 @@ { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - sub_4B46A5(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0);// "Select the Item to Repair" result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( !result || (v27 = pMouse->GetCursorPos(&v110)->x - 14, @@ -11697,7 +11657,7 @@ { draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - sub_4B46A5(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0);// "Select the Item to Identify" result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( result ) { @@ -11742,7 +11702,7 @@ } draw_leather(); CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - sub_4B46A5(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);// "Select the Item to Sell" result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); if ( !result || (v11 = pMouse->GetCursorPos(&v107)->x - 14, @@ -11785,7 +11745,7 @@ // if ( pParty->field_777C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID); { - v50 = dword_F8B168[v49]; + v50 = ItemsInShopTexture[v49]; v51 = 152 - v50->uTextureHeight; if ( (signed int)v51 < 1 ) v51 = 0; @@ -11794,7 +11754,7 @@ { if ( v122 == 5 ) { - v53 = dword_F8B168[5]->uTextureWidth; + v53 = ItemsInShopTexture[5]->uTextureWidth; if ( (signed int)v52 > 457 - v53 ) v52 = 457 - v53; } @@ -11805,7 +11765,7 @@ v52 = 18; } pRenderer->DrawTextureTransparent(v52, v51, v50); - sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], dword_F8B168[v122], v122 + 1); + sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1); v49 = v122; } ++v49; @@ -11818,14 +11778,14 @@ //if ( pParty->field_777C[9 * (v122 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 54] ) if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v122+1].uItemID); { - v54 = dword_F8B168[v122 + 6]; + v54 = ItemsInShopTexture[v122 + 6]; v55 = 306 - v54->uTextureHeight; v56 = 75 * v122 - v54->uTextureWidth / 2 + 40; if ( v122 ) { if ( v122 == 5 ) { - v57 = dword_F8B168[11]->uTextureWidth; + v57 = ItemsInShopTexture[11]->uTextureWidth; if ( (signed int)v56 > 457 - v57 ) v56 = 457 - v57; } @@ -11836,7 +11796,7 @@ v56 = 18; } pRenderer->DrawTextureTransparent(v56, v55, v54); - sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], dword_F8B168[v122 + 6], v122 + 7); + sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7); } ++v122; } @@ -11847,9 +11807,9 @@ do { // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) - { - v58 = dword_F8B168[v49]; + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uItemID) + { + v58 = ItemsInShopTexture[v49]; v59 = 152 - v58->uTextureHeight; if ( (signed int)v59 < 1 ) v59 = 0; @@ -11858,7 +11818,7 @@ { if ( v122 == 5 ) { - v61 = dword_F8B168[5]->uTextureWidth; + v61 = ItemsInShopTexture[5]->uTextureWidth; if ( (signed int)v60 > 457 - v61 ) v60 = 457 - v61; } @@ -11869,7 +11829,7 @@ v60 = 18; } pRenderer->DrawTextureTransparent(v60, v59, v58); - sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], dword_F8B168[v122], v122 + 1); + sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1); v49 = v122; } ++v49; @@ -11880,9 +11840,9 @@ do { //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] ) //weak - if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes) - { - v62 = dword_F8B168[v122 + 6]; + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v49].uAttributes) + { + v62 = ItemsInShopTexture[v122 + 6]; v63 = 306 - v62->uTextureHeight; if ( (signed int)v63 < 1 ) v63 = 0; @@ -11891,7 +11851,7 @@ { if ( v122 == 5 ) { - v65 = dword_F8B168[11]->uTextureWidth; + v65 = ItemsInShopTexture[11]->uTextureWidth; if ( (signed int)v64 > 457 - v65 ) v64 = 457 - v65; } @@ -11902,7 +11862,7 @@ v64 = 18; } pRenderer->DrawTextureTransparent(v64, v63, v62); - sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], dword_F8B168[v122 + 6], v122 + 7); + sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7); } ++v122; } @@ -11928,7 +11888,7 @@ do { //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShop[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) ++v117; ++v66; } @@ -11947,13 +11907,12 @@ if ( dword_F8B19C != 2 ) v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" } - sub_4B46A5(v69, 0); + DrawTextAtStatusBar(v69, 0); if ( !v117 ) - return (int)v112._4B1854( - __PAIR__( - pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C + 1], - pParty->field_3C.field_50[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) - - pParty->uTimePlayed); + { + v112.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return 0; + } v70 = pMouse->GetCursorPos(&v102); result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) @@ -11965,7 +11924,7 @@ v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71]; if ( dword_F8B19C != 2 ) // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724]; - v74 =&pParty->SpecialItemsInShop[v72][v71]; + v74 =&pParty->SpecialItemsInShops[v72][v71]; if ( v67 && Str ) { v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" @@ -12457,8 +12416,8 @@ { if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) { - pRenderer->DrawTextureTransparent(v63, 0x5Au, dword_F8B168[v6]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), dword_F8B168[v6], v6 + 1); + pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]); + ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); v1 = v58; } v63 += 70; @@ -12473,8 +12432,8 @@ { if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) { - pRenderer->DrawTextureTransparent(v63, 0xFAu, dword_F8B168[v7]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), dword_F8B168[v7], v7 + 1); + pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]); + ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); v1 = v58; } v63 += 70; @@ -12500,13 +12459,16 @@ v11 = pGlobalTXT_LocalizationStrings[195]; if ( dword_F8B19C != 2 ) v11 = pGlobalTXT_LocalizationStrings[196]; - sub_4B46A5(v11, 0); + DrawTextAtStatusBar(v11, 0); if ( !v8 ) - return (int)v52._4B1854( + { + v52.DrawCurrentTime( __PAIR__( *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44472], *(int *)&stru_AA1058[3].pSounds[8 * (unsigned int)window_SpeakInHouse->ptr_1C + 44468]) - pParty->uTimePlayed); + return 0; + } v12 = pMouse->GetCursorPos(&v51); result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; @@ -13172,9 +13134,7 @@ pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v5); return result; // void func } - if ( !(unsigned __int16)_449B57_test_bit( - (unsigned __int8 *)v1->field_152, - word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) + if ( !(unsigned __int16)_449B57_test_bit((unsigned __int8 *)v1->field_152, word_4F0754[2 * (unsigned int)window_SpeakInHouse->ptr_1C]) ) { v24 = pNPCTopics[171].pText; v25 = v31; @@ -14249,7 +14209,7 @@ } //----- (0044606A) -------------------------------------------------------- -void PrepareHouse(HOUSE_TYPE house) +void PrepareHouse(HOUSE_ID house) { //unsigned int v1; // ebx@1 //signed int v2; // esi@1 @@ -14372,9 +14332,9 @@ //----- (0044622E) -------------------------------------------------------- -bool __fastcall EnterHouse(HOUSE_TYPE uHouseID) -{ - //enum HOUSE_TYPE v1; // edi@1 +bool __fastcall EnterHouse(enum HOUSE_ID uHouseID) +{ + //enum HOUSE_ID v1; // edi@1 //int v2; // edi@5 unsigned int uOpenTime; // eax@5 int uCloseTime; // esi@5 @@ -14397,7 +14357,7 @@ //const char *v22; // [sp-4h] [bp-40h]@33 char pContainer[40]; // [sp+Ch] [bp-30h]@32 unsigned int v24; // [sp+34h] [bp-8h]@5 - //enum HOUSE_TYPE v25; // [sp+38h] [bp-4h]@1 + //enum HOUSE_ID v25; // [sp+38h] [bp-4h]@1 //v1 = uHouseID; //v25 = uHouseID; @@ -14476,17 +14436,17 @@ pAudioPlayer->StopChannels(-1, -1); //uCurrentHouse_Animation = p2DEvents_minus1___02[v2]; uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; - dword_F8B198 = LOBYTE(pAnimatedRooms[uCurrentHouse_Animation].field_C); - if ( dword_F8B198 == 20 && pParty->uFine ) // going 2 jail + in_current_bilding_type = LOBYTE(pAnimatedRooms[uCurrentHouse_Animation].field_C); + if ( in_current_bilding_type == BildingType_20 && pParty->uFine ) // going 2 jail { uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; //v25 = HOUSE_187; uHouseID = HOUSE_JAIL; v12 = LODWORD(pParty->uTimePlayed); LODWORD(pParty->uTimePlayed) += 0x7620000u; - v14 = LOBYTE(pAnimatedRooms[(signed __int16)p2DEvents[HOUSE_186].uAnimationID].field_C); + v14 = LOBYTE(pAnimatedRooms[(signed __int16)p2DEvents[HOUSE_LORD_AND_JUDGE].uAnimationID].field_C); pParty->uTimePlayed = __PAIR__(HIDWORD(pParty->uTimePlayed), v12) + 0x7620000; - dword_F8B198 = v14; + in_current_bilding_type = v14; //v13 = pParty->pPlayers;//[0].uNumDivineInterventionCastsThisDay; //do ++pParty->uNumPrisonTerms;
--- a/mm7_data.cpp Tue Feb 26 18:47:30 2013 +0600 +++ b/mm7_data.cpp Tue Feb 26 18:48:05 2013 +0600 @@ -1610,7 +1610,7 @@ int dword_4EFA84; // weak void *off_4EFDB0; // weak int dword_4F031C[777]; // weak -const char *off_4F03B8[] = +const char *off_4F03B8[19] = { "", "WEPNTABL", "ARMORY", "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF", "MAGSHELF", @@ -2340,8 +2340,8 @@ char byte_F8B148[16]; __int16 word_F8B158[777]; // weak struct Texture *dword_F8B164; // idb -struct Texture *dword_F8B168[12]; -int dword_F8B198; // weak +struct Texture *ItemsInShopTexture[12]; +int in_current_bilding_type; // 0xF8B198 int dword_F8B19C; // weak __int16 word_F8B1A0; // weak const char *dword_F8B1A4; // idb
--- a/mm7_data.h Tue Feb 26 18:47:30 2013 +0600 +++ b/mm7_data.h Tue Feb 26 18:48:05 2013 +0600 @@ -1685,8 +1685,8 @@ extern char byte_F8B148[16]; extern __int16 word_F8B158[]; // weak extern struct Texture *dword_F8B164; // idb -extern struct Texture *dword_F8B168[12]; -extern int dword_F8B198; // weak +extern struct Texture *ItemsInShopTexture[12]; +extern int in_current_bilding_type; // weak extern int dword_F8B19C; // weak extern __int16 word_F8B1A0; // weak extern const char *dword_F8B1A4; // idb @@ -2025,8 +2025,8 @@ struct NPCData *__fastcall GetNewNPCData(signed int npcid, int a2); int __fastcall sub_445C8B(signed int a1); void __cdecl sub_44603D(); -void PrepareHouse(enum HOUSE_TYPE house); // idb -bool __fastcall EnterHouse(enum HOUSE_TYPE uHouseID); +void PrepareHouse(enum HOUSE_ID house); // idb +bool __fastcall EnterHouse(enum HOUSE_ID uHouseID); int sub_4465DF_check_season(int a1); int __fastcall IsActorAlive(unsigned int uType, unsigned int uParam, unsigned int uNumAlive); // idb // void __cdecl crt_construct_5773C4(); @@ -2307,28 +2307,28 @@ char *__thiscall _4B254D_SkillMasteryTeacher(int _this); const char *__fastcall ContractSelectText(int pEventNumber); char __cdecl SimpleHouseAndBoatsDialog(); -struct GUIButton *__fastcall sub_4B36CC(int a1, unsigned int a2); -int sub_4B3703(int _this); -int __thiscall sub_4B3A72(int a1); // idb -int __fastcall sub_4B3AD4(signed int a1); -int __fastcall sub_4B3B42(signed int a1); +void CreateButtonInColumn(int a1, unsigned int a2); +void FillAviableSkillsToTeach(int _this); +void sub_4B3A72(int a1); // idb +void sub_4B3AD4(signed int a1); +void sub_4B3B42(signed int a1); void __cdecl sub_4B3E1E(); void __fastcall DrawJoinGuildWindow(int pEventNumber); void __fastcall sub_4B3FE5(int a4); void __cdecl sub_4B40E6(); void _4B4224_UpdateNPCTopics(int _this); -char __fastcall sub_4B46A5(const char *Str, int a5); +char __fastcall DrawTextAtStatusBar(const char *Str, int a5); int __fastcall sub_4B46F8(int a1); int __cdecl TrainingDialog(); -char *__cdecl sub_4B4F4F(); +char *__cdecl JailDialog(); int __cdecl MagicShopDialog(); int __cdecl GuildDialog(); int __cdecl sub_4B6478(); bool __fastcall sub_4B68EA(int a1); void __cdecl TravelByTransport(); int __cdecl TampleDialog(); -void __cdecl sub_4B7911(); -void __cdecl _4B7D7E_bank(); +void __cdecl TownHallDialog(); +void __cdecl BankDialog(); void __cdecl TavernDialog(); char *__cdecl WeaponShopDialog(); @@ -2347,7 +2347,7 @@ void __cdecl sub_4BDB56_buy_skill____(); struct FrameTableTxtLine *__thiscall texture_frame_table_txt_parser(const char *_this, FrameTableTxtLine *a2); struct FrameTableTxtLine *__thiscall frame_table_txt_parser(const char *pString, FrameTableTxtLine *a2); -int __fastcall sub_4BE571(int a1, int *a2, int a3, int a4); + void __cdecl ShowIntroVideo_and_LoadingScreen(); unsigned int __thiscall GameOverMenu(void *ecx0); bool __thiscall BinkLockBuffer(struct _BINKBUF *_this);