diff --git a/source/games/duke/src/dispatch.cpp b/source/games/duke/src/dispatch.cpp index 563437391..94a93b752 100644 --- a/source/games/duke/src/dispatch.cpp +++ b/source/games/duke/src/dispatch.cpp @@ -45,8 +45,8 @@ int ifhitbyweapon_r(DDukeActor* sn); int ifhitbyweapon_d(DDukeActor* sn); void incur_damage_d(DDukePlayer* p); void incur_damage_r(DDukePlayer* p); -void selectweapon_d(int snum, int j); -void selectweapon_r(int snum, int j); +void selectweapon_d(DDukePlayer* const p, int j); +void selectweapon_r(DDukePlayer* const p, int j); int doincrements_d(DDukePlayer* p); int doincrements_r(DDukePlayer* p); void checkweapons_d(DDukePlayer* p); diff --git a/source/games/duke/src/duke3d.h b/source/games/duke/src/duke3d.h index c93792643..d1f3a8390 100644 --- a/source/games/duke/src/duke3d.h +++ b/source/games/duke/src/duke3d.h @@ -79,7 +79,7 @@ struct Dispatcher // player void (*incur_damage)(DDukePlayer* p); - void (*selectweapon)(int snum, int j); + void (*selectweapon)(DDukePlayer* const p, int j); int (*doincrements)(DDukePlayer* p); void (*checkweapons)(DDukePlayer* p); void (*processinput)(int snum); diff --git a/source/games/duke/src/input.cpp b/source/games/duke/src/input.cpp index 26f5c0136..179127222 100644 --- a/source/games/duke/src/input.cpp +++ b/source/games/duke/src/input.cpp @@ -246,7 +246,7 @@ void hud_input(DDukePlayer* const p) p->wantweaponfire = weap - 1; // Here we have to be extra careful that the weapons do not get mixed up, so let's keep the code for Duke and RR completely separate. - fi.selectweapon(p->pnum, weap); + fi.selectweapon(p, weap); if (!!(p->cmd.ucmd.actions & SB_HOLSTER)) { diff --git a/source/games/duke/src/player_d.cpp b/source/games/duke/src/player_d.cpp index 541525725..3acd7984f 100644 --- a/source/games/duke/src/player_d.cpp +++ b/source/games/duke/src/player_d.cpp @@ -86,10 +86,9 @@ void incur_damage_d(DDukePlayer* p) // //--------------------------------------------------------------------------- -void selectweapon_d(int snum, int weap) // playernum, weaponnum +void selectweapon_d(DDukePlayer* const p, int weap) // playernum, weaponnum { int i, j, k; - auto p = getPlayer(snum); if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->spr.scale.X > 0.5 && p->access_incs == 0 && p->knee_incs == 0) { if ((p->weapon_pos == 0 || (p->holster_weapon && p->weapon_pos == -9))) diff --git a/source/games/duke/src/player_r.cpp b/source/games/duke/src/player_r.cpp index d7e116e9a..1d7d5e400 100644 --- a/source/games/duke/src/player_r.cpp +++ b/source/games/duke/src/player_r.cpp @@ -85,10 +85,9 @@ void incur_damage_r(DDukePlayer* p) // //--------------------------------------------------------------------------- -void selectweapon_r(int snum, int weap) +void selectweapon_r(DDukePlayer* const p, int weap) { int i, j, k; - auto p = getPlayer(snum); if (p->last_pissed_time <= (26 * 218) && p->show_empty_weapon == 0 && p->kickback_pic == 0 && p->quick_kick == 0 && p->GetActor()->spr.scale.X > 0.125 && p->access_incs == 0 && p->knee_incs == 0) { if ((p->weapon_pos == 0 || (p->holster_weapon && p->weapon_pos == -9)))