mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-03-21 18:32:08 +00:00
Add option to always turn with input while locked
Uhhh also camera options scrolls now.
This commit is contained in:
parent
cdf5287fcc
commit
69b623e086
4 changed files with 58 additions and 40 deletions
|
@ -838,6 +838,8 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_cam_turnfacingspindash[1]);
|
||||
CV_RegisterVar(&cv_cam_turnfacinginput[0]);
|
||||
CV_RegisterVar(&cv_cam_turnfacinginput[1]);
|
||||
CV_RegisterVar(&cv_cam_lockedinput[0]);
|
||||
CV_RegisterVar(&cv_cam_lockedinput[1]);
|
||||
|
||||
// s_sound.c
|
||||
CV_RegisterVar(&cv_soundvolume);
|
||||
|
|
15
src/g_game.c
15
src/g_game.c
|
@ -421,6 +421,13 @@ consvar_t cv_cam_turnfacinginput[2] = {
|
|||
{"cam2_turnfacinginput", "0.4375", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
};
|
||||
|
||||
static CV_PossibleValue_t lockedinput_cons_t[] = {{0, "Strafe"}, {1, "Turn Slow"}, {2, "Turn"}, {0, NULL}};
|
||||
|
||||
consvar_t cv_cam_lockedinput[2] = {
|
||||
{"cam_lockedinput", "Strafe", CV_SAVE, lockedinput_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
{"cam2_lockedinput", "Strafe", CV_SAVE, lockedinput_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
};
|
||||
|
||||
typedef enum
|
||||
{
|
||||
AXISNONE = 0,
|
||||
|
@ -1400,7 +1407,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
|
||||
// Adjust camera angle by player input
|
||||
if (abilitydirection && !forcestrafe && camera.chase && !turnheld[forplayer] &&
|
||||
!(ticcmd_resetdown[forplayer] && !(player->pflags & PF_STARTDASH))
|
||||
!(ticcmd_resetdown[forplayer] && !(cv_cam_lockedinput[forplayer].value || (player->pflags & PF_STARTDASH)))
|
||||
&& !player->climbing && player->powers[pw_carry] != CR_MINECART)
|
||||
{
|
||||
fixed_t camadjustfactor = cv_cam_turnfacinginput[forplayer].value; //@TODO cvar
|
||||
|
@ -1410,13 +1417,13 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
|||
fixed_t sine = FINESINE((R_PointToAngle2(0, 0, player->rmomx, player->rmomy) - localangle)>>ANGLETOFINESHIFT);
|
||||
fixed_t factor = min(20, FixedMul(player->speed, abs(sine)) / FRACUNIT);
|
||||
|
||||
if (ticcmd_resetdown[forplayer] && (player->pflags & PF_STARTDASH))
|
||||
factor = (ssplayer == 1 ? cv_cam_rotspeed.value : cv_cam2_rotspeed.value); // Turn while in startdash and locking camera
|
||||
if (ticcmd_resetdown[forplayer] && (cv_cam_lockedinput[forplayer].value || (player->pflags & PF_STARTDASH)))
|
||||
factor = (ssplayer == 1 ? cv_cam_rotspeed.value : cv_cam2_rotspeed.value) * (cv_cam_lockedinput[forplayer].value ?: 1); // Turn while in startdash and locking camera
|
||||
|
||||
*myangle -= cmd->sidemove * factor * camadjustfactor;
|
||||
}
|
||||
|
||||
if (ticcmd_resetdown[forplayer] && (player->pflags & PF_STARTDASH))
|
||||
if (ticcmd_resetdown[forplayer] && (cv_cam_lockedinput[forplayer].value || (player->pflags & PF_STARTDASH)))
|
||||
cmd->sidemove = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,8 @@ extern consvar_t cv_ghost_bestscore, cv_ghost_besttime, cv_ghost_bestrings, cv_g
|
|||
|
||||
// hi here's some new controls
|
||||
extern consvar_t cv_abilitydirection[2], cv_cam_shiftfacing[2], cv_cam_turnfacing[2],
|
||||
cv_cam_turnfacingability[2], cv_cam_turnfacingspindash[2], cv_cam_turnfacinginput[2];
|
||||
cv_cam_turnfacingability[2], cv_cam_turnfacingspindash[2], cv_cam_turnfacinginput[2],
|
||||
cv_cam_lockedinput[2];
|
||||
|
||||
// mouseaiming (looking up/down with the mouse or keyboard)
|
||||
#define KB_LOOKSPEED (1<<25)
|
||||
|
|
78
src/m_menu.c
78
src/m_menu.c
|
@ -1181,44 +1181,46 @@ static menuitem_t OP_Mouse2OptionsMenu[] =
|
|||
|
||||
static menuitem_t OP_CameraOptionsMenu[] =
|
||||
{
|
||||
{IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam , 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Orbital Looking" , &cv_cam_orbit , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Downhill Slope Adjustment", &cv_cam_adjust, 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam , 5},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam , 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Orbital Looking" , &cv_cam_orbit , 15},
|
||||
{IT_STRING | IT_CVAR, NULL, "Downhill Slope Adjustment", &cv_cam_adjust, 20},
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Distance", &cv_cam_dist, 60},
|
||||
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Height", &cv_cam_height, 70},
|
||||
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Camera Speed", &cv_cam_speed, 80},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Rotation Speed", &cv_cam_rotspeed, 90},
|
||||
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Distance", &cv_cam_dist, 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Height", &cv_cam_height, 35},
|
||||
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Camera Speed", &cv_cam_speed, 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Rotation Speed", &cv_cam_rotspeed, 45},
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Shift to player angle", &cv_cam_shiftfacing[0], 100},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to player angle", &cv_cam_turnfacing[0], 110},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to ability", &cv_cam_turnfacingability[0], 120},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to spindash", &cv_cam_turnfacingspindash[0], 130},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to input", &cv_cam_turnfacinginput[0], 140},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Shift to player angle", &cv_cam_shiftfacing[0], 55},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to player angle", &cv_cam_turnfacing[0], 60},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to ability", &cv_cam_turnfacingability[0], 65},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to spindash", &cv_cam_turnfacingspindash[0], 70},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to input", &cv_cam_turnfacinginput[0], 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Locked movement", &cv_cam_lockedinput[0], 80},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair, 160},
|
||||
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair, 90},
|
||||
};
|
||||
|
||||
static menuitem_t OP_Camera2OptionsMenu[] =
|
||||
{
|
||||
{IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam2 , 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam2 , 20},
|
||||
{IT_STRING | IT_CVAR, NULL, "Orbital Looking" , &cv_cam2_orbit , 30},
|
||||
{IT_STRING | IT_CVAR, NULL, "Downhill Slope Adjustment", &cv_cam2_adjust, 40},
|
||||
{IT_STRING | IT_CVAR, NULL, "Third-person Camera" , &cv_chasecam2 , 5},
|
||||
{IT_STRING | IT_CVAR, NULL, "Flip Camera with Gravity" , &cv_flipcam2 , 10},
|
||||
{IT_STRING | IT_CVAR, NULL, "Orbital Looking" , &cv_cam2_orbit , 15},
|
||||
{IT_STRING | IT_CVAR, NULL, "Downhill Slope Adjustment", &cv_cam2_adjust, 20},
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Distance", &cv_cam2_dist, 60},
|
||||
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Height", &cv_cam2_height, 70},
|
||||
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Camera Speed", &cv_cam2_speed, 80},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Rotation Speed", &cv_cam2_rotspeed, 90},
|
||||
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Distance", &cv_cam2_dist, 30},
|
||||
{IT_STRING | IT_CVAR | IT_CV_INTEGERSTEP, NULL, "Camera Height", &cv_cam2_height, 35},
|
||||
{IT_STRING | IT_CVAR | IT_CV_FLOATSLIDER, NULL, "Camera Speed", &cv_cam2_speed, 40},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Rotation Speed", &cv_cam2_rotspeed, 45},
|
||||
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Shift to character angle", &cv_cam_shiftfacing[1], 100},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to character angle", &cv_cam_turnfacing[1], 110},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to ability", &cv_cam_turnfacingability[1], 120},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to spindash", &cv_cam_turnfacingspindash[1], 130},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to input", &cv_cam_turnfacinginput[1], 140},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Shift to character angle", &cv_cam_shiftfacing[1], 55},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to character angle", &cv_cam_turnfacing[1], 60},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to ability", &cv_cam_turnfacingability[1], 65},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to spindash", &cv_cam_turnfacingspindash[1], 70},
|
||||
{IT_STRING | IT_CVAR | IT_CV_SLIDER, NULL, "Turn to input", &cv_cam_turnfacinginput[1], 75},
|
||||
{IT_STRING | IT_CVAR, NULL, "Locked movement", &cv_cam_lockedinput[0], 80},
|
||||
|
||||
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair2, 160},
|
||||
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair2, 90},
|
||||
};
|
||||
|
||||
static menuitem_t OP_VideoOptionsMenu[] =
|
||||
|
@ -1976,10 +1978,10 @@ menu_t OP_JoystickSetDef =
|
|||
0,
|
||||
NULL
|
||||
};
|
||||
menu_t OP_CameraOptionsDef = DEFAULTMENUSTYLE(
|
||||
menu_t OP_CameraOptionsDef = DEFAULTSCROLLMENUSTYLE(
|
||||
MN_OP_MAIN + (MN_OP_P1CONTROLS << 6) + (MN_OP_P1CAMERA << 12),
|
||||
"M_CONTRO", OP_CameraOptionsMenu, &OP_P1ControlsDef, 35, 30);
|
||||
menu_t OP_Camera2OptionsDef = DEFAULTMENUSTYLE(
|
||||
menu_t OP_Camera2OptionsDef = DEFAULTSCROLLMENUSTYLE(
|
||||
MN_OP_MAIN + (MN_OP_P2CONTROLS << 6) + (MN_OP_P2CAMERA << 12),
|
||||
"M_CONTRO", OP_Camera2OptionsMenu, &OP_P2ControlsDef, 35, 30);
|
||||
|
||||
|
@ -4269,7 +4271,8 @@ static void M_DrawControlsDefMenu(void)
|
|||
OP_CameraOptionsMenu[10].status = IT_STRING|IT_CVAR|IT_CV_SLIDER;
|
||||
OP_CameraOptionsMenu[11].status = IT_STRING|IT_CVAR|IT_CV_SLIDER;
|
||||
OP_CameraOptionsMenu[12].status = IT_STRING|IT_CVAR|IT_CV_SLIDER;
|
||||
OP_CameraOptionsMenu[13].alphaKey = 160;
|
||||
OP_CameraOptionsMenu[13].status = IT_STRING|IT_CVAR;
|
||||
OP_CameraOptionsMenu[14].alphaKey = 90;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4278,7 +4281,8 @@ static void M_DrawControlsDefMenu(void)
|
|||
OP_CameraOptionsMenu[10].status = IT_DISABLED;
|
||||
OP_CameraOptionsMenu[11].status = IT_DISABLED;
|
||||
OP_CameraOptionsMenu[12].status = IT_DISABLED;
|
||||
OP_CameraOptionsMenu[13].alphaKey = 110;
|
||||
OP_CameraOptionsMenu[13].status = IT_DISABLED;
|
||||
OP_CameraOptionsMenu[14].alphaKey = 55;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -4292,7 +4296,8 @@ static void M_DrawControlsDefMenu(void)
|
|||
OP_Camera2OptionsMenu[10].status = IT_STRING|IT_CVAR|IT_CV_SLIDER;
|
||||
OP_Camera2OptionsMenu[11].status = IT_STRING|IT_CVAR|IT_CV_SLIDER;
|
||||
OP_Camera2OptionsMenu[12].status = IT_STRING|IT_CVAR|IT_CV_SLIDER;
|
||||
OP_Camera2OptionsMenu[13].alphaKey = 160;
|
||||
OP_Camera2OptionsMenu[13].status = IT_STRING|IT_CVAR;
|
||||
OP_Camera2OptionsMenu[14].alphaKey = 90;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -4301,7 +4306,8 @@ static void M_DrawControlsDefMenu(void)
|
|||
OP_Camera2OptionsMenu[10].status = IT_DISABLED;
|
||||
OP_Camera2OptionsMenu[11].status = IT_DISABLED;
|
||||
OP_Camera2OptionsMenu[12].status = IT_DISABLED;
|
||||
OP_Camera2OptionsMenu[13].alphaKey = 110;
|
||||
OP_Camera2OptionsMenu[13].status = IT_DISABLED;
|
||||
OP_Camera2OptionsMenu[14].alphaKey = 55;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4319,7 +4325,9 @@ static void M_DrawGenericScrollMenu(void)
|
|||
x = currentMenu->x;
|
||||
y = currentMenu->y;
|
||||
|
||||
if ((currentMenu->menuitems[itemOn].alphaKey*2 - currentMenu->menuitems[0].alphaKey*2) <= scrollareaheight)
|
||||
if (currentMenu->menuitems[currentMenu->numitems-1].alphaKey < scrollareaheight)
|
||||
tempcentery = currentMenu->y; // Not tall enough to scroll, but this thinker is used in case it becomes so
|
||||
else if ((currentMenu->menuitems[itemOn].alphaKey*2 - currentMenu->menuitems[0].alphaKey*2) <= scrollareaheight)
|
||||
tempcentery = currentMenu->y - currentMenu->menuitems[0].alphaKey*2;
|
||||
else if ((currentMenu->menuitems[currentMenu->numitems-1].alphaKey*2 - currentMenu->menuitems[itemOn].alphaKey*2) <= scrollareaheight)
|
||||
tempcentery = currentMenu->y - currentMenu->menuitems[currentMenu->numitems-1].alphaKey*2 + 2*scrollareaheight;
|
||||
|
|
Loading…
Reference in a new issue