diff --git a/Minecraft.Client/HumanoidModel.cpp b/Minecraft.Client/HumanoidModel.cpp index c6c6b9f4f..950cc29fc 100644 --- a/Minecraft.Client/HumanoidModel.cpp +++ b/Minecraft.Client/HumanoidModel.cpp @@ -140,6 +140,10 @@ HumanoidModel::HumanoidModel(float g, float yOffset, int texWidth, int texHeight _init(g,yOffset,texWidth,texHeight); } +bool HumanoidModel::bitmaskEnabled(unsigned int uiBitmask, animbits bit) +{ + return (uiBitmask&(1<0; +} void HumanoidModel::render(shared_ptr entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) { if(entity != nullptr) @@ -185,6 +189,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float //bool bIsAttacking = (attackTime > -9990.0f); { + head->yRot = yRot / (float) (180.0f / PI); head->xRot = xRot / (float) (180.0f / PI); hair->yRot = head->yRot; @@ -193,7 +198,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float // Does the skin have an override for anim? - if(uiBitmaskOverrideAnim&(1<xRot=0.0f; arm1->xRot=0.0f; @@ -201,14 +206,14 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float arm1->zRot = 0.0f; } - else if(uiBitmaskOverrideAnim&(1<xRot=-HALF_PI; arm1->xRot=-HALF_PI; arm0->zRot = 0.0f; arm1->zRot = 0.0f; } - else if(uiBitmaskOverrideAnim&(1<xRot = (Mth::cos(time * 0.6662f + PI) * 2.0f) * r * 0.5f; arm1->xRot = (Mth::cos(time * 0.6662f + PI) * 2.0f) * r * 0.5f; @@ -216,7 +221,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float arm1->zRot = 0.0f; } // 4J-PB - Weeping Angel - does't look good holding something in the arm that's up - else if((uiBitmaskOverrideAnim&(1<xRot = -PI; arm0->zRot = -0.3f; @@ -241,21 +246,24 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float if (riding) { - if(uiBitmaskOverrideAnim&(1<xRot += -HALF_PI * 0.4f; arm1->xRot += -HALF_PI * 0.4f; leg0->xRot = -HALF_PI * 0.8f; leg1->xRot = -HALF_PI * 0.8f; - leg0->yRot = HALF_PI * 0.2f; - leg1->yRot = -HALF_PI * 0.2f; } else { + //New arm0->xRot += -HALF_PI * 0.4f; arm1->xRot += -HALF_PI * 0.4f; - leg0->xRot = -HALF_PI * 0.4f; - leg1->xRot = -HALF_PI * 0.4f; + leg0->xRot = -HALF_PI * 0.8f; + leg1->xRot = -HALF_PI * 0.8f; + leg0->yRot = HALF_PI * 0.2f; + leg1->yRot = -HALF_PI * 0.2f; + } } else if(idle && !sneaking ) @@ -265,7 +273,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float leg0->yRot = HALF_PI * 0.2f; leg1->yRot = -HALF_PI * 0.2f; } - else if(uiBitmaskOverrideAnim&(1<xRot=0.0f; leg0->zRot=0.0f; @@ -274,7 +282,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float leg0->yRot = 0.0f; leg1->yRot = 0.0f; } - else if(uiBitmaskOverrideAnim&(1<xRot = ( Mth::cos(time * 0.6662f) * 1.4f) * r; leg1->xRot = ( Mth::cos(time * 0.6662f) * 1.4f) * r; @@ -318,7 +326,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float arm0->xRot -= aa * 1.2f + bb; // 4J - changed 1.2 -> 1.2f arm0->yRot += body->yRot * 2.0f; - if((uiBitmaskOverrideAnim&(1<zRot -= Mth::sin(attackTime * PI) * -0.4f; } @@ -345,7 +353,7 @@ void HumanoidModel::setupAnim(float time, float r, float bob, float yRot, float if (sneaking) { - if(uiBitmaskOverrideAnim&(1<xRot = -0.5f; leg0->xRot -= 0.0f; diff --git a/Minecraft.Client/HumanoidModel.h b/Minecraft.Client/HumanoidModel.h index 52f9d98e1..54f7c9363 100644 --- a/Minecraft.Client/HumanoidModel.h +++ b/Minecraft.Client/HumanoidModel.h @@ -60,6 +60,7 @@ class HumanoidModel : public Model void renderEars(float scale, bool usecompiled); void renderCloak(float scale, bool usecompiled); void render(HumanoidModel *model, float scale, bool usecompiled); + static bool bitmaskEnabled(unsigned int uiBitmask, animbits bit); // Add new bits to models ModelPart * AddOrRetrievePart(SKIN_BOX *pBox); diff --git a/Minecraft.Client/ItemInHandRenderer.cpp b/Minecraft.Client/ItemInHandRenderer.cpp index 66c922b42..663e754d5 100644 --- a/Minecraft.Client/ItemInHandRenderer.cpp +++ b/Minecraft.Client/ItemInHandRenderer.cpp @@ -287,6 +287,17 @@ void ItemInHandRenderer::renderItem(shared_ptr mob, shared_ptrgetAnimOverrideBitmask(), HumanoidModel::eAnim_SmallModel)) { + if (mob->isRiding()) { + std::shared_ptr ridingEntity = mob->riding; + if (ridingEntity != nullptr) //Safety check; + { + yo += 0.3f; //reverts the change in Boat.cpp for smaller models. + } + } + } glEnable(GL_RESCALE_NORMAL); glTranslatef(-xo, -yo, 0); float s = 1.5f; diff --git a/Minecraft.Client/PlayerRenderer.cpp b/Minecraft.Client/PlayerRenderer.cpp index a9b945440..4b56c96a5 100644 --- a/Minecraft.Client/PlayerRenderer.cpp +++ b/Minecraft.Client/PlayerRenderer.cpp @@ -199,11 +199,24 @@ void PlayerRenderer::render(shared_ptr _mob, double x, double y, double armorParts1->sneaking = armorParts2->sneaking = humanoidModel->sneaking = mob->isSneaking(); double yp = y - mob->heightOffset; - if (mob->isSneaking() && !mob->instanceof(eTYPE_LOCALPLAYER)) + if (mob->isSneaking()) { - yp -= 2 / 16.0f; + yp -= 2 / 16.0f; //Added more } + //For some reason the bitmask is zero here + unsigned int uiBitmaskOverrideAnim = mob->getSkinAnimOverrideBitmask(mob->getCustomSkin()); + if (HumanoidModel::bitmaskEnabled(uiBitmaskOverrideAnim, HumanoidModel::eAnim_SmallModel)) { + if (mob->isRiding()) { + std::shared_ptr ridingEntity = mob->riding; + if (ridingEntity != nullptr) //Safety check; + { + if (ridingEntity->instanceof(eTYPE_BOAT)) { + yp += 0.25f; //reverts the change in Boat.cpp for smaller models. + } + } + } + } // Check if an idle animation is needed if(mob->getAnimOverrideBitmask()&(1<attackTime = 0; humanoidModel->setupAnim(0, 0, 0, 0, 0, 1 / 16.0f, Minecraft::GetInstance()->player); // 4J-PB - does this skin have its arm0 disabled? (Dalek, etc) - if((humanoidModel->m_uiAnimOverrideBitmask&(1<m_uiAnimOverrideBitmask, HumanoidModel::eAnim_DisableRenderArm0)==0) { humanoidModel->arm0->render(1 / 16.0f,true); } diff --git a/Minecraft.World/Boat.cpp b/Minecraft.World/Boat.cpp index 60d0c807e..0f7516349 100644 --- a/Minecraft.World/Boat.cpp +++ b/Minecraft.World/Boat.cpp @@ -26,7 +26,7 @@ void Boat::_init() lxd = lyd = lzd = 0.0; blocksBuilding = true; - setSize(1.5f, 0.6f); + setSize(1.5f, 0.6f); heightOffset = (bbHeight / 2.0f) + 0.2f; // 4J Stu - This function call had to be moved here from the Entity ctor to ensure that @@ -87,7 +87,7 @@ Boat::Boat(Level *level, double x, double y, double z) : Entity( level ) double Boat::getRideHeight() { - return heightOffset; + return heightOffset - 0.5; } bool Boat::hurt(DamageSource *source, float hurtDamage)