diff --git a/External/tely b/External/tely index 63cd4aa..fd7afc7 160000 --- a/External/tely +++ b/External/tely @@ -1 +1 @@ -Subproject commit 63cd4aa4a04ec3adadf9778bd01d7e2a2ba04794 +Subproject commit fd7afc792253e4324c56e0113669d16ca9118eca diff --git a/feely_pona.cpp b/feely_pona.cpp index 55ba3ff..b981096 100644 --- a/feely_pona.cpp +++ b/feely_pona.cpp @@ -374,7 +374,7 @@ void TELY_DLL_Init(void *user_data) game->audio[FP_GameAudio_TerryHit] = platform->func_load_audio(assets, DQN_STRING8("Terry Hit"), DQN_STRING8("Data/Audio/terry_hit.ogg")); } -void FP_EntityActionStateMachine(FP_Game *game, TELY_PlatformInput *input, FP_GameEntity *entity, Dqn_V2 dir_vector) +void FP_EntityActionStateMachine(FP_Game *game, TELY_Audio *audio, TELY_PlatformInput *input, FP_GameEntity *entity, Dqn_V2 dir_vector) { FP_GameEntityAction *action = &entity->action; bool const we_are_clicked_entity = entity->handle == game->clicked_entity; @@ -505,8 +505,8 @@ void FP_EntityActionStateMachine(FP_Game *game, TELY_PlatformInput *input, FP_Ga // NOTE: Adding an attack_processed bool to make sure things only fire once if (!entity->attack_processed && game->clock_ms >= midpoint_clock_ms) { entity->attack_box_size = entity->local_hit_box_size; + TELY_Audio_Play(audio, game->audio[FP_GameAudio_TerryHit], 1.f); - FP_EnqueueSound(game, game->audio[FP_GameAudio_TerryHit], 1.0f); // NOTE: Position the attack box switch (entity->direction) { case FP_GameDirection_Left: { @@ -1219,7 +1219,7 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input FP_Game_MoveEntity(game, entity->handle, acceleration_meters_per_s); // NOTE: Tick the state machine - FP_EntityActionStateMachine(game, input, entity, dir_vector); + FP_EntityActionStateMachine(game, &platform->audio, input, entity, dir_vector); if (game->clicked_entity == entity->handle) { if (TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_F1)) { @@ -1630,21 +1630,11 @@ void TELY_DLL_FrameUpdate(void *user_data) TELY_Audio *audio = &platform->audio; - // NOTE: Process the sound command queue - for (uint32_t i = 0; i < game->sound_command_count; i++) - { - FP_SoundCommand *sound_command = &game->sound_commands[i]; - TELY_Audio_Play(audio, sound_command->audio_handle, sound_command->volume); - } - - // NOTE: Clear the sound command queue for the next frame - game->sound_command_count = 0; - -#if 0 + #if 0 if (audio->playback_size == 0) { TELY_Audio_Play(audio, game->audio[FP_GameAudio_TestAudio], 1.f /*volume*/); } -#endif + #endif // ============================================================================================= diff --git a/feely_pona_game.cpp b/feely_pona_game.cpp index c79e615..7e84ca5 100644 --- a/feely_pona_game.cpp +++ b/feely_pona_game.cpp @@ -715,11 +715,3 @@ FP_GameFindClosestEntityResult FP_Game_FindClosestEntityWithType(FP_Game *game, return result; } - -static void FP_EnqueueSound(FP_Game *game, TELY_AssetAudioHandle audio_handle, Dqn_f32 volume) -{ - DQN_ASSERT(game->sound_command_count < MAX_SOUNDS); - FP_SoundCommand *sound_command = &game->sound_commands[game->sound_command_count++]; - sound_command->audio_handle = audio_handle; - sound_command->volume = volume; -} diff --git a/feely_pona_game.h b/feely_pona_game.h index a33f90e..d8b143a 100644 --- a/feely_pona_game.h +++ b/feely_pona_game.h @@ -208,13 +208,6 @@ enum FP_GameAudio FP_GameAudio_Count, }; -struct FP_SoundCommand -{ - TELY_AssetAudioHandle audio_handle; - float volume; -}; - -const uint32_t MAX_SOUNDS = 128; struct FP_Game { Dqn_f32 delta_s_accumulator; @@ -225,9 +218,6 @@ struct FP_Game TELY_AssetFontHandle jetbrains_mono_font; TELY_AssetAudioHandle audio[FP_GameAudio_Count]; - FP_SoundCommand sound_commands[MAX_SOUNDS]; - uint32_t sound_command_count; - Dqn_Slice hero_sprite_anims; TELY_AssetSpriteSheet hero_sprite_sheet; Dqn_FArray parent_entity_stack;