diff options
| author | daoge <3523206925@qq.com> | 2026-03-03 03:04:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-03 03:04:10 +0800 |
| commit | b3feddfef372618c8a9d7a0abcaf18cfad866c18 (patch) | |
| tree | 267761c3bb39241ba5c347bfbe2254d06686e287 /Minecraft.Client/WitherBossModel.cpp | |
| parent | 84c31a2331f7a0ec85b9d438992e244f60e5020f (diff) | |
feat: TU19 (Dec 2014) Features & Content (#155)
* try to resolve merge conflict
* feat: TU19 (Dec 2014) Features & Content (#32)
* December 2014 files
* Working release build
* Fix compilation issues
* Add sound to Windows64Media
* Add DLC content and force Tutorial DLC
* Revert "Add DLC content and force Tutorial DLC"
This reverts commit 97a43994725008e35fceb984d5549df9c8cea470.
* Disable broken light packing
* Disable breakpoint during DLC texture map load
Allows DLC loading but the DLC textures are still broken
* Fix post build not working
* ...
* fix vs2022 build
* fix cmake build
---------
Co-authored-by: Loki <lokirautio@gmail.com>
Diffstat (limited to 'Minecraft.Client/WitherBossModel.cpp')
| -rw-r--r-- | Minecraft.Client/WitherBossModel.cpp | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/Minecraft.Client/WitherBossModel.cpp b/Minecraft.Client/WitherBossModel.cpp new file mode 100644 index 00000000..626a8950 --- /dev/null +++ b/Minecraft.Client/WitherBossModel.cpp @@ -0,0 +1,80 @@ +#include "stdafx.h" +#include "WitherBossModel.h" +#include "..\Minecraft.World\WitherBoss.h" +#include "ModelPart.h" + +WitherBossModel::WitherBossModel() +{ + texWidth = 64; + texHeight = 64; + + upperBodyParts = ModelPartArray(3); + + upperBodyParts[0] = new ModelPart(this, 0, 16); + upperBodyParts[0]->addBox(-10, 3.9f, -.5f, 20, 3, 3); + + upperBodyParts[1] = new ModelPart(this); + upperBodyParts[1]->setTexSize(texWidth, texHeight); + upperBodyParts[1]->setPos(-2, 6.9f, -.5f); + upperBodyParts[1]->texOffs(0, 22)->addBox(0, 0, 0, 3, 10, 3); + upperBodyParts[1]->texOffs(24, 22)->addBox(-4.f, 1.5f, .5f, 11, 2, 2); + upperBodyParts[1]->texOffs(24, 22)->addBox(-4.f, 4, .5f, 11, 2, 2); + upperBodyParts[1]->texOffs(24, 22)->addBox(-4.f, 6.5f, .5f, 11, 2, 2); + + upperBodyParts[2] = new ModelPart(this, 12, 22); + upperBodyParts[2]->addBox(0, 0, 0, 3, 6, 3); + + heads = ModelPartArray(3); + heads[0] = new ModelPart(this, 0, 0); + heads[0]->addBox(-4, -4, -4, 8, 8, 8); + heads[1] = new ModelPart(this, 32, 0); + heads[1]->addBox(-4, -4, -4, 6, 6, 6); + heads[1]->x = -8; + heads[1]->y = 4; + heads[2] = new ModelPart(this, 32, 0); + heads[2]->addBox(-4, -4, -4, 6, 6, 6); + heads[2]->x = 10; + heads[2]->y = 4; +} + +int WitherBossModel::modelVersion() +{ + return 32; +} + +void WitherBossModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) +{ + setupAnim(time, r, bob, yRot, xRot, scale, entity); + + for (int i = 0; i < heads.length; i++) + { + heads[i]->render(scale, usecompiled); + } + for (int i = 0; i < upperBodyParts.length; i++) + { + upperBodyParts[i]->render(scale, usecompiled); + } +} + +void WitherBossModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim) +{ + float anim = cos(bob * .1f); + upperBodyParts[1]->xRot = (.065f + .05f * anim) * PI; + + upperBodyParts[2]->setPos(-2.f, 6.9f + cos(upperBodyParts[1]->xRot) * 10.f, -.5f + sin(upperBodyParts[1]->xRot) * 10.f); + upperBodyParts[2]->xRot = (.265f + .1f * anim) * PI; + + heads[0]->yRot = yRot / (180 / PI); + heads[0]->xRot = xRot / (180 / PI); +} + +void WitherBossModel::prepareMobModel(shared_ptr<LivingEntity> mob, float time, float r, float a) +{ + shared_ptr<WitherBoss> boss = dynamic_pointer_cast<WitherBoss>(mob); + + for (int i = 1; i < 3; i++) + { + heads[i]->yRot = (boss->getHeadYRot(i - 1) - mob->yBodyRot) / (180 / PI); + heads[i]->xRot = boss->getHeadXRot(i - 1) / (180 / PI); + } +}
\ No newline at end of file |
