the game where you go into mines and start crafting! but for consoles (forked directly from smartcmd's github)
at main 104 lines 2.7 kB view raw
1#include "stdafx.h" 2#include "..\Minecraft.World\JavaMath.h" 3#include "DragonBreathParticle.h" 4 5void DragonBreathParticle::init(Level *level, double x, double y, double z, double xa, double ya, double za, float scale) 6{ 7 xd *= 0.1f; 8 yd *= 0.1f; 9 zd *= 0.1f; 10 xd = xa; //+= xa; 11 yd = ya; //+= ya; 12 zd = za; //+= za; 13 14 unsigned int cMin = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Particle_DragonBreathMin ); //0xb700d2 15 unsigned int cMax = Minecraft::GetInstance()->getColourTable()->getColor( eMinecraftColour_Particle_DragonBreathMax ); //0xdf00f9 16 double rMin = ( (cMin>>16)&0xFF )/255.0f, gMin = ( (cMin>>8)&0xFF )/255.0, bMin = ( cMin&0xFF )/255.0; 17 double rMax = ( (cMax>>16)&0xFF )/255.0f, gMax = ( (cMax>>8)&0xFF )/255.0, bMax = ( cMax&0xFF )/255.0; 18 19 rCol = (rMax - rMin) * Math::random() + rMin; // 184/255 -- 224/255 20 gCol = (gMax - gMin) * Math::random() + gMin; // 0,0 21 bCol = (bMax - bMin) * Math::random() + bMin; // 210/255 -- 250/255 22 23 size *= 0.75f; 24 size *= scale; 25 oSize = size; 26 27 lifetime = (int) (20 / (Math::random() * 0.8 + 0.2)); 28 lifetime = (int) (lifetime * scale); 29 noPhysics = false; 30 31 m_bHasHitGround = false; 32} 33 34DragonBreathParticle::DragonBreathParticle(Level *level, double x, double y, double z, double xa, double ya, double za) : Particle(level, x, y, z, 0, 0, 0) 35{ 36 init(level, x, y, z, xa, ya, za, 1); 37} 38 39DragonBreathParticle::DragonBreathParticle(Level *level, double x, double y, double z, double xa, double ya, double za, float scale) : Particle(level, x, y, z, 0, 0, 0) 40{ 41 init(level, x, y, z, xa, ya, za, scale); 42} 43 44void DragonBreathParticle::render(Tesselator *t, float a, float xa, float ya, float za, float xa2, float za2) 45{ 46 float l = ((age + a) / lifetime) * 32; 47 if (l < 0) l = 0; 48 if (l > 1) l = 1; 49 50 size = oSize * l; 51 Particle::render(t, a, xa, ya, za, xa2, za2); 52} 53 54void DragonBreathParticle::tick() 55{ 56 xo = x; 57 yo = y; 58 zo = z; 59 60 if (age++ >= lifetime) remove(); 61 62 setMiscTex( ( 3 * age / lifetime) + 5 ); 63 64 if(onGround) 65 { 66 yd = 0; 67 m_bHasHitGround = true; 68 } 69 70 if(m_bHasHitGround) yd += 0.002; //0.004; 71 72 move(xd, yd, zd); 73 if (y == yo) 74 { 75 xd *= 1.1; 76 zd *= 1.1; 77 } 78 xd *= 0.96f; 79 zd *= 0.96f; 80 81 if(m_bHasHitGround) yd *= 0.96f; 82 83 // if (onGround) 84 //{ 85 // xd *= 0.7f; 86 // zd *= 0.7f; 87 // } 88} 89 90int DragonBreathParticle::getParticleTexture() 91{ 92 return ParticleEngine::DRAGON_BREATH_TEXTURE; 93} 94 95float DragonBreathParticle::getBrightness(float a) 96{ 97 float l = ((age + a) / lifetime) * 32; 98 if (l < 0) l = 0; 99 if (l > 1) l = 1; 100 101 float brightness = (0.5f / l) + 0.5f; 102 103 return brightness; 104}