diff --git a/Minecraft.Client/HumanoidModel.cpp b/Minecraft.Client/HumanoidModel.cpp index b0a394945..f83012cb6 100644 --- a/Minecraft.Client/HumanoidModel.cpp +++ b/Minecraft.Client/HumanoidModel.cpp @@ -109,7 +109,7 @@ ModelPart * HumanoidModel::AddOrRetrievePart(SKIN_BOX *pBox) pNewBox = new ModelPart(this, static_cast(pBox->fU), static_cast(pBox->fV)); pNewBox->visible=false; 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->hideWithArmor = (unsigned int)pBox->fA; // add the "hide when armor is worn" bit flags 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. //pNewBox->compile(1.0f/16.0f); diff --git a/Minecraft.Client/ItemInHandRenderer.cpp b/Minecraft.Client/ItemInHandRenderer.cpp index e3be5c90d..462cb81fe 100644 --- a/Minecraft.Client/ItemInHandRenderer.cpp +++ b/Minecraft.Client/ItemInHandRenderer.cpp @@ -286,7 +286,6 @@ void ItemInHandRenderer::renderItem(shared_ptr mob, shared_ptr mob, shared_ptr player = dynamic_pointer_cast(mob); - vector* pModelOffsets = nullptr; - if (player != nullptr) - pModelOffsets = player->GetModelOffsets(); - if (pModelOffsets != nullptr) - { - for( SKIN_OFFSET *pModelOffset : *pModelOffsets ) - { - switch (pModelOffset->ePart) - { - case eBodyOffset_Arm0: - if(pModelOffset->fD == 1) - xo += pModelOffset->fO / 16.0f; - else if(pModelOffset->fD == 2) - zo += pModelOffset->fO / 16.0f; - else if(pModelOffset->fD == 3) - yo += pModelOffset->fO / 16.0f; - break; - case eBodyOffset_Tool0: - if(pModelOffset->fD == 1) - xo += pModelOffset->fO / 16.0f; - else if(pModelOffset->fD == 2) - zo += pModelOffset->fO / 16.0f; - else if(pModelOffset->fD == 3) - yo += pModelOffset->fO / 16.0f; - break; - } - } - } - glEnable(GL_RESCALE_NORMAL); - glTranslatef(-xo, -yo, -zo); + glTranslatef(-xo, -yo, 0); float s = 1.5f; glScalef(s, s, s); diff --git a/Minecraft.Client/ModelPart.cpp b/Minecraft.Client/ModelPart.cpp index 2ea9d04b6..ac081f78b 100644 --- a/Minecraft.Client/ModelPart.cpp +++ b/Minecraft.Client/ModelPart.cpp @@ -13,7 +13,7 @@ void ModelPart::_init() compiled=false; bMirror = false; visible = true; - hideWithHelmet = false; + hideWithArmor = 0L; isArmorPart1 = false; neverRender = false; x=y=z = 0.0f; diff --git a/Minecraft.Client/ModelPart.h b/Minecraft.Client/ModelPart.h index 575dbcbb9..df3b1e8b0 100644 --- a/Minecraft.Client/ModelPart.h +++ b/Minecraft.Client/ModelPart.h @@ -16,7 +16,7 @@ public: float xRot, yRot, zRot; bool bMirror; bool visible; - bool hideWithHelmet; + unsigned int hideWithArmor; bool isArmorPart1; bool neverRender; vector cubes; diff --git a/Minecraft.Client/PlayerRenderer.cpp b/Minecraft.Client/PlayerRenderer.cpp index f311b2bc7..b115601f9 100644 --- a/Minecraft.Client/PlayerRenderer.cpp +++ b/Minecraft.Client/PlayerRenderer.cpp @@ -270,25 +270,6 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double shared_ptr itemLeggings = mob->inventory->getArmor(1); shared_ptr itemBoots = mob->inventory->getArmor(0); - // Hide armor layer of skin if corresponnding piece of armor is worn - Langtanium - if (itemChestplate != nullptr && resModel->texHeight == 64) - { - resModel->bodyArmor->visible=false; - resModel->armArmor0->visible=false; - resModel->armArmor1->visible=false; - } - if (itemLeggings != nullptr && resModel->texHeight == 64) - { - resModel->belt->visible=false; - resModel->legging0->visible=false; - resModel->legging1->visible=false; - } - if (itemBoots != nullptr && resModel->texHeight == 64) - { - resModel->boot0->visible=false; - resModel->boot1->visible=false; - } - // 4J-PB - any additional parts to turn on for this player (skin dependent) vector *pAdditionalModelParts=mob->GetAdditionalModelParts(); //turn them on @@ -296,7 +277,15 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double { for(ModelPart *pModelPart : *pAdditionalModelParts) { - if (itemHelmet == nullptr || !pModelPart->hideWithHelmet) // Hide the skin boxes that have the "hide when helmet is worn" flag - Langtanium + if (itemHelmet != nullptr && pModelPart->hideWithArmor&(1<<0)) // Hide the skin boxes that have the "hide when helmet is worn" bit flag - Langtanium + pModelPart->visible=false; + else if (itemChestplate != nullptr && pModelPart->hideWithArmor&(1<<1)) // Hide the skin boxes that have the "hide when chestplate is worn" bit flag - Langtanium + pModelPart->visible=false; + else if (itemLeggings != nullptr && pModelPart->hideWithArmor&(1<<2)) // Hide the skin boxes that have the "hide when leggings are worn" bit flag - Langtanium + pModelPart->visible=false; + else if (itemBoots != nullptr && pModelPart->hideWithArmor&(1<<3)) // Hide the skin boxes that have the "hide when boots are worn" bit flag - Langtanium + pModelPart->visible=false; + else pModelPart->visible=true; } }