home *** CD-ROM | disk | FTP | other *** search
/ Cutting-Edge 3D Game Programming with C++ / CE3DC++.ISO / BOOK / CHAP12 / MONSTER.HPP < prev    next >
C/C++ Source or Header  |  1996-01-24  |  1KB  |  53 lines

  1. //
  2. // File name: Monster.HPP
  3. //
  4. // Description: A monster object
  5. //
  6. // Author: John De Goes
  7. //
  8. // Project: Cutting Edge 3D Game Programming
  9. //
  10.  
  11. #ifndef MONSTERHPP
  12. #define MONSTERHPP
  13.  
  14. #include "Point3D.HPP"
  15. #include "Matrix3D.HPP"
  16. #include "3DClass.HPP"
  17. #include "BMP32.HPP"
  18.  
  19. class Monster {
  20. protected:
  21.   BMPImage *Frame;
  22.   int FrameNum, FrameCount, Width, Height, Health;
  23.   Point3D Pos, Dir;
  24. public:
  25.   enum { ASCII, Binary };
  26.   Monster ( float Sx, float Sy, float Sz, char *IniFile,
  27.             int Mode = ASCII );
  28.   ~Monster () { delete [] Frame; }
  29.   Monster &operator = ( int FN )
  30.      {
  31.      if ( ( FN >= 0 ) && ( FN < FrameCount ) )
  32.         FrameNum = FN;
  33.      return *this;
  34.      }
  35.   int GetHealth () { return Health; }
  36.   int SetHealth () { return Health; }
  37.  
  38.   BOOL Show ( Matrix3D &M, BYTE *Dest );
  39.   float GetX () { return Pos.Wx; }
  40.   float GetY () { return Pos.Wy; }
  41.   float GetZ () { return Pos.Wz; }
  42.   float Dist ()
  43.       {
  44.       float Mag = sqrt ( Pos.Wx * Pos.Wx +
  45.                          Pos.Wy * Pos.Wy +
  46.                          Pos.Wz * Pos.Wz );
  47.       return Mag;
  48.       }
  49.   void MoveToward ( float Tx, float Ty, float Tz, float Steps,
  50.                     Matrix3D &M );
  51. };
  52.  
  53. #endif