# HG changeset patch # User Ritor1 # Date 1363922085 -21600 # Node ID e0a8cc28caeb56cc6853a0f8c5babdd1803fb563 # Parent 7378398c34e42c2bee41aaf7379e22827b5f4b59# Parent 8323734d58c80aee25860a3a13993240552cc7d6 Слияние diff -r 7378398c34e4 -r e0a8cc28caeb GUIProgressBar.cpp --- a/GUIProgressBar.cpp Fri Mar 22 09:14:37 2013 +0600 +++ b/GUIProgressBar.cpp Fri Mar 22 09:14:45 2013 +0600 @@ -215,11 +215,11 @@ pRenderer->DrawTextureRGB(0, 0, &pLoadingBg); pRenderer->SetRasterClipRect(0, 0, 0x27Fu, 0x1DFu); - pRenderer->Clip(0xACu, 0x1CBu, + pRenderer->SetTextureClipRect(0xACu, 0x1CBu, 15 * (signed int)(signed __int64)((double)(300 * uProgressCurrent) / (double)uProgressMax) / 15 + 172, 0x1D7u); pRenderer->DrawTextureTransparent(0xACu, 0x1CBu, &pLoadingProgress); - pRenderer->ResetClip(); + pRenderer->ResetTextureClipRect(); LABEL_11: pRenderer->EndScene(); pRenderer->Present(); diff -r 7378398c34e4 -r e0a8cc28caeb MM7.h --- a/MM7.h Fri Mar 22 09:14:37 2013 +0600 +++ b/MM7.h Fri Mar 22 09:14:45 2013 +0600 @@ -262,5 +262,18 @@ - - +#pragma pack(push, 1) +struct stru365_travel_info +{ + unsigned char uMapInfoID; + unsigned char pSchedule[7]; + unsigned char uTravelTime; + unsigned char field_9[3]; + int field_C; + int field_10; + int field_14; + int field_18; + unsigned int uQuestBit; // quest bit required to set for this travel option to be enabled; otherwise 0 +}; +#pragma pack(pop) +extern stru365_travel_info array_4F09B0[]; \ No newline at end of file diff -r 7378398c34e4 -r e0a8cc28caeb Player.cpp --- a/Player.cpp Fri Mar 22 09:14:37 2013 +0600 +++ b/Player.cpp Fri Mar 22 09:14:45 2013 +0600 @@ -3382,7 +3382,7 @@ { v6 = 0; while ( !HasItemEquipped((ITEM_EQUIP_TYPE)v6) - || *(int *)&this->pInventoryItems[a2-1].uItemID != a1 ) + || *(int *)&this->pInventoryItems[pEquipment.pIndices[v6] - 1].uItemID != a1 ) { ++v6; if ( (signed int)v6 >= 16 ) @@ -3390,8 +3390,7 @@ } return 1; } - if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) - && *(int *)&this->pInventoryItems[*(&this->pEquipment.uOffHand + v3)-1] == a1 ) + if ( HasItemEquipped((ITEM_EQUIP_TYPE)a2) && pInventoryItems[pEquipment.pIndices[a2 - 1]].uItemID == a1 ) return 1; return 0; } diff -r 7378398c34e4 -r e0a8cc28caeb Render.cpp --- a/Render.cpp Fri Mar 22 09:14:37 2013 +0600 +++ b/Render.cpp Fri Mar 22 09:14:45 2013 +0600 @@ -9397,7 +9397,7 @@ //----- (004A5B81) -------------------------------------------------------- -void Render::Clip(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) +void Render::SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW) { this->bClip = 1; this->uClipY = uY; @@ -9408,7 +9408,7 @@ //----- (004A5BB6) -------------------------------------------------------- -void Render::ResetClip() +void Render::ResetTextureClipRect() { this->uClipY = 0; this->uClipX = 0; diff -r 7378398c34e4 -r e0a8cc28caeb Render.h --- a/Render.h Fri Mar 22 09:14:37 2013 +0600 +++ b/Render.h Fri Mar 22 09:14:45 2013 +0600 @@ -338,8 +338,8 @@ void BeginScene(); void EndScene(); unsigned int _4A52F1(unsigned int this_, float a3); - void Clip(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW); - void ResetClip(); + void SetTextureClipRect(unsigned int uX, unsigned int uY, unsigned int uZ, unsigned int uW); + void ResetTextureClipRect(); void DrawTextureRGB(unsigned int uOutX, unsigned int uOutY, RGBTexture *a4); void _4A5D33(unsigned int a2, unsigned int a3, int a4, int a5, RGBTexture *pTexture); void DrawTextureIndexed(unsigned int uX, unsigned int uY, Texture *a4); diff -r 7378398c34e4 -r e0a8cc28caeb UICharacter.cpp --- a/UICharacter.cpp Fri Mar 22 09:14:37 2013 +0600 +++ b/UICharacter.cpp Fri Mar 22 09:14:45 2013 +0600 @@ -1453,8 +1453,8 @@ pBodyComplection = pSex != 0; } v244 = pPlayer->uFace; - pRenderer->ResetClip(); - pRenderer->DrawTextureIndexed(0x1D3u, 0, (Texture *)(uTextureID_BACKDOLL != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_BACKDOLL] : 0));// + pRenderer->ResetTextureClipRect(); + pRenderer->DrawTextureIndexed(0x1D3u, 0, pIcons_LOD->GetTexture(uTextureID_BACKDOLL));// if ( !IsPlayerWearingWatersuit[uPlayerID_] ) { v21 = pPlayer->pEquipment.uBow; // diff -r 7378398c34e4 -r e0a8cc28caeb UIHouses.cpp --- a/UIHouses.cpp Fri Mar 22 09:14:37 2013 +0600 +++ b/UIHouses.cpp Fri Mar 22 09:14:45 2013 +0600 @@ -22,6 +22,7 @@ #include "Keyboard.h" #include "NPC.h" +#include "MM7.h" #include "mm7_data.h" @@ -456,8 +457,8 @@ { 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->uTimePlayed = pParty->uTimePlayed + 0x7620000; + in_current_building_type = pAnimatedRooms[p2DEvents[HOUSE_LORD_AND_JUDGE_EMERALD_ISLE].uAnimationID].uBuildingType; ++pParty->uNumPrisonTerms; pParty->uFine = 0; for (uint i = 0; i < 4; ++i) @@ -490,12 +491,12 @@ 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; - } - } + { + if ( (signed int)uHouseID >= HOUSE_STABLES_HARMONDALE && (signed int)uHouseID <= 73 && !IsTravelAvailable(uHouseID - HOUSE_STABLES_HARMONDALE) ) + { + return 1; + } + } else { //guilds v19 = guild_mambership_flags[uHouseID-139]; //guilds flags @@ -547,27 +548,31 @@ //----- (004B68EA) -------------------------------------------------------- -bool __fastcall sub_4B68EA(int a1) +bool __fastcall IsTravelAvailable(int a1) { - signed int v1; // edi@1 - int *v2; // esi@1 - int v3; // ecx@2 + //signed int v1; // edi@1 + //int *v2; // esi@1 + //int v3; // ecx@2 - v1 = 0; - v2 = &dword_4F0E10[a1]; - while ( 1 ) + __debugbreak(); // fill all 25 elements of array_4F09B0 before continue + //v1 = 0; + //v2 = &dword_4F0E10[a1]; + //while ( 1 ) + for (uint i = 0; i < 4; ++i) { - v3 = 8 * *((char *)v2 + v1); - if ( *(&byte_4F09B1[pParty->uDaysPlayed % 7] + v3 * 4) ) + uint idx = byte_4F0E10[a1][i]; + //v3 = 8 * byte_4F0E10[a1][i]; + if (array_4F09B0[idx].pSchedule[pParty->uDaysPlayed % 7]) { - if ( !dword_4F09CC[v3] || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, LOWORD(dword_4F09CC[v3])) ) - break; + if (!array_4F09B0[idx].uQuestBit || _449B57_test_bit(pParty->_quest_bits, array_4F09B0[idx].uQuestBit)) + return true; } - ++v1; - if ( v1 >= 4 ) - return 0; + //++v1; + //if ( v1 >= 4 ) + // return 0; } - return 1; + return false; + //return 1; } diff -r 7378398c34e4 -r e0a8cc28caeb UIHouses.h --- a/UIHouses.h Fri Mar 22 09:14:37 2013 +0600 +++ b/UIHouses.h Fri Mar 22 09:14:45 2013 +0600 @@ -22,23 +22,47 @@ /* 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//??? - }; +{ + HOUSE_SMITH_EMERALD_ISLE = 1, + HOUSE_ARMOURER_EMERALD_ISLE = 15, + HOUSE_MAGE_EMERALD_ISLE = 29, + HOUSE_MAGE_HARMONDALE = 30, + HOUSE_ALCHEMIST_EMERALD_ISLE = 42, + HOUSE_ALCHEMIST_HARMONDALE = 43, + HOUSE_STABLES_HARMONDALE = 54, + HOUSE_TEMPLE_EMERALD_ISLE = 74, + HOUSE_TEMPLE_HARMONDALE = 75, + HOUSE_TRAINING_HALL_HARMONDALE = 90, + HOUSE_TOWNHALL_HARMONDALE = 102, + HOUSE_TAVERN_EMERALD_ISLE = 107, + HOUSE_BANK_HARMONDALE = 128, + HOUSE_FIRE_GUILD_INITIATE_EMERALD_ISLE = 139, + HOUSE_AIR_GUILD_INITIATE_EMERALD_ISLE = 143, + HOUSE_SPIRIT_GUILD_INITIATE_EMERALD_ISLE = 155, + HOUSE_BODY_GUILD_INITIATE_EMERALD_ISLE = 163, + HOUSE_BODY_GUILD_ERATHIA = 165, + HOUSE_DARK_GUILD_PIT = 170, + HOUSE_LORD_AND_JUDGE_EMERALD_ISLE = 186, + HOUSE_JAIL = 187, + HOUSE_JUDGE_HARMONDALE = 190, + HOUSE_224_EMERALD_ISLE = 224, + HOUSE_225_EMERALD_ISLE = 225, + HOUSE_466_HARMONDALE = 466, + HOUSE_467_HARMONDALE = 467, + HOUSE_468_HARMONDALE = 468, + HOUSE_472_HARMONDALE = 472, + HOUSE_488_HARMONDALE = 488, + HOUSE_489_HARMONDALE = 489, + HOUSE_600 = 600,//??? + HOUSE_601 = 601//??? +}; int __cdecl TrainingDialog(); char *__cdecl JailDialog(); void MagicShopDialog(); void GuildDialog(); void sub_4B6478(); -bool __fastcall sub_4B68EA(int a1); +bool __fastcall IsTravelAvailable(int a1); void __cdecl TravelByTransport(); void TempleDialog(); void __cdecl TownHallDialog(); diff -r 7378398c34e4 -r e0a8cc28caeb UIMainMenu.cpp --- a/UIMainMenu.cpp Fri Mar 22 09:14:37 2013 +0600 +++ b/UIMainMenu.cpp Fri Mar 22 09:14:45 2013 +0600 @@ -63,7 +63,7 @@ for (uint i = 0; i < 480; ++i) pSRZBufferLineOffsets[i] = 640 * i; - pRenderer->ResetClip(); + pRenderer->ResetTextureClipRect(); uTextureID_FONTPAL = pIcons_LOD->LoadTexture("FONTPAL", TEXTURE_16BIT_PALETTE); pFontArrus = LoadFont("arrus.fnt", "FONTPAL", NULL); @@ -352,9 +352,9 @@ pAsyncMouse->_46B736_consume_click_lists(1); pRenderer->BeginScene(); pRenderer->DrawTextureRGB(0, 0, &pTexture); - pRenderer->Clip(pX, pY, pX + v20, pY + a4); + pRenderer->SetTextureClipRect(pX, pY, pX + v20, pY + a4); pRenderer->_4A5D33(pX, pY, 0, a5, &pTexture2); - pRenderer->ResetClip(); + pRenderer->ResetTextureClipRect(); pRenderer->EndScene(); ++a5; if ( a5 >= (signed __int16)pTexture2.uHeight ) diff -r 7378398c34e4 -r e0a8cc28caeb UIPopup.cpp --- a/UIPopup.cpp Fri Mar 22 09:14:37 2013 +0600 +++ b/UIPopup.cpp Fri Mar 22 09:14:45 2013 +0600 @@ -75,7 +75,7 @@ v4 = uY; a2a = uX; a4 = uX + uWidth; - pRenderer->Clip(uX, v4, uX + uWidth, v4 + uHeight); + pRenderer->SetTextureClipRect(uX, v4, uX + uWidth, v4 + uHeight); v5 = (Texture *)(uTextureID_Parchment != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Parchment] : 0); uTileWidth = (uTextureID_Parchment != -1 ? pIcons_LOD->pTextures[uTextureID_Parchment].uTextureWidth : 24); v13 = (uTextureID_Parchment != -1 ? pIcons_LOD->pTextures[uTextureID_Parchment].uTextureWidth : 24); @@ -130,7 +130,7 @@ v22 = v4 + uHeight - 10; if ( (signed int)uWidth > 64 ) { - pRenderer->Clip(a2a + 32, v4, a4 - 32, v4 + uHeight); + pRenderer->SetTextureClipRect(a2a + 32, v4, a4 - 32, v4 + uHeight); pRenderer->DrawTextureTransparent( uNumXTilesb, v4, @@ -154,7 +154,7 @@ v9 = v4 + 32; if ( (signed int)uHeight > 64 ) { - pRenderer->Clip(a2a, v9, a4, a5a); + pRenderer->SetTextureClipRect(a2a, v9, a4, a5a); pRenderer->DrawTextureTransparent( a2a, v9, @@ -164,7 +164,7 @@ v9, (Texture *)(uTextureID_50769C != -1 ? &pIcons_LOD->pTextures[uTextureID_50769C] : 0)); } - pRenderer->ResetClip(); + pRenderer->ResetTextureClipRect(); } } @@ -350,7 +350,7 @@ { wHintWindow.DrawMessageBox(0); //v15 = &; - pRenderer->Clip(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12, + pRenderer->SetTextureClipRect(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12, wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12, wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12); wHintWindow.uFrameWidth -= 24; @@ -367,7 +367,7 @@ v18 = v17 >> 1; v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x19u, 0x19u); wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[32], 3); //"Broken Item" - pRenderer->ResetClip(); + pRenderer->ResetTextureClipRect(); if ( !areWeLoadingTexture ) { v73->Release(); @@ -378,7 +378,7 @@ if (!inspect_item->Identified()) { wHintWindow.DrawMessageBox(0); - pRenderer->Clip(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12, + pRenderer->SetTextureClipRect(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12, wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12, wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12); wHintWindow.uFrameWidth -= 24; @@ -391,7 +391,7 @@ v18 = v17 >> 1; v19 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x19u, 0x19u); wHintWindow.DrawTitleText(pFontArrus, 0x64u, ((signed int)wHintWindow.uFrameHeight >> 1) - v18, v19, pGlobalTXT_LocalizationStrings[232], 3); - pRenderer->ResetClip(); + pRenderer->ResetTextureClipRect(); if ( !areWeLoadingTexture ) { v73->Release(); @@ -518,7 +518,7 @@ wHintWindow.uFrameZ = wHintWindow.uFrameX + wHintWindow.uFrameWidth - 1; wHintWindow.DrawMessageBox(0); //v15 = pRenderer; - pRenderer->Clip(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12, + pRenderer->SetTextureClipRect(wHintWindow.uFrameX + 12, wHintWindow.uFrameY + 12, wHintWindow.uFrameX + wHintWindow.uFrameWidth - 12, wHintWindow.uFrameY + wHintWindow.uFrameHeight - 12); wHintWindow.uFrameWidth -= 12; v32 = v73->uTextureHeight; @@ -608,7 +608,7 @@ { if ( !(BYTE1(v38) & 2) ) { - pRenderer->ResetClip(); + pRenderer->ResetTextureClipRect(); if ( !areWeLoadingTexture ) { v73->Release(); @@ -629,7 +629,7 @@ v41 = v39 + 132; } wHintWindow.DrawText(v40, v41, v42, v44, v47, v51, v56, v61); - pRenderer->ResetClip(); + pRenderer->ResetTextureClipRect(); if ( !areWeLoadingTexture ) { v73->Release(); diff -r 7378398c34e4 -r e0a8cc28caeb UiGame.cpp --- a/UiGame.cpp Fri Mar 22 09:14:37 2013 +0600 +++ b/UiGame.cpp Fri Mar 22 09:14:45 2013 +0600 @@ -134,17 +134,18 @@ } } v8 = a2->uFrameX + (signed int)(a2->uFrameWidth - v4) / 2; - pRenderer->Clip(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52); + pRenderer->SetTextureClipRect(v8, a2->uFrameY + 32, v8 + v4, a2->uFrameY + 52); pRenderer->DrawTextureIndexed( v8, v3->uFrameY + 32, (Texture *)(uTextureID_mhp_bd != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_mhp_bd] : 0)); - pRenderer->Clip(v8, v3->uFrameY + 32, v8 + v10, v3->uFrameY + 52); + pRenderer->SetTextureClipRect(v8, v3->uFrameY + 32, v8 + v10, v3->uFrameY + 52); pRenderer->DrawTextureIndexed( v8, v3->uFrameY + 34, (Texture *)(v9 != -1 ? (int)&pIcons_LOD->pTextures[v9] : 0)); - pRenderer->ResetClip(); + pRenderer->ResetTextureClipRect(); + pRenderer->DrawTextureIndexed( v8 - 5, v3->uFrameY + 32, @@ -201,7 +202,7 @@ v17 = 2; else v17 = 0; - pRenderer->Clip( + pRenderer->SetTextureClipRect( v17 + pHealthBarPos[v16], v4 + 402, v17 + pHealthBarPos[v16] + v0->uTextureWidth, @@ -214,7 +215,7 @@ v17 = 2; else v17 = 0; - pRenderer->Clip( + pRenderer->SetTextureClipRect( v17 + pHealthBarPos[v16], (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, v17 + pHealthBarPos[v16] + v14->uTextureWidth, @@ -227,7 +228,7 @@ v17 = 2; else v17 = 0; - pRenderer->Clip( + pRenderer->SetTextureClipRect( v17 + pHealthBarPos[v16], (unsigned __int64)(signed __int64)((1.0 - v3) * v15) + 402, v17 + pHealthBarPos[v16] + v13->uTextureWidth, @@ -237,7 +238,7 @@ if( v3 > 0.0 ) { pRenderer->DrawTextureIndexed(v17 + pHealthBarPos[v16], 0x192u, v9); - pRenderer->ResetClip(); + pRenderer->ResetTextureClipRect(); } } v5 = v11; @@ -249,13 +250,13 @@ if ( v7 > 1.0 ) v7 = 1.0; v8 = v16 == 2; - pRenderer->Clip( + pRenderer->SetTextureClipRect( (v16 == 2) + pManaBarPos[v16], (unsigned __int64)(signed __int64)((1.0 - v7) * v15) + 402, v8 + pManaBarPos[v16] + v10->uTextureWidth, v10->uTextureHeight + 402); pRenderer->DrawTextureIndexed(v8 + pManaBarPos[v16], 0x192u, v10); - pRenderer->ResetClip(); + pRenderer->ResetTextureClipRect(); } ++v16; } @@ -1915,9 +1916,9 @@ pRenderer->DrawTextureTransparent(0x1D4u, 0, (Texture *)(dword_5079D8 != -1 ? &pIcons_LOD->pTextures[dword_5079D8] : 0)); uZooma = (double)pParty->sRotationY * 0.1171875; //v50 = uZooma + 6.7553994e15; - pRenderer->Clip(541, 0, 567, 480); + pRenderer->SetTextureClipRect(541, 0, 567, 480); pRenderer->DrawTextureIndexed(floorf(uZooma + 0.5f) + 285, 136, (Texture *)(dword_5079B4 != -1 ? &pIcons_LOD->pTextures[dword_5079B4] : 0)); - pRenderer->ResetClip(); + pRenderer->ResetTextureClipRect(); } //----- (00441498) -------------------------------------------------------- diff -r 7378398c34e4 -r e0a8cc28caeb mm7_2.cpp --- a/mm7_2.cpp Fri Mar 22 09:14:37 2013 +0600 +++ b/mm7_2.cpp Fri Mar 22 09:14:45 2013 +0600 @@ -812,15 +812,14 @@ //----- (004BCA33) -------------------------------------------------------- -GUIButton *__cdecl UI_CreateEndConversationButton() +void UI_CreateEndConversationButton() { pDialogueWindow->Release(); pDialogueWindow = GUIWindow::Create(0, 0, 640, 345, WINDOW_MainMenu, 0, 0); pBtn_ExitCancel = pDialogueWindow->CreateButton( 471, 445, 169, 35, 1, 0, 0x71u, 0, 0, pGlobalTXT_LocalizationStrings[74], //"End Conversation" - (Texture *)(uExitCancelTextureId != -1 ? &pIcons_LOD->pTextures[uExitCancelTextureId] : NULL), - 0); - return pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0); + pIcons_LOD->GetTexture(uExitCancelTextureId), 0); + pDialogueWindow->CreateButton(8, 8, 450, 320, 1, 0, 0x51u, 0, 0, "", 0); } //----- (004BCACC) -------------------------------------------------------- @@ -928,8 +927,8 @@ if ( in_current_building_type != BildingType_Training ) { v8 = window_SpeakInHouse; - if ( (in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) - && (*(&byte_4F09B1[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + uMessageParam)] + pParty->uDaysPlayed % 7)) + if ((in_current_building_type == BildingType_Stables || in_current_building_type == BildingType_Boats) && + array_4F09B0[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][uMessageParam - 1]].pSchedule[pParty->uDaysPlayed % 7] || in_current_building_type != BildingType_Temple || uMessageParam != BildingType_MindGuild ) { //LABEL_9: diff -r 7378398c34e4 -r e0a8cc28caeb mm7_4.cpp --- a/mm7_4.cpp Fri Mar 22 09:14:37 2013 +0600 +++ b/mm7_4.cpp Fri Mar 22 09:14:45 2013 +0600 @@ -243,7 +243,7 @@ int v13; // ecx@13 signed int v14; // ebx@14 int v15; // eax@16 - int v16; // edx@19 + //int v16; // edx@19 int v17; // ST18_4@19 signed int v18; // edx@19 signed __int64 v19; // qtt@19 @@ -310,7 +310,20 @@ v13 = i; v14 = word_721460[i + 1] >= x ? 0 : 2; v15 = v14 | word_721460[i] < x; - if ( v15 != 3 ) + + if ( !v15) + ++v53; + else + { + //v16 = word_721390[i]; + v17 = word_721390[i + 1] - word_721390[i]; + v18 = y - word_721390[i]; + LODWORD(v19) = v18 << 16; + HIDWORD(v19) = v18 >> 16; + if ((signed int)(((unsigned __int64)(((signed int)word_721460[i + 1] - (signed int)word_721460[i]) * v19 / v17) >> 16) + word_721460[i]) >= x) + ++v53; + } + /*if ( v15 != 3 ) { if ( !v15 ) { @@ -320,7 +333,7 @@ if ( v16 >= x) ++v53; } - } + }*/ } v48 = v50; } @@ -381,11 +394,17 @@ if ( v29 != 3 ) { if ( !v29 ) - LODWORD(v33) = (y - word_721390[i]) << 16; - HIDWORD(v33) = (y - word_721390[i]) >> 16; - v30 = ((((word_721460[i + 1] - word_721460[i]) * v33 / (word_721390[i + 1] - word_721390[i])) >> 16) + word_721460[i]); - if ( v30 >= x) + ++v54; + else + { + //v30 = word_721390[v27]; + v31 = word_721390[i + 1] - word_721390[i]; + v32 = y - word_721390[i]; + LODWORD(v33) = v32 << 16; + HIDWORD(v33) = v32 >> 16; + if ((signed int)(((unsigned __int64)(((signed int)word_721460[i + 1] - (signed int)word_721460[i]) * v33 / v31) >> 16) + word_721460[i]) >= x) ++v54; + } } } v49 = v47; @@ -9896,7 +9915,7 @@ signed int v2; // edi@1 unsigned int v3; // eax@1 signed int v4; // ebx@1 - char *v5; // esi@7 + stru365_travel_info *v5; // esi@7 int v6; // eax@9 int v7; // eax@9 int v8; // eax@12 @@ -9914,10 +9933,10 @@ int v20; // esi@36 int v21; // eax@36 void *v22; // eax@39 - Player *v23; // esi@39 + int v23; // esi@39 GUIButton *v24; // ebx@39 signed int v25; // eax@41 - int v26; // esi@44 + //int v26; // esi@44 const char *v27; // eax@46 char *v28; // eax@62 int v29; // eax@62 @@ -9949,10 +9968,10 @@ int v55; // [sp+260h] [bp-30h]@36 unsigned int v56; // [sp+264h] [bp-2Ch]@1 int v57; // [sp+268h] [bp-28h]@1 - Player *v58; // [sp+26Ch] [bp-24h]@36 + int v58; // [sp+26Ch] [bp-24h]@36 GUIWindow *v59; // [sp+270h] [bp-20h]@1 unsigned int v60; // [sp+274h] [bp-1Ch]@36 - Player *v61; // [sp+278h] [bp-18h]@1 + //Player *v61; // [sp+278h] [bp-18h]@1 int v62; // [sp+27Ch] [bp-14h]@36 int v63; // [sp+280h] [bp-10h]@14 char *a1; // [sp+284h] [bp-Ch]@37 @@ -9962,8 +9981,8 @@ v0 = window_SpeakInHouse; memcpy(&v53, window_SpeakInHouse, sizeof(v53)); v2 = 255; - v61 = pPlayers[uActiveCharacter]; - v1 = v61; + //v61 = pPlayers[uActiveCharacter]; + v1 = pPlayers[uActiveCharacter]; v53.uFrameX = 483; v53.uFrameWidth = 148; v53.uFrameZ = 334; @@ -9982,7 +10001,7 @@ if ( sub_4B1784_check_if_player_concious__draw_warning_else_mess_with_dlg_win() ) { v16 = pDialogueWindow; - v58 = (Player *)-1; + v58 = -1; v62 = 0; v17 = LOBYTE(pFontArrus->uFontHeight) - 3; v59 = pDialogueWindow; @@ -10004,23 +10023,22 @@ { int v47 = v60; v22 = window_SpeakInHouse->ptr_1C; - v23 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36 - v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land + v23 = byte_4F0E10[(unsigned int)v22 - HOUSE_STABLES_HARMONDALE][v62]; + //v23 = (unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // negindex. actual address is around + 0x36 + //v61 = (Player *)(unsigned __int8)*(&_4F0D38_TravelInfo[4 * (unsigned int)v22] + v62); // + 0x3F for sea travels, less for land v24 = v16->GetControl(v60); if ( v23 != v58 - && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = (unsigned __int8)*(&byte_4F09B1[32 * (int)v23] - + pParty->uDaysPlayed % 7)), + && ((signed int)s1 >= 6 ? (v25 = 1) : (v25 = array_4F09B0[v23].pSchedule[pParty->uDaysPlayed % 7]), v25 - && ((v26 = 8 * (int)v23, !dword_4F09CC[v26]) - || (unsigned __int16)_449B57_test_bit(pParty->_quest_bits, LOWORD(dword_4F09CC[v26])))) ) - { - v58 = v61; + && (array_4F09B0[v23].uQuestBit || _449B57_test_bit(pParty->_quest_bits, array_4F09B0[v23].uQuestBit))) ) + { + v58 = v23; v27 = (const char *)v56; if ( pDialogueWindow->pCurrentPosActiveItem != s1 ) v27 = (const char *)v57; //v32.uRedbookTrackID = v27; sprintf(a1, "\f%05d", v27); - v66 = (unsigned __int8)byte_4F09B8[v26 * 4]; + v66 = array_4F09B0[v23].uTravelTime; if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) { if ( CheckHiredNPCSpeciality(Sailor) ) @@ -10041,9 +10059,9 @@ --v66; if ( v66 < 1 ) v66 = 1; - if ( v61 != (Player *)v2 ) + if ( v23 != v2 ) { - memcpy(&v32, &pMapStats->pInfos[(unsigned __int8)byte_4F09B0[v26 * 4]], 0x44u); + memcpy(&v32, &pMapStats->pInfos[array_4F09B0[v23].uMapInfoID], 0x44u); sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[404], // Time - %d days, destination %s v66, v32.pName); strcat(a1, pTmpBuf); @@ -10117,16 +10135,16 @@ } Party::TakeGold(s1); //v47[1] = (const char *)7; - v5 = &byte_4F09B0[32 * (unsigned __int8)*(&byte_4F0CCF[4 * (unsigned int)window_SpeakInHouse->ptr_1C] + dialog_menu_id)]; // negindex with ptr_1C around +0x36 - if ( v5[pParty->uDaysPlayed % 7 + 1] ) - { - if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[(unsigned __int8)*v5].pFilename) ) + v5 = &array_4F09B0[byte_4F0CD0[(unsigned int)window_SpeakInHouse->ptr_1C - 1][dialog_menu_id - 1]]; + if ( v5->pSchedule[pParty->uDaysPlayed % 7] ) + { + if ( _strcmpi(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename) ) { SaveGame(1, 0); - strcpy(pCurrentMapName, pMapStats->pInfos[(unsigned __int8)*v5].pFilename); - v8 = *((int *)v5 + 6); - v9 = *((int *)v5 + 5); - v10 = *((int *)v5 + 4); + strcpy(pCurrentMapName, pMapStats->pInfos[v5->uMapInfoID].pFilename); + v8 = v5->field_18; + v9 = v5->field_14; + v10 = v5->field_10; dword_6BE364_game_settings_1 |= 1u; _5B65B8_npcdata_hiword_house_or_other = 0; dword_5B65BC = 0; @@ -10140,19 +10158,19 @@ } else { - v6 = *((int *)v5 + 3); + v6 = v5->field_C; pParty->sRotationX = 0; pParty->vPosition.x = v6; - v7 = *((int *)v5 + 4); + v7 = v5->field_10; pIndoorCamera->sRotationY = 0; pParty->uFlags |= 2u; pParty->vPosition.y = v7; - pParty->vPosition.z = *((int *)v5 + 5); + pParty->vPosition.z = v5->field_14; pParty->uFallStartY = pParty->vPosition.z; - pParty->sRotationY = *((int *)v5 + 6); + pParty->sRotationY = v5->field_18; } HousePlaySomeSound((unsigned int)window_SpeakInHouse->ptr_1C, 2); - v12 = (unsigned __int8)v5[8]; + v12 = v5->uTravelTime; int _v47; if ( (signed int)window_SpeakInHouse->ptr_1C >= 63 ) { @@ -10179,7 +10197,7 @@ if ( v12 < 1 ) v12 = 1; RestAndHeal(1440 * v12); - v61->PlaySound((PlayerSpeech)v63, 0); + v1->PlaySound((PlayerSpeech)v63, 0); v14 = GetTickCount(); v15 = v14 + v13; if ( v15 < v14 ) diff -r 7378398c34e4 -r e0a8cc28caeb mm7_data.cpp --- a/mm7_data.cpp Fri Mar 22 09:14:37 2013 +0600 +++ b/mm7_data.cpp Fri Mar 22 09:14:45 2013 +0600 @@ -1489,13 +1489,73 @@ unsigned short pMaxLevelPerTrainingHallType[6] = {5, 15, 25, 25, 200, 200}; int price_for_membership[11]={100, 100, 50, 50, 50, 50, 50, 50, 50, 1000, 1000}; // weak -char byte_4F09B0[777]; // weak -char byte_4F09B1[777]; // weak -char byte_4F09B8[777]; // weak -int dword_4F09CC[192]; -char byte_4F0CCF[777]; // weak -char _4F0D38_TravelInfo[777]; // weak -int dword_4F0E10[32]; + +stru365_travel_info array_4F09B0[25] = +{ + {3, {1, 0, 1, 0, 1, 0, 0}, 2, {0, 0, 0}, 0xFFFFB980, 4636, 833, 1536, 0} +}; +//char byte_4F09B0[777]; // weak +//char byte_4F09B1[777]; // weak +//char byte_4F09B8[777]; // weak +//int dword_4F09CC[192]; + +unsigned char byte_4F0CD0[30][4] = +{ + { 9, 0, 1, 0}, // BildingType_WeaponShop + { 1, 0, 0, 0}, // BildingType_ArmorShop + { 1, 0, 0, 0}, // BildingType_MagicShop + { 0, 61, 0, 0}, // BildingType_AlchemistShop + {246, 24, 0, 0}, // BildingType_FireGuild + {193, 0, 0, 0}, // BildingType_AirGuild + { 0, 6, 0, 0}, // BildingType_WaterGuild + { 64, 0, 0, 0}, // BildingType_EarthGuild + { 6, 0, 1, 0}, // BildingType_SpiritGuild + { 1, 0, 0, 0}, // BildingType_MindGuild + { 1, 0, 0, 0}, // BildingType_BodyGuild + {227, 74, 0, 0}, // BildingType_LightGuild + {246, 178, 255, 255}, // BildingType_DarkGuild + {193, 0, 0, 0}, // BildingType_14 + { 0, 4, 0, 0}, // BildingType_15 + { 0, 0, 0, 0}, // BildingType_16 + { 3, 0, 1, 0}, // BildingType_TownHall + { 1, 0, 1, 0}, // BildingType_18 + { 2, 0, 0, 0}, // BildingType_19 + { 25, 215, 255, 255}, // BildingType_Throne_Room + {185, 52, 0, 0}, // BildingType_Tavern + {193, 0, 0, 0}, // BildingType_Bank + { 0, 6, 0, 0}, // BildingType_Temple + { 0, 0, 0, 0}, // BuildingType_24 + { 6, 1, 0, 1}, // BildingType_Unic + { 0, 0, 0, 0}, // BildingType_1A + { 4, 0, 0, 0}, // BildingType_Stables + {227, 74, 0, 0}, // BildingType_Boats + {246, 178, 255, 255}, // BildingType_House + {193, 0, 0, 0} // BildingType_Training +}; + +unsigned char byte_4F0E10[20][4] = +{ + { 0, 1, 1, 34}, + { 2, 3, 4, 5}, + { 6, 7, 8, 8}, + { 9, 10, 10, 10}, + { 11, 11, 12, 12}, + { 13, 13, 13, 13}, + { 14, 14, 15, 15}, + {255, 255, 255, 255}, + {255, 255, 255, 255}, + {255, 255, 255, 255}, + { 16, 17, 18, 19}, + { 18, 20, 21, 21}, + { 22, 23, 24, 25}, + { 22, 22, 23, 23}, + {255, 255, 255, 255}, + { 27, 28, 29, 30}, + { 31, 32, 33, 33}, + { 24, 24, 24, 24}, + {255, 255, 255, 255}, + {255, 255, 255, 255} +}; Vec2_int_ pMonsterArenaPlacements[20]; __int16 word_4F0F30[32] ={ 4, 7, 10, 11, 4, 7, 10, 11, diff -r 7378398c34e4 -r e0a8cc28caeb mm7_data.h --- a/mm7_data.h Fri Mar 22 09:14:37 2013 +0600 +++ b/mm7_data.h Fri Mar 22 09:14:45 2013 +0600 @@ -1012,13 +1012,15 @@ extern __int16 _4F0882_evt_VAR_PlayerItemInHands_vals[54]; extern unsigned short pMaxLevelPerTrainingHallType[]; extern int price_for_membership[]; // weak -extern char byte_4F09B0[]; // weak -extern char byte_4F09B1[]; // weak -extern char byte_4F09B8[]; // weak -extern int dword_4F09CC[192]; -extern char byte_4F0CCF[]; // weak -extern char _4F0D38_TravelInfo[]; // weak -extern int dword_4F0E10[32]; +//extern char byte_4F09B0[]; // weak +//extern char byte_4F09B1[]; // weak +//extern char byte_4F09B8[]; // weak +//extern int dword_4F09CC[192]; +//extern char byte_4F0CCF[]; // weak +extern unsigned char byte_4F0CD0[30][4]; +//extern char _4F0D38_TravelInfo[]; // negindex inside byte_4F0CD0; indexing furthers structs +//extern int dword_4F0E10[32]; +extern unsigned char byte_4F0E10[20][4]; extern Vec2_int_ pMonsterArenaPlacements[20]; extern __int16 word_4F0F30[32]; // weak extern char aS03d[]; // idb @@ -2321,7 +2323,7 @@ void __fastcall _4BBF61_summon_actor(int a1, __int16 x, int y, int z); // idb void __cdecl ArenaFight(); void SpellBookGenerator(); -struct GUIButton *__cdecl UI_CreateEndConversationButton(); +void UI_CreateEndConversationButton(); void __fastcall OnSelectShopDialogueOption(signed int uMessageParam); signed int __cdecl sub_4BD8B5(); bool __fastcall sub_4BDAAF(ItemGen *a1, int _2da_idx);