Improved control map handling
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
#include <sdl3game/registry.h>
|
||||
#include <sdl3game/staticstring.h>
|
||||
#include <sdl3game/iterator.h>
|
||||
|
||||
#include <sdl3game/util.h>
|
||||
|
||||
ErrorContext *character_initialize(character *obj, char *name)
|
||||
{
|
||||
@@ -44,7 +44,7 @@ ErrorContext *character_sprite_add(character *basechar, sprite *ref, int state)
|
||||
memset(&stateval, 0x00, 32);
|
||||
SDL_itoa(state, (char *)&stateval, 10);
|
||||
SDL_SetPointerProperty(basechar->state_sprites, (char *)&stateval, ref);
|
||||
SDL_Log("Added sprite %s to character %s for state %s", (char *)&ref->name, (char *)&basechar->name, (char *)&stateval);
|
||||
SDL_Log("Added sprite %s to character %s for state %b", (char *)&ref->name, (char *)&basechar->name, state);
|
||||
ref->refcount += 1;
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
@@ -59,9 +59,9 @@ ErrorContext *character_sprite_get(character *basechar, int state, sprite **dest
|
||||
memset(&stateval, 0x00, 32);
|
||||
SDL_itoa(state, (char *)&stateval, 10);
|
||||
*dest = (sprite *)SDL_GetPointerProperty(basechar->state_sprites, (char *)&stateval, NULL);
|
||||
FAIL_ZERO_RETURN(errctx, *dest, ERR_KEY, "Sprite for state %d (%s) not found in the character's registry", state, (char *)&stateval);
|
||||
FAIL_ZERO_RETURN(errctx, *dest, ERR_KEY, "Sprite for state %d (%b) not found in the character's registry", state, state);
|
||||
target = *dest;
|
||||
SDL_Log("Sprite state %d (%s) has character %s", state, (char *)&stateval, target->name);
|
||||
//SDL_Log("Sprite state %d (%s) has character %s", state, (char *)&stateval, target->name);
|
||||
SUCCEED_RETURN(errctx);
|
||||
}
|
||||
|
||||
@@ -144,7 +144,7 @@ static ErrorContext *character_load_json_inner(json_t *json, character *obj)
|
||||
errctx,
|
||||
spriteptr,
|
||||
ERR_NULLPOINTER,
|
||||
"Character %s for state %d references sprite %s but not found in the registry",
|
||||
"Character %s for state %b references sprite %s but not found in the registry",
|
||||
tmpstr2->data,
|
||||
stateval,
|
||||
tmpstr->data
|
||||
|
||||
Reference in New Issue
Block a user