home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright 1992-1993, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- //////////////////////////////////////////////////////////////////////
- // Engine.h - definition of the engine class
- //
- // Actually, encompasses entire drivetrain.
- //////////////////////////////////////////////////////////////////////
-
- #ifndef ENGINE_H
- #define ENGINE_H
-
- #include "Defines.h"
-
- class Car;
- class Noise;
- class sample;
-
- const int MAX_GEARS = 7; // five plus neutral, reverse
-
- class Engine {
-
- public:
-
- Engine(Car *);
- ~Engine();
-
- void reset_all();
-
- // XXX should this depend on velocity?
- float get_yaw_per_steering() const { return _yaw_per_steering; };
-
- int get_max_speed() const { return _max_speed; };
- int get_rpm() const { return _rpm; };
- int get_max_rpm() const { return _max_rpm; };
- int get_redline() const { return _redline; };
-
- Boolean revving() const;
-
- int get_gear() const { return _gear; };
- void set_gear(int g) { _gear = g; };
- void upshift();
- void downshift();
- float get_ratio() const { return _ratio[_gear]; };
-
- float get_max_gas() const { return _max_fuel; };
- float get_gas() const { return _fuel; };
-
- float get_max_temp() const { return _max_temp; };
- float get_temp() const { return _temp; };
-
- float get_max_oil() const { return _max_oil; };
- float get_oil() const { return _oil; };
-
- float get_tire_diam() const { return _tire_diam; };
-
- void crank(Boolean ignition);
- void stall(Boolean noise);
-
- void set_sound(Boolean b);
-
- void update();
-
- protected:
-
- Car * _car; // car that this engine is in
-
- // 0 is neutral, -1 is reverse
- int _gear;
- float _ratio[MAX_GEARS];
-
- // Change in yaw per change in steering wheel
- float _yaw_per_steering;
-
- int _max_speed;
-
- int _rpm, _max_rpm, _redline, _idle, _stall;
- int _compression; // revolutions lost per second
- int _rpm_per_gas; // revolutions gained per second due to gas
-
- Boolean _running; // TRUE if the engine is running
-
- float _max_fuel, _fuel;
- float _mileage;
-
- float _max_temp, _temp;
- float _max_oil, _oil;
-
- float _tire_diam;
-
- Noise * _revving_noise;
- sample * _starting_noise;
- sample * _cranking_noise;
- sample * _caf_caf;
-
- };
-
- #endif
-