- resetinventory.

This commit is contained in:
Christoph Oelckers 2020-05-20 23:10:20 +02:00
parent 4c00e4cf7c
commit fe49d0d2d9
5 changed files with 24 additions and 64 deletions

View file

@ -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<int16_t>(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);
}
//---------------------------------------------------------------------------

View file

@ -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);

View file

@ -265,11 +265,6 @@ void cacheit_d(void)
}
#if 0
void resetweapons_w(int snum)
{
resetweapons(snum);
OnEvent(EVENT_RESETWEAPONS, -1, snum, -1);
}
//---------------------------------------------------------------------------
//

View file

@ -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;
}
}
//---------------------------------------------------------------------------
//
//

View file

@ -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<int16_t>(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);