- lower the value of MAXSO.

This was causing overflow issues and resulted in bad int <-> float conversions.
This commit is contained in:
Christoph Oelckers 2022-01-28 17:03:14 +01:00
parent 6e96b1ee81
commit 13d01bc98b
6 changed files with 10 additions and 27 deletions

View file

@ -861,8 +861,7 @@ void TranslateSector(sectortype* pSector, int a2, int a3, int a4, int a5, int a6
vertexscan(wal, [&](walltype* wal)
{
viewInterpolateWall(wal);
wal->pos = vec;
wal->moved();
wal->move(vec);
});
};

View file

@ -318,12 +318,14 @@ void setanimatevalue(int type, int index, double value)
sector[index].setceilingz((int)value);
break;
case anim_vertexx:
wall[index].moved();
wall[index].pos.X = value * worldtomap;
wall[index].pos.X = value * maptoworld;
wall[index].moved();
break;
case anim_vertexy:
wall[index].moved();
wall[index].pos.Y = value * worldtomap;
wall[index].pos.Y = value * maptoworld;
wall[index].moved();
break;
default:
assert(false);

View file

@ -1564,10 +1564,10 @@ enum
SO_TURRET = 97,
SO_VEHICLE = 98,
// #define SO_SPEED_BOAT 99
MAXSO = INT32_MAX
MAXSO = INT32_MAX / 2
};
inline bool SO_EMPTY(SECTOR_OBJECT* sop) { return (sop->pmid.X == INT32_MAX); }
inline bool SO_EMPTY(SECTOR_OBJECT* sop) { return (sop->pmid.X == MAXSO); }
extern SECTOR_OBJECT SectorObject[MAX_SECTOR_OBJECTS];

View file

@ -133,12 +133,12 @@ static void setvalue(so_interp::interp_data& element, double value)
switch (type)
{
case soi_wallx:
wall[index].moved();
wall[index].pos.X = value;
wall[index].moved();
break;
case soi_wally:
wall[index].moved();
wall[index].pos.Y = value;
wall[index].moved();
break;
case soi_ceil:
sector[index].setceilingz((int)value);

View file

@ -379,7 +379,7 @@ void SectorSetup(void)
SectorObject[ndx].mid_sector = nullptr;
SectorObject[ndx].op_main_sector = nullptr;
SectorObject[ndx].morph_wall_point = nullptr;
SectorObject[ndx].pmid.X = INT32_MAX;
SectorObject[ndx].pmid.X = MAXSO;
}
memset(SineWaveFloor, 0, sizeof(SineWaveFloor));

View file

@ -2669,24 +2669,6 @@ void VehicleSetSmoke(SECTOR_OBJECT* sop, ANIMATOR* animator)
}
void KillSectorObject(SECTOR_OBJECT* sop)
{
int newx = MAXSO;
int newy = MAXSO;
short newang = 0;
if (sop->track < SO_OPERATE_TRACK_START)
return;
sop->ang_tgt = sop->ang_moving = newang;
sop->spin_ang = 0;
sop->ang = sop->ang_tgt;
RefreshPoints(sop, newx - sop->pmid.X, newy - sop->pmid.Y, false);
}
void TornadoSpin(SECTOR_OBJECT* sop)
{
short delta_ang, speed;