add splitscreen support to gamepad led
also add more proper device check
This commit is contained in:
1 parent
c75e6ba63c
commit
6efc8fdad3
5 files changed
+83
-13
No files matched your search
+8
-2
@@ -6062,7 +6062,7 @@ static void Command_SkinSearch(void)
|
||||
*/
|
||||
static void Color_OnChange(void)
|
||||
{
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(0); // i want this to always change so its here
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(0, 0); // i want this to always change so its here
|
||||
|
||||
if (!Playing())
|
||||
return; // do whatever you want
|
||||
@@ -6084,7 +6084,7 @@ static void Color_OnChange(void)
|
||||
players[consoleplayer].skincolor);
|
||||
}
|
||||
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(0); // update again
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(0, 0); // update again
|
||||
}
|
||||
|
||||
/** Sends a color change for the secondary splitscreen player, unless that
|
||||
@@ -6107,6 +6107,8 @@ static void Color2_OnChange(void)
|
||||
CV_StealthSetValue(&cv_playercolor2,
|
||||
players[displayplayers[1]].skincolor);
|
||||
}
|
||||
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(1, 0);
|
||||
}
|
||||
|
||||
static void Color3_OnChange(void)
|
||||
@@ -6124,6 +6126,8 @@ static void Color3_OnChange(void)
|
||||
CV_StealthSetValue(&cv_playercolor3,
|
||||
players[displayplayers[2]].skincolor);
|
||||
}
|
||||
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(2, 0);
|
||||
}
|
||||
|
||||
static void Color4_OnChange(void)
|
||||
@@ -6141,6 +6145,8 @@ static void Color4_OnChange(void)
|
||||
CV_StealthSetValue(&cv_playercolor4,
|
||||
players[displayplayers[3]].skincolor);
|
||||
}
|
||||
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(3, 0);
|
||||
}
|
||||
|
||||
/** Displays the result of the chat being muted or unmuted.
|
||||
|
||||
+4
-2
@@ -2151,7 +2151,7 @@ void G_ResetView(UINT8 viewnum, INT32 playernum, boolean onlyactive)
|
||||
if (viewnum == 1 && demo.playback)
|
||||
consoleplayer = displayplayers[0];
|
||||
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(0);
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(viewnum-1, 0);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -8538,9 +8538,11 @@ boolean G_DemoTitleResponder(event_t *ev)
|
||||
//
|
||||
void G_SetGamestate(gamestate_t newstate)
|
||||
{
|
||||
SINT8 i;
|
||||
gamestate = newstate;
|
||||
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(0); // dumb hack but works
|
||||
for (i = 0; i <= splitscreen; i++)
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(i, 0); // dumb hack but works
|
||||
|
||||
#ifdef HAVE_DISCORDRPC
|
||||
DRPC_UpdatePresence();
|
||||
|
||||
+57
-5
@@ -826,25 +826,77 @@ static const char *gamecontrolname[num_gamecontrols] =
|
||||
|
||||
#include "k_kart.h"
|
||||
|
||||
static UINT16 G_GetSkinColor(void)
|
||||
static INT32 G_GetDeviceForPlayer(INT32 player)
|
||||
{
|
||||
return ((gamestate == GS_LEVEL) ? players[displayplayers[0]].skincolor : cv_playercolor.value);
|
||||
switch (player)
|
||||
{
|
||||
case 0:
|
||||
return cv_usejoystick.value;
|
||||
break;
|
||||
case 1:
|
||||
return cv_usejoystick2.value;
|
||||
break;
|
||||
case 2:
|
||||
return cv_usejoystick3.value;
|
||||
break;
|
||||
case 3:
|
||||
return cv_usejoystick4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static UINT16 G_GetSkinColor(INT32 player)
|
||||
{
|
||||
if (gamestate == GS_LEVEL)
|
||||
return players[displayplayers[player]].skincolor;
|
||||
|
||||
switch (player)
|
||||
{
|
||||
case 0:
|
||||
return cv_playercolor.value;
|
||||
break;
|
||||
case 1:
|
||||
return cv_playercolor2.value;
|
||||
break;
|
||||
case 2:
|
||||
return cv_playercolor3.value;
|
||||
break;
|
||||
case 3:
|
||||
return cv_playercolor4.value;
|
||||
break;
|
||||
default:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// ehhhhhh ill maybe add splitscreen support eventually lol
|
||||
void G_SetPlayerGamepadIndicatorToPlayerColor(UINT16 color)
|
||||
void G_SetPlayerGamepadIndicatorToPlayerColor(INT32 player, UINT16 color)
|
||||
{
|
||||
INT32 device;
|
||||
UINT16 skincolor;
|
||||
byteColor_t byte_color;
|
||||
|
||||
I_Assert(player >= 0 && player < MAXSPLITSCREENPLAYERS);
|
||||
|
||||
device = G_GetDeviceForPlayer(player);
|
||||
|
||||
if (device <= 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (color)
|
||||
skincolor = color;
|
||||
else
|
||||
skincolor = G_GetSkinColor();
|
||||
skincolor = G_GetSkinColor(player);
|
||||
|
||||
byte_color = V_GetColor(colortranslations[skincolor][8]).s;
|
||||
|
||||
I_SetGamepadIndicatorColor(1, byte_color.red, byte_color.green, byte_color.blue);
|
||||
I_SetGamepadIndicatorColor(device, byte_color.red, byte_color.green, byte_color.blue);
|
||||
}
|
||||
|
||||
void G_PlayerDeviceRumble(UINT16 low_strength, UINT16 high_strength)
|
||||
|
||||
+1
-1
@@ -131,7 +131,7 @@ extern INT32 gamecontrol4[num_gamecontrols][2];
|
||||
// peace to my little coder fingers!
|
||||
// check a gamecontrol being active or not
|
||||
|
||||
void G_SetPlayerGamepadIndicatorToPlayerColor(UINT16 color);
|
||||
void G_SetPlayerGamepadIndicatorToPlayerColor(INT32 player, UINT16 color);
|
||||
void G_PlayerDeviceRumble(UINT16 low_strength, UINT16 high_strength);
|
||||
|
||||
// remaps the input event to a game control.
|
||||
|
||||
+13
-3
@@ -10412,6 +10412,8 @@ static UINT8 setupm_skinypos;
|
||||
static INT32 setupm_skinselect;
|
||||
static boolean setupm_skinlockedselect;
|
||||
|
||||
static UINT8 setupm_playernum; //brap
|
||||
|
||||
#define SELECTEDSTATSCOUNT skinstatscount[setupm_skinxpos][setupm_skinypos]
|
||||
#define LASTSELECTEDSTAT skinstats[setupm_skinxpos][setupm_skinypos][skinstatscount[setupm_skinxpos][setupm_skinypos]]
|
||||
|
||||
@@ -11253,7 +11255,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
|
||||
{
|
||||
S_StartSound(NULL,sfx_menu1); // Tails
|
||||
setupm_fakecolor--;
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(setupm_fakecolor);
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(setupm_playernum, setupm_fakecolor);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -11309,7 +11311,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
|
||||
{
|
||||
S_StartSound(NULL,sfx_menu1); // Tails
|
||||
setupm_fakecolor++;
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(setupm_fakecolor);
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(setupm_playernum, setupm_fakecolor);
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -11349,7 +11351,7 @@ static void M_HandleSetupMultiPlayer(INT32 choice)
|
||||
{
|
||||
S_StartSound(NULL,sfx_menu1); // Tails
|
||||
setupm_fakecolor = col;
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(setupm_fakecolor);
|
||||
G_SetPlayerGamepadIndicatorToPlayerColor(setupm_playernum, setupm_fakecolor);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -11483,6 +11485,8 @@ static void M_SetupMultiPlayer(INT32 choice)
|
||||
setupm_skinypos = 0;
|
||||
setupm_skinlockedselect = false;
|
||||
|
||||
setupm_playernum = 0;
|
||||
|
||||
// For whatever reason this doesn't work right if you just use ->value
|
||||
setupm_fakeskin = R_SkinAvailable(setupm_cvskin->string);
|
||||
if (setupm_fakeskin == -1)
|
||||
@@ -11522,6 +11526,8 @@ static void M_SetupMultiPlayer2(INT32 choice)
|
||||
setupm_skinypos = 0;
|
||||
setupm_skinlockedselect = false;
|
||||
|
||||
setupm_playernum = 1;
|
||||
|
||||
// For whatever reason this doesn't work right if you just use ->value
|
||||
setupm_fakeskin = R_SkinAvailable(setupm_cvskin->string);
|
||||
if (setupm_fakeskin == -1)
|
||||
@@ -11561,6 +11567,8 @@ static void M_SetupMultiPlayer3(INT32 choice)
|
||||
setupm_skinypos = 0;
|
||||
setupm_skinlockedselect = false;
|
||||
|
||||
setupm_playernum = 2;
|
||||
|
||||
// For whatever reason this doesn't work right if you just use ->value
|
||||
setupm_fakeskin = R_SkinAvailable(setupm_cvskin->string);
|
||||
if (setupm_fakeskin == -1)
|
||||
@@ -11600,6 +11608,8 @@ static void M_SetupMultiPlayer4(INT32 choice)
|
||||
setupm_skinypos = 0;
|
||||
setupm_skinlockedselect = false;
|
||||
|
||||
setupm_playernum = 3;
|
||||
|
||||
// For whatever reason this doesn't work right if you just use ->value
|
||||
setupm_fakeskin = R_SkinAvailable(setupm_cvskin->string);
|
||||
if (setupm_fakeskin == -1)
|
||||
|
||||
Reference in new issue
Block a user