mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-23 11:21:01 +00:00
Add cvar to use abilities in input direction
This commit is contained in:
parent
32c9c912ab
commit
075f751f67
3 changed files with 31 additions and 1 deletions
|
@ -823,6 +823,10 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_autobrake);
|
||||
CV_RegisterVar(&cv_autobrake2);
|
||||
|
||||
// hi here's some new controls
|
||||
CV_RegisterVar(&cv_abilitydirection[0]);
|
||||
CV_RegisterVar(&cv_abilitydirection[1]);
|
||||
|
||||
// s_sound.c
|
||||
CV_RegisterVar(&cv_soundvolume);
|
||||
CV_RegisterVar(&cv_closedcaptioning);
|
||||
|
|
25
src/g_game.c
25
src/g_game.c
|
@ -394,6 +394,12 @@ consvar_t cv_directionchar2 = {"directionchar2", "Movement", CV_SAVE|CV_CALL, di
|
|||
consvar_t cv_autobrake = {"autobrake", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_autobrake2 = {"autobrake2", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrake2_OnChange, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
// hi here's some new controls
|
||||
consvar_t cv_abilitydirection[2] = {
|
||||
{"abilitydirection", "Movement", CV_SAVE, directionchar_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"abilitydirection2", "Movement", CV_SAVE, directionchar_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AXISNONE = 0,
|
||||
|
@ -996,7 +1002,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
angle_t *myangle = (ssplayer == 1 ? &localangle : &localangle2);
|
||||
INT32 *myaiming = (ssplayer == 1 ? &localaiming : &localaiming2);
|
||||
|
||||
INT32 chasecam, chasefreelook, alwaysfreelook, usejoystick, analog, invertmouse, mousemove;
|
||||
INT32 chasecam, chasefreelook, alwaysfreelook, usejoystick, analog, invertmouse, mousemove, abilitydirection;
|
||||
INT32 *mx; INT32 *my; INT32 *mly;
|
||||
|
||||
static INT32 turnheld[2]; // for accelerative turning
|
||||
|
@ -1033,6 +1039,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
mly = &mlook2y;
|
||||
G_CopyTiccmd(cmd, I_BaseTiccmd2(), 1); // empty, or external driver
|
||||
}
|
||||
abilitydirection = cv_abilitydirection[forplayer].value;
|
||||
|
||||
// why build a ticcmd if we're paused?
|
||||
// Or, for that matter, if we're being reborn.
|
||||
|
@ -1352,6 +1359,22 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
{
|
||||
*myangle += (cmd->angleturn<<16);
|
||||
cmd->angleturn = (INT16)(*myangle >> 16);
|
||||
|
||||
if (abilitydirection && !player->climbing && !forcestrafe)
|
||||
{
|
||||
if (cmd->forwardmove || cmd->sidemove)
|
||||
{
|
||||
angle_t controlangle = R_PointToAngle2(0, 0, cmd->forwardmove << FRACBITS, -cmd->sidemove << FRACBITS);
|
||||
cmd->angleturn += (controlangle>>16);
|
||||
|
||||
cmd->forwardmove = R_PointToDist2(0, 0, cmd->forwardmove, cmd->sidemove);
|
||||
if (cmd->forwardmove > MAXPLMOVE)
|
||||
cmd->forwardmove = MAXPLMOVE;
|
||||
cmd->sidemove = 0;
|
||||
}
|
||||
else
|
||||
cmd->angleturn = (player->drawangle>>16);
|
||||
}
|
||||
}
|
||||
|
||||
//Reset away view if a command is given.
|
||||
|
|
|
@ -76,6 +76,9 @@ extern consvar_t cv_sideaxis,cv_turnaxis,cv_moveaxis,cv_lookaxis,cv_jumpaxis,cv_
|
|||
extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis2,cv_spinaxis2,cv_fireaxis2,cv_firenaxis2;
|
||||
extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_ghost_last, cv_ghost_guest;
|
||||
|
||||
// hi here's some new controls
|
||||
extern consvar_t cv_abilitydirection[2];
|
||||
|
||||
// mouseaiming (looking up/down with the mouse or keyboard)
|
||||
#define KB_LOOKSPEED (1<<25)
|
||||
#define MAXPLMOVE (50)
|
||||
|
|
Loading…
Reference in a new issue