home *** CD-ROM | disk | FTP | other *** search
/ Game Programming in C++ - Start to Finish / GameProgrammingS.iso / developer_install / ReplicaNetFreewareV5_4.exe / data1.cab / Program_Executable_Files / Example4 / Plane.h < prev    next >
Encoding:
C/C++ Source or Header  |  2005-10-30  |  2.1 KB  |  108 lines

  1. /* START_LICENSE_HEADER
  2.  
  3. Copyright (C) 2000 Martin Piper, original design and program code
  4. Copyright (C) 2001-2005 Replica Software
  5.  
  6. This program file is copyright (C) Replica Software and can only be used under license.
  7. For more information visit: http://www.replicanet.com/
  8. Or email: info@replicanet.com
  9.  
  10. END_LICENSE_HEADER */
  11. /*
  12. See Plane.cpp
  13. */
  14. #ifndef __PLANE_H__
  15. #define __PLANE_H__
  16.  
  17. #include "d3dfile.h"
  18.  
  19. #include "GameObject.h"
  20. #include "Shadow.h"
  21.  
  22. #include "_RO_Plane.h"
  23.  
  24. class Plane : _RO_DO_PUBLIC_RO(Plane) , public GameObject
  25. {
  26. public:
  27.     Plane();
  28.     virtual ~Plane();
  29.  
  30.     virtual void PostObjectCreate(void);
  31.  
  32.     void Render(void);
  33.  
  34.     void PollIt(void);
  35.  
  36.     bool GetPosition(D3DXVECTOR4 &input)
  37.     {
  38.         input = mPosition;
  39.         return true;
  40.     }
  41.  
  42.     D3DXVECTOR4 GetPosition(void)
  43.     {
  44.         return mPosition;
  45.     }
  46.  
  47.     void SetPosition(D3DXVECTOR4 pos)
  48.     {
  49.         mPosition = pos;
  50.         GiveDeltaHint(mPosition.x,0);
  51.         GiveDeltaHint(mPosition.y,0);
  52.         GiveDeltaHint(mPosition.z,0);
  53.     }
  54.  
  55.     D3DXVECTOR4 GetRotation(void)
  56.     {
  57.         return mRotation;
  58.     }
  59.  
  60.     void SetRotation(D3DXVECTOR4 rot)
  61.     {
  62.         mRotation = rot;
  63.     }
  64.  
  65.     CD3DMesh *mMesh;
  66.     ShadowVolume *mShadow;
  67.     D3DXMATRIX    m_matObjectMatrix;
  68.  
  69.     float GetSpeed(void)
  70.     {
  71.         return mSpeed;
  72.     }
  73.  
  74.     void SetSpeed(float speed)
  75.     {
  76.         mSpeed = speed;
  77.     }
  78.  
  79.     void *GetOpaquePointer(void *data = 0)
  80.     {
  81.         return (GameObject *)(this);
  82.     }
  83.  
  84.     /*
  85.     This callback is used by the distance based prediction to calculate the distance to another object in our game
  86.     */
  87.     float CalculateDistanceToObject(RNReplicaNet::ReplicaObject *object)
  88.     {
  89.         // Since the OpaquePointer is always the GameObject pointer for each object we can do this cast safely
  90.         GameObject *gameobject = (GameObject *) object->GetOpaquePointer();
  91.         return GameObject::CalculateDistanceToObject(gameobject);
  92.     }
  93.  
  94. /* These variables are defined in the ROL file for this object */
  95. private:
  96. _RO_DO_ALLOW_FRIEND_RO(Plane);
  97.     D3DXVECTOR4 mPosition;
  98.     D3DXVECTOR4 mRotation;
  99.  
  100.     int mPlayerNumber;
  101.     int mPlayerColour;
  102.     float mPlayerEnergy;
  103.  
  104.     float mSpeed;
  105. };
  106.  
  107. #endif
  108.