diff options
author | Samuel Villareal | 2010-09-02 05:11:42 +0000 |
---|---|---|
committer | Samuel Villareal | 2010-09-02 05:11:42 +0000 |
commit | 42572cb925b9723cfa69ff37816de213d7d8a469 (patch) | |
tree | b4103cbc59bbdb0560fc519910c1ba26f5ea16a3 /src | |
parent | 34aa87405686a3ef556ba0be677bd359e2151477 (diff) | |
download | chocolate-doom-42572cb925b9723cfa69ff37816de213d7d8a469.tar.gz chocolate-doom-42572cb925b9723cfa69ff37816de213d7d8a469.tar.bz2 chocolate-doom-42572cb925b9723cfa69ff37816de213d7d8a469.zip |
+ Jumping/look/centerview actions added
+ button code/flags added for cmd->buttons2
Subversion-branch: /branches/strife-branch
Subversion-revision: 1999
Diffstat (limited to 'src')
-rw-r--r-- | src/d_event.h | 15 | ||||
-rw-r--r-- | src/strife/p_user.c | 55 |
2 files changed, 70 insertions, 0 deletions
diff --git a/src/d_event.h b/src/d_event.h index e47f82df..eb9211bb 100644 --- a/src/d_event.h +++ b/src/d_event.h @@ -89,6 +89,21 @@ typedef enum } buttoncode_t; +// villsa [STRIFE] Strife specific buttons +// TODO - not finished +typedef enum +{ + // Player view look up + BT_LOOKUP = 1, + // Player view look down + BT_LOOKDOWN = 2, + // Center player's view + BT_CENTERVIEW = 4, + // Jump up and down + BT_JUMP = 32, + +} buttoncode2_t; + diff --git a/src/strife/p_user.c b/src/strife/p_user.c index 9d44f78c..3c0cdb5e 100644 --- a/src/strife/p_user.c +++ b/src/strife/p_user.c @@ -40,6 +40,10 @@ // Index of the special effects (INVUL inverse) map. #define INVERSECOLORMAP 32 +#define LOOKPITCHAMOUNT 6 // villsa [STRIFE] +#define CENTERVIEWAMOUNT (LOOKPITCHAMOUNT + 2) // villsa [STRIFE] +#define LOOKUPMAX 90 // villsa [STRIFE] +#define LOOKDOWNMAX -110 // villsa [STRIFE] // @@ -161,6 +165,13 @@ void P_MovePlayer (player_t* player) // Do not let the player control movement // if not onground. onground = (player->mo->z <= player->mo->floorz); + + // villsa [STRIFE] jump button + if (onground && cmd->buttons2 & BT_JUMP) + { + if(!player->deltaviewheight) + player->mo->momz += (8*FRACUNIT); + } if (cmd->forwardmove && onground) P_Thrust (player, player->mo->angle, cmd->forwardmove*2048); @@ -174,6 +185,50 @@ void P_MovePlayer (player_t* player) { P_SetMobjState (player->mo, S_PLAY_01); } + + // villsa [STRIFE] centerview button + if (cmd->buttons2 & BT_CENTERVIEW) + player->centerview = 1; + + // villsa [STRIFE] adjust player's pitch when centerviewing + if (player->centerview) + { + if (player->pitch <= 0) + { + if (player->pitch < 0) + player->pitch = player->pitch + CENTERVIEWAMOUNT; + } + else + { + player->pitch = player->pitch - CENTERVIEWAMOUNT; + } + if (abs(player->pitch) < CENTERVIEWAMOUNT) + { + player->pitch = 0; + player->centerview = 0; + } + } + + // villsa [STRIFE] look up action + if (cmd->buttons2 & BT_LOOKUP) + { + player->pitch += LOOKPITCHAMOUNT; + if ((player->pitch + LOOKPITCHAMOUNT) > LOOKUPMAX || + (player->pitch + LOOKPITCHAMOUNT) < LOOKDOWNMAX) + player->pitch -= LOOKPITCHAMOUNT; + } + else + { + // villsa [STRIFE] look down action + if (cmd->buttons2 & BT_LOOKDOWN) + { + player->pitch -= LOOKPITCHAMOUNT; + if ((player->pitch - LOOKPITCHAMOUNT) > LOOKUPMAX || + (player->pitch - LOOKPITCHAMOUNT) < LOOKDOWNMAX) + player->pitch += LOOKPITCHAMOUNT; + } + } + } |