diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-01-13 11:15:32 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2008-01-13 11:15:32 +0000 |
| commit | ea245b969d1864441b41d25c7631beccfb39d874 (patch) | |
| tree | 68fb62ef99cdd90f5dd4ec8edf11e7bb54b7f953 /src/engine | |
| parent | 906ece7894927983b8ac69e37dd3cb82cfe7aad1 (diff) | |
| download | zcatch-ea245b969d1864441b41d25c7631beccfb39d874.tar.gz zcatch-ea245b969d1864441b41d25c7631beccfb39d874.zip | |
new mapformat in place. continued the cleanup. some effects are gone, gonna be redone so no biggie. CTF isn't working now.
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/client/ec_client.c | 67 | ||||
| -rw-r--r-- | src/engine/client/ec_gfx.c | 36 | ||||
| -rw-r--r-- | src/engine/e_config_variables.h | 1 | ||||
| -rw-r--r-- | src/engine/e_engine.c | 3 | ||||
| -rw-r--r-- | src/engine/e_interface.h | 1 | ||||
| -rw-r--r-- | src/engine/e_map.c | 5 |
6 files changed, 97 insertions, 16 deletions
diff --git a/src/engine/client/ec_client.c b/src/engine/client/ec_client.c index bae8cb5c..6a3b4220 100644 --- a/src/engine/client/ec_client.c +++ b/src/engine/client/ec_client.c @@ -513,13 +513,15 @@ static void client_debug_render() } /* render graphs */ - gfx_mapscreen(0,0,400.0f,300.0f); - graph_render(&predict_graph, 300, 10, 90, 50); - graph_render(&predicted_time.graph, 300, 10+50+10, 90, 50); - - graph_render(&intra_graph, 300, 10+50+10+50+10, 90, 50); - graph_render(&input_late_graph, 300, 10+50+10+50+10+50+10, 90, 50); - + if(config.dbg_graphs) + { + gfx_mapscreen(0,0,400.0f,300.0f); + graph_render(&predict_graph, 300, 10, 90, 50); + graph_render(&predicted_time.graph, 300, 10+50+10, 90, 50); + + graph_render(&intra_graph, 300, 10+50+10+50+10, 90, 50); + graph_render(&input_late_graph, 300, 10+50+10+50+10+50+10, 90, 50); + } } void client_quit() @@ -808,7 +810,7 @@ static void client_process_packet(NETPACKET *packet) recived_snapshots++; if(current_recv_tick > 0) - snaploss += game_tick-current_recv_tick-1; + snaploss += game_tick-current_recv_tick-2; current_recv_tick = game_tick; /* we got two snapshots until we see us self as connected */ @@ -978,6 +980,9 @@ static void client_run() int64 reportinterval = time_freq()*1; int editor_active = 0; + static PERFORMACE_INFO rootscope = {"root", 0}; + perf_start(&rootscope); + local_start_time = time_get(); snapshot_part = 0; @@ -1014,14 +1019,27 @@ static void client_run() while (1) { + static PERFORMACE_INFO rootscope = {"root", 0}; int64 frame_start_time = time_get(); frames++; + perf_start(&rootscope); + /* update input */ - inp_update(); + { + static PERFORMACE_INFO scope = {"inp_update", 0}; + perf_start(&scope); + inp_update(); + perf_end(); + } /* update sound */ - snd_update(); + { + static PERFORMACE_INFO scope = {"snd_update", 0}; + perf_start(&scope); + snd_update(); + perf_end(); + } /* refocus */ if(!gfx_window_active()) @@ -1085,7 +1103,12 @@ static void client_run() } else { - client_update(); + { + static PERFORMACE_INFO scope = {"client_update", 0}; + perf_start(&scope); + client_update(); + perf_end(); + } if(config.dbg_stress) { @@ -1097,10 +1120,24 @@ static void client_run() } else { - client_render(); - gfx_swap(); + { + static PERFORMACE_INFO scope = {"client_render", 0}; + perf_start(&scope); + client_render(); + perf_end(); + } + + { + static PERFORMACE_INFO scope = {"gfx_swap", 0}; + perf_start(&scope); + gfx_swap(); + perf_end(); + } } } + + perf_end(); + /* check conditions */ if(client_state() == CLIENTSTATE_QUITING) @@ -1130,6 +1167,10 @@ static void client_run() frametime_high = 0; frames = 0; reporttime += reportinterval; + perf_next(); + + if(config.dbg_pref) + perf_dump(&rootscope); } /* update frametime */ diff --git a/src/engine/client/ec_gfx.c b/src/engine/client/ec_gfx.c index 754d5d63..771c8515 100644 --- a/src/engine/client/ec_gfx.c +++ b/src/engine/client/ec_gfx.c @@ -529,6 +529,7 @@ static int record = 0; void gfx_swap() { + #if 0 if(record) { int w = screen_width; @@ -597,10 +598,39 @@ void gfx_swap() mem_free(pixel_data); do_screenshot = 0; } + #endif - glfwSwapBuffers(); - glFinish(); - glfwPollEvents(); + { + static PERFORMACE_INFO pscope = {"glfwSwapBuffers", 0}; + perf_start(&pscope); + glFinish(); + glfwSwapBuffers(); + perf_end(); + } + + if(0) + { + static PERFORMACE_INFO pscope = {"glFlush", 0}; + perf_start(&pscope); + glFlush(); + perf_end(); + } + + if(0) + { + static PERFORMACE_INFO pscope = {"glFinish", 0}; + perf_start(&pscope); + glFinish(); + perf_end(); + } + + if(0) + { + static PERFORMACE_INFO pscope = {"glfwPollEvents", 0}; + perf_start(&pscope); + glfwPollEvents(); + perf_end(); + } } int gfx_screenwidth() diff --git a/src/engine/e_config_variables.h b/src/engine/e_config_variables.h index c3bbc524..7271c530 100644 --- a/src/engine/e_config_variables.h +++ b/src/engine/e_config_variables.h @@ -62,6 +62,7 @@ MACRO_CONFIG_INT(sv_status, 0, 0, 1) MACRO_CONFIG_INT(debug, 0, 0, 1) MACRO_CONFIG_INT(dbg_stress, 0, 0, 0) MACRO_CONFIG_INT(dbg_pref, 0, 0, 1) +MACRO_CONFIG_INT(dbg_graphs, 0, 0, 1) MACRO_CONFIG_INT(dbg_hitch, 0, 0, 0) MACRO_CONFIG_STR(dbg_stress_server, 32, "localhost") diff --git a/src/engine/e_engine.c b/src/engine/e_engine.c index 3a3f6333..dc6484d6 100644 --- a/src/engine/e_engine.c +++ b/src/engine/e_engine.c @@ -118,6 +118,9 @@ void perf_start(PERFORMACE_INFO *info) void perf_end() { + if(!current) + return; + current->last_delta = time_get()-current->start; current->total += current->last_delta; diff --git a/src/engine/e_interface.h b/src/engine/e_interface.h index 57b7e9db..701930ee 100644 --- a/src/engine/e_interface.h +++ b/src/engine/e_interface.h @@ -519,6 +519,7 @@ void map_get_type(int type, int *start, int *num); A pointer to the raw data, otherwise 0. */ void *map_get_data(int index); +void *map_get_data_swapped(int index); /* Group: Network (Server) diff --git a/src/engine/e_map.c b/src/engine/e_map.c index 6dfa4aa6..9f7a910e 100644 --- a/src/engine/e_map.c +++ b/src/engine/e_map.c @@ -9,6 +9,11 @@ void *map_get_data(int index) return datafile_get_data(map, index); } +void *map_get_data_swapped(int index) +{ + return datafile_get_data_swapped(map, index); +} + void map_unload_data(int index) { datafile_unload_data(map, index); |