- SW: deleted SECT_USER.

This commit is contained in:
Christoph Oelckers 2021-11-20 23:35:14 +01:00
parent 7d2404ce76
commit fded90c491
7 changed files with 26 additions and 76 deletions

View file

@ -153,7 +153,6 @@ int16_t pointhighlight=-1, linehighlight=-1, highlightcnt=0;
static int16_t numhits;
bool inpreparemirror = 0;
//

View file

@ -41,6 +41,7 @@ typedef struct {
static_assert(sizeof(vec3d_t) == sizeof(double) * 3);
int32_t xyaspect = -1;
bool inpreparemirror = 0;

View file

@ -419,7 +419,6 @@ void TerminateLevel(void)
if (!currentLevel) return;
int i, stat, pnum, ndx;
SECT_USERp* sectu;
// Free any track points
for (ndx = 0; ndx < MAX_TRACKS; ndx++)
@ -456,7 +455,6 @@ void TerminateLevel(void)
}
// Free SectUser memory
for (auto& su : SectUser) su.Clear();
TRAVERSE_CONNECT(pnum)
{

View file

@ -1481,23 +1481,6 @@ enum ShrapType
SHRAP_USER_DEFINED = 99
};
typedef struct SECT_USER
{
int _flags;
int depth_fixed;
short stag, // ST? tag number - for certain things it helps to know it
ang,
height,
speed,
damage,
number; // usually used for matching number
uint8_t flags2;
} *SECT_USERp;
extern TPointer<SECT_USER> SectUser[MAXSECTORS];
SECT_USERp SpawnSectUser(short sectnum);
# define CallocMem(size, num) M_Calloc(size, num)
# define FreeMem(ptr) M_Free(ptr)
@ -1823,8 +1806,6 @@ USERp SpawnUser(DSWActor* actor, short id, STATEp state);
short ActorFindTrack(DSWActor* actor, int8_t player_dir, int track_type, short *track_point_num, short *track_dir);
SECT_USERp GetSectUser(short sectnum);
// Some sounds were checked by storing handles in static local variables.
// Problems with this design:
// 1. The variables were unmaintained and could refer to handles that had been reused already.

View file

@ -81,8 +81,6 @@ int DoTrapMatch(short match);
PLAYERp GlobPlayerP;
TPointer<SECT_USER> SectUser[MAXSECTORS];
ANIM Anim[MAXANIM];
short AnimCnt = 0;
@ -328,47 +326,41 @@ void WallSetup(void)
}
void SectorLiquidSet(short i)
void SectorLiquidSet(int i)
{
SECT_USERp sectu;
auto sectp = &sector[i];
// ///////////////////////////////////
//
// CHECK for pics that mean something
//
// ///////////////////////////////////
if (sector[i].floorpicnum >= 300 && sector[i].floorpicnum <= 307)
if (sectp->floorpicnum >= 300 && sectp->floorpicnum <= 307)
{
sectu = GetSectUser(i);
SET(sector[i].extra, SECTFX_LIQUID_WATER);
sectp->u_defined = true;
SET(sectp->extra, SECTFX_LIQUID_WATER);
}
else if (sector[i].floorpicnum >= 320 && sector[i].floorpicnum <= 343)
else if (sectp->floorpicnum >= 320 && sectp->floorpicnum <= 343)
{
sectu = GetSectUser(i);
SET(sector[i].extra, SECTFX_LIQUID_WATER);
sectp->u_defined = true;
SET(sectp->extra, SECTFX_LIQUID_WATER);
}
else if (sector[i].floorpicnum >= 780 && sector[i].floorpicnum <= 794)
else if (sectp->floorpicnum >= 780 && sectp->floorpicnum <= 794)
{
sectu = GetSectUser(i);
SET(sector[i].extra, SECTFX_LIQUID_WATER);
sectp->u_defined = true;
SET(sectp->extra, SECTFX_LIQUID_WATER);
}
else if (sector[i].floorpicnum >= 890 && sector[i].floorpicnum <= 897)
else if (sectp->floorpicnum >= 890 && sectp->floorpicnum <= 897)
{
sectu = GetSectUser(i);
SET(sector[i].extra, SECTFX_LIQUID_WATER);
sectp->u_defined = true;
SET(sectp->extra, SECTFX_LIQUID_WATER);
}
else if (sector[i].floorpicnum >= 175 && sector[i].floorpicnum <= 182)
else if (sectp->floorpicnum >= 175 && sectp->floorpicnum <= 182)
{
sectu = GetSectUser(i);
SET(sector[i].extra, SECTFX_LIQUID_LAVA);
if (!sectu->damage)
sectu->damage = 40;
sectp->u_defined = true;
SET(sectp->extra, SECTFX_LIQUID_LAVA);
if (!sectp->damage)
sectp->damage = 40;
}
}

View file

@ -918,22 +918,6 @@ USERp SpawnUser(DSWActor* actor, short id, STATEp state)
return u;
}
SECT_USERp GetSectUser(short sectnum)
{
SECT_USERp sectu;
if (SectUser[sectnum].Data())
return SectUser[sectnum].Data();
SectUser[sectnum].Alloc();
sectu = SectUser[sectnum].Data();
ASSERT(sectu != nullptr);
return sectu;
}
DSWActor* SpawnActor(short stat, short id, STATEp state, short sectnum, int x, int y, int z, int init_ang, int vel)
{
SPRITEp sp;
@ -1698,7 +1682,6 @@ void SpriteSetup(void)
// Clear all extra bits - they are set by sprites
for (int i = 0; i < numsectors; i++)
{
SectUser[i].Clear();
sector[i].extra = 0;
}

View file

@ -2191,7 +2191,6 @@ void CallbackSOsink(ANIMp ap, void *data)
SECTOR_OBJECTp sop;
SPRITEp sp;
USERp u;
SECT_USERp su;
int startwall, endwall, j;
int dest_sector = -1;
int src_sector = -1;
@ -2230,15 +2229,13 @@ void CallbackSOsink(ANIMp ap, void *data)
RESET(sector[dest_sector].floorstat, FLOOR_STAT_RELATIVE);
su = GetSectUser(dest_sector);
auto su = &sector[dest_sector];
ASSERT(su != nullptr);
ASSERT(su->hasU() && sector[src_sector].hasU());
ASSERT(GetSectUser(src_sector));
tgt_depth = FixedToInt((GetSectUser(src_sector))->depth_fixed);
tgt_depth = FixedToInt(sector[src_sector].depth_fixed);
short sectnum;
for (sectnum = 0; sectnum < numsectors; sectnum++)
for (int sectnum = 0; sectnum < numsectors; sectnum++)
{
if (sectnum == dest_sector)
{
@ -2527,9 +2524,8 @@ void DoTrack(SECTOR_OBJECTp sop, short locktics, int *nx, int *ny)
{
// for lowering the whirlpool in level 1
SECTORp *sectp;
short i;
SECT_USERp sectu;
int i;
for (i = 0, sectp = &sop->sectp[0]; *sectp; sectp++, i++)
{
if ((*sectp)->hasU())