00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef ArmageTron_CAMERA_H
00029 #define ArmageTron_CAMERA_H
00030
00031 typedef enum {CAMERA_IN=0, CAMERA_CUSTOM=1, CAMERA_FREE=2, CAMERA_FOLLOW=3,
00032 CAMERA_SMART=4, CAMERA_MER=5, CAMERA_SERVER_CUSTOM=6,
00033 CAMERA_SMART_IN=7, CAMERA_COUNT=8 } eCamMode;
00034
00035 #include "eCoord.h"
00036
00037 #include "rViewport.h"
00038 #include "tLinkedList.h"
00039 #include "tList.h"
00040 #include "nObserver.h"
00041
00042 class ePlayer;
00043 class ePlayerNetID;
00044 class eGameObject;
00045 class eNetGameObject;
00046 class eCamera;
00047 class eGrid;
00048 class uActionCamera;
00049 class uGlanceAction;
00050
00051
00052
00053
00054
00055
00056
00057 class eGlanceRequest : public tListItem<eGlanceRequest> {
00058 public:
00059 eGlanceRequest() : tListItem<eGlanceRequest>() {}
00060 eCoord dir;
00061 };
00062
00063 class eCamera{
00064 protected:
00065 enum { se_glances = 4 };
00066 static uActionCamera se_lookUp,se_lookDown,se_lookLeft,se_lookRight,
00067 se_moveLeft,se_moveRight,se_moveUp,se_moveDown,se_moveForward,se_moveBack,
00068 se_zoomIn,se_zoomOut, se_switchView;
00069 static uGlanceAction se_glance[se_glances];
00070
00071 int id;
00072
00073 tCHECKED_PTR(eGrid) grid;
00074
00075 nObserverPtr< ePlayerNetID> netPlayer;
00076 tCHECKED_PTR(ePlayer) localPlayer;
00077
00078 tJUST_CONTROLLED_PTR<eGameObject> center;
00079
00080
00081
00082 REAL lastSwitch;
00083 REAL zNear ;
00084 eCamMode mode ;
00085
00086 eCoord pos;
00087 eCoord lastPos;
00088 eCoord dir;
00089 eCoord top;
00090 REAL z,rise;
00091 REAL fov;
00092
00093 REAL turning;
00094 REAL smoothTurning;
00095
00096
00097 REAL distance;
00098 REAL lastrendertime;
00099
00100 REAL smartcamSkewSmooth, smartcamIncamSmooth, smartcamFrontSmooth, centerSpeedSmooth;
00101 eCoord centerDirSmooth;
00102 eCoord centerDirLast;
00103 eCoord centerPos;
00104 eCoord centerPosSmooth;
00105
00106 tCHECKED_PTR(rViewport) vp;
00107
00108 eCoord centerPosLast, centerposLast;
00109 REAL userCameraControl;
00110 REAL centerIncam;
00111
00112 eGlanceRequest* activeGlanceRequest;
00113 eGlanceRequest glanceRequests[se_glances];
00114
00115 bool renderingMain_;
00116
00117 static bool InterestingToWatch(eGameObject const * g);
00118
00124 static eCoord nextDirIfGlancing(eCoord const & dir, eCoord const & targetDir, REAL ts);
00125
00126 void Bound( REAL dt );
00127 void Bound( REAL dt, eCoord & pos );
00128
00129 void MyInit();
00130 public:
00131 bool CenterIncamOnTurn();
00132 bool WhobbleIncam();
00133 bool AutoSwitchIncam();
00134
00135 bool RenderingMain() const { return renderingMain_; }
00136 void SetRenderingMain( bool f ){ renderingMain_ = f; }
00137
00138 const ePlayerNetID* Player() const;
00139 const ePlayer* LocalPlayer() const;
00140
00141 eCamera(eGrid *grid, rViewport *vp,ePlayerNetID *owner,ePlayer *lp,eCamMode m=CAMERA_IN);
00142 virtual ~eCamera();
00143
00144 eGameObject * Center() const;
00145
00146 eCoord CenterPos() const;
00147 eCoord CenterDir() const;
00148 virtual eCoord CenterCycleDir() const;
00149
00150 virtual REAL SpeedMultiplier() const { return 1; }
00151
00152 eCoord CenterCamDir() const;
00153 eCoord CenterCamTop() const;
00154 eCoord CenterCamPos() const;
00155 REAL CenterCamZ() const;
00156
00157 REAL CenterZ() const;
00158 REAL CenterSpeed() const;
00159
00160 const eCoord& CameraDir() const {return dir;}
00161 const eCoord& CameraPos() const {return pos;}
00162 eCoord CameraGlancePos() const {return pos;}
00163 REAL CameraZ () const {return z;}
00164
00165 bool CenterAlive() const;
00166
00167 bool CenterCockpitFixedBefore() const;
00168 void CenterCockpitFixedAfter() const;
00169
00170 void SwitchView();
00171 void SwitchCenter(int d);
00172 bool Act(uActionCamera *act,REAL x);
00173
00174 eCamMode GetCamMode() {return mode;}
00175
00176 #ifndef DEDICATED
00177 void Render();
00178
00179 private:
00180
00181 public:
00182 #endif
00183
00184 virtual void Timestep(REAL ts);
00185
00186 REAL Dist(){return distance;}
00187
00188
00189
00190
00191
00192
00193
00194
00195
00196
00197
00198
00199
00200
00201
00202
00203
00204
00205
00206
00207
00208
00209
00210
00211 static void s_Timestep(eGrid *grid, REAL time);
00212
00213 private:
00215 bool Bound( REAL ratio, eCoord & pos, eCoord const & dirFromTarget, REAL & hitCache );
00216
00217 enum HitCacheSize{ hitCacheSize = 3 };
00218 REAL hitCache_[hitCacheSize];
00219 };
00220
00221
00222
00223
00224
00225
00226
00227
00228
00229 #endif