Commit 52438b55 authored by nanahira's avatar nanahira

Merge branch 'develop' into another-develop

parents aa120375 7aa57f1f
...@@ -1934,7 +1934,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -1934,7 +1934,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_AUDIO
case CHECKBOX_ENABLE_MUSIC: { case CHECKBOX_ENABLE_MUSIC: {
if(!mainGame->chkEnableMusic->isChecked()) if(!mainGame->chkEnableMusic->isChecked())
soundManager.StopBGM(); soundManager.StopBGM();
...@@ -2053,7 +2053,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) { ...@@ -2053,7 +2053,7 @@ bool ClientField::OnCommonEvent(const irr::SEvent& event) {
return true; return true;
break; break;
} }
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_AUDIO
case SCROLL_VOLUME: { case SCROLL_VOLUME: {
mainGame->gameConf.sound_volume = (double)mainGame->scrSoundVolume->getPos() / 100; mainGame->gameConf.sound_volume = (double)mainGame->scrSoundVolume->getPos() / 100;
mainGame->gameConf.music_volume = (double)mainGame->scrMusicVolume->getPos() / 100; mainGame->gameConf.music_volume = (double)mainGame->scrMusicVolume->getPos() / 100;
......
...@@ -1572,7 +1572,7 @@ bool Game::LoadConfigFromFile(const char* file) { ...@@ -1572,7 +1572,7 @@ bool Game::LoadConfigFromFile(const char* file) {
gameConf.window_height = strtol(valbuf, nullptr, 10); gameConf.window_height = strtol(valbuf, nullptr, 10);
} else if(!std::strcmp(strbuf, "resize_popup_menu")) { } else if(!std::strcmp(strbuf, "resize_popup_menu")) {
gameConf.resize_popup_menu = strtol(valbuf, nullptr, 10) > 0; gameConf.resize_popup_menu = strtol(valbuf, nullptr, 10) > 0;
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_AUDIO
} else if(!std::strcmp(strbuf, "enable_sound")) { } else if(!std::strcmp(strbuf, "enable_sound")) {
gameConf.enable_sound = strtol(valbuf, nullptr, 10) > 0; gameConf.enable_sound = strtol(valbuf, nullptr, 10) > 0;
} else if(!std::strcmp(strbuf, "sound_volume")) { } else if(!std::strcmp(strbuf, "sound_volume")) {
...@@ -1813,7 +1813,7 @@ void Game::SaveConfig() { ...@@ -1813,7 +1813,7 @@ void Game::SaveConfig() {
fprintf(fp, "window_width = %d\n", gameConf.window_width); fprintf(fp, "window_width = %d\n", gameConf.window_width);
fprintf(fp, "window_height = %d\n", gameConf.window_height); fprintf(fp, "window_height = %d\n", gameConf.window_height);
fprintf(fp, "resize_popup_menu = %d\n", gameConf.resize_popup_menu ? 1 : 0); fprintf(fp, "resize_popup_menu = %d\n", gameConf.resize_popup_menu ? 1 : 0);
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_AUDIO
fprintf(fp, "enable_sound = %d\n", (chkEnableSound->isChecked() ? 1 : 0)); fprintf(fp, "enable_sound = %d\n", (chkEnableSound->isChecked() ? 1 : 0));
fprintf(fp, "enable_music = %d\n", (chkEnableMusic->isChecked() ? 1 : 0)); fprintf(fp, "enable_music = %d\n", (chkEnableMusic->isChecked() ? 1 : 0));
fprintf(fp, "#Volume of sound and music, between 0 and 100\n"); fprintf(fp, "#Volume of sound and music, between 0 and 100\n");
...@@ -2044,7 +2044,7 @@ void Game::initUtils() { ...@@ -2044,7 +2044,7 @@ void Game::initUtils() {
FileSystem::MakeDir("textures/cover2"); FileSystem::MakeDir("textures/cover2");
FileSystem::MakeDir("textures/pscale"); FileSystem::MakeDir("textures/pscale");
//sound //sound
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_AUDIO
FileSystem::MakeDir("sound"); FileSystem::MakeDir("sound");
FileSystem::MakeDir("sound/BGM"); FileSystem::MakeDir("sound/BGM");
FileSystem::MakeDir("sound/BGM/advantage"); FileSystem::MakeDir("sound/BGM/advantage");
......
This diff is collapsed.
This diff is collapsed.
project "cminiaudio"
kind "StaticLib"
files { "*.c", "*.h" }
filter "system:linux"
links { "dl", "pthread", "m" }
include "lzma/." include "lzma/."
include "spmemvfs/." include "spmemvfs/."
if USE_AUDIO then
include "miniaudio/."
end
project "YGOPro" project "YGOPro"
kind "WindowedApp" kind "WindowedApp"
...@@ -7,13 +10,6 @@ project "YGOPro" ...@@ -7,13 +10,6 @@ project "YGOPro"
files { "*.cpp", "*.h", "CGUISkinSystem/*.cpp", "CGUISkinSystem/*.h", "CXMLRegistry/*.cpp", "CXMLRegistry/*.h" } files { "*.cpp", "*.h", "CGUISkinSystem/*.cpp", "CGUISkinSystem/*.h", "CXMLRegistry/*.cpp", "CXMLRegistry/*.h" }
includedirs { "../ocgcore" } includedirs { "../ocgcore" }
links { "ocgcore", "clzma", "cspmemvfs", LUA_LIB_NAME, "sqlite3", "irrlicht", "freetype", "event" } links { "ocgcore", "clzma", "cspmemvfs", LUA_LIB_NAME, "sqlite3", "irrlicht", "freetype", "event" }
if BUILD_IKPMP3 then
links { "ikpmp3" }
end
if BUILD_IKPMP3 then
links { "ikpmp3" }
end
if BUILD_EVENT then if BUILD_EVENT then
includedirs { "../event/include" } includedirs { "../event/include" }
...@@ -43,29 +39,15 @@ project "YGOPro" ...@@ -43,29 +39,15 @@ project "YGOPro"
libdirs { SQLITE_LIB_DIR } libdirs { SQLITE_LIB_DIR }
end end
if USE_IRRKLANG then if USE_AUDIO then
defines { "YGOPRO_USE_IRRKLANG" } defines { "YGOPRO_USE_AUDIO" }
includedirs { IRRKLANG_INCLUDE_DIR } links { "cminiaudio" }
if not IRRKLANG_PRO then
libdirs { IRRKLANG_LIB_DIR }
end
end end
filter "system:windows" filter "system:windows"
defines { "_IRR_WCHAR_FILESYSTEM" } defines { "_IRR_WCHAR_FILESYSTEM" }
files "ygopro.rc" files "ygopro.rc"
libdirs { "$(DXSDK_DIR)Lib/x86" } libdirs { "$(DXSDK_DIR)Lib/x86" }
if USE_IRRKLANG then
links { "irrKlang" }
if IRRKLANG_PRO then
defines { "IRRKLANG_STATIC" }
filter { "not configurations:Debug" }
libdirs { IRRKLANG_PRO_RELEASE_LIB_DIR }
filter { "configurations:Debug" }
libdirs { IRRKLANG_PRO_DEBUG_LIB_DIR }
filter {}
end
end
links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32", "Dnsapi" } links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32", "Dnsapi" }
filter "not action:vs*" filter "not action:vs*"
buildoptions { "-std=c++14", "-fno-rtti" } buildoptions { "-std=c++14", "-fno-rtti" }
...@@ -78,13 +60,6 @@ project "YGOPro" ...@@ -78,13 +60,6 @@ project "YGOPro"
buildoptions { "--target=arm64-apple-macos12" } buildoptions { "--target=arm64-apple-macos12" }
linkoptions { "-arch arm64" } linkoptions { "-arch arm64" }
end end
if USE_IRRKLANG then
links { "irrklang" }
end
filter "system:linux" filter "system:linux"
linkoptions { "-static-libstdc++", "-static-libgcc" } linkoptions { "-static-libstdc++", "-static-libgcc" }
links { "GL", "X11", "Xxf86vm" } links { "GL", "X11", "Xxf86vm" }
if USE_IRRKLANG then
links { "IrrKlang" }
linkoptions { IRRKLANG_LINK_RPATH }
end
This diff is collapsed.
...@@ -3,8 +3,9 @@ ...@@ -3,8 +3,9 @@
#include "game.h" #include "game.h"
#include "../ocgcore/mtrandom.h" #include "../ocgcore/mtrandom.h"
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_AUDIO
#include <irrKlang.h> #define MINIAUDIO_IMPLEMENTATION
#include "miniaudio/miniaudio.h"
#endif #endif
namespace ygo { namespace ygo {
...@@ -16,10 +17,11 @@ private: ...@@ -16,10 +17,11 @@ private:
int previous_bgm_scene; int previous_bgm_scene;
bool bgm_process; bool bgm_process;
mt19937 rnd; mt19937 rnd;
#ifdef YGOPRO_USE_IRRKLANG #ifdef YGOPRO_USE_AUDIO
irrklang::ISoundEngine* engineSound; ma_engine engineSound;
irrklang::ISoundEngine* engineMusic; ma_engine engineMusic;
irrklang::ISound* soundBGM; ma_sound soundBGM;
char currentPlayingMusic[1024]{};
#endif #endif
void RefershBGMDir(std::wstring path, int scene); void RefershBGMDir(std::wstring path, int scene);
...@@ -28,6 +30,7 @@ public: ...@@ -28,6 +30,7 @@ public:
void RefreshBGMList(); void RefreshBGMList();
void PlaySoundEffect(int sound); void PlaySoundEffect(int sound);
void PlayDialogSound(irr::gui::IGUIElement * element); void PlayDialogSound(irr::gui::IGUIElement * element);
bool IsCurrentlyPlaying(char* song);
void PlayMusic(char* song, bool loop); void PlayMusic(char* song, bool loop);
void PlayBGM(int scene); void PlayBGM(int scene);
void PlayCustomBGM(char* BGMName); void PlayCustomBGM(char* BGMName);
......
...@@ -5,8 +5,6 @@ BUILD_EVENT = os.istarget("windows") ...@@ -5,8 +5,6 @@ BUILD_EVENT = os.istarget("windows")
BUILD_FREETYPE = os.istarget("windows") BUILD_FREETYPE = os.istarget("windows")
BUILD_SQLITE = os.istarget("windows") BUILD_SQLITE = os.istarget("windows")
BUILD_IRRLICHT = not os.istarget("macosx") BUILD_IRRLICHT = not os.istarget("macosx")
USE_IRRKLANG = true
IRRKLANG_PRO = false
LUA_LIB_NAME = "lua" LUA_LIB_NAME = "lua"
-- read settings from command line or environment variables -- read settings from command line or environment variables
...@@ -38,11 +36,6 @@ newoption { trigger = "no-build-irrlicht", category = "YGOPro - irrlicht", descr ...@@ -38,11 +36,6 @@ newoption { trigger = "no-build-irrlicht", category = "YGOPro - irrlicht", descr
newoption { trigger = "irrlicht-include-dir", category = "YGOPro - irrlicht", description = "", value = "PATH" } newoption { trigger = "irrlicht-include-dir", category = "YGOPro - irrlicht", description = "", value = "PATH" }
newoption { trigger = "irrlicht-lib-dir", category = "YGOPro - irrlicht", description = "", value = "PATH" } newoption { trigger = "irrlicht-lib-dir", category = "YGOPro - irrlicht", description = "", value = "PATH" }
newoption { trigger = "use-irrklang", category = "YGOPro - irrklang", description = "" }
newoption { trigger = "no-use-irrklang", category = "YGOPro - irrklang", description = "" }
newoption { trigger = "irrklang-include-dir", category = "YGOPro - irrklang", description = "", value = "PATH" }
newoption { trigger = "irrklang-lib-dir", category = "YGOPro - irrklang", description = "", value = "PATH" }
newoption { trigger = "irrklang-pro", category = "YGOPro - irrklang - pro", description = "" } newoption { trigger = "irrklang-pro", category = "YGOPro - irrklang - pro", description = "" }
newoption { trigger = "no-irrklang-pro", category = "YGOPro - irrklang - pro", description = "" } newoption { trigger = "no-irrklang-pro", category = "YGOPro - irrklang - pro", description = "" }
newoption { trigger = "irrklang-pro-release-lib-dir", category = "YGOPro - irrklang - pro", description = "", value = "PATH" } newoption { trigger = "irrklang-pro-release-lib-dir", category = "YGOPro - irrklang - pro", description = "", value = "PATH" }
...@@ -161,36 +154,7 @@ if not BUILD_IRRLICHT then ...@@ -161,36 +154,7 @@ if not BUILD_IRRLICHT then
IRRLICHT_LIB_DIR = GetParam("irrlicht-lib-dir") or "/usr/local/lib" IRRLICHT_LIB_DIR = GetParam("irrlicht-lib-dir") or "/usr/local/lib"
end end
if GetParam("use-irrklang") then USE_AUDIO = not GetParam("no-audio")
USE_IRRKLANG = true
elseif GetParam("no-use-irrklang") then
USE_IRRKLANG = false
end
if USE_IRRKLANG then
IRRKLANG_INCLUDE_DIR = GetParam("irrklang-include-dir") or "../irrklang/include"
if os.istarget("windows") then
IRRKLANG_LIB_DIR = "../irrklang/lib/Win32-visualStudio"
elseif os.istarget("linux") then
IRRKLANG_LIB_DIR = "../irrklang/bin/linux-gcc-64"
IRRKLANG_LINK_RPATH = "-Wl,-rpath=./lib/"
elseif os.istarget("macosx") then
IRRKLANG_LIB_DIR = "../irrklang/bin/macosx-gcc"
end
IRRKLANG_LIB_DIR = GetParam("irrklang-lib-dir") or IRRKLANG_LIB_DIR
end
if GetParam("irrklang-pro") and os.istarget("windows") then
IRRKLANG_PRO = true
elseif GetParam("no-irrklang-pro") then
IRRKLANG_PRO = false
end
if IRRKLANG_PRO then
-- irrklang pro can't use the pro lib to debug
IRRKLANG_PRO_RELEASE_LIB_DIR = GetParam("irrklang-pro-release-lib-dir") or "../irrklang/lib/Win32-vs2019"
IRRKLANG_PRO_DEBUG_LIB_DIR = GetParam("irrklang-pro-debug-lib-dir") or "../irrklang/lib/Win32-visualStudio-debug"
end
BUILD_IKPMP3 = USE_IRRKLANG
if GetParam("winxp-support") and os.istarget("windows") then if GetParam("winxp-support") and os.istarget("windows") then
WINXP_SUPPORT = true WINXP_SUPPORT = true
...@@ -293,6 +257,6 @@ workspace "YGOPro" ...@@ -293,6 +257,6 @@ workspace "YGOPro"
if BUILD_SQLITE then if BUILD_SQLITE then
include "sqlite3" include "sqlite3"
end end
if BUILD_IKPMP3 then --if BUILD_IKPMP3 then
include "ikpmp3" -- include "ikpmp3"
end --end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment