void app_end(void) { if (server.map_open) map_end(); if (server.game_open) game_end(); // shut down app console_add_system("Closing App"); // shutdown view if (!app.dedicated_host) view_shutdown(); // physics ray tracing ray_trace_shutdown(); // shutdown server server_shutdown(); // OS network shutdown net_shutdown(); }
void game_end(void) { console_add_system("Closing Game"); // blank progress progress_initialize("Ending"); progress_draw(0); // close any network joins or hosting if (net_setup.client.joined) { if (!net_setup.host.hosting) { net_client_send_leave_host(object_player_get_remote_uid()); net_client_end_message_queue(); net_client_join_host_end(); } else { net_host_game_end(); net_client_end_message_queue_local(); } } // stop view view_game_stop(); // stop server server_game_stop(); // game closed server.game_open=FALSE; }
void debug_screenshot(void) { char path[1024],file_name[256]; struct tm *tm; time_t curtime; curtime=time(NULL); tm=localtime(&curtime); sprintf(file_name,"%.4d%.2d%.2d_%.2d%.2d%.2d",(tm->tm_year+1900),(tm->tm_mon+1),tm->tm_mday,tm->tm_hour,tm->tm_min,tm->tm_sec); file_paths_documents(&setup.file_path_setup,path,"Screenshots",file_name,"png"); if (!gl_screen_shot(render_info.view_x,render_info.view_y,setup.screen.x_sz,setup.screen.y_sz,FALSE,path)) { console_add_system("Unable to save screenshot"); return; } console_add_system("Screenshot taken"); }
bool game_start(int skill,network_reply_join_remotes *remotes,char *err_str) { // pause time game_time_pause_start(); // reset random numbers random_reset(); // start progress console_add_system("Starting Game"); progress_initialize("Starting"); progress_draw(0); // start server if (!server_game_start("Game",skill,remotes,err_str)) { return(FALSE); } // start view view_game_start(); // game in running state server.game_open=TRUE; server.state=gs_running; game_time_pause_end(); return(TRUE); }
void debug_dump(void) { int i,idx,cnt,mem_sz; obj_type *obj; effect_type *effect; proj_type *proj; weapon_type *weap; proj_setup_type *proj_setup; model_type *mdl; script_type *script; timer_type *timer; SDL_version *sdl_ver; console_add_system("Debugging info dumped to stdout"); fprintf(stdout,"\n\n"); fprintf(stdout,"#########################################################################\n"); fprintf(stdout,"Dump: dim3 Debugging Info\n"); fprintf(stdout,"Engine v%s\n",dim3_version); fprintf(stdout,"(c) 2000-2007 Klink! Software\n"); fprintf(stdout,"#########################################################################\n\n"); // game info fprintf(stdout,"**************************************\n"); fprintf(stdout,"Game\n"); fprintf(stdout,"**************************************\n\n"); fprintf(stdout,"Project: %s\n",net_setup.host.proj_name); fprintf(stdout,"Tick: %d\n",game_time_get()); debug_return(); // system info fprintf(stdout,"**************************************\n"); fprintf(stdout,"System\n"); fprintf(stdout,"**************************************\n\n"); fprintf(stdout,"Arch Type: %s\n",arch_type); #ifdef D3_OS_MAC fprintf(stdout,"OS Version: %d.%d.%d\n",os_vers_major,os_vers_minor_1,os_vers_minor_2); #endif sdl_ver=(SDL_version*)SDL_Linked_Version(); fprintf(stdout,"SDL Version: %d.%d.%d\n",sdl_ver->major,sdl_ver->minor,sdl_ver->patch); fprintf(stdout,"JavaScript Version: %.2f\n",((float)JS_VERSION/100.0f)); fprintf(stdout,"PNG Version: %s\n",PNG_LIBPNG_VER_STRING); debug_return(); // video info fprintf(stdout,"**************************************\n"); fprintf(stdout,"Video\n"); fprintf(stdout,"**************************************\n\n"); fprintf(stdout,"Engine: %s\n",render_info.name); fprintf(stdout,"Screen: %d,%d at %d\n",render_info.monitor_x_sz,render_info.monitor_y_sz,render_info.monitor_refresh_rate); fprintf(stdout,"Max Texture Units: %d\n",render_info.texture_unit_count); fprintf(stdout,"Max Texture Size: %d\n",render_info.texture_max_size); if (!gl_check_frame_buffer_ok()) fprintf(stdout,"Shadow support disabled; Unsupported on this video card.\n"); if (!gl_check_fsaa_ok()) fprintf(stdout,"FSAA support disabled; Unsupported on this video card.\n"); if (!gl_check_texture_compress_ok()) fprintf(stdout,"Compression disabled; Unsupported on this video card.\n"); if (!gl_check_point_sprite_ok()) fprintf(stdout,"Point sprite support disabled; Unsupported on this video card.\n"); if (!gl_check_shader_ok()) fprintf(stdout,"GLSL support disabled; Unsupported on this video card.\n"); fprintf(stdout,"Extensions:\n%s\n",render_info.ext_string); #ifdef D3_OS_WINDOWS fprintf(stdout,"WGL Extensions:\n%s\n",wglGetExtensionsStringARB(wglGetCurrentDC())); #endif debug_return(); // map info fprintf(stdout,"**************************************\n"); fprintf(stdout,"Map\n"); fprintf(stdout,"**************************************\n\n"); fprintf(stdout,"Map: %s\n",map.info.name); fprintf(stdout,"Author: %s\n",map.info.author); fprintf(stdout,"Mesh Count: %d\n",map.mesh.nmesh); fprintf(stdout,"Liquid Count: %d\n",map.liquid.nliquid); fprintf(stdout,"Spot Count: %d\n",map.nspot); fprintf(stdout,"Scenery Count: %d\n",map.nscenery); fprintf(stdout,"Node Count: %d\n",map.nnode); debug_return(); // objects debug_header("Objects",server.count.obj,(sizeof(obj_type)*server.count.obj)); debug_space("Name",25); debug_space("Type",15); debug_space("Script",25); debug_space("Binding",10); debug_return(); debug_space("------------------------",25); debug_space("------------------------",15); debug_space("------------------------",25); debug_space("---------",10); debug_return(); obj=server.objs; for ((i=0);(i!=server.count.obj);i++) { debug_space(obj->name,25); debug_space(obj->type,15); if (!obj->scenery.on) { idx=scripts_find_uid(obj->attach.script_uid); debug_space(js.scripts[idx].name,25); } else { debug_space("*",25); } debug_space(bind_type_str[obj->bind],10); debug_return(); obj++; } debug_return(); // weapons debug_header("Weapons",server.count.weapon,(sizeof(weapon_type)*server.count.weapon)); debug_space("Name",20); debug_space("Object",20); debug_return(); debug_space("-------------------",20); debug_space("-------------------",20); debug_return(); weap=server.weapons; for ((i=0);(i!=server.count.weapon);i++) { obj=object_find_uid(weap->obj_uid); debug_space(weap->name,20); debug_space(obj->name,20); debug_return(); weap++; } debug_return(); // projectile setups debug_header("Projectile Setups",server.count.proj_setup,(sizeof(proj_setup_type)*server.count.proj_setup)); debug_space("Name",20); debug_space("Object",20); debug_space("Weapon",20); debug_return(); debug_space("-------------------",20); debug_space("-------------------",20); debug_space("-------------------",20); debug_return(); proj_setup=server.proj_setups; for ((i=0);(i!=server.count.proj_setup);i++) { obj=object_find_uid(proj_setup->obj_uid); weap=weapon_find_uid(proj_setup->weap_uid); debug_space(proj_setup->name,20); debug_space(obj->name,20); debug_space(weap->name,20); debug_return(); proj_setup++; } debug_return(); // models mem_sz=sizeof(model_type)*server.count.model; mdl=server.models; for (i=0;i!=server.count.model;i++) { mem_sz+=model_memory_size(mdl); mdl++; } debug_header("Models",server.count.model,mem_sz); debug_space("Name",32); debug_space("Vertexes",10); debug_space("Trigs",10); debug_space("Ref Count",10); debug_return(); debug_space("------------------------------",32); debug_space("---------",10); debug_space("---------",10); debug_space("---------",10); debug_return(); mdl=server.models; for (i=0;i!=server.count.model;i++) { debug_space(mdl->name,32); debug_int_space(mdl->meshes[0].nvertex,10); debug_int_space(mdl->meshes[0].ntrig,10); debug_int_space(mdl->reference_count,10); debug_return(); mdl++; } debug_return(); // projectiles debug_header("Projectiles",server.count.proj,(sizeof(proj_type)*max_projectile)); debug_space("Name",20); debug_space("Object",20); debug_space("Weapon",20); debug_return(); debug_space("-------------------",20); debug_space("-------------------",20); debug_space("-------------------",20); debug_return(); proj=server.projs; for ((i=0);(i!=server.count.proj);i++) { obj=object_find_uid(proj->obj_uid); weap=weapon_find_uid(proj->weap_uid); proj_setup=proj_setups_find_uid(proj->proj_setup_uid); debug_space(proj_setup->name,20); debug_space(obj->name,20); debug_space(weap->name,20); debug_return(); proj++; } debug_return(); // effects debug_header("Effects",server.count.effect,(sizeof(effect_type)*max_effect)); debug_space("Type",10); debug_space("Life Tick",10); debug_return(); debug_space("---------",10); debug_space("---------",10); debug_return(); effect=server.effects; for ((i=0);(i!=server.count.effect);i++) { debug_space(effect_type_str[effect->effecttype],10); debug_int_space(effect->life_tick,10); debug_return(); effect++; } debug_return(); // scripts script=js.scripts; cnt=0; for ((i=0);(i!=max_scripts);i++) { if (script->used) cnt++; script++; } debug_header("Scripts",cnt,-1); debug_space("Name",32); debug_return(); debug_space("-------------------------------",32); debug_return(); script=js.scripts; for ((i=0);(i!=max_scripts);i++) { if (script->used) { debug_space(script->name,32); debug_return(); } script++; } debug_return(); // timers debug_header("Timers",js.count.timer,-1); debug_space("Script",32); debug_space("Count",10); debug_space("Type",10); debug_return(); debug_space("-------------------------------",32); debug_space("---------",10); debug_space("---------",10); debug_return(); timer=js.timers; for ((i=0);(i!=js.count.timer);i++) { script=&js.scripts[scripts_find_uid(timer->attach.script_uid)]; debug_space(script->name,32); debug_int_space(timer->count,10); debug_space((timer->mode==timer_mode_repeat)?"Timer":"Wait",10); debug_return(); timer++; } debug_return(); fflush(stdout); }