diff --git a/source/blood/src/config.cpp b/source/blood/src/config.cpp index 54a4e81990..1a5382f520 100644 --- a/source/blood/src/config.cpp +++ b/source/blood/src/config.cpp @@ -76,6 +76,7 @@ int32_t useprecache; char CommbatMacro[MAXRIDECULE][MAXRIDECULELENGTH]; char szPlayerName[MAXPLAYERNAME]; int32_t gTurnSpeed; +int32_t gTurnAcceleration; int32_t gDetail; int32_t gMouseAim; int32_t gAutoAim; @@ -384,6 +385,7 @@ void CONFIG_SetDefaults(void) gDeliriumBlur = 1; gViewSize = 2; gTurnSpeed = 92; + gTurnAcceleration = 1; gDetail = 4; gAutoRun = 0; gViewInterpolate = 1; @@ -738,7 +740,7 @@ int CONFIG_ReadSetup(void) char nameBuf[64]; - while (Bstrlen(OSD_StripColors(nameBuf, tempbuf)) > 10) + while (Bstrlen(OSD_StripColors(nameBuf, tempbuf)) >= MAXPLAYERNAME) tempbuf[Bstrlen(tempbuf) - 1] = '\0'; Bstrncpyz(szPlayerName, tempbuf, sizeof(szPlayerName)); diff --git a/source/blood/src/config.h b/source/blood/src/config.h index 19715aa566..1124484f21 100644 --- a/source/blood/src/config.h +++ b/source/blood/src/config.h @@ -57,6 +57,7 @@ extern int32_t useprecache; extern char CommbatMacro[MAXRIDECULE][MAXRIDECULELENGTH]; extern char szPlayerName[MAXPLAYERNAME]; extern int32_t gTurnSpeed; +extern int32_t gTurnAcceleration; extern int32_t gDetail; extern int32_t gAutoAim; extern int32_t gWeaponSwitch; diff --git a/source/blood/src/controls.cpp b/source/blood/src/controls.cpp index 349321bb6b..6f68ebb2f8 100644 --- a/source/blood/src/controls.cpp +++ b/source/blood/src/controls.cpp @@ -489,7 +489,7 @@ void ctrlGetInput(void) if (turnRight) input.q16turn = fix16_sadd(input.q16turn, fix16_from_float(scaleAdjustmentToInterval(ClipHigh(12 * turnHeldTime, gTurnSpeed)>>2))); - if ((run2 || run) && turnHeldTime > 24) + if (!gTurnAcceleration || (((gTurnAcceleration == 2) || run2 || run) && (turnHeldTime > 24))) input.q16turn <<= 1; if (BUTTON(gamefunc_Strafe)) diff --git a/source/blood/src/loadsave.cpp b/source/blood/src/loadsave.cpp index 5103be094c..11682619c0 100644 --- a/source/blood/src/loadsave.cpp +++ b/source/blood/src/loadsave.cpp @@ -490,7 +490,9 @@ void MyLoadSave::Save(void) void LoadSavedInfo(void) { - auto pList = klistpath("./", "game*.sav", BUILDVFS_FIND_FILE); + int const bakpathsearchmode = pathsearchmode; + pathsearchmode = 1; + auto pList = klistpath((g_modDir[0] != '/') ? g_modDir : "./", "game*.sav", BUILDVFS_FIND_FILE); int nCount = 0; for (auto pIterator = pList; pIterator != NULL && nCount < 10; pIterator = pIterator->next, nCount++) { @@ -523,6 +525,7 @@ void LoadSavedInfo(void) kclose(hFile); } klistfree(pList); + pathsearchmode = bakpathsearchmode; } void UpdateSavedInfo(int nSlot) @@ -581,4 +584,4 @@ void LoadSaveSetup(void) #ifdef NOONE_EXTENSIONS nnExtLoadSaveConstruct(); #endif -} \ No newline at end of file +} diff --git a/source/blood/src/menu.cpp b/source/blood/src/menu.cpp index da41899a4f..00d903cab0 100644 --- a/source/blood/src/menu.cpp +++ b/source/blood/src/menu.cpp @@ -66,6 +66,7 @@ void SetViewSwaying(CGameMenuItemZBool *); void SetMouseSensitivity(CGameMenuItemSliderFloat *); void SetMouseAimFlipped(CGameMenuItemZBool *); void SetTurnSpeed(CGameMenuItemSlider *); +void SetTurnAcceleration(CGameMenuItemZCycle *); void ResetKeys(CGameMenuItemChain *); void ResetKeysClassic(CGameMenuItemChain *); void SetMessages(CGameMenuItemZBool *); @@ -706,6 +707,12 @@ void SetJoystickDigitalNeg(CGameMenuItemZCycle* pItem); void SetJoystickDeadzone(CGameMenuItemSlider* pItem); void SetJoystickSaturate(CGameMenuItemSlider* pItem); +const char *pzTurnAccelerationStrings[] = { + "OFF", + "ON RUNNING", + "ALWAYS ON", +}; + CGameMenuItemTitle itemOptionsControlTitle("CONTROL SETUP", 1, 160, 20, 2038); CGameMenuItemChain itemOptionsControlKeyboard("KEYBOARD SETUP", 1, 0, 60, 320, 1, &menuOptionsControlKeyboard, -1, NULL, 0); CGameMenuItemChain itemOptionsControlMouse("MOUSE SETUP", 1, 0, 80, 320, 1, &menuOptionsControlMouse, -1, SetupMouseMenu, 0); @@ -713,9 +720,11 @@ CGameMenuItemChain itemOptionsControlJoystickButtons("JOYSTICK BUTTONS SETUP", 1 CGameMenuItemChain itemOptionsControlJoystickAxes("JOYSTICK AXES SETUP", 1, 0, 140, 320, 1, &menuOptionsControlJoystickListAxes, -1, SetupJoystickAxesMenu, 0); CGameMenuItemTitle itemOptionsControlKeyboardTitle("KEYBOARD SETUP", 1, 160, 20, 2038); -CGameMenuItemChain itemOptionsControlKeyboardList("Configure Keys...", 1, 0, 60, 320, 1, &menuKeys, -1, NULL, 0); -CGameMenuItemChain itemOptionsControlKeyboardReset("Reset Keys (default)...", 1, 0, 80, 320, 1, &menuKeys, -1, ResetKeys, 0); -CGameMenuItemChain itemOptionsControlKeyboardResetClassic("Reset Keys (classic)...", 1, 0, 100, 320, 1, &menuKeys, -1, ResetKeysClassic, 0); +CGameMenuItemSlider itemOptionsControlKeyboardSliderTurnSpeed("Key Turn Speed:", 1, 18, 50, 280, &gTurnSpeed, 64, 128, 4, SetTurnSpeed, -1, -1); +CGameMenuItemZCycle itemOptionsControlKeyboardCycleTurnAcceleration("Key Turn Acceleration:", 1, 18, 70, 280, 0, SetTurnAcceleration, pzTurnAccelerationStrings, ARRAY_SIZE(pzTurnAccelerationStrings), 0); +CGameMenuItemChain itemOptionsControlKeyboardList("Configure Keys...", 1, 0, 110, 320, 1, &menuKeys, -1, NULL, 0); +CGameMenuItemChain itemOptionsControlKeyboardReset("Reset Keys (default)...", 1, 0, 135, 320, 1, &menuKeys, -1, ResetKeys, 0); +CGameMenuItemChain itemOptionsControlKeyboardResetClassic("Reset Keys (classic)...", 1, 0, 155, 320, 1, &menuKeys, -1, ResetKeysClassic, 0); void SetMouseAimMode(CGameMenuItemZBool *pItem); void SetMouseVerticalAim(CGameMenuItemZBool *pItem); @@ -1417,11 +1426,16 @@ void SetupOptionsMenu(void) menuOptionsControl.Add(&itemBloodQAV, false); menuOptionsControlKeyboard.Add(&itemOptionsControlKeyboardTitle, false); - menuOptionsControlKeyboard.Add(&itemOptionsControlKeyboardList, true); + menuOptionsControlKeyboard.Add(&itemOptionsControlKeyboardSliderTurnSpeed, true); + menuOptionsControlKeyboard.Add(&itemOptionsControlKeyboardCycleTurnAcceleration, false); + menuOptionsControlKeyboard.Add(&itemOptionsControlKeyboardList, false); menuOptionsControlKeyboard.Add(&itemOptionsControlKeyboardReset, false); menuOptionsControlKeyboard.Add(&itemOptionsControlKeyboardResetClassic, false); menuOptionsControlKeyboard.Add(&itemBloodQAV, false); + itemOptionsControlKeyboardSliderTurnSpeed.nValue = gTurnSpeed; + itemOptionsControlKeyboardCycleTurnAcceleration.m_nFocus = gTurnAcceleration; + menuOptionsControlMouse.Add(&itemOptionsControlMouseTitle, false); menuOptionsControlMouse.Add(&itemOptionsControlMouseButton, true); menuOptionsControlMouse.Add(&itemOptionsControlMouseSensitivity, false); @@ -1770,6 +1784,11 @@ void SetTurnSpeed(CGameMenuItemSlider *pItem) gTurnSpeed = pItem->nValue; } +void SetTurnAcceleration(CGameMenuItemZCycle *pItem) +{ + gTurnAcceleration = pItem->m_nFocus; +} + void SetAutoAim(CGameMenuItemZCycle *pItem) { gAutoAim = pItem->m_nFocus; diff --git a/source/blood/src/osdcmd.cpp b/source/blood/src/osdcmd.cpp index ab81c3a157..161fa6de04 100644 --- a/source/blood/src/osdcmd.cpp +++ b/source/blood/src/osdcmd.cpp @@ -1030,6 +1030,8 @@ int32_t registerosdcommands(void) { "in_mousedeadzone", "amount of mouse movement to filter out", (void *)&MouseDeadZone, CVAR_INT, 0, 512 }, { "in_mouseflip", "invert vertical mouse movement", (void *)&gMouseAimingFlipped, CVAR_BOOL, 0, 1 }, { "in_mousemode", "toggles vertical mouse view", (void *)&gMouseAim, CVAR_BOOL, 0, 1 }, + { "in_turnaccelmode", "set keyboard turning acceleration mode (0: off, 1: only when running, 2: always on)", (void *)&gTurnAcceleration, CVAR_INT, 0, 2 }, + { "in_turnspeed", "keyboard turning speed", (void *)&gTurnSpeed, CVAR_INT, 64, 124 }, // { "mus_enabled", "enables/disables music", (void *)&MusicToggle, CVAR_BOOL, 0, 1 }, { "mus_restartonload", "restart the music when loading a saved game with the same map or not", (void *)&MusicRestartsOnLoadToggle, CVAR_BOOL, 0, 1 },