From de2d0b2bf6a957e9cd844941d3443c481b8ec6fa Mon Sep 17 00:00:00 2001 From: Marrub Date: Wed, 4 Oct 2017 23:19:27 -0400 Subject: [PATCH] Rename types --- src/g_missile.c | 6 +++--- src/g_missile.h | 4 ++-- src/g_objdef.c | 26 +++++++++++++------------- src/g_objdef.h | 16 ++++++++-------- src/g_object.c | 18 +++++++++--------- src/g_object.h | 30 +++++++++++++++--------------- src/g_player.c | 8 ++++---- src/g_player.h | 9 ++++----- src/g_stage.c | 8 ++++---- src/g_stage.h | 26 +++++++++++++------------- src/golan5.c | 2 +- src/i_gui.c | 8 ++++---- src/i_gui.h | 10 +++++----- src/m_tokbuf.c | 2 +- src/m_tokbuf.h | 2 +- src/m_token.h | 8 ++++---- src/main.c | 4 ++-- src/r_resdec.c | 4 ++-- 18 files changed, 95 insertions(+), 96 deletions(-) diff --git a/src/g_missile.c b/src/g_missile.c index 8d38c41..443c1d5 100644 --- a/src/g_missile.c +++ b/src/g_missile.c @@ -13,10 +13,10 @@ // // G_Missile_Fire // -void G_Missile_Fire(enum G_mslty type, unsigned owner, fixed x, fixed y, fixed z, ulfra yaw) +void G_Missile_Fire(enum G_msltype type, unsigned owner, fixed x, fixed y, fixed z, ulfra yaw) { - G_entit ot = {owner}; - G_missl th = {DGE_MissileEntity_Create(0)}; + G_entity ot = {owner}; + G_missile th = {DGE_MissileEntity_Create(0)}; th.subtype = subtype_missile; th.x = ot.x + x; diff --git a/src/g_missile.h b/src/g_missile.h index a255a3c..3c93dcc 100644 --- a/src/g_missile.h +++ b/src/g_missile.h @@ -7,7 +7,7 @@ // Types ---------------------------------------------------------------------| -enum G_mslty +enum G_msltype { missile_p_basicL, missile_p_basicR, @@ -15,6 +15,6 @@ enum G_mslty // Extern Functions ----------------------------------------------------------| -void G_Missile_Fire(enum G_mslty type, unsigned owner, fixed x, fixed y, fixed z, ulfra yaw); +void G_Missile_Fire(enum G_msltype type, unsigned owner, fixed x, fixed y, fixed z, ulfra yaw); #endif diff --git a/src/g_objdef.c b/src/g_objdef.c index 329cc98..11e99d3 100644 --- a/src/g_objdef.c +++ b/src/g_objdef.c @@ -52,7 +52,7 @@ _Noreturn static void G_ObjDef_throw (struct G_dodst *st, char const *emsg); [[__optional_args(1)]] -static M_token *G_ObjDef_expect (struct G_dodst *st, M_tokty t, char const *exp); +static M_token *G_ObjDef_expect (struct G_dodst *st, M_toktype t, char const *exp); [[__optional_args(1)]] static struct G_odarg G_ObjDef_getArgs (struct G_dodst *st, char const *arg); @@ -107,8 +107,8 @@ typedef struct G_otdcl typedef struct G_etdcl { - G_entty type; - G_anims anim; + G_enttype type; + G_anims anim; M_Vec_decl(struct G_manim, anims); char name[32]; size_t keyhash; @@ -126,15 +126,15 @@ typedef struct G_frdcl typedef struct G_andcl { M_Vec_decl(G_frame, frame); - G_anima anim; - char name[32]; - size_t keyhash; + G_anim anim; + char name[32]; + size_t keyhash; struct G_andcl *next, **prev; } G_andcl; typedef struct G_manim { - G_anima anim; + G_anim anim; char name[32]; size_t keyhash; struct G_manim *next, **prev; @@ -189,7 +189,7 @@ static enum M_tkprc G_ObjDef_tokProcess(M_token *tok, void *udata) // // G_ObjDef_expect // -static M_token *G_ObjDef_expect(G_dodst *st, M_tokty t, char const *exp) +static M_token *G_ObjDef_expect(G_dodst *st, M_toktype t, char const *exp) { M_token *tok; if((tok = st->getToken())->type != t) { @@ -267,7 +267,7 @@ static void G_ObjDef_getEntAnim(G_dodst *st, G_etdcl *decl) // // G_ObjDef_getEntProp // -static void G_ObjDef_getEntProp(G_dodst *st, G_entty *type, char const *id) +static void G_ObjDef_getEntProp(G_dodst *st, G_enttype *type, char const *id) { if(strcmp(id, "subtype") == 0) { @@ -421,7 +421,7 @@ static void G_ObjDef_parseAnimDef(G_dodst *st) while(!st->drop(tok_bracec)) G_ObjDef_parseAnim(st, decl); - decl->anim = (G_anima){decl->frameV, decl->frameC}; + decl->anim = (G_anim){decl->frameV, decl->frameC}; if(ins) { decl->keyhash = M_StrHash(decl->name); @@ -553,7 +553,7 @@ void G_ObjDef_AddType(char const *name, mword subtype, mword ext, DGE_CallbackTy // // G_ObjDef_GetType // -G_entty const *G_ObjDef_GetType(char const *name) +G_enttype const *G_ObjDef_GetType(char const *name) { G_etdcl const *decl = G_enttypes.find(name); return decl ? &decl->type : NULL; @@ -562,7 +562,7 @@ G_entty const *G_ObjDef_GetType(char const *name) // // G_ObjDef_GetTAni // -G_anima const *G_ObjDef_GetTAni(G_entty const *type, char const *name) +G_anim const *G_ObjDef_GetTAni(G_enttype const *type, char const *name) { G_manim *anim = ((G_etdcl *)type)->anim.find(name); return anim ? &anim->anim : NULL; @@ -571,7 +571,7 @@ G_anima const *G_ObjDef_GetTAni(G_entty const *type, char const *name) // // G_ObjDef_GetAnim // -G_anima const *G_ObjDef_GetAnim(char const *name) +G_anim const *G_ObjDef_GetAnim(char const *name) { G_andcl *an = G_animsmap.find(name); return an ? &an->anim : NULL; diff --git a/src/g_objdef.h b/src/g_objdef.h index 41c817b..a3a2e4d 100644 --- a/src/g_objdef.h +++ b/src/g_objdef.h @@ -26,24 +26,24 @@ // Extern Functions ----------------------------------------------------------| -struct G_entty const *G_ObjDef_GetType(char const *name); -struct G_anima const *G_ObjDef_GetTAni(struct G_entty const *type, char const *name); +struct G_enttype const *G_ObjDef_GetType(char const *name); +struct G_anim const *G_ObjDef_GetTAni(struct G_enttype const *type, char const *name); // Types ---------------------------------------------------------------------| -typedef struct G_frame // Frame +typedef struct G_frame { integ time; M_texid sprite; } G_frame; -typedef struct G_anima // Animation +typedef struct G_anim { G_frame const *frame; msize count; -} G_anima; +} G_anim; -typedef struct G_entty // Entity Type +typedef struct G_enttype { __prop getAnim {call: G_ObjDef_GetTAni(this)} @@ -56,11 +56,11 @@ typedef struct G_entty // Entity Type mword subtype; mword ext; DGE_CallbackType task; -} G_entty; +} G_enttype; // Extern Functions ----------------------------------------------------------| -G_anima const *G_ObjDef_GetAnim(char const *name); +G_anim const *G_ObjDef_GetAnim(char const *name); void G_ObjDef_Init(void); void G_ObjDef_Load(char const *fname); void G_ObjDef_AddType(char const *name, mword subtype, mword ext, DGE_CallbackType fptr); diff --git a/src/g_object.c b/src/g_object.c index a702ec7..b961f2c 100644 --- a/src/g_object.c +++ b/src/g_object.c @@ -15,7 +15,7 @@ // void G_RenderThinker_Animate(unsigned id) { - G_rthnk th = {id}; + G_renderth th = {id}; if(th.ftime > 0) th.ftime = th.ftime - 1; @@ -37,9 +37,9 @@ void G_RenderThinker_Animate(unsigned id) // // G_RenderThinker_AnimSet // -void G_RenderThinker_AnimSet(unsigned id, G_anima const *anim) +void G_RenderThinker_AnimSet(unsigned id, G_anim const *anim) { - G_rthnk th = {id}; + G_renderth th = {id}; if(anim && th.curanim != anim) { @@ -52,9 +52,9 @@ void G_RenderThinker_AnimSet(unsigned id, G_anima const *anim) // // G_RenderThinker_AnimSetForced // -void G_RenderThinker_AnimSetForced(unsigned id, G_anima const *anim) +void G_RenderThinker_AnimSetForced(unsigned id, G_anim const *anim) { - G_rthnk th = {id}; + G_renderth th = {id}; th.curanim = anim; th.frame = 0; @@ -64,11 +64,11 @@ void G_RenderThinker_AnimSetForced(unsigned id, G_anima const *anim) // // G_Entity_Create // -void G_Entity_Create(G_mfdat *info) +void G_Entity_Create(G_mapdata *info) { - G_entty const *type = G_ObjDef_GetType(info->ent.name); + G_enttype const *type = G_ObjDef_GetType(info->ent.name); - G_entit ent = {DGE_Entity_Create(type ? type->ext : 0)}; + G_entity ent = {DGE_Entity_Create(type ? type->ext : 0)}; ent.x = info->ent.x; ent.y = info->ent.y; @@ -89,7 +89,7 @@ void G_Entity_Create(G_mfdat *info) // // G_Sector_Create // -void G_Sector_Create(G_mfdat *info) +void G_Sector_Create(G_mapdata *info) { DGE_Sector sec = {DGE_Sector_Create(4, 0)}; diff --git a/src/g_object.h b/src/g_object.h index 2271df2..5d86ee4 100644 --- a/src/g_object.h +++ b/src/g_object.h @@ -24,9 +24,9 @@ G_propMemIEM(RenderThinker, ofs, t, name) #define G_RenderThinker_propExt() \ - G_propMemGEM(RenderThinker, unsigned, frame) \ - G_propMemGEM(RenderThinker, unsigned, ftime) \ - G_propMemGEM(RenderThinker, G_anima const *, curanim) \ + G_propMemGEM(RenderThinker, unsigned, frame) \ + G_propMemGEM(RenderThinker, unsigned, ftime) \ + G_propMemGEM(RenderThinker, G_anim const *, curanim) \ __prop animate {__call: G_RenderThinker_Animate(->id)} \ __prop setAnim {__call: G_RenderThinker_AnimSet(->id)} \ __prop fsetAnim {__call: G_RenderThinker_AnimSetForced(->id)} @@ -36,13 +36,13 @@ // Extern Functions ----------------------------------------------------------| -void G_RenderThinker_Animate(unsigned id); -void G_RenderThinker_AnimSet(unsigned id, G_anima const *anim); -void G_RenderThinker_AnimSetForced(unsigned id, G_anima const *anim); +void G_RenderThinker_Animate (unsigned id); +void G_RenderThinker_AnimSet (unsigned id, G_anim const *anim); +void G_RenderThinker_AnimSetForced(unsigned id, G_anim const *anim); // Types ---------------------------------------------------------------------| -enum G_subty +enum G_subtype { subtype_none, subtype_missile, @@ -53,36 +53,36 @@ enum G_subty #define G_RenderThinker_props() DGE_RenderThinkerProps() \ G_RenderThinker_propExt() -typedef struct G_rthnk // Render Thinker +typedef struct G_renderth { int id; G_RenderThinker_props() -} G_rthnk; +} G_renderth; #define G_Entity_props() DGE_EntityProps() \ G_RenderThinker_propExt() \ G_Entity_propExt() -typedef struct G_entit // Entity +typedef struct G_entity { int id; G_Entity_props() -} G_entit; +} G_entity; #define G_Missile_props() DGE_MissileEntityProps() \ G_RenderThinker_propExt() \ G_Entity_propExt() -typedef struct G_missl // Missile +typedef struct G_missile { int id; G_Missile_props() -} G_missl; +} G_missile; // Extern Functions ----------------------------------------------------------| -void G_Entity_Create(union G_mfdat *info); -void G_Sector_Create(union G_mfdat *info); +void G_Entity_Create(union G_mapdata *info); +void G_Sector_Create(union G_mapdata *info); #endif diff --git a/src/g_player.c b/src/g_player.c index a8a3a20..c76d5f0 100644 --- a/src/g_player.c +++ b/src/g_player.c @@ -23,7 +23,7 @@ int G_Player_Count; // // G_Player_applyVelocity // -static void G_Player_applyVelocity(G_entty const *ty, G_playr th) +static void G_Player_applyVelocity(G_enttype const *ty, G_player th) { DGE_Point3R ax = DGE_Input_GetAxis(1); accum vx = (accum)ax.x, vy = (accum)ax.y; @@ -54,10 +54,10 @@ static void G_Player_applyVelocity(G_entty const *ty, G_playr th) // G_Player_Think // DGE_Callback -void G_Player_Think(G_entty const *ty, unsigned id) +void G_Player_Think(G_enttype const *ty, unsigned id) { - G_playr th = {id}; - G_rthnk shot = {DGE_RenderThinker_Create(0)}; + G_player th = {id}; + G_renderth shot = {DGE_RenderThinker_Create(0)}; shot.rsx = 30; shot.rsy = 24; diff --git a/src/g_player.h b/src/g_player.h index 36b24dd..0e879e8 100644 --- a/src/g_player.h +++ b/src/g_player.h @@ -24,20 +24,19 @@ enum G_Player_propMem(unsigned, lives) \ G_Player_propMem(DGE_Accum, lvx) \ G_Player_propMem(unsigned, nextfire) -typedef struct G_playr // Player +typedef struct G_player { int id; G_Player_props() -} G_playr; +} G_player; // Extern Objects ------------------------------------------------------------| -extern int G_Player_Count; -extern G_playr G_Player_InGame[G_Player_max]; +extern int G_Player_Count; // Extern Functions ----------------------------------------------------------| -DGE_Callback void G_Player_Think(G_entty const *ty, unsigned id); +DGE_Callback void G_Player_Think(G_enttype const *ty, unsigned id); #endif diff --git a/src/g_stage.c b/src/g_stage.c index c90b8a8..9256180 100644 --- a/src/g_stage.c +++ b/src/g_stage.c @@ -26,7 +26,7 @@ unsigned long G_Time; static void G_Stage_readSector(FILE *fp, G_stage *s, hword *size, mword time) { *size -= 4 * 6; - G_mfsec sec; + G_mapsector sec; sec.x = M_IO_ReadLE4k(fp); sec.y = M_IO_ReadLE4k(fp); sec.w = M_IO_ReadLE4k(fp); @@ -34,7 +34,7 @@ static void G_Stage_readSector(FILE *fp, G_stage *s, hword *size, mword time) sec.f = M_IO_ReadLE4k(fp); sec.c = M_IO_ReadLE4k(fp); M_Vec_grow(s->map, 1); - M_Vec_next(s->map) = (G_mfptr){time, {.sec = sec}, G_Sector_Create}; + M_Vec_next(s->map) = (G_mapobj){time, {.sec = sec}, G_Sector_Create}; } // @@ -43,13 +43,13 @@ static void G_Stage_readSector(FILE *fp, G_stage *s, hword *size, mword time) static void G_Stage_readEntity(FILE *fp, G_stage *s, hword *size, mword time, char *name) { *size -= 4 * 3; - G_mfent ent; + G_mapentity ent; ent.x = M_IO_ReadLE4k(fp); ent.y = M_IO_ReadLE4k(fp); ent.z = M_IO_ReadLE4k(fp); M_strbufcpy(ent.name, name); M_Vec_grow(s->map, 1); - M_Vec_next(s->map) = (G_mfptr){time, {.ent = ent}, G_Entity_Create}; + M_Vec_next(s->map) = (G_mapobj){time, {.ent = ent}, G_Entity_Create}; } // Extern Functions ----------------------------------------------------------| diff --git a/src/g_stage.h b/src/g_stage.h index cc5c756..0eaa706 100644 --- a/src/g_stage.h +++ b/src/g_stage.h @@ -8,36 +8,36 @@ // Types ---------------------------------------------------------------------| -typedef struct G_mfsec +typedef struct G_mapsector { fixed x, y; fixed w, h; fixed f, c; -} G_mfsec; +} G_mapsector; -typedef struct G_mfent +typedef struct G_mapentity { fixed x, y, z; char name[32]; -} G_mfent; +} G_mapentity; -typedef union G_mfdat +typedef union G_mapdata { - G_mfsec sec; - G_mfent ent; -} G_mfdat; + G_mapsector sec; + G_mapentity ent; +} G_mapdata; -typedef struct G_mfptr +typedef struct G_mapobj { mword time; - G_mfdat data; + G_mapdata data; - void (*proc)(G_mfdat *data); -} G_mfptr; + void (*proc)(G_mapdata *data); +} G_mapobj; typedef struct G_stage { - M_Vec_decl(G_mfptr, map); + M_Vec_decl(G_mapobj, map); } G_stage; // Extern Objects ------------------------------------------------------------| diff --git a/src/golan5.c b/src/golan5.c index 7839fd0..8148030 100644 --- a/src/golan5.c +++ b/src/golan5.c @@ -17,7 +17,7 @@ static jmp_buf ejmp; // // Expect // -static M_token *Expect(M_tkbuf *tb, M_tokty t) +static M_token *Expect(M_tkbuf *tb, M_toktype t) { M_token *tok = M_TokBuf_Get(tb); if(tok->type != t) { diff --git a/src/i_gui.c b/src/i_gui.c index d4a6c15..e8759a4 100644 --- a/src/i_gui.c +++ b/src/i_gui.c @@ -9,7 +9,7 @@ // // I_GUI_auto // -static void I_GUI_auto(I_gictx *g, I_objid id, int xl, int yl, int xu, int yu) +static void I_GUI_auto(I_guictx *g, I_objid id, int xl, int yl, int xu, int yu) { if(M_AABBPoint(xl, yl, xu, yu, g->cr.x, g->cr.y)) { g->hot = id; @@ -22,7 +22,7 @@ static void I_GUI_auto(I_gictx *g, I_objid id, int xl, int yl, int xu, int yu) // // I_GUI_Begin // -void I_GUI_Begin(I_gictx *g) +void I_GUI_Begin(I_guictx *g) { g->hot = 0; } @@ -30,7 +30,7 @@ void I_GUI_Begin(I_gictx *g) // // I_GUI_End // -void I_GUI_End(I_gictx *g) +void I_GUI_End(I_guictx *g) { // Set last left/right clicks. g->llc = g->lc; @@ -43,7 +43,7 @@ void I_GUI_End(I_gictx *g) // // I_GUI_ButtonFId // -bool I_GUI_ButtonFId(I_gictx *g, I_objid id, int x, int y, char const *text) +bool I_GUI_ButtonFId(I_guictx *g, I_objid id, int x, int y, char const *text) { int const xl = x , yl = y; int const xu = x + 90, yu = y + 30; diff --git a/src/i_gui.h b/src/i_gui.h index 5f3bc3e..acac9ac 100644 --- a/src/i_gui.h +++ b/src/i_gui.h @@ -12,12 +12,12 @@ // Extern Functions ----------------------------------------------------------| -void I_GUI_Begin(struct I_gictx *g); -void I_GUI_End (struct I_gictx *g); +void I_GUI_Begin(struct I_guictx *g); +void I_GUI_End (struct I_guictx *g); // Types ---------------------------------------------------------------------| -typedef struct I_gictx +typedef struct I_guictx { __prop begin {call: I_GUI_Begin(this)} __prop end {call: I_GUI_End (this)} @@ -31,10 +31,10 @@ typedef struct I_gictx bool rc, lrc; bool open; -} I_gictx; +} I_guictx; // Types ---------------------------------------------------------------------| -bool I_GUI_ButtonFId(struct I_gictx *g, I_objid id, int x, int y, char const *text); +bool I_GUI_ButtonFId(struct I_guictx *g, I_objid id, int x, int y, char const *text); #endif diff --git a/src/m_tokbuf.c b/src/m_tokbuf.c index c728bde..92bb6d0 100644 --- a/src/m_tokbuf.c +++ b/src/m_tokbuf.c @@ -113,7 +113,7 @@ M_token *M_TokBuf_ReGet(M_tkbuf *tb) // // M_TokBuf_Drop // -bool M_TokBuf_Drop(M_tkbuf *tb, M_tokty t) +bool M_TokBuf_Drop(M_tkbuf *tb, M_toktype t) { if(M_TokBuf_Get(tb)->type != t) {M_TokBuf_UnGet(tb); return false;} diff --git a/src/m_tokbuf.h b/src/m_tokbuf.h index 59d0286..4e5a6d0 100644 --- a/src/m_tokbuf.h +++ b/src/m_tokbuf.h @@ -13,7 +13,7 @@ void M_TokBuf_Dtor(struct M_tkbuf *tb); M_token *M_TokBuf_Get(struct M_tkbuf *tb); M_token *M_TokBuf_UnGet(struct M_tkbuf *tb); M_token *M_TokBuf_ReGet(struct M_tkbuf *tb); -bool M_TokBuf_Drop(struct M_tkbuf *tb, M_tokty t); +bool M_TokBuf_Drop(struct M_tkbuf *tb, M_toktype t); // Types ---------------------------------------------------------------------| diff --git a/src/m_token.h b/src/m_token.h index 46438a0..7164313 100644 --- a/src/m_token.h +++ b/src/m_token.h @@ -10,7 +10,7 @@ // Types ---------------------------------------------------------------------| -typedef enum M_tokty +typedef enum M_toktype { tok_null, // No token @@ -86,12 +86,12 @@ typedef enum M_tokty tok_eof, // End of file tok_max -} M_tokty; +} M_toktype; typedef struct M_token { - M_tokty type; - int line; + M_toktype type; + int line; M_Vec_decl(char, text); } M_token; diff --git a/src/main.c b/src/main.c index 3ede120..a69a071 100644 --- a/src/main.c +++ b/src/main.c @@ -15,9 +15,9 @@ // G_TestObj_Think // DGE_Callback -void G_TestObj_Think(G_entty const *ty, unsigned id) +void G_TestObj_Think(G_enttype const *ty, unsigned id) { - G_entit th = {id}; + G_entity th = {id}; DGE_Object_RefAdd(id); diff --git a/src/r_resdec.c b/src/r_resdec.c index b47796e..b1a4446 100644 --- a/src/r_resdec.c +++ b/src/r_resdec.c @@ -12,7 +12,7 @@ // Static Functions ----------------------------------------------------------| _Noreturn static void R_ResDec_throw (struct R_rdcst *st, char const *emsg); -static M_token *R_ResDec_expect(struct R_rdcst *st, M_tokty t, char const *exp); +static M_token *R_ResDec_expect(struct R_rdcst *st, M_toktype t, char const *exp); // Types ---------------------------------------------------------------------| @@ -39,7 +39,7 @@ _Noreturn static void R_ResDec_throw(R_rdcst *st, char const *emsg) // // R_ResDec_expect // -static M_token *R_ResDec_expect(R_rdcst *st, M_tokty t, char const *exp) +static M_token *R_ResDec_expect(R_rdcst *st, M_toktype t, char const *exp) { M_token *tok; if((tok = st->tb.get())->type != t)