- all SectUsers replaced, except for the maintenance code of the array.

This commit is contained in:
Christoph Oelckers 2021-11-19 23:20:58 +01:00
parent bd43f49c29
commit 56a1836e68
7 changed files with 38 additions and 39 deletions

View file

@ -2095,7 +2095,7 @@ void LoadGameDescr(short save_num, char *descr); // save.c
void SetRotatorActive(DSWActor* actor); // rotator.c void SetRotatorActive(DSWActor* actor); // rotator.c
bool VatorSwitch(short match, short setting); // vator.c bool VatorSwitch(short match, short setting); // vator.c
void MoveSpritesWithSector(short sectnum,int z_amt,bool type); // vator.c void MoveSpritesWithSector(int sectnum,int z_amt,bool type); // vator.c
void SetVatorActive(DSWActor*); // vator.c void SetVatorActive(DSWActor*); // vator.c
void DoSpikeMatch(short match); // spike.c void DoSpikeMatch(short match); // spike.c

View file

@ -489,7 +489,9 @@ void WaterAdjust(const Collision& florhit, int32_t* loz)
{ {
if (florhit.type == kHitSector) if (florhit.type == kHitSector)
{ {
SECT_USERp sectu = SectUser[florhit.index].Data(); auto sect = &sector[florhit.index];
if (!sect->hasU()) return;
SECT_USERp sectu = sect->u();
if (sectu && FixedToInt(sectu->depth_fixed)) if (sectu && FixedToInt(sectu->depth_fixed))
*loz += Z(FixedToInt(sectu->depth_fixed)); *loz += Z(FixedToInt(sectu->depth_fixed));

View file

@ -180,13 +180,11 @@ void DoRotatorMatch(PLAYERp pp, short match, bool manual)
if (firstVator == nullptr) if (firstVator == nullptr)
firstVator = actor; firstVator = actor;
sectnum = fsp->sectnum; auto sect = fsp->sector();
if (pp && SectUser[sectnum].Data() && SectUser[sectnum]->stag == SECT_LOCK_DOOR && SectUser[sectnum]->number) if (pp && sect->hasU() && sect->u()->stag == SECT_LOCK_DOOR && sect->u()->number)
{ {
short key_num; int key_num = sect->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));

View file

@ -172,13 +172,11 @@ void DoSlidorMatch(PLAYERp pp, short match, bool manual)
continue; continue;
} }
sectnum = fsp->sectnum; auto sect = fsp->sector();
if (pp && SectUser[sectnum].Data() && SectUser[sectnum]->stag == SECT_LOCK_DOOR && SectUser[sectnum]->number) if (pp && sect->hasU() && sect->u()->stag == SECT_LOCK_DOOR && sect->u()->number)
{ {
short key_num; int key_num = sect->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));

View file

@ -806,25 +806,26 @@ void SectorObjectSetupBounds(SECTOR_OBJECTp sop)
if (SectorInBounds) if (SectorInBounds)
{ {
auto sect = &sector[k];
sop->sector[sop->num_sectors] = k; sop->sector[sop->num_sectors] = k;
sop->sectp[sop->num_sectors] = &sector[k]; sop->sectp[sop->num_sectors] = sect;
// all sectors in sector object have this flag set - for colision // all sectors in sector object have this flag set - for colision
// detection and recognition // detection and recognition
SET(sector[k].extra, SECTFX_SECTOR_OBJECT); SET(sect->extra, SECTFX_SECTOR_OBJECT);
sop->zorig_floor[sop->num_sectors] = sector[k].floorz; sop->zorig_floor[sop->num_sectors] = sect->floorz;
sop->zorig_ceiling[sop->num_sectors] = sector[k].ceilingz; sop->zorig_ceiling[sop->num_sectors] = sect->ceilingz;
if (TEST(sector[k].extra, SECTFX_SINK)) if (TEST(sect->extra, SECTFX_SINK))
sop->zorig_floor[sop->num_sectors] += Z(FixedToInt(SectUser[k]->depth_fixed)); sop->zorig_floor[sop->num_sectors] += Z(FixedToInt(sect->u()->depth_fixed));
// lowest and highest floorz's // lowest and highest floorz's
if (sector[k].floorz > sop->floor_loz) if (sect->floorz > sop->floor_loz)
sop->floor_loz = sector[k].floorz; sop->floor_loz = sect->floorz;
if (sector[k].floorz < sop->floor_hiz) if (sect->floorz < sop->floor_hiz)
sop->floor_hiz = sector[k].floorz; sop->floor_hiz = sect->floorz;
sop->num_sectors++; sop->num_sectors++;
} }
@ -2531,14 +2532,17 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++) for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
{ {
sectu = SectUser[sectnum(*sectp)].Data(); if ((*sectp)->hasU())
if (sectu && sectu->stag == SECT_SO_FORM_WHIRLPOOL)
{ {
AnimSet(ANIM_Floorz, sectnum(*sectp), nullptr, (*sectp)->floorz + Z(sectu->height), 128); sectu = (*sectp)->u();
(*sectp)->floorshade += sectu->height/6;
RESET((*sectp)->extra, SECTFX_NO_RIDE); if (sectu && sectu->stag == SECT_SO_FORM_WHIRLPOOL)
{
AnimSet(ANIM_Floorz, sectnum(*sectp), nullptr, (*sectp)->floorz + Z(sectu->height), 128);
(*sectp)->floorshade += sectu->height / 6;
RESET((*sectp)->extra, SECTFX_NO_RIDE);
}
} }
} }

View file

@ -295,13 +295,13 @@ void InterpSectorSprites(short sectnum, bool state)
} }
} }
void MoveSpritesWithSector(short sectnum, int z_amt, bool type) void MoveSpritesWithSector(int sectnum, int z_amt, bool type)
{ {
SPRITEp sp; SPRITEp sp;
bool both = false; bool both = false;
auto sect = &sector[sectnum];
if (SectUser[sectnum].Data()) if ( sect->hasU())
both = !!TEST(SectUser[sectnum]->flags, SECTFU_VATOR_BOTH); both = !!TEST(sect->u()->flags, SECTFU_VATOR_BOTH);
SWSectIterator it(sectnum); SWSectIterator it(sectnum);
while (auto actor = it.Next()) while (auto actor = it.Next())
@ -320,7 +320,7 @@ void MoveSpritesWithSector(short sectnum, int z_amt, bool type)
case STAT_STATIC_FIRE: case STAT_STATIC_FIRE:
break; break;
default: default:
goto cont; continue;
} }
} }
else else
@ -331,7 +331,7 @@ void MoveSpritesWithSector(short sectnum, int z_amt, bool type)
case STAT_HOLE_QUEUE: case STAT_HOLE_QUEUE:
// case STAT_WALLBLOOD_QUEUE: // case STAT_WALLBLOOD_QUEUE:
// case STAT_FLOORBLOOD_QUEUE: // case STAT_FLOORBLOOD_QUEUE:
goto cont; continue;
} }
} }
@ -356,9 +356,6 @@ void MoveSpritesWithSector(short sectnum, int z_amt, bool type)
} }
sp->z += z_amt; sp->z += z_amt;
cont:
continue;
} }
} }

View file

@ -4335,7 +4335,7 @@ bool WeaponMoveHit(DSWActor* actor)
return true; return true;
} }
if (SectUser[hit_sect].Data() && FixedToInt(SectUser[hit_sect]->depth_fixed) > 0) if (sector[hit_sect].hasU() && FixedToInt(sector[hit_sect].u()->depth_fixed) > 0)
{ {
SpawnSplash(actor); SpawnSplash(actor);
return true; return true;
@ -7678,7 +7678,7 @@ int DoStar(DSWActor* actor)
if (sp->z > ((u->hiz + u->loz) >> 1)) if (sp->z > ((u->hiz + u->loz) >> 1))
{ {
if (SectUser[hit_sect].Data() && FixedToInt(SectUser[hit_sect]->depth_fixed) > 0) if (sector[hit_sect].hasU() && FixedToInt(sector[hit_sect].u()->depth_fixed) > 0)
{ {
SpawnSplash(actor); SpawnSplash(actor);
KillActor(actor); KillActor(actor);