diff --git a/game/main.c b/game/main.c index 2370fc1..3ac22ab 100644 --- a/game/main.c +++ b/game/main.c @@ -86,7 +86,7 @@ typedef struct { ivec_t animstep, svarstep, ext; dbox_t fbox; SDL_Texture *tex; -} entity_t; +} dynentity_t; typedef struct { unsigned animframes; @@ -97,11 +97,11 @@ typedef struct { typedef struct { unsigned type; ivec_t pos; -} obj_t; +} objentity_t; typedef struct { size_t n, cap; - obj_t *buf; + objentity_t *buf; } objcol_t; typedef unsigned map_t[MAPNLAYERS][MAPWIDTH][MAPHEIGHT]; @@ -114,7 +114,7 @@ typedef struct { dvec_t vpos; objtype_t objtypes[MAXOBJTYPES]; objcol_t objcol; - entity_t p; + dynentity_t p; } gamestate_t; const engineconf_t game_conf = { @@ -298,7 +298,7 @@ maploadobjects(gamestate_t *state, xmlNodePtr node, SDL_Renderer *renderer) { state->objcol.n = 0; state->objcol.cap = INITOBJCOLCAP; - state->objcol.buf = malloc(sizeof(obj_t) * state->objcol.cap); + state->objcol.buf = malloc(sizeof(objentity_t) * state->objcol.cap); assert(state->objcol.buf); node = node->xmlChildrenNode; @@ -311,10 +311,10 @@ maploadobjects(gamestate_t *state, xmlNodePtr node, SDL_Renderer *renderer) if (state->objcol.n == state->objcol.cap) { state->objcol.cap *= 2; state->objcol.buf = realloc( - state->objcol.buf, sizeof(obj_t) * state->objcol.cap); + state->objcol.buf, sizeof(objentity_t) * state->objcol.cap); assert(state->objcol.buf); } - obj_t *o = &state->objcol.buf[state->objcol.n++]; + objentity_t *o = &state->objcol.buf[state->objcol.n++]; // Load object type xmlChar *templ = xmlGetProp(node, (const xmlChar *)"template"); @@ -377,7 +377,7 @@ static void mapdraw(const gamestate_t *state, SDL_Renderer *renderer) } } -static void entityupdate(gamestate_t *state, entity_t *e, double dt) +static void entityupdate(gamestate_t *state, dynentity_t *e, double dt) { if (0 == e->speed) { // Round position to nearest integer to align with pixel grid. @@ -424,7 +424,7 @@ static void entityupdate(gamestate_t *state, entity_t *e, double dt) } static void entitydraw( - const gamestate_t *state, SDL_Renderer *renderer, const entity_t *e, + const gamestate_t *state, SDL_Renderer *renderer, const dynentity_t *e, uint64_t t) { const unsigned frame = (t / BASEANIMPERIOD) % e->animlen; @@ -447,7 +447,7 @@ static void objsdraw(const gamestate_t *state, SDL_Renderer *renderer, uint64_t t) { for (unsigned i = 0; i < state->objcol.n; ++i) { - const obj_t *obj = &state->objcol.buf[i]; + const objentity_t *obj = &state->objcol.buf[i]; assert(obj->type < MAXOBJTYPES); const objtype_t *type = &state->objtypes[obj->type]; assert(NULL != type->tex);