home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / XenonSource.exe / demo2 / ship.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-13  |  1.7 KB  |  79 lines

  1. //-------------------------------------------------------------
  2. //
  3. // Class:    Player's Ship
  4. //
  5. // Author:    John M Phillips
  6. //
  7. // Started:    06/05/00
  8. //
  9. // Base:    CActor
  10. //
  11. // Derived:    None
  12. //
  13. //-------------------------------------------------------------
  14.  
  15. #ifndef _INCLUDE_SHIP_H
  16. #define _INCLUDE_SHIP_H
  17.  
  18. #include "actor.h"
  19. #include "weapon.h"
  20. #include "shipengine.h"
  21. #include "retroengine.h"
  22.  
  23. //-------------------------------------------------------------
  24.  
  25. const int SHIP_CENTRE_FRAME = 3;        // ship centred frame
  26. const int SHIP_ROLL_FRAMES = 3;            // frame range for roll i.e. -3..+3 from centre
  27.  
  28. const float SHIP_ROLL_RATE = 10.f;        // frames per seconds
  29. const int SHIP_MAP_HIT = 0;            // energy lost if ship hits map
  30.  
  31. //-------------------------------------------------------------
  32.  
  33. class CShip : public CActor
  34. {
  35.     private:
  36.         CWeapon *m_weapon;
  37.         WeaponType m_weapon_type;
  38.  
  39.         CShipEngine *m_left_engine;
  40.         CShipEngine *m_right_engine;
  41.         CRetroEngine *m_retro_nw;
  42.         CRetroEngine *m_retro_ne;
  43.         CRetroEngine *m_retro_sw;
  44.         CRetroEngine *m_retro_se;
  45.  
  46.         float m_max_speed;
  47.         float m_acceleration;
  48.         float m_damping;        
  49.  
  50.         int m_roll;
  51.  
  52.     public:
  53.         CShip();
  54.         ~CShip();
  55.         const ActorInfo& getActorInfo() { return ActorInfoList[INFO_SHIP]; };
  56.  
  57.         bool activate();
  58.         void kill();
  59.  
  60.         void explode();
  61.  
  62.         bool update(Controls *controls);
  63.  
  64.         gsCRect getCollisionRect();
  65.  
  66.         void registerHit(int energy,CActor *hitter);
  67.  
  68.         void onCollisionWithActor(CActor *actor);
  69.  
  70.         void setWeapon(WeaponType type,WeaponGrade grade = WEAPON_STANDARD);
  71.  
  72.         WeaponType getWeaponType();
  73. };
  74.  
  75. //-------------------------------------------------------------
  76.  
  77. #endif
  78.  
  79.