- cleaned out most of the less frequent typedef types in SW.

This commit is contained in:
Christoph Oelckers 2021-12-31 15:27:18 +01:00
parent 10187e892f
commit 87d2b3274b
12 changed files with 39 additions and 126 deletions

View file

@ -41,29 +41,24 @@ typedef enum
} BOT_Actions; } BOT_Actions;
// Linked lists containing node trees that are chosen based on desired actions // Linked lists containing node trees that are chosen based on desired actions
struct NODEstruct;
typedef struct NODEstruct NODE, *NODEp;
struct NODEstruct struct NODE
{ {
NODEp p, l, r; // Pointers to tree nodes NODE* p,* l,* r; // Pointers to tree nodes
int goalx, goaly, goalz; // x,y,z point bot wants to get to int goalx, goaly, goalz; // x,y,z point bot wants to get to
BOT_Actions action; // Action to take if this node is reached BOT_Actions action; // Action to take if this node is reached
int tics; // Optionally stay in this node for x tics. int tics; // Optionally stay in this node for x tics.
}; };
struct NODETREEstruct; struct NODETREE
typedef struct NODETREEstruct NODETREE, *NODETREEp;
struct NODETREEstruct
{ {
NODEp tree; // This is the node tree used to navigate to goal NODE* tree; // This is the node tree used to navigate to goal
bool Locked; // If list is locked, a bot is using/modifying it and bool Locked; // If list is locked, a bot is using/modifying it and
// other bots cannot modify it while it's locked // other bots cannot modify it while it's locked
}; };
// Bots main action variables // Bots main action variables
typedef struct BOT_BRAIN struct BOT_BRAIN
{ {
int16_t tgt_inv; // Inventory item it wants to use int16_t tgt_inv; // Inventory item it wants to use
int16_t tgt_weapon; // weapon in wants to activate and use int16_t tgt_weapon; // weapon in wants to activate and use
@ -72,7 +67,7 @@ typedef struct BOT_BRAIN
int16_t tgt_sector; // Sector it wants to get to int16_t tgt_sector; // Sector it wants to get to
int16_t tgt_wall; // Wall it wants to touch int16_t tgt_wall; // Wall it wants to touch
BOT_Actions action; // Bot's current action BOT_Actions action; // Bot's current action
} BotBrain, *BotBrain_p; };
// NOTE: // NOTE:
// The following arrays should be saved off with save games! // The following arrays should be saved off with save games!

View file

@ -370,7 +370,7 @@ ACTOR_ACTION_SET CoolieActionSet =
}; };
// later. This is used by multiple enemies. // later. This is used by multiple enemies.
void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SETp action, PERSONALITYp person) void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SET* action, PERSONALITYp person)
{ {
unsigned int wpn; unsigned int wpn;
int wpn_cnt; int wpn_cnt;

View file

@ -855,7 +855,8 @@ enum
MAX_ACTOR_CLOSE_ATTACK = 2, MAX_ACTOR_CLOSE_ATTACK = 2,
MAX_ACTOR_ATTACK = 6, MAX_ACTOR_ATTACK = 6,
}; };
typedef struct
struct ACTOR_ACTION_SET
{ {
STATEp *Stand; STATEp *Stand;
STATEp *Run; STATEp *Run;
@ -884,7 +885,7 @@ typedef struct
STATEp *Special[2]; STATEp *Special[2];
STATEp *Duck; STATEp *Duck;
STATEp *Dive; STATEp *Dive;
} ACTOR_ACTION_SET,*ACTOR_ACTION_SETp; };
struct ROTATOR struct ROTATOR
{ {
@ -914,8 +915,6 @@ struct ROTATOR
}; };
using ROTATORp = ROTATOR*;
// //
// User Extension record // User Extension record
// //
@ -945,7 +944,7 @@ struct USER
STATEp *StateFallOverride; // a bit kludgy - override std fall state STATEp *StateFallOverride; // a bit kludgy - override std fall state
ANIMATORp ActorActionFunc; ANIMATORp ActorActionFunc;
ACTOR_ACTION_SETp ActorActionSet; ACTOR_ACTION_SET* ActorActionSet;
PERSONALITYp Personality; PERSONALITYp Personality;
ATTRIBUTEp Attrib; ATTRIBUTEp Attrib;
SECTOR_OBJECTp sop_parent; // denotes that this sprite is a part of the SECTOR_OBJECTp sop_parent; // denotes that this sprite is a part of the
@ -1191,12 +1190,6 @@ enum
}; };
typedef struct
{
int16_t high;
} RANGE,*RANGEp;
/////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////
// //
// Sector Stuff - Sector Objects and Tracks // Sector Stuff - Sector Objects and Tracks
@ -1242,11 +1235,10 @@ enum
}; };
#define MAKE_STAG_ENUM #define MAKE_STAG_ENUM
enum stag_id enum STAG_ID
{ {
#include "stag.h" #include "stag.h"
}; };
typedef enum stag_id STAG_ID;
#undef MAKE_STAG_ENUM #undef MAKE_STAG_ENUM
@ -1291,19 +1283,19 @@ enum ShrapType
# define CallocMem(size, num) M_Calloc(size, num) # define CallocMem(size, num) M_Calloc(size, num)
# define FreeMem(ptr) M_Free(ptr) # define FreeMem(ptr) M_Free(ptr)
typedef struct TARGET_SORT struct TARGET_SORT
{ {
DSWActor* actor; DSWActor* actor;
int16_t dang; int16_t dang;
int dist; int dist;
int weight; int weight;
} *TARGET_SORTp; };
enum { MAX_TARGET_SORT = 16 }; enum { MAX_TARGET_SORT = 16 };
extern TARGET_SORT TargetSort[MAX_TARGET_SORT]; extern TARGET_SORT TargetSort[MAX_TARGET_SORT];
extern unsigned TargetSortCount; extern unsigned TargetSortCount;
enum DoorType enum DOOR_TYPE
{ {
OPERATE_TYPE, OPERATE_TYPE,
DOOR_HORIZ_TYPE, DOOR_HORIZ_TYPE,
@ -1312,30 +1304,28 @@ enum DoorType
DOOR_ROTATE_TYPE DOOR_ROTATE_TYPE
}; };
typedef enum DoorType DOOR_TYPE; struct DOOR_AUTO_CLOSE
typedef struct
{ {
DOOR_TYPE Type; DOOR_TYPE Type;
int Sector; int Sector;
int16_t Speed; int16_t Speed;
int16_t TimeOut; int16_t TimeOut;
} DOOR_AUTO_CLOSE, *DOOR_AUTO_CLOSEp; };
typedef struct struct SWING
{ {
int origx[17], origy[17]; int origx[17], origy[17];
int sector; int sector;
int16_t angopen, angclosed, angopendir, sang, anginc; int16_t angopen, angclosed, angopendir, sang, anginc;
} SWING; };
typedef struct SINE_WAVE_FLOOR struct SINE_WAVE_FLOOR
{ {
sectortype* sectp; sectortype* sectp;
int floor_origz, ceiling_origz, range; int floor_origz, ceiling_origz, range;
int16_t sintable_ndx, speed_shift; int16_t sintable_ndx, speed_shift;
uint8_t flags; uint8_t flags;
} *SINE_WAVE_FLOORp; };
enum enum
{ {
@ -1346,12 +1336,12 @@ enum
extern SINE_WAVE_FLOOR SineWaveFloor[MAX_SINE_WAVE][21]; extern SINE_WAVE_FLOOR SineWaveFloor[MAX_SINE_WAVE][21];
typedef struct SINE_WALL struct SINE_WALL
{ {
walltype* wallp; walltype* wallp;
int orig_xy, range; int orig_xy, range;
int16_t sintable_ndx, speed_shift, type; int16_t sintable_ndx, speed_shift, type;
} *SINE_WALLp; };
extern SINE_WALL SineWall[MAX_SINE_WALL][MAX_SINE_WALL_POINTS]; extern SINE_WALL SineWall[MAX_SINE_WALL][MAX_SINE_WALL_POINTS];
@ -1373,9 +1363,7 @@ enum
extern DOOR_AUTO_CLOSE DoorAutoClose[MAX_DOOR_AUTO_CLOSE]; extern DOOR_AUTO_CLOSE DoorAutoClose[MAX_DOOR_AUTO_CLOSE];
typedef void ANIM_CALLBACK (ANIMp, void *); typedef void (*ANIM_CALLBACKp) (ANIMp, void *);
typedef ANIM_CALLBACK *ANIM_CALLBACKp;
typedef void *ANIM_DATAp;
enum enum
{ {
@ -1694,7 +1682,7 @@ int AnimSet(int animtype, sectortype* animindex, int thegoal, int thevel)
short AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, SECTOR_OBJECTp data); short AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, SECTOR_OBJECTp data);
short AnimSetVelAdj(short anim_ndx, short vel_adj); short AnimSetVelAdj(short anim_ndx, short vel_adj);
void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SETp action, PERSONALITYp person); void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SET* action, PERSONALITYp person);
void getzrangepoint(int x, int y, int z, sectortype* sect, int32_t* ceilz, Collision* ceilhit, int32_t* florz, Collision* florhit); void getzrangepoint(int x, int y, int z, sectortype* sect, int32_t* ceilz, Collision* ceilhit, int32_t* florz, Collision* florhit);
Collision move_sprite(DSWActor* , int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics); Collision move_sprite(DSWActor* , int xchange, int ychange, int zchange, int ceildist, int flordist, uint32_t cliptype, int numtics);

View file

@ -1133,7 +1133,7 @@ DSWActor* DoPickTarget(DSWActor* actor, uint32_t max_delta_ang, int skip_targets
int16_t* shp; int16_t* shp;
int ezh, ezhl, ezhm; int ezh, ezhl, ezhm;
unsigned ndx; unsigned ndx;
TARGET_SORTp ts; TARGET_SORT* ts;
int ang_weight, dist_weight; int ang_weight, dist_weight;
// !JIM! Watch out for max_delta_ang of zero! // !JIM! Watch out for max_delta_ang of zero!

View file

@ -46,7 +46,7 @@ void DoRotatorStopInterp(DSWActor*);
void ReverseRotator(DSWActor* actor) void ReverseRotator(DSWActor* actor)
{ {
ROTATORp r; ROTATOR* r;
r = actor->user.rotator.Data(); r = actor->user.rotator.Data();
@ -90,7 +90,7 @@ bool RotatorSwitch(short match, short setting)
void SetRotatorActive(DSWActor* actor) void SetRotatorActive(DSWActor* actor)
{ {
ROTATORp r; ROTATOR* r;
r = actor->user.rotator.Data(); r = actor->user.rotator.Data();
@ -241,7 +241,7 @@ void DoRotatorStopInterp(DSWActor* actor)
int DoRotator(DSWActor* actor) int DoRotator(DSWActor* actor)
{ {
ROTATORp r; ROTATOR* r;
short ndx,w,startwall,endwall; short ndx,w,startwall,endwall;
DSWActor* pivot = nullptr; DSWActor* pivot = nullptr;
vec2_t nxy; vec2_t nxy;

View file

@ -182,7 +182,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, STATEp*& w, STATEp
return SerializeDataPtr(arc, keyname, *(void**)&w, sizeof(STATEp)); return SerializeDataPtr(arc, keyname, *(void**)&w, sizeof(STATEp));
} }
FSerializer& Serialize(FSerializer& arc, const char* keyname, ACTOR_ACTION_SETp& w, ACTOR_ACTION_SETp* def) FSerializer& Serialize(FSerializer& arc, const char* keyname, ACTOR_ACTION_SET*& w, ACTOR_ACTION_SET** def)
{ {
return SerializeDataPtr(arc, keyname, *(void**)&w, sizeof(ACTOR_ACTION_SET)); return SerializeDataPtr(arc, keyname, *(void**)&w, sizeof(ACTOR_ACTION_SET));
} }

View file

@ -250,7 +250,7 @@ void WallSetup(void)
{ {
walltype* wall_num; walltype* wall_num;
int cnt, num_points, type, tag_end; int cnt, num_points, type, tag_end;
SINE_WALLp sw; SINE_WALL* sw;
int range = 250, speed = 3, peak = 0; int range = 250, speed = 3, peak = 0;
tag_end = wal.lotag + 2; tag_end = wal.lotag + 2;
@ -541,7 +541,7 @@ void SectorSetup(void)
// setup the sintable_ndx based on the actual number of // setup the sintable_ndx based on the actual number of
// sectors (swf_ndx) // sectors (swf_ndx)
for (swf = &SineWaveFloor[NextSineWave][0], cnt = 0; swf->sectp != 0 && swf < (SINE_WAVE_FLOORp)&SineWaveFloor[SIZ(SineWaveFloor)]; swf++, cnt++) for (swf = &SineWaveFloor[NextSineWave][0], cnt = 0; swf->sectp != 0 && swf < (SINE_WAVE_FLOOR*)&SineWaveFloor[SIZ(SineWaveFloor)]; swf++, cnt++)
{ {
if (peak_dist) if (peak_dist)
swf->sintable_ndx = cnt * (2048 / peak_dist); swf->sintable_ndx = cnt * (2048 / peak_dist);

View file

@ -30,7 +30,7 @@ Prepared for public release: 03/28/2005 - Charlie Wiederhold, 3D Realms
BEGIN_SW_NS BEGIN_SW_NS
void SectorSetup(void); void SectorSetup(void);
DOOR_AUTO_CLOSEp SetDoorAutoClose(short SectorNum, short Type); DOOR_AUTO_CLOSE* SetDoorAutoClose(short SectorNum, short Type);
void DoDragging(void); void DoDragging(void);
int MoveDoorVert(short door_sector, short dir, short door_speed); int MoveDoorVert(short door_sector, short dir, short door_speed);
int MoveDoorUp(short door_sector, short auto_close, short door_speed); int MoveDoorUp(short door_sector, short auto_close, short door_speed);

View file

@ -41,7 +41,7 @@ BEGIN_SW_NS
void ReverseSlidor(DSWActor* actor) void ReverseSlidor(DSWActor* actor)
{ {
ROTATORp r; ROTATOR* r;
r = actor->user.rotator.Data(); r = actor->user.rotator.Data();
@ -86,7 +86,7 @@ bool SlidorSwitch(short match, short setting)
void SetSlidorActive(DSWActor* actor) void SetSlidorActive(DSWActor* actor)
{ {
ROTATORp r; ROTATOR* r;
r = actor->user.rotator.Data(); r = actor->user.rotator.Data();
@ -412,7 +412,7 @@ int DoSlidorInstantClose(DSWActor* actor)
int DoSlidor(DSWActor* actor) int DoSlidor(DSWActor* actor)
{ {
ROTATORp r; ROTATOR* r;
int old_pos; int old_pos;
bool kill = false; bool kill = false;

View file

@ -540,41 +540,6 @@ STATEp sg_SumoDead[] =
s_SumoDead s_SumoDead
}; };
/*
struct
{
#define MAX_ACTOR_CLOSE_ATTACK 2
#define MAX_ACTOR_ATTACK 6
STATEp *Stand;
STATEp *Run;
STATEp *Jump;
STATEp *Fall;
STATEp *Crawl;
STATEp *Swim;
STATEp *Fly;
STATEp *Rise;
STATEp *Sit;
STATEp *Look;
STATEp *Climb;
STATEp *Pain;
STATEp *Death1;
STATEp *Death2;
STATEp *Dead;
STATEp *DeathJump;
STATEp *DeathFall;
STATEp *CloseAttack[MAX_ACTOR_CLOSE_ATTACK];
short CloseAttackPercent[MAX_ACTOR_CLOSE_ATTACK];
STATEp *Attack[MAX_ACTOR_ATTACK];
short AttackPercent[MAX_ACTOR_ATTACK];
STATEp *Special[2];
STATEp *Duck;
STATEp *Dive;
}ACTOR_ACTION_SET,*ACTOR_ACTION_SETp;
*/
ACTOR_ACTION_SET SumoActionSet = ACTOR_ACTION_SET SumoActionSet =
{ {
sg_SumoStand, sg_SumoStand,

View file

@ -7623,7 +7623,7 @@ int DoPlasmaDone(DSWActor* actor)
DSWActor* PickEnemyTarget(DSWActor* actor, short aware_range) DSWActor* PickEnemyTarget(DSWActor* actor, short aware_range)
{ {
TARGET_SORTp ts; TARGET_SORT* ts;
DoPickTarget(actor, aware_range, false); DoPickTarget(actor, aware_range, false);
@ -13654,7 +13654,7 @@ int InitMicro(PLAYERp pp)
DSWActor* actor = pp->actor; DSWActor* actor = pp->actor;
int nx, ny, nz, dist; int nx, ny, nz, dist;
short i,ang; short i,ang;
TARGET_SORTp ts = TargetSort; TARGET_SORT* ts = TargetSort;
DSWActor* picked = nullptr; DSWActor* picked = nullptr;
nx = pp->pos.X; nx = pp->pos.X;
@ -15415,7 +15415,7 @@ int InitTurretMicro(DSWActor* actor, PLAYERp pp)
DSWActor* plActor = pp->actor; DSWActor* plActor = pp->actor;
int nx, ny, nz, dist; int nx, ny, nz, dist;
short i,ang; short i,ang;
TARGET_SORTp ts = TargetSort; TARGET_SORT* ts = TargetSort;
DSWActor* picked = nullptr; DSWActor* picked = nullptr;
if (SW_SHAREWARE) return false; // JBF: verify if (SW_SHAREWARE) return false; // JBF: verify

View file

@ -575,41 +575,6 @@ STATEp sg_ZillaDead[] =
s_ZillaDead s_ZillaDead
}; };
/*
struct
{
#define MAX_ACTOR_CLOSE_ATTACK 2
#define MAX_ACTOR_ATTACK 6
STATEp *Stand;
STATEp *Run;
STATEp *Jump;
STATEp *Fall;
STATEp *Crawl;
STATEp *Swim;
STATEp *Fly;
STATEp *Rise;
STATEp *Sit;
STATEp *Look;
STATEp *Climb;
STATEp *Pain;
STATEp *Death1;
STATEp *Death2;
STATEp *Dead;
STATEp *DeathJump;
STATEp *DeathFall;
STATEp *CloseAttack[MAX_ACTOR_CLOSE_ATTACK];
short CloseAttackPercent[MAX_ACTOR_CLOSE_ATTACK];
STATEp *Attack[MAX_ACTOR_ATTACK];
short AttackPercent[MAX_ACTOR_ATTACK];
STATEp *Special[2];
STATEp *Duck;
STATEp *Dive;
}ACTOR_ACTION_SET,*ACTOR_ACTION_SETp;
*/
ACTOR_ACTION_SET ZillaActionSet = ACTOR_ACTION_SET ZillaActionSet =
{ {
sg_ZillaStand, sg_ZillaStand,