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

Allow node cracking animations of any length

This commit is contained in:
Perttu Ahola 2012-06-16 18:02:56 +03:00
parent 2b500d72e5
commit 07ccc15fc2
4 changed files with 49 additions and 7 deletions

View file

@ -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="<<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