diff --git a/source/games/sw/src/ai.h b/source/games/sw/src/ai.h index 4e14a9746..eadab2e6e 100644 --- a/source/games/sw/src/ai.h +++ b/source/games/sw/src/ai.h @@ -37,7 +37,7 @@ struct DECISION }; // Personality structure -struct PERSONALITYstruct +struct PERSONALITY { DECISION* Battle; DECISION* Offense; @@ -51,15 +51,14 @@ struct PERSONALITYstruct enum ActorStates { SLOW_SPEED, NORM_SPEED, MID_SPEED, FAST_SPEED, MAX_SPEED}; -#define MAXATTRIBSNDS 11 -typedef enum +enum ATTRIB_SNDS { attr_ambient, attr_alert, attr_attack, attr_pain, attr_die, attr_extra1, attr_extra2, attr_extra3,attr_extra4,attr_extra5, - attr_extra6 -} ATTRIB_SNDS; + attr_extra6, MAXATTRIBSNDS +}; -struct ATTRIBUTEstruct +struct ATTRIBUTE { int16_t Speed[MAX_SPEED]; int8_t TicAdjust[MAX_SPEED]; diff --git a/source/games/sw/src/bots.h b/source/games/sw/src/bots.h index 9021c99a1..f91986cc8 100644 --- a/source/games/sw/src/bots.h +++ b/source/games/sw/src/bots.h @@ -34,11 +34,11 @@ BEGIN_SW_NS // BOT DEFINITIONS AND STRUCTURES -typedef enum +enum BOT_Actions { BOTstand, BOThide, BOTrun, BOTduck, BOTjump, BOTstrafe, BOTshoot, BOTuseinv, BOTopen, BOTswimup, BOTswimdown, BOTturn, BOTuserts -} BOT_Actions; +}; // Linked lists containing node trees that are chosen based on desired actions diff --git a/source/games/sw/src/coolie.cpp b/source/games/sw/src/coolie.cpp index e107e435a..b60a8ce63 100644 --- a/source/games/sw/src/coolie.cpp +++ b/source/games/sw/src/coolie.cpp @@ -370,7 +370,7 @@ ACTOR_ACTION_SET CoolieActionSet = }; // later. This is used by multiple enemies. -void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SET* action, PERSONALITYp person) +void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SET* action, PERSONALITY* person) { unsigned int wpn; int wpn_cnt; diff --git a/source/games/sw/src/game.h b/source/games/sw/src/game.h index b21296462..846aab8d9 100644 --- a/source/games/sw/src/game.h +++ b/source/games/sw/src/game.h @@ -63,7 +63,7 @@ constexpr int BIT(int shift) return 1 << shift; } -typedef struct +struct GAME_SET { // Net Options from Menus uint8_t NetGameType; // 0=DeathMatch [spawn], 1=Cooperative 2=DeathMatch [no spawn] @@ -75,7 +75,7 @@ typedef struct uint8_t NetTimeLimit; // Limit time of game uint8_t NetColor; // Chosen color for player bool NetNuke; -} GAME_SET, * GAME_SETp; +}; extern const GAME_SET gs_defaults; extern GAME_SET gs; @@ -340,8 +340,6 @@ enum Dir8 NW = ORD_NW * DEGREE_45, }; -typedef enum Dir8 DIR8; - // Auto building enumerations #define DIGI_ENUM @@ -367,22 +365,16 @@ enum dam // Forward declarations -struct STATEstruct; -typedef struct STATEstruct STATE, *STATEp, * *STATEpp; - -//struct PIC_STATEstruct; -//typedef struct PIC_STATEstruct PIC_STATE, *PIC_STATEp; +struct STATE; +typedef STATE* STATEp; struct PANEL_STATE; struct PLAYERstruct; typedef struct PLAYERstruct PLAYER, *PLAYERp; -struct PERSONALITYstruct; -typedef struct PERSONALITYstruct PERSONALITY, *PERSONALITYp; - -struct ATTRIBUTEstruct; -typedef struct ATTRIBUTEstruct ATTRIBUTE, *ATTRIBUTEp; +struct PERSONALITY; +struct ATTRIBUTE; struct SECTOR_OBJECTstruct; typedef struct SECTOR_OBJECTstruct SECTOR_OBJECT, *SECTOR_OBJECTp; @@ -400,13 +392,12 @@ typedef ANIMATOR *ANIMATORp; typedef void pANIMATOR (PANEL_SPRITEp); typedef pANIMATOR *pANIMATORp; -typedef void soANIMATOR (SECTOR_OBJECTp); -typedef soANIMATOR *soANIMATORp; +typedef void (*soANIMATORp) (SECTOR_OBJECTp); typedef sectortype SECTOR, *SECTORp; typedef walltype WALL, *WALLp; -struct STATEstruct +struct STATE { short Pic; int Tics; @@ -432,7 +423,8 @@ enum // Jim's MISC declarations from other files /////////////////////////////////////////////////////////////////////////////// -typedef enum {WATER_FOOT, BLOOD_FOOT} FOOT_TYPE; +enum FOOT_TYPE +{WATER_FOOT, BLOOD_FOOT}; extern FOOT_TYPE FootMode; ANIMATOR QueueFloorBlood; // Weapon.c @@ -483,7 +475,7 @@ enum }; //#define WEAP_ENTRY(id, init_func, damage_lo, damage_hi, radius) -typedef struct +struct DAMAGE_DATA { void (*Init)(PLAYERp); int16_t damage_lo; @@ -494,7 +486,7 @@ typedef struct int16_t with_weapon; int16_t weapon_pickup; int16_t ammo_pickup; -} DAMAGE_DATA, *DAMAGE_DATAp; +}; extern DAMAGE_DATA DamageData[]; @@ -589,14 +581,14 @@ typedef void (*PLAYER_ACTION_FUNCp)(PLAYERp); #include "inv.h" -typedef struct +struct REMOTE_CONTROL { sectortype* cursectp, * lastcursectp; int pang; vec2_t vect, ovect, slide_vect; vec3_t pos; SECTOR_OBJECTp sop_control; -} REMOTE_CONTROL, *REMOTE_CONTROLp; +}; struct PLAYERstruct { @@ -945,8 +937,8 @@ struct USER ANIMATORp ActorActionFunc; ACTOR_ACTION_SET* ActorActionSet; - PERSONALITYp Personality; - ATTRIBUTEp Attrib; + PERSONALITY* Personality; + ATTRIBUTE* Attrib; SECTOR_OBJECTp sop_parent; // denotes that this sprite is a part of the // sector object - contains info for the SO @@ -1682,7 +1674,7 @@ int AnimSet(int animtype, sectortype* animindex, int thegoal, int thevel) short AnimSetCallback(short anim_ndx, ANIM_CALLBACKp call, SECTOR_OBJECTp data); short AnimSetVelAdj(short anim_ndx, short vel_adj); -void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SET* action, PERSONALITYp person); +void EnemyDefaults(DSWActor* actor, ACTOR_ACTION_SET* action, PERSONALITY* person); 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); diff --git a/source/games/sw/src/lists.h b/source/games/sw/src/lists.h index 05130fd46..0735d5b1c 100644 --- a/source/games/sw/src/lists.h +++ b/source/games/sw/src/lists.h @@ -32,23 +32,22 @@ BEGIN_SW_NS /********************************************************************/ -typedef - struct List +struct List { struct List *Next; struct List *Prev; -} LISTHEAD, *LIST; +}; inline void INITLIST(void* listp) { - LIST list = (LIST)listp; + List* list = (List*)listp; list->Prev = list->Next = list; } inline void INSERT(void* listp, void* nodepp) { - LIST list = (LIST)listp; - LIST nodep = (LIST)nodepp; + List* list = (List*)listp; + List* nodep = (List*)nodepp; nodep->Prev = list; nodep->Next = list->Next; list->Next = nodep; @@ -63,7 +62,7 @@ inline void REMOVE(PANEL_SPRITEp nodep) inline bool EMPTY(void* listp) { - LIST list = (LIST)listp; + List* list = (List*)listp; return list->Next == list; } diff --git a/source/games/sw/src/panel.cpp b/source/games/sw/src/panel.cpp index 70800a454..15f8432ac 100644 --- a/source/games/sw/src/panel.cpp +++ b/source/games/sw/src/panel.cpp @@ -6218,7 +6218,7 @@ void InsertPanelSprite(PLAYERp pp, PANEL_SPRITEp psp) for (cur = list->Next; nxt = cur->Next, cur != list; cur = nxt) { // if the next pointer is the end of the list, insert it - if ((LIST) cur->Next == (LIST) &pp->PanelSpriteList) + if ((List*) cur->Next == (List*) &pp->PanelSpriteList) { INSERT(cur, psp); return; @@ -6296,7 +6296,7 @@ void pClearSpriteList(PLAYERp pp) PANEL_SPRITEp psp=nullptr, next_psp=nullptr; auto l = &pp->PanelSpriteList; - for (psp = l->Next; next_psp = psp->Next, (LIST)psp != (LIST)l; psp = next_psp) + for (psp = l->Next; next_psp = psp->Next, (List*)psp != (List*)l; psp = next_psp) { if (psp->Next == nullptr || psp->Prev == nullptr) return; // this can happen when cleaning up a fatal error. pKillSprite(psp); diff --git a/source/games/sw/src/panel.h b/source/games/sw/src/panel.h index 206f125aa..f80c13be2 100644 --- a/source/games/sw/src/panel.h +++ b/source/games/sw/src/panel.h @@ -46,7 +46,6 @@ enum conpic_id { #include "conpic.h" }; -typedef enum conpic_id CONPIC_ID; #undef MAKE_CONPIC_ENUM enum PanelSpriteIDs diff --git a/source/games/sw/src/save.cpp b/source/games/sw/src/save.cpp index ebe398a12..a296b683d 100644 --- a/source/games/sw/src/save.cpp +++ b/source/games/sw/src/save.cpp @@ -187,12 +187,12 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, ACTOR_ACTION_SET*& return SerializeDataPtr(arc, keyname, *(void**)&w, sizeof(ACTOR_ACTION_SET)); } -FSerializer& Serialize(FSerializer& arc, const char* keyname, PERSONALITYp& w, PERSONALITYp* def) +FSerializer& Serialize(FSerializer& arc, const char* keyname, PERSONALITY*& w, PERSONALITY** def) { return SerializeDataPtr(arc, keyname, *(void**)&w, sizeof(PERSONALITY)); } -FSerializer& Serialize(FSerializer& arc, const char* keyname, ATTRIBUTEp& w, ATTRIBUTEp* def) +FSerializer& Serialize(FSerializer& arc, const char* keyname, ATTRIBUTE*& w, ATTRIBUTE** def) { return SerializeDataPtr(arc, keyname, *(void**)&w, sizeof(ATTRIBUTE)); } @@ -219,7 +219,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, PANEL_SPRITEp& w, for (unsigned i = 0; i < MAX_SW_PLAYERS_REG; i++) { // special case for pointing to the list head - if ((LIST)w == (LIST)&Player[i].PanelSpriteList) + if ((List*)w == (List*)&Player[i].PanelSpriteList) { idx = 1000'0000 + i; break; diff --git a/source/games/sw/src/weapon.cpp b/source/games/sw/src/weapon.cpp index 92ed44ef9..72eff72fd 100644 --- a/source/games/sw/src/weapon.cpp +++ b/source/games/sw/src/weapon.cpp @@ -5273,7 +5273,7 @@ int PlayerDamageSlide(PLAYERp pp, int damage, short ang) int GetDamage(DSWActor* actor, DSWActor* weapActor, int DamageNdx) { - DAMAGE_DATAp d = &DamageData[DamageNdx]; + auto d = &DamageData[DamageNdx]; // if ndx does radius if (d->radius > 0 && weapActor)