mirror of
https://github.com/thunderbrewhq/thunderbrew
synced 2025-10-26 22:06:06 +03:00
feat(glue): wire up character select background
This commit is contained in:
parent
f384fce742
commit
5e3d08bf32
@ -1,3 +1,31 @@
|
|||||||
#include "glue/CCharacterSelection.hpp"
|
#include "glue/CCharacterSelection.hpp"
|
||||||
|
#include "model/CM2Shared.hpp"
|
||||||
|
#include "ui/CSimpleModelFFX.hpp"
|
||||||
|
|
||||||
TSGrowableArray<CharacterSelectionDisplay> CCharacterSelection::s_characterList;
|
TSGrowableArray<CharacterSelectionDisplay> CCharacterSelection::s_characterList;
|
||||||
|
CSimpleModelFFX* CCharacterSelection::s_modelFrame;
|
||||||
|
|
||||||
|
void CCharacterSelection::SetBackgroundModel(const char* modelPath) {
|
||||||
|
if (!CCharacterSelection::s_modelFrame || !modelPath || !*modelPath) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto model = CCharacterSelection::s_modelFrame->m_model;
|
||||||
|
|
||||||
|
// Check if already set
|
||||||
|
if (model && !SStrCmpI(modelPath, model->m_shared->m_filePath, STORM_MAX_STR)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
CCharacterSelection::s_modelFrame->SetModel(modelPath);
|
||||||
|
|
||||||
|
// TODO BYTE1(CCharacterSelection::m_modelFrame->simplemodelffx_dword510[3]) = 1;
|
||||||
|
|
||||||
|
model = CCharacterSelection::s_modelFrame->m_model;
|
||||||
|
|
||||||
|
if (model) {
|
||||||
|
// TODO lighting callback + arg
|
||||||
|
|
||||||
|
model->IsDrawable(1, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <storm/Array.hpp>
|
#include <storm/Array.hpp>
|
||||||
|
|
||||||
|
class CSimpleModelFFX;
|
||||||
|
|
||||||
struct CharacterSelectionDisplay {
|
struct CharacterSelectionDisplay {
|
||||||
// TODO
|
// TODO
|
||||||
};
|
};
|
||||||
@ -11,6 +13,10 @@ class CCharacterSelection {
|
|||||||
public:
|
public:
|
||||||
// Static variables
|
// Static variables
|
||||||
static TSGrowableArray<CharacterSelectionDisplay> s_characterList;
|
static TSGrowableArray<CharacterSelectionDisplay> s_characterList;
|
||||||
|
static CSimpleModelFFX* s_modelFrame;
|
||||||
|
|
||||||
|
// Static functions
|
||||||
|
static void SetBackgroundModel(const char* modelPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -15,6 +15,7 @@ target_link_libraries(glue
|
|||||||
db
|
db
|
||||||
event
|
event
|
||||||
gx
|
gx
|
||||||
|
model
|
||||||
net
|
net
|
||||||
sound
|
sound
|
||||||
ui
|
ui
|
||||||
|
|||||||
@ -1,17 +1,37 @@
|
|||||||
#include "ui/ScriptFunctions.hpp"
|
#include "ui/ScriptFunctions.hpp"
|
||||||
#include "db/Db.hpp"
|
#include "db/Db.hpp"
|
||||||
#include "glue/CCharacterSelection.hpp"
|
#include "glue/CCharacterSelection.hpp"
|
||||||
|
#include "ui/CSimpleModelFFX.hpp"
|
||||||
#include "ui/Types.hpp"
|
#include "ui/Types.hpp"
|
||||||
#include "util/Lua.hpp"
|
#include "util/Lua.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
int32_t Script_SetCharSelectModelFrame(lua_State* L) {
|
int32_t Script_SetCharSelectModelFrame(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED();
|
if (!lua_isstring(L, 1)) {
|
||||||
|
return luaL_error(L, "Usage: SetCharSelectModelFrame(\"frameName\")");
|
||||||
|
}
|
||||||
|
|
||||||
|
auto type = CSimpleModel::GetObjectType();
|
||||||
|
auto name = lua_tolstring(L, 1, nullptr);
|
||||||
|
auto frame = CScriptObject::GetScriptObjectByName(name, type);
|
||||||
|
|
||||||
|
if (frame) {
|
||||||
|
CCharacterSelection::s_modelFrame = static_cast<CSimpleModelFFX*>(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_SetCharSelectBackground(lua_State* L) {
|
int32_t Script_SetCharSelectBackground(lua_State* L) {
|
||||||
WHOA_UNIMPLEMENTED();
|
if (!lua_isstring(L, 1)) {
|
||||||
|
return luaL_error(L, "Usage: SetCharSelectBackground(\"filename\")");
|
||||||
|
}
|
||||||
|
|
||||||
|
auto modelPath = lua_tolstring(L, 1, nullptr);
|
||||||
|
CCharacterSelection::SetBackgroundModel(modelPath);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int32_t Script_GetCharacterListUpdate(lua_State* L) {
|
int32_t Script_GetCharacterListUpdate(lua_State* L) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user