omi-eikyo/src/g_objdef.h

69 lines
1.8 KiB
C
Raw Normal View History

2017-09-27 18:47:18 -07:00
// Copyright © 2017 Project Golan, all rights reserved.
2017-10-04 17:14:46 -07:00
// See COPYING for more information.
2017-09-27 18:47:18 -07:00
#ifndef g_objdef_h
#define g_objdef_h
#include "m_types.h"
#include <Doominati.h>
#define G_ObjDef_setupEntity(type, th) \
do { \
(th).sprite = (type)->sprite; \
(th).health = (type)->health; \
(th).friction = (type)->friction; \
(th).mass = (type)->mass; \
(th).rsx = (type)->rsx; \
(th).rsy = (type)->rsy; \
(th).sx = (type)->sx; \
(th).sy = (type)->sy; \
(th).sz = (type)->sz; \
(th).subtype = (type)->subtype; \
2017-09-27 18:47:18 -07:00
} while(0)
#define G_ObjDef_createTask(type, ...) \
2017-10-04 02:07:02 -07:00
(DGE_Task_Create(0, (type)->task, (type), __VA_ARGS__))
2017-09-27 18:47:18 -07:00
// Extern Functions ----------------------------------------------------------|
struct G_entty const *G_ObjDef_GetType(char const *name);
2017-10-04 02:07:02 -07:00
struct G_anima const *G_ObjDef_GetTAni(struct G_entty const *type, char const *name);
2017-09-27 18:47:18 -07:00
// Types ---------------------------------------------------------------------|
typedef struct G_frame // Frame
{
integ time;
M_texid sprite;
} G_frame;
typedef struct G_anima // Animation
{
2017-10-04 02:07:02 -07:00
G_frame const *frame;
msize count;
2017-09-27 18:47:18 -07:00
} G_anima;
typedef struct G_entty // Entity Type
{
2017-10-04 02:07:02 -07:00
__prop getAnim {call: G_ObjDef_GetTAni(this)}
2017-09-27 18:47:18 -07:00
M_texid sprite;
integ health;
lfrac friction;
fixed mass;
fixed rsx, rsy;
fixed sx, sy, sz;
mword subtype;
mword ext;
2017-09-27 18:47:18 -07:00
DGE_CallbackType task;
} G_entty;
// Extern Functions ----------------------------------------------------------|
2017-10-04 02:07:02 -07:00
G_anima const *G_ObjDef_GetAnim(char const *name);
2017-09-27 18:47:18 -07:00
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);
2017-09-27 18:47:18 -07:00
#endif