feat(sound): Small script related improvements

* chore(build): rename src/util/Log.* to SysMessage.*

* chore(ui): implement SetNonSpaceWrap() for error messages

* chore(ui): move Video Script methods into CGVideoOptions class

* chore(script): temporary fix GetNumOutputDrivers to eliminate loading errors

* feat(sound): add SI2 Log methods

* chore(sound): add SI2 CVars

* chore(ui): implement Script_PlayGlueMusic

* chore(sound): update SI2::Init()

* fix: resolve compilation errors in variadic macros SI2_ERR and SI2_LOG

---------

Co-authored-by: Tristan Cormier <cormiert2@outlook.com>
This commit is contained in:
VDm 2024-03-06 00:53:07 +04:00 committed by GitHub
parent 8596860120
commit 32cfe08d0b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 366 additions and 73 deletions

View file

@ -25,4 +25,5 @@ target_link_libraries(ui
common
storm
tempest
fmod
)

View file

@ -748,6 +748,17 @@ void CSimpleFontString::SetJustifyH(uint8_t justify) {
void CSimpleFontString::SetNonSpaceWrap(int32_t a2) {
// TODO
// Proper implementation
uint32_t styleFlags = a2
? this->m_styleFlags | 0x1000
: this->m_styleFlags & ~0x1000;
if (this->m_styleFlags != styleFlags) {
this->m_styleFlags = styleFlags;
if (this->m_string) {
this->UpdateString();
}
}
}
void CSimpleFontString::SetSpacing(float spacing) {

View file

@ -11,7 +11,7 @@ struct lua_State;
#define NUM_SCRIPT_FUNCTIONS_GLUE_SCRIPT_EVENTS 113
#define NUM_SCRIPT_FUNCTIONS_REALM_LIST 14
#define NUM_SCRIPT_FUNCTIONS_SIMPLE_FRAME 7
#define NUM_SCRIPT_FUNCTIONS_SYSTEM 13
#define NUM_SCRIPT_FUNCTIONS_SYSTEM 7
namespace FrameScript {
extern FrameScript_Method s_ScriptFunctions_CharCreate[NUM_SCRIPT_FUNCTIONS_CHAR_CREATE];
@ -210,6 +210,5 @@ int32_t Script_GetTime(lua_State*);
int32_t Script_GetGameTime(lua_State*);
int32_t Script_ConsoleExec(lua_State*);
int32_t Script_AccessDenied(lua_State*);
int32_t Script_GetCurrentResolution(lua_State*);
#endif

View file

@ -11,6 +11,7 @@
#include "util/Lua.hpp"
#include "util/SFile.hpp"
#include "util/Unimplemented.hpp"
#include "sound/SI2.hpp"
#include <cstdint>
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) {
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) {

View file

@ -24,30 +24,6 @@ int32_t Script_AccessDenied(lua_State* L) {
return luaL_error(L, "Access Denied");
}
int32_t Script_GetCurrentResolution(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
}
int32_t Script_GetScreenResolutions(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
}
int32_t Script_GetRefreshRates(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
}
int32_t Script_GetCurrentMultisampleFormat(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
}
int32_t Script_GetMultisampleFormats(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
}
int32_t Script_IsStereoVideoAvailable(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
}
FrameScript_Method FrameScript::s_ScriptFunctions_System[NUM_SCRIPT_FUNCTIONS_SYSTEM] = {
{ "GetTime", &Script_GetTime },
{ "GetGameTime", &Script_GetGameTime },
@ -55,11 +31,5 @@ FrameScript_Method FrameScript::s_ScriptFunctions_System[NUM_SCRIPT_FUNCTIONS_SY
{ "ReadFile", &Script_AccessDenied },
{ "DeleteFile", &Script_AccessDenied },
{ "AppendToFile", &Script_AccessDenied },
{ "GetAccountExpansionLevel", &Script_GetAccountExpansionLevel },
{ "GetCurrentResolution", &Script_GetCurrentResolution },
{ "GetScreenResolutions", &Script_GetScreenResolutions },
{ "GetRefreshRates", &Script_GetRefreshRates },
{ "GetCurrentMultisampleFormat", &Script_GetCurrentMultisampleFormat },
{ "GetMultisampleFormats", &Script_GetMultisampleFormats },
{ "IsStereoVideoAvailable", &Script_IsStereoVideoAvailable },
{ "GetAccountExpansionLevel", &Script_GetAccountExpansionLevel }
};