mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-02 16:52:45 +03:00
feat(component): implement CCharacterComponent::ReplaceHairTexture
This commit is contained in:
parent
e794580ea8
commit
dd318480f1
@ -7,6 +7,7 @@
|
|||||||
#include "gx/Texture.hpp"
|
#include "gx/Texture.hpp"
|
||||||
#include "model/CM2Model.hpp"
|
#include "model/CM2Model.hpp"
|
||||||
#include "object/Types.hpp"
|
#include "object/Types.hpp"
|
||||||
|
#include "util/CStatus.hpp"
|
||||||
#include <storm/Memory.hpp>
|
#include <storm/Memory.hpp>
|
||||||
#include <storm/String.hpp>
|
#include <storm/String.hpp>
|
||||||
|
|
||||||
@ -70,6 +71,7 @@ int32_t s_itemPriority[NUM_ITEM_SLOT][NUM_COMPONENT_SECTIONS] = {
|
|||||||
int32_t s_bInRenderPrep = 0;
|
int32_t s_bInRenderPrep = 0;
|
||||||
char* s_pathEnd;
|
char* s_pathEnd;
|
||||||
char s_path[STORM_MAX_PATH];
|
char s_path[STORM_MAX_PATH];
|
||||||
|
CStatus s_status;
|
||||||
|
|
||||||
#define TEXTURE_INDEX(section, texture) (3 * section + texture)
|
#define TEXTURE_INDEX(section, texture) (3 * section + texture)
|
||||||
|
|
||||||
@ -78,6 +80,11 @@ CCharacterComponent* CCharacterComponent::AllocComponent() {
|
|||||||
return STORM_NEW(CCharacterComponent);
|
return STORM_NEW(CCharacterComponent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HTEXTURE CCharacterComponent::CreateTexture(const char* fileName, CStatus* status) {
|
||||||
|
auto texFlags = CGxTexFlags(GxTex_LinearMipNearest, 0, 0, 0, 0, 0, 1);
|
||||||
|
return TextureCreate(fileName, texFlags, status, 0);
|
||||||
|
}
|
||||||
|
|
||||||
void CCharacterComponent::Initialize() {
|
void CCharacterComponent::Initialize() {
|
||||||
// TODO
|
// TODO
|
||||||
|
|
||||||
@ -841,7 +848,29 @@ void CCharacterComponent::ReplaceExtraSkinTexture(const char* a2) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::ReplaceHairTexture(int32_t hairStyleID, const char* a3) {
|
void CCharacterComponent::ReplaceHairTexture(int32_t hairStyleID, const char* a3) {
|
||||||
// TODO
|
if (!ComponentValidateBase(
|
||||||
|
CCharacterComponent::s_chrVarArray,
|
||||||
|
this->m_data.raceID,
|
||||||
|
this->m_data.sexID,
|
||||||
|
VARIATION_HAIR,
|
||||||
|
hairStyleID,
|
||||||
|
this->m_data.hairColorID
|
||||||
|
)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto sectionsRec = this->GetSectionsRecord(VARIATION_HAIR, hairStyleID, this->m_data.hairColorID, nullptr);
|
||||||
|
if (!*sectionsRec->m_textureName[0]) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SStrCopy(s_pathEnd, sectionsRec->m_textureName[0]);
|
||||||
|
|
||||||
|
auto hairTexture = CCharacterComponent::CreateTexture(s_path, &s_status);
|
||||||
|
if (hairTexture) {
|
||||||
|
this->m_data.model->ReplaceTexture(6, hairTexture);
|
||||||
|
HandleClose(hairTexture);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::SetFace(int32_t faceID, bool a3, const char* a4) {
|
void CCharacterComponent::SetFace(int32_t faceID, bool a3, const char* a4) {
|
||||||
|
|||||||
@ -43,6 +43,7 @@ class CCharacterComponent {
|
|||||||
|
|
||||||
// Static functions
|
// Static functions
|
||||||
static CCharacterComponent* AllocComponent();
|
static CCharacterComponent* AllocComponent();
|
||||||
|
static HTEXTURE CreateTexture(const char* fileName, CStatus* status);
|
||||||
static void Initialize();
|
static void Initialize();
|
||||||
static void Initialize(EGxTexFormat textureFormat, uint32_t textureLevel, int32_t thread, int32_t compress);
|
static void Initialize(EGxTexFormat textureFormat, uint32_t textureLevel, int32_t thread, int32_t compress);
|
||||||
static void InitDbData();
|
static void InitDbData();
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user