- unlimited and floatified the movesector position array.

This commit is contained in:
Christoph Oelckers 2022-09-11 16:41:17 +02:00
parent 4f9718e8a8
commit b5b159f45b
7 changed files with 8 additions and 18 deletions

View file

@ -280,7 +280,7 @@ void movesector(DDukeActor* const actor, int msindex, DAngle rotation)
for(auto& wal : wallsofsector(actor->sector())) for(auto& wal : wallsofsector(actor->sector()))
{ {
auto t = rotatepoint({ 0, 0 }, { msx[msindex] * inttoworld, msy[msindex] * inttoworld }, rotation); auto t = rotatepoint({ 0, 0 }, mspos[msindex], rotation);
dragpoint(&wal, actor->spr.pos.XY() + t); dragpoint(&wal, actor->spr.pos.XY() + t);
msindex++; msindex++;

View file

@ -31,7 +31,6 @@ void movefta();
void clearcameras(int i, player_struct* p); void clearcameras(int i, player_struct* p);
void RANDOMSCRAP(DDukeActor* i); void RANDOMSCRAP(DDukeActor* i);
void ms(DDukeActor* i);
void movecrane(DDukeActor* i, int crane); void movecrane(DDukeActor* i, int crane);
void movefountain(DDukeActor* i, int fountain); void movefountain(DDukeActor* i, int fountain);
void moveflammable(DDukeActor* i, int pool); void moveflammable(DDukeActor* i, int pool);

View file

@ -83,8 +83,7 @@ int actor_tog; // cheat helper
int playerswhenstarted; // why is this needed? int playerswhenstarted; // why is this needed?
int show_shareware; // display only. int show_shareware; // display only.
int rtsplaying; // RTS playback state int rtsplaying; // RTS playback state
int tempwallptr; // msx/y index. TArray<DVector2> mspos;
int msx[MAXANIMPOINTS], msy[MAXANIMPOINTS];
TArray<CraneDef> cranes; TArray<CraneDef> cranes;
bool sound445done; // used in checksectors_r. This was local state inside a function, but this must be maintained globally and serialized bool sound445done; // used in checksectors_r. This was local state inside a function, but this must be maintained globally and serialized

View file

@ -62,7 +62,6 @@ extern int screenpeek;
// Variables that must be saved // Variables that must be saved
extern int rtsplaying; extern int rtsplaying;
extern int tempwallptr;
extern bool sound445done; extern bool sound445done;
extern player_struct ps[MAXPLAYERS]; extern player_struct ps[MAXPLAYERS];
@ -123,7 +122,7 @@ extern int geocnt;
extern short ambientlotag[64]; extern short ambientlotag[64];
extern short ambienthitag[64]; extern short ambienthitag[64];
extern unsigned ambientfx; extern unsigned ambientfx;
extern int msx[MAXANIMPOINTS], msy[MAXANIMPOINTS]; // todo: unlimit extern TArray<DVector2> mspos;
extern TArray<CraneDef> cranes; extern TArray<CraneDef> cranes;
extern int WindTime, WindDir; extern int WindTime, WindDir;
extern short fakebubba_spawn, mamaspawn_count, banjosound; extern short fakebubba_spawn, mamaspawn_count, banjosound;

View file

@ -453,7 +453,7 @@ void resetprestat(int snum,int g)
randomseed = 17L; randomseed = 17L;
paused = 0; paused = 0;
ud.cameraactor =nullptr; ud.cameraactor =nullptr;
tempwallptr = 0; mspos.Clear();
cranes.Clear(); cranes.Clear();
camsprite =nullptr; camsprite =nullptr;
earthquaketime = 0; earthquaketime = 0;

View file

@ -372,7 +372,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
("bomb_tag", ud.bomb_tag) ("bomb_tag", ud.bomb_tag)
("rtsplaying", rtsplaying) ("rtsplaying", rtsplaying)
("tempwallptr", tempwallptr) //("tempwallptr", tempwallptr)
("cranes", cranes) ("cranes", cranes)
("sound445done", sound445done) ("sound445done", sound445done)
.Array("players", ps, ud.multimode) .Array("players", ps, ud.multimode)
@ -425,8 +425,7 @@ void GameInterface::SerializeGameState(FSerializer& arc)
("ambientfx", ambientfx) ("ambientfx", ambientfx)
.Array("ambientlotag", ambientlotag, ambientfx) .Array("ambientlotag", ambientlotag, ambientfx)
.Array("ambienthitag", ambienthitag, ambientfx) .Array("ambienthitag", ambienthitag, ambientfx)
.Array("msx", msx, MAXANIMPOINTS) ("mspos", mspos)
.Array("msy", msy, MAXANIMPOINTS)
("windtime", WindTime) ("windtime", WindTime)
("winddir", WindDir) ("winddir", WindDir)
("fakebubba_spawn", fakebubba_spawn) ("fakebubba_spawn", fakebubba_spawn)

View file

@ -955,16 +955,10 @@ void spawneffector(DDukeActor* actor, TArray<DDukeActor*>* actors)
} }
} }
actor->temp_data[1] = tempwallptr; actor->temp_data[1] = mspos.Size();
for (auto& wal : wallsofsector(sectp)) for (auto& wal : wallsofsector(sectp))
{ {
msx[tempwallptr] = wal.wall_int_pos().X - actor->int_pos().X; mspos.Push(wal.pos - actor->spr.pos);
msy[tempwallptr] = wal.wall_int_pos().Y - actor->int_pos().Y;
tempwallptr++;
if (tempwallptr > 2047)
{
I_Error("Too many moving sectors at (%d,%d).\n", int(wal.pos.X), int(wal.pos.Y));
}
} }
if (actor->spr.lotag == SE_30_TWO_WAY_TRAIN || actor->spr.lotag == SE_6_SUBWAY || actor->spr.lotag == SE_14_SUBWAY_CAR || actor->spr.lotag == SE_5_BOSS) if (actor->spr.lotag == SE_30_TWO_WAY_TRAIN || actor->spr.lotag == SE_6_SUBWAY || actor->spr.lotag == SE_14_SUBWAY_CAR || actor->spr.lotag == SE_5_BOSS)
{ {