From 959c3bc18b84b4b310bc888478fa37720f7112c5 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 25 Nov 2021 17:02:27 +0100 Subject: [PATCH] - springboard --- source/games/sw/src/game.h | 10 ++-------- source/games/sw/src/save.cpp | 4 ++-- source/games/sw/src/sector.cpp | 12 ++++++------ 3 files changed, 10 insertions(+), 16 deletions(-) diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 3dd72ea72..4424dd8fe 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -1553,19 +1553,13 @@ extern SINE_WALL SineWall[MAX_SINE_WALL][MAX_SINE_WALL_POINTS]; struct SPRING_BOARD { - int Sector, TimeOut; + sectortype* sectp; + int TimeOut; }; extern SPRING_BOARD SpringBoard[20]; extern SWING Rotate[17]; -typedef struct -{ - int sector, speed; - int xmid, ymid; -} SPIN; - -extern SPIN Spin[17]; extern DOOR_AUTO_CLOSE DoorAutoClose[MAX_DOOR_AUTO_CLOSE]; #define MAXANIM 256 diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index c33b3bc33..b5eb55262 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -935,7 +935,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, SINE_WALL& w, SINE FSerializer& Serialize(FSerializer& arc, const char* keyname, SPRING_BOARD& w, SPRING_BOARD* def) { - static SPRING_BOARD nul = { -1,-1 }; + static SPRING_BOARD nul = { nullptr,-1 }; if (!def) { def = &nul; @@ -944,7 +944,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, SPRING_BOARD& w, S if (arc.BeginObject(keyname)) { - arc("sector", w.Sector, def->Sector) + arc("sector", w.sectp, def->sectp) ("timeout", w.TimeOut, def->TimeOut) .EndObject(); } diff --git a/source/games/sw/src/sector.cpp b/source/games/sw/src/sector.cpp index 60acdcd43..2b43ad6f6 100644 --- a/source/games/sw/src/sector.cpp +++ b/source/games/sw/src/sector.cpp @@ -387,7 +387,7 @@ void SectorSetup(void) } memset(SineWaveFloor, 0, sizeof(SineWaveFloor)); - memset(SpringBoard, -1, sizeof(SpringBoard)); + memset(SpringBoard, 0, sizeof(SpringBoard)); LevelSecrets = 0; @@ -626,19 +626,19 @@ void DoSpringBoardDown(void) sbp = &SpringBoard[sb]; // if empty set up an entry to close the sb later - if (sbp->Sector != -1) + if (sbp->sectp != nullptr) { if ((sbp->TimeOut -= synctics) <= 0) { int destz; - destz = nextsectorneighborzptr(sbp->Sector, sector[sbp->Sector].floorz, 1, 1)->floorz; + destz = nextsectorneighborzptr(sbp->sectp, sbp->sectp->floorz, 1, 1)->floorz; - AnimSet(ANIM_Floorz, sbp->Sector, nullptr, destz, 256); + AnimSet(ANIM_Floorz, sbp->sectp, destz, 256); - sector[sbp->Sector].lotag = TAG_SPRING_BOARD; + sbp->sectp->lotag = TAG_SPRING_BOARD; - sbp->Sector = -1; + sbp->sectp = nullptr; } } }