diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-11-18 12:03:59 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-11-18 12:03:59 +0000 |
| commit | dda8f6b33ee05acdf23883c91a0897a464b84061 (patch) | |
| tree | 7058eb2de2b55db067957f0a67bfcb1c43f5b93d /src/engine | |
| parent | 7efefe27163548b7f61c516d6b650258a3c7d033 (diff) | |
| download | zcatch-dda8f6b33ee05acdf23883c91a0897a464b84061.tar.gz zcatch-dda8f6b33ee05acdf23883c91a0897a464b84061.zip | |
fixed skin selector and some other mindor stuff
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/client/client.c | 17 | ||||
| -rw-r--r-- | src/engine/config.c | 2 | ||||
| -rw-r--r-- | src/engine/snapshot.c | 21 |
3 files changed, 39 insertions, 1 deletions
diff --git a/src/engine/client/client.c b/src/engine/client/client.c index 19ddf9e4..ecb48582 100644 --- a/src/engine/client/client.c +++ b/src/engine/client/client.c @@ -446,6 +446,9 @@ static int client_load_data() return 1; } +extern int snapshot_data_rate[0xffff]; +extern int snapshot_data_updates[0xffff]; + static void client_debug_render() { static NETSTATS prev, current; @@ -478,6 +481,20 @@ static void client_debug_render() (int)(1.0f/frametime_avg)); gfx_quads_text(2, 2, 16, buffer); + /* render rates */ + { + int i; + for(i = 0; i < 256; i++) + { + if(snapshot_data_rate[i]) + { + sprintf(buffer, "%4d : %8d %8d %8d", i, snapshot_data_rate[i]/8, snapshot_data_updates[i], + (snapshot_data_rate[i]/snapshot_data_updates[i])/8); + gfx_quads_text(2, 100+i*8, 16, buffer); + } + } + } + /* render graphs */ gfx_mapscreen(0,0,400.0f,300.0f); graph_render(&predict_graph, 300, 10, 90, 50); diff --git a/src/engine/config.c b/src/engine/config.c index 97241e48..a4e802bf 100644 --- a/src/engine/config.c +++ b/src/engine/config.c @@ -188,7 +188,7 @@ void config_save(const char *filename) #undef MACRO_CONFIG_INT #undef MACRO_CONFIG_STR -#define MACRO_CONFIG_INT(name,def,min,max) void config_set_ ## name (CONFIGURATION *c, int val) { if (val < min) val = min; if (max != 0 && val > max) val = max; c->name = val; } +#define MACRO_CONFIG_INT(name,def,min,max) void config_set_ ## name (CONFIGURATION *c, int val) { if(min != max) { if (val < min) val = min; if (max != 0 && val > max) val = max; } c->name = val; } #define MACRO_CONFIG_STR(name,len,def) void config_set_ ## name (CONFIGURATION *c, const char *str) { strncpy(c->name, str, len-1); c->name[sizeof(c->name)-1] = 0; } #include "config_variables.h" #undef MACRO_CONFIG_INT diff --git a/src/engine/snapshot.c b/src/engine/snapshot.c index 40bad21e..3bd2f6de 100644 --- a/src/engine/snapshot.c +++ b/src/engine/snapshot.c @@ -1,4 +1,5 @@ #include "snapshot.h" +#include "compression.h" int *snapitem_data(SNAPSHOT_ITEM *item) { return (int *)(item+1); } @@ -108,11 +109,25 @@ static int diff_item(int *past, int *current, int *out, int size) return needed; } +int snapshot_data_rate[0xffff] = {0}; +int snapshot_data_updates[0xffff] = {0}; +static int snapshot_current = 0; + static void undiff_item(int *past, int *diff, int *out, int size) { while(size) { *out = *past+*diff; + + if(*diff == 0) + snapshot_data_rate[snapshot_current] += 1; + else + { + unsigned char buf[16]; + unsigned char *end = vint_pack(buf, *diff); + snapshot_data_rate[snapshot_current] += (int)(end - (unsigned char*)buf) * 8; + } + out++; past++; diff++; @@ -260,6 +275,7 @@ int snapshot_unpack_delta(SNAPSHOT *from, SNAPSHOT *to, void *srcdata, int data_ itemsize = *data++; type = *data++; id = *data++; + snapshot_current = type; key = (type<<16)|id; @@ -273,9 +289,14 @@ int snapshot_unpack_delta(SNAPSHOT *from, SNAPSHOT *to, void *srcdata, int data_ { /* we got an update so we need to apply the diff */ undiff_item((int *)snapitem_data(snapshot_get_item(from, fromindex)), data, newdata, itemsize/4); + snapshot_data_updates[snapshot_current]++; } else /* no previous, just copy the data */ + { mem_copy(newdata, data, itemsize); + snapshot_data_rate[snapshot_current] += itemsize*8; + snapshot_data_updates[snapshot_current]++; + } data += itemsize/4; } |