Browse Source

Sync Little Girl Quest

pull/6155/head
obligaron 3 years ago committed by Anders Jenbo
parent
commit
bac8535564
  1. 8
      Source/items.cpp
  2. 2
      Source/items.h
  3. 5
      Source/quests.cpp
  4. 16
      Source/towners.cpp
  5. 2
      Source/towners.h

8
Source/items.cpp

@ -2208,7 +2208,7 @@ void RecreateTownItem(const Player &player, Item &item, _item_indexes idx, uint1
RecreateHealerItem(player, item, idx, icreateinfo & CF_LEVEL, iseed);
}
void CreateMagicItem(Point position, int lvl, ItemType itemType, int imid, int icurs, bool sendmsg, bool delta)
void CreateMagicItem(Point position, int lvl, ItemType itemType, int imid, int icurs, bool sendmsg, bool delta, bool spawn = false)
{
if (ActiveItemCount >= MAXITEMS)
return;
@ -2231,6 +2231,8 @@ void CreateMagicItem(Point position, int lvl, ItemType itemType, int imid, int i
NetSendCmdPItem(false, CMD_DROPITEM, item.position, item);
if (delta)
DeltaAddItem(ii);
if (spawn)
NetSendCmdPItem(false, CMD_SPAWNITEM, item.position, item);
}
void NextItemRecord(int i)
@ -4515,9 +4517,9 @@ void CreateMagicArmor(Point position, ItemType itemType, int icurs, bool sendmsg
CreateMagicItem(position, lvl, itemType, IMISC_NONE, icurs, sendmsg, delta);
}
void CreateAmulet(Point position, int lvl, bool sendmsg, bool delta)
void CreateAmulet(Point position, int lvl, bool sendmsg, bool delta, bool spawn /*= false*/)
{
CreateMagicItem(position, lvl, ItemType::Amulet, IMISC_AMULET, ICURS_AMULET, sendmsg, delta);
CreateMagicItem(position, lvl, ItemType::Amulet, IMISC_AMULET, ICURS_AMULET, sendmsg, delta, spawn);
}
void CreateMagicWeapon(Point position, ItemType itemType, int icurs, bool sendmsg, bool delta)

2
Source/items.h

@ -549,7 +549,7 @@ void MakeGoldStack(Item &goldItem, int value);
int ItemNoFlippy();
void CreateSpellBook(Point position, SpellID ispell, bool sendmsg, bool delta);
void CreateMagicArmor(Point position, ItemType itemType, int icurs, bool sendmsg, bool delta);
void CreateAmulet(Point position, int lvl, bool sendmsg, bool delta);
void CreateAmulet(Point position, int lvl, bool sendmsg, bool delta, bool spawn = false);
void CreateMagicWeapon(Point position, ItemType itemType, int icurs, bool sendmsg, bool delta);
bool GetItemRecord(uint32_t nSeed, uint16_t wCI, int nIndex);
void SetItemRecord(uint32_t nSeed, uint16_t wCI, int nIndex);

5
Source/quests.cpp

@ -930,9 +930,12 @@ void SetMultiQuest(int q, quest_state s, bool log, int v1, int v2, int16_t qmsg)
// Ensure that changes on another client is also updated on our own
ResyncQuests();
bool questGotCompleted = oldQuestState != QUEST_DONE && quest._qactive == QUEST_DONE;
// Ensure that water also changes for remote players
if (quest._qidx == Q_PWATER && oldQuestState == QUEST_ACTIVE && quest._qactive == QUEST_DONE && MyPlayer->isOnLevel(quest._qslvl))
if (quest._qidx == Q_PWATER && questGotCompleted && MyPlayer->isOnLevel(quest._qslvl))
StartPWaterPurify();
if (quest._qidx == Q_GIRL && questGotCompleted && MyPlayer->isOnLevel(0))
UpdateGirlAnimAfterQuestComplete();
}
}

16
Source/towners.cpp

@ -750,11 +750,9 @@ void TalkToGirl(Player &player, Towner &girl)
if (quest._qactive != QUEST_DONE && RemoveInventoryItemById(player, IDI_THEODORE)) {
InitQTextMsg(TEXT_GIRL4);
CreateAmulet(girl.position, 13, true, false);
CreateAmulet(girl.position, 13, false, false, true);
quest._qactive = QUEST_DONE;
auto curFrame = girl._tAnimFrame;
LoadTownerAnimations(girl, "towners\\girl\\girls1", 20, 6);
girl._tAnimFrame = std::min<uint8_t>(curFrame, girl._tAnimLen - 1);
UpdateGirlAnimAfterQuestComplete();
if (gbIsMultiplayer)
NetSendCmdQuest(true, quest);
return;
@ -917,6 +915,16 @@ void TalkToTowner(Player &player, int t)
towner.talk(player, towner);
}
void UpdateGirlAnimAfterQuestComplete()
{
Towner *girl = GetTowner(TOWN_GIRL);
if (girl == nullptr || !girl->ownedAnim)
return; // Girl is not spawned in town yet
auto curFrame = girl->_tAnimFrame;
LoadTownerAnimations(*girl, "towners\\girl\\girls1", 20, 6);
girl->_tAnimFrame = std::min<uint8_t>(curFrame, girl->_tAnimLen - 1);
}
#ifdef _DEBUG
bool DebugTalkToTowner(std::string targetName)
{

2
Source/towners.h

@ -80,6 +80,8 @@ void FreeTownerGFX();
void ProcessTowners();
void TalkToTowner(Player &player, int t);
void UpdateGirlAnimAfterQuestComplete();
#ifdef _DEBUG
bool DebugTalkToTowner(std::string targetName);
#endif

Loading…
Cancel
Save