Merge branch 'profiles-play-set' into 'master'

Clean up Profile setting in edit menu flow (#34)

Closes #34

See merge request KartKrew/RingRacers!51
This commit is contained in:
Sal 2024-08-28 22:06:49 +00:00
commit 8d9dab0edc
4 changed files with 27 additions and 18 deletions

View file

@ -564,7 +564,7 @@ static void PR_ApplyProfile_Appearance(profile_t *p, UINT8 playernum)
static void PR_ApplyProfile_Settings(profile_t *p, UINT8 playernum)
{
// toggles
// toggles -- be sure to also adjust M_ProfileEditApply
CV_StealthSetValue(&cv_kickstartaccel[playernum], p->kickstartaccel);
CV_StealthSetValue(&cv_autoroulette[playernum], p->autoroulette);
CV_StealthSetValue(&cv_litesteer[playernum], p->litesteer);
@ -621,6 +621,21 @@ void PR_ApplyProfileLight(UINT8 profilenum, UINT8 playernum)
PR_ApplyProfile_Appearance(p, playernum);
}
void PR_ApplyProfileToggles(UINT8 profilenum, UINT8 playernum)
{
profile_t *p = PR_GetProfile(profilenum);
// this CAN happen!!
if (p == NULL)
{
// no need to be as loud...
profilenum = 0; // make sure to set this so that the cvar is set properly.
p = PR_GetProfile(profilenum);
}
PR_ApplyProfile_Settings(p, playernum);
}
void PR_ApplyProfilePretend(UINT8 profilenum, UINT8 playernum)
{
profile_t *p = PR_GetProfile(profilenum);

View file

@ -230,6 +230,11 @@ void PR_ApplyProfile(UINT8 profilenum, UINT8 playernum);
// Controls, kickstartaccel and "current profile" data is *not* modified.
void PR_ApplyProfileLight(UINT8 profilenum, UINT8 playernum);
// PR_ApplyProfileToggles(UINT8 profilenum, UINT8 playernum)
// Applies ONLY controls and kickstartaccel.
// Exposed for menu code exclusively.
void PR_ApplyProfileToggles(UINT8 profilenum, UINT8 playernum);
// PR_ApplyProfilePretend(UINT8 profilenum, UINT8 playernum)
// ONLY modifies "current profile" data.
// Exists because any other option inteferes with rapid testing.

View file

@ -103,27 +103,16 @@ static void M_ProfileEditApply(void)
optionsmenu.profile->fov = cv_dummyprofilefov.value;
// If this profile is in-use by anyone, apply the changes immediately upon exiting.
// Don't apply the profile itself as that would lead to issues mid-game.
// Don't apply the full profile itself as that would lead to issues mid-game.
if (belongsto > -1 && belongsto < MAXSPLITSCREENPLAYERS)
{
extern consvar_t cv_fov[MAXSPLITSCREENPLAYERS];
CV_SetValue(&cv_kickstartaccel[belongsto], cv_dummyprofilekickstart.value);
CV_SetValue(&cv_autoroulette[belongsto], cv_dummyprofileautoroulette.value);
CV_SetValue(&cv_litesteer[belongsto], cv_dummyprofilelitesteer.value);
CV_SetValue(&cv_autoring[belongsto], cv_dummyprofileautoring.value);
CV_SetValue(&cv_rumble[belongsto], cv_dummyprofilerumble.value);
CV_SetValue(&cv_fov[belongsto], cv_dummyprofilefov.value);
PR_ApplyProfileToggles(optionsmenu.profilen, belongsto);
}
// Reapply player 1's real profile.
// (And then we do this for P1 anyway. I didn't write
// this code so I'm not sure why it's doing this, but it
// can override cv_skin if forcecharacter is in effect!
// I suspect this is intended to set cv_currprofile.
// FIXME?)
// Reapply player 1's real profile ID.
if (cv_currprofile.value > -1)
{
PR_ApplyProfile(cv_lastprofile[0].value, 0);
PR_ApplyProfilePretend(cv_lastprofile[0].value, 0);
}
}

View file

@ -278,10 +278,10 @@ void M_ProfileControlsConfirm(INT32 choice)
M_ProfileControlSaveResponse(MA_YES);
// Reapply player 1's real profile.
// Reapply player 1's real profile ID.
if (cv_currprofile.value > -1)
{
PR_ApplyProfile(cv_lastprofile[0].value, 0);
PR_ApplyProfilePretend(cv_lastprofile[0].value, 0);
}
}