mirror of
https://github.com/ZDoom/Raze.git
synced 2025-06-01 09:42:27 +00:00
- replaced half of the remaining SectUser accesses.
This commit is contained in:
parent
5cda292d98
commit
bd43f49c29
11 changed files with 38 additions and 39 deletions
|
@ -526,7 +526,7 @@ void KeepActorOnFloor(DSWActor* actor)
|
||||||
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
|
if (TEST(u->Flags, SPR_JUMPING | SPR_FALLING))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (u->lo_sectp && SectUser[sectnum(u->lo_sectp)].Data())
|
if (u->lo_sectp && u->lo_sectp->hasU())
|
||||||
depth = FixedToInt(u->lo_sectp->u()->depth_fixed);
|
depth = FixedToInt(u->lo_sectp->u()->depth_fixed);
|
||||||
else
|
else
|
||||||
depth = 0;
|
depth = 0;
|
||||||
|
|
|
@ -239,10 +239,10 @@ static void ItemCheat(int player)
|
||||||
|
|
||||||
PlayerUpdateInventory(p, p->InventoryNum);
|
PlayerUpdateInventory(p, p->InventoryNum);
|
||||||
|
|
||||||
for (int i = 0; i < numsectors; i++)
|
for (auto& sect : sectors())
|
||||||
{
|
{
|
||||||
if (SectUser[i].Data() && SectUser[i]->stag == SECT_LOCK_DOOR)
|
if (sect.hasU() && sect.u()->stag == SECT_LOCK_DOOR)
|
||||||
SectUser[i]->number = 0; // unlock all doors of this type
|
sect.u()->number = 0; // unlock all doors of this type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -471,18 +471,16 @@ void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SETp action, PERSONALITYp perso
|
||||||
//KeepActorOnFloor(actor); // for swimming actors
|
//KeepActorOnFloor(actor); // for swimming actors
|
||||||
|
|
||||||
// make sure we start in the water if thats where we are
|
// make sure we start in the water if thats where we are
|
||||||
if (u->lo_sectp) // && SectUser[u->lo_sectp - sector])
|
if (u->lo_sectp)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
int sectno = sectnum(u->lo_sectp);
|
|
||||||
|
|
||||||
if (SectUser[sectno].Data() && TEST(u->lo_sectp->extra, SECTFX_SINK))
|
if (u->lo_sectp->hasU() && TEST(u->lo_sectp->extra, SECTFX_SINK))
|
||||||
{
|
{
|
||||||
depth = FixedToInt(SectUser[sectno]->depth_fixed);
|
depth = FixedToInt(u->lo_sectp->u()->depth_fixed);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SWSectIterator it(sectno);
|
SWSectIterator it(u->lo_sectp);
|
||||||
while (auto itActor = it.Next())
|
while (auto itActor = it.Next())
|
||||||
{
|
{
|
||||||
SPRITEp np = &itActor->s();
|
SPRITEp np = &itActor->s();
|
||||||
|
|
|
@ -208,7 +208,7 @@ void CopySectorMatch(short match)
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy sector user if there is one
|
// copy sector user if there is one
|
||||||
if (SectUser[src_sp->sectnum].Data() || SectUser[dest_sp->sectnum].Data())
|
if (src_sp->sector()->hasU() || dest_sp->sector()->hasU())
|
||||||
{
|
{
|
||||||
SECT_USERp ssectu = GetSectUser(src_sp->sectnum);
|
SECT_USERp ssectu = GetSectUser(src_sp->sectnum);
|
||||||
SECT_USERp dsectu = GetSectUser(dest_sp->sectnum);
|
SECT_USERp dsectu = GetSectUser(dest_sp->sectnum);
|
||||||
|
|
|
@ -676,7 +676,7 @@ void analyzesprites(spritetype* tsprite, int& spritesortcnt, int viewx, int view
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if sector pal is something other than default
|
// if sector pal is something other than default
|
||||||
SECT_USERp sectu = SectUser[tsp->sectnum].Data();
|
SECT_USERp sectu = tsp->sector()->u();
|
||||||
uint8_t pal = tsp->sector()->floorpal;
|
uint8_t pal = tsp->sector()->floorpal;
|
||||||
bool nosectpal=false;
|
bool nosectpal=false;
|
||||||
|
|
||||||
|
|
|
@ -2292,7 +2292,7 @@ struct ANIMstruct
|
||||||
case ANIM_Userz:
|
case ANIM_Userz:
|
||||||
return animactor->u()->sz;
|
return animactor->u()->sz;
|
||||||
case ANIM_SUdepth:
|
case ANIM_SUdepth:
|
||||||
return SectUser[animindex]->depth_fixed;
|
return sector[animindex].u()->depth_fixed;
|
||||||
default:
|
default:
|
||||||
return animindex;
|
return animindex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1596,9 +1596,13 @@ void DoPlayerTurnTurret(PLAYERp pp, float avel)
|
||||||
void SlipSlope(PLAYERp pp)
|
void SlipSlope(PLAYERp pp)
|
||||||
{
|
{
|
||||||
short ang;
|
short ang;
|
||||||
SECT_USERp sectu;
|
|
||||||
|
|
||||||
if (pp->cursectnum < 0 || !(sectu = SectUser[pp->cursectnum].Data()) || !TEST(sectu->flags, SECTFU_SLIDE_SECTOR) || !TEST(pp->cursector()->floorstat, FLOOR_STAT_SLOPE))
|
if (pp->cursectnum < 0 || !pp->cursector()->hasU())
|
||||||
|
return;
|
||||||
|
|
||||||
|
SECT_USERp sectu = pp->cursector()->u();
|
||||||
|
|
||||||
|
if (!TEST(sectu->flags, SECTFU_SLIDE_SECTOR) || !TEST(pp->cursector()->floorstat, FLOOR_STAT_SLOPE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
short wallptr = pp->cursector()->wallptr;
|
short wallptr = pp->cursector()->wallptr;
|
||||||
|
@ -3922,8 +3926,10 @@ int GetOverlapSector(int x, int y, short *over, short *under)
|
||||||
{
|
{
|
||||||
int i, found = 0;
|
int i, found = 0;
|
||||||
short sf[2]= {0,0}; // sectors found
|
short sf[2]= {0,0}; // sectors found
|
||||||
|
auto secto = §or[*over];
|
||||||
|
auto sectu = §or[*under];
|
||||||
|
|
||||||
if ((SectUser[*under].Data() && SectUser[*under]->number >= 30000) || (SectUser[*over].Data() && SectUser[*over]->number >= 30000))
|
if ((sectu->hasU() && sectu->u()->number >= 30000) || (secto->hasU() && secto->u()->number >= 30000))
|
||||||
return GetOverlapSector2(x,y,over,under);
|
return GetOverlapSector2(x,y,over,under);
|
||||||
|
|
||||||
// instead of check ALL sectors, just check the two most likely first
|
// instead of check ALL sectors, just check the two most likely first
|
||||||
|
|
|
@ -746,16 +746,18 @@ int OperateSector(short sectnum, short player_is_operating)
|
||||||
if (!player_is_operating)
|
if (!player_is_operating)
|
||||||
{
|
{
|
||||||
SPRITEp fsp;
|
SPRITEp fsp;
|
||||||
|
auto sect = §or[sectnum];
|
||||||
|
|
||||||
if (SectUser[sectnum].Data() && SectUser[sectnum]->stag == SECT_LOCK_DOOR)
|
if (sect->hasU() && sect->u()->stag == SECT_LOCK_DOOR)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
SWSectIterator it(sectnum);
|
SWSectIterator it(sectnum);
|
||||||
while (auto actor = it.Next())
|
while (auto actor = it.Next())
|
||||||
{
|
{
|
||||||
fsp = &actor->s();
|
fsp = &actor->s();
|
||||||
|
auto fsect = fsp->sector();
|
||||||
|
|
||||||
if (SectUser[fsp->sectnum].Data() && SectUser[fsp->sectnum]->stag == SECT_LOCK_DOOR)
|
if (fsect->hasU() && fsect->u()->stag == SECT_LOCK_DOOR)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (fsp->statnum == STAT_VATOR && SP_TAG1(fsp) == SECT_VATOR && TEST_BOOL7(fsp))
|
if (fsp->statnum == STAT_VATOR && SP_TAG1(fsp) == SECT_VATOR && TEST_BOOL7(fsp))
|
||||||
|
@ -768,9 +770,6 @@ int OperateSector(short sectnum, short player_is_operating)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//CON_Message("Operating sectnum %d",sectnum);
|
|
||||||
//CON_Message("stag = %d, lock = %d",SectUser[sectnum]->stag,SECT_LOCK_DOOR);
|
|
||||||
|
|
||||||
switch (sector[sectnum].lotag)
|
switch (sector[sectnum].lotag)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -1647,11 +1646,10 @@ int OperateSprite(DSWActor* actor, short player_is_operating)
|
||||||
key_num = sp->hitag;
|
key_num = sp->hitag;
|
||||||
if (pp->HasKey[key_num - 1])
|
if (pp->HasKey[key_num - 1])
|
||||||
{
|
{
|
||||||
int i;
|
for(auto& sect : sectors())
|
||||||
for (i=0; i<numsectors; i++)
|
|
||||||
{
|
{
|
||||||
if (SectUser[i].Data() && SectUser[i]->stag == SECT_LOCK_DOOR && SectUser[i]->number == key_num)
|
if (sect.hasU() && sect.u()->stag == SECT_LOCK_DOOR && sect.u()->number == key_num)
|
||||||
SectUser[i]->number = 0; // unlock all doors of this type
|
sect.u()->number = 0; // unlock all doors of this type
|
||||||
}
|
}
|
||||||
UnlockKeyLock(key_num, actor);
|
UnlockKeyLock(key_num, actor);
|
||||||
}
|
}
|
||||||
|
@ -2449,7 +2447,7 @@ void PlayerOperateEnv(PLAYERp pp)
|
||||||
// ////////////////////////////
|
// ////////////////////////////
|
||||||
|
|
||||||
SECT_USERp sectu;
|
SECT_USERp sectu;
|
||||||
if (pp->cursectnum >= 0 && (sectu = SectUser[pp->cursectnum].Data()) && sectu->damage)
|
if (pp->cursectnum >= 0 && (sectu = pp->cursector()->u()) && sectu->damage)
|
||||||
{
|
{
|
||||||
SECTORp sectp = pp->cursector();
|
SECTORp sectp = pp->cursector();
|
||||||
if (TEST(sectu->flags, SECTFU_DAMAGE_ABOVE_SECTOR))
|
if (TEST(sectu->flags, SECTFU_DAMAGE_ABOVE_SECTOR))
|
||||||
|
|
|
@ -6731,7 +6731,7 @@ int MissileWaterAdjust(DSWActor* actor)
|
||||||
|
|
||||||
if (u->lo_sectp)
|
if (u->lo_sectp)
|
||||||
{
|
{
|
||||||
SECT_USERp sectu = SectUser[sectnum(u->lo_sectp)].Data();
|
SECT_USERp sectu = u->lo_sectp->u();
|
||||||
if (sectu && FixedToInt(sectu->depth_fixed))
|
if (sectu && FixedToInt(sectu->depth_fixed))
|
||||||
u->loz -= Z(FixedToInt(sectu->depth_fixed));
|
u->loz -= Z(FixedToInt(sectu->depth_fixed));
|
||||||
}
|
}
|
||||||
|
|
|
@ -156,7 +156,7 @@ void DoVatorOperate(PLAYERp pp, short sectnum)
|
||||||
|
|
||||||
if (fsp->statnum == STAT_VATOR && SP_TAG1(fsp) == SECT_VATOR && SP_TAG3(fsp) == 0)
|
if (fsp->statnum == STAT_VATOR && SP_TAG1(fsp) == SECT_VATOR && SP_TAG3(fsp) == 0)
|
||||||
{
|
{
|
||||||
sectnum = fsp->sectnum;
|
auto fsect = fsp->sector();
|
||||||
|
|
||||||
// single play only vator
|
// single play only vator
|
||||||
// bool 8 must be set for message to display
|
// bool 8 must be set for message to display
|
||||||
|
@ -174,11 +174,11 @@ void DoVatorOperate(PLAYERp pp, short sectnum)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pp && SectUser[sectnum].Data() && SectUser[sectnum]->stag == SECT_LOCK_DOOR && SectUser[sectnum]->number)
|
if (pp && fsect->hasU() && fsect->u()->stag == SECT_LOCK_DOOR && fsect->u()->number)
|
||||||
{
|
{
|
||||||
short key_num;
|
short key_num;
|
||||||
|
|
||||||
key_num = SectUser[sectnum]->number;
|
key_num = fsect->u()->number;
|
||||||
|
|
||||||
{
|
{
|
||||||
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
|
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
|
||||||
|
@ -198,7 +198,6 @@ void DoVatorMatch(PLAYERp pp, short match)
|
||||||
{
|
{
|
||||||
USERp fu;
|
USERp fu;
|
||||||
SPRITEp fsp;
|
SPRITEp fsp;
|
||||||
short sectnum;
|
|
||||||
|
|
||||||
SWStatIterator it(STAT_VATOR);
|
SWStatIterator it(STAT_VATOR);
|
||||||
while (auto actor = it.Next())
|
while (auto actor = it.Next())
|
||||||
|
@ -218,12 +217,10 @@ void DoVatorMatch(PLAYERp pp, short match)
|
||||||
}
|
}
|
||||||
|
|
||||||
// lock code
|
// lock code
|
||||||
sectnum = fsp->sectnum;
|
auto fsect = fsp->sector();
|
||||||
if (pp && SectUser[sectnum].Data() && SectUser[sectnum]->stag == SECT_LOCK_DOOR && SectUser[sectnum]->number)
|
if (pp && fsect->hasU() && fsect->u()->stag == SECT_LOCK_DOOR && fsect->u()->number)
|
||||||
{
|
{
|
||||||
short key_num;
|
int key_num = fsect->u()->number;
|
||||||
|
|
||||||
key_num = SectUser[sectnum]->number;
|
|
||||||
|
|
||||||
{
|
{
|
||||||
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
|
PutStringInfo(pp, quoteMgr.GetQuote(QUOTE_DOORMSG + key_num - 1));
|
||||||
|
|
|
@ -17901,7 +17901,7 @@ int InitEnemyFireball(DSWActor* actor)
|
||||||
bool WarpToUnderwater(short *sectnum, int *x, int *y, int *z)
|
bool WarpToUnderwater(short *sectnum, int *x, int *y, int *z)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SECT_USERp sectu = SectUser[*sectnum].Data();
|
SECT_USERp sectu = sector[*sectnum].u();
|
||||||
SPRITEp under_sp = nullptr, over_sp = nullptr;
|
SPRITEp under_sp = nullptr, over_sp = nullptr;
|
||||||
bool Found = false;
|
bool Found = false;
|
||||||
short over, under;
|
short over, under;
|
||||||
|
@ -17974,7 +17974,7 @@ bool WarpToUnderwater(short *sectnum, int *x, int *y, int *z)
|
||||||
bool WarpToSurface(short *sectnum, int *x, int *y, int *z)
|
bool WarpToSurface(short *sectnum, int *x, int *y, int *z)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
SECT_USERp sectu = SectUser[*sectnum].Data();
|
SECT_USERp sectu = sector[*sectnum].u();
|
||||||
short over, under;
|
short over, under;
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
|
|
||||||
|
@ -18251,8 +18251,8 @@ int SpawnSplashXY(int hit_x, int hit_y, int hit_z, int sectnum)
|
||||||
if (Prediction)
|
if (Prediction)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
sectu = SectUser[sectnum].Data();
|
|
||||||
sectp = §or[sectnum];
|
sectp = §or[sectnum];
|
||||||
|
sectu = sectp->hasU() ? sectp->u() : nullptr;
|
||||||
|
|
||||||
if (sectu && (TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_NONE))
|
if (sectu && (TEST(sectp->extra, SECTFX_LIQUID_MASK) == SECTFX_LIQUID_NONE))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue