the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 75 lines 2.2 kB view raw
1#include "stdafx.h" 2#include "..\Minecraft.World\Mth.h" 3#include "BlazeModel.h" 4#include "ModelPart.h" 5 6BlazeModel::BlazeModel() : Model() 7{ 8 upperBodyParts = ModelPartArray(12); 9 10 for (unsigned int i = 0; i < upperBodyParts.length; i++) 11 { 12 upperBodyParts[i] = new ModelPart(this, 0, 16); 13 upperBodyParts[i]->addBox(0, 0, 0, 2, 8, 2); 14 } 15 16 head = new ModelPart(this, 0, 0); 17 head->addBox(-4, -4, -4, 8, 8, 8); 18 19 // 4J added - compile now to avoid random performance hit first time cubes are rendered 20 // 4J Stu - Not just performance, but alpha+depth tests don't work right unless we compile here 21 for (unsigned int i = 0; i < upperBodyParts.length; i++) 22 { 23 upperBodyParts[i]->compile(1.0f/16.0f); 24 } 25 head->compile(1.0f/16.0f); 26} 27 28int BlazeModel::modelVersion() 29{ 30 return 8; 31} 32 33void BlazeModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) 34{ 35 setupAnim(time, r, bob, yRot, xRot, scale, entity); 36 37 head->render(scale, usecompiled); 38 for (unsigned int i = 0; i < upperBodyParts.length; i++) 39 { 40 upperBodyParts[i]->render(scale, usecompiled); 41 } 42} 43 44void BlazeModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim) 45{ 46 float angle = bob * PI * -.1f; 47 for (int i = 0; i < 4; i++) 48 { 49 upperBodyParts[i]->y = -2 + Mth::cos((i * 2 + bob) * .25f); 50 upperBodyParts[i]->x = Mth::cos(angle) * 9.0f; 51 upperBodyParts[i]->z = Mth::sin(angle) * 9.0f; 52 angle += PI * 0.5f; 53 } 54 angle = .25f * PI + bob * PI * .03f; 55 for (int i = 4; i < 8; i++) 56 { 57 upperBodyParts[i]->y = 2 + Mth::cos((i * 2 + bob) * .25f); 58 upperBodyParts[i]->x = Mth::cos(angle) * 7.0f; 59 upperBodyParts[i]->z = Mth::sin(angle) * 7.0f; 60 angle += PI * 0.5f; 61 } 62 63 angle = .15f * PI + bob * PI * -.05f; 64 for (int i = 8; i < 12; i++) 65 { 66 upperBodyParts[i]->y = 11 + Mth::cos((i * 1.5f + bob) * .5f); 67 upperBodyParts[i]->x = Mth::cos(angle) * 5.0f; 68 upperBodyParts[i]->z = Mth::sin(angle) * 5.0f; 69 angle += PI * 0.5f; 70 } 71 72 head->yRot = yRot / (float) (180 / PI); 73 head->xRot = xRot / (float) (180 / PI); 74} 75