From 2102ffa094c43cce33817209be56a1d350d1f292 Mon Sep 17 00:00:00 2001 From: Joshalosh Date: Sun, 8 Oct 2023 16:21:39 +1100 Subject: [PATCH] fp: Add more sfx --- Data/Audio/ching.ogg | 4 ++-- Data/Audio/church.ogg | 3 +++ Data/Audio/woosh.ogg | 3 +++ Data/Audio/woosh.wav | 3 --- feely_pona.cpp | 16 ++++++++++++---- feely_pona_entity_create.cpp | 2 +- feely_pona_game.h | 3 +++ 7 files changed, 24 insertions(+), 10 deletions(-) create mode 100644 Data/Audio/church.ogg create mode 100644 Data/Audio/woosh.ogg delete mode 100644 Data/Audio/woosh.wav diff --git a/Data/Audio/ching.ogg b/Data/Audio/ching.ogg index cdf4800..809debe 100644 --- a/Data/Audio/ching.ogg +++ b/Data/Audio/ching.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a10aa522b38369df3429bff0e46a4ef13e4c2110bce0afb29396ed4907a3cced -size 55857 +oid sha256:cf1553666cdd8039453453d26fbadb602826722b0a4a8291d9104da3d1cab34c +size 34345 diff --git a/Data/Audio/church.ogg b/Data/Audio/church.ogg new file mode 100644 index 0000000..13a51de --- /dev/null +++ b/Data/Audio/church.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8b179b02d519e900ffb852adee386ffbcd3c4063763151047f5f2420aeec1bcf +size 85382 diff --git a/Data/Audio/woosh.ogg b/Data/Audio/woosh.ogg new file mode 100644 index 0000000..91947e7 --- /dev/null +++ b/Data/Audio/woosh.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:69843e9c3dae5ee24bb3b11385626d73a261262d7ca1972eba73d8b9644a96a3 +size 17114 diff --git a/Data/Audio/woosh.wav b/Data/Audio/woosh.wav deleted file mode 100644 index af40b9b..0000000 --- a/Data/Audio/woosh.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:06cb81f3ca402a34a79829859d47e60e3e03917c893c008c3eb993e6ed5feddb -size 989726 diff --git a/feely_pona.cpp b/feely_pona.cpp index d6d5f95..6d2fba9 100644 --- a/feely_pona.cpp +++ b/feely_pona.cpp @@ -522,6 +522,10 @@ void TELY_DLL_Init(void *user_data) game->audio[FP_GameAudio_TestAudio] = platform->func_load_audio(assets, DQN_STRING8("Test Audio"), DQN_STRING8("Data/Audio/Purrple Cat - Moonwinds.qoa")); game->audio[FP_GameAudio_TerryHit] = platform->func_load_audio(assets, DQN_STRING8("Terry Hit"), DQN_STRING8("Data/Audio/terry_hit.ogg")); game->audio[FP_GameAudio_Smooch] = platform->func_load_audio(assets, DQN_STRING8("Smooch"), DQN_STRING8("Data/Audio/smooch.mp3")); + game->audio[FP_GameAudio_Woosh] = platform->func_load_audio(assets, DQN_STRING8("Woosh"), DQN_STRING8("Data/Audio/woosh.ogg")); + game->audio[FP_GameAudio_Woosh] = platform->func_load_audio(assets, DQN_STRING8("Woosh"), DQN_STRING8("Data/Audio/woosh.ogg")); + game->audio[FP_GameAudio_Ching] = platform->func_load_audio(assets, DQN_STRING8("Ching"), DQN_STRING8("Data/Audio/ching.ogg")); + game->audio[FP_GameAudio_Church] = platform->func_load_audio(assets, DQN_STRING8("Church"), DQN_STRING8("Data/Audio/church.ogg")); } struct FP_GetClosestPortalMonkeyResult @@ -701,6 +705,7 @@ void FP_EntityActionStateMachine(FP_Game *game, TELY_Audio *audio, TELY_Platform *acceleration_meters_per_s *= 35.f; entity->stamina -= FP_TERRY_DASH_STAMINA_COST; + TELY_Audio_Play(audio, game->audio[FP_GameAudio_Woosh], 1.f); #if 0 FP_GameRenderSprite *cosmetic_sprite = Dqn_FArray_Make(&entity->extra_cosmetic_anims, Dqn_ZeroMem_Yes); @@ -1344,7 +1349,7 @@ void FP_EntityActionStateMachine(FP_Game *game, TELY_Audio *audio, TELY_Platform } } -void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input) +void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input, TELY_Audio *audio) { Dqn_Profiler_ZoneScopeWithIndex("FP_Update", FP_ProfileZone_FPUpdate); @@ -1858,6 +1863,7 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input FP_Entity_CreateClubTerry(game, placement_pos, "Club Terry"); } else if (placeable_building.type == FP_EntityType_ChurchTerry) { FP_Entity_CreateChurchTerry(game, placement_pos, "Church Terry"); + TELY_Audio_Play(audio, game->audio[FP_GameAudio_Church], 1.f); } else if (placeable_building.type == FP_EntityType_AirportTerry) { FP_Entity_CreateAirportTerry(game, placement_pos, "Airport Terry"); } else { @@ -2084,7 +2090,7 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input Dqn_Profiler_EndZone(update_zone); } -void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer) +void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer, TELY_Audio *audio) { Dqn_Profiler_ZoneScopeWithIndex("FP_Render", FP_ProfileZone_FPRender); TELY_PlatformInput *input = &platform->input; @@ -2486,6 +2492,7 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer) if (game->clock_ms > game->player_trigger_purchase_building_timestamp) { if (mapping.inventory_count) { player->coins -= *mapping.building_base_price; + TELY_Audio_Play(audio, game->audio[FP_GameAudio_Ching], 1.f); *mapping.building_base_price *= 2; // NOTE: Raise the prices of everything else @@ -2572,6 +2579,7 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer) if (game->clock_ms > game->player_trigger_purchase_upgrade_timestamp) { player->coins -= *mapping.upgrade_base_price; *mapping.upgrade_base_price *= 2; + TELY_Audio_Play(audio, game->audio[FP_GameAudio_Ching], 1.f); if (mapping.merchant == game->merchant_terry) { // TODO(doyle): Attack damage? Or increase attack range? @@ -3111,10 +3119,10 @@ void TELY_DLL_FrameUpdate(void *user_data) for (game->delta_s_accumulator += DQN_CAST(Dqn_f32)input->delta_s; game->delta_s_accumulator > PHYSICS_STEP; game->delta_s_accumulator -= PHYSICS_STEP) { - FP_Update(platform, game, input); + FP_Update(platform, game, input, audio); } - FP_Render(game, platform, renderer); + FP_Render(game, platform, renderer, audio); TELY_RFui_Flush(rfui, renderer, input, assets); TELY_Audio_MixPlaybackSamples(audio, assets); diff --git a/feely_pona_entity_create.cpp b/feely_pona_entity_create.cpp index 69709b0..754e31d 100644 --- a/feely_pona_entity_create.cpp +++ b/feely_pona_entity_create.cpp @@ -459,7 +459,7 @@ static FP_GameEntityHandle FP_Entity_CreateTerry(FP_Game *game, Dqn_V2 pos, DQN_ entity->local_hit_box_size = FP_Game_MetersToPixelsNx2(game, 0.5f, entity->sprite_height.meters * .6f); entity->hp_cap = FP_DEFAULT_DAMAGE * 3; entity->hp = entity->hp_cap; - entity->coins = 0;//1'000'000; + entity->coins = 1'000'000; FP_Entity_AddDebugEditorFlags(game, result); entity->flags |= FP_GameEntityFlag_NonTraversable; entity->flags |= FP_GameEntityFlag_Attackable; diff --git a/feely_pona_game.h b/feely_pona_game.h index bf81507..293a482 100644 --- a/feely_pona_game.h +++ b/feely_pona_game.h @@ -260,6 +260,9 @@ enum FP_GameAudio FP_GameAudio_TestAudio, FP_GameAudio_TerryHit, FP_GameAudio_Smooch, + FP_GameAudio_Woosh, + FP_GameAudio_Ching, + FP_GameAudio_Church, FP_GameAudio_Count, };