mirror of
https://github.com/DrBeef/Raze.git
synced 2025-01-31 13:10:39 +00:00
- Duke: added a wrapper for player_struct::cursectnum to directly return the sector pointer.
This eliminates more than 10% of the existing direct references to the sector[] array.
This commit is contained in:
parent
c3cbd1b1eb
commit
9a1c80c464
13 changed files with 60 additions and 55 deletions
|
@ -363,7 +363,7 @@ void movedummyplayers(void)
|
||||||
p = act->GetOwner()->PlayerIndex();
|
p = act->GetOwner()->PlayerIndex();
|
||||||
auto spri = act->s;
|
auto spri = act->s;
|
||||||
|
|
||||||
if ((!isRR() && ps[p].on_crane != nullptr) || sector[ps[p].cursectnum].lotag != 1 || ps->GetActor()->s->extra <= 0)
|
if ((!isRR() && ps[p].on_crane != nullptr) || ps[p].cursector()->lotag != 1 || ps->GetActor()->s->extra <= 0)
|
||||||
{
|
{
|
||||||
ps[p].dummyplayersprite = nullptr;
|
ps[p].dummyplayersprite = nullptr;
|
||||||
deletesprite(act);
|
deletesprite(act);
|
||||||
|
@ -371,7 +371,7 @@ void movedummyplayers(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (ps[p].on_ground && ps[p].on_warping_sector == 1 && sector[ps[p].cursectnum].lotag == 1)
|
if (ps[p].on_ground && ps[p].on_warping_sector == 1 && ps[p].cursector()->lotag == 1)
|
||||||
{
|
{
|
||||||
spri->cstat = CSTAT_SPRITE_BLOCK_ALL;
|
spri->cstat = CSTAT_SPRITE_BLOCK_ALL;
|
||||||
spri->z = spri->sector()->ceilingz + (27 << 8);
|
spri->z = spri->sector()->ceilingz + (27 << 8);
|
||||||
|
@ -2918,7 +2918,7 @@ void handle_se14(DDukeActor* actor, bool checkstat, int RPG, int JIBS6)
|
||||||
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
for (int p = connecthead; p >= 0; p = connectpoint2[p])
|
||||||
{
|
{
|
||||||
auto psp = ps[p].GetActor();
|
auto psp = ps[p].GetActor();
|
||||||
if (sector[ps[p].cursectnum].lotag != 2)
|
if (ps[p].cursector()->lotag != 2)
|
||||||
{
|
{
|
||||||
if (po[p].os == s->sectnum)
|
if (po[p].os == s->sectnum)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,7 @@ FString GameInterface::GetCoordString()
|
||||||
|
|
||||||
out.Format("pos= %d, %d, %d - angle = %2.3f - sector = %d, lotag = %d, hitag = %d",
|
out.Format("pos= %d, %d, %d - angle = %2.3f - sector = %d, lotag = %d, hitag = %d",
|
||||||
ps[snum].pos.x, ps[snum].pos.y, ps[snum].pos.z, ps[snum].angle.ang.asdeg(), ps[snum].cursectnum,
|
ps[snum].pos.x, ps[snum].pos.y, ps[snum].pos.z, ps[snum].angle.ang.asdeg(), ps[snum].cursectnum,
|
||||||
sector[ps[snum].cursectnum].lotag, sector[ps[snum].cursectnum].hitag);
|
ps[snum].cursector()->lotag, ps[snum].cursector()->hitag);
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ void drawoverlays(double smoothratio)
|
||||||
{
|
{
|
||||||
fi.displayweapon(screenpeek, smoothratio);
|
fi.displayweapon(screenpeek, smoothratio);
|
||||||
if (pp->over_shoulder_on == 0)
|
if (pp->over_shoulder_on == 0)
|
||||||
fi.displaymasks(screenpeek, pp->GetActor()->s->pal == 1 ? 1 : sector[pp->cursectnum].floorpal, smoothratio);
|
fi.displaymasks(screenpeek, pp->GetActor()->s->pal == 1 ? 1 : pp->cursector()->floorpal, smoothratio);
|
||||||
}
|
}
|
||||||
if (!isRR())
|
if (!isRR())
|
||||||
moveclouds(smoothratio);
|
moveclouds(smoothratio);
|
||||||
|
|
|
@ -263,7 +263,7 @@ void displayweapon_d(int snum, double smoothratio)
|
||||||
shade = p->GetActor()->s->shade;
|
shade = p->GetActor()->s->shade;
|
||||||
if(shade > 24) shade = 24;
|
if(shade > 24) shade = 24;
|
||||||
|
|
||||||
pal = p->GetActor()->s->pal == 1 ? 1 : sector[p->cursectnum].floorpal;
|
pal = p->GetActor()->s->pal == 1 ? 1 : p->cursector()->floorpal;
|
||||||
if (pal == 0)
|
if (pal == 0)
|
||||||
pal = p->palookup;
|
pal = p->palookup;
|
||||||
|
|
||||||
|
@ -1173,7 +1173,7 @@ void displayweapon_d(int snum, double smoothratio)
|
||||||
|
|
||||||
auto displayflamethrower = [&]()
|
auto displayflamethrower = [&]()
|
||||||
{
|
{
|
||||||
if (*kb < 1 || sector[p->cursectnum].lotag == 2)
|
if (*kb < 1 || p->cursector()->lotag == 2)
|
||||||
{
|
{
|
||||||
hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, FLAMETHROWER, shade, o, pal);
|
hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, FLAMETHROWER, shade, o, pal);
|
||||||
hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, FLAMETHROWERPILOT, shade, o, pal);
|
hud_drawpal(weapon_xoffset + 210 - look_anghalf, looking_arc + 261 - gun_pos, FLAMETHROWERPILOT, shade, o, pal);
|
||||||
|
|
|
@ -150,7 +150,7 @@ void displayweapon_r(int snum, double smoothratio)
|
||||||
shade = p->GetActor()->s->shade;
|
shade = p->GetActor()->s->shade;
|
||||||
if(shade > 24) shade = 24;
|
if(shade > 24) shade = 24;
|
||||||
|
|
||||||
pal = p->GetActor()->s->pal == 1 ? 1 : pal = sector[p->cursectnum].floorpal;
|
pal = p->GetActor()->s->pal == 1 ? 1 : pal = p->cursector()->floorpal;
|
||||||
|
|
||||||
if(p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s->pal != 1 && p->GetActor()->s->extra <= 0))
|
if(p->newOwner != nullptr || ud.cameraactor != nullptr || p->over_shoulder_on > 0 || (p->GetActor()->s->pal != 1 && p->GetActor()->s->extra <= 0))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -189,7 +189,7 @@ inline bool playrunning()
|
||||||
|
|
||||||
inline void doslopetilting(player_struct* p, double const scaleAdjust = 1)
|
inline void doslopetilting(player_struct* p, double const scaleAdjust = 1)
|
||||||
{
|
{
|
||||||
bool const canslopetilt = p->on_ground && sector[p->cursectnum].lotag != ST_2_UNDERWATER && (sector[p->cursectnum].floorstat & 2);
|
bool const canslopetilt = p->on_ground && p->cursector()->lotag != ST_2_UNDERWATER && (p->cursector()->floorstat & 2);
|
||||||
p->horizon.calcviewpitch(p->pos.vec2, p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursectnum, scaleAdjust);
|
p->horizon.calcviewpitch(p->pos.vec2, p->angle.ang, p->aim_mode == 0, canslopetilt, p->cursectnum, scaleAdjust);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ inline void doslopetilting(player_struct* p, double const scaleAdjust = 1)
|
||||||
|
|
||||||
inline void hud_draw(double x, double y, int tilenum, int shade, int orientation)
|
inline void hud_draw(double x, double y, int tilenum, int shade, int orientation)
|
||||||
{
|
{
|
||||||
int p = sector[ps[screenpeek].cursectnum].floorpal;
|
int p = ps[screenpeek].cursector()->floorpal;
|
||||||
hud_drawsprite(x, y, 65536, 0, tilenum, shade, p, 2 | orientation);
|
hud_drawsprite(x, y, 65536, 0, tilenum, shade, p, 2 | orientation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -337,7 +337,7 @@ void hud_input(int plnum)
|
||||||
S_PlayActorSound(390, pact);
|
S_PlayActorSound(390, pact);
|
||||||
p->noise_radius = 16384;
|
p->noise_radius = 16384;
|
||||||
madenoise(plnum);
|
madenoise(plnum);
|
||||||
if (sector[p->cursectnum].lotag == 857)
|
if (p->cursector()->lotag == 857)
|
||||||
{
|
{
|
||||||
if (p->GetActor()->s->extra <= gs.max_player_health)
|
if (p->GetActor()->s->extra <= gs.max_player_health)
|
||||||
{
|
{
|
||||||
|
@ -528,7 +528,7 @@ enum
|
||||||
static void processInputBits(player_struct *p, ControlInfo* const hidInput)
|
static void processInputBits(player_struct *p, ControlInfo* const hidInput)
|
||||||
{
|
{
|
||||||
// Set-up crouch bools.
|
// Set-up crouch bools.
|
||||||
int const sectorLotag = p->cursectnum != -1 ? sector[p->cursectnum].lotag : 0;
|
int const sectorLotag = p->cursectnum != -1 ? p->cursector()->lotag : 0;
|
||||||
bool const crouchable = sectorLotag != ST_2_UNDERWATER && (sectorLotag != ST_1_ABOVE_WATER || p->spritebridge);
|
bool const crouchable = sectorLotag != ST_2_UNDERWATER && (sectorLotag != ST_1_ABOVE_WATER || p->spritebridge);
|
||||||
bool const disableToggle = p->jetpack_on || (!crouchable && p->on_ground) || (isRRRA() && (p->OnMotorcycle || p->OnBoat));
|
bool const disableToggle = p->jetpack_on || (!crouchable && p->on_ground) || (isRRRA() && (p->OnMotorcycle || p->OnBoat));
|
||||||
|
|
||||||
|
|
|
@ -84,8 +84,8 @@ int setpal(struct player_struct* p)
|
||||||
if (p->DrugMode) palette = DRUGPAL;
|
if (p->DrugMode) palette = DRUGPAL;
|
||||||
else if (p->heat_on) palette = SLIMEPAL;
|
else if (p->heat_on) palette = SLIMEPAL;
|
||||||
else if (p->cursectnum < 0) palette = BASEPAL; // don't crash if out of range.
|
else if (p->cursectnum < 0) palette = BASEPAL; // don't crash if out of range.
|
||||||
else if (sector[p->cursectnum].ceilingpicnum >= TILE_FLOORSLIME && sector[p->cursectnum].ceilingpicnum <= TILE_FLOORSLIME + 2) palette = SLIMEPAL;
|
else if (p->cursector()->ceilingpicnum >= TILE_FLOORSLIME && p->cursector()->ceilingpicnum <= TILE_FLOORSLIME + 2) palette = SLIMEPAL;
|
||||||
else if (sector[p->cursectnum].lotag == ST_2_UNDERWATER) palette = WATERPAL;
|
else if (p->cursector()->lotag == ST_2_UNDERWATER) palette = WATERPAL;
|
||||||
else palette = BASEPAL;
|
else palette = BASEPAL;
|
||||||
return palette;
|
return palette;
|
||||||
}
|
}
|
||||||
|
@ -494,7 +494,7 @@ void footprints(int snum)
|
||||||
auto psect = s->sectnum;
|
auto psect = s->sectnum;
|
||||||
|
|
||||||
if (p->footprintcount > 0 && p->on_ground)
|
if (p->footprintcount > 0 && p->on_ground)
|
||||||
if ((sector[p->cursectnum].floorstat & 2) != 2)
|
if ((p->cursector()->floorstat & 2) != 2)
|
||||||
{
|
{
|
||||||
int j = -1;
|
int j = -1;
|
||||||
DukeSectIterator it(psect);
|
DukeSectIterator it(psect);
|
||||||
|
@ -511,7 +511,7 @@ void footprints(int snum)
|
||||||
if (j < 0)
|
if (j < 0)
|
||||||
{
|
{
|
||||||
p->footprintcount--;
|
p->footprintcount--;
|
||||||
if (sector[p->cursectnum].lotag == 0 && sector[p->cursectnum].hitag == 0)
|
if (p->cursector()->lotag == 0 && p->cursector()->hitag == 0)
|
||||||
{
|
{
|
||||||
DDukeActor* fprint;
|
DDukeActor* fprint;
|
||||||
switch (krand() & 3)
|
switch (krand() & 3)
|
||||||
|
|
|
@ -1561,7 +1561,7 @@ int doincrements_d(struct player_struct* p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->scuba_on == 0 && sector[p->cursectnum].lotag == 2)
|
if (p->scuba_on == 0 && p->cursector()->lotag == 2)
|
||||||
{
|
{
|
||||||
if (p->scuba_amount > 0)
|
if (p->scuba_amount > 0)
|
||||||
{
|
{
|
||||||
|
@ -1765,7 +1765,7 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
|
||||||
p->dummyplayersprite = spawn(pact, PLAYERONWATER);
|
p->dummyplayersprite = spawn(pact, PLAYERONWATER);
|
||||||
|
|
||||||
p->footprintcount = 6;
|
p->footprintcount = 6;
|
||||||
if (sector[p->cursectnum].floorpicnum == FLOORSLIME)
|
if (p->cursector()->floorpicnum == FLOORSLIME)
|
||||||
p->footprintpal = 8;
|
p->footprintpal = 8;
|
||||||
else p->footprintpal = 0;
|
else p->footprintpal = 0;
|
||||||
p->footprintshade = 0;
|
p->footprintshade = 0;
|
||||||
|
@ -1798,7 +1798,7 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
|
||||||
if ((p->pos.z + p->poszv) >= (fz - (i << 8))) // hit the ground
|
if ((p->pos.z + p->poszv) >= (fz - (i << 8))) // hit the ground
|
||||||
{
|
{
|
||||||
S_StopSound(DUKE_SCREAM, pact);
|
S_StopSound(DUKE_SCREAM, pact);
|
||||||
if (sector[p->cursectnum].lotag != 1)
|
if (p->cursector()->lotag != 1)
|
||||||
{
|
{
|
||||||
if (p->falling_counter > 62) quickkill(p);
|
if (p->falling_counter > 62) quickkill(p);
|
||||||
|
|
||||||
|
@ -2146,7 +2146,7 @@ static void fireweapon(int snum)
|
||||||
if (isWorldTour() && p->ammo_amount[FLAMETHROWER_WEAPON] > 0)
|
if (isWorldTour() && p->ammo_amount[FLAMETHROWER_WEAPON] > 0)
|
||||||
{
|
{
|
||||||
p->kickback_pic = 1;
|
p->kickback_pic = 1;
|
||||||
if (sector[p->cursectnum].lotag != 2)
|
if (p->cursector()->lotag != 2)
|
||||||
S_PlayActorSound(FLAMETHROWER_INTRO, pact);
|
S_PlayActorSound(FLAMETHROWER_INTRO, pact);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -2545,7 +2545,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect)
|
||||||
p->kickback_pic++;
|
p->kickback_pic++;
|
||||||
if (p->kickback_pic == 2)
|
if (p->kickback_pic == 2)
|
||||||
{
|
{
|
||||||
if (sector[p->cursectnum].lotag != 2)
|
if (p->cursector()->lotag != 2)
|
||||||
{
|
{
|
||||||
p->ammo_amount[FLAMETHROWER_WEAPON]--;
|
p->ammo_amount[FLAMETHROWER_WEAPON]--;
|
||||||
if (snum == screenpeek)
|
if (snum == screenpeek)
|
||||||
|
@ -2845,7 +2845,7 @@ void processinput_d(int snum)
|
||||||
s->xvel = clamp(ksqrt((p->pos.x - p->bobposx) * (p->pos.x - p->bobposx) + (p->pos.y - p->bobposy) * (p->pos.y - p->bobposy)), 0, 512);
|
s->xvel = clamp(ksqrt((p->pos.x - p->bobposx) * (p->pos.x - p->bobposx) + (p->pos.y - p->bobposy) * (p->pos.y - p->bobposy)), 0, 512);
|
||||||
if (p->on_ground) p->bobcounter += p->GetActor()->s->xvel >> 1;
|
if (p->on_ground) p->bobcounter += p->GetActor()->s->xvel >> 1;
|
||||||
|
|
||||||
p->backuppos(ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS));
|
p->backuppos(ud.clipping == 0 && (p->cursector()->floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS));
|
||||||
|
|
||||||
// Shrinking code
|
// Shrinking code
|
||||||
|
|
||||||
|
@ -3007,7 +3007,7 @@ HORIZONLY:
|
||||||
if (psectlotag == 1 || p->spritebridge == 1) ii = (4L << 8);
|
if (psectlotag == 1 || p->spritebridge == 1) ii = (4L << 8);
|
||||||
else ii = (20L << 8);
|
else ii = (20L << 8);
|
||||||
|
|
||||||
if (sector[p->cursectnum].lotag == 2) k = 0;
|
if (p->cursector()->lotag == 2) k = 0;
|
||||||
else k = 1;
|
else k = 1;
|
||||||
|
|
||||||
Collision clip{};
|
Collision clip{};
|
||||||
|
@ -3061,7 +3061,7 @@ HORIZONLY:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (truefdist < gs.playerheight && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1)
|
if (truefdist < gs.playerheight && p->on_ground && psectlotag != 1 && shrunk == 0 && p->cursector()->lotag == 1)
|
||||||
if (!S_CheckActorSoundPlaying(pact, DUKE_ONWATER))
|
if (!S_CheckActorSoundPlaying(pact, DUKE_ONWATER))
|
||||||
S_PlayActorSound(DUKE_ONWATER, pact);
|
S_PlayActorSound(DUKE_ONWATER, pact);
|
||||||
|
|
||||||
|
|
|
@ -1423,7 +1423,7 @@ int doincrements_r(struct player_struct* p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->scuba_on == 0 && sector[p->cursectnum].lotag == 2)
|
if (p->scuba_on == 0 && p->cursector()->lotag == 2)
|
||||||
{
|
{
|
||||||
if (p->scuba_amount > 0)
|
if (p->scuba_amount > 0)
|
||||||
{
|
{
|
||||||
|
@ -2079,12 +2079,12 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
|
||||||
p->dummyplayersprite = spawn(pact, PLAYERONWATER);
|
p->dummyplayersprite = spawn(pact, PLAYERONWATER);
|
||||||
|
|
||||||
p->footprintcount = 6;
|
p->footprintcount = 6;
|
||||||
if (sector[p->cursectnum].floorpicnum == FLOORSLIME)
|
if (p->cursector()->floorpicnum == FLOORSLIME)
|
||||||
{
|
{
|
||||||
p->footprintpal = 8;
|
p->footprintpal = 8;
|
||||||
p->footprintshade = 0;
|
p->footprintshade = 0;
|
||||||
}
|
}
|
||||||
else if (isRRRA() && (sector[p->cursectnum].floorpicnum == RRTILE7756 || sector[p->cursectnum].floorpicnum == RRTILE7888))
|
else if (isRRRA() && (p->cursector()->floorpicnum == RRTILE7756 || p->cursector()->floorpicnum == RRTILE7888))
|
||||||
{
|
{
|
||||||
p->footprintpal = 0;
|
p->footprintpal = 0;
|
||||||
p->footprintshade = 40;
|
p->footprintshade = 40;
|
||||||
|
@ -2143,10 +2143,10 @@ static void movement(int snum, ESyncBits actions, int psect, int fz, int cz, int
|
||||||
if ((p->pos.z + p->poszv) >= (fz - (i << 8))) // hit the ground
|
if ((p->pos.z + p->poszv) >= (fz - (i << 8))) // hit the ground
|
||||||
{
|
{
|
||||||
S_StopSound(DUKE_SCREAM, pact);
|
S_StopSound(DUKE_SCREAM, pact);
|
||||||
if (sector[p->cursectnum].lotag != 1)
|
if (p->cursector()->lotag != 1)
|
||||||
{
|
{
|
||||||
if (isRRRA()) p->MotoOnGround = 1;
|
if (isRRRA()) p->MotoOnGround = 1;
|
||||||
if (p->falling_counter > 62 || (isRRRA() && p->falling_counter > 2 && sector[p->cursectnum].lotag == 802))
|
if (p->falling_counter > 62 || (isRRRA() && p->falling_counter > 2 && p->cursector()->lotag == 802))
|
||||||
quickkill(p);
|
quickkill(p);
|
||||||
|
|
||||||
else if (p->falling_counter > 9)
|
else if (p->falling_counter > 9)
|
||||||
|
@ -3564,7 +3564,7 @@ void processinput_r(int snum)
|
||||||
s->xvel = clamp(ksqrt((p->pos.x - p->bobposx) * (p->pos.x - p->bobposx) + (p->pos.y - p->bobposy) * (p->pos.y - p->bobposy)), 0, 512);
|
s->xvel = clamp(ksqrt((p->pos.x - p->bobposx) * (p->pos.x - p->bobposx) + (p->pos.y - p->bobposy) * (p->pos.y - p->bobposy)), 0, 512);
|
||||||
if (p->on_ground) p->bobcounter += p->GetActor()->s->xvel >> 1;
|
if (p->on_ground) p->bobcounter += p->GetActor()->s->xvel >> 1;
|
||||||
|
|
||||||
p->backuppos(ud.clipping == 0 && (sector[p->cursectnum].floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS));
|
p->backuppos(ud.clipping == 0 && (p->cursector()->floorpicnum == MIRROR || p->cursectnum < 0 || p->cursectnum >= MAXSECTORS));
|
||||||
|
|
||||||
// Shrinking code
|
// Shrinking code
|
||||||
|
|
||||||
|
@ -3675,7 +3675,7 @@ void processinput_r(int snum)
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
if ((krand() & 1) == 0)
|
if ((krand() & 1) == 0)
|
||||||
if (!isRRRA() || (!p->OnBoat && !p->OnMotorcycle && sector[p->cursectnum].hitag != 321))
|
if (!isRRRA() || (!p->OnBoat && !p->OnMotorcycle && p->cursector()->hitag != 321))
|
||||||
S_PlayActorSound(DUKE_ONWATER, pact);
|
S_PlayActorSound(DUKE_ONWATER, pact);
|
||||||
p->walking_snd_toggle = 1;
|
p->walking_snd_toggle = 1;
|
||||||
break;
|
break;
|
||||||
|
@ -3770,7 +3770,7 @@ HORIZONLY:
|
||||||
if (psectlotag == 1 || p->spritebridge == 1) i = (4L << 8);
|
if (psectlotag == 1 || p->spritebridge == 1) i = (4L << 8);
|
||||||
else i = (20L << 8);
|
else i = (20L << 8);
|
||||||
|
|
||||||
if (sector[p->cursectnum].lotag == 2) k = 0;
|
if (p->cursector()->lotag == 2) k = 0;
|
||||||
else k = 1;
|
else k = 1;
|
||||||
|
|
||||||
Collision clip{};
|
Collision clip{};
|
||||||
|
@ -3905,9 +3905,9 @@ HORIZONLY:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (truefdist < gs.playerheight && p->on_ground && psectlotag != 1 && shrunk == 0 && sector[p->cursectnum].lotag == 1)
|
if (truefdist < gs.playerheight && p->on_ground && psectlotag != 1 && shrunk == 0 && p->cursector()->lotag == 1)
|
||||||
if (!S_CheckActorSoundPlaying(pact, DUKE_ONWATER))
|
if (!S_CheckActorSoundPlaying(pact, DUKE_ONWATER))
|
||||||
if (!isRRRA() || (!p->OnBoat && !p->OnMotorcycle && sector[p->cursectnum].hitag != 321))
|
if (!isRRRA() || (!p->OnBoat && !p->OnMotorcycle && p->cursector()->hitag != 321))
|
||||||
S_PlayActorSound(DUKE_ONWATER, pact);
|
S_PlayActorSound(DUKE_ONWATER, pact);
|
||||||
|
|
||||||
if (p->cursectnum != s->sectnum)
|
if (p->cursectnum != s->sectnum)
|
||||||
|
@ -3940,7 +3940,7 @@ HORIZONLY:
|
||||||
fi.activatebysector(psect, pact);
|
fi.activatebysector(psect, pact);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ud.clipping == 0 && sector[p->cursectnum].ceilingz > (sector[p->cursectnum].floorz - (12 << 8)))
|
if (ud.clipping == 0 && p->cursector()->ceilingz > (p->cursector()->floorz - (12 << 8)))
|
||||||
{
|
{
|
||||||
quickkill(p);
|
quickkill(p);
|
||||||
return;
|
return;
|
||||||
|
@ -4044,7 +4044,7 @@ void processmove_r(int snum, ESyncBits actions, int psect, int fz, int cz, int s
|
||||||
|
|
||||||
void OnMotorcycle(struct player_struct *p, DDukeActor* motosprite)
|
void OnMotorcycle(struct player_struct *p, DDukeActor* motosprite)
|
||||||
{
|
{
|
||||||
if (!p->OnMotorcycle && !(sector[p->cursectnum].lotag == 2))
|
if (!p->OnMotorcycle && !(p->cursector()->lotag == 2))
|
||||||
{
|
{
|
||||||
if (motosprite)
|
if (motosprite)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1500,30 +1500,30 @@ void checksectors_d(int snum)
|
||||||
p = &ps[snum];
|
p = &ps[snum];
|
||||||
auto pact = p->GetActor();
|
auto pact = p->GetActor();
|
||||||
|
|
||||||
switch (sector[p->cursectnum].lotag)
|
switch (p->cursector()->lotag)
|
||||||
{
|
{
|
||||||
|
|
||||||
case 32767:
|
case 32767:
|
||||||
sector[p->cursectnum].lotag = 0;
|
p->cursector()->lotag = 0;
|
||||||
FTA(9, p);
|
FTA(9, p);
|
||||||
p->secret_rooms++;
|
p->secret_rooms++;
|
||||||
SECRET_Trigger(p->cursectnum);
|
SECRET_Trigger(p->cursectnum);
|
||||||
return;
|
return;
|
||||||
case -1:
|
case -1:
|
||||||
sector[p->cursectnum].lotag = 0;
|
p->cursector()->lotag = 0;
|
||||||
setnextmap(false);
|
setnextmap(false);
|
||||||
return;
|
return;
|
||||||
case -2:
|
case -2:
|
||||||
sector[p->cursectnum].lotag = 0;
|
p->cursector()->lotag = 0;
|
||||||
p->timebeforeexit = 26 * 8;
|
p->timebeforeexit = 26 * 8;
|
||||||
p->customexitsound = sector[p->cursectnum].hitag;
|
p->customexitsound = p->cursector()->hitag;
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
if (sector[p->cursectnum].lotag >= 10000 && sector[p->cursectnum].lotag < 16383)
|
if (p->cursector()->lotag >= 10000 && p->cursector()->lotag < 16383)
|
||||||
{
|
{
|
||||||
if (snum == screenpeek || ud.coop == 1)
|
if (snum == screenpeek || ud.coop == 1)
|
||||||
S_PlayActorSound(sector[p->cursectnum].lotag - 10000, pact);
|
S_PlayActorSound(p->cursector()->lotag - 10000, pact);
|
||||||
sector[p->cursectnum].lotag = 0;
|
p->cursector()->lotag = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -1626,7 +1626,7 @@ void checksectors_d(int snum)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (neartagsprite == nullptr && neartagwall == -1)
|
if (neartagsprite == nullptr && neartagwall == -1)
|
||||||
if (sector[p->cursectnum].lotag == 2)
|
if (p->cursector()->lotag == 2)
|
||||||
{
|
{
|
||||||
DDukeActor* hit;
|
DDukeActor* hit;
|
||||||
oldz = hitasprite(p->GetActor(), &hit);
|
oldz = hitasprite(p->GetActor(), &hit);
|
||||||
|
|
|
@ -2445,17 +2445,17 @@ void checksectors_r(int snum)
|
||||||
p = &ps[snum];
|
p = &ps[snum];
|
||||||
auto pact = p->GetActor();
|
auto pact = p->GetActor();
|
||||||
|
|
||||||
switch (sector[p->cursectnum].lotag)
|
switch (p->cursector()->lotag)
|
||||||
{
|
{
|
||||||
|
|
||||||
case 32767:
|
case 32767:
|
||||||
sector[p->cursectnum].lotag = 0;
|
p->cursector()->lotag = 0;
|
||||||
FTA(9, p);
|
FTA(9, p);
|
||||||
p->secret_rooms++;
|
p->secret_rooms++;
|
||||||
SECRET_Trigger(p->cursectnum);
|
SECRET_Trigger(p->cursectnum);
|
||||||
return;
|
return;
|
||||||
case -1:
|
case -1:
|
||||||
sector[p->cursectnum].lotag = 0;
|
p->cursector()->lotag = 0;
|
||||||
if (!isRRRA() || !RRRA_ExitedLevel)
|
if (!isRRRA() || !RRRA_ExitedLevel)
|
||||||
{
|
{
|
||||||
setnextmap(false);
|
setnextmap(false);
|
||||||
|
@ -2463,16 +2463,16 @@ void checksectors_r(int snum)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
case -2:
|
case -2:
|
||||||
sector[p->cursectnum].lotag = 0;
|
p->cursector()->lotag = 0;
|
||||||
p->timebeforeexit = 26 * 8;
|
p->timebeforeexit = 26 * 8;
|
||||||
p->customexitsound = sector[p->cursectnum].hitag;
|
p->customexitsound = p->cursector()->hitag;
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
if (sector[p->cursectnum].lotag >= 10000)
|
if (p->cursector()->lotag >= 10000)
|
||||||
{
|
{
|
||||||
if (snum == screenpeek || ud.coop == 1)
|
if (snum == screenpeek || ud.coop == 1)
|
||||||
S_PlayActorSound(sector[p->cursectnum].lotag - 10000, pact);
|
S_PlayActorSound(p->cursector()->lotag - 10000, pact);
|
||||||
sector[p->cursectnum].lotag = 0;
|
p->cursector()->lotag = 0;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -2598,7 +2598,7 @@ void checksectors_r(int snum)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (neartagsprite == nullptr && neartagwall == -1)
|
if (neartagsprite == nullptr && neartagwall == -1)
|
||||||
if (sector[p->cursectnum].lotag == 2)
|
if (p->cursector()->lotag == 2)
|
||||||
{
|
{
|
||||||
DDukeActor* hit;
|
DDukeActor* hit;
|
||||||
oldz = hitasprite(p->GetActor(), &hit);
|
oldz = hitasprite(p->GetActor(), &hit);
|
||||||
|
|
|
@ -491,7 +491,7 @@ int S_PlaySound3D(int sndnum, DDukeActor* actor, const vec3_t* pos, int channel,
|
||||||
|
|
||||||
bool explosion = ((userflags & (SF_GLOBAL | SF_DTAG)) == (SF_GLOBAL | SF_DTAG)) || ((sndnum == PIPEBOMB_EXPLODE || sndnum == LASERTRIP_EXPLODE || sndnum == RPG_EXPLODE));
|
bool explosion = ((userflags & (SF_GLOBAL | SF_DTAG)) == (SF_GLOBAL | SF_DTAG)) || ((sndnum == PIPEBOMB_EXPLODE || sndnum == LASERTRIP_EXPLODE || sndnum == RPG_EXPLODE));
|
||||||
|
|
||||||
bool underwater = ps[screenpeek].cursectnum > -1 && sector[ps[screenpeek].cursectnum].lotag == ST_2_UNDERWATER;
|
bool underwater = ps[screenpeek].cursectnum > -1 && ps[screenpeek].cursector()->lotag == ST_2_UNDERWATER;
|
||||||
if (explosion)
|
if (explosion)
|
||||||
{
|
{
|
||||||
if (underwater)
|
if (underwater)
|
||||||
|
|
|
@ -292,6 +292,11 @@ struct player_struct
|
||||||
return (psectlotag == ST_2_UNDERWATER)? avel * 0.875f : avel;
|
return (psectlotag == ST_2_UNDERWATER)? avel * 0.875f : avel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sectortype* cursector() const
|
||||||
|
{
|
||||||
|
return &::sector[cursectnum];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue