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; \
|
2017-09-28 10:52:02 -07:00
|
|
|
(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 ----------------------------------------------------------|
|
|
|
|
|
2017-10-04 20:19:27 -07:00
|
|
|
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);
|
2017-09-27 18:47:18 -07:00
|
|
|
|
|
|
|
// Types ---------------------------------------------------------------------|
|
|
|
|
|
2017-10-04 20:19:27 -07:00
|
|
|
typedef struct G_frame
|
2017-09-27 18:47:18 -07:00
|
|
|
{
|
|
|
|
integ time;
|
|
|
|
M_texid sprite;
|
|
|
|
} G_frame;
|
|
|
|
|
2017-10-04 20:19:27 -07:00
|
|
|
typedef struct G_anim
|
2017-09-27 18:47:18 -07:00
|
|
|
{
|
2017-10-04 02:07:02 -07:00
|
|
|
G_frame const *frame;
|
|
|
|
msize count;
|
2017-10-04 20:19:27 -07:00
|
|
|
} G_anim;
|
2017-09-27 18:47:18 -07:00
|
|
|
|
2017-10-04 20:19:27 -07:00
|
|
|
typedef struct G_enttype
|
2017-09-27 18:47:18 -07:00
|
|
|
{
|
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;
|
2017-09-28 10:52:02 -07:00
|
|
|
mword subtype;
|
|
|
|
mword ext;
|
2017-09-27 18:47:18 -07:00
|
|
|
DGE_CallbackType task;
|
2017-10-04 20:19:27 -07:00
|
|
|
} G_enttype;
|
2017-09-27 18:47:18 -07:00
|
|
|
|
|
|
|
// Extern Functions ----------------------------------------------------------|
|
|
|
|
|
2017-10-04 20:19:27 -07:00
|
|
|
G_anim 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);
|
2017-09-28 10:52:02 -07:00
|
|
|
void G_ObjDef_AddType(char const *name, mword subtype, mword ext, DGE_CallbackType fptr);
|
2017-09-27 18:47:18 -07:00
|
|
|
|
|
|
|
#endif
|