Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

playerclnt.h

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------- //
00002 //
00003 // MODULE  : playerclnt.h
00004 //
00005 // PURPOSE : CPlayerClnt object class - Definition
00006 //
00007 // CREATED : 02/11/01
00008 //
00009 // (c) 2001 LithTech, Inc.  All Rights Reserved
00010 //
00011 // ----------------------------------------------------------------------- //
00012 
00013 #ifndef __PLAYER_CLNT_H__
00014 #define __PLAYER_CLNT_H__
00015 
00016 
00017 // Definitions of classes
00018 #include "camera.h"
00019 #include "i_event_callback.h"
00020 
00021 // Engine includes
00022 #include <ltengineobjectsclient.h>
00023 #include <autoview/autoview.h>
00024 
00026 class LTCollisionSphere;
00027 
00028 
00030 enum EPlayerState
00031 {
00032     PLS_WALK = 0,
00033     PLS_SPECTATOR,
00034     PLS_SPECTATOR_NOSLIDE,
00035     PLS_SPECTATOR_NOCLIP,
00036     PLS_HEAVY_BALL,
00037     PLS_BOUNCY_BALL,
00038 
00039     PLS_NUM_STATES
00040 };
00041 
00042 
00044 class CPlayerClnt : public BaseClassClient, public IEventCallback
00045 {
00046 public:
00047     // Construction / destruction
00048     CPlayerClnt();
00049     virtual ~CPlayerClnt();
00050 
00051     distr_class(CPlayerClnt);
00052 
00053     // Called when server updates the associated values
00054     virtual void    RemotePositionUpdate(LTVector3f& newPosition);
00055     virtual void    RemoteRotationUpdate(LTOrientation& newOrientation);
00056     virtual void    RemoteVelocityUpdate(LTVector3f& newVelocity);
00057     virtual void    RemoteAngularVelocityUpdate(LTVector3f& newAngVelocity);
00058 
00059     void            Init();
00060 
00061     void            OnCommandOn(int32 command, uint32 nActCmd);
00062     void            OnCommandOff(int32 command, uint32 nActCmd);
00063     
00064     virtual uint32  OnTouchClient(LTContactInfo* info, float force);
00065 
00066     LTRESULT        HandleInput();
00067     LTRESULT        Update(float fFrameTime);
00068     LTRESULT        PhysicsUpdate(float fFrameTime);
00069     
00070     virtual void    Event(uint32 nEvent, float fFrameTime, float fGameTime,
00071                         IEventData *pEventData, uint32 nPriority, 
00072                         ECallbackType eCT,
00073                         uint32 nCountRemaining, float fTimeRemaining,
00074                         float fLoopTime);
00075 
00076     void            SetRotation(LTOrientation oRot);
00077 
00078     void            CycleState();
00079     LTRESULT        SetState(EPlayerState state, bool bForceInit=false);
00080     uint32          GetState()                      { return m_eState; }
00081     void            HandleStateChange();
00082 
00083     //void          SetCamera(CCamera* pCam)        { m_pCamera = pCam; }
00084     CCamera*        GetCamera()                     { return &m_Camera; }
00085     uint32          GetClientID()                   { return m_ClientID; }
00086     
00087     void            CallbackClientID(const uint32& nOldVal);
00088     
00089     
00090   protected:
00091     uint32              m_eState;       // Player state (one of EPlayerState).
00092     CCamera             m_Camera;       // Attached/controlling camera.
00093     bool                m_bFirstUpdate; // Flag to mark first update loop.
00094     LTCollisionSphere*  m_pCollSphere;  // Collision sphere for player.
00095 
00096     bool                m_bMoved;
00097     LTVector3f          m_vNewVel;
00098 
00099     distr_callback_fn(CPlayerClnt, uint32, m_ClientID, CallbackClientID);
00100     distr_uint32_callback(m_ClientID,       AVITEM_REG, 10, 0);
00101 };
00102 
00103 
00104 #endif  // __PLAYER_CLNT_H__

Generated on Mon Mar 4 08:42:23 2002 for Aria by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002