Fixed the game-breaking memory failure. Was a failure to free a json resource.

This commit is contained in:
2024-12-22 16:32:54 -05:00
parent ab51822caf
commit 1e0d22d4e1
2 changed files with 18 additions and 8 deletions

View File

@@ -75,7 +75,10 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
REGISTRY_CHARACTER,
"little guy",
NULL);
actorptr->state = (ACTOR_STATE_ALIVE | ACTOR_STATE_FACE_LEFT);
actorptr->state = (ACTOR_STATE_ALIVE | ACTOR_STATE_FACE_LEFT | ACTOR_STATE_MOVING_LEFT);
actorptr->x = 320;
actorptr->y = 240;
actorptr->visible = true;
} EXCEPT {
} CATCH(EXC_NULLPOINTER) {
SDL_Log("Attempting to load asset: %s (%s)", EXCLIB_EXCEPTION->description, SDL_GetError());
@@ -95,7 +98,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
return SDL_APP_FAILURE;
} FINALLY {
} ETRY;
*/
*/
TRY {
tilemap_load("../assets/tilemap.tmj", &gamemap);
@@ -105,6 +108,7 @@ SDL_AppResult SDL_AppInit(void **appstate, int argc, char *argv[])
return SDL_APP_FAILURE;
} FINALLY {
} ETRY;
camera.x = 0;
camera.y = 0;
@@ -140,9 +144,9 @@ SDL_AppResult SDL_AppIterate(void *appstate)
BITMASK_ADD(opflags.flags, ITERATOR_OP_RENDER);
for ( i = 0; i < gamemap.numlayers; i++ ) {
opflags.layerid = i;
tilemap_draw(renderer, &gamemap, &camera, i);
SDL_EnumerateProperties(REGISTRY_ACTOR, &registry_iterate_actor, (void *)&opflags);
opflags.layerid = i;
tilemap_draw(renderer, &gamemap, &camera, i);
SDL_EnumerateProperties(REGISTRY_ACTOR, &registry_iterate_actor, (void *)&opflags);
}
SDL_RenderPresent(renderer);
return SDL_APP_CONTINUE;