mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 00:02:45 +03:00
feat(component): add CCharacterComponent::FreeComponent
This commit is contained in:
parent
09acc6f421
commit
1cba1cc66d
@ -286,6 +286,11 @@ HTEXTURE CCharacterComponent::CreateTexture(const char* fileName, CStatus* statu
|
||||
return TextureCreate(fileName, texFlags, status, 0);
|
||||
}
|
||||
|
||||
void CCharacterComponent::FreeComponent(CCharacterComponent* component) {
|
||||
component->~CCharacterComponent();
|
||||
ObjectFree(*s_componentHeap, component->m_memHandle);
|
||||
}
|
||||
|
||||
GEOCOMPONENTLINKS CCharacterComponent::GetSheatheLink(SHEATHE_TYPE sheatheType, bool a2) {
|
||||
switch (sheatheType) {
|
||||
case SHEATHE_1:
|
||||
@ -823,6 +828,29 @@ void CCharacterComponent::UpdateBaseTexture(EGxTexCommand cmd, uint32_t width, u
|
||||
}
|
||||
}
|
||||
|
||||
CCharacterComponent::~CCharacterComponent() {
|
||||
// TODO destroy base texture
|
||||
|
||||
if (this->m_data.model) {
|
||||
this->m_data.model->Release();
|
||||
this->m_data.model = nullptr;
|
||||
}
|
||||
|
||||
for (auto& texture : this->m_texture) {
|
||||
TextureCacheDestroyTexture(texture);
|
||||
texture = nullptr;
|
||||
}
|
||||
|
||||
for (auto& itemDisplay : this->m_itemDisplays) {
|
||||
for (auto& texture : itemDisplay.texture) {
|
||||
TextureCacheDestroyTexture(texture);
|
||||
texture = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
// TODO
|
||||
}
|
||||
|
||||
void CCharacterComponent::AddItem(ITEM_SLOT itemSlot, int32_t displayID, int32_t a4) {
|
||||
if (displayID <= 0) {
|
||||
return;
|
||||
|
||||
@ -54,6 +54,7 @@ class CCharacterComponent {
|
||||
static void ComponentCloseFingers(CM2Model* model, COMP_HAND_SLOT handSlot);
|
||||
static void ComponentOpenFingers(CM2Model* model, COMP_HAND_SLOT handSlot);
|
||||
static HTEXTURE CreateTexture(const char* fileName, CStatus* status);
|
||||
static void FreeComponent(CCharacterComponent* component);
|
||||
static GEOCOMPONENTLINKS GetSheatheLink(SHEATHE_TYPE sheatheType, bool a2);
|
||||
static void Initialize();
|
||||
static void Initialize(EGxTexFormat textureFormat, uint32_t textureLevel, int32_t thread, int32_t compress);
|
||||
@ -81,6 +82,7 @@ class CCharacterComponent {
|
||||
int32_t m_items[NUM_ITEM_SLOT] = {};
|
||||
|
||||
// Member functions
|
||||
~CCharacterComponent();
|
||||
void AddItem(ITEM_SLOT itemSlot, int32_t displayID, int32_t a4);
|
||||
void AddItem(ITEM_SLOT itemSlot, const ItemDisplayInfoRec* displayRec, int32_t a4);
|
||||
void AddItemBySlot(INVENTORY_SLOTS invSlot, int32_t displayID, int32_t a4);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user