From 07ccc15fc2f0f2abc7f67b51bbfcdc673f6b2869 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sat, 16 Jun 2012 18:02:56 +0300 Subject: Allow node cracking animations of any length --- src/game.cpp | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) (limited to 'src/game.cpp') diff --git a/src/game.cpp b/src/game.cpp index ac6d13af1..83e853b93 100644 --- a/src/game.cpp +++ b/src/game.cpp @@ -1225,6 +1225,16 @@ void the_game( */ Inventory local_inventory(itemdef); + /* + Find out size of crack animation + */ + int crack_animation_length = 5; + { + video::ITexture *t = tsrc->getTextureRaw("crack_anylength.png"); + v2u32 size = t->getOriginalSize(); + crack_animation_length = size.Y / size.X; + } + /* Add some gui stuff */ @@ -2271,20 +2281,20 @@ void the_game( if(dig_time_complete >= 0.001) { - dig_index = (u16)((float)CRACK_ANIMATION_LENGTH + dig_index = (u16)((float)crack_animation_length * dig_time/dig_time_complete); } // This is for torches else { - dig_index = CRACK_ANIMATION_LENGTH; + dig_index = crack_animation_length; } // Don't show cracks if not diggable if(dig_time_complete >= 100000.0) { } - else if(dig_index < CRACK_ANIMATION_LENGTH) + else if(dig_index < crack_animation_length) { //TimeTaker timer("client.setTempMod"); //infostream<<"dig_index="<