00001
00002
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00031
00032 #ifndef RCSC_PLAYER_SEE_STATE_H
00033 #define RCSC_PLAYER_SEE_STATE_H
00034
00035 #include <rcsc/player/view_mode.h>
00036 #include <rcsc/game_time.h>
00037
00038 namespace rcsc {
00039
00044 class SeeState {
00045 public:
00049 enum SynchType {
00050 SYNCH_NO,
00051 SYNCH_EVERY,
00052 SYNCH_NARROW,
00053 SYNCH_NORMAL,
00054 SYNCH_WIDE,
00055 SYNCH_SYNC,
00056 };
00057
00061 enum Timing {
00062 TIME_0_00 = 0,
00063 TIME_37_5 = 375,
00064 TIME_75_0 = 750,
00065 TIME_12_5 = 125,
00066 TIME_50_0 = 500,
00067 TIME_87_5 = 875,
00068 TIME_22_5 = 225,
00069 TIME_62_5 = 625,
00070 TIME_SYNC = 999,
00071 TIME_NOSYNCH = 1000,
00072 };
00073
00074 private:
00075 enum {
00076 HISTORY_SIZE = 3
00077 };
00078
00079
00080 static bool S_synch_see_mode;
00081
00082 GameTime M_current_time;
00083 GameTime M_last_see_time;
00084
00085 SynchType M_synch_type;
00086
00087 Timing M_last_timing;
00088 int M_current_see_count;
00089 int M_see_count_history[HISTORY_SIZE];
00090
00091 int M_cycles_till_next_see;
00092
00093 ViewWidth M_view_width;
00094 ViewQuality M_view_quality;
00095
00097 SeeState( const SeeState & );
00099 SeeState & operator=( const SeeState & );
00100 public:
00104 SeeState();
00105
00109 void setSynchSeeMode()
00110 {
00111 S_synch_see_mode = true;
00112 }
00113
00118 static
00119 bool synch_see_mode()
00120 {
00121 return S_synch_see_mode;
00122 }
00123
00128 Timing lastTiming() const
00129 {
00130 return M_last_timing;
00131 }
00132
00133 private:
00134
00141 Timing getNextTiming( const ViewWidth & vw,
00142 const ViewQuality & vq ) const;
00143
00144 public:
00146
00147
00156 void updateBySenseBody( const GameTime & sense_time,
00157 const ViewWidth & vw,
00158 const ViewQuality & vq );
00159
00168 void updateBySee( const GameTime & see_time,
00169 const ViewWidth & vw,
00170 const ViewQuality & vq );
00171
00178 void setNewCycle( const GameTime & new_time );
00179
00185 void setLastSeeTiming( const Timing last_timing );
00186
00191 bool isSynch() const;
00192
00206 bool isSynchedSeeCountNormalMode() const;
00207
00221 bool isSynchedSeeCountSynchMode() const;
00222
00224
00225
00233 bool canChangeViewTo( const ViewWidth & next_width,
00234 const GameTime & current ) const;
00235
00240 int cyclesTillNextSee() const;
00241
00251 void setViewMode( const ViewWidth & new_width,
00252 const ViewQuality & new_quality );
00253 };
00254
00255 }
00256
00257 #endif