Browse Source

Move player code to g_player.h

master
Marrub 5 years ago
parent
commit
cc8f9f21bc
  1. 21
      src/g_object.h
  2. 2
      src/g_player.c
  3. 34
      src/g_player.h
  4. 5
      src/main.c

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

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

34
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

5
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 <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");

Loading…
Cancel
Save