5919: Tweak the running visuals r=def- a=VoxelDoesCode

Sorry for putting this off for so long. Turns out animating with raw code is harder than you'd think.

https://user-images.githubusercontent.com/95713843/194726134-40925aea-6ec4-40ae-9597-b80a28d1b6a2.mp4



## Checklist

- [x] Tested the change ingame
- [x] Provided screenshots if it is a visual change
- [ ] Tested in combination with possibly related configuration options
- [ ] Written a unit test (especially base/) or added coverage to integration test
- [ ] Considered possible null pointers and out of bounds array indexing
- [x] Changed no physics that affect existing maps
- [ ] Tested the change with [ASan+UBSan or valgrind's memcheck](https://github.com/ddnet/ddnet/#using-addresssanitizer--undefinedbehavioursanitizer-or-valgrinds-memcheck) (optional)


Co-authored-by: VoxelDoesCode <bluheadcat@gmail.com>
This commit is contained in:
bors[bot] 2022-10-08 22:58:13 +00:00 committed by GitHub
commit b7da20826d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 27 deletions

View file

@ -501,50 +501,52 @@ anim.front_foot.frames.Add(AnimKeyframe(0.8, 8, 0, 0))
anim.front_foot.frames.Add(AnimKeyframe(1.0,-10,-4, 0.2))
container.animations.Add(anim)
# the run_left animation is taken directly from run_right, only the x and rotate values are flipped,
# and each string is run backwards, to account for how it's played in game.
anim = Animation("run_left")
anim.body.frames.Add(AnimKeyframe(0.0, 0, -2, 0))
anim.body.frames.Add(AnimKeyframe(0.0, 0, -1, 0))
anim.body.frames.Add(AnimKeyframe(0.2, 0, 0, 0))
anim.body.frames.Add(AnimKeyframe(0.4, 0, 0, 0))
anim.body.frames.Add(AnimKeyframe(0.6, 0, -2, 0))
anim.body.frames.Add(AnimKeyframe(0.4, 0, -1, 0))
anim.body.frames.Add(AnimKeyframe(0.6, 0, 0, 0))
anim.body.frames.Add(AnimKeyframe(0.8, 0, 0, 0))
anim.body.frames.Add(AnimKeyframe(1.0, 0, -2, 0))
anim.body.frames.Add(AnimKeyframe(1.0, 0, -1, 0))
anim.back_foot.frames.Add(AnimKeyframe(0.0, 18, -11, -0.27))
anim.back_foot.frames.Add(AnimKeyframe(0.0, 18, -8, -0.27))
anim.back_foot.frames.Add(AnimKeyframe(0.2, 6, 0, 0))
anim.back_foot.frames.Add(AnimKeyframe(0.4, -7, 0, 0))
anim.back_foot.frames.Add(AnimKeyframe(0.6, -13, -4.5, 0.05))
anim.back_foot.frames.Add(AnimKeyframe(0.8, 0, -11, -0.2))
anim.back_foot.frames.Add(AnimKeyframe(1.0, 18, -11, -0.27))
anim.back_foot.frames.Add(AnimKeyframe(0.8, 0, -8, -0.2))
anim.back_foot.frames.Add(AnimKeyframe(1.0, 18, -8, -0.27))
anim.front_foot.frames.Add(AnimKeyframe(0.0, -13, -4.5, 0.05))
anim.front_foot.frames.Add(AnimKeyframe(0.2, -14, -7, 0.1))
anim.front_foot.frames.Add(AnimKeyframe(0.4, 11, -13, -0.3))
anim.front_foot.frames.Add(AnimKeyframe(0.6, 18, -11, -0.27))
anim.front_foot.frames.Add(AnimKeyframe(0.8, 3, 0, -0.02))
anim.front_foot.frames.Add(AnimKeyframe(1.0, -13, -4.5, 0.05))
anim.front_foot.frames.Add(AnimKeyframe(0.0, -11, -2.5, 0.05))
anim.front_foot.frames.Add(AnimKeyframe(0.2, -14, -5, 0.1))
anim.front_foot.frames.Add(AnimKeyframe(0.4, 11, -8, -0.3))
anim.front_foot.frames.Add(AnimKeyframe(0.6, 18, -8, -0.27))
anim.front_foot.frames.Add(AnimKeyframe(0.8, 3, 0, 0))
anim.front_foot.frames.Add(AnimKeyframe(1.0, -11, -2.5, 0.05))
container.animations.Add(anim)
anim = Animation("run_right")
anim.body.frames.Add(AnimKeyframe(0.0, 0, -2, 0))
anim.body.frames.Add(AnimKeyframe(0.0, 0, -1, 0))
anim.body.frames.Add(AnimKeyframe(0.2, 0, 0, 0))
anim.body.frames.Add(AnimKeyframe(0.4, 0, -2, 0))
anim.body.frames.Add(AnimKeyframe(0.6, 0, 0, 0))
anim.body.frames.Add(AnimKeyframe(0.4, 0, 0, 0))
anim.body.frames.Add(AnimKeyframe(0.6, 0, -1, 0))
anim.body.frames.Add(AnimKeyframe(0.8, 0, 0, 0))
anim.body.frames.Add(AnimKeyframe(1.0, 0, -2, 0))
anim.body.frames.Add(AnimKeyframe(1.0, 0, -1, 0))
anim.back_foot.frames.Add(AnimKeyframe(0.0, -18, -11, 0.27))
anim.back_foot.frames.Add(AnimKeyframe(0.2, 0, -11, 0.2))
anim.back_foot.frames.Add(AnimKeyframe(0.0, -18, -8, 0.27))
anim.back_foot.frames.Add(AnimKeyframe(0.2, 0, -8, 0.2))
anim.back_foot.frames.Add(AnimKeyframe(0.4, 13, -4.5, -0.05))
anim.back_foot.frames.Add(AnimKeyframe(0.6, 7, 0, 0))
anim.back_foot.frames.Add(AnimKeyframe(0.8, -6, 0, 0))
anim.back_foot.frames.Add(AnimKeyframe(1.0, -18, -11, 0.27))
anim.back_foot.frames.Add(AnimKeyframe(1.0, -18, -8, 0.27))
anim.front_foot.frames.Add(AnimKeyframe(0.0, 13, -4.5, -0.05))
anim.front_foot.frames.Add(AnimKeyframe(0.2, -3, 0, 0.02))
anim.front_foot.frames.Add(AnimKeyframe(0.4, -18, -11, 0.27))
anim.front_foot.frames.Add(AnimKeyframe(0.6, -11, -13, 0.3))
anim.front_foot.frames.Add(AnimKeyframe(0.8, 14, -7, -0.1))
anim.front_foot.frames.Add(AnimKeyframe(1.0, 13, -4.5, -0.05))
anim.front_foot.frames.Add(AnimKeyframe(0.0, 11, -2.5, -0.05))
anim.front_foot.frames.Add(AnimKeyframe(0.2, -3, 0, 0))
anim.front_foot.frames.Add(AnimKeyframe(0.4, -18, -8, 0.27))
anim.front_foot.frames.Add(AnimKeyframe(0.6, -11, -8, 0.3))
anim.front_foot.frames.Add(AnimKeyframe(0.8, 14, -5, -0.1))
anim.front_foot.frames.Add(AnimKeyframe(1.0, 11, -2.5, -0.05))
container.animations.Add(anim)
anim = Animation("hammer_swing")

View file

@ -420,7 +420,7 @@ void CPlayers::RenderPlayer(
// evaluate animation
float WalkTime = fmod(Position.x, 100.0f) / 100.0f;
float RunTime = fmod(Position.x, 250.0f) / 250.0f;
float RunTime = fmod(Position.x, 200.0f) / 200.0f;
// Don't do a moon walk outside the left border
if(WalkTime < 0)