Implement new animation system - is backwards compatible with old animations, since they only use the first 3 values, which are ultimately output identically

This commit is contained in:
George Paton 2024-01-24 16:12:15 +11:00
parent b5b3131d04
commit 5a7367624f
20 changed files with 389 additions and 357 deletions

View File

@ -18,6 +18,7 @@ import com.hbm.potion.HbmPotion;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationKeyframe;
import com.hbm.render.anim.BusAnimationSequence;
import com.hbm.render.anim.BusAnimationSequence.Dimension;
import com.hbm.render.anim.HbmAnimations.AnimType;
import com.hbm.render.util.RenderScreenOverlay.Crosshair;
@ -70,13 +71,13 @@ public class Gun12GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL_TRANSLATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, -2, 100))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200))
.addKeyframePosition(0, 0, -2, 100)
.addKeyframePosition(0, 0, 0, 200)
)
.addBus("PUMP", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 450))
.addKeyframe(new BusAnimationKeyframe(0, 0, -1.8, 200))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200))
.addKeyframePosition(0, 0, 0, 450)
.addKeyframePosition(0, 0, -1.8, 200)
.addKeyframePosition(0, 0, 0, 200)
)
);
@ -110,20 +111,18 @@ public class Gun12GaugeFactory {
config.config = HbmCollection.g12hs;
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("SPAS_RECOIL_TRANSLATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, -2, 100))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200))
)
.addBus("SPAS_RECOIL_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-1, 0, 1, 100))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200))
)
.addBus("SPAS_PUMP", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 450))
.addKeyframe(new BusAnimationKeyframe(0, 0, -1.8, 200))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200))
)
);
.addBus("SPAS_RECOIL", new BusAnimationSequence()
.addKeyframePosition(0, 0, -2, 100)
.addKeyframePosition(0, 0, 0, 200)
.addKeyframeRotation(-10, 0, 5, 100)
.addKeyframeRotation(0, 0, 0, 200)
)
.addBus("SPAS_PUMP", new BusAnimationSequence()
.addKeyframe(Dimension.TZ, 0, 450)
.addKeyframe(Dimension.TZ, -1.8, 200)
.addKeyframe(Dimension.TZ, 0, 200)
)
);
config.ejector = EJECTOR_SPAS;
@ -200,24 +199,24 @@ public class Gun12GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("SHOTTY_RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0.5, 0, 0, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50))
.addKeyframePosition(0.5, 0, 0, 50)
.addKeyframePosition(0, 0, 0, 50)
)
.addBus("SHOTTY_BREAK", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100)) //do nothing for 100ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 60, 200)) //open
.addKeyframe(new BusAnimationKeyframe(0, 0, 60, 500)) //do nothing for 500ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200)) //close
.addKeyframePosition(0, 0, 0, 100) //do nothing for 100ms
.addKeyframePosition(0, 0, 60, 200) //open
.addKeyframePosition(0, 0, 60, 500) //do nothing for 500ms
.addKeyframePosition(0, 0, 0, 200) //close
)
.addBus("SHOTTY_EJECT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300)) //do nothing for 300ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 700)) //fling!
.addKeyframePosition(0, 0, 0, 300) //do nothing for 300ms
.addKeyframePosition(1, 0, 0, 700) //fling!
)
.addBus("SHOTTY_INSERT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300)) //do nothing for 300ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 1, 0)) //reposition
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 350)) //come in from the side
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 150)) //push
.addKeyframePosition(0, 0, 0, 300) //do nothing for 300ms
.addKeyframePosition(1, 0, 1, 0) //reposition
.addKeyframePosition(1, 0, 0, 350) //come in from the side
.addKeyframePosition(0, 0, 0, 150) //push
)
);
@ -252,26 +251,26 @@ public class Gun12GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(6.25, 0.25, 2.5, 55))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 55))
.addKeyframePosition(6.25, 0.25, 2.5, 55)
.addKeyframePosition(0, 0, 0, 55)
)
.addBus("EJECT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 25))
.addKeyframe(new BusAnimationKeyframe(25, 0, 0, 100))
.addKeyframePosition(0, 0, 0, 25)
.addKeyframePosition(25, 0, 0, 100)
)
);
config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("RELOAD", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(60, 0, -10, 400))
.addKeyframe(new BusAnimationKeyframe(60, 125, -10, 200))
.addKeyframe(new BusAnimationKeyframe(60, 125, -10, 300))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300))
.addKeyframePosition(60, 0, -10, 400)
.addKeyframePosition(60, 125, -10, 200)
.addKeyframePosition(60, 125, -10, 300)
.addKeyframePosition(0, 0, 0, 300)
)
.addBus("PUMP", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 900))
.addKeyframe(new BusAnimationKeyframe(10, 0, 0, 200))
.addKeyframe(new BusAnimationKeyframe())
.addKeyframePosition(0, 0, 0, 900)
.addKeyframePosition(10, 0, 0, 200)
.addKeyframePosition(0, 0, 0, 1)
)
);

View File

@ -50,16 +50,16 @@ public class Gun20GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("LEVER_ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250))
.addKeyframe(new BusAnimationKeyframe(0, 0, 45, 500))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500))
.addKeyframePosition(0, 0, 0, 250)
.addKeyframePosition(0, 0, 45, 500)
.addKeyframePosition(0, 0, 0, 500)
)
.addBus("LEVER_RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0.5, 0, 0, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 150))
.addKeyframe(new BusAnimationKeyframe(0, -0.5, 0, 500))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500))
.addKeyframePosition(0.5, 0, 0, 50)
.addKeyframePosition(0, 0, 0, 50)
.addKeyframePosition(0, 0, 0, 150)
.addKeyframePosition(0, -0.5, 0, 500)
.addKeyframePosition(0, 0, 0, 500)
)
);

View File

@ -81,12 +81,12 @@ public class Gun45ACPFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("SLIDE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 10))// Wait for hammer
.addKeyframe(new BusAnimationKeyframe(0, 0, -3.5, 40))// Slide back
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 40)))// Return
.addKeyframePosition(0, 0, 0, 10)// Wait for hammer
.addKeyframePosition(0, 0, -3.5, 40)// Slide back
.addKeyframePosition(0, 0, 0, 40))// Return
.addBus("HAMMER", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(15, 0, 0, 10))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 40))));
.addKeyframePosition(15, 0, 0, 10)
.addKeyframePosition(0, 0, 0, 40)));
return config;
}

View File

@ -109,25 +109,25 @@ public class Gun4GaugeFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("SAUER_RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0.5, 0, 0, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50))
.addKeyframePosition(0.5, 0, 0, 50)
.addKeyframePosition(0, 0, 0, 50)
)
.addBus("SAUER_TILT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0.0, 0, 0, 200)) // do nothing for 200ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 30, 150)) //tilt forward
.addKeyframe(new BusAnimationKeyframe(45, 0, 30, 150)) //tilt sideways
.addKeyframe(new BusAnimationKeyframe(45, 0, 30, 200)) //do nothing for 200ms (eject)
.addKeyframe(new BusAnimationKeyframe(0, 0, 30, 150)) //restore sideways
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 150)) //restore forward
.addKeyframePosition(0.0, 0, 0, 200) // do nothing for 200ms
.addKeyframePosition(0, 0, 30, 150) //tilt forward
.addKeyframePosition(45, 0, 30, 150) //tilt sideways
.addKeyframePosition(45, 0, 30, 200) //do nothing for 200ms (eject)
.addKeyframePosition(0, 0, 30, 150) //restore sideways
.addKeyframePosition(0, 0, 0, 150) //restore forward
)
.addBus("SAUER_COCK", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)) //do nothing for 500ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 100)) //pull back lever for 100ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100)) //release lever for 100ms
.addKeyframePosition(0, 0, 0, 500) //do nothing for 500ms
.addKeyframePosition(1, 0, 0, 100) //pull back lever for 100ms
.addKeyframePosition(0, 0, 0, 100) //release lever for 100ms
)
.addBus("SAUER_SHELL_EJECT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)) //do nothing for 500ms
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 500)) //FLING!
.addKeyframePosition(0, 0, 0, 500) //do nothing for 500ms
.addKeyframePosition(0, 0, 1, 500) //FLING!
)
);

View File

@ -138,20 +138,20 @@ public class Gun50BMGFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75))
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
)
);
config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("TILT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 125))
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 750))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 125))
.addKeyframePosition(1, 0, 0, 125)
.addKeyframePosition(1, 0, 0, 750)
.addKeyframePosition(0, 0, 0, 125)
)
.addBus("MAG", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 200))
.addKeyframe(new BusAnimationKeyframe(1, 0, 1, 200))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200))
.addKeyframePosition(0, 0, 1, 200)
.addKeyframePosition(1, 0, 1, 200)
.addKeyframePosition(0, 0, 0, 200)
)
);
@ -191,8 +191,8 @@ public class Gun50BMGFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75))
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
)
);
@ -238,10 +238,10 @@ public class Gun50BMGFactory {
config.animations.put(AnimType.CYCLE,
new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-0.45, 0.15, 0, 40)) // Moves back and raise slightly
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75))) // Then forward again
.addBus("EJECT", new BusAnimationSequence().addKeyframe(new BusAnimationKeyframe(0, 0, 0, 30)) // Wait
.addKeyframe(new BusAnimationKeyframe(50, 0, 0, 120)))); // Fly // out
.addKeyframePosition(-0.45, 0.15, 0, 40) // Moves back and raise slightly
.addKeyframePosition(0, 0, 0, 75)) // Then forward again
.addBus("EJECT", new BusAnimationSequence().addKeyframePosition(0, 0, 0, 30) // Wait
.addKeyframePosition(50, 0, 0, 120))); // Fly // out
config.ejector = EJECTOR_SNIPER;
return config;

View File

@ -94,8 +94,8 @@ public class Gun556mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0.5, 0, 0, 25))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75))
.addKeyframePosition(0.5, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
)
);

View File

@ -49,25 +49,25 @@ public class Gun75BoltFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75))
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
)
.addBus("EJECT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 25))
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 75))
.addKeyframePosition(0, 0, 0, 25)
.addKeyframePosition(0, 0, 1, 75)
)
);
config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("TILT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 250))
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 1500))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250))
.addKeyframePosition(1, 0, 0, 250)
.addKeyframePosition(1, 0, 0, 1500)
.addKeyframePosition(0, 0, 0, 250)
)
.addBus("MAG", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 500))
.addKeyframe(new BusAnimationKeyframe(1, 0, 1, 500))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500))
.addKeyframePosition(0, 0, 1, 500)
.addKeyframePosition(1, 0, 1, 500)
.addKeyframePosition(0, 0, 0, 500)
)
);

View File

@ -58,15 +58,15 @@ public class Gun762mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75))
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
)
);
config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("MAG", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, -1, 0, 500))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500))
.addKeyframePosition(0, -1, 0, 500)
.addKeyframePosition(0, 0, 0, 500)
)
);
@ -177,19 +177,19 @@ public class Gun762mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75))
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
)
.addBus("LEVER_PULL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 375)) //wait out recoil and lever flick
.addKeyframe(new BusAnimationKeyframe(-1, 0, 0, 375)) //pull back bolt
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 375)) //release bolt
.addKeyframePosition(0, 0, 0, 375) //wait out recoil and lever flick
.addKeyframePosition(-1, 0, 0, 375) //pull back bolt
.addKeyframePosition(0, 0, 0, 375) //release bolt
)
.addBus("LEVER_ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250)) //wait out recoil
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 125)) //flick up lever in 125ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 750)) //pull action
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 125)) //flick down lever again
.addKeyframePosition(0, 0, 0, 250) //wait out recoil
.addKeyframePosition(1, 0, 0, 125) //flick up lever in 125ms
.addKeyframePosition(1, 0, 0, 750) //pull action
.addKeyframePosition(0, 0, 0, 125) //flick down lever again
)
);
@ -216,19 +216,19 @@ public class Gun762mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75))
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
)
.addBus("LEVER_PULL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 375)) //wait out recoil and lever flick
.addKeyframe(new BusAnimationKeyframe(-1, 0, 0, 375)) //pull back bolt
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 375)) //release bolt
.addKeyframePosition(0, 0, 0, 375) //wait out recoil and lever flick
.addKeyframePosition(-1, 0, 0, 375) //pull back bolt
.addKeyframePosition(0, 0, 0, 375) //release bolt
)
.addBus("LEVER_ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250)) //wait out recoil
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 125)) //flick up lever in 125ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 750)) //pull action
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 125)) //flick down lever again
.addKeyframePosition(0, 0, 0, 250) //wait out recoil
.addKeyframePosition(1, 0, 0, 125) //flick up lever in 125ms
.addKeyframePosition(1, 0, 0, 750) //pull action
.addKeyframePosition(0, 0, 0, 125) //flick down lever again
)
);
@ -259,19 +259,19 @@ public class Gun762mmFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75))
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
)
.addBus("LEVER_PULL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 375)) //wait out recoil and lever flick
.addKeyframe(new BusAnimationKeyframe(-1, 0, 0, 375)) //pull back bolt
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 375)) //release bolt
.addKeyframePosition(0, 0, 0, 375) //wait out recoil and lever flick
.addKeyframePosition(-1, 0, 0, 375) //pull back bolt
.addKeyframePosition(0, 0, 0, 375) //release bolt
)
.addBus("LEVER_ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250)) //wait out recoil
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 125)) //flick up lever in 125ms
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 750)) //pull action
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 125)) //flick down lever again
.addKeyframePosition(0, 0, 0, 250) //wait out recoil
.addKeyframePosition(1, 0, 0, 125) //flick up lever in 125ms
.addKeyframePosition(1, 0, 0, 750) //pull action
.addKeyframePosition(0, 0, 0, 125) //flick down lever again
)
);

View File

@ -42,8 +42,8 @@ public class GunGaussFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 25))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75))
.addKeyframePosition(1, 0, 0, 25)
.addKeyframePosition(0, 0, 0, 75)
)
);

View File

@ -84,23 +84,23 @@ public class GunRocketFactory {
config.animations.put(AnimType.CYCLE, new BusAnimation()
.addBus("QUADRO_RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, -0.5, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50))
.addKeyframePosition(0, 0, -0.5, 50)
.addKeyframePosition(0, 0, 0, 50)
)
);
config.animations.put(AnimType.RELOAD, new BusAnimation()
.addBus("QUADRO_RELOAD_ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 60, 750))
.addKeyframe(new BusAnimationKeyframe(0, 0, 60, 3500))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 750))
.addKeyframePosition(0, 0, 60, 750)
.addKeyframePosition(0, 0, 60, 3500)
.addKeyframePosition(0, 0, 0, 750)
)
.addBus("QUADRO_RELOAD_PUSH", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-1, -1, 0, 0))
.addKeyframe(new BusAnimationKeyframe(-1, -1, 0, 750))
.addKeyframe(new BusAnimationKeyframe(-1, 0, 0, 500))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 3000))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 750))
.addKeyframePosition(-1, -1, 0, 0)
.addKeyframePosition(-1, -1, 0, 750)
.addKeyframePosition(-1, 0, 0, 500)
.addKeyframePosition(0, 0, 0, 3000)
.addKeyframePosition(0, 0, 0, 750)
)
);

View File

@ -128,7 +128,7 @@ public class ItemBoltgun extends Item implements IAnimatedItem {
public BusAnimation getAnimation(NBTTagCompound data, ItemStack stack) {
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 1, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 100)));
.addKeyframePosition(1, 0, 1, 50)
.addKeyframePosition(0, 0, 1, 100));
}
}

View File

@ -23,16 +23,16 @@ public class ItemCoilgun extends ItemGunBase {
if(type == AnimType.CYCLE) {
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 100))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200)));
.addKeyframePosition(1, 0, 0, 100)
.addKeyframePosition(0, 0, 0, 200));
}
if(type == AnimType.RELOAD) {
return new BusAnimation()
.addBus("RELOAD", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 250))
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 500))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250)));
.addKeyframePosition(1, 0, 0, 250)
.addKeyframePosition(1, 0, 0, 500)
.addKeyframePosition(0, 0, 0, 250));
}
GunConfiguration config = ((ItemGunBase) stack.getItem()).mainConfig;

View File

@ -70,54 +70,54 @@ public class ItemGunBio extends ItemGunBase {
lastShot = System.currentTimeMillis();
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, -3, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250))
.addKeyframePosition(0, 0, 0, 50)
.addKeyframePosition(0, 0, -3, 50)
.addKeyframePosition(0, 0, 0, 250)
)
.addBus("HAMMER", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 300))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200))
.addKeyframePosition(0, 0, 1, 50)
.addKeyframePosition(0, 0, 1, 300)
.addKeyframePosition(0, 0, 0, 200)
)
.addBus("DRUM", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 50))
.addKeyframePosition(0, 0, 1, 50)
);
}
if(type == AnimType.RELOAD) {
return new BusAnimation()
.addBus("LATCH", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 90, 300))
.addKeyframe(new BusAnimationKeyframe(0, 0, 90, 2000))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 150))
.addKeyframePosition(0, 0, 90, 300)
.addKeyframePosition(0, 0, 90, 2000)
.addKeyframePosition(0, 0, 0, 150)
)
.addBus("FRONT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200))
.addKeyframe(new BusAnimationKeyframe(0, 0, 45, 150))
.addKeyframe(new BusAnimationKeyframe(0, 0, 45, 2000))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 75))
.addKeyframePosition(0, 0, 0, 200)
.addKeyframePosition(0, 0, 45, 150)
.addKeyframePosition(0, 0, 45, 2000)
.addKeyframePosition(0, 0, 0, 75)
)
.addBus("RELOAD_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300))
.addKeyframe(new BusAnimationKeyframe(60, 0, 0, 500))
.addKeyframe(new BusAnimationKeyframe(60, 0, 0, 500))
.addKeyframe(new BusAnimationKeyframe(0, -90, -90, 0))
.addKeyframe(new BusAnimationKeyframe(0, -90, -90, 600))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100))
.addKeyframe(new BusAnimationKeyframe(-45, 0, 0, 50))
.addKeyframe(new BusAnimationKeyframe(-45, 0, 0, 100))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300))
.addKeyframePosition(0, 0, 0, 300)
.addKeyframePosition(60, 0, 0, 500)
.addKeyframePosition(60, 0, 0, 500)
.addKeyframePosition(0, -90, -90, 0)
.addKeyframePosition(0, -90, -90, 600)
.addKeyframePosition(0, 0, 0, 300)
.addKeyframePosition(0, 0, 0, 100)
.addKeyframePosition(-45, 0, 0, 50)
.addKeyframePosition(-45, 0, 0, 100)
.addKeyframePosition(0, 0, 0, 300)
)
.addBus("RELOAD_MOVE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300))
.addKeyframe(new BusAnimationKeyframe(0, -15, 0, 1000))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 450))
.addKeyframePosition(0, 0, 0, 300)
.addKeyframePosition(0, -15, 0, 1000)
.addKeyframePosition(0, 0, 0, 450)
)
.addBus("DRUM_PUSH", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 1600))
.addKeyframe(new BusAnimationKeyframe(0, 0, -5, 0))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 300))
.addKeyframePosition(0, 0, 0, 1600)
.addKeyframePosition(0, 0, -5, 0)
.addKeyframePosition(0, 0, 0, 300)
);
}

View File

@ -23,12 +23,12 @@ public class ItemGunCongo extends ItemGunBase {
if(type == AnimType.CYCLE) {
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100)))
.addKeyframePosition(1, 0, 0, 50)
.addKeyframePosition(0, 0, 0, 100))
.addBus("PUMP", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500))
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 100))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200)));
.addKeyframePosition(0, 0, 0, 500)
.addKeyframePosition(1, 0, 0, 100)
.addKeyframePosition(0, 0, 0, 200));
}

View File

@ -65,7 +65,7 @@ public class ItemGunPip extends ItemGunBase {
if(type == AnimType.EQUIP) {
return new BusAnimation()
.addBus("ROTATE", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-360, 0, 0, 350))
.addKeyframePosition(-360, 0, 0, 350)
);
}
@ -74,17 +74,17 @@ public class ItemGunPip extends ItemGunBase {
int s = 1;
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 50 * s))
.addKeyframe(new BusAnimationKeyframe(0, 0, -3, 50 * s))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 250 * s))
.addKeyframePosition(0, 0, 0, 50 * s)
.addKeyframePosition(0, 0, -3, 50 * s)
.addKeyframePosition(0, 0, 0, 250 * s)
)
.addBus("HAMMER", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 50 * s))
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 300 * s))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200 * s))
.addKeyframePosition(0, 0, 1, 50 * s)
.addKeyframePosition(0, 0, 1, 300 * s)
.addKeyframePosition(0, 0, 0, 200 * s)
)
.addBus("DRUM", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 50 * s))
.addKeyframePosition(0, 0, 1, 50 * s)
);
}
@ -92,44 +92,44 @@ public class ItemGunPip extends ItemGunBase {
int s = 1;
return new BusAnimation()
.addBus("RELAOD_TILT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-15, 0, 0, 100 * s))
.addKeyframe(new BusAnimationKeyframe(65, 0, 0, 100 * s)) //200
.addKeyframe(new BusAnimationKeyframe(45, 0, 0, 50 * s)) //250
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200 * s)) //450
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 1450 * s)) //1900
.addKeyframe(new BusAnimationKeyframe(-80, 0, 0, 100 * s)) //2000
.addKeyframe(new BusAnimationKeyframe(-80, 0, 0, 100 * s)) //2100
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200 * s)) //2300
.addKeyframePosition(-15, 0, 0, 100 * s)
.addKeyframePosition(65, 0, 0, 100 * s) //200
.addKeyframePosition(45, 0, 0, 50 * s) //250
.addKeyframePosition(0, 0, 0, 200 * s) //450
.addKeyframePosition(0, 0, 0, 1450 * s) //1900
.addKeyframePosition(-80, 0, 0, 100 * s) //2000
.addKeyframePosition(-80, 0, 0, 100 * s) //2100
.addKeyframePosition(0, 0, 0, 200 * s) //2300
)
.addBus("RELOAD_CYLINDER", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 200 * s))
.addKeyframe(new BusAnimationKeyframe(90, 0, 0, 100 * s)) //300
.addKeyframe(new BusAnimationKeyframe(90, 0, 0, 1700 * s)) //2000
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 70 * s)) //2100
.addKeyframePosition(0, 0, 0, 200 * s)
.addKeyframePosition(90, 0, 0, 100 * s) //300
.addKeyframePosition(90, 0, 0, 1700 * s) //2000
.addKeyframePosition(0, 0, 0, 70 * s) //2100
)
.addBus("RELOAD_LIFT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 350 * s))
.addKeyframe(new BusAnimationKeyframe(-45, 0, 0, 250 * s)) //600
.addKeyframe(new BusAnimationKeyframe(-45, 0, 0, 350 * s)) //950
.addKeyframe(new BusAnimationKeyframe(-15, 0, 0, 200 * s)) //1150
.addKeyframe(new BusAnimationKeyframe(-15, 0, 0, 1050 * s)) //2200
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100 * s)) //2300
.addKeyframePosition(0, 0, 0, 350 * s)
.addKeyframePosition(-45, 0, 0, 250 * s) //600
.addKeyframePosition(-45, 0, 0, 350 * s) //950
.addKeyframePosition(-15, 0, 0, 200 * s) //1150
.addKeyframePosition(-15, 0, 0, 1050 * s) //2200
.addKeyframePosition(0, 0, 0, 100 * s) //2300
)
.addBus("RELOAD_JOLT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 600 * s))
.addKeyframe(new BusAnimationKeyframe(2, 0, 0, 50 * s)) //650
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 100 * s)) //750
.addKeyframePosition(0, 0, 0, 600 * s)
.addKeyframePosition(2, 0, 0, 50 * s) //650
.addKeyframePosition(0, 0, 0, 100 * s) //750
)
.addBus("RELOAD_BULLETS", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 650 * s))
.addKeyframe(new BusAnimationKeyframe(10, 0, 0, 300 * s)) //950
.addKeyframe(new BusAnimationKeyframe(10, 0, 0, 200 * s)) //1150
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 700 * s)) //1850
.addKeyframePosition(0, 0, 0, 650 * s)
.addKeyframePosition(10, 0, 0, 300 * s) //950
.addKeyframePosition(10, 0, 0, 200 * s) //1150
.addKeyframePosition(0, 0, 0, 700 * s) //1850
)
.addBus("RELOAD_BULLETS_CON", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 0 * s))
.addKeyframe(new BusAnimationKeyframe(1, 0, 0, 950 * s))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 1 * s))
.addKeyframePosition(1, 0, 0, 0 * s)
.addKeyframePosition(1, 0, 0, 950 * s)
.addKeyframePosition(0, 0, 0, 1 * s)
);
}

View File

@ -1740,9 +1740,9 @@ public class ClientProxy extends ServerProxy {
BusAnimation animation = new BusAnimation()
.addBus("GUARD_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(90, 0, 1, 0))
.addKeyframe(new BusAnimationKeyframe(90, 0, 1, 800))
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 50)));
.addKeyframePosition(90, 0, 1, 0)
.addKeyframePosition(90, 0, 1, 800)
.addKeyframePosition(0, 0, 1, 50));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
}
@ -1756,13 +1756,13 @@ public class ClientProxy extends ServerProxy {
BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(90 - offset, 90 - offset, 35, 75))
.addKeyframe(new BusAnimationKeyframe(90 + offset, 90 - offset, -45, 150))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)))
.addKeyframePosition(90 - offset, 90 - offset, 35, 75)
.addKeyframePosition(90 + offset, 90 - offset, -45, 150)
.addKeyframePosition(0, 0, 0, 500))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(-3, 0, 0, 75))
.addKeyframe(new BusAnimationKeyframe(8, 0, 0, 150))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, 500)));
.addKeyframePosition(-3, 0, 0, 75)
.addKeyframePosition(8, 0, 0, 150)
.addKeyframePosition(0, 0, 0, 500));
Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("hbm:weapon.cSwing"), 0.8F + player.getRNG().nextFloat() * 0.2F));
@ -1781,13 +1781,13 @@ public class ClientProxy extends ServerProxy {
BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 90, forward))
.addKeyframe(new BusAnimationKeyframe(45, 0, 90, sideways))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, retire)))
.addKeyframePosition(0, 0, 90, forward)
.addKeyframePosition(45, 0, 90, sideways)
.addKeyframePosition(0, 0, 0, retire))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(0, 0, 3, forward))
.addKeyframe(new BusAnimationKeyframe(2, 0, 2, sideways))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, retire)));
.addKeyframePosition(0, 0, 3, forward)
.addKeyframePosition(2, 0, 2, sideways)
.addKeyframePosition(0, 0, 0, retire));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
@ -1801,15 +1801,15 @@ public class ClientProxy extends ServerProxy {
BusAnimation animation = new BusAnimation()
.addBus("SWING_ROT", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(rot[0], rot[1], rot[2], 0))
.addKeyframe(new BusAnimationKeyframe(0, 0, 90, forward))
.addKeyframe(new BusAnimationKeyframe(45, 0, 90, sideways))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, retire)))
.addKeyframePosition(rot[0], rot[1], rot[2], 0)
.addKeyframePosition(0, 0, 90, forward)
.addKeyframePosition(45, 0, 90, sideways)
.addKeyframePosition(0, 0, 0, retire))
.addBus("SWING_TRANS", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(trans[0], trans[1], trans[2], 0))
.addKeyframe(new BusAnimationKeyframe(0, 0, 3, forward))
.addKeyframe(new BusAnimationKeyframe(2, 0, 2, sideways))
.addKeyframe(new BusAnimationKeyframe(0, 0, 0, retire)));
.addKeyframePosition(trans[0], trans[1], trans[2], 0)
.addKeyframePosition(0, 0, 3, forward)
.addKeyframePosition(2, 0, 2, sideways)
.addKeyframePosition(0, 0, 0, retire));
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
}

View File

@ -8,46 +8,55 @@ public class BusAnimationKeyframe {
//two frames could be implemented
public static enum InterpolationType {
NONE,
SMOOTH
LINEAR
}
//unimplemented, all current animations are absolute
//whether the transformation happens on its own or relative to the last state
//i.e. 5 with 15 being the previous would be 20 additive and 5 absolute, simple enough
public static enum StateType {
ADDITIVE,
ABSOLTE
}
public double x;
public double y;
public double z;
// public double x;
// public double y;
// public double z;
public double value;
public InterpolationType interpolationType;
public int duration;
public double[] toArray() {
return new double[] {x, y, z};
}
// public double[] toArray() {
// return new double[] {x, y, z};
// }
//this one can be used for "reset" type keyframes
public BusAnimationKeyframe() {
this.x = 0;
this.y = 0;
this.z = 0;
// this.x = 0;
// this.y = 0;
// this.z = 0;
this.value = 0;
this.duration = 1;
this.interpolationType = InterpolationType.SMOOTH;
this.interpolationType = InterpolationType.LINEAR;
}
public BusAnimationKeyframe(double x, double y, double z, int duration) {
public BusAnimationKeyframe(double value, int duration) {
this();
this.x = x;
this.y = y;
this.z = z;
this.value = value;
this.duration = duration;
}
public BusAnimationKeyframe(double x, double y, double z, int duration, InterpolationType interpolation) {
this(x, y, z, duration);
public BusAnimationKeyframe(double value, int duration, InterpolationType interpolation) {
this(value, duration);
this.interpolationType = interpolation;
}
// public BusAnimationKeyframe(double x, double y, double z, int duration) {
// this();
// this.x = x;
// this.y = y;
// this.z = z;
// this.duration = duration;
// }
// public BusAnimationKeyframe(double x, double y, double z, int duration, InterpolationType interpolation) {
// this(x, y, z, duration);
// this.interpolationType = interpolation;
// }
}

View File

@ -7,105 +7,120 @@ import com.hbm.render.anim.BusAnimationKeyframe.InterpolationType;
//the actual bus, a sequence of keyframes with their own behavior and such
public class BusAnimationSequence {
//not actually useful for anything since the renderer usually handles
//this part, but it's nice to have for distinction just in case
public static enum EnumTransformation {
UNDEFINED,
ROTATION,
TRANSLATION,
SCALE
public static enum Dimension {
TX,
TY,
TZ,
RX,
RY,
RZ,
SX,
SY,
SZ
}
private List<BusAnimationKeyframe> keyframes = new ArrayList();
public EnumTransformation transformationType;
// Storing a matrix of keyframe data, each keyframe stores a SINGLE dimension, so we can stagger frames over each parameter
private List<List<BusAnimationKeyframe>> transformKeyframes = new ArrayList<List<BusAnimationKeyframe>>(9);
public BusAnimationSequence() {
// Initialise our keyframe storage, since it's multidimensional
for (int i = 0; i < 9; i++) {
transformKeyframes.add(new ArrayList<BusAnimationKeyframe>());
}
}
//appends a keyframe at the end of the sequence
public BusAnimationSequence addKeyframe(BusAnimationKeyframe keyframe) {
keyframes.add(keyframe);
// Adds a keyframe to the given dimension
public BusAnimationSequence addKeyframe(Dimension dimension, BusAnimationKeyframe keyframe) {
transformKeyframes.get(dimension.ordinal()).add(keyframe);
return this;
}
public BusAnimationSequence addKeyframe(Dimension dimension, double value, int duration) {
transformKeyframes.get(dimension.ordinal()).add(new BusAnimationKeyframe(value, duration));
return this;
}
// Two helper methods for the old hard-coded animations
public BusAnimationSequence addKeyframePosition(double x, double y, double z, int duration) {
addKeyframe(Dimension.TX, new BusAnimationKeyframe(x, duration));
addKeyframe(Dimension.TY, new BusAnimationKeyframe(y, duration));
addKeyframe(Dimension.TZ, new BusAnimationKeyframe(z, duration));
return this;
}
public BusAnimationSequence addKeyframeRotation(double x, double y, double z, int duration) {
addKeyframe(Dimension.RX, new BusAnimationKeyframe(x, duration));
addKeyframe(Dimension.RY, new BusAnimationKeyframe(y, duration));
addKeyframe(Dimension.RZ, new BusAnimationKeyframe(z, duration));
return this;
}
//all transformation data is absolute, additive transformations have not yet been implemented
public double[] getTransformation(int millis) {
BusAnimationKeyframe frame = getFrameAtTime(millis);
if(frame == null)
return null;
//if no interpolation type is set, just return the new coords
if(frame.interpolationType == InterpolationType.NONE)
return frame.toArray();
//if this is the first frame, the "previous" values are 0
double[] previous = new double[] {0, 0, 0};
BusAnimationKeyframe lastFrame = getPreviousFrame(frame);
if(lastFrame != null)
previous = lastFrame.toArray();
//the time elapsed during the frame is the total current time minus the starting timie of the current frame
int frameTime = millis - getStartingTime(frame);
double interpolation = (double)frameTime / (double)frame.duration;
double[] transform = new double[9];
double interX = (frame.x - previous[0]) * interpolation + previous[0];
double interY = (frame.y - previous[1]) * interpolation + previous[1];
double interZ = (frame.z - previous[2]) * interpolation + previous[2];
return new double[] {interX, interY, interZ};
}
public BusAnimationKeyframe getFrameAtTime(int millis) {
for (int i = 0; i < 9; i++) {
List<BusAnimationKeyframe> keyframes = transformKeyframes.get(i);
int time = 0;
for(BusAnimationKeyframe frame : keyframes) {
time += frame.duration;
if(millis < time)
return frame;
BusAnimationKeyframe currentFrame = null;
BusAnimationKeyframe previousFrame = null;
int startTime = 0;
int endTime = 0;
for (BusAnimationKeyframe keyframe: keyframes) {
startTime = endTime;
endTime += keyframe.duration;
previousFrame = currentFrame;
currentFrame = keyframe;
if (millis < endTime) break;
}
if (currentFrame == null || millis >= endTime) {
// Scale defaults to 1, others are 0
transform[i] = i >= 6 ? 1 : 0;
continue;
}
if (currentFrame.interpolationType == InterpolationType.NONE) {
transform[i] = currentFrame.value;
continue;
}
double a = currentFrame.value;
double b = previousFrame != null ? previousFrame.value : 0;
double t = (double)(millis - startTime) / (double)currentFrame.duration;
transform[i] = (a - b) * t + b;
}
return null;
}
public BusAnimationKeyframe getPreviousFrame(BusAnimationKeyframe frame) {
int index = keyframes.indexOf(frame);
if(index == 0)
return null;
return keyframes.get(index - 1);
}
public int getStartingTime(BusAnimationKeyframe start) {
int time = 0;
for(BusAnimationKeyframe frame : keyframes) {
if(frame == start)
break;
time += frame.duration;
}
return time;
return transform;
}
public int getTotalTime() {
int highestTime = 0;
int time = 0;
for(BusAnimationKeyframe frame : keyframes) {
time += frame.duration;
for (List<BusAnimationKeyframe> keyframes: transformKeyframes) {
int time = 0;
for (BusAnimationKeyframe frame: keyframes) {
time += frame.duration;
}
highestTime = Math.max(time, highestTime);
}
return time;
return highestTime;
}
}

View File

@ -4,6 +4,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import org.lwjgl.opengl.GL11;
public class HbmAnimations {
//in flans mod and afaik also MW, there's an issue that there is only one
@ -83,7 +85,21 @@ public class HbmAnimations {
}
}
return new double[] {0, 0, 0};
return new double[] {
0, 0, 0, // position
0, 0, 0, // rotation
1, 1, 1 // scale
};
}
public static void applyRelevantTransformation(String bus) {
double[] transform = getRelevantTransformation(bus);
GL11.glTranslated(transform[0], transform[1], transform[2]);
GL11.glRotated(transform[3], 1, 0, 0);
GL11.glRotated(transform[4], 0, 1, 0);
GL11.glRotated(transform[5], 0, 0, 1);
GL11.glScaled(transform[6], transform[7], transform[8]);
}
}

View File

@ -44,24 +44,17 @@ public class ItemRenderWeaponSpas12 implements IItemRenderer {
case EQUIPPED_FIRST_PERSON:
double[] recoilT = HbmAnimations.getRelevantTransformation("SPAS_RECOIL_TRANSLATE");
double[] recoilR = HbmAnimations.getRelevantTransformation("SPAS_RECOIL_ROT");
double[] pump = HbmAnimations.getRelevantTransformation("SPAS_PUMP");
double s0 = 0.5D;
GL11.glRotated(25, 0, 0, 1);
GL11.glTranslated(0, -0.8, 0.1);
GL11.glRotated(80, 0, 1, 0);
GL11.glScaled(s0, s0, s0);
int m = 2;
GL11.glTranslated(recoilT[0]*m, recoilT[1]*m, recoilT[2]*m);
GL11.glRotated(2, recoilR[0]*m, recoilR[1]*m, recoilR[2]*m);
HbmAnimations.applyRelevantTransformation("SPAS_RECOIL");
ResourceManager.spas_12.renderPart("MainBody");
GL11.glTranslated(pump[0], pump[1], pump[2]);
HbmAnimations.applyRelevantTransformation("SPAS_PUMP");
ResourceManager.spas_12.renderPart("PumpGrip");