Skip to content

Commit

Permalink
Sync Jersey's Jersey Quest
Browse files Browse the repository at this point in the history
  • Loading branch information
obligaron authored and AJenbo committed May 27, 2023
1 parent d2cf208 commit 805c323
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
4 changes: 3 additions & 1 deletion Source/quests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
}

Expand Down
14 changes: 11 additions & 3 deletions Source/towners.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint8_t>(curFrame, cowFarmer._tAnimLen - 1);
UpdateCowFarmerAnimAfterQuestComplete();
NetSendCmdQuest(true, quest);
return;
}

Expand All @@ -685,6 +684,7 @@ void TalkToCowFarmer(Player &player, Towner &cowFarmer)
quest._qvar1 = 1;
quest._qmsg = TEXT_JERSEY4;
quest._qlog = true;
NetSendCmdQuest(true, quest);
return;
}

Expand Down Expand Up @@ -925,6 +925,14 @@ void UpdateGirlAnimAfterQuestComplete()
girl->_tAnimFrame = std::min<uint8_t>(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<uint8_t>(curFrame, cowFarmer->_tAnimLen - 1);
}

#ifdef _DEBUG
bool DebugTalkToTowner(std::string targetName)
{
Expand Down
1 change: 1 addition & 0 deletions Source/towners.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ void ProcessTowners();
void TalkToTowner(Player &player, int t);

void UpdateGirlAnimAfterQuestComplete();
void UpdateCowFarmerAnimAfterQuestComplete();

#ifdef _DEBUG
bool DebugTalkToTowner(std::string targetName);
Expand Down

0 comments on commit 805c323

Please sign in to comment.