- 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 vel; // velocity adjuments
TArray<int> origX;
TArray<int> origY;
TArray<DVector2> 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();
}
};

View file

@ -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++;
}

View file

@ -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;

View file

@ -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++;
}