- floatified ROTATOR

This commit is contained in:
Christoph Oelckers 2022-09-06 00:45:22 +02:00
parent b53e4b824e
commit 3bd8a02c3f
4 changed files with 8 additions and 16 deletions

View file

@ -870,21 +870,17 @@ struct ROTATOR
int orig_speed; // original speed - vel jacks with speed int orig_speed; // original speed - vel jacks with speed
int vel; // velocity adjuments int vel; // velocity adjuments
TArray<int> origX; TArray<DVector2> orig;
TArray<int> origY;
void SetNumWalls(int num) void SetNumWalls(int num)
{ {
origX.Resize(num); orig.Resize(num);
origY.Resize(num); memset(orig.Data(), 0, num * sizeof(DVector2));
memset(origX.Data(), 0, num * sizeof(int));
memset(origY.Data(), 0, num * sizeof(int));
} }
void ClearWalls() void ClearWalls()
{ {
origX.Reset(); orig.Reset();
origY.Reset();
} }
}; };

View file

@ -300,7 +300,6 @@ int DoRotator(DSWActor* actor)
ROTATOR* r; ROTATOR* r;
short ndx,w,startwall,endwall; short ndx,w,startwall,endwall;
DSWActor* pivot = nullptr; DSWActor* pivot = nullptr;
vec2_t nxy;
bool kill = false; bool kill = false;
r = actor->user.rotator.Data(); r = actor->user.rotator.Data();
@ -397,10 +396,9 @@ int DoRotator(DSWActor* actor)
ndx = 0; ndx = 0;
for(auto& wal : wallsofsector(actor->sector())) for(auto& wal : wallsofsector(actor->sector()))
{ {
vec2_t const orig = { r->origX[ndx], r->origY[ndx] }; auto nxy = rotatepoint(pivot->spr.pos, r->orig[ndx], DAngle::fromBuild(r->pos));
rotatepoint(pivot->int_pos().vec2, orig, r->pos, &nxy);
dragpoint(&wal, nxy.X, nxy.Y); dragpoint(&wal, nxy);
ndx++; ndx++;
} }

View file

@ -727,8 +727,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, ROTATOR& w, ROTATO
("speed", w.speed) ("speed", w.speed)
("orig_speed", w.orig_speed) ("orig_speed", w.orig_speed)
("vel", w.vel) ("vel", w.vel)
("origx", w.origX) ("orig", w.orig)
("origy", w.origY)
.EndObject(); .EndObject();
} }
return arc; return arc;

View file

@ -2121,8 +2121,7 @@ void SpriteSetup(void)
wallcount = 0; wallcount = 0;
for(auto& wal : wallsofsector(actor->sector())) for(auto& wal : wallsofsector(actor->sector()))
{ {
actor->user.rotator->origX[wallcount] = wal.wall_int_pos().X; actor->user.rotator->orig[wallcount] = wal.pos;
actor->user.rotator->origY[wallcount] = wal.wall_int_pos().Y;
wallcount++; wallcount++;
} }