69 lines
1.8 KiB
C
69 lines
1.8 KiB
C
// Copyright © 2017 Project Golan, all rights reserved.
|
|
// See COPYING for more information.
|
|
#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; \
|
|
} while(0)
|
|
|
|
#define G_ObjDef_createTask(type, ...) \
|
|
(DGE_Task_Create(0, (type)->task, (type), __VA_ARGS__))
|
|
|
|
// Extern Functions ----------------------------------------------------------|
|
|
|
|
struct G_entty const *G_ObjDef_GetType(char const *name);
|
|
struct G_anima const *G_ObjDef_GetTAni(struct G_entty const *type, char const *name);
|
|
|
|
// Types ---------------------------------------------------------------------|
|
|
|
|
typedef struct G_frame // Frame
|
|
{
|
|
integ time;
|
|
M_texid sprite;
|
|
} G_frame;
|
|
|
|
typedef struct G_anima // Animation
|
|
{
|
|
G_frame const *frame;
|
|
msize count;
|
|
} G_anima;
|
|
|
|
typedef struct G_entty // Entity Type
|
|
{
|
|
__prop getAnim {call: G_ObjDef_GetTAni(this)}
|
|
|
|
M_texid sprite;
|
|
integ health;
|
|
lfrac friction;
|
|
fixed mass;
|
|
fixed rsx, rsy;
|
|
fixed sx, sy, sz;
|
|
mword subtype;
|
|
mword ext;
|
|
DGE_CallbackType task;
|
|
} G_entty;
|
|
|
|
// Extern Functions ----------------------------------------------------------|
|
|
|
|
G_anima const *G_ObjDef_GetAnim(char const *name);
|
|
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);
|
|
|
|
#endif
|