mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-17 23:21:22 +00:00
Update playstyle menu handling to use analog/directionchar combo
This commit is contained in:
parent
c3d14064e2
commit
a51f2500e0
6 changed files with 20 additions and 33 deletions
|
@ -828,8 +828,6 @@ void D_RegisterClientCommands(void)
|
|||
CV_RegisterVar(&cv_autobrake2);
|
||||
|
||||
// hi here's some new controls
|
||||
CV_RegisterVar(&cv_abilitydirection[0]);
|
||||
CV_RegisterVar(&cv_abilitydirection[1]);
|
||||
CV_RegisterVar(&cv_cam_shiftfacing[0]);
|
||||
CV_RegisterVar(&cv_cam_shiftfacing[1]);
|
||||
CV_RegisterVar(&cv_cam_turnfacing[0]);
|
||||
|
|
|
@ -407,10 +407,6 @@ consvar_t cv_autobrake = {"autobrake", "On", CV_SAVE|CV_CALL, CV_OnOff, AutoBrak
|
|||
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},
|
||||
};
|
||||
static CV_PossibleValue_t zerotoone_cons_t[] = {{0, "MIN"}, {FRACUNIT, "MAX"}, {0, NULL}};
|
||||
consvar_t cv_cam_shiftfacing[2] = {
|
||||
{"cam_shiftfacingchar", "0.33", CV_FLOAT|CV_SAVE, zerotoone_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL},
|
||||
|
|
|
@ -87,7 +87,7 @@ extern consvar_t cv_sideaxis2,cv_turnaxis2,cv_moveaxis2,cv_lookaxis2,cv_jumpaxis
|
|||
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], cv_cam_shiftfacing[2], cv_cam_turnfacing[2],
|
||||
extern consvar_t cv_cam_shiftfacing[2], cv_cam_turnfacing[2],
|
||||
cv_cam_turnfacingability[2], cv_cam_turnfacingspindash[2], cv_cam_turnfacinginput[2],
|
||||
cv_cam_centertoggle[2], cv_cam_lockedinput[2], cv_cam_lockonboss[2];
|
||||
|
||||
|
|
|
@ -2195,12 +2195,12 @@ void HU_Drawer(void)
|
|||
|
||||
// draw the crosshair, not when viewing demos nor with chasecam
|
||||
if (!automapactive && cv_crosshair.value && !demoplayback &&
|
||||
(!camera.chase || (cv_abilitydirection[0].value && ticcmd_centerviewdown[0] && ticcmd_ztargetfocus[0]))
|
||||
(!camera.chase || ticcmd_ztargetfocus[0])
|
||||
&& !players[displayplayer].spectator)
|
||||
HU_DrawCrosshair();
|
||||
|
||||
if (!automapactive && cv_crosshair2.value && !demoplayback &&
|
||||
(!camera2.chase || (cv_abilitydirection[1].value && ticcmd_centerviewdown[1] && ticcmd_ztargetfocus[1]))
|
||||
(!camera2.chase || ticcmd_ztargetfocus[1])
|
||||
&& !players[secondarydisplayplayer].spectator)
|
||||
HU_DrawCrosshair2();
|
||||
|
||||
|
|
27
src/m_menu.c
27
src/m_menu.c
|
@ -1038,10 +1038,8 @@ static menuitem_t OP_P1ControlsMenu[] =
|
|||
|
||||
{IT_SUBMENU | IT_STRING, NULL, "Camera Options...", &OP_CameraOptionsDef, 50},
|
||||
|
||||
//{IT_STRING | IT_CVAR, NULL, "Character angle", &cv_directionchar[0], 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Automatic braking", &cv_autobrake, 70},
|
||||
{IT_CALL | IT_STRING, NULL, "Play Style...", M_Setup1PPlaystyleMenu, 80},
|
||||
//{IT_STRING | IT_CVAR, NULL, "Ability angle", &cv_abilitydirection[0], 90},
|
||||
};
|
||||
|
||||
static menuitem_t OP_P2ControlsMenu[] =
|
||||
|
@ -1052,10 +1050,8 @@ static menuitem_t OP_P2ControlsMenu[] =
|
|||
|
||||
{IT_SUBMENU | IT_STRING, NULL, "Camera Options...", &OP_Camera2OptionsDef, 50},
|
||||
|
||||
//{IT_STRING | IT_CVAR, NULL, "Character angle", &cv_directionchar[1], 70},
|
||||
{IT_STRING | IT_CVAR, NULL, "Automatic braking", &cv_autobrake2, 70},
|
||||
{IT_CALL | IT_STRING, NULL, "Play Style...", M_Setup2PPlaystyleMenu, 80},
|
||||
//{IT_STRING | IT_CVAR, NULL, "Ability angle", &cv_abilitydirection[1], 90},
|
||||
};
|
||||
|
||||
static menuitem_t OP_ChangeControlsMenu[] =
|
||||
|
@ -4318,7 +4314,7 @@ static void M_DrawControlsDefMenu(void)
|
|||
|
||||
if (currentMenu == &OP_P1ControlsDef)
|
||||
{
|
||||
opt = cv_useranalog[0].value ? 3 : (cv_abilitydirection[0].value ? 2 : cv_directionchar[0].value);
|
||||
opt = cv_useranalog[0].value ? 3 - cv_directionchar[0].value : cv_directionchar[0].value;
|
||||
|
||||
if (opt == 2)
|
||||
{
|
||||
|
@ -4333,7 +4329,7 @@ static void M_DrawControlsDefMenu(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
opt = cv_useranalog[1].value ? 3 : (cv_abilitydirection[1].value ? 2 : cv_directionchar[1].value);
|
||||
opt = cv_useranalog[1].value ? 3 - cv_directionchar[1].value : cv_directionchar[1].value;
|
||||
|
||||
if (opt == 2)
|
||||
{
|
||||
|
@ -11619,7 +11615,7 @@ static void M_Setup1PPlaystyleMenu(INT32 choice)
|
|||
(void)choice;
|
||||
|
||||
playstyle_activeplayer = 0;
|
||||
playstyle_currentchoice = cv_useranalog[0].value ? 3 : (cv_abilitydirection[0].value ? 2 : cv_directionchar[0].value);
|
||||
playstyle_currentchoice = cv_useranalog[0].value ? 3 - cv_directionchar[0].value : cv_directionchar[0].value;
|
||||
OP_PlaystyleDef.prevMenu = &OP_P1ControlsDef;
|
||||
M_SetupNextMenu(&OP_PlaystyleDef);
|
||||
}
|
||||
|
@ -11629,7 +11625,7 @@ static void M_Setup2PPlaystyleMenu(INT32 choice)
|
|||
(void)choice;
|
||||
|
||||
playstyle_activeplayer = 1;
|
||||
playstyle_currentchoice = cv_useranalog[1].value ? 3 : (cv_abilitydirection[1].value ? 2 : cv_directionchar[1].value);
|
||||
playstyle_currentchoice = cv_useranalog[1].value ? 3 - cv_directionchar[1].value : cv_directionchar[1].value;
|
||||
OP_PlaystyleDef.prevMenu = &OP_P2ControlsDef;
|
||||
M_SetupNextMenu(&OP_PlaystyleDef);
|
||||
}
|
||||
|
@ -11662,16 +11658,13 @@ static void M_HandlePlaystyleMenu(INT32 choice)
|
|||
|
||||
case KEY_ENTER:
|
||||
S_StartSound(NULL, sfx_menu1);
|
||||
if (cv_abilitydirection[playstyle_activeplayer].value != (playstyle_currentchoice/2))
|
||||
{
|
||||
CV_SetValue(&cv_abilitydirection[playstyle_activeplayer], playstyle_currentchoice/2);
|
||||
if (playstyle_activeplayer)
|
||||
CV_UpdateCam2Dist();
|
||||
else
|
||||
CV_UpdateCamDist();
|
||||
}
|
||||
CV_SetValue((playstyle_activeplayer ? &cv_directionchar[1] : &cv_directionchar[0]), playstyle_currentchoice ? 1 : 0);
|
||||
CV_SetValue((playstyle_activeplayer ? &cv_useranalog[1] : &cv_useranalog[0]), 0);
|
||||
CV_SetValue((playstyle_activeplayer ? &cv_useranalog[1] : &cv_useranalog[0]), playstyle_currentchoice/2);
|
||||
|
||||
if (playstyle_activeplayer)
|
||||
CV_UpdateCam2Dist();
|
||||
else
|
||||
CV_UpdateCamDist();
|
||||
|
||||
M_SetupNextMenu(currentMenu->prevMenu);
|
||||
break;
|
||||
|
|
14
src/p_user.c
14
src/p_user.c
|
@ -9792,14 +9792,14 @@ consvar_t cv_cam_saveheight[2][2] = {
|
|||
|
||||
void CV_UpdateCamDist(void)
|
||||
{
|
||||
CV_Set(&cv_cam_dist, va("%f", FIXED_TO_FLOAT(cv_cam_savedist[cv_abilitydirection[0].value][0].value)));
|
||||
CV_Set(&cv_cam_height, va("%f", FIXED_TO_FLOAT(cv_cam_saveheight[cv_abilitydirection[0].value][0].value)));
|
||||
CV_Set(&cv_cam_dist, va("%f", FIXED_TO_FLOAT(cv_cam_savedist[cv_useranalog[0].value][0].value)));
|
||||
CV_Set(&cv_cam_height, va("%f", FIXED_TO_FLOAT(cv_cam_saveheight[cv_useranalog[0].value][0].value)));
|
||||
}
|
||||
|
||||
void CV_UpdateCam2Dist(void)
|
||||
{
|
||||
CV_Set(&cv_cam2_dist, va("%f", FIXED_TO_FLOAT(cv_cam_savedist[cv_abilitydirection[1].value][1].value)));
|
||||
CV_Set(&cv_cam2_height, va("%f", FIXED_TO_FLOAT(cv_cam_saveheight[cv_abilitydirection[1].value][1].value)));
|
||||
CV_Set(&cv_cam2_dist, va("%f", FIXED_TO_FLOAT(cv_cam_savedist[cv_useranalog[1].value][1].value)));
|
||||
CV_Set(&cv_cam2_height, va("%f", FIXED_TO_FLOAT(cv_cam_saveheight[cv_useranalog[1].value][1].value)));
|
||||
}
|
||||
|
||||
fixed_t t_cam_dist = -42;
|
||||
|
@ -9835,8 +9835,8 @@ void P_ResetCamera(player_t *player, camera_t *thiscam)
|
|||
thiscam->y = y;
|
||||
thiscam->z = z;
|
||||
|
||||
if ((thiscam == &camera && cv_abilitydirection[0].value)
|
||||
|| (thiscam == &camera2 && cv_abilitydirection[1].value))
|
||||
if ((thiscam == &camera && G_ControlStyle(1) == CS_SIMPLE)
|
||||
|| (thiscam == &camera2 && G_ControlStyle(2) == CS_SIMPLE))
|
||||
{
|
||||
thiscam->angle = (thiscam == &camera) ? localangle : localangle2;
|
||||
thiscam->aiming = (thiscam == &camera) ? localaiming : localaiming2;
|
||||
|
@ -10075,7 +10075,7 @@ boolean P_MoveChaseCamera(player_t *player, camera_t *thiscam, boolean resetcall
|
|||
}
|
||||
}
|
||||
|
||||
if (cv_abilitydirection[(thiscam == &camera) ? 0 : 1].value && !sign)
|
||||
if (G_ControlStyle((thiscam == &camera) ? 1 : 2) == CS_SIMPLE && !sign)
|
||||
{
|
||||
// Shift the camera slightly to the sides depending on the player facing direction
|
||||
UINT8 forplayer = (thiscam == &camera) ? 0 : 1;
|
||||
|
|
Loading…
Reference in a new issue