Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/nukeykt/NBlood
Browse files Browse the repository at this point in the history
  • Loading branch information
NoOneBlood committed Oct 17, 2024
2 parents 92eebf5 + 047729a commit fce0bb8
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 8 deletions.
4 changes: 3 additions & 1 deletion source/blood/src/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -384,6 +385,7 @@ void CONFIG_SetDefaults(void)
gDeliriumBlur = 1;
gViewSize = 2;
gTurnSpeed = 92;
gTurnAcceleration = 1;
gDetail = 4;
gAutoRun = 0;
gViewInterpolate = 1;
Expand Down Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions source/blood/src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion source/blood/src/controls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
7 changes: 5 additions & 2 deletions source/blood/src/loadsave.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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++)
{
Expand Down Expand Up @@ -523,6 +525,7 @@ void LoadSavedInfo(void)
kclose(hFile);
}
klistfree(pList);
pathsearchmode = bakpathsearchmode;
}

void UpdateSavedInfo(int nSlot)
Expand Down Expand Up @@ -581,4 +584,4 @@ void LoadSaveSetup(void)
#ifdef NOONE_EXTENSIONS
nnExtLoadSaveConstruct();
#endif
}
}
27 changes: 23 additions & 4 deletions source/blood/src/menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 *);
Expand Down Expand Up @@ -706,16 +707,24 @@ 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);
CGameMenuItemChain itemOptionsControlJoystickButtons("JOYSTICK BUTTONS SETUP", 1, 0, 120, 320, 1, &menuOptionsControlJoystickButtonAssignment[0], -1, SetupJoystickButtonsMenu, 0);
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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions source/blood/src/osdcmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down

0 comments on commit fce0bb8

Please sign in to comment.