// 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 #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).cr = (type)->cr; \ (th).cg = (type)->cg; \ (th).cb = (type)->cb; \ (th).ca = (type)->ca; \ (th).subtype = (type)->subtype; \ } while(0) #define G_ObjDef_createTask(type, ...) \ (DGE_Task_Create(0, (type)->task, (type), __VA_ARGS__)) // Extern Functions ----------------------------------------------------------| 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); // Types ---------------------------------------------------------------------| typedef struct G_frame { integ time; M_texid sprite; } G_frame; typedef struct G_anim { G_frame const *frame; msize count; } G_anim; typedef struct G_enttype { __prop getAnim {call: G_ObjDef_GetTAni(this)} M_texid sprite; integ health; lfrac friction; fixed mass; fixed rsx, rsy; fixed sx, sy, sz; ulfra cr, cg, cb, ca; mword subtype; mword ext; DGE_CallbackType task; } G_enttype; // Extern Functions ----------------------------------------------------------| G_anim 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