diff --git a/Data/Audio/airport.ogg b/Data/Audio/airport.ogg index 9eacdae..373bc5c 100644 --- a/Data/Audio/airport.ogg +++ b/Data/Audio/airport.ogg @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:a02370fd271ebb3d3711526de3e84352d04e0cba0d9b65c051a39965d0b20ecc -size 48215 +oid sha256:66c7e4a72246bd91856fdf71b50ca906fb41eddbf92105a6cbe0dfc00da7e128 +size 34566 diff --git a/Data/Audio/church.wav b/Data/Audio/church.wav deleted file mode 100644 index c82e716..0000000 --- a/Data/Audio/church.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:503e97aa6889737e741342501067e1da87cee0c156a8f5bc49d33a028d7c0ed8 -size 2075398 diff --git a/Data/Audio/club_terry.ogg b/Data/Audio/club_terry.ogg new file mode 100644 index 0000000..3f59a1c --- /dev/null +++ b/Data/Audio/club_terry.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2db3e753a4e35ca54d2c9daa92fb901852ad347338e5a1ae772ab4c60d368d77 +size 9308 diff --git a/Data/Audio/club_terry.wav b/Data/Audio/club_terry.wav deleted file mode 100644 index 2bfe86b..0000000 --- a/Data/Audio/club_terry.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:b2ddcb74009caa5bf7d9a1fce5431bdbe4a893850f3ac6b66f878e9466abed06 -size 151820 diff --git a/Data/Audio/dog.ogg b/Data/Audio/dog.ogg new file mode 100644 index 0000000..2313a4b --- /dev/null +++ b/Data/Audio/dog.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c4cf9980a69034756d61331e4e7de6a64f918ecc2f8a4a584d7b7692f771f09d +size 9703 diff --git a/Data/Audio/dog.wav b/Data/Audio/dog.wav deleted file mode 100644 index fdb533b..0000000 --- a/Data/Audio/dog.wav +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:801cc789470f210add55b1bf057ca558b311b0635e7c6e11232fd78c9a3796d2 -size 295820 diff --git a/Data/Audio/merchant_ghost.ogg b/Data/Audio/merchant_ghost.ogg new file mode 100644 index 0000000..e1e6b74 --- /dev/null +++ b/Data/Audio/merchant_ghost.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:66afa22f9ae85cebf2fb1babd23c4c40a27e547c6942372137074c18b93e9e70 +size 21018 diff --git a/Data/Audio/merchant_gym.ogg b/Data/Audio/merchant_gym.ogg new file mode 100644 index 0000000..447ca43 --- /dev/null +++ b/Data/Audio/merchant_gym.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4459146ebf6594d01eaafb8260f2f77a8bc68c20b0b129957fa7ab2beb26098c +size 19363 diff --git a/Data/Audio/merchant_tech.ogg b/Data/Audio/merchant_tech.ogg new file mode 100644 index 0000000..1626f43 --- /dev/null +++ b/Data/Audio/merchant_tech.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2cca15996afb420afbea59ff0ffb551cea61876b85401ba67d58fd39ffa3781 +size 23084 diff --git a/Data/Audio/merchant_terry.ogg b/Data/Audio/merchant_terry.ogg new file mode 100644 index 0000000..f5b9808 --- /dev/null +++ b/Data/Audio/merchant_terry.ogg @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2462c3c4167b6015e3d97260237daf493f46110b73f76d0f2d5a77a72befeb57 +size 15768 diff --git a/feely_pona.cpp b/feely_pona.cpp index 517f106..b931b78 100644 --- a/feely_pona.cpp +++ b/feely_pona.cpp @@ -453,10 +453,12 @@ static void FP_PlayReset(FP_Game *game, TELY_Platform *platform) play->merchant_phone_company = FP_Entity_CreateMerchantPhoneCompany(game, base_top_right, "PhoneCompany"); } +#if 0 FP_Entity_CreateClubTerry(game, Dqn_V2_InitNx2(+500, -191), "Club Terry"); FP_Entity_CreateKennelTerry(game, Dqn_V2_InitNx2(-300, -191), "Kennel Terry"); FP_Entity_CreateChurchTerry(game, Dqn_V2_InitNx2(-800, -191), "Church Terry"); FP_Entity_CreateAirportTerry(game, Dqn_V2_InitNx2(-1200, -191), "Airport Terry"); +#endif play->tile_size = 37; Dqn_V2I max_tile = platform->core.window_size / play->tile_size; @@ -501,6 +503,13 @@ void TELY_DLL_Init(void *user_data) 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")); + game->audio[FP_GameAudio_Plane] = platform->func_load_audio(assets, DQN_STRING8("Plane"), DQN_STRING8("Data/Audio/airport.ogg")); + game->audio[FP_GameAudio_Club] = platform->func_load_audio(assets, DQN_STRING8("Club"), DQN_STRING8("Data/Audio/club_terry.ogg")); + game->audio[FP_GameAudio_Dog] = platform->func_load_audio(assets, DQN_STRING8("Dog"), DQN_STRING8("Data/Audio/dog.ogg")); + game->audio[FP_GameAudio_MerchantTerry] = platform->func_load_audio(assets, DQN_STRING8("Door"), DQN_STRING8("Data/Audio/merchant_terry.ogg")); + game->audio[FP_GameAudio_MerchantGhost] = platform->func_load_audio(assets, DQN_STRING8("Ghost"), DQN_STRING8("Data/Audio/merchant_ghost.ogg")); + game->audio[FP_GameAudio_MerchantGym] = platform->func_load_audio(assets, DQN_STRING8("Gym"), DQN_STRING8("Data/Audio/merchant_gym.ogg")); + game->audio[FP_GameAudio_MerchantPhone] = platform->func_load_audio(assets, DQN_STRING8("Phone"), DQN_STRING8("Data/Audio/merchant_tech.ogg")); platform->user_data = game; { @@ -1873,14 +1882,17 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input TELY_Platform_InputScanCodeIsPressed(input, TELY_PlatformInputScanCode_J)) { if (placeable_building.type == FP_EntityType_ClubTerry) { FP_Entity_CreateClubTerry(game, placement_pos, "Club Terry"); + TELY_Audio_Play(audio, game->audio[FP_GameAudio_Club], 1.f); } 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"); + TELY_Audio_Play(audio, game->audio[FP_GameAudio_Plane], 1.f); } else { DQN_ASSERT(placeable_building.type == FP_EntityType_KennelTerry); FP_Entity_CreateKennelTerry(game, placement_pos, "Kennel Terry"); + TELY_Audio_Play(audio, game->audio[FP_GameAudio_Dog], 1.f); } (*inventory_count)--; @@ -1943,12 +1955,10 @@ void FP_Update(TELY_Platform *platform, FP_Game *game, TELY_PlatformInput *input entity->terry_mobile_data_plan_cap); // NOTE: Recover hp & stamina - entity->stamina = DQN_MIN(entity->stamina + 1, entity->stamina_cap); + entity->stamina = DQN_MIN(entity->stamina + 0.25f, entity->stamina_cap); - if (entity->flags & FP_GameEntityFlag_RecoversHP) { - if (game->play.update_counter % 12 == 0) { - entity->hp = DQN_MIN(entity->hp + 1, entity->hp_cap); - } + if (game->play.update_counter % 12 == 0) { + entity->hp = DQN_MIN(entity->hp + 0.75f, entity->hp_cap); } // NOTE: Derive dynmamic bounding boxes ==================================================== @@ -2470,6 +2480,7 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer, FP_GameEntity *player = FP_Game_GetEntity(game, game->play.player); Dqn_V2 player_pos = FP_Game_CalcEntityWorldPos(game, game->play.player); { + static bool sound_played_flags[4] = {false, false, false, false}; FP_GameInventory *invent = &player->inventory; struct FP_MerchantToMenuMapping { FP_GameEntityHandle merchant; @@ -2479,11 +2490,13 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer, uint8_t *inventory_count; uint32_t *building_base_price; uint32_t *upgrade_base_price; + FP_GameAudio audio_type; + bool *sound_played; } merchants[] = { - {game->play.merchant_terry, g_anim_names.merchant_terry_menu, g_anim_names.club_terry_dark, Dqn_V2_InitNx2(0.015f, +0.04f), &invent->clubs, &invent->clubs_base_price, &invent->health_base_price}, - {game->play.merchant_graveyard, g_anim_names.merchant_graveyard_menu, g_anim_names.church_terry_dark, Dqn_V2_InitNx2(0.04f, -0.15f), &invent->churchs, &invent->churchs_base_price, &invent->stamina_base_price}, - {game->play.merchant_gym, g_anim_names.merchant_gym_menu, g_anim_names.kennel_terry, Dqn_V2_InitNx2(0, +0), &invent->kennels, &invent->kennels_base_price, &invent->attack_base_price}, - {game->play.merchant_phone_company, g_anim_names.merchant_phone_company_menu, g_anim_names.airport_terry, Dqn_V2_InitNx2(0, -0.1f), &invent->airports, &invent->airports_base_price, &invent->mobile_plan_base_price}, + {game->play.merchant_terry, g_anim_names.merchant_terry_menu, g_anim_names.club_terry_dark, Dqn_V2_InitNx2(0.015f, +0.04f), &invent->clubs, &invent->clubs_base_price, &invent->health_base_price, FP_GameAudio_MerchantTerry, &sound_played_flags[0]}, + {game->play.merchant_graveyard, g_anim_names.merchant_graveyard_menu, g_anim_names.church_terry_dark, Dqn_V2_InitNx2(0.04f, -0.15f), &invent->churchs, &invent->churchs_base_price, &invent->stamina_base_price, FP_GameAudio_MerchantGhost, &sound_played_flags[1]}, + {game->play.merchant_gym, g_anim_names.merchant_gym_menu, g_anim_names.kennel_terry, Dqn_V2_InitNx2(0, +0), &invent->kennels, &invent->kennels_base_price, &invent->attack_base_price, FP_GameAudio_MerchantGym, &sound_played_flags[2]}, + {game->play.merchant_phone_company, g_anim_names.merchant_phone_company_menu, g_anim_names.airport_terry, Dqn_V2_InitNx2(0, -0.1f), &invent->airports, &invent->airports_base_price, &invent->mobile_plan_base_price, FP_GameAudio_MerchantPhone, &sound_played_flags[3]}, }; bool activated_merchant = false; @@ -2492,8 +2505,10 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer, Dqn_V2 world_pos = FP_Game_CalcEntityWorldPos(game, merchant_handle); Dqn_f32 dist_squared = Dqn_V2_LengthSq_V2x2(world_pos, player_pos); - if (dist_squared > DQN_SQUARED(FP_Game_MetersToPixelsNx1(game->play, 4))) + if (dist_squared > DQN_SQUARED(FP_Game_MetersToPixelsNx1(game->play, 4))) { + *mapping.sound_played = false; continue; + } // NOTE: Render animated merchant menu ============================= activated_merchant = true; @@ -2524,6 +2539,11 @@ void FP_Render(FP_Game *game, TELY_Platform *platform, TELY_Renderer *renderer, Dqn_V2_Zero /*rotate origin*/, 0.f /*rotation*/, TELY_COLOUR_WHITE_V4); + + if (activated_merchant && !*mapping.sound_played) { + TELY_Audio_Play(audio, game->audio[mapping.audio_type], 1.f); + *mapping.sound_played = true; + } } TELY_Render_PushColourV4(renderer, TELY_COLOUR_WHITE_V4); diff --git a/feely_pona_game.h b/feely_pona_game.h index 78bcc90..b395b50 100644 --- a/feely_pona_game.h +++ b/feely_pona_game.h @@ -265,6 +265,13 @@ enum FP_GameAudio FP_GameAudio_Woosh, FP_GameAudio_Ching, FP_GameAudio_Church, + FP_GameAudio_Plane, + FP_GameAudio_Club, + FP_GameAudio_Dog, + FP_GameAudio_MerchantTerry, + FP_GameAudio_MerchantGhost, + FP_GameAudio_MerchantGym, + FP_GameAudio_MerchantPhone, FP_GameAudio_Count, };