Revision: 2656
http://rigsofrods.svn.sourceforge.net/rigsofrods/?rev=2656&view=rev
Author: ulteq
Date: 2012-05-24 23:55:18 +0000 (Thu, 24 May 2012)
Log Message:
-----------
-Codechanged: continued cleanup in BeamEngine
Modified Paths:
--------------
trunk/source/main/gameplay/BeamEngine.cpp
trunk/source/main/gameplay/BeamEngine.h
Modified: trunk/source/main/gameplay/BeamEngine.cpp
===================================================================
--- trunk/source/main/gameplay/BeamEngine.cpp 2012-05-24 23:39:49 UTC (rev
2655)
+++ trunk/source/main/gameplay/BeamEngine.cpp 2012-05-24 23:55:18 UTC (rev
2656)
@@ -104,7 +104,7 @@
{
if (hasair)
{
- //air pressure
+ // air pressure
apressure += dt * curEngineRPM;
if (apressure > 50000.0f)
{
@@ -439,7 +439,7 @@
return curAcc;
}
-//this is mainly for smoke...
+// this is mainly for smoke...
void BeamEngine::netForceSettings(float rpm, float force, float clutch, int
gear, bool _running, bool _contact, char _automode)
{
curEngineRPM = rpm;
@@ -504,43 +504,44 @@
contact=!contact;
#ifdef USE_OPENAL
if (contact)
+ {
SoundScriptManager::getSingleton().trigStart(trucknum,
SS_TRIG_IGNITION);
- else
+ } else
+ {
SoundScriptManager::getSingleton().trigStop(trucknum,
SS_TRIG_IGNITION);
+ }
#endif // USE_OPENAL
}
-//quick start
+// quick start
void BeamEngine::start()
{
if (automode == AUTOMATIC)
{
- curGear=1;
+ curGear = 1;
autoselect=DRIVE;
- }
- else
+ } else
{
if (automode == SEMIAUTO)
{
- curGear=1;
- }
- else
+ curGear = 1;
+ } else
{
- curGear=0;
+ curGear = 0;
}
autoselect=MANUALMODE;
}
- curClutch=0;
- curEngineRPM=750.0f;
- curGearboxRPM=750.0f;
- curClutchTorque=0.0f;
- curTurboRPM=0.0f;
- apressure=0.0f;
- running=1;
- contact=1;
+ curClutch = 0.0f;
+ curEngineRPM = 750.0f;
+ curGearboxRPM = 750.0f;
+ curClutchTorque = 0.0f;
+ curTurboRPM = 0.0f;
+ apressure = 0.0f;
+ running = 1;
+ contact = 1;
#ifdef USE_OPENAL
SoundScriptManager::getSingleton().trigStart(trucknum,
SS_TRIG_IGNITION);
- setAcc(0);
+ setAcc(0.0f);
SoundScriptManager::getSingleton().trigStart(trucknum, SS_TRIG_ENGINE);
#endif // USE_OPENAL
}
@@ -573,7 +574,7 @@
return curGear;
}
-//low level gear changing
+// low level gear changing
void BeamEngine::setGear(int v)
{
curGear = v;
@@ -594,7 +595,7 @@
if (!running) return;
running = 0;
- //Script Event - engine death
+ // Script Event - engine death
TRIGGER_EVENT(SE_TRUCK_ENGINE_DIED, trucknum);
#ifdef USE_OPENAL
SoundScriptManager::getSingleton().trigStop(trucknum, SS_TRIG_ENGINE);
Modified: trunk/source/main/gameplay/BeamEngine.h
===================================================================
--- trunk/source/main/gameplay/BeamEngine.h 2012-05-24 23:39:49 UTC (rev
2655)
+++ trunk/source/main/gameplay/BeamEngine.h 2012-05-24 23:55:18 UTC (rev
2656)
@@ -31,37 +31,34 @@
BeamEngine(float iddle, float max, float torque, std::vector<float>
gears, float diff, int trucknum);
~BeamEngine();
- float getRPM();
- void setOptions(float einertia, char etype, float eclutch, float ctime,
float stime, float pstime);
- void setRPM(float value);
- void update(float dt, int doUpdate);
- void updateAudio(int doUpdate);
-
- int getAutoMode();
- void setAutoMode(int mode);
- void toggleAutoMode();
-
float getAcc();
+ float getClutch();
+ float getClutchForce();
+ float getCrankFactor();
+ float getRPM();
float getSmoke();
float getTorque();
float getTurboPSI();
+ int getAutoMode();
+
void netForceSettings(float rpm, float force, float clutch, int gear,
bool running, bool contact, char automode);
+
void setAcc(float val);
+ void setAutoMode(int mode);
+ void setClutch(float clutch);
+ void setOptions(float einertia, char etype, float eclutch, float ctime,
float stime, float pstime);
+ void setRPM(float value);
void setSpin(float rpm);
- // for hydros acceleration
- float getClutch();
- float getClutchForce();
- float getCrankFactor();
- void setClutch(float clutch);
+ void toggleAutoMode();
void toggleContact();
- //quick start
+ // quick start
void offstart();
void setstarter(int v);
void start();
- //low level gear changing
+ // low level gear changing
int getGear();
int getGearRange();
void setGear(int v);
@@ -80,7 +77,7 @@
float getMaxRPM() { return maxRPM; };
int getAutoShift();
size_t getNumGears() { return gearsRatio.size() - 2; };
- size_t getNumGearsRanges() {return getNumGears()/6+1; }
+ size_t getNumGearsRanges() {return getNumGears() / 6 + 1; }
TorqueCurve *getTorqueCurve() { return torqueCurve; };
void autoSetAcc(float val);
void autoShiftDown();
@@ -91,26 +88,14 @@
void shiftTo(int val);
void updateShifts();
+ void update(float dt, int doUpdate);
+ void updateAudio(int doUpdate);
+
enum shiftmodes {AUTOMATIC, SEMIAUTO, MANUAL, MANUAL_STICK,
MANUAL_RANGES};
enum autoswitch {REAR, NEUTRAL, DRIVE, TWO, ONE, MANUALMODE};
protected:
- float iddleRPM;
- float maxRPM;
- float stallRPM;
- float brakingTorque;
- float engineTorque;
-
- bool hasturbo;
- bool hasair;
- char type;
- int running;
- int contact;
- float hydropump;
- int prime;
-
-
// gear stuff
float curGearboxRPM;
int curGear;
@@ -125,9 +110,21 @@
float curClutchTorque;
// engine stuff
+ bool hasair;
+ bool hasturbo;
+ char type;
+ float brakingTorque;
float curAcc;
float curEngineRPM;
+ float engineTorque;
+ float hydropump;
+ float iddleRPM;
float inertia;
+ float maxRPM;
+ float stallRPM;
+ int contact;
+ int prime;
+ int running;
// shifting
float post_shift_time;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Rigsofrods-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rigsofrods-devel