aboutsummaryrefslogtreecommitdiff
path: root/src/game.cpp
diff options
context:
space:
mode:
authorPerttu Ahola <celeron55@gmail.com>2012-06-16 18:02:56 +0300
committerPerttu Ahola <celeron55@gmail.com>2012-06-16 18:02:56 +0300
commit07ccc15fc2f0f2abc7f67b51bbfcdc673f6b2869 (patch)
treea8717a38b84455cdc042b80ca0ef45e9802610ea /src/game.cpp
parent2b500d72e5bcf30bb960c2878918c0105219e450 (diff)
downloadminetest-07ccc15fc2f0f2abc7f67b51bbfcdc673f6b2869.tar.gz
minetest-07ccc15fc2f0f2abc7f67b51bbfcdc673f6b2869.tar.bz2
minetest-07ccc15fc2f0f2abc7f67b51bbfcdc673f6b2869.zip
Allow node cracking animations of any length
Diffstat (limited to 'src/game.cpp')
-rw-r--r--src/game.cpp18
1 files changed, 14 insertions, 4 deletions
diff --git a/src/game.cpp b/src/game.cpp
index ac6d13af1..83e853b93 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1226,6 +1226,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="<<dig_index<<std::endl;
@@ -2302,7 +2312,7 @@ void the_game(
digging = false;
nodig_delay_timer = dig_time_complete
- / (float)CRACK_ANIMATION_LENGTH;
+ / (float)crack_animation_length;
// We don't want a corresponding delay to
// very time consuming nodes