mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-26 05:51:30 +00:00
- do the same for plr.sector to eliminate another large batch of sector[] references.
This commit is contained in:
parent
dcee283154
commit
5b84755aed
10 changed files with 60 additions and 59 deletions
|
@ -63,7 +63,7 @@ static void chasegonzo(PLAYER& plr, DWHActor* actor)
|
|||
SetActorPos(actor, &spr.pos);
|
||||
moveStat.type = -1; // make invalid.
|
||||
|
||||
if (rand() % 100 > 80 && sector[plr.sector].lotag == 25) {
|
||||
if (rand() % 100 > 80 && plr.Sector()->lotag == 25) {
|
||||
SetNewStatus(actor, AMBUSH);
|
||||
spr.z -= (getPlayerHeight() << 6);
|
||||
spr.lotag = 60;
|
||||
|
@ -75,7 +75,7 @@ static void chasegonzo(PLAYER& plr, DWHActor* actor)
|
|||
|
||||
}
|
||||
|
||||
if (moveStat.type == kHitWall && sector[plr.sector].lotag == 25) {
|
||||
if (moveStat.type == kHitWall && plr.Sector()->lotag == 25) {
|
||||
SetNewStatus(actor, AMBUSH);
|
||||
spr.z -= (getPlayerHeight() << 6);
|
||||
spr.lotag = 90;
|
||||
|
|
|
@ -27,7 +27,7 @@ void drawweapons(int snum, double const dasmoothratio) {
|
|||
dapalnum = 0;
|
||||
}
|
||||
else {
|
||||
dashade = sector[plr.sector].ceilingshade;
|
||||
dashade = plr.Sector()->ceilingshade;
|
||||
dapalnum = 0;
|
||||
}
|
||||
|
||||
|
@ -404,7 +404,7 @@ static void spikeheart(PLAYER& plr)
|
|||
int dax = spikeanimtics[plr.currspikeframe].currx;
|
||||
int day = spikeanimtics[plr.currspikeframe].curry;
|
||||
|
||||
overwritesprite(dax, day, plr.spikeframe, sector[plr.sector].ceilingshade, 0, 0);
|
||||
overwritesprite(dax, day, plr.spikeframe, plr.Sector()->ceilingshade, 0, 0);
|
||||
startredflash(10);
|
||||
}
|
||||
|
||||
|
|
|
@ -258,7 +258,7 @@ void processinput(int num) {
|
|||
else
|
||||
onsprite = -1;
|
||||
|
||||
feetoffground = (plr.sector != -1) ? (sector[plr.sector].floorz - plr.z) : 0;
|
||||
feetoffground = (plr.sector != -1) ? (plr.Sector()->floorz - plr.z) : 0;
|
||||
|
||||
if (abs(plr.plInput.svel) > gi->playerKeyMove() || abs(plr.plInput.fvel) > gi->playerKeyMove()) {
|
||||
if (feetoffground > (32 << 8))
|
||||
|
@ -311,21 +311,21 @@ void processinput(int num) {
|
|||
plr.angle.applyinput(plr.plInput.avel, &bits);
|
||||
}
|
||||
|
||||
if (plr.sector != -1 && ((sector[plr.sector].floorpicnum != LAVA || sector[plr.sector].floorpicnum != SLIME
|
||||
|| sector[plr.sector].floorpicnum != WATER || sector[plr.sector].floorpicnum != HEALTHWATER
|
||||
|| sector[plr.sector].floorpicnum != ANILAVA || sector[plr.sector].floorpicnum != LAVA1
|
||||
|| sector[plr.sector].floorpicnum != LAVA2) && feetoffground <= (32 << 8))) {
|
||||
if (plr.sector != -1 && ((plr.Sector()->floorpicnum != LAVA || plr.Sector()->floorpicnum != SLIME
|
||||
|| plr.Sector()->floorpicnum != WATER || plr.Sector()->floorpicnum != HEALTHWATER
|
||||
|| plr.Sector()->floorpicnum != ANILAVA || plr.Sector()->floorpicnum != LAVA1
|
||||
|| plr.Sector()->floorpicnum != LAVA2) && feetoffground <= (32 << 8))) {
|
||||
plr.plInput.fvel /= 3;
|
||||
plr.plInput.svel /= 3;
|
||||
}
|
||||
|
||||
if ((plr.sector != -1 && (sector[plr.sector].floorpicnum == LAVA || sector[plr.sector].floorpicnum == SLIME
|
||||
|| sector[plr.sector].floorpicnum == WATER || sector[plr.sector].floorpicnum == HEALTHWATER
|
||||
|| sector[plr.sector].floorpicnum == ANILAVA || sector[plr.sector].floorpicnum == LAVA1
|
||||
|| sector[plr.sector].floorpicnum == LAVA2)) && plr.orbactive[5] < 0 // loz
|
||||
&& plr.z >= sector[plr.sector].floorz - (plr.height << 8) - (8 << 8)) {
|
||||
if ((plr.sector != -1 && (plr.Sector()->floorpicnum == LAVA || plr.Sector()->floorpicnum == SLIME
|
||||
|| plr.Sector()->floorpicnum == WATER || plr.Sector()->floorpicnum == HEALTHWATER
|
||||
|| plr.Sector()->floorpicnum == ANILAVA || plr.Sector()->floorpicnum == LAVA1
|
||||
|| plr.Sector()->floorpicnum == LAVA2)) && plr.orbactive[5] < 0 // loz
|
||||
&& plr.z >= plr.Sector()->floorz - (plr.height << 8) - (8 << 8)) {
|
||||
goalz = loz - (32 << 8);
|
||||
switch (sector[plr.sector].floorpicnum) {
|
||||
switch (plr.Sector()->floorpicnum) {
|
||||
case ANILAVA:
|
||||
case LAVA:
|
||||
case LAVA1:
|
||||
|
@ -383,7 +383,7 @@ void processinput(int num) {
|
|||
}
|
||||
|
||||
if ((bits & SB_CROUCH) != 0) {
|
||||
if (plr.sector != -1 && goalz < ((sector[plr.sector].floorz) - (plr.height >> 3))) {
|
||||
if (plr.sector != -1 && goalz < ((plr.Sector()->floorz) - (plr.height >> 3))) {
|
||||
if (isWh2())
|
||||
goalz += (48 << 8);
|
||||
else
|
||||
|
@ -457,7 +457,7 @@ void processinput(int num) {
|
|||
// JSA BLORB
|
||||
|
||||
if (plr.sector != plr.oldsector) {
|
||||
switch (sector[plr.sector].floorpicnum) {
|
||||
switch (plr.Sector()->floorpicnum) {
|
||||
case ANILAVA:
|
||||
case LAVA:
|
||||
case LAVA1:
|
||||
|
|
|
@ -542,7 +542,7 @@ void InitItems()
|
|||
items[a++].Init(-1, -1, true, true, [](PLAYER& plr, DWHActor* actor) // PENTAGRAM
|
||||
|
||||
{
|
||||
if (sector[plr.sector].lotag == 4002)
|
||||
if (plr.Sector()->lotag == 4002)
|
||||
return;
|
||||
else {
|
||||
plr.treasure[TPENTAGRAM] = 1;
|
||||
|
|
|
@ -24,6 +24,7 @@ struct PLAYER {
|
|||
int oldsector;
|
||||
short spritenum;
|
||||
DWHActor* actor() { return &whActors[spritenum]; }
|
||||
sectortype* Sector() { return &::sector[sector]; }
|
||||
boolean keytoggle;
|
||||
int flags;
|
||||
int weapon[MAXWEAPONS], preenchantedweapon[MAXWEAPONS];
|
||||
|
|
|
@ -315,10 +315,10 @@ void animateobjs(PLAYER& plr) {
|
|||
if (spr.lotag < 0) {
|
||||
DeleteActor(actor);
|
||||
// set back to normall
|
||||
sector[plr.sector].ceilingshade = ceilingshadearray[plr.sector];
|
||||
sector[plr.sector].floorshade = floorshadearray[plr.sector];
|
||||
startwall = sector[plr.sector].wallptr;
|
||||
endwall = (short) (startwall + sector[plr.sector].wallnum - 1);
|
||||
plr.Sector()->ceilingshade = ceilingshadearray[plr.sector];
|
||||
plr.Sector()->floorshade = floorshadearray[plr.sector];
|
||||
startwall = plr.Sector()->wallptr;
|
||||
endwall = (short) (startwall + plr.Sector()->wallnum - 1);
|
||||
for (k = startwall; k <= endwall; k++) {
|
||||
wall[k].shade = wallshadearray[k];
|
||||
}
|
||||
|
|
|
@ -428,7 +428,7 @@ void teleporter() {
|
|||
if (plr.sector == -1)
|
||||
return;
|
||||
|
||||
if (sector[plr.sector].lotag == 10) {
|
||||
if (plr.Sector()->lotag == 10) {
|
||||
if (plr.sector != plr.oldsector) {
|
||||
daang = plr.angle.ang.asbuild();
|
||||
warpfxsprite(plr.spritenum);
|
||||
|
@ -447,7 +447,7 @@ void teleporter() {
|
|||
}
|
||||
}
|
||||
|
||||
if (sector[plr.sector].lotag == 4002) {
|
||||
if (plr.Sector()->lotag == 4002) {
|
||||
if (plr.sector != plr.oldsector) {
|
||||
if (plr.treasure[TPENTAGRAM] == 1) {
|
||||
plr.treasure[TPENTAGRAM] = 0;
|
||||
|
@ -458,7 +458,7 @@ void teleporter() {
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
switch (sector[plr.sector].hitag) {
|
||||
switch (plr.Sector()->hitag) {
|
||||
case 1: // NEXTLEVEL
|
||||
justteleported = true;
|
||||
CompleteLevel(currentLevel);
|
||||
|
@ -593,7 +593,7 @@ void sectorsounds() {
|
|||
|
||||
PLAYER& plr = player[pyrn];
|
||||
|
||||
int sec = sector[plr.sector].extra & 0xFFFF;
|
||||
int sec = plr.Sector()->extra & 0xFFFF;
|
||||
if (sec != 0)
|
||||
{
|
||||
if ((sec & 32768) != 0)
|
||||
|
@ -610,7 +610,7 @@ void sectorsounds() {
|
|||
soundEngine->StopSound(CHAN_AMBIENT1 + index);
|
||||
}
|
||||
} else {
|
||||
if (plr.z <= sector[plr.sector].floorz - (8 << 8))
|
||||
if (plr.z <= plr.Sector()->floorz - (8 << 8))
|
||||
spritesound(sec, &sprite[plr.spritenum]);
|
||||
}
|
||||
}
|
||||
|
@ -654,7 +654,7 @@ void dofx() {
|
|||
cracks();
|
||||
if (isWh2()) {
|
||||
PLAYER& plr = player[0];
|
||||
if (sector[plr.sector].lotag == 50 && sector[plr.sector].hitag > 0)
|
||||
if (plr.Sector()->lotag == 50 && plr.Sector()->hitag > 0)
|
||||
weaponpowerup(plr);
|
||||
}
|
||||
|
||||
|
@ -775,13 +775,13 @@ void thesplash() {
|
|||
if (plr.sector == -1)
|
||||
return;
|
||||
|
||||
if (sector[plr.sector].floorpicnum == WATER || sector[plr.sector].floorpicnum == LAVA
|
||||
|| sector[plr.sector].floorpicnum == SLIME) {
|
||||
if (plr.Sector()->floorpicnum == WATER || plr.Sector()->floorpicnum == LAVA
|
||||
|| plr.Sector()->floorpicnum == SLIME) {
|
||||
if (plr.onsomething == 0)
|
||||
return;
|
||||
|
||||
if (plr.sector != plr.oldsector) {
|
||||
switch (sector[plr.sector].floorpicnum) {
|
||||
switch (plr.Sector()->floorpicnum) {
|
||||
case WATER:
|
||||
makeasplash(SPLASHAROO, plr);
|
||||
break;
|
||||
|
@ -805,7 +805,7 @@ void makeasplash(int picnum, PLAYER& plr) {
|
|||
|
||||
spawned.x = plr.x;
|
||||
spawned.y = plr.y;
|
||||
spawned.z = sector[plr.sector].floorz + (tileHeight(picnum) << 8);
|
||||
spawned.z = plr.Sector()->floorz + (tileHeight(picnum) << 8);
|
||||
spawned.cstat = 0; // Hitscan does not hit other bullets
|
||||
spawned.picnum = (short) picnum;
|
||||
spawned.shade = 0;
|
||||
|
@ -920,38 +920,38 @@ void cracks() {
|
|||
if (plr.sector == -1)
|
||||
return;
|
||||
|
||||
int datag = sector[plr.sector].lotag;
|
||||
int datag = plr.Sector()->lotag;
|
||||
|
||||
if (floorpanningcnt < 64)
|
||||
if (datag >= 3500 && datag <= 3599) {
|
||||
sector[plr.sector].hitag = 0;
|
||||
int daz = sector[plr.sector].floorz + (1024 * (sector[plr.sector].lotag - 3500));
|
||||
plr.Sector()->hitag = 0;
|
||||
int daz = plr.Sector()->floorz + (1024 * (plr.Sector()->lotag - 3500));
|
||||
if ((setanimation(plr.sector, daz, 32, 0, FLOORZ)) >= 0) {
|
||||
sector[plr.sector].floorpicnum = LAVA1;
|
||||
sector[plr.sector].floorshade = -25;
|
||||
plr.Sector()->floorpicnum = LAVA1;
|
||||
plr.Sector()->floorshade = -25;
|
||||
SND_Sound(S_CRACKING);
|
||||
}
|
||||
sector[plr.sector].lotag = 80;
|
||||
plr.Sector()->lotag = 80;
|
||||
floorpanninglist[floorpanningcnt++] = plr.sector;
|
||||
}
|
||||
|
||||
if (datag >= 5100 && datag <= 5199) {
|
||||
sector[plr.sector].hitag = 0;
|
||||
sector[plr.sector].lotag = 0;
|
||||
plr.Sector()->hitag = 0;
|
||||
plr.Sector()->lotag = 0;
|
||||
}
|
||||
|
||||
if (datag >= 5200 && datag <= 5299) {
|
||||
sector[plr.sector].hitag = 0;
|
||||
sector[plr.sector].lotag = 0;
|
||||
plr.Sector()->hitag = 0;
|
||||
plr.Sector()->lotag = 0;
|
||||
}
|
||||
|
||||
if (datag == 3001) {
|
||||
sector[plr.sector].lotag = 0;
|
||||
plr.Sector()->lotag = 0;
|
||||
WHSpriteIterator it;
|
||||
while (auto itActor = it.Next())
|
||||
{
|
||||
auto& spk = itActor->s();
|
||||
if (sector[plr.sector].hitag == spk.hitag) {
|
||||
if (plr.Sector()->hitag == spk.hitag) {
|
||||
spk.lotag = 36;
|
||||
spk.zvel = (short) (krand() & 1024 + 512);
|
||||
SetNewStatus(itActor, SHOVE);
|
||||
|
@ -1071,9 +1071,9 @@ void weaponpowerup(PLAYER& plr) {
|
|||
break;
|
||||
}
|
||||
|
||||
if (sector[plr.sector].hitag > 0) {
|
||||
sector[plr.sector].hitag--;
|
||||
if (sector[plr.sector].hitag == 0) {
|
||||
if (plr.Sector()->hitag > 0) {
|
||||
plr.Sector()->hitag--;
|
||||
if (plr.Sector()->hitag == 0) {
|
||||
WHSectIterator it(plr.sector);
|
||||
while (auto actor = it.Next())
|
||||
{
|
||||
|
|
|
@ -782,7 +782,7 @@ boolean prepareboard(const char* fname) {
|
|||
|
||||
pspr.x = plr.x;
|
||||
pspr.y = plr.y;
|
||||
pspr.z = sector[plr.sector].floorz;
|
||||
pspr.z = plr.Sector()->floorz;
|
||||
pspr.cstat = 1 + 256;
|
||||
pspr.picnum = isWh2() ? GRONSW : FRED;
|
||||
pspr.shade = 0;
|
||||
|
|
|
@ -88,7 +88,7 @@ void initplayersprite(PLAYER& plr) {
|
|||
plr.oldsector = plr.sector;
|
||||
plr.horizon.horiz = q16horiz(0);
|
||||
plr.height = getPlayerHeight();
|
||||
plr.z = sector[plr.sector].floorz - (plr.height << 8);
|
||||
plr.z = plr.Sector()->floorz - (plr.height << 8);
|
||||
|
||||
plr.spritenum = (short) insertsprite(plr.sector, (short) 0);
|
||||
auto& spr = sprite[plr.spritenum];
|
||||
|
|
|
@ -291,7 +291,7 @@ void operatesector(PLAYER& plr, int s) {
|
|||
|
||||
case PLATFORMELEVTAG:
|
||||
i = getanimationgoal(sector[s], 1);
|
||||
goalz = sector[plr.sector].floorz;
|
||||
goalz = plr.Sector()->floorz;
|
||||
if (i >= 0) {
|
||||
gAnimationData[i].goal = goalz;
|
||||
} else {
|
||||
|
@ -302,7 +302,7 @@ void operatesector(PLAYER& plr, int s) {
|
|||
i = getanimationgoal(sector[s], 1);
|
||||
j = getanimationgoal(sector[s], 2);
|
||||
size = sector[s].ceilingz - sector[s].floorz;
|
||||
goalz = sector[plr.sector].floorz;
|
||||
goalz = plr.Sector()->floorz;
|
||||
if (i >= 0) {
|
||||
|
||||
gAnimationData[i].goal = goalz;
|
||||
|
@ -901,9 +901,9 @@ void animatetags(int nPlayer) {
|
|||
PLAYER& plr = player[nPlayer];
|
||||
|
||||
if (plr.sector != -1) {
|
||||
if (sector[plr.sector].lotag == 2) {
|
||||
if (plr.Sector()->lotag == 2) {
|
||||
for (i = 0; i < numsectors; i++)
|
||||
if (sector[i].hitag == sector[plr.sector].hitag)
|
||||
if (sector[i].hitag == plr.Sector()->hitag)
|
||||
if (sector[i].lotag != 2)
|
||||
operatesector(plr, i);
|
||||
|
||||
|
@ -913,16 +913,16 @@ void animatetags(int nPlayer) {
|
|||
SPRITE& spr = actor->s();
|
||||
int i = actor->GetSpriteIndex();
|
||||
|
||||
if (spr.hitag == sector[plr.sector].hitag)
|
||||
if (spr.hitag == plr.Sector()->hitag)
|
||||
operatesprite(plr, i);
|
||||
}
|
||||
|
||||
sector[plr.sector].lotag = 0;
|
||||
sector[plr.sector].hitag = 0;
|
||||
plr.Sector()->lotag = 0;
|
||||
plr.Sector()->hitag = 0;
|
||||
}
|
||||
if ((sector[plr.sector].lotag == 1) && (plr.sector != plr.oldsector)) {
|
||||
if ((plr.Sector()->lotag == 1) && (plr.sector != plr.oldsector)) {
|
||||
for (i = 0; i < numsectors; i++)
|
||||
if (sector[i].hitag == sector[plr.sector].hitag)
|
||||
if (sector[i].hitag == plr.Sector()->hitag)
|
||||
if (sector[i].lotag != 2)
|
||||
operatesector(plr, i);
|
||||
|
||||
|
@ -932,7 +932,7 @@ void animatetags(int nPlayer) {
|
|||
SPRITE& spr = actor->s();
|
||||
int i = actor->GetSpriteIndex();
|
||||
|
||||
if (spr.hitag == sector[plr.sector].hitag)
|
||||
if (spr.hitag == plr.Sector()->hitag)
|
||||
operatesprite(plr, i);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue