mirror of
https://github.com/fabiangreffrath/woof.git
synced 2025-09-22 11:22:18 -04:00
make death use action demo compatible (#1910)
This commit is contained in:
parent
e87ac53bb0
commit
58b7bdd0e9
24
src/g_game.c
24
src/g_game.c
@ -546,6 +546,28 @@ void G_PrepGyroTiccmd(void)
|
||||
}
|
||||
}
|
||||
|
||||
static boolean FilterDeathUseAction(void)
|
||||
{
|
||||
if (players[consoleplayer].playerstate & PST_DEAD)
|
||||
{
|
||||
switch (death_use_action)
|
||||
{
|
||||
case death_use_nothing:
|
||||
return true;
|
||||
case death_use_reload:
|
||||
if (!demoplayback && !demorecording && !netgame)
|
||||
{
|
||||
activate_death_use_reload = true;
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//
|
||||
// G_BuildTiccmd
|
||||
// Builds a ticcmd from all of the available inputs
|
||||
@ -703,6 +725,7 @@ void G_BuildTiccmd(ticcmd_t* cmd)
|
||||
|
||||
if (M_InputGameActive(input_use)) // [FG] mouse button for "use"
|
||||
{
|
||||
if (!FilterDeathUseAction())
|
||||
cmd->buttons |= BT_USE;
|
||||
// clear double clicks if hit use button
|
||||
dclick = false;
|
||||
@ -811,6 +834,7 @@ void G_BuildTiccmd(ticcmd_t* cmd)
|
||||
if (dclick)
|
||||
{
|
||||
dclick = false;
|
||||
if (!FilterDeathUseAction())
|
||||
cmd->buttons |= BT_USE;
|
||||
}
|
||||
|
||||
|
21
src/p_user.c
21
src/p_user.c
@ -31,7 +31,6 @@
|
||||
#include "hu_stuff.h"
|
||||
#include "info.h"
|
||||
#include "m_cheat.h"
|
||||
#include "m_input.h"
|
||||
#include "p_map.h"
|
||||
#include "p_mobj.h"
|
||||
#include "p_pspr.h"
|
||||
@ -39,7 +38,6 @@
|
||||
#include "p_user.h"
|
||||
#include "r_defs.h"
|
||||
#include "r_main.h"
|
||||
#include "r_state.h"
|
||||
#include "st_stuff.h"
|
||||
|
||||
static fixed_t PlayerSlope(player_t *player)
|
||||
@ -259,6 +257,7 @@ void P_MovePlayer (player_t* player)
|
||||
#define ANG5 (ANG90/18)
|
||||
|
||||
death_use_action_t death_use_action;
|
||||
boolean activate_death_use_reload;
|
||||
|
||||
//
|
||||
// P_DeathThink
|
||||
@ -316,29 +315,21 @@ void P_DeathThink (player_t* player)
|
||||
|
||||
if (player->cmd.buttons & BT_USE)
|
||||
{
|
||||
if (demorecording || demoplayback || netgame)
|
||||
player->playerstate = PST_REBORN;
|
||||
else switch(death_use_action)
|
||||
}
|
||||
|
||||
if (activate_death_use_reload)
|
||||
{
|
||||
case death_use_default:
|
||||
player->playerstate = PST_REBORN;
|
||||
break;
|
||||
case death_use_reload:
|
||||
activate_death_use_reload = false;
|
||||
|
||||
if (savegameslot >= 0)
|
||||
{
|
||||
char *file = G_SaveGameName(savegameslot);
|
||||
G_LoadGame(file, savegameslot, false);
|
||||
free(file);
|
||||
// [Woof!] prevent on-death-action reloads from activating specials
|
||||
M_InputGameDeactivate(input_use);
|
||||
}
|
||||
else
|
||||
player->playerstate = PST_REBORN;
|
||||
break;
|
||||
case death_use_nothing:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ typedef enum
|
||||
} death_use_action_t;
|
||||
|
||||
extern death_use_action_t death_use_action;
|
||||
extern boolean activate_death_use_reload;
|
||||
|
||||
extern boolean onground; // whether player is on ground or in air
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user