mirror of
https://github.com/KartKrewDev/RingRacers.git
synced 2025-10-30 08:01:28 +00:00
Replace memcpy to gamecontrol with G_ApplyControlScheme
This commit is contained in:
parent
a2d22c730f
commit
5e37aa12a5
6 changed files with 10 additions and 20 deletions
|
|
@ -963,19 +963,9 @@ void G_DefineDefaultControls(void)
|
||||||
menucontrolreserved[gc_start][0] = KEY_ESCAPE; // Handled special
|
menucontrolreserved[gc_start][0] = KEY_ESCAPE; // Handled special
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_CopyControls(INT32 (*setupcontrols)[MAXINPUTMAPPING], INT32 (*fromcontrols)[MAXINPUTMAPPING], const INT32 *gclist, INT32 gclen)
|
void G_ApplyControlScheme(UINT8 splitplayer, INT32 (*fromcontrols)[MAXINPUTMAPPING])
|
||||||
{
|
{
|
||||||
INT32 i, j, gc;
|
memcpy(gamecontrol[splitplayer], fromcontrols, sizeof gamecontrol[splitplayer]);
|
||||||
|
|
||||||
for (i = 0; i < (gclist && gclen ? gclen : num_gamecontrols); i++)
|
|
||||||
{
|
|
||||||
gc = (gclist && gclen) ? gclist[i] : i;
|
|
||||||
|
|
||||||
for (j = 0; j < MAXINPUTMAPPING; j++)
|
|
||||||
{
|
|
||||||
setupcontrols[gc][j] = fromcontrols[gc][j];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_SaveKeySetting(FILE *f, INT32 (*fromcontrolsa)[MAXINPUTMAPPING], INT32 (*fromcontrolsb)[MAXINPUTMAPPING], INT32 (*fromcontrolsc)[MAXINPUTMAPPING], INT32 (*fromcontrolsd)[MAXINPUTMAPPING])
|
void G_SaveKeySetting(FILE *f, INT32 (*fromcontrolsa)[MAXINPUTMAPPING], INT32 (*fromcontrolsb)[MAXINPUTMAPPING], INT32 (*fromcontrolsc)[MAXINPUTMAPPING], INT32 (*fromcontrolsd)[MAXINPUTMAPPING])
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ void Command_Setcontrol3_f(void);
|
||||||
void Command_Setcontrol4_f(void);
|
void Command_Setcontrol4_f(void);
|
||||||
void G_DefineDefaultControls(void);
|
void G_DefineDefaultControls(void);
|
||||||
INT32 G_GetControlScheme(INT32 (*fromcontrols)[MAXINPUTMAPPING], const INT32 *gclist, INT32 gclen);
|
INT32 G_GetControlScheme(INT32 (*fromcontrols)[MAXINPUTMAPPING], const INT32 *gclist, INT32 gclen);
|
||||||
void G_CopyControls(INT32 (*setupcontrols)[MAXINPUTMAPPING], INT32 (*fromcontrols)[MAXINPUTMAPPING], const INT32 *gclist, INT32 gclen);
|
void G_ApplyControlScheme(UINT8 splitplayer, INT32 (*fromcontrols)[MAXINPUTMAPPING]);
|
||||||
void G_SaveKeySetting(FILE *f, INT32 (*fromcontrolsa)[MAXINPUTMAPPING], INT32 (*fromcontrolsb)[MAXINPUTMAPPING], INT32 (*fromcontrolsc)[MAXINPUTMAPPING], INT32 (*fromcontrolsd)[MAXINPUTMAPPING]);
|
void G_SaveKeySetting(FILE *f, INT32 (*fromcontrolsa)[MAXINPUTMAPPING], INT32 (*fromcontrolsb)[MAXINPUTMAPPING], INT32 (*fromcontrolsc)[MAXINPUTMAPPING], INT32 (*fromcontrolsd)[MAXINPUTMAPPING]);
|
||||||
INT32 G_CheckDoubleUsage(INT32 keynum, INT32 playernum, boolean modify);
|
INT32 G_CheckDoubleUsage(INT32 keynum, INT32 playernum, boolean modify);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -497,7 +497,7 @@ static void PR_ApplyProfile_Settings(profile_t *p, UINT8 playernum)
|
||||||
CV_StealthSetValue(&cv_rumble[playernum], p->rumble);
|
CV_StealthSetValue(&cv_rumble[playernum], p->rumble);
|
||||||
|
|
||||||
// set controls...
|
// set controls...
|
||||||
memcpy(&gamecontrol[playernum], p->controls, sizeof(gamecontroldefault));
|
G_ApplyControlScheme(playernum, p->controls);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void PR_ApplyProfile_Memory(UINT8 profilenum, UINT8 playernum)
|
static void PR_ApplyProfile_Memory(UINT8 profilenum, UINT8 playernum)
|
||||||
|
|
|
||||||
|
|
@ -577,7 +577,7 @@ void Command_LoadConfig_f(void)
|
||||||
|
|
||||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||||
{
|
{
|
||||||
G_CopyControls(gamecontrol[i], gamecontroldefault, NULL, 0);
|
G_ApplyControlScheme(i, gamecontroldefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
// temporarily reset execversion to default
|
// temporarily reset execversion to default
|
||||||
|
|
@ -631,7 +631,7 @@ void M_FirstLoadConfig(void)
|
||||||
|
|
||||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||||
{
|
{
|
||||||
G_CopyControls(gamecontrol[i], gamecontroldefault, NULL, 0);
|
G_ApplyControlScheme(i, gamecontroldefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
// register execversion here before we load any configs
|
// register execversion here before we load any configs
|
||||||
|
|
|
||||||
|
|
@ -219,7 +219,7 @@ void M_ProfileTryController(INT32 choice)
|
||||||
optionsmenu.trycontroller = TICRATE*5;
|
optionsmenu.trycontroller = TICRATE*5;
|
||||||
|
|
||||||
// Apply these controls right now on P1's end.
|
// Apply these controls right now on P1's end.
|
||||||
memcpy(&gamecontrol[0], optionsmenu.tempcontrols, sizeof(gamecontroldefault));
|
G_ApplyControlScheme(0, optionsmenu.tempcontrols);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void M_ProfileControlSaveResponse(INT32 choice)
|
static void M_ProfileControlSaveResponse(INT32 choice)
|
||||||
|
|
@ -234,7 +234,7 @@ static void M_ProfileControlSaveResponse(INT32 choice)
|
||||||
// Don't apply the profile itself as that would lead to issues mid-game.
|
// Don't apply the profile itself as that would lead to issues mid-game.
|
||||||
if (belongsto > -1 && belongsto < MAXSPLITSCREENPLAYERS)
|
if (belongsto > -1 && belongsto < MAXSPLITSCREENPLAYERS)
|
||||||
{
|
{
|
||||||
memcpy(&gamecontrol[belongsto], optionsmenu.tempcontrols, sizeof(gamecontroldefault));
|
G_ApplyControlScheme(belongsto, optionsmenu.tempcontrols);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -325,7 +325,7 @@ boolean M_ProfileControlsInputs(INT32 ch)
|
||||||
profile_t *cpr = PR_GetProfile(cv_currprofile.value);
|
profile_t *cpr = PR_GetProfile(cv_currprofile.value);
|
||||||
if (cpr == NULL)
|
if (cpr == NULL)
|
||||||
cpr = PR_GetProfile(0); // Creating a profile at boot, revert to guest profile
|
cpr = PR_GetProfile(0); // Creating a profile at boot, revert to guest profile
|
||||||
memcpy(&gamecontrol[0], cpr->controls, sizeof(gamecontroldefault));
|
G_ApplyControlScheme(0, cpr->controls);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -502,7 +502,7 @@ static boolean M_HandlePressStart(setup_player_t *p, UINT8 num)
|
||||||
else if (num)
|
else if (num)
|
||||||
{
|
{
|
||||||
// For any player past player 1, set controls to default profile controls, otherwise it's generally awful to do any menuing...
|
// For any player past player 1, set controls to default profile controls, otherwise it's generally awful to do any menuing...
|
||||||
memcpy(&gamecontrol[num], gamecontroldefault, sizeof(gamecontroldefault));
|
G_ApplyControlScheme(num, gamecontroldefault);
|
||||||
}
|
}
|
||||||
|
|
||||||
G_SetDeviceForPlayer(num, device);
|
G_SetDeviceForPlayer(num, device);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue