mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(component): implement CCharacterComponent::AddLink
This commit is contained in:
parent
20caf39136
commit
9ef900f80f
@ -6,6 +6,7 @@
|
|||||||
#include "gx/Device.hpp"
|
#include "gx/Device.hpp"
|
||||||
#include "gx/Texture.hpp"
|
#include "gx/Texture.hpp"
|
||||||
#include "model/CM2Model.hpp"
|
#include "model/CM2Model.hpp"
|
||||||
|
#include "model/CM2Scene.hpp"
|
||||||
#include "object/Types.hpp"
|
#include "object/Types.hpp"
|
||||||
#include "util/CStatus.hpp"
|
#include "util/CStatus.hpp"
|
||||||
#include "util/Unimplemented.hpp"
|
#include "util/Unimplemented.hpp"
|
||||||
@ -160,8 +161,58 @@ int32_t CCharacterComponent::AddHandItem(CM2Model* model, const ItemDisplayInfoR
|
|||||||
return link;
|
return link;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::AddLink(CM2Model* model, GEOCOMPONENTLINKS link, char const* modelPath, char const* texturePath, int32_t a5, const ItemDisplayInfoRec* displayRec) {
|
void CCharacterComponent::AddLink(CM2Model* parent, GEOCOMPONENTLINKS link, char const* modelPath, char const* texturePath, int32_t visualID, const ItemDisplayInfoRec* displayRec) {
|
||||||
// TODO
|
if (!parent) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create item model
|
||||||
|
|
||||||
|
auto model = parent->m_scene->CreateModel(modelPath, 0);
|
||||||
|
|
||||||
|
if (!model) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create item texture
|
||||||
|
|
||||||
|
auto textureFlags = CGxTexFlags(GxTex_LinearMipNearest, 0, 0, 0, 0, 0, 1);
|
||||||
|
auto texture = TextureCreate(texturePath, textureFlags, &s_status, 0);
|
||||||
|
|
||||||
|
if (!texture) {
|
||||||
|
model->Release();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace item texture
|
||||||
|
|
||||||
|
model->ReplaceTexture(2, texture);
|
||||||
|
HandleClose(texture);
|
||||||
|
|
||||||
|
// Add item visual
|
||||||
|
|
||||||
|
if (visualID > 0) {
|
||||||
|
// TODO CCharacterComponent::ComponentUtilAddItemVisual(model, visualID);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach item to parent
|
||||||
|
|
||||||
|
parent->DetachAllChildrenById(link);
|
||||||
|
model->AttachToParent(parent, link, nullptr, 0);
|
||||||
|
|
||||||
|
// Add link point
|
||||||
|
|
||||||
|
if (link == ATTACH_HANDR) {
|
||||||
|
// TODO CCharacterComponent::AddLinkpt(parent, 0);
|
||||||
|
} else if (link == ATTACH_HANDL) {
|
||||||
|
// TODO CCharacterComponent::AddLinkpt(parent, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Replace item particle color
|
||||||
|
|
||||||
|
// TODO ReplaceParticleColor(displayRec->m_particleColorID, model);
|
||||||
|
|
||||||
|
model->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
CCharacterComponent* CCharacterComponent::AllocComponent() {
|
CCharacterComponent* CCharacterComponent::AllocComponent() {
|
||||||
|
|||||||
@ -48,7 +48,7 @@ class CCharacterComponent {
|
|||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
static int32_t AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool sheathed, bool shield, bool a7, int32_t a8);
|
static int32_t AddHandItem(CM2Model* model, const ItemDisplayInfoRec* displayRec, INVENTORY_SLOTS invSlot, SHEATHE_TYPE sheatheType, bool sheathed, bool shield, bool a7, int32_t a8);
|
||||||
static void AddLink(CM2Model* model, GEOCOMPONENTLINKS link, char const* modelPath, char const* texturePath, int32_t a5, const ItemDisplayInfoRec* displayRec);
|
static void AddLink(CM2Model* parent, GEOCOMPONENTLINKS link, char const* modelPath, char const* texturePath, int32_t visualID, const ItemDisplayInfoRec* displayRec);
|
||||||
static CCharacterComponent* AllocComponent();
|
static CCharacterComponent* AllocComponent();
|
||||||
static HTEXTURE CreateTexture(const char* fileName, CStatus* status);
|
static HTEXTURE CreateTexture(const char* fileName, CStatus* status);
|
||||||
static GEOCOMPONENTLINKS GetSheatheLink(SHEATHE_TYPE sheatheType, bool a2);
|
static GEOCOMPONENTLINKS GetSheatheLink(SHEATHE_TYPE sheatheType, bool a2);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user