diff --git a/src/levels/actions.c b/src/levels/actions.c index f976edf..1e4f573 100644 --- a/src/levels/actions.c +++ b/src/levels/actions.c @@ -170,15 +170,15 @@ bool PassLevel(struct Game *game, struct TM_Action *action, enum TM_ActionState bool Letter(struct Game *game, struct TM_Action *action, enum TM_ActionState state) { if (state == TM_ACTIONSTATE_INIT) { - action->arguments = TM_AddToArgs(action->arguments, malloc(sizeof(float))); - float* f = (float*)action->arguments->value; + float* f = (float*)malloc(sizeof(float)); *f = 0; - action->arguments = TM_AddToArgs(action->arguments, malloc(sizeof(ALLEGRO_AUDIO_STREAM*))); - ALLEGRO_AUDIO_STREAM** stream = (ALLEGRO_AUDIO_STREAM**)action->arguments->next->value; + ALLEGRO_AUDIO_STREAM** stream = (ALLEGRO_AUDIO_STREAM**)malloc(sizeof(ALLEGRO_AUDIO_STREAM*)); *stream = al_load_audio_stream(GetDataFilePath(GetLevelFilename(game, "levels/?/letter.flac")), 4, 1024); al_attach_audio_stream_to_mixer(*stream, game->audio.voice); al_set_audio_stream_playing(*stream, false); al_set_audio_stream_gain(*stream, 2.00); + action->arguments = TM_AddToArgs(action->arguments, (void*)f); + action->arguments = TM_AddToArgs(action->arguments, (void*)stream); action->arguments->next->next = NULL; } else if (state == TM_ACTIONSTATE_DESTROY) { ALLEGRO_AUDIO_STREAM** stream = (ALLEGRO_AUDIO_STREAM**)action->arguments->next->value; @@ -197,7 +197,8 @@ bool Letter(struct Game *game, struct TM_Action *action, enum TM_ActionState sta } else if ((state == TM_ACTIONSTATE_RESUME) || (state == TM_ACTIONSTATE_START)) { ALLEGRO_AUDIO_STREAM** stream = (ALLEGRO_AUDIO_STREAM**)action->arguments->next->value; al_set_audio_stream_playing(*stream, true); - } else if (state != TM_ACTIONSTATE_RUNNING) return false; + } + if (state != TM_ACTIONSTATE_RUNNING) return false; float* f = (float*)action->arguments->value; *f+=5;