actor_logic_changeframe was allowing frame counters to increment out of control leading to unpredictable behavior when changing state, animations would be outside their frame range

This commit is contained in:
2025-08-09 08:54:12 -04:00
parent e20752a97e
commit 93bc3addfe
3 changed files with 26 additions and 18 deletions

View File

@@ -9,19 +9,19 @@
ErrorContext *load_start_bgm(char *fname)
{
PREPARE_ERROR(errctx);
string *tmpstr = NULL;
//string *tmpstr = NULL;
MIX_Track *bgmtrack = NULL;
SDL_PropertiesID bgmprops = 0;
ATTEMPT {
FAIL_ZERO_BREAK(errctx, fname, ERR_NULLPOINTER, "load_start_bgm received NULL filename");
CATCH(errctx, heap_next_string(&tmpstr));
CATCH(errctx, string_initialize(tmpstr, NULL));
//CATCH(errctx, heap_next_string(&tmpstr));
//CATCH(errctx, string_initialize(tmpstr, NULL));
SDL_snprintf((char *)&tmpstr->data, MAX_STRING_LENGTH, "%s%s", SDL_GetBasePath(), fname);
SDL_Log("Loading music asset from %s", (char *)&tmpstr->data);
bgm = MIX_LoadAudio(game.mixer, (char *)&tmpstr->data, true);
FAIL_ZERO_BREAK(errctx, bgm, ERR_NULLPOINTER, "Failed to load music asset %s : %s", (char *)&tmpstr->data, SDL_GetError());
//SDL_snprintf((char *)&tmpstr->data, MAX_STRING_LENGTH, "%s%s", SDL_GetBasePath(), fname);
SDL_Log("Loading music asset from %s", fname);
bgm = MIX_LoadAudio(game.mixer, fname, true);
FAIL_ZERO_BREAK(errctx, bgm, ERR_NULLPOINTER, "Failed to load music asset %s : %s", fname, SDL_GetError());
bgmtrack = MIX_CreateTrack(game.mixer);
FAIL_ZERO_BREAK(errctx, bgmtrack, ERR_NULLPOINTER, "Failed to create audio track for background music: %s", SDL_GetError());
@@ -41,7 +41,7 @@ ErrorContext *load_start_bgm(char *fname)
FAIL_BREAK(errctx, ERR_SDL, "Failed to play music asset %s", fname);
}
} CLEANUP {
IGNORE(heap_release_string(tmpstr));
//IGNORE(heap_release_string(tmpstr));
if ( errctx != NULL ) {
if ( errctx->status != 0 && bgm != NULL) {
MIX_DestroyAudio(bgm);