Mercurial > mm7
changeset 633:f6aeea3eb893
Слияние
author | Ritor1 |
---|---|
date | Mon, 11 Mar 2013 09:28:57 +0600 |
parents | f234b67a9caf (current diff) 3d03a3a674bc (diff) |
children | efa8ceae21d4 |
files | MM7.vcxproj.filters mm7_3.cpp |
diffstat | 32 files changed, 5682 insertions(+), 6133 deletions(-) [+] |
line wrap: on
line diff
--- a/Chest.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/Chest.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -581,21 +581,21 @@ uChestArea = pChestWidthsByType[pChests[uChestID].uChestBitmapID] * pChestHeightsByType[pChests[uChestID].uChestBitmapID]; memset(chest_cells_map, 0, 144); //fill cell map at random positions - for (items_counter = 0; items_counter<uChestArea; ++items_counter) - { + for ( items_counter = 0; items_counter < uChestArea; ++items_counter ) + { //get random position in chest do random_chest_pos = (unsigned __int8)rand(); while ( random_chest_pos >= uChestArea ); //if this pos occupied move to next while ( chest_cells_map[random_chest_pos] ) - { + { ++random_chest_pos; if ( random_chest_pos == uChestArea ) random_chest_pos = 0; - } + } chest_cells_map[random_chest_pos] = items_counter; - } + } items_counter = 0; for (items_counter = 0; items_counter<uChestArea; ++items_counter)
--- a/Events.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/Events.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -24,6 +24,7 @@ #include "stru159.h" #include "Events.h" #include "Events2D.h" +#include "UIHouses.h" #include "Weather.h" #include "Party.h" #include "MM7.h" @@ -838,7 +839,7 @@ else if ( player_choose == 5 )//all { v130=0; - for(int i = 0; i < 5; ++i) + for(int i = 1; i < 5; ++i) { if ( pPlayers[i]->CompareVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) { @@ -945,7 +946,7 @@ else if ( player_choose == 5 )//all { v130 = 0; - for(int i = 0; i < 5; ++i) + for(int i = 1; i < 5; ++i) { if ( pPlayers[i]->SubtractVariable((enum VariableType)EVT_WORD(_evt->v5), pValue) ) break; @@ -1352,7 +1353,7 @@ if ( uGameState == 2 ) { pAudioPlayer->StopChannels(-1, -1); - dword_F8B19C = 0; + dialog_menu_id = 0; while ( sub_4BD8B5() ) ; pVideoPlayer->Unload(); @@ -1364,7 +1365,7 @@ viewparams->bRedrawGameUI = 1; pDialogueNPCCount = 0; pDialogueWindow->Release(); - dword_F8B19C = 0; + dialog_menu_id = 0; pDialogueWindow = 0; pIcons_LOD->_40F9C5(); }
--- a/GUIWindow.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/GUIWindow.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -19,6 +19,7 @@ #include "FactionTable.h" #include "StorylineTextTable.h" #include "Events2D.h" +#include "UIHouses.h" #include "texts.h" #include "Autonotes.h"
--- a/Game.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/Game.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -497,7 +497,6 @@ } - //----- (0044F192) -------------------------------------------------------- void Game::PrepareBloodsplats() {
--- a/Indoor.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/Indoor.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -1233,7 +1233,7 @@ } //----- (004B0EA8) -------------------------------------------------------- -void BspRenderer::PrepareFaceRenderList_d3d(int a2, unsigned int uFaceID) +void BspRenderer::AddFaceToRenderList_d3d(int a2, unsigned int uFaceID) { //unsigned int v3; // edx@1 //stru170 *v4; // ebx@1 @@ -1384,14 +1384,14 @@ } else { - static RenderVertexSoft static_subPrepareFaceRenderList_d3d_stru_F7AA08[64]; - static RenderVertexSoft static_subPrepareFaceRenderList_d3d_stru_F79E08[64]; + static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F7AA08[64]; + static RenderVertexSoft static_subAddFaceToRenderList_d3d_stru_F79E08[64]; //v23 = 0; a2 = pFace->uNumVertices; for (uint k = 0; k < pFace->uNumVertices; ++k) { - //v24 = (char *)&static_subPrepareFaceRenderList_d3d_stru_F7AA08[0].vWorldPosition.z; + //v24 = (char *)&static_subAddFaceToRenderList_d3d_stru_F7AA08[0].vWorldPosition.z; //do //{ //v25 = pFace->pVertexIDs[k]; @@ -1400,24 +1400,24 @@ //v27 = (double)v26->z; //v28 = v26->y; //v17 = v39; - static_subPrepareFaceRenderList_d3d_stru_F7AA08[k].vWorldPosition.x = pVertex->x; - static_subPrepareFaceRenderList_d3d_stru_F7AA08[k].vWorldPosition.y = pVertex->y; - static_subPrepareFaceRenderList_d3d_stru_F7AA08[k].vWorldPosition.z = pVertex->z; + static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.x = pVertex->x; + static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.y = pVertex->y; + static_subAddFaceToRenderList_d3d_stru_F7AA08[k].vWorldPosition.z = pVertex->z; //v24 += 48; //} //while ( v23 < a2 ); } pGame->pIndoorCameraD3D->_437285_prolly_colide_vertices_against_frustrum( - static_subPrepareFaceRenderList_d3d_stru_F7AA08, + static_subAddFaceToRenderList_d3d_stru_F7AA08, (unsigned int *)&a2, - static_subPrepareFaceRenderList_d3d_stru_F79E08, + static_subAddFaceToRenderList_d3d_stru_F79E08, p->std__vector_0007AC, 4, 0, 0); v29 = pGame->pStru10Instance->_49C5DA( pFace, - static_subPrepareFaceRenderList_d3d_stru_F79E08, + static_subAddFaceToRenderList_d3d_stru_F79E08, &a2, field_FA8[std__vector_000FA8].std__vector_0007AC, field_FA8[std__vector_000FA8].pVertices); @@ -1451,7 +1451,7 @@ //----- (004AFB86) -------------------------------------------------------- -void BspRenderer::PrepareFaceRenderList_sw(int a2, unsigned int uFaceID) +void BspRenderer::AddFaceToRenderList_sw(int a2, unsigned int uFaceID) { BspRenderer *v3; // ebx@1 BLVFace *v4; // eax@1 @@ -3198,7 +3198,7 @@ if (pSector->pBounding.y1 <= sY && pSector->pBounding.y2 >= sY) if (pSector->pBounding.z1 - 64 <= sZ && pSector->pBounding.z2 + 64 >= sZ) { - Log::Warning(L"Sector[%u]", i); + //Log::Warning(L"Sector[%u]", i); v51 = pSector->uNumFloors + pSector->uNumPortals; if (!v51) continue;
--- a/Indoor_stuff.h Mon Mar 11 09:28:41 2013 +0600 +++ b/Indoor_stuff.h Mon Mar 11 09:28:57 2013 +0600 @@ -79,8 +79,8 @@ uNumVisibleNotEmptySectors = 0; } - void PrepareFaceRenderList_sw(int a2, unsigned int uFaceID); - void PrepareFaceRenderList_d3d(signed int a2, unsigned int uFaceID); + void AddFaceToRenderList_sw(int a2, unsigned int uFaceID); + void AddFaceToRenderList_d3d(signed int a2, unsigned int uFaceID); void MakeVisibleSectorList(); void DrawFaceOutlines();
--- a/MM7.h Mon Mar 11 09:28:41 2013 +0600 +++ b/MM7.h Mon Mar 11 09:28:57 2013 +0600 @@ -143,48 +143,6 @@ - - - - - - - - - - - - - - - - - - - -/* 349 */ -enum HOUSE_ID -{ - HOUSE_SMITH_EMERALD_ISLE = 1, - HOUSE_BODY_GUILD_NOVICE_EMERALD_ISLE = 163, - HOUSE_BODY_GUILD_ERATHIA = 165, - HOUSE_DARK_GUILD_PIT = 170, - HOUSE_LORD_AND_JUDGE = 186, - HOUSE_JAIL = 187, - HOUSE_600 = 600,//??? - HOUSE_601 = 601//??? -}; - - - - - - - - - - - /* 362 */ #pragma pack(push, 1) struct TravelInfo
--- a/MM7.vcxproj.filters Mon Mar 11 09:28:41 2013 +0600 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,326 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> - <ItemGroup> - <ClInclude Include="MM7.h" /> - <ClInclude Include="lib\legacy_dx\d3d.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\d3dcaps.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\d3drm.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\d3drmdef.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\d3drmobj.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\d3drmwin.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\d3dtypes.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\ddraw.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dinput.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dinputd.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dmdls.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dmerror.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dmksctrl.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dmplugin.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dmusbuff.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dmusicc.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dmusicf.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dmusici.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dmusics.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dsconf.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dsound.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\dvoice.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\multimon.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\rmxfguid.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\rmxftmpl.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="lib\legacy_dx\strsafe.h"> - <Filter>lib\legacy_dx</Filter> - </ClInclude> - <ClInclude Include="AudioPlayer.h" /> - <ClInclude Include="VideoPlayer.h" /> - <ClInclude Include="Texture.h" /> - <ClInclude Include="LOD.h" /> - <ClInclude Include="Mouse.h" /> - <ClInclude Include="LightmapBuilder.h" /> - <ClInclude Include="Vis.h" /> - <ClInclude Include="Render.h" /> - <ClInclude Include="Game.h" /> - <ClInclude Include="VectorTypes.h" /> - <ClInclude Include="ParticleEngine.h" /> - <ClInclude Include="IndoorCameraD3D.h" /> - <ClInclude Include="Keyboard.h" /> - <ClInclude Include="Party.h" /> - <ClInclude Include="Player.h" /> - <ClInclude Include="CShow.h" /> - <ClInclude Include="stru6.h" /> - <ClInclude Include="stru9.h" /> - <ClInclude Include="stru10.h" /> - <ClInclude Include="stru11.h" /> - <ClInclude Include="stru12.h" /> - <ClInclude Include="GammaControl.h" /> - <ClInclude Include="Indoor.h" /> - <ClInclude Include="Outdoor.h" /> - <ClInclude Include="OutdoorCamera.h" /> - <ClInclude Include="BSPModel.h" /> - <ClInclude Include="Actor.h" /> - <ClInclude Include="Items.h" /> - <ClInclude Include="Monsters.h" /> - <ClInclude Include="NPC.h" /> - <ClInclude Include="PaletteManager.h" /> - <ClInclude Include="GUIButton.h" /> - <ClInclude Include="GUIFont.h" /> - <ClInclude Include="GUIWindow.h" /> - <ClInclude Include="Spells.h" /> - <ClInclude Include="DecalBuilder.h" /> - <ClInclude Include="Lights.h" /> - <ClInclude Include="Arcomage.h" /> - <ClInclude Include="GUIProgressBar.h" /> - <ClInclude Include="Events.h" /> - <ClInclude Include="Sprites.h" /> - <ClInclude Include="Overlays.h" /> - <ClInclude Include="Time.h" /> - <ClInclude Include="Chest.h" /> - <ClInclude Include="mm7_data.h" /> - <ClInclude Include="Allocator.h" /> - <ClInclude Include="IndoorCamera.h" /> - <ClInclude Include="Viewport.h" /> - <ClInclude Include="MapInfo.h" /> - <ClInclude Include="PlayerFrameTable.h" /> - <ClInclude Include="OSInfo.h" /> - <ClInclude Include="Math.h" /> - <ClInclude Include="Weather.h" /> - <ClInclude Include="IconFrameTable.h" /> - <ClInclude Include="ObjectList.h" /> - <ClInclude Include="DecorationList.h" /> - <ClInclude Include="Outdoor_stuff.h" /> - <ClInclude Include="Random.h" /> - <ClInclude Include="Indoor_stuff.h" /> - <ClInclude Include="stru157.h" /> - <ClInclude Include="stru123.h" /> - <ClInclude Include="AIL.h" /> - <ClInclude Include="Bink_Smacker.h" /> - <ClInclude Include="TurnEngine.h" /> - <ClInclude Include="stru220.h" /> - <ClInclude Include="stru279.h" /> - <ClInclude Include="stru314.h" /> - <ClInclude Include="SaveLoad.h" /> - <ClInclude Include="stru287.h" /> - <ClInclude Include="Awards.h" /> - <ClInclude Include="Autonotes.h" /> - <ClInclude Include="stru160.h" /> - <ClInclude Include="FactionTable.h" /> - <ClInclude Include="StorylineTextTable.h" /> - <ClInclude Include="stru277.h" /> - <ClInclude Include="stru298.h" /> - <ClInclude Include="OSAPI.h" /> - <ClInclude Include="Events2D.h" /> - <ClInclude Include="stru176.h" /> - <ClInclude Include="stru159.h" /> - <ClInclude Include="stru351.h" /> - <ClInclude Include="stru272.h" /> - <ClInclude Include="lib\zlib\deflate.h"> - <Filter>lib\zlib</Filter> - </ClInclude> - <ClInclude Include="lib\zlib\infblock.h"> - <Filter>lib\zlib</Filter> - </ClInclude> - <ClInclude Include="lib\zlib\infcodes.h"> - <Filter>lib\zlib</Filter> - </ClInclude> - <ClInclude Include="lib\zlib\inffast.h"> - <Filter>lib\zlib</Filter> - </ClInclude> - <ClInclude Include="lib\zlib\inffixed.h"> - <Filter>lib\zlib</Filter> - </ClInclude> - <ClInclude Include="lib\zlib\inftrees.h"> - <Filter>lib\zlib</Filter> - </ClInclude> - <ClInclude Include="lib\zlib\infutil.h"> - <Filter>lib\zlib</Filter> - </ClInclude> - <ClInclude Include="lib\zlib\trees.h"> - <Filter>lib\zlib</Filter> - </ClInclude> - <ClInclude Include="lib\zlib\zconf.h"> - <Filter>lib\zlib</Filter> - </ClInclude> - <ClInclude Include="lib\zlib\zlib.h"> - <Filter>lib\zlib</Filter> - </ClInclude> - <ClInclude Include="lib\zlib\zutil.h"> - <Filter>lib\zlib</Filter> - </ClInclude> - <ClInclude Include="Log.h" /> - <ClInclude Include="FrameTableInc.h" /> - <ClInclude Include="resource.h" /> - <ClInclude Include="stru346.h" /> - <ClInclude Include="texts.h" /> - </ItemGroup> - <ItemGroup> - <Filter Include="lib"> - <UniqueIdentifier>{674d5845-1afa-4bb4-b0f9-e59bdcf6bf46}</UniqueIdentifier> - </Filter> - <Filter Include="lib\legacy_dx"> - <UniqueIdentifier>{7f786ac2-aa3f-48a5-81ef-d5bcf2ee57bf}</UniqueIdentifier> - </Filter> - <Filter Include="lib\zlib"> - <UniqueIdentifier>{2c8eede3-bdcb-4411-b5e3-86c1c48e8351}</UniqueIdentifier> - </Filter> - </ItemGroup> - <ItemGroup> - <None Include="lib\legacy_dx\d3dvec.inl"> - <Filter>lib\legacy_dx</Filter> - </None> - </ItemGroup> - <ItemGroup> - <ClCompile Include="mm7_2.cpp" /> - <ClCompile Include="Game.cpp" /> - <ClCompile Include="GammaControl.cpp" /> - <ClCompile Include="Monsters.cpp" /> - <ClCompile Include="Time.cpp" /> - <ClCompile Include="Actor.cpp" /> - <ClCompile Include="Items.cpp" /> - <ClCompile Include="LOD.cpp" /> - <ClCompile Include="Render.cpp" /> - <ClCompile Include="Spells.cpp" /> - <ClCompile Include="Overlays.cpp" /> - <ClCompile Include="Chest.cpp" /> - <ClCompile Include="GUIWindow.cpp" /> - <ClCompile Include="Keyboard.cpp" /> - <ClCompile Include="LightmapBuilder.cpp" /> - <ClCompile Include="Arcomage.cpp" /> - <ClCompile Include="Mouse.cpp" /> - <ClCompile Include="Texture.cpp" /> - <ClCompile Include="DecalBuilder.cpp" /> - <ClCompile Include="Allocator.cpp" /> - <ClCompile Include="IndoorCameraD3D.cpp" /> - <ClCompile Include="Sprites.cpp" /> - <ClCompile Include="Vis.cpp" /> - <ClCompile Include="IndoorCamera.cpp" /> - <ClCompile Include="GUIFont.cpp" /> - <ClCompile Include="Indoor.cpp" /> - <ClCompile Include="Outdoor.cpp" /> - <ClCompile Include="Player.cpp" /> - <ClCompile Include="stru10.cpp" /> - <ClCompile Include="LightsStack.cpp" /> - <ClCompile Include="BSPModel.cpp" /> - <ClCompile Include="PaletteManager.cpp" /> - <ClCompile Include="ParticleEngine.cpp" /> - <ClCompile Include="Party.cpp" /> - <ClCompile Include="stru9.cpp" /> - <ClCompile Include="stru6.cpp" /> - <ClCompile Include="AudioPlayer.cpp" /> - <ClCompile Include="GUIButton.cpp" /> - <ClCompile Include="VideoPlayer.cpp" /> - <ClCompile Include="GUIProgressBar.cpp" /> - <ClCompile Include="TileFrameTable.h" /> - <ClCompile Include="Weather.cpp" /> - <ClCompile Include="Random.cpp" /> - <ClCompile Include="SaveLoad.cpp" /> - <ClCompile Include="mm7_3.cpp" /> - <ClCompile Include="mm7_data.cpp" /> - <ClCompile Include="AIL.cpp" /> - <ClCompile Include="Bink_Smacker.cpp" /> - <ClCompile Include="Events.cpp" /> - <ClCompile Include="lib\zlib\adler32.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="lib\zlib\compress.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="lib\zlib\crc32.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="lib\zlib\deflate.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="lib\zlib\infblock.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="lib\zlib\infcodes.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="lib\zlib\inffast.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="lib\zlib\inflate.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="lib\zlib\inftrees.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="lib\zlib\infutil.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="lib\zlib\trees.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="lib\zlib\uncompr.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="lib\zlib\zutil.c"> - <Filter>lib\zlib</Filter> - </ClCompile> - <ClCompile Include="Log.cpp" /> - <ClCompile Include="OSAPI.cpp" /> - <ClCompile Include="mm7_4.cpp" /> - <ClCompile Include="mm7_1.cpp" /> - <ClCompile Include="mm7_5.cpp" /> - <ClCompile Include="FrameTableInc.cpp" /> - <ClCompile Include="mm7_6.cpp" /> - <ClCompile Include="GameUIs.cpp" /> - <ClCompile Include="StorylineTextTable.cpp" /> - <ClCompile Include="texts.cpp" /> - <ClCompile Include="mm7text_ru.cpp" /> - <ClCompile Include="NPC.cpp" /> - <ClCompile Include="SpriteObject.cpp" /> - </ItemGroup> - <ItemGroup> - <ResourceCompile Include="Might and Magic Trilogy.rc" /> - </ItemGroup> -</Project> \ No newline at end of file
--- a/NPC.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/NPC.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -12,6 +12,11 @@ #include "NPC.h" +int pDialogueNPCCount; +struct Texture *pDialogueNPCPortraits[6]; +int uNumDialogueNPCPortraits; // weak +struct NPCStats *pNPCStats = nullptr; + void InitializeAwards(); void InitializeScrolls(); void InitializeMerchants();
--- a/NPC.h Mon Mar 11 09:28:41 2013 +0600 +++ b/NPC.h Mon Mar 11 09:28:57 2013 +0600 @@ -202,6 +202,10 @@ #pragma pack(push, 1) struct NPCProfession { + inline NPCProfession(): + uHirePrice(0), pBenefits(nullptr), pActionText(nullptr), pJoinText(nullptr), pDismissText(nullptr) + {} + unsigned int uHirePrice; char *pBenefits; char *pActionText; @@ -278,5 +282,10 @@ }; #pragma pack(pop) +extern int pDialogueNPCCount; +extern struct Texture *pDialogueNPCPortraits[6]; +extern int uNumDialogueNPCPortraits; // weak +extern struct NPCStats *pNPCStats; + bool PartyHasDragon(); bool CheckHiredNPCSpeciality(unsigned int uProfession);
--- a/Outdoor.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/Outdoor.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -43,6 +43,9 @@ Edge stru_80C9D8; + + + //----- (0047A59E) -------------------------------------------------------- void OutdoorLocation::ExecDraw(unsigned int bRedraw) { @@ -283,7 +286,7 @@ day_fogrange_2 = v5->day_fogrange_2; if ( Is_out15odm_underwater() ) SetUnderwaterFog(); - _6BE134_odm_main_tile_group = v5->pTileTypes[0].uTileGroup; + _6BE134_odm_main_tile_group = v5->pTileTypes[0].tileset; result = 1; } else @@ -520,7 +523,7 @@ v5 = WorldPosToGridCellX(pParty->vPosition.x); v6 = WorldPosToGridCellZ(pParty->vPosition.y); v7 = _47ED83(v5, v6 - 1); - v8 = pTileTable->pTiles[_47ECC1(v7)].uTerrainType; + v8 = pTileTable->pTiles[_47ECC1(v7)].tileset; if ( v8 ) { v9 = v8 - 1; @@ -1086,12 +1089,12 @@ strcpy(v1->pLocationFileName, "i6.odm"); strcpy(v1->pLocationFileDescription, "MM6 Outdoor v1.00"); v1->uNumBModels = 0; - v1->pTileTypes[0].uTileGroup = 0; - v1->pTileTypes[1].uTileGroup = 5; - v1->pTileTypes[2].uTileGroup = 6; - v1->pTileTypes[3].uTileGroup = 10; + v1->pTileTypes[0].tileset = Tileset_Grass; + v1->pTileTypes[1].tileset = Tileset_Water; + v1->pTileTypes[2].tileset = Tileset_6; + v1->pTileTypes[3].tileset = Tileset_RoadGrassCobble; v1->LoadTileGroupIds(); - v1->_47F3EA(); + v1->LoadRoadTileset(); pAllocator->FreeChunk(v1->pBModels); pAllocator->FreeChunk(v1->pSpawnPoints); v1->pBModels = 0; @@ -1386,7 +1389,7 @@ fseek((FILE *)v7, Offset, 0); fread(this, 0xB0u, 1u, (FILE *)v7); LoadTileGroupIds(); - _47F3EA(); + LoadRoadTileset(); strcpy(pGroundTileset, "grastyl"); fseek((FILE *)v7, v114, 0); fread(&uNumBModels, 4u, 1u, (FILE *)v7); @@ -1705,7 +1708,7 @@ //v43 = (char *)pSrc + 176; LoadTileGroupIds(); - _47F3EA(); + LoadRoadTileset(); strcpy(pGroundTileset, "grastyl"); pGameLoadingUI_ProgressBar->Progress(); pTerrain.Initialize(); @@ -2258,16 +2261,17 @@ free(pSrcMem); - pTileTable->InitializeTileset(4); + pTileTable->InitializeTileset(Tileset_Dirt); + pTileTable->InitializeTileset(Tileset_Snow); //thisa = (int)pTileTypes; //v108 = pTileTypes[0].uTileGroup; - pTileTable->InitializeTileset(pTileTypes[0].uTileGroup); + pTileTable->InitializeTileset(pTileTypes[0].tileset); //v108 = pTileTypes[1].uTileGroup; - pTileTable->InitializeTileset(pTileTypes[1].uTileGroup); + pTileTable->InitializeTileset(pTileTypes[1].tileset); //v108 = pTileTypes[2].uTileGroup; - pTileTable->InitializeTileset(pTileTypes[2].uTileGroup); + pTileTable->InitializeTileset(pTileTypes[2].tileset); //v108 = pTileTypes[3].uTileGroup; - pTileTable->InitializeTileset(pTileTypes[3].uTileGroup); + pTileTable->InitializeTileset(pTileTypes[3].tileset); strcpy(pGroundTileset, byte_6BE124_cfg_textures_DefaultGroundTexture); //v97 = pTileTypes[0].uTileID; //v108 = 0; @@ -2402,11 +2406,10 @@ int v3; // esi@5 unsigned int result; // eax@9 - if ( uX < 0 || uX > 127 || uY < 0 || uY > 127) - return 0; + assert(uX < 128 && uY < 128); v3 = this->pTerrain.pTilemap[uY * 128 + uX]; - if (v3 < 198) + if (v3 < 198) // < Tileset_3 { if (v3 >= 90) v3 = v3 + this->pTileTypes[(v3 - 90) / 36].uTileID - 36 * ((v3 - 90) / 36) - 90; @@ -2414,6 +2417,41 @@ else v3 = v3 + this->pTileTypes[3].uTileID - 198; + static int f = 0; + if (f) + pParty->uCurrentMonth = 2; + + switch (pParty->uCurrentMonth) + { + case 11: case 0: case 1: // winter + if (v3 >= 90) // Tileset_Grass begins at TileID = 90 + { + if (v3 <= 95) // some grastyl entries + v3 = 348; + else if (v3 <= 113) // rest of grastyl & all grdrt* + v3 = 348 + (v3 - 96); + } + /*switch (v3) + { + case 102: v3 = 354; break; // grdrtNE -> SNdrtne + case 104: v3 = 356; break; // grdrtNW -> SNdrtnw + case 108: v3 = 360; break; // grdrtN -> SNdrtn + }*/ + break; + + case 2: case 3: case 4: // spring + case 8: case 9: case 10: // autumn + if (v3 >= 90 && v3 <= 113) // just convert all Tileset_Grass to dirt + v3 = 1; + break; + + case 5: case 6: case 7: // summer + //all tiles are green grass by default + break; + + default: assert(pParty->uCurrentMonth >= 0 && pParty->uCurrentMonth < 12); + } + return pTileTable->pTiles[v3].uBitmapID; } @@ -2488,10 +2526,10 @@ LOBYTE(v6) = v6 & 0xD9; return v6 + 92; } - v8 = pTileTable->pTiles[v5].uTerrainType; + v8 = pTileTable->pTiles[v5].tileset; if ( v8 <= 6 ) { - if ( v8 == 6 ) + if ( v8 == Tileset_6 ) { v17 = -(a4 != 0); LOBYTE(v17) = v17 & 0xD9; @@ -2841,13 +2879,13 @@ } //----- (0047F3EA) -------------------------------------------------------- -bool OutdoorLocation::_47F3EA() +bool OutdoorLocation::LoadRoadTileset() { OutdoorLocationTileType *v1; // esi@1 v1 = &this->pTileTypes[3]; - this->pTileTypes[3].uTileID = pTileTable->method_487ED6(this->pTileTypes[3].uTileGroup, 1); - pTileTable->InitializeTileset(v1->uTileGroup); + pTileTypes[3].uTileID = pTileTable->method_487ED6(pTileTypes[3].tileset, 1); + pTileTable->InitializeTileset(v1->tileset); return 1; } @@ -2855,7 +2893,7 @@ bool OutdoorLocation::LoadTileGroupIds() { for (uint i = 0; i < 3; ++i) - pTileTypes[i].uTileID = pTileTable->method_487ED6(pTileTypes[i].uTileGroup, 1); + pTileTypes[i].uTileID = pTileTable->method_487ED6(pTileTypes[i].tileset, 1); return true; }
--- a/Outdoor.h Mon Mar 11 09:28:41 2013 +0600 +++ b/Outdoor.h Mon Mar 11 09:28:57 2013 +0600 @@ -2,6 +2,7 @@ #include "BSPModel.h" #include "OutdoorCamera.h" #include "Indoor.h" +#include "TileFrameTable.h" @@ -22,7 +23,7 @@ #pragma pack(push, 1) struct OutdoorLocationTileType { - unsigned __int16 uTileGroup; + Tileset tileset; unsigned __int16 uTileID; }; #pragma pack(pop) @@ -160,7 +161,7 @@ bool PrepareDecorations(); int _47F223_LooksLikeGenerateMonsterLoot(); bool InitalizeActors(int a1); - bool _47F3EA(); + bool LoadRoadTileset(); bool LoadTileGroupIds(); double GetFogDensityByTime(); int GetSomeOtherTileInfo(int sX, int sY); @@ -182,7 +183,7 @@ char pLocationFileDescription[32]; char pSkyTextureName[32]; char pGroundTileset[32]; - OutdoorLocationTileType pTileTypes[4]; + OutdoorLocationTileType pTileTypes[4]; // [3] road tileset unsigned int uNumBModels; struct OutdoorLocationTerrain pTerrain; void *ptr_D4;
--- a/ParticleEngine.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/ParticleEngine.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -29,13 +29,13 @@ } //----- (0048AB23) -------------------------------------------------------- -void ParticleEngine::AddParticle(Particle_ *a2) +void ParticleEngine::AddParticle(Particle_sw *a2) { signed int v2; // eax@2 Particle *v3; // edx@2 Particle *v4; // esi@10 int v5; // ecx@10 - char v6; // zf@10 + //char v6; // zf@10 if ( !pMiscTimer->bPaused ) { @@ -43,7 +43,7 @@ v3 = (Particle *)this; do { - if ( !v3->uType ) + if (v3->type == ParticleType_Invalid) break; ++v2; ++v3; @@ -56,7 +56,7 @@ if ( v2 > this->uEndParticle ) this->uEndParticle = v2; v4 = &this->pParticles[v2]; - v4->uType = a2->bFree; + v4->type = a2->type; v4->x = a2->x; v4->y = a2->y; v4->z = a2->z; @@ -69,20 +69,20 @@ v5 = a2->uDiffuse; v4->uParticleColor = v5; v4->uLightColor = v5; - v6 = (v4->uType & 4) == 0; + //v6 = (v4->uType & 4) == 0; v4->timeToLive = a2->timeToLive; v4->uTextureID = a2->uTextureID; v4->flt_28 = a2->flt_28; - if ( v6 ) + if (v4->type & ParticleType_Rotating) + { + v4->field_38 = (unsigned __int8)rand() - 128; + v4->_rotation = rand(); + } + else { v4->field_38 = 0; v4->_rotation = 0; } - else - { - v4->field_38 = (unsigned __int8)rand() - 128; - v4->_rotation = rand(); - } } } } @@ -137,14 +137,14 @@ { auto p = pParticles + i; - v5 = p->uType; - if (!p->uType) + v5 = p->type; + if (p->type == ParticleType_Invalid) continue; v6 = (p->timeToLive - time) < 0; p->timeToLive -= time; if (v6) - p->uType = 0; + p->type = ParticleType_Invalid; else { if ( BYTE1(v5) & 2 ) @@ -190,16 +190,16 @@ bool ParticleEngine::ViewProject_TrueIfStillVisible(unsigned int uParticleID) { Particle *pParticle; // esi@1 - double v56; // ST28_8@2 + //double v56; // ST28_8@2 float v4; // eax@4 double v5; // ST34_8@4 signed __int64 v6; // qtt@4 - double v7; // st7@4 - float v8; // ST18_4@4 + //double v7; // st7@4 + //float v8; // ST18_4@4 int v9; // ecx@4 - int v10; // eax@4 - double v11; // ST44_8@7 - double v12; // ST4C_8@7 + //int v10; // eax@4 + //double v11; // ST44_8@7 + //double v12; // ST4C_8@7 double v13; // ST4C_8@7 int v14; // ecx@7 signed __int64 v15; // qtt@7 @@ -235,10 +235,10 @@ int v46; // ecx@18 float v47; // ST18_4@18 unsigned __int64 v48; // qax@18 - double y_int_; // [sp+10h] [bp-40h]@2 + int y_int_; // [sp+10h] [bp-40h]@2 int a2; // [sp+18h] [bp-38h]@10 int x_int; // [sp+20h] [bp-30h]@2 - double z_int_; // [sp+24h] [bp-2Ch]@2 + int z_int_; // [sp+24h] [bp-2Ch]@2 int z_int_4; // [sp+28h] [bp-28h]@8 int z; // [sp+3Ch] [bp-14h]@3 double a5; // [sp+40h] [bp-10h]@4 @@ -246,83 +246,85 @@ int y; // [sp+4Ch] [bp-4h]@3 pParticle = &this->pParticles[uParticleID]; - if ( !pParticle->uType ) + if (pParticle->type == ParticleType_Invalid) return 0; - uParticleID = LODWORD(pParticle->x); - v56 = *(float *)&uParticleID + 6.7553994e15; - x_int = LODWORD(v56); - uParticleID = LODWORD(pParticle->y); - y_int_ = *(float *)&uParticleID + 6.7553994e15; - uParticleID = LODWORD(pParticle->z); - z_int_ = *(float *)&uParticleID + 6.7553994e15; + //uParticleID = LODWORD(pParticle->x); + //v56 = *(float *)&uParticleID + 6.7553994e15; + x_int = floorf(pParticle->x + 0.5f); + //uParticleID = LODWORD(pParticle->y); + //y_int_ = *(float *)&uParticleID + 6.7553994e15; + y_int_ = floorf(pParticle->y + 0.5f); + //uParticleID = LODWORD(pParticle->z); + //z_int_ = *(float *)&uParticleID + 6.7553994e15; + z_int_ = floorf(pParticle->z + 0.5f); if ( !pRenderer->pRenderD3D ) { if ( pBLVRenderParams->sPartyRotX ) { - if ( BYTE1(pParticle->uType) & 2 ) + if (pParticle->type & ParticleType_Line) { - v11 = pParticle->_x + 6.7553994e15; - uParticleID = (LODWORD(v11) - pBLVRenderParams->vPartyPos.x) << 16; - v12 = pParticle->_y + 6.7553994e15; - y = (LODWORD(v12) - pBLVRenderParams->vPartyPos.y) << 16; + //v11 = pParticle->_x + 6.7553994e15; + int _uParticleID = (int)(floorf(pParticle->_x + 0.5f) - pBLVRenderParams->vPartyPos.x) << 16; + //v12 = pParticle->_y + 6.7553994e15; + y = (int)(floorf(pParticle->_y + 0.5f) - pBLVRenderParams->vPartyPos.y) << 16; z = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - HIDWORD(a5) = ((unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) + HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - z; - a6 = (unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v13 = pParticle->_z + 6.7553994e15; - uParticleID = (LODWORD(v13) - pBLVRenderParams->vPartyPos.z) << 16; + a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; + //v13 = pParticle->_z + 6.7553994e15; + _uParticleID = (int)(floorf(pParticle->_z + 0.5f) - pBLVRenderParams->vPartyPos.z) << 16; z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - - ((unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); + - ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); v14 = z; HIDWORD(v13) = (unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; - HIDWORD(a5) = (unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16; + HIDWORD(a5) = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16; LODWORD(v15) = pBLVRenderParams->field_40 << 16; HIDWORD(v15) = pBLVRenderParams->field_40 >> 16; v16 = v15 / z; v17 = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; pParticle->_screenspace_scale = v16; - uParticleID = (unsigned __int64)(v16 * (signed __int64)(a6 + v17)) >> 16; + _uParticleID = (unsigned __int64)(v16 * (signed __int64)(a6 + v17)) >> 16; LODWORD(v18) = pBLVRenderParams->uViewportCenterX - ((signed int)((unsigned __int64)(v16 * (signed __int64)(a6 + v17)) >> 16) >> 16); v19 = pParticle->_screenspace_scale; pParticle->uScreenSpaceZ = v18; - uParticleID = (unsigned __int64)(v19 * (signed __int64)(HIDWORD(v13) + HIDWORD(a5))) >> 16; + _uParticleID = (unsigned __int64)(v19 * (signed __int64)(HIDWORD(v13) + HIDWORD(a5))) >> 16; v20 = pBLVRenderParams->uViewportCenterY - ((signed int)((unsigned __int64)(v19 * (signed __int64)(HIDWORD(v13) + HIDWORD(a5))) >> 16) >> 16); pParticle->sZValue2 = v14; pParticle->uScreenSpaceW = v20; } - uParticleID = (x_int - pBLVRenderParams->vPartyPos.x) << 16; - y = (LODWORD(y_int_) - pBLVRenderParams->vPartyPos.y) << 16; - HIDWORD(a5) = ((unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) + int _uParticleID = (x_int - pBLVRenderParams->vPartyPos.x) << 16; + y = (y_int_ - pBLVRenderParams->vPartyPos.y) << 16; + HIDWORD(a5) = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - ((unsigned __int64)(y * (signed __int64)pBLVRenderParams->sSineY) >> 16); - a6 = (unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; - HIDWORD(z_int_) = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; - uParticleID = (LODWORD(z_int_) - pBLVRenderParams->vPartyPos.z) << 16; - v21 = (unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; + a6 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; + z_int_4 = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; + _uParticleID = (z_int_ - pBLVRenderParams->vPartyPos.z) << 16; + v21 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineNegX) >> 16; v22 = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v21; z = ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) - v21; if ( v22 < (signed int)0x40000u || v22 > (signed int)0x1F400000u ) return 0; v23 = a6 + z_int_4; a2 = a6 + z_int_4; - v24 = ((unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) + v24 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineNegX) >> 16) + ((unsigned __int64)(SHIDWORD(a5) * (signed __int64)pBLVRenderParams->sSineNegX) >> 16); } else { - if ( BYTE1(pParticle->uType) & 2 ) + if (pParticle->type & ParticleType_Line) { v25 = pParticle->_x + 6.7553994e15; - uParticleID = (LODWORD(v25) - pBLVRenderParams->vPartyPos.x) << 16; + int _uParticleID = (LODWORD(v25) - pBLVRenderParams->vPartyPos.x) << 16; v26 = pParticle->_y + 6.7553994e15; y = (LODWORD(v26) - pBLVRenderParams->vPartyPos.y) << 16; HIDWORD(v25) = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v27 = ((unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) + v27 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - HIDWORD(v25); - z = ((unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) + z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - HIDWORD(v25); - v28 = (unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; + v28 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; a5 = pParticle->_z + 6.7553994e15; v29 = (LODWORD(a5) - pBLVRenderParams->vPartyPos.z) << 16; LODWORD(v30) = pBLVRenderParams->field_40 << 16; @@ -330,7 +332,7 @@ v31 = v30 / z; v32 = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; pParticle->_screenspace_scale = v31; - uParticleID = (unsigned __int64)(v31 * (signed __int64)(v28 + v32)) >> 16; + _uParticleID = (unsigned __int64)(v31 * (signed __int64)(v28 + v32)) >> 16; LODWORD(v33) = pBLVRenderParams->uViewportCenterX - ((signed int)((unsigned __int64)(v31 * (signed __int64)(v28 + v32)) >> 16) >> 16); v34 = pParticle->_screenspace_scale; @@ -340,72 +342,70 @@ pParticle->sZValue2 = v27; pParticle->uScreenSpaceW = v35; } - uParticleID = (x_int - pBLVRenderParams->vPartyPos.x) << 16; - y = (LODWORD(y_int_) - pBLVRenderParams->vPartyPos.y) << 16; + int _uParticleID = (x_int - pBLVRenderParams->vPartyPos.x) << 16; + y = (y_int_ - pBLVRenderParams->vPartyPos.y) << 16; v36 = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sSineY) >> 16; - v22 = ((unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v36; - z = ((unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v36; + v22 = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v36; + z = ((unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sCosineY) >> 16) - v36; if ( v22 < 262144 || v22 > 524288000 ) return 0; - v37 = (unsigned __int64)((signed int)uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; - uParticleID = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; + v37 = (unsigned __int64)((signed int)_uParticleID * (signed __int64)pBLVRenderParams->sSineY) >> 16; + _uParticleID = (unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16; v23 = v37 + ((unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); a2 = v37 + ((unsigned __int64)(y * (signed __int64)pBLVRenderParams->sCosineY) >> 16); - v24 = (LODWORD(z_int_) - pBLVRenderParams->vPartyPos.z) << 16; + v24 = (z_int_ - pBLVRenderParams->vPartyPos.z) << 16; } - uParticleID = abs(v23); + int _uParticleID = abs(v23); v38 = abs(v22); - if ( v38 >= (signed int)uParticleID ) + if ( v38 >= (signed int)_uParticleID ) { LODWORD(v40) = pBLVRenderParams->field_40 << 16; HIDWORD(v40) = pBLVRenderParams->field_40 >> 16; v41 = v40 / z; pParticle->_screenspace_scale = v41; - uParticleID = (unsigned __int64)(v41 * (signed __int64)a2) >> 16; + _uParticleID = (unsigned __int64)(v41 * (signed __int64)a2) >> 16; v42 = pBLVRenderParams->uViewportCenterX - ((signed int)((unsigned __int64)(v41 * (signed __int64)a2) >> 16) >> 16); v43 = pParticle->_screenspace_scale; pParticle->uScreenSpaceX = v42; v44 = v43 * (signed __int64)v24; - uParticleID = v44 >> 16; + //uParticleID = v44 >> 16; v45 = pParticle->flt_28; LODWORD(v44) = (signed int)(v44 >> 16) >> 16; v46 = pBLVRenderParams->uViewportCenterY - v44; pParticle->uScreenSpaceY = pBLVRenderParams->uViewportCenterY - v44; v47 = v45; v48 = _48B561_mess_with_scaling_along_z(/*v46, */v47) * (signed __int64)pParticle->_screenspace_scale; - uParticleID = v48 >> 16; + //_uParticleID = v48 >> 16; pParticle->_screenspace_scale = v48 >> 16; - v10 = z; - goto LABEL_19; + pParticle->sZValue = z; + return true; } - return 0; + return false; } + + int x; if ( !pGame->pIndoorCameraD3D->ApplyViewTransform_TrueIfStillVisible( x_int, - SLODWORD(y_int_), - COERCE_UNSIGNED_INT64(*(float *)&uParticleID + 6.7553994e15), - (signed int *)&uParticleID, + y_int_, + z_int_, + &x, &y, &z, 1) ) - return 0; - pGame->pIndoorCameraD3D->Project(uParticleID, y, z, (int *)&a5 + 1, &a6); + return false; + pGame->pIndoorCameraD3D->Project(x, y, z, &pParticle->uScreenSpaceX, &pParticle->uScreenSpaceY); pParticle->flt_5C = pGame->pIndoorCameraD3D->fov_x; v4 = pParticle->flt_5C; pParticle->flt_60 = pGame->pIndoorCameraD3D->fov_y; v5 = v4 + 6.7553994e15; LODWORD(v6) = 0; HIDWORD(v6) = SLOWORD(v5); - v7 = pParticle->flt_28; - pParticle->_screenspace_scale = v6 / (signed int)uParticleID; - v8 = v7; - pParticle->uScreenSpaceX = HIDWORD(a5); - pParticle->uScreenSpaceY = a6; - pParticle->_screenspace_scale = (unsigned __int64)(_48B561_mess_with_scaling_along_z(/*v9, */v8) * (signed __int64)pParticle->_screenspace_scale) >> 16; - v10 = uParticleID; -LABEL_19: - pParticle->sZValue = v10; - return 1; + //v7 = pParticle->flt_28; + pParticle->_screenspace_scale = v6 / x; + //v8 = v7; + pParticle->_screenspace_scale = (unsigned __int64)(_48B561_mess_with_scaling_along_z(/*v9, */pParticle->flt_28) * (signed __int64)pParticle->_screenspace_scale) >> 16; + pParticle->sZValue = x; + return true; } @@ -473,7 +473,7 @@ v4 = stru_5C6E00->Cos(pIndoorCamera->sRotationY); v5 = stru_5C6E00->Sin(pIndoorCamera->sRotationY); v6 = &v2->pParticles[uID]; - if ( v6->uType ) + if (v6->type != ParticleType_Invalid) { v7 = v6->x + 6.7553994e15; v41 = LODWORD(v7); @@ -481,7 +481,7 @@ v42 = v6->z + 6.7553994e15; if ( v3 ) { - if ( BYTE1(v6->uType) & 2 ) + if (v6->type & ParticleType_Line) { v8 = v6->_x + 6.7553994e15; uIDc = (LODWORD(v8) - pIndoorCamera->pos.x) << 16; @@ -524,7 +524,7 @@ } else { - if ( BYTE1(v6->uType) & 2 ) + if (v6->type & ParticleType_Line) { v18 = v6->_x + 6.7553994e15; uIDf = (LODWORD(v18) - pIndoorCamera->pos.x) << 16; @@ -600,7 +600,7 @@ int v11; // eax@18 int v12; // ecx@20 int v13; // edx@20 - Particle *v14; // eax@28 + //Particle *v14; // eax@28 RenderBillboardTransform_local0 v15; // [sp+Ch] [bp-58h]@1 v15.uParentBillboardID = -1; @@ -609,7 +609,7 @@ { auto p = pParticles + i; - if (!p->uType) + if (p->type == ParticleType_Invalid) continue; if (!ViewProject_TrueIfStillVisible(i)) @@ -622,18 +622,18 @@ { if (pRenderer->pRenderD3D) { - if (p->uType & 0x0100) + if (p->type & ParticleType_Diffuse) { - v14 = &pParticles[i]; - v15._screenspace_x_scaler_packedfloat = v14->_screenspace_scale / 4; - v15._screenspace_y_scaler_packedfloat = v14->_screenspace_scale / 4; - v15.uScreenSpaceX = v14->uScreenSpaceX; - v15.uScreenSpaceY = v14->uScreenSpaceY; - v15.sZValue = v14->sZValue; - pRenderer->MakeParticleBillboardAndPush_BLV(&v15, 0, v14->uLightColor, v14->_rotation); + //v14 = &pParticles[i]; + v15._screenspace_x_scaler_packedfloat = p->_screenspace_scale / 4; + v15._screenspace_y_scaler_packedfloat = p->_screenspace_scale / 4; + v15.uScreenSpaceX = p->uScreenSpaceX; + v15.uScreenSpaceY = p->uScreenSpaceY; + v15.sZValue = p->sZValue; + pRenderer->MakeParticleBillboardAndPush_BLV(&v15, 0, p->uLightColor, p->_rotation); return; } - if (p->uType & 0x0200) + if (p->type & ParticleType_Line) { if (pLines.uNumLines < 100) { @@ -656,28 +656,26 @@ pLines.pLineVertices[2 * pLines.uNumLines++ + 1].texcoord.y = 0.0; } } - if (p->uType & 0x0400) + if (p->type & ParticleType_Bitmap) { v15._screenspace_x_scaler_packedfloat = p->_screenspace_scale; v15._screenspace_y_scaler_packedfloat = p->_screenspace_scale; v15.uScreenSpaceX = p->uScreenSpaceX; v15.uScreenSpaceY = p->uScreenSpaceY; v15.sZValue = p->sZValue; - pRenderer->MakeParticleBillboardAndPush_BLV(&v15, - pBitmaps_LOD->pHardwareTextures[p->uTextureID], - v14->uLightColor, + pRenderer->MakeParticleBillboardAndPush_BLV(&v15, pBitmaps_LOD->pHardwareTextures[p->uTextureID], + p->uLightColor, p->_rotation); } - if (p->uType & 0x0800) + if (p->type & ParticleType_Sprite) { v15._screenspace_x_scaler_packedfloat = p->_screenspace_scale; v15._screenspace_y_scaler_packedfloat = p->_screenspace_scale; v15.uScreenSpaceX = p->uScreenSpaceX; v15.uScreenSpaceY = p->uScreenSpaceY; v15.sZValue = p->sZValue; - pRenderer->MakeParticleBillboardAndPush_BLV(&v15, - pSprites_LOD->pHardwareSprites[p->uTextureID].pTexture, - v14->uLightColor, + pRenderer->MakeParticleBillboardAndPush_BLV(&v15, pSprites_LOD->pHardwareSprites[p->uTextureID].pTexture, + p->uLightColor, p->_rotation); } } @@ -697,7 +695,7 @@ } else { - pRenderer->MakeParticleBillboardAndPush_BLV_Software(v13, v12, p->sZValue, p->uLightColor, v11); + pRenderer->MakeParticleBillboardAndPush_BLV_Software(v13, v12, p->sZValue, p->uLightColor, v11); } } } @@ -764,7 +762,7 @@ pParticleEngine->pLines.pLineVertices[2 * pParticleEngine->pLines.uNumLines].diffuse = *(_DWORD *)(v7 + 18); pParticleEngine->pLines.pLineVertices[2 * pParticleEngine->pLines.uNumLines].specular = 0; pParticleEngine->pLines.pLineVertices[2 * pParticleEngine->pLines.uNumLines].texcoord.x = 0.0; - *((float *)&pParticleEngine->pParticles[0].uType + 16 * (pParticleEngine->pLines.uNumLines + 813)) = 0.0; + *((float *)&pParticleEngine->pParticles[0].type + 16 * (pParticleEngine->pLines.uNumLines + 813)) = 0.0; pParticleEngine->pLines.pLineVertices[2 * pParticleEngine->pLines.uNumLines + 1].pos.x = (double)*(signed int *)(v7 - 10); pParticleEngine->pLines.pLineVertices[2 * pParticleEngine->pLines.uNumLines + 1].pos.y = (double)*(signed int *)(v7 - 6); v15 = *(_DWORD *)v7;
--- a/ParticleEngine.h Mon Mar 11 09:28:41 2013 +0600 +++ b/ParticleEngine.h Mon Mar 11 09:28:57 2013 +0600 @@ -3,11 +3,23 @@ +enum ParticleType: unsigned __int32 +{ + ParticleType_Invalid = 0, + ParticleType_1 = 0x0001, + ParticleType_Rotating = 0x0004, + ParticleType_8 = 0x0008, + ParticleType_Diffuse = 0x0100, // colored plane + ParticleType_Line = 0x0200, // line + ParticleType_Bitmap = 0x0400, // textured planed + ParticleType_Sprite = 0x0800 +}; + /* 305 */ #pragma pack(push, 1) -struct Particle_ +struct Particle_sw { - int bFree; + unsigned int type; float x; float y; float z; @@ -26,15 +38,12 @@ #pragma pack(pop) + /* 109 */ #pragma pack(push, 1) struct Particle { - int uType; // 0x0000: empty - // 0x0100: color plane - // 0x0200: line - // 0x0400: bitmap plane - // 0x0800: sprite plane + unsigned int type; float x; float y; float z; @@ -101,9 +110,9 @@ ParticleEngine(); void ResetParticles(); - void AddParticle(Particle_ *a2); + void AddParticle(Particle_sw *a2); void Draw(); - void UpdateParticles(); + void UpdateParticles(); bool ViewProject_TrueIfStillVisible(unsigned int uParticleID); bool _48B5B3(unsigned int uID); void DrawParticles_BLV();
--- a/Player.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/Player.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -1804,7 +1804,7 @@ Player *v27; // [sp+14h] [bp-4h]@1 v27 = this; - LOBYTE(v5) = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); + v5 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); v26 = v5; result = 4; v7 = pItem->uItemID; @@ -1929,7 +1929,7 @@ } //----- (004910A8) -------------------------------------------------------- -int Player::GetMediatation() +int Player::GetMeditation() { char v1; // al@1 int v2; // ecx@1 @@ -2067,9 +2067,9 @@ signed int v9; // [sp-4h] [bp-10h]@6 v1 = this; - LOBYTE(v2) = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); + v2 = GetActualSkillLevel(PLAYER_SKILL_MERCHANT); v3 = v1->pActiveSkills[22]; - v4 = v2 & 0x3F; + v4 = v2 & 0x003F; v5 = v1->pActiveSkills[22] & 0x3F; if ( (signed int)SkillToMastery(v2) >= 4 ) return 10000; @@ -5997,7 +5997,7 @@ if ( a2 == CHARACTER_ATTRIBUTE_MANA ) { v60 = pBaseManaPerLevelByClass[v2->classType]; - v61 = v2->GetMediatation(); + v61 = v2->GetMeditation(); return v60 * v61; } if ( a2 != 9 )
--- a/Player.h Mon Mar 11 09:28:41 2013 +0600 +++ b/Player.h Mon Mar 11 09:28:57 2013 +0600 @@ -524,7 +524,7 @@ bool DiscardConditionIfLastsLongerThan(unsigned int uCondition, unsigned __int64 uTime); int _490EEE(ItemGen *pItem, int a3, int a4, int a5); int GetBodybuilding(); - int GetMediatation(); + int GetMeditation(); int CanIdentify(ItemGen *pItem); int CanRepair(ItemGen *); int GetMerchant();
--- a/Render.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/Render.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -191,9 +191,8 @@ soft_billboard.uViewportZ = pBLVRenderParams->uViewportZ - 1; soft_billboard.uViewportW = pBLVRenderParams->uViewportW; - pOutdoorCamera->uNumBillboards = uNumBillboardsToDraw; - - for (uint i = 0; i < uNumBillboardsToDraw; ++i) + pOutdoorCamera->uNumBillboards = ::uNumBillboardsToDraw; + for (uint i = 0; i < ::uNumBillboardsToDraw; ++i) { auto p = pBillboardRenderList + i; @@ -3507,7 +3506,7 @@ __int16 v29; // cx@37 int v30; // ecx@37 int v31; // ebx@37 - Particle_ local_0; // [sp+Ch] [bp-98h]@7 + Particle_sw local_0; // [sp+Ch] [bp-98h]@7 int x; // [sp+74h] [bp-30h]@9 int y; // [sp+78h] [bp-2Ch]@9 //int v35; // [sp+7Ch] [bp-28h]@1 @@ -3701,8 +3700,8 @@ { memset(&local_0, 0, 0x68u); v3 = (double)*((signed int *)v0 - 1); - local_0.bFree = 1036; - local_0.uDiffuse = 0xFF3C1Eu; + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; + local_0.uDiffuse = 0xFF3C1E; local_0.x = v3; local_0.y = (double)*(signed int *)v0; local_0.z = (double)*((signed int *)v0 + 1);
--- a/SpriteObject.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/SpriteObject.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -221,7 +221,7 @@ int v49; // [sp+Ch] [bp-9Ch]@52 int v50; // [sp+10h] [bp-98h]@52 Vec3_int_ v51; // [sp+14h] [bp-94h]@11 - Particle_ Dst; // [sp+20h] [bp-88h]@45 + Particle_sw Dst; // [sp+20h] [bp-88h]@45 unsigned int uLayingItemID_; // [sp+88h] [bp-20h]@1 int v54; // [sp+8Ch] [bp-1Ch]@1 int v55; // [sp+90h] [bp-18h]@1 @@ -324,8 +324,8 @@ Dst.flt_18 = 0.0; if ( HIBYTE(v23) & 2 ) { - Dst.bFree = 1036; - Dst.uDiffuse = 16727070; + Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; + Dst.uDiffuse = 0xFF3C1E; v24 = rand(); v48 = (TEXTURE_TYPE)0; LABEL_83: @@ -335,7 +335,7 @@ { if ( HIBYTE(v23) & 4 ) { - Dst.bFree = 512; + Dst.type = ParticleType_Line; Dst.uDiffuse = rand(); Dst.timeToLive = 64; Dst.uTextureID = 0; @@ -344,7 +344,7 @@ pGame->pParticleEngine->AddParticle(&Dst); return; } - Dst.bFree = 1032; + Dst.type = ParticleType_Bitmap | ParticleType_8; Dst.uDiffuse = rand(); v24 = rand(); v48 = (TEXTURE_TYPE)0; @@ -464,22 +464,22 @@ Dst.flt_18 = 0.0; if ( HIBYTE(v45) & 2 ) { - Dst.bFree = 1036; - Dst.uDiffuse = 16727070; + Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; + Dst.uDiffuse = 0xFF3C1E; v24 = rand(); v48 = (TEXTURE_TYPE)0; goto LABEL_83; } if ( HIBYTE(v45) & 4 ) { - Dst.bFree = 512; + Dst.type = ParticleType_Line; v46 = rand(); Dst.uTextureID = 0; Dst.uDiffuse = v46; Dst.timeToLive = 64; goto LABEL_89; } - Dst.bFree = 1032; + Dst.type = ParticleType_Bitmap | ParticleType_8; Dst.uDiffuse = rand(); v24 = rand(); v48 = (TEXTURE_TYPE)0; @@ -628,7 +628,7 @@ const char *v32; // [sp-8h] [bp-98h]@68 enum TEXTURE_TYPE v33; // [sp-4h] [bp-94h]@19 enum TEXTURE_TYPE v34; // [sp-4h] [bp-94h]@68 - Particle_ Dst; // [sp+Ch] [bp-84h]@18 + Particle_sw Dst; // [sp+Ch] [bp-84h]@18 unsigned int uLayingItemID_; // [sp+74h] [bp-1Ch]@1 ObjectDesc *v37; // [sp+78h] [bp-18h]@1 unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4 @@ -749,8 +749,8 @@ Dst.flt_18 = 0.0; if ( v29 & 0x200 ) { - Dst.bFree = 1036; - Dst.uDiffuse = 0xFF3C1Eu; + Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; + Dst.uDiffuse = 0xFF3C1E; v30 = rand(); v34 = (TEXTURE_TYPE)v8; v32 = "effpar01"; @@ -759,7 +759,7 @@ { if ( v29 & 0x400 ) goto LABEL_70; - Dst.bFree = 1032; + Dst.type = ParticleType_Bitmap | ParticleType_8; Dst.uDiffuse = rand(); v30 = rand(); v34 = (TEXTURE_TYPE)v8; @@ -925,8 +925,8 @@ Dst.flt_18 = 0.0; if ( v10 & 0x200 ) { - Dst.bFree = 1036; - Dst.uDiffuse = 0xFF3C1Eu; + Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; + Dst.uDiffuse = 0xFF3C1E; Dst.flt_28 = 1.0; v11 = rand(); v33 = (TEXTURE_TYPE)v8; @@ -937,7 +937,7 @@ if ( v10 & 0x400 ) { LABEL_70: - Dst.bFree = 512; + Dst.type = ParticleType_Line; Dst.uDiffuse = rand(); Dst.timeToLive = 64; Dst.uTextureID = v8; @@ -945,7 +945,7 @@ Dst.flt_28 = 1.0; goto LABEL_72; } - Dst.bFree = 1032; + Dst.type = ParticleType_Bitmap | ParticleType_8; Dst.uDiffuse = rand(); Dst.flt_28 = 1.0; v11 = rand();
--- a/TileFrameTable.h Mon Mar 11 09:28:41 2013 +0600 +++ b/TileFrameTable.h Mon Mar 11 09:28:57 2013 +0600 @@ -21,6 +21,20 @@ }; +enum Tileset: unsigned __int16 +{ + Tileset_Grass = 0, + Tileset_Snow = 1, + Tileset_2 = 2, + Tileset_3 = 3, + Tileset_Dirt = 4, + Tileset_Water = 5, + Tileset_6 = 6, + Tileset_Swamp = 7, + Tileset_8 = 8, + Tileset_9 = 9, + Tileset_RoadGrassCobble = 10 +}; /* 48 */ #pragma pack(push, 1) @@ -29,7 +43,7 @@ char pTileName[16]; unsigned __int16 uTileID; unsigned __int16 uBitmapID; - unsigned __int16 uTerrainType; + Tileset tileset; unsigned __int16 uSection; unsigned __int16 uAttributes; }; @@ -48,7 +62,7 @@ ~TileTable(); TileDesc *GetTileById(unsigned int uTileID); - void InitializeTileset(int uTerrainType); + void InitializeTileset(Tileset tileset); int method_487ED6(signed int a1, int a2); unsigned int GetTileId(unsigned int uTerrainType, unsigned int uSection); void ToFile();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UIHouses.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -0,0 +1,5193 @@ +#include "UIHouses.h" + +#include "Party.h" +#include "Player.h" +#include "texts.h" +#include "Events.h" +#include "Arcomage.h" +#include "LOD.h" +#include "Mouse.h" +#include "GUIWindow.h" +#include "GUIButton.h" +#include "GUIFont.h" +#include "Events2D.h" +#include "Overlays.h" +#include "Render.h" +#include "Indoor.h" +#include "Outdoor.h" +#include "AudioPlayer.h" +#include "VideoPlayer.h" +#include "Monsters.h" +#include "Viewport.h" +#include "Keyboard.h" +#include "NPC.h" + +#include "mm7_data.h" + + +int uHouse_ExitPic; // weak + +int dword_591080; // weak + +const stru159 pAnimatedRooms[196] = //0x4E5F70 + { + {"", 0x4, 0x1F4, 0, 0, 0}, + {"Human Armor01", 0x20, 0x2C0, 2, 58, 0}, + {"Necromancer Armor01", 0x20, 0x2D7, 2, 70, 0 }, + {"Dwarven Armor01", 0x20, 0x2EE, 2, 5, 0 }, + {"Wizard Armor", 0x20, 0x3BD, 2, 19, 0 }, + {"Warlock Armor", 0x20, 0x2D6, 2, 35, 0 }, + {"Elf Armor", 0x20, 0x2BC, 2, 79, 0 }, + {"Human Alchemisht01", 0xE, 0x2BE, 4, 95, 0 }, + {"Necromancer Alchemist01", 0xE, 0x2D6, 4, 69, 0 }, + {"Dwarven Achemist01", 0xE, 0x387, 4, 4, 0 }, + {"Wizard Alchemist", 0xE, 0x232, 4, 25, 0 }, + {"Warlock Alchemist", 0xE, 0x2BE, 4, 42, 0 }, + {"Elf Alchemist", 0xE, 0x38A, 4, 84, 0 }, + {"Human Bank01", 0x6, 0x384, 22, 52, 0 }, + {"Necromancer Bank01", 0x6, 0x2D8, 22, 71, 0 }, + {"Dwarven Bank", 0x6, 0x2F3, 22, 6, 0 }, + {"Wizard Bank", 0x6, 0x3BA, 22, 20, 0 }, + {"Warlock Bank", 0x6, 0x39F, 22, 36, 0 }, + {"Elf Bank", 0x6, 0x2BC, 22, 71, 0 }, + {"Boat01", 0xF, 0x4C, 28, 53, 3 }, + {"Boat01d", 0xF, 0x4C, 28, 53, 3 }, + {"Human Magic Shop01", 0xA, 0x2C8, 3, 54, 0 }, + {"Necromancer Magic Shop01", 0xE, 0x2DC, 3, 66, 0 }, + {"Dwarven Magic Shop01", 0x2A, 0x2EF, 3, 91, 0 }, + {"Wizard Magic Shop", 0x1E, 0x2DF, 3, 15, 0 }, + {"Warlock Magic Shop", 0x7, 0x3B9, 3, 15, 0 }, + {"Elf Magic Shop", 0x24, 0x2CC, 3, 82, 0 }, + {"Human Stables01", 0x21, 0x31, 27, 48, 3 }, + {"Necromancer Stables", 0x21, 0x2DD, 27, 67, 3 }, + {"", 0x21, 0x2F0, 27, 91, 3 }, + {"Wizard Stables", 0x21, 0x3BA, 27, 16, 3 }, + {"Warlock Stables", 0x21, 0x181, 27, 77, 3 }, + {"Elf Stables", 0x21, 0x195, 27, 77, 3 }, + {"Human Tavern01", 0xD, 0x2C2, 21, 49, 0 }, + {"Necromancer Tavern01", 0xD, 0x3B0, 21, 57, 0 }, + {"Dwarven Tavern01", 0xD, 0x2FE, 21, 94, 0 }, + {"Wizard Tavern", 0xD, 0x3BB, 21, 17, 0 }, + {"Warlock Tavern", 0xD, 0x3A8, 21, 33, 0 }, + {"Elf Tavern", 0xD, 0x2CD, 21, 78, 0 }, + {"Human Temple01", 0x24, 0x2DB, 23, 50, 3 }, + {"Necromancer Temple", 0x24, 0x2DF, 23, 60, 3 }, + {"Dwarven Temple01", 0x24, 0x2F1, 23, 86, 3 }, + {"Wizard Temple", 0x24, 0x2E0, 23, 10, 3 }, + {"Warlock Temple", 0x24, 0x3A4, 23, 27, 3 }, + {"Elf Temple", 0x24, 0x2CE, 23, 72, 3 }, + {"Human Town Hall", 0x10, 0x39C, 17, 14, 0 }, + {"Necromancer Town Hall01", 0x10, 0x3A4, 17, 61, 0 }, + {"Dwarven Town Hall", 0x10, 0x2DB, 17, 88, 0 }, + {"Wizard Town Hall", 0x10, 0x3BD, 17, 11, 0 }, + {"Warlock Town Hall", 0x10, 0x2DB, 17, 28, 0 }, + {"Elf Town Hall", 0x10, 0x27A, 17, 73, 0 }, + {"Human Training Ground01", 0x18, 0x2C7, 30, 44, 0 }, + {"Necromancer Training Ground", 0x18, 0x3AD, 30, 62, 0 }, + {"Dwarven Training Ground", 0x18, 0x2F2, 30, 89, 0 }, + {"Wizard Training Ground", 0x18, 0x3A3, 30, 12, 0 }, + {"Warlock Training Ground", 0x18, 0x3A6, 30, 29, 0 }, + {"Elf Training Ground", 0x18, 0x19F, 30, 74, 0 }, + {"Human Weapon Smith01", 0x16, 0x2C1, 1, 45, 4 }, + {"Necromancer Weapon Smith01", 0x16, 0x2D9, 1, 63, 4 }, + {"Dwarven Weapon Smith01", 0x16, 0x2EE, 1, 82, 4 }, + {"Wizard Weapon Smith", 0x16, 0x2D5, 1, 13, 4 }, + {"Warlock Weapon Smith", 0x16, 0x2D7, 1, 23, 4 }, + {"Elf Weapon Smith", 0x16, 0x2CA, 1, 75, 4 }, + {"Air Guild", 0x1D, 0xA4, 6, 1, 3 }, + {"Body Guild", 0x19, 0x3BF, 11, 2, 0 }, + {"DarkGuild", 0x19, 0x2D1, 13, 3, 0 }, + {"EarthGuild", 0x19, 0x2CB, 8, 83, 0 }, + {"Fire Guild", 0x1C, 0x2BF, 5, 56, 0 }, + {"Light Guild", 0x1C, 0x2D5, 12, 46, 0 }, + {"Mind Guild", 0x1C, 0xE5, 10, 40, 0 }, + {"Spirit Guild", 0x1C, 0x2D2, 9, 41, 0 }, + {"Water Guild", 0x1B, 0x2D3, 7, 24, 0 }, + {"Lord And Judge Out01", 1, 0, 29, 39, 0 }, + {"Human Poor House 1", 8, 0, 29, 0, 0 }, + {"Human Poor House 2", 8, 0, 29, 0, 0 }, + {"Human Poor House 3", 8, 0, 29, 0, 0 }, + {"Human Medium House 1", 8, 0, 29, 0, 0 }, + {"Human Medium House 2", 8, 0, 29, 0, 0 }, + {"Human Medium House 3", 8, 0, 29, 0, 0 }, + {"Human Rich House 1", 8, 0, 29, 0, 0 }, + {"Human Rich House 2", 8, 0, 29, 0, 0 }, + {"Human Rich House 3", 8, 0, 29, 0, 0 }, + {"Elven Poor House 1", 8, 0, 29, 0, 0 }, + {"Elven Poor House 2", 8, 0, 29, 0, 0 }, + {"Elven Poor House 3", 8, 0, 29, 0, 0 }, + {"Elven Medium House 1", 8, 0, 29, 0, 0 }, + {"Elven Medium House 2", 8, 0, 29, 0, 0 }, + {"Elven Medium House 3", 8, 0, 29, 0, 0 }, + {"Elven Rich House 1", 8, 0, 29, 0, 0 }, + {"Elven Rich House 2", 8, 0, 29, 0, 0 }, + {"Elven Rich House 3", 8, 0, 29, 0, 0 }, + {"Dwarven Poor House 1", 8, 0, 29, 0, 0 }, + {"Dwarven Poor House 2", 8, 0, 29, 0, 0 }, + {"Dwarven Poor House 3", 8, 0, 29, 0, 0 }, + {"Dwarven Medium House 1", 8, 0, 29, 0, 0 }, + {"Dwarven Medium house 2", 8, 0, 29, 0, 0 }, + {"Dwarven Medium House 3", 8, 0, 29, 0, 0 }, + {"Dwarven Rich House 1", 8, 0, 29, 0, 0 }, + {"Dwarven Rich House 2", 8, 0, 29, 0, 0 }, + {"Dwarven Rich House 3", 8, 0, 29, 0, 0 }, + {"Wizard Poor House 1", 8, 0, 29, 0, 0 }, + {"Wizard Poor House 2", 8, 0, 29, 0, 0 }, + {"Wizard Poor House 3", 8, 0, 29, 0, 0 }, + {"Wizard Medium House 1", 8, 0, 29, 0, 0 }, + {"Wizard Medium House 2", 8, 0, 29, 0, 0 }, + {"Wizard Mdeium House 3", 8, 0, 29, 0, 0 }, + {"Wizard Rich House 1", 8, 0, 29, 0, 0 }, + {"Wizard Rich House 2", 8, 0, 29, 0, 0 }, + {"Wizard Rich House 3", 8, 0, 29, 0, 0 }, + {"Necromancer Poor House 1", 8, 0, 29, 0, 0 }, + {"Necromancer Poor House 2", 8, 0, 29, 0, 0 }, + {"Necromancer Poor House 3", 8, 0, 29, 0, 0 }, + {"Necromancer Medium House 1", 8, 0, 29, 0, 0 }, + {"Necromancer Medium House 2", 8, 0, 29, 0, 0 }, + {"Necromancer Mdeium House 3", 8, 0, 29, 0, 0 }, + {"Necromancer Rich House 1", 8, 0, 29, 0, 0 }, + {"Necromancer Rich House 2", 8, 0, 29, 0, 0 }, + {"Necromancer Rich House 3", 8, 0, 29, 0, 0 }, + {"Warlock Poor House 1", 8, 0, 29, 0, 0 }, + {"Warlock Poor House 2", 8, 0, 29, 0, 0 }, + {"Warlock Poor House 3", 8, 0, 29, 0, 0 }, + {"Warlock Medium House 1", 8, 0, 29, 0, 0 }, + {"Warlock Medium House 2", 8, 0, 29, 0, 0 }, + {"Warlock Mdeium House 3", 8, 0, 29, 0, 0 }, + {"Warlock Rich House 1", 8, 0, 29, 0, 0 }, + {"Warlock Rich House 2", 8, 0, 29, 0, 0 }, + {"Warlock Rich House 3", 8, 0, 29, 0, 0 }, + {"Out01 Temple of the Moon", 0x24, 0, 25, 0, 0 }, + {"Out01 Dragon Cave", 0x24, 0, 25, 0, 0 }, + {"Out02 Castle Harmondy", 0x24, 0, 25, 0, 0 }, + {"Out02 White Cliff Cave", 0x24, 0, 25, 0, 0 }, + {"Out03 Erathian Sewer", 0x24, 0, 25, 0, 0 }, + {"Out03 Fort Riverstride", 0x24, 0, 25, 0, 0 }, + {"Out03 Castle Gryphonheart", 0x24, 0, 25, 0, 0 }, + {"Out04 Elf Castle", 0x24, 0, 25, 0, 0 }, + {"Out04 Tularean Caves", 0x24, 0, 25, 0, 0 }, + {"Out04 Clanker's Laboratory", 0x24, 0, 25, 0, 0 }, + {"Out05 Hall of the Pit", 0x24, 0, 25, 0, 0 }, + {"Out05 Watchtower 6", 0x24, 0, 25, 0, 0 }, + {"Out06 School of Sorcery", 0x24, 0, 25, 0, 0 }, + {"Out06 Red Dwarf Mines", 0x24, 0, 25, 0, 0 }, + {"Out07 Castle Lambert", 0x24, 0, 25, 0, 0 }, + {"Out07 Walls of Mist", 0x24, 0, 25, 0, 0 }, + {"Out07 Temple of the Light", 0x24, 0, 25, 0, 0 }, + {"Out08 Evil Entrance", 0x24, 0, 25, 0, 0 }, + {"Out08 Breeding Zone", 0x24, 0, 25, 0, 0 }, + {"Out08 Temple of the Dark", 0x24, 0, 25, 0, 0 }, + {"Out09 Grand Temple of the Moon", 0x24, 0, 25, 0, 0 }, + {"Out09 Grand Tempple of the Sun", 0x24, 0, 25, 0, 0 }, + {"Out10 Thunderfist Mountain", 0x24, 0, 25, 0, 0 }, + {"Out10 The Maze", 0x24, 0, 25, 0, 0 }, + {"Out10 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 }, + {"", 0x24, 0, 25, 0, 0 }, + {"", 0x24, 0, 25, 0, 0 }, + {"Out11 Stone City", 0x24, 0, 25, 0, 0 }, + {"", 0x24, 0, 25, 0, 0 }, + {"Out12 Colony Zod", 0x24, 0, 25, 0, 0 }, + {"Out12 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 }, + {"", 0x24, 0, 25, 0, 0 }, + {"", 0x24, 0, 25, 0, 0 }, + {"Out13 Mercenary Guild", 0x24, 0, 25, 0, 0 }, + {"Out13 Tidewater Caverns", 0x24, 0, 25, 0, 0 }, + {"Out13 Wine Cellar", 0x24, 0, 25, 0, 0 }, + {"Out14 Titan's Stronghold", 0x24, 0, 25, 0, 0 }, + {"Out14 Temple Of Baa", 0x24, 0, 25, 0, 0 }, + {"Out14 Hall under the Hill", 0x24, 0, 25, 0, 0 }, + {"Out15 The Linclon", 0x24, 0, 25, 0, 0 }, + {"Jail", 0x24, 0, 31, 0, 0 }, + {"Harmondale Throne Room", 0x24, 0, 29, 0, 0 }, + {"Gryphonheart Throne Room", 0x24, 0, 20, 0, 0 }, + {"Elf Castle Throne Room", 0x24, 0, 20, 0, 0 }, + {"Wizard Castle Throne Room", 0x24, 0, 20, 0, 0 }, + {"Necromancer Casstle Trone Room", 0x24, 0, 20, 0, 0 }, + {"Master Thief", 0x24, 0, 29, 0, 0 }, + {"Dwarven King", 0x24, 0, 20, 0, 0 }, + {"Arms Master", 0x24, 0, 29, 0, 0 }, + {"Warlock", 0x24, 0, 29, 0, 0 }, + {"Lord Markam", 0x24, 0, 20, 0, 0 }, + {"Arbiter Neutral Town", 0x24, 0, 29, 0, 0 }, + {"Arbiter Good Town", 0x24, 0, 29, 0, 0 }, + {"Arbiter Evil Town", 0x24, 0, 29, 0, 0 }, + {"Necromancer Throne Room Empty", 0x24, 0, 20, 0, 0 }, + {"", 0x24, 0, 29, 0, 0 }, + {"", 0x24, 0, 29, 0, 0 }, + {"", 0x24, 0, 29, 0, 0 }, + {"", 0x24, 0, 29, 0, 0 }, + {"Boat01", 0xF, 0, 29, 53, 3 }, + {"", 0x24, 0, 28, 0, 0 }, + {"", 0x24, 0, 28, 0, 0 }, + {"", 0x24, 0, 28, 0, 0 }, + {"", 0x24, 0, 29, 0, 0 }, + {"Arbiter Room Neutral", 0x24, 0, 29, 0, 0 }, + {"Out02 Castle Harmondy Abandoned", 0x24, 0, 25, 0, 0 }, + {"Human Temple02", 0x24, 0x3AB, 23, 27, 0 }, + {"Player Castle Good", 0x24, 0, 25, 0, 0 }, + {"Player Castle Bad", 0x24, 0, 25, 0, 0} + }; + + + + +//----- (0044606A) -------------------------------------------------------- +void PrepareHouse(HOUSE_ID house) +{ + //unsigned int v1; // ebx@1 + //signed int v2; // esi@1 + //int uExitPic; // edi@1 + __int16 uExitMapID; // ax@2 + //int result; // eax@5 + //unsigned int *v6; // ecx@8 + int v7; // ebx@11 + //int v8; // esi@16 + //unsigned int v9; // eax@16 + //unsigned int v10; // eax@19 + //int v11; // ecx@19 + //char pContainer[36]; // [sp+Ch] [bp-54h]@16 + int v13; // [sp+30h] [bp-30h]@11 + int Dst[6]; // [sp+34h] [bp-2Ch]@1 + //unsigned int v15; // [sp+4Ch] [bp-14h]@1 + int uAnimationID; // [sp+50h] [bp-10h]@1 + //unsigned int *v17; // [sp+54h] [bp-Ch]@3 + //unsigned int v18; // [sp+58h] [bp-8h]@1 + //int v19; // [sp+5Ch] [bp-4h]@7 + + //v15 = uHouseID; + //v1 = 52 * uHouseID; + //uAnimationID = p2DEvents_minus1___02[26 * uHouseID]; + uAnimationID = p2DEvents[house - 1].uAnimationID; + //v18 = 52 * uHouseID; + memset(Dst, 0, 0x18u); + //uExitPic = *(__int16 *)((char *)p2DEvents_minus1_::2C + v1); + //uExitPic = p2DEvents[uHouseID - 1].uExitPicID; + uNumDialogueNPCPortraits = 0; + uHouse_ExitPic = p2DEvents[house - 1].uExitPicID; + if ( uHouse_ExitPic ) + { + //uExitMapID = *(__int16 *)((char *)p2DEvents_minus1_::30 + v1); + uExitMapID = p2DEvents[house - 1]._quest_related; + if ( uExitMapID > 0 ) + { + //v17 = (unsigned int *)(uExitMapID - 1); + if(_449B57_test_bit(pParty->_quest_bits,uExitMapID)) + // if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) ) + { + //uExitPic = 0; + uHouse_ExitPic = 0; + } + } + } + + dword_591080 = pAnimatedRooms[uAnimationID].field_8; + //result = dword_591080; + + //v2 = 0; + uNumDialogueNPCPortraits = 0; + if ( dword_591080 ) + { + //v2 = 1; + Dst[0] = dword_591080; + uNumDialogueNPCPortraits = 1; + } + + //v19 = 1; + for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) + { + auto npc = pNPCStats->pNewNPCData + i; + //v6 = &pNPCStats->pNewNPCData[1].uFlags; + //v17 = &pNPCStats->pNewNPCData[1].uFlags; + //do + //{ + if (npc->Location2D == house ) + { + if (~npc->uFlags & 0x80) + //if ( !(*(char *)v6 & 0x80) ) + { + v7 = uNumDialogueNPCPortraits++ - dword_591080 ? 1 : 0; + HouseNPCData[v7] = npc; + //v6 = v17; + //*(&v13 + v2) = *(v17 - 1); + Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID; + //v1 = v18; + if ((npc->uFlags & 3) != 2) + ++npc->uFlags; + } + } + //++v19; + //v6 += 19; + //v17 = v6; + //} + //while ( v19 < (signed int)pNPCStats->uNumNewNPCs ); + } + //uNumDialogueNPCPortraits = v2; + + //v19 = 0; + for (uint i = 0; i < uNumDialogueNPCPortraits; ++i) + //if ( v2 > 0 ) + { + //do + //{ + //v8 = v19; + char icon_name[128]; + sprintfex(icon_name, "npc%03u", Dst[i]); + //v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + //++v19; + pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); + //result = v19; + //} + //while ( v19 < uNumDialogueNPCPortraits ); + //uExitPic = uHouse_ExitPic; + } + + if (uHouse_ExitPic) + { + //v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); + //v11 = uNumDialogueNPCPortraits++; + pDialogueNPCPortraits[uNumDialogueNPCPortraits++] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); + //result = *(__int16 *)((char *)p2DEvents_minus1_::2E + v1); + //result = p2DEvents[house - 1].uExitMapID; + uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; + } + //return result; +} + + + +//----- (0044622E) -------------------------------------------------------- +bool EnterHouse(enum HOUSE_ID uHouseID) + { + //enum HOUSE_ID v1; // edi@1 + //int v2; // edi@5 + signed int uOpenTime; // eax@5 + signed int uCloseTime; // esi@5 + unsigned int v5; // esi@5 + int v6; // edx@5 + signed int am_pm_flag_open; // ecx@10 + signed int am_pm_flag_close; // eax@10 + int v9; // esi@10 + //unsigned int v10; // esi@16 + int v11; // ecx@17 + unsigned int v12; // kr00_4@25 + //Player *v13; // esi@25 + int v14; // eax@25 + //Player *v15; // esi@27 + //signed int v16; // eax@32 + unsigned int v17; // eax@37 + signed int v18; // edi@37 + signed int v19; // edi@41 + //unsigned int v20; // ecx@41 + //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_ID v25; // [sp+38h] [bp-4h]@1 + + //v1 = uHouseID; + //v25 = uHouseID; + GameUI_StatusBar_TimedString[0] = 0; + pStatusBarString[0] = 0; + ShowStatusBarString("", 2u); + if ( pMessageQueue_50CBD0->uNumMessages ) + pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; + viewparams->bRedrawGameUI = 1; + uDialogueType = 0; + pKeyActionMap->_459ED1(3); + pKeyActionMap->ResetKeys(); + if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) + { + GameOverMenu(0); + return 0; + } + uOpenTime = p2DEvents[uHouseID - 1].uOpenTime; + uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; + ptr_F8B1E8 = 0; + dword_F8B1E4 = 0; + dword_F8B1F4 = 0; + memset(byte_F8B1F0, 0, 4); + memset(byte_F8B148, 0, 16); + pRenderer->ClearZBuffer(0, 479); + + if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))|| + ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1))))) + + { + am_pm_flag_open = 0; + am_pm_flag_close = 0; + if (uOpenTime > 12 ) + { + uOpenTime -= 12; + am_pm_flag_open = 1; + } + if ( uCloseTime > 12 ) + { + uCloseTime -= 12; + am_pm_flag_close = 1; + } + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], + uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s" + ShowStatusBarString(pTmpBuf, 2u); + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0); + return 0; + } + else + { + //v10 = uHouseID; + if ( (signed int)uHouseID < 53 ) //entering shops and guilds + { + if ( !(pParty->field_3C._shop_ban_times[uHouseID]) + || (pParty->field_3C._shop_ban_times[uHouseID] <= pParty->uTimePlayed) ) + { + pParty->field_3C._shop_ban_times[uHouseID] = 0; + } + else + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!" + return 0; + } + } + if ( !start_event_seq_number ) + pAudioPlayer->StopChannels(-1, -1); + + uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; + in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; + if ( in_current_building_type == BildingType_Throne_Room && pParty->uFine ) // going 2 jail + { + uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; + uHouseID = HOUSE_JAIL; + pParty->uTimePlayed = pParty->uTimePlayed+ 0x7620000; + in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE].uAnimationID].uBuildingType; + ++pParty->uNumPrisonTerms; + pParty->uFine = 0; + for (uint i = 0; i < 4; ++i) + { + pParty->pPlayers[i].uTimeToRecovery = 0; + pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; + pParty->pPlayers[i].SetVariable(VAR_Award, 87); + } + } + ++pIcons_LOD->uTexturePacksCount; + if ( !pIcons_LOD->uNumPrevLoadedFiles ) + pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; + switch (pParty->alignment) + { + case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; + case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; + case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; + default: assert(false); + } + + v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); + pDialogueNPCCount = 0; + pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; + uTextureID_507B04 = uTextureID_right_panel; + PrepareHouse(uHouseID); + v18 = 1; + uTextureID_507B04 = uTextureID_right_panel; + if ( uNumDialogueNPCPortraits == 1 ) + pDialogueNPCCount = 1; + pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); + dword_5C35D4 = 1; + if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) + { + if ( (signed int)uHouseID >= 54 && (signed int)uHouseID <= 73 && !sub_4B68EA(uHouseID - 54) ) + { + return 1; + } + } + else + { //guilds + v19 = guild_mambership_flags[uHouseID-139]; //guilds flags + //v20 = uHouseID; + //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) ) + if(_449B57_test_bit((unsigned char*)pPlayers[uActiveCharacter]->_guilds_member_bits,v19)) + { + HousePlaySomeSound(uHouseID, 3); + return 1; + } + } + HousePlaySomeSound(uHouseID, 1); + dword_5C35D4 = 1; + return 1; + } + } + +//----- (004B1E92) -------------------------------------------------------- +void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2) + { + //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) ) + if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId ) + pAudioPlayer->PlaySound( + //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)), + (SoundID)(a2 + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId) + 300), + 806, 0, -1, 0, 0, 0, 0); + } + + //----- (004B4F4F) -------------------------------------------------------- +char *__cdecl JailDialog() +{ + const char *v0; // esi@1 + const char *v1; // ST10_4@1 + unsigned __int16 v2; // ST0C_2@1 + int v3; // eax@1 + GUIWindow v5; // [sp+8h] [bp-54h]@1 + + memcpy(&v5, window_SpeakInHouse, sizeof(v5)); + v0 = pGlobalTXT_LocalizationStrings[672]; + v1 = pGlobalTXT_LocalizationStrings[672]; + v5.uFrameX = 483; + v5.uFrameWidth = 148; + v5.uFrameZ = 334; + v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); + v3 = pFontArrus->CalcTextHeight(v0, &v5, 0, 0); + return v5.DrawTitleText(pFontArrus, 0, (310 - v3) / 2 + 18, v2, v1, 3u); +} + + + +//----- (004B68EA) -------------------------------------------------------- +bool __fastcall sub_4B68EA(int a1) +{ + signed int v1; // edi@1 + int *v2; // esi@1 + int v3; // ecx@2 + + v1 = 0; + v2 = &dword_4F0E10[a1]; + while ( 1 ) + { + v3 = 8 * *((char *)v2 + v1); + if ( *(&byte_4F09B1[pParty->uDaysPlayed % 7] + v3 * 4) ) + { + if ( !dword_4F09CC[v3] || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, LOWORD(dword_4F09CC[v3])) ) + break; + } + ++v1; + if ( v1 >= 4 ) + return 0; + } + return 1; +} + + + +//----- (004B7911) -------------------------------------------------------- +void __cdecl TownHallDialog() +{ + GUIWindow *v0; // eax@4 + int v1; // eax@10 + int v2; // esi@10 + GUIFont *v3; // ST20_4@20 + int v4; // eax@20 + MonsterInfo *v5; // edi@21 + unsigned int v6; // ST20_4@21 + char *v7; // ST1C_4@21 + unsigned int v8; // eax@21 + int v9; // esi@21 + char *v10; // eax@23 + signed int v11; // ebx@24 + signed int i; // esi@26 + int v13; // eax@27 + GUIWindow *v14; // ecx@28 + __int64 v15; // qax@28 + signed int v16; // ebx@28 + int v17; // ebx@28 + unsigned __int8 v18; // sf@28 + char **v19; // edi@29 + GUIButton *v20; // eax@30 + GUIButton *v21; // esi@30 + int v22; // eax@30 + unsigned int v23; // ecx@30 + unsigned __int16 v24; // ax@30 + GUIWindow a1; // [sp+Ch] [bp-110h]@21 + GUIWindow w; // [sp+60h] [bp-BCh]@21 + GUIWindow _this; // [sp+B4h] [bp-68h]@1 + int v28; // [sp+108h] [bp-14h]@1 + int v29; // [sp+10Ch] [bp-10h]@28 + int v30; // [sp+110h] [bp-Ch]@1 + int v31; // [sp+114h] [bp-8h]@29 + GUIFont *pOutString; // [sp+118h] [bp-4h]@21 + + memcpy(&_this, window_SpeakInHouse, sizeof(_this)); + _this.uFrameX = 483; + _this.uFrameWidth = 148; + _this.uFrameZ = 334; + v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); + sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine); + _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u); + switch(dialog_menu_id) + { + case 1: + { + v11 = 1; + pOutString = 0; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[604]; + if ( pParty->uFine ) + { + pShopOptions[1] = pGlobalTXT_LocalizationStrings[603]; + v11 = 2; + } + for ( i = 0; i < v11; ++i ) + { + v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0); + pOutString = (GUIFont *)((char *)pOutString + v13); + } + v29 = (100 - (signed int)pOutString) / v11; + v14 = pDialogueWindow; + v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString; + v16 = v15 - HIDWORD(v15); + LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem; + HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton; + v17 = (v16 >> 1) - v29 / 2 + 158; + v18 = -pDialogueWindow->pNumPresenceButton < 0; + pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; + if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) ) + { + v31 = 2; + v19 = pShopOptions; + do + { + v20 = v14->GetControl((unsigned int)pOutString); + v21 = v20; + v20->uY = v29 + v17; + v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0); + v23 = v21->uY; + v21->uHeight = v22; + v17 = v23 + v22 - 1; + v21->uW = v17; + v24 = v30; + if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) + v24 = v28; + _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u); + v14 = pDialogueWindow; + ++v31; + ++v19; + pOutString = (GUIFont *)((char *)pOutString + 1); + } + while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + break; + } + case 99: + { + v5 = &pMonsterStats->pInfos[word_F8B1A0]; + v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + v7 = v5->pName; + v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); + sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6); + sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel); + ptr_F8B1E8 = pTmpBuf2; + memcpy(&a1, pDialogueWindow, sizeof(a1)); + w.uFrameWidth = 458; + w.uFrameZ = 457; + pOutString = pFontArrus; + v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7; + if ( 352 - v9 < 8 ) + { + pOutString = pFontCreate; + v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; + } + + auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); + pRenderer->_4A6A68(8u, 352 - v9, pTex, (pTex ? pTex->uTextureHeight : 26) - v9); + pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428); + v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0); + a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0); + break; + } + case 100: + { + v0 = window_SpeakInHouse; + if ( window_SpeakInHouse->field_40 == 1 ) + { + sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); + _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u); + _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); + v3 = pFontArrus; + v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); + _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3); + return; + } + if ( window_SpeakInHouse->field_40 == 2 ) + { + v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + v2 = v1; + if ( v1 <= 0 ) + { + //LABEL_8: + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + return; + } + if ( v1 > pParty->uNumGold ) + { + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); + v2 = pParty->uNumGold; + } + if ( v2 > pParty->uFine ) + v2 = pParty->uFine; + Party::TakeGold(v2); + pParty->uFine -= v2; + if ( pParty->uFine < 0 ) + pParty->uFine = 0; + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); + v0 = window_SpeakInHouse; + } + if ( window_SpeakInHouse->field_40 == 3 ) + { + v0->field_40 = 0; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + } + break; + } + default: + { + break; + } + } + return; +} +// F8B19C: using guessed type int dword_F8B19C; +// F8B1A0: using guessed type __int16 word_F8B1A0; + +//----- (004B7D7E) -------------------------------------------------------- +void __cdecl BankDialog() +{ + GUIWindow *v0; // eax@4 + int v1; // ecx@5 + int v2; // eax@6 + unsigned int v3; // esi@6 + GUIFont *v4; // ST10_4@12 + int v5; // eax@12 + int v6; // eax@19 + unsigned int v7; // esi@19 + unsigned __int16 v8; // ax@27 + unsigned __int16 v9; // ax@29 + char *v10; // [sp-8h] [bp-70h]@11 + char *v11; // [sp-4h] [bp-6Ch]@11 + GUIWindow _this; // [sp+Ch] [bp-5Ch]@1 + __int16 v13[2]; // [sp+60h] [bp-8h]@1 + __int16 v14[2]; // [sp+64h] [bp-4h]@1 + + memcpy(&_this, window_SpeakInHouse, sizeof(_this)); + _this.uFrameX = 483; + _this.uFrameWidth = 148; + _this.uFrameZ = 334; + *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); + sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); + _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u); + switch(dialog_menu_id) + { + case 1: + { + v8 = v14[0]; + if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) + v8 = v13[0]; + _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u); + v9 = v14[0]; + if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) + v9 = v13[0]; + _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u); + break; + } + case 7: + { + v0 = window_SpeakInHouse; + if ( window_SpeakInHouse->field_40 != 1 ) + { + v1 = window_SpeakInHouse->field_40 - 2; + if ( window_SpeakInHouse->field_40 == 2 ) + { + v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + v7 = v6; + if ( !v6 ) + { +//LABEL_17: + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; + *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + }*/ + return; + } + if ( v6 > pParty->uNumGold ) + { + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); + v7 = pParty->uNumGold; + } + if ( v7 ) + { + Party::TakeGold(v7); + pParty->uNumGoldInBank += v7; + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); + } + v0 = window_SpeakInHouse; + v0->field_40 = 0; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + if ( v1 != 1 ) + return; + v0->field_40 = 0; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + v11 = pGlobalTXT_LocalizationStrings[112]; + v10 = pGlobalTXT_LocalizationStrings[60]; + sprintf(pTmpBuf, "%s\n%s", v10, v11); + _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); + _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); + v4 = pFontArrus; + v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); + _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); + break; + } + + case 8: + { + v0 = window_SpeakInHouse; + if ( window_SpeakInHouse->field_40 != 1 ) + { + v1 = window_SpeakInHouse->field_40 - 2; + if ( window_SpeakInHouse->field_40 == 2 ) + { + window_SpeakInHouse->field_40 = 0; + v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); + v3 = v2; + if ( v2 ) + { + if ( v2 > pParty->uNumGoldInBank ) + { + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); + v3 = pParty->uNumGoldInBank; + } + if ( v3 ) + { + Party::SetGold(pParty->uNumGold + v3); + pParty->uNumGoldInBank -= v3; + } + } + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + if ( v1 != 1 ) + return; + v0->field_40 = 0; + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + v11 = pGlobalTXT_LocalizationStrings[112]; + v10 = pGlobalTXT_LocalizationStrings[244]; + sprintf(pTmpBuf, "%s\n%s", v10, v11); + _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); + _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); + v4 = pFontArrus; + v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); + _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); + return; + break; + } + + default: + { + break; + } + } +} +// F8B19C: using guessed type int dword_F8B19C; + +//----- (004B8285) -------------------------------------------------------- +void __cdecl TavernDialog() +{ + GUIWindow *v0; // ebx@1 + Player *v1; // edi@1 + double v2; // st7@1 + signed int v3; // ebx@1 + int v4; // ecx@1 + int v5; // esi@3 + signed int v6; // edi@5 + int v7; // ecx@5 + GUIWindow *v8; // edi@16 + signed int v9; // esi@16 + unsigned int v10; // esi@18 + int v11; // eax@18 + unsigned int v12; // eax@19 + int v13; // eax@21 + int v14; // ecx@26 + GUIButton *v15; // eax@28 + GUIButton *v16; // esi@28 + int v17; // eax@28 + char *v18; // eax@30 + int v19; // eax@30 + unsigned int v20; // ecx@30 + int v21; // edx@30 + int v22; // eax@30 + unsigned __int16 v23; // ax@30 + int v24; // eax@34 + int v25; // eax@34 + char *v26; // esi@36 + int v27; // edi@46 + unsigned int v28; // eax@53 + unsigned int v29; // eax@55 + unsigned int v30; // eax@57 + signed int v31; // eax@59 + unsigned int v32; // eax@61 + GUIWindow *v33; // edi@64 + int v34; // eax@64 + int v35; // ecx@64 + int v36; // esi@64 + char v37; // sf@64 + GUIButton *v38; // eax@65 + int v39; // edx@69 + int v40; // ecx@69 + int v41; // ecx@69 + int v42; // ecx@70 + unsigned int v43; // edx@70 + int v44; // edx@71 + int v45; // ecx@71 + int v46; // ecx@72 + int v47; // eax@74 + signed int v48; // edi@77 + signed int i; // esi@79 + int v50; // eax@80 + GUIWindow *v51; // ecx@81 + _QWORD v52; // qax@81 + signed int v53; // edi@81 + int v54; // edi@81 + GUIButton *v55; // esi@83 + const char **v56; // eax@83 + int v57; // eax@83 + unsigned int v58; // ecx@83 + Player *v59; // edx@83 + unsigned __int16 v60; // ax@83 + int v61; // eax@99 + int v62; // edi@99 + char *v63; // eax@99 + GUIFont *v64; // edx@99 + GUIFont *v65; // edi@100 + unsigned int v66; // [sp-10h] [bp-284h]@75 + unsigned __int16 v67; // [sp-Ch] [bp-280h]@75 + int v68; // [sp-Ch] [bp-280h]@99 + char *v69; // [sp-8h] [bp-27Ch]@75 + int v70; // [sp-8h] [bp-27Ch]@99 + unsigned int v71; // [sp-4h] [bp-278h]@75 + const char *v72; // [sp-4h] [bp-278h]@93 + unsigned int v73; // [sp-4h] [bp-278h]@99 + char Dest[100]; // [sp+Ch] [bp-268h]@55 + char v75[100]; // [sp+70h] [bp-204h]@59 + char a1[100]; // [sp+D4h] [bp-1A0h]@57 + char v77[100]; // [sp+138h] [bp-13Ch]@59 + GUIWindow v78; // [sp+19Ch] [bp-D8h]@99 + GUIWindow v79; // [sp+1F0h] [bp-84h]@1 + char *Str[2]; // [sp+244h] [bp-30h]@30 + unsigned int v81; // [sp+24Ch] [bp-28h]@1 + unsigned __int8 v82; // [sp+253h] [bp-21h]@59 + int v83; // [sp+254h] [bp-20h]@1 + __int16 v84[2]; // [sp+258h] [bp-1Ch]@1 + Player *v85; // [sp+25Ch] [bp-18h]@1 + int v86; // [sp+260h] [bp-14h]@18 + unsigned __int8 v87; // [sp+266h] [bp-Eh]@59 + unsigned __int8 v88; // [sp+267h] [bp-Dh]@57 + int v89; // [sp+268h] [bp-Ch]@1 + unsigned __int8 v90; // [sp+26Fh] [bp-5h]@55 + GUIFont *pOutString; // [sp+270h] [bp-4h]@3 + + v0 = window_SpeakInHouse; + memcpy(&v79, window_SpeakInHouse, sizeof(v79)); + v85 = pPlayers[uActiveCharacter]; + v1 = v85; + v79.uFrameX = 483; + v79.uFrameWidth = 148; + v79.uFrameZ = 334; + v81 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + *(int *)v84 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); + //v2 = p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]; + v2 = p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier; + *(float *)&v83 = v2; + *(float *)&v89 = v2 * v2; + v3 = (signed __int64)(*(float *)&v89 * 0.1); + v4 = v3 * (100 - v1->GetMerchant()) / 100; + if ( v4 < v3 / 3 ) + v4 = v3 / 3; + v5 = 1; + pOutString = (GUIFont *)v4; + if ( v4 <= 0 ) + pOutString = (GUIFont *)1; + v6 = (signed __int64)(*(float *)&v89 * *(float *)&v83 * 0.0099999998); + v7 = v6 * (100 - v85->GetMerchant()) / 100; + if ( v7 < v6 / 3 ) + v7 = v6 / 3; + v83 = v7; + if ( v7 <= 0 ) + { + v7 = 1; + v83 = 1; + } + switch(dialog_menu_id) + { + case 102: + { + v65 = pFontArrus; + pOutString = pFontArrus; + strcpy(pTmpBuf, pNPCTopics[354].pText); + v78.uFrameWidth = 460; + v78.uFrameZ = 452; + v62 = v65->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; + if ( 352 - v62 < 8 ) + { + pOutString = pFontCreate; + v62 = pFontCreate->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; + } + + auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); + pRenderer->_4A6A68(8u, 352 - v62, pTex, (pTex ? pTex->uTextureHeight : 26) - v62); + + pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); + v73 = 0; + v70 = 0; + v68 = 0; + v63 = FitTextInAWindow(pTmpBuf, pOutString, &v78, 0xCu, 0); + v64 = pOutString; + window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73); + break; + } + case 103: + { + strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); + v78.uFrameWidth = 460; + v78.uFrameZ = 452; + v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0); + v62 = v61 + 7; + + auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr); + pRenderer->_4A6A68(8u, 352 - (v61 + 7), pTex, (pTex ? pTex->uTextureHeight : 26) - (v61 + 7)); + + pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); + v73 = 0; + v70 = 0; + v68 = 0; + v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &v78, 0xCu, 0); + v64 = pFontArrus; + window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73); + break; + } + case 104: + { + if ( pArcomageGame->bGameInProgress == 1 ) + return; + v26 = pTmpBuf; + if ( pArcomageGame->uGameResult ) + { + if ( pArcomageGame->uGameResult == 1 ) + v72 = pGlobalTXT_LocalizationStrings[640];// You won! + else + v72 = pGlobalTXT_LocalizationStrings[641];// You lost! + } + else + { + v72 = pGlobalTXT_LocalizationStrings[639];// A tie! + } + strcpy(pTmpBuf, v72); +//LABEL_97: + v71 = 3; + v69 = v26; + v67 = v84[0]; + v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; + v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); + break; + } + case 15: + { + if ( pParty->uNumGold >= (unsigned int)pOutString ) + { + Party::TakeGold((unsigned int)pOutString); + v27 = (int)window_SpeakInHouse->ptr_1C; + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); + dialog_menu_id = 0; + while ( sub_4BD8B5() ) + ; + sub_4B1D27(); + pVideoPlayer->Unload(); + window_SpeakInHouse->Release(); + window_SpeakInHouse = 0; + + if ( pMessageQueue_50CBD0->uNumMessages ) + pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; + pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_OpenRestUI; + pMessageQueue_50CBD0->pMessages[0].param = v27; + pMessageQueue_50CBD0->pMessages[0].field_8 = 1; +//LABEL_51: + ++pMessageQueue_50CBD0->uNumMessages; + return; + } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + break; + } + case 96: + { + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v8 = pDialogueWindow; + *(float *)&v89 = 0.0; + + //v9 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); + v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + + pOutString = (GUIFont *)(v9 * (100 - v85->GetMerchant()) / 100); + if ( (signed int)pOutString < v9 / 3 ) + pOutString = (GUIFont *)(v9 / 3); + v10 = v8->pStartingPosActiveItem; + v11 = v10 + v8->pNumPresenceButton; + v86 = 0; + if ( (signed int)v10 < v11 ) + { + do + { + v12 = v8->GetControl(v10)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v12] && !v85->pActiveSkills[v12] ) + { + v13 = pFontArrus->CalcTextHeight(pSkillNames[v12], &v79, 0, 0); + v89 += v13; + ++v86; + } + ++v10; + } + while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton ); + if ( v86 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString); + v79.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + pOutString = (GUIFont *)((149 - v89) / v86); + if ( (149 - v89) / v86 > 32 ) + pOutString = (GUIFont *)32; + v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162; + v89 = v8->pStartingPosActiveItem; + v83 = v14; + if ( v89 < v89 + v8->pNumPresenceButton ) + { + v86 = 2; + do + { + v15 = v8->GetControl(v89); + v16 = v15; + v17 = v15->uControlParam - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v17] || v85->pActiveSkills[v17] ) + { + v16->uW = 0; + v16->uHeight = 0; + v16->uY = 0; + } + else + { + v18 = pSkillNames[v17]; + v16->uY = (unsigned int)((char *)pOutString + v83); + Str[1] = v18; + v19 = pFontArrus->CalcTextHeight(v18, &v79, 0, 0); + v20 = v16->uY; + v21 = v86; + v16->uHeight = v19; + v22 = v19 + v20 - 1; + v16->uW = v22; + v83 = v22; + v23 = v84[0]; + if ( pDialogueWindow->pCurrentPosActiveItem != v21 ) + v23 = v81; + v79.DrawTitleText(pFontArrus, 0, v20, v23, Str[1], 3u); + } + v24 = v8->pNumPresenceButton; + ++v89; + v25 = v8->pStartingPosActiveItem + v24; + ++v86; + } + while ( v89 < v25 ); + } + return; + } + } + v26 = pTmpBuf; + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + v71 = 3; + v69 = v26; + v67 = v84[0]; + v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; + v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); + return; + break; + } + case 16: + { + *(_QWORD *)Str = pParty->uNumFoodRations; + //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] ) + if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); + if ( uActiveCharacter ) + pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + return; + } + if ( pParty->uNumGold >= v7 ) + { + Party::TakeGold(v7); + //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; + pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3); + v5 = 1; +//LABEL_43: + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + return; + //goto LABEL_51; + } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); + break; + } + case 1: + { + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v28 = *(int *)v84; + if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) + v28 = v81; + sprintf(Dest, format_4E2DC8, v28); + sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); + strcat(Dest, pTmpBuf2); + v90 = pFontArrus->CalcTextHeight(Dest, &v79, 0, 0); + strcat(Dest, "\n \n"); + v29 = *(int *)v84; + if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) + v29 = v81; + sprintf(a1, format_4E2DC8, v29); + sprintf(pTmpBuf2, + pGlobalTXT_LocalizationStrings[86], + //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C], + (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, + v83); + strcat(a1, pTmpBuf2); + v88 = pFontArrus->CalcTextHeight(a1, &v79, 0, 0); + strcat(a1, "\n \n"); + v30 = *(int *)v84; + if ( pDialogueWindow->pCurrentPosActiveItem != 4 ) + v30 = v81; + sprintf(v77, format_4E2DC8, v30); + strcat(v77, pGlobalTXT_LocalizationStrings[160]); + v82 = pFontArrus->CalcTextHeight(v77, &v79, 0, 0); + strcat(v77, "\n \n"); + v75[0] = 0; + v87 = 0; + v31 = (signed int)window_SpeakInHouse->ptr_1C; + if ( v31 >= 108 && v31 <= 120 ) + { + v32 = *(int *)v84; + if ( pDialogueWindow->pCurrentPosActiveItem != 5 ) + v32 = v81; + sprintf(v75, format_4E2DC8, v32); + strcat(v75, pGlobalTXT_LocalizationStrings[611]); + v87 = pFontArrus->CalcTextHeight(v75, &v79, 0, 0); + } + v33 = pDialogueWindow; + Str[1] = (char *)pDialogueWindow; + v34 = pDialogueWindow->pStartingPosActiveItem; + v35 = v34 + pDialogueWindow->pNumPresenceButton; + v36 = LOBYTE(pFontArrus->uFontHeight) - 3; + v37 = -pDialogueWindow->pNumPresenceButton < 0; + pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; + if ( !(v37 ^ __OFSUB__(v34, v35)) ) + { + //LABEL_75: + sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); + v71 = 3; + v69 = pTmpBuf; + v67 = 0; + v66 = 146; + //LABEL_98: + v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); + return; + } + while ( 1 ) + { + v38 = v33->GetControl((unsigned int)pOutString); + if ( v38->uControlParam == 15 ) + { + v46 = v90; + v38->uHeight = v90; + v38->uY = 146; + v41 = v46 + 145; + v38->uW = v41; + } + else if ( v38->uControlParam == 16 ) + { + v44 = v88; + v45 = v90 + v36 + 146; + v38->uHeight = v88; + v38->uY = v45; + v41 = v45 + v44 - 1; + v38->uW = v41; + } + else if ( v38->uControlParam == 96 ) + { + v42 = v90 + v88 + 2 * v36 + 146; + v43 = v82; + v38->uY = v42; + v38->uHeight = v43; + v41 = v43 + v42 - 1; + v38->uW = v41; + } + else if ( v38->uControlParam == 101 ) + { + v39 = v90 + 3 * v36 + v87 + v88 + 146; + v33 = (GUIWindow *)Str[1]; + v40 = v87; + v38->uHeight = v87; + v38->uY = v39; + v41 = v39 + v40 - 1; + //LABEL_73: + v38->uW = v41; + } + v47 = v33->pStartingPosActiveItem; + pOutString = (GUIFont *)((char *)pOutString + 1); + if ( (signed int)pOutString >= v33->pNumPresenceButton + v47 ) + { + sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); + v71 = 3; + v69 = pTmpBuf; + v67 = 0; + v66 = 146; + v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); + return; + } + } + break; + } + case 101: + { + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v48 = 2; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; + pOutString = 0; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; + if ( pParty->HasItem(0x28Bu) ) + { + pShopOptions[2] = pGlobalTXT_LocalizationStrings[621]; + v48 = 3; + } + for ( i = 0; i < v48; ++i ) + { + v50 = pFontArrus->CalcTextHeight(pShopOptions[i], &v79, 0, 0); + pOutString = (GUIFont *)((char *)pOutString + v50); + } + v86 = (174 - (signed int)pOutString) / v48; + v51 = pDialogueWindow; + v52 = 174 - v48 * (174 - (signed int)pOutString) / v48 - (signed int)pOutString; + v53 = v52 - HIDWORD(v52); + LODWORD(v52) = pDialogueWindow->pStartingPosActiveItem; + HIDWORD(v52) = v52 + pDialogueWindow->pNumPresenceButton; + v54 = (v53 >> 1) - v86 / 2 + 138; + v37 = -pDialogueWindow->pNumPresenceButton < 0; + v89 = pDialogueWindow->pStartingPosActiveItem; + if ( v37 ^ __OFSUB__((int)v52, HIDWORD(v52)) ) + { + v85 = (Player *)2; + pOutString = (GUIFont *)pShopOptions; + do + { + v55 = v51->GetControl(v89); + v56 = (const char **)pOutString; + v55->uY = v86 + v54; + v57 = pFontArrus->CalcTextHeight(*v56, &v79, 0, 0); + v58 = v55->uY; + v59 = v85; + v55->uHeight = v57; + v54 = v57 + v58 - 1; + v55->uW = v54; + v60 = v84[0]; + if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v59 ) + v60 = v81; + v79.DrawTitleText(pFontArrus, 0, v58, v60, *(const char **)&pOutString->cFirstChar, 3u); + v51 = pDialogueWindow; + v85 = (Player *)((char *)v85 + 1); + pOutString = (GUIFont *)((char *)pOutString + 4); + ++v89; + } + while ( v89 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + } + break; + } + default: + { + break; + } + } +} + + +//----- (004B910F) -------------------------------------------------------- +void __cdecl WeaponShopDialog() +{ + //Player *v0; // ebx@1 + int pNumActiveItem; // eax@6 + signed int v2; // esi@8 + unsigned int v3; // ebx@10 + ItemGen *v4; // eax@11 + char *v5; // ecx@12 + unsigned __int8 v6; // dl@13 + char *v7; // edx@14 + //int v8; // eax@15 + int v9; // ST08_4@16 + int v10; // eax@16 + signed int v11; // esi@18 + int v12; // ST08_4@21 + int v13; // eax@21 + int v14; // edi@23 + char **v15; // esi@23 + int v16; // eax@24 + GUIWindow *v17; // ecx@25 + int v18; // edx@25 + int v19; // edi@25 + unsigned __int8 v20; // sf@25 + GUIButton *pButton; // esi@27 + int pNewItem; // eax@27 + //int v23; // eax@27 + unsigned int v24; // ecx@27 + int v25; // edx@27 + unsigned __int16 v26; // ax@27 + signed int v27; // esi@32 + int v28; // ST08_4@36 + int v29; // eax@36 + GUIWindow *v30; // edi@41 + void *v31; // eax@41 + signed int v32; // esi@41 + unsigned int v33; // esi@43 + int v34; // eax@43 + unsigned int v35; // eax@44 + int v36; // eax@46 + __int32 v37; // ecx@51 + GUIButton *v38; // eax@53 + GUIButton *v39; // esi@53 + int v40; // eax@53 + char *v41; // eax@55 + //int v42; // eax@55 + unsigned int v43; // ecx@55 + const char **v44; // edx@55 + int v45; // eax@55 + unsigned __int16 v46; // ax@55 + int v47; // eax@59 + const char **v48; // eax@63 + unsigned int v49; // esi@65 + Texture *v50; // eax@65 + int v51; // edi@65 + int v52; // esi@70 + Texture *v53; // ST1C_4@70 + int v54; // edi@70 + signed int v55; // ecx@73 + SHORT v56; // di@82 + bool v57; // eax@82 + const char *v58; // ecx@84 + POINT *v59; // esi@89 + LONG v60; // ecx@90 + int v61; // eax@90 + int v62; // ecx@90 + ItemGen *v63; // esi@90 + int v64; // eax@95 + int all_text_height; // esi@96 + char **v66; // edi@96 + int v67; // eax@97 + GUIWindow *v68; // ecx@98 + int v69; // edx@98 + int v70; // edi@98 + //GUIButton *pButton; // esi@100 + const char **v72; // eax@100 + int pTextHeight; // eax@100 + unsigned int v74; // ecx@100 + Player *v75; // edx@100 + unsigned __int16 v76; // ax@100 + GUIWindow *v77; // [sp-18h] [bp-110h]@14 + int v78; // [sp-14h] [bp-10Ch]@14 + ItemGen *v79; // [sp-10h] [bp-108h]@12 + int v80; // [sp-10h] [bp-108h]@14 + void *v81; // [sp-Ch] [bp-104h]@12 + unsigned __int16 v82; // [sp-Ch] [bp-104h]@14 + int v83; // [sp-8h] [bp-100h]@11 + char *v84; // [sp-8h] [bp-100h]@14 + __int64 *v85; // [sp-4h] [bp-FCh]@11 + unsigned int v86; // [sp-4h] [bp-FCh]@14 + POINT v87; // [sp+Ch] [bp-ECh]@8 + POINT v88; // [sp+14h] [bp-E4h]@18 + POINT v89; // [sp+1Ch] [bp-DCh]@89 + POINT v90; // [sp+24h] [bp-D4h]@19 + POINT v91; // [sp+2Ch] [bp-CCh]@89 + POINT v92; // [sp+34h] [bp-C4h]@9 + POINT v93; // [sp+3Ch] [bp-BCh]@33 + POINT v94; // [sp+44h] [bp-B4h]@18 + POINT v95; // [sp+4Ch] [bp-ACh]@32 + POINT v96; // [sp+54h] [bp-A4h]@18 + POINT v97; // [sp+5Ch] [bp-9Ch]@32 + POINT a2; // [sp+64h] [bp-94h]@8 + POINT v99; // [sp+6Ch] [bp-8Ch]@32 + POINT v100; // [sp+74h] [bp-84h]@8 + GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 + char *Str; // [sp+D0h] [bp-28h]@55 + __int32 v103; // [sp+D4h] [bp-24h]@25 + int pColor2; // [sp+D8h] [bp-20h]@1 + int pColorWhite; // [sp+DCh] [bp-1Ch]@1 + POINT v106; // [sp+E0h] [bp-18h]@8 + Player *pPlayer; // [sp+E8h] [bp-10h]@1 + int pItemNum; // [sp+ECh] [bp-Ch]@26 + const char **v109; // [sp+F0h] [bp-8h]@26 + unsigned __int8 v110; // [sp+F7h] [bp-1h]@16 + int pNumString; + + //v0 = pPlayers[uActiveCharacter]; + pPlayer = pPlayers[uActiveCharacter]; + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + pColorWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + pColor2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + switch(dialog_menu_id) + { + case DIALOG_SHOP_MAIN: + { + pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( pNumActiveItem ) + { + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + all_text_height = 0; + for (int i = 0; i < 4; ++i)//while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v103 = (174 - all_text_height) / 4; + pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + v18 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; + v19 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; + v20 = -pDialogueWindow->pNumPresenceButton < 0; + if ( v20 ^ pNumActiveItem > v18 ) + { + pItemNum = 2; + pNumString = 0; + do + { + pButton = pDialogueWindow->GetControl(pItemNum); + pButton->uY = v103 + v19; + pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + v19 = pButton->uY + pTextHeight - 1; + pButton->uW = v19; + v26 = pColor2; + if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) + v26 = pColorWhite; + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, v26, (const char *)pShopOptions[pNumString], 3); + ++pItemNum; + ++pNumString; + pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; + } + while ( pItemNum < pNumActiveItem ); + } + } + break; + } + case DIALOG_SHOP_BUY_STANDART: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + v3 = 0; + v48 = 0; + pItemNum = 0; + v109 = 0; + do + { + // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID); + { + v49 = word_F8B158[(signed int)v48]; + v50 = ItemsInShopTexture[(signed int)v48]; + v49 += 30; + v51 = 60 - ((signed int)v50->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v51 + pItemNum, v49, v50); + sub_40F92A(&pRenderer->pActiveZBuffer[v51 + pItemNum + 640 * v49], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); + v48 = v109; + } + pItemNum += 70; + v48 = (const char **)((char *)v48 + 1); + v109 = v48; + } + while ( (signed int)v48 < 6 ); + pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( pNumActiveItem ) + { + v55 = 0; + v106.x = 0; + v106.x = 0; + do + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + ++v106.x; + ++v55; + } + while ( v55 < 6 ); + v56 = GetAsyncKeyState(17); + v57 = pPlayer->CanSteal(); + Str = (char *)v57; + if ( v56 && v57 ) + { + v58 = pGlobalTXT_LocalizationStrings[185]; + } + else + { + v58 = pGlobalTXT_LocalizationStrings[195]; + if ( dialog_menu_id != 2 ) + v58 = pGlobalTXT_LocalizationStrings[196]; + } + DrawTextAtStatusBar(v58, 0); + if ( v106.x ) + { + v59 = pMouse->GetCursorPos(&v91); + pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]; + if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) + { + v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; + v106.x = v60; + v61 = (int)window_SpeakInHouse->ptr_1C; + // v62 = 9 * (v60 + 12 * v61); + v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; + if ( dialog_menu_id != 2 ) + v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; + if ( !v56 || !Str ) + { + v64 = pPlayer->_490EEE(v63, 1, v61, 2); + v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); + dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + } + else + { + v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); + dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + } + } + } + else + { + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + pNumActiveItem = 0; //added + } + } + break; + } + case DIALOG_SHOP_SELL: + { + 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() ) + return; + if((v11 = pMouse->GetCursorPos(&v96)->x - 14, v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5), + pMouse->GetCursorPos(&v94)->x <= 13) || pMouse->GetCursorPos(&v90)->x >= 462 + || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), v3 = 0, !pNumActiveItem) ) + return; + v79 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v13 = pPlayer->_490EEE(v79, 1, (int)window_SpeakInHouse->ptr_1C, 3); + v7 = BuilDialogueString((char *)pMerchantsSellPhrases[v13], uActiveCharacter - 1, v79, (char *)window_SpeakInHouse->ptr_1C, 3, 0); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); + dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + break; + } + case DIALOG_SHOP_IDENTIFY: + { + 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() ) + return; + if((v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5), + pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 + || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), v3 = 0, !pNumActiveItem) ) + return; + v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + if (!v4->Identified()) + { + v10 = pPlayer->_490EEE(v4, 1, (int)window_SpeakInHouse->ptr_1C, 4); + v7 = BuilDialogueString((char *)pMerchantsIdentifyPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); + dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + } + v7 = BuilDialogueString("%24", uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); + dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + break; + } + case DIALOG_SHOP_REPAIR: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) + return; + if( (v2 = pMouse->GetCursorPos(&a2)->x - 14, v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5), + pMouse->GetCursorPos(&v100)->x <= 13) || pMouse->GetCursorPos(&v92)->x >= 462 + || (pNumActiveItem = pPlayer->GetItemIDAtInventoryIndex((int *)&v106.x), v3 = 0, !pNumActiveItem) + || (pNumActiveItem = 9 * pNumActiveItem, !(pPlayer->field_1F5[4 * pNumActiveItem + 15] & 2)) ) + return; + v4 = (ItemGen *)&pPlayer->pInventoryItems[pNumActiveItem - 1]; + v10 = pPlayer->_490EEE(v4, 2, (int)window_SpeakInHouse->ptr_1C, 5); + v7 = BuilDialogueString((char *)pMerchantsRepairPhrases[v10], uActiveCharacter - 1, v4, (char *)window_SpeakInHouse->ptr_1C, 5, 0); + pTextHeight = (174 - pFontArrus->CalcTextHeight(v7, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, pTextHeight, pColorWhite, v7, 3); + return; + } + break; + case DIALOG_SHOP_DISPLAY_EQUIPMENT: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];//sell + pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];//identify + pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];//repair + all_text_height = 0; + for ( int i = 0; i < 3; ++i ) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v103 = (174 - all_text_height) / 3; + pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + v18 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; + v70 = (3 * (58 - (signed int)v103) - all_text_height) / 2 - ((174 - all_text_height) / 3) / 2 + 138; + v20 = -pDialogueWindow->pNumPresenceButton < 0; + if ( v20 ^ pNumActiveItem > v18 ) + { + pItemNum = 2; + pNumString = 0; + do + { + pButton = pDialogueWindow->GetControl(pItemNum); + pButton->uY = v103 + v70; + pTextHeight = pFontArrus->CalcTextHeight((const char *)pShopOptions[pNumString], &dialog_window, 0, 0); + pButton->uHeight = pTextHeight; + v70 = pButton->uY + pTextHeight - 1; + pButton->uW = v70; + v76 = pColor2; + if ( pDialogueWindow->pCurrentPosActiveItem != pItemNum ) + v76 = pColorWhite; + dialog_window.DrawTitleText(pFontArrus, 0, pButton->uY, v76, (const char *)pShopOptions[pNumString], 3); + ++pItemNum; + ++pNumString; + pNumActiveItem = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; + } + while ( pItemNum < pNumActiveItem ); + } + break; + } + case DIALOG_SHOP_BUY_SPECIAL: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + v3 = 0; + v109 = 0; + pItemNum = 0; + do + { + // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) + { + v52 = word_F8B158[(signed int)v109] + 30; + v53 = ItemsInShopTexture[(signed int)v109]; + v54 = 60 - ((signed int)v53->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v54 + pItemNum, word_F8B158[(signed int)v109] + 30, v53); + sub_40F92A(&pRenderer->pActiveZBuffer[v54 + pItemNum + 640 * v52], ItemsInShopTexture[(signed int)v109], (int)((char *)v109 + 1)); + } + v109 = (const char **)((char *)v109 + 1); + pItemNum += 70; + } + while ( (signed int)v109 < 6 ); + pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( pNumActiveItem ) + { + v55 = 0; + v106.x = 0; + do + { + // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) + ++v106.x; + ++v55; + } + while ( v55 < 6 ); + v56 = GetAsyncKeyState(17); + v57 = pPlayer->CanSteal(); + Str = (char *)v57; + if ( v56 && v57 ) + { + v58 = pGlobalTXT_LocalizationStrings[185]; + } + else + { + v58 = pGlobalTXT_LocalizationStrings[195]; + if ( dialog_menu_id != 2 ) + v58 = pGlobalTXT_LocalizationStrings[196]; + } + DrawTextAtStatusBar(v58, 0); + if ( v106.x ) + { + v59 = pMouse->GetCursorPos(&v91); + pNumActiveItem = v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]; + if ( pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF ) + { + v60 = (pRenderer->pActiveZBuffer[pNumActiveItem] & 0xFFFF) - 1; + v106.x = v60; + v61 = (int)window_SpeakInHouse->ptr_1C; + // v62 = 9 * (v60 + 12 * v61); + v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; + if ( dialog_menu_id != 2 ) + v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; + if ( !v56 || !Str ) + { + v64 = pPlayer->_490EEE(v63, 1, v61, 2); + v7 = BuilDialogueString((char *)pMerchantsBuyPhrases[v64], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); + dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + } + else + { + v7 = BuilDialogueString(pGlobalTXT_LocalizationStrings[181], uActiveCharacter - 1, v63, (char *)window_SpeakInHouse->ptr_1C, 2, 0); + pTextHeight = pFontArrus->CalcTextHeight(v7, &dialog_window, v3, v3); + dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColorWhite, v7, 3); + } + } + } + else + { + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + pNumActiveItem = 0; //added + } + } + break; + } + case DIALOG_SHOP_SKILLS: + { + pNumActiveItem = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( pNumActiveItem ) + { + v3 = 0; + v31 = window_SpeakInHouse->ptr_1C; + v106.y = 0; + //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0); + v32 = (signed __int64)(p2DEvents[(signed int)v31 - 1].flt_24 * 500.0); + pItemNum = v32 * (100 - pPlayer->GetMerchant()) / 100; + if ( pItemNum < v32 / 3 ) + pItemNum = v32 / 3; + pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + v34 = pNumActiveItem + pDialogueWindow->pNumPresenceButton; + v109 = 0; + if ( pNumActiveItem >= v34 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColor2, pTmpBuf, 3); + } + do + { + v35 = pDialogueWindow->GetControl(pNumActiveItem)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v35] && !pPlayer->pActiveSkills[v35] ) + { + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v35], &dialog_window, 0, 0); + v106.y += pTextHeight; + v109 = (const char **)((char *)v109 + 1); + } + ++pNumActiveItem; + } + while ( pNumActiveItem < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + if ( !v109 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayer->pName, pClassNames[pPlayer->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + pTextHeight = pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, v3, (174 - pTextHeight) / 2 + 138, pColor2, pTmpBuf, 3); + } + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pItemNum); + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3); + pItemNum = (149 - v106.y) / (signed int)v109; + if ( (149 - v106.y) / (signed int)v109 > 32 ) + pItemNum = 32; + pNumActiveItem = pDialogueWindow->pStartingPosActiveItem; + v37 = (149 - (signed int)v109 * pItemNum - v106.y) / 2 - pItemNum / 2 + 162; + v106.y = (LONG)pNumActiveItem; + v103 = v37; + if ( pNumActiveItem < pNumActiveItem + pDialogueWindow->pNumPresenceButton ) + { + v109 = (const char **)2; + do + { + pButton = pDialogueWindow->GetControl(v106.y); + v40 = pButton->uControlParam - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[pPlayer->classType][v40] || pPlayer->pActiveSkills[v40] ) + { + pButton->uW = 0; + pButton->uHeight = 0; + pButton->uY = 0; + } + else + { + pButton->uY = pItemNum + v103; + pTextHeight = pFontArrus->CalcTextHeight(pSkillNames[v40], &dialog_window, 0, 0); + v43 = pButton->uY; + v44 = v109; + pButton->uHeight = pTextHeight; + v45 = v43 + pTextHeight - 1; + pButton->uW = v45; + v103 = v45; + v46 = pColor2; + if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v44 ) + v46 = pColorWhite; + dialog_window.DrawTitleText(pFontArrus, 0, v43, v46, pSkillNames[v40], 3); + } + v47 = pDialogueWindow->pStartingPosActiveItem; + ++v106.y; + pNumActiveItem = pDialogueWindow->pNumPresenceButton + v47; + v109 = (const char **)((char *)v109 + 1); + } + while ( v106.y < pNumActiveItem ); + } + } + break; + } + default: + { + if( dialog_menu_id > 5 ) + pNumActiveItem = dialog_menu_id - 96; + else + pNumActiveItem = dialog_menu_id - 4; + break; + } + } +} + + + +//----- (004B9CC6) -------------------------------------------------------- +void __cdecl AlchemistDialog() +{ + Player *v0; // ebx@1 + POINT *result; // eax@7 + GUIWindow *v2; // edi@9 + unsigned int v3; // ebx@9 + void *v4; // eax@9 + signed int v5; // esi@9 + unsigned int v6; // esi@11 + int v7; // eax@11 + unsigned int v8; // eax@12 + int v9; // eax@14 + int v10; // ecx@19 + GUIButton *v11; // eax@21 + GUIButton *v12; // esi@21 + int v13; // eax@21 + char *v14; // eax@23 + int v15; // eax@23 + unsigned int v16; // ecx@23 + int v17; // edx@23 + int v18; // eax@23 + unsigned __int16 v19; // ax@23 + int v20; // eax@27 + char *v21; // edx@29 + int v22; // esi@30 + char **v23; // edi@30 + int v24; // eax@31 + GUIWindow *v25; // ecx@32 + int v26; // edx@32 + int v27; // edi@32 + unsigned __int8 v28; // sf@32 + GUIButton *v29; // esi@34 + const char **v30; // eax@34 + int v31; // eax@34 + unsigned int v32; // ecx@34 + Player *v33; // edx@34 + int v34; // eax@34 + unsigned __int16 v35; // ax@34 + signed int v36; // esi@39 + ItemGen *v37; // eax@42 + char *v38; // ecx@43 + unsigned __int8 v39; // dl@44 + int v40; // eax@46 + int v41; // ST08_4@47 + int v42; // eax@47 + signed int v43; // esi@49 + int v44; // ST08_4@52 + int v45; // eax@52 + Texture *v46; // ecx@55 + unsigned int v47; // edi@55 + unsigned int v48; // esi@57 + int v49; // edx@61 + Texture *v50; // ecx@67 + unsigned int v51; // edi@67 + unsigned int v52; // esi@69 + int v53; // edx@73 + Texture *v54; // ecx@79 + unsigned int v55; // edi@79 + unsigned int v56; // esi@81 + int v57; // edx@85 + Texture *v58; // ecx@91 + unsigned int v59; // edi@91 + unsigned int v60; // esi@93 + int v61; // edx@97 + signed int v62; // ecx@102 + SHORT v63; // di@110 + bool v64; // eax@110 + const char *v65; // ecx@112 + POINT *v66; // esi@117 + int v67; // ecx@118 + int v68; // eax@118 + int v69; // ecx@118 + ItemGen *v70; // esi@118 + int v71; // eax@123 + int v72; // edi@125 + char **v73; // esi@125 + int v74; // eax@126 + GUIWindow *v75; // ecx@127 + int v76; // edx@127 + int v77; // edi@127 + GUIButton *v78; // esi@129 + const char **v79; // eax@129 + int v80; // eax@129 + unsigned int v81; // ecx@129 + Player *v82; // edx@129 + unsigned __int16 v83; // ax@129 + GUIWindow *v84; // [sp-18h] [bp-F0h]@29 + int v85; // [sp-14h] [bp-ECh]@29 + int v86; // [sp-10h] [bp-E8h]@29 + ItemGen *v87; // [sp-10h] [bp-E8h]@43 + unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29 + void *v89; // [sp-Ch] [bp-E4h]@43 + char *v90; // [sp-8h] [bp-E0h]@29 + int v91; // [sp-8h] [bp-E0h]@42 + unsigned int v92; // [sp-4h] [bp-DCh]@29 + __int64 *v93; // [sp-4h] [bp-DCh]@42 + POINT v94; // [sp+Ch] [bp-CCh]@39 + POINT v95; // [sp+14h] [bp-C4h]@49 + POINT v96; // [sp+1Ch] [bp-BCh]@117 + POINT v97; // [sp+24h] [bp-B4h]@40 + POINT v98; // [sp+2Ch] [bp-ACh]@117 + POINT v99; // [sp+34h] [bp-A4h]@49 + POINT v100; // [sp+3Ch] [bp-9Ch]@50 + POINT v101; // [sp+44h] [bp-94h]@39 + POINT v102; // [sp+4Ch] [bp-8Ch]@49 + POINT a2; // [sp+54h] [bp-84h]@39 + GUIWindow v104; // [sp+5Ch] [bp-7Ch]@1 + int v105; // [sp+B0h] [bp-28h]@19 + int v106; // [sp+B4h] [bp-24h]@1 + char *Str; // [sp+B8h] [bp-20h]@23 + int v108; // [sp+BCh] [bp-1Ch]@1 + __int32 v109; // [sp+C0h] [bp-18h]@39 + Player *_this; // [sp+C4h] [bp-14h]@1 + const char **v111; // [sp+C8h] [bp-10h]@9 + unsigned int v112; // [sp+CCh] [bp-Ch]@9 + unsigned __int8 v113; // [sp+D3h] [bp-5h]@47 + int v114; // [sp+D4h] [bp-4h]@11 + + v0 = pPlayers[uActiveCharacter]; + _this = pPlayers[uActiveCharacter]; + memcpy(&v104, window_SpeakInHouse, sizeof(v104)); + v104.uFrameX = 483; + v104.uFrameWidth = 148; + v104.uFrameZ = 334; + v108 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + v106 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + switch(dialog_menu_id) + { + case 1: + { + result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; + v72 = 0; + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + v73 = pShopOptions; + do + { + v74 = pFontArrus->CalcTextHeight(*v73, &v104, 0, 0); + ++v73; + v72 += v74; + } + while ( (signed int)v73 < (signed int)&unk_F8B1C8 ); + v75 = pDialogueWindow; + Str = (char *)((174 - v72) / 4); + result = (POINT *)pDialogueWindow->pStartingPosActiveItem; + v76 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); + v77 = (174 - 4 * (174 - v72) / 4 - v72) / 2 - (174 - v72) / 4 / 2 + 138; + v28 = -pDialogueWindow->pNumPresenceButton < 0; + v112 = pDialogueWindow->pStartingPosActiveItem; + if ( v28 ^ __OFSUB__((int)result, v76) ) + { + _this = (Player *)2; + v111 = (const char **)pShopOptions; + do + { + v78 = v75->GetControl(v112); + v79 = v111; + v78->uY = (unsigned int)&Str[v77]; + v80 = pFontArrus->CalcTextHeight(*v79, &v104, 0, 0); + v81 = v78->uY; + v82 = _this; + v78->uHeight = v80; + v77 = v81 + v80 - 1; + v78->uW = v77; + v83 = v106; + if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v82 ) + v83 = v108; + v104.DrawTitleText(pFontArrus, 0, v81, v83, *v111, 3u); + v75 = pDialogueWindow; + _this = (Player *)((char *)_this + 1); + ++v111; + ++v112; + result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); + } + while ( (signed int)v112 < (signed int)result ); + } + } + return; + } + case 3: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + 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, + v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5), + result = pMouse->GetCursorPos(&v102), + result->x <= 13) + || (result = pMouse->GetCursorPos(&v100), result->x >= 462) + || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) + return; + v93 = 0; + v91 = 3; + v89 = window_SpeakInHouse->ptr_1C; + v87 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; + v44 = (int)window_SpeakInHouse->ptr_1C; + v113 = uActiveCharacter - 1; + v45 = _this->_490EEE(v87, 4, v44, 3); + v39 = v113; + v38 = (char *)pMerchantsSellPhrases[v45]; + v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); + v92 = 3; + v90 = v21; + v88 = v108; + v86 = v3; + v85 = v3; + v84 = &v104; + v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); + + v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); + return; + } + case 4: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + 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, + v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5), + result = pMouse->GetCursorPos(&v101), + result->x <= 13) + || (result = pMouse->GetCursorPos(&v97), result->x >= 462) + || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) + return; + v93 = 0; + v91 = 4; + v37 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; + if (!v37->Identified()) + { + v89 = window_SpeakInHouse->ptr_1C; + v87 = v37; + v41 = (int)window_SpeakInHouse->ptr_1C; + v113 = uActiveCharacter - 1; + v42 = _this->_490EEE(v37, 4, v41, 4); + v39 = v113; + v38 = (char *)pMerchantsIdentifyPhrases[v42]; + } + else + { + v89 = window_SpeakInHouse->ptr_1C; + v38 = "%24"; + v87 = v37; + v39 = uActiveCharacter - 1; + } + v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); + v92 = 3; + v90 = v21; + v88 = v108; + v86 = v3; + v85 = v3; + v84 = &v104; + v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); + v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); + return; + } + case 94: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; + v22 = 0; + v23 = pShopOptions; + do + { + v24 = pFontArrus->CalcTextHeight(*v23, &v104, 0, 0); + ++v23; + v22 += v24; + } + while ( (signed int)v23 < (signed int)&pShopOptions[2] ); + Str = (char *)((174 - v22) / 2); + v25 = pDialogueWindow; + result = (POINT *)pDialogueWindow->pStartingPosActiveItem; + v26 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); + v27 = (2 * (87 - (174 - v22) / 2) - v22) / 2 - (174 - v22) / 2 / 2 + 138; + v28 = -pDialogueWindow->pNumPresenceButton < 0; + v112 = pDialogueWindow->pStartingPosActiveItem; + if ( v28 ^ __OFSUB__((int)result, v26) ) + { + _this = (Player *)2; + v111 = (const char **)pShopOptions; + do + { + v29 = v25->GetControl(v112); + v30 = v111; + v29->uY = (unsigned int)&Str[v27]; + v31 = pFontArrus->CalcTextHeight(*v30, &v104, 0, 0); + v32 = v29->uY; + v33 = _this; + v29->uHeight = v31; + v34 = v31 + v32 - 1; + v29->uW = v34; + v27 = v34; + v35 = v106; + if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v33 ) + v35 = v108; + v104.DrawTitleText(pFontArrus, 0, v32, v35, *v111, 3u); + v25 = pDialogueWindow; + _this = (Player *)((char *)_this + 1); + ++v111; + ++v112; + result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); + } + while ( (signed int)v112 < (signed int)result ); + } + return; + } + case 2: + { + pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); + v3 = 0; + v114 = 0; + do + { + // 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 = ItemsInShopTexture[v114]; + v47 = 152 - v46->uTextureHeight; + if ( (signed int)v47 < 1 ) + v47 = 0; + v48 = 75 * v114 - v46->uTextureWidth / 2 + 40; + if ( v114 ) + { + if ( v114 == 5 ) + { + v49 = ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)v48 > 457 - v49 ) + v48 = 457 - v49; + } + } + else if ( (signed int)v48 < 18 ) + v48 = 18; + pRenderer->DrawTextureTransparent(v48, v47, v46); + sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); + } + ++v114; + } + while ( v114 < 6 ); + v114 = 0; + do + { + // 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 = ItemsInShopTexture[v114 + 6]; + v51 = 308 - v50->uTextureHeight; + if ( (signed int)v51 < 1 ) + v51 = 0; + v52 = 75 * v114 - v50->uTextureWidth / 2 + 40; + if ( v114 ) + { + if ( v114 == 5 ) + { + v53 = ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)v52 > 457 - v53 ) + v52 = 457 - v53; + } + } + else + { + if ( (signed int)v52 < 18 ) + v52 = 18; + } + pRenderer->DrawTextureTransparent(v52, v51, v50); + sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); + } + ++v114; + } + while ( v114 < 6 ); + result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + v62 = 0; + v109 = 0; + do + { + // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID); + ++v109; + ++v62; + } + while ( v62 < 12 ); + v63 = GetAsyncKeyState(17); + v64 = _this->CanSteal(); + Str = (char *)v64; + if ( v63 && v64 ) + { + v65 = pGlobalTXT_LocalizationStrings[185]; + } + else if ( dialog_menu_id == 2 ) + { + v65 = pGlobalTXT_LocalizationStrings[195]; + } + else + { + v65 = pGlobalTXT_LocalizationStrings[196]; + } + DrawTextAtStatusBar(v65, 0); + if ( !v109 ) + { + v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return; + } + v66 = pMouse->GetCursorPos(&v98); + result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); + if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) + { + v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; + v109 = v67; + v68 = (int)window_SpeakInHouse->ptr_1C; + // v69 = 9 * (v67 + 12 * v68); + v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; + if ( dialog_menu_id != 2 ) + v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; + if ( !v63 || !Str ) + { + v93 = 0; + v91 = 2; + v89 = window_SpeakInHouse->ptr_1C; + v87 = v70; + v113 = uActiveCharacter - 1; + v71 = _this->_490EEE(v70, 4, v68, 2); + v39 = v113; + v38 = (char *)pMerchantsBuyPhrases[v71]; + } + else + { + v38 = pGlobalTXT_LocalizationStrings[181]; + v93 = 0; + v91 = 2; + v89 = window_SpeakInHouse->ptr_1C; + v87 = v70; + v39 = uActiveCharacter - 1; + } + v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); + v92 = 3; + v90 = v21; + v88 = v108; + v86 = v3; + v85 = v3; + v84 = &v104; + v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); + v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); + return ; + } + } + return; + } + case 95: + { + pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); + v3 = 0; + v114 = 0; + do + { + //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + 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; + v56 = 75 * v114 - v54->uTextureWidth / 2 + 40; + if ( v114 ) + { + if ( v114 == 5 ) + { + v57 = ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)v56 > 457 - v57 ) + v56 = 457 - v57; + } + } + else + { + if ( (signed int)v56 < 18 ) + v56 = 18; + } + pRenderer->DrawTextureTransparent(v56, v55, v54); + sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); + } + ++v114; + } + while ( v114 < 6 ); + v114 = 0; + do + { + // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) //weak + 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; + v60 = 75 * v114 - v58->uTextureWidth / 2 + 40; + if ( v114 ) + { + if ( v114 == 5 ) + { + v61 = ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)v60 > 457 - v61 ) + v60 = 457 - v61; + } + } + else + { + if ( (signed int)v60 < 18 ) + v60 = 18; + } + pRenderer->DrawTextureTransparent(v60, v59, v58); + sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); + } + ++v114; + } + while ( v114 < 6 ); + result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + v62 = 0; + v109 = 0; + do + { + //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) + ++v109; + ++v62; + } + while ( v62 < 12 ); + v63 = GetAsyncKeyState(17); + v64 = _this->CanSteal(); + Str = (char *)v64; + if ( v63 && v64 ) + { + v65 = pGlobalTXT_LocalizationStrings[185]; + } + else + { + v65 = pGlobalTXT_LocalizationStrings[195]; + if ( dialog_menu_id != 2 ) + v65 = pGlobalTXT_LocalizationStrings[196]; + } + DrawTextAtStatusBar(v65, 0); + if ( !v109 ) + { + v104.DrawCurrentTime( pParty->field_3C.field_50[ (unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return; + } + v66 = pMouse->GetCursorPos(&v98); + result = (POINT *)(v66->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v96)->y]); + if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) + { + v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; + v109 = v67; + v68 = (int)window_SpeakInHouse->ptr_1C; + // v69 = 9 * (v67 + 12 * v68); + v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; + if ( dialog_menu_id != 2 ) + v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; + if ( !v63 || !Str ) + { + v93 = 0; + v91 = 2; + v89 = window_SpeakInHouse->ptr_1C; + v87 = v70; + v113 = uActiveCharacter - 1; + v71 = _this->_490EEE(v70, 4, v68, 2); + v39 = v113; + v38 = (char *)pMerchantsBuyPhrases[v71]; + } + else + { + v38 = pGlobalTXT_LocalizationStrings[181]; + v93 = 0; + v91 = 2; + v89 = window_SpeakInHouse->ptr_1C; + v87 = v70; + v39 = uActiveCharacter - 1; + } + v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); + v92 = 3; + v90 = v21; + v88 = v108; + v86 = v3; + v85 = v3; + v84 = &v104; + v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); + v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); + return; + } + } + return; + } + case 96: + { + if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) + return; + v2 = pDialogueWindow; + v3 = 0; + v4 = window_SpeakInHouse->ptr_1C; + v112 = 0; + //v5 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v4] * 500.0); + v5 = (signed __int64)(p2DEvents[(signed int)v4 - 1].flt_24 * 500.0); + v111 = (const char **)(v5 * (100 - _this->GetMerchant()) / 100); + if ( (signed int)v111 < v5 / 3 ) + v111 = (const char **)(v5 / 3); + v6 = v2->pStartingPosActiveItem; + v7 = v6 + v2->pNumPresenceButton; + v114 = 0; + if ( (signed int)v6 < v7 ) + { + do + { + v8 = v2->GetControl(v6)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v8] && !_this->pActiveSkills[v8] ) + { + v9 = pFontArrus->CalcTextHeight(pSkillNames[v8], &v104, 0, 0); + v112 += v9; + ++v114; + } + ++v6; + } + while ( (signed int)v6 < v2->pNumPresenceButton + v2->pStartingPosActiveItem ); + if ( v114 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v111); + v104.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + v111 = (const char **)((signed int)(149 - v112) / v114); + if ( (signed int)(149 - v112) / v114 > 32 ) + v111 = (const char **)32; + result = (POINT *)v2->pStartingPosActiveItem; + v10 = (signed int)(149 - v114 * (int)v111 - v112) / 2 - (signed int)v111 / 2 + 162; + v112 = (unsigned int)result; + v105 = v10; + if ( (signed int)result < (signed int)((char *)result + v2->pNumPresenceButton) ) + { + v114 = 2; + do + { + v11 = v2->GetControl(v112); + v12 = v11; + v13 = v11->uControlParam - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v13] || _this->pActiveSkills[v13] ) + { + v12->uW = 0; + v12->uHeight = 0; + v12->uY = 0; + } + else + { + v14 = pSkillNames[v13]; + v12->uY = (unsigned int)((char *)v111 + v105); + Str = v14; + v15 = pFontArrus->CalcTextHeight(v14, &v104, 0, 0); + v16 = v12->uY; + v17 = v114; + v12->uHeight = v15; + v18 = v16 + v15 - 1; + v12->uW = v18; + v105 = v18; + v19 = v106; + if ( pDialogueWindow->pCurrentPosActiveItem != v17 ) + v19 = v108; + v104.DrawTitleText(pFontArrus, 0, v16, v19, Str, 3u); + } + v20 = v2->pStartingPosActiveItem; + ++v112; + result = (POINT *)(v2->pNumPresenceButton + v20); + ++v114; + } + while ( (signed int)v112 < (signed int)result ); + } + return; + } + } + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + v21 = pTmpBuf; + v92 = 3; + v90 = pTmpBuf; + v88 = v106; + v86 = 0; + v85 = 0; + v84 = &v104; + v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); + v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); + return; + } + default: + { + return;// (POINT *)dialog_menu_id - 96; + } + } +} + + +//----- (004BA928) -------------------------------------------------------- +void __cdecl ArmorShopDialog() + { + Player *v0; // ebx@1 + signed int v1; // esi@8 + unsigned int v2; // eax@10 + ItemGen *v3; // eax@11 + unsigned __int8 v4; // dl@12 + char *v5; // ecx@12 + char *v6; // eax@13 + int v7; // ST08_4@15 + int v8; // eax@15 + signed int v9; // esi@17 + unsigned int v10; // eax@19 + char *v11; // edi@19 + int v12; // ST08_4@20 + int v13; // eax@20 + unsigned __int8 v14; // dl@20 + char *v15; // ecx@20 + char **v16; // edi@22 + int all_text_height; // ebx@22 + char **v18; // esi@22 + int v19; // eax@23 + GUIWindow *v20; // ecx@24 + int v21; // eax@24 + int v22; // edx@24 + int v23; // ebx@24 + unsigned __int8 v24; // sf@24 + GUIButton *control_button; // eax@26 + GUIButton *v26; // esi@26 + int v27; // eax@26 + unsigned int v28; // ecx@26 + int v29; // edx@26 + + signed int v31; // esi@31 + unsigned int v32; // eax@33 + int v33; // eax@34 + int v34; // ST08_4@35 + int v35; // eax@35 + char *v36; // edx@36 + GUIWindow *v37; // edi@42 + signed int v38; // esi@42 + unsigned int v39; // esi@44 + int v40; // eax@44 + unsigned int v41; // eax@45 + int v42; // eax@47 + int v43; // ecx@52 + GUIButton *v44; // eax@54 + GUIButton *v45; // esi@54 + int v46; // eax@54 + char *v47; // eax@56 + int v48; // eax@56 + unsigned int v49; // ecx@56 + int v50; // edx@56 + int v51; // eax@56 + unsigned __int16 v52; // ax@56 + int v53; // eax@60 + int textureH; // eax@60 + signed int textureW; // ebx@65 + Texture *v56; // eax@67 + unsigned int v57; // edi@68 + Texture *v58; // ST1C_4@68 + int v59; // eax@68 + int v60; // edi@69 + signed int v61; // ebx@73 + Texture *v62; // eax@75 + int v63; // edi@76 + Texture *v64; // ST1C_4@76 + unsigned int v65; // ST18_4@76 + int v66; // eax@76 + int v67; // edi@77 + signed int v68; // ecx@81 + SHORT v69; // bx@89 + bool v70; // eax@89 + const char *v71; // ecx@91 + void *v72; // eax@95 + POINT *v73; // esi@97 + int v74; // ecx@97 + int v75; // eax@98 + int v76; // ecx@98 + ItemGen *selected_item; // ecx@99 + unsigned __int8 v78; // bl@104 + char **v79; // edi@105 + int v80; // ebx@105 + char **v81; // esi@105 + int v82; // eax@106 + GUIWindow *v83; // ecx@107 + int v84; // eax@107 + int v85; // edx@107 + int v86; // ebx@107 + GUIButton *v87; // eax@109 + GUIButton *v88; // esi@109 + int v89; // eax@109 + unsigned int v90; // ecx@109 + int v91; // edx@109 + unsigned __int16 v92; // ax@109 + signed int v93; // edx@114 + POINT *v94; // edi@120 + __int32 v95; // ecx@120 + void *v96; // ST14_4@122 + unsigned __int8 v97; // bl@122 + ItemGen *v98; // ST10_4@122 + int v99; // eax@122 + char *v100; // eax@122 + const char *v101; // ST18_4@122 + unsigned __int16 v102; // ST14_2@122 + int v103; // eax@122 + signed int v104; // edi@123 + Texture *v105; // eax@125 + int v106; // ebx@126 + Texture *v107; // ST1C_4@126 + unsigned int v108; // ST18_4@126 + int v109; // eax@126 + int v110; // ebx@127 + GUIWindow *v111; // [sp-18h] [bp-11Ch]@36 + unsigned int v112; // [sp-14h] [bp-118h]@13 + int v113; // [sp-14h] [bp-118h]@36 + ItemGen *v114; // [sp-10h] [bp-114h]@12 + unsigned int v115; // [sp-10h] [bp-114h]@13 + ItemGen *v116; // [sp-10h] [bp-114h]@20 + int v117; // [sp-10h] [bp-114h]@36 + void *v118; // [sp-Ch] [bp-110h]@12 + unsigned __int16 v119; // [sp-Ch] [bp-110h]@13 + void *v120; // [sp-Ch] [bp-110h]@20 + char *v121; // [sp-8h] [bp-10Ch]@13 + int v122; // [sp-8h] [bp-10Ch]@20 + unsigned int v123; // [sp-4h] [bp-108h]@13 + __int64 *v124; // [sp-4h] [bp-108h]@20 + int v125; // [sp-4h] [bp-108h]@68 + int v126; // [sp-4h] [bp-108h]@76 + int v127; // [sp-4h] [bp-108h]@126 + POINT v128; // [sp+Ch] [bp-F8h]@8 + POINT v129; // [sp+14h] [bp-F0h]@18 + char v130; // [sp+1Ch] [bp-E8h]@120 + POINT a2; // [sp+24h] [bp-E0h]@8 + POINT v132; // [sp+2Ch] [bp-D8h]@120 + POINT v133; // [sp+34h] [bp-D0h]@17 + POINT v134; // [sp+3Ch] [bp-C8h]@97 + POINT v135; // [sp+44h] [bp-C0h]@31 + POINT v136; // [sp+4Ch] [bp-B8h]@97 + POINT v137; // [sp+54h] [bp-B0h]@17 + POINT v138; // [sp+5Ch] [bp-A8h]@32 + POINT v139; // [sp+64h] [bp-A0h]@17 + POINT v140; // [sp+6Ch] [bp-98h]@31 + POINT v141; // [sp+74h] [bp-90h]@8 + POINT v142; // [sp+7Ch] [bp-88h]@31 + POINT v143; // [sp+84h] [bp-80h]@9 + GUIWindow dialog_window; // [sp+8Ch] [bp-78h]@1 + char *Str; // [sp+E0h] [bp-24h]@56 + int v146; // [sp+E4h] [bp-20h]@24 + int hilight_color; // [sp+E8h] [bp-1Ch]@1 + int m_text_color; // [sp+ECh] [bp-18h]@1 + __int32 v149; // [sp+F0h] [bp-14h]@8 + Player* _this; // [sp+F4h] [bp-10h]@1 + unsigned __int8 uPlayerID; // [sp+FBh] [bp-9h]@15 + int v152; // [sp+FCh] [bp-8h]@24 + int v153; // [sp+100h] [bp-4h]@44 + int th; + short text_color; + + v0 = pPlayers[uActiveCharacter]; + _this = pPlayers[uActiveCharacter]; + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + switch (dialog_menu_id) + { + case DIALOG_SHOP_MAIN: + { + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + + all_text_height = 0; + for(int i=0;i<4;++i) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v146 = (174 - all_text_height) / 4; + + v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; + int j=0; + if ( pDialogueWindow->pNumPresenceButton>=0 ) + { + th = 2; + for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) + { + control_button = pDialogueWindow->GetControl(v152); + control_button->uY = v146 + v23; + v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); + control_button->uHeight = v27; + v23 = control_button->uY + control_button->uHeight - 1; + control_button->uW = v23; + text_color = hilight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != th ) + text_color = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); + ++th; + ++j; + } + } + } + break; + case DIALOG_SHOP_BUY_STANDART: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + textureW = 0; + v153 = 0; + for(int i=0; i<8; ++i) + { + if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID); + { + textureW = ItemsInShopTexture[i]->uTextureWidth; + textureH = ItemsInShopTexture[i]->uTextureHeight; + if ( i >= 4 ) //low row + { + v60 = 90 - (textureW/2); + pRenderer->DrawTextureTransparent(v60 + v153 - 420, 126, ItemsInShopTexture[i]); + v59 = v60 + v153 + 80220; + } + else + { + v57 = 98 - textureH; + v152 = 86 - (textureW/2); + pRenderer->DrawTextureTransparent(v153 + v152, v57, ItemsInShopTexture[i]); + v59 = v153 + v152 + 640 * v57; + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v59], ItemsInShopTexture[i], i+1); + } + v153 += 105; + + } + + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + + v149 = 0; + for(int i=0; i<8; ++i) + { + if ( pParty->StandartItemsInShops[window_SpeakInHouse->par1C][i].uItemID); + ++v149; + + } + + v69 = GetAsyncKeyState(17); + v70 = _this->CanSteal(); + //Str = (char *)v70; + if ( v69 == 0 || v70 == 0 ) + { + v71 = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" + } + else + { + v71 = pGlobalTXT_LocalizationStrings[185];//"Steal item" + } + DrawTextAtStatusBar(v71, 0); + if ( v149 != 0 ) + { + v73 = pMouse->GetCursorPos(&v136); + v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v134)->y]] & 0xFFFF; + if ( !v74 ) + return; + v149 = v74 - 1; + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; + if ( v69 ==0 || v70 == 0) + { + v120 = window_SpeakInHouse->ptr_1C; + v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; + } + else + { + v120 = window_SpeakInHouse->ptr_1C; + v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" + } + v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); + return; + } + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + case DIALOG_SHOP_SELL: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0);//"Select the Item to Sell" + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) + return; + + if((v9 = pMouse->GetCursorPos(&v139)->x - 14, v149 = (v9 >> 5) + 14 * ((pMouse->GetCursorPos(&v133)->y - 17) >> 5), + pMouse->GetCursorPos(&v137)->x <= 13) || pMouse->GetCursorPos(&v129)->x >= 462 + || (v10 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v10) ) + return; + + v116 = (ItemGen *)&v0->pInventoryItems[v10-1]; + v13 = v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3); + v15 = (char *)pMerchantsSellPhrases[v0->_490EEE(v116, 2, window_SpeakInHouse->par1C, 3)]; + v36 = BuilDialogueString(v15, uActiveCharacter - 1, v116, (char *) window_SpeakInHouse->par1C, 3, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); + return; + } + break; + case DIALOG_SHOP_IDENTIFY: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); //"Select the Item to Identify" + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v1 = pMouse->GetCursorPos(&a2)->x - 14; + v149 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v128)->y - 17) >> 5); + if ( pMouse->GetCursorPos(&v141)->x > 13 ) + { + if ( pMouse->GetCursorPos(&v143)->x < 462 ) + { + v2 = v0->GetItemIDAtInventoryIndex((int *)&v149); + if ( v2 ) + { + v3 = (ItemGen *)&v0->pInventoryItems[v2-1]; + if (v3->Identified()) + { + v118 = window_SpeakInHouse->ptr_1C; + v4 = uActiveCharacter - 1; + v5 = "%24"; + v114 = v3; + } + else + { + v118 = window_SpeakInHouse->ptr_1C; + v114 = v3; + v7 = (int)window_SpeakInHouse->ptr_1C; + uPlayerID = uActiveCharacter - 1; + v8 = v0->_490EEE(v3, 2, v7, 4); + v4 = uPlayerID; + v5 = (char *)pMerchantsIdentifyPhrases[v8]; + } + v6 = BuilDialogueString(v5, v4, v114, (char *)v118, 4, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v6, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v6, 3); + return; + } + } + } + } + } + break; + case DIALOG_SHOP_REPAIR: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[198], 0); + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) + return; + + if( (v31 = pMouse->GetCursorPos(&v135)->x - 14, + v149 = (v31 >> 5) + 14 * ((pMouse->GetCursorPos(&v142)->y - 17) >> 5), + pMouse->GetCursorPos(&v140)->x <= 13) + || pMouse->GetCursorPos(&v138)->x >= 462 + || (v32 = v0->GetItemIDAtInventoryIndex((int *)&v149), v11 = 0, !v32) + || (v33 = 9 * v32, !(v0->field_1F5[4 * v33 + 15] & 2)) ) + return; + + + v120 = window_SpeakInHouse->ptr_1C; + v116 = (ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5]; + v34 = (int)window_SpeakInHouse->ptr_1C; + uPlayerID = uActiveCharacter - 1; + v35 = v0->_490EEE((ItemGen *)&v0->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * v33 + 5], 2, v34, 5); + v14 = uPlayerID; + v15 = (char *)pMerchantsRepairPhrases[v35]; + v36 = BuilDialogueString(v15, v14, v116, (char *)v120, 5, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); + return; + } + break; + case 6: //buy standart + { + pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); + DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[195], 0); //"Select the Item to Buy" + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v149 = 0; + for(int i=0;i<6;++i) + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][i].uItemID) + ++v149; + + + if ( v149 ) + { + v94 = pMouse->GetCursorPos(&v132); + v149 = pRenderer->pActiveZBuffer[v94->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v130)->y]]; + v95 = v149; + if ( v149 && v149 != -65536 ) + { + --v149; + + v97 = uActiveCharacter - 1; + + v99 = _this->_490EEE( + &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v95-1], 2, window_SpeakInHouse->par1C, 2); + v100 = BuilDialogueString((char *)pMerchantsBuyPhrases[v99], uActiveCharacter - 1, v98, (char *)window_SpeakInHouse->par1C, 2, 0); + v103 = pFontArrus->CalcTextHeight(v100, &dialog_window, 0, 0); + dialog_window.DrawTitleText(pFontArrus, 0, (174 - v103) / 2 + 138, m_text_color, v100, 3); + } + v104 = 0; + v153 = 0; + do + { + //if ( pParty->field_C59C[9 * (v104 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v104].uItemID) + { + v105 = ItemsInShopTexture[v104]; + if ( v104 >= 4 ) + { + v110 = 90 - ((signed int)v105->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v153 + v110 - 420, 0x7Eu, ItemsInShopTexture[v104]); + v127 = v104 + 1; + v109 = v153 + v110 + 80220; + } + else + { + v106 = 98 - v105->uTextureHeight; + v107 = ItemsInShopTexture[v104]; + v108 = 98 - v105->uTextureHeight; + v152 = 86 - ((signed int)v105->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v152 + v153, v108, v107); + v127 = v104 + 1; + v109 = v152 + v153 + 640 * v106; + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v109], ItemsInShopTexture[v104], v127); + } + v153 += 105; + ++v104; + } + while ( v104 < 8 ); + return; + } + dialog_window.DrawCurrentTime(pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + case DIALOG_SHOP_DISPLAY_EQUIPMENT: + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + v79 = pShopOptions; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; //"Sell" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; //"Identify" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; //"Repair" + + all_text_height = 0; + for(int i=0;i<3;++i) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v83 = pDialogueWindow; + v152 = (174 - all_text_height) / 3; + v84 = pDialogueWindow->pStartingPosActiveItem; + v85 = v84 + pDialogueWindow->pNumPresenceButton; + v86 = (3 * (58 - v152) - all_text_height) / 2 - v152 / 2 + 138; + v24 = -pDialogueWindow->pNumPresenceButton < 0; + _this = (Player *)pDialogueWindow->pStartingPosActiveItem; + if ( v24 ^ __OFSUB__(v84, v85) ) + { + v153 = 2; + do + { + v87 = v83->GetControl((unsigned int)_this); + v88 = v87; + v87->uY = v152 + v86; + v89 = pFontArrus->CalcTextHeight(*v79, &dialog_window, 0, 0); + v90 = v88->uY; + v91 = v153; + v88->uHeight = v89; + v86 = v90 + v89 - 1; + v88->uW = v86; + v92 = hilight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != v91 ) + v92 = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, v90, v92, *v79, 3u); + v83 = pDialogueWindow; + ++v153; + ++v79; + _this = (Player *)((char *)_this + 1); + } + while ( (signed int)_this < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + return; + } + break; + case DIALOG_SHOP_BUY_SPECIAL: + { + pRenderer->DrawTextureIndexed(8, 8, ShopTexture); + v11 = 0; + v61 = 0; + v153 = 0; + do + { + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v61].uItemID) + { + v62 = ItemsInShopTexture[v61]; + if ( v61 >= 4 ) + { + v67 = 90 - ((signed int)v62->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v153 + v67 - 420, 0x7Eu, ItemsInShopTexture[v61]); + v66 = v153 + v67 + 80220; + } + else + { + v63 = 98 - v62->uTextureHeight; + v64 = ItemsInShopTexture[v61]; + v65 = 98 - v62->uTextureHeight; + v152 = 86 - ((signed int)v62->uTextureWidth >> 1); + pRenderer->DrawTextureTransparent(v152 + v153, v65, v64); + v66 = v152 + v153 + 640 * v63; + } + ZBuffer_DoFill(&pRenderer->pActiveZBuffer[v66], ItemsInShopTexture[v61], v61 + 1); + } + v153 += 105; + ++v61; + } + while ( v61 < 8 ); + + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v68 = 0; + v149 = 0; + + do + { + // if ( (char *)pParty->field_C59C[9 * (v68 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] != v11 ) + if (pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][(signed int)v68].uItemID) + ++v149; + ++v68; + } + while ( v68 < 6 ); + + v69 = GetAsyncKeyState(17); + v70 = _this->CanSteal(); + Str = (char *)v70; + if ( v69 == 0 || (char *)v70 == 0 ) + { + v71 = pGlobalTXT_LocalizationStrings[196]; //Select the Special Item to Buy" + } + else + { + v71 = pGlobalTXT_LocalizationStrings[185]; + } + DrawTextAtStatusBar(v71, 0); + if ( (char *)v149 != 0 ) + { + v73 = pMouse->GetCursorPos(&v136); + v74 = pRenderer->pActiveZBuffer[v73->x + pSRZBufferLineOffsets[pMouse->GetCursorPos((POINT *)&v134)->y]] & 0xFFFF; + if ( !v74 ) + return; + v149 = v74 - 1; + + if ( dialog_menu_id == 2 ) + selected_item = &pParty->StandartItemsInShops[window_SpeakInHouse->par1C][v74-1]; + else + selected_item = &pParty->SpecialItemsInShops[window_SpeakInHouse->par1C][v74-1];//(ItemGen *)&pParty->field_C59C[v76 + 724]; + if ( v69 == 0 || Str == 0 ) + { + v120 = window_SpeakInHouse->ptr_1C; + v15 = (char *)pMerchantsBuyPhrases[_this->_490EEE(selected_item, 2, window_SpeakInHouse->par1C, 2)]; + } + else + { + v120 = window_SpeakInHouse->ptr_1C; + v15 = pGlobalTXT_LocalizationStrings[181]; //"Steal %24" + } + v36 = BuilDialogueString(v15, uActiveCharacter - 1, selected_item, (char *)v120, 2, 0); + v115 = (174 - pFontArrus->CalcTextHeight(v36, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, m_text_color, v36, 3); + return; + } + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[window_SpeakInHouse->par1C]- pParty->uTimePlayed); + return; + } + break; + case DIALOG_SHOP_SKILLS: + { + if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v152 = 0; + v37 = pDialogueWindow; + //v38 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); + v38 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + _this = (Player *)(v38 * (100 - v0->GetMerchant()) / 100); + if ( (signed int)_this < v38 / 3 ) + _this = (Player *)(v38 / 3); + v39 = v37->pStartingPosActiveItem; + v40 = v37->pNumPresenceButton; + v153 = 0; + if ( (signed int)v39 < (signed int)(v39 + v40) ) + { + do + { + v41 = v37->GetControl(v39)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v41] && !v0->pActiveSkills[v41] ) + { + v42 = pFontArrus->CalcTextHeight(pSkillNames[v41], &dialog_window, 0, 0); + v152 += v42; + ++v153; + } + ++v39; + } + while ( (signed int)v39 < v37->pNumPresenceButton + v37->pStartingPosActiveItem ); + if ( v153 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], _this); + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + _this = (Player *)((149 - v152) / v153); + if ( (149 - v152) / v153 > 32 ) + _this = (Player *)32; + v43 = (149 - v153 * (signed int)_this - v152) / 2 - (signed int)_this / 2 + 162; + v152 = v37->pStartingPosActiveItem; + v146 = v43; + if ( v152 < v152 + v37->pNumPresenceButton ) + { + v153 = 2; + do + { + v44 = v37->GetControl(v152); + v45 = v44; + v46 = v44->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, &dialog_window, 0, 0); + v49 = v45->uY; + v50 = v153; + v45->uHeight = v48; + v51 = v49 + v48 - 1; + v45->uW = v51; + v146 = v51; + v52 = hilight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != v50 ) + v52 = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, v49, v52, Str, 3u); + } + v53 = v37->pStartingPosActiveItem; + ++v152; + textureH = v37->pNumPresenceButton + v53; + ++v153; + } + while ( v152 < textureH ); + } + return; + } + } + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]); //"Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + v115 = (174 - pFontArrus->CalcTextHeight(pTmpBuf, &dialog_window, 0, 0)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, 0, v115, hilight_color, pTmpBuf, 3); + return; + } + break; + } + } + + + + //----- (004B5D7C) -------------------------------------------------------- + void GuildDialog() + { + GUIWindow *v0; // ebx@1 + Player *currPlayer; // edi@1 + signed int base_teach_price; // ebx@1 + int v3; // edi@6 + int result; // eax@11 + unsigned int v5; // ebx@13 + int v6; // esi@13 + signed int v7; // esi@17 + int v8; // esi@22 + signed int v9; // ecx@22 + char *v10; // eax@22 + const char *statusbar_string; // ecx@26 + POINT *v12; // esi@30 + int v13; // ecx@30 + void *v14; // ST1C_4@31 + ItemGen *v15; // ST18_4@31 + int v16; // ST10_4@31 + int v17; // eax@31 + char *v18; // edx@31 + int v19; // eax@32 + GUIWindow *v20; // edi@35 + int v21; // esi@35 + int v22; // eax@35 + unsigned int v23; // eax@36 + int v24; // eax@39 + int v25; // eax@40 + int v26; // ecx@47 + GUIButton *v27; // eax@49 + GUIButton *v28; // esi@49 + unsigned int v29; // eax@49 + char *v30; // eax@52 + int v31; // eax@55 + unsigned int v32; // ecx@55 + int v33; // eax@55 + unsigned __int16 v34; // ax@55 + int v35; // eax@58 + const char *v36; // ST20_4@61 + unsigned __int16 v37; // ST1C_2@61 + int v38; // eax@61 + GUIWindow *v39; // [sp-18h] [bp-304h]@31 + int v40; // [sp-14h] [bp-300h]@31 + int v41; // [sp-10h] [bp-2FCh]@31 + unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31 + char *v43; // [sp-8h] [bp-2F4h]@31 + unsigned int v44; // [sp-4h] [bp-2F0h]@31 + char Dest[100]; // [sp+Ch] [bp-2E0h]@3 + char v46[100]; // [sp+70h] [bp-27Ch]@3 + char v47[100]; // [sp+D4h] [bp-218h]@3 + char v48[100]; // [sp+138h] [bp-1B4h]@3 + char v49[100]; // [sp+19Ch] [bp-150h]@3 + POINT v50; // [sp+264h] [bp-88h]@30 + POINT v51; // [sp+26Ch] [bp-80h]@30 + GUIWindow working_window; // [sp+274h] [bp-78h]@1 + signed int v53; // [sp+27Ch] [bp-70h]@1 + signed int v54; // [sp+284h] [bp-68h]@1 + int v55; // [sp+2C8h] [bp-24h]@47 + int main_text_color; // [sp+2CCh] [bp-20h]@1 + int hi_text_color; // [sp+2D0h] [bp-1Ch]@1 + Player *v58; // [sp+2D4h] [bp-18h]@1 + unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31 + char *Str; // [sp+2DCh] [bp-10h]@35 + int v61; // [sp+2E0h] [bp-Ch]@35 + unsigned int v62; // [sp+2E4h] [bp-8h]@13 + int v63; // [sp+2E8h] [bp-4h]@1 + + v0 = window_SpeakInHouse; + memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); + v58 = pPlayers[uActiveCharacter]; + currPlayer = v58; + working_window.uFrameX = 483; + working_window.uFrameWidth = 148; + working_window.uFrameZ = 334; + main_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + hi_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); + //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0); + base_teach_price = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0); + v63 = base_teach_price * (100 - currPlayer->GetMerchant()) / 100; + if ( v63 < base_teach_price / 3 ) + v63 = base_teach_price / 3; + strcpy(Dest, ""); + strcpy(v46, ""); + strcpy(v47, ""); + strcpy(v48, ""); + strcpy(v49, ""); + if ( dialog_menu_id != 1 ) + { + if ( dialog_menu_id != 18 ) //buy skill + { + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill + if ( v58->pActiveSkills[dialog_menu_id-36] ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dialog_menu_id - 16]); //"You already know the %s skill" + ShowStatusBarString(pTmpBuf, 2u); + pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); + } + else + { + if ( pParty->uNumGold < v63 ) + { + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold" + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); + } + else + { + Party::TakeGold(v63); + v58->pActiveSkills[dialog_menu_id-36] = 1; + } + } + } + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return; + } + pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); + v5 = 0; + v6 = 0; + v62 = 0; + v63 = 32; + do + { + if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID) + // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) + + { + pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]); + ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); + currPlayer = v58; + } + v63 += 70; + v62 += 280; + ++v6; + } + while ( v63 < 452 ); + + v62 = 1680; + v7 = 6; + v63 = 32; + do + { + if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) + // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) + { + pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]); + ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); + currPlayer = v58; + } + v63 += 70; + v62 += 280; + ++v7; + } + while ( v63 < 452 ); + + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v8 = 0; + v9 = 12; + // v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C); + // v10 = + do + { + if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID ) + ++v8; + // v10 += 36; + --v9; + } + while ( v9 ); + + GetAsyncKeyState(17); + statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" + if ( dialog_menu_id != 2 ) + statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy" + DrawTextAtStatusBar(statusbar_string, 0); + if ( !v8 ) + { + working_window.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; + } + v12 = pMouse->GetCursorPos(&v51); + result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; + v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; + if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) + { + v14 = window_SpeakInHouse->ptr_1C; + v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); + v16 = (int)window_SpeakInHouse->ptr_1C; + uPlayerID = uActiveCharacter - 1; + v17 = currPlayer->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16, 2); + v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0); + v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, main_text_color, v18, 3); + return; + } + } + return; + } + if ( !(unsigned __int16)_449B57_test_bit( + (unsigned __int8 *)currPlayer->_guilds_member_bits, + guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) + { //you must me member + v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, hi_text_color, pNPCTopics[121].pText, 3u); + pDialogueWindow->pNumPresenceButton = 0; + return; + } + + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + v20 = pDialogueWindow; + v5 = 0; + v62 = 0; + Str = 0; + v21 = pDialogueWindow->pStartingPosActiveItem; + v22 = v21 + pDialogueWindow->pNumPresenceButton; + v61 = 0; + if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem+pDialogueWindow->pNumPresenceButton ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3); + return; + } + do + { + v23 = v20->GetControl(v21)->uControlParam; + if ( v23 == 18 ) + { + v25 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells" + v62 += v25; + ++v61; + } + else + { + + if((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v23-36])&&(v58->pActiveSkills[v23-36])) + // or + //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] + { + v24 = pFontArrus->CalcTextHeight(pClassNames[v23 - 16], &working_window, 0, 0); + v62 += v24; + ++v61; + ++Str; + } + } + ++v21; + } + while ( v21 < v20->pNumPresenceButton + v20->pStartingPosActiveItem ); + if ( !v61 ) + { +LABEL_64: + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->classType]); // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." + v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); + working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3); + return; + } + if ( Str ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu" + working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + } + v63 = (signed int)(149 - v62) / v61; + if ( v63 > 32 ) + v63 = 32; + v26 = (signed int)(149 - v61 * v63 - v62) / 2 - v63 / 2 + 162; + v62 = v20->pStartingPosActiveItem; + v55 = v26; + if (v20->pStartingPosActiveItem < v20->pStartingPosActiveItem + v20->pNumPresenceButton ) + { + v61 = 2; + while ( 1 ) + { + v27 = v20->GetControl(v62); + v28 = v27; + v29 = v27->uControlParam; + if ( v29 == 18 ) + break; + + // __debugbreak(); + //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] + // or + if ((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v29 - 36])&&(v58->pActiveSkills[v29-36])) + // or + //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] + + { + v30 = pClassNames[v29 -16]; +LABEL_55: + Str = v30; + v28->uY = v63 + v55; + v31 = pFontArrus->CalcTextHeight(v30, &working_window, 0, 0); + v32 = v28->uY; + v28->uHeight = v31; + v33 = v32 + v31 - 1; + v28->uW = v33; + v55 = v33; + v34 = hi_text_color; + if ( pDialogueWindow->pCurrentPosActiveItem != v61 ) + v34 = main_text_color; + working_window.DrawTitleText(pFontArrus, 0, v32, v34, Str, 3u); + v35 = v20->pStartingPosActiveItem; + ++v62; + ++v61; + if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem ) + return; + } + v28->uW = 0; + v28->uHeight = 0; + v28->uY = 0; +LABEL_58: + v35 = v20->pStartingPosActiveItem; + ++v62; + ++v61; + if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem ) + return; + } + v30 = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells" + goto LABEL_55; + } + return; + } + + + +//----- (004B705E) -------------------------------------------------------- +void TempleDialog() + { + GUIWindow *v0; // ebx@1 + Player *v1; // esi@1 + int v2; // edi@1 + int result; // eax@4 + GUIWindow *v4; // edi@6 + void *v5; // eax@6 + int v6; // eax@6 + unsigned int v7; // eax@8 + int v8; // ecx@8 + unsigned int v9; // eax@9 + int v10; // eax@11 + int v11; // eax@12 + GUIWindow *v12; // ecx@16 + int v13; // edx@16 + GUIButton *v14; // eax@19 + GUIButton *v15; // edi@19 + int v16; // eax@19 + const char *v17; // eax@21 + int v18; // eax@21 + unsigned int v19; // ecx@21 + int v20; // eax@21 + unsigned __int16 v21; // ax@21 + unsigned __int16 v22; // ST14_2@27 + int v23; // eax@27 + double v24; // st7@28 + unsigned int v25; // ebx@28 + DDM_DLV_Header *v26; // edi@29 + int v27; // eax@31 + int v28; // eax@32 + //unsigned int v29; // ecx@34 + unsigned int v30; // edx@36 + unsigned int v31; // edx@38 + unsigned int v32; // edx@40 + unsigned int v33; // edx@42 + unsigned int v34; // edx@44 + int v35; // edi@50 + signed int v36; // eax@50 + unsigned __int8 v37; // al@54 + int v38; // ecx@54 + GUIWindow *v39; // eax@56 + unsigned __int8 v40; // al@61 + GUIButton *v41; // edi@64 + int v42; // esi@66 + GUIWindow *v43; // ecx@66 + int v44; // edi@66 + int v45; // eax@68 + signed int v46; // edi@69 + int v47; // edi@71 + GUIButton *v48; // eax@73 + const char *v49; // edx@73 + GUIButton *v50; // esi@73 + int v51; // eax@73 + unsigned int v52; // ecx@73 + unsigned __int16 v53; // ax@73 + char a1[300]; // [sp+10h] [bp-1B4h]@64 + GUIWindow v57; // [sp+13Ch] [bp-88h]@1 + __int64 v58; // [sp+190h] [bp-34h]@1 + __int64 v59; // [sp+198h] [bp-2Ch]@1 + __int64 v60; // [sp+1A0h] [bp-24h]@1 + GUIWindow *v61; // [sp+1ACh] [bp-18h]@6 + unsigned int v62; // [sp+1B0h] [bp-14h]@8 + unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64 + int v64; // [sp+1B8h] [bp-Ch]@6 + unsigned int v65; // [sp+1BCh] [bp-8h]@6 + DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6 + + v0 = window_SpeakInHouse; + memcpy(&v57, window_SpeakInHouse, sizeof(v57)); + v57.uFrameX = 483; + v57.uFrameWidth = 148; + v57.uFrameZ = 334; + HIDWORD(v58) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + HIDWORD(v59) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); + v1 = pPlayers[uActiveCharacter]; + //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]); + v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); + HIDWORD(v60) = v2; + if ( dialog_menu_id != 1 ) + { + if ( dialog_menu_id != 10 ) + { + if ( dialog_menu_id != 11 ) + { + + if ( dialog_menu_id == 96 ) + { + if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v4 = pDialogueWindow; + v61 = pDialogueWindow; + v5 = window_SpeakInHouse->ptr_1C; + v66 = 0; + //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0); + v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); + v6 = v1->GetMerchant(); + v64 = (signed int)(v65 * (100 - v6)) / 100; + if ( v64 < (signed int)v65 / 3 ) + v64 = (signed int)v65 / 3; + v7 = v4->pStartingPosActiveItem; + v8 = v7 + v4->pNumPresenceButton; + v65 = 0; + v62 = v7; + if ( (signed int)v7 >= v8 ) + goto LABEL_78; + do + { + v9 = v4->GetControl(v62)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] ) + { + v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); + v66 = (DDM_DLV_Header *)((char *)v66 + v10); + ++v65; + } + v11 = v4->pStartingPosActiveItem; + ++v62; + } + while ( (signed int)v62 < v4->pNumPresenceButton + v11 ); + if ( v65 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64); + v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + v64 = (149 - (signed int)v66) / (signed int)v65; + if ( v64 > 32 ) + v64 = 32; + v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162; + v12 = v61; + result = v61->pStartingPosActiveItem; + v13 = result + v61->pNumPresenceButton; + v62 = v61->pStartingPosActiveItem; + if ( result < v13 ) + { + v66 = (DDM_DLV_Header *)2; + while ( 1 ) + { + v14 = v12->GetControl(v62); + v15 = v14; + v16 = v14->uControlParam - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] ) + { + v15->uW = 0; + v15->uHeight = 0; + v15->uY = 0; + } + else + { + v17 = pSkillNames[v16]; + v15->uY = v64 + v65; + HIDWORD(v60) = (uint32)v17; + v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0); + v19 = v15->uY; + v15->uHeight = v18; + v20 = v19 + v18 - 1; + v15->uW = v20; + v65 = v20; + v21 = WORD2(v59); + if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 ) + v21 = WORD2(v58); + v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u); + } + result = (int)v61; + ++v62; + v66 = (DDM_DLV_Header *)((char *)v66 + 1); + if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem ) + break; + v12 = v61; + } + } + } + else + { +LABEL_78: + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); + v22 = WORD2(v59); + v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0); + result = (int)v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); + } + } + } + return; + } + + // DONATION + //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; + v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; + v25 = 0; + if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) + { + Party::TakeGold((signed __int64)v24); + v26 = &pOutdoor->ddm; + if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) + v26 = &pIndoor->dlv; + v27 = v26->uReputation; + v66 = v26; + if ( v27 > -5 ) + { + v28 = v27 - 1; + v26->uReputation = v28; + if ( v28 < -5 ) + v26->uReputation = -5; + } + if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 ) + { + if ( v26->uReputation <= -5 ) + { + v30 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v30) = v30 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0); + } + if ( v26->uReputation <= -10 ) + { + v31 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v31) = v31 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0); + v26 = v66; + } + if ( v26->uReputation <= -15 ) + { + v32 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v32) = v32 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0); + v26 = v66; + } + if ( v26->uReputation <= -20 ) + { + v33 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v33) = v33 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0); + v26 = v66; + } + if ( v26->uReputation <= -25 ) + { + v34 = pParty->uDaysPlayed % 7 + 1; + LOBYTE(v34) = v34 | 0x80; + _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0); + } + } + ++byte_F8B1EF[uActiveCharacter]; + v1->PlaySound(SPEECH_83, 0); + ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!" + goto LABEL_46; + } + goto LABEL_55; + } + if ( !v1->_4B6FF9() ) + return; + v25 = 0; + if ( pParty->uNumGold < v2 ) + { +LABEL_55: + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); + goto LABEL_46; + } + Party::TakeGold(v2); + v35 = LODWORD(v1->pConditions[17]); + v59 = v1->pConditions[14]; + v58 = v1->pConditions[15]; + v60 = v1->pConditions[16]; + v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]); + memset(v1, 0, 0xA0u); + v1->sHealth = v1->GetMaxHealth(); + v1->sMana = v1->GetMaxMana(); + v36 = (signed int)window_SpeakInHouse->ptr_1C; + if ( v36 != 78 && (v36 <= 80 || v36 > 82) ) + { + if ( (unsigned int)v61 | v35 ) + { + v37 = LOBYTE(v1->field_1928); + v38 = v1->field_1924; + v1->uFace = v37; + v1->uVoiceID = v38; + ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37); + } + goto LABEL_63; + } + v39 = v61; + if ( (unsigned int)v61 | v35 ) + { + LODWORD(v1->pConditions[17]) = v35; + } + else + { + if ( !v60 && !v58 && !v59 ) + goto LABEL_63; + v1->field_1928 = v1->uFace; + v1->field_1924 = v1->uVoiceID; + v1->SetCondition(0x11u, 1); + v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23; + v40 = (v1->GetSexByVoice() != 0) + 23; + v1->uFace = v40; + ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40); + LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed); + v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); + } + HIDWORD(v1->pConditions[17]) = (int)v39; +LABEL_63: + pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); + v1->PlaySound(SPEECH_82, 0); + pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); +LABEL_46: + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); + return ; // void func + } + v63 = 1; + v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); + strcpy(a1, ""); + v41->uHeight = 0; + v41->uY = 0; + if ( v1->_4B6FF9() ) + { + sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]); + v63 = 0; + } + strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]); + strcpy(&a1[200], pGlobalTXT_LocalizationStrings[160]); + v42 = v63; + v43 = pDialogueWindow; + v44 = v63; + v66 = 0; + if ( v63 < pDialogueWindow->pNumPresenceButton ) + { + v61 = (GUIWindow *)&a1[100 * v63]; + do + { + v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0); + v66 = (DDM_DLV_Header *)((char *)v66 + v45); + v43 = pDialogueWindow; + v61 = (GUIWindow *)((char *)v61 + 100); + ++v44; + } + while ( v44 < pDialogueWindow->pNumPresenceButton ); + } + v46 = v43->pNumPresenceButton - v42; + v64 = (174 - (signed int)v66) / v46; + if ( v64 > 32 ) + v64 = 32; + v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138; + v65 = v42 + v43->pStartingPosActiveItem; + if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton ) + { + v61 = (GUIWindow *)(v42 + 2); + v66 = (DDM_DLV_Header *)&a1[100 * v42]; + do + { + v48 = v43->GetControl(v65); + v49 = (const char *)v66; + v50 = v48; + v48->uY = v64 + v47; + v51 = pFontArrus->CalcTextHeight(v49, &v57, 0, 0); + v52 = v50->uY; + v50->uHeight = v51; + v47 = v52 + v51 - 1; + v50->uW = v47; + v53 = WORD2(v59); + if ( (GUIWindow *)pDialogueWindow->pCurrentPosActiveItem != v61 ) + v53 = WORD2(v58); + v57.DrawTitleText(pFontArrus, 0, v52, v53, (const char *)v66, 3u); + v43 = pDialogueWindow; + v66 = (DDM_DLV_Header *)((char *)v66 + 100); + v61 = (GUIWindow *)((char *)v61 + 1); + ++v65; + } + while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + return; + } + +//----- (004B4710) -------------------------------------------------------- +int __cdecl TrainingDialog() +{ + Player *v0; // ebx@1 + int color2; // eax@1 + unsigned int v2; // ecx@1 + int v3; // eax@1 + signed int v4; // edx@1 + int v5; // edi@3 + unsigned int v6; // esi@3 + void *v7; // ecx@3 + int v8; // edx@4 + double v9; // st7@6 + signed int v10; // esi@6 + int v11; // ecx@6 + int result; // eax@9 + GUIWindow *v13; // edi@14 + signed int v14; // esi@14 + unsigned int v15; // esi@16 + int v16; // eax@16 + unsigned int v17; // eax@17 + int v18; // eax@19 + int v19; // ecx@24 + GUIButton *v20; // eax@26 + GUIButton *v21; // esi@26 + int v22; // eax@26 + const char *v23; // eax@28 + int v24; // eax@28 + unsigned int v25; // ecx@28 + int v26; // eax@28 + unsigned __int16 v27; // ax@28 + int v28; // eax@32 + unsigned __int16 v29; // ST14_2@34 + int v30; // eax@34 + const char *v31; // ST18_4@36 + unsigned __int16 v32; // ST14_2@36 + int v33; // eax@36 + int v34; // eax@37 + unsigned int v35; // edi@38 + unsigned int v36; // eax@38 + int v37; // ecx@41 + char *v38; // eax@41 + int *v39; // eax@45 + unsigned int v40; // eax@46 + void *v41; // ecx@46 + unsigned int v42; // eax@46 + GUIWindow *v43; // ecx@59 + int v44; // edx@59 + char **v45; // esi@60 + int v46; // eax@62 + int v47; // eax@68 + int v48; // edx@69 + int v49; // ebx@69 + unsigned __int8 v50; // sf@69 + char **v51; // edi@70 + GUIButton *v52; // eax@71 + GUIButton *v53; // esi@71 + int v54; // eax@71 + unsigned int v55; // ecx@71 + int v56; // eax@71 + unsigned __int16 v57; // ax@71 + unsigned __int16 v58; // [sp-Ch] [bp-90h]@38 + const char *v59; // [sp-Ch] [bp-90h]@63 + char *v60; // [sp-8h] [bp-8Ch]@38 + char *v61; // [sp-8h] [bp-8Ch]@63 + unsigned int v62; // [sp-4h] [bp-88h]@38 + int v63; // [sp-4h] [bp-88h]@52 + char *v64; // [sp-4h] [bp-88h]@63 + GUIWindow v65; // [sp+Ch] [bp-78h]@1 + __int64 v66; // [sp+60h] [bp-24h]@3 + unsigned int white; // [sp+68h] [bp-1Ch]@1 + int v68; // [sp+6Ch] [bp-18h]@3 + int v69; // [sp+70h] [bp-14h]@6 + unsigned int i; // [sp+74h] [bp-10h]@1 + int v71; // [sp+78h] [bp-Ch]@1 + int v72; // [sp+7Ch] [bp-8h]@16 + int v73; // [sp+80h] [bp-4h]@14 + + v0 = pPlayers[uActiveCharacter]; + memcpy(&v65, window_SpeakInHouse, sizeof(v65)); + v65.uFrameX = 483; + v65.uFrameWidth = 148; + v65.uFrameZ = 334; + white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + v2 = v0->uLevel; + v71 = color2; + v3 = 0; + v4 = 0; + for ( i = v2; v4 < (signed int)v2; ++v4 ) + v3 += v4 + 1; + v5 = 1000 * v3; + v6 = HIDWORD(v0->uExperience); + v7 = window_SpeakInHouse->ptr_1C; + v68 = (unsigned __int16)word_4F0866[(signed int)v7]; + v66 = 1000 * v3; + if ( (signed __int64)__PAIR__(v6, LODWORD(v0->uExperience)) >= v66 ) + { + v8 = v0->classType % 4 + 1; + if ( v8 == 4 ) + v8 = 3; + v9 = (double)(signed int)i; + i = 0; + v69 = v8; + //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8); + v10 = (signed __int64)(v9 * p2DEvents[(signed int)v7 - 1].fPriceMultiplier * (double)v8); + v11 = v10 * (100 - v0->GetMerchant()) / 100; + if ( v11 < v10 / 3 ) + v11 = v10 / 3; + i = v11; + } + result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + if ( dialog_menu_id != 1 ) + { + if ( dialog_menu_id != 17 ) + { + result = dialog_menu_id - 96; + if ( dialog_menu_id == 96 ) + { + result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + i = 0; + v13 = pDialogueWindow; + //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); + v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); + v73 = v14 * (100 - v0->GetMerchant()) / 100; + if ( v73 < v14 / 3 ) + v73 = v14 / 3; + v15 = v13->pStartingPosActiveItem; + v16 = v13->pNumPresenceButton; + v72 = 0; + if ( (signed int)v15 >= (signed int)(v15 + v16) ) + goto LABEL_76; + do + { + v17 = v13->GetControl(v15)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v17] && !v0->pActiveSkills[v17] ) + { + v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0); + i += v18; + ++v72; + } + ++v15; + } + while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem ); + if ( v72 ) + { + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu" + v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + v73 = (signed int)(149 - i) / v72; + if ( v73 > 32 ) + v73 = 32; + result = v13->pStartingPosActiveItem; + v19 = (signed int)(149 - v72 * v73 - i) / 2 - v73 / 2 + 162; + i = result; + v68 = v19; + if ( result < result + v13->pNumPresenceButton ) + { + v72 = 2; + do + { + v20 = v13->GetControl(i); + v21 = v20; + v22 = v20->uControlParam - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v22] || v0->pActiveSkills[v22] ) + { + v21->uW = 0; + v21->uHeight = 0; + v21->uY = 0; + } + else + { + v23 = pSkillNames[v22]; + v21->uY = v73 + v68; + HIDWORD(v66) = (int)v23; + v24 = pFontArrus->CalcTextHeight(v23, &v65, 0, 0); + v25 = v21->uY; + v21->uHeight = v24; + v26 = v25 + v24 - 1; + v21->uW = v26; + v68 = v26; + v27 = v71; + if ( pDialogueWindow->pCurrentPosActiveItem != v72 ) + v27 = white; + v65.DrawTitleText(pFontArrus, 0, v25, v27, (char *)HIDWORD(v66), 3u); + } + v28 = v13->pStartingPosActiveItem; + ++i; + result = v13->pNumPresenceButton + v28; + ++v72; + } + while ( (signed int)i < result ); + } + } + else + { +LABEL_76: + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]);// + // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." + v29 = v71; + v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0); + result = (int)v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u); + } + } + } + return result; + } + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + { + v31 = pNPCTopics[122].pText; + v32 = v71; + v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); + v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3u); + result = (int)pDialogueWindow; + pDialogueWindow->pNumPresenceButton = 0; + return result; + } + v34 = v0->uLevel; + if ( v34 < v68 ) + { + if ( (signed __int64)v0->uExperience >= v66 ) + { + if ( pParty->uNumGold >= i ) + { + Party::TakeGold(i); + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); + ++v0->uLevel; + v0->uSkillPoints += v0->uLevel / 10 + 5; + v0->sHealth = v0->GetMaxHealth(); + v0->sMana = v0->GetMaxMana(); + v37 = 0; + v38 = byte_F8B148; + do + { + if ( *(int *)v38 > v37 ) + v37 = *(int *)v38; + v38 += 4; + } + while ( (signed int)v38 < (signed int)word_F8B158 ); + v39 = &dword_F8B144 + uActiveCharacter; + ++*v39; + if ( *v39 > v37 ) + { + v40 = sub_494820(pParty->uCurrentHour); + v41 = window_SpeakInHouse->ptr_1C; + v42 = 60 * (v40 + 4) - pParty->uCurrentMinute; + if ( v41 == (void *)94 || v41 == (void *)95 ) + v42 += 720; + RestAndHeal((signed int)(v42 + 10080)); + if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) + pOutdoor->SetFog(); + } + v0->PlaySound(SPEECH_87, 0); + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);// + // "%s is now Level %lu and has earned %lu Skill Points!" + ShowStatusBarString(pTmpBuf, 2u); + goto LABEL_56; + } + ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" + v63 = 4; +LABEL_55: + HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v63); +LABEL_56: + /*result = pMessageQueue_50CBD0->uNumMessages; + if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) + { + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; + pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; + result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; + *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; + ++pMessageQueue_50CBD0->uNumMessages; + } + return result;*/ + pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); + return 1; // void function actually + } + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[538], v5 - LODWORD(v0->uExperience), v34 + 1);// + // "You need %d more experience to train to level %d" + v35 = 0; + v62 = 3; + v60 = pTmpBuf; + v58 = v71; + v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 88; + } + else + { + sprintf(pTmpBuf, "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// + // ""With your skills, you should be working here as a teacher."" + // ""Sorry, but we are unable to train you."" + v35 = 0; + v62 = 3; + v60 = pTmpBuf; + v58 = v71; + v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 101; + } + v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62); + v63 = 3; + goto LABEL_55; + } + result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + v43 = pDialogueWindow; + v72 = 0; + pShopOptions[0] = pTmpBuf; + pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" + v44 = pDialogueWindow->pNumPresenceButton; + v73 = pDialogueWindow->pStartingPosActiveItem; + if ( v73 < v73 + v44 ) + { + v45 = pShopOptions; + do + { + if ( v43->GetControl(v73)->uControlParam == 17 ) + { + v46 = v0->uLevel; + if ( v46 < v68 ) + { + if ( (signed __int64)v0->uExperience < v66 ) + { + v64 = (char *)(v46 + 1); + v61 = (char *)(v5 - LODWORD(v0->uExperience)); + v59 = pGlobalTXT_LocalizationStrings[538];// "You need %d more experience to train to level %d" + } + else + { + v64 = (char *)i; + v61 = (char *)(v46 + 1); + v59 = pGlobalTXT_LocalizationStrings[537];// "Train to level %d for %d gold" + } + } + else + { + v64 = pGlobalTXT_LocalizationStrings[529];// ""Sorry, but we are unable to train you."" + v61 = pGlobalTXT_LocalizationStrings[536];// ""With your skills, you should be working here as a teacher."" + v59 = "%s\n \n%s"; + } + sprintf(*v45, v59, v61, v64); + } + v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0); + v43 = pDialogueWindow; + v72 += v47; + ++v45; + ++v73; + } + while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); + } + HIDWORD(v66) = (174 - v72) / 2; + result = v43->pStartingPosActiveItem; + v48 = result + v43->pNumPresenceButton; + v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138; + v50 = -v43->pNumPresenceButton < 0; + v73 = v43->pStartingPosActiveItem; + if ( v50 ^ __OFSUB__(result, v48) ) + { + i = 2; + v51 = pShopOptions; + do + { + v52 = v43->GetControl(v73); + v53 = v52; + v52->uY = HIDWORD(v66) + v49; + v54 = pFontArrus->CalcTextHeight(*v51, &v65, 0, 0); + v55 = v53->uY; + v53->uHeight = v54; + v56 = v54 + v55 - 1; + v53->uW = v56; + v49 = v56; + v57 = v71; + if ( pDialogueWindow->pCurrentPosActiveItem != i ) + v57 = white; + v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u); + v43 = pDialogueWindow; + ++i; + ++v51; + ++v73; + result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; + } + while ( v73 < result ); + } + } + } + return result; +} + + + + + + + + + +//----- (004B4FCF) -------------------------------------------------------- +void MagicShopDialog() + { + Player *v0; // ebx@1 + int result; // eax@6 + signed int v2; // esi@8 + unsigned int v3; // ebx@10 + char *v4; // eax@11 + char *v5; // eax@12 + unsigned int v6; // eax@12 + int v7; // ST08_4@14 + int v8; // eax@14 + unsigned __int8 v9; // dl@14 + char *v10; // ecx@14 + signed int v11; // esi@16 + int v12; // ST08_4@19 + int v13; // eax@19 + int all_text_height; // edi@21 + char **v15; // esi@21 + int v16; // eax@22 + GUIWindow *v17; // ecx@23 + int v18; // edx@23 + int v19; // edi@23 + unsigned __int8 v20; // sf@23 + GUIButton *control_button; // esi@25 + const char **v22; // eax@25 + int v23; // eax@25 + unsigned int v24; // ecx@25 + const char **v25; // edx@25 + unsigned __int16 text_color; // ax@25 + signed int v27; // esi@30 + int v28; // ST08_4@34 + int v29; // eax@34 + char *v30; // edx@35 + GUIWindow *v31; // edi@40 + void *v32; // eax@40 + signed int v33; // esi@40 + unsigned int v34; // esi@42 + int v35; // eax@42 + unsigned int v36; // eax@43 + int v37; // eax@45 + int v38; // ecx@50 + GUIButton *v39; // eax@52 + GUIButton *v40; // esi@52 + int v41; // eax@52 + char *v42; // eax@54 + int v43; // eax@54 + unsigned int v44; // ecx@54 + int v45; // edx@54 + int v46; // eax@54 + unsigned __int16 v47; // ax@54 + int v48; // eax@58 + signed int v49; // esi@62 + Texture *v50; // ecx@64 + unsigned int v51; // edi@64 + unsigned int v52; // esi@66 + int v53; // edx@70 + Texture *v54; // ecx@76 + unsigned int v55; // edi@76 + unsigned int v56; // esi@76 + int v57; // edx@80 + Texture *v58; // ecx@86 + unsigned int v59; // edi@86 + unsigned int v60; // esi@88 + int v61; // edx@92 + Texture *v62; // ecx@98 + unsigned int v63; // edi@98 + unsigned int v64; // esi@100 + int v65; // edx@104 + signed int v66; // ecx@109 + SHORT v67; // di@117 + bool v68; // eax@117 + const char *v69; // ecx@119 + POINT *v70; // esi@124 + int v71; // ecx@125 + int v72; // eax@125 + int v73; // ecx@125 + ItemGen *v74; // esi@125 + int v75; // eax@130 + int v76; // esi@131 + char **v77; // edi@131 + int v78; // eax@132 + GUIWindow *v79; // ecx@133 + int v80; // edx@133 + int v81; // edi@133 + GUIButton *v82; // esi@135 + const char **v83; // eax@135 + int v84; // eax@135 + unsigned int v85; // ecx@135 + int v86; // edx@135 + unsigned __int16 v87; // ax@135 + GUIWindow *v88; // [sp-18h] [bp-110h]@35 + int v89; // [sp-14h] [bp-10Ch]@35 + ItemGen *v90; // [sp-10h] [bp-108h]@14 + int v91; // [sp-10h] [bp-108h]@35 + unsigned __int16 v92; // [sp-Ch] [bp-104h]@12 + void *v93; // [sp-Ch] [bp-104h]@14 + int v94; // [sp-8h] [bp-100h]@11 + char *v95; // [sp-8h] [bp-100h]@12 + __int64 *v96; // [sp-4h] [bp-FCh]@11 + unsigned int v97; // [sp-4h] [bp-FCh]@12 + POINT v98; // [sp+Ch] [bp-ECh]@8 + POINT v99; // [sp+14h] [bp-E4h]@16 + POINT v100; // [sp+1Ch] [bp-DCh]@124 + POINT v101; // [sp+24h] [bp-D4h]@17 + POINT v102; // [sp+2Ch] [bp-CCh]@124 + POINT v103; // [sp+34h] [bp-C4h]@9 + POINT v104; // [sp+3Ch] [bp-BCh]@31 + POINT v105; // [sp+44h] [bp-B4h]@16 + POINT v106; // [sp+4Ch] [bp-ACh]@30 + POINT v107; // [sp+54h] [bp-A4h]@16 + POINT v108; // [sp+5Ch] [bp-9Ch]@30 + POINT a2; // [sp+64h] [bp-94h]@8 + POINT v110; // [sp+6Ch] [bp-8Ch]@30 + POINT v111; // [sp+74h] [bp-84h]@8 + GUIWindow dialog_window; // [sp+7Ch] [bp-7Ch]@1 + char *Str; // [sp+D0h] [bp-28h]@54 + int v146; // [sp+D4h] [bp-24h]@23 + unsigned int hilight_color; // [sp+D8h] [bp-20h]@1 + unsigned int m_text_color; // [sp+DCh] [bp-1Ch]@1 + __int32 v117; // [sp+E0h] [bp-18h]@8 + int v118; // [sp+E4h] [bp-14h]@40 + const char **v119; // [sp+E8h] [bp-10h]@24 + Player *_this; // [sp+ECh] [bp-Ch]@1 + unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14 + int v152; // [sp+F4h] [bp-4h]@23 + int v122; + int v114; + + v0 = pPlayers[uActiveCharacter]; + _this = pPlayers[uActiveCharacter]; + memcpy(&dialog_window, window_SpeakInHouse, sizeof(dialog_window)); + dialog_window.uFrameX = 483; + dialog_window.uFrameWidth = 148; + dialog_window.uFrameZ = 334; + m_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); + hilight_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); + if ( dialog_menu_id > 5 ) + { + if ( dialog_menu_id == 94 ) + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair" + v76 = 0; + v77 = pShopOptions; + do + { + v78 = pFontArrus->CalcTextHeight(*v77, &dialog_window, 0, 0); + ++v77; + v76 += v78; + } + while ( (signed int)v77 < (signed int)&pShopOptions[3] ); + v79 = pDialogueWindow; + _this = (Player *)((174 - v76) / 3); + result = pDialogueWindow->pStartingPosActiveItem; + v80 = result + pDialogueWindow->pNumPresenceButton; + v81 = (3 * (58 - (signed int)_this) - v76) / 2 - (174 - v76) / 3 / 2 + 138; + v20 = -pDialogueWindow->pNumPresenceButton < 0; + v118 = pDialogueWindow->pStartingPosActiveItem; + if ( v20 ^ __OFSUB__(result, v80) ) + { + v122 = 2; + v119 = (const char **)pShopOptions; + do + { + v82 = v79->GetControl(v118); + v83 = v119; + v82->uY = (unsigned int)((char *)_this + v81); + v84 = pFontArrus->CalcTextHeight(*v83, &dialog_window, 0, 0); + v85 = v82->uY; + v86 = v122; + v82->uHeight = v84; + v81 = v84 + v85 - 1; + v82->uW = v81; + v87 = hilight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != v86 ) + v87 = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, v85, v87, *v119, 3u); + v79 = pDialogueWindow; + ++v122; + ++v119; + ++v118; + result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; + } + while ( v118 < result ); + } + return; + } + if ( dialog_menu_id != 95 ) + { + result = dialog_menu_id - 96; + if ( dialog_menu_id == 96 ) + { + result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + v31 = pDialogueWindow; + v3 = 0; + v32 = window_SpeakInHouse->ptr_1C; + v118 = 0; + //v33 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v32] * 500.0); + v33 = (signed __int64)(p2DEvents[(signed int)v32 - 1].flt_24 * 500.0); + v119 = (const char **)(v33 * (100 - _this->GetMerchant()) / 100); + if ( (signed int)v119 < v33 / 3 ) + v119 = (const char **)(v33 / 3); + v34 = v31->pStartingPosActiveItem; + v35 = v34 + v31->pNumPresenceButton; + v122 = 0; + if ( (signed int)v34 >= v35 ) + goto LABEL_140; + do + { + v36 = v31->GetControl(v34)->uControlParam - 36; + if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v36] && !_this->pActiveSkills[v36] ) + { + v37 = pFontArrus->CalcTextHeight(pSkillNames[v36], &dialog_window, 0, 0); + v118 += v37; + ++v122; + } + ++v34; + } + while ( (signed int)v34 < v31->pNumPresenceButton + v31->pStartingPosActiveItem ); + if ( !v122 ) + { +LABEL_140: + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);// + // "Seek knowledge elsewhere %s the %s" + strcat(pTmpBuf, "\n \n"); + strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." + v30 = pTmpBuf; + v97 = 3; + v95 = pTmpBuf; + v92 = hilight_color; + v91 = 0; + v89 = 0; + v88 = &dialog_window; + goto LABEL_61; + } + sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" + dialog_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); + v119 = (const char **)((149 - v118) / v122); + if ( (149 - v118) / v122 > 32 ) + v119 = (const char **)32; + result = v31->pStartingPosActiveItem; + v38 = (149 - v122 * (signed int)v119 - v118) / 2 - (signed int)v119 / 2 + 162; + v118 = result; + v114 = v38; + if ( result < result + v31->pNumPresenceButton ) + { + v122 = 2; + do + { + v39 = v31->GetControl(v118); + v40 = v39; + v41 = v39->uControlParam - 36; + if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v41] || _this->pActiveSkills[v41] ) + { + v40->uW = 0; + v40->uHeight = 0; + v40->uY = 0; + } + else + { + v42 = pSkillNames[v41]; + v40->uY = (unsigned int)((char *)v119 + v114); + Str = v42; + v43 = pFontArrus->CalcTextHeight(v42, &dialog_window, 0, 0); + v44 = v40->uY; + v45 = v122; + v40->uHeight = v43; + v46 = v44 + v43 - 1; + v40->uW = v46; + v114 = v46; + v47 = hilight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != v45 ) + v47 = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, v44, v47, Str, 3u); + } + v48 = v31->pStartingPosActiveItem; + ++v118; + result = v31->pNumPresenceButton + v48; + ++v122; + } + while ( v118 < result ); + } + } + } + return; + } + } + else + { + if ( dialog_menu_id == 5 ) + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + 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, + v117 = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5), + result = (int)pMouse->GetCursorPos(&v106), + *(int *)result <= 13) + || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462) + || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) + || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) ) + return; + v96 = 0; + v94 = 5; + v93 = window_SpeakInHouse->ptr_1C; + v90 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5]; + v28 = (int)window_SpeakInHouse->ptr_1C; + uPlayerID = uActiveCharacter - 1; + v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5); + v9 = uPlayerID; + v10 = (char *)pMerchantsRepairPhrases[v29]; + goto LABEL_35; + } + if ( dialog_menu_id == 1 ) + { + /* result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];// "Buy Standard" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];// "Buy Special" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];// "Display Inventory" + v14 = 0; + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" + v15 = pShopOptions; + do + { + v16 = pFontArrus->CalcTextHeight(*v15, &dialogue_window, 0, 0); + ++v15; + v14 += v16; + } + while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); + v17 = pDialogueWindow; + v114 = (174 - v14) / 4; + result = pDialogueWindow->pStartingPosActiveItem; + v18 = result + pDialogueWindow->pNumPresenceButton; + v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; + v20 = -pDialogueWindow->pNumPresenceButton < 0; + v122 = pDialogueWindow->pStartingPosActiveItem; + if ( v20 ^ __OFSUB__(result, v18) ) + { + v119 = (const char **)2; + _this = (Player *)pShopOptions; + do + { + v21 = v17->GetControl(v122); + v22 = (const char **)_this; + v21->uY = v114 + v19; + v23 = pFontArrus->CalcTextHeight(*v22, &dialogue_window, 0, 0); + v24 = v21->uY; + v25 = v119; + v21->uHeight = v23; + v19 = v24 + v23 - 1; + v21->uW = v19; + v26 = color2; + if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v25 ) + v26 = m_text_color; + dialogue_window.DrawTitleText(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u); + v17 = pDialogueWindow; + v119 = (const char **)((char *)v119 + 1); + _this = (Player *)((char *)_this + 4); + ++v122; + result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; + } + while ( v122 < result ); + } + }*/ + if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) + return; + pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; //"Buy Standard" + pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; //"Buy Special" + pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; //"Display Inventory" + pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; + + all_text_height = 0; + for(int i=0;i<4;++i) + all_text_height += pFontArrus->CalcTextHeight(pShopOptions[i], &dialog_window, 0, 0); + v146 = (174 - all_text_height) / 4; + + v23 = (174 - 4 * (174 - all_text_height) / 4 - all_text_height) / 2 - (174 - all_text_height) / 4 / 2 + 138; + int j=0; + if ( pDialogueWindow->pNumPresenceButton>=0 ) + { + int th = 2; + for (v152 = pDialogueWindow->pStartingPosActiveItem; v152 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; ++v152) + { + control_button = pDialogueWindow->GetControl(v152); + control_button->uY = v146 + v23; + v27 = pFontArrus->CalcTextHeight(pShopOptions[j], &dialog_window, 0, 0); + control_button->uHeight = v27; + v23 = control_button->uY + control_button->uHeight - 1; + control_button->uW = v23; + text_color = hilight_color; + if ( pDialogueWindow->pCurrentPosActiveItem != th ) + text_color = m_text_color; + dialog_window.DrawTitleText(pFontArrus, 0, control_button->uY, text_color, pShopOptions[j], 3); + ++th; + ++j; + } + } + + + return; + } + if ( dialog_menu_id != 2 ) + { + if ( dialog_menu_id != 3 ) + { + result = dialog_menu_id - 4; + if ( dialog_menu_id == 4 ) + { + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + 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 ) + { + v2 = pMouse->GetCursorPos(&a2)->x - 14; + v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5); + result = (int)pMouse->GetCursorPos(&v111); + if ( *(int *)result > 13 ) + { + result = (int)pMouse->GetCursorPos(&v103); + if ( *(int *)result < 462 ) + { + result = v0->GetItemIDAtInventoryIndex((int *)&v117); + v3 = 0; + if ( result ) + { + v96 = 0; + v94 = 4; + v4 = (char *)&_this->pInventoryItems[result-1]; + if ( v4[20] & 1 ) + { + v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); + v97 = 3; + v95 = v5; + v92 = m_text_color; + v6 = (212 - pFontArrus->CalcTextHeight(v5, &dialog_window, 0, 0)) / 2 + 101; + + dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); + return; + } + v93 = window_SpeakInHouse->ptr_1C; + v90 = (ItemGen *)v4; + v7 = (int)window_SpeakInHouse->ptr_1C; + uPlayerID = uActiveCharacter - 1; + v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4); + v9 = uPlayerID; + v10 = (char *)pMerchantsIdentifyPhrases[v8]; + goto LABEL_35; + } + } + } + } + } + return; + } + draw_leather(); + CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); + 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, + v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5), + result = (int)pMouse->GetCursorPos(&v105), + *(int *)result <= 13) + || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) + || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) + return; + v96 = 0; + v94 = 3; + v93 = window_SpeakInHouse->ptr_1C; + v90 = (ItemGen *)&_this->pInventoryItems[result-1]; + v12 = (int)window_SpeakInHouse->ptr_1C; + uPlayerID = uActiveCharacter - 1; + v13 = _this->_490EEE(v90, 3, v12, 3); + v9 = uPlayerID; + v10 = (char *)pMerchantsSellPhrases[v13]; +LABEL_35: + v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); + v97 = 3; + v95 = v30; + v92 = m_text_color; + v91 = v3; + v89 = v3; + v88 = &dialog_window; +LABEL_61: + v6 = (174 - pFontArrus->CalcTextHeight(v30, v88, v89, v91)) / 2 + 138; + dialog_window.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); + return; + } + } + pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); + v3 = 0; + v49 = 0; + v122 = 0; + if ( dialog_menu_id == 2 ) + { + do + { + // 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 = ItemsInShopTexture[v49]; + v51 = 152 - v50->uTextureHeight; + if ( (signed int)v51 < 1 ) + v51 = 0; + v52 = 75 * v49 - v50->uTextureWidth / 2 + 40; + if ( v122 ) + { + if ( v122 == 5 ) + { + v53 = ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)v52 > 457 - v53 ) + v52 = 457 - v53; + } + } + else + { + if ( (signed int)v52 < 18 ) + v52 = 18; + } + pRenderer->DrawTextureTransparent(v52, v51, v50); + sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1); + v49 = v122; + } + ++v49; + v122 = v49; + } + while ( v49 < 6 ); + v122 = 0; + do + { + //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 = ItemsInShopTexture[v122 + 6]; + v55 = 306 - v54->uTextureHeight; + v56 = 75 * v122 - v54->uTextureWidth / 2 + 40; + if ( v122 ) + { + if ( v122 == 5 ) + { + v57 = ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)v56 > 457 - v57 ) + v56 = 457 - v57; + } + } + else + { + if ( (signed int)v56 < 18 ) + v56 = 18; + } + pRenderer->DrawTextureTransparent(v56, v55, v54); + sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7); + } + ++v122; + } + while ( v122 < 6 ); + } + else + { + do + { + // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + 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; + v60 = 75 * v49 - v58->uTextureWidth / 2 + 40; + if ( v122 ) + { + if ( v122 == 5 ) + { + v61 = ItemsInShopTexture[5]->uTextureWidth; + if ( (signed int)v60 > 457 - v61 ) + v60 = 457 - v61; + } + } + else + { + if ( (signed int)v60 < 18 ) + v60 = 18; + } + pRenderer->DrawTextureTransparent(v60, v59, v58); + sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1); + v49 = v122; + } + ++v49; + v122 = v49; + } + while ( v49 < 6 ); + v122 = 0; + do + { + //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] ) //weak + 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; + v64 = 75 * v122 - v62->uTextureWidth / 2 + 40; + if ( v122 ) + { + if ( v122 == 5 ) + { + v65 = ItemsInShopTexture[11]->uTextureWidth; + if ( (signed int)v64 > 457 - v65 ) + v64 = 457 - v65; + } + } + else + { + if ( (signed int)v64 < 18 ) + v64 = 18; + } + pRenderer->DrawTextureTransparent(v64, v63, v62); + sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7); + } + ++v122; + } + while ( v122 < 6 ); + } + result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); + if ( result ) + { + v66 = 0; + v117 = 0; + if ( dialog_menu_id == 2 ) + { + do + { + if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) + ++v117; + ++v66; + } + while ( v66 < 12 ); + } + else + { + do + { + //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) + if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) + ++v117; + ++v66; + } + while ( v66 < 12 ); + } + v67 = GetAsyncKeyState(VK_CONTROL); + v68 = _this->CanSteal(); + Str = (char *)v68; + if ( v67 && v68 ) + { + v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item" + } + else + { + v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" + if ( dialog_menu_id != 2 ) + v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" + } + DrawTextAtStatusBar(v69, 0); + if ( !v117 ) + { + dialog_window.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); + return; + } + v70 = pMouse->GetCursorPos(&v102); + result = v70->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v100)->y]; + if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) + { + v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; + v117 = v71; + v72 = (int)window_SpeakInHouse->ptr_1C; + // v73 = 9 * (v71 + 12 * v72); + v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71]; + if ( dialog_menu_id != 2 ) + // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724]; + v74 =&pParty->SpecialItemsInShops[v72][v71]; + if ( v67 && Str ) + { + v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" + v96 = 0; + v94 = 2; + v93 = window_SpeakInHouse->ptr_1C; + v90 = v74; + v9 = uActiveCharacter - 1; + } + else + { + v96 = 0; + v94 = 2; + v93 = window_SpeakInHouse->ptr_1C; + v90 = v74; + uPlayerID = uActiveCharacter - 1; + v75 = _this->_490EEE(v74, 3, v72, 2); + v9 = uPlayerID; + v10 = (char *)pMerchantsBuyPhrases[v75]; + } + goto LABEL_35; + } + } + return; +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/UIHouses.h Mon Mar 11 09:28:57 2013 +0600 @@ -0,0 +1,48 @@ +#pragma once + +#include "stru159.h" + +enum DIALOG_MENU + { + DIALOG_SHOP_MAIN = 1, + DIALOG_SHOP_BUY_STANDART = 2, + DIALOG_SHOP_SELL = 3, + DIALOG_SHOP_IDENTIFY = 4, + DIALOG_SHOP_REPAIR = 5, + DIALOG_SHOP_DISPLAY_EQUIPMENT = 94, + DIALOG_SHOP_BUY_SPECIAL = 95, + DIALOG_SHOP_SKILLS = 96, + }; + +/* 349 */ +enum HOUSE_ID + { + HOUSE_SMITH_EMERALD_ISLE = 1, + HOUSE_BODY_GUILD_NOVICE_EMERALD_ISLE = 163, + HOUSE_BODY_GUILD_ERATHIA = 165, + HOUSE_DARK_GUILD_PIT = 170, + HOUSE_LORD_AND_JUDGE = 186, + HOUSE_JAIL = 187, + HOUSE_600 = 600,//??? + HOUSE_601 = 601//??? + }; + +int __cdecl TrainingDialog(); +char *__cdecl JailDialog(); +void MagicShopDialog(); +void GuildDialog(); +int __cdecl sub_4B6478(); +bool __fastcall sub_4B68EA(int a1); +void __cdecl TravelByTransport(); +void TempleDialog(); +void __cdecl TownHallDialog(); +void __cdecl BankDialog(); +void __cdecl TavernDialog(); +void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2); // idb +void __cdecl WeaponShopDialog(); +void __cdecl AlchemistDialog(); +void __cdecl ArmorShopDialog(); + +extern int uHouse_ExitPic; // weak +extern int dword_591080; // weak + extern const stru159 pAnimatedRooms[196];
--- a/VideoPlayer.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/VideoPlayer.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -12,7 +12,7 @@ #include "Allocator.h" #include "Time.h" #include "Log.h" - +#include "UIHouses.h" #include "MM7.h" #include "mm7_data.h"
--- a/Vis.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/Vis.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -343,6 +343,7 @@ int v17; // [sp+48h] [bp-8h]@1 Vis *thisa; // [sp+4Ch] [bp-4h]@1 + __debugbreak(); // refactor for BLV picking v5 = 0;
--- a/mm7_1.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/mm7_1.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -4479,7 +4479,7 @@ } if ( pCurrentScreen == SCREEN_HOUSE ) { - if ( dword_F8B19C != 2 + if ( dialog_menu_id != 2 || (v16 = pRenderer->pActiveZBuffer[pX + pSRZBufferLineOffsets[pY]], v16 == 0) || v16 == -65536 ) //goto _return; @@ -4980,7 +4980,7 @@ //goto LABEL_28; uActiveCharacter = uPlayerID; return; - if ( dword_F8B19C == 2 || dword_F8B19C == 6 ) + if ( dialog_menu_id == 2 || dialog_menu_id == 6 ) { pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103; v5 = 14;
--- a/mm7_2.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/mm7_2.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -51,3076 +51,13 @@ #include "Events2D.h" #include "stru159.h" #include "Log.h" +#include "UIHouses.h" #include "texts.h" #include "mm7_data.h" #include "MM7.h" -//----- (004B4F4F) -------------------------------------------------------- -char *__cdecl JailDialog() -{ - const char *v0; // esi@1 - const char *v1; // ST10_4@1 - unsigned __int16 v2; // ST0C_2@1 - int v3; // eax@1 - GUIWindow v5; // [sp+8h] [bp-54h]@1 - - memcpy(&v5, window_SpeakInHouse, sizeof(v5)); - v0 = pGlobalTXT_LocalizationStrings[672]; - v1 = pGlobalTXT_LocalizationStrings[672]; - v5.uFrameX = 483; - v5.uFrameWidth = 148; - v5.uFrameZ = 334; - v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - v3 = pFontArrus->CalcTextHeight(v0, &v5, 0, 0); - return v5.DrawTitleText(pFontArrus, 0, (310 - v3) / 2 + 18, v2, v1, 3u); -} - - - -//----- (004B68EA) -------------------------------------------------------- -bool __fastcall sub_4B68EA(int a1) -{ - signed int v1; // edi@1 - int *v2; // esi@1 - int v3; // ecx@2 - - v1 = 0; - v2 = &dword_4F0E10[a1]; - while ( 1 ) - { - v3 = 8 * *((char *)v2 + v1); - if ( *(&byte_4F09B1[pParty->uDaysPlayed % 7] + v3 * 4) ) - { - if ( !dword_4F09CC[v3] || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, LOWORD(dword_4F09CC[v3])) ) - break; - } - ++v1; - if ( v1 >= 4 ) - return 0; - } - return 1; -} - - - -//----- (004B7911) -------------------------------------------------------- -void __cdecl TownHallDialog() -{ - GUIWindow *v0; // eax@4 - int v1; // eax@10 - int v2; // esi@10 - GUIFont *v3; // ST20_4@20 - int v4; // eax@20 - MonsterInfo *v5; // edi@21 - unsigned int v6; // ST20_4@21 - char *v7; // ST1C_4@21 - unsigned int v8; // eax@21 - int v9; // esi@21 - char *v10; // eax@23 - signed int v11; // ebx@24 - signed int i; // esi@26 - int v13; // eax@27 - GUIWindow *v14; // ecx@28 - __int64 v15; // qax@28 - signed int v16; // ebx@28 - int v17; // ebx@28 - unsigned __int8 v18; // sf@28 - char **v19; // edi@29 - GUIButton *v20; // eax@30 - GUIButton *v21; // esi@30 - int v22; // eax@30 - unsigned int v23; // ecx@30 - unsigned __int16 v24; // ax@30 - GUIWindow a1; // [sp+Ch] [bp-110h]@21 - GUIWindow w; // [sp+60h] [bp-BCh]@21 - GUIWindow _this; // [sp+B4h] [bp-68h]@1 - int v28; // [sp+108h] [bp-14h]@1 - int v29; // [sp+10Ch] [bp-10h]@28 - int v30; // [sp+110h] [bp-Ch]@1 - int v31; // [sp+114h] [bp-8h]@29 - GUIFont *pOutString; // [sp+118h] [bp-4h]@21 - - memcpy(&_this, window_SpeakInHouse, sizeof(_this)); - _this.uFrameX = 483; - _this.uFrameWidth = 148; - _this.uFrameZ = 334; - v28 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v30 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[605], pParty->uFine); - _this.DrawTitleText(pFontArrus, 0, 0x104u, v30, pTmpBuf, 3u); - switch(dword_F8B19C) - { - case 1: - { - v11 = 1; - pOutString = 0; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[604]; - if ( pParty->uFine ) - { - pShopOptions[1] = pGlobalTXT_LocalizationStrings[603]; - v11 = 2; - } - for ( i = 0; i < v11; ++i ) - { - v13 = pFontArrus->CalcTextHeight(pShopOptions[i], &_this, 0, 0); - pOutString = (GUIFont *)((char *)pOutString + v13); - } - v29 = (100 - (signed int)pOutString) / v11; - v14 = pDialogueWindow; - v15 = 80 - v11 * (100 - (signed int)pOutString) / v11 - (signed int)pOutString; - v16 = v15 - HIDWORD(v15); - LODWORD(v15) = pDialogueWindow->pStartingPosActiveItem; - HIDWORD(v15) = v15 + pDialogueWindow->pNumPresenceButton; - v17 = (v16 >> 1) - v29 / 2 + 158; - v18 = -pDialogueWindow->pNumPresenceButton < 0; - pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; - if ( v18 ^ __OFSUB__((int)v15, HIDWORD(v15)) ) - { - v31 = 2; - v19 = pShopOptions; - do - { - v20 = v14->GetControl((unsigned int)pOutString); - v21 = v20; - v20->uY = v29 + v17; - v22 = pFontArrus->CalcTextHeight(*v19, &_this, 0, 0); - v23 = v21->uY; - v21->uHeight = v22; - v17 = v23 + v22 - 1; - v21->uW = v17; - v24 = v30; - if ( pDialogueWindow->pCurrentPosActiveItem != v31 ) - v24 = v28; - _this.DrawTitleText(pFontArrus, 0, v23, v24, *v19, 3u); - v14 = pDialogueWindow; - ++v31; - ++v19; - pOutString = (GUIFont *)((char *)pOutString + 1); - } - while ( (signed int)pOutString < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - break; - } - case 99: - { - v5 = &pMonsterStats->pInfos[word_F8B1A0]; - v6 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v7 = v5->pName; - v8 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - sprintf(pTmpBuf, &byte_4F0F98, v8, v7, v6); - sprintf(pTmpBuf2, dword_F8B1A4, pTmpBuf, 100 * v5->uLevel); - ptr_F8B1E8 = pTmpBuf2; - memcpy(&a1, pDialogueWindow, sizeof(a1)); - w.uFrameWidth = 458; - w.uFrameZ = 457; - pOutString = pFontArrus; - v9 = pFontArrus->CalcTextHeight(pTmpBuf2, &w, 13, 0) + 7; - if ( 352 - v9 < 8 ) - { - pOutString = pFontCreate; - v9 = pFontCreate->CalcTextHeight(ptr_F8B1E8, &w, 13, 0) + 7; - } - - auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); - pRenderer->_4A6A68(8u, 352 - v9, pTex, (pTex ? pTex->uTextureHeight : 26) - v9); - pRenderer->DrawTextureIndexed(8u, 347 - v9, pTexture_591428); - v10 = FitTextInAWindow(ptr_F8B1E8, pOutString, &w, 0xDu, 0); - a1.DrawText(pOutString, 13, 354 - v9, 0, v10, 0, 0, 0); - break; - } - case 100: - { - v0 = window_SpeakInHouse; - if ( window_SpeakInHouse->field_40 == 1 ) - { - sprintf(pTmpBuf, "%s\n%s", pGlobalTXT_LocalizationStrings[606], pGlobalTXT_LocalizationStrings[112]); - _this.DrawTitleText(pFontArrus, 0, 0x92u, v30, pTmpBuf, 3u); - _this.DrawTitleText(pFontArrus, 0, 0xBAu, v28, (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); - v3 = pFontArrus; - v4 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); - _this.DrawFlashingInputCursor(v4 / 2 + 80, 185, v3); - return; - } - if ( window_SpeakInHouse->field_40 == 2 ) - { - v1 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); - v2 = v1; - if ( v1 <= 0 ) - { - //LABEL_8: - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - return; - } - if ( v1 > pParty->uNumGold ) - { - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - v2 = pParty->uNumGold; - } - if ( v2 > pParty->uFine ) - v2 = pParty->uFine; - Party::TakeGold(v2); - pParty->uFine -= v2; - if ( pParty->uFine < 0 ) - pParty->uFine = 0; - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); - v0 = window_SpeakInHouse; - } - if ( window_SpeakInHouse->field_40 == 3 ) - { - v0->field_40 = 0; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - } - break; - } - default: - { - break; - } - } - return; -} -// F8B19C: using guessed type int dword_F8B19C; -// F8B1A0: using guessed type __int16 word_F8B1A0; - -//----- (004B7D7E) -------------------------------------------------------- -void __cdecl BankDialog() -{ - GUIWindow *v0; // eax@4 - int v1; // ecx@5 - int v2; // eax@6 - unsigned int v3; // esi@6 - GUIFont *v4; // ST10_4@12 - int v5; // eax@12 - int v6; // eax@19 - unsigned int v7; // esi@19 - unsigned __int16 v8; // ax@27 - unsigned __int16 v9; // ax@29 - char *v10; // [sp-8h] [bp-70h]@11 - char *v11; // [sp-4h] [bp-6Ch]@11 - GUIWindow _this; // [sp+Ch] [bp-5Ch]@1 - __int16 v13[2]; // [sp+60h] [bp-8h]@1 - __int16 v14[2]; // [sp+64h] [bp-4h]@1 - - memcpy(&_this, window_SpeakInHouse, sizeof(_this)); - _this.uFrameX = 483; - _this.uFrameWidth = 148; - _this.uFrameZ = 334; - *(int *)v13 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - *(int *)v14 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - sprintf(pTmpBuf, "%s: %d", pGlobalTXT_LocalizationStrings[25], pParty->uNumGoldInBank); - _this.DrawTitleText(pFontArrus, 0, 0xDCu, v14[0], pTmpBuf, 3u); - switch(dword_F8B19C) - { - case 1: - { - v8 = v14[0]; - if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) - v8 = v13[0]; - _this.DrawTitleText(pFontArrus, 0, 0x92u, v8, pGlobalTXT_LocalizationStrings[60], 3u); - v9 = v14[0]; - if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) - v9 = v13[0]; - _this.DrawTitleText(pFontArrus, 0, 0xB0u, v9, pGlobalTXT_LocalizationStrings[244], 3u); - break; - } - case 7: - { - v0 = window_SpeakInHouse; - if ( window_SpeakInHouse->field_40 != 1 ) - { - v1 = window_SpeakInHouse->field_40 - 2; - if ( window_SpeakInHouse->field_40 == 2 ) - { - v6 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); - v7 = v6; - if ( !v6 ) - { -//LABEL_17: - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - *(&pMessageQueue_50CBD0->uNumMessages + 3 * pMessageQueue_50CBD0->uNumMessages + 3) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - }*/ - return; - } - if ( v6 > pParty->uNumGold ) - { - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - v7 = pParty->uNumGold; - } - if ( v7 ) - { - Party::TakeGold(v7); - pParty->uNumGoldInBank += v7; - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_81, 0); - } - v0 = window_SpeakInHouse; - v0->field_40 = 0; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return; - } - if ( v1 != 1 ) - return; - v0->field_40 = 0; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return; - } - v11 = pGlobalTXT_LocalizationStrings[112]; - v10 = pGlobalTXT_LocalizationStrings[60]; - sprintf(pTmpBuf, "%s\n%s", v10, v11); - _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); - _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); - v4 = pFontArrus; - v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); - _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); - break; - } - - case 8: - { - v0 = window_SpeakInHouse; - if ( window_SpeakInHouse->field_40 != 1 ) - { - v1 = window_SpeakInHouse->field_40 - 2; - if ( window_SpeakInHouse->field_40 == 2 ) - { - window_SpeakInHouse->field_40 = 0; - v2 = atoi((const char *)pKeyActionMap->pPressedKeysBuffer); - v3 = v2; - if ( v2 ) - { - if ( v2 > pParty->uNumGoldInBank ) - { - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - v3 = pParty->uNumGoldInBank; - } - if ( v3 ) - { - Party::SetGold(pParty->uNumGold + v3); - pParty->uNumGoldInBank -= v3; - } - } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return; - } - if ( v1 != 1 ) - return; - v0->field_40 = 0; - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return; - } - v11 = pGlobalTXT_LocalizationStrings[112]; - v10 = pGlobalTXT_LocalizationStrings[244]; - sprintf(pTmpBuf, "%s\n%s", v10, v11); - _this.DrawTitleText(pFontArrus, 0, 0x92u, v14[0], pTmpBuf, 3u); - _this.DrawTitleText(pFontArrus, 0, 0xBAu, v13[0], (const char *)pKeyActionMap->pPressedKeysBuffer, 3u); - v4 = pFontArrus; - v5 = pFontArrus->GetLineWidth((const char *)pKeyActionMap->pPressedKeysBuffer); - _this.DrawFlashingInputCursor(v5 / 2 + 80, 185, v4); - return; - break; - } - - default: - { - break; - } - } -} -// F8B19C: using guessed type int dword_F8B19C; - -//----- (004B8285) -------------------------------------------------------- -void __cdecl TavernDialog() -{ - GUIWindow *v0; // ebx@1 - Player *v1; // edi@1 - double v2; // st7@1 - signed int v3; // ebx@1 - int v4; // ecx@1 - int v5; // esi@3 - signed int v6; // edi@5 - int v7; // ecx@5 - GUIWindow *v8; // edi@16 - signed int v9; // esi@16 - unsigned int v10; // esi@18 - int v11; // eax@18 - unsigned int v12; // eax@19 - int v13; // eax@21 - int v14; // ecx@26 - GUIButton *v15; // eax@28 - GUIButton *v16; // esi@28 - int v17; // eax@28 - char *v18; // eax@30 - int v19; // eax@30 - unsigned int v20; // ecx@30 - int v21; // edx@30 - int v22; // eax@30 - unsigned __int16 v23; // ax@30 - int v24; // eax@34 - int v25; // eax@34 - char *v26; // esi@36 - int v27; // edi@46 - unsigned int v28; // eax@53 - unsigned int v29; // eax@55 - unsigned int v30; // eax@57 - signed int v31; // eax@59 - unsigned int v32; // eax@61 - GUIWindow *v33; // edi@64 - int v34; // eax@64 - int v35; // ecx@64 - int v36; // esi@64 - char v37; // sf@64 - GUIButton *v38; // eax@65 - int v39; // edx@69 - int v40; // ecx@69 - int v41; // ecx@69 - int v42; // ecx@70 - unsigned int v43; // edx@70 - int v44; // edx@71 - int v45; // ecx@71 - int v46; // ecx@72 - int v47; // eax@74 - signed int v48; // edi@77 - signed int i; // esi@79 - int v50; // eax@80 - GUIWindow *v51; // ecx@81 - _QWORD v52; // qax@81 - signed int v53; // edi@81 - int v54; // edi@81 - GUIButton *v55; // esi@83 - const char **v56; // eax@83 - int v57; // eax@83 - unsigned int v58; // ecx@83 - Player *v59; // edx@83 - unsigned __int16 v60; // ax@83 - int v61; // eax@99 - int v62; // edi@99 - char *v63; // eax@99 - GUIFont *v64; // edx@99 - GUIFont *v65; // edi@100 - unsigned int v66; // [sp-10h] [bp-284h]@75 - unsigned __int16 v67; // [sp-Ch] [bp-280h]@75 - int v68; // [sp-Ch] [bp-280h]@99 - char *v69; // [sp-8h] [bp-27Ch]@75 - int v70; // [sp-8h] [bp-27Ch]@99 - unsigned int v71; // [sp-4h] [bp-278h]@75 - const char *v72; // [sp-4h] [bp-278h]@93 - unsigned int v73; // [sp-4h] [bp-278h]@99 - char Dest[100]; // [sp+Ch] [bp-268h]@55 - char v75[100]; // [sp+70h] [bp-204h]@59 - char a1[100]; // [sp+D4h] [bp-1A0h]@57 - char v77[100]; // [sp+138h] [bp-13Ch]@59 - GUIWindow v78; // [sp+19Ch] [bp-D8h]@99 - GUIWindow v79; // [sp+1F0h] [bp-84h]@1 - char *Str[2]; // [sp+244h] [bp-30h]@30 - unsigned int v81; // [sp+24Ch] [bp-28h]@1 - unsigned __int8 v82; // [sp+253h] [bp-21h]@59 - int v83; // [sp+254h] [bp-20h]@1 - __int16 v84[2]; // [sp+258h] [bp-1Ch]@1 - Player *v85; // [sp+25Ch] [bp-18h]@1 - int v86; // [sp+260h] [bp-14h]@18 - unsigned __int8 v87; // [sp+266h] [bp-Eh]@59 - unsigned __int8 v88; // [sp+267h] [bp-Dh]@57 - int v89; // [sp+268h] [bp-Ch]@1 - unsigned __int8 v90; // [sp+26Fh] [bp-5h]@55 - GUIFont *pOutString; // [sp+270h] [bp-4h]@3 - - v0 = window_SpeakInHouse; - memcpy(&v79, window_SpeakInHouse, sizeof(v79)); - v85 = pPlayers[uActiveCharacter]; - v1 = v85; - v79.uFrameX = 483; - v79.uFrameWidth = 148; - v79.uFrameZ = 334; - v81 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - *(int *)v84 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - //v2 = p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]; - v2 = p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier; - *(float *)&v83 = v2; - *(float *)&v89 = v2 * v2; - v3 = (signed __int64)(*(float *)&v89 * 0.1); - v4 = v3 * (100 - v1->GetMerchant()) / 100; - if ( v4 < v3 / 3 ) - v4 = v3 / 3; - v5 = 1; - pOutString = (GUIFont *)v4; - if ( v4 <= 0 ) - pOutString = (GUIFont *)1; - v6 = (signed __int64)(*(float *)&v89 * *(float *)&v83 * 0.0099999998); - v7 = v6 * (100 - v85->GetMerchant()) / 100; - if ( v7 < v6 / 3 ) - v7 = v6 / 3; - v83 = v7; - if ( v7 <= 0 ) - { - v7 = 1; - v83 = 1; - } - switch(dword_F8B19C) - { - case 102: - { - v65 = pFontArrus; - pOutString = pFontArrus; - strcpy(pTmpBuf, pNPCTopics[354].pText); - v78.uFrameWidth = 460; - v78.uFrameZ = 452; - v62 = v65->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; - if ( 352 - v62 < 8 ) - { - pOutString = pFontCreate; - v62 = pFontCreate->CalcTextHeight(pTmpBuf, &v78, 12, 0) + 7; - } - - auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : 0); - pRenderer->_4A6A68(8u, 352 - v62, pTex, (pTex ? pTex->uTextureHeight : 26) - v62); - - pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); - v73 = 0; - v70 = 0; - v68 = 0; - v63 = FitTextInAWindow(pTmpBuf, pOutString, &v78, 0xCu, 0); - v64 = pOutString; - window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73); - break; - } - case 103: - { - strcpy(pTmpBuf, pNPCTopics[(uint)window_SpeakInHouse->ptr_1C + 247].pText); - v78.uFrameWidth = 460; - v78.uFrameZ = 452; - v61 = pFontArrus->CalcTextHeight(pTmpBuf, &v78, 12, 0); - v62 = v61 + 7; - - auto pTex = (uTextureID_Leather != -1 ? &pIcons_LOD->pTextures[uTextureID_Leather] : nullptr); - pRenderer->_4A6A68(8u, 352 - (v61 + 7), pTex, (pTex ? pTex->uTextureHeight : 26) - (v61 + 7)); - - pRenderer->DrawTextureIndexed(8u, 347 - v62, pTexture_591428); - v73 = 0; - v70 = 0; - v68 = 0; - v63 = FitTextInAWindow(pTmpBuf, pFontArrus, &v78, 0xCu, 0); - v64 = pFontArrus; - window_SpeakInHouse->DrawText(v64, 12, 354 - v62, 0, v63, v68, v70, v73); - break; - } - case 104: - { - if ( pArcomageGame->bGameInProgress == 1 ) - return; - v26 = pTmpBuf; - if ( pArcomageGame->uGameResult ) - { - if ( pArcomageGame->uGameResult == 1 ) - v72 = pGlobalTXT_LocalizationStrings[640];// You won! - else - v72 = pGlobalTXT_LocalizationStrings[641];// You lost! - } - else - { - v72 = pGlobalTXT_LocalizationStrings[639];// A tie! - } - strcpy(pTmpBuf, v72); -//LABEL_97: - v71 = 3; - v69 = v26; - v67 = v84[0]; - v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; - v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); - break; - } - case 15: - { - if ( pParty->uNumGold >= (unsigned int)pOutString ) - { - Party::TakeGold((unsigned int)pOutString); - v27 = (int)window_SpeakInHouse->ptr_1C; - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - dword_F8B19C = 0; - while ( sub_4BD8B5() ) - ; - sub_4B1D27(); - pVideoPlayer->Unload(); - window_SpeakInHouse->Release(); - window_SpeakInHouse = 0; - - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - pMessageQueue_50CBD0->pMessages[0].eType = UIMSG_OpenRestUI; - pMessageQueue_50CBD0->pMessages[0].param = v27; - pMessageQueue_50CBD0->pMessages[0].field_8 = 1; -//LABEL_51: - ++pMessageQueue_50CBD0->uNumMessages; - return; - } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); - break; - } - case 96: - { - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v8 = pDialogueWindow; - *(float *)&v89 = 0.0; - - //v9 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v9 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - - pOutString = (GUIFont *)(v9 * (100 - v85->GetMerchant()) / 100); - if ( (signed int)pOutString < v9 / 3 ) - pOutString = (GUIFont *)(v9 / 3); - v10 = v8->pStartingPosActiveItem; - v11 = v10 + v8->pNumPresenceButton; - v86 = 0; - if ( (signed int)v10 < v11 ) - { - do - { - v12 = v8->GetControl(v10)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v12] && !v85->pActiveSkills[v12] ) - { - v13 = pFontArrus->CalcTextHeight(pSkillNames[v12], &v79, 0, 0); - v89 += v13; - ++v86; - } - ++v10; - } - while ( (signed int)v10 < v8->pStartingPosActiveItem + v8->pNumPresenceButton ); - if ( v86 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], pOutString); - v79.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - pOutString = (GUIFont *)((149 - v89) / v86); - if ( (149 - v89) / v86 > 32 ) - pOutString = (GUIFont *)32; - v14 = (149 - v86 * (signed int)pOutString - v89) / 2 - (signed int)pOutString / 2 + 162; - v89 = v8->pStartingPosActiveItem; - v83 = v14; - if ( v89 < v89 + v8->pNumPresenceButton ) - { - v86 = 2; - do - { - v15 = v8->GetControl(v89); - v16 = v15; - v17 = v15->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v85->classType][v17] || v85->pActiveSkills[v17] ) - { - v16->uW = 0; - v16->uHeight = 0; - v16->uY = 0; - } - else - { - v18 = pSkillNames[v17]; - v16->uY = (unsigned int)((char *)pOutString + v83); - Str[1] = v18; - v19 = pFontArrus->CalcTextHeight(v18, &v79, 0, 0); - v20 = v16->uY; - v21 = v86; - v16->uHeight = v19; - v22 = v19 + v20 - 1; - v16->uW = v22; - v83 = v22; - v23 = v84[0]; - if ( pDialogueWindow->pCurrentPosActiveItem != v21 ) - v23 = v81; - v79.DrawTitleText(pFontArrus, 0, v20, v23, Str[1], 3u); - } - v24 = v8->pNumPresenceButton; - ++v89; - v25 = v8->pStartingPosActiveItem + v24; - ++v86; - } - while ( v89 < v25 ); - } - return; - } - } - v26 = pTmpBuf; - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v85->pName, pClassNames[v85->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v71 = 3; - v69 = v26; - v67 = v84[0]; - v66 = (174 - pFontArrus->CalcTextHeight(v26, &v79, 0, 0)) / 2 + 138; - v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); - return; - break; - } - case 16: - { - *(_QWORD *)Str = pParty->uNumFoodRations; - //if ( (double)pParty->uNumFoodRations >= p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C] ) - if ( (double)pParty->uNumFoodRations >= p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[140], 2u); - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_67, 0); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); - return; - } - if ( pParty->uNumGold >= v7 ) - { - Party::TakeGold(v7); - //pParty->uNumFoodRations = (signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; - pParty->uNumFoodRations = (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 3); - v5 = 1; -//LABEL_43: - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); - return; - //goto LABEL_51; - } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 4); - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, v5, 0); - break; - } - case 1: - { - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v28 = *(int *)v84; - if ( pDialogueWindow->pCurrentPosActiveItem != 2 ) - v28 = v81; - sprintf(Dest, format_4E2DC8, v28); - sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[178], pOutString); - strcat(Dest, pTmpBuf2); - v90 = pFontArrus->CalcTextHeight(Dest, &v79, 0, 0); - strcat(Dest, "\n \n"); - v29 = *(int *)v84; - if ( pDialogueWindow->pCurrentPosActiveItem != 3 ) - v29 = v81; - sprintf(a1, format_4E2DC8, v29); - sprintf(pTmpBuf2, - pGlobalTXT_LocalizationStrings[86], - //(signed __int64)p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C], - (signed __int64)p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier, - v83); - strcat(a1, pTmpBuf2); - v88 = pFontArrus->CalcTextHeight(a1, &v79, 0, 0); - strcat(a1, "\n \n"); - v30 = *(int *)v84; - if ( pDialogueWindow->pCurrentPosActiveItem != 4 ) - v30 = v81; - sprintf(v77, format_4E2DC8, v30); - strcat(v77, pGlobalTXT_LocalizationStrings[160]); - v82 = pFontArrus->CalcTextHeight(v77, &v79, 0, 0); - strcat(v77, "\n \n"); - v75[0] = 0; - v87 = 0; - v31 = (signed int)window_SpeakInHouse->ptr_1C; - if ( v31 >= 108 && v31 <= 120 ) - { - v32 = *(int *)v84; - if ( pDialogueWindow->pCurrentPosActiveItem != 5 ) - v32 = v81; - sprintf(v75, format_4E2DC8, v32); - strcat(v75, pGlobalTXT_LocalizationStrings[611]); - v87 = pFontArrus->CalcTextHeight(v75, &v79, 0, 0); - } - v33 = pDialogueWindow; - Str[1] = (char *)pDialogueWindow; - v34 = pDialogueWindow->pStartingPosActiveItem; - v35 = v34 + pDialogueWindow->pNumPresenceButton; - v36 = LOBYTE(pFontArrus->uFontHeight) - 3; - v37 = -pDialogueWindow->pNumPresenceButton < 0; - pOutString = (GUIFont *)pDialogueWindow->pStartingPosActiveItem; - if ( !(v37 ^ __OFSUB__(v34, v35)) ) - { - //LABEL_75: - sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); - v71 = 3; - v69 = pTmpBuf; - v67 = 0; - v66 = 146; - //LABEL_98: - v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); - return; - } - while ( 1 ) - { - v38 = v33->GetControl((unsigned int)pOutString); - if ( v38->uControlParam == 15 ) - { - v46 = v90; - v38->uHeight = v90; - v38->uY = 146; - v41 = v46 + 145; - v38->uW = v41; - } - else if ( v38->uControlParam == 16 ) - { - v44 = v88; - v45 = v90 + v36 + 146; - v38->uHeight = v88; - v38->uY = v45; - v41 = v45 + v44 - 1; - v38->uW = v41; - } - else if ( v38->uControlParam == 96 ) - { - v42 = v90 + v88 + 2 * v36 + 146; - v43 = v82; - v38->uY = v42; - v38->uHeight = v43; - v41 = v43 + v42 - 1; - v38->uW = v41; - } - else if ( v38->uControlParam == 101 ) - { - v39 = v90 + 3 * v36 + v87 + v88 + 146; - v33 = (GUIWindow *)Str[1]; - v40 = v87; - v38->uHeight = v87; - v38->uY = v39; - v41 = v39 + v40 - 1; - //LABEL_73: - v38->uW = v41; - } - v47 = v33->pStartingPosActiveItem; - pOutString = (GUIFont *)((char *)pOutString + 1); - if ( (signed int)pOutString >= v33->pNumPresenceButton + v47 ) - { - sprintf(pTmpBuf, "%s%s%s%s", &Dest, &a1, &v77, &v75); - v71 = 3; - v69 = pTmpBuf; - v67 = 0; - v66 = 146; - v79.DrawTitleText(pFontArrus, 0, v66, v67, v69, v71); - return; - } - } - break; - } - case 101: - { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v48 = 2; - pShopOptions[0] = pGlobalTXT_LocalizationStrings[620]; - pOutString = 0; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[622]; - if ( pParty->HasItem(0x28Bu) ) - { - pShopOptions[2] = pGlobalTXT_LocalizationStrings[621]; - v48 = 3; - } - for ( i = 0; i < v48; ++i ) - { - v50 = pFontArrus->CalcTextHeight(pShopOptions[i], &v79, 0, 0); - pOutString = (GUIFont *)((char *)pOutString + v50); - } - v86 = (174 - (signed int)pOutString) / v48; - v51 = pDialogueWindow; - v52 = 174 - v48 * (174 - (signed int)pOutString) / v48 - (signed int)pOutString; - v53 = v52 - HIDWORD(v52); - LODWORD(v52) = pDialogueWindow->pStartingPosActiveItem; - HIDWORD(v52) = v52 + pDialogueWindow->pNumPresenceButton; - v54 = (v53 >> 1) - v86 / 2 + 138; - v37 = -pDialogueWindow->pNumPresenceButton < 0; - v89 = pDialogueWindow->pStartingPosActiveItem; - if ( v37 ^ __OFSUB__((int)v52, HIDWORD(v52)) ) - { - v85 = (Player *)2; - pOutString = (GUIFont *)pShopOptions; - do - { - v55 = v51->GetControl(v89); - v56 = (const char **)pOutString; - v55->uY = v86 + v54; - v57 = pFontArrus->CalcTextHeight(*v56, &v79, 0, 0); - v58 = v55->uY; - v59 = v85; - v55->uHeight = v57; - v54 = v57 + v58 - 1; - v55->uW = v54; - v60 = v84[0]; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v59 ) - v60 = v81; - v79.DrawTitleText(pFontArrus, 0, v58, v60, *(const char **)&pOutString->cFirstChar, 3u); - v51 = pDialogueWindow; - v85 = (Player *)((char *)v85 + 1); - pOutString = (GUIFont *)((char *)pOutString + 4); - ++v89; - } - while ( v89 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - } - break; - } - default: - { - break; - } - } -} - - -//----- (004B910F) -------------------------------------------------------- -char *__cdecl WeaponShopDialog() -{ - Player *v0; // ebx@1 - char *result; // eax@6 - signed int v2; // esi@8 - unsigned int v3; // ebx@10 - ItemGen *v4; // eax@11 - char *v5; // ecx@12 - unsigned __int8 v6; // dl@13 - char *v7; // edx@14 - int v8; // eax@15 - int v9; // ST08_4@16 - int v10; // eax@16 - signed int v11; // esi@18 - int v12; // ST08_4@21 - int v13; // eax@21 - int v14; // edi@23 - char **v15; // esi@23 - int v16; // eax@24 - GUIWindow *v17; // ecx@25 - int v18; // edx@25 - int v19; // edi@25 - unsigned __int8 v20; // sf@25 - GUIButton *v21; // esi@27 - const char **v22; // eax@27 - int v23; // eax@27 - unsigned int v24; // ecx@27 - int v25; // edx@27 - unsigned __int16 v26; // ax@27 - signed int v27; // esi@32 - int v28; // ST08_4@36 - int v29; // eax@36 - GUIWindow *v30; // edi@41 - void *v31; // eax@41 - signed int v32; // esi@41 - unsigned int v33; // esi@43 - int v34; // eax@43 - unsigned int v35; // eax@44 - int v36; // eax@46 - __int32 v37; // ecx@51 - GUIButton *v38; // eax@53 - GUIButton *v39; // esi@53 - int v40; // eax@53 - char *v41; // eax@55 - int v42; // eax@55 - unsigned int v43; // ecx@55 - const char **v44; // edx@55 - int v45; // eax@55 - unsigned __int16 v46; // ax@55 - int v47; // eax@59 - const char **v48; // eax@63 - unsigned int v49; // esi@65 - Texture *v50; // eax@65 - int v51; // edi@65 - int v52; // esi@70 - Texture *v53; // ST1C_4@70 - int v54; // edi@70 - signed int v55; // ecx@73 - SHORT v56; // di@82 - bool v57; // eax@82 - const char *v58; // ecx@84 - POINT *v59; // esi@89 - LONG v60; // ecx@90 - int v61; // eax@90 - int v62; // ecx@90 - ItemGen *v63; // esi@90 - int v64; // eax@95 - int v65; // esi@96 - char **v66; // edi@96 - int v67; // eax@97 - GUIWindow *v68; // ecx@98 - int v69; // edx@98 - int v70; // edi@98 - GUIButton *v71; // esi@100 - const char **v72; // eax@100 - int v73; // eax@100 - unsigned int v74; // ecx@100 - Player *v75; // edx@100 - unsigned __int16 v76; // ax@100 - GUIWindow *v77; // [sp-18h] [bp-110h]@14 - int v78; // [sp-14h] [bp-10Ch]@14 - ItemGen *v79; // [sp-10h] [bp-108h]@12 - int v80; // [sp-10h] [bp-108h]@14 - void *v81; // [sp-Ch] [bp-104h]@12 - unsigned __int16 v82; // [sp-Ch] [bp-104h]@14 - int v83; // [sp-8h] [bp-100h]@11 - char *v84; // [sp-8h] [bp-100h]@14 - __int64 *v85; // [sp-4h] [bp-FCh]@11 - unsigned int v86; // [sp-4h] [bp-FCh]@14 - POINT v87; // [sp+Ch] [bp-ECh]@8 - POINT v88; // [sp+14h] [bp-E4h]@18 - POINT v89; // [sp+1Ch] [bp-DCh]@89 - POINT v90; // [sp+24h] [bp-D4h]@19 - POINT v91; // [sp+2Ch] [bp-CCh]@89 - POINT v92; // [sp+34h] [bp-C4h]@9 - POINT v93; // [sp+3Ch] [bp-BCh]@33 - POINT v94; // [sp+44h] [bp-B4h]@18 - POINT v95; // [sp+4Ch] [bp-ACh]@32 - POINT v96; // [sp+54h] [bp-A4h]@18 - POINT v97; // [sp+5Ch] [bp-9Ch]@32 - POINT a2; // [sp+64h] [bp-94h]@8 - POINT v99; // [sp+6Ch] [bp-8Ch]@32 - POINT v100; // [sp+74h] [bp-84h]@8 - GUIWindow v101; // [sp+7Ch] [bp-7Ch]@1 - char *Str; // [sp+D0h] [bp-28h]@55 - __int32 v103; // [sp+D4h] [bp-24h]@25 - int v104; // [sp+D8h] [bp-20h]@1 - int v105; // [sp+DCh] [bp-1Ch]@1 - POINT v106; // [sp+E0h] [bp-18h]@8 - Player *_this; // [sp+E8h] [bp-10h]@1 - int v108; // [sp+ECh] [bp-Ch]@26 - const char **v109; // [sp+F0h] [bp-8h]@26 - unsigned __int8 v110; // [sp+F7h] [bp-1h]@16 - - v0 = pPlayers[uActiveCharacter]; - _this = pPlayers[uActiveCharacter]; - memcpy(&v101, window_SpeakInHouse, sizeof(v101)); - v101.uFrameX = 483; - v101.uFrameWidth = 148; - v101.uFrameZ = 334; - v105 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v104 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - switch(dword_F8B19C) - { - case 94: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179]; - v65 = 0; - v66 = pShopOptions; - do - { - v67 = pFontArrus->CalcTextHeight(*v66, &v101, 0, 0); - ++v66; - v65 += v67; - } - while ( (signed int)v66 < (signed int)&pShopOptions[3] ); - v68 = pDialogueWindow; - v109 = (const char **)((174 - v65) / 3); - result = (char *)pDialogueWindow->pStartingPosActiveItem; - v69 = (int)&result[pDialogueWindow->pNumPresenceButton]; - v70 = (3 * (58 - (signed int)v109) - v65) / 2 - (174 - v65) / 3 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - v106.y = pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ __OFSUB__((int)result, (int)v69) ) - { - _this = (Player *)2; - v108 = (int)pShopOptions; - do - { - v71 = v68->GetControl(v106.y); - v72 = (const char **)v108; - v71->uY = (unsigned int)((char *)v109 + v70); - v73 = pFontArrus->CalcTextHeight(*v72, &v101, 0, 0); - v74 = v71->uY; - v75 = _this; - v71->uHeight = v73; - v70 = v73 + v74 - 1; - v71->uW = v70; - v76 = v104; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v75 ) - v76 = v105; - v101.DrawTitleText(pFontArrus, 0, v74, v76, *(const char **)v108, 3u); - v68 = pDialogueWindow; - _this = (Player *)((char *)_this + 1); - v108 += 4; - ++v106.y; - result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); - } - while ( v106.y < (signed int)result ); - } - break; - } - case 96: - { - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v30 = pDialogueWindow; - v3 = 0; - v31 = window_SpeakInHouse->ptr_1C; - v106.y = 0; - //v32 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v31] * 500.0); - v32 = (signed __int64)(p2DEvents[(signed int)v31 - 1].flt_24 * 500.0); - v108 = v32 * (100 - _this->GetMerchant()) / 100; - if ( v108 < v32 / 3 ) - v108 = v32 / 3; - v33 = v30->pStartingPosActiveItem; - v34 = v33 + v30->pNumPresenceButton; - v109 = 0; - if ( (signed int)v33 >= v34 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v7 = pTmpBuf; - v86 = 3; - v84 = pTmpBuf; - v82 = v104; - v80 = 0; - v78 = 0; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - do - { - v35 = v30->GetControl(v33)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v35] && !_this->pActiveSkills[v35] ) - { - v36 = pFontArrus->CalcTextHeight(pSkillNames[v35], &v101, 0, 0); - v106.y += v36; - v109 = (const char **)((char *)v109 + 1); - } - ++v33; - } - while ( (signed int)v33 < v30->pNumPresenceButton + v30->pStartingPosActiveItem ); - if ( !v109 ) - { -//LABEL_105: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v7 = pTmpBuf; - v86 = 3; - v84 = pTmpBuf; - v82 = v104; - v80 = 0; - v78 = 0; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v108); - v101.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v108 = (149 - v106.y) / (signed int)v109; - if ( (149 - v106.y) / (signed int)v109 > 32 ) - v108 = 32; - result = (char *)v30->pStartingPosActiveItem; - v37 = (149 - (signed int)v109 * v108 - v106.y) / 2 - v108 / 2 + 162; - v106.y = (LONG)result; - v103 = v37; - if ( (signed int)result < (signed int)&result[v30->pNumPresenceButton] ) - { - v109 = (const char **)2; - do - { - v38 = v30->GetControl(v106.y); - v39 = v38; - v40 = v38->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v40] || _this->pActiveSkills[v40] ) - { - v39->uW = 0; - v39->uHeight = 0; - v39->uY = 0; - } - else - { - v41 = pSkillNames[v40]; - v39->uY = v108 + v103; - Str = v41; - v42 = pFontArrus->CalcTextHeight(v41, &v101, 0, 0); - v43 = v39->uY; - v44 = v109; - v39->uHeight = v42; - v45 = v43 + v42 - 1; - v39->uW = v45; - v103 = v45; - v46 = v104; - if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v44 ) - v46 = v105; - v101.DrawTitleText(pFontArrus, 0, v43, v46, Str, 3u); - } - v47 = v30->pStartingPosActiveItem; - ++v106.y; - result = (char *)(v30->pNumPresenceButton + v47); - v109 = (const char **)((char *)v109 + 1); - } - while ( v106.y < (signed int)result ); - } - } - break; - } - case 95: - { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v3 = 0; - v109 = 0; - v108 = 0; - do - { - // if ( pParty->field_C59C[9 * (int)&v109[3 * (unsigned int)window_SpeakInHouse->ptr_1C] + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(signed int)v109].uItemID) - { - v52 = word_F8B158[(signed int)v109] + 30; - 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], - ItemsInShopTexture[(signed int)v109], - (int)((char *)v109 + 1)); - } - v109 = (const char **)((char *)v109 + 1); - v108 += 70; - } - while ( (signed int)v109 < 6 ); - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v55 = 0; - v106.x = 0; - do - { - // if ( pParty->field_C59C[9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID) - ++v106.x; - ++v55; - } - while ( v55 < 6 ); - v56 = GetAsyncKeyState(17); - v57 = _this->CanSteal(); - Str = (char *)v57; - if ( v56 && v57 ) - { - v58 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dword_F8B19C != 2 ) - v58 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v58, 0); - if ( v106.x ) - { - v59 = pMouse->GetCursorPos(&v91); - result = (char *)(v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]); - if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) - { - v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; - v106.x = v60; - v61 = (int)window_SpeakInHouse->ptr_1C; - // v62 = 9 * (v60 + 12 * v61); - v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dword_F8B19C != 2 ) - v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; - if ( !v56 || !Str ) - { - v85 = 0; - v83 = 2; - v81 = window_SpeakInHouse->ptr_1C; - v79 = v63; - v110 = uActiveCharacter - 1; - v64 = _this->_490EEE(v63, 1, v61, 2); - v6 = v110; - v5 = (char *)pMerchantsBuyPhrases[v64]; - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - v5 = pGlobalTXT_LocalizationStrings[181]; - v85 = 0; - v83 = 2; - v81 = window_SpeakInHouse->ptr_1C; - v79 = v63; - v6 = uActiveCharacter - 1; - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - } - else - { - v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - result =0; //added - } - } - break; - } - case 2: - { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v3 = 0; - v48 = 0; - v108 = 0; - v109 = 0; - do - { - // if ( pParty->field_777C[9 * (int)&v48[3 * (unsigned int)window_SpeakInHouse->ptr_1C]] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][(int)v48].uItemID); - { - v49 = word_F8B158[(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], - ItemsInShopTexture[(signed int)v109], - (int)((char *)v109 + 1)); - v48 = v109; - } - v108 += 70; - v48 = (const char **)((char *)v48 + 1); - v109 = v48; - } - while ( (signed int)v48 < 6 ); - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v55 = 0; - v106.x = 0; - v106.x = 0; - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v55].uItemID);//9 * (v55 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - ++v106.x; - ++v55; - } - while ( v55 < 6 ); - v56 = GetAsyncKeyState(17); - v57 = _this->CanSteal(); - Str = (char *)v57; - if ( v56 && v57 ) - { - v58 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v58 = pGlobalTXT_LocalizationStrings[195]; - if ( dword_F8B19C != 2 ) - v58 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v58, 0); - if ( v106.x ) - { - v59 = pMouse->GetCursorPos(&v91); - result = (char *)(v59->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v89)->y]); - if ( pRenderer->pActiveZBuffer[(int)result] & 0xFFFF ) - { - v60 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; - v106.x = v60; - v61 = (int)window_SpeakInHouse->ptr_1C; - // v62 = 9 * (v60 + 12 * v61); - v63 = (ItemGen *)&pParty->StandartItemsInShops[(int)v61][v60]; - if ( dword_F8B19C != 2 ) - v63 = &pParty->SpecialItemsInShops[(int)v61][v60];//v63 = (ItemGen *)&pParty->field_C59C[v62 + 724]; - if ( !v56 || !Str ) - { - v85 = 0; - v83 = 2; - v81 = window_SpeakInHouse->ptr_1C; - v79 = v63; - v110 = uActiveCharacter - 1; - v64 = _this->_490EEE(v63, 1, v61, 2); - v6 = v110; - v5 = (char *)pMerchantsBuyPhrases[v64]; - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - v5 = pGlobalTXT_LocalizationStrings[181]; - v85 = 0; - v83 = 2; - v81 = window_SpeakInHouse->ptr_1C; - v79 = v63; - v6 = uActiveCharacter - 1; - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - } - else - { - v101.DrawCurrentTime( pParty->field_3C.field_50[(unsigned int)window_SpeakInHouse->ptr_1C] - pParty->uTimePlayed); - result =0; //added - } - } - break; - } - case 3: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[199], 0); - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v11 = pMouse->GetCursorPos(&v96)->x - 14; - v106.x = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v88)->y - 17) >> 5); - result = (char *)pMouse->GetCursorPos(&v94); - if ( *(int *)result > 13 ) - { - result = (char *)pMouse->GetCursorPos(&v90); - if ( *(int *)result < 462 ) - { - result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x); - v3 = 0; - if ( result ) - { - v85 = 0; - v83 = 3; - v81 = window_SpeakInHouse->ptr_1C; - v79 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - v12 = (int)window_SpeakInHouse->ptr_1C; - v110 = uActiveCharacter - 1; - v13 = _this->_490EEE(v79, 1, v12, 3); - v6 = v110; - v5 = (char *)pMerchantsSellPhrases[v13]; - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - } - } - } - break; - } - case 4: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - DrawTextAtStatusBar(pGlobalTXT_LocalizationStrings[197], 0); - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v2 = pMouse->GetCursorPos(&a2)->x - 14; - v106.x = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v87)->y - 17) >> 5); - result = (char *)pMouse->GetCursorPos(&v100); - if ( *(int *)result > 13 ) - { - result = (char *)pMouse->GetCursorPos(&v92); - if ( *(int *)result < 462 ) - { - result = (char *)v0->GetItemIDAtInventoryIndex((int *)&v106.x); - v3 = 0; - if ( result ) - { - v85 = 0; - v83 = 4; - v4 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - if (!v4->Identified()) - { - v81 = window_SpeakInHouse->ptr_1C; - v79 = v4; - v9 = (int)window_SpeakInHouse->ptr_1C; - v110 = uActiveCharacter - 1; - v10 = _this->_490EEE(v4, 1, v9, 4); - v6 = v110; - v5 = (char *)pMerchantsIdentifyPhrases[v10]; - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - v81 = window_SpeakInHouse->ptr_1C; - v5 = "%24"; - v79 = v4; - //LABEL_13: - v6 = uActiveCharacter - 1; - //LABEL_14: - v7 = BuilDialogueString(v5, v6, v79, (char *)v81, v83, v85); - v86 = 3; - v84 = v7; - v82 = v105; - v80 = v3; - v78 = v3; - v77 = &v101; - //LABEL_15: - v8 = pFontArrus->CalcTextHeight(v7, v77, v78, v80); - return v101.DrawTitleText(pFontArrus, v3, (174 - v8) / 2 + 138, v82, v84, v86); - } - } - } - } - break; - } - case 1: - { - result = (char *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; - v14 = 0; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - v15 = pShopOptions; - do - { - v16 = pFontArrus->CalcTextHeight(*v15, &v101, 0, 0); - ++v15; - v14 += v16; - } - while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); - v17 = pDialogueWindow; - v103 = (174 - v14) / 4; - result = (char *)pDialogueWindow->pStartingPosActiveItem; - v18 = (int)&result[pDialogueWindow->pNumPresenceButton]; - v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - _this = (Player *)pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ __OFSUB__((int)result, v18) ) - { - v108 = 2; - v109 = (const char **)pShopOptions; - do - { - v21 = v17->GetControl((unsigned int)_this); - v22 = v109; - v21->uY = v103 + v19; - v23 = pFontArrus->CalcTextHeight(*v22, &v101, 0, 0); - v24 = v21->uY; - v25 = v108; - v21->uHeight = v23; - v19 = v24 + v23 - 1; - v21->uW = v19; - v26 = v104; - if ( pDialogueWindow->pCurrentPosActiveItem != v25 ) - v26 = v105; - v101.DrawTitleText(pFontArrus, 0, v24, v26, *v109, 3u); - v17 = pDialogueWindow; - ++v108; - ++v109; - _this = (Player *)((char *)_this + 1); - result = (char *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); - } - while ( (signed int)_this < (signed int)result ); - } - } - break; - } - default: - { - if( dword_F8B19C > 5 ) - result = (char *)(dword_F8B19C - 96); - else - result = (char *)(dword_F8B19C - 4); - break; - } - } - return result; -} - - -//----- (004B9CC6) -------------------------------------------------------- -POINT *__cdecl AlchemistDialog() -{ - Player *v0; // ebx@1 - POINT *result; // eax@7 - GUIWindow *v2; // edi@9 - unsigned int v3; // ebx@9 - void *v4; // eax@9 - signed int v5; // esi@9 - unsigned int v6; // esi@11 - int v7; // eax@11 - unsigned int v8; // eax@12 - int v9; // eax@14 - int v10; // ecx@19 - GUIButton *v11; // eax@21 - GUIButton *v12; // esi@21 - int v13; // eax@21 - char *v14; // eax@23 - int v15; // eax@23 - unsigned int v16; // ecx@23 - int v17; // edx@23 - int v18; // eax@23 - unsigned __int16 v19; // ax@23 - int v20; // eax@27 - char *v21; // edx@29 - int v22; // esi@30 - char **v23; // edi@30 - int v24; // eax@31 - GUIWindow *v25; // ecx@32 - int v26; // edx@32 - int v27; // edi@32 - unsigned __int8 v28; // sf@32 - GUIButton *v29; // esi@34 - const char **v30; // eax@34 - int v31; // eax@34 - unsigned int v32; // ecx@34 - Player *v33; // edx@34 - int v34; // eax@34 - unsigned __int16 v35; // ax@34 - signed int v36; // esi@39 - ItemGen *v37; // eax@42 - char *v38; // ecx@43 - unsigned __int8 v39; // dl@44 - int v40; // eax@46 - int v41; // ST08_4@47 - int v42; // eax@47 - signed int v43; // esi@49 - int v44; // ST08_4@52 - int v45; // eax@52 - Texture *v46; // ecx@55 - unsigned int v47; // edi@55 - unsigned int v48; // esi@57 - int v49; // edx@61 - Texture *v50; // ecx@67 - unsigned int v51; // edi@67 - unsigned int v52; // esi@69 - int v53; // edx@73 - Texture *v54; // ecx@79 - unsigned int v55; // edi@79 - unsigned int v56; // esi@81 - int v57; // edx@85 - Texture *v58; // ecx@91 - unsigned int v59; // edi@91 - unsigned int v60; // esi@93 - int v61; // edx@97 - signed int v62; // ecx@102 - SHORT v63; // di@110 - bool v64; // eax@110 - const char *v65; // ecx@112 - POINT *v66; // esi@117 - int v67; // ecx@118 - int v68; // eax@118 - int v69; // ecx@118 - ItemGen *v70; // esi@118 - int v71; // eax@123 - int v72; // edi@125 - char **v73; // esi@125 - int v74; // eax@126 - GUIWindow *v75; // ecx@127 - int v76; // edx@127 - int v77; // edi@127 - GUIButton *v78; // esi@129 - const char **v79; // eax@129 - int v80; // eax@129 - unsigned int v81; // ecx@129 - Player *v82; // edx@129 - unsigned __int16 v83; // ax@129 - GUIWindow *v84; // [sp-18h] [bp-F0h]@29 - int v85; // [sp-14h] [bp-ECh]@29 - int v86; // [sp-10h] [bp-E8h]@29 - ItemGen *v87; // [sp-10h] [bp-E8h]@43 - unsigned __int16 v88; // [sp-Ch] [bp-E4h]@29 - void *v89; // [sp-Ch] [bp-E4h]@43 - char *v90; // [sp-8h] [bp-E0h]@29 - int v91; // [sp-8h] [bp-E0h]@42 - unsigned int v92; // [sp-4h] [bp-DCh]@29 - __int64 *v93; // [sp-4h] [bp-DCh]@42 - POINT v94; // [sp+Ch] [bp-CCh]@39 - POINT v95; // [sp+14h] [bp-C4h]@49 - POINT v96; // [sp+1Ch] [bp-BCh]@117 - POINT v97; // [sp+24h] [bp-B4h]@40 - POINT v98; // [sp+2Ch] [bp-ACh]@117 - POINT v99; // [sp+34h] [bp-A4h]@49 - POINT v100; // [sp+3Ch] [bp-9Ch]@50 - POINT v101; // [sp+44h] [bp-94h]@39 - POINT v102; // [sp+4Ch] [bp-8Ch]@49 - POINT a2; // [sp+54h] [bp-84h]@39 - GUIWindow v104; // [sp+5Ch] [bp-7Ch]@1 - int v105; // [sp+B0h] [bp-28h]@19 - int v106; // [sp+B4h] [bp-24h]@1 - char *Str; // [sp+B8h] [bp-20h]@23 - int v108; // [sp+BCh] [bp-1Ch]@1 - __int32 v109; // [sp+C0h] [bp-18h]@39 - Player *_this; // [sp+C4h] [bp-14h]@1 - const char **v111; // [sp+C8h] [bp-10h]@9 - unsigned int v112; // [sp+CCh] [bp-Ch]@9 - unsigned __int8 v113; // [sp+D3h] [bp-5h]@47 - int v114; // [sp+D4h] [bp-4h]@11 - - v0 = pPlayers[uActiveCharacter]; - _this = pPlayers[uActiveCharacter]; - memcpy(&v104, window_SpeakInHouse, sizeof(v104)); - v104.uFrameX = 483; - v104.uFrameWidth = 148; - v104.uFrameZ = 334; - v108 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - v106 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - switch(dword_F8B19C) - { - case 1: - { - result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152]; - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159]; - v72 = 0; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160]; - v73 = pShopOptions; - do - { - v74 = pFontArrus->CalcTextHeight(*v73, &v104, 0, 0); - ++v73; - v72 += v74; - } - while ( (signed int)v73 < (signed int)&unk_F8B1C8 ); - v75 = pDialogueWindow; - Str = (char *)((174 - v72) / 4); - result = (POINT *)pDialogueWindow->pStartingPosActiveItem; - v76 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); - v77 = (174 - 4 * (174 - v72) / 4 - v72) / 2 - (174 - v72) / 4 / 2 + 138; - v28 = -pDialogueWindow->pNumPresenceButton < 0; - v112 = pDialogueWindow->pStartingPosActiveItem; - if ( v28 ^ __OFSUB__((int)result, v76) ) - { - _this = (Player *)2; - v111 = (const char **)pShopOptions; - do - { - v78 = v75->GetControl(v112); - v79 = v111; - v78->uY = (unsigned int)&Str[v77]; - v80 = pFontArrus->CalcTextHeight(*v79, &v104, 0, 0); - v81 = v78->uY; - v82 = _this; - v78->uHeight = v80; - v77 = v81 + v80 - 1; - v78->uW = v77; - v83 = v106; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v82 ) - v83 = v108; - v104.DrawTitleText(pFontArrus, 0, v81, v83, *v111, 3u); - v75 = pDialogueWindow; - _this = (Player *)((char *)_this + 1); - ++v111; - ++v112; - result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); - } - while ( (signed int)v112 < (signed int)result ); - } - } - return result; - } - case 3: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - 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, - v109 = (v43 >> 5) + 14 * ((pMouse->GetCursorPos(&v95)->y - 17) >> 5), - result = pMouse->GetCursorPos(&v102), - result->x <= 13) - || (result = pMouse->GetCursorPos(&v100), result->x >= 462) - || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) - return result; - v93 = 0; - v91 = 3; - v89 = window_SpeakInHouse->ptr_1C; - v87 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - v44 = (int)window_SpeakInHouse->ptr_1C; - v113 = uActiveCharacter - 1; - v45 = _this->_490EEE(v87, 4, v44, 3); - v39 = v113; - v38 = (char *)pMerchantsSellPhrases[v45]; - v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); - v92 = 3; - v90 = v21; - v88 = v108; - v86 = v3; - v85 = v3; - v84 = &v104; - v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); - return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); - } - case 4: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - 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, - v109 = (v36 >> 5) + 14 * ((pMouse->GetCursorPos(&v94)->y - 17) >> 5), - result = pMouse->GetCursorPos(&v101), - result->x <= 13) - || (result = pMouse->GetCursorPos(&v97), result->x >= 462) - || (result = (POINT *)v0->GetItemIDAtInventoryIndex((int *)&v109), v3 = 0, !result) ) - return result; - v93 = 0; - v91 = 4; - v37 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[36 * (int)result + 5]; - if (!v37->Identified()) - { - v89 = window_SpeakInHouse->ptr_1C; - v87 = v37; - v41 = (int)window_SpeakInHouse->ptr_1C; - v113 = uActiveCharacter - 1; - v42 = _this->_490EEE(v37, 4, v41, 4); - v39 = v113; - v38 = (char *)pMerchantsIdentifyPhrases[v42]; - } - else - { - v89 = window_SpeakInHouse->ptr_1C; - v38 = "%24"; - v87 = v37; - v39 = uActiveCharacter - 1; - } - v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); - v92 = 3; - v90 = v21; - v88 = v108; - v86 = v3; - v85 = v3; - v84 = &v104; - v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); - return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); - } - case 94: - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200]; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113]; - v22 = 0; - v23 = pShopOptions; - do - { - v24 = pFontArrus->CalcTextHeight(*v23, &v104, 0, 0); - ++v23; - v22 += v24; - } - while ( (signed int)v23 < (signed int)&pShopOptions[2] ); - Str = (char *)((174 - v22) / 2); - v25 = pDialogueWindow; - result = (POINT *)pDialogueWindow->pStartingPosActiveItem; - v26 = (int)((char *)result + pDialogueWindow->pNumPresenceButton); - v27 = (2 * (87 - (174 - v22) / 2) - v22) / 2 - (174 - v22) / 2 / 2 + 138; - v28 = -pDialogueWindow->pNumPresenceButton < 0; - v112 = pDialogueWindow->pStartingPosActiveItem; - if ( v28 ^ __OFSUB__((int)result, v26) ) - { - _this = (Player *)2; - v111 = (const char **)pShopOptions; - do - { - v29 = v25->GetControl(v112); - v30 = v111; - v29->uY = (unsigned int)&Str[v27]; - v31 = pFontArrus->CalcTextHeight(*v30, &v104, 0, 0); - v32 = v29->uY; - v33 = _this; - v29->uHeight = v31; - v34 = v31 + v32 - 1; - v29->uW = v34; - v27 = v34; - v35 = v106; - if ( (Player *)pDialogueWindow->pCurrentPosActiveItem != v33 ) - v35 = v108; - v104.DrawTitleText(pFontArrus, 0, v32, v35, *v111, 3u); - v25 = pDialogueWindow; - _this = (Player *)((char *)_this + 1); - ++v111; - ++v112; - result = (POINT *)(pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem); - } - while ( (signed int)v112 < (signed int)result ); - } - return result; - } - case 2: - { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v3 = 0; - v114 = 0; - do - { - // 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 = ItemsInShopTexture[v114]; - v47 = 152 - v46->uTextureHeight; - if ( (signed int)v47 < 1 ) - v47 = 0; - v48 = 75 * v114 - v46->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v49 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v48 > 457 - v49 ) - v48 = 457 - v49; - } - } - else if ( (signed int)v48 < 18 ) - v48 = 18; - pRenderer->DrawTextureTransparent(v48, v47, v46); - sub_40F92A(&pRenderer->pActiveZBuffer[v48 + 640 * v47], ItemsInShopTexture[v114], v114 + 1); - } - ++v114; - } - while ( v114 < 6 ); - v114 = 0; - do - { - // 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 = ItemsInShopTexture[v114 + 6]; - v51 = 308 - v50->uTextureHeight; - if ( (signed int)v51 < 1 ) - v51 = 0; - v52 = 75 * v114 - v50->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v53 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v52 > 457 - v53 ) - v52 = 457 - v53; - } - } - else - { - if ( (signed int)v52 < 18 ) - v52 = 18; - } - pRenderer->DrawTextureTransparent(v52, v51, v50); - sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v114 + 6], v114 + 7); - } - ++v114; - } - while ( v114 < 6 ); - result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v62 = 0; - v109 = 0; - do - { - // if ( pParty->field_777C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID); - ++v109; - ++v62; - } - while ( v62 < 12 ); - v63 = GetAsyncKeyState(17); - v64 = _this->CanSteal(); - Str = (char *)v64; - if ( v63 && v64 ) - { - v65 = pGlobalTXT_LocalizationStrings[185]; - } - else if ( dword_F8B19C == 2 ) - { - v65 = pGlobalTXT_LocalizationStrings[195]; - } - else - { - v65 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v65, 0); - if ( !v109 ) - { - 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 ) - { - v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; - v109 = v67; - v68 = (int)window_SpeakInHouse->ptr_1C; - // v69 = 9 * (v67 + 12 * v68); - v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; - if ( dword_F8B19C != 2 ) - v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; - if ( !v63 || !Str ) - { - v93 = 0; - v91 = 2; - v89 = window_SpeakInHouse->ptr_1C; - v87 = v70; - v113 = uActiveCharacter - 1; - v71 = _this->_490EEE(v70, 4, v68, 2); - v39 = v113; - v38 = (char *)pMerchantsBuyPhrases[v71]; - } - else - { - v38 = pGlobalTXT_LocalizationStrings[181]; - v93 = 0; - v91 = 2; - v89 = window_SpeakInHouse->ptr_1C; - v87 = v70; - v39 = uActiveCharacter - 1; - } - v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); - v92 = 3; - v90 = v21; - v88 = v108; - v86 = v3; - v85 = v3; - v84 = &v104; - v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); - return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); - } - } - return result; - } - case 95: - { - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v3 = 0; - v114 = 0; - do - { - //if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - 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; - v56 = 75 * v114 - v54->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v57 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v56 > 457 - v57 ) - v56 = 457 - v57; - } - } - else - { - if ( (signed int)v56 < 18 ) - v56 = 18; - } - pRenderer->DrawTextureTransparent(v56, v55, v54); - sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v114], v114 + 1); - } - ++v114; - } - while ( v114 < 6 ); - v114 = 0; - do - { - // if ( pParty->field_C59C[9 * (v114 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 778] ) //weak - 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; - v60 = 75 * v114 - v58->uTextureWidth / 2 + 40; - if ( v114 ) - { - if ( v114 == 5 ) - { - v61 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v60 > 457 - v61 ) - v60 = 457 - v61; - } - } - else - { - if ( (signed int)v60 < 18 ) - v60 = 18; - } - pRenderer->DrawTextureTransparent(v60, v59, v58); - sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v114 + 6], v114 + 7); - } - ++v114; - } - while ( v114 < 6 ); - result = (POINT *)sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v62 = 0; - v109 = 0; - do - { - //if ( pParty->field_C59C[9 * (v62 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v62].uItemID) - ++v109; - ++v62; - } - while ( v62 < 12 ); - v63 = GetAsyncKeyState(17); - v64 = _this->CanSteal(); - Str = (char *)v64; - if ( v63 && v64 ) - { - v65 = pGlobalTXT_LocalizationStrings[185]; - } - else - { - v65 = pGlobalTXT_LocalizationStrings[195]; - if ( dword_F8B19C != 2 ) - v65 = pGlobalTXT_LocalizationStrings[196]; - } - DrawTextAtStatusBar(v65, 0); - if ( !v109 ) - { - 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 ) - { - v67 = (pRenderer->pActiveZBuffer[(int)result] & 0xFFFF) - 1; - v109 = v67; - v68 = (int)window_SpeakInHouse->ptr_1C; - // v69 = 9 * (v67 + 12 * v68); - v70 = (ItemGen *)&pParty->StandartItemsInShops[v68][v67]; - if ( dword_F8B19C != 2 ) - v70 = &pParty->SpecialItemsInShops[(int)v68][v67];//v70 = (ItemGen *)&pParty->field_C59C[v69 + 724]; - if ( !v63 || !Str ) - { - v93 = 0; - v91 = 2; - v89 = window_SpeakInHouse->ptr_1C; - v87 = v70; - v113 = uActiveCharacter - 1; - v71 = _this->_490EEE(v70, 4, v68, 2); - v39 = v113; - v38 = (char *)pMerchantsBuyPhrases[v71]; - } - else - { - v38 = pGlobalTXT_LocalizationStrings[181]; - v93 = 0; - v91 = 2; - v89 = window_SpeakInHouse->ptr_1C; - v87 = v70; - v39 = uActiveCharacter - 1; - } - v21 = BuilDialogueString(v38, v39, v87, (char *)v89, v91, v93); - v92 = 3; - v90 = v21; - v88 = v108; - v86 = v3; - v85 = v3; - v84 = &v104; - v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); - return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); - } - } - return result; - } - case 96: - { - if (!sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win()) - return 0; - v2 = pDialogueWindow; - v3 = 0; - v4 = window_SpeakInHouse->ptr_1C; - v112 = 0; - //v5 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v4] * 500.0); - v5 = (signed __int64)(p2DEvents[(signed int)v4 - 1].flt_24 * 500.0); - v111 = (const char **)(v5 * (100 - _this->GetMerchant()) / 100); - if ( (signed int)v111 < v5 / 3 ) - v111 = (const char **)(v5 / 3); - v6 = v2->pStartingPosActiveItem; - v7 = v6 + v2->pNumPresenceButton; - v114 = 0; - if ( (signed int)v6 < v7 ) - { - do - { - v8 = v2->GetControl(v6)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v8] && !_this->pActiveSkills[v8] ) - { - v9 = pFontArrus->CalcTextHeight(pSkillNames[v8], &v104, 0, 0); - v112 += v9; - ++v114; - } - ++v6; - } - while ( (signed int)v6 < v2->pNumPresenceButton + v2->pStartingPosActiveItem ); - if ( v114 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v111); - v104.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v111 = (const char **)((signed int)(149 - v112) / v114); - if ( (signed int)(149 - v112) / v114 > 32 ) - v111 = (const char **)32; - result = (POINT *)v2->pStartingPosActiveItem; - v10 = (signed int)(149 - v114 * (int)v111 - v112) / 2 - (signed int)v111 / 2 + 162; - v112 = (unsigned int)result; - v105 = v10; - if ( (signed int)result < (signed int)((char *)result + v2->pNumPresenceButton) ) - { - v114 = 2; - do - { - v11 = v2->GetControl(v112); - v12 = v11; - v13 = v11->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v13] || _this->pActiveSkills[v13] ) - { - v12->uW = 0; - v12->uHeight = 0; - v12->uY = 0; - } - else - { - v14 = pSkillNames[v13]; - v12->uY = (unsigned int)((char *)v111 + v105); - Str = v14; - v15 = pFontArrus->CalcTextHeight(v14, &v104, 0, 0); - v16 = v12->uY; - v17 = v114; - v12->uHeight = v15; - v18 = v16 + v15 - 1; - v12->uW = v18; - v105 = v18; - v19 = v106; - if ( pDialogueWindow->pCurrentPosActiveItem != v17 ) - v19 = v108; - v104.DrawTitleText(pFontArrus, 0, v16, v19, Str, 3u); - } - v20 = v2->pStartingPosActiveItem; - ++v112; - result = (POINT *)(v2->pNumPresenceButton + v20); - ++v114; - } - while ( (signed int)v112 < (signed int)result ); - } - return result; - } - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v21 = pTmpBuf; - v92 = 3; - v90 = pTmpBuf; - v88 = v106; - v86 = 0; - v85 = 0; - v84 = &v104; - v40 = pFontArrus->CalcTextHeight(v21, v84, v85, v86); - return (POINT *)v104.DrawTitleText(pFontArrus, v3, (174 - v40) / 2 + 138, v88, v90, v92); - } - default: - { - return (POINT *)dword_F8B19C - 96; - } - } -} - - -//----- (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 - int 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 = th; - v26->uHeight = v27; - v23 = v28 + v27 - 1; - v26->uW = v23; - v30 = v147; - if ( 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, ShopTexture); - 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, ShopTexture); - 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, ShopTexture); - - 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) @@ -3364,11 +301,12 @@ pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); pDialogueWindow->CreateButton(480u, 160u, 140u, 30u, 1, 0, 0, 0x53u, 0, "", 0); pDialogueWindow->_41D08F(1, 1, 0, 2); - dword_F8B19C = -1; + dialog_menu_id = -1; v0 = (int)((char *)window_SpeakInHouse->ptr_1C - 102); if ( (signed __int64)__PAIR__(pParty->field_3C.field_0[2 * v0 + 1], pParty->field_3C.field_0[2 * v0]) < (signed __int64)pParty->uTimePlayed ) { pParty->field_75A[v0] = 0; + __debugbreak(); // starting year-related constant here; v1 = (signed __int64)((double)(0x12750000 * (pParty->uCurrentMonth + 12i64 * pParty->uCurrentYear - 14015)) * 0.033333335); pParty->field_3C.field_0[2 * v0] = v1; @@ -3952,7 +890,7 @@ return; pRenderer->ClearZBuffer(0, 479); //v3 = dword_F8B198; - if ( dword_F8B19C != 1 ) + if ( dialog_menu_id != 1 ) { v8 = window_SpeakInHouse; } @@ -4010,7 +948,7 @@ } } //LABEL_11: - dword_F8B19C = uMessageParam; + dialog_menu_id = uMessageParam; if ( in_current_building_type < BildingType_19 ) { v9 = pIcons_LOD->LoadTexture(off_4F03B8[in_current_building_type], TEXTURE_16BIT_PALETTE); @@ -4024,7 +962,7 @@ { if ( in_current_building_type == BildingType_Bank ) { - if ( dword_F8B19C >= 7 && dword_F8B19C <= 8 ) + if ( dialog_menu_id >= 7 && dialog_menu_id <= 8 ) pKeyActionMap->EnterText(1, 10, v8); return; } @@ -4296,10 +1234,10 @@ sub_4B3A72(in_current_building_type); break; case 102: - dword_F8B19C = 102; + dialog_menu_id = 102; break; case 103: - dword_F8B19C = 103; + dialog_menu_id = 103; break; case 104: /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) @@ -4310,7 +1248,7 @@ ++pMessageQueue_50CBD0->uNumMessages; }*/ pMessageQueue_50CBD0->AddMessage(UIMSG_PlayArcomage, v1, v1); - dword_F8B19C = 104; + dialog_menu_id = 104; break; } return; @@ -4319,13 +1257,13 @@ { if ( uMessageParam == 3 ) { - dword_F8B19C = 3; + dialog_menu_id = 3; } else { if ( uMessageParam == 4 ) { - dword_F8B19C = 4; + dialog_menu_id = 4; } else { @@ -4386,7 +1324,7 @@ } return; } - dword_F8B19C = 5; + dialog_menu_id = 5; } } sub_421B2C_PlaceInInventory_or_DropPickedItem(); @@ -4517,16 +1455,16 @@ ptr_F8B1E8 = 0; if ( pDialogueNPCCount ) { - v0 = dword_F8B19C; - if ( dword_F8B19C != 2 - && dword_F8B19C != 3 - && dword_F8B19C != 97 - && dword_F8B19C != 5 - && dword_F8B19C != 4 + v0 = dialog_menu_id; + if ( dialog_menu_id != 2 + && dialog_menu_id != 3 + && dialog_menu_id != 97 + && dialog_menu_id != 5 + && dialog_menu_id != 4 && ShopTexture ) { ShopTexture->Release(); - v0 = dword_F8B19C; + v0 = dialog_menu_id; ShopTexture = 0; } if ( v0 && v0 != 1 ) @@ -4543,7 +1481,7 @@ if ( v0 == 3 || v0 == 5 || v0 == 4 ) { UI_CreateEndConversationButton(); - dword_F8B19C = 94; + dialog_menu_id = 94; sub_4B3AD4(in_current_building_type); } else @@ -4552,26 +1490,26 @@ { pVideoPlayer->_4BF5B2(); //LABEL_28: - dword_F8B19C = 1; + dialog_menu_id = 1; sub_4B3B42(in_current_building_type); return 1; } pVideoPlayer->_4BF5B2(); UI_CreateEndConversationButton(); - dword_F8B19C = 101; + dialog_menu_id = 101; sub_4B3A72(in_current_building_type); } return 1; } pVideoPlayer->_4BF5B2(); UI_CreateEndConversationButton(); - dword_F8B19C = 1; + dialog_menu_id = 1; sub_4B3B42(in_current_building_type); return 1; } pDialogueNPCCount = 0; pDialogueWindow->Release(); - dword_F8B19C = 0; + dialog_menu_id = 0; pDialogueWindow = 0; pIcons_LOD->_40F9C5(); v1 = uNumDialogueNPCPortraits; @@ -4708,13 +1646,13 @@ pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); return; } - if ( dword_F8B19C > 18 ) - { - if ( dword_F8B19C < 36 ) + if ( dialog_menu_id > 18 ) + { + if ( dialog_menu_id < 36 ) return; - if ( dword_F8B19C <= 72 ) - { - v42 = dword_F8B19C - 36; + if ( dialog_menu_id <= 72 ) + { + v42 = dialog_menu_id - 36; //v43 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); v43 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); v44 = v43 * (100 - v0->GetMerchant()) / 100; @@ -4748,9 +1686,9 @@ } return; } - if ( dword_F8B19C != 94 ) - { - if ( dword_F8B19C != 95 ) + if ( dialog_menu_id != 94 ) + { + if ( dialog_menu_id != 95 ) return; goto LABEL_49; } @@ -4759,7 +1697,7 @@ sub_421EA6_OnInventoryLeftClick(); return; } - if ( dword_F8B19C == 18 ) + if ( dialog_menu_id == 18 ) { v17 = pMouse->GetCursorPos(&v63); v18 = pRenderer->pActiveZBuffer[v17->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v61)->y]] & 0xFFFF; @@ -4808,7 +1746,7 @@ ShowStatusBarString(v9, v54); return; } - if ( dword_F8B19C == 2 ) + if ( dialog_menu_id == 2 ) { LABEL_49: v28 = pMouse->GetCursorPos(&v59); @@ -4817,7 +1755,7 @@ return; v30 = window_SpeakInHouse->ptr_1C; // v31 = 9 * (v29 - 1 + 12 * (int)v30); - if ( dword_F8B19C == 2 ) + if ( dialog_menu_id == 2 ) { v32 = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29]; _this = (ItemGen *)&pParty->StandartItemsInShops[(int)v30][v29]; @@ -4916,7 +1854,7 @@ ShowStatusBarString(v9, v54); return; } - if ( dword_F8B19C == 3 ) + if ( dialog_menu_id == 3 ) { v14 = pMouse->GetCursorPos(&v71)->x - 14; v79 = (v14 >> 5) + 14 * ((pMouse->GetCursorPos(&v69)->y - 17) >> 5); @@ -4949,7 +1887,7 @@ pAudioPlayer->PlaySound(SOUND_27, v46, v47, v48, v49, v50, v52, v56); return; } - if ( dword_F8B19C == 4 ) + if ( dialog_menu_id == 4 ) { v10 = pMouse->GetCursorPos(&v62)->x - 14; v79 = (v10 >> 5) + 14 * ((pMouse->GetCursorPos(&v66)->y - 17) >> 5); @@ -5003,7 +1941,7 @@ } else { - if ( dword_F8B19C == 5 ) + if ( dialog_menu_id == 5 ) { v1 = pMouse->GetCursorPos(&a2)->x - 14; v79 = (v1 >> 5) + 14 * ((pMouse->GetCursorPos(&v70)->y - 17) >> 5); @@ -13449,7 +10387,7 @@ assert(sizeof(IndoorLocation) == 0x690); assert(sizeof(OutdoorCamera) == 0x74); assert(sizeof(Mouse) == 0x114); - assert(sizeof(Particle_) == 0x68); + assert(sizeof(Particle_sw) == 0x68); assert(sizeof(Particle) == 0x68); assert(sizeof(ParticleEngine) == 0xE430); assert(sizeof(Lightmap) == 0xC1C); @@ -15997,15 +12935,11 @@ } else { - if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) - { + if (uCurrentlyLoadedLevelType == LEVEL_Indoor) BLV_UpdateUserInputAndOther(); - } - else - { - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) + else if (uCurrentlyLoadedLevelType == LEVEL_Outdoor) ODM_UpdateUserInputAndOther(); - } + _438F8F_area_of_effect__damage_evaluate(); } }
--- a/mm7_3.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/mm7_3.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -1766,14 +1766,12 @@ switch ( pPartyActionQueue->Next() ) { case PARTY_TurnLeft: - __debugbreak(); v12 = uTurnSpeed; if ( uTurnSpeed ) goto LABEL_58; v13 = (double)v82 * fTurnSpeedMultiplier; goto LABEL_51; case PARTY_TurnRight: - __debugbreak(); LODWORD(v15) = uTurnSpeed; if ( uTurnSpeed ) goto LABEL_56; @@ -1842,12 +1840,10 @@ v26 = stru_5C6E00->Cos(angle); v27 = (double)v81; //v88 = v27; - v78 = (unsigned __int64)(v26 - * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16; + v78 = (unsigned __int64)(v26 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16; v2 -= v78; v28 = stru_5C6E00->Sin(angle); - v78 = (unsigned __int64)(v28 - * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16; + v78 = (unsigned __int64)(v28 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16; LABEL_68: v1 -= v78; LABEL_64: @@ -1873,7 +1869,6 @@ v72 = 1; goto LABEL_87; case PARTY_LookUp: - __debugbreak(); _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); if ( _view_angle > 128 ) _view_angle = 128; @@ -1884,7 +1879,6 @@ v63 = SPEECH_63; goto LABEL_76; case PARTY_LookDown: - __debugbreak(); _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); if ( _view_angle < -128 ) _view_angle = -128; @@ -1898,11 +1892,9 @@ } break; case PARTY_CenterView: - __debugbreak(); _view_angle = 0; break; case PARTY_Jump: - __debugbreak(); if ( (!bJumping || party_z <= v80 + 6 && v89 <= 0) && pParty->field_24 ) { bJumping = 1; @@ -11215,7 +11207,7 @@ signed __int64 v21; // qtt@20 int v22; // edx@21 int v23; // eax@21 - Particle_ local_0; // [sp+Ch] [bp-A0h]@3 + Particle_sw local_0; // [sp+Ch] [bp-A0h]@3 double v25; // [sp+74h] [bp-38h]@19 unsigned int v26; // [sp+7Ch] [bp-30h]@1 int a2; // [sp+80h] [bp-2Ch]@5 @@ -11340,8 +11332,8 @@ { memset(&local_0, 0, 0x68u); // fire, like at the Pit's tavern v5 = (double)v2->vPosition.x; - local_0.bFree = 1036; - local_0.uDiffuse = 0xFF3C1Eu; + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; + local_0.uDiffuse = 0xFF3C1E; local_0.x = v5; local_0.y = (double)v2->vPosition.y; local_0.z = (double)v2->vPosition.z; @@ -11529,22 +11521,16 @@ v3 = &pIndoor->pSectors[pBspRenderer->field_FA8[a1].uSectorID]; if ( pRenderer->pRenderD3D ) { - if ( v3->uNumNonBSPFaces > 0 ) - { - do - { - Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]); - pBspRenderer->PrepareFaceRenderList_d3d(v1, v3->pFaceIDs[v2++]); - } - while ( v2 < v3->uNumNonBSPFaces ); - } + for (uint i = 0; i < v3->uNumNonBSPFaces; ++i) + //Log::Warning(L"Non-BSP face: %X", v3->pFaceIDs[v2]); + pBspRenderer->AddFaceToRenderList_d3d(v1, v3->pFaceIDs[i]); } else { if ( v3->uNumNonBSPFaces > 0 ) { do - pBspRenderer->PrepareFaceRenderList_sw(v1, v3->pFaceIDs[v2++]); + pBspRenderer->AddFaceToRenderList_sw(v1, v3->pFaceIDs[v2++]); while ( v2 < v3->uNumNonBSPFaces ); } } @@ -11567,7 +11553,7 @@ bool v11; // [sp+14h] [bp-8h]@5 BspRenderer_stru0 *v12; // [sp+18h] [bp-4h]@1 - Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode); + //Log::Warning(L"sub_4406BC(%u, %u)", a1, uFirstNode); v10 = a1; v12 = &pBspRenderer->field_FA8[a1]; @@ -11592,17 +11578,17 @@ v7 = v3->uCoplanarOffset; v8 = v7 + v3->uCoplanarSize; - Log::Warning(L"Node %u: %X to %X (%hX)", uFirstNode, v7, v8, v2->pFaceIDs[v7]); + //Log::Warning(L"Node %u: %X to %X (%hX)", uFirstNode, v7, v8, v2->pFaceIDs[v7]); if ( pRenderer->pRenderD3D ) { while ( v7 < v8 ) - pBspRenderer->PrepareFaceRenderList_d3d(v10, v2->pFaceIDs[v7++]); + pBspRenderer->AddFaceToRenderList_d3d(v10, v2->pFaceIDs[v7++]); } else { while ( v7 < v8 ) - pBspRenderer->PrepareFaceRenderList_sw(v10, v2->pFaceIDs[v7++]); + pBspRenderer->AddFaceToRenderList_sw(v10, v2->pFaceIDs[v7++]); } v9 = v11 ? v3->uFront : v3->uBack; if ( v9 == -1 )
--- a/mm7_4.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/mm7_4.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -53,6 +53,7 @@ #include "stru159.h" #include "texts.h" #include "Log.h" +#include "UIHouses.h" #include "mm7_data.h" @@ -1683,14 +1684,12 @@ result = &this->pTiles[uTileID]; return result;*/ - if (uTileID < 0 || uTileID > this->uNumTiles - 1) - return this->pTiles; - else - return &this->pTiles[uTileID]; + assert(uTileID < uNumTiles); + return &pTiles[uTileID]; } //----- (00487E58) -------------------------------------------------------- -void TileTable::InitializeTileset(int uTerrainType) +void TileTable::InitializeTileset(Tileset tileset) { TileTable *v2; // edi@1 int v3; // ebx@1 @@ -1702,7 +1701,7 @@ for ( i = 0; i < (signed int)v2->uNumTiles; ++v3 ) { v4 = &v2->pTiles[v3]; - if ( uTerrainType == v4->uTerrainType && v4->pTileName[0] ) + if (v4->tileset == tileset && v4->pTileName[0] ) { v2->pTiles[v3].uBitmapID = pBitmaps_LOD->LoadTexture(v4->pTileName); if ( v2->pTiles[v3].uBitmapID != -1 ) @@ -1978,7 +1977,7 @@ v8 = atoi(v7); v9 = v84.pProperties[3]; v2->pTiles[v2->uNumTiles].uBitmapID = v8; - v2->pTiles[v2->uNumTiles].uTerrainType = 0; + v2->pTiles[v2->uNumTiles].tileset = Tileset_Grass; if ( _strcmpi(v9, "TTtype_NULL") ) { if ( _strcmpi(v9, "TTtype_Start") ) @@ -2033,145 +2032,145 @@ { if ( !_strcmpi(v9, "TTtype_RoadCityStone") ) { - v34 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v34 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v34 |= 0x1Cu; } } else { - v33 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v33 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v33 |= 0xDu; } } else { - v32 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v32 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v32 |= 0xCu; } } else { - v31 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v31 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v31 |= 0x1Bu; } } else { - v30 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v30 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v30 |= 0x1Au; } } else { - v29 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v29 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v29 |= 0x19u; } } else { - v28 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v28 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v28 |= 0x18u; } } else { - v27 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v27 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v27 |= 0x11u; } } else { - v26 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v26 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v26 |= 0x10u; } } else { - v25 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v25 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v25 |= 0xFu; } } else { - v24 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v24 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v24 |= 0xEu; } } else { - v23 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v23 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v23 |= 0x17u; } } else { - v22 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v22 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v22 |= 0x16u; } } else { - v21 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v21 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v21 |= 0xBu; } } else { - v20 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v20 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v20 |= 0xAu; } } else { - v19 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v19 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v19 |= 9u; } } else { - v18 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v18 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v18 |= 7u; } } else { - v17 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v17 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v17 |= 8u; } } else { - v16 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v16 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v16 |= 5u; } } else { - v15 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v15 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v15 |= 4u; } } else { - v14 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v14 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v14 |= 3u; } } else { - v13 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v13 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v13 |= 2u; } } else { - v12 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v12 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v12 |= 1u; } } else { - v11 = (int)&v2->pTiles[v2->uNumTiles].uTerrainType; + v11 = (int)&v2->pTiles[v2->uNumTiles].tileset; *(char *)v11 |= 6u; } } @@ -2184,7 +2183,7 @@ } else { - LOBYTE(v2->pTiles[v2->uNumTiles].uTerrainType) = -1; + LOBYTE(v2->pTiles[v2->uNumTiles].tileset) = -1; } v35 = v84.pProperties[4]; v2->pTiles[v2->uNumTiles].uSection = 0; @@ -4806,8 +4805,8 @@ // AE3370: using guessed type int dword_AE3370; //----- (00495430) -------------------------------------------------------- -char *__fastcall GetReputationString(signed int a1) -{ +char * GetReputationString( signed int a1 ) + { if (a1 >= 25) return pGlobalTXT_LocalizationStrings[379]; // Hated else if (a1 >= 6) @@ -9070,11 +9069,11 @@ return; if ( in_current_building_type <= BildingType_AlchemistShop ) { - if ( dword_F8B19C != 2 ) - { - if ( dword_F8B19C <= 2 ) + if ( dialog_menu_id != 2 ) + { + if ( dialog_menu_id <= 2 ) return; - if ( dword_F8B19C <= 5 || dword_F8B19C == 94 ) + if ( dialog_menu_id <= 5 || dialog_menu_id == 94 ) { v8 = pMouse->GetCursorPos(&v15)->x - 14; v18 = (v8 >> 5) + 14 * ((pMouse->GetCursorPos(&v14)->y - 17) >> 5); @@ -9087,7 +9086,7 @@ GameUI_DrawItemInfo(v7); return; } - if ( dword_F8B19C != 95 ) + if ( dialog_menu_id != 95 ) return; } v4 = pMouse->GetCursorPos(&v11); @@ -9097,12 +9096,12 @@ return; v6 = 9 * (v5 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C); v7 = (ItemGen *)((char *)&pParty->pPickedItem + 4 * v6 + 4); - if ( dword_F8B19C != 2 ) + if ( dialog_menu_id != 2 ) // v7 = (ItemGen *)&pParty->field_C59C[v6 + 715]; v7 =&pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v5]; goto LABEL_15; } - if ( in_current_building_type <= BildingType_16 && dword_F8B19C == BildingType_18 ) + if ( in_current_building_type <= BildingType_16 && dialog_menu_id == BildingType_18 ) { v1 = pMouse->GetCursorPos(&a2); v2 = v1->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v16)->y]; @@ -9244,16 +9243,7 @@ } } -//----- (004B1E92) -------------------------------------------------------- -void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2) -{ - //if ( BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) ) - if ( pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId ) - pAudioPlayer->PlaySound( - //(SoundID)(a2 + 100 * (BYTE1(pAnimatedRooms[p2DEvents_minus1___02[26 * uHouseID]].field_C) + 300)), - (SoundID)(a2 + 100 * (pAnimatedRooms[p2DEvents[uHouseID - 1].uAnimationID].uRoomSoundId) + 300), - 806, 0, -1, 0, 0, 0, 0); -} + //----- (004B1ECE) -------------------------------------------------------- void __cdecl sub_4B1ECE() @@ -9393,7 +9383,7 @@ case 13: ptr_F8B1E8 = pNPCStats->pProfessions[pCurrentNPCInfo->uProfession].pJoinText;//(char *)*(&pNPCStats->field_13A64 + 5 * v2->uProfession); ptr_F8B1E8 = BuilDialogueString((char *)ptr_F8B1E8, uActiveCharacter - 1, 0, 0, 0, 0); - sub_4B40E6(); + NPCHireableDialogPrepare(); dialogue_show_profession_details = false; goto _return; case 19: @@ -9619,7 +9609,7 @@ pParty->field_709 = 0; sub_44A56A(); PrepareHouse((HOUSE_ID)(int)window_SpeakInHouse->ptr_1C); - dword_F8B19C = 1; + dialog_menu_id = 1; pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); /*if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) @@ -10616,7 +10606,7 @@ pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x52u, 0, pGlobalTXT_LocalizationStrings[122], 0); pDialogueWindow->_41D08F(1, 1, 0, 2); - dword_F8B19C = -1; + dialog_menu_id = -1; } // F8B19C: using guessed type int dword_F8B19C; @@ -10642,14 +10632,14 @@ v2 = pGlobalTXT_LocalizationStrings[535]; pDialogueWindow->CreateButton(0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Fu, 0, v2, 0); pDialogueWindow->_41D08F(1, 1, 0, 2); - dword_F8B19C = -1; + dialog_menu_id = -1; } // F8B19C: using guessed type int dword_F8B19C; // F8B1A8: using guessed type int dword_F8B1A8; //----- (004B40E6) -------------------------------------------------------- -void __cdecl sub_4B40E6() -{ +void NPCHireableDialogPrepare() + { signed int v0; // ebx@1 NPCData *v1; // edi@1 @@ -10657,50 +10647,21 @@ v1 = HouseNPCData[(unsigned int)((char *)pDialogueNPCCount + -(dword_591080 != 0) - 1)]; pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 0x15Eu, WINDOW_MainMenu, 0, 0); - pBtn_ExitCancel = pDialogueWindow->CreateButton( - 0x1D7u, - 0x1BDu, - 0xA9u, - 0x23u, - 1, - 0, - 0x71u, - 0, - 0, - pGlobalTXT_LocalizationStrings[34], + pBtn_ExitCancel = pDialogueWindow->CreateButton( 0x1D7u, 0x1BDu, 0xA9u, 0x23u, 1, 0, 0x71u, 0, 0, + pGlobalTXT_LocalizationStrings[34], //"Cancel" (Texture *)(uExitCancelTextureId != -1 ? (int)&pIcons_LOD->pTextures[uExitCancelTextureId] : 0), 0); pDialogueWindow->CreateButton(0, 0, 0, 0, 1, 0, 0x51u, 0, 0, "", 0); if ( pNPCStats->pProfessions[v1->uProfession].pBenefits)//*(&pNPCStats->field_13A5C + 5 * v1->uProfession) ) { - pDialogueWindow->CreateButton( - 0x1E0u, - 0xA0u, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0xAFu, - 0x4Du, - 0, - pGlobalTXT_LocalizationStrings[407], - 0); + pDialogueWindow->CreateButton( 0x1E0u, 0xA0u, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Du, 0, + pGlobalTXT_LocalizationStrings[407], 0);//"More Information" v0 = 1; } - pDialogueWindow->CreateButton( - 0x1E0u, - 30 * v0 + 160, - 0x8Cu, - 0x1Eu, - 1, - 0, - 0xAFu, - 0x4Cu, - 0, - pGlobalTXT_LocalizationStrings[406], - 0); + pDialogueWindow->CreateButton( 0x1E0u, 30 * v0 + 160, 0x8Cu, 0x1Eu, 1, 0, 0xAFu, 0x4Cu, 0, + pGlobalTXT_LocalizationStrings[406], 0); //"Hire" pDialogueWindow->_41D08F(v0 + 1, 1, 0, 2); - dword_F8B19C = -1; + dialog_menu_id = -1; } @@ -10737,7 +10698,7 @@ else { v17 = HouseNPCData[_this + 1 - ((dword_591080 != 0) + 1)]; - if ( dword_F8B19C == -1 ) + if ( dialog_menu_id == -1 ) { pDialogueWindow->Release(); } @@ -10820,7 +10781,7 @@ pDialogueWindow->_41D08F(num_menu_buttons, 1, 0, 2); dword_F8B1E0 = pDialogueWindow->pNumPresenceButton; } - dword_F8B19C = 1; + dialog_menu_id = 1; } } @@ -10848,1080 +10809,6 @@ return 1000 * v1; } -//----- (004B4710) -------------------------------------------------------- -int __cdecl TrainingDialog() -{ - Player *v0; // ebx@1 - int color2; // eax@1 - unsigned int v2; // ecx@1 - int v3; // eax@1 - signed int v4; // edx@1 - int v5; // edi@3 - unsigned int v6; // esi@3 - void *v7; // ecx@3 - int v8; // edx@4 - double v9; // st7@6 - signed int v10; // esi@6 - int v11; // ecx@6 - int result; // eax@9 - GUIWindow *v13; // edi@14 - signed int v14; // esi@14 - unsigned int v15; // esi@16 - int v16; // eax@16 - unsigned int v17; // eax@17 - int v18; // eax@19 - int v19; // ecx@24 - GUIButton *v20; // eax@26 - GUIButton *v21; // esi@26 - int v22; // eax@26 - const char *v23; // eax@28 - int v24; // eax@28 - unsigned int v25; // ecx@28 - int v26; // eax@28 - unsigned __int16 v27; // ax@28 - int v28; // eax@32 - unsigned __int16 v29; // ST14_2@34 - int v30; // eax@34 - const char *v31; // ST18_4@36 - unsigned __int16 v32; // ST14_2@36 - int v33; // eax@36 - int v34; // eax@37 - unsigned int v35; // edi@38 - unsigned int v36; // eax@38 - int v37; // ecx@41 - char *v38; // eax@41 - int *v39; // eax@45 - unsigned int v40; // eax@46 - void *v41; // ecx@46 - unsigned int v42; // eax@46 - GUIWindow *v43; // ecx@59 - int v44; // edx@59 - char **v45; // esi@60 - int v46; // eax@62 - int v47; // eax@68 - int v48; // edx@69 - int v49; // ebx@69 - unsigned __int8 v50; // sf@69 - char **v51; // edi@70 - GUIButton *v52; // eax@71 - GUIButton *v53; // esi@71 - int v54; // eax@71 - unsigned int v55; // ecx@71 - int v56; // eax@71 - unsigned __int16 v57; // ax@71 - unsigned __int16 v58; // [sp-Ch] [bp-90h]@38 - const char *v59; // [sp-Ch] [bp-90h]@63 - char *v60; // [sp-8h] [bp-8Ch]@38 - char *v61; // [sp-8h] [bp-8Ch]@63 - unsigned int v62; // [sp-4h] [bp-88h]@38 - int v63; // [sp-4h] [bp-88h]@52 - char *v64; // [sp-4h] [bp-88h]@63 - GUIWindow v65; // [sp+Ch] [bp-78h]@1 - __int64 v66; // [sp+60h] [bp-24h]@3 - unsigned int white; // [sp+68h] [bp-1Ch]@1 - int v68; // [sp+6Ch] [bp-18h]@3 - int v69; // [sp+70h] [bp-14h]@6 - unsigned int i; // [sp+74h] [bp-10h]@1 - int v71; // [sp+78h] [bp-Ch]@1 - int v72; // [sp+7Ch] [bp-8h]@16 - int v73; // [sp+80h] [bp-4h]@14 - - v0 = pPlayers[uActiveCharacter]; - memcpy(&v65, window_SpeakInHouse, sizeof(v65)); - v65.uFrameX = 483; - v65.uFrameWidth = 148; - v65.uFrameZ = 334; - white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - v2 = v0->uLevel; - v71 = color2; - v3 = 0; - v4 = 0; - for ( i = v2; v4 < (signed int)v2; ++v4 ) - v3 += v4 + 1; - v5 = 1000 * v3; - v6 = HIDWORD(v0->uExperience); - v7 = window_SpeakInHouse->ptr_1C; - v68 = (unsigned __int16)word_4F0866[(signed int)v7]; - v66 = 1000 * v3; - if ( (signed __int64)__PAIR__(v6, LODWORD(v0->uExperience)) >= v66 ) - { - v8 = v0->classType % 4 + 1; - if ( v8 == 4 ) - v8 = 3; - v9 = (double)(signed int)i; - i = 0; - v69 = v8; - //v10 = (signed __int64)(v9 * p2DEvents_minus1__20[13 * (signed int)v7] * (double)v8); - v10 = (signed __int64)(v9 * p2DEvents[(signed int)v7 - 1].fPriceMultiplier * (double)v8); - v11 = v10 * (100 - v0->GetMerchant()) / 100; - if ( v11 < v10 / 3 ) - v11 = v10 / 3; - i = v11; - } - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - if ( dword_F8B19C != 1 ) - { - if ( dword_F8B19C != 17 ) - { - result = dword_F8B19C - 96; - if ( dword_F8B19C == 96 ) - { - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - i = 0; - v13 = pDialogueWindow; - //v14 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (unsigned int)ptr_507BC0->ptr_1C] * 500.0); - v14 = (signed __int64)(p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].flt_24 * 500.0); - v73 = v14 * (100 - v0->GetMerchant()) / 100; - if ( v73 < v14 / 3 ) - v73 = v14 / 3; - v15 = v13->pStartingPosActiveItem; - v16 = v13->pNumPresenceButton; - v72 = 0; - if ( (signed int)v15 >= (signed int)(v15 + v16) ) - goto LABEL_76; - do - { - v17 = v13->GetControl(v15)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v17] && !v0->pActiveSkills[v17] ) - { - v18 = pFontArrus->CalcTextHeight(pSkillNames[v17], &v65, 0, 0); - i += v18; - ++v72; - } - ++v15; - } - while ( (signed int)v15 < v13->pNumPresenceButton + v13->pStartingPosActiveItem ); - if ( v72 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v73);// "Skill Cost: %lu" - v65.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v73 = (signed int)(149 - i) / v72; - if ( v73 > 32 ) - v73 = 32; - result = v13->pStartingPosActiveItem; - v19 = (signed int)(149 - v72 * v73 - i) / 2 - v73 / 2 + 162; - i = result; - v68 = v19; - if ( result < result + v13->pNumPresenceButton ) - { - v72 = 2; - do - { - v20 = v13->GetControl(i); - v21 = v20; - v22 = v20->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v0->classType][v22] || v0->pActiveSkills[v22] ) - { - v21->uW = 0; - v21->uHeight = 0; - v21->uY = 0; - } - else - { - v23 = pSkillNames[v22]; - v21->uY = v73 + v68; - HIDWORD(v66) = (int)v23; - v24 = pFontArrus->CalcTextHeight(v23, &v65, 0, 0); - v25 = v21->uY; - v21->uHeight = v24; - v26 = v25 + v24 - 1; - v21->uW = v26; - v68 = v26; - v27 = v71; - if ( pDialogueWindow->pCurrentPosActiveItem != v72 ) - v27 = white; - v65.DrawTitleText(pFontArrus, 0, v25, v27, (char *)HIDWORD(v66), 3u); - } - v28 = v13->pStartingPosActiveItem; - ++i; - result = v13->pNumPresenceButton + v28; - ++v72; - } - while ( (signed int)i < result ); - } - } - else - { -LABEL_76: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v0->pName, pClassNames[v0->classType]);// - // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." - v29 = v71; - v30 = pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0); - result = (int)v65.DrawTitleText(pFontArrus, 0, (174 - v30) / 2 + 138, v29, pTmpBuf, 3u); - } - } - } - return result; - } - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v31 = pNPCTopics[122].pText; - v32 = v71; - v33 = pFontArrus->CalcTextHeight(pNPCTopics[122].pText, &v65, 0, 0); - v65.DrawTitleText(pFontArrus, 0, (212 - v33) / 2 + 101, v32, v31, 3u); - result = (int)pDialogueWindow; - pDialogueWindow->pNumPresenceButton = 0; - return result; - } - v34 = v0->uLevel; - if ( v34 < v68 ) - { - if ( (signed __int64)v0->uExperience >= v66 ) - { - if ( pParty->uNumGold >= i ) - { - Party::TakeGold(i); - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - ++v0->uLevel; - v0->uSkillPoints += v0->uLevel / 10 + 5; - v0->sHealth = v0->GetMaxHealth(); - v0->sMana = v0->GetMaxMana(); - v37 = 0; - v38 = byte_F8B148; - do - { - if ( *(int *)v38 > v37 ) - v37 = *(int *)v38; - v38 += 4; - } - while ( (signed int)v38 < (signed int)word_F8B158 ); - v39 = &dword_F8B144 + uActiveCharacter; - ++*v39; - if ( *v39 > v37 ) - { - v40 = sub_494820(pParty->uCurrentHour); - v41 = window_SpeakInHouse->ptr_1C; - v42 = 60 * (v40 + 4) - pParty->uCurrentMinute; - if ( v41 == (void *)94 || v41 == (void *)95 ) - v42 += 720; - RestAndHeal((signed int)(v42 + 10080)); - if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) - pOutdoor->SetFog(); - } - v0->PlaySound(SPEECH_87, 0); - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[430], v0->pName, v0->uLevel, v0->uLevel / 10 + 5);// - // "%s is now Level %lu and has earned %lu Skill Points!" - ShowStatusBarString(pTmpBuf, 2u); - goto LABEL_56; - } - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u);// "You don't have enough gold" - v63 = 4; -LABEL_55: - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, v63); -LABEL_56: - /*result = pMessageQueue_50CBD0->uNumMessages; - if ( (signed int)pMessageQueue_50CBD0->uNumMessages < 40 ) - { - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113; - pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].param = 1; - result = 3 * pMessageQueue_50CBD0->uNumMessages + 3; - *(&pMessageQueue_50CBD0->uNumMessages + result) = 0; - ++pMessageQueue_50CBD0->uNumMessages; - } - return result;*/ - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return 1; // void function actually - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[538], v5 - LODWORD(v0->uExperience), v34 + 1);// - // "You need %d more experience to train to level %d" - v35 = 0; - v62 = 3; - v60 = pTmpBuf; - v58 = v71; - v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 88; - } - else - { - sprintf(pTmpBuf, "%s\n \n%s", pGlobalTXT_LocalizationStrings[536], pGlobalTXT_LocalizationStrings[529]);// - // ""With your skills, you should be working here as a teacher."" - // ""Sorry, but we are unable to train you."" - v35 = 0; - v62 = 3; - v60 = pTmpBuf; - v58 = v71; - v36 = (212 - pFontArrus->CalcTextHeight(pTmpBuf, &v65, 0, 0)) / 2 + 101; - } - v65.DrawTitleText(pFontArrus, v35, v36, v58, v60, v62); - v63 = 3; - goto LABEL_55; - } - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v43 = pDialogueWindow; - v72 = 0; - pShopOptions[0] = pTmpBuf; - pShopOptions[1] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" - v44 = pDialogueWindow->pNumPresenceButton; - v73 = pDialogueWindow->pStartingPosActiveItem; - if ( v73 < v73 + v44 ) - { - v45 = pShopOptions; - do - { - if ( v43->GetControl(v73)->uControlParam == 17 ) - { - v46 = v0->uLevel; - if ( v46 < v68 ) - { - if ( (signed __int64)v0->uExperience < v66 ) - { - v64 = (char *)(v46 + 1); - v61 = (char *)(v5 - LODWORD(v0->uExperience)); - v59 = pGlobalTXT_LocalizationStrings[538];// "You need %d more experience to train to level %d" - } - else - { - v64 = (char *)i; - v61 = (char *)(v46 + 1); - v59 = pGlobalTXT_LocalizationStrings[537];// "Train to level %d for %d gold" - } - } - else - { - v64 = pGlobalTXT_LocalizationStrings[529];// ""Sorry, but we are unable to train you."" - v61 = pGlobalTXT_LocalizationStrings[536];// ""With your skills, you should be working here as a teacher."" - v59 = "%s\n \n%s"; - } - sprintf(*v45, v59, v61, v64); - } - v47 = pFontArrus->CalcTextHeight(*v45, &v65, 0, 0); - v43 = pDialogueWindow; - v72 += v47; - ++v45; - ++v73; - } - while ( v73 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - HIDWORD(v66) = (174 - v72) / 2; - result = v43->pStartingPosActiveItem; - v48 = result + v43->pNumPresenceButton; - v49 = (2 * (87 - (174 - v72) / 2) - v72) / 2 - (174 - v72) / 2 / 2 + 138; - v50 = -v43->pNumPresenceButton < 0; - v73 = v43->pStartingPosActiveItem; - if ( v50 ^ __OFSUB__(result, v48) ) - { - i = 2; - v51 = pShopOptions; - do - { - v52 = v43->GetControl(v73); - v53 = v52; - v52->uY = HIDWORD(v66) + v49; - v54 = pFontArrus->CalcTextHeight(*v51, &v65, 0, 0); - v55 = v53->uY; - v53->uHeight = v54; - v56 = v54 + v55 - 1; - v53->uW = v56; - v49 = v56; - v57 = v71; - if ( pDialogueWindow->pCurrentPosActiveItem != i ) - v57 = white; - v65.DrawTitleText(pFontArrus, 0, v55, v57, *v51, 3u); - v43 = pDialogueWindow; - ++i; - ++v51; - ++v73; - result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( v73 < result ); - } - } - } - return result; -} - - - - - - - - - -//----- (004B4FCF) -------------------------------------------------------- -int __cdecl MagicShopDialog() -{ - Player *v0; // ebx@1 - int result; // eax@6 - signed int v2; // esi@8 - unsigned int v3; // ebx@10 - char *v4; // eax@11 - char *v5; // eax@12 - unsigned int v6; // eax@12 - int v7; // ST08_4@14 - int v8; // eax@14 - unsigned __int8 v9; // dl@14 - char *v10; // ecx@14 - signed int v11; // esi@16 - int v12; // ST08_4@19 - int v13; // eax@19 - int v14; // edi@21 - char **v15; // esi@21 - int v16; // eax@22 - GUIWindow *v17; // ecx@23 - int v18; // edx@23 - int v19; // edi@23 - unsigned __int8 v20; // sf@23 - GUIButton *v21; // esi@25 - const char **v22; // eax@25 - int v23; // eax@25 - unsigned int v24; // ecx@25 - const char **v25; // edx@25 - unsigned __int16 v26; // ax@25 - signed int v27; // esi@30 - int v28; // ST08_4@34 - int v29; // eax@34 - char *v30; // edx@35 - GUIWindow *v31; // edi@40 - void *v32; // eax@40 - signed int v33; // esi@40 - unsigned int v34; // esi@42 - int v35; // eax@42 - unsigned int v36; // eax@43 - int v37; // eax@45 - int v38; // ecx@50 - GUIButton *v39; // eax@52 - GUIButton *v40; // esi@52 - int v41; // eax@52 - char *v42; // eax@54 - int v43; // eax@54 - unsigned int v44; // ecx@54 - int v45; // edx@54 - int v46; // eax@54 - unsigned __int16 v47; // ax@54 - int v48; // eax@58 - signed int v49; // esi@62 - Texture *v50; // ecx@64 - unsigned int v51; // edi@64 - unsigned int v52; // esi@66 - int v53; // edx@70 - Texture *v54; // ecx@76 - unsigned int v55; // edi@76 - unsigned int v56; // esi@76 - int v57; // edx@80 - Texture *v58; // ecx@86 - unsigned int v59; // edi@86 - unsigned int v60; // esi@88 - int v61; // edx@92 - Texture *v62; // ecx@98 - unsigned int v63; // edi@98 - unsigned int v64; // esi@100 - int v65; // edx@104 - signed int v66; // ecx@109 - SHORT v67; // di@117 - bool v68; // eax@117 - const char *v69; // ecx@119 - POINT *v70; // esi@124 - int v71; // ecx@125 - int v72; // eax@125 - int v73; // ecx@125 - ItemGen *v74; // esi@125 - int v75; // eax@130 - int v76; // esi@131 - char **v77; // edi@131 - int v78; // eax@132 - GUIWindow *v79; // ecx@133 - int v80; // edx@133 - int v81; // edi@133 - GUIButton *v82; // esi@135 - const char **v83; // eax@135 - int v84; // eax@135 - unsigned int v85; // ecx@135 - int v86; // edx@135 - unsigned __int16 v87; // ax@135 - GUIWindow *v88; // [sp-18h] [bp-110h]@35 - int v89; // [sp-14h] [bp-10Ch]@35 - ItemGen *v90; // [sp-10h] [bp-108h]@14 - int v91; // [sp-10h] [bp-108h]@35 - unsigned __int16 v92; // [sp-Ch] [bp-104h]@12 - void *v93; // [sp-Ch] [bp-104h]@14 - int v94; // [sp-8h] [bp-100h]@11 - char *v95; // [sp-8h] [bp-100h]@12 - __int64 *v96; // [sp-4h] [bp-FCh]@11 - unsigned int v97; // [sp-4h] [bp-FCh]@12 - POINT v98; // [sp+Ch] [bp-ECh]@8 - POINT v99; // [sp+14h] [bp-E4h]@16 - POINT v100; // [sp+1Ch] [bp-DCh]@124 - POINT v101; // [sp+24h] [bp-D4h]@17 - POINT v102; // [sp+2Ch] [bp-CCh]@124 - POINT v103; // [sp+34h] [bp-C4h]@9 - POINT v104; // [sp+3Ch] [bp-BCh]@31 - POINT v105; // [sp+44h] [bp-B4h]@16 - POINT v106; // [sp+4Ch] [bp-ACh]@30 - POINT v107; // [sp+54h] [bp-A4h]@16 - POINT v108; // [sp+5Ch] [bp-9Ch]@30 - POINT a2; // [sp+64h] [bp-94h]@8 - POINT v110; // [sp+6Ch] [bp-8Ch]@30 - POINT v111; // [sp+74h] [bp-84h]@8 - GUIWindow v112; // [sp+7Ch] [bp-7Ch]@1 - char *Str; // [sp+D0h] [bp-28h]@54 - int v114; // [sp+D4h] [bp-24h]@23 - unsigned int color2; // [sp+D8h] [bp-20h]@1 - unsigned int white; // [sp+DCh] [bp-1Ch]@1 - __int32 v117; // [sp+E0h] [bp-18h]@8 - int v118; // [sp+E4h] [bp-14h]@40 - const char **v119; // [sp+E8h] [bp-10h]@24 - Player *_this; // [sp+ECh] [bp-Ch]@1 - unsigned __int8 uPlayerID; // [sp+F3h] [bp-5h]@14 - int v122; // [sp+F4h] [bp-4h]@23 - - v0 = pPlayers[uActiveCharacter]; - _this = pPlayers[uActiveCharacter]; - memcpy(&v112, window_SpeakInHouse, sizeof(v112)); - v112.uFrameX = 483; - v112.uFrameWidth = 148; - v112.uFrameZ = 334; - white = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - color2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xE1u, 0xCDu, 0x23u); - if ( dword_F8B19C > 5 ) - { - if ( dword_F8B19C == 94 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - pShopOptions[0] = pGlobalTXT_LocalizationStrings[200];// "Sell" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[113];// "Identify" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[179];// "Repair" - v76 = 0; - v77 = pShopOptions; - do - { - v78 = pFontArrus->CalcTextHeight(*v77, &v112, 0, 0); - ++v77; - v76 += v78; - } - while ( (signed int)v77 < (signed int)&pShopOptions[3] ); - v79 = pDialogueWindow; - _this = (Player *)((174 - v76) / 3); - result = pDialogueWindow->pStartingPosActiveItem; - v80 = result + pDialogueWindow->pNumPresenceButton; - v81 = (3 * (58 - (signed int)_this) - v76) / 2 - (174 - v76) / 3 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - v118 = pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ __OFSUB__(result, v80) ) - { - v122 = 2; - v119 = (const char **)pShopOptions; - do - { - v82 = v79->GetControl(v118); - v83 = v119; - v82->uY = (unsigned int)((char *)_this + v81); - v84 = pFontArrus->CalcTextHeight(*v83, &v112, 0, 0); - v85 = v82->uY; - v86 = v122; - v82->uHeight = v84; - v81 = v84 + v85 - 1; - v82->uW = v81; - v87 = color2; - if ( pDialogueWindow->pCurrentPosActiveItem != v86 ) - v87 = white; - v112.DrawTitleText(pFontArrus, 0, v85, v87, *v119, 3u); - v79 = pDialogueWindow; - ++v122; - ++v119; - ++v118; - result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( v118 < result ); - } - return result; - } - if ( dword_F8B19C != 95 ) - { - result = dword_F8B19C - 96; - if ( dword_F8B19C == 96 ) - { - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v31 = pDialogueWindow; - v3 = 0; - v32 = window_SpeakInHouse->ptr_1C; - v118 = 0; - //v33 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v32] * 500.0); - v33 = (signed __int64)(p2DEvents[(signed int)v32 - 1].flt_24 * 500.0); - v119 = (const char **)(v33 * (100 - _this->GetMerchant()) / 100); - if ( (signed int)v119 < v33 / 3 ) - v119 = (const char **)(v33 / 3); - v34 = v31->pStartingPosActiveItem; - v35 = v34 + v31->pNumPresenceButton; - v122 = 0; - if ( (signed int)v34 >= v35 ) - goto LABEL_140; - do - { - v36 = v31->GetControl(v34)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v36] && !_this->pActiveSkills[v36] ) - { - v37 = pFontArrus->CalcTextHeight(pSkillNames[v36], &v112, 0, 0); - v118 += v37; - ++v122; - } - ++v34; - } - while ( (signed int)v34 < v31->pNumPresenceButton + v31->pStartingPosActiveItem ); - if ( !v122 ) - { -LABEL_140: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], _this->pName, pClassNames[_this->classType]);// - // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]);// "I can offer you nothing further." - v30 = pTmpBuf; - v97 = 3; - v95 = pTmpBuf; - v92 = color2; - v91 = 0; - v89 = 0; - v88 = &v112; - goto LABEL_61; - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v119);// "Skill Cost: %lu" - v112.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v119 = (const char **)((149 - v118) / v122); - if ( (149 - v118) / v122 > 32 ) - v119 = (const char **)32; - result = v31->pStartingPosActiveItem; - v38 = (149 - v122 * (signed int)v119 - v118) / 2 - (signed int)v119 / 2 + 162; - v118 = result; - v114 = v38; - if ( result < result + v31->pNumPresenceButton ) - { - v122 = 2; - do - { - v39 = v31->GetControl(v118); - v40 = v39; - v41 = v39->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[_this->classType][v41] || _this->pActiveSkills[v41] ) - { - v40->uW = 0; - v40->uHeight = 0; - v40->uY = 0; - } - else - { - v42 = pSkillNames[v41]; - v40->uY = (unsigned int)((char *)v119 + v114); - Str = v42; - v43 = pFontArrus->CalcTextHeight(v42, &v112, 0, 0); - v44 = v40->uY; - v45 = v122; - v40->uHeight = v43; - v46 = v44 + v43 - 1; - v40->uW = v46; - v114 = v46; - v47 = color2; - if ( pDialogueWindow->pCurrentPosActiveItem != v45 ) - v47 = white; - v112.DrawTitleText(pFontArrus, 0, v44, v47, Str, 3u); - } - v48 = v31->pStartingPosActiveItem; - ++v118; - result = v31->pNumPresenceButton + v48; - ++v122; - } - while ( v118 < result ); - } - } - } - return result; - } - } - else - { - if ( dword_F8B19C == 5 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - 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, - v117 = (v27 >> 5) + 14 * ((pMouse->GetCursorPos(&v108)->y - 17) >> 5), - result = (int)pMouse->GetCursorPos(&v106), - *(int *)result <= 13) - || (result = (int)pMouse->GetCursorPos(&v104), *(int *)result >= 462) - || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) - || (result *= 9, !(_this->field_1F5[4 * result + 15] & 2)) ) - return result; - v96 = 0; - v94 = 5; - v93 = window_SpeakInHouse->ptr_1C; - v90 = (ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5]; - v28 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v29 = _this->_490EEE((ItemGen *)&_this->spellbook.pDarkSpellbook.bIsSpellAvailable[4 * result + 5], 3, v28, 5); - v9 = uPlayerID; - v10 = (char *)pMerchantsRepairPhrases[v29]; - goto LABEL_35; - } - if ( dword_F8B19C == 1 ) - { - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - pShopOptions[0] = pGlobalTXT_LocalizationStrings[134];// "Buy Standard" - pShopOptions[1] = pGlobalTXT_LocalizationStrings[152];// "Buy Special" - pShopOptions[2] = pGlobalTXT_LocalizationStrings[159];// "Display Inventory" - v14 = 0; - pShopOptions[3] = pGlobalTXT_LocalizationStrings[160];// "Learn Skills" - v15 = pShopOptions; - do - { - v16 = pFontArrus->CalcTextHeight(*v15, &v112, 0, 0); - ++v15; - v14 += v16; - } - while ( (signed int)v15 < (signed int)&unk_F8B1C8 ); - v17 = pDialogueWindow; - v114 = (174 - v14) / 4; - result = pDialogueWindow->pStartingPosActiveItem; - v18 = result + pDialogueWindow->pNumPresenceButton; - v19 = (174 - 4 * (174 - v14) / 4 - v14) / 2 - (174 - v14) / 4 / 2 + 138; - v20 = -pDialogueWindow->pNumPresenceButton < 0; - v122 = pDialogueWindow->pStartingPosActiveItem; - if ( v20 ^ __OFSUB__(result, v18) ) - { - v119 = (const char **)2; - _this = (Player *)pShopOptions; - do - { - v21 = v17->GetControl(v122); - v22 = (const char **)_this; - v21->uY = v114 + v19; - v23 = pFontArrus->CalcTextHeight(*v22, &v112, 0, 0); - v24 = v21->uY; - v25 = v119; - v21->uHeight = v23; - v19 = v24 + v23 - 1; - v21->uW = v19; - v26 = color2; - if ( (const char **)pDialogueWindow->pCurrentPosActiveItem != v25 ) - v26 = white; - v112.DrawTitleText(pFontArrus, 0, v24, v26, (const char *)LODWORD(_this->pConditions[0]), 3u); - v17 = pDialogueWindow; - v119 = (const char **)((char *)v119 + 1); - _this = (Player *)((char *)_this + 4); - ++v122; - result = pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem; - } - while ( v122 < result ); - } - } - return result; - } - if ( dword_F8B19C != 2 ) - { - if ( dword_F8B19C != 3 ) - { - result = dword_F8B19C - 4; - if ( dword_F8B19C == 4 ) - { - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - 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 ) - { - v2 = pMouse->GetCursorPos(&a2)->x - 14; - v117 = (v2 >> 5) + 14 * ((pMouse->GetCursorPos(&v98)->y - 17) >> 5); - result = (int)pMouse->GetCursorPos(&v111); - if ( *(int *)result > 13 ) - { - result = (int)pMouse->GetCursorPos(&v103); - if ( *(int *)result < 462 ) - { - result = v0->GetItemIDAtInventoryIndex((int *)&v117); - v3 = 0; - if ( result ) - { - v96 = 0; - v94 = 4; - v4 = (char *)&_this->pInventoryItems[result-1]; - if ( v4[20] & 1 ) - { - v5 = BuilDialogueString("%24", uActiveCharacter - 1, (ItemGen *)v4, (char *)window_SpeakInHouse->ptr_1C, 4, 0); - v97 = 3; - v95 = v5; - v92 = white; - v6 = (212 - pFontArrus->CalcTextHeight(v5, &v112, 0, 0)) / 2 + 101; - return (int)v112.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); - } - v93 = window_SpeakInHouse->ptr_1C; - v90 = (ItemGen *)v4; - v7 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v8 = ((Player *)_this)->_490EEE((ItemGen *)v4, 3, v7, 4); - v9 = uPlayerID; - v10 = (char *)pMerchantsIdentifyPhrases[v8]; - goto LABEL_35; - } - } - } - } - } - return result; - } - draw_leather(); - CharacterUI_InventoryTab_Draw(uActiveCharacter, 1); - 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, - v117 = (v11 >> 5) + 14 * ((pMouse->GetCursorPos(&v99)->y - 17) >> 5), - result = (int)pMouse->GetCursorPos(&v105), - *(int *)result <= 13) - || (result = (int)pMouse->GetCursorPos(&v101), *(int *)result >= 462) - || (result = v0->GetItemIDAtInventoryIndex((int *)&v117), v3 = 0, !result) ) - return result; - v96 = 0; - v94 = 3; - v93 = window_SpeakInHouse->ptr_1C; - v90 = (ItemGen *)&_this->pInventoryItems[result-1]; - v12 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v13 = _this->_490EEE(v90, 3, v12, 3); - v9 = uPlayerID; - v10 = (char *)pMerchantsSellPhrases[v13]; -LABEL_35: - v30 = BuilDialogueString(v10, v9, v90, (char *)v93, v94, v96); - v97 = 3; - v95 = v30; - v92 = white; - v91 = v3; - v89 = v3; - v88 = &v112; -LABEL_61: - v6 = (174 - pFontArrus->CalcTextHeight(v30, v88, v89, v91)) / 2 + 138; - return (int)v112.DrawTitleText(pFontArrus, v3, v6, v92, v95, v97); - } - } - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v3 = 0; - v49 = 0; - v122 = 0; - if ( dword_F8B19C == 2 ) - { - do - { - // 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 = ItemsInShopTexture[v49]; - v51 = 152 - v50->uTextureHeight; - if ( (signed int)v51 < 1 ) - v51 = 0; - v52 = 75 * v49 - v50->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v53 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v52 > 457 - v53 ) - v52 = 457 - v53; - } - } - else - { - if ( (signed int)v52 < 18 ) - v52 = 18; - } - pRenderer->DrawTextureTransparent(v52, v51, v50); - sub_40F92A(&pRenderer->pActiveZBuffer[v52 + 640 * v51], ItemsInShopTexture[v122], v122 + 1); - v49 = v122; - } - ++v49; - v122 = v49; - } - while ( v49 < 6 ); - v122 = 0; - do - { - //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 = ItemsInShopTexture[v122 + 6]; - v55 = 306 - v54->uTextureHeight; - v56 = 75 * v122 - v54->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v57 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v56 > 457 - v57 ) - v56 = 457 - v57; - } - } - else - { - if ( (signed int)v56 < 18 ) - v56 = 18; - } - pRenderer->DrawTextureTransparent(v56, v55, v54); - sub_40F92A(&pRenderer->pActiveZBuffer[v56 + 640 * v55], ItemsInShopTexture[v122 + 6], v122 + 7); - } - ++v122; - } - while ( v122 < 6 ); - } - else - { - do - { - // if ( pParty->field_C59C[9 * (v49 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - 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; - v60 = 75 * v49 - v58->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v61 = ItemsInShopTexture[5]->uTextureWidth; - if ( (signed int)v60 > 457 - v61 ) - v60 = 457 - v61; - } - } - else - { - if ( (signed int)v60 < 18 ) - v60 = 18; - } - pRenderer->DrawTextureTransparent(v60, v59, v58); - sub_40F92A(&pRenderer->pActiveZBuffer[v60 + 640 * v59], ItemsInShopTexture[v122], v122 + 1); - v49 = v122; - } - ++v49; - v122 = v49; - } - while ( v49 < 6 ); - v122 = 0; - do - { - //if ( pParty->Spell_Item[(unsigned int)window_SpeakInHouse->ptr_1C][v49] + 778] ) //weak - 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; - v64 = 75 * v122 - v62->uTextureWidth / 2 + 40; - if ( v122 ) - { - if ( v122 == 5 ) - { - v65 = ItemsInShopTexture[11]->uTextureWidth; - if ( (signed int)v64 > 457 - v65 ) - v64 = 457 - v65; - } - } - else - { - if ( (signed int)v64 < 18 ) - v64 = 18; - } - pRenderer->DrawTextureTransparent(v64, v63, v62); - sub_40F92A(&pRenderer->pActiveZBuffer[v64 + 640 * v63], ItemsInShopTexture[v122 + 6], v122 + 7); - } - ++v122; - } - while ( v122 < 6 ); - } - result = sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win(); - if ( result ) - { - v66 = 0; - v117 = 0; - if ( dword_F8B19C == 2 ) - { - do - { - if ( pParty->StandartItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID); //9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)] ) - ++v117; - ++v66; - } - while ( v66 < 12 ); - } - else - { - do - { - //if ( pParty->field_C59C[9 * (v66 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C) + 724] ) - if (pParty->SpecialItemsInShops[(unsigned int)window_SpeakInHouse->ptr_1C][v66].uItemID) - ++v117; - ++v66; - } - while ( v66 < 12 ); - } - v67 = GetAsyncKeyState(VK_CONTROL); - v68 = _this->CanSteal(); - Str = (char *)v68; - if ( v67 && v68 ) - { - v69 = pGlobalTXT_LocalizationStrings[185];// "Steal item" - } - else - { - v69 = pGlobalTXT_LocalizationStrings[195];// "Select the Item to Buy" - if ( dword_F8B19C != 2 ) - v69 = pGlobalTXT_LocalizationStrings[196];// "Select the Special Item to Buy" - } - DrawTextAtStatusBar(v69, 0); - if ( !v117 ) - { - 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 ) - { - v71 = (pRenderer->pActiveZBuffer[result] & 0xFFFF) - 1; - v117 = v71; - v72 = (int)window_SpeakInHouse->ptr_1C; - // v73 = 9 * (v71 + 12 * v72); - v74 = (ItemGen *)&pParty->StandartItemsInShops[v72][v71]; - if ( dword_F8B19C != 2 ) - // v74 = (ItemGen *)&pParty->field_C59C[v73 + 724]; - v74 =&pParty->SpecialItemsInShops[v72][v71]; - if ( v67 && Str ) - { - v10 = pGlobalTXT_LocalizationStrings[181];// "Steal %24" - v96 = 0; - v94 = 2; - v93 = window_SpeakInHouse->ptr_1C; - v90 = v74; - v9 = uActiveCharacter - 1; - } - else - { - v96 = 0; - v94 = 2; - v93 = window_SpeakInHouse->ptr_1C; - v90 = v74; - uPlayerID = uActiveCharacter - 1; - v75 = _this->_490EEE(v74, 3, v72, 2); - v9 = uPlayerID; - v10 = (char *)pMerchantsBuyPhrases[v75]; - } - goto LABEL_35; - } - } - return result; -} //----- (004BC49B) -------------------------------------------------------- void OnSelectDialogueOption(DIALOGUE_TYPE newDialogueType) @@ -12216,713 +11103,6 @@ -//----- (004B5D7C) -------------------------------------------------------- -void GuildDialog() -{ - GUIWindow *v0; // ebx@1 - Player *currPlayer; // edi@1 - signed int base_teach_price; // ebx@1 - int v3; // edi@6 - int result; // eax@11 - unsigned int v5; // ebx@13 - int v6; // esi@13 - signed int v7; // esi@17 - int v8; // esi@22 - signed int v9; // ecx@22 - char *v10; // eax@22 - const char *statusbar_string; // ecx@26 - POINT *v12; // esi@30 - int v13; // ecx@30 - void *v14; // ST1C_4@31 - ItemGen *v15; // ST18_4@31 - int v16; // ST10_4@31 - int v17; // eax@31 - char *v18; // edx@31 - int v19; // eax@32 - GUIWindow *v20; // edi@35 - int v21; // esi@35 - int v22; // eax@35 - unsigned int v23; // eax@36 - int v24; // eax@39 - int v25; // eax@40 - int v26; // ecx@47 - GUIButton *v27; // eax@49 - GUIButton *v28; // esi@49 - unsigned int v29; // eax@49 - char *v30; // eax@52 - int v31; // eax@55 - unsigned int v32; // ecx@55 - int v33; // eax@55 - unsigned __int16 v34; // ax@55 - int v35; // eax@58 - const char *v36; // ST20_4@61 - unsigned __int16 v37; // ST1C_2@61 - int v38; // eax@61 - GUIWindow *v39; // [sp-18h] [bp-304h]@31 - int v40; // [sp-14h] [bp-300h]@31 - int v41; // [sp-10h] [bp-2FCh]@31 - unsigned __int16 v42; // [sp-Ch] [bp-2F8h]@31 - char *v43; // [sp-8h] [bp-2F4h]@31 - unsigned int v44; // [sp-4h] [bp-2F0h]@31 - char Dest[100]; // [sp+Ch] [bp-2E0h]@3 - char v46[100]; // [sp+70h] [bp-27Ch]@3 - char v47[100]; // [sp+D4h] [bp-218h]@3 - char v48[100]; // [sp+138h] [bp-1B4h]@3 - char v49[100]; // [sp+19Ch] [bp-150h]@3 - POINT v50; // [sp+264h] [bp-88h]@30 - POINT v51; // [sp+26Ch] [bp-80h]@30 - GUIWindow working_window; // [sp+274h] [bp-78h]@1 - signed int v53; // [sp+27Ch] [bp-70h]@1 - signed int v54; // [sp+284h] [bp-68h]@1 - int v55; // [sp+2C8h] [bp-24h]@47 - int main_text_color; // [sp+2CCh] [bp-20h]@1 - int hi_text_color; // [sp+2D0h] [bp-1Ch]@1 - Player *v58; // [sp+2D4h] [bp-18h]@1 - unsigned __int8 uPlayerID; // [sp+2DBh] [bp-11h]@31 - char *Str; // [sp+2DCh] [bp-10h]@35 - int v61; // [sp+2E0h] [bp-Ch]@35 - unsigned int v62; // [sp+2E4h] [bp-8h]@13 - int v63; // [sp+2E8h] [bp-4h]@1 - - v0 = window_SpeakInHouse; - memcpy(&working_window, window_SpeakInHouse, sizeof(GUIWindow)); - v58 = pPlayers[uActiveCharacter]; - currPlayer = v58; - working_window.uFrameX = 483; - working_window.uFrameWidth = 148; - working_window.uFrameZ = 334; - main_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - hi_text_color = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - //v2 = (signed __int64)(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C] * 500.0); - base_teach_price = (signed __int64)(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier * 500.0); - v63 = base_teach_price * (100 - currPlayer->GetMerchant()) / 100; - if ( v63 < base_teach_price / 3 ) - v63 = base_teach_price / 3; - strcpy(Dest, ""); - strcpy(v46, ""); - strcpy(v47, ""); - strcpy(v48, ""); - strcpy(v49, ""); - if ( dword_F8B19C != 1 ) - { - if ( dword_F8B19C != 18 ) //buy skill - { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - //v3 = (int)(&currPlayer->uIntelligence + dword_F8B19C); //test skill - if ( v58->pActiveSkills[dword_F8B19C-36] ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[403], pClassNames[dword_F8B19C - 16]); //"You already know the %s skill" - ShowStatusBarString(pTmpBuf, 2u); - pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); - } - else - { - if ( pParty->uNumGold < v63 ) - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); //"You don't have enough gold" - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - } - else - { - Party::TakeGold(v63); - v58->pActiveSkills[dword_F8B19C-36] = 1; - } - } - } - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, 0); - return; - } - pRenderer->DrawTextureIndexed(8u, 8u, ShopTexture); - v5 = 0; - v6 = 0; - v62 = 0; - v63 = 32; - do - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v6].uItemID) - // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v6 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) - - { - pRenderer->DrawTextureTransparent(v63, 0x5Au, ItemsInShopTexture[v6]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 230528), ItemsInShopTexture[v6], v6 + 1); - currPlayer = v58; - } - v63 += 70; - v62 += 280; - ++v6; - } - while ( v63 < 452 ); - - v62 = 1680; - v7 = 6; - v63 = 32; - do - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v7].uItemID) - // if ( *(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 9 * (v7 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C)) ) - { - pRenderer->DrawTextureTransparent(v63, 0xFAu, ItemsInShopTexture[v7]); - ZBuffer_DoFill((int *)((char *)pRenderer->pActiveZBuffer + v62 + 638448), ItemsInShopTexture[v7], v7 + 1); - currPlayer = v58; - } - v63 += 70; - v62 += 280; - ++v7; - } - while ( v63 < 452 ); - - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v8 = 0; - v9 = 12; - // v10 = (char *)(&pParty->pPlayers[1].pInstalledBeacons[0].field_18 + 108 * (unsigned int)window_SpeakInHouse->ptr_1C); - // v10 = - do - { - if (pParty->SpellBooksInGuilds[window_SpeakInHouse->par1C-139][v9].uItemID ) - ++v8; - // v10 += 36; - --v9; - } - while ( v9 ); - - GetAsyncKeyState(17); - statusbar_string = pGlobalTXT_LocalizationStrings[195]; //"Select the Item to Buy" - if ( dword_F8B19C != 2 ) - statusbar_string = pGlobalTXT_LocalizationStrings[196]; //"Select the Special Item to Buy" - DrawTextAtStatusBar(statusbar_string, 0); - if ( !v8 ) - { - working_window.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; - } - v12 = pMouse->GetCursorPos(&v51); - result = v12->x + pSRZBufferLineOffsets[pMouse->GetCursorPos(&v50)->y]; - v13 = pRenderer->pActiveZBuffer[result] & 0xFFFF; - if ( pRenderer->pActiveZBuffer[result] & 0xFFFF ) - { - v14 = window_SpeakInHouse->ptr_1C; - v15 = (ItemGen *)(&pParty->pPlayers[1].uExpressionTimeLength + 18 * (v13 + 12 * (int)v14)); - v16 = (int)window_SpeakInHouse->ptr_1C; - uPlayerID = uActiveCharacter - 1; - v17 = currPlayer->_490EEE( (ItemGen *)&pParty->pPlayers[1].uExpressionTimeLength + v13 + 12 * (int)v14, 3, v16, 2); - v18 = BuilDialogueString((char *)pMerchantsBuyPhrases[v17], uPlayerID, v15, (char *)v14, 2, 0); - v19 = pFontArrus->CalcTextHeight(v18, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (174 - v19) / 2 + 138, main_text_color, v18, 3); - return; - } - } - return; - } - if ( !(unsigned __int16)_449B57_test_bit( - (unsigned __int8 *)currPlayer->_guilds_member_bits, - guild_mambership_flags[(unsigned int)window_SpeakInHouse->ptr_1C-139]) ) - { //you must me member - v38 = pFontArrus->CalcTextHeight(pNPCTopics[121].pText, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, 0, (212 - v38) / 2 + 101, hi_text_color, pNPCTopics[121].pText, 3u); - pDialogueWindow->pNumPresenceButton = 0; - return; - } - - if ( !sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - return; - v20 = pDialogueWindow; - v5 = 0; - v62 = 0; - Str = 0; - v21 = pDialogueWindow->pStartingPosActiveItem; - v22 = v21 + pDialogueWindow->pNumPresenceButton; - v61 = 0; - if ( pDialogueWindow->pStartingPosActiveItem >= pDialogueWindow->pStartingPosActiveItem+pDialogueWindow->pNumPresenceButton ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], pPlayers[uActiveCharacter]->pName, pClassNames[pPlayers[uActiveCharacter]->classType]); // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3); - return; - } - do - { - v23 = v20->GetControl(v21)->uControlParam; - if ( v23 == 18 ) - { - v25 = pFontArrus->CalcTextHeight(pGlobalTXT_LocalizationStrings[400], &working_window, 0, 0); //"Buy Spells" - v62 += v25; - ++v61; - } - else - { - - if((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v23-36])&&(v58->pActiveSkills[v23-36])) - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] - { - v24 = pFontArrus->CalcTextHeight(pClassNames[v23 - 16], &working_window, 0, 0); - v62 += v24; - ++v61; - ++Str; - } - } - ++v21; - } - while ( v21 < v20->pNumPresenceButton + v20->pStartingPosActiveItem ); - if ( !v61 ) - { -LABEL_64: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v58->pName, pClassNames[v58->classType]); // "Seek knowledge elsewhere %s the %s" - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); //"I can offer you nothing further." - v19 = pFontArrus->CalcTextHeight(pTmpBuf, &working_window, 0, 0); - working_window.DrawTitleText(pFontArrus, v5, (174 - v19) / 2 + 138, hi_text_color, pTmpBuf, 3); - return; - } - if ( Str ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v63); //"Skill Cost: %lu" - working_window.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - } - v63 = (signed int)(149 - v62) / v61; - if ( v63 > 32 ) - v63 = 32; - v26 = (signed int)(149 - v61 * v63 - v62) / 2 - v63 / 2 + 162; - v62 = v20->pStartingPosActiveItem; - v55 = v26; - if (v20->pStartingPosActiveItem < v20->pStartingPosActiveItem + v20->pNumPresenceButton ) - { - v61 = 2; - while ( 1 ) - { - v27 = v20->GetControl(v62); - v28 = v27; - v29 = v27->uControlParam; - if ( v29 == 18 ) - break; - - // __debugbreak(); - //pSkillAvailabilityPerClass[8 + v58->uClass][4 + v23] - // or - if ((byte_4ED970_skill_learn_ability_by_class_table[v58->classType][v29 - 36])&&(v58->pActiveSkills[v29-36])) - // or - //byte_4ED970_skill_learn_ability_by_class_table[v58->uClass - 1][v23 + 1] - - { - v30 = pClassNames[v29 -16]; -LABEL_55: - Str = v30; - v28->uY = v63 + v55; - v31 = pFontArrus->CalcTextHeight(v30, &working_window, 0, 0); - v32 = v28->uY; - v28->uHeight = v31; - v33 = v32 + v31 - 1; - v28->uW = v33; - v55 = v33; - v34 = hi_text_color; - if ( pDialogueWindow->pCurrentPosActiveItem != v61 ) - v34 = main_text_color; - working_window.DrawTitleText(pFontArrus, 0, v32, v34, Str, 3u); - v35 = v20->pStartingPosActiveItem; - ++v62; - ++v61; - if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem ) - return; - } - v28->uW = 0; - v28->uHeight = 0; - v28->uY = 0; -LABEL_58: - v35 = v20->pStartingPosActiveItem; - ++v62; - ++v61; - if ( (signed int)v62 >=v20->pNumPresenceButton +v20->pStartingPosActiveItem ) - return; - } - v30 = pGlobalTXT_LocalizationStrings[400]; //"Buy Spells" - goto LABEL_55; - } - return; -} - - - -//----- (004B705E) -------------------------------------------------------- -void TempleDialog() - { - GUIWindow *v0; // ebx@1 - Player *v1; // esi@1 - int v2; // edi@1 - int result; // eax@4 - GUIWindow *v4; // edi@6 - void *v5; // eax@6 - int v6; // eax@6 - unsigned int v7; // eax@8 - int v8; // ecx@8 - unsigned int v9; // eax@9 - int v10; // eax@11 - int v11; // eax@12 - GUIWindow *v12; // ecx@16 - int v13; // edx@16 - GUIButton *v14; // eax@19 - GUIButton *v15; // edi@19 - int v16; // eax@19 - const char *v17; // eax@21 - int v18; // eax@21 - unsigned int v19; // ecx@21 - int v20; // eax@21 - unsigned __int16 v21; // ax@21 - unsigned __int16 v22; // ST14_2@27 - int v23; // eax@27 - double v24; // st7@28 - unsigned int v25; // ebx@28 - DDM_DLV_Header *v26; // edi@29 - int v27; // eax@31 - int v28; // eax@32 - //unsigned int v29; // ecx@34 - unsigned int v30; // edx@36 - unsigned int v31; // edx@38 - unsigned int v32; // edx@40 - unsigned int v33; // edx@42 - unsigned int v34; // edx@44 - int v35; // edi@50 - signed int v36; // eax@50 - unsigned __int8 v37; // al@54 - int v38; // ecx@54 - GUIWindow *v39; // eax@56 - unsigned __int8 v40; // al@61 - GUIButton *v41; // edi@64 - int v42; // esi@66 - GUIWindow *v43; // ecx@66 - int v44; // edi@66 - int v45; // eax@68 - signed int v46; // edi@69 - int v47; // edi@71 - GUIButton *v48; // eax@73 - const char *v49; // edx@73 - GUIButton *v50; // esi@73 - int v51; // eax@73 - unsigned int v52; // ecx@73 - unsigned __int16 v53; // ax@73 - char a1[300]; // [sp+10h] [bp-1B4h]@64 - GUIWindow v57; // [sp+13Ch] [bp-88h]@1 - __int64 v58; // [sp+190h] [bp-34h]@1 - __int64 v59; // [sp+198h] [bp-2Ch]@1 - __int64 v60; // [sp+1A0h] [bp-24h]@1 - GUIWindow *v61; // [sp+1ACh] [bp-18h]@6 - unsigned int v62; // [sp+1B0h] [bp-14h]@8 - unsigned __int8 v63; // [sp+1B7h] [bp-Dh]@64 - int v64; // [sp+1B8h] [bp-Ch]@6 - unsigned int v65; // [sp+1BCh] [bp-8h]@6 - DDM_DLV_Header *v66; // [sp+1C0h] [bp-4h]@6 - - v0 = window_SpeakInHouse; - memcpy(&v57, window_SpeakInHouse, sizeof(v57)); - v57.uFrameX = 483; - v57.uFrameWidth = 148; - v57.uFrameZ = 334; - HIDWORD(v58) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu); - HIDWORD(v59) = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu); - v1 = pPlayers[uActiveCharacter]; - //v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents_minus1__20[13 * (unsigned int)v0->ptr_1C]); - v2 = pPlayers[uActiveCharacter]->_4B807C(p2DEvents[(unsigned int)v0->ptr_1C - 1].fPriceMultiplier); - HIDWORD(v60) = v2; - if ( dword_F8B19C != 1 ) - { - if ( dword_F8B19C != 10 ) - { - if ( dword_F8B19C != 11 ) - { - - if ( dword_F8B19C == 96 ) - { - if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) - { - v4 = pDialogueWindow; - v61 = pDialogueWindow; - v5 = window_SpeakInHouse->ptr_1C; - v66 = 0; - //v65 = (signed __int64)(*(float *)&p2DEvents_minus1__24[13 * (signed int)v5] * 500.0); - v65 = (signed __int64)(p2DEvents[(signed int)v5 - 1].flt_24 * 500.0); - v6 = v1->GetMerchant(); - v64 = (signed int)(v65 * (100 - v6)) / 100; - if ( v64 < (signed int)v65 / 3 ) - v64 = (signed int)v65 / 3; - v7 = v4->pStartingPosActiveItem; - v8 = v7 + v4->pNumPresenceButton; - v65 = 0; - v62 = v7; - if ( (signed int)v7 >= v8 ) - goto LABEL_78; - do - { - v9 = v4->GetControl(v62)->uControlParam - 36; - if ( byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v9] && !v1->pActiveSkills[v9] ) - { - v10 = pFontArrus->CalcTextHeight(pSkillNames[v9], &v57, 0, 0); - v66 = (DDM_DLV_Header *)((char *)v66 + v10); - ++v65; - } - v11 = v4->pStartingPosActiveItem; - ++v62; - } - while ( (signed int)v62 < v4->pNumPresenceButton + v11 ); - if ( v65 ) - { - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[401], v64); - v57.DrawTitleText(pFontArrus, 0, 0x92u, 0, pTmpBuf, 3u); - v64 = (149 - (signed int)v66) / (signed int)v65; - if ( v64 > 32 ) - v64 = 32; - v65 = (signed int)(149 - v65 * v64 - (int)v66) / 2 - v64 / 2 + 162; - v12 = v61; - result = v61->pStartingPosActiveItem; - v13 = result + v61->pNumPresenceButton; - v62 = v61->pStartingPosActiveItem; - if ( result < v13 ) - { - v66 = (DDM_DLV_Header *)2; - while ( 1 ) - { - v14 = v12->GetControl(v62); - v15 = v14; - v16 = v14->uControlParam - 36; - if ( !byte_4ED970_skill_learn_ability_by_class_table[v1->classType][v16] || v1->pActiveSkills[v16] ) - { - v15->uW = 0; - v15->uHeight = 0; - v15->uY = 0; - } - else - { - v17 = pSkillNames[v16]; - v15->uY = v64 + v65; - HIDWORD(v60) = (uint32)v17; - v18 = pFontArrus->CalcTextHeight(v17, &v57, 0, 0); - v19 = v15->uY; - v15->uHeight = v18; - v20 = v19 + v18 - 1; - v15->uW = v20; - v65 = v20; - v21 = WORD2(v59); - if ( (DDM_DLV_Header *)pDialogueWindow->pCurrentPosActiveItem != v66 ) - v21 = WORD2(v58); - v57.DrawTitleText(pFontArrus, 0, v19, v21, (const char *)HIDWORD(v60), 3u); - } - result = (int)v61; - ++v62; - v66 = (DDM_DLV_Header *)((char *)v66 + 1); - if ( (signed int)v62 >= v61->pNumPresenceButton + v61->pStartingPosActiveItem ) - break; - v12 = v61; - } - } - } - else - { -LABEL_78: - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[544], v1->pName, pClassNames[v1->classType]); - strcat(pTmpBuf, "\n \n"); - strcat(pTmpBuf, pGlobalTXT_LocalizationStrings[528]); - v22 = WORD2(v59); - v23 = pFontArrus->CalcTextHeight(pTmpBuf, &v57, 0, 0); - result = (int)v57.DrawTitleText(pFontArrus, 0, (174 - v23) / 2 + 138, v22, pTmpBuf, 3u); - } - } - } - return; - } - - // DONATION - //v24 = p2DEvents_minus1__20[13 * (unsigned int)ptr_507BC0->ptr_1C]; - v24 = p2DEvents[(unsigned int)window_SpeakInHouse->ptr_1C - 1].fPriceMultiplier; - v25 = 0; - if ( pParty->uNumGold >= (unsigned int)(signed __int64)v24 ) - { - Party::TakeGold((signed __int64)v24); - v26 = &pOutdoor->ddm; - if ( uCurrentlyLoadedLevelType != LEVEL_Outdoor ) - v26 = &pIndoor->dlv; - v27 = v26->uReputation; - v66 = v26; - if ( v27 > -5 ) - { - v28 = v27 - 1; - v26->uReputation = v28; - if ( v28 < -5 ) - v26->uReputation = -5; - } - if ( (unsigned __int8)byte_F8B1EF[uActiveCharacter] == pParty->uDaysPlayed % 7 ) - { - if ( v26->uReputation <= -5 ) - { - v30 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v30) = v30 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_AIR_WIZARD_EYE, uActiveCharacter - 1, v30, 48, 0); - } - if ( v26->uReputation <= -10 ) - { - v31 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v31) = v31 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_SPIRIT_PRESERVATION, uActiveCharacter - 1, v31, 48, 0); - v26 = v66; - } - if ( v26->uReputation <= -15 ) - { - v32 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v32) = v32 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_BODY_PROTECTION_FROM_MAGIC, uActiveCharacter - 1, v32, 48, 0); - v26 = v66; - } - if ( v26->uReputation <= -20 ) - { - v33 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v33) = v33 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_HOUR_OF_POWER, uActiveCharacter - 1, v33, 48, 0); - v26 = v66; - } - if ( v26->uReputation <= -25 ) - { - v34 = pParty->uDaysPlayed % 7 + 1; - LOBYTE(v34) = v34 | 0x80; - _42777D_CastSpell_UseWand_ShootArrow(SPELL_LIGHT_DAY_OF_PROTECTION, uActiveCharacter - 1, v34, 48, 0); - } - } - ++byte_F8B1EF[uActiveCharacter]; - v1->PlaySound(SPEECH_83, 0); - ShowStatusBarString(pGlobalTXT_LocalizationStrings[527], 2u); // "Thank You!" - goto LABEL_46; - } - goto LABEL_55; - } - if ( !v1->_4B6FF9() ) - return; - v25 = 0; - if ( pParty->uNumGold < v2 ) - { -LABEL_55: - ShowStatusBarString(pGlobalTXT_LocalizationStrings[155], 2u); - HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - goto LABEL_46; - } - Party::TakeGold(v2); - v35 = LODWORD(v1->pConditions[17]); - v59 = v1->pConditions[14]; - v58 = v1->pConditions[15]; - v60 = v1->pConditions[16]; - v61 = (GUIWindow *)HIDWORD(v1->pConditions[17]); - memset(v1, 0, 0xA0u); - v1->sHealth = v1->GetMaxHealth(); - v1->sMana = v1->GetMaxMana(); - v36 = (signed int)window_SpeakInHouse->ptr_1C; - if ( v36 != 78 && (v36 <= 80 || v36 > 82) ) - { - if ( (unsigned int)v61 | v35 ) - { - v37 = LOBYTE(v1->field_1928); - v38 = v1->field_1924; - v1->uFace = v37; - v1->uVoiceID = v38; - ReloadPlayerPortraits(uActiveCharacter - 1, (char)v37); - } - goto LABEL_63; - } - v39 = v61; - if ( (unsigned int)v61 | v35 ) - { - LODWORD(v1->pConditions[17]) = v35; - } - else - { - if ( !v60 && !v58 && !v59 ) - goto LABEL_63; - v1->field_1928 = v1->uFace; - v1->field_1924 = v1->uVoiceID; - v1->SetCondition(0x11u, 1); - v1->uVoiceID = (v1->GetSexByVoice() != 0) + 23; - v40 = (v1->GetSexByVoice() != 0) + 23; - v1->uFace = v40; - ReloadPlayerPortraits(uActiveCharacter - 1, (char)v40); - LODWORD(v1->pConditions[17]) = LODWORD(pParty->uTimePlayed); - v39 = (GUIWindow *)HIDWORD(pParty->uTimePlayed); - } - HIDWORD(v1->pConditions[17]) = (int)v39; -LABEL_63: - pAudioPlayer->PlaySound((SoundID)(SOUND_GoldReceived|0x2), -1, 0, -1, 0, 0, 0, 0); - v1->PlaySound(SPEECH_82, 0); - pOtherOverlayList->_4418B1(20, uActiveCharacter + 99, 0, 65536); -LABEL_46: - pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 1, v25); - return ; // void func - } - v63 = 1; - v41 = pDialogueWindow->GetControl(pDialogueWindow->pStartingPosActiveItem); - strcpy(a1, ""); - v41->uHeight = 0; - v41->uY = 0; - if ( v1->_4B6FF9() ) - { - sprintf(a1, "%s %d %s", pGlobalTXT_LocalizationStrings[104], HIDWORD(v60), pGlobalTXT_LocalizationStrings[97]); - v63 = 0; - } - strcpy(&a1[100], pGlobalTXT_LocalizationStrings[68]); - strcpy(&a1[200], pGlobalTXT_LocalizationStrings[160]); - v42 = v63; - v43 = pDialogueWindow; - v44 = v63; - v66 = 0; - if ( v63 < pDialogueWindow->pNumPresenceButton ) - { - v61 = (GUIWindow *)&a1[100 * v63]; - do - { - v45 = pFontArrus->CalcTextHeight((const char *)v61, &v57, 0, 0); - v66 = (DDM_DLV_Header *)((char *)v66 + v45); - v43 = pDialogueWindow; - v61 = (GUIWindow *)((char *)v61 + 100); - ++v44; - } - while ( v44 < pDialogueWindow->pNumPresenceButton ); - } - v46 = v43->pNumPresenceButton - v42; - v64 = (174 - (signed int)v66) / v46; - if ( v64 > 32 ) - v64 = 32; - v47 = (174 - v64 * v46 - (signed int)v66) / 2 - v64 / 2 + 138; - v65 = v42 + v43->pStartingPosActiveItem; - if ( v42 + v43->pStartingPosActiveItem < v43->pStartingPosActiveItem + v43->pNumPresenceButton ) - { - v61 = (GUIWindow *)(v42 + 2); - v66 = (DDM_DLV_Header *)&a1[100 * v42]; - do - { - v48 = v43->GetControl(v65); - v49 = (const char *)v66; - v50 = v48; - v48->uY = v64 + v47; - v51 = pFontArrus->CalcTextHeight(v49, &v57, 0, 0); - v52 = v50->uY; - v50->uHeight = v51; - v47 = v52 + v51 - 1; - v50->uW = v47; - v53 = WORD2(v59); - if ( (GUIWindow *)pDialogueWindow->pCurrentPosActiveItem != v61 ) - v53 = WORD2(v58); - v57.DrawTitleText(pFontArrus, 0, v52, v53, (const char *)v66, 3u); - v43 = pDialogueWindow; - v66 = (DDM_DLV_Header *)((char *)v66 + 100); - v61 = (GUIWindow *)((char *)v61 + 1); - ++v65; - } - while ( (signed int)v65 < pDialogueWindow->pNumPresenceButton + pDialogueWindow->pStartingPosActiveItem ); - } - return; -} - - //----- (004B6478) -------------------------------------------------------- int __cdecl sub_4B6478() @@ -12984,7 +11164,7 @@ v4 = v3 / 3; v32 = v3 / 3; } - if ( dword_F8B19C != 1 ) + if ( dialog_menu_id != 1 ) { if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -12999,7 +11179,7 @@ if (false //if ( !*(&byte_4ED94C[37 * v1->uClass / 3] + dword_F8B19C) - || (v6 = (int)(&v1->uIntelligence + dword_F8B19C), *(short *)v6) ) + || (v6 = (int)(&v1->uIntelligence + dialog_menu_id), *(short *)v6) ) { pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); } @@ -13224,7 +11404,7 @@ s1 = v4 * (100 - v1->GetMerchant()) / 100; if ( (signed int)s1 < v4 / 3 ) s1 = v4 / 3; - if ( dword_F8B19C == 1 ) + if ( dialog_menu_id == 1 ) { if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { @@ -13366,7 +11546,7 @@ } else { - if ( dword_F8B19C > 104 && dword_F8B19C <= 108 ) + if ( dialog_menu_id > 104 && dialog_menu_id <= 108 ) { if ( pParty->uNumGold < s1 ) { @@ -13381,7 +11561,7 @@ } Party::TakeGold(s1); v47[1] = (const char *)7; - v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + dword_F8B19C)]; + v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + dialog_menu_id)]; if ( v5[pParty->uDaysPlayed % 7 + 1] ) { if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[(unsigned __int8)*v5].pFilename) ) @@ -13462,7 +11642,7 @@ } else { - dword_F8B19C = 1; + dialog_menu_id = 1; pAudioPlayer->PlaySound(SOUND_27, 0, 0, -1, 0, 0, 0, 0); } } @@ -13941,7 +12121,6 @@ - //----- (00444732) -------------------------------------------------------- char *GetEventHintString(unsigned int uEventID) { @@ -14108,284 +12287,3 @@ return result; } -//----- (0044606A) -------------------------------------------------------- -void PrepareHouse(HOUSE_ID house) -{ - //unsigned int v1; // ebx@1 - //signed int v2; // esi@1 - //int uExitPic; // edi@1 - __int16 uExitMapID; // ax@2 - //int result; // eax@5 - //unsigned int *v6; // ecx@8 - int v7; // ebx@11 - //int v8; // esi@16 - //unsigned int v9; // eax@16 - //unsigned int v10; // eax@19 - //int v11; // ecx@19 - //char pContainer[36]; // [sp+Ch] [bp-54h]@16 - int v13; // [sp+30h] [bp-30h]@11 - int Dst[6]; // [sp+34h] [bp-2Ch]@1 - //unsigned int v15; // [sp+4Ch] [bp-14h]@1 - int uAnimationID; // [sp+50h] [bp-10h]@1 - //unsigned int *v17; // [sp+54h] [bp-Ch]@3 - //unsigned int v18; // [sp+58h] [bp-8h]@1 - //int v19; // [sp+5Ch] [bp-4h]@7 - - //v15 = uHouseID; - //v1 = 52 * uHouseID; - //uAnimationID = p2DEvents_minus1___02[26 * uHouseID]; - uAnimationID = p2DEvents[house - 1].uAnimationID; - //v18 = 52 * uHouseID; - memset(Dst, 0, 0x18u); - //uExitPic = *(__int16 *)((char *)p2DEvents_minus1_::2C + v1); - //uExitPic = p2DEvents[uHouseID - 1].uExitPicID; - uNumDialogueNPCPortraits = 0; - uHouse_ExitPic = p2DEvents[house - 1].uExitPicID; - if ( uHouse_ExitPic ) - { - //uExitMapID = *(__int16 *)((char *)p2DEvents_minus1_::30 + v1); - uExitMapID = p2DEvents[house - 1]._quest_related; - if ( uExitMapID > 0 ) - { - //v17 = (unsigned int *)(uExitMapID - 1); - if(_449B57_test_bit(pParty->_quest_bits,uExitMapID)) - // if ( !((unsigned __int8)(0x80u >> (uExitMapID - 1) % 8) & pParty->_quest_bits[(uExitMapID - 1) >> 3]) ) - { - //uExitPic = 0; - uHouse_ExitPic = 0; - } - } - } - - dword_591080 = pAnimatedRooms[uAnimationID].field_8; - //result = dword_591080; - - //v2 = 0; - uNumDialogueNPCPortraits = 0; - if ( dword_591080 ) - { - //v2 = 1; - Dst[0] = dword_591080; - uNumDialogueNPCPortraits = 1; - } - - //v19 = 1; - for (uint i = 0; i < pNPCStats->uNumNewNPCs; ++i) - { - auto npc = pNPCStats->pNewNPCData + i; - //v6 = &pNPCStats->pNewNPCData[1].uFlags; - //v17 = &pNPCStats->pNewNPCData[1].uFlags; - //do - //{ - if (npc->Location2D == house ) - { - if (~npc->uFlags & 0x80) - //if ( !(*(char *)v6 & 0x80) ) - { - v7 = uNumDialogueNPCPortraits++ - dword_591080 ? 1 : 0; - HouseNPCData[v7] = npc; - //v6 = v17; - //*(&v13 + v2) = *(v17 - 1); - Dst[uNumDialogueNPCPortraits - 1] = npc->uPortraitID; - //v1 = v18; - if ((npc->uFlags & 3) != 2) - ++npc->uFlags; - } - } - //++v19; - //v6 += 19; - //v17 = v6; - //} - //while ( v19 < (signed int)pNPCStats->uNumNewNPCs ); - } - //uNumDialogueNPCPortraits = v2; - - //v19 = 0; - for (uint i = 0; i < uNumDialogueNPCPortraits; ++i) - //if ( v2 > 0 ) - { - //do - //{ - //v8 = v19; - char icon_name[128]; - sprintfex(icon_name, "npc%03u", Dst[i]); - //v9 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - //++v19; - pDialogueNPCPortraits[i] = pIcons_LOD->LoadTexturePtr(icon_name, TEXTURE_16BIT_PALETTE); - //result = v19; - //} - //while ( v19 < uNumDialogueNPCPortraits ); - //uExitPic = uHouse_ExitPic; - } - - if (uHouse_ExitPic) - { - //v10 = pIcons_LOD->LoadTexture(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); - //v11 = uNumDialogueNPCPortraits++; - pDialogueNPCPortraits[uNumDialogueNPCPortraits++] = pIcons_LOD->LoadTexturePtr(pHouse_ExitPictures[uHouse_ExitPic], TEXTURE_16BIT_PALETTE); - //result = *(__int16 *)((char *)p2DEvents_minus1_::2E + v1); - //result = p2DEvents[house - 1].uExitMapID; - uHouse_ExitPic = p2DEvents[house - 1].uExitMapID; - } - //return result; -} - - - -//----- (0044622E) -------------------------------------------------------- -bool EnterHouse(enum HOUSE_ID uHouseID) - { - //enum HOUSE_ID v1; // edi@1 - //int v2; // edi@5 - signed int uOpenTime; // eax@5 - signed int uCloseTime; // esi@5 - unsigned int v5; // esi@5 - int v6; // edx@5 - signed int am_pm_flag_open; // ecx@10 - signed int am_pm_flag_close; // eax@10 - int v9; // esi@10 - //unsigned int v10; // esi@16 - int v11; // ecx@17 - unsigned int v12; // kr00_4@25 - //Player *v13; // esi@25 - int v14; // eax@25 - //Player *v15; // esi@27 - //signed int v16; // eax@32 - unsigned int v17; // eax@37 - signed int v18; // edi@37 - signed int v19; // edi@41 - //unsigned int v20; // ecx@41 - //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_ID v25; // [sp+38h] [bp-4h]@1 - - //v1 = uHouseID; - //v25 = uHouseID; - GameUI_StatusBar_TimedString[0] = 0; - pStatusBarString[0] = 0; - ShowStatusBarString("", 2u); - if ( pMessageQueue_50CBD0->uNumMessages ) - pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0; - viewparams->bRedrawGameUI = 1; - uDialogueType = 0; - pKeyActionMap->_459ED1(3); - pKeyActionMap->ResetKeys(); - if (uHouseID == HOUSE_600 || uHouseID == HOUSE_601) - { - GameOverMenu(0); - return 0; - } - uOpenTime = p2DEvents[uHouseID - 1].uOpenTime; - uCloseTime = p2DEvents[uHouseID - 1].uCloseTime; - ptr_F8B1E8 = 0; - dword_F8B1E4 = 0; - dword_F8B1F4 = 0; - memset(byte_F8B1F0, 0, 4); - memset(byte_F8B148, 0, 16); - pRenderer->ClearZBuffer(0, 479); - - if (((uCloseTime - 1 <= uOpenTime)&&((pParty->uCurrentHour <uOpenTime)&&(pParty->uCurrentHour >(uCloseTime - 1))))|| - ((uCloseTime - 1 > uOpenTime)&&((pParty->uCurrentHour < uOpenTime)||(pParty->uCurrentHour > (uCloseTime - 1))))) - - { - am_pm_flag_open = 0; - am_pm_flag_close = 0; - if (uOpenTime > 12 ) - { - uOpenTime -= 12; - am_pm_flag_open = 1; - } - if ( uCloseTime > 12 ) - { - uCloseTime -= 12; - am_pm_flag_close = 1; - } - sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[414], uOpenTime, aAMPMNames[am_pm_flag_open], - uCloseTime, aAMPMNames[am_pm_flag_close]); //"This place is open from %d%s to %d%s" - ShowStatusBarString(pTmpBuf, 2u); - if ( uActiveCharacter ) - pPlayers[uActiveCharacter]->PlaySound(SPEECH_3, 0); - return 0; - } - else - { - //v10 = uHouseID; - if ( (signed int)uHouseID < 53 ) //entering shops and guilds - { - if ( !(pParty->field_3C._shop_ban_times[uHouseID]) - || (pParty->field_3C._shop_ban_times[uHouseID] <= pParty->uTimePlayed) ) - { - pParty->field_3C._shop_ban_times[uHouseID] = 0; - } - else - { - ShowStatusBarString(pGlobalTXT_LocalizationStrings[191], 2u);// "You've been banned from this shop!" - return 0; - } - } - if ( !start_event_seq_number ) - pAudioPlayer->StopChannels(-1, -1); - - uCurrentHouse_Animation = p2DEvents[uHouseID - 1].uAnimationID; - in_current_building_type = pAnimatedRooms[uCurrentHouse_Animation].uBuildingType; - if ( in_current_building_type == BildingType_Throne_Room && pParty->uFine ) // going 2 jail - { - uCurrentHouse_Animation = (signed __int16)p2DEvents[186].uAnimationID; - uHouseID = HOUSE_JAIL; - pParty->uTimePlayed = pParty->uTimePlayed+ 0x7620000; - in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE].uAnimationID].uBuildingType; - ++pParty->uNumPrisonTerms; - pParty->uFine = 0; - for (uint i = 0; i < 4; ++i) - { - pParty->pPlayers[i].uTimeToRecovery = 0; - pParty->pPlayers[i].uNumDivineInterventionCastsThisDay = 0; - pParty->pPlayers[i].SetVariable(VAR_Award, 87); - } - } - ++pIcons_LOD->uTexturePacksCount; - if ( !pIcons_LOD->uNumPrevLoadedFiles ) - pIcons_LOD->uNumPrevLoadedFiles = pIcons_LOD->uNumLoadedFiles; - switch (pParty->alignment) - { - case PartyAlignment_Good: sprintf(pContainer, "evt%02d-b", const_2()); break; - case PartyAlignment_Neutral: sprintf(pContainer, "evt%02d", const_2()); break; - case PartyAlignment_Evil: sprintf(pContainer, "evt%02d-c", const_2()); break; - default: assert(false); - } - - v17 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE); - pDialogueNPCCount = 0; - pTexture_Dialogue_Background = &pIcons_LOD->pTextures[v17]; - uTextureID_507B04 = uTextureID_right_panel; - PrepareHouse(uHouseID); - v18 = 1; - uTextureID_507B04 = uTextureID_right_panel; - if ( uNumDialogueNPCPortraits == 1 ) - pDialogueNPCCount = 1; - pVideoPlayer->_4BF28F(pAnimatedRooms[uCurrentHouse_Animation].video_name, 1u); - dword_5C35D4 = 1; - if ( (signed int)uHouseID < 139 || (signed int)uHouseID > 172 ) - { - if ( (signed int)uHouseID >= 54 && (signed int)uHouseID <= 73 && !sub_4B68EA(uHouseID - 54) ) - { - return 1; - } - } - else - { //guilds - v19 = guild_mambership_flags[uHouseID-139]; //guilds flags - //v20 = uHouseID; - //if ( !((unsigned __int8)(0x80u >> v19 % 8) & pPlayers[uActiveCharacter]->_guilds_member_bits[v19 /8]) ) - if(_449B57_test_bit((unsigned char*)pPlayers[uActiveCharacter]->_guilds_member_bits,v19)) - { - HousePlaySomeSound(uHouseID, 3); - return 1; - } - } - HousePlaySomeSound(uHouseID, 1); - dword_5C35D4 = 1; - return 1; - } - }
--- a/mm7_5.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/mm7_5.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -44,6 +44,7 @@ #include "Events2D.h" #include "texts.h" #include "Log.h" +#include "UIHouses.h" #include "mm7_data.h" @@ -15817,7 +15818,7 @@ if ( v5 ) { if ( a2 == 57 ) - v7 = pNPCTopics[512].pText; + v7 = pNPCTopics[512].pText; // Baby dragon else v7 = (const CHAR *)pNPCStats->pProfessions[v5->uProfession].pBenefits; lpsz = v7;
--- a/mm7_data.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/mm7_data.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -68,205 +68,6 @@ Award pAwards[104]; #include "stru159.h" -stru159 pAnimatedRooms[196] = //0x4E5F70 -{ - {"", 0x4, 0x1F4, 0, 0, 0}, - {"Human Armor01", 0x20, 0x2C0, 2, 58, 0}, -{"Necromancer Armor01", 0x20, 0x2D7, 2, 70, 0 }, -{"Dwarven Armor01", 0x20, 0x2EE, 2, 5, 0 }, -{"Wizard Armor", 0x20, 0x3BD, 2, 19, 0 }, -{"Warlock Armor", 0x20, 0x2D6, 2, 35, 0 }, -{"Elf Armor", 0x20, 0x2BC, 2, 79, 0 }, -{"Human Alchemisht01", 0xE, 0x2BE, 4, 95, 0 }, -{"Necromancer Alchemist01", 0xE, 0x2D6, 4, 69, 0 }, -{"Dwarven Achemist01", 0xE, 0x387, 4, 4, 0 }, -{"Wizard Alchemist", 0xE, 0x232, 4, 25, 0 }, -{"Warlock Alchemist", 0xE, 0x2BE, 4, 42, 0 }, -{"Elf Alchemist", 0xE, 0x38A, 4, 84, 0 }, -{"Human Bank01", 0x6, 0x384, 22, 52, 0 }, -{"Necromancer Bank01", 0x6, 0x2D8, 22, 71, 0 }, -{"Dwarven Bank", 0x6, 0x2F3, 22, 6, 0 }, -{"Wizard Bank", 0x6, 0x3BA, 22, 20, 0 }, -{"Warlock Bank", 0x6, 0x39F, 22, 36, 0 }, -{"Elf Bank", 0x6, 0x2BC, 22, 71, 0 }, -{"Boat01", 0xF, 0x4C, 28, 53, 3 }, -{"Boat01d", 0xF, 0x4C, 28, 53, 3 }, -{"Human Magic Shop01", 0xA, 0x2C8, 3, 54, 0 }, -{"Necromancer Magic Shop01", 0xE, 0x2DC, 3, 66, 0 }, -{"Dwarven Magic Shop01", 0x2A, 0x2EF, 3, 91, 0 }, -{"Wizard Magic Shop", 0x1E, 0x2DF, 3, 15, 0 }, -{"Warlock Magic Shop", 0x7, 0x3B9, 3, 15, 0 }, -{"Elf Magic Shop", 0x24, 0x2CC, 3, 82, 0 }, -{"Human Stables01", 0x21, 0x31, 27, 48, 3 }, -{"Necromancer Stables", 0x21, 0x2DD, 27, 67, 3 }, -{"", 0x21, 0x2F0, 27, 91, 3 }, -{"Wizard Stables", 0x21, 0x3BA, 27, 16, 3 }, -{"Warlock Stables", 0x21, 0x181, 27, 77, 3 }, -{"Elf Stables", 0x21, 0x195, 27, 77, 3 }, -{"Human Tavern01", 0xD, 0x2C2, 21, 49, 0 }, -{"Necromancer Tavern01", 0xD, 0x3B0, 21, 57, 0 }, -{"Dwarven Tavern01", 0xD, 0x2FE, 21, 94, 0 }, -{"Wizard Tavern", 0xD, 0x3BB, 21, 17, 0 }, -{"Warlock Tavern", 0xD, 0x3A8, 21, 33, 0 }, -{"Elf Tavern", 0xD, 0x2CD, 21, 78, 0 }, -{"Human Temple01", 0x24, 0x2DB, 23, 50, 3 }, -{"Necromancer Temple", 0x24, 0x2DF, 23, 60, 3 }, -{"Dwarven Temple01", 0x24, 0x2F1, 23, 86, 3 }, -{"Wizard Temple", 0x24, 0x2E0, 23, 10, 3 }, -{"Warlock Temple", 0x24, 0x3A4, 23, 27, 3 }, -{"Elf Temple", 0x24, 0x2CE, 23, 72, 3 }, -{"Human Town Hall", 0x10, 0x39C, 17, 14, 0 }, -{"Necromancer Town Hall01", 0x10, 0x3A4, 17, 61, 0 }, -{"Dwarven Town Hall", 0x10, 0x2DB, 17, 88, 0 }, -{"Wizard Town Hall", 0x10, 0x3BD, 17, 11, 0 }, -{"Warlock Town Hall", 0x10, 0x2DB, 17, 28, 0 }, -{"Elf Town Hall", 0x10, 0x27A, 17, 73, 0 }, -{"Human Training Ground01", 0x18, 0x2C7, 30, 44, 0 }, -{"Necromancer Training Ground", 0x18, 0x3AD, 30, 62, 0 }, -{"Dwarven Training Ground", 0x18, 0x2F2, 30, 89, 0 }, -{"Wizard Training Ground", 0x18, 0x3A3, 30, 12, 0 }, -{"Warlock Training Ground", 0x18, 0x3A6, 30, 29, 0 }, -{"Elf Training Ground", 0x18, 0x19F, 30, 74, 0 }, -{"Human Weapon Smith01", 0x16, 0x2C1, 1, 45, 4 }, -{"Necromancer Weapon Smith01", 0x16, 0x2D9, 1, 63, 4 }, -{"Dwarven Weapon Smith01", 0x16, 0x2EE, 1, 82, 4 }, -{"Wizard Weapon Smith", 0x16, 0x2D5, 1, 13, 4 }, -{"Warlock Weapon Smith", 0x16, 0x2D7, 1, 23, 4 }, -{"Elf Weapon Smith", 0x16, 0x2CA, 1, 75, 4 }, -{"Air Guild", 0x1D, 0xA4, 6, 1, 3 }, -{"Body Guild", 0x19, 0x3BF, 11, 2, 0 }, -{"DarkGuild", 0x19, 0x2D1, 13, 3, 0 }, -{"EarthGuild", 0x19, 0x2CB, 8, 83, 0 }, -{"Fire Guild", 0x1C, 0x2BF, 5, 56, 0 }, -{"Light Guild", 0x1C, 0x2D5, 12, 46, 0 }, -{"Mind Guild", 0x1C, 0xE5, 10, 40, 0 }, -{"Spirit Guild", 0x1C, 0x2D2, 9, 41, 0 }, -{"Water Guild", 0x1B, 0x2D3, 7, 24, 0 }, -{"Lord And Judge Out01", 1, 0, 29, 39, 0 }, -{"Human Poor House 1", 8, 0, 29, 0, 0 }, -{"Human Poor House 2", 8, 0, 29, 0, 0 }, -{"Human Poor House 3", 8, 0, 29, 0, 0 }, -{"Human Medium House 1", 8, 0, 29, 0, 0 }, -{"Human Medium House 2", 8, 0, 29, 0, 0 }, -{"Human Medium House 3", 8, 0, 29, 0, 0 }, -{"Human Rich House 1", 8, 0, 29, 0, 0 }, -{"Human Rich House 2", 8, 0, 29, 0, 0 }, -{"Human Rich House 3", 8, 0, 29, 0, 0 }, -{"Elven Poor House 1", 8, 0, 29, 0, 0 }, -{"Elven Poor House 2", 8, 0, 29, 0, 0 }, -{"Elven Poor House 3", 8, 0, 29, 0, 0 }, -{"Elven Medium House 1", 8, 0, 29, 0, 0 }, -{"Elven Medium House 2", 8, 0, 29, 0, 0 }, -{"Elven Medium House 3", 8, 0, 29, 0, 0 }, -{"Elven Rich House 1", 8, 0, 29, 0, 0 }, -{"Elven Rich House 2", 8, 0, 29, 0, 0 }, -{"Elven Rich House 3", 8, 0, 29, 0, 0 }, -{"Dwarven Poor House 1", 8, 0, 29, 0, 0 }, -{"Dwarven Poor House 2", 8, 0, 29, 0, 0 }, -{"Dwarven Poor House 3", 8, 0, 29, 0, 0 }, -{"Dwarven Medium House 1", 8, 0, 29, 0, 0 }, -{"Dwarven Medium house 2", 8, 0, 29, 0, 0 }, -{"Dwarven Medium House 3", 8, 0, 29, 0, 0 }, -{"Dwarven Rich House 1", 8, 0, 29, 0, 0 }, -{"Dwarven Rich House 2", 8, 0, 29, 0, 0 }, -{"Dwarven Rich House 3", 8, 0, 29, 0, 0 }, -{"Wizard Poor House 1", 8, 0, 29, 0, 0 }, -{"Wizard Poor House 2", 8, 0, 29, 0, 0 }, -{"Wizard Poor House 3", 8, 0, 29, 0, 0 }, -{"Wizard Medium House 1", 8, 0, 29, 0, 0 }, -{"Wizard Medium House 2", 8, 0, 29, 0, 0 }, -{"Wizard Mdeium House 3", 8, 0, 29, 0, 0 }, -{"Wizard Rich House 1", 8, 0, 29, 0, 0 }, -{"Wizard Rich House 2", 8, 0, 29, 0, 0 }, -{"Wizard Rich House 3", 8, 0, 29, 0, 0 }, -{"Necromancer Poor House 1", 8, 0, 29, 0, 0 }, -{"Necromancer Poor House 2", 8, 0, 29, 0, 0 }, -{"Necromancer Poor House 3", 8, 0, 29, 0, 0 }, -{"Necromancer Medium House 1", 8, 0, 29, 0, 0 }, -{"Necromancer Medium House 2", 8, 0, 29, 0, 0 }, -{"Necromancer Mdeium House 3", 8, 0, 29, 0, 0 }, -{"Necromancer Rich House 1", 8, 0, 29, 0, 0 }, -{"Necromancer Rich House 2", 8, 0, 29, 0, 0 }, -{"Necromancer Rich House 3", 8, 0, 29, 0, 0 }, -{"Warlock Poor House 1", 8, 0, 29, 0, 0 }, -{"Warlock Poor House 2", 8, 0, 29, 0, 0 }, -{"Warlock Poor House 3", 8, 0, 29, 0, 0 }, -{"Warlock Medium House 1", 8, 0, 29, 0, 0 }, -{"Warlock Medium House 2", 8, 0, 29, 0, 0 }, -{"Warlock Mdeium House 3", 8, 0, 29, 0, 0 }, -{"Warlock Rich House 1", 8, 0, 29, 0, 0 }, -{"Warlock Rich House 2", 8, 0, 29, 0, 0 }, -{"Warlock Rich House 3", 8, 0, 29, 0, 0 }, -{"Out01 Temple of the Moon", 0x24, 0, 25, 0, 0 }, -{"Out01 Dragon Cave", 0x24, 0, 25, 0, 0 }, -{"Out02 Castle Harmondy", 0x24, 0, 25, 0, 0 }, -{"Out02 White Cliff Cave", 0x24, 0, 25, 0, 0 }, -{"Out03 Erathian Sewer", 0x24, 0, 25, 0, 0 }, -{"Out03 Fort Riverstride", 0x24, 0, 25, 0, 0 }, -{"Out03 Castle Gryphonheart", 0x24, 0, 25, 0, 0 }, -{"Out04 Elf Castle", 0x24, 0, 25, 0, 0 }, -{"Out04 Tularean Caves", 0x24, 0, 25, 0, 0 }, -{"Out04 Clanker's Laboratory", 0x24, 0, 25, 0, 0 }, -{"Out05 Hall of the Pit", 0x24, 0, 25, 0, 0 }, -{"Out05 Watchtower 6", 0x24, 0, 25, 0, 0 }, -{"Out06 School of Sorcery", 0x24, 0, 25, 0, 0 }, -{"Out06 Red Dwarf Mines", 0x24, 0, 25, 0, 0 }, -{"Out07 Castle Lambert", 0x24, 0, 25, 0, 0 }, -{"Out07 Walls of Mist", 0x24, 0, 25, 0, 0 }, -{"Out07 Temple of the Light", 0x24, 0, 25, 0, 0 }, -{"Out08 Evil Entrance", 0x24, 0, 25, 0, 0 }, -{"Out08 Breeding Zone", 0x24, 0, 25, 0, 0 }, -{"Out08 Temple of the Dark", 0x24, 0, 25, 0, 0 }, -{"Out09 Grand Temple of the Moon", 0x24, 0, 25, 0, 0 }, -{"Out09 Grand Tempple of the Sun", 0x24, 0, 25, 0, 0 }, -{"Out10 Thunderfist Mountain", 0x24, 0, 25, 0, 0 }, -{"Out10 The Maze", 0x24, 0, 25, 0, 0 }, -{"Out10 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 }, -{"", 0x24, 0, 25, 0, 0 }, -{"", 0x24, 0, 25, 0, 0 }, -{"Out11 Stone City", 0x24, 0, 25, 0, 0 }, -{"", 0x24, 0, 25, 0, 0 }, -{"Out12 Colony Zod", 0x24, 0, 25, 0, 0 }, -{"Out12 Connecting Tunnel Cave #1", 0x24, 0, 25, 0, 0 }, -{"", 0x24, 0, 25, 0, 0 }, -{"", 0x24, 0, 25, 0, 0 }, -{"Out13 Mercenary Guild", 0x24, 0, 25, 0, 0 }, -{"Out13 Tidewater Caverns", 0x24, 0, 25, 0, 0 }, -{"Out13 Wine Cellar", 0x24, 0, 25, 0, 0 }, -{"Out14 Titan's Stronghold", 0x24, 0, 25, 0, 0 }, -{"Out14 Temple Of Baa", 0x24, 0, 25, 0, 0 }, -{"Out14 Hall under the Hill", 0x24, 0, 25, 0, 0 }, -{"Out15 The Linclon", 0x24, 0, 25, 0, 0 }, -{"Jail", 0x24, 0, 31, 0, 0 }, -{"Harmondale Throne Room", 0x24, 0, 29, 0, 0 }, -{"Gryphonheart Throne Room", 0x24, 0, 20, 0, 0 }, -{"Elf Castle Throne Room", 0x24, 0, 20, 0, 0 }, -{"Wizard Castle Throne Room", 0x24, 0, 20, 0, 0 }, -{"Necromancer Casstle Trone Room", 0x24, 0, 20, 0, 0 }, -{"Master Thief", 0x24, 0, 29, 0, 0 }, -{"Dwarven King", 0x24, 0, 20, 0, 0 }, -{"Arms Master", 0x24, 0, 29, 0, 0 }, -{"Warlock", 0x24, 0, 29, 0, 0 }, -{"Lord Markam", 0x24, 0, 20, 0, 0 }, -{"Arbiter Neutral Town", 0x24, 0, 29, 0, 0 }, -{"Arbiter Good Town", 0x24, 0, 29, 0, 0 }, -{"Arbiter Evil Town", 0x24, 0, 29, 0, 0 }, -{"Necromancer Throne Room Empty", 0x24, 0, 20, 0, 0 }, -{"", 0x24, 0, 29, 0, 0 }, -{"", 0x24, 0, 29, 0, 0 }, -{"", 0x24, 0, 29, 0, 0 }, -{"", 0x24, 0, 29, 0, 0 }, -{"Boat01", 0xF, 0, 29, 53, 3 }, -{"", 0x24, 0, 28, 0, 0 }, -{"", 0x24, 0, 28, 0, 0 }, -{"", 0x24, 0, 28, 0, 0 }, -{"", 0x24, 0, 29, 0, 0 }, -{"Arbiter Room Neutral", 0x24, 0, 29, 0, 0 }, -{"Out02 Castle Harmondy Abandoned", 0x24, 0, 25, 0, 0 }, -{"Human Temple02", 0x24, 0x3AB, 23, 27, 0 }, -{"Player Castle Good", 0x24, 0, 25, 0, 0 }, -{"Player Castle Bad", 0x24, 0, 25, 0, 0} -}; #include "stru160.h" stru160 array_4EB8B8[66] = @@ -2001,7 +1802,7 @@ __int64 _5773B8_event_timer; // weak int dword_5773C0; // weak -int dword_591080; // weak + int dword_591084; // weak struct Actor *pDialogue_SpeakingActor; unsigned int uDialogueType; @@ -2018,9 +1819,7 @@ int dword_59117C_teleportx; // weak char byte_591180[600]; // idb struct NPCData *HouseNPCData[6];//array_5913D8 -int pDialogueNPCCount; -struct Texture *pDialogueNPCPortraits[6]; -int uNumDialogueNPCPortraits; // weak + struct Texture *pTexture_591428; struct Texture *pTexture_outside; // idb struct Texture *pTexture_Dialogue_Background; @@ -2052,7 +1851,7 @@ int bDialogueUI_InitializeActor_NPC_ID; // weak int dword_5C35C8; // weak char *p2DEventsTXT_Raw; -int uHouse_ExitPic; // weak + int dword_5C35D4; // weak char *aAMPMNames[2]; char byte_5C45AF[777]; // weak @@ -2261,7 +2060,7 @@ int dword_723E84[777]; // weak int dword_7241C8; // weak struct unk_F7B60C stru_73C834; // struct @ MM7.exe::0073C834 -struct NPCStats *pNPCStats = nullptr; + char *aNPCProfessionNames[59]; char *pAwardsTXT_Raw; char *pScrollsTXT_Raw; @@ -2362,7 +2161,7 @@ struct Texture *ShopTexture; // idb struct Texture *ItemsInShopTexture[12]; int in_current_building_type; // 0xF8B198 -int dword_F8B19C; // weak +int dialog_menu_id; // weak __int16 word_F8B1A0; // weak const char *dword_F8B1A4; // idb int contract_approved; // weak
--- a/mm7_data.h Mon Mar 11 09:28:41 2013 +0600 +++ b/mm7_data.h Mon Mar 11 09:28:57 2013 +0600 @@ -1316,7 +1316,7 @@ extern __int64 _5773B8_event_timer; // weak extern int dword_5773C0; // weak -extern int dword_591080; // weak + extern int dword_591084; // weak extern struct Actor *pDialogue_SpeakingActor; extern unsigned int uDialogueType; @@ -1333,9 +1333,7 @@ extern int dword_59117C_teleportx; // weak extern char byte_591180[600]; // idb extern struct NPCData *HouseNPCData[6]; -extern int pDialogueNPCCount; -extern struct Texture *pDialogueNPCPortraits[6]; -extern int uNumDialogueNPCPortraits; // weak + extern struct Texture *pTexture_591428; extern struct Texture *pTexture_outside; // idb extern struct Texture *pTexture_Dialogue_Background; @@ -1367,7 +1365,7 @@ extern int bDialogueUI_InitializeActor_NPC_ID; // weak extern int dword_5C35C8; // weak extern char *p2DEventsTXT_Raw; -extern int uHouse_ExitPic; // weak + extern int dword_5C35D4; // weak extern char *aAMPMNames[2]; extern char byte_5C45AF[]; // weak @@ -1577,7 +1575,7 @@ extern int dword_723E80_award_related[]; // weak extern int dword_723E84[]; // weak extern int dword_7241C8; // weak -extern struct NPCStats *pNPCStats; + extern char *aNPCProfessionNames[59]; extern char *pAwardsTXT_Raw; extern char *pScrollsTXT_Raw; @@ -1687,7 +1685,7 @@ extern struct Texture *ShopTexture; // idb extern struct Texture *ItemsInShopTexture[12]; extern int in_current_building_type; // weak -extern int dword_F8B19C; // weak +extern int dialog_menu_id; // weak extern __int16 word_F8B1A0; // weak extern const char *dword_F8B1A4; // idb extern int contract_approved; // weak @@ -2253,7 +2251,7 @@ void __cdecl _494035_timed_effects__water_walking_damage__etc(); unsigned int __fastcall sub_494820(unsigned int a1); char *__fastcall sub_495366(unsigned __int8 a1, unsigned __int8 a2); -char *__fastcall GetReputationString(signed int a1); +char * GetReputationString(signed int a1); char *BuilDialogueString(char *lpsz, unsigned __int8 uPlayerID, struct ItemGen *a3, char *a4, int a5, __int64 *a6); void __cdecl PlayerCreationUI_Draw(); void __cdecl PlayerCreationUI_Initialize(); @@ -2300,7 +2298,7 @@ void __cdecl sub_4B1A2D(); void __stdcall RestAndHeal(__int64 uNumMinutes); // idb void __cdecl sub_4B1D27(); -void __fastcall HousePlaySomeSound(unsigned int uHouseID, int a2); // idb + void __cdecl sub_4B1ECE(); void __fastcall ClickNPCTopic(signed int uMessageParam); char *__thiscall _4B254D_SkillMasteryTeacher(int _this); @@ -2314,25 +2312,11 @@ void __cdecl sub_4B3E1E(); void DrawJoinGuildWindow(int pEventCode); void __fastcall sub_4B3FE5(int a4); -void __cdecl sub_4B40E6(); +void NPCHireableDialogPrepare(); void _4B4224_UpdateNPCTopics(int _this); char __fastcall DrawTextAtStatusBar(const char *Str, int a5); int __fastcall sub_4B46F8(int a1); -int __cdecl TrainingDialog(); -char *__cdecl JailDialog(); -int __cdecl MagicShopDialog(); -void GuildDialog(); -int __cdecl sub_4B6478(); -bool __fastcall sub_4B68EA(int a1); -void __cdecl TravelByTransport(); -void TempleDialog(); -void __cdecl TownHallDialog(); -void __cdecl BankDialog(); -void __cdecl TavernDialog(); -char *__cdecl WeaponShopDialog(); -POINT *__cdecl AlchemistDialog(); -void __cdecl ArmorShopDialog(); signed int __fastcall sub_4BB756(signed int a1); const char *sub_4BBA85_bounties(); void __cdecl sub_4BBCDD();
--- a/stru159.h Mon Mar 11 09:28:41 2013 +0600 +++ b/stru159.h Mon Mar 11 09:28:57 2013 +0600 @@ -14,4 +14,3 @@ unsigned __int16 padding_e; }; #pragma pack(pop) -extern stru159 pAnimatedRooms[196]; \ No newline at end of file
--- a/stru6.cpp Mon Mar 11 09:28:41 2013 +0600 +++ b/stru6.cpp Mon Mar 11 09:28:57 2013 +0600 @@ -155,7 +155,7 @@ double v8; // st7@2 double v9; // st6@2 double v10; // st7@3 - Particle_ local_0; // [sp+8h] [bp-68h]@1 + Particle_sw local_0; // [sp+8h] [bp-68h]@1 float x; // [sp+78h] [bp+8h]@2 v4 = this; @@ -168,7 +168,7 @@ x = ((double)a2->vPosition.x - v7->flt_0_x) * 0.5 + v7->flt_0_x; v8 = ((double)v5->vPosition.y - v7->flt_4_y) * 0.5 + v7->flt_4_y; v9 = ((double)v5->vPosition.z - v7->flt_8_z) * 0.5 + v7->flt_8_z; - local_0.bFree = 1036; + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; local_0.uDiffuse = uDiffuse; local_0.x = x + 4.0; local_0.y = v8; @@ -199,7 +199,7 @@ v4->array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y; v4->array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z; v10 = (double)a2->vPosition.x; - local_0.bFree = 1036; + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; local_0.uDiffuse = uDiffuse; local_0.x = v10 + 4.0; local_0.y = (double)a2->vPosition.y; @@ -221,10 +221,10 @@ { double v4; // st7@1 signed int v5; // edi@1 - Particle_ local_0; // [sp+8h] [bp-68h]@1 + Particle_sw local_0; // [sp+8h] [bp-68h]@1 memset(&local_0, 0, 0x68u); - local_0.bFree = 1029; + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; local_0.x = (double)a1->vPosition.x; local_0.y = (double)a1->vPosition.y; v4 = (double)a1->vPosition.z; @@ -257,7 +257,7 @@ float v8; // ST08_4@6 float v9; // ST04_4@6 float v10; // ST00_4@6 - Particle_ local_0; // [sp+1Ch] [bp-7Ch]@1 + Particle_sw local_0; // [sp+1Ch] [bp-7Ch]@1 stru6 *v12; // [sp+84h] [bp-14h]@1 float v13; // [sp+88h] [bp-10h]@1 double v14; // [sp+8Ch] [bp-Ch]@5 @@ -276,8 +276,8 @@ v4 = v3 * 1.333333333333333; v15 = v4; v5 = (double)a2->vPosition.x; - local_0.bFree = 1029; - local_0.uDiffuse = 0xFF3C1Eu; + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; + local_0.uDiffuse = 0xFF3C1E; local_0.x = v5; local_0.y = (double)a2->vPosition.y; local_0.z = (double)a2->vPosition.z; @@ -348,15 +348,15 @@ ObjectDesc *v2; // esi@1 unsigned int v3; // eax@1 double v4; // st7@1 - Particle_ local_0; // [sp+8h] [bp-68h]@1 + Particle_sw local_0; // [sp+8h] [bp-68h]@1 v2 = &pObjectList->pObjects[a1->uObjectDescID]; memset(&local_0, 0, 0x68u); v3 = a1->uSpriteFrameID; local_0.x = (double)a1->vPosition.x; v4 = (double)a1->vPosition.y; - local_0.bFree = 2048; - local_0.uDiffuse = 0x7F7F7Fu; + local_0.type = ParticleType_Sprite; + local_0.uDiffuse = 0x7F7F7F; local_0.timeToLive = 1; local_0.y = v4; local_0.z = (double)a1->vPosition.z; @@ -376,15 +376,15 @@ double v4; // st7@1 char v5; // al@1 signed int v6; // edi@1 - Particle_ Dst; // [sp+8h] [bp-68h]@1 + Particle_sw Dst; // [sp+8h] [bp-68h]@1 v2 = &pObjectList->pObjects[a1->uObjectDescID]; memset(&Dst, 0, 0x68u); v3 = a1->uSpriteFrameID; Dst.x = (double)a1->vPosition.x; v4 = (double)a1->vPosition.y; - Dst.bFree = 2053; - Dst.uDiffuse = 0x7F7F7Fu; + Dst.type = ParticleType_Sprite | ParticleType_Rotating | ParticleType_1; + Dst.uDiffuse = 0x7F7F7F; Dst.y = v4; Dst.z = (double)a1->vPosition.z; Dst.uTextureID = pSpriteFrameTable->GetFrame(v2->uSpriteID, v3)->pHwSpriteIDs[0]; @@ -428,14 +428,14 @@ double v8; // st6@1 double v9; // st7@1 double v10; // st6@1 - Particle_ local_0; // [sp+0h] [bp-6Ch]@1 + Particle_sw local_0; // [sp+0h] [bp-6Ch]@1 float v12; // [sp+68h] [bp-4h]@1 float a1a; // [sp+74h] [bp+8h]@1 float uDiffusea; // [sp+78h] [bp+Ch]@1 float uTextureIDa; // [sp+7Ch] [bp+10h]@1 memset(&local_0, 0, 0x68u); - local_0.bFree = 1029; + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; local_0.x = (double)a1->vPosition.x; v5 = a1->vPosition.z; local_0.y = (double)a1->vPosition.y; @@ -501,7 +501,7 @@ char v10; // al@2 double v11; // st7@2 double v12; // st7@3 - Particle_ local_0; // [sp+Ch] [bp-68h]@1 + Particle_sw local_0; // [sp+Ch] [bp-68h]@1 float a2a; // [sp+7Ch] [bp+8h]@2 v2 = this; @@ -515,8 +515,8 @@ v7 = ((double)a2->vPosition.x - v6->flt_0_x) * 0.5 + v6->flt_0_x; v8 = ((double)a2->vPosition.y - v6->flt_4_y) * 0.5 + v6->flt_4_y; v9 = ((double)a2->vPosition.z - v6->flt_8_z) * 0.5 + v6->flt_8_z; - local_0.bFree = 2048; - local_0.uDiffuse = 0xFFFFFFu; + local_0.type = ParticleType_Sprite; + local_0.uDiffuse = 0xFFFFFF; a2a = v9; local_0.x = v7; local_0.z = a2a; @@ -547,8 +547,8 @@ v2->array_4[a2->field_54 & 0x1F].flt_4_y = (double)a2->vPosition.y; v2->array_4[a2->field_54 & 0x1F].flt_8_z = (double)a2->vPosition.z; v12 = (double)a2->vPosition.x; - local_0.bFree = 2048; - local_0.uDiffuse = 0xFFFFFFu; + local_0.type = ParticleType_Sprite; + local_0.uDiffuse = 0xFFFFFF; LODWORD(local_0.flt_28) = 0x40000000u; local_0.x = v12; local_0.y = (double)a2->vPosition.y; @@ -600,12 +600,12 @@ Actor *v3; // edi@1 int v4; // ebx@3 //int result; // eax@5 - Particle_ Dst; // [sp+Ch] [bp-6Ch]@1 + Particle_sw Dst; // [sp+Ch] [bp-6Ch]@1 int v7; // [sp+74h] [bp-4h]@2 signed int pActora; // [sp+80h] [bp+8h]@1 memset(&Dst, 0, 0x68u); - Dst.bFree = 1036; + Dst.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_8; Dst.timeToLive = (rand() & 0x7F) + 128; v3 = pActor; Dst.uTextureID = pBitmaps_LOD->LoadTexture("effpar02", TEXTURE_DEFAULT); @@ -643,15 +643,15 @@ unsigned int v7; // eax@1 double v8; // st7@2 double v9; // st7@2 - Particle_ local_0; // [sp+8h] [bp-78h]@1 + Particle_sw local_0; // [sp+8h] [bp-78h]@1 double v11; // [sp+70h] [bp-10h]@1 double v12; // [sp+78h] [bp-8h]@1 float z1; // [sp+88h] [bp+8h]@2 v4 = this; memset(&local_0, 0, 0x68u); - local_0.bFree = 1029; - local_0.uDiffuse = 0x7E7E7Eu; + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; + local_0.uDiffuse = 0x7E7E7E; v5 = rand(); local_0.flt_28 = 1.0; v6 = 8; @@ -714,12 +714,12 @@ { stru6 *v2; // esi@1 signed int v3; // ebx@1 - Particle_ local_0; // [sp+Ch] [bp-68h]@1 + Particle_sw local_0; // [sp+Ch] [bp-68h]@1 v2 = this; memset(&local_0, 0, 0x68u); - local_0.bFree = 1029; - local_0.uDiffuse = 0x7E7E7Eu; + local_0.type = ParticleType_Bitmap | ParticleType_Rotating | ParticleType_1; + local_0.uDiffuse = 0x7E7E7E; local_0.timeToLive = (rand() & 0x7F) + 128; local_0.uTextureID = v2->uTextureID_effpar1; v3 = 8;