Added skin box hide bit functionality

Added code to hide skin boxes when wearing a helmet if bit for said functionality is present.
This commit is contained in:
Langtanium 2026-04-14 16:30:16 -07:00
parent fd2fd65908
commit 24c74aa225
4 changed files with 6 additions and 1 deletions

View file

@ -109,6 +109,7 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox)
pNewBox = new ModelPart(this, static_cast<int>(pBox->fU), static_cast<int>(pBox->fV)); pNewBox = new ModelPart(this, static_cast<int>(pBox->fU), static_cast<int>(pBox->fV));
pNewBox->visible=false; pNewBox->visible=false;
if (pBox->fM > 0) pNewBox->bMirror = true; // check if this box has the mirror flag if (pBox->fM > 0) pNewBox->bMirror = true; // check if this box has the mirror flag
if (pBox->fA > 0) pNewBox->hideWithHelmet = true; // check if this box has the "hide when helmet" is worn flag
pNewBox->addHumanoidBox(pBox->fX, pBox->fY, pBox->fZ, pBox->fW, pBox->fH, pBox->fD, scale); pNewBox->addHumanoidBox(pBox->fX, pBox->fY, pBox->fZ, pBox->fW, pBox->fH, pBox->fD, scale);
// 4J-PB - don't compile here, since the lighting isn't set up. It'll be compiled on first use. // 4J-PB - don't compile here, since the lighting isn't set up. It'll be compiled on first use.
//pNewBox->compile(1.0f/16.0f); //pNewBox->compile(1.0f/16.0f);

View file

@ -13,6 +13,7 @@ void ModelPart::_init()
compiled=false; compiled=false;
bMirror = false; bMirror = false;
visible = true; visible = true;
hideWithHelmet = false;
neverRender = false; neverRender = false;
x=y=z = 0.0f; x=y=z = 0.0f;
xRot=yRot=zRot = 0.0f; xRot=yRot=zRot = 0.0f;

View file

@ -16,6 +16,7 @@ public:
float xRot, yRot, zRot; float xRot, yRot, zRot;
bool bMirror; bool bMirror;
bool visible; bool visible;
bool hideWithHelmet;
bool neverRender; bool neverRender;
vector <Cube *> cubes; vector <Cube *> cubes;
vector <ModelPart *> children; vector <ModelPart *> children;

View file

@ -258,7 +258,9 @@ void PlayerRenderer::render(shared_ptr<Entity> _mob, double x, double y, double
{ {
for(ModelPart *pModelPart : *pAdditionalModelParts) for(ModelPart *pModelPart : *pAdditionalModelParts)
{ {
pModelPart->visible=true; shared_ptr<ItemInstance> itemInstance = mob->inventory->getArmor(3);
if (itemInstance == nullptr || !pModelPart->hideWithHelmet)
pModelPart->visible=true;
} }
} }