More skin changes

Added armor skin layer to HumanoidModel.cpp and HumanoidModel.h and adjusted skin box code to handle new armor layer. Added SkinOffsets.h with SKIN_OFFSET type. Added code to DLCManager.cpp, DLCManager.h, DLCSkinFile.cpp, and DLCSkinFile.h to read skin offsets from DLC skin packs (Does not affect skin yet). Changed Steve skins back to their original 64x32 size for parity with official LCE. Removed some redundant code.
This commit is contained in:
Langtanium 2026-05-19 16:49:28 -07:00
parent b5847b1ae7
commit 131db508b5
28 changed files with 630 additions and 433 deletions

View file

@ -24,6 +24,7 @@ const WCHAR *DLCManager::wchTypeNamesA[]=
L"ENCHANTTEXTFOCUSCOLOUR",
L"DATAPATH",
L"PACKVERSION",
L"OFFSET",
};
DLCManager::DLCManager()

View file

@ -45,6 +45,7 @@ public:
e_DLCParamType_EnchantmentTextFocusColour,
e_DLCParamType_DataPath,
e_DLCParamType_PackVersion,
e_DLCParamType_Offset,
e_DLCParamType_Max,

View file

@ -160,11 +160,216 @@ void DLCSkinFile::addParameter(DLCManager::EDLCParameterType type, const wstring
{
pSkinBox->ePart=eBodyPart_Leg1;
}
else if(wcscmp(wchBodyPart,L"HEADWEAR")==0)
{
pSkinBox->ePart=eBodyPart_Headwear;
}
else if(wcscmp(wchBodyPart,L"JACKET")==0)
{
pSkinBox->ePart=eBodyPart_Jacket;
}
else if(wcscmp(wchBodyPart,L"SLEEVE0")==0)
{
pSkinBox->ePart=eBodyPart_Sleeve0;
}
else if(wcscmp(wchBodyPart,L"SLEEVE1")==0)
{
pSkinBox->ePart=eBodyPart_Sleeve1;
}
else if(wcscmp(wchBodyPart,L"PANTS0")==0)
{
pSkinBox->ePart=eBodyPart_Pants0;
}
else if(wcscmp(wchBodyPart,L"PANTS1")==0)
{
pSkinBox->ePart=eBodyPart_Pants1;
}
else if(wcscmp(wchBodyPart,L"WAIST")==0)
{
pSkinBox->ePart=eBodyPart_Waist;
}
else if(wcscmp(wchBodyPart,L"LEGGING0")==0)
{
pSkinBox->ePart=eBodyPart_Legging0;
}
else if(wcscmp(wchBodyPart,L"LEGGING1")==0)
{
pSkinBox->ePart=eBodyPart_Legging1;
}
else if(wcscmp(wchBodyPart,L"SOCK0")==0)
{
pSkinBox->ePart=eBodyPart_Sock0;
}
else if(wcscmp(wchBodyPart,L"SOCK1")==0)
{
pSkinBox->ePart=eBodyPart_Sock1;
}
else if(wcscmp(wchBodyPart,L"BOOT0")==0)
{
pSkinBox->ePart=eBodyPart_Boot0;
}
else if(wcscmp(wchBodyPart,L"BOOT1")==0)
{
pSkinBox->ePart=eBodyPart_Boot1;
}
else if(wcscmp(wchBodyPart,L"ARMARMOR0")==0)
{
pSkinBox->ePart=eBodyPart_ArmArmor0;
}
else if(wcscmp(wchBodyPart,L"ARMARMOR1")==0)
{
pSkinBox->ePart=eBodyPart_ArmArmor1;
}
else if(wcscmp(wchBodyPart,L"BODYARMOR")==0)
{
pSkinBox->ePart=eBodyPart_BodyArmor;
}
else if(wcscmp(wchBodyPart,L"BELT")==0)
{
pSkinBox->ePart=eBodyPart_Belt;
}
// add this to the skin's vector of parts
m_AdditionalBoxes.push_back(pSkinBox);
}
break;
case DLCManager::e_DLCParamType_Offset:
{
WCHAR wchBodyPart[10];
wchar_t wchDirection[2];
SKIN_OFFSET *pSkinOffset = new SKIN_OFFSET;
ZeroMemory(pSkinOffset,sizeof(SKIN_OFFSET));
#ifdef __PS3__
// 4J Stu - The Xbox version used swscanf_s which isn't available in GCC.
swscanf(value.c_str(), L"%10ls%2ls%f", wchBodyPart,
#else
swscanf_s(value.c_str(), L"%9ls%2ls%f", wchBodyPart,10, wchDirection,2,
#endif
&pSkinOffset->fO);
if(wcscmp(wchDirection,L"X")==0)
{
pSkinOffset->fD=eOffsetDirection_X;
}
else if (wcscmp(wchDirection,L"Y")==0)
{
pSkinOffset->fD=eOffsetDirection_Y;
}
else if(wcscmp(wchDirection,L"Z")==0)
{
pSkinOffset->fD=eOffsetDirection_Z;
}
if(wcscmp(wchBodyPart,L"HEAD")==0)
{
pSkinOffset->ePart=eBodyOffset_Head;
}
else if(wcscmp(wchBodyPart,L"BODY")==0)
{
pSkinOffset->ePart=eBodyOffset_Body;
}
else if(wcscmp(wchBodyPart,L"ARM0")==0)
{
pSkinOffset->ePart=eBodyOffset_Arm0;
}
else if(wcscmp(wchBodyPart,L"ARM1")==0)
{
pSkinOffset->ePart=eBodyOffset_Arm1;
}
else if(wcscmp(wchBodyPart,L"LEG0")==0)
{
pSkinOffset->ePart=eBodyOffset_Leg0;
}
else if(wcscmp(wchBodyPart,L"LEG1")==0)
{
pSkinOffset->ePart=eBodyOffset_Leg1;
}
else if(wcscmp(wchBodyPart,L"HEADWEAR")==0)
{
pSkinOffset->ePart=eBodyOffset_Headwear;
}
else if(wcscmp(wchBodyPart,L"JACKET")==0)
{
pSkinOffset->ePart=eBodyOffset_Jacket;
}
else if(wcscmp(wchBodyPart,L"SLEEVE0")==0)
{
pSkinOffset->ePart=eBodyOffset_Sleeve0;
}
else if(wcscmp(wchBodyPart,L"SLEEVE1")==0)
{
pSkinOffset->ePart=eBodyOffset_Sleeve1;
}
else if(wcscmp(wchBodyPart,L"PANTS0")==0)
{
pSkinOffset->ePart=eBodyOffset_Pants0;
}
else if(wcscmp(wchBodyPart,L"PANTS1")==0)
{
pSkinOffset->ePart=eBodyOffset_Pants1;
}
else if(wcscmp(wchBodyPart,L"HELMET")==0)
{
pSkinOffset->ePart=eBodyOffset_Helmet;
}
else if(wcscmp(wchBodyPart,L"WAIST")==0)
{
pSkinOffset->ePart=eBodyOffset_Waist;
}
else if(wcscmp(wchBodyPart,L"LEGGING0")==0)
{
pSkinOffset->ePart=eBodyOffset_Legging0;
}
else if(wcscmp(wchBodyPart,L"LEGGING1")==0)
{
pSkinOffset->ePart=eBodyOffset_Legging1;
}
else if(wcscmp(wchBodyPart,L"SOCK0")==0)
{
pSkinOffset->ePart=eBodyOffset_Sock0;
}
else if(wcscmp(wchBodyPart,L"SOCK1")==0)
{
pSkinOffset->ePart=eBodyOffset_Sock1;
}
else if(wcscmp(wchBodyPart,L"BOOT0")==0)
{
pSkinOffset->ePart=eBodyOffset_Boot0;
}
else if(wcscmp(wchBodyPart,L"BOOT1")==0)
{
pSkinOffset->ePart=eBodyOffset_Boot1;
}
else if(wcscmp(wchBodyPart,L"ARMARMOR1")==0)
{
pSkinOffset->ePart=eBodyOffset_ArmArmor1;
}
else if(wcscmp(wchBodyPart,L"ARMARMOR0")==0)
{
pSkinOffset->ePart=eBodyOffset_ArmArmor0;
}
else if(wcscmp(wchBodyPart,L"BODYARMOR")==0)
{
pSkinOffset->ePart=eBodyOffset_BodyArmor;
}
else if(wcscmp(wchBodyPart,L"BELT")==0)
{
pSkinOffset->ePart=eBodyOffset_Belt;
}
else if(wcscmp(wchBodyPart,L"TOOL0")==0)
{
pSkinOffset->ePart=eBodyOffset_Tool0;
}
else if(wcscmp(wchBodyPart,L"TOOL1")==0)
{
pSkinOffset->ePart=eBodyOffset_Tool1;
}
// add this to the skin's vector of offsets
m_Offsets.push_back(pSkinOffset);
}
break;
case DLCManager::e_DLCParamType_Anim:
#ifdef __PS3__
// 4J Stu - The Xbox version used swscanf_s which isn't available in GCC.

View file

@ -13,6 +13,7 @@ private:
unsigned int m_uiAnimOverrideBitmask;
bool m_bIsFree;
vector<SKIN_BOX *> m_AdditionalBoxes;
vector<SKIN_OFFSET *> m_Offsets;
_SkinAdjustments m_skinAdjustments;
public:
@ -26,6 +27,8 @@ public:
bool getParameterAsBool(DLCManager::EDLCParameterType type) override;
vector<SKIN_BOX *> *getAdditionalBoxes();
int getAdditionalBoxesCount();
vector<SKIN_OFFSET *> *getOffsets();
int getOffsetsCount();
unsigned int getAnimOverrideBitmask() { return m_uiAnimOverrideBitmask;}
bool isFree() {return m_bIsFree;}
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

File diff suppressed because it is too large Load diff

View file

@ -1,9 +1,11 @@
#pragma once
#include "Model.h"
#include "SkinOffset.h"
class HumanoidModel : public Model
{
public:
ModelPart* head, * hair, * body, * jacket, * arm0, * sleeve0, * arm1, * sleeve1, * leg0, * pants0, * leg1, * pants1, * ear, * cloak;
ModelPart* waist, * belt, * bodyArmor, * armArmor0, * armArmor1, * legging0, * legging1, * sock0, * sock1, * boot0, * boot1;
ModelPart* elytraLeft, * elytraRight;
int holdingLeftHand;
int holdingRightHand;
@ -69,16 +71,13 @@ public:
(1 << HumanoidModel::eAnim_DisableRenderPants0) |
(1 << HumanoidModel::eAnim_DisableRenderPants1);
void _init(float g, float yOffset, int texWidth, int texHeight,
bool slimHands, bool mirror, bool force32, bool isArmor = false);
void _init(float g, float yOffset, int texWidth, int texHeight, bool slim, bool isArmor);
HumanoidModel();
HumanoidModel(float g);
HumanoidModel(float g, bool isArmor);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands, bool mirror);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slimHands, bool mirror, bool force32);
HumanoidModel(float g, float yOffset, int texWidth, int texHeight, bool slim);
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob,
float yRot, float xRot, float scale, bool usecompiled);

View file

@ -18,7 +18,7 @@ LivingEntityRenderer::LivingEntityRenderer(Model *model, float shadow, bool isPl
if (isPlayer)
{
this->modelWide = new HumanoidModel(0, 0, 64, 64, false);
this->modelWide = new HumanoidModel(0, 0, 64, 64);
this->modelSlim = new HumanoidModel(0, 0, 64, 64, true);
}

View file

@ -77,9 +77,12 @@ PlayerRenderer::PlayerRenderer() : LivingEntityRenderer(new HumanoidModel(0), 0.
void PlayerRenderer::setModelType(shared_ptr<Player> player)
{
if (Player::GetModelTypeFromTextureId(player->getCustomSkin()) == 2 || Player::GetModelTypeFromAnimBitmask(player->getAnimOverrideBitmask()) == 2) resModel = humanoidModelSlim;
else if (Player::GetModelTypeFromTextureId(player->getCustomSkin()) == 1 || Player::GetModelTypeFromAnimBitmask(player->getAnimOverrideBitmask()) == 1) resModel = humanoidModelWide;
else resModel = humanoidModel;
if (Player::GetModelTypeFromTextureId(player->getCustomSkin()) == 2 || Player::GetModelTypeFromAnimBitmask(player->getAnimOverrideBitmask()) == 2)
resModel = humanoidModelSlim;
else if (Player::GetModelTypeFromTextureId(player->getCustomSkin()) == 1 || Player::GetModelTypeFromAnimBitmask(player->getAnimOverrideBitmask()) == 1)
resModel = humanoidModelWide;
else
resModel = humanoidModel;
}
unsigned int PlayerRenderer::getNametagColour(int index)
@ -93,7 +96,6 @@ int PlayerRenderer::prepareArmor(shared_ptr<LivingEntity> _player, int layer, fl
{
// 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<Player> player = dynamic_pointer_cast<Player>(_player);
setModelType(player);
// 4J-PB - need to disable rendering armour for some special skins (Daleks)
unsigned int uiAnimOverrideBitmask = player->getAnimOverrideBitmask();
@ -375,7 +377,6 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
// 4J - dynamic cast required because we aren't using templates/generics in our version
shared_ptr<Player> mob = dynamic_pointer_cast<Player>(_mob);
setModelType(mob);
shared_ptr<ItemInstance> headGear = mob->inventory->getArmor(3);
if (headGear != nullptr)
@ -478,7 +479,7 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
glRotatef(lean2 / 2, 0, 0, 1);
glRotatef(-lean2 / 2, 0, 1, 0);
glRotatef(180, 0, 1, 0);
resModel->renderCloak(1 / 16.0f, true);
humanoidModel->renderCloak(1 / 16.0f, true);
glPopMatrix();
}

View file

@ -9,11 +9,23 @@ enum eBodyPart
eBodyPart_Arm1,
eBodyPart_Leg0,
eBodyPart_Leg1,
eBodyPart_Headwear,
eBodyPart_Jacket,
eBodyPart_Sleeve0,
eBodyPart_Sleeve1,
eBodyPart_Pants0,
eBodyPart_Pants1,
eBodyPart_Waist,
eBodyPart_Legging0,
eBodyPart_Legging1,
eBodyPart_Sock0,
eBodyPart_Sock1,
eBodyPart_Boot0,
eBodyPart_Boot1,
eBodyPart_ArmArmor0,
eBodyPart_ArmArmor1,
eBodyPart_BodyArmor,
eBodyPart_Belt
};
typedef struct

View file

@ -0,0 +1,48 @@
#pragma once
enum eBodyOffset
{
eBodyOffset_Unknown=0,
eBodyOffset_Head,
eBodyOffset_Body,
eBodyOffset_Arm0,
eBodyOffset_Arm1,
eBodyOffset_Leg0,
eBodyOffset_Leg1,
eBodyOffset_Headwear,
eBodyOffset_Jacket,
eBodyOffset_Sleeve0,
eBodyOffset_Sleeve1,
eBodyOffset_Pants0,
eBodyOffset_Pants1,
eBodyOffset_Helmet,
eBodyOffset_Waist,
eBodyOffset_Legging0,
eBodyOffset_Legging1,
eBodyOffset_Sock0,
eBodyOffset_Sock1,
eBodyOffset_Boot0,
eBodyOffset_Boot1,
eBodyOffset_ArmArmor1,
eBodyOffset_ArmArmor0,
eBodyOffset_BodyArmor,
eBodyOffset_Belt,
eBodyOffset_Tool0,
eBodyOffset_Tool1
};
enum eOffsetDirection
{
eOffsetDirection_Unknown=0,
eOffsetDirection_X,
eOffsetDirection_Y,
eOffsetDirection_Z
};
typedef struct
{
eBodyOffset ePart;
float fD, fO;
}
SKIN_OFFSET;

View file

@ -25,12 +25,12 @@ void VillagerZombieModel::_init(float g, float yOffset, bool isArmor)
head->compile(1.0f/16.0f);
}
VillagerZombieModel::VillagerZombieModel() : HumanoidModel(0, 0, 64, 64, false, true, true)
VillagerZombieModel::VillagerZombieModel() : HumanoidModel(0, 0, 64, 64)
{
_init(0, 0, false);
}
VillagerZombieModel::VillagerZombieModel(float g, float yOffset, bool isArmor) : HumanoidModel(g, 0, 64, isArmor ? 32 : 64 , false, true, isArmor ? true : false)
VillagerZombieModel::VillagerZombieModel(float g, float yOffset, bool isArmor) : HumanoidModel(g, 0, 64, isArmor ? 32 : 64)
{
_init(g, yOffset, isArmor);
}

View file

@ -738,7 +738,6 @@ int Player::GetModelTypeFromTextureId(int textureId)
{
if (textureId > 8 && textureId < 18) return 2;
else if (textureId == 18) return 1;
else if (textureId >= 0 && textureId < 9) return 1;
else return 0;
}