Mercurial > mm7
changeset 1828:35c1e4ff6ba7
party_finds_gold to Party::PartyFindsGold, cleaned up, moved Level/Decoration.h reference out of Indoor.h
author | Grumpy7 |
---|---|
date | Fri, 11 Oct 2013 07:04:19 +0200 |
parents | 0c75c3e7e436 |
children | e4e27261d84e |
files | Actor.cpp Arcomage.cpp AudioPlayer.cpp CastSpellInfo.cpp Chest.cpp Events.cpp Indoor.cpp Indoor.h Keyboard.cpp Level/Decoration.h NPC.cpp Outdoor.cpp Party.cpp Party.h Player.cpp Render.cpp SaveLoad.cpp SpriteObject.cpp Sprites.cpp Sprites.h UI/Books/UIMapBook.cpp UI/UIHouses.cpp UI/UiGame.cpp Viewport.cpp Vis.cpp mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp mm7_6.cpp mm7_data.h |
diffstat | 31 files changed, 77 insertions(+), 84 deletions(-) [+] |
line wrap: on
line diff
--- a/Actor.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Actor.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -32,6 +32,7 @@ #include "stru298.h" #include "Log.h" #include "Texts.h" +#include "Level/Decoration.h"
--- a/Arcomage.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Arcomage.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -3901,7 +3901,7 @@ { pParty->pArcomageWins[v8-108] = 1; auto _a = (signed int)(p2DEvents[ window_SpeakInHouse->par1C - 1].fPriceMultiplier * 100.0); - party_finds_gold(_a, 0); + pParty->PartyFindsGold(_a, 0); } }
--- a/AudioPlayer.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/AudioPlayer.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -21,6 +21,7 @@ #include "GUIWindow.h" #include "Log.h" #include "ErrorHandling.h" +#include "Level/Decoration.h" #include "Bink_Smacker.h"
--- a/CastSpellInfo.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/CastSpellInfo.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -24,6 +24,7 @@ #include "TurnEngine.h" #include "texts.h" #include "LOD.h" +#include "Level/Decoration.h" const size_t CastSpellInfoCount = 10; std::array<CastSpellInfo, CastSpellInfoCount> pCastSpellInfo; @@ -2950,7 +2951,7 @@ v450 = *(int *)v449; if ( pItemsTable->pItems[v450].uEquipType == 18 ) { - party_finds_gold(*((int *)v449 + 3), 0); + pParty->PartyFindsGold(*((int *)v449 + 3), 0); viewparams->bRedrawGameUI = 1; } else
--- a/Chest.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Chest.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -27,6 +27,7 @@ #include "SpriteObject.h" #include "Mouse.h" #include "Viewport.h" +#include "Level/Decoration.h" size_t uNumChests; // idb struct ChestList *pChestList; @@ -835,7 +836,7 @@ v4 = pChests[chest_id].pInventoryIndices[v3] - 1; if ( pChests[chest_id].igChestItems[v4].GetItemEquipType() == EQUIP_GOLD ) { - party_finds_gold(pChests[chest_id].igChestItems[v4].uSpecEnchantmentType, 0); + pParty->PartyFindsGold(pChests[chest_id].igChestItems[v4].uSpecEnchantmentType, 0); viewparams->bRedrawGameUI = 1; } else
--- a/Events.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Events.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -32,6 +32,7 @@ #include "UI\UIHouses.h" #include "Log.h" #include "MM7.h" +#include "Level/Decoration.h"
--- a/Indoor.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Indoor.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -40,6 +40,7 @@ #include "Outdoor_stuff.h" #include "texts.h" #include "GUIWindow.h" +#include "Level/Decoration.h" @@ -6059,7 +6060,7 @@ v20 = pSpriteObjects[v18].stru_24.uItemID; if ( pItemsTable->pItems[v20].uEquipType == EQUIP_GOLD) { - party_finds_gold(v19->uSpecEnchantmentType, 0); + pParty->PartyFindsGold(v19->uSpecEnchantmentType, 0); viewparams->bRedrawGameUI = 1; v21 = v17; }
--- a/Indoor.h Fri Oct 11 05:49:39 2013 +0200 +++ b/Indoor.h Fri Oct 11 07:04:19 2013 +0200 @@ -1,6 +1,5 @@ #pragma once -#include "Level/Decoration.h" #include "Indoor_stuff.h" @@ -30,10 +29,6 @@ -extern std::array<LevelDecoration, 3000> pLevelDecorations; -extern size_t uNumLevelDecorations; -extern LevelDecoration* activeLevelDecoration; -
--- a/Keyboard.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Keyboard.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -16,6 +16,7 @@ #include "Indoor.h" #include "viewport.h" #include "AudioPlayer.h" +#include "Level/Decoration.h" struct KeyboardActionMapping *pKeyActionMap;
--- a/Level/Decoration.h Fri Oct 11 05:49:39 2013 +0200 +++ b/Level/Decoration.h Fri Oct 11 07:04:19 2013 +0200 @@ -1,9 +1,11 @@ #pragma once #include <cstdint> +#include <array> #include "../VectorTypes.h" + enum LEVEL_DECORATION_FLAGS: uint16_t { LEVEL_DECORATION_TRIGGERED_BY_TOUCH = 0x01, @@ -35,4 +37,10 @@ int16_t _idx_in_stru123; int16_t field_1E; }; + + + +extern std::array<LevelDecoration, 3000> pLevelDecorations; +extern size_t uNumLevelDecorations; +extern LevelDecoration* activeLevelDecoration; #pragma pack(pop)
--- a/NPC.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/NPC.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -16,6 +16,7 @@ #include "UI\UIHouses.h" #include "Indoor.h" #include "MapInfo.h" +#include "Level/Decoration.h" int pDialogueNPCCount; std::array<struct Texture *, 6> pDialogueNPCPortraits;
--- a/Outdoor.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Outdoor.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -35,6 +35,7 @@ #include "Outdoor_stuff.h" #include "BSPModel.h" #include "GUIWindow.h" +#include "Level/Decoration.h" MapStartPoint uLevel_StartingPointType; // weak
--- a/Party.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Party.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -819,7 +819,6 @@ signed __int64 v2; // qax@1 unsigned __int64 v4; // qax@1 unsigned int v5; // ebx@1 - Player *v6; // ebx@1 pParty->pHirelings[0].bHasUsedTheAbility = 0; pParty->pHirelings[1].bHasUsedTheAbility = 0; @@ -934,86 +933,54 @@ } } //----- (00420C05) -------------------------------------------------------- -void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal) +void Party::PartyFindsGold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal) { - unsigned int v2; // edi@1 int hirelingSalaries; // ebp@1 unsigned int goldToGain; // esi@1 - int v5; // ecx@6 - NPCData *v6; // eax@6 - signed int v7; // edx@8 - signed int v8; // ebx@10 - char *v9; // edi@11 - signed int v10; // ecx@17 - int v11; // eax@21 NPCData *v12; // ecx@21 unsigned int v13; // ecx@23 signed int hirelingCount; // [sp+Ch] [bp-4h]@6 - v2 = 0; hirelingSalaries = 0; goldToGain = uNumGold; - if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal ) + + if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 2 ) + pTmpBuf2[0] = 0; + else if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 ) { - if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 1 ) - { - sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold! - } - else - { - if ( _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal == 2 ) - pTmpBuf2[0] = 0; - } - } + sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], uNumGold);// You found %lu gold! + } else { hirelingCount = 0; - v5 = 0; - v6 = pParty->pHirelings; - do + for (int i = 0; i < 2; i++) { - if ( v6->pName ) + if (this->pHirelings[i].pName) { - v7 = hirelingCount++; - pTmpBuf[v7] = v5; + hirelingCount++; + pTmpBuf[hirelingCount] = i; } - ++v6; - ++v5; } - while ( (signed int)v6 < (signed int)&pParty->pPickedItem ); - v8 = 0; - if ( (signed int)pNPCStats->uNumNewNPCs > 0 ) + for (uint i = 0; i < pNPCStats->uNumNewNPCs; i++) { - v9 = (char *)pNPCStats->pNewNPCData; - do + if ( pNPCStats->pNewNPCData[i].uFlags & 0x80 + && (!this->pHirelings[0].pName || strcmp(pNPCStats->pNewNPCData[i].pName, this->pHirelings[0].pName)) + && (!this->pHirelings[1].pName || strcmp(pNPCStats->pNewNPCData[i].pName, this->pHirelings[1].pName)) ) { - if ( v9[8] & 0x80 - && (!pParty->pHirelings[0].pName || strcmp(*(const char **)v9, pParty->pHirelings[0].pName)) - && (!pParty->pHirelings[1].pName || strcmp(*(const char **)v9, pParty->pHirelings[1].pName)) ) - { - v10 = hirelingCount++; - pTmpBuf[v10] = v8 + 2; - } - ++v8; - v9 += 76; + hirelingCount++; + pTmpBuf[hirelingCount] = i + 2; } - while ( v8 < (signed int)pNPCStats->uNumNewNPCs ); - v2 = 0; } - if ( hirelingCount > 0 ) + for (int i = 0; i < hirelingCount; i++) { - do - { - v11 = (unsigned __int8)pTmpBuf[v2]; - v12 = &pNPCStats->pNPCData[v11 + 499]; - if ( (unsigned __int8)pTmpBuf[v2] < 2 ) - v12 = &pParty->pHirelings[v11]; - v13 = v12->uProfession; - if ( v13 ) - hirelingSalaries += pNPCStats->pProfessions[v13].uHirePrice;//*(&pNPCStats->field_13A58 + 5 * v13); - ++v2; - } - while ( (signed int)v2 < hirelingCount ); + uchar thisBufId = (uchar)pTmpBuf[i]; + if (thisBufId < 2) + v12 = &this->pHirelings[thisBufId]; + else + v12 = &pNPCStats->pNPCData[thisBufId + 499]; + v13 = v12->uProfession; + if ( v13 ) + hirelingSalaries += pNPCStats->pProfessions[v13].uHirePrice;//*(&pNPCStats->field_13A58 + 5 * v13); } if ( CheckHiredNPCSpeciality(Factor) ) goldToGain += (signed int)(10 * goldToGain) / 100; @@ -1032,14 +999,13 @@ { sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[467], goldToGain);// You found %lu gold! } - v2 = 0; } - pParty->uNumGold += goldToGain - hirelingSalaries; - pUIAnim_Gold->uAnimTime = v2; + this->uNumGold += goldToGain - hirelingSalaries; + pUIAnim_Gold->uAnimTime = 0; pUIAnim_Gold->uAnimLength = 8 * pIconsFrameTable->pIcons[(signed __int16)pUIAnim_Gold->uIconID].uAnimLength; if ( pTmpBuf2[0] ) ShowStatusBarString(pTmpBuf2.data(), 2u); - pAudioPlayer->PlaySound(SOUND_GoldReceived, v2, v2, -1, v2, v2, v2, v2); + pAudioPlayer->PlaySound(SOUND_GoldReceived, 0, 0, -1, 0, 0, 0, 0); } //----- (00421B2C) -------------------------------------------------------- bool sub_421B2C_PlaceInInventory_or_DropPickedItem()
--- a/Party.h Fri Oct 11 05:49:39 2013 +0200 +++ b/Party.h Fri Oct 11 07:04:19 2013 +0200 @@ -189,6 +189,9 @@ void GivePartyExp(unsigned int pEXPNum); int GetPartyReputation(); + + void PartyFindsGold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal); + static void SetGold(unsigned int uNumGold); static void TakeGold(unsigned int uNumGold); static void SetFood(unsigned int uNumFood);
--- a/Player.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Player.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -2130,7 +2130,7 @@ } if ( enchBonusSum ) { - party_finds_gold(enchBonusSum, 2); + pParty->PartyFindsGold(enchBonusSum, 2); sprintf(pTmpBuf2.data(), pGlobalTXT_LocalizationStrings[302], this->pName, enchBonusSum); //%stole %d gold } else @@ -4876,7 +4876,7 @@ sprintf(pTmpBuf.data(), "+%u %s %s", thisa, v74, pGlobalTXT_LocalizationStrings[121]);//"Permanent" break; case 7: - party_finds_gold(1000 * thisa, 0); + pParty->PartyFindsGold(1000 * thisa, 0); sprintf(pTmpBuf.data(), "+%u %s", 1000 * thisa, pGlobalTXT_LocalizationStrings[97]);//"Gold" break; case 8: @@ -6078,7 +6078,7 @@ if ( val == 0 ) val = 1; v6 = rand(); - party_finds_gold(v6 % val + 1, 1); + pParty->PartyFindsGold(v6 % val + 1, 1); GameUI_DrawFoodAndGold(); return; case VAR_RandomFood: @@ -6165,7 +6165,7 @@ pParty->SetHoldingItem(&item); return; case VAR_FixedGold: - party_finds_gold(val, 1); + pParty->PartyFindsGold(val, 1); return; case VAR_BaseMight: this->uMight = min(this->uMight + val, 255);
--- a/Render.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Render.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -32,6 +32,7 @@ #include "mm7_data.h" #include "MM7.h" #include "Lights.h" +#include "Level/Decoration.h" #pragma comment(lib, "lib\\legacy_dx\\lib\\ddraw.lib") #pragma comment(lib, "lib\\legacy_dx\\lib\\dxguid.lib")
--- a/SaveLoad.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/SaveLoad.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -23,6 +23,7 @@ #include "texts.h" #include "Log.h" #include "VideoPlayer.h" +#include "Level/Decoration.h" #include "mm7_data.h"
--- a/SpriteObject.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/SpriteObject.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -13,6 +13,7 @@ #include "LOD.h" #include "Actor.h" #include "Events.h" +#include "Level/Decoration.h" #include "mm7_data.h" #include "MM7.h"
--- a/Sprites.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Sprites.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -15,6 +15,7 @@ #include "DecorationList.h" #include "MM7.h" #include "Actor.h" +#include "Level/Decoration.h"
--- a/Sprites.h Fri Oct 11 05:49:39 2013 +0200 +++ b/Sprites.h Fri Oct 11 07:04:19 2013 +0200 @@ -39,8 +39,9 @@ //__int16 _pad; }; -struct SpriteFrame: SpriteFrame_mm6 +class SpriteFrame: public SpriteFrame_mm6 { +public: __int16 uAnimLength; __int16 _pad; };
--- a/UI/Books/UIMapBook.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/UI/Books/UIMapBook.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -16,6 +16,7 @@ #include "..\..\Viewport.h" #include "..\..\Math.h" #include "..\..\texts.h" +#include "..\..\Level/Decoration.h" // #include "..\..\mm7_data.h"
--- a/UI/UIHouses.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/UI/UIHouses.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -1223,7 +1223,7 @@ { if ( pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] > 0 )//get prize { - party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); + pParty->PartyFindsGold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); for ( uint i = 0; i < 4; ++i ) pParty->pPlayers[i].SetVariable(VAR_Award, 86); pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel;
--- a/UI/UiGame.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/UI/UiGame.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -32,6 +32,7 @@ #include "UIHouses.h" #include "..\BSPModel.h" #include "..\Math.h" +#include "..\Level/Decoration.h" int uTextureID_GameUI_CharSelectionFrame; // 50C98C
--- a/Viewport.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Viewport.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -20,6 +20,7 @@ #include "TurnEngine.h" #include "stru123.h" #include "MM7.h" +#include "Level/Decoration.h" //----- (004C0262) -------------------------------------------------------- @@ -289,7 +290,7 @@ { if ( pSpriteObjects[v21].stru_24.GetItemEquipType() == 18 ) { - party_finds_gold(pSpriteObjects[v21].stru_24.uSpecEnchantmentType, 0); + pParty->PartyFindsGold(pSpriteObjects[v21].stru_24.uSpecEnchantmentType, 0); viewparams->bRedrawGameUI = 1; } else
--- a/Vis.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/Vis.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -11,6 +11,7 @@ #include "mm7_data.h" #include "MM7.h" +#include "Level/Decoration.h" static Vis_SelectionList Vis_static_sub_4C1944_stru_F8BDE8;
--- a/mm7_2.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/mm7_2.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -65,6 +65,7 @@ #include "MM7.h" #include "Lights.h" #include "NewUI/MainMenu.h" +#include "Level/Decoration.h" //----- (004BB756) -------------------------------------------------------- int UseNPCSkill(NPCProf profession) @@ -260,7 +261,7 @@ { if ( pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)] ) { - party_finds_gold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); + pParty->PartyFindsGold(100 * pMonsterStats->pInfos[(unsigned __int16)pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel, 0); for ( uint i = 0; i < 4; ++i ) pParty->pPlayers[i].SetVariable(VAR_Award, 86); pParty->uNumBountiesCollected += 100 * pMonsterStats->pInfos[pParty->monster_id_for_hunting[(int)((char *)window_SpeakInHouse->ptr_1C - 102)]].uLevel; @@ -317,7 +318,7 @@ ++v4; } while ( (signed int)v4 < (signed int)pParty->pHirelings ); - party_finds_gold(gold_transaction_amount, 0); + pParty->PartyFindsGold(gold_transaction_amount, 0); pAudioPlayer->PlaySound((SoundID)14060, 0, 0, -1, 0, 0, 0, 0); pParty->field_7B5_in_arena_quest = -1; }
--- a/mm7_3.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/mm7_3.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -43,6 +43,7 @@ #include "texts.h" #include "Log.h" #include "Lights.h" +#include "Level/Decoration.h" #include "MM7.h"
--- a/mm7_4.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/mm7_4.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -40,6 +40,7 @@ #include "Log.h" #include "UI\UIHouses.h" #include "Lights.h" +#include "Level/Decoration.h" //----- (0046CC4B) -------------------------------------------------------- void check_event_triggers()
--- a/mm7_5.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/mm7_5.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -46,6 +46,7 @@ #include "UI\UIHouses.h" #include "Lights.h" #include "Lights.h" +#include "Level/Decoration.h" //----- (004304E7) -------------------------------------------------------- void GameUI_MsgProc()
--- a/mm7_6.cpp Fri Oct 11 05:49:39 2013 +0200 +++ b/mm7_6.cpp Fri Oct 11 07:04:19 2013 +0200 @@ -77,7 +77,7 @@ while ( v2 < pActor->pMonsterInfo.uTreasureDiceRolls ); if ( v14 ) { - party_finds_gold(v14, 0); + pParty->PartyFindsGold(v14, 0); viewparams->bRedrawGameUI = 1; } } @@ -90,7 +90,7 @@ pActor->array_000234[3].Reset(); if ( v14 ) { - party_finds_gold(v14, 0); + pParty->PartyFindsGold(v14, 0); viewparams->bRedrawGameUI = 1; } }
--- a/mm7_data.h Fri Oct 11 05:49:39 2013 +0200 +++ b/mm7_data.h Fri Oct 11 07:04:19 2013 +0200 @@ -1083,7 +1083,6 @@ void LoadActualSkyFrame(); void Sleep6Hours(); void ChestUI_WritePointedObjectStatusString(); -void __fastcall party_finds_gold(unsigned int uNumGold, int _1_dont_share_with_followers___2_the_same_but_without_a_message__else_normal); // idb void OnChestLeftClick(); void GameUI_WritePointedObjectStatusString(); bool sub_421B2C_PlaceInInventory_or_DropPickedItem();