diff --git a/source/games/duke/src/premap.cpp b/source/games/duke/src/premap.cpp index 0b447d896..a09d895df 100644 --- a/source/games/duke/src/premap.cpp +++ b/source/games/duke/src/premap.cpp @@ -262,23 +262,39 @@ void resetweapons(int snum) p = &ps[snum]; - for ( weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++ ) - p->gotweapon.Clear(weapon); - for ( weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++ ) + for (weapon = PISTOL_WEAPON; weapon < MAX_WEAPONS; weapon++) + { p->ammo_amount[weapon] = 0; + } + p->gotweapon.Zero(); p->weapon_pos = 6; p->kickback_pic = 5; p->curr_weapon = PISTOL_WEAPON; p->gotweapon.Set(PISTOL_WEAPON); p->gotweapon.Set(KNEE_WEAPON); - p->ammo_amount[PISTOL_WEAPON] = 48; + p->ammo_amount[PISTOL_WEAPON] = std::min(max_ammo_amount[PISTOL_WEAPON], 48); p->gotweapon.Set(HANDREMOTE_WEAPON); p->last_weapon = -1; p->show_empty_weapon= 0; p->last_pissed_time = 0; p->holster_weapon = 0; + + // Always clear these, even for non-RRRA + p->OnMotorcycle = 0; + p->moto_underwater = 0; + p->OnBoat = 0; + p->lotag800kill = 0; + + if (isRRRA()) + { + chickenphase = 0; + p->ammo_amount[KNEE_WEAPON] = 1; + p->gotweapon.Set(SLINGBLADE_WEAPON); + p->ammo_amount[SLINGBLADE_WEAPON] = 1; + } + OnEvent(EVENT_RESETWEAPONS, -1, snum, -1); } //--------------------------------------------------------------------------- diff --git a/source/games/duke/src/premap.h b/source/games/duke/src/premap.h index 59445edc5..438a4b8f4 100644 --- a/source/games/duke/src/premap.h +++ b/source/games/duke/src/premap.h @@ -39,7 +39,7 @@ void P_RandomSpawnPoint(int playerNum); void P_ResetInventory(int playerNum); void P_ResetPlayer(int playerNum); void resetplayerstats(int playerNum); -void P_ResetWeapons(int playerNum); +void resetweapons(int playerNum); void G_ClearFIFO(void); void G_ResetInterpolations(void); extern int32_t fragbarheight(void); diff --git a/source/games/duke/src/premap_d.cpp b/source/games/duke/src/premap_d.cpp index ab10978bb..e48f3c98f 100644 --- a/source/games/duke/src/premap_d.cpp +++ b/source/games/duke/src/premap_d.cpp @@ -265,11 +265,6 @@ void cacheit_d(void) } #if 0 -void resetweapons_w(int snum) -{ - resetweapons(snum); - OnEvent(EVENT_RESETWEAPONS, -1, snum, -1); -} //--------------------------------------------------------------------------- // diff --git a/source/games/duke/src/premap_r.cpp b/source/games/duke/src/premap_r.cpp index 3410f4c33..3cdfddbc6 100644 --- a/source/games/duke/src/premap_r.cpp +++ b/source/games/duke/src/premap_r.cpp @@ -433,22 +433,6 @@ void cacheit_r(void) } #if 0 -void resetweapons_r(int snum) -{ - resetweapons(snum); - if (isRRRA()) - { - auto p = &ps[snum]; - p->chickenphase = 0; - p->ammo_amount[KNEE_WEAPON] = 1; - p->gotweapon[SLINGBLADE_WEAPON] = 1; - p->ammo_amount[SLINGBLADE_WEAPON] = 1; - p->OnMotorcycle = 0; - p->moto_underwater = 0; - p->OnBoat = 0; - p->MamaEnd = 0; - } -} //--------------------------------------------------------------------------- // // diff --git a/source/games/duke/src/zz_premap.cpp b/source/games/duke/src/zz_premap.cpp index 7c14d64c4..c75eb491e 100644 --- a/source/games/duke/src/zz_premap.cpp +++ b/source/games/duke/src/zz_premap.cpp @@ -304,47 +304,12 @@ void P_ResetPlayer(int playerNum) actor[pPlayer->i].t_data[4] = 0; P_ResetInventory(playerNum); - P_ResetWeapons(playerNum); + resetweapons(playerNum); //pPlayer->reloading = 0; pPlayer->movement_lock = 0; } -void P_ResetWeapons(int playerNum) -{ - DukePlayer_t *const pPlayer = g_player[playerNum].ps; - - for (bssize_t weaponNum = PISTOL_WEAPON; weaponNum < MAX_WEAPONS; weaponNum++) - pPlayer->ammo_amount[weaponNum] = 0; - - pPlayer->weapon_pos = WEAPON_POS_START; - pPlayer->curr_weapon = PISTOL_WEAPON; - pPlayer->kickback_pic = 5; - pPlayer->gotweapon.Zero(); - pPlayer->gotweapon.Set(PISTOL_WEAPON); - pPlayer->gotweapon.Set(KNEE_WEAPON); - pPlayer->gotweapon.Set(HANDREMOTE_WEAPON); - pPlayer->ammo_amount[PISTOL_WEAPON] = min(max_ammo_amount[PISTOL_WEAPON], 48); - if (RRRA) - { - chickenphase = 0; - pPlayer->gotweapon.Set(SLINGBLADE_WEAPON); - pPlayer->ammo_amount[KNEE_WEAPON] = 1; - pPlayer->ammo_amount[SLINGBLADE_WEAPON] = 1; - pPlayer->OnMotorcycle = 0; - pPlayer->moto_underwater = 0; - pPlayer->OnBoat = 0; - pPlayer->lotag800kill = 0; - } - pPlayer->last_weapon = -1; - pPlayer->show_empty_weapon = 0; - pPlayer->last_pissed_time = 0; - pPlayer->holster_weapon = 0; - pPlayer->last_used_weapon = -1; - - VM_OnEvent(EVENT_RESETWEAPONS, pPlayer->i, playerNum); -} - void P_ResetInventory(int playerNum) { DukePlayer_t *const pPlayer = g_player[playerNum].ps; @@ -460,7 +425,7 @@ static void resetprestat(int playerNum, int gameMode) if (((gameMode & MODE_EOL) != MODE_EOL && numplayers < 2 && !g_netServer) || (!(g_gametypeFlags[ud.coop] & GAMETYPE_PRESERVEINVENTORYDEATH) && numplayers > 1)) { - P_ResetWeapons(playerNum); + resetweapons(playerNum); P_ResetInventory(playerNum); } else if (pPlayer->curr_weapon == HANDREMOTE_WEAPON && !isRR()) @@ -1656,7 +1621,7 @@ int G_EnterLevel(int gameMode) case HURTRAIL__STATIC: case FLOORSLIME__STATIC: case FLOORPLASMA__STATIC: - P_ResetWeapons(i); + resetweapons(i); P_ResetInventory(i); g_player[i].ps->gotweapon.Clear(PISTOL_WEAPON);