87_allow_NR_sequential

Added extra parameter to allow either or/both Neutral & Reverse in sequential
shift mode.

Even if commands set for Reverse/Neutral shift will shift out of Reverse for
better games play (ie. R->1 when you're in a panic to go)

git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@3738 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 049116084cf8f199e1eec15497cfdd63ea41168d
Former-commit-id: 71de2a5365ee59969d846cf5fefbbe984e9818ee
This commit is contained in:
mungewell 2011-07-20 03:55:48 +00:00
parent 1e37d64bee
commit 1c73f4cd3e
6 changed files with 35 additions and 10 deletions

View file

@ -1189,8 +1189,13 @@ drive_mt(int index, tCarElt* car, tSituation *s)
|| (cmd[CMD_UP_SHFT].type == GFCTRL_TYPE_KEYBOARD && keyInfo[lookUpKeyMap(cmd[CMD_UP_SHFT].val)].edgeUp) || (cmd[CMD_UP_SHFT].type == GFCTRL_TYPE_KEYBOARD && keyInfo[lookUpKeyMap(cmd[CMD_UP_SHFT].val)].edgeUp)
|| (cmd[CMD_UP_SHFT].type == GFCTRL_TYPE_JOY_ATOB && cmd[CMD_UP_SHFT].deadZone == 1)) || (cmd[CMD_UP_SHFT].type == GFCTRL_TYPE_JOY_ATOB && cmd[CMD_UP_SHFT].deadZone == 1))
{ {
if (HCtx[idx]->seqShftAllowNeutral || car->_gearCmd > -1) if (car->_gearCmd > -1)
car->_gearCmd++; car->_gearCmd++;
else if (HCtx[idx]->seqShftAllowNeutral && car->_gearCmd == -1)
car->_gearCmd = 0;
/* always allow up shift out of reverse to improve game play */
else if (car->_gearCmd == -1)
car->_gearCmd = 1;
} }
/* Down shifting command */ /* Down shifting command */
@ -1199,8 +1204,12 @@ drive_mt(int index, tCarElt* car, tSituation *s)
|| (cmd[CMD_DN_SHFT].type == GFCTRL_TYPE_KEYBOARD && keyInfo[lookUpKeyMap(cmd[CMD_DN_SHFT].val)].edgeUp) || (cmd[CMD_DN_SHFT].type == GFCTRL_TYPE_KEYBOARD && keyInfo[lookUpKeyMap(cmd[CMD_DN_SHFT].val)].edgeUp)
|| (cmd[CMD_DN_SHFT].type == GFCTRL_TYPE_JOY_ATOB && cmd[CMD_DN_SHFT].deadZone == 1)) || (cmd[CMD_DN_SHFT].type == GFCTRL_TYPE_JOY_ATOB && cmd[CMD_DN_SHFT].deadZone == 1))
{ {
if (HCtx[idx]->seqShftAllowNeutral || car->_gearCmd > 1) if (car->_gearCmd > 1)
car->_gearCmd--; car->_gearCmd--;
else if (HCtx[idx]->seqShftAllowNeutral && car->_gearCmd == 1)
car->_gearCmd = 0;
else if (HCtx[idx]->seqShftAllowReverse && car->_gearCmd < 2)
car->_gearCmd = -1;
} }
/* Neutral gear command */ /* Neutral gear command */

View file

@ -59,6 +59,7 @@ typedef struct HumanContext
bool paramAbs; bool paramAbs;
bool relButNeutral; bool relButNeutral;
bool seqShftAllowNeutral; bool seqShftAllowNeutral;
bool seqShftAllowReverse;
bool autoReverse; bool autoReverse;
eDriveTrain driveTrain; eDriveTrain driveTrain;
int autoClutch; int autoClutch;

View file

@ -207,6 +207,10 @@ HmReadPrefs(const int index)
prm = GfParmGetStr(PrefHdle, sstring, HM_ATT_SEQSHFT_ALLOW_NEUTRAL, prm); prm = GfParmGetStr(PrefHdle, sstring, HM_ATT_SEQSHFT_ALLOW_NEUTRAL, prm);
HCtx[idx]->seqShftAllowNeutral = (prm == Yn[0]); HCtx[idx]->seqShftAllowNeutral = (prm == Yn[0]);
prm = GfParmGetStr(PrefHdle, defaultSettings, HM_ATT_SEQSHFT_ALLOW_REVERSE, Yn[HCtx[idx]->seqShftAllowReverse].c_str());
prm = GfParmGetStr(PrefHdle, sstring, HM_ATT_SEQSHFT_ALLOW_REVERSE, prm);
HCtx[idx]->seqShftAllowReverse = (prm == Yn[0]);
prm = GfParmGetStr(PrefHdle, sstring, HM_ATT_AUTOREVERSE, Yn[HCtx[idx]->autoReverse].c_str()); prm = GfParmGetStr(PrefHdle, sstring, HM_ATT_AUTOREVERSE, Yn[HCtx[idx]->autoReverse].c_str());
HCtx[idx]->autoReverse = (prm == Yn[0]); HCtx[idx]->autoReverse = (prm == Yn[0]);
}//HmReadPrefs }//HmReadPrefs

View file

@ -81,6 +81,7 @@
/* Tell if the sequential shifter can go to neutral */ /* Tell if the sequential shifter can go to neutral */
#define HM_ATT_SEQSHFT_ALLOW_NEUTRAL "sequential shifter allow neutral" #define HM_ATT_SEQSHFT_ALLOW_NEUTRAL "sequential shifter allow neutral"
#define HM_ATT_SEQSHFT_ALLOW_REVERSE "sequential shifter allow reverse"
#define HM_ATT_STEER_SENS "steer sensitivity" #define HM_ATT_STEER_SENS "steer sensitivity"
#define HM_ATT_STEER_POW "steer power" #define HM_ATT_STEER_POW "steer power"

View file

@ -748,16 +748,20 @@ void ControlPutSettings(void *prefHdle, unsigned index, tGearChangeMode gearChan
if (gearChangeMode == GEAR_MODE_NONE) if (gearChangeMode == GEAR_MODE_NONE)
gearChangeMode = GearChangeMode; gearChangeMode = GearChangeMode;
/* Allow neutral gear in sequential mode if nor reverse nor neutral gear command defined */ /* Allow neutral gear in sequential mode if neutral gear command not defined */
pszReverseCmd = GfctrlGetNameByRef(Cmd[ICmdReverseGear].ref.type, Cmd[ICmdReverseGear].ref.index);
pszNeutralCmd = GfctrlGetNameByRef(Cmd[ICmdNeutralGear].ref.type, Cmd[ICmdNeutralGear].ref.index); pszNeutralCmd = GfctrlGetNameByRef(Cmd[ICmdNeutralGear].ref.type, Cmd[ICmdNeutralGear].ref.index);
if (gearChangeMode == GEAR_MODE_SEQ if (gearChangeMode == GEAR_MODE_SEQ && (!pszNeutralCmd || !strcmp(pszNeutralCmd, "-")))
&& (!pszReverseCmd || !strcmp(pszReverseCmd, "-")
|| !pszNeutralCmd || !strcmp(pszNeutralCmd, "-")))
GfParmSetStr(prefHdle, CurrentSection, HM_ATT_SEQSHFT_ALLOW_NEUTRAL, HM_VAL_YES); GfParmSetStr(prefHdle, CurrentSection, HM_ATT_SEQSHFT_ALLOW_NEUTRAL, HM_VAL_YES);
else else
GfParmSetStr(prefHdle, CurrentSection, HM_ATT_SEQSHFT_ALLOW_NEUTRAL, HM_VAL_NO); GfParmSetStr(prefHdle, CurrentSection, HM_ATT_SEQSHFT_ALLOW_NEUTRAL, HM_VAL_NO);
/* Allow reverse gear in sequential mode if reverse gear command not defined */
pszReverseCmd = GfctrlGetNameByRef(Cmd[ICmdReverseGear].ref.type, Cmd[ICmdReverseGear].ref.index);
if (gearChangeMode == GEAR_MODE_SEQ && (!pszReverseCmd || !strcmp(pszReverseCmd, "-")))
GfParmSetStr(prefHdle, CurrentSection, HM_ATT_SEQSHFT_ALLOW_REVERSE, HM_VAL_YES);
else
GfParmSetStr(prefHdle, CurrentSection, HM_ATT_SEQSHFT_ALLOW_REVERSE, HM_VAL_NO);
/* Release gear lever goes neutral in grid mode if no neutral gear command defined */ /* Release gear lever goes neutral in grid mode if no neutral gear command defined */
if (gearChangeMode == GEAR_MODE_GRID if (gearChangeMode == GEAR_MODE_GRID
&& (!pszNeutralCmd || !strcmp(pszNeutralCmd, "-"))) && (!pszNeutralCmd || !strcmp(pszNeutralCmd, "-")))

View file

@ -368,14 +368,20 @@ PutPlayerSettings(unsigned index)
GfParmSetNum(PrefHdle, drvSectionPath, HM_ATT_NBPITS, (char*)NULL, (tdble)player->nbPitStops()); GfParmSetNum(PrefHdle, drvSectionPath, HM_ATT_NBPITS, (char*)NULL, (tdble)player->nbPitStops());
GfParmSetStr(PrefHdle, drvSectionPath, HM_ATT_AUTOREVERSE, Yn[player->autoReverse()]); GfParmSetStr(PrefHdle, drvSectionPath, HM_ATT_AUTOREVERSE, Yn[player->autoReverse()]);
/* Allow neutral gear in sequential mode if nor reverse nor neutral gear command defined */ /* Allow neutral gear in sequential mode if neutral gear command not defined */
if (player->gearChangeMode() == GEAR_MODE_SEQ if (player->gearChangeMode() == GEAR_MODE_SEQ
&& (!strcmp(GfParmGetStr(PrefHdle, drvSectionPath, HM_ATT_GEAR_R, "-"), "-") && !strcmp(GfParmGetStr(PrefHdle, drvSectionPath, HM_ATT_GEAR_N, "-"), "-"))
|| !strcmp(GfParmGetStr(PrefHdle, drvSectionPath, HM_ATT_GEAR_N, "-"), "-")))
GfParmSetStr(PrefHdle, drvSectionPath, HM_ATT_SEQSHFT_ALLOW_NEUTRAL, HM_VAL_YES); GfParmSetStr(PrefHdle, drvSectionPath, HM_ATT_SEQSHFT_ALLOW_NEUTRAL, HM_VAL_YES);
else else
GfParmSetStr(PrefHdle, drvSectionPath, HM_ATT_SEQSHFT_ALLOW_NEUTRAL, HM_VAL_NO); GfParmSetStr(PrefHdle, drvSectionPath, HM_ATT_SEQSHFT_ALLOW_NEUTRAL, HM_VAL_NO);
/* Allow reverse gear in sequential mode if reverse gear command not defined */
if (player->gearChangeMode() == GEAR_MODE_SEQ
&& !strcmp(GfParmGetStr(PrefHdle, drvSectionPath, HM_ATT_GEAR_R, "-"), "-"))
GfParmSetStr(PrefHdle, drvSectionPath, HM_ATT_SEQSHFT_ALLOW_REVERSE, HM_VAL_YES);
else
GfParmSetStr(PrefHdle, drvSectionPath, HM_ATT_SEQSHFT_ALLOW_REVERSE, HM_VAL_NO);
/* Release gear lever goes neutral in grid mode if no neutral gear command defined */ /* Release gear lever goes neutral in grid mode if no neutral gear command defined */
if (player->gearChangeMode() == GEAR_MODE_GRID if (player->gearChangeMode() == GEAR_MODE_GRID
&& !strcmp(GfParmGetStr(PrefHdle, drvSectionPath, HM_ATT_GEAR_N, "-"), "-")) && !strcmp(GfParmGetStr(PrefHdle, drvSectionPath, HM_ATT_GEAR_N, "-"), "-"))