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