mirror of
https://github.com/whoahq/whoa.git
synced 2026-02-01 16:22:45 +03:00
feat(component): finish implementing all render prep functions in CCharacterComponent
This commit is contained in:
parent
1f0b89963d
commit
206b8f7a54
@ -34,7 +34,9 @@ CompSectionInfo CCharacterComponent::s_sectionInfoRaw[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Texture priorities for each item slot and component section.
|
* Texture priorities for each item slot and component section. Determines order for pasting
|
||||||
|
* textures in RenderPrep functions. Priority start and end for leg component sections is
|
||||||
|
* adjusted in the corresponding RenderPrep functions.
|
||||||
*/
|
*/
|
||||||
int32_t s_itemPriority[NUM_ITEM_SLOT][NUM_COMPONENT_SECTIONS] = {
|
int32_t s_itemPriority[NUM_ITEM_SLOT][NUM_COMPONENT_SECTIONS] = {
|
||||||
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, // ITEMSLOT_0
|
{ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 }, // ITEMSLOT_0
|
||||||
@ -51,6 +53,20 @@ int32_t s_itemPriority[NUM_ITEM_SLOT][NUM_COMPONENT_SECTIONS] = {
|
|||||||
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // ITEMSLOT_11
|
{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // ITEMSLOT_11
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Total item texture priorities for each component section.
|
||||||
|
*/
|
||||||
|
#define SECTION_AU_ITEM_PRIORITIES 2
|
||||||
|
#define SECTION_AL_ITEM_PRIORITIES 7
|
||||||
|
#define SECTION_HA_ITEM_PRIORITIES 1
|
||||||
|
#define SECTION_TU_ITEM_PRIORITIES 5
|
||||||
|
#define SECTION_TL_ITEM_PRIORITIES 7
|
||||||
|
#define SECTION_LU_ITEM_PRIORITIES 3
|
||||||
|
#define SECTION_LL_ITEM_PRIORITIES 6
|
||||||
|
#define SECTION_FO_ITEM_PRIORITIES 1
|
||||||
|
#define SECTION_HU_ITEM_PRIORITIES 0
|
||||||
|
#define SECTION_HL_ITEM_PRIORITIES 0
|
||||||
|
|
||||||
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];
|
||||||
@ -352,31 +368,71 @@ void CCharacterComponent::PasteTransparent8Bit(void* srcTexture, const BlpPalPix
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::RenderPrepAL(CCharacterComponent* component) {
|
void CCharacterComponent::RenderPrepAL(CCharacterComponent* component) {
|
||||||
auto skin = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
auto& itemDisplay = component->m_itemDisplays[SECTION_ARM_LOWER];
|
||||||
CCharacterComponent::PasteFromSkin(SECTION_ARM_LOWER, skin, CCharacterComponent::s_textureBuffer);
|
|
||||||
|
|
||||||
// TODO
|
// Skin texture
|
||||||
|
|
||||||
|
auto skinTexture = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
||||||
|
CCharacterComponent::PasteFromSkin(SECTION_ARM_LOWER, skinTexture, CCharacterComponent::s_textureBuffer);
|
||||||
|
|
||||||
|
// Item textures
|
||||||
|
|
||||||
|
for (int32_t priority = 0; priority < SECTION_AL_ITEM_PRIORITIES; priority++) {
|
||||||
|
if (itemDisplay.priorityDirty & (1 << priority)) {
|
||||||
|
CCharacterComponent::PasteToSection(SECTION_ARM_LOWER, itemDisplay.texture[priority], CCharacterComponent::s_textureBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::RenderPrepAU(CCharacterComponent* component) {
|
void CCharacterComponent::RenderPrepAU(CCharacterComponent* component) {
|
||||||
auto skin = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
auto& itemDisplay = component->m_itemDisplays[SECTION_ARM_UPPER];
|
||||||
CCharacterComponent::PasteFromSkin(SECTION_ARM_UPPER, skin, CCharacterComponent::s_textureBuffer);
|
|
||||||
|
|
||||||
// TODO
|
// Skin texture
|
||||||
|
|
||||||
|
auto skinTexture = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
||||||
|
CCharacterComponent::PasteFromSkin(SECTION_ARM_UPPER, skinTexture, CCharacterComponent::s_textureBuffer);
|
||||||
|
|
||||||
|
// Item textures
|
||||||
|
|
||||||
|
for (int32_t priority = 0; priority < SECTION_AU_ITEM_PRIORITIES; priority++) {
|
||||||
|
if (itemDisplay.priorityDirty & (1 << priority)) {
|
||||||
|
CCharacterComponent::PasteToSection(SECTION_ARM_UPPER, itemDisplay.texture[priority], CCharacterComponent::s_textureBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::RenderPrepFO(CCharacterComponent* component) {
|
void CCharacterComponent::RenderPrepFO(CCharacterComponent* component) {
|
||||||
auto skin = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
auto& itemDisplay = component->m_itemDisplays[SECTION_FOOT];
|
||||||
CCharacterComponent::PasteFromSkin(SECTION_FOOT, skin, CCharacterComponent::s_textureBuffer);
|
|
||||||
|
|
||||||
// TODO
|
// Skin texture
|
||||||
|
|
||||||
|
auto skinTexture = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
||||||
|
CCharacterComponent::PasteFromSkin(SECTION_FOOT, skinTexture, CCharacterComponent::s_textureBuffer);
|
||||||
|
|
||||||
|
// Item textures
|
||||||
|
|
||||||
|
for (int32_t priority = 0; priority < SECTION_FO_ITEM_PRIORITIES; priority++) {
|
||||||
|
if (itemDisplay.priorityDirty & (1 << priority)) {
|
||||||
|
CCharacterComponent::PasteToSection(SECTION_FOOT, itemDisplay.texture[priority], CCharacterComponent::s_textureBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::RenderPrepHA(CCharacterComponent* component) {
|
void CCharacterComponent::RenderPrepHA(CCharacterComponent* component) {
|
||||||
auto skin = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
auto& itemDisplay = component->m_itemDisplays[SECTION_HAND];
|
||||||
CCharacterComponent::PasteFromSkin(SECTION_HAND, skin, CCharacterComponent::s_textureBuffer);
|
|
||||||
|
|
||||||
// TODO
|
// Skin texture
|
||||||
|
|
||||||
|
auto skinTexture = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
||||||
|
CCharacterComponent::PasteFromSkin(SECTION_HAND, skinTexture, CCharacterComponent::s_textureBuffer);
|
||||||
|
|
||||||
|
// Item textures
|
||||||
|
|
||||||
|
for (int32_t priority = 0; priority < SECTION_HA_ITEM_PRIORITIES; priority++) {
|
||||||
|
if (itemDisplay.priorityDirty & (1 << priority)) {
|
||||||
|
CCharacterComponent::PasteToSection(SECTION_HAND, itemDisplay.texture[priority], CCharacterComponent::s_textureBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::RenderPrepHL(CCharacterComponent* component) {
|
void CCharacterComponent::RenderPrepHL(CCharacterComponent* component) {
|
||||||
@ -390,16 +446,22 @@ void CCharacterComponent::RenderPrepHL(CCharacterComponent* component) {
|
|||||||
nullptr
|
nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Skin texture
|
||||||
|
|
||||||
if (sectionsRec && sectionsRec->m_flags & 0x8) {
|
if (sectionsRec && sectionsRec->m_flags & 0x8) {
|
||||||
auto skin = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
auto skinTexture = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
||||||
CCharacterComponent::PasteFromSkin(SECTION_HEAD_LOWER, skin, CCharacterComponent::s_textureBuffer);
|
CCharacterComponent::PasteFromSkin(SECTION_HEAD_LOWER, skinTexture, CCharacterComponent::s_textureBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Face texture
|
||||||
|
|
||||||
auto faceLowerTexture = component->m_texture[TEXTURE_INDEX(VARIATION_FACE, 0)];
|
auto faceLowerTexture = component->m_texture[TEXTURE_INDEX(VARIATION_FACE, 0)];
|
||||||
if (faceLowerTexture) {
|
if (faceLowerTexture) {
|
||||||
CCharacterComponent::PasteToSection(SECTION_HEAD_LOWER, faceLowerTexture, CCharacterComponent::s_textureBuffer);
|
CCharacterComponent::PasteToSection(SECTION_HEAD_LOWER, faceLowerTexture, CCharacterComponent::s_textureBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hair textures
|
||||||
|
|
||||||
auto facialHairLowerTexture = component->m_texture[TEXTURE_INDEX(VARIATION_FACIAL_HAIR, 0)];
|
auto facialHairLowerTexture = component->m_texture[TEXTURE_INDEX(VARIATION_FACIAL_HAIR, 0)];
|
||||||
if (facialHairLowerTexture) {
|
if (facialHairLowerTexture) {
|
||||||
CCharacterComponent::PasteToSection(SECTION_HEAD_LOWER, facialHairLowerTexture, CCharacterComponent::s_textureBuffer);
|
CCharacterComponent::PasteToSection(SECTION_HEAD_LOWER, facialHairLowerTexture, CCharacterComponent::s_textureBuffer);
|
||||||
@ -422,16 +484,22 @@ void CCharacterComponent::RenderPrepHU(CCharacterComponent* component) {
|
|||||||
nullptr
|
nullptr
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Skin texture
|
||||||
|
|
||||||
if (sectionsRec && sectionsRec->m_flags & 0x8) {
|
if (sectionsRec && sectionsRec->m_flags & 0x8) {
|
||||||
auto skin = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
auto skinTexture = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
||||||
CCharacterComponent::PasteFromSkin(SECTION_HEAD_UPPER, skin, CCharacterComponent::s_textureBuffer);
|
CCharacterComponent::PasteFromSkin(SECTION_HEAD_UPPER, skinTexture, CCharacterComponent::s_textureBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Face texture
|
||||||
|
|
||||||
auto faceUpperTexture = component->m_texture[TEXTURE_INDEX(VARIATION_FACE, 1)];
|
auto faceUpperTexture = component->m_texture[TEXTURE_INDEX(VARIATION_FACE, 1)];
|
||||||
if (faceUpperTexture) {
|
if (faceUpperTexture) {
|
||||||
CCharacterComponent::PasteToSection(SECTION_HEAD_LOWER, faceUpperTexture, CCharacterComponent::s_textureBuffer);
|
CCharacterComponent::PasteToSection(SECTION_HEAD_LOWER, faceUpperTexture, CCharacterComponent::s_textureBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Hair textures
|
||||||
|
|
||||||
auto facialHairUpperTexture = component->m_texture[TEXTURE_INDEX(VARIATION_FACIAL_HAIR, 1)];
|
auto facialHairUpperTexture = component->m_texture[TEXTURE_INDEX(VARIATION_FACIAL_HAIR, 1)];
|
||||||
if (facialHairUpperTexture) {
|
if (facialHairUpperTexture) {
|
||||||
CCharacterComponent::PasteToSection(SECTION_HEAD_LOWER, facialHairUpperTexture, CCharacterComponent::s_textureBuffer);
|
CCharacterComponent::PasteToSection(SECTION_HEAD_LOWER, facialHairUpperTexture, CCharacterComponent::s_textureBuffer);
|
||||||
@ -444,45 +512,99 @@ void CCharacterComponent::RenderPrepHU(CCharacterComponent* component) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::RenderPrepLL(CCharacterComponent* component) {
|
void CCharacterComponent::RenderPrepLL(CCharacterComponent* component) {
|
||||||
auto skin = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
auto& itemDisplay = component->m_itemDisplays[SECTION_LEG_LOWER];
|
||||||
CCharacterComponent::PasteFromSkin(SECTION_LEG_LOWER, skin, CCharacterComponent::s_textureBuffer);
|
|
||||||
|
|
||||||
// TODO
|
// Skin texture
|
||||||
|
|
||||||
|
auto skinTexture = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
||||||
|
CCharacterComponent::PasteFromSkin(SECTION_LEG_LOWER, skinTexture, CCharacterComponent::s_textureBuffer);
|
||||||
|
|
||||||
|
// Item textures
|
||||||
|
|
||||||
|
auto firstPriority = 0;
|
||||||
|
auto itemPriorities = SECTION_LL_ITEM_PRIORITIES;
|
||||||
|
|
||||||
|
if (component->m_flags & 0x20) {
|
||||||
|
firstPriority = 1;
|
||||||
|
itemPriorities = SECTION_LL_ITEM_PRIORITIES - 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int32_t priority = firstPriority; priority < itemPriorities; priority++) {
|
||||||
|
if (itemDisplay.priorityDirty & (1 << priority)) {
|
||||||
|
CCharacterComponent::PasteToSection(SECTION_LEG_LOWER, itemDisplay.texture[priority], CCharacterComponent::s_textureBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::RenderPrepLU(CCharacterComponent* component) {
|
void CCharacterComponent::RenderPrepLU(CCharacterComponent* component) {
|
||||||
auto skin = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
auto& itemDisplay = component->m_itemDisplays[SECTION_LEG_UPPER];
|
||||||
CCharacterComponent::PasteFromSkin(SECTION_LEG_UPPER, skin, CCharacterComponent::s_textureBuffer);
|
|
||||||
|
|
||||||
if ((component->m_flags & 0x20) || !(component->m_itemDisplays[ITEMSLOT_5].priorityDirty & ((1 << 0) | (1 << 1)))) {
|
// Skin texture
|
||||||
auto underwearLowerTexture = component->m_texture[TEXTURE_INDEX(VARIATION_UNDERWEAR, 0)];
|
|
||||||
if (underwearLowerTexture) {
|
auto skinTexture = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
||||||
CCharacterComponent::PasteToSection(SECTION_LEG_UPPER, underwearLowerTexture, CCharacterComponent::s_textureBuffer);
|
CCharacterComponent::PasteFromSkin(SECTION_LEG_UPPER, skinTexture, CCharacterComponent::s_textureBuffer);
|
||||||
|
|
||||||
|
// Underwear texture
|
||||||
|
|
||||||
|
if ((component->m_flags & 0x20) || !(itemDisplay.priorityDirty & ((1 << 0) | (1 << 1)))) {
|
||||||
|
auto bottomUnderwearTexture = component->m_texture[TEXTURE_INDEX(VARIATION_UNDERWEAR, 0)];
|
||||||
|
if (bottomUnderwearTexture) {
|
||||||
|
CCharacterComponent::PasteToSection(SECTION_LEG_UPPER, bottomUnderwearTexture, CCharacterComponent::s_textureBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// Item textures
|
||||||
|
|
||||||
|
auto firstPriority = (component->m_flags & 0x20) ? 1 : 0;
|
||||||
|
|
||||||
|
for (int32_t priority = firstPriority; priority < SECTION_LU_ITEM_PRIORITIES; priority++) {
|
||||||
|
if (itemDisplay.priorityDirty & (1 << priority)) {
|
||||||
|
CCharacterComponent::PasteToSection(SECTION_LEG_UPPER, itemDisplay.texture[priority], CCharacterComponent::s_textureBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::RenderPrepTL(CCharacterComponent* component) {
|
void CCharacterComponent::RenderPrepTL(CCharacterComponent* component) {
|
||||||
auto skin = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
auto& itemDisplay = component->m_itemDisplays[SECTION_TORSO_LOWER];
|
||||||
CCharacterComponent::PasteFromSkin(SECTION_TORSO_LOWER, skin, CCharacterComponent::s_textureBuffer);
|
|
||||||
|
|
||||||
// TODO
|
// Skin texture
|
||||||
|
|
||||||
|
auto skinTexture = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
||||||
|
CCharacterComponent::PasteFromSkin(SECTION_TORSO_LOWER, skinTexture, CCharacterComponent::s_textureBuffer);
|
||||||
|
|
||||||
|
// Item textures
|
||||||
|
|
||||||
|
for (int32_t priority = 0; priority < SECTION_TL_ITEM_PRIORITIES; priority++) {
|
||||||
|
if (itemDisplay.priorityDirty & (1 << priority)) {
|
||||||
|
CCharacterComponent::PasteToSection(SECTION_TORSO_LOWER, itemDisplay.texture[priority], CCharacterComponent::s_textureBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::RenderPrepTU(CCharacterComponent* component) {
|
void CCharacterComponent::RenderPrepTU(CCharacterComponent* component) {
|
||||||
auto skin = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
auto& itemDisplay = component->m_itemDisplays[SECTION_TORSO_UPPER];
|
||||||
CCharacterComponent::PasteFromSkin(SECTION_TORSO_UPPER, skin, CCharacterComponent::s_textureBuffer);
|
|
||||||
|
|
||||||
if (!(component->m_itemDisplays[ITEMSLOT_3].priorityDirty & ((1 << 0) | (1 << 1) | (1 << 2)))) {
|
// Skin texture
|
||||||
auto underwearUpperTexture = component->m_texture[TEXTURE_INDEX(VARIATION_UNDERWEAR, 1)];
|
|
||||||
if (underwearUpperTexture) {
|
auto skinTexture = component->m_texture[TEXTURE_INDEX(VARIATION_SKIN, 0)];
|
||||||
CCharacterComponent::PasteToSection(SECTION_TORSO_UPPER, underwearUpperTexture, CCharacterComponent::s_textureBuffer);
|
CCharacterComponent::PasteFromSkin(SECTION_TORSO_UPPER, skinTexture, CCharacterComponent::s_textureBuffer);
|
||||||
|
|
||||||
|
// Underwear texture
|
||||||
|
|
||||||
|
if (!(itemDisplay.priorityDirty & ((1 << 0) | (1 << 1) | (1 << 2)))) {
|
||||||
|
auto topUnderwearTexture = component->m_texture[TEXTURE_INDEX(VARIATION_UNDERWEAR, 1)];
|
||||||
|
if (topUnderwearTexture) {
|
||||||
|
CCharacterComponent::PasteToSection(SECTION_TORSO_UPPER, topUnderwearTexture, CCharacterComponent::s_textureBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// Item textures
|
||||||
|
|
||||||
|
for (int32_t priority = 0; priority < SECTION_TU_ITEM_PRIORITIES; priority++) {
|
||||||
|
if (itemDisplay.priorityDirty & (1 << priority)) {
|
||||||
|
CCharacterComponent::PasteToSection(SECTION_TORSO_UPPER, itemDisplay.texture[priority], CCharacterComponent::s_textureBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCharacterComponent::UpdateBaseTexture(EGxTexCommand cmd, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipLevel, void* userArg, uint32_t& texelStrideInBytes, const void*& texels) {
|
void CCharacterComponent::UpdateBaseTexture(EGxTexCommand cmd, uint32_t width, uint32_t height, uint32_t depth, uint32_t mipLevel, void* userArg, uint32_t& texelStrideInBytes, const void*& texels) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user