home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / demos / audio / drive / Engine.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  2.7 KB  |  112 lines

  1. /*
  2.  * Copyright 1992-1993, 1994, Silicon Graphics, Inc.
  3.  * All Rights Reserved.
  4.  *
  5.  * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6.  * the contents of this file may not be disclosed to third parties, copied or
  7.  * duplicated in any form, in whole or in part, without the prior written
  8.  * permission of Silicon Graphics, Inc.
  9.  *
  10.  * RESTRICTED RIGHTS LEGEND:
  11.  * Use, duplication or disclosure by the Government is subject to restrictions
  12.  * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13.  * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14.  * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15.  * rights reserved under the Copyright Laws of the United States.
  16.  */
  17. //////////////////////////////////////////////////////////////////////
  18. // Engine.h - definition of the engine class
  19. //
  20. // Actually, encompasses entire drivetrain.
  21. //////////////////////////////////////////////////////////////////////
  22.  
  23. #ifndef ENGINE_H
  24. #define ENGINE_H
  25.  
  26. #include "Defines.h"
  27.  
  28. class Car;
  29. class Noise;
  30. class sample;
  31.  
  32. const int MAX_GEARS = 7; // five plus neutral, reverse
  33.  
  34. class Engine {
  35.  
  36. public:
  37.  
  38.     Engine(Car *);
  39.     ~Engine();
  40.  
  41.     void reset_all();
  42.     
  43.     // XXX should this depend on velocity?
  44.     float get_yaw_per_steering() const { return _yaw_per_steering; };
  45.  
  46.     int get_max_speed() const { return _max_speed; };
  47.     int get_rpm() const { return _rpm; };
  48.     int get_max_rpm() const { return _max_rpm; };
  49.     int get_redline() const { return _redline; };
  50.  
  51.     Boolean revving() const;
  52.     
  53.     int get_gear() const { return _gear; };
  54.     void set_gear(int g) { _gear = g; };
  55.     void upshift();
  56.     void downshift();
  57.     float get_ratio() const { return _ratio[_gear]; };
  58.  
  59.     float get_max_gas() const { return _max_fuel; };
  60.     float get_gas() const { return _fuel; };
  61.  
  62.     float get_max_temp() const { return _max_temp; };
  63.     float get_temp() const { return _temp; };
  64.     
  65.     float get_max_oil() const { return _max_oil; };
  66.     float get_oil() const { return _oil; };
  67.  
  68.     float get_tire_diam() const { return _tire_diam; };
  69.  
  70.     void crank(Boolean ignition);
  71.     void stall(Boolean noise);
  72.     
  73.     void set_sound(Boolean b);
  74.     
  75.     void update();
  76.  
  77. protected:
  78.  
  79.     Car * _car; // car that this engine is in
  80.     
  81.     // 0 is neutral, -1 is reverse
  82.     int _gear;
  83.     float _ratio[MAX_GEARS];
  84.     
  85.     // Change in yaw per change in steering wheel
  86.     float _yaw_per_steering;
  87.     
  88.     int _max_speed;
  89.  
  90.     int _rpm, _max_rpm, _redline, _idle, _stall;
  91.     int _compression; // revolutions lost per second
  92.     int _rpm_per_gas; // revolutions gained per second due to gas
  93.  
  94.     Boolean _running; // TRUE if the engine is running
  95.  
  96.     float _max_fuel, _fuel;
  97.     float _mileage;
  98.  
  99.     float _max_temp, _temp;
  100.     float _max_oil, _oil;
  101.  
  102.     float _tire_diam;
  103.  
  104.     Noise * _revving_noise;
  105.     sample * _starting_noise;
  106.     sample * _cranking_noise;
  107.     sample * _caf_caf;
  108.  
  109. };
  110.  
  111. #endif
  112.