Move player code to g_player.h

master
Marrub 2017-09-27 22:26:32 -04:00
parent e4e6c07a7a
commit cc8f9f21bc
4 changed files with 38 additions and 24 deletions

View File

@ -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);

View File

@ -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 <Doominati.h>

34
src/g_player.h Normal file
View File

@ -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

View File

@ -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 <Doominati.h>
@ -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");