feat(ui): implement Script_GetMovieResolution method

This commit is contained in:
VDm 2025-04-24 00:42:23 +04:00
parent 5a36ab2f7c
commit 92a3925797
3 changed files with 16 additions and 4 deletions

View File

@ -31,16 +31,16 @@ FrameScript_Object::ScriptIx* CSimpleMovieFrame::GetScriptByName(const char* nam
}
if (!SStrCmpI(name, "OnMovieFinished", STORM_MAX_STR)) {
//return (int)this + 948;
return &this->m_onMovieFinished;
}
if (!SStrCmpI(name, "OnMovieShowSubtitle", STORM_MAX_STR)) {
data.wrapper = "return function(self,text) %s end";
//return (int)this + 956;
return &this->m_onMovieShowSubtitle;
}
if (!SStrCmpI(name, "OnMovieHideSubtitle", STORM_MAX_STR)) {
//return (int)this + 964;
return &this->m_onMovieHideSubtitle;
}
return nullptr;

View File

@ -19,6 +19,9 @@ class CSimpleMovieFrame : public CSimpleFrame {
static void RegisterScriptMethods(lua_State* L);
// Member variables
ScriptIx m_onMovieFinished;
ScriptIx m_onMovieShowSubtitle;
ScriptIx m_onMovieHideSubtitle;
// Virtual member functions
virtual ScriptIx* GetScriptByName(const char* name, ScriptData& data);

View File

@ -118,7 +118,16 @@ int32_t Script_StopGlueMusic(lua_State* L) {
}
int32_t Script_GetMovieResolution(lua_State* L) {
WHOA_UNIMPLEMENTED(0);
auto gxResolution = CVar::Lookup("gxResolution");
STORM_ASSERT(gxResolution);
auto resolution = gxResolution->GetString();
STORM_ASSERT(resolution);
int32_t width = 0;
int32_t height = 0;
sscanf(resolution, "%dx%d", &width, &height);
lua_pushnumber(L, width);
return 1;
}
int32_t Script_GetScreenWidth(lua_State* L) {