From 50cea20687ec7271ae75a82cbfb8e92a045245ad Mon Sep 17 00:00:00 2001 From: obligaron Date: Tue, 22 Nov 2022 21:48:09 +0100 Subject: [PATCH] Show portal opening animation in town --- Source/msg.cpp | 2 +- Source/portal.cpp | 12 +++++++----- Source/portal.h | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Source/msg.cpp b/Source/msg.cpp index fa4648fa6..3966a4d56 100644 --- a/Source/msg.cpp +++ b/Source/msg.cpp @@ -2123,7 +2123,7 @@ size_t OnActivatePortal(const TCmd *pCmd, size_t pnum) } } if (addPortal) { - AddWarpMissile(pnum, position); + AddWarpMissile(pnum, position, false); } } else { RemovePortalMissile(pnum); diff --git a/Source/portal.cpp b/Source/portal.cpp index 8ac8f8654..572ddbcaa 100644 --- a/Source/portal.cpp +++ b/Source/portal.cpp @@ -47,13 +47,15 @@ void SetPortalStats(int i, bool o, int x, int y, int lvl, dungeon_type lvltype, Portals[i].setlvl = isSetLevel; } -void AddWarpMissile(int i, Point position) +void AddWarpMissile(int i, Point position, bool sync) { MissilesData[MIS_TOWN].mlSFX = SFX_NONE; auto *missile = AddMissile({ 0, 0 }, position, Direction::South, MIS_TOWN, TARGET_MONSTERS, i, 0, 0); if (missile != nullptr) { - SetMissDir(*missile, 1); + // Don't show portal opening animation if we sync existing portals + if (sync) + SetMissDir(*missile, 1); if (leveltype != DTYPE_TOWN) missile->_mlid = AddLight(missile->position.tile, 15); @@ -68,20 +70,20 @@ void SyncPortals() if (!Portals[i].open) continue; if (leveltype == DTYPE_TOWN) - AddWarpMissile(i, WarpDrop[i]); + AddWarpMissile(i, WarpDrop[i], true); else { int lvl = currlevel; if (setlevel) lvl = setlvlnum; if (Portals[i].level == lvl && Portals[i].setlvl == setlevel) - AddWarpMissile(i, Portals[i].position); + AddWarpMissile(i, Portals[i].position, true); } } } void AddInTownPortal(int i) { - AddWarpMissile(i, WarpDrop[i]); + AddWarpMissile(i, WarpDrop[i], false); } void ActivatePortal(int i, Point position, int lvl, dungeon_type dungeonType, bool isSetLevel) diff --git a/Source/portal.h b/Source/portal.h index fbb4f028a..3c2e6e3f3 100644 --- a/Source/portal.h +++ b/Source/portal.h @@ -24,7 +24,7 @@ extern Portal Portals[MAXPORTAL]; void InitPortals(); void SetPortalStats(int i, bool o, int x, int y, int lvl, dungeon_type lvltype, bool isSetLevel); -void AddWarpMissile(int i, Point position); +void AddWarpMissile(int i, Point position, bool sync); void SyncPortals(); void AddInTownPortal(int i); void ActivatePortal(int i, Point position, int lvl, dungeon_type lvltype, bool sp);