1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Move TileAnimation code to seperate file

This commit is contained in:
sfan5 2016-12-23 13:48:32 +01:00
parent e2e8da5ee4
commit 523f0e8c5b
10 changed files with 168 additions and 48 deletions

View file

@ -567,19 +567,20 @@ void ParticleManager::addNodeParticle(IGameDef* gamedef, scene::ISceneManager* s
{
// Texture
u8 texid = myrand_range(0, 5);
video::ITexture *texture = tiles[texid].texture;
video::ITexture *texture;
// Only use first frame of animated texture
f32 ymax = 1;
if(tiles[texid].material_flags & MATERIAL_FLAG_ANIMATION_VERTICAL_FRAMES)
ymax /= tiles[texid].animation_frame_count;
if(tiles[texid].material_flags & MATERIAL_FLAG_ANIMATION)
texture = tiles[texid].frames[0].texture;
else
texture = tiles[texid].texture;
float size = rand() % 64 / 512.;
float visual_size = BS * size;
v2f texsize(size * 2, ymax * size * 2);
v2f texsize(size * 2, size * 2);
v2f texpos;
texpos.X = ((rand() % 64) / 64. - texsize.X);
texpos.Y = ymax * ((rand() % 64) / 64. - texsize.Y);
texpos.Y = ((rand() % 64) / 64. - texsize.Y);
// Physics
v3f velocity((rand() % 100 / 50. - 1) / 1.5,