New input display option for stick display
thy neppy! https://codeberg.org/NepDisk/blankart/commit/52601bdfc2a6dd8916c3c401d70128d2ca11a1ff#diff-baf740b84aa99188fc2e5c1cb93e59fa2e319ff3 + hellish abomination code cause kart
This commit is contained in:
1 parent
474ed722f6
commit
8a410913f3
2 files changed
+100
-36
No files matched your search
+1
-1
@@ -1043,7 +1043,7 @@ void G_BuildTiccmd(ticcmd_t *cmd, INT32 realtics, UINT8 ssplayer)
|
||||
cmd->driftturn = (INT16)(cmd->driftturn - ((mousex*(encoremode ? -1 : 1)*8)));
|
||||
}
|
||||
|
||||
if (player->spectator || objectplacing) // SRB2Kart: spectators need special controls
|
||||
if (objectplacing) // SRB2Kart: spectators need special controls // not anymore huehuehue
|
||||
{
|
||||
axis = JoyAxis(AXISMOVE, ssplayer);
|
||||
if (InputDown(gc_accelerate, ssplayer) || (usejoystick && axis > 0))
|
||||
|
||||
+99
-35
@@ -12,6 +12,7 @@
|
||||
#include "d_player.h"
|
||||
#include "hu_stuff.h"
|
||||
#include "g_game.h"
|
||||
#include "i_joy.h"
|
||||
#include "m_fixed.h"
|
||||
#include "m_random.h"
|
||||
#include "m_menu.h" // ffdhidshfuisduifigergho9igj89dgodhfih AAAAAAAAAA
|
||||
@@ -132,7 +133,8 @@ consvar_t cv_airsparks = {"airdriftsparks", "Off", CV_SAVE, CV_OnOff, NULL, 0, N
|
||||
|
||||
//extra hud things
|
||||
consvar_t cv_showstats = {"showstats", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_showinput = {"showinput", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
static CV_PossibleValue_t inputdisplay_cons_t[] = {{0, "Off"}, {1, "Wheel"}, {2, "Stick"}, {0, NULL}};
|
||||
consvar_t cv_showinput = {"showinput", "Off", CV_SAVE, inputdisplay_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
consvar_t cv_showlaptimes = {"showlaptimes", "Off", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
|
||||
consvar_t cv_posanim = {"postitionanimation", "On", CV_SAVE, CV_OnOff, NULL, 0, NULL, NULL, 0, 0, NULL};
|
||||
@@ -10952,7 +10954,7 @@ static void K_drawInput(void)
|
||||
#define BUTTH 11
|
||||
|
||||
#define drawbutt(xoffs, butt, symb)\
|
||||
if (stplyr->cmd.buttons & butt)\
|
||||
if (cmd->buttons & butt)\
|
||||
{\
|
||||
offs = 2*FRACUNIT;\
|
||||
col = accent1;\
|
||||
@@ -10978,43 +10980,105 @@ static void K_drawInput(void)
|
||||
|
||||
y -= FRACUNIT;
|
||||
|
||||
if (!cmd->driftturn) // no turn
|
||||
target = 0;
|
||||
else // turning of multiple strengths!
|
||||
if (cv_showinput.value == 2)
|
||||
{
|
||||
target = ((abs(cmd->driftturn) - 1)/125)+1;
|
||||
if (target > 4)
|
||||
target = 4;
|
||||
if (cmd->driftturn < 0)
|
||||
target = -target;
|
||||
INT32 joyx, joyxoffs, joyy, joyyoffs, joyflags, axis;
|
||||
joyxoffs = -8, joyyoffs = -24;
|
||||
joyx = x>>FRACBITS, joyy = y>>FRACBITS;
|
||||
joyflags = V_SNAPTORIGHT|V_SNAPTOBOTTOM;
|
||||
|
||||
// O backing
|
||||
V_DrawFill(joyx+joyxoffs, joyy+joyyoffs-1, 16, 16, joyflags|accent2);
|
||||
V_DrawFill(joyx+joyxoffs, joyy+joyyoffs+15, 16, 1, joyflags|splitflags|31);
|
||||
|
||||
// time for pain and suffering
|
||||
// kart does not have anything we can get analogue joystick y axis values from
|
||||
// during normal gameplay, so replicate shit here
|
||||
INT32 hudforward[MAXSPLITSCREENPLAYERS] = {0}; // for the stick input display :chaosleep:
|
||||
const boolean analogjoystickmove = cv_usejoystick[stplyrnum].value && !Joystick[stplyrnum].bGamepadStyle;
|
||||
const boolean gamepadjoystickmove = cv_usejoystick[stplyrnum].value && Joystick[stplyrnum].bGamepadStyle;
|
||||
const UINT8 ssplayer = stplyrnum+1;
|
||||
|
||||
axis = JoyAxis(AXISAIM, ssplayer);
|
||||
|
||||
if (analogjoystickmove && axis != 0)
|
||||
{
|
||||
// JOYAXISRANGE is supposed to be 1023 (divide by 1024)
|
||||
hudforward[stplyrnum] -= ((axis * KART_FULLTURN) / (JOYAXISRANGE-1));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (InputDown(gc_aimforward, ssplayer) || (gamepadjoystickmove && axis < 0))
|
||||
{
|
||||
hudforward[stplyrnum] += KART_FULLTURN;
|
||||
}
|
||||
if (InputDown(gc_aimbackward, ssplayer) || (gamepadjoystickmove && axis > 0))
|
||||
{
|
||||
hudforward[stplyrnum] -= KART_FULLTURN;
|
||||
}
|
||||
}
|
||||
|
||||
hudforward[stplyrnum] = CLAMP(hudforward[stplyrnum], -KART_FULLTURN, KART_FULLTURN);
|
||||
|
||||
if (cmd->driftturn || hudforward[stplyrnum])
|
||||
{
|
||||
INT16 turning = encoremode ? -cmd->driftturn : cmd->driftturn;
|
||||
// joystick hole
|
||||
V_DrawFill(joyx+joyxoffs+5, joyy+joyyoffs+4, 6, 6, joyflags|accent1);
|
||||
// joystick top and back
|
||||
V_DrawFill(joyx+joyxoffs+3-turning/80,
|
||||
joyy+joyyoffs+2-hudforward[stplyrnum]/80,
|
||||
10, 10, joyflags|31);
|
||||
V_DrawFill(joyx+joyxoffs+3-turning/64,
|
||||
joyy+joyyoffs+1-hudforward[stplyrnum]/64,
|
||||
10, 10, joyflags|accent1);
|
||||
}
|
||||
else
|
||||
{
|
||||
V_DrawFill(joyx+joyxoffs+3, joyy+joyyoffs+11, 10, 1, joyflags|accent2);
|
||||
V_DrawFill(joyx+joyxoffs+3,
|
||||
joyy+joyyoffs+1,
|
||||
10, 10,joyflags|accent1);
|
||||
}
|
||||
}
|
||||
|
||||
if (pn != target)
|
||||
{
|
||||
if (abs(pn - target) == 1)
|
||||
pn = target;
|
||||
else if (pn < target)
|
||||
pn += 2;
|
||||
else //if (pn > target)
|
||||
pn -= 2;
|
||||
}
|
||||
|
||||
if (pn < 0)
|
||||
{
|
||||
splitflags |= V_FLIP; // right turn
|
||||
x -= FRACUNIT;
|
||||
}
|
||||
|
||||
target = abs(pn);
|
||||
if (target > 4)
|
||||
target = 4;
|
||||
|
||||
if (!K_GetHudColor())
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, splitflags, kp_inputwheel[target], NULL);
|
||||
else
|
||||
{
|
||||
UINT8 *colormap;
|
||||
colormap = R_GetTranslationColormap(0, K_GetHudColor(), GTC_CACHE);
|
||||
UINT8 *colormap = NULL;
|
||||
|
||||
if (!cmd->driftturn) // no turn
|
||||
target = 0;
|
||||
else // turning of multiple strengths!
|
||||
{
|
||||
target = ((abs(cmd->driftturn) - 1)/125)+1;
|
||||
if (target > 4)
|
||||
target = 4;
|
||||
if (cmd->driftturn < 0)
|
||||
target = -target;
|
||||
}
|
||||
|
||||
if (pn != target)
|
||||
{
|
||||
if (abs(pn - target) == 1)
|
||||
pn = target;
|
||||
else if (pn < target)
|
||||
pn += 2;
|
||||
else //if (pn > target)
|
||||
pn -= 2;
|
||||
}
|
||||
|
||||
if (pn < 0)
|
||||
{
|
||||
splitflags |= V_FLIP; // right turn
|
||||
x -= FRACUNIT;
|
||||
}
|
||||
|
||||
target = abs(pn);
|
||||
if (target > 4)
|
||||
target = 4;
|
||||
|
||||
if (K_GetHudColor())
|
||||
colormap = R_GetTranslationColormap(0, K_GetHudColor(), GTC_CACHE);
|
||||
|
||||
V_DrawFixedPatch(x, y, FRACUNIT, splitflags, kp_inputwheel[target], colormap);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user