Code:
Index: include/vamosworld.h
===================================================================
--- include/vamosworld.h (revision 1323)
+++ include/vamosworld.h (working copy)
@@ -109,6 +109,7 @@
bool camneedupdate;
bool MPH;
bool auto_clutch;
+ bool auto_trans;
bool display_hud;
bool input_graph_enabled;
bool car_shadows_enabled;
Index: src/vamosworld.cc
===================================================================
--- src/vamosworld.cc (revision 1323)
+++ src/vamosworld.cc (working copy)
@@ -1432,6 +1432,36 @@
DoOp(GetCar(CONT_PLAYERLOCAL), "clutch", autoclutch, 0.0, true, timefactor, fps);
}
}
+
+ // Automatic Transmission
+ if (auto_trans)
+ {
+ // only autoshift when no shift pending and we are not in neutral or reverse gear
+ if (!GetCar(CONT_PLAYERLOCAL)->car->ShiftPending() &&
+ GetCar(CONT_PLAYERLOCAL)->car->gear() > 0)
+ {
+ // shift up when engine speed exceeds peak speed
+ if (GetCar(CONT_PLAYERLOCAL)->car->engine()->rotational_speed() >
+ GetCar(CONT_PLAYERLOCAL)->car->engine()->peak_engine_speed()
+ &&
+ GetCar(CONT_PLAYERLOCAL)->car->engine()->last_rotational_speed() <GetCar>car->engine()->peak_engine_speed())
+ {
+ GetCar(CONT_PLAYERLOCAL)->car->shift_up();
+ }
+
+ // shift down when engine speed below fixed value
+ // however, we do not auto shift down from 1st gear to neutral
+ if (GetCar(CONT_PLAYERLOCAL)->car->gear() > 1
+ &&
+ GetCar(CONT_PLAYERLOCAL)->car->engine()->rotational_speed() <200>car->engine()->last_rotational_speed() > 200.0)
+ {
+ GetCar(CONT_PLAYERLOCAL)->car->shift_down();
+ }
+ }
+ }
}
void VAMOSWORLD::DoOp(Vamos_World::Car_Information * c, string dofunction, float dovalue, float dotime, bool held, float timefactor, float fps)
@@ -2096,6 +2126,7 @@
settings.Get( "display.show_hud", display_hud );
settings.Get( "display.mph", MPH );
settings.Get( "control.autoclutch", auto_clutch );
+ settings.Get( "control.autotrans", auto_trans );
settings.Get( "display.input_graph", input_graph_enabled );
settings.Get( "display.car_shadows", car_shadows_enabled );
settings.Get( "control.button_ramp", button_ramp );
Index: data/settings/options.config
===================================================================
--- data/settings/options.config (revision 1323)
+++ data/settings/options.config (working copy)
@@ -1,4 +1,4 @@
-num_options = 41
+num_options = 42
[ option-00 ]
cat = game
@@ -520,3 +520,14 @@
default = 1
values = replays
+[ option-41 ]
+cat = control
+name = autotrans
+title = AutoTransmission
+desc = Enable/disable automatic transmission
+type = bool
+default = true
+values = bool
+true = On
+false = Off
+
Index: data/skins/simple/menus/ControlsOptions
===================================================================
--- data/skins/simple/menus/ControlsOptions (revision 1323)
+++ data/skins/simple/menus/ControlsOptions (working copy)
@@ -1,5 +1,5 @@
name = ControlsOptions
-widgets = 11
+widgets = 12
background = box.png
dialog = false
@@ -21,7 +21,7 @@
name = TouchCompWheel
setting = joystick.touchcomp
values = options
-center = 0.5, 0.29
+center = 0.5, 0.25
width = auto
height = auto
fontsize = 6
@@ -32,6 +32,20 @@
[ widget-02 ]
type = toggle
+name = AutoTransToggle
+setting = control.autotrans
+values = options
+center = 0.5, 0.29
+width = auto
+height = auto
+fontsize = 6
+enabled = 1
+selected = 0
+default = 0
+cancel = 0
+
+[ widget-03 ]
+type = toggle
name = AutoClutchToggle
setting = control.autoclutch
values = options
@@ -44,7 +58,7 @@
default = 0
cancel = 0
-[ widget-03 ]
+[ widget-04 ]
type = toggle
name = ABSToggle
setting = game.antilock
@@ -58,7 +72,7 @@
default = 0
cancel = 0
-[ widget-04 ]
+[ widget-05 ]
type = toggle
name = TCSToggle
setting = game.traction_control
@@ -72,7 +86,7 @@
default = 0
cancel = 0
-[ widget-05 ]
+[ widget-06 ]
type = floatwheel
name = ButtonRampWheel
setting = control.button_ramp
@@ -86,7 +100,7 @@
default = 0
cancel = 0
-[ widget-06 ]
+[ widget-07 ]
type = button
name = ActionControlMapButton
text = Assign Controls
@@ -102,7 +116,7 @@
default = 0
cancel = 0
-[ widget-07 ]
+[ widget-08 ]
type = button
name = JoystickOptionsButton
text = Joystick Options
@@ -118,7 +132,7 @@
default = 0
cancel = 0
-[ widget-08 ]
+[ widget-09 ]
type = button
name = MouseOptionsButton
text = Mouse Options
@@ -134,7 +148,7 @@
default = 0
cancel = 0
-[ widget-09 ]
+[ widget-10 ]
type = button
name = ControlsOptionsOKButton
text = OK
@@ -150,7 +164,7 @@
default = 1
cancel = 0
-[ widget-10 ]
+[ widget-11 ]
type = button
name = ControlsOptionsCancelButton
text = Cancel
Index: data/skins/simple/menus/InGameControlsOptions
===================================================================
--- data/skins/simple/menus/InGameControlsOptions (revision 1323)
+++ data/skins/simple/menus/InGameControlsOptions (working copy)
@@ -1,5 +1,5 @@
name = InGameControlsOptions
-widgets = 11
+widgets = 12
background = box.png
dialog = false
@@ -21,7 +21,7 @@
name = InGameTouchCompWheel
setting = joystick.touchcomp
values = options
-center = 0.5, 0.29
+center = 0.5, 0.25
width = auto
height = auto
fontsize = 6
@@ -32,6 +32,20 @@
[ widget-02 ]
type = toggle
+name = InGameAutoTransToggle
+setting = control.autotrans
+values = options
+center = 0.5, 0.29
+width = auto
+height = auto
+fontsize = 6
+enabled = 1
+selected = 0
+default = 0
+cancel = 0
+
+[ widget-03 ]
+type = toggle
name = InGameAutoClutchToggle
setting = control.autoclutch
values = options
@@ -44,7 +58,7 @@
default = 0
cancel = 0
-[ widget-03 ]
+[ widget-04 ]
type = toggle
name = InGameABSToggle
setting = game.antilock
@@ -58,7 +72,7 @@
default = 0
cancel = 0
-[ widget-04 ]
+[ widget-05 ]
type = toggle
name = InGameTCSToggle
setting = game.traction_control
@@ -72,7 +86,7 @@
default = 0
cancel = 0
-[ widget-05 ]
+[ widget-06 ]
type = floatwheel
name = InGameButtonRampWheel
setting = control.button_ramp
@@ -86,7 +100,7 @@
default = 0
cancel = 0
-[ widget-06 ]
+[ widget-07 ]
type = button
name = InGameActionControlMapButton
text = Assign Controls
@@ -102,7 +116,7 @@
default = 0
cancel = 0
-[ widget-07 ]
+[ widget-08 ]
type = button
name = InGameJoystickOptionsButton
text = Joystick Options
@@ -118,7 +132,7 @@
default = 0
cancel = 0
-[ widget-08 ]
+[ widget-09 ]
type = button
name = InGameMouseOptionsButton
text = Mouse Options
@@ -134,7 +148,7 @@
default = 0
cancel = 0
-[ widget-09 ]
+[ widget-10 ]
type = button
name = InGameControlsOptionsOKButton
text = OK
@@ -150,7 +164,7 @@
default = 1
cancel = 0
-[ widget-10 ]
+[ widget-11 ]
type = button
name = InGameControlsOptionsCancelButton
text = Cancel