Spectator-only looking, fixed crosshairs

This commit is contained in:
TehRealSalt 2018-01-24 16:53:20 -05:00
parent 403e14e971
commit 33350eb2a8
3 changed files with 92 additions and 41 deletions

View file

@ -1424,7 +1424,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
? -1 : 1; // set to -1 or 1 to multiply ? -1 : 1; // set to -1 or 1 to multiply
// mouse look stuff (mouse look is not the same as mouse aim) // mouse look stuff (mouse look is not the same as mouse aim)
if (mouseaiming) if (mouseaiming && player->spectator)
{ {
kbl = false; kbl = false;
@ -1433,24 +1433,28 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
} }
axis = JoyAxis(AXISLOOK, ssplayer); axis = JoyAxis(AXISLOOK, ssplayer);
if (analogjoystickmove && axis != 0 && lookaxis) if (analogjoystickmove && axis != 0 && lookaxis && player->spectator)
laim += (axis<<16) * screen_invert; laim += (axis<<16) * screen_invert;
// spring back if not using keyboard neither mouselookin' // spring back if not using keyboard neither mouselookin'
if (!kbl && !lookaxis && !mouseaiming) if (!kbl && !lookaxis && !mouseaiming)
laim = 0; laim = 0;
if (InputDown(gc_lookup, ssplayer) || (gamepadjoystickmove && axis < 0)) if (player->spectator)
{ {
laim += KB_LOOKSPEED * screen_invert; if (InputDown(gc_lookup, ssplayer) || (gamepadjoystickmove && axis < 0))
kbl = true; {
laim += KB_LOOKSPEED * screen_invert;
kbl = true;
}
else if (InputDown(gc_lookdown, ssplayer) || (gamepadjoystickmove && axis > 0))
{
laim -= KB_LOOKSPEED * screen_invert;
kbl = true;
}
} }
else if (InputDown(gc_lookdown, ssplayer) || (gamepadjoystickmove && axis > 0))
{ if (InputDown(gc_centerview, ssplayer)) // No need to put a spectator limit on this one though :V
laim -= KB_LOOKSPEED * screen_invert;
kbl = true;
}
else if (InputDown(gc_centerview, ssplayer))
laim = 0; laim = 0;
// accept no mlook for network games // accept no mlook for network games

View file

@ -911,7 +911,7 @@ static void HU_DrawChat(void)
static inline void HU_DrawCrosshair(void) static inline void HU_DrawCrosshair(void)
{ {
INT32 i, y; INT32 i, x, y;
i = cv_crosshair.value & 3; i = cv_crosshair.value & 3;
if (!i) if (!i)
@ -922,17 +922,23 @@ static inline void HU_DrawCrosshair(void)
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
{
x = (INT32)gr_basewindowcenterx;
y = (INT32)gr_basewindowcentery; y = (INT32)gr_basewindowcentery;
}
else else
#endif #endif
{
x = viewwindowx + (viewwidth>>1);
y = viewwindowy + (viewheight>>1); y = viewwindowy + (viewheight>>1);
}
V_DrawScaledPatch(vid.width>>1, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]); V_DrawScaledPatch(x, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]);
} }
static inline void HU_DrawCrosshair2(void) static inline void HU_DrawCrosshair2(void)
{ {
INT32 i, y; INT32 i, x, y;
i = cv_crosshair2.value & 3; i = cv_crosshair2.value & 3;
if (!i) if (!i)
@ -943,27 +949,43 @@ static inline void HU_DrawCrosshair2(void)
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
{
x = (INT32)gr_basewindowcenterx;
y = (INT32)gr_basewindowcentery; y = (INT32)gr_basewindowcentery;
}
else else
#endif #endif
{
x = viewwindowx + (viewwidth>>1);
y = viewwindowy + (viewheight>>1); y = viewwindowy + (viewheight>>1);
}
if (splitscreen) if (splitscreen)
{ {
if (splitscreen > 1)
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
y += (INT32)gr_viewheight; x += (INT32)gr_viewwidth;
else else
#endif #endif
y += viewheight; x += viewwidth;
else
{
#ifdef HWRENDER
if (rendermode != render_soft)
y += (INT32)gr_viewheight;
else
#endif
y += viewheight;
}
V_DrawScaledPatch(vid.width>>1, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]); V_DrawScaledPatch(x, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]);
} }
} }
static inline void HU_DrawCrosshair3(void) static inline void HU_DrawCrosshair3(void)
{ {
INT32 i, y; INT32 i, x, y;
i = cv_crosshair3.value & 3; i = cv_crosshair3.value & 3;
if (!i) if (!i)
@ -974,10 +996,16 @@ static inline void HU_DrawCrosshair3(void)
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
{
x = (INT32)gr_basewindowcenterx;
y = (INT32)gr_basewindowcentery; y = (INT32)gr_basewindowcentery;
}
else else
#endif #endif
{
x = viewwindowx + (viewwidth>>1);
y = viewwindowy + (viewheight>>1); y = viewwindowy + (viewheight>>1);
}
if (splitscreen > 1) if (splitscreen > 1)
{ {
@ -988,13 +1016,13 @@ static inline void HU_DrawCrosshair3(void)
#endif #endif
y += viewheight; y += viewheight;
V_DrawScaledPatch(vid.width>>1, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]); V_DrawScaledPatch(x, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]);
} }
} }
static inline void HU_DrawCrosshair4(void) static inline void HU_DrawCrosshair4(void)
{ {
INT32 i, y; INT32 i, x, y;
i = cv_crosshair4.value & 3; i = cv_crosshair4.value & 3;
if (!i) if (!i)
@ -1005,21 +1033,33 @@ static inline void HU_DrawCrosshair4(void)
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
{
x = (INT32)gr_basewindowcenterx;
y = (INT32)gr_basewindowcentery; y = (INT32)gr_basewindowcentery;
}
else else
#endif #endif
{
x = viewwindowx + (viewwidth>>1);
y = viewwindowy + (viewheight>>1); y = viewwindowy + (viewheight>>1);
}
if (splitscreen > 2) if (splitscreen > 2)
{ {
#ifdef HWRENDER #ifdef HWRENDER
if (rendermode != render_soft) if (rendermode != render_soft)
{
x += (INT32)gr_viewwidth;
y += (INT32)gr_viewheight; y += (INT32)gr_viewheight;
}
else else
#endif #endif
{
x += viewwidth;
y += viewheight; y += viewheight;
}
V_DrawScaledPatch(vid.width>>1, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]); V_DrawScaledPatch(x, y, V_NOSCALESTART|V_OFFSET|V_TRANSLUCENT, crosshair[i - 1]);
} }
} }

View file

@ -282,7 +282,7 @@ static void M_SetupMultiPlayer4(INT32 choice);
// Split into multiple parts due to size // Split into multiple parts due to size
// Controls // Controls
menu_t OP_ControlsDef, /*OP_ControlListDef,*/ OP_MoveControlsDef; menu_t OP_ControlsDef, /*OP_ControlListDef,*/ OP_MoveControlsDef;
menu_t /*OP_MPControlsDef, OP_CameraControlsDef, OP_MiscControlsDef,*/ OP_CustomControlsDef; menu_t /*OP_MPControlsDef, OP_CameraControlsDef, OP_MiscControlsDef,*/ OP_CustomControlsDef, OP_SpectateControlsDef;
menu_t OP_P1ControlsDef, OP_P2ControlsDef; menu_t OP_P1ControlsDef, OP_P2ControlsDef;
menu_t OP_MouseOptionsDef, OP_Mouse2OptionsDef; menu_t OP_MouseOptionsDef, OP_Mouse2OptionsDef;
menu_t OP_Joystick1Def, OP_Joystick2Def; menu_t OP_Joystick1Def, OP_Joystick2Def;
@ -1060,11 +1060,11 @@ static menuitem_t OP_ControlsMenu[] =
static menuitem_t OP_P1ControlsMenu[] = static menuitem_t OP_P1ControlsMenu[] =
{ {
{IT_CALL | IT_STRING, NULL, "Control Configuration...", M_Setup1PControlsMenu, 10}, {IT_CALL | IT_STRING, NULL, "Control Configuration...", M_Setup1PControlsMenu, 10},
{IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 20}, //{IT_SUBMENU | IT_STRING, NULL, "Mouse Options...", &OP_MouseOptionsDef, 20},
{IT_SUBMENU | IT_STRING, NULL, "Joystick Options...", &OP_Joystick1Def , 30}, {IT_SUBMENU | IT_STRING, NULL, "Joystick Options...", &OP_Joystick1Def , 20},
{IT_STRING | IT_CVAR, NULL, "Camera" , &cv_chasecam , 50}, {IT_STRING | IT_CVAR, NULL, "Camera" , &cv_chasecam , 40},
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair , 60}, {IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair , 50},
//{IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog, 80}, //{IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog, 80},
}; };
@ -1072,11 +1072,11 @@ static menuitem_t OP_P1ControlsMenu[] =
static menuitem_t OP_P2ControlsMenu[] = static menuitem_t OP_P2ControlsMenu[] =
{ {
{IT_CALL | IT_STRING, NULL, "Control Configuration...", M_Setup2PControlsMenu, 10}, {IT_CALL | IT_STRING, NULL, "Control Configuration...", M_Setup2PControlsMenu, 10},
{IT_SUBMENU | IT_STRING, NULL, "Second Mouse Options...", &OP_Mouse2OptionsDef, 20}, //{IT_SUBMENU | IT_STRING, NULL, "Second Mouse Options...", &OP_Mouse2OptionsDef, 20},
{IT_SUBMENU | IT_STRING, NULL, "Second Joystick Options...", &OP_Joystick2Def , 30}, {IT_SUBMENU | IT_STRING, NULL, "Second Joystick Options...", &OP_Joystick2Def , 20},
{IT_STRING | IT_CVAR, NULL, "Camera" , &cv_chasecam2 , 50}, {IT_STRING | IT_CVAR, NULL, "Camera" , &cv_chasecam2 , 40},
{IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair2, 60}, {IT_STRING | IT_CVAR, NULL, "Crosshair", &cv_crosshair2, 50},
//{IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog2, 70}, //{IT_STRING | IT_CVAR, NULL, "Analog Control", &cv_useranalog2, 70},
}; };
@ -1124,18 +1124,25 @@ static menuitem_t OP_MoveControlsMenu[] =
{IT_CALL | IT_STRING2, NULL, "Brake", M_ChangeControl, gc_brake }, {IT_CALL | IT_STRING2, NULL, "Brake", M_ChangeControl, gc_brake },
{IT_CALL | IT_STRING2, NULL, "Use/Throw Item", M_ChangeControl, gc_fire }, {IT_CALL | IT_STRING2, NULL, "Use/Throw Item", M_ChangeControl, gc_fire },
{IT_CALL | IT_STRING2, NULL, "Look Backward", M_ChangeControl, gc_lookback }, {IT_CALL | IT_STRING2, NULL, "Look Backward", M_ChangeControl, gc_lookback },
{IT_CALL | IT_STRING2, NULL, "Toggle Chasecam", M_ChangeControl, gc_camtoggle },
{IT_CALL | IT_STRING2, NULL, "Pause", M_ChangeControl, gc_pause }, {IT_CALL | IT_STRING2, NULL, "Toggle Chasecam", M_ChangeControl, gc_camtoggle },
{IT_CALL | IT_STRING2, NULL, "Console", M_ChangeControl, gc_console },
{IT_CALL | IT_STRING2, NULL, "Talk key", M_ChangeControl, gc_talkkey }, {IT_CALL | IT_STRING2, NULL, "Talk key", M_ChangeControl, gc_talkkey },
{IT_CALL | IT_STRING2, NULL, "Team-Talk key", M_ChangeControl, gc_teamkey }, {IT_CALL | IT_STRING2, NULL, "Team-Talk key", M_ChangeControl, gc_teamkey },
{IT_CALL | IT_STRING2, NULL, "Rankings/Scores", M_ChangeControl, gc_scores }, {IT_CALL | IT_STRING2, NULL, "Rankings/Scores", M_ChangeControl, gc_scores },
{IT_CALL | IT_STRING2, NULL, "Spectate", M_ChangeControl, gc_spectate },
{IT_SUBMENU | IT_STRING, NULL, "Custom Actions...",&OP_CustomControlsDef, 128}, {IT_CALL | IT_STRING2, NULL, "Pause", M_ChangeControl, gc_pause },
// {IT_CALL | IT_STRING2, NULL, "Strafe Left", M_ChangeControl, gc_strafeleft }, {IT_CALL | IT_STRING2, NULL, "Console", M_ChangeControl, gc_console },
// {IT_CALL | IT_STRING2, NULL, "Strafe Right", M_ChangeControl, gc_straferight},
{IT_SUBMENU | IT_STRING, NULL, "Spectator Controls...",&OP_SpectateControlsDef,120},
{IT_SUBMENU | IT_STRING, NULL, "Custom Actions...", &OP_CustomControlsDef, 128},
};
static menuitem_t OP_SpectateControlsMenu[] =
{
{IT_CALL | IT_STRING2, NULL, "Spectate", M_ChangeControl, gc_spectate },
{IT_CALL | IT_STRING2, NULL, "Look Up", M_ChangeControl, gc_lookup },
{IT_CALL | IT_STRING2, NULL, "Look Down", M_ChangeControl, gc_lookdown },
{IT_CALL | IT_STRING2, NULL, "Center View", M_ChangeControl, gc_centerview},
}; };
static menuitem_t OP_CustomControlsMenu[] = static menuitem_t OP_CustomControlsMenu[] =
@ -1143,7 +1150,6 @@ static menuitem_t OP_CustomControlsMenu[] =
{IT_CALL | IT_STRING2, NULL, "Custom Action 1", M_ChangeControl, gc_custom1}, {IT_CALL | IT_STRING2, NULL, "Custom Action 1", M_ChangeControl, gc_custom1},
{IT_CALL | IT_STRING2, NULL, "Custom Action 2", M_ChangeControl, gc_custom2}, {IT_CALL | IT_STRING2, NULL, "Custom Action 2", M_ChangeControl, gc_custom2},
{IT_CALL | IT_STRING2, NULL, "Custom Action 3", M_ChangeControl, gc_custom3}, {IT_CALL | IT_STRING2, NULL, "Custom Action 3", M_ChangeControl, gc_custom3},
}; };
// Obsolete thanks to Kart // Obsolete thanks to Kart
@ -1789,6 +1795,7 @@ menu_t OP_MoveControlsDef = CONTROLMENUSTYLE(OP_MoveControlsMenu, &OP_ControlsDe
//menu_t OP_CameraControlsDef = CONTROLMENUSTYLE(OP_CameraControlsMenu, &OP_ControlListDef); //menu_t OP_CameraControlsDef = CONTROLMENUSTYLE(OP_CameraControlsMenu, &OP_ControlListDef);
//menu_t OP_MiscControlsDef = CONTROLMENUSTYLE(OP_MiscControlsMenu, &OP_ControlListDef); //menu_t OP_MiscControlsDef = CONTROLMENUSTYLE(OP_MiscControlsMenu, &OP_ControlListDef);
menu_t OP_CustomControlsDef = CONTROLMENUSTYLE(OP_CustomControlsMenu, &OP_MoveControlsDef); menu_t OP_CustomControlsDef = CONTROLMENUSTYLE(OP_CustomControlsMenu, &OP_MoveControlsDef);
menu_t OP_SpectateControlsDef = CONTROLMENUSTYLE(OP_SpectateControlsMenu, &OP_MoveControlsDef);
menu_t OP_P1ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P1ControlsMenu, &OP_ControlsDef, 60, 30); menu_t OP_P1ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P1ControlsMenu, &OP_ControlsDef, 60, 30);
menu_t OP_P2ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P2ControlsMenu, &OP_ControlsDef, 60, 30); menu_t OP_P2ControlsDef = DEFAULTMENUSTYLE("M_CONTRO", OP_P2ControlsMenu, &OP_ControlsDef, 60, 30);
#ifndef NOFOURPLAYER #ifndef NOFOURPLAYER