mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 07:12:03 +00:00
Add cv_lookbackaxis (and p2-4 equivalents)
* Rename `Look Up/Down` to `Spec. Look Up/Down` to disambiguate from `Look Backward` * Make it support multiplayer replay recording save request too
This commit is contained in:
parent
44eeb3a0f3
commit
9e194dab2d
6 changed files with 51 additions and 19 deletions
|
@ -912,6 +912,10 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_driftaxis2);
|
||||
CV_RegisterVar(&cv_driftaxis3);
|
||||
CV_RegisterVar(&cv_driftaxis4);
|
||||
CV_RegisterVar(&cv_lookbackaxis);
|
||||
CV_RegisterVar(&cv_lookbackaxis2);
|
||||
CV_RegisterVar(&cv_lookbackaxis3);
|
||||
CV_RegisterVar(&cv_lookbackaxis4);
|
||||
CV_RegisterVar(&cv_xdeadzone);
|
||||
CV_RegisterVar(&cv_ydeadzone);
|
||||
CV_RegisterVar(&cv_xdeadzone2);
|
||||
|
|
21
src/g_game.c
21
src/g_game.c
|
@ -493,6 +493,7 @@ consvar_t cv_aimaxis = {"joyaxis_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL,
|
|||
consvar_t cv_lookaxis = {"joyaxis_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis = {"joyaxis_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftaxis = {"joyaxis_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookbackaxis = {"joyaxis_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_xdeadzone = {"joy_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_ydeadzone = {"joy_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
@ -503,6 +504,7 @@ consvar_t cv_aimaxis2 = {"joyaxis2_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL
|
|||
consvar_t cv_lookaxis2 = {"joyaxis2_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis2 = {"joyaxis2_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftaxis2 = {"joyaxis2_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookbackaxis2 = {"joyaxis2_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_xdeadzone2 = {"joy2_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_ydeadzone2 = {"joy2_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
@ -513,6 +515,7 @@ consvar_t cv_aimaxis3 = {"joyaxis3_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL
|
|||
consvar_t cv_lookaxis3 = {"joyaxis3_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis3 = {"joyaxis3_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftaxis3 = {"joyaxis3_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookbackaxis3 = {"joyaxis3_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_xdeadzone3 = {"joy3_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_ydeadzone3 = {"joy3_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
@ -523,6 +526,7 @@ consvar_t cv_aimaxis4 = {"joyaxis4_aim", "Left Y", CV_SAVE, joyaxis_cons_t, NULL
|
|||
consvar_t cv_lookaxis4 = {"joyaxis4_look", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_fireaxis4 = {"joyaxis4_fire", "L Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_driftaxis4 = {"joyaxis4_drift", "R Trigger", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_lookbackaxis4 = {"joyaxis4_lookback", "None", CV_SAVE, joyaxis_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_xdeadzone4 = {"joy4_xdeadzone", "0.3", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_ydeadzone4 = {"joy4_ydeadzone", "0.5", CV_FLOAT|CV_SAVE, deadzone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
|
@ -910,6 +914,9 @@ static INT32 Joy1Axis(axis_input_e axissel)
|
|||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis.value;
|
||||
break;
|
||||
case AXISLOOKBACK:
|
||||
axisval = cv_lookbackaxis.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -1003,11 +1010,13 @@ static INT32 Joy2Axis(axis_input_e axissel)
|
|||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis2.value;
|
||||
break;
|
||||
case AXISLOOKBACK:
|
||||
axisval = cv_lookbackaxis2.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (axisval < 0) //odd -axises
|
||||
{
|
||||
axisval = -axisval;
|
||||
|
@ -1099,11 +1108,13 @@ static INT32 Joy3Axis(axis_input_e axissel)
|
|||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis3.value;
|
||||
break;
|
||||
case AXISLOOKBACK:
|
||||
axisval = cv_lookbackaxis3.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (axisval < 0) //odd -axises
|
||||
{
|
||||
axisval = -axisval;
|
||||
|
@ -1195,6 +1206,9 @@ static INT32 Joy4Axis(axis_input_e axissel)
|
|||
case AXISDRIFT:
|
||||
axisval = cv_driftaxis4.value;
|
||||
break;
|
||||
case AXISLOOKBACK:
|
||||
axisval = cv_lookbackaxis4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
@ -1645,7 +1659,8 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
keyboard_look[ssplayer-1] = kbl;
|
||||
turnheld[ssplayer-1] = th;
|
||||
resetdown[ssplayer-1] = rd;
|
||||
camspin[ssplayer-1] = InputDown(gc_lookback, ssplayer);
|
||||
axis = JoyAxis(AXISLOOKBACK, ssplayer);
|
||||
camspin[ssplayer-1] = (InputDown(gc_lookback, ssplayer) || (usejoystick && axis > 0));
|
||||
}
|
||||
|
||||
/* Lua: Allow this hook to overwrite ticcmd.
|
||||
|
|
|
@ -118,10 +118,10 @@ extern consvar_t cv_invertmouse/*, cv_alwaysfreelook, cv_chasefreelook, cv_mouse
|
|||
extern consvar_t cv_invertmouse2/*, cv_alwaysfreelook2, cv_chasefreelook2, cv_mousemove2*/;
|
||||
extern consvar_t cv_useranalog, cv_useranalog2, cv_useranalog3, cv_useranalog4;
|
||||
extern consvar_t cv_analog, cv_analog2, cv_analog3, cv_analog4;
|
||||
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis,cv_xdeadzone,cv_ydeadzone;
|
||||
extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2,cv_xdeadzone2,cv_ydeadzone2;
|
||||
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3,cv_xdeadzone3,cv_ydeadzone3;
|
||||
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_xdeadzone4,cv_ydeadzone4;
|
||||
extern consvar_t cv_turnaxis,cv_moveaxis,cv_brakeaxis,cv_aimaxis,cv_lookaxis,cv_fireaxis,cv_driftaxis,cv_lookbackaxis,cv_xdeadzone,cv_ydeadzone;
|
||||
extern consvar_t cv_turnaxis2,cv_moveaxis2,cv_brakeaxis2,cv_aimaxis2,cv_lookaxis2,cv_fireaxis2,cv_driftaxis2,cv_lookbackaxis2,cv_xdeadzone2,cv_ydeadzone2;
|
||||
extern consvar_t cv_turnaxis3,cv_moveaxis3,cv_brakeaxis3,cv_aimaxis3,cv_lookaxis3,cv_fireaxis3,cv_driftaxis3,cv_lookbackaxis3,cv_xdeadzone3,cv_ydeadzone3;
|
||||
extern consvar_t cv_turnaxis4,cv_moveaxis4,cv_brakeaxis4,cv_aimaxis4,cv_lookaxis4,cv_fireaxis4,cv_driftaxis4,cv_lookbackaxis4,cv_xdeadzone4,cv_ydeadzone4;
|
||||
extern consvar_t cv_ghost_besttime, cv_ghost_bestlap, cv_ghost_last, cv_ghost_guest, cv_ghost_staff;
|
||||
|
||||
typedef enum
|
||||
|
@ -135,6 +135,7 @@ typedef enum
|
|||
AXISBRAKE,
|
||||
AXISFIRE,
|
||||
AXISDRIFT,
|
||||
AXISLOOKBACK,
|
||||
} axis_input_e;
|
||||
|
||||
// mouseaiming (looking up/down with the mouse or keyboard)
|
||||
|
|
28
src/m_menu.c
28
src/m_menu.c
|
@ -1163,9 +1163,10 @@ static menuitem_t OP_Joystick1Menu[] =
|
|||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone , 110},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone , 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis , 100},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone , 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone , 130},
|
||||
};
|
||||
|
||||
static menuitem_t OP_Joystick2Menu[] =
|
||||
|
@ -1177,9 +1178,10 @@ static menuitem_t OP_Joystick2Menu[] =
|
|||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis2 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis2 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis2 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis2 , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone2 , 110},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone2 , 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis2 , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis2 , 100},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone2 , 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone2 , 130},
|
||||
};
|
||||
|
||||
static menuitem_t OP_Joystick3Menu[] =
|
||||
|
@ -1191,9 +1193,10 @@ static menuitem_t OP_Joystick3Menu[] =
|
|||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis3 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis3 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis3 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis3 , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "X DeadZone" , &cv_xdeadzone3 , 110},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y DeadZone" , &cv_ydeadzone3 , 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis3 , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis3 , 100},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone3 , 120},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone3 , 130},
|
||||
};
|
||||
|
||||
static menuitem_t OP_Joystick4Menu[] =
|
||||
|
@ -1205,7 +1208,8 @@ static menuitem_t OP_Joystick4Menu[] =
|
|||
{IT_STRING | IT_CVAR, NULL, "Brake" , &cv_brakeaxis4 , 60},
|
||||
{IT_STRING | IT_CVAR, NULL, "Drift" , &cv_driftaxis4 , 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Use Item" , &cv_fireaxis4 , 80},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Up/Down" , &cv_lookaxis4 , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Look Backward" , &cv_lookbackaxis4 , 90},
|
||||
{IT_STRING | IT_CVAR, NULL, "Spec. Look Up/Down" , &cv_lookaxis4 , 100},
|
||||
{IT_STRING | IT_CVAR, NULL, "X deadzone" , &cv_xdeadzone4 , 110},
|
||||
{IT_STRING | IT_CVAR, NULL, "Y deadzone" , &cv_ydeadzone4 , 120},
|
||||
};
|
||||
|
@ -10711,6 +10715,7 @@ static void M_ResetControlsResponse(INT32 ch)
|
|||
CV_StealthSet(&cv_lookaxis4, cv_lookaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis4, cv_fireaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis4, cv_driftaxis4.defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis4, cv_lookbackaxis4.defaultvalue);
|
||||
break;
|
||||
case 3:
|
||||
CV_StealthSet(&cv_usejoystick3, cv_usejoystick3.defaultvalue);
|
||||
|
@ -10721,6 +10726,7 @@ static void M_ResetControlsResponse(INT32 ch)
|
|||
CV_StealthSet(&cv_lookaxis3, cv_lookaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis3, cv_fireaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis3, cv_driftaxis3.defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis3, cv_lookbackaxis3.defaultvalue);
|
||||
break;
|
||||
case 2:
|
||||
CV_StealthSet(&cv_usejoystick2, cv_usejoystick2.defaultvalue);
|
||||
|
@ -10731,6 +10737,7 @@ static void M_ResetControlsResponse(INT32 ch)
|
|||
CV_StealthSet(&cv_lookaxis2, cv_lookaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis2, cv_fireaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis2, cv_driftaxis2.defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis2, cv_lookbackaxis2.defaultvalue);
|
||||
break;
|
||||
case 1:
|
||||
default:
|
||||
|
@ -10742,6 +10749,7 @@ static void M_ResetControlsResponse(INT32 ch)
|
|||
CV_StealthSet(&cv_lookaxis, cv_lookaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_fireaxis, cv_fireaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_driftaxis, cv_driftaxis.defaultvalue);
|
||||
CV_StealthSet(&cv_lookbackaxis, cv_lookbackaxis.defaultvalue);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -770,10 +770,12 @@ void P_Ticker(boolean run)
|
|||
|
||||
if (demo.recording)
|
||||
{
|
||||
INT32 axis = JoyAxis(AXISLOOKBACK, 1);
|
||||
|
||||
G_WriteAllGhostTics();
|
||||
|
||||
if (cv_recordmultiplayerdemos.value && (demo.savemode == DSM_NOTSAVING || demo.savemode == DSM_WILLAUTOSAVE))
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && InputDown(gc_lookback, 1))
|
||||
if (demo.savebutton && demo.savebutton + 3*TICRATE < leveltime && (InputDown(gc_lookback, 1) || (cv_usejoystick.value && axis > 0)))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
}
|
||||
else if (demo.playback) // Use Ghost data for consistency checks.
|
||||
|
|
|
@ -608,7 +608,9 @@ void Y_Ticker(void)
|
|||
|
||||
if (demo.recording)
|
||||
{
|
||||
if (demo.savemode == DSM_NOTSAVING && InputDown(gc_lookback, 1))
|
||||
INT32 axis = JoyAxis(AXISLOOKBACK, 1);
|
||||
|
||||
if (demo.savemode == DSM_NOTSAVING && (InputDown(gc_lookback, 1) || (cv_usejoystick.value && axis > 0)))
|
||||
demo.savemode = DSM_TITLEENTRY;
|
||||
|
||||
if (demo.savemode == DSM_WILLSAVE || demo.savemode == DSM_WILLAUTOSAVE)
|
||||
|
|
Loading…
Reference in a new issue