RigsofRods
Soft-body Physics Simulation
EngineSim.cpp
Go to the documentation of this file.
1 /*
2  This source file is part of Rigs of Rods
3  Copyright 2005-2012 Pierre-Michel Ricordel
4  Copyright 2007-2012 Thomas Fischer
5  Copyright 2013-2020 Petr Ohlidal
6 
7  For more information, see http://www.rigsofrods.org/
8 
9  Rigs of Rods is free software: you can redistribute it and/or modify
10  it under the terms of the GNU General Public License version 3, as
11  published by the Free Software Foundation.
12 
13  Rigs of Rods is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with Rigs of Rods. If not, see <http://www.gnu.org/licenses/>.
20 */
21 
22 #include "EngineSim.h"
23 
24 #include "AppContext.h"
25 #include "ApproxMath.h" // frand()
26 #include "Actor.h"
27 #include "ActorManager.h"
28 #include "Console.h"
29 #include "InputEngine.h"
30 #include "ScriptEngine.h"
31 #include "SoundScriptManager.h"
32 #include "TorqueCurve.h"
33 
34 using namespace Ogre;
35 using namespace RoR;
36 
37 EngineSim::EngineSim(float _min_rpm, float _max_rpm, float torque, std::vector<float> gears, float dratio, ActorPtr actor) :
38  m_air_pressure(0.0f)
39  , m_auto_cur_acc(0.0f)
40  , m_auto_mode(AUTOMATIC)
41  , m_autoselect(DRIVE)
42  , m_braking_torque(-torque / 5.0f)
43  , m_clutch_force(10000.0f)
44  , m_clutch_time(0.2f)
45  , m_contact(false)
46  , m_cur_acc(0.0f)
47  , m_cur_clutch(0.0f)
48  , m_cur_clutch_torque(0.0f)
49  , m_cur_engine_rpm(0.0f)
50  , m_cur_engine_torque(0.0f)
51  , m_cur_gear(0)
52  , m_cur_gear_range(0)
53  , m_cur_wheel_revolutions(0.0f)
54  , m_ref_wheel_revolutions(0.0f)
55  , m_diff_ratio(dratio)
56  , m_tcase_ratio(1.0f)
57  , m_engine_torque(torque)
58  , m_gear_ratios(gears)
59  , m_engine_has_air(true)
60  , m_engine_has_turbo(true)
61  , m_hydropump_state(0.0f)
62  , m_engine_idle_rpm(std::min(std::abs(_min_rpm), 800.0f))
63  , m_engine_inertia(10.0f)
64  , m_kickdown_delay_counter(0)
65  , m_max_idle_mixture(0.1f)
66  , m_engine_max_rpm(std::abs(_max_rpm))
67  , m_min_idle_mixture(0.0f)
68  , m_engine_min_rpm(std::abs(_min_rpm))
69  , m_num_gears((int)gears.size() - 2)
70  , m_post_shift_time(0.2f)
71  , m_post_shift_clock(0.0f)
72  , m_post_shifting(0)
73  , m_engine_is_priming(false)
74  , m_engine_is_running(false)
75  , m_shift_behaviour(0.0f)
76  , m_shift_time(0.5f)
77  , m_shift_clock(0.0f)
78  , m_shifting(0)
79  , m_shift_val(0)
80  , m_engine_stall_rpm(300.0f)
81  , m_starter(0)
82  , m_torque_curve(new TorqueCurve())
83  , m_actor(actor)
84  , m_engine_turbo_mode(OLD)
85  , m_engine_type('t')
86  , m_upshift_delay_counter(0)
87  , m_engine_is_electric(false)
88  , m_turbo_inertia_factor(1)
89  , m_num_turbos(1)
90  , m_max_turbo_rpm(200000.0f)
91  , m_turbo_engine_rpm_operation(0.0f)
92  , m_turbo_ver(1)
93  , m_min_bov_psi(11)
94  , m_min_wastegate_psi(20)
95  , m_turbo_has_wastegate(false)
96  , m_turbo_has_bov(false)
97  , m_turbo_flutters(false)
98  , m_turbo_wg_threshold_p(0)
99  , m_turbo_wg_threshold_n(0)
100  , m_turbo_has_antilag(false)
101  , m_antilag_rand_chance(0.9975)
102  , m_antilag_min_rpm(3000)
103  , m_antilag_power_factor(170)
104 {
108 
109  m_gear_ratios[0] = -m_gear_ratios[0];
110  for (std::vector<float>::iterator it = m_gear_ratios.begin(); it != m_gear_ratios.end(); ++it)
111  {
112  (*it) *= m_diff_ratio;
113  }
114 
115  for (int i = 0; i < MAXTURBO; i++)
116  {
117  m_engine_addi_torque[i] = 0;
118  m_cur_turbo_rpm[i] = 0;
119  }
120 }
121 
123 {
124  // delete NULL is safe
125  delete m_torque_curve;
126  m_torque_curve = NULL;
127 }
128 
129 void EngineSim::SetTurboOptions(int type, float tinertiaFactor, int nturbos, float param1, float param2, float param3, float param4, float param5, float param6, float param7, float param8, float param9, float param10, float param11)
130 {
131  m_engine_has_turbo = true;
133 
134  if (nturbos > MAXTURBO)
135  {
136  m_num_turbos = 4;
137  LOG("Turbo: No more than 4 turbos allowed"); //TODO: move this under RigParser
138  }
139  else
140  m_num_turbos = nturbos;
141 
142  m_turbo_ver = type;
143  m_turbo_inertia_factor = tinertiaFactor;
144 
145  if (param2 != 9999)
147 
148  if (m_turbo_ver == 1)
149  {
150  for (int i = 0; i < m_num_turbos; i++)
151  m_engine_addi_torque[i] = param1 / m_num_turbos; //Additional torque
152  }
153  else
154  {
155  float turbo_max_psi = param1; //maxPSI
156  m_max_turbo_rpm = turbo_max_psi * 10000;
157 
158  //Duh
159  if (param3 == 1)
160  m_turbo_has_bov = true;
161  else
162  m_turbo_has_bov = false;
163 
164  if (param3 != 9999)
165  m_min_bov_psi = param4;
166 
167  if (param5 == 1)
168  m_turbo_has_wastegate = true;
169  else
170  m_turbo_has_wastegate = false;
171 
172  if (param6 != 9999)
173  m_min_wastegate_psi = param6 * 10000;
174 
175  if (param7 != 9999)
176  {
177  m_turbo_wg_threshold_n = 1 - param7;
178  m_turbo_wg_threshold_p = 1 + param7;
179  }
180 
181  if (param8 == 1)
182  m_turbo_has_antilag = true;
183  else
184  m_turbo_has_antilag = false;
185 
186  if (param9 != 9999)
187  m_antilag_rand_chance = param9;
188 
189  if (param10 != 9999)
190  m_antilag_min_rpm = param10;
191 
192  if (param11 != 9999)
193  m_antilag_power_factor = param11;
194  }
195 }
196 
197 void EngineSim::SetEngineOptions(float einertia, char etype, float eclutch, float ctime, float stime, float pstime, float irpm, float srpm, float maximix, float minimix, float ebraking)
198 {
199  m_engine_inertia = einertia;
200  m_engine_type = etype;
201  m_clutch_force = eclutch;
202 
203  if (ctime > 0)
204  m_clutch_time = ctime;
205  if (stime > 0)
206  m_shift_time = stime;
207  if (pstime > 0)
208  m_post_shift_time = pstime;
209  if (irpm > 0)
210  m_engine_idle_rpm = irpm;
211  if (srpm > 0)
212  m_engine_stall_rpm = srpm;
213  if (maximix > 0)
214  m_max_idle_mixture = maximix;
215  if (minimix > 0)
216  m_min_idle_mixture = minimix;
217  if (ebraking > 0)
218  m_braking_torque = -ebraking;
219 
220  m_shift_time = std::max(0.0f, m_shift_time);
221  m_post_shift_time = std::max(0.0f, m_post_shift_time);
222  m_clutch_time = Math::Clamp(m_clutch_time, 0.0f, 0.9f * m_shift_time);
223 
224  m_engine_stall_rpm = Math::Clamp(m_engine_stall_rpm, 0.0f, 0.9f * m_engine_idle_rpm);
225 
226  if (etype == 'c')
227  {
228  // it's a car!
229  m_engine_has_air = false;
230  m_engine_has_turbo = false;
231  m_engine_is_electric = false;
232  // set default clutch force
233  if (m_clutch_force < 0.0f)
234  {
235  m_clutch_force = 5000.0f;
236  }
237  }
238  else if (etype == 'e') //electric
239  {
240  m_engine_is_electric = true;
241  m_engine_has_air = false;
242  m_engine_has_turbo = false;
243  if (m_clutch_force < 0.0f)
244  {
245  m_clutch_force = 5000.0f;
246  }
247  }
248  else
249  {
250  m_engine_is_electric = false;
251  // it's a truck
252  if (m_clutch_force < 0.0f)
253  {
254  m_clutch_force = 10000.0f;
255  }
256  }
257 }
258 
259 void EngineSim::UpdateEngineSim(float dt, int doUpdate)
260 {
261  float acc = m_cur_acc;
262 
263  acc = std::max(getIdleMixture(), acc);
264  acc = std::max(getPrimeMixture(), acc);
265 
266  if (doUpdate)
267  {
269  }
270 
271  if (m_engine_has_air)
272  {
273  // air pressure
275  if (m_air_pressure > 50000.0f)
276  {
278  m_air_pressure = 0.0f;
279  }
280  }
281 
282  if (m_engine_has_turbo)
283  {
284  if (m_engine_turbo_mode == OLD)
285  {
286  // update turbo speed (lag)
287  float turbotorque = 0.0f;
288  float turboInertia = 0.000003f;
289 
290  // braking (compression)
291  turbotorque -= m_cur_turbo_rpm[0] / 200000.0f;
292 
293  // powering (exhaust) with limiter
294  if (m_cur_turbo_rpm[0] < 200000.0f && m_engine_is_running && m_cur_acc > 0.06f)
295  {
296  turbotorque += 1.5f * m_cur_acc * (m_cur_engine_rpm / m_engine_max_rpm);
297  }
298  else
299  {
300  turbotorque += 0.1f * (m_cur_engine_rpm / m_engine_max_rpm);
301  }
302 
303  // integration
304  m_cur_turbo_rpm[0] += dt * turbotorque / turboInertia;
305  }
306  else
307  {
308  for (int i = 0; i < m_num_turbos; i++)
309  {
310  // update turbo speed (lag)
311  // reset each of the values for each turbo
312  float turbotorque = 0.0f;
313  float turboBOVtorque = 0.0f;
314 
315  float turboInertia = 0.000003f * m_turbo_inertia_factor;
316 
317  // braking (compression)
318  turbotorque -= m_cur_turbo_rpm[i] / m_max_turbo_rpm;
319  turboBOVtorque -= m_turbo_bov_rpm[i] / m_max_turbo_rpm;
320 
321  // powering (exhaust) with limiter
323  {
324  if (m_cur_turbo_rpm[i] <= m_max_turbo_rpm && m_engine_is_running && acc > 0.06f)
325  {
327  {
329  {
331  }
332  else
333  {
334  m_turbo_flutters = true;
335  turbotorque -= (m_cur_turbo_rpm[i] / m_max_turbo_rpm) * 1.5;
336  }
337 
338  if (m_turbo_flutters)
339  {
342  {
343  m_turbo_flutters = false;
345  }
346  }
347  }
348  else
350  }
351  else
352  {
354  }
355 
356  //Update waste gate, it's like a BOV on the exhaust part of the turbo, acts as a limiter
358  {
359  if (m_cur_turbo_rpm[i] > m_min_wastegate_psi * 0.95)
360  turboInertia = turboInertia * 0.7; //Kill inertia so it flutters
361  else
362  turboInertia = turboInertia * 1.3; //back to normal inertia
363  }
364  }
365 
366  //simulate compressor surge
367  if (!m_turbo_has_bov)
368  {
369  if (m_cur_turbo_rpm[i] > 13 * 10000 && m_cur_acc < 0.06f)
370  {
371  turbotorque += (turbotorque * 2.5);
372  }
373  }
374 
375  // anti lag
376  if (m_turbo_has_antilag && m_cur_acc < 0.5)
377  {
378  float f = frand();
380  {
382  {
383  turbotorque -= (turbotorque * (f * m_antilag_power_factor));
385  }
386  }
387  else
388  {
390  }
391  }
392 
393  // update main turbo rpm
394  m_cur_turbo_rpm[i] += dt * turbotorque / turboInertia;
395 
396  //Update BOV
397  //It's basicly an other turbo which is limmited to the main one's rpm, but it doesn't affect its rpm. It only affects the power going into the engine.
398  //This one is used to simulate the pressure between the engine and the compressor.
399  //I should make the whole turbo code work this way. -Max98
400  if (m_turbo_has_bov)
401  {
402  if (m_turbo_bov_rpm[i] < m_cur_turbo_rpm[i])
403  turboBOVtorque += 1.5f * acc * (((m_cur_engine_rpm) / (m_engine_max_rpm)));
404  else
405  turboBOVtorque += 0.07f * (((m_cur_engine_rpm) / (m_engine_max_rpm)));
406 
407  if (m_cur_acc < 0.06 && m_cur_turbo_rpm[i] > m_min_bov_psi * 10000)
408  {
410  m_turbo_bov_rpm[i] += dt * turboBOVtorque / (turboInertia * 0.1);
411  }
412  else
413  {
415  if (m_turbo_bov_rpm[i] < m_cur_turbo_rpm[i])
416  m_turbo_bov_rpm[i] += dt * turboBOVtorque / (turboInertia * 0.05);
417  else
418  m_turbo_bov_rpm[i] += dt * turboBOVtorque / turboInertia;
419  }
420  }
421  }
422  }
423  }
424 
425  // update engine speed
426  float totaltorque = 0.0f;
427 
428  // engine braking
430  {
431  totaltorque += m_braking_torque * m_cur_engine_rpm / m_engine_max_rpm * (1.0f - m_cur_acc);
432  }
433  else if (!m_contact || !m_starter)
434  {
435  totaltorque += m_braking_torque;
436  }
437 
438  // braking by hydropump
439  if (m_cur_engine_rpm > 100.0f)
440  {
441  totaltorque -= 8.0f * m_hydropump_state / (m_cur_engine_rpm * 0.105f * dt);
442  }
443 
445  {
447  totaltorque += m_cur_engine_torque;
448  }
449 
450  // engine stall
452  {
454  {
455  this->StopEngine();
456  }
457  }
458 
459  // engine start
461  {
463  {
464  if (m_starter)
465  m_engine_is_running = true;
466  }
467  else
468  {
470  {
471  if (m_starter)
472  {
473  totaltorque += m_engine_torque * exp(-2.7f * m_cur_engine_rpm / m_engine_idle_rpm) - m_braking_torque;
474  }
475  }
476  else
477  {
478  m_engine_is_running = true;
480  }
481  }
482  }
483 
484  // clutch
485  if (m_cur_gear)
486  {
487  totaltorque -= m_cur_clutch_torque / m_gear_ratios[m_cur_gear + 1];
488  }
489 
490  // integration
491  m_cur_engine_rpm += dt * totaltorque / m_engine_inertia;
492 
493  // update clutch torque
494  if (m_cur_gear)
495  {
496  float force_threshold = 1.5f * std::max(m_engine_torque, getEnginePower()) * std::abs(m_gear_ratios[2]);
497  float gearboxspinner = m_cur_engine_rpm / m_gear_ratios[m_cur_gear + 1];
499  m_cur_clutch_torque = Math::Clamp(m_cur_clutch_torque, -force_threshold, +force_threshold);
500  m_cur_clutch_torque *= 1.0f - approx_exp(-std::abs(gearboxspinner - m_cur_wheel_revolutions));
501  }
502  else
503  {
504  m_cur_clutch_torque = 0.0f;
505  }
506 
507  m_cur_engine_rpm = std::max(0.0f, m_cur_engine_rpm);
508 
509  if (m_auto_mode < MANUAL)
510  {
511  // auto-shift
512  if (m_shifting)
513  {
514  m_shift_clock += dt;
515 
516  if (m_shift_val)
517  {
518  float declutchTime = std::min(m_shift_time - m_clutch_time, m_clutch_time);
519  if (m_shift_clock <= declutchTime)
520  {
521  // depress the clutch
522  float ratio = pow(1.0f - (m_shift_clock / declutchTime), 2);
523  m_cur_clutch = std::min(ratio, m_cur_clutch);
524  m_cur_acc = std::min(ratio, m_auto_cur_acc);
525  }
526  else
527  {
528  // engage a gear
530  if (m_autoselect != NEUTRAL)
531  {
533  m_cur_gear = std::max(-1, m_cur_gear);
534  m_cur_gear = std::min(m_cur_gear, m_num_gears);
535  }
536  m_shift_val = 0;
537  }
538  }
539 
541  {
542  // we're done m_shifting
545  m_shifting = 0;
546  m_post_shifting = 1;
547  m_post_shift_clock = 0.0f;
548  }
550  {
551  // release the clutch <-- Done below
552  float timer = m_shift_clock - (m_shift_time - m_clutch_time);
553  float ratio = sqrt(timer / m_clutch_time);
554  m_cur_acc = (m_auto_cur_acc / 2.0f) * ratio;
555  }
556  }
557 
558  if (m_post_shifting)
559  {
560  m_post_shift_clock += dt;
562  {
563  m_post_shifting = 0;
564  }
565  else if (m_auto_cur_acc > 0.0f)
566  {
567  float ratio = m_post_shift_clock / m_post_shift_time;
568  m_cur_acc = (m_auto_cur_acc / 2.0f) + (m_auto_cur_acc / 2.0f) * ratio;
569  }
570  else if (m_cur_gear)
571  {
572  float gearboxspinner = m_cur_engine_rpm / m_gear_ratios[m_cur_gear + 1];
573  if (m_cur_wheel_revolutions > gearboxspinner)
574  {
575  float ratio = sqrt(m_post_shift_clock / m_post_shift_time);
576  m_cur_clutch = std::max(m_cur_clutch, ratio);
577  }
578  }
579  }
580 
581  // auto clutch
582  float declutchRPM = m_engine_min_rpm * 0.75f + m_engine_stall_rpm * 0.25f;
583  if (m_cur_gear == 0 || m_cur_engine_rpm < declutchRPM)
584  {
585  m_cur_clutch = 0.0f;
586  }
587  else if (m_cur_engine_rpm < m_engine_min_rpm && m_engine_min_rpm > declutchRPM)
588  {
589  float clutch = (m_cur_engine_rpm - declutchRPM) / (m_engine_min_rpm - declutchRPM);
590  m_cur_clutch = std::min(clutch * clutch, m_cur_clutch);
591  }
593  {
594  float threshold = 1.5f * getEnginePower(m_cur_engine_rpm) * std::abs(m_gear_ratios[2]);
595  float gearboxspinner = m_cur_engine_rpm / m_gear_ratios[m_cur_gear + 1];
596  float clutchTorque = (gearboxspinner - m_cur_wheel_revolutions) * m_clutch_force;
597  float reTorque = Math::Clamp(clutchTorque, -threshold, +threshold) / m_gear_ratios[m_cur_gear + 1];
598 
599  float range = (m_engine_max_rpm - m_engine_min_rpm) * 0.4f * sqrt(std::max(0.2f, acc));
600  float powerRatio = std::min((m_cur_engine_rpm - m_engine_min_rpm) / range, 1.0f);
601  float engineTorque = getEnginePower() * std::min(m_cur_acc, 0.9f) * powerRatio;
602 
603  float torqueDiff = std::min(engineTorque, std::abs(reTorque));
604  float clutch = torqueDiff / reTorque;
605  m_cur_clutch = std::max(m_cur_clutch, clutch);
606  }
607 
608  m_cur_clutch = std::max(0.0f, m_cur_clutch);
609  m_cur_clutch = std::min(m_cur_clutch, 1.0f);
610  }
611 
612  if (doUpdate && !m_shifting && !m_post_shifting)
613  {
614  // gear hack
615  float velocity = m_actor->ar_nodes[0].Velocity.length();
616 
617  Vector3 hdir = m_actor->GetCameraDir();
618  if (hdir != Vector3::ZERO)
619  {
620  velocity = hdir.dotProduct(m_actor->ar_nodes[0].Velocity);
621  }
622 
623  if (m_actor->ar_wheels[0].wh_radius != 0)
624  {
626  }
627 
629  {
631  {
632  if ((m_autoselect == DRIVE && m_cur_gear < m_num_gears && m_cur_clutch > 0.99f) || (m_autoselect == TWO && m_cur_gear < std::min(2, m_num_gears)))
633  {
635  shift(1);
636  }
637  }
640  {
641  shift(-1);
642  }
643 
644  int newGear = m_cur_gear;
645 
646  m_rpms.push_front(m_cur_engine_rpm);
647  m_accs.push_front(acc);
648  m_brakes.push_front(m_actor->ar_brake);
649 
650  float avgRPM50 = 0.0f;
651  float avgRPM200 = 0.0f;
652  float avgAcc50 = 0.0f;
653  float avgAcc200 = 0.0f;
654  float avgBrake50 = 0.0f;
655  float avgBrake200 = 0.0f;
656 
657  for (unsigned int i = 0; i < m_accs.size(); i++)
658  {
659  if (i < 50)
660  {
661  avgRPM50 += m_rpms[i];
662  avgAcc50 += m_accs[i];
663  avgBrake50 += m_brakes[i];
664  }
665 
666  avgRPM200 += m_rpms[i];
667  avgAcc200 += m_accs[i];
668  avgBrake200 += m_brakes[i];
669  }
670 
671  avgRPM50 /= std::min(m_rpms.size(), (std::deque<float>::size_type)50);
672  avgAcc50 /= std::min(m_accs.size(), (std::deque<float>::size_type)50);
673  avgBrake50 /= std::min(m_brakes.size(), (std::deque<float>::size_type)50);
674 
675  avgRPM200 /= m_rpms.size();
676  avgAcc200 /= m_accs.size();
677  avgBrake200 /= m_brakes.size();
678 
679  if (avgAcc50 > 0.8f || avgAcc200 > 0.8f || avgBrake50 > 0.8f || avgBrake200 > 0.8f)
680  {
681  m_shift_behaviour = std::min(m_shift_behaviour + 0.01f, 1.0f);
682  }
683  else if (acc < 0.5f && avgAcc50 < 0.5f && avgAcc200 < 0.5f && m_actor->ar_brake < 0.5f && avgBrake50 < 0.5f && avgBrake200 < 0.5)
684  {
685  m_shift_behaviour /= 1.01;
686  }
687 
688  if (avgAcc50 > 0.8f && m_cur_engine_rpm < m_engine_max_rpm - m_one_third_rpm_range)
689  {
690  while (newGear > 1 && m_cur_wheel_revolutions * m_gear_ratios[newGear] < m_engine_max_rpm - m_one_third_rpm_range &&
692  getEnginePower(m_cur_wheel_revolutions * m_gear_ratios[newGear + 1]) * m_gear_ratios[newGear + 1])
693  {
694  newGear--;
695  }
696  }
697  else if (avgAcc50 > 0.6f && acc < 0.8f && acc > avgAcc50 + 0.1f && m_cur_engine_rpm < m_engine_min_rpm + m_half_rpm_range)
698  {
699  if (newGear > 1 && m_cur_wheel_revolutions * m_gear_ratios[newGear] < m_engine_min_rpm + m_half_rpm_range &&
701  getEnginePower(m_cur_wheel_revolutions * m_gear_ratios[newGear + 1]) * m_gear_ratios[newGear + 1])
702  {
703  newGear--;
704  }
705  }
706  else if (avgAcc50 > 0.4f && acc < 0.8f && acc > avgAcc50 + 0.1f && m_cur_engine_rpm < m_engine_min_rpm + m_half_rpm_range)
707  {
710  getEnginePower(m_cur_wheel_revolutions * m_gear_ratios[newGear + 1]) * m_gear_ratios[newGear + 1])
711  {
712  newGear--;
713  }
714  }
715  else if (m_cur_gear < (m_autoselect == TWO ? std::min(2, m_num_gears) : m_num_gears) &&
716  avgBrake200 < 0.2f && acc < std::min(avgAcc200 + 0.1f, 1.0f) && m_cur_engine_rpm > avgRPM200 - m_full_rpm_range / 20.0f)
717  {
719  {
721  {
722  newGear++;
723  }
724  }
725  else if (avgAcc200 < 0.4f && avgAcc200 > 0.2f && m_cur_engine_rpm > m_engine_min_rpm + m_one_third_rpm_range)
726  {
728  {
729  newGear++;
730  }
731  }
732  else if (avgAcc200 < 0.2f && m_cur_engine_rpm > m_engine_min_rpm + m_one_third_rpm_range / 2.0f && m_cur_engine_rpm < m_engine_min_rpm + m_half_rpm_range)
733  {
735  {
736  newGear++;
737  }
738  }
739 
740  if (newGear > m_cur_gear)
741  {
744  {
745  newGear = m_cur_gear;
746  }
747  }
748  else
749  {
751  }
752  }
753 
754  if (newGear < m_cur_gear && m_kickdown_delay_counter > 0)
755  {
756  newGear = m_cur_gear;
757  }
759 
760  if (newGear < m_cur_gear && std::abs(m_cur_wheel_revolutions * (m_gear_ratios[newGear + 1] - m_gear_ratios[m_cur_gear + 1])) > m_one_third_rpm_range / 6.0f ||
761  newGear > m_cur_gear && std::abs(m_cur_wheel_revolutions * (m_gear_ratios[newGear + 1] - m_gear_ratios[m_cur_gear + 1])) > m_one_third_rpm_range / 3.0f)
762  {
763  if (std::abs(m_actor->getGForces().y) < 0.25f)
764  shiftTo(newGear);
765  }
766 
767  if (m_accs.size() > 200)
768  {
769  m_rpms.pop_back();
770  m_accs.pop_back();
771  m_brakes.pop_back();
772  }
773  // avoid over-revving
774  if (m_auto_mode <= SEMIAUTO && m_cur_gear != 0)
775  {
776  if (std::abs(m_cur_wheel_revolutions * m_gear_ratios[m_cur_gear + 1]) > m_engine_max_rpm * 1.25f)
777  {
778  float clutch = 0.0f + 1.0f / (1.0f + std::abs(m_cur_wheel_revolutions * m_gear_ratios[m_cur_gear + 1] - m_engine_max_rpm * 1.25f) / 2.0f);
779  m_cur_clutch = std::min(clutch, m_cur_clutch);
780  }
781  if (m_cur_gear * m_cur_wheel_revolutions < -10.0f)
782  {
783  float clutch = 0.0f + 1.0f / (1.0f + std::abs(-10.0f - m_cur_gear * m_cur_wheel_revolutions) / 2.0f);
784  m_cur_clutch = std::min(clutch, m_cur_clutch);
785  }
786  }
787  }
788  }
789 }
790 
792 {
793 #ifdef USE_OPENAL
794  if (m_engine_has_turbo)
795  {
796  for (int i = 0; i < m_num_turbos; i++)
797  {
799  }
800  }
801 
805 
806  // reverse gear beep
807  if (m_cur_gear == -1 && m_engine_is_running)
808  {
810  }
811  else
812  {
814  }
815 #endif // USE_OPENAL
816 }
817 
819 {
820  m_auto_mode = (m_auto_mode + 1) % (MANUAL_RANGES + 1);
821 
822  if (m_auto_mode == AUTOMATIC)
823  {
824  if (m_cur_gear > 0)
826  if (m_cur_gear < 0)
827  m_autoselect = REAR;
828  if (m_cur_gear == 0)
830  }
831  else
832  {
834  }
835 
836  if (m_auto_mode == MANUAL_RANGES)
837  {
838  m_cur_gear_range = 0;
839  }
840 }
841 
843 {
844  return (RoR::SimGearboxMode)this->m_auto_mode;
845 }
846 
848 {
849  this->m_auto_mode = (shiftmodes)mode;
850 }
851 
853 {
854  m_cur_acc = val;
855 }
856 
858 {
859  if (m_engine_turbo_mode == OLD)
860  {
861  return m_cur_turbo_rpm[0] / 10000.0f;
862  }
863 
864  float turboPSI = 0;
865 
866  if (m_turbo_has_bov)
867  {
868  for (int i = 0; i < m_num_turbos; i++)
869  turboPSI += m_turbo_bov_rpm[i] / 10000.0f;
870  }
871  else
872  {
873  for (int i = 0; i < m_num_turbos; i++)
874  turboPSI += m_cur_turbo_rpm[i] / 10000.0f;
875  }
876 
877  return turboPSI;
878 }
879 
881 {
882  return m_cur_acc;
883 }
884 
885 void EngineSim::PushNetworkState(float rpm, float acc, float clutch, int gear, bool running, bool contact, char automode, char autoselect)
886 {
887  m_cur_engine_rpm = rpm;
888  m_cur_acc = acc;
889  m_cur_clutch = clutch;
890  m_cur_gear = gear;
891  m_engine_is_running = running;
892  m_contact = contact;
893  if (automode != -1)
894  {
895  m_auto_mode = automode;
896  }
897  if (autoselect != -1)
898  {
899  m_autoselect = (autoswitch)autoselect;
900  }
901 }
902 
904 {
906  {
907  return m_cur_acc * (1.0f - m_cur_turbo_rpm[0] /* doesn't matter */ / m_max_turbo_rpm);// * m_engine_torque / 5000.0f;
908  }
909 
910  return -1;
911 }
912 
914 {
915  return m_cur_clutch_torque;
916 }
917 
918 void EngineSim::SetEngineRpm(float rpm)
919 {
920  m_cur_engine_rpm = rpm;
921 }
922 
924 {
926 }
927 
929 {
930  m_hydropump_state = work;
931 }
932 
933 void EngineSim::SetWheelSpin(float rpm)
934 {
936 }
937 
938 void EngineSim::SetTCaseRatio(float ratio)
939 {
940  if (ratio < 1.0f)
941  return;
942 
943  for (std::vector<float>::iterator it = m_gear_ratios.begin(); it != m_gear_ratios.end(); ++it)
944  {
945  (*it) /= m_tcase_ratio;
946  }
947 
948  m_tcase_ratio = ratio;
949 
950  for (std::vector<float>::iterator it = m_gear_ratios.begin(); it != m_gear_ratios.end(); ++it)
951  {
952  (*it) *= m_tcase_ratio;
953  }
954 }
955 
956 // for hydros acceleration
958 {
959  float minWorkingRPM = m_engine_idle_rpm * 1.1f; // minWorkingRPM > m_engine_idle_rpm avoids commands deadlocking the engine
960 
961  float rpmRatio = (m_cur_engine_rpm - minWorkingRPM) / (m_engine_max_rpm - minWorkingRPM);
962  rpmRatio = std::max(0.0f, rpmRatio); // Avoids a negative rpmRatio when m_cur_engine_rpm < minWorkingRPM
963  rpmRatio = std::min(rpmRatio, 1.0f); // Avoids a rpmRatio > 1.0f when m_cur_engine_rpm > m_engine_max_rpm
964 
965  float crankfactor = 5.0f * rpmRatio;
966 
967  return crankfactor;
968 }
969 
970 void EngineSim::SetClutch(float clutch)
971 {
972  m_cur_clutch = clutch;
973 }
974 
976 {
977  return m_cur_clutch;
978 }
979 
981 {
982  return m_clutch_force;
983 }
984 
986 {
987  m_contact = !m_contact;
988  if (m_contact)
989  {
991  }
992  else
993  {
995  }
996 }
997 
999 {
1000  this->OffStart();
1001  m_contact = true;
1003  m_engine_is_running = true;
1004  if (m_auto_mode <= SEMIAUTO)
1005  {
1006  m_cur_gear = 1;
1007  }
1008  if (m_auto_mode == AUTOMATIC)
1009  {
1010  m_autoselect = DRIVE;
1011  }
1014 }
1015 
1017 {
1018  m_air_pressure = 0.0f;
1020  m_contact = false;
1021  m_cur_acc = 0.0f;
1022  m_cur_clutch = 0.0f;
1023  m_cur_clutch_torque = 0.0f;
1024  m_cur_engine_rpm = 0.0f;
1025  m_cur_gear = 0;
1026  m_post_shifting = 0;
1027  m_engine_is_running = false;
1028  m_shifting = 0;
1029  m_shift_val = 0;
1030  if (m_auto_mode == AUTOMATIC)
1031  {
1033  }
1034  for (int i = 0; i < m_num_turbos; i++)
1035  {
1036  m_cur_turbo_rpm[i] = 0.0f;
1037  m_turbo_bov_rpm[i] = 0.0f;
1038  }
1039 }
1040 
1042 {
1043  return m_cur_gear;
1044 }
1045 
1046 // low level gear changing
1048 {
1049  m_cur_gear = v;
1050 }
1051 
1053 {
1054  return m_cur_gear_range;
1055 }
1056 
1058 {
1059  m_cur_gear_range = v;
1060 }
1061 
1063 {
1064  if (!m_engine_is_running)
1065  return;
1066 
1067  m_engine_is_running = false;
1070 }
1071 
1073 {
1074  return (-m_braking_torque * std::pow(m_cur_engine_rpm / m_engine_max_rpm, 2.0f)) / getEnginePower();
1075 }
1076 
1077 // high level controls
1078 void EngineSim::autoSetAcc(float val)
1079 {
1080  m_auto_cur_acc = val;
1081  if (!m_shifting)
1082  {
1083  SetAcceleration(val);
1084  }
1085 }
1086 
1087 void EngineSim::shift(int val)
1088 {
1089  if (!val || m_cur_gear + val < -1 || m_cur_gear + val > getNumGears())
1090  return;
1091  if (m_auto_mode < MANUAL)
1092  {
1093  m_shift_val = val;
1094  m_shifting = 1;
1095  m_shift_clock = 0.0f;
1096  }
1097  else
1098  {
1099  if (m_cur_clutch > 0.25f)
1100  {
1102  }
1103  else
1104  {
1106  m_cur_gear += val;
1107  }
1108  }
1109 }
1110 
1111 void EngineSim::shiftTo(int newGear)
1112 {
1113  shift(newGear - m_cur_gear);
1114 }
1115 
1117 {
1118  if (m_autoselect == MANUALMODE)
1119  return;
1120 
1121  if (!m_engine_is_electric)
1122  {
1124  }
1125 
1126  if (m_autoselect == REAR)
1127  {
1128  m_cur_gear = -1;
1129  }
1130  else if (m_autoselect == NEUTRAL)
1131  {
1132  m_cur_gear = 0;
1133  }
1134  else if (m_autoselect == ONE)
1135  {
1136  m_cur_gear = 1;
1137  }
1138  else
1139  {
1140  // search for an appropriate gear
1141  int newGear = 1;
1142 
1143  while (newGear < m_num_gears && m_cur_wheel_revolutions > 0.0f && m_cur_wheel_revolutions * m_gear_ratios[newGear + 1] > m_engine_max_rpm - 100.0f)
1144  {
1145  newGear++;
1146  }
1147 
1148  m_cur_gear = newGear;
1149 
1150  if (m_autoselect == TWO)
1151  {
1152  m_cur_gear = std::min(m_cur_gear, 2);
1153  }
1154  }
1155 }
1156 
1158 {
1159  m_autoselect = (autoswitch)mode;
1161  m_autoselect = DRIVE;
1162  updateShifts();
1163 }
1164 
1166 {
1167  if (m_autoselect != REAR)
1168  {
1170  updateShifts();
1171  }
1172 }
1173 
1175 {
1176  if ((m_engine_is_electric && m_autoselect != DRIVE) ||
1178  {
1180  updateShifts();
1181  }
1182 }
1183 
1185 {
1186  return (int)m_autoselect;
1187 }
1188 
1190 {
1191  if (m_auto_mode >= MANUAL)
1192  {
1193  val = std::max(0.0f, val);
1194  m_cur_clutch = 1.0 - val;
1195  }
1196 }
1197 
1199 {
1200  if (!m_engine_has_turbo)
1201  return 0.0f;
1202  if (m_engine_turbo_mode != NEW)
1203  return 0.0f;
1204 
1205  float atValue = 0.0f; // torque (turbo integreation)
1206 
1207  if (m_turbo_ver == 1)
1208  {
1209  for (int i = 0; i < m_num_turbos; i++)
1210  {
1211  atValue += m_engine_addi_torque[i] * (m_cur_turbo_rpm[i] / m_max_turbo_rpm);
1212  }
1213  }
1214  else
1215  {
1216  atValue = (((GetTurboPsi() * 6.8) * m_engine_torque) / 100); //1psi = 6% more power
1217  }
1218 
1219  return atValue;
1220 }
1221 
1223 {
1224  // engine power with limiter
1225  float tqValue = 1.0f; // ratio (0-1)
1226 
1227  if (m_torque_curve)
1228  {
1229  tqValue = m_torque_curve->getEngineTorque(rpm);
1230  }
1231 
1232  return (m_engine_torque * tqValue) + getTurboPower();
1233 }
1234 
1236 {
1238  return m_max_idle_mixture;
1239  return m_min_idle_mixture;
1240 }
1241 
1243 {
1244  if (m_engine_is_priming)
1245  {
1246  float crankfactor = GetCrankFactor();
1247 
1248  if (crankfactor < 0.9f)
1249  {
1250  // crankfactor is between 0.0f and 0.9f
1251  return 1.0f;
1252  }
1253  else if (crankfactor < 1.0f)
1254  {
1255  // crankfactor is between 0.9f and 1.0f
1256  return 10.0f * (1.0f - crankfactor);
1257  }
1258  }
1259 
1260  return 0.0f;
1261 }
1262 
1264 {
1267 
1268  if (App::GetInputEngine()->getEventValue(EV_TRUCK_ACCELERATE_MODIFIER_25) ||
1270  {
1271  float acclModifier = 0.0f;
1273  {
1274  acclModifier += 0.25f;
1275  }
1277  {
1278  acclModifier += 0.50f;
1279  }
1280  accl *= acclModifier;
1281  }
1282 
1283  if (App::GetInputEngine()->getEventValue(EV_TRUCK_BRAKE_MODIFIER_25) ||
1285  {
1286  float brakeModifier = 0.0f;
1287  if (App::GetInputEngine()->getEventValue(EV_TRUCK_BRAKE_MODIFIER_25))
1288  {
1289  brakeModifier += 0.25f;
1290  }
1291  if (App::GetInputEngine()->getEventValue(EV_TRUCK_BRAKE_MODIFIER_50))
1292  {
1293  brakeModifier += 0.50f;
1294  }
1295  brake *= brakeModifier;
1296  }
1297 
1298  // arcade controls are only working with auto-clutch!
1299  if (!App::io_arcade_controls->getBool() || (this->GetAutoShiftMode() >= SimGearboxMode::MANUAL))
1300  {
1301  // classic mode, realistic
1302  this->autoSetAcc(accl);
1303  m_actor->ar_brake = brake;
1304  }
1305  else
1306  {
1307  // start engine
1308  if (this->hasContact() && !this->isRunning() && (accl > 0 || brake > 0))
1309  {
1310  this->StartEngine();
1311  }
1312 
1313  // arcade controls: hey - people wanted it x| ... <- and it's convenient
1314  if (this->GetGear() >= 0)
1315  {
1316  // neutral or drive forward, everything is as its used to be: brake is brake and accel. is accel.
1317  this->autoSetAcc(accl);
1318  m_actor->ar_brake = brake;
1319  }
1320  else
1321  {
1322  // reverse gear, reverse controls: brake is accel. and accel. is brake.
1323  this->autoSetAcc(brake);
1324  m_actor->ar_brake = accl;
1325  }
1326 
1327  // only when the truck really is not moving anymore
1328  if (fabs(m_actor->ar_avg_wheel_speed) <= 1.0f)
1329  {
1330  Ogre::Vector3 hdir = m_actor->getDirection();
1331  float velocity = hdir.dotProduct(m_actor->ar_nodes[0].Velocity);
1332 
1333  // switching point, does the user want to drive forward from backward or the other way round? change gears?
1334  if (velocity < 1.0f && brake > 0.5f && accl < 0.5f && this->GetGear() > 0)
1335  {
1336  // we are on the brake, jump to reverse gear
1337  if (this->GetAutoShiftMode() == SimGearboxMode::AUTO)
1338  {
1340  }
1341  else
1342  {
1343  this->SetGear(-1);
1344  }
1345  }
1346  else if (velocity > -1.0f && brake < 0.5f && accl > 0.5f && this->GetGear() < 0)
1347  {
1348  // we are on the gas pedal, jump to first gear when we were in rear gear
1349  if (this->GetAutoShiftMode() == SimGearboxMode::AUTO)
1350  {
1352  }
1353  else
1354  {
1355  this->SetGear(1);
1356  }
1357  }
1358  }
1359  }
1360 
1361  // gear management
1362  if (this->GetAutoShiftMode() == SimGearboxMode::AUTO)
1363  {
1364  if (App::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_AUTOSHIFT_UP))
1365  {
1366  this->autoShiftUp();
1367  }
1368  if (App::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_AUTOSHIFT_DOWN))
1369  {
1370  this->autoShiftDown();
1371  }
1372  }
1373 
1374  if (App::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_TOGGLE_CONTACT))
1375  {
1376  this->toggleContact();
1377  }
1378 
1379  if (App::GetInputEngine()->getEventBoolValue(EV_TRUCK_STARTER) && this->hasContact() && !this->isRunning())
1380  {
1381  m_starter = true;
1382  if (!m_engine_is_electric)
1384  }
1385  else
1386  {
1387  m_starter = false;
1389  }
1390 
1391  if (App::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_SWITCH_SHIFT_MODES))
1392  {
1393  // toggle Auto shift
1394  this->ToggleAutoShiftMode();
1395 
1396  // force gui update
1398 
1400  ToLocalizedString(this->GetAutoShiftMode()), "cog.png");
1401  }
1402 
1403  // joy clutch
1405  this->setManualClutch(cval);
1406 
1407  SimGearboxMode shiftmode = this->GetAutoShiftMode();
1408 
1409  if (shiftmode <= SimGearboxMode::MANUAL) // auto, semi auto and sequential shifting
1410  {
1411  if (App::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_SHIFT_UP))
1412  {
1413  this->shift(1);
1414  }
1415  else if (App::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_SHIFT_DOWN))
1416  {
1417  if (shiftmode > SimGearboxMode::SEMI_AUTO ||
1418  shiftmode == SimGearboxMode::SEMI_AUTO && (!App::io_arcade_controls->getBool()) ||
1419  shiftmode == SimGearboxMode::SEMI_AUTO && this->GetGear() > 0 ||
1420  shiftmode == SimGearboxMode::AUTO)
1421  {
1422  this->shift(-1);
1423  }
1424  }
1425  else if (shiftmode != SimGearboxMode::AUTO)
1426  {
1427  if (App::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_SHIFT_NEUTRAL))
1428  {
1429  this->shiftTo(0);
1430  }
1431  else if (App::GetInputEngine()->getEventBoolValue(EV_TRUCK_SHIFT_GEAR_REVERSE))
1432  {
1433  this->shiftTo(-1);
1434  }
1435  else
1436  {
1437  for (int i = 1; i < 19; i++)
1438  {
1439  if (App::GetInputEngine()->getEventBoolValue(EV_TRUCK_SHIFT_GEAR01 + i - 1))
1440  {
1441  this->shiftTo(i);
1442  }
1443  }
1444  }
1445  }
1446  }
1447  else //if (shiftmode > SimGearboxMode::MANUAL) // h-shift or h-shift with ranges shifting
1448  {
1449  bool gear_changed = false;
1450  bool found = false;
1451  int curgear = this->GetGear();
1452  int curgearrange = this->GetGearRange();
1453  int gearoffset = std::max(0, curgear - curgearrange * 6);
1454 
1455  // one can select range only if in neutral
1456  if (shiftmode == SimGearboxMode::MANUAL_RANGES && curgear == 0)
1457  {
1458  // maybe this should not be here, but should experiment
1459  if (App::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_SHIFT_LOWRANGE) && curgearrange != 0)
1460  {
1461  this->SetGearRange(0);
1462  gear_changed = true;
1464  }
1465  else if (App::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_SHIFT_MIDRANGE) && curgearrange != 1 && this->getNumGearsRanges() > 1)
1466  {
1467  this->SetGearRange(1);
1468  gear_changed = true;
1470  }
1471  else if (App::GetInputEngine()->getEventBoolValueBounce(EV_TRUCK_SHIFT_HIGHRANGE) && curgearrange != 2 && this->getNumGearsRanges() > 2)
1472  {
1473  this->SetGearRange(2);
1474  gear_changed = true;
1476  }
1477  }
1478  //zaxxon
1479  if (curgear == -1)
1480  {
1482  }
1483  else if (curgear > 0 && curgear < 19)
1484  {
1485  gear_changed = !App::GetInputEngine()->getEventBoolValue(EV_TRUCK_SHIFT_GEAR01 + gearoffset - 1); // range mode
1486  }
1487 
1488  if (gear_changed || curgear == 0)
1489  {
1490  if (App::GetInputEngine()->getEventBoolValue(EV_TRUCK_SHIFT_GEAR_REVERSE))
1491  {
1492  this->shiftTo(-1);
1493  found = true;
1494  }
1495  else if (App::GetInputEngine()->getEventBoolValue(EV_TRUCK_SHIFT_NEUTRAL))
1496  {
1497  this->shiftTo(0);
1498  found = true;
1499  }
1500  else
1501  {
1502  if (shiftmode == SimGearboxMode::MANUAL_STICK)
1503  {
1504  for (int i = 1; i < 19 && !found; i++)
1505  {
1506  if (App::GetInputEngine()->getEventBoolValue(EV_TRUCK_SHIFT_GEAR01 + i - 1))
1507  {
1508  this->shiftTo(i);
1509  found = true;
1510  }
1511  }
1512  }
1513  else // SimGearboxMode::MANUALMANUAL_RANGES
1514  {
1515  for (int i = 1; i < 7 && !found; i++)
1516  {
1517  if (App::GetInputEngine()->getEventBoolValue(EV_TRUCK_SHIFT_GEAR01 + i - 1))
1518  {
1519  this->shiftTo(i + curgearrange * 6);
1520  found = true;
1521  }
1522  }
1523  }
1524  }
1525  if (!found)
1526  {
1527  this->shiftTo(0);
1528  }
1529  } // end of if (gear_changed)
1530  } // end of shitmode > SimGearboxMode::MANUAL
1531 }
RoR::Actor::ar_avg_wheel_speed
float ar_avg_wheel_speed
Physics state; avg wheel speed in m/s.
Definition: Actor.h:402
RoR::EngineSim::m_braking_torque
float m_braking_torque
Engine attribute.
Definition: EngineSim.h:180
RoR::EngineSim::m_tcase_ratio
float m_tcase_ratio
Engine.
Definition: EngineSim.h:185
RoR::EngineSim::m_ref_wheel_revolutions
float m_ref_wheel_revolutions
Gears; estimated wheel revolutions based on current vehicle speed along the longi....
Definition: EngineSim.h:160
RoR::EngineSim::UpdateEngineAudio
void UpdateEngineAudio()
Definition: EngineSim.cpp:791
RoR::EngineSim::SetEngineRpm
void SetEngineRpm(float rpm)
Set current engine RPM.
Definition: EngineSim.cpp:918
RoR::EngineSim::GetCrankFactor
float GetCrankFactor()
Definition: EngineSim.cpp:957
RoR::EngineSim::m_actor
ActorPtr m_actor
Definition: EngineSim.h:157
RoR::EngineSim::PushNetworkState
void PushNetworkState(float engine_rpm, float acc, float clutch, int gear, bool running, bool contact, char auto_mode, char auto_select=-1)
Sets current engine state;.
Definition: EngineSim.cpp:885
RoR::EngineSim::m_post_shift_clock
float m_post_shift_clock
Definition: EngineSim.h:205
RoR::node_t::Velocity
Ogre::Vector3 Velocity
Definition: SimData.h:295
RoR::EngineSim::setManualClutch
void setManualClutch(float val)
Definition: EngineSim.cpp:1189
RoR::EngineSim::isRunning
bool isRunning() const
Definition: EngineSim.h:93
RoR::EV_TRUCK_BRAKE_MODIFIER_50
@ EV_TRUCK_BRAKE_MODIFIER_50
brake with 50 percent pedal input
Definition: InputEngine.h:308
RoR::EngineSim::SetClutch
void SetClutch(float clutch)
Definition: EngineSim.cpp:970
RoR::EV_TRUCK_SHIFT_UP
@ EV_TRUCK_SHIFT_UP
shift one gear up in manual transmission mode
Definition: InputEngine.h:355
RoR::EngineSim::m_air_pressure
float m_air_pressure
Definition: EngineSim.h:197
RoR::EngineSim::shift
void shift(int val)
Changes gear by a relative offset. Plays sounds.
Definition: EngineSim.cpp:1087
RoR::EV_TRUCK_TOGGLE_CONTACT
@ EV_TRUCK_TOGGLE_CONTACT
toggle ignition
Definition: InputEngine.h:360
RoR::EngineSim::GetTurboPsi
float GetTurboPsi()
Definition: EngineSim.cpp:857
RoR::EngineSim::m_turbo_ver
int m_turbo_ver
Definition: EngineSim.h:228
RoR::EngineSim::m_hydropump_state
float m_hydropump_state
Engine.
Definition: EngineSim.h:187
RoR::EngineSim::GetGearRange
int GetGearRange()
low level gear changing
Definition: EngineSim.cpp:1052
RoR::EngineSim::MANUAL_RANGES
@ MANUAL_RANGES
Definition: EngineSim.h:153
RoR::EngineSim::m_engine_turbo_mode
int m_engine_turbo_mode
Engine attribute.
Definition: EngineSim.h:177
RoR::EngineSim::GetClutch
float GetClutch()
Definition: EngineSim.cpp:975
RoR::Actor::GetCameraDir
Ogre::Vector3 GetCameraDir()
Definition: Actor.h:266
RoR::EngineSim::m_num_turbos
int m_num_turbos
Definition: EngineSim.h:231
RoR::EngineSim::autoShiftSet
void autoShiftSet(int mode)
Definition: EngineSim.cpp:1157
RoR::EngineSim::ToggleAutoShiftMode
void ToggleAutoShiftMode()
Definition: EngineSim.cpp:818
RoR::Actor::ar_instance_id
ActorInstanceID_t ar_instance_id
Static attr; session-unique ID.
Definition: Actor.h:376
RoR::EngineSim::m_num_gears
int m_num_gears
Gears.
Definition: EngineSim.h:164
RoR::EngineSim::m_turbo_bov_rpm
float m_turbo_bov_rpm[MAXTURBO]
Definition: EngineSim.h:236
RoR::EngineSim::m_engine_has_air
bool m_engine_has_air
Engine attribute.
Definition: EngineSim.h:175
RoR::SS_TRIG_ENGINE
@ SS_TRIG_ENGINE
Definition: SoundScriptManager.h:54
RoR::EngineSim::m_min_wastegate_psi
float m_min_wastegate_psi
Definition: EngineSim.h:239
RoR::EngineSim::m_antilag_rand_chance
float m_antilag_rand_chance
Definition: EngineSim.h:245
RoR::EngineSim::m_shift_val
int m_shift_val
Definition: EngineSim.h:210
RoR::EngineSim::m_full_rpm_range
float m_full_rpm_range
Definition: EngineSim.h:216
RoR::EngineSim::m_cur_engine_rpm
float m_cur_engine_rpm
Engine.
Definition: EngineSim.h:182
RoR::EngineSim::m_kickdown_delay_counter
int m_kickdown_delay_counter
Definition: EngineSim.h:221
RoR::EngineSim::m_torque_curve
TorqueCurve * m_torque_curve
Definition: EngineSim.h:196
RoR::EV_TRUCK_SHIFT_GEAR01
@ EV_TRUCK_SHIFT_GEAR01
shift directly into this gear
Definition: InputEngine.h:332
RoR::SS_TRIG_TURBOBACKFIRE
@ SS_TRIG_TURBOBACKFIRE
Definition: SoundScriptManager.h:65
RoR::EngineSim::MANUAL
@ MANUAL
Definition: EngineSim.h:151
RoR::TRIGGER_EVENT_ASYNC
void TRIGGER_EVENT_ASYNC(scriptEvents type, int arg1, int arg2ex=0, int arg3ex=0, int arg4ex=0, std::string arg5ex="", std::string arg6ex="", std::string arg7ex="", std::string arg8ex="")
Asynchronously (via MSG_SIM_SCRIPT_EVENT_TRIGGERED) invoke script function eventCallbackEx(),...
Definition: ScriptEngine.h:51
RoR::Actor::ar_brake
Ogre::Real ar_brake
Physics state; braking intensity.
Definition: Actor.h:399
RoR::EngineSim::m_cur_gear_range
int m_cur_gear_range
Gears.
Definition: EngineSim.h:163
RoR::EngineSim::REAR
@ REAR
Definition: EngineSim.h:131
RoR::EngineSim::m_turbo_engine_rpm_operation
float m_turbo_engine_rpm_operation
Definition: EngineSim.h:234
RoR::Actor::RequestUpdateHudFeatures
void RequestUpdateHudFeatures()
Definition: Actor.h:270
RoR::EngineSim::m_rpms
std::deque< float > m_rpms
Definition: EngineSim.h:222
RoR::SS_TRIG_TURBOWASTEGATE
@ SS_TRIG_TURBOWASTEGATE
Definition: SoundScriptManager.h:64
RoR::EngineSim::m_turbo_wg_threshold_n
float m_turbo_wg_threshold_n
Definition: EngineSim.h:242
RoR::EngineSim::m_turbo_flutters
bool m_turbo_flutters
Definition: EngineSim.h:240
AppContext.h
System integration layer; inspired by OgreBites::ApplicationContext.
Console.h
RoR::EngineSim::autoswitch
autoswitch
Definition: EngineSim.h:129
RoR::EngineSim::updateShifts
void updateShifts()
Changes gears. Plays sounds.
Definition: EngineSim.cpp:1116
RoR::Console::putMessage
void putMessage(MessageArea area, MessageType type, std::string const &msg, std::string icon="")
Definition: Console.cpp:97
RoR::TorqueCurve
This class loads and processes a torque curve for a vehicle.
Definition: TorqueCurve.h:42
RoR::EV_TRUCK_SHIFT_DOWN
@ EV_TRUCK_SHIFT_DOWN
shift one gear down in manual transmission mode
Definition: InputEngine.h:331
RoR::EngineSim::SetAutoMode
void SetAutoMode(RoR::SimGearboxMode mode)
Definition: EngineSim.cpp:847
RoR::EV_TRUCK_BRAKE_MODIFIER_25
@ EV_TRUCK_BRAKE_MODIFIER_25
brake with 25 percent pedal input
Definition: InputEngine.h:307
RoR::EngineSim::m_cur_acc
float m_cur_acc
Engine.
Definition: EngineSim.h:181
approx_exp
float approx_exp(const float x)
Definition: ApproxMath.h:68
RoR::SS_MOD_GEARBOX
@ SS_MOD_GEARBOX
Definition: SoundScriptManager.h:134
RoR::EngineSim::m_engine_max_rpm
float m_engine_max_rpm
Engine attribute.
Definition: EngineSim.h:191
RoR::EngineSim::SetWheelSpin
void SetWheelSpin(float rpm)
Set current wheel spinning speed.
Definition: EngineSim.cpp:933
RoR::EngineSim::m_antilag_min_rpm
float m_antilag_min_rpm
Definition: EngineSim.h:244
RoR::EV_TRUCK_ACCELERATE_MODIFIER_50
@ EV_TRUCK_ACCELERATE_MODIFIER_50
accelerate with 50 percent pedal input
Definition: InputEngine.h:299
RoR::EngineSim::autoSetAcc
void autoSetAcc(float val)
Definition: EngineSim.cpp:1078
RoR::EngineSim::SetAcceleration
void SetAcceleration(float val)
Definition: EngineSim.cpp:852
RefCountingObjectPtr< Actor >
RoR::InputEngine::getEventValue
float getEventValue(int eventID, bool pure=false, InputSourceType valueSource=InputSourceType::IST_ANY)
valueSource: IST_ANY=digital and analog devices, IST_DIGITAL=only digital, IST_ANALOG=only analog
Definition: InputEngine.cpp:958
RoR::EV_TRUCK_ACCELERATE_MODIFIER_25
@ EV_TRUCK_ACCELERATE_MODIFIER_25
accelerate with 25 percent pedal input
Definition: InputEngine.h:298
RoR::EngineSim::TWO
@ TWO
Definition: EngineSim.h:134
RoR::SE_TRUCK_ENGINE_DIED
@ SE_TRUCK_ENGINE_DIED
triggered when the vehicle's engine dies (from underrev, water, etc), the argument refers to the acto...
Definition: ScriptEvents.h:38
ActorManager.h
RoR::EngineSim::m_engine_type
char m_engine_type
Engine attribute {'t' = truck (default), 'c' = car}.
Definition: EngineSim.h:179
Actor.h
RoR::EngineSim::m_turbo_has_wastegate
bool m_turbo_has_wastegate
Definition: EngineSim.h:238
RoR::SimGearboxMode
SimGearboxMode
Definition: Application.h:192
RoR::Console::CONSOLE_SYSTEM_NOTICE
@ CONSOLE_SYSTEM_NOTICE
Definition: Console.h:51
EngineSim.h
RoR::SS_MOD_INJECTOR
@ SS_MOD_INJECTOR
Definition: SoundScriptManager.h:132
RoR::SimGearboxMode::AUTO
@ AUTO
Automatic shift.
RoR::SS_TRIG_REVERSE_GEAR
@ SS_TRIG_REVERSE_GEAR
Definition: SoundScriptManager.h:99
RoR::EngineSim::~EngineSim
~EngineSim()
Definition: EngineSim.cpp:122
RoR::EngineSim::m_cur_clutch
float m_cur_clutch
Definition: EngineSim.h:170
RoR::EngineSim::UpdateEngineSim
void UpdateEngineSim(float dt, int doUpdate)
Definition: EngineSim.cpp:259
RoR::EngineSim::m_auto_cur_acc
float m_auto_cur_acc
Definition: EngineSim.h:215
RoR::EngineSim::getTurboPower
float getTurboPower()
Definition: EngineSim.cpp:1198
RoR::EngineSim::m_shifting
int m_shifting
Definition: EngineSim.h:209
RoR::EngineSim::m_engine_idle_rpm
float m_engine_idle_rpm
Engine attribute.
Definition: EngineSim.h:193
RoR::EngineSim::m_turbo_has_bov
bool m_turbo_has_bov
Definition: EngineSim.h:235
RoR::SimGearboxMode::MANUAL_STICK
@ MANUAL_STICK
Fully manual: stick shift.
RoR::EngineSim::getIdleMixture
float getIdleMixture()
Definition: EngineSim.cpp:1235
RoR::ToLocalizedString
std::string ToLocalizedString(SimGearboxMode e)
Definition: Application.cpp:440
RoR::EngineSim::DRIVE
@ DRIVE
Definition: EngineSim.h:133
RoR::EngineSim::MANUALMODE
@ MANUALMODE
Definition: EngineSim.h:136
RoR::EngineSim::m_one_third_rpm_range
float m_one_third_rpm_range
Definition: EngineSim.h:217
RoR::EngineSim::shiftmodes
shiftmodes
Definition: EngineSim.h:147
RoR::SS_MOD_TURBO
@ SS_MOD_TURBO
Definition: SoundScriptManager.h:126
RoR::EngineSim::SetTurboOptions
void SetTurboOptions(int type, float tinertiaFactor, int nturbos, float param1, float param2, float param3, float param4, float param5, float param6, float param7, float param8, float param9, float param10, float param11)
Sets turbo options.
Definition: EngineSim.cpp:129
RoR::SS_TRIG_AIR_PURGE
@ SS_TRIG_AIR_PURGE
Definition: SoundScriptManager.h:78
RAD_PER_SEC_TO_RPM
static const float RAD_PER_SEC_TO_RPM
Convert radian/second to RPM (60/2*PI)
Definition: SimConstants.h:37
RoR::EV_TRUCK_STARTER
@ EV_TRUCK_STARTER
hold to start the engine
Definition: InputEngine.h:356
RoR::EngineSim::m_engine_inertia
float m_engine_inertia
Engine attribute.
Definition: EngineSim.h:190
RoR::App::io_arcade_controls
CVar * io_arcade_controls
Definition: Application.cpp:198
RoR::EngineSim::m_post_shift_time
float m_post_shift_time
Shift attribute.
Definition: EngineSim.h:204
RoR::EngineSim::m_engine_min_rpm
float m_engine_min_rpm
Engine attribute.
Definition: EngineSim.h:192
ScriptEngine.h
RoR::EngineSim::SetTCaseRatio
void SetTCaseRatio(float ratio)
Set current transfer case gear (reduction) ratio.
Definition: EngineSim.cpp:938
TorqueCurve.h
torquecurve loader.
RoR::EngineSim::m_engine_stall_rpm
float m_engine_stall_rpm
Engine attribute.
Definition: EngineSim.h:194
RoR::EngineSim::m_upshift_delay_counter
int m_upshift_delay_counter
Definition: EngineSim.h:220
RoR::EngineSim::UpdateInputEvents
void UpdateInputEvents(float dt)
Definition: EngineSim.cpp:1263
RoR::EngineSim::GetTorque
float GetTorque()
Definition: EngineSim.cpp:913
RoR::EngineSim::ONE
@ ONE
Definition: EngineSim.h:135
RoR::EngineSim::m_cur_turbo_rpm
float m_cur_turbo_rpm[MAXTURBO]
Definition: EngineSim.h:229
RoR::EngineSim::GetAutoShiftMode
RoR::SimGearboxMode GetAutoShiftMode()
Definition: EngineSim.cpp:842
MAXTURBO
#define MAXTURBO
Definition: EngineSim.h:227
RoR::EngineSim::getNumGears
int getNumGears() const
Definition: EngineSim.h:99
SOUND_START
#define SOUND_START(_ACTOR_, _TRIG_)
Definition: SoundScriptManager.h:35
RoR::EngineSim::m_post_shifting
int m_post_shifting
Definition: EngineSim.h:208
RoR::EngineSim::m_engine_is_electric
bool m_engine_is_electric
Engine attribute.
Definition: EngineSim.h:174
RoR::EngineSim::m_auto_mode
int m_auto_mode
Transmission mode (.
Definition: EngineSim.h:213
RoR::InputEngine::getEventBoolValue
bool getEventBoolValue(int eventID)
Definition: InputEngine.cpp:757
RoR::EngineSim::hasContact
bool hasContact() const
Definition: EngineSim.h:127
RoR::App::GetConsole
Console * GetConsole()
Definition: Application.cpp:270
RoR::SimGearboxMode::SEMI_AUTO
@ SEMI_AUTO
Manual shift with auto clutch.
SoundScriptManager.h
RoR::EngineSim::m_max_idle_mixture
float m_max_idle_mixture
Engine attribute.
Definition: EngineSim.h:189
RoR::EngineSim::m_half_rpm_range
float m_half_rpm_range
Definition: EngineSim.h:218
RoR::EngineSim::m_shift_clock
float m_shift_clock
Definition: EngineSim.h:207
RoR::EV_TRUCK_SHIFT_HIGHRANGE
@ EV_TRUCK_SHIFT_HIGHRANGE
select high range (13-18) for H-shaft
Definition: InputEngine.h:351
RoR::EngineSim::SEMIAUTO
@ SEMIAUTO
Definition: EngineSim.h:150
RoR::Actor::getDirection
Ogre::Vector3 getDirection()
average actor velocity, calculated using the actor positions of the last two frames
Definition: Actor.cpp:418
SOUND_STOP
#define SOUND_STOP(_ACTOR_, _TRIG_)
Definition: SoundScriptManager.h:36
RoR::EngineSim::GetAccToHoldRPM
float GetAccToHoldRPM()
estimate required throttle input to hold the current rpm
Definition: EngineSim.cpp:1072
RoR::EngineSim::m_min_idle_mixture
float m_min_idle_mixture
Engine attribute.
Definition: EngineSim.h:188
RoR::EngineSim::SetGear
void SetGear(int v)
low level gear changing
Definition: EngineSim.cpp:1047
frand
float frand()
Definition: ApproxMath.h:31
RoR::EngineSim::GetGear
int GetGear()
low level gear changing
Definition: EngineSim.cpp:1041
ApproxMath.h
RoR::SS_TRIG_TURBOBOV
@ SS_TRIG_TURBOBOV
Definition: SoundScriptManager.h:63
RoR::EV_TRUCK_SWITCH_SHIFT_MODES
@ EV_TRUCK_SWITCH_SHIFT_MODES
toggle between transmission modes
Definition: InputEngine.h:359
RoR::EngineSim::m_starter
bool m_starter
Ignition switch is in START position.
Definition: EngineSim.h:201
RoR::EngineSim::SetEngineOptions
void SetEngineOptions(float einertia, char etype, float eclutch, float ctime, float stime, float pstime, float irpm, float srpm, float maximix, float minimix, float ebraking)
Sets engine options.
Definition: EngineSim.cpp:197
RoR::SimGearboxMode::MANUAL
@ MANUAL
Fully manual: sequential shift.
SOUND_MODULATE
#define SOUND_MODULATE(_ACTOR_, _MOD_, _VALUE_)
Definition: SoundScriptManager.h:40
RoR::EngineSim::NEW
@ NEW
Definition: EngineSim.h:142
RoR::EngineSim::m_cur_wheel_revolutions
float m_cur_wheel_revolutions
Gears; measured wheel revolutions.
Definition: EngineSim.h:161
RoR::EngineSim::toggleContact
void toggleContact()
Definition: EngineSim.cpp:985
RoR::EngineSim::AUTOMATIC
@ AUTOMATIC
Definition: EngineSim.h:149
RoR::EngineSim::StopEngine
void StopEngine()
stall engine
Definition: EngineSim.cpp:1062
RoR::wheel_t::wh_radius
Ogre::Real wh_radius
Definition: SimData.h:442
RoR::EV_TRUCK_ACCELERATE
@ EV_TRUCK_ACCELERATE
accelerate the truck
Definition: InputEngine.h:297
RoR::EngineSim::autoShiftUp
void autoShiftUp()
Definition: EngineSim.cpp:1165
RoR::EngineSim::OLD
@ OLD
Definition: EngineSim.h:141
RoR::EV_TRUCK_MANUAL_CLUTCH
@ EV_TRUCK_MANUAL_CLUTCH
manual clutch (for manual transmission)
Definition: InputEngine.h:326
RoR::EngineSim::GetSmoke
float GetSmoke()
Definition: EngineSim.cpp:903
RoR::Actor::ar_nodes
node_t * ar_nodes
Definition: Actor.h:279
RoR::EngineSim::m_engine_has_turbo
bool m_engine_has_turbo
Engine attribute.
Definition: EngineSim.h:176
RoR::EngineSim::m_turbo_inertia_factor
float m_turbo_inertia_factor
Definition: EngineSim.h:230
RoR::EngineSim::getAutoShift
int getAutoShift()
Definition: EngineSim.cpp:1184
RoR::EngineSim::m_autoselect
autoswitch m_autoselect
Definition: EngineSim.h:214
RoR::SS_TRIG_SHIFT
@ SS_TRIG_SHIFT
Definition: SoundScriptManager.h:79
_L
#define _L
Definition: ErrorUtils.cpp:34
RoR::EngineSim::m_cur_clutch_torque
float m_cur_clutch_torque
Definition: EngineSim.h:171
SOUND_PLAY_ONCE
#define SOUND_PLAY_ONCE(_ACTOR_, _TRIG_)
Definition: SoundScriptManager.h:34
RoR::TorqueCurve::getEngineTorque
Ogre::Real getEngineTorque(Ogre::Real rpm)
Returns the calculated engine torque based on the given RPM, interpolating the torque curve spline.
Definition: TorqueCurve.cpp:44
RoR::EngineSim::StartEngine
void StartEngine()
Quick engine start. Plays sounds.
Definition: EngineSim.cpp:998
RoR::SS_TRIG_GEARSLIDE
@ SS_TRIG_GEARSLIDE
Definition: SoundScriptManager.h:80
RoR::EngineSim::m_engine_is_priming
bool m_engine_is_priming
Engine.
Definition: EngineSim.h:195
RoR::App::GetInputEngine
InputEngine * GetInputEngine()
Definition: Application.cpp:271
RoR::EngineSim::m_cur_gear
int m_cur_gear
Gears; Current gear {-1 = reverse, 0 = neutral, 1...21 = forward}.
Definition: EngineSim.h:162
RoR::EngineSim::m_diff_ratio
float m_diff_ratio
Engine.
Definition: EngineSim.h:184
RoR::EngineSim::GetAcceleration
float GetAcceleration()
Definition: EngineSim.cpp:880
RoR::EngineSim::m_gear_ratios
std::vector< float > m_gear_ratios
Gears.
Definition: EngineSim.h:165
RoR::EngineSim::OffStart
void OffStart()
Quick start of vehicle engine.
Definition: EngineSim.cpp:1016
RoR::EV_TRUCK_AUTOSHIFT_UP
@ EV_TRUCK_AUTOSHIFT_UP
shift automatic transmission one gear up
Definition: InputEngine.h:302
RoR::SimGearboxMode::MANUAL_RANGES
@ MANUAL_RANGES
Fully manual: stick shift with ranges.
InputEngine.h
Handles controller inputs from player. Defines input events and binding mechanism,...
Ogre
Definition: ExtinguishableFireAffector.cpp:35
RoR::EngineSim::shiftTo
void shiftTo(int val)
Changes gear to given value. Plays sounds.
Definition: EngineSim.cpp:1111
RoR::EngineSim::m_clutch_force
float m_clutch_force
Clutch attribute.
Definition: EngineSim.h:168
RoR::SS_MOD_ENGINE
@ SS_MOD_ENGINE
Definition: SoundScriptManager.h:125
RoR::EngineSim::m_min_bov_psi
int m_min_bov_psi
Definition: EngineSim.h:237
RoR::Console::CONSOLE_MSGTYPE_INFO
@ CONSOLE_MSGTYPE_INFO
Generic message.
Definition: Console.h:60
RoR::EngineSim::m_contact
bool m_contact
Ignition switch is in ON/RUN position.
Definition: EngineSim.h:200
RoR::EV_TRUCK_AUTOSHIFT_DOWN
@ EV_TRUCK_AUTOSHIFT_DOWN
shift automatic transmission one gear down
Definition: InputEngine.h:301
RoR::EngineSim::getEnginePower
float getEnginePower()
Definition: EngineSim.h:107
RoR::EngineSim::m_shift_behaviour
float m_shift_behaviour
Definition: EngineSim.h:219
RoR::EngineSim::GetClutchForce
float GetClutchForce()
Definition: EngineSim.cpp:980
RoR::Actor::ar_wheels
wheel_t ar_wheels[MAX_WHEELS]
Definition: Actor.h:323
RoR::EngineSim::getNumGearsRanges
int getNumGearsRanges() const
Definition: EngineSim.h:100
RoR::SS_TRIG_IGNITION
@ SS_TRIG_IGNITION
Definition: SoundScriptManager.h:98
RoR::EngineSim::m_antilag_power_factor
float m_antilag_power_factor
Definition: EngineSim.h:246
RoR::Actor::getGForces
Ogre::Vector3 getGForces()
Definition: Actor.h:86
RoR::EngineSim::getPrimeMixture
float getPrimeMixture()
Definition: EngineSim.cpp:1242
RoR::EngineSim::m_engine_addi_torque
float m_engine_addi_torque[MAXTURBO]
Definition: EngineSim.h:233
RoR::EngineSim::m_accs
std::deque< float > m_accs
Definition: EngineSim.h:223
RoR::EngineSim::NEUTRAL
@ NEUTRAL
Definition: EngineSim.h:132
RoR::EngineSim::SetHydroPumpWork
void SetHydroPumpWork(float work)
Set current hydro pump work.
Definition: EngineSim.cpp:928
RoR::EngineSim::m_clutch_time
float m_clutch_time
Clutch attribute.
Definition: EngineSim.h:169
RoR::EngineSim::autoShiftDown
void autoShiftDown()
Definition: EngineSim.cpp:1174
RoR::EV_TRUCK_SHIFT_NEUTRAL
@ EV_TRUCK_SHIFT_NEUTRAL
shift to neutral gear in manual transmission mode
Definition: InputEngine.h:354
RoR::EngineSim::SetGearRange
void SetGearRange(int v)
low level gear changing
Definition: EngineSim.cpp:1057
RoR
Definition: AppContext.h:36
RoR::SS_MOD_TORQUE
@ SS_MOD_TORQUE
Definition: SoundScriptManager.h:133
RoR::EngineSim::m_turbo_wg_threshold_p
float m_turbo_wg_threshold_p
Definition: EngineSim.h:241
RoR::EngineSim::m_shift_time
float m_shift_time
Shift attribute.
Definition: EngineSim.h:206
RoR::EngineSim::m_max_turbo_rpm
int m_max_turbo_rpm
Definition: EngineSim.h:232
RoR::EV_TRUCK_BRAKE
@ EV_TRUCK_BRAKE
brake
Definition: InputEngine.h:306
RoR::EngineSim::m_turbo_has_antilag
bool m_turbo_has_antilag
Definition: EngineSim.h:243
RoR::SS_TRIG_STARTER
@ SS_TRIG_STARTER
Definition: SoundScriptManager.h:62
RoR::EngineSim::m_cur_engine_torque
float m_cur_engine_torque
Engine.
Definition: EngineSim.h:183
RoR::EngineSim::SetEnginePriming
void SetEnginePriming(bool p)
Set current engine prime.
Definition: EngineSim.cpp:923
RoR::EngineSim::m_brakes
std::deque< float > m_brakes
Definition: EngineSim.h:224
RoR::EV_TRUCK_SHIFT_GEAR_REVERSE
@ EV_TRUCK_SHIFT_GEAR_REVERSE
shift directly into this gear
Definition: InputEngine.h:350
RoR::EngineSim::m_engine_is_running
bool m_engine_is_running
Engine state.
Definition: EngineSim.h:178
RoR::EngineSim::m_engine_torque
float m_engine_torque
Engine attribute.
Definition: EngineSim.h:186
RoR::EV_TRUCK_SHIFT_LOWRANGE
@ EV_TRUCK_SHIFT_LOWRANGE
select low range (1-6) for H-shaft
Definition: InputEngine.h:352
RoR::EV_TRUCK_SHIFT_MIDRANGE
@ EV_TRUCK_SHIFT_MIDRANGE
select middle range (7-12) for H-shaft
Definition: InputEngine.h:353