From 3e79e7b63fb34bfd41c21027b06c86f9316a5551 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Thu, 27 Aug 2020 15:54:49 +1000 Subject: [PATCH] - Duke: Fix bug where player wasn't cracking knuckles after 777 idle tics while `cl_syncinput` was 1. * Use opportunity to replace the literal constant of `777` with an enum. --- source/games/duke/src/constants.h | 6 ++++++ source/games/duke/src/player.cpp | 2 +- source/games/duke/src/player_d.cpp | 14 ++++++-------- source/games/duke/src/player_r.cpp | 10 +++++----- source/games/duke/src/player_w.cpp | 2 +- 5 files changed, 19 insertions(+), 15 deletions(-) diff --git a/source/games/duke/src/constants.h b/source/games/duke/src/constants.h index 64822083a..f92d01249 100644 --- a/source/games/duke/src/constants.h +++ b/source/games/duke/src/constants.h @@ -425,6 +425,12 @@ enum TRIPBOMB_TIMER = 2 }; +// Miscellaenous constants in use throughout the game. +enum +{ + CRACK_TIME = 777 +}; + // World tour enum EFlamethrowerState { diff --git a/source/games/duke/src/player.cpp b/source/games/duke/src/player.cpp index 701d92123..b4d2fec61 100644 --- a/source/games/duke/src/player.cpp +++ b/source/games/duke/src/player.cpp @@ -732,7 +732,7 @@ void playerCrouch(int snum) if (GetGameVarID(g_iReturnVarID, p->i, snum) == 0) { p->posz += (2048 + 768); - p->crack_time = 777; + p->crack_time = CRACK_TIME; } } diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index d3b8a5d1c..1c1b617f7 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -112,7 +112,7 @@ void shoot_d(int i, int atwith) sz = ps[p].posz + ps[p].pyoff + (4 << 8); sa = ps[p].getang(); - ps[p].crack_time = 777; + ps[p].crack_time = CRACK_TIME; } else @@ -1352,7 +1352,7 @@ int doincrements_d(struct player_struct* p) if (p->crack_time == 0) { p->knuckle_incs = 1; - p->crack_time = 777; + p->crack_time = CRACK_TIME; } } @@ -1586,7 +1586,7 @@ static void operateJetpack(int snum, ESyncBits sb_snum, int psectlotag, int fz, if (GetGameVarID(g_iReturnVarID, pi, snum) == 0) { p->posz -= j; - p->crack_time = 777; + p->crack_time = CRACK_TIME; } } @@ -1598,7 +1598,7 @@ static void operateJetpack(int snum, ESyncBits sb_snum, int psectlotag, int fz, if (GetGameVarID(g_iReturnVarID, pi, snum) == 0) { p->posz += j; - p->crack_time = 777; + p->crack_time = CRACK_TIME; } } @@ -1945,7 +1945,7 @@ static void fireweapon(int snum) auto p = &ps[snum]; int pi = p->i; - p->crack_time = 777; + p->crack_time = CRACK_TIME; if (p->holster_weapon == 1) { @@ -2787,8 +2787,6 @@ void processinput_d(int snum) // may still be needed later for demo recording applylook(snum, 1, sb_avel); - - p->crack_time = 777; } if (p->spritebridge == 0) @@ -2832,7 +2830,7 @@ void processinput_d(int snum) if (p->posxv || p->posyv || sb_fvel || sb_svel) { - p->crack_time = 777; + p->crack_time = CRACK_TIME; k = sintable[p->bobcounter & 2047] >> 12; diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 882a935fc..be78fb476 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -107,7 +107,7 @@ void shoot_r(int i, int atwith) sz = ps[p].posz + ps[p].pyoff + (4 << 8); sa = ps[p].getang(); - if (isRRRA()) ps[p].crack_time = 777; + if (isRRRA()) ps[p].crack_time = CRACK_TIME; } else { @@ -1284,7 +1284,7 @@ int doincrements_r(struct player_struct* p) if (p->crack_time == 0) { p->knuckle_incs = 1; - p->crack_time = 777; + p->crack_time = CRACK_TIME; } } @@ -2612,7 +2612,7 @@ static void fireweapon(int snum) auto p = &ps[snum]; int pi = p->i; - p->crack_time = 777; + p->crack_time = CRACK_TIME; if (p->holster_weapon == 1) { @@ -3699,7 +3699,7 @@ void processinput_r(int snum) applylook(snum, 1, sb_avel); - p->crack_time = 777; + p->crack_time = CRACK_TIME; } if (p->spritebridge == 0) @@ -3725,7 +3725,7 @@ void processinput_r(int snum) if (p->posxv || p->posyv || sb_fvel || sb_svel) { - p->crack_time = 777; + p->crack_time = CRACK_TIME; k = sintable[p->bobcounter & 2047] >> 12; diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index cc23579be..47761a891 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -144,7 +144,7 @@ void fireweapon_ww(int snum) auto p = &ps[snum]; int pi = p->i; - p->crack_time = 777; + p->crack_time = CRACK_TIME; if (p->holster_weapon == 1) {