mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2026-01-30 19:42:51 +03:00
chore(ui): implement Script_PlayGlueMusic
This commit is contained in:
parent
9c775dce40
commit
30cbb77728
@ -1,6 +1,20 @@
|
|||||||
#include "sound/SI2.hpp"
|
#include "sound/SI2.hpp"
|
||||||
#include "ui/FrameScript.hpp"
|
#include "ui/FrameScript.hpp"
|
||||||
#include "console/CVar.hpp"
|
#include "console/CVar.hpp"
|
||||||
|
#include <storm/Memory.hpp>
|
||||||
|
|
||||||
|
void* F_CALL FMOD_Alloc(unsigned int size, FMOD_MEMORY_TYPE type, const char* sourcestr) {
|
||||||
|
return SMemAlloc(size, sourcestr, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void* F_CALL FMOD_ReAlloc(void* ptr, unsigned int size, FMOD_MEMORY_TYPE type, const char* sourcestr) {
|
||||||
|
return SMemReAlloc(ptr, size, sourcestr, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void F_CALL FMOD_Free(void* ptr, FMOD_MEMORY_TYPE type, const char* sourcestr) {
|
||||||
|
SMemFree(ptr, sourcestr, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SI2::RegisterScriptFunctions() {
|
void SI2::RegisterScriptFunctions() {
|
||||||
FrameScript_Method* item = s_ScriptFunctions;
|
FrameScript_Method* item = s_ScriptFunctions;
|
||||||
@ -17,7 +31,13 @@ int32_t SI2::Init(int32_t flag) {
|
|||||||
SI2_LOG(" ");
|
SI2_LOG(" ");
|
||||||
SI2_LOG("=> Setting up Game Sound:");
|
SI2_LOG("=> Setting up Game Sound:");
|
||||||
SI2_LOG(" - SESound Engine Init");
|
SI2_LOG(" - SESound Engine Init");
|
||||||
SI2_LOG(" - FMOD Memory Init");
|
|
||||||
|
auto errcode = FMOD::Memory_Initialize(nullptr, 0, &FMOD_Alloc, &FMOD_ReAlloc, &FMOD_Free);
|
||||||
|
SI2_ERR(errcode, " - FMOD Memory Init");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SI2::StartGlueMusic(const char* filename) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -5,7 +5,7 @@
|
|||||||
#include <storm/Log.hpp>
|
#include <storm/Log.hpp>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdarg>
|
#include <cstdarg>
|
||||||
#include <fmod.h>
|
#include <fmod.hpp>
|
||||||
#include <fmod_errors.h>
|
#include <fmod_errors.h>
|
||||||
|
|
||||||
|
|
||||||
@ -26,6 +26,7 @@ class SI2 {
|
|||||||
static void Log_Write(uint32_t line, const char* filename, FMOD_RESULT errcode, const char* format, ...);
|
static void Log_Write(uint32_t line, const char* filename, FMOD_RESULT errcode, const char* format, ...);
|
||||||
static void RegisterCVars();
|
static void RegisterCVars();
|
||||||
static int32_t Init(int32_t flag);
|
static int32_t Init(int32_t flag);
|
||||||
|
static void StartGlueMusic(const char* filename);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -25,4 +25,5 @@ target_link_libraries(ui
|
|||||||
common
|
common
|
||||||
storm
|
storm
|
||||||
tempest
|
tempest
|
||||||
|
fmod
|
||||||
)
|
)
|
||||||
|
|||||||
@ -11,6 +11,7 @@
|
|||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
#include "util/SFile.hpp"
|
#include "util/SFile.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
|
#include "sound/SI2.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
int32_t Script_IsShiftKeyDown(lua_State* L) {
|
int32_t Script_IsShiftKeyDown(lua_State* L) {
|
||||||
@ -80,7 +81,12 @@ int32_t Script_QuitGameAndRunLauncher(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_PlayGlueMusic(lua_State* L) {
|
int32_t Script_PlayGlueMusic(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED(0);
|
if (!lua_isstring(L, 1)) {
|
||||||
|
return luaL_error(L, "Usage: PlayGlueMusic(\"filename\")");
|
||||||
|
}
|
||||||
|
|
||||||
|
SI2::StartGlueMusic(lua_tolstring(L, 1, 0));
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_PlayCreditsMusic(lua_State* L) {
|
int32_t Script_PlayCreditsMusic(lua_State* L) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user