- Added GetPlayerInput() for examining a player's inputs from ACS. Most

buttons are now passed across the network, and there are four new user
  buttons specifically for use with this command. Also defined +zoom
  and +reload for future implementation.

  See http://zdoom.org/files/examples/playerinput.zip for an example.


SVN r1215 (trunk)
This commit is contained in:
Randy Heit 2008-09-13 02:55:45 +00:00
commit 5cd4604f81
14 changed files with 252 additions and 49 deletions

View file

@ -1955,6 +1955,11 @@ void P_PlayerThink (player_t *player)
player->mo->flags &= ~MF_NOCLIP;
}
cmd = &player->cmd;
// Make unmodified copies for ACS's GetPlayerInput.
player->original_oldbuttons = player->original_cmd.buttons;
player->original_cmd = cmd->ucmd;
if (player->mo->flags & MF_JUSTATTACKED)
{ // Chainsaw/Gauntlets attack auto forward motion
cmd->ucmd.yaw = 0;
@ -1990,7 +1995,10 @@ void P_PlayerThink (player_t *player)
}
// Handle crouching
if (player->cmd.ucmd.buttons & BT_JUMP) player->cmd.ucmd.buttons &= ~BT_DUCK;
if (player->cmd.ucmd.buttons & BT_CROUCH)
{
player->cmd.ucmd.buttons &= ~BT_CROUCH;
}
if (player->morphTics == 0 && player->health > 0 && level.IsCrouchingAllowed())
{
if (!(player->cheats & CF_TOTALLYFROZEN))
@ -1999,9 +2007,9 @@ void P_PlayerThink (player_t *player)
if (crouchdir==0)
{
crouchdir = (player->cmd.ucmd.buttons & BT_DUCK)? -1 : 1;
crouchdir = (player->cmd.ucmd.buttons & BT_CROUCH)? -1 : 1;
}
else if (player->cmd.ucmd.buttons & BT_DUCK)
else if (player->cmd.ucmd.buttons & BT_CROUCH)
{
player->crouching=0;
}
@ -2452,7 +2460,9 @@ void player_t::Serialize (FArchive &arc)
arc << crouchfactor
<< crouching
<< crouchdir
<< crouchviewdelta;
<< crouchviewdelta
<< original_cmd
<< original_oldbuttons;
if (isbot)
{
@ -2486,6 +2496,7 @@ void player_t::Serialize (FArchive &arc)
// If the player reloaded because they pressed +use after dying, we
// don't want +use to still be down after the game is loaded.
oldbuttons = ~0;
original_oldbuttons = ~0;
}
}