mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(glue): implement Script_SetCharCustomizeBackground
This commit is contained in:
parent
f326f30fc6
commit
f20b9fbbde
@ -3,6 +3,7 @@
|
||||
#include "component/Types.hpp"
|
||||
#include "db/Db.hpp"
|
||||
#include "glue/CGlueLoading.hpp"
|
||||
#include "model/CM2Shared.hpp"
|
||||
#include "object/client/Player_C.hpp"
|
||||
#include "ui/simple/CSimpleModelFFX.hpp"
|
||||
|
||||
@ -208,6 +209,36 @@ void CCharacterCreation::ResetCharCustomizeInfo() {
|
||||
CGlueLoading::StartLoad(CCharacterCreation::s_character, true);
|
||||
}
|
||||
|
||||
void CCharacterCreation::SetCharCustomizeModel(const char* filename) {
|
||||
if (!CCharacterCreation::s_charCustomizeFrame || !filename || !*filename) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto existingModel = CCharacterCreation::s_charCustomizeFrame->m_model;
|
||||
|
||||
if (existingModel && !SStrCmpI(existingModel->m_shared->m_filePath, filename)) {
|
||||
return;
|
||||
}
|
||||
|
||||
CCharacterCreation::s_charCustomizeFrame->SetModel(filename);
|
||||
auto customizeModel = CCharacterCreation::s_charCustomizeFrame->m_model;
|
||||
|
||||
// TODO inlined?
|
||||
if (customizeModel) {
|
||||
// TODO lighting stuff
|
||||
customizeModel->IsDrawable(1, 1);
|
||||
}
|
||||
|
||||
// TODO inlined?
|
||||
if (customizeModel) {
|
||||
auto characterModel = CCharacterCreation::s_character->m_data.model;
|
||||
|
||||
if (characterModel) {
|
||||
characterModel->AttachToParent(customizeModel, 0, nullptr, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CCharacterCreation::SetSelectedClass(int32_t classID) {
|
||||
if (!CCharacterCreation::IsClassValid(classID)) {
|
||||
return;
|
||||
|
||||
@ -30,6 +30,7 @@ class CCharacterCreation {
|
||||
static void Initialize();
|
||||
static bool IsClassValid(int32_t classID);
|
||||
static void ResetCharCustomizeInfo();
|
||||
static void SetCharCustomizeModel(const char* filename);
|
||||
static void SetSelectedClass(int32_t classID);
|
||||
};
|
||||
|
||||
|
||||
@ -30,7 +30,17 @@ int32_t Script_SetCharCustomizeFrame(lua_State* L) {
|
||||
}
|
||||
|
||||
int32_t Script_SetCharCustomizeBackground(lua_State* L) {
|
||||
WHOA_UNIMPLEMENTED(0);
|
||||
if (!lua_isstring(L, 1)) {
|
||||
luaL_error(L, "Usage: SetCharCustomizeBackground(\"filename\")");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto filename = lua_tostring(L, 1);
|
||||
|
||||
CCharacterCreation::SetCharCustomizeModel(filename);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t Script_ResetCharCustomize(lua_State* L) {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user