- pass a sector pointer to floorspace/ceilingspace.

This commit is contained in:
Christoph Oelckers 2021-11-06 22:57:26 +01:00
parent 060da8ec1d
commit d45f687d4b
6 changed files with 30 additions and 29 deletions

View file

@ -469,7 +469,7 @@ void moveplayers(void)
act->SetHitOwner(act); act->SetHitOwner(act);
if (ud.god == 0) if (ud.god == 0)
if (fi.ceilingspace(spri->sectnum) || fi.floorspace(spri->sectnum)) if (fi.ceilingspace(spri->sector()) || fi.floorspace(spri->sector()))
quickkill(p); quickkill(p);
} }
else else
@ -5015,11 +5015,11 @@ void makeitfall(DDukeActor* actor)
auto s = actor->s; auto s = actor->s;
int c; int c;
if( fi.floorspace(s->sectnum) ) if( fi.floorspace(s->sector()) )
c = 0; c = 0;
else else
{ {
if( fi.ceilingspace(s->sectnum) || s->sector()->lotag == ST_2_UNDERWATER) if( fi.ceilingspace(s->sector()) || s->sector()->lotag == ST_2_UNDERWATER)
c = gs.gravity/6; c = gs.gravity/6;
else c = gs.gravity; else c = gs.gravity;
} }
@ -5266,11 +5266,11 @@ void fall_common(DDukeActor *actor, int playernum, int JIBS6, int DRONE, int BLO
int c; int c;
int sphit = fallspecial? fallspecial(actor, playernum) : 0; int sphit = fallspecial? fallspecial(actor, playernum) : 0;
if (fi.floorspace(s->sectnum)) if (fi.floorspace(s->sector()))
c = 0; c = 0;
else else
{ {
if (fi.ceilingspace(s->sectnum) || s->sector()->lotag == 2) if (fi.ceilingspace(s->sector()) || s->sector()->lotag == 2)
c = gs.gravity / 6; c = gs.gravity / 6;
else c = gs.gravity; else c = gs.gravity;
} }

View file

@ -104,11 +104,11 @@ void SerializeActorGlobals(FSerializer& arc)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool ceilingspace_d(int sectnum) bool ceilingspace_d(sectortype* sectp)
{ {
if( (sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 ) if( (sectp->ceilingstat&1) && sectp->ceilingpal == 0 )
{ {
switch(sector[sectnum].ceilingpicnum) switch(sectp->ceilingpicnum)
{ {
case MOONSKY1: case MOONSKY1:
case BIGORBIT1: case BIGORBIT1:
@ -124,11 +124,11 @@ bool ceilingspace_d(int sectnum)
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool floorspace_d(int sectnum) bool floorspace_d(sectortype* sectp)
{ {
if( (sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 ) if( (sectp->floorstat&1) && sectp->ceilingpal == 0 )
{ {
switch(sector[sectnum].floorpicnum) switch(sectp->floorpicnum)
{ {
case MOONSKY1: case MOONSKY1:
case BIGORBIT1: case BIGORBIT1:
@ -1002,10 +1002,10 @@ void movefallers_d(void)
ssp(act, CLIPMASK0); ssp(act, CLIPMASK0);
} }
if (fi.floorspace(s->sectnum)) x = 0; if (fi.floorspace(s->sector())) x = 0;
else else
{ {
if (fi.ceilingspace(s->sectnum)) if (fi.ceilingspace(s->sector()))
x = gs.gravity / 6; x = gs.gravity / 6;
else else
x = gs.gravity; x = gs.gravity;

View file

@ -51,11 +51,11 @@ void resetlanepics(void);
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool ceilingspace_r(int sectnum) bool ceilingspace_r(sectortype* sectp)
{ {
if( (sector[sectnum].ceilingstat&1) && sector[sectnum].ceilingpal == 0 ) if( (sectp->ceilingstat&1) && sectp->ceilingpal == 0 )
{ {
switch(sector[sectnum].ceilingpicnum) switch(sectp->ceilingpicnum)
{ {
case MOONSKY1: case MOONSKY1:
case BIGORBIT1: case BIGORBIT1:
@ -65,17 +65,18 @@ bool ceilingspace_r(int sectnum)
return 0; return 0;
} }
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
// //
// //
// //
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
bool floorspace_r(int sectnum) bool floorspace_r(sectortype* sectp)
{ {
if( (sector[sectnum].floorstat&1) && sector[sectnum].ceilingpal == 0 ) if( (sectp->floorstat&1) && sectp->ceilingpal == 0 )
{ {
switch(sector[sectnum].floorpicnum) switch(sectp->floorpicnum)
{ {
case MOONSKY1: case MOONSKY1:
case BIGORBIT1: case BIGORBIT1:
@ -856,10 +857,10 @@ void movefallers_r(void)
} }
int x; int x;
if (fi.floorspace(s->sectnum)) x = 0; if (fi.floorspace(s->sector())) x = 0;
else else
{ {
if (fi.ceilingspace(s->sectnum)) if (fi.ceilingspace(s->sector()))
x = gs.gravity / 6; x = gs.gravity / 6;
else else
x = gs.gravity; x = gs.gravity;

View file

@ -56,10 +56,10 @@ void checkhitsprite_r(DDukeActor* i, DDukeActor* sn);
void checksectors_d(int snum); void checksectors_d(int snum);
void checksectors_r(int snum); void checksectors_r(int snum);
bool ceilingspace_d(int sectnum); bool ceilingspace_d(sectortype*);
bool ceilingspace_r(int sectnum); bool ceilingspace_r(sectortype*);
bool floorspace_d(int sectnum); bool floorspace_d(sectortype*);
bool floorspace_r(int sectnum); bool floorspace_r(sectortype*);
void addweapon_d(struct player_struct* p, int weapon); void addweapon_d(struct player_struct* p, int weapon);
void addweapon_r(struct player_struct* p, int weapon); void addweapon_r(struct player_struct* p, int weapon);
void hitradius_d(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4); void hitradius_d(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4);

View file

@ -88,8 +88,8 @@ struct Dispatcher
void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn); void (*checkhitsprite)(DDukeActor* i, DDukeActor* sn);
void (*checksectors)(int low); void (*checksectors)(int low);
bool (*ceilingspace)(int sectnum); bool (*ceilingspace)(sectortype* sectp);
bool (*floorspace)(int sectnum); bool (*floorspace)(sectortype* sectp);
void (*addweapon)(struct player_struct *p, int weapon); void (*addweapon)(struct player_struct *p, int weapon);
void (*hitradius)(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4); void (*hitradius)(DDukeActor* i, int r, int hp1, int hp2, int hp3, int hp4);
void (*lotsofmoney)(DDukeActor *s, short n); void (*lotsofmoney)(DDukeActor *s, short n);

View file

@ -2511,7 +2511,7 @@ int ParseState::parse(void)
} }
break; break;
case concmd_ifinspace: case concmd_ifinspace:
parseifelse(fi.ceilingspace(g_sp->sectnum)); parseifelse(fi.ceilingspace(g_sp->sector()));
break; break;
case concmd_spritepal: case concmd_spritepal:
@ -2811,7 +2811,7 @@ int ParseState::parse(void)
insptr++; insptr++;
break; break;
case concmd_ifinouterspace: case concmd_ifinouterspace:
parseifelse( fi.floorspace(g_sp->sectnum)); parseifelse( fi.floorspace(g_sp->sector()));
break; break;
case concmd_ifnotmoving: case concmd_ifnotmoving:
parseifelse( (g_ac->movflag&kHitTypeMask) > kHitSector ); parseifelse( (g_ac->movflag&kHitTypeMask) > kHitSector );