mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-08-05 23:11:08 +03:00
Compare commits
No commits in common. "676fd280c63f5bc7d08e90e0a90f3f4795671967" and "f0257d3e4c1ac81484be6ec62eb3de10bc67e918" have entirely different histories.
676fd280c6
...
f0257d3e4c
@ -1,115 +0,0 @@
|
|||||||
#include "ui/CSimpleMovieFrame.hpp"
|
|
||||||
#include "ui/CSimpleMovieFrameScript.hpp"
|
|
||||||
|
|
||||||
int32_t CSimpleMovieFrame::s_metatable;
|
|
||||||
int32_t CSimpleMovieFrame::s_objectType;
|
|
||||||
|
|
||||||
void CSimpleMovieFrame::CreateScriptMetaTable() {
|
|
||||||
lua_State* L = FrameScript_GetContext();
|
|
||||||
int32_t ref = FrameScript_Object::CreateScriptMetaTable(L, &CSimpleMovieFrame::RegisterScriptMethods);
|
|
||||||
CSimpleMovieFrame::s_metatable = ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleMovieFrame::GetObjectType() {
|
|
||||||
if (!CSimpleMovieFrame::s_objectType) {
|
|
||||||
CSimpleMovieFrame::s_objectType = ++FrameScript_Object::s_objectTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
return CSimpleMovieFrame::s_objectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSimpleMovieFrame::RegisterScriptMethods(lua_State* L) {
|
|
||||||
CSimpleFrame::RegisterScriptMethods(L);
|
|
||||||
FrameScript_Object::FillScriptMethodTable(L, SimpleMovieFrameMethods, NUM_SIMPLE_MOVIE_FRAME_SCRIPT_METHODS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSimpleMovieFrame::RenderMovie(void* param) {
|
|
||||||
auto movieFrame = reinterpret_cast<CSimpleMovieFrame*>(param);
|
|
||||||
if (movieFrame->m_isPlaying) {
|
|
||||||
// movieFrame->UpdateTiming();
|
|
||||||
// movieFrame->Render();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameScript_Object::ScriptIx* CSimpleMovieFrame::GetScriptByName(const char* name, ScriptData& data) {
|
|
||||||
auto parentScript = CSimpleFrame::GetScriptByName(name, data);
|
|
||||||
|
|
||||||
if (parentScript) {
|
|
||||||
return parentScript;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SStrCmpI(name, "OnMovieFinished", STORM_MAX_STR)) {
|
|
||||||
return &this->m_onMovieFinished;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SStrCmpI(name, "OnMovieShowSubtitle", STORM_MAX_STR)) {
|
|
||||||
data.wrapper = "return function(self,text) %s end";
|
|
||||||
return &this->m_onMovieShowSubtitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!SStrCmpI(name, "OnMovieHideSubtitle", STORM_MAX_STR)) {
|
|
||||||
return &this->m_onMovieHideSubtitle;
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CSimpleMovieFrame::IsA(int32_t type) {
|
|
||||||
return type == CSimpleMovieFrame::s_objectType
|
|
||||||
|| type == CSimpleFrame::s_objectType
|
|
||||||
|| type == CScriptRegion::s_objectType
|
|
||||||
|| type == CScriptObject::s_objectType;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleMovieFrame::GetScriptMetaTable() {
|
|
||||||
return CSimpleMovieFrame::s_metatable;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSimpleMovieFrame::OnFrameRender(CRenderBatch* batch, uint32_t layer) {
|
|
||||||
this->CSimpleFrame::OnFrameRender(batch, layer);
|
|
||||||
if (layer == DRAWLAYER_ARTWORK) {
|
|
||||||
batch->QueueCallback(&CSimpleMovieFrame::RenderMovie, this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CSimpleMovieFrame::CSimpleMovieFrame(CSimpleFrame* parent)
|
|
||||||
: CSimpleFrame(parent) {
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleMovieFrame::StartMovie(const char* filename, int32_t volume) {
|
|
||||||
if (!this->ParseAVIFile(filename) || !this->OpenVideo()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
SStrCopy(this->m_filename, filename, 256);
|
|
||||||
this->m_volume = volume;
|
|
||||||
|
|
||||||
// this->OpenAudio(this, filename, volume, 0);
|
|
||||||
// this->OpenCaptions(this, filename);
|
|
||||||
|
|
||||||
this->m_isPlaying = 1;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CSimpleMovieFrame::StopMovie() {
|
|
||||||
if (!this->m_isPlaying) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// UnloadDivxDecoder
|
|
||||||
// CloseAudio
|
|
||||||
// CloseCaptions
|
|
||||||
this->m_isStopped = 0;
|
|
||||||
this->m_isPlaying = 0;
|
|
||||||
if (this->m_onMovieFinished.luaRef) {
|
|
||||||
this->RunScript(this->m_onMovieFinished, 0, nullptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleMovieFrame::ParseAVIFile(const char* filename) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleMovieFrame::OpenVideo() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,46 +0,0 @@
|
|||||||
#ifndef UI_C_SIMPLE_MOVIE_FRAME_HPP
|
|
||||||
#define UI_C_SIMPLE_MOVIE_FRAME_HPP
|
|
||||||
|
|
||||||
#include "ui/CSimpleFrame.hpp"
|
|
||||||
#include <tempest/Vector.hpp>
|
|
||||||
|
|
||||||
class CRect;
|
|
||||||
class CRenderBatch;
|
|
||||||
|
|
||||||
class CSimpleMovieFrame : public CSimpleFrame {
|
|
||||||
public:
|
|
||||||
// Static variables
|
|
||||||
static int32_t s_metatable;
|
|
||||||
static int32_t s_objectType;
|
|
||||||
|
|
||||||
// Static functions
|
|
||||||
static void CreateScriptMetaTable();
|
|
||||||
static int32_t GetObjectType();
|
|
||||||
static void RegisterScriptMethods(lua_State* L);
|
|
||||||
static void RenderMovie(void* param);
|
|
||||||
|
|
||||||
// Member variables
|
|
||||||
int32_t m_isPlaying = 0;
|
|
||||||
int32_t m_isStopped = 0;
|
|
||||||
int32_t m_enableSubtitles = 0;
|
|
||||||
char m_filename[256];
|
|
||||||
int32_t m_volume = 100;
|
|
||||||
ScriptIx m_onMovieFinished;
|
|
||||||
ScriptIx m_onMovieShowSubtitle;
|
|
||||||
ScriptIx m_onMovieHideSubtitle;
|
|
||||||
|
|
||||||
// Virtual member functions
|
|
||||||
virtual ScriptIx* GetScriptByName(const char* name, ScriptData& data);
|
|
||||||
virtual bool IsA(int32_t type);
|
|
||||||
virtual int32_t GetScriptMetaTable();
|
|
||||||
virtual void OnFrameRender(CRenderBatch* batch, uint32_t layer);
|
|
||||||
|
|
||||||
// Member functions
|
|
||||||
CSimpleMovieFrame(CSimpleFrame* parent);
|
|
||||||
int32_t StartMovie(const char* filename, int32_t volume);
|
|
||||||
void StopMovie();
|
|
||||||
int32_t ParseAVIFile(const char* filename);
|
|
||||||
int32_t OpenVideo();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
@ -1,47 +0,0 @@
|
|||||||
#include "ui/CSimpleMovieFrameScript.hpp"
|
|
||||||
#include "ui/CSimpleMovieFrame.hpp"
|
|
||||||
#include "util/Lua.hpp"
|
|
||||||
#include "util/Unimplemented.hpp"
|
|
||||||
#include "util/StringTo.hpp"
|
|
||||||
#include <cstdint>
|
|
||||||
|
|
||||||
|
|
||||||
int32_t CSimpleMovieFrame_StartMovie(lua_State* L) {
|
|
||||||
auto type = CSimpleMovieFrame::GetObjectType();
|
|
||||||
auto movieFrame = static_cast<CSimpleMovieFrame*>(FrameScript_GetObjectThis(L, type));
|
|
||||||
|
|
||||||
if (!lua_isstring(L, 2) || !lua_isnumber(L, 3)) {
|
|
||||||
return luaL_error(L, "Usage: %s:StartMovie(\"filename\", volume_0_to_255)", movieFrame->GetDisplayName());
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t volume = static_cast<int32_t>(lua_tointeger(L, 3));
|
|
||||||
const char* filename = lua_tolstring(L, 2, nullptr);
|
|
||||||
|
|
||||||
if (movieFrame->StartMovie(filename, volume)) {
|
|
||||||
lua_pushnumber(L, 1.0);
|
|
||||||
} else {
|
|
||||||
lua_pushnil(L);
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleMovieFrame_StopMovie(lua_State* L) {
|
|
||||||
auto type = CSimpleMovieFrame::GetObjectType();
|
|
||||||
auto movieFrame = static_cast<CSimpleMovieFrame*>(FrameScript_GetObjectThis(L, type));
|
|
||||||
movieFrame->StopMovie();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int32_t CSimpleMovieFrame_EnableSubtitles(lua_State* L) {
|
|
||||||
auto type = CSimpleMovieFrame::GetObjectType();
|
|
||||||
auto movieFrame = static_cast<CSimpleMovieFrame*>(FrameScript_GetObjectThis(L, type));
|
|
||||||
movieFrame->m_enableSubtitles = StringToBOOL(L, 2, 1);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
FrameScript_Method SimpleMovieFrameMethods[NUM_SIMPLE_MOVIE_FRAME_SCRIPT_METHODS] = {
|
|
||||||
{ "StartMovie", &CSimpleMovieFrame_StartMovie },
|
|
||||||
{ "StopMovie", &CSimpleMovieFrame_StopMovie },
|
|
||||||
{ "EnableSubtitles", &CSimpleMovieFrame_EnableSubtitles }
|
|
||||||
};
|
|
@ -1,10 +0,0 @@
|
|||||||
#ifndef UI_C_SIMPLE_MOVIE_FRAME_SCRIPT_HPP
|
|
||||||
#define UI_C_SIMPLE_MOVIE_FRAME_SCRIPT_HPP
|
|
||||||
|
|
||||||
#include "ui/FrameScript.hpp"
|
|
||||||
|
|
||||||
#define NUM_SIMPLE_MOVIE_FRAME_SCRIPT_METHODS 3
|
|
||||||
|
|
||||||
extern FrameScript_Method SimpleMovieFrameMethods[NUM_SIMPLE_MOVIE_FRAME_SCRIPT_METHODS];
|
|
||||||
|
|
||||||
#endif
|
|
@ -6,7 +6,6 @@
|
|||||||
#include "ui/CSimpleFrame.hpp"
|
#include "ui/CSimpleFrame.hpp"
|
||||||
#include "ui/CSimpleHTML.hpp"
|
#include "ui/CSimpleHTML.hpp"
|
||||||
#include "ui/CSimpleModel.hpp"
|
#include "ui/CSimpleModel.hpp"
|
||||||
#include "ui/CSimpleMovieFrame.hpp"
|
|
||||||
#include "ui/CSimpleScrollFrame.hpp"
|
#include "ui/CSimpleScrollFrame.hpp"
|
||||||
#include "ui/CSimpleSlider.hpp"
|
#include "ui/CSimpleSlider.hpp"
|
||||||
#include "util/CStatus.hpp"
|
#include "util/CStatus.hpp"
|
||||||
@ -110,10 +109,8 @@ CSimpleFrame* Create_SimpleColorSelect(CSimpleFrame* parent) {
|
|||||||
|
|
||||||
CSimpleFrame* Create_SimpleMovieFrame(CSimpleFrame* parent) {
|
CSimpleFrame* Create_SimpleMovieFrame(CSimpleFrame* parent) {
|
||||||
// TODO
|
// TODO
|
||||||
// auto m = CDataAllocator::GetData(CSimpleMovie::s_simpleMovieHeap, 0, __FILE__, __LINE__);
|
|
||||||
|
|
||||||
auto m = SMemAlloc(sizeof(CSimpleMovieFrame), __FILE__, __LINE__, 0x0);
|
return nullptr;
|
||||||
return new (m) CSimpleMovieFrame(parent);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
XMLNode* FrameXML_AcquireHashNode(const char* name, const char*& tainted, bool& locked) {
|
XMLNode* FrameXML_AcquireHashNode(const char* name, const char*& tainted, bool& locked) {
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
#include "ui/CSimpleHTML.hpp"
|
#include "ui/CSimpleHTML.hpp"
|
||||||
#include "ui/CSimpleModel.hpp"
|
#include "ui/CSimpleModel.hpp"
|
||||||
#include "ui/CSimpleModelFFX.hpp"
|
#include "ui/CSimpleModelFFX.hpp"
|
||||||
#include "ui/CSimpleMovieFrame.hpp"
|
|
||||||
#include "ui/CSimpleScrollFrame.hpp"
|
#include "ui/CSimpleScrollFrame.hpp"
|
||||||
#include "ui/CSimpleSlider.hpp"
|
#include "ui/CSimpleSlider.hpp"
|
||||||
#include "ui/CSimpleTexture.hpp"
|
#include "ui/CSimpleTexture.hpp"
|
||||||
@ -89,7 +88,7 @@ void RegisterSimpleFrameScriptMethods() {
|
|||||||
// TODO
|
// TODO
|
||||||
// CSimpleStatusBar::CreateScriptMetaTable();
|
// CSimpleStatusBar::CreateScriptMetaTable();
|
||||||
// CSimpleColorSelect::CreateScriptMetaTable();
|
// CSimpleColorSelect::CreateScriptMetaTable();
|
||||||
CSimpleMovieFrame::CreateScriptMetaTable();
|
// CSimpleMovieFrame::CreateScriptMetaTable();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemRegisterFunctions() {
|
void SystemRegisterFunctions() {
|
||||||
|
@ -118,16 +118,7 @@ int32_t Script_StopGlueMusic(lua_State* L) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetMovieResolution(lua_State* L) {
|
int32_t Script_GetMovieResolution(lua_State* L) {
|
||||||
auto gxResolution = CVar::Lookup("gxResolution");
|
WHOA_UNIMPLEMENTED(0);
|
||||||
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) {
|
int32_t Script_GetScreenWidth(lua_State* L) {
|
||||||
|
Loading…
Reference in New Issue
Block a user