From d0978672e963d4a7a36ae4035a381afbf931a57c Mon Sep 17 00:00:00 2001 From: obligaron Date: Sun, 6 Nov 2022 20:46:43 +0100 Subject: [PATCH] Make Poisoned Water Supply quest multiplayer compatible --- Source/levels/town.cpp | 8 +++++++- Source/levels/town.h | 5 +++++ Source/quests.cpp | 7 +++++++ Source/towners.cpp | 2 ++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/Source/levels/town.cpp b/Source/levels/town.cpp index 06a0a9409..45ebf2342 100644 --- a/Source/levels/town.cpp +++ b/Source/levels/town.cpp @@ -346,6 +346,13 @@ void TownOpenGrave() dPiece[34][21] = 0x53b; } +void CleanTownFountain() +{ + if (!pMegaTiles) + return; + FillTile(60, 70, 71); +} + void CreateTown(lvl_entry entry) { dminPosition = { 10, 10 }; @@ -374,7 +381,6 @@ void CreateTown(lvl_entry entry) } DrlgTPass3(); - pMegaTiles = nullptr; } } // namespace devilution diff --git a/Source/levels/town.h b/Source/levels/town.h index 4811d62aa..abc83817c 100644 --- a/Source/levels/town.h +++ b/Source/levels/town.h @@ -44,6 +44,11 @@ void TownOpenHive(); */ void TownOpenGrave(); +/** + * @brief Update town to show clean/not poisoned water fountain + */ +void CleanTownFountain(); + /** * @brief Initialize town level * @param entry Method of entry diff --git a/Source/quests.cpp b/Source/quests.cpp index bae3dd4a6..c6707f07e 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -17,6 +17,7 @@ #include "engine/world_tile.hpp" #include "init.h" #include "levels/gendung.h" +#include "levels/town.h" #include "levels/trigs.h" #include "minitext.h" #include "missiles.h" @@ -350,6 +351,7 @@ void CheckQuests() && ActiveMonsterCount == 4 && Quests[Q_PWATER]._qactive != QUEST_DONE) { Quests[Q_PWATER]._qactive = QUEST_DONE; + NetSendCmdQuest(true, Quests[Q_PWATER]); PlaySfxLoc(IS_QUESTDN, MyPlayer->position.tile); LoadPalette("levels\\l3data\\l3pwater.pal", false); UpdatePWaterPalette(); @@ -691,6 +693,11 @@ void ResyncQuests() ObjChangeMapResync(posPentagram.x, posPentagram.y, posPentagram.x + 5, posPentagram.y + 5); InitL4Triggers(); } + if (currlevel == 0 + && Quests[Q_PWATER]._qactive == QUEST_DONE + && gbIsMultiplayer) { + CleanTownFountain(); + } } void DrawQuestLog(const Surface &out) diff --git a/Source/towners.cpp b/Source/towners.cpp index a7f76438b..8306d5a87 100644 --- a/Source/towners.cpp +++ b/Source/towners.cpp @@ -484,12 +484,14 @@ void TalkToHealer(Player &player, Towner &healer) Quests[Q_PWATER]._qlog = true; Quests[Q_PWATER]._qmsg = TEXT_POISON3; InitQTextMsg(TEXT_POISON3); + NetSendCmdQuest(true, Quests[Q_PWATER]); return; } if (Quests[Q_PWATER]._qactive == QUEST_DONE && Quests[Q_PWATER]._qvar1 != 2) { Quests[Q_PWATER]._qvar1 = 2; InitQTextMsg(TEXT_POISON5); SpawnUnique(UITEM_TRING, healer.position + Direction::SouthWest); + NetSendCmdQuest(true, Quests[Q_PWATER]); return; } }