00001 
00032 #ifndef LL_VIEWER_H
00033 #define LL_VIEWER_H
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 #include "llviewercontrol.h"
00044 
00045 
00046 
00047 #define TOGGLE_HACKED_GODLIKE_VIEWER 
00048 #ifdef TOGGLE_HACKED_GODLIKE_VIEWER
00049 extern BOOL gHackGodmode;
00050 #endif
00051 
00052 
00053 
00054 
00055 
00056 class LLAudioEngine;
00057 class LLFrameTimer;
00058 class LLMessageSystem;
00059 class LLHost;
00060 class LLPieMenu;
00061 class LLWorkerThread;
00062 class LLTextureFetch;
00063 class LLTextureCache;
00064 class LLPumpIO;
00065 class LLHTTPNode;
00066 class LLTimer;
00067 class LLUUID;
00068 class LLVector3;
00069 class LLVector3d;
00070 class LLViewerObject;
00071 class LLViewerRegion;
00072 class LLVFS;
00073 
00074 
00075 
00076 
00077 
00078 extern LLString gSecondLife;
00079 
00080 extern S32 gNumSessions;
00081 extern BOOL gNoRender;
00082 extern LLMemoryInfo gSysMemory;
00083 extern BOOL gLogMessages;
00084 extern BOOL gUseAudio;
00085 extern bool gPreloadImages;
00086 extern BOOL gGodConnect;
00087 extern LLString gCmdLineFirstName;
00088 extern LLString gCmdLineLastName;
00089 extern LLString gCmdLinePassword;
00090 extern BOOL gAutoLogin;
00091 extern U32 gFrameCount;
00092 extern U32 gForegroundFrameCount;
00093 extern BOOL gRequestInventoryLibrary;
00094 extern BOOL gAcceptTOS;
00095 extern BOOL gAcceptCriticalMessage;
00096 extern std::string gChannelName;
00097 extern LLUUID gInventoryLibraryOwner;
00098 extern LLUUID gInventoryLibraryRoot;
00099 extern BOOL gLastExecFroze;
00100 extern F32 gLogoutMaxTime;
00101 extern LLTimer gRenderStartTime;
00102 extern LLFrameTimer gForegroundTime;
00103 extern LLTimer gLogoutTimer;
00104 extern BOOL gInProductionGrid;
00105 extern S32 gCrashBehavior;
00106 extern bool gVerifySSLCert;
00107 extern const char* DEFAULT_SETTINGS_FILE;
00108 
00109 
00110 extern const U32 PATCH_SIZE;
00111 extern const LLVector3 DEFAULT_OBJECT_SCALE;
00112 extern BOOL             gDisconnected;
00113 extern BOOL             gDisableVoice;
00114 extern BOOL             gQuit;                                          
00115 extern BOOL             gQuitRequested;                         
00116 extern BOOL             gLogoutRequestSent;                     
00117 extern BOOL             gInitializationComplete;        
00118 extern BOOL             gUseWireframe;
00119 extern BOOL             gPurgeCache;                            
00120 extern U32              gSecondsPerDay;
00121 extern U32              gSecondsPerYear;
00122 
00123 
00124 extern BOOL gPacificDaylightTime;
00125 
00126 extern LLString gLastVersionChannel;
00127 
00128 extern LLVector3 gWindVec;
00129 extern LLVector3 gRelativeWindVec;
00130 
00131 extern U64      gFrameTime;                                     
00132 extern F32              gFrameTimeSeconds;                      
00133 extern F32              gFrameIntervalSeconds;          
00134 extern F32              gFPSClamped;                                            
00135 extern F32              gFrameDTClamped;
00136 extern U64              gStartTime;
00137 
00138 extern LLFrameTimer     gRestoreGLTimer;
00139 extern BOOL                     gRestoreGL;
00140 
00141 extern BOOL                     gDisplayCameraPos;
00142 extern BOOL                     gDisplayWindInfo;
00143 extern BOOL                     gDisplayNearestWater;
00144 extern BOOL                     gDisplayFOV;
00145 extern BOOL                     gForceRenderLandFence;
00146 
00147 extern BOOL                     gAllowIdleAFK;
00148 extern F32                      gAFKTimeout;
00149 extern BOOL                     gShowObjectUpdates;
00150 
00151 extern BOOL                     gTeleportDisplay;
00152 extern LLFrameTimer     gTeleportDisplayTimer;
00153 
00154 extern std::map<S32,LLFrameTimer> gDebugTimers;
00155 
00156 
00157 
00158 
00159 extern LLVFS    *gStaticVFS;
00160 
00161 extern LLUUID   gViewerDigest;  
00162 
00163 extern LLWorkerThread* gImageDecodeThread;
00164 extern LLTextureFetch* gTextureFetch;
00165 extern LLTextureCache* gTextureCache;
00166 
00167 extern LLPumpIO* gServicePump;
00168 
00169 extern LLUUID gSunTextureID;
00170 extern LLUUID gMoonTextureID;
00171 
00172 extern BOOL gHandleKeysAsync;
00173 
00174 
00175 extern F32 gMapScale;
00176 extern F32 gMiniMapScale;
00177 
00178 extern F32 gMouseSensitivity;
00179 extern BOOL gInvertMouse;
00180 
00181 
00182 
00183 
00184 
00185 const S32 AGENT_UPDATES_PER_SECOND  = 10;
00186 
00187 
00188 
00189 extern LLString gWindowTitle;
00190 extern LLString gDisabledMessage;
00191 extern BOOL gHideLinks;
00192 
00193 #define REGIONS_PER_LANDSCAPE_EDGE  3 
00194 #define NUMBER_OF_REGIONS       (REGIONS_PER_LANDSCAPE_EDGE             \
00195                                                         * REGIONS_PER_LANDSCAPE_EDGE)
00196 #define CENTER_REGION           ((REGIONS_PER_LANDSCAPE_EDGE / 2)       \
00197                                                         * REGIONS_PER_LANDSCAPE_EDGE            \
00198                                                         + REGIONS_PER_LANDSCAPE_EDGE / 2)
00199 
00200 
00201 
00202 
00203 
00204 const S32 MAP_REGION_TO_X[NUMBER_OF_REGIONS - 1] =
00205 {
00206         1,      
00207         0,      
00208         -1,     
00209         0,      
00210         1,      
00211         -1,     
00212         -1,     
00213         1       
00214 };
00215 const S32 MAP_REGION_TO_Y[NUMBER_OF_REGIONS - 1] =
00216 {
00217         0,      
00218         1,      
00219         0,      
00220         -1,     
00221         1,      
00222         1,      
00223         -1,     
00224         -1      
00225 };
00226 
00227 const BOOL FOR_SELECTION = TRUE;
00228 const BOOL NOT_FOR_SELECTION = FALSE;
00229 
00230 const U8 YES_PHYSICS = 1;
00231 const U8 NO_PHYSICS = 0;
00232 
00233 
00234 
00235 
00236 void display(BOOL rebuild = TRUE, F32 zoom_factor = 1.f, int subfield = 0);
00237 void draw_axes();
00238 
00239 void fire_shot(const U8 shot_type, const U8 use_physics );
00240 void add_object(LLPCode pcode, 
00241                                 U8 use_physics, 
00242                                 const LLVector3d &object_pos_global, 
00243                                 const LLQuaternion &rotation, 
00244                                 const LLVector3 &scale, 
00245                                 const LLVector3 &velocity,
00246                                 const LLVector3 &angular_velocity);
00247 
00248 BOOL add_object(LLPCode pcode, S32 screen_x, S32 screen_y, U8 use_physics);
00249 
00250 void idle();
00251 void idle_network();
00252 void init_audio();
00253 void init_textures();
00254 void init_landscape();
00255 void keyboard(char key);
00256 void keyboard_windows(char key);
00257 void kill_all_trees();
00258 void move_sun();
00259 BOOL raycast_for_new_obj_pos( S32 x, S32 y, LLViewerObject** hit_obj, S32* hit_face, BOOL* b_hit_land, LLVector3* ray_start_region, LLVector3* ray_end_region, LLViewerRegion** region );
00260 
00261 void audio_update_volume(bool force_update = true);
00262 void audio_update_listener();
00263 void audio_update_wind(bool force_update = true);
00264 
00265 
00266 void save_final_snapshot(void*);
00267 
00268 
00269 void app_user_quit();
00270 
00271 
00272 void app_request_quit();
00273 
00274 
00275 
00276 void app_abort_quit();
00277 
00278 
00279 
00280 void app_force_quit(const char* launch_file_on_quit = NULL);
00281 
00282 
00283 void app_early_exit(const LLString& message);
00284 
00285 
00286 void app_force_exit(S32 arg);
00287 
00288 void do_disconnect(const LLString& message);
00289 void send_logout_request();
00290 void save_avatar(void*);
00291 
00292 void set_view(S32 which);
00293 
00294 void user_logout();
00295 
00296 F32 mouse_x_from_center(S32 x);
00297 F32 mouse_y_from_center(S32 x);
00298 
00299 void print_agent_nvpairs(void*);
00300 void reload_viewer(void);
00301 void reset_statistics();
00302 void output_statistics(void*);
00303 void write_debug(const char *str);
00304 void write_debug(const std::string& str);
00305 void login_alert_done(S32 option, void* user_data);
00306 void callback_cache_name(const LLUUID& id, const char* firstname, const char* lastname, BOOL is_group, void* data);
00307 void load_name_cache();
00308 void remove_marker_file();
00309 
00310 
00311 const LLUUID& agent_get_id();
00312 const LLUUID& agent_get_session_id();
00313 void agent_send_reliable_message();
00314 
00315 
00316 const std::vector<std::string>& getLoginURIs();
00317 const std::string& getHelperURI();
00318 void resetURIs();
00319 
00320 void load_region_name_cache();
00321 void save_region_name_cache();
00322 
00323 
00324 
00325 #if LL_WINDOWS
00326 class llLCD;
00327 extern llLCD    *gLcdScreen; 
00328 #endif
00329 
00330 #endif