From 3bd8a02c3f07c58b669c3abaf248b0a4deaab4c8 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 6 Sep 2022 00:45:22 +0200 Subject: [PATCH] - floatified ROTATOR --- source/games/sw/src/game.h | 12 ++++-------- source/games/sw/src/rotator.cpp | 6 ++---- source/games/sw/src/save.cpp | 3 +-- source/games/sw/src/sprite.cpp | 3 +-- 4 files changed, 8 insertions(+), 16 deletions(-) diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index 335e624ef..ecd969267 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -870,21 +870,17 @@ struct ROTATOR int orig_speed; // original speed - vel jacks with speed int vel; // velocity adjuments - TArray origX; - TArray origY; + TArray orig; void SetNumWalls(int num) { - origX.Resize(num); - origY.Resize(num); - memset(origX.Data(), 0, num * sizeof(int)); - memset(origY.Data(), 0, num * sizeof(int)); + orig.Resize(num); + memset(orig.Data(), 0, num * sizeof(DVector2)); } void ClearWalls() { - origX.Reset(); - origY.Reset(); + orig.Reset(); } }; diff --git a/source/games/sw/src/rotator.cpp b/source/games/sw/src/rotator.cpp index a81e9c03d..2d7129a6d 100644 --- a/source/games/sw/src/rotator.cpp +++ b/source/games/sw/src/rotator.cpp @@ -300,7 +300,6 @@ int DoRotator(DSWActor* actor) ROTATOR* r; short ndx,w,startwall,endwall; DSWActor* pivot = nullptr; - vec2_t nxy; bool kill = false; r = actor->user.rotator.Data(); @@ -397,10 +396,9 @@ int DoRotator(DSWActor* actor) ndx = 0; for(auto& wal : wallsofsector(actor->sector())) { - vec2_t const orig = { r->origX[ndx], r->origY[ndx] }; - rotatepoint(pivot->int_pos().vec2, orig, r->pos, &nxy); + auto nxy = rotatepoint(pivot->spr.pos, r->orig[ndx], DAngle::fromBuild(r->pos)); - dragpoint(&wal, nxy.X, nxy.Y); + dragpoint(&wal, nxy); ndx++; } diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index d68626c22..53c77c84f 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -727,8 +727,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, ROTATOR& w, ROTATO ("speed", w.speed) ("orig_speed", w.orig_speed) ("vel", w.vel) - ("origx", w.origX) - ("origy", w.origY) + ("orig", w.orig) .EndObject(); } return arc; diff --git a/source/games/sw/src/sprite.cpp b/source/games/sw/src/sprite.cpp index 407af1bfc..ff08f0ed8 100644 --- a/source/games/sw/src/sprite.cpp +++ b/source/games/sw/src/sprite.cpp @@ -2121,8 +2121,7 @@ void SpriteSetup(void) wallcount = 0; for(auto& wal : wallsofsector(actor->sector())) { - actor->user.rotator->origX[wallcount] = wal.wall_int_pos().X; - actor->user.rotator->origY[wallcount] = wal.wall_int_pos().Y; + actor->user.rotator->orig[wallcount] = wal.pos; wallcount++; }