From 8643459cbee87e5bfd140b765cca98559ff56e9f Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 26 Jul 2020 10:18:55 +0200 Subject: [PATCH] - re-added EDuke32's last_quick_kick to remove flicker during the animation. Fixes #7. --- source/games/duke/src/hudweapon_d.cpp | 13 ++++++++----- source/games/duke/src/player_d.cpp | 3 +++ source/games/duke/src/savegame.cpp | 1 + source/games/duke/src/types.h | 2 +- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/source/games/duke/src/hudweapon_d.cpp b/source/games/duke/src/hudweapon_d.cpp index e578580ac..77cd50c09 100644 --- a/source/games/duke/src/hudweapon_d.cpp +++ b/source/games/duke/src/hudweapon_d.cpp @@ -335,7 +335,7 @@ void displayweapon_d(int snum) // rest of code should be moved to CON.. j = 14-p->quick_kick; - if (j != 14) + if (j != 14 || p->last_quick_kick) { if (sprite[p->i].pal == 1) pal = 1; @@ -348,10 +348,13 @@ void displayweapon_d(int snum) if (j < 5 || j > 9) - hud_drawpal(weapon_xoffset + 80 - (p->getlookang() >> 1), - looking_arc + 250 - gun_pos, KNEE, gs, o | 4, pal); - else hud_drawpal(weapon_xoffset + 160 - 16 - (p->getlookang() >> 1), - looking_arc + 214 - gun_pos, KNEE + 1, gs, o | 4, pal); + { + hud_drawpal(weapon_xoffset + 80 - (p->getlookang() >> 1), looking_arc + 250 - gun_pos, KNEE, gs, o | 4, pal); + } + else + { + hud_drawpal(weapon_xoffset + 160 - 16 - (p->getlookang() >> 1), looking_arc + 214 - gun_pos, KNEE + 1, gs, o | 4, pal); + } } if (sprite[p->i].xrepeat < 40) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 34efd56bd..fa48172e0 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -1404,10 +1404,13 @@ int doincrements_d(struct player_struct* p) if (p->quick_kick > 0 && sprite[p->i].pal != 1) { + p->last_quick_kick = p->quick_kick + 1; p->quick_kick--; if (p->quick_kick == 8) fi.shoot(p->i, KNEE); } + else if (p->last_quick_kick > 0) + p->last_quick_kick--; if (p->access_incs && sprite[p->i].pal != 1) { diff --git a/source/games/duke/src/savegame.cpp b/source/games/duke/src/savegame.cpp index 8a0926cc7..bad00b1fc 100644 --- a/source/games/duke/src/savegame.cpp +++ b/source/games/duke/src/savegame.cpp @@ -187,6 +187,7 @@ FSerializer& Serialize(FSerializer& arc, const char* keyname, player_struct& w, ("dummyplayersprite", w.dummyplayersprite) ("extra_extra8", w.extra_extra8) ("quick_kick", w.quick_kick) + ("last_quick_kick", w.last_quick_kick) ("heat_amount", w.heat_amount) ("actorsqu", w.actorsqu) ("timebeforeexit", w.timebeforeexit) diff --git a/source/games/duke/src/types.h b/source/games/duke/src/types.h index d15b351a5..51d6cdbaa 100644 --- a/source/games/duke/src/types.h +++ b/source/games/duke/src/types.h @@ -137,7 +137,7 @@ struct player_struct short somethingonplayer, on_crane, i, one_parallax_sectnum; short over_shoulder_on, random_club_frame, fist_incs; short cheat_phase; - short dummyplayersprite, extra_extra8, quick_kick; + short dummyplayersprite, extra_extra8, quick_kick, last_quick_kick; short heat_amount, actorsqu, timebeforeexit, customexitsound; short weaprecs[256], weapreccnt;