From ce82eaf89991bb0042f82d3860cec229ba224106 Mon Sep 17 00:00:00 2001 From: Mitchell Richters Date: Wed, 16 Sep 2020 21:01:09 +1000 Subject: [PATCH] - Duke/RR: Address weapon drawer interpolation concerns raised in #403. --- source/games/duke/src/actors.cpp | 2 +- source/games/duke/src/actors_d.cpp | 2 +- source/games/duke/src/actors_r.cpp | 2 +- source/games/duke/src/player_d.cpp | 24 +++++------ source/games/duke/src/player_r.cpp | 64 +++++++++++++++--------------- source/games/duke/src/player_w.cpp | 12 +++--- 6 files changed, 53 insertions(+), 53 deletions(-) diff --git a/source/games/duke/src/actors.cpp b/source/games/duke/src/actors.cpp index 77e1b2a4d..6cbee22e5 100644 --- a/source/games/duke/src/actors.cpp +++ b/source/games/duke/src/actors.cpp @@ -182,7 +182,7 @@ void checkavailweapon(struct player_struct* p) OnEvent(EVENT_CHANGEWEAPON, p->i, snum, -1); } - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; if (p->holster_weapon == 1) { p->holster_weapon = 0; diff --git a/source/games/duke/src/actors_d.cpp b/source/games/duke/src/actors_d.cpp index 15495575e..04ccab479 100644 --- a/source/games/duke/src/actors_d.cpp +++ b/source/games/duke/src/actors_d.cpp @@ -238,7 +238,7 @@ void addweapon_d(struct player_struct *p, int weapon) p->last_weapon = -1; } - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; #ifdef EDUKE if(p->curr_weapon != weapon) { diff --git a/source/games/duke/src/actors_r.cpp b/source/games/duke/src/actors_r.cpp index 25f2de03e..f55e8b22d 100644 --- a/source/games/duke/src/actors_r.cpp +++ b/source/games/duke/src/actors_r.cpp @@ -178,7 +178,7 @@ void addweapon_r(struct player_struct* p, int weapon) p->last_weapon = -1; } - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; p->curr_weapon = cw; switch (weapon) diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 71142a5f4..eeac0a790 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -1299,7 +1299,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum if (p->holster_weapon) { PlayerSetInput(snum, SB_HOLSTER); - p->weapon_pos = -9; + p->oweapon_pos = p->weapon_pos = -9; } else if (j >= MIN_WEAPON && p->gotweapon[j] && (unsigned int)p->curr_weapon != j) switch (j) { @@ -1329,7 +1329,7 @@ void selectweapon_d(int snum, int weap) // playernum, weaponnum { p->curr_weapon = HANDREMOTE_WEAPON; p->last_weapon = -1; - p->weapon_pos = 10; + p->oweapon_pos = p->weapon_pos = 10; } break; case HANDBOMB_WEAPON: @@ -1378,7 +1378,7 @@ int doincrements_d(struct player_struct* p) if (p->last_pissed_time == (26 * 218)) { p->holster_weapon = 0; - p->weapon_pos = 10; + p->oweapon_pos = p->weapon_pos = 10; } } @@ -1481,8 +1481,8 @@ int doincrements_d(struct player_struct* p) if (p->access_incs > 20) { p->access_incs = 0; - p->weapon_pos = 10; - p->kickback_pic = 0; + p->oweapon_pos = p->weapon_pos = 10; + p->okickback_pic = p->kickback_pic = 0; } } @@ -1988,7 +1988,7 @@ static void fireweapon(int snum) if (p->last_pissed_time <= (26 * 218) && p->weapon_pos == -9) { p->holster_weapon = 0; - p->weapon_pos = 10; + p->oweapon_pos = p->weapon_pos = 10; FTA(74, p); } } @@ -2425,7 +2425,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->ammo_amount[DEVISTATOR_WEAPON]--; checkavailweapon(p); } - if (p->kickback_pic > 5) p->kickback_pic = 0; + if (p->kickback_pic > 5) p->okickback_pic = p->kickback_pic = 0; } else if (p->kickback_pic & 1) { @@ -2434,9 +2434,9 @@ static void operateweapon(int snum, ESyncBits actions, int psect) fi.shoot(pi, RPG); p->ammo_amount[DEVISTATOR_WEAPON]--; checkavailweapon(p); - if (p->ammo_amount[DEVISTATOR_WEAPON] <= 0) p->kickback_pic = 0; + if (p->ammo_amount[DEVISTATOR_WEAPON] <= 0) p->okickback_pic = p->kickback_pic = 0; } - if (p->kickback_pic > 5) p->kickback_pic = 0; + if (p->kickback_pic > 5) p->okickback_pic = p->kickback_pic = 0; } break; case FREEZE_WEAPON: @@ -2466,7 +2466,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->okickback_pic = p->kickback_pic = 1; S_PlayActorSound(CAT_FIRE, pi); } - else p->kickback_pic = 0; + else p->okickback_pic = p->kickback_pic = 0; } break; @@ -3106,12 +3106,12 @@ HORIZONLY: { if (p->last_weapon >= 0) { - p->weapon_pos = 10; + p->oweapon_pos = p->weapon_pos = 10; // if(p->curr_weapon == KNEE_WEAPON) p->kickback_pic = 1; p->last_weapon = -1; } else if (p->holster_weapon == 0) - p->weapon_pos = 10; + p->oweapon_pos = p->weapon_pos = 10; } else p->weapon_pos--; } diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index 892213f4e..e74206b15 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -1097,7 +1097,7 @@ void selectweapon_r(int snum, int weap) if (p->holster_weapon) { PlayerSetInput(snum, SB_HOLSTER); - p->weapon_pos = -9; + p->oweapon_pos = p->weapon_pos = -9; } else if (j >= MIN_WEAPON && p->gotweapon[j] && p->curr_weapon != j) switch (j) { @@ -1158,7 +1158,7 @@ void selectweapon_r(int snum, int weap) { p->curr_weapon = THROWINGDYNAMITE_WEAPON; p->last_weapon = -1; - p->weapon_pos = 10; + p->oweapon_pos = p->weapon_pos = 10; } break; case DYNAMITE_WEAPON: @@ -1305,7 +1305,7 @@ int doincrements_r(struct player_struct* p) if (p->last_pissed_time == 5668) { p->holster_weapon = 0; - p->weapon_pos = 10; + p->oweapon_pos = p->weapon_pos = 10; } } @@ -1366,8 +1366,8 @@ int doincrements_r(struct player_struct* p) if (p->access_incs > 20) { p->access_incs = 0; - p->weapon_pos = 10; - p->kickback_pic = 0; + p->oweapon_pos = p->weapon_pos = 10; + p->okickback_pic = p->kickback_pic = 0; } } @@ -2650,7 +2650,7 @@ static void fireweapon(int snum) if (p->last_pissed_time <= (26 * 218) && p->weapon_pos == -9) { p->holster_weapon = 0; - p->weapon_pos = 10; + p->oweapon_pos = p->weapon_pos = 10; FTA(74, p); } } @@ -2790,10 +2790,10 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->kickback_pic++; if (p->kickback_pic > 19) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; p->curr_weapon = THROWINGDYNAMITE_WEAPON; p->last_weapon = -1; - p->weapon_pos = 10; + p->oweapon_pos = p->weapon_pos = 10; p->detonate_time = 45; p->detonate_count = 1; S_PlaySound(402); @@ -2860,7 +2860,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->kickback_pic == 40) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; p->curr_weapon = DYNAMITE_WEAPON; p->last_weapon = -1; p->detonate_count = 0; @@ -2868,7 +2868,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->ammo_amount[DYNAMITE_WEAPON] > 0) { fi.addweapon(p, DYNAMITE_WEAPON); - p->weapon_pos = -9; + p->oweapon_pos = p->weapon_pos = -9; } else checkavailweapon(p); } @@ -2893,7 +2893,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) else if (p->kickback_pic == 2) if (p->ammo_amount[PISTOL_WEAPON] <= 0) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; checkavailweapon(p); } @@ -2903,7 +2903,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) { if (p->ammo_amount[PISTOL_WEAPON] <= 0) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; checkavailweapon(p); break; } @@ -2925,7 +2925,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->kickback_pic == 38) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; checkavailweapon(p); } @@ -3008,7 +3008,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) S_PlayActorSound(SHOTGUN_COCK, pi); break; case 28: - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; p->shotgun_state[0] = 0; p->shotgun_state[1] = 0; return; @@ -3084,7 +3084,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if ((actions & SB_FIRE) == 0) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; break; } } @@ -3092,7 +3092,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) else if (p->kickback_pic > 10) { if (actions & SB_FIRE) p->kickback_pic = 1; - else p->kickback_pic = 0; + else p->okickback_pic = p->kickback_pic = 0; } break; @@ -3101,7 +3101,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->kickback_pic > 3) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; fi.shoot(pi, GROWSPARK); p->noise_radius = 1024; madenoise(snum); @@ -3120,7 +3120,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) } p->kickback_pic++; if (p->kickback_pic > 20) - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; break; case TIT_WEAPON: @@ -3147,7 +3147,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->kickback_pic > 4) p->kickback_pic = 1; if (!(actions & SB_FIRE)) - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; break; case MOTORCYCLE_WEAPON: @@ -3162,7 +3162,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) madenoise(snum); p->ammo_amount[MOTORCYCLE_WEAPON]--; if (p->ammo_amount[MOTORCYCLE_WEAPON] <= 0) - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; else checkavailweapon(p); } @@ -3177,7 +3177,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) if (p->kickback_pic > 4) p->kickback_pic = 1; if (!(actions & SB_FIRE)) - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; break; case BOAT_WEAPON: if (p->kickback_pic == 3) @@ -3189,11 +3189,11 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->kickback_pic++; if (p->kickback_pic > 20) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; checkavailweapon(p); } if (p->ammo_amount[BOAT_WEAPON] <= 0) - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; else checkavailweapon(p); break; @@ -3224,7 +3224,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->recoil += 20; } if (p->kickback_pic > 20) - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; break; case POWDERKEG_WEAPON: @@ -3252,7 +3252,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->kickback_pic++; if (p->kickback_pic > 20) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; checkavailweapon(p); } break; @@ -3274,7 +3274,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) p->kickback_pic++; if (p->kickback_pic > 40) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; p->gotweapon.Clear(BOWLING_WEAPON); checkavailweapon(p); } @@ -3291,7 +3291,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) madenoise(snum); } else if (p->kickback_pic == 16) - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; if (p->wantweaponfire >= 0) checkavailweapon(p); @@ -3309,7 +3309,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) madenoise(snum); } else if (p->kickback_pic == 16) - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; if (p->wantweaponfire >= 0) checkavailweapon(p); @@ -3332,7 +3332,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) else if (p->kickback_pic == 16) S_PlayActorSound(450, pi); else if (p->kickback_pic == 34) - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; break; case CHICKEN_WEAPON: @@ -3350,7 +3350,7 @@ static void operateweapon(int snum, ESyncBits actions, int psect) else if (p->kickback_pic == 16) S_PlayActorSound(450, pi); else if (p->kickback_pic == 34) - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; break; } @@ -4109,12 +4109,12 @@ HORIZONLY: { if (p->last_weapon >= 0) { - p->weapon_pos = 10; + p->oweapon_pos = p->weapon_pos = 10; // if(p->curr_weapon == KNEE_WEAPON) p->kickback_pic = 1; p->last_weapon = -1; } else if (p->holster_weapon == 0) - p->weapon_pos = 10; + p->oweapon_pos = p->weapon_pos = 10; } else p->weapon_pos--; } diff --git a/source/games/duke/src/player_w.cpp b/source/games/duke/src/player_w.cpp index 07bff843d..80bc69c2a 100644 --- a/source/games/duke/src/player_w.cpp +++ b/source/games/duke/src/player_w.cpp @@ -151,7 +151,7 @@ void fireweapon_ww(int snum) if (p->last_pissed_time <= (26 * 218) && p->weapon_pos == -9) { p->holster_weapon = 0; - p->weapon_pos = 10; + p->oweapon_pos = p->weapon_pos = 10; FTA(74, p); } } @@ -380,7 +380,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect) } else if (p->kickback_pic > aplWeaponTotalTime[p->curr_weapon][snum]) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; // don't change to remote when in NAM: grenades are timed checkavailweapon(p); } @@ -411,7 +411,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect) if (p->kickback_pic >= aplWeaponTotalTime[p->curr_weapon][snum]) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; /// WHAT THE HELL DOES THIS DO....????????????? if (p->ammo_amount[TRIPBOMB_WEAPON] > 0) fi.addweapon(p, TRIPBOMB_WEAPON); @@ -510,7 +510,7 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect) if (p->kickback_pic >= (aplWeaponReload[p->curr_weapon][snum])) { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; } } @@ -532,12 +532,12 @@ void operateweapon_ww(int snum, ESyncBits actions, int psect) } else { - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; } } else { // not 'automatic' and >totaltime - p->kickback_pic = 0; + p->okickback_pic = p->kickback_pic = 0; } } }