diff --git a/Adventures in Lestoria/Adventures in Lestoria.tiled-project b/Adventures in Lestoria/Adventures in Lestoria.tiled-project index d112b4a3..698ed73e 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.tiled-project +++ b/Adventures in Lestoria/Adventures in Lestoria.tiled-project @@ -8,6 +8,17 @@ "." ], "propertyTypes": [ + { + "id": 27, + "name": "BGM", + "storageType": "string", + "type": "enum", + "values": [ + "None", + "foresty_1_1" + ], + "valuesAsFlags": false + }, { "color": "#ff290aa4", "drawFill": true, @@ -160,6 +171,12 @@ "drawFill": true, "id": 19, "members": [ + { + "name": "Background Music", + "propertyType": "BGM", + "type": "string", + "value": "None" + }, { "name": "Level Type", "propertyType": "LevelType", diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index 428f4d2b..32375e2e 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -642,6 +642,8 @@ + + diff --git a/Adventures in Lestoria/Audio.cpp b/Adventures in Lestoria/Audio.cpp index 400a070c..473f1266 100644 --- a/Adventures in Lestoria/Audio.cpp +++ b/Adventures in Lestoria/Audio.cpp @@ -43,4 +43,18 @@ INCLUDE_game MiniAudio&Audio::Engine(){ return game->audioEngine.audioEngine; +} +void Audio::Play(const std::string_view sound){ + Engine().Play(std::string(sound)); +}; +void Audio::PlayBGM(const std::string_view sound,const bool loop=true){ + if(Engine().LoadS) + Engine().Play(std::string(sound)); +}; + +std::string operator""_SFX(const char*key,size_t length){ + return "sfx_directory"_S+std::string(key,length); +} +std::string operator""_BGM(const char*key,size_t length){ + return "bgm_directory"_S+std::string(key,length); } \ No newline at end of file diff --git a/Adventures in Lestoria/Audio.h b/Adventures in Lestoria/Audio.h index d5a9a2a3..cde143d5 100644 --- a/Adventures in Lestoria/Audio.h +++ b/Adventures in Lestoria/Audio.h @@ -37,9 +37,21 @@ All rights reserved. #pragma endregion #pragma once #include "olcPGEX_MiniAudio.h" +#include "config.h" class Audio{ + class BGM{ + std::vectorchannels; + public: + Load(); + Unload(); + }; MiniAudio audioEngine; public: static MiniAudio&Engine(); -}; \ No newline at end of file + static void Play(const std::string_view sound); + static void PlayBGM(const std::string_view sound,const bool loop=true); +}; + +std::string operator""_SFX(const char*key,size_t length); +std::string operator""_BGM(const char*key,size_t length); \ No newline at end of file diff --git a/Adventures in Lestoria/State_OverworldMap.cpp b/Adventures in Lestoria/State_OverworldMap.cpp index f92ec5a7..bbc062c4 100644 --- a/Adventures in Lestoria/State_OverworldMap.cpp +++ b/Adventures in Lestoria/State_OverworldMap.cpp @@ -47,6 +47,7 @@ All rights reserved. #include "VisualNovel.h" #include "State_OverworldMap.h" #include "SaveFile.h" +#include "Audio.h" INCLUDE_MONSTER_LIST INCLUDE_game @@ -106,7 +107,7 @@ void State_OverworldMap::OnUserUpdate(AiL*game){ } if(game->GetKey(K1).bPressed){ - Audio::Engine().Play("sfx_directory"_S+"sfx100v2_loop_water_01.mp3"); + Audio::Play("sfx100v2_loop_water_01.mp3"_SFX); } #pragma region Handle Connection Point Clicking and Movement diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index b27ae199..23338e9d 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 0 #define VERSION_MINOR 2 #define VERSION_PATCH 1 -#define VERSION_BUILD 5350 +#define VERSION_BUILD 5353 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx index 2d6de9ef..97fbaf70 100644 --- a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx +++ b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx @@ -1,6 +1,7 @@ + diff --git a/Adventures in Lestoria/assets/config/bgm/bgm.txt b/Adventures in Lestoria/assets/config/bgm/bgm.txt new file mode 100644 index 00000000..c460ae08 --- /dev/null +++ b/Adventures in Lestoria/assets/config/bgm/bgm.txt @@ -0,0 +1,25 @@ +#Song title followed by filenames for individual parts +foresty1_1 +{ + # High + channel[0]=foresty1_1_1.mp3 + # Low + channel[1]=foresty1_1_2.mp3 + + # Underwater High + channel[2]=foresty1_1_alt1.mp3 + # Underwater Low + channel[3]=foresty1_1_alt2.mp3 + + Default Volume = 70%,50%,0%,0% + + # Transition time between one phase to the next. + Fade Speed = 2.0 + + Events + { + LowHealth = 50%,60%,20%,20% + InCombat = 90%,100%,0%,0% + Underwater = 0%,0%,100%,100% + } +} \ No newline at end of file diff --git a/Adventures in Lestoria/assets/config/bgm/events.txt b/Adventures in Lestoria/assets/config/bgm/events.txt new file mode 100644 index 00000000..8d8104ca --- /dev/null +++ b/Adventures in Lestoria/assets/config/bgm/events.txt @@ -0,0 +1,6 @@ +Events +{ + LowHealth = "Occurs when the player is low in health." + InCombat = "Occurs when the player is in combat." + Underwater = "Occurs when the player is in water." +} \ No newline at end of file diff --git a/Adventures in Lestoria/assets/config/configuration.txt b/Adventures in Lestoria/assets/config/configuration.txt index 23ae32ad..f4ba22c5 100644 --- a/Adventures in Lestoria/assets/config/configuration.txt +++ b/Adventures in Lestoria/assets/config/configuration.txt @@ -65,6 +65,12 @@ sfx_directory = assets/sounds/ # Path to bgm files bgm_directory = assets/music/ +# Path to bgm configuration +bgm_config = bgm.txt + +# Path to bgm events configuration +event_config = events.txt + # Path to character images character_image_location = characters/ diff --git a/Adventures in Lestoria/assets/music/foresty1_1_1.mp3 b/Adventures in Lestoria/assets/music/foresty1_1_1.mp3 new file mode 100644 index 00000000..8c60a499 Binary files /dev/null and b/Adventures in Lestoria/assets/music/foresty1_1_1.mp3 differ diff --git a/Adventures in Lestoria/assets/music/foresty1_1_2.mp3 b/Adventures in Lestoria/assets/music/foresty1_1_2.mp3 new file mode 100644 index 00000000..61d1e877 Binary files /dev/null and b/Adventures in Lestoria/assets/music/foresty1_1_2.mp3 differ diff --git a/Adventures in Lestoria/assets/music/foresty1_1_alt1.mp3 b/Adventures in Lestoria/assets/music/foresty1_1_alt1.mp3 new file mode 100644 index 00000000..d4363b1a Binary files /dev/null and b/Adventures in Lestoria/assets/music/foresty1_1_alt1.mp3 differ diff --git a/Adventures in Lestoria/assets/music/foresty1_1_alt2.mp3 b/Adventures in Lestoria/assets/music/foresty1_1_alt2.mp3 new file mode 100644 index 00000000..301d81f9 Binary files /dev/null and b/Adventures in Lestoria/assets/music/foresty1_1_alt2.mp3 differ