More death use reload fixes (#1938)

* Prevent double reload with "death use"

* Don't crash if "death use" save is deleted
This commit is contained in:
ceski 2024-10-02 22:58:51 -07:00 committed by GitHub
parent 7b636710ac
commit ed349ec34e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 6 deletions

View File

@ -656,9 +656,9 @@ static boolean FilterDeathUseAction(void)
return true;
case death_use_reload:
if (!demoplayback && !demorecording && !netgame
&& !activate_death_use_reload)
&& activate_death_use_reload == 0)
{
activate_death_use_reload = true;
activate_death_use_reload = 2;
}
return true;
default:
@ -953,7 +953,6 @@ void G_ClearInput(void)
I_ResetRelativeMouseState();
I_ResetAllRumbleChannels();
WS_Reset();
activate_death_use_reload = false;
}
//
@ -1066,6 +1065,8 @@ static void G_DoLoadLevel(void)
// Set the initial listener parameters using the player's initial state.
S_InitListener(players[displayplayer].mo);
activate_death_use_reload = 0;
// clear cmd building stuff
memset (gamekeydown, 0, sizeof(gamekeydown));
G_ClearInput();

View File

@ -817,6 +817,11 @@ static void M_DeleteGame(int i)
quickSaveSlot = -1;
}
if (i == savegameslot)
{
savegameslot = -1;
}
M_ReadSaveStrings();
if (name)

View File

@ -257,7 +257,7 @@ void P_MovePlayer (player_t* player)
#define ANG5 (ANG90/18)
death_use_action_t death_use_action;
boolean activate_death_use_reload;
int activate_death_use_reload;
//
// P_DeathThink
@ -318,8 +318,10 @@ void P_DeathThink (player_t* player)
player->playerstate = PST_REBORN;
}
if (activate_death_use_reload)
if (activate_death_use_reload == 2)
{
activate_death_use_reload = 1;
if (savegameslot >= 0)
{
char *file = G_SaveGameName(savegameslot);

View File

@ -41,7 +41,7 @@ typedef enum
} death_use_action_t;
extern death_use_action_t death_use_action;
extern boolean activate_death_use_reload;
extern int activate_death_use_reload;
extern boolean onground; // whether player is on ground or in air