From 805c323063a20029a3c6e0f6d5d15043b28e11dc Mon Sep 17 00:00:00 2001 From: obligaron Date: Sat, 27 May 2023 21:05:07 +0200 Subject: [PATCH] Sync Jersey's Jersey Quest --- Source/quests.cpp | 4 +++- Source/towners.cpp | 14 +++++++++++--- Source/towners.h | 1 + 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/Source/quests.cpp b/Source/quests.cpp index 9c769dc1ebd..4c2958bd4be 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -917,7 +917,7 @@ void SetMultiQuest(int q, quest_state s, bool log, int v1, int v2, int16_t qmsg) auto &quest = Quests[q]; quest_state oldQuestState = quest._qactive; if (quest._qactive != QUEST_DONE) { - if (s > quest._qactive) + if (s > quest._qactive || (IsAnyOf(s, QUEST_ACTIVE, QUEST_DONE) && IsAnyOf(quest._qactive, QUEST_HIVE_TEASE1, QUEST_HIVE_TEASE2, QUEST_HIVE_ACTIVE))) quest._qactive = s; if (log) quest._qlog = true; @@ -936,6 +936,8 @@ void SetMultiQuest(int q, quest_state s, bool log, int v1, int v2, int16_t qmsg) StartPWaterPurify(); if (quest._qidx == Q_GIRL && questGotCompleted && MyPlayer->isOnLevel(0)) UpdateGirlAnimAfterQuestComplete(); + if (quest._qidx == Q_JERSEY && questGotCompleted && MyPlayer->isOnLevel(0)) + UpdateCowFarmerAnimAfterQuestComplete(); } } diff --git a/Source/towners.cpp b/Source/towners.cpp index 7f0da308329..3c5237665b9 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -673,9 +673,8 @@ void TalkToCowFarmer(Player &player, Towner &cowFarmer) SpawnUnique(UITEM_BOVINE, cowFarmer.position + Direction::SouthEast); InitQTextMsg(TEXT_JERSEY8); quest._qactive = QUEST_DONE; - auto curFrame = cowFarmer._tAnimFrame; - LoadTownerAnimations(cowFarmer, "towners\\farmer\\mfrmrn2", 15, 3); - cowFarmer._tAnimFrame = std::min(curFrame, cowFarmer._tAnimLen - 1); + UpdateCowFarmerAnimAfterQuestComplete(); + NetSendCmdQuest(true, quest); return; } @@ -685,6 +684,7 @@ void TalkToCowFarmer(Player &player, Towner &cowFarmer) quest._qvar1 = 1; quest._qmsg = TEXT_JERSEY4; quest._qlog = true; + NetSendCmdQuest(true, quest); return; } @@ -925,6 +925,14 @@ void UpdateGirlAnimAfterQuestComplete() girl->_tAnimFrame = std::min(curFrame, girl->_tAnimLen - 1); } +void UpdateCowFarmerAnimAfterQuestComplete() +{ + Towner *cowFarmer = GetTowner(TOWN_COWFARM); + auto curFrame = cowFarmer->_tAnimFrame; + LoadTownerAnimations(*cowFarmer, "towners\\farmer\\mfrmrn2", 15, 3); + cowFarmer->_tAnimFrame = std::min(curFrame, cowFarmer->_tAnimLen - 1); +} + #ifdef _DEBUG bool DebugTalkToTowner(std::string targetName) { diff --git a/Source/towners.h b/Source/towners.h index 075bbfa50a5..0a3c1b5e007 100644 --- a/Source/towners.h +++ b/Source/towners.h @@ -81,6 +81,7 @@ void ProcessTowners(); void TalkToTowner(Player &player, int t); void UpdateGirlAnimAfterQuestComplete(); +void UpdateCowFarmerAnimAfterQuestComplete(); #ifdef _DEBUG bool DebugTalkToTowner(std::string targetName);