00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __PLAYER_CLNT_H__
00014 #define __PLAYER_CLNT_H__
00015
00016
00017
00018 #include "camera.h"
00019 #include "i_event_callback.h"
00020
00021
00022 #include <ltengineobjectsclient.h>
00023 #include <autoview/autoview.h>
00024
00025 #include "theStage.h"
00026
00028 class LTCollisionSphere;
00029
00030
00032 enum EPlayerState
00033 {
00034 PLS_WALK = 0,
00035 PLS_SPECTATOR,
00036 PLS_SPECTATOR_NOSLIDE,
00037 PLS_SPECTATOR_NOCLIP,
00038 PLS_HEAVY_BALL,
00039 PLS_BOUNCY_BALL,
00040
00041 PLS_NUM_STATES
00042 };
00043
00044
00046 class CPlayerClnt : public BaseClassClient, public IEventCallback
00047 {
00048 public:
00049
00050 CPlayerClnt();
00051 virtual ~CPlayerClnt();
00052
00053 distr_class(CPlayerClnt);
00054
00055
00056 virtual void RemotePositionUpdate(LTVector3f& newPosition);
00057 virtual void RemoteRotationUpdate(LTOrientation& newOrientation);
00058 virtual void RemoteVelocityUpdate(LTVector3f& newVelocity);
00059 virtual void RemoteAngularVelocityUpdate(LTVector3f& newAngVelocity);
00060
00061 void Init();
00062
00063 void OnCommandOn(int32 command, uint32 nActCmd);
00064 void OnCommandOff(int32 command, uint32 nActCmd);
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
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;
00092 CCamera m_Camera;
00093 bool m_bFirstUpdate;
00094 LTCollisionSphere* m_pCollSphere;
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__