the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at master 55 lines 1.8 kB view raw
1#include "stdafx.h" 2#include "SquidModel.h" 3#include "..\Minecraft.World\Mth.h" 4#include "ModelPart.h" 5 6SquidModel::SquidModel() : Model() 7{ 8 int yoffs = -16; 9 body = new ModelPart(this, 0, 0); 10 body->addBox(-6, -8, -6, 12, 16, 12); 11 body->y += (8 + 16) + yoffs; 12 13 for (int i = 0; i < TENTACLES_LENGTH; i++) // 4J - 8 was tentacles.length 14 { 15 tentacles[i] = new ModelPart(this, 48, 0); 16 17 double angle = i * PI * 2.0 / (double) TENTACLES_LENGTH; // 4J - 8 was tentacles.length 18 float xo = Mth::cos((float)angle) * 5; 19 float yo = Mth::sin((float)angle) * 5; 20 tentacles[i]->addBox(-1, 0, -1, 2, 18, 2); 21 22 tentacles[i]->x = xo; 23 tentacles[i]->z = yo; 24 tentacles[i]->y = (float)(31 + yoffs); 25 26 angle = i * PI * -2.0 / (double) TENTACLES_LENGTH + PI * .5; // 4J - 8 was tentacles.length 27 tentacles[i]->yRot = (float) angle; 28 29 // 4J added - compile now to avoid random performance hit first time cubes are rendered 30 tentacles[i]->compile(1.0f/16.0f); 31 } 32 body->compile(1.0f/16.0f); 33 34} 35 36void SquidModel::setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, shared_ptr<Entity> entity, unsigned int uiBitmaskOverrideAnim) 37{ 38 for (int i = 0; i < TENTACLES_LENGTH; i++) // 4J - 8 was tentacles.length 39 { 40 41 // tentacle angle is calculated in SquidRenderer 42 tentacles[i]->xRot = bob; 43 } 44} 45 46void SquidModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled) 47{ 48 setupAnim(time, r, bob, yRot, xRot, scale, entity); 49 50 body->render(scale, usecompiled); 51 for (int i = 0; i < TENTACLES_LENGTH; i++) // 4J - 8 was tentacles.length // 4J Stu - Was 9 but I made it 8 as the array is [0,8) 52 { 53 tentacles[i]->render(scale, usecompiled); 54 } 55}