mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-19 07:31:03 +00:00
- SOP::op_main_sector
This commit is contained in:
parent
f388efc5ef
commit
52d9451cbc
5 changed files with 16 additions and 15 deletions
|
@ -1652,6 +1652,7 @@ struct SECTOR_OBJECTstruct
|
|||
sectortype*
|
||||
sectp[MAX_SO_SECTOR],
|
||||
*scratch, // Just a filler to account for shitty loop tests.
|
||||
*op_main_sector, // main sector operational SO moves in - for speed purposes
|
||||
*mid_sector; // middle sector
|
||||
|
||||
|
||||
|
@ -1680,7 +1681,6 @@ struct SECTOR_OBJECTstruct
|
|||
drive_speed,
|
||||
drive_slide,
|
||||
crush_z,
|
||||
op_main_sector, // main sector operational SO moves in - for speed purposes
|
||||
flags;
|
||||
|
||||
int16_t xorig[MAX_SO_POINTS], // save the original x & y location of each wall so it can be
|
||||
|
|
|
@ -307,7 +307,7 @@ MorphTornado(SECTOR_OBJECTp sop)
|
|||
int x,y,sx,sy;
|
||||
|
||||
// z direction
|
||||
ASSERT(sop->op_main_sector >= 0);
|
||||
ASSERT(sop->op_main_sector != nullptr);
|
||||
sop->morph_z += Z(sop->morph_z_speed);
|
||||
|
||||
// move vector
|
||||
|
@ -352,8 +352,8 @@ MorphTornado(SECTOR_OBJECTp sop)
|
|||
dragpoint(sop->morph_wall_point, mx, my);
|
||||
|
||||
// bound the Z
|
||||
ceilingz = sector[sop->op_main_sector].ceilingz;
|
||||
floorz = sector[sop->op_main_sector].floorz;
|
||||
ceilingz = sop->op_main_sector->ceilingz;
|
||||
floorz = sop->op_main_sector->floorz;
|
||||
|
||||
for (sectp = sop->sectp, j = 0; *sectp; sectp++, j++)
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ MorphFloor(SECTOR_OBJECTp sop)
|
|||
int x,y;
|
||||
|
||||
// z direction
|
||||
ASSERT(sop->op_main_sector >= 0);
|
||||
ASSERT(sop->op_main_sector != nullptr);
|
||||
sop->morph_z -= Z(sop->morph_z_speed);
|
||||
|
||||
// move vector
|
||||
|
@ -431,7 +431,7 @@ MorphFloor(SECTOR_OBJECTp sop)
|
|||
dragpoint(sop->morph_wall_point, mx, my);
|
||||
|
||||
// bound the Z
|
||||
floorz = sector[sop->op_main_sector].floorz;
|
||||
floorz = sop->op_main_sector->floorz;
|
||||
|
||||
#define MORPH_FLOOR_ZRANGE Z(300)
|
||||
|
||||
|
@ -516,7 +516,7 @@ SpikeFloor(SECTOR_OBJECTp sop)
|
|||
int x,y;
|
||||
|
||||
// z direction
|
||||
ASSERT(sop->op_main_sector >= 0);
|
||||
ASSERT(sop->op_main_sector != nullptr);
|
||||
sop->morph_z -= Z(sop->morph_z_speed);
|
||||
|
||||
// move vector
|
||||
|
@ -532,7 +532,7 @@ SpikeFloor(SECTOR_OBJECTp sop)
|
|||
my = y;
|
||||
|
||||
// bound the Z
|
||||
floorz = sector[sop->op_main_sector].floorz;
|
||||
floorz = sop->op_main_sector->floorz;
|
||||
|
||||
#define MORPH_FLOOR_ZRANGE Z(300)
|
||||
|
||||
|
|
|
@ -2647,7 +2647,7 @@ void DoPlayerMoveVehicle(PLAYERp pp)
|
|||
|
||||
save_sectnum = pp->cursectnum;
|
||||
OperateSectorObject(pp->sop, pp->angle.ang.asbuild(), MAXSO, MAXSO);
|
||||
pp->cursectnum = pp->sop->op_main_sector; // for speed
|
||||
pp->setcursector(pp->sop->op_main_sector); // for speed
|
||||
|
||||
floor_dist = labs(z - pp->sop->floor_loz);
|
||||
|
||||
|
@ -4917,7 +4917,7 @@ void DoPlayerBeginOperateTurret(PLAYERp pp)
|
|||
void FindMainSector(SECTOR_OBJECTp sop)
|
||||
{
|
||||
// find the main sector - only do this once for each sector object
|
||||
if (sop->op_main_sector < 0)
|
||||
if (sop->op_main_sector == nullptr)
|
||||
{
|
||||
int sx = sop->xmid;
|
||||
int sy = sop->ymid;
|
||||
|
@ -4925,7 +4925,7 @@ void FindMainSector(SECTOR_OBJECTp sop)
|
|||
PlaceSectorObject(sop, MAXSO, MAXSO);
|
||||
|
||||
// set it to something valid
|
||||
sop->op_main_sector = 0;
|
||||
sop->op_main_sector = §or[0];
|
||||
|
||||
updatesectorz(sx, sy, sop->zmid, &sop->op_main_sector);
|
||||
|
||||
|
|
|
@ -384,6 +384,7 @@ void SectorSetup(void)
|
|||
SectorObject[ndx].controller = nullptr;
|
||||
SectorObject[ndx].sp_child = nullptr;
|
||||
SectorObject[ndx].mid_sector = nullptr;
|
||||
SectorObject[ndx].op_main_sector = nullptr;
|
||||
SectorObject[ndx].xmid = INT32_MAX;
|
||||
}
|
||||
|
||||
|
|
|
@ -1033,6 +1033,7 @@ void SetupSectorObject(sectortype* sectp, short tag)
|
|||
|
||||
memset(sop->sectp, 0, sizeof(sop->sectp));
|
||||
memset(sop->so_actors, 0, sizeof(sop->so_actors));
|
||||
sop->scratch = nullptr; // this is a guard field for sectp, because several loops do not test the end properly.
|
||||
sop->match_event_actor = nullptr;
|
||||
sop->crush_z = 0;
|
||||
sop->drive_angspeed = 0;
|
||||
|
@ -1058,7 +1059,7 @@ void SetupSectorObject(sectortype* sectp, short tag)
|
|||
sop->floor_hiz = 9999999;
|
||||
sop->player_xoff = sop->player_yoff = 0;
|
||||
sop->ang_tgt = sop->ang = sop->ang_moving = 0;
|
||||
sop->op_main_sector = -1;
|
||||
sop->op_main_sector = nullptr;
|
||||
sop->ram_damage = 0;
|
||||
sop->max_damage = -9999;
|
||||
|
||||
|
@ -2816,7 +2817,6 @@ void TornadoSpin(SECTOR_OBJECTp sop)
|
|||
void DoTornadoObject(SECTOR_OBJECTp sop)
|
||||
{
|
||||
int xvect,yvect;
|
||||
int cursect;
|
||||
// this made them move together more or less - cool!
|
||||
//static short ang = 1024;
|
||||
int floor_dist;
|
||||
|
@ -2827,8 +2827,8 @@ void DoTornadoObject(SECTOR_OBJECTp sop)
|
|||
xvect = sop->vel * bcos(*ang);
|
||||
yvect = sop->vel * bcos(*ang);
|
||||
|
||||
cursect = sop->op_main_sector; // for sop->vel
|
||||
floor_dist = (labs(sector[cursect].ceilingz - sector[cursect].floorz)) >> 2;
|
||||
auto cursect = sop->op_main_sector; // for sop->vel
|
||||
floor_dist = (abs(cursect->ceilingz - cursect->floorz)) >> 2;
|
||||
pos.x = sop->xmid;
|
||||
pos.y = sop->ymid;
|
||||
pos.z = floor_dist;
|
||||
|
|
Loading…
Reference in a new issue