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
28
src/g_game.c
28
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
|
// G_BuildTiccmd
|
||||||
// Builds a ticcmd from all of the available inputs
|
// Builds a ticcmd from all of the available inputs
|
||||||
@ -703,7 +725,8 @@ void G_BuildTiccmd(ticcmd_t* cmd)
|
|||||||
|
|
||||||
if (M_InputGameActive(input_use)) // [FG] mouse button for "use"
|
if (M_InputGameActive(input_use)) // [FG] mouse button for "use"
|
||||||
{
|
{
|
||||||
cmd->buttons |= BT_USE;
|
if (!FilterDeathUseAction())
|
||||||
|
cmd->buttons |= BT_USE;
|
||||||
// clear double clicks if hit use button
|
// clear double clicks if hit use button
|
||||||
dclick = false;
|
dclick = false;
|
||||||
}
|
}
|
||||||
@ -811,7 +834,8 @@ void G_BuildTiccmd(ticcmd_t* cmd)
|
|||||||
if (dclick)
|
if (dclick)
|
||||||
{
|
{
|
||||||
dclick = false;
|
dclick = false;
|
||||||
cmd->buttons |= BT_USE;
|
if (!FilterDeathUseAction())
|
||||||
|
cmd->buttons |= BT_USE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// special buttons
|
// special buttons
|
||||||
|
37
src/p_user.c
37
src/p_user.c
@ -31,7 +31,6 @@
|
|||||||
#include "hu_stuff.h"
|
#include "hu_stuff.h"
|
||||||
#include "info.h"
|
#include "info.h"
|
||||||
#include "m_cheat.h"
|
#include "m_cheat.h"
|
||||||
#include "m_input.h"
|
|
||||||
#include "p_map.h"
|
#include "p_map.h"
|
||||||
#include "p_mobj.h"
|
#include "p_mobj.h"
|
||||||
#include "p_pspr.h"
|
#include "p_pspr.h"
|
||||||
@ -39,7 +38,6 @@
|
|||||||
#include "p_user.h"
|
#include "p_user.h"
|
||||||
#include "r_defs.h"
|
#include "r_defs.h"
|
||||||
#include "r_main.h"
|
#include "r_main.h"
|
||||||
#include "r_state.h"
|
|
||||||
#include "st_stuff.h"
|
#include "st_stuff.h"
|
||||||
|
|
||||||
static fixed_t PlayerSlope(player_t *player)
|
static fixed_t PlayerSlope(player_t *player)
|
||||||
@ -259,6 +257,7 @@ void P_MovePlayer (player_t* player)
|
|||||||
#define ANG5 (ANG90/18)
|
#define ANG5 (ANG90/18)
|
||||||
|
|
||||||
death_use_action_t death_use_action;
|
death_use_action_t death_use_action;
|
||||||
|
boolean activate_death_use_reload;
|
||||||
|
|
||||||
//
|
//
|
||||||
// P_DeathThink
|
// P_DeathThink
|
||||||
@ -316,29 +315,21 @@ void P_DeathThink (player_t* player)
|
|||||||
|
|
||||||
if (player->cmd.buttons & BT_USE)
|
if (player->cmd.buttons & BT_USE)
|
||||||
{
|
{
|
||||||
if (demorecording || demoplayback || netgame)
|
player->playerstate = PST_REBORN;
|
||||||
player->playerstate = PST_REBORN;
|
}
|
||||||
else switch(death_use_action)
|
|
||||||
|
if (activate_death_use_reload)
|
||||||
|
{
|
||||||
|
activate_death_use_reload = false;
|
||||||
|
|
||||||
|
if (savegameslot >= 0)
|
||||||
{
|
{
|
||||||
case death_use_default:
|
char *file = G_SaveGameName(savegameslot);
|
||||||
player->playerstate = PST_REBORN;
|
G_LoadGame(file, savegameslot, false);
|
||||||
break;
|
free(file);
|
||||||
case death_use_reload:
|
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
player->playerstate = PST_REBORN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,6 +41,7 @@ typedef enum
|
|||||||
} death_use_action_t;
|
} death_use_action_t;
|
||||||
|
|
||||||
extern death_use_action_t death_use_action;
|
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
|
extern boolean onground; // whether player is on ground or in air
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user