Merge branch 'master' into next

This commit is contained in:
Steel Titanium 2020-03-18 15:42:02 -04:00
commit 5dac9c6875
2 changed files with 15 additions and 16 deletions

View file

@ -1044,18 +1044,17 @@ static INT32 G_BasicDeadZoneCalculation(INT32 magnitude, fixed_t deadZone)
{ {
const INT32 jdeadzone = (JOYAXISRANGE * deadZone) / FRACUNIT; const INT32 jdeadzone = (JOYAXISRANGE * deadZone) / FRACUNIT;
INT32 deadzoneAppliedValue = 0; INT32 deadzoneAppliedValue = 0;
INT32 adjustedMagnitude = abs(magnitude);
if (jdeadzone > 0) if (jdeadzone >= JOYAXISRANGE && adjustedMagnitude >= JOYAXISRANGE) // If the deadzone and magnitude are both 100%...
return JOYAXISRANGE; // ...return 100% input directly, to avoid dividing by 0
else if (adjustedMagnitude > jdeadzone) // Otherwise, calculate how much the magnitude exceeds the deadzone
{ {
if (magnitude > jdeadzone) adjustedMagnitude = min(adjustedMagnitude, JOYAXISRANGE);
{
INT32 adjustedMagnitude = abs(magnitude);
adjustedMagnitude = min(adjustedMagnitude, JOYAXISRANGE);
adjustedMagnitude -= jdeadzone; adjustedMagnitude -= jdeadzone;
deadzoneAppliedValue = (adjustedMagnitude * JOYAXISRANGE) / (JOYAXISRANGE - jdeadzone); deadzoneAppliedValue = (adjustedMagnitude * JOYAXISRANGE) / (JOYAXISRANGE - jdeadzone);
}
} }
return deadzoneAppliedValue; return deadzoneAppliedValue;

View file

@ -2204,7 +2204,7 @@ menu_t OP_DataOptionsDef = DEFAULTMENUSTYLE(
menu_t OP_ScreenshotOptionsDef = menu_t OP_ScreenshotOptionsDef =
{ {
MN_OP_MAIN + (MN_OP_DATA << 6) + (MN_OP_SCREENSHOTS << 12), MN_OP_MAIN + (MN_OP_DATA << 6) + (MN_OP_SCREENSHOTS << 12),
"M_DATA", "M_SCREEN",
sizeof (OP_ScreenshotOptionsMenu)/sizeof (menuitem_t), sizeof (OP_ScreenshotOptionsMenu)/sizeof (menuitem_t),
&OP_DataOptionsDef, &OP_DataOptionsDef,
OP_ScreenshotOptionsMenu, OP_ScreenshotOptionsMenu,
@ -10099,13 +10099,13 @@ static void M_ReplayTimeAttack(INT32 choice)
static void M_EraseGuest(INT32 choice) static void M_EraseGuest(INT32 choice)
{ {
const char *rguest = va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value)); const char *rguest = va("%s"PATHSEP"replay"PATHSEP"%s"PATHSEP"%s-guest.lmp", srb2home, timeattackfolder, G_BuildMapName(cv_nextmap.value));
(void)choice;
if (FIL_FileExists(rguest)) if (choice == 'y' || choice == KEY_ENTER)
remove(rguest); {
if (currentMenu == &SP_NightsGuestReplayDef) if (FIL_FileExists(rguest))
M_SetupNextMenu(&SP_NightsAttackDef); remove(rguest);
else }
M_SetupNextMenu(&SP_TimeAttackDef); M_SetupNextMenu(currentMenu->prevMenu->prevMenu);
Nextmap_OnChange(); Nextmap_OnChange();
M_StartMessage(M_GetText("Guest replay data erased.\n"),NULL,MM_NOTHING); M_StartMessage(M_GetText("Guest replay data erased.\n"),NULL,MM_NOTHING);
} }