From cc8f9f21bc2c7929d5219bcd57f66f204931c9c2 Mon Sep 17 00:00:00 2001 From: Marrub Date: Wed, 27 Sep 2017 22:26:32 -0400 Subject: [PATCH] Move player code to g_player.h --- src/g_object.h | 21 --------------------- src/g_player.c | 2 +- src/g_player.h | 34 ++++++++++++++++++++++++++++++++++ src/main.c | 5 +++-- 4 files changed, 38 insertions(+), 24 deletions(-) create mode 100644 src/g_player.h diff --git a/src/g_object.h b/src/g_object.h index b3721fe..9753691 100644 --- a/src/g_object.h +++ b/src/g_object.h @@ -28,12 +28,6 @@ enum G_subty subtype_max, }; -enum -{ - G_Player_ammo, - G_Player_propN -}; - typedef struct G_entit // Entity { int id; @@ -41,23 +35,8 @@ typedef struct G_entit // Entity G_Entity_props() } G_entit; -#define G_Player_props() G_Entity_props() \ - G_Entity_propMem(G_Player_ammo, unsigned, ammo) -typedef struct G_playr // Player -{ - int id; - - G_Player_props() -} G_playr; - -// Extern Objects ------------------------------------------------------------| - -extern int G_Player_Count; - // Extern Functions ----------------------------------------------------------| -DGE_Callback void G_Player_Think(unsigned id); - void G_Entity_Create(union G_mfdat *info); void G_Sector_Create(union G_mfdat *info); diff --git a/src/g_player.c b/src/g_player.c index e1e52c7..89ac55b 100644 --- a/src/g_player.c +++ b/src/g_player.c @@ -1,6 +1,6 @@ // Copyright © 2017 Project Golan, all rights reserved. #define _GNU_SOURCE // Required for sincos(3). See feature_test_macros(7) -#include "g_object.h" +#include "g_player.h" #include diff --git a/src/g_player.h b/src/g_player.h new file mode 100644 index 0000000..77f1e72 --- /dev/null +++ b/src/g_player.h @@ -0,0 +1,34 @@ +// Copyright © 2017 Project Golan, all rights reserved. +#ifndef g_player_h +#define g_player_h + +#include "g_object.h" + +#define G_Player_propMem(t, name) G_Entity_propMem(G_Player_##name, t, name) + +// Types ---------------------------------------------------------------------| + +enum +{ + G_Player_ammo, + G_Player_propC +}; + +#define G_Player_props() G_Entity_props() \ + G_Player_propMem(unsigned, ammo) +typedef struct G_playr // Player +{ + int id; + + G_Player_props() +} G_playr; + +// Extern Objects ------------------------------------------------------------| + +extern int G_Player_Count; + +// Extern Functions ----------------------------------------------------------| + +DGE_Callback void G_Player_Think(unsigned id); + +#endif diff --git a/src/main.c b/src/main.c index d51919b..9f4972a 100644 --- a/src/main.c +++ b/src/main.c @@ -1,6 +1,7 @@ // Copyright © 2017 Project Golan, all rights reserved. -#include "g_object.h" #include "g_stage.h" +#include "g_object.h" +#include "g_player.h" #include "r_draw.h" #include @@ -27,7 +28,7 @@ void GInit(char const *resdecl) printf("Loading object function table...\n"); G_ObjDef_Init(); - G_ObjDef_loadFunc(G_Player_propN, G_Player_Think); + G_ObjDef_loadFunc(G_Player_propC, G_Player_Think); printf("Loading object definitions...\n"); G_ObjDef_Load("objdefs.dod");