set controller rgb to playercolor

eh only for 1st player now no splitscreen support
idk if everything here is even correct
This commit is contained in:
Alug committed 2024-07-28 19:54:08 +02:00
1 parent f2b21c6055
commit 6bcd2024a0
6 files changed
+46

No files matched your search

+4
View File
@@ -37,6 +37,7 @@
#include "d_net.h"
#include "f_finale.h"
#include "g_game.h"
#include "g_input.h"
#include "hu_stuff.h"
#include "i_sound.h"
#include "i_system.h"
@@ -1848,6 +1849,9 @@ void D_SRB2Main(void)
CONS_Printf("ST_Init(): Init status bar.\n");
ST_Init();
if (!dedicated)
G_SetPlayerGamepadIndicatorToPlayerColor(); // no idea where else to throw it lol
// Set up splitscreen players before joining!
if (!dedicated && (M_CheckParm("-splitscreen") && M_IsNextParm()))
{
+2
View File
@@ -6083,6 +6083,8 @@ static void Color_OnChange(void)
CV_StealthSetValue(&cv_playercolor,
players[consoleplayer].skincolor);
}
G_SetPlayerGamepadIndicatorToPlayerColor();
}
/** Sends a color change for the secondary splitscreen player, unless that
+19
View File
@@ -14,11 +14,16 @@
#include "doomdef.h"
#include "doomstat.h"
#include "g_input.h"
#include "g_game.h"
#include "keys.h"
#include "hu_stuff.h" // need HUFONT start & end
#include "d_net.h"
#include "console.h"
#include "i_video.h"
#include "r_draw.h"
#include "v_video.h"
#define MAXMOUSESENSITIVITY 100 // sensitivity steps
static CV_PossibleValue_t mousesens_cons_t[] = {{1, "MIN"}, {MAXMOUSESENSITIVITY, "MAX"}, {0, NULL}};
@@ -817,6 +822,20 @@ static const char *gamecontrolname[num_gamecontrols] =
#define NUMKEYNAMES (sizeof (keynames)/sizeof (keyname_t))
#include "k_kart.h"
// ehhhhhh ill maybe add splitscreen support eventually lol
void G_SetPlayerGamepadIndicatorToPlayerColor(void)
{
UINT16 skincolor;
byteColor_t byte_color;
skincolor = cv_playercolor.value;
byte_color = V_GetColor(colortranslations[skincolor][8]).s;
I_SetGamepadIndicatorColor(1, byte_color.red, byte_color.green, byte_color.blue);
}
//
// Detach any keys associated to the given game control
// - pass the pointer to the gamecontrol table for the player being edited
+2
View File
@@ -130,6 +130,8 @@ extern INT32 gamecontrol4[num_gamecontrols][2];
// peace to my little coder fingers!
// check a gamecontrol being active or not
void G_SetPlayerGamepadIndicatorToPlayerColor(void);
// remaps the input event to a game control.
void G_MapEventsToControls(event_t *ev);
+2
View File
@@ -139,6 +139,8 @@ UINT32 I_GetRefreshRate(void);
boolean I_UseNativeKeyboard(void);
void I_SetGamepadIndicatorColor(INT32 device_id, UINT8 red, UINT8 green, UINT8 blue);
#ifdef USE_FBO_OGL
void RefreshOGLSDLSurface(void);
void I_DownSample(void);
+17
View File
@@ -1529,6 +1529,23 @@ void I_StartupMouse(void)
SDLdoUngrabMouse();
}
void I_SetGamepadIndicatorColor(INT32 device_id, UINT8 red, UINT8 green, UINT8 blue)
{
#if !(SDL_VERSION_ATLEAST(2,0,14))
(void)device_id;
#else
I_Assert(device_id > 0); // Gamepad devices are always ID 1 or higher
SDL_GameController *controller = SDL_GameControllerFromInstanceID(device_id - 1);
if (controller == NULL)
{
return;
}
SDL_GameControllerSetLED(controller, red, green, blue);
#endif
}
//
// I_OsPolling
//