home *** CD-ROM | disk | FTP | other *** search
/ PC Format (South-Africa) 2001 June / PCFJune.iso / Xenon / XenonSource.exe / demo4 / ship.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-09-12  |  1.5 KB  |  72 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.  
  21. //-------------------------------------------------------------
  22.  
  23. const int SHIP_CENTRE_FRAME = 3;        // ship centred frame
  24. const int SHIP_ROLL_FRAMES = 3;            // frame range for roll i.e. -3..+3 from centre
  25.  
  26. const float SHIP_ROLL_RATE = 10.f;        // frames per seconds
  27. const int SHIP_MAP_HIT = 0;            // energy lost if ship hits map
  28.  
  29. //-------------------------------------------------------------
  30.  
  31. class CShip : public CActor
  32. {
  33.     private:
  34.         CWeapon *m_weapon;
  35.  
  36.         WeaponType m_weapon_type;
  37.  
  38.         float m_max_speed;
  39.         float m_acceleration;
  40.         float m_damping;        
  41.  
  42.         int m_roll;
  43.  
  44.     public:
  45.         CShip();
  46.         ~CShip();
  47.         const ActorInfo& getActorInfo() { return ActorInfoList[INFO_SHIP]; };
  48.  
  49.         bool activate();
  50.         void kill();
  51.  
  52.         void explode();
  53.  
  54.         bool update(Controls *controls);
  55.  
  56.         gsCRect getCollisionRect();
  57.  
  58.         void registerHit(int energy,CActor *hitter);
  59.  
  60.         void onCollisionWithActor(CActor *actor);
  61.         void onCollisionWithMap(gsCMap *map,int hits);
  62.  
  63.         void setWeapon(WeaponType type,WeaponGrade grade = WEAPON_STANDARD);
  64.  
  65.         WeaponType getWeaponType();
  66. };
  67.  
  68. //-------------------------------------------------------------
  69.  
  70. #endif
  71.  
  72.