diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-12-15 10:24:49 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-12-15 10:24:49 +0000 |
| commit | a2566b3ebd93e0bbc55a920a7be08054a9377f11 (patch) | |
| tree | 44a4612805d894168fe4b3b4c065fccc1a1686e9 /src | |
| parent | ac9873056aa1fe529b098f19ff31e9ffa0e016a2 (diff) | |
| download | zcatch-a2566b3ebd93e0bbc55a920a7be08054a9377f11.tar.gz zcatch-a2566b3ebd93e0bbc55a920a7be08054a9377f11.zip | |
cleaned up code structure a bit
Diffstat (limited to 'src')
| -rw-r--r-- | src/editor/editor.cpp | 18 | ||||
| -rw-r--r-- | src/engine/client/ec_client.c (renamed from src/engine/client/client.c) | 26 | ||||
| -rw-r--r-- | src/engine/client/ec_gfx.c (renamed from src/engine/client/gfx.c) | 10 | ||||
| -rw-r--r-- | src/engine/client/ec_inp.c (renamed from src/engine/client/inp.c) | 6 | ||||
| -rw-r--r-- | src/engine/client/ec_snd.c (renamed from src/engine/client/snd.c) | 6 | ||||
| -rw-r--r-- | src/engine/client/ec_srvbrowse.c (renamed from src/engine/client/srvbrowse.c) | 10 | ||||
| -rw-r--r-- | src/engine/client/ec_ui.c (renamed from src/engine/client/ui.c) | 8 | ||||
| -rw-r--r-- | src/engine/client/ec_ui.h (renamed from src/engine/client/ui.h) | 0 | ||||
| -rw-r--r-- | src/engine/e_compression.c (renamed from src/engine/compression.c) | 2 | ||||
| -rw-r--r-- | src/engine/e_compression.h (renamed from src/engine/compression.h) | 0 | ||||
| -rw-r--r-- | src/engine/e_config.c (renamed from src/engine/config.c) | 14 | ||||
| -rw-r--r-- | src/engine/e_config.h (renamed from src/engine/config.h) | 6 | ||||
| -rw-r--r-- | src/engine/e_config_variables.h (renamed from src/engine/config_variables.h) | 2 | ||||
| -rw-r--r-- | src/engine/e_datafile.c (renamed from src/engine/datafile.c) | 4 | ||||
| -rw-r--r-- | src/engine/e_datafile.h (renamed from src/engine/datafile.h) | 0 | ||||
| -rw-r--r-- | src/engine/e_detect.h (renamed from src/engine/detect.h) | 0 | ||||
| -rw-r--r-- | src/engine/e_engine.c (renamed from src/engine/engine.c) | 6 | ||||
| -rw-r--r-- | src/engine/e_engine.h (renamed from src/engine/engine.h) | 0 | ||||
| -rw-r--r-- | src/engine/e_interface.h (renamed from src/engine/interface.h) | 2 | ||||
| -rw-r--r-- | src/engine/e_keynames.c (renamed from src/engine/keynames.c) | 0 | ||||
| -rw-r--r-- | src/engine/e_keys.h (renamed from src/engine/keys.h) | 0 | ||||
| -rw-r--r-- | src/engine/e_map.c (renamed from src/engine/map.c) | 2 | ||||
| -rw-r--r-- | src/engine/e_memheap.c (renamed from src/engine/memheap.c) | 2 | ||||
| -rw-r--r-- | src/engine/e_memheap.h (renamed from src/engine/memheap.h) | 0 | ||||
| -rw-r--r-- | src/engine/e_msg.c (renamed from src/engine/msg.c) | 4 | ||||
| -rw-r--r-- | src/engine/e_network.c (renamed from src/engine/network.c) | 6 | ||||
| -rw-r--r-- | src/engine/e_network.h (renamed from src/engine/network.h) | 0 | ||||
| -rw-r--r-- | src/engine/e_packer.c (renamed from src/engine/packer.c) | 4 | ||||
| -rw-r--r-- | src/engine/e_packer.h (renamed from src/engine/packer.h) | 0 | ||||
| -rw-r--r-- | src/engine/e_protocol.h (renamed from src/engine/protocol.h) | 2 | ||||
| -rw-r--r-- | src/engine/e_snapshot.c (renamed from src/engine/snapshot.c) | 4 | ||||
| -rw-r--r-- | src/engine/e_snapshot.h (renamed from src/engine/snapshot.h) | 2 | ||||
| -rw-r--r-- | src/engine/e_system.c (renamed from src/engine/system.c) | 4 | ||||
| -rw-r--r-- | src/engine/e_system.h (renamed from src/engine/system.h) | 2 | ||||
| -rw-r--r-- | src/engine/external/pa.c | 2 | ||||
| -rw-r--r-- | src/engine/server/es_server.c (renamed from src/engine/server/server.c) | 22 | ||||
| -rw-r--r-- | src/game/client/data/createdir.txt | 1 | ||||
| -rw-r--r-- | src/game/client/gc_client.cpp (renamed from src/game/client/game_client.cpp) | 24 | ||||
| -rw-r--r-- | src/game/client/gc_mapres_image.cpp (renamed from src/game/client/mapres_image.cpp) | 8 | ||||
| -rw-r--r-- | src/game/client/gc_mapres_image.h (renamed from src/game/client/mapres_image.h) | 0 | ||||
| -rw-r--r-- | src/game/client/gc_mapres_tilemap.cpp (renamed from src/game/client/mapres_tilemap.cpp) | 10 | ||||
| -rw-r--r-- | src/game/client/gc_mapres_tilemap.h (renamed from src/game/client/mapres_tilemap.h) | 0 | ||||
| -rw-r--r-- | src/game/client/gc_menu.cpp (renamed from src/game/client/menu2.cpp) | 28 | ||||
| -rw-r--r-- | src/game/client/gc_menu.h (renamed from src/game/client/menu.h) | 0 | ||||
| -rw-r--r-- | src/game/client/gc_render.h (renamed from src/game/client/cl_render.h) | 0 | ||||
| -rw-r--r-- | src/game/client/gc_skin.cpp (renamed from src/game/client/cl_skin.cpp) | 8 | ||||
| -rw-r--r-- | src/game/client/gc_skin.h (renamed from src/game/client/cl_skin.h) | 2 | ||||
| -rw-r--r-- | src/game/client/menu.cpp | 1865 | ||||
| -rw-r--r-- | src/game/g_game.cpp (renamed from src/game/game.cpp) | 2 | ||||
| -rw-r--r-- | src/game/g_game.h (renamed from src/game/game.h) | 10 | ||||
| -rw-r--r-- | src/game/g_mapres.h (renamed from src/game/mapres.h) | 0 | ||||
| -rw-r--r-- | src/game/g_mapres_col.cpp (renamed from src/game/mapres_col.cpp) | 12 | ||||
| -rw-r--r-- | src/game/g_mapres_col.h (renamed from src/game/mapres_col.h) | 2 | ||||
| -rw-r--r-- | src/game/g_math.h (renamed from src/game/math.h) | 0 | ||||
| -rw-r--r-- | src/game/g_protocol.h (renamed from src/game/game_protocol.h) | 0 | ||||
| -rw-r--r-- | src/game/g_variables.h (renamed from src/game/game_variables.h) | 0 | ||||
| -rw-r--r-- | src/game/g_version.h (renamed from src/game/version.h) | 2 | ||||
| -rw-r--r-- | src/game/g_vmath.h (renamed from src/game/vmath.h) | 0 | ||||
| -rw-r--r-- | src/game/generated/createdir.txt | 0 | ||||
| -rw-r--r-- | src/game/server/data/createdir.txt | 1 | ||||
| -rw-r--r-- | src/game/server/game_server.h | 2 | ||||
| -rw-r--r-- | src/game/server/gs_common.cpp (renamed from src/game/server/srv_common.cpp) | 4 | ||||
| -rw-r--r-- | src/game/server/gs_common.h (renamed from src/game/server/srv_common.h) | 4 | ||||
| -rw-r--r-- | src/game/server/gs_game_ctf.cpp (renamed from src/game/server/srv_ctf.cpp) | 4 | ||||
| -rw-r--r-- | src/game/server/gs_game_ctf.h (renamed from src/game/server/srv_ctf.h) | 0 | ||||
| -rw-r--r-- | src/game/server/gs_game_dm.cpp (renamed from src/game/server/srv_dm.cpp) | 6 | ||||
| -rw-r--r-- | src/game/server/gs_game_dm.h (renamed from src/game/server/srv_dm.h) | 0 | ||||
| -rw-r--r-- | src/game/server/gs_game_tdm.cpp (renamed from src/game/server/srv_tdm.cpp) | 6 | ||||
| -rw-r--r-- | src/game/server/gs_game_tdm.h (renamed from src/game/server/srv_tdm.h) | 0 | ||||
| -rw-r--r-- | src/game/server/gs_server.cpp (renamed from src/game/server/game_server.cpp) | 13 | ||||
| -rw-r--r-- | src/mastersrv/mastersrv.cpp | 4 | ||||
| -rw-r--r-- | src/tools/crapnet.cpp | 2 | ||||
| -rw-r--r-- | src/tools/fake_server.c | 6 | ||||
| -rw-r--r-- | src/tools/map_resave.c | 2 |
74 files changed, 167 insertions, 2037 deletions
diff --git a/src/editor/editor.cpp b/src/editor/editor.cpp index 4430cde1..43ee1651 100644 --- a/src/editor/editor.cpp +++ b/src/editor/editor.cpp @@ -3,18 +3,18 @@ #include <string.h> extern "C" { - #include <engine/system.h> - #include <engine/client/ui.h> - #include <engine/interface.h> - #include <engine/datafile.h> - #include <engine/config.h> + #include <engine/e_system.h> + #include <engine/client/ec_ui.h> + #include <engine/e_interface.h> + #include <engine/e_datafile.h> + #include <engine/e_config.h> } -#include <game/client/mapres_image.h> -#include <game/client/mapres_tilemap.h> +#include <game/client/gc_mapres_image.h> +#include <game/client/gc_mapres_tilemap.h> //#include "game/mapres_col.h" -#include <game/mapres.h> -#include <game/game.h> +#include <game/g_mapres.h> +#include <game/g_game.h> static int font_texture = 0; static int checker_texture = 0; diff --git a/src/engine/client/client.c b/src/engine/client/ec_client.c index 646ca4b4..78e7877c 100644 --- a/src/engine/client/client.c +++ b/src/engine/client/ec_client.c @@ -6,19 +6,19 @@ #include <stdio.h> #include <math.h> -#include <engine/system.h> -#include <engine/engine.h> -#include <engine/interface.h> -#include "ui.h" - -#include <engine/protocol.h> -#include <engine/snapshot.h> -#include <engine/compression.h> -#include <engine/network.h> -#include <engine/config.h> -#include <engine/packer.h> -#include <engine/memheap.h> -#include <engine/datafile.h> +#include <engine/e_system.h> +#include <engine/e_engine.h> +#include <engine/e_interface.h> +#include "ec_ui.h" + +#include <engine/e_protocol.h> +#include <engine/e_snapshot.h> +#include <engine/e_compression.h> +#include <engine/e_network.h> +#include <engine/e_config.h> +#include <engine/e_packer.h> +#include <engine/e_memheap.h> +#include <engine/e_datafile.h> #include <mastersrv/mastersrv.h> diff --git a/src/engine/client/gfx.c b/src/engine/client/ec_gfx.c index c61f0cb1..cd1f690b 100644 --- a/src/engine/client/gfx.c +++ b/src/engine/client/ec_gfx.c @@ -2,11 +2,11 @@ #include <engine/external/glfw/include/GL/glfw.h> #include <engine/external/pnglite/pnglite.h> -#include <engine/system.h> -#include <engine/interface.h> -#include <engine/engine.h> -#include <engine/config.h> -#include <engine/keys.h> +#include <engine/e_system.h> +#include <engine/e_interface.h> +#include <engine/e_engine.h> +#include <engine/e_config.h> +#include <engine/e_keys.h> #include <string.h> #include <stdio.h> diff --git a/src/engine/client/inp.c b/src/engine/client/ec_inp.c index 7ffb7f3f..0366cff5 100644 --- a/src/engine/client/inp.c +++ b/src/engine/client/ec_inp.c @@ -2,9 +2,9 @@ #include <string.h> #include <engine/external/glfw/include/GL/glfw.h> -#include <engine/system.h> -#include <engine/interface.h> -#include <engine/config.h> +#include <engine/e_system.h> +#include <engine/e_interface.h> +#include <engine/e_config.h> static int keyboard_state[2][1024]; /* TODO: fix this!! */ static int keyboard_current = 0; diff --git a/src/engine/client/snd.c b/src/engine/client/ec_snd.c index aa155c0c..89e18cb8 100644 --- a/src/engine/client/snd.c +++ b/src/engine/client/ec_snd.c @@ -1,7 +1,7 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/system.h> -#include <engine/interface.h> -#include <engine/config.h> +#include <engine/e_system.h> +#include <engine/e_interface.h> +#include <engine/e_config.h> #include <engine/external/portaudio/portaudio.h> #include <engine/external/wavpack/wavpack.h> diff --git a/src/engine/client/srvbrowse.c b/src/engine/client/ec_srvbrowse.c index 9fbbc2a0..9fc5ec02 100644 --- a/src/engine/client/srvbrowse.c +++ b/src/engine/client/ec_srvbrowse.c @@ -1,9 +1,9 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/system.h> -#include <engine/network.h> -#include <engine/interface.h> -#include <engine/config.h> -#include <engine/memheap.h> +#include <engine/e_system.h> +#include <engine/e_network.h> +#include <engine/e_interface.h> +#include <engine/e_config.h> +#include <engine/e_memheap.h> #include <mastersrv/mastersrv.h> diff --git a/src/engine/client/ui.c b/src/engine/client/ec_ui.c index 9486b2c1..5ba9c0d9 100644 --- a/src/engine/client/ui.c +++ b/src/engine/client/ec_ui.c @@ -1,8 +1,8 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/system.h> -#include <engine/interface.h> -#include <engine/config.h> -#include "ui.h" +#include <engine/e_system.h> +#include <engine/e_interface.h> +#include <engine/e_config.h> +#include "ec_ui.h" /******************************************************** UI diff --git a/src/engine/client/ui.h b/src/engine/client/ec_ui.h index 15c63b90..15c63b90 100644 --- a/src/engine/client/ui.h +++ b/src/engine/client/ec_ui.h diff --git a/src/engine/compression.c b/src/engine/e_compression.c index d99624c0..fa7d7866 100644 --- a/src/engine/compression.c +++ b/src/engine/e_compression.c @@ -1,5 +1,5 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "system.h" +#include "e_system.h" #include <string.h> /* Format: ESDDDDDD EDDDDDDD EDD... Extended, Data, Sign */ diff --git a/src/engine/compression.h b/src/engine/e_compression.h index 39ffd596..39ffd596 100644 --- a/src/engine/compression.h +++ b/src/engine/e_compression.h diff --git a/src/engine/config.c b/src/engine/e_config.c index 3fa6f98d..a4c47ec1 100644 --- a/src/engine/config.c +++ b/src/engine/e_config.c @@ -4,8 +4,8 @@ #include <stdio.h> #include <stdlib.h> -#include "system.h" -#include "config.h" +#include "e_system.h" +#include "e_config.h" /* buffered stream for reading lines, should perhaps be something smaller */ @@ -86,7 +86,7 @@ void config_reset() #define MACRO_CONFIG_INT(name,def,min,max) config.name = def; #define MACRO_CONFIG_STR(name,len,def) strncpy(config.name, def, len); - #include "config_variables.h" + #include "e_config_variables.h" #undef MACRO_CONFIG_INT #undef MACRO_CONFIG_STR @@ -127,7 +127,7 @@ void config_set(const char *line) #define MACRO_CONFIG_INT(name,def,min,max) { if (strcmp(#name, var_str) == 0) config_set_ ## name (&config, atoi(val_str)); } #define MACRO_CONFIG_STR(name,len,def) { if (strcmp(#name, var_str) == 0) { config_set_ ## name (&config, val_str); } } - #include "config_variables.h" + #include "e_config_variables.h" #undef MACRO_CONFIG_INT #undef MACRO_CONFIG_STR @@ -172,7 +172,7 @@ void config_save(const char *filename) #define MACRO_CONFIG_INT(name,def,min,max) { char str[256]; sprintf(str, "%s=%i%s", #name, config.name, newline); io_write(file, str, strlen(str)); } #define MACRO_CONFIG_STR(name,len,def) { io_write(file, #name, strlen(#name)); io_write(file, "=", 1); io_write(file, config.name, strlen(config.name)); io_write(file, newline, newline_len); } - #include "config_variables.h" + #include "e_config_variables.h" #undef MACRO_CONFIG_INT #undef MACRO_CONFIG_STR @@ -185,12 +185,12 @@ void config_save(const char *filename) #define MACRO_CONFIG_INT(name,def,min,max) int config_get_ ## name (CONFIGURATION *c) { return c->name; } #define MACRO_CONFIG_STR(name,len,def) const char *config_get_ ## name (CONFIGURATION *c) { return c->name; } -#include "config_variables.h" +#include "e_config_variables.h" #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(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" +#include "e_config_variables.h" #undef MACRO_CONFIG_INT #undef MACRO_CONFIG_STR diff --git a/src/engine/config.h b/src/engine/e_config.h index e01a7ec8..63933660 100644 --- a/src/engine/config.h +++ b/src/engine/e_config.h @@ -10,7 +10,7 @@ typedef struct { #define MACRO_CONFIG_INT(name,def,min,max) int name; #define MACRO_CONFIG_STR(name,len,def) char name[len]; - #include "config_variables.h" + #include "e_config_variables.h" #undef MACRO_CONFIG_INT #undef MACRO_CONFIG_STR } CONFIGURATION; @@ -24,13 +24,13 @@ void config_save(const char *filename); #define MACRO_CONFIG_INT(name,def,min,max) int config_get_ ## name (CONFIGURATION *c); #define MACRO_CONFIG_STR(name,len,def) const char *config_get_ ## name (CONFIGURATION *c); -#include "config_variables.h" +#include "e_config_variables.h" #undef MACRO_CONFIG_INT #undef MACRO_CONFIG_STR #define MACRO_CONFIG_INT(name,def,min,max) void config_set_ ## name (CONFIGURATION *c, int val); #define MACRO_CONFIG_STR(name,len,def) void config_set_ ## name (CONFIGURATION *c, const char *str); -#include "config_variables.h" +#include "e_config_variables.h" #undef MACRO_CONFIG_INT #undef MACRO_CONFIG_STR diff --git a/src/engine/config_variables.h b/src/engine/e_config_variables.h index 4a63e731..51ee7376 100644 --- a/src/engine/config_variables.h +++ b/src/engine/e_config_variables.h @@ -1,5 +1,5 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "../game/game_variables.h" +#include "../game/g_variables.h" MACRO_CONFIG_STR(player_name, 32, "nameless tee") diff --git a/src/engine/datafile.c b/src/engine/e_datafile.c index 7069044c..14138ed9 100644 --- a/src/engine/datafile.c +++ b/src/engine/e_datafile.c @@ -1,6 +1,6 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "system.h" -#include "datafile.h" +#include "e_system.h" +#include "e_datafile.h" #include "external/zlib/zlib.h" static const int DEBUG=0; diff --git a/src/engine/datafile.h b/src/engine/e_datafile.h index 7cc7b209..7cc7b209 100644 --- a/src/engine/datafile.h +++ b/src/engine/e_datafile.h diff --git a/src/engine/detect.h b/src/engine/e_detect.h index 04cca2d9..04cca2d9 100644 --- a/src/engine/detect.h +++ b/src/engine/e_detect.h diff --git a/src/engine/engine.c b/src/engine/e_engine.c index 08f13184..341bf936 100644 --- a/src/engine/engine.c +++ b/src/engine/e_engine.c @@ -2,9 +2,9 @@ #include <string.h> #include <stdio.h> -#include <engine/system.h> -#include <engine/interface.h> -#include <engine/config.h> +#include <engine/e_system.h> +#include <engine/e_interface.h> +#include <engine/e_config.h> static char application_save_path[512] = {0}; diff --git a/src/engine/engine.h b/src/engine/e_engine.h index 56fec20e..56fec20e 100644 --- a/src/engine/engine.h +++ b/src/engine/e_engine.h diff --git a/src/engine/interface.h b/src/engine/e_interface.h index 5cd8d604..67f8c78c 100644 --- a/src/engine/interface.h +++ b/src/engine/e_interface.h @@ -10,7 +10,7 @@ extern "C" { Title: Engine Interface */ -#include "keys.h" +#include "e_keys.h" enum { diff --git a/src/engine/keynames.c b/src/engine/e_keynames.c index fa87467d..fa87467d 100644 --- a/src/engine/keynames.c +++ b/src/engine/e_keynames.c diff --git a/src/engine/keys.h b/src/engine/e_keys.h index 77a52f58..77a52f58 100644 --- a/src/engine/keys.h +++ b/src/engine/e_keys.h diff --git a/src/engine/map.c b/src/engine/e_map.c index 921c05c7..6dfa4aa6 100644 --- a/src/engine/map.c +++ b/src/engine/e_map.c @@ -1,6 +1,6 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ #include <stdio.h> -#include "datafile.h" +#include "e_datafile.h" static DATAFILE *map = 0; diff --git a/src/engine/memheap.c b/src/engine/e_memheap.c index cb8ca664..6d117631 100644 --- a/src/engine/memheap.c +++ b/src/engine/e_memheap.c @@ -1,5 +1,5 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "system.h" +#include "e_system.h" typedef struct CHUNK_t { diff --git a/src/engine/memheap.h b/src/engine/e_memheap.h index 83082046..83082046 100644 --- a/src/engine/memheap.h +++ b/src/engine/e_memheap.h diff --git a/src/engine/msg.c b/src/engine/e_msg.c index d3f916fa..adfb1cd3 100644 --- a/src/engine/msg.c +++ b/src/engine/e_msg.c @@ -1,6 +1,6 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "interface.h" -#include "packer.h" +#include "e_interface.h" +#include "e_packer.h" /* message packing */ static PACKER msg_packer; diff --git a/src/engine/network.c b/src/engine/e_network.c index 85b4604f..b26e75f0 100644 --- a/src/engine/network.c +++ b/src/engine/e_network.c @@ -2,9 +2,9 @@ #include <string.h> #include <stdio.h> -#include "system.h" -#include "config.h" -#include "network.h" +#include "e_system.h" +#include "e_config.h" +#include "e_network.h" /* header (6 bytes) diff --git a/src/engine/network.h b/src/engine/e_network.h index 338c5982..338c5982 100644 --- a/src/engine/network.h +++ b/src/engine/e_network.h diff --git a/src/engine/packer.c b/src/engine/e_packer.c index 30cb6755..948db4ea 100644 --- a/src/engine/packer.c +++ b/src/engine/e_packer.c @@ -1,7 +1,7 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "packer.h" -#include "compression.h" +#include "e_packer.h" +#include "e_compression.h" void packer_reset(PACKER *p) { diff --git a/src/engine/packer.h b/src/engine/e_packer.h index 71b99ff7..71b99ff7 100644 --- a/src/engine/packer.h +++ b/src/engine/e_packer.h diff --git a/src/engine/protocol.h b/src/engine/e_protocol.h index e85ecf9f..0e8a63f4 100644 --- a/src/engine/protocol.h +++ b/src/engine/e_protocol.h @@ -1,5 +1,5 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "system.h" +#include "e_system.h" /* Connection diagram - How the initilization works. diff --git a/src/engine/snapshot.c b/src/engine/e_snapshot.c index 4db6ac26..91b7797b 100644 --- a/src/engine/snapshot.c +++ b/src/engine/e_snapshot.c @@ -1,6 +1,6 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "snapshot.h" -#include "compression.h" +#include "e_snapshot.h" +#include "e_compression.h" int *snapitem_data(SNAPSHOT_ITEM *item) { return (int *)(item+1); } diff --git a/src/engine/snapshot.h b/src/engine/e_snapshot.h index 60131d4f..0a74b0dc 100644 --- a/src/engine/snapshot.h +++ b/src/engine/e_snapshot.h @@ -2,7 +2,7 @@ #ifndef ENGINE_SNAPSHOT_H #define ENGINE_SNAPSHOT_H -#include "system.h" +#include "e_system.h" /* SNAPSHOT */ diff --git a/src/engine/system.c b/src/engine/e_system.c index 8e5bd8e5..90aeccc5 100644 --- a/src/engine/system.c +++ b/src/engine/e_system.c @@ -6,8 +6,8 @@ #include <ctype.h> #include <time.h> -#include "detect.h" -#include "system.h" +#include "e_detect.h" +#include "e_system.h" #if defined(CONF_FAMILY_UNIX) #include <sys/time.h> diff --git a/src/engine/system.h b/src/engine/e_system.h index e54af0f1..4802111f 100644 --- a/src/engine/system.h +++ b/src/engine/e_system.h @@ -2,7 +2,7 @@ #ifndef BASE_SYSTEM_H #define BASE_SYSTEM_H -#include "detect.h" +#include "e_detect.h" #ifdef __cplusplus extern "C" { diff --git a/src/engine/external/pa.c b/src/engine/external/pa.c index a417e9db..71afc065 100644 --- a/src/engine/external/pa.c +++ b/src/engine/external/pa.c @@ -1,5 +1,5 @@ /* Include the auto configuration */ -#include <engine/detect.h> +#include <engine/e_detect.h> /* common part */ #include "portaudio/pa_converters.c" diff --git a/src/engine/server/server.c b/src/engine/server/es_server.c index d2ef39ed..00100b10 100644 --- a/src/engine/server/server.c +++ b/src/engine/server/es_server.c @@ -3,20 +3,20 @@ #include <string.h> #include <stdlib.h> -#include <engine/system.h> -#include <engine/config.h> -#include <engine/engine.h> -#include <engine/interface.h> +#include <engine/e_system.h> +#include <engine/e_config.h> +#include <engine/e_engine.h> +#include <engine/e_interface.h> -#include <engine/protocol.h> -#include <engine/snapshot.h> +#include <engine/e_protocol.h> +#include <engine/e_snapshot.h> -#include <engine/compression.h> +#include <engine/e_compression.h> -#include <engine/network.h> -#include <engine/config.h> -#include <engine/packer.h> -#include <engine/datafile.h> +#include <engine/e_network.h> +#include <engine/e_config.h> +#include <engine/e_packer.h> +#include <engine/e_datafile.h> #include <mastersrv/mastersrv.h> diff --git a/src/game/client/data/createdir.txt b/src/game/client/data/createdir.txt deleted file mode 100644 index 258b42d5..00000000 --- a/src/game/client/data/createdir.txt +++ /dev/null @@ -1 +0,0 @@ -this file is here to make sure that this directory gets created diff --git a/src/game/client/game_client.cpp b/src/game/client/gc_client.cpp index 00deea5f..98275188 100644 --- a/src/game/client/game_client.cpp +++ b/src/game/client/gc_client.cpp @@ -1,23 +1,23 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <game/math.h> +#include <game/g_math.h> #include <stdlib.h> #include <stdio.h> #include <string.h> extern "C" { - #include <engine/client/ui.h> - #include <engine/config.h> + #include <engine/client/ec_ui.h> + #include <engine/e_config.h> }; -#include "../game.h" -#include "../version.h" -#include "../mapres.h" -#include "mapres_image.h" -#include "mapres_tilemap.h" -#include "data.h" -#include "menu.h" -#include "cl_skin.h" -#include "cl_render.h" +#include "../g_game.h" +#include "../g_version.h" +#include "../g_mapres.h" +#include "gc_mapres_image.h" +#include "gc_mapres_tilemap.h" +#include "../generated/gc_data.h" +#include "gc_menu.h" +#include "gc_skin.h" +#include "gc_render.h" // sound channels enum diff --git a/src/game/client/mapres_image.cpp b/src/game/client/gc_mapres_image.cpp index 1ef1617c..cc9a8143 100644 --- a/src/game/client/mapres_image.cpp +++ b/src/game/client/gc_mapres_image.cpp @@ -1,8 +1,8 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/system.h> -#include <engine/interface.h> -#include "mapres_image.h" -#include "../mapres.h" +#include <engine/e_system.h> +#include <engine/e_interface.h> +#include "gc_mapres_image.h" +#include "../g_mapres.h" static int map_textures[64] = {0}; static int count = 0; diff --git a/src/game/client/mapres_image.h b/src/game/client/gc_mapres_image.h index f841ca53..f841ca53 100644 --- a/src/game/client/mapres_image.h +++ b/src/game/client/gc_mapres_image.h diff --git a/src/game/client/mapres_tilemap.cpp b/src/game/client/gc_mapres_tilemap.cpp index 6bee4081..6e687495 100644 --- a/src/game/client/mapres_tilemap.cpp +++ b/src/game/client/gc_mapres_tilemap.cpp @@ -1,9 +1,9 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/interface.h> -#include <engine/config.h> -#include "mapres_tilemap.h" -#include "mapres_image.h" -#include "../mapres.h" +#include <engine/e_interface.h> +#include <engine/e_config.h> +#include "gc_mapres_tilemap.h" +#include "gc_mapres_image.h" +#include "../g_mapres.h" int tilemap_init() { diff --git a/src/game/client/mapres_tilemap.h b/src/game/client/gc_mapres_tilemap.h index a13495ed..a13495ed 100644 --- a/src/game/client/mapres_tilemap.h +++ b/src/game/client/gc_mapres_tilemap.h diff --git a/src/game/client/menu2.cpp b/src/game/client/gc_menu.cpp index 04ed48b0..de9047df 100644 --- a/src/game/client/menu2.cpp +++ b/src/game/client/gc_menu.cpp @@ -4,26 +4,26 @@ #include <string.h> #include <stdlib.h> -#include <game/math.h> -#include <game/vmath.h> +#include <game/g_math.h> +#include <game/g_vmath.h> extern "C" { - #include <engine/system.h> - #include <engine/interface.h> - #include <engine/config.h> - #include <engine/client/ui.h> + #include <engine/e_system.h> + #include <engine/e_interface.h> + #include <engine/e_config.h> + #include <engine/client/ec_ui.h> } -#include "../mapres.h" -#include "../version.h" -#include "../game_protocol.h" +#include "../g_mapres.h" +#include "../g_version.h" +#include "../g_protocol.h" -#include "mapres_image.h" -#include "mapres_tilemap.h" +#include "gc_mapres_image.h" +#include "gc_mapres_tilemap.h" -#include "data.h" -#include "cl_render.h" -#include "cl_skin.h" +#include "../generated/gc_data.h" +#include "gc_render.h" +#include "gc_skin.h" #include <mastersrv/mastersrv.h> extern data_container *data; diff --git a/src/game/client/menu.h b/src/game/client/gc_menu.h index 5c68c53d..5c68c53d 100644 --- a/src/game/client/menu.h +++ b/src/game/client/gc_menu.h diff --git a/src/game/client/cl_render.h b/src/game/client/gc_render.h index fc85d49a..fc85d49a 100644 --- a/src/game/client/cl_render.h +++ b/src/game/client/gc_render.h diff --git a/src/game/client/cl_skin.cpp b/src/game/client/gc_skin.cpp index da8fe535..cc5699e4 100644 --- a/src/game/client/cl_skin.cpp +++ b/src/game/client/gc_skin.cpp @@ -1,10 +1,10 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ #include <string.h> #include <stdio.h> -#include <engine/system.h> -#include <engine/interface.h> -#include "cl_skin.h" -#include "../math.h" +#include <engine/e_system.h> +#include <engine/e_interface.h> +#include "gc_skin.h" +#include "../g_math.h" enum { diff --git a/src/game/client/cl_skin.h b/src/game/client/gc_skin.h index bafc76b9..3742d04e 100644 --- a/src/game/client/cl_skin.h +++ b/src/game/client/gc_skin.h @@ -1,5 +1,5 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "../vmath.h" +#include "../g_vmath.h" // do this better and nicer typedef struct diff --git a/src/game/client/menu.cpp b/src/game/client/menu.cpp deleted file mode 100644 index 10dafc39..00000000 --- a/src/game/client/menu.cpp +++ /dev/null @@ -1,1865 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#if 0 - -#include <stdio.h> -#include <math.h> -#include <string.h> -#include <stdlib.h> - -#include <game/math.h> - -extern "C" { - #include <engine/system.h> - #include <engine/interface.h> - #include <engine/config.h> - #include <engine/client/ui.h> -} - -#include "../mapres.h" -#include "../version.h" - -#include "mapres_image.h" -#include "mapres_tilemap.h" - -#include "data.h" -#include <mastersrv/mastersrv.h> - -extern data_container *data; - -/******************************************************** - MENU -*********************************************************/ - -enum gui_tileset_enum -{ - tileset_regular, - tileset_hot, - tileset_active, - tileset_inactive -}; - -void draw_area(gui_tileset_enum tileset, int areax, int areay, int areaw, int areah, float x, float y, float w, float h) -{ -/* - const float tex_w = 512.0, tex_h = 512.0; - - switch (tileset) - { - case tileset_regular: - break; - case tileset_hot: - areax += 192; areay += 192; break; - case tileset_active: - areay += 192; break; - case tileset_inactive: - areax += 192; break; - default: - dbg_msg("menu", "invalid tileset given to draw_part"); - } - - float ts_x = areax / tex_w; - float ts_y = areay / tex_h; - float te_x = (areax + areaw) / tex_w; - float te_y = (areay + areah) / tex_h; - - gfx_blend_normal(); - gfx_texture_set(data->images[IMAGE_GUI_WIDGETS].id); - gfx_quads_begin(); - gfx_setcolor(1,1,1,1); - gfx_quads_setsubset( - ts_x, // startx - ts_y, // starty - te_x, // endx - te_y); // endy - gfx_quads_drawTL(x,y,w,h); - gfx_quads_end(); - */ -} - -void draw_part(int part_type, gui_tileset_enum tileset, float x, float y, float w, float h) -{ - gui_box part = data->gui.misc[part_type]; - - draw_area(tileset, part.x, part.y, part.w, part.h, x, y, w, h); - - //draw_part(parts[part], tileset, x, y, w, h); -} - -void draw_part(int part_type, gui_tileset_enum tileset, float x, float y) -{ - gui_box part = data->gui.misc[part_type]; - - draw_part(part_type, tileset, x, y, part.w, part.h); -} - -void draw_box(int box_type, gui_tileset_enum tileset, float x, float y, float w, float h) -{ - gui_compositebox box = data->gui.boxes[box_type]; - - /* A composite box consists of 9 parts. To get the coordinates for all corners, we need A, B, C and D: - * A----+----+----+ - * | tl | tm | tr | - * +----B----+----+ - * | ml | mm | mr | - * +----+----C----+ - * | bl | bm | br | - * +----+----+----D - */ - - int ax = box.rect.x; - int ay = box.rect.y; - - int bx = box.center.x; - int by = box.center.y; - - int cx = box.center.x + box.center.w; - int cy = box.center.y + box.center.h; - - int dx = box.rect.x + box.rect.w; - int dy = box.rect.y + box.rect.h; - - draw_area(tileset, ax, ay, bx-ax, by-ay, x, y, bx-ax, by-ay); - draw_area(tileset, bx, ay, cx-bx, by-ay, x+bx-ax, y, w-(bx-ax)-(dx-cx), by-ay); - draw_area(tileset, cx, ay, dx-cx, by-ay, x+w-(dx-cx), y, dx-cx, by-ay); - - draw_area(tileset, ax, by, bx-ax, min(int(h-(by-ay)-(dy-cy)), cy-by), x, y+(by-ay), bx-ax, h-(by-ay)-(dy-cy)); - draw_area(tileset, bx, by, cx-bx, cy-by, x+bx-ax, y+(by-ay), w-(bx-ax)-(dx-cx), h-(by-ay)-(dy-cy)); - draw_area(tileset, cx, by, dx-cx, min(int(h-(by-ay)-(dy-cy)), cy-by), x+w-(dx-cx), y+(by-ay), dx-cx, h-(by-ay)-(dy-cy)); - - draw_area(tileset, ax, cy, bx-ax, dy-cy, x, y+h-(dy-cy), bx-ax, dy-cy); - draw_area(tileset, bx, cy, cx-bx, dy-cy, x+bx-ax, y+h-(dy-cy), w-(bx-ax)-(dx-cx), dy-cy); - draw_area(tileset, cx, cy, dx-cx, dy-cy, x+w-(dx-cx), y+h-(dy-cy), dx-cx, dy-cy); -} - -extern "C" -{ - -struct pretty_font -{ - float m_CharStartTable[256]; - float m_CharEndTable[256]; - int font_texture; -}; - -extern pretty_font *current_font; - -} - -extern void render_sun(float x, float y); -extern void select_sprite(int id, int flags=0, int sx=0, int sy=0); -extern void draw_sprite(float x, float y, float size); - -void draw_background(float t) -{ - // background color - gfx_clear(0.65f,0.78f,0.9f); - - gfx_blend_normal(); - - render_sun(170, 170); - - gfx_texture_set(data->images[IMAGE_CLOUDS].id); - gfx_quads_begin(); - select_sprite(SPRITE_CLOUD1); - draw_sprite(3500 - fmod(t * 20 + 2000, 4524), 250, 512); - select_sprite(SPRITE_CLOUD2); - draw_sprite(3000 - fmod(t * 50 + 2000, 4024), 150+250, 512); - select_sprite(SPRITE_CLOUD3); - draw_sprite(4000 - fmod(t * 60 + 500, 4512), 300+130, 256); - gfx_quads_end(); - - /* - gfx_texture_set(data->images[IMAGE_MENU_BACKGROUND].id); - gfx_quads_begin(); - gfx_quads_drawTL(0, 430, 1600, 1600/2); - gfx_quads_end(); - */ - -/* - int frame = int(t * 10) % 3; - - //float x_path = -t - - float x_nudge = 3*cos(t*10); - float y_nudge = 8*sin(t*3); - - x_nudge += 150 * cos(t/3); - y_nudge += 30 * sin(t/3); - - float angl = t/3; - angl = fmod(angl, 2*pi); - - bool flip = angl > pi; - - gfx_texture_set(data->images[IMAGE_MENU_BUTTERFLY].id); - gfx_quads_begin(); - gfx_setcolor(1, 1, 1, 1); - gfx_quads_setsubset( - flip ? (frame + 1) * 0.25f : frame * 0.25f, // startx - 0.0f, // starty - flip ? frame * 0.25f : (frame + 1) * 0.25f, // endx - 0.5f); // endy - gfx_quads_drawTL(1250 + x_nudge, 480 + y_nudge, 64, 64); - gfx_quads_end(); - */ -} - -void draw_image_button(const void *id, const char *text, int checked, float x, float y, float w, float h, void *extra) -{ - ui_do_image(*(int *)id, x, y, w, h); -} - -void draw_single_part_button(const void *id, const char *text, int checked, float x, float y, float w, float h, void *extra) -{ - gui_tileset_enum tileset; - - if (ui_active_item() == id && ui_hot_item() == id) - tileset = tileset_active; - else if (ui_hot_item() == id) - tileset = tileset_hot; - else - tileset = tileset_regular; - - - draw_part((int)((char*)extra-(char*)0), tileset, x, y, w, h); -} - -void draw_menu_button(const void *id, const char *text, int checked, float x, float y, float w, float h, void *extra) -{ - int box_type; - if ((int)((char*)extra-(char*)0)) - box_type = GUI_BOX_SCREEN_INFO; - else - box_type = GUI_BOX_SCREEN_LIST; - draw_box(box_type, tileset_regular, x, y, w, h); - - ui_do_label(x + 10, y, text, 28); -} - -void draw_teewars_button(const void *id, const char *text, int checked, float x, float y, float w, float h, void *extra) -{ - const float font_size = h-6.0f;//42.0f; - - float text_width = gfx_pretty_text_width(font_size, text, -1); - gui_tileset_enum tileset; - - if (ui_active_item() == id) - { - int inside = ui_mouse_inside(x, y, w, h); - tileset = inside ? tileset_active : tileset_hot; - } - else if (ui_hot_item() == id) - tileset = tileset_hot; - else - tileset = tileset_regular; - - if ((int)((char*)extra-(char*)0) == 1) - tileset = tileset_inactive; - - draw_box(GUI_BOX_BUTTON, tileset, x, y, w, h); - - ui_do_label(x + w/2 - text_width/2, y + 2, text, font_size); -} - -/* -struct server_info -{ - int version; - int players; - int max_players; - netaddr4 address; - char name[129]; - char map[65]; -};*/ - -struct server_list -{ - int active_count, info_count; - int scroll_index; - int selected_index; -}; - -int ui_do_key_reader(void *id, float x, float y, float w, float h, int key) -{ - // process - static bool mouse_released = true; - int inside = ui_mouse_inside(x, y, w, h); - int new_key = key; - - if(!ui_mouse_button(0)) - mouse_released = true; - - if(ui_active_item() == id) - { - int k = inp_last_key(); - if (k) - { - new_key = k; - ui_set_active_item(0); - mouse_released = false; - } - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0) && mouse_released) - ui_set_active_item(id); - } - - if(inside) - ui_set_hot_item(id); - - // draw - int box_type; - if (ui_active_item() == id || ui_hot_item() == id) - box_type = GUI_BOX_SCREEN_INFO; - else - box_type = GUI_BOX_SCREEN_TEXTBOX; - draw_box(box_type, tileset_regular, x, y, w, h); - - const char *str = inp_key_name(key); - ui_do_label(x + 10, y, str, 36); - if (ui_active_item() == id) - { - float w = gfx_pretty_text_width(36.0f, str, -1); - ui_do_label(x + 10 + w, y, "_", 36); - } - - return new_key; -} - -int ui_do_combo_box(void *id, float x, float y, float w, const char **lines, int line_count, int selected_index) -{ - float line_height = 36.0f; - float height = line_count * line_height; - - int inside = (ui_active_item() == id) ? ui_mouse_inside(x, y, w, height) : ui_mouse_inside(x, y, w, line_height); - int hover_index = (int)((ui_mouse_y() - y) / line_height); - - if (ui_active_item() == id) - { - if (!ui_mouse_button(0)) - { - ui_set_active_item(0); - - if (inside) - selected_index = hover_index; - } - } - else if(ui_hot_item() == id) - { - if (ui_mouse_button(0)) - { - ui_set_active_item(id); - } - } - - if (inside) - { - ui_set_hot_item(id); - } - - if (ui_active_item() == id) - { - for (int i = 0; i < line_count; i++) - { - int box_type; - if (inside && hover_index == i) - box_type = GUI_BOX_SCREEN_INFO; - else - box_type = GUI_BOX_SCREEN_LIST; - - draw_box(box_type, tileset_regular, x, y + i * line_height, w, line_height); - ui_do_label(x + 10 + 10, y + i * line_height, lines[i], 36); - if (selected_index == i) - ui_do_label(x + 10, y + i * line_height, "-", 36); - } - } - else - { - int box_type; - if (ui_active_item() == id || ui_hot_item() == id) - box_type = GUI_BOX_SCREEN_INFO; - else - box_type = GUI_BOX_SCREEN_TEXTBOX; - draw_box(box_type, tileset_regular, x, y, w, line_height); - ui_do_label(x + 10, y, lines[selected_index], 36); - } - - return selected_index; -} - -int ui_do_edit_box(void *id, float x, float y, float w, float h, char *str, int str_size) -{ - int inside = ui_mouse_inside(x, y, w, h); - int r = 0; - static int at_index = 0; - - if(ui_last_active_item() == id) - { - int c = inp_last_char(); - int k = inp_last_key(); - int len = strlen(str); - - if (inside && ui_mouse_button(0)) - { - int mx_rel = (int)(ui_mouse_x() - x); - - for (int i = 1; i <= len; i++) - { - if (gfx_pretty_text_width(36.0f, str, i) + 10 > mx_rel) - { - at_index = i - 1; - break; - } - - if (i == len) - at_index = len; - } - } - - if (at_index > len) - at_index = len; - - if (!(c >= 0 && c < 32)) - { - if (len < str_size - 1 && at_index < str_size - 1) - { - memmove(str + at_index + 1, str + at_index, len - at_index + 1); - str[at_index] = c; - at_index++; - } - } - - if (k == KEY_BACKSPACE && at_index > 0) - { - memmove(str + at_index - 1, str + at_index, len - at_index + 1); - at_index--; - } - else if (k == KEY_DEL && at_index < len) - memmove(str + at_index, str + at_index + 1, len - at_index); - else if (k == KEY_ENTER) - ui_clear_last_active_item(); - else if (k == KEY_LEFT && at_index > 0) - at_index--; - else if (k == KEY_RIGHT && at_index < len) - at_index++; - else if (k == KEY_HOME) - at_index = 0; - else if (k == KEY_END) - at_index = len; - - r = 1; - } - - int box_type; - if (ui_active_item() == id || ui_hot_item() == id || ui_last_active_item() == id) - box_type = GUI_BOX_SCREEN_INFO; - else - box_type = GUI_BOX_SCREEN_TEXTBOX; - - bool just_got_active = false; - - if(ui_active_item() == id) - { - if(!ui_mouse_button(0)) - ui_set_active_item(0); - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0)) - { - if (ui_last_active_item() != id) - just_got_active = true; - ui_set_active_item(id); - } - } - - if(inside) - ui_set_hot_item(id); - - draw_box(box_type, tileset_regular, x, y, w, h); - - ui_do_label(x + 10, y, str, 36); - - if (ui_last_active_item() == id && !just_got_active) - { - float w = gfx_pretty_text_width(36.0f, str, at_index); - ui_do_label(x + 10 + w, y, "_", 36); - } - - return r; -} - -int ui_do_check_box(void *id, float x, float y, float w, float h, int value) -{ - int inside = ui_mouse_inside(x, y, w, h); - int r = value; - - if(ui_active_item() == id) - { - if(!ui_mouse_button(0)) - { - ui_set_active_item(0); - r = r ? 0 : 1; - } - } - else if(ui_hot_item() == id) - { - if(ui_mouse_button(0)) - ui_set_active_item(id); - } - - if(inside) - ui_set_hot_item(id); - - // render - gui_tileset_enum tileset; - int part_type; - if (ui_active_item() == id) - tileset = tileset_active; - else if (ui_hot_item() == id) - tileset = tileset_hot; - else - tileset = tileset_regular; - - part_type = r ? GUI_MISC_RADIO_CHECKED : GUI_MISC_RADIO_UNCHECKED; - - draw_part(part_type, tileset, x, y, w, h); - - return r; -} - -int do_scroll_bar_horiz(void *id, float x, float y, float width, int steps, int last_index) -{ - int r = last_index; - - static int up_button; - static int down_button; - - if (ui_do_button(&up_button, "", 0, x, y + 8, 16, 16, draw_single_part_button, (void *)GUI_MISC_SLIDER_BIG_ARROW_LEFT)) - { - if (r > 0) - --r; - } - if (ui_do_button(&down_button, "", 0, x + width - 16, y + 8, 16, 16, draw_single_part_button, (void *)GUI_MISC_SLIDER_BIG_ARROW_RIGHT)) - { - if (r < steps) - ++r; - } - if (steps > 0) // only if there's actually stuff to scroll through - { - int inside = ui_mouse_inside(x + 16, y, width - 32, 32); - if (inside && (!ui_active_item() || ui_active_item() == id)) - ui_set_hot_item(id); - - if(ui_active_item() == id) - { - if (ui_mouse_button(0)) - { - float pos = ui_mouse_x() - x - 16; - float perc = pos / (width - 32); - - r = (int)((steps + 1) * perc); - if (r < 0) - r = 0; - else if (r > steps) - r = steps; - } - else - ui_set_active_item(0); - } - else if (ui_hot_item() == id && ui_mouse_button(0)) - ui_set_active_item(id); - else if (inside && (!ui_active_item() || ui_active_item() == id)) - ui_set_hot_item(id); - } - - draw_part(GUI_MISC_SLIDER_BIG_HORIZ_BEGIN, tileset_regular, x + 16, y + 8, 16, 16); - draw_part(GUI_MISC_SLIDER_BIG_HORIZ_MID, tileset_regular, x + 32, y + 8, width - 32 - 32, 16); - draw_part(GUI_MISC_SLIDER_BIG_HORIZ_END, tileset_regular, x + width - 32, y + 8, 16, 16); - - draw_part(GUI_MISC_SLIDER_BIG_HANDLE_HORIZ, tileset_regular, x + 16 + r * ((width - 64) / steps), y + 8, 32, 16); - - return r; -} - -int do_scroll_bar_vert(void *id, float x, float y, float height, int steps, int last_index) -{ - int r = last_index; - - static int up_button; - static int down_button; - - if (ui_do_button(&up_button, "", 0, x + 8, y, 16, 16, draw_single_part_button, (void *)GUI_MISC_SLIDER_BIG_ARROW_UP)) - { - if (r > 0) - --r; - } - if (ui_do_button(&down_button, "", 0, x + 8, y + height - 16, 16, 16, draw_single_part_button, (void *)GUI_MISC_SLIDER_BIG_ARROW_DOWN)) - { - if (r < steps) - ++r; - } - if (steps > 0) // only if there's actually stuff to scroll through - { - int inside = ui_mouse_inside(x, y + 16, 16, height - 32); - if (inside && (!ui_active_item() || ui_active_item() == id)) - ui_set_hot_item(id); - - if(ui_active_item() == id) - { - if (ui_mouse_button(0)) - { - float pos = ui_mouse_y() - y - 32; - float perc = pos / (height - 32); - - r = (int)((steps + 1) * perc); - if (r < 0) - r = 0; - else if (r > steps) - r = steps; - } - else - ui_set_active_item(0); - } - else if (ui_hot_item() == id && ui_mouse_button(0)) - ui_set_active_item(id); - else if (inside && (!ui_active_item() || ui_active_item() == id)) - ui_set_hot_item(id); - } - - draw_part(GUI_MISC_SLIDER_BIG_VERT_BEGIN, tileset_regular, x + 8, y + 16, 16, 16); - draw_part(GUI_MISC_SLIDER_BIG_VERT_MID, tileset_regular, x + 8, y + 32, 16, height - 32 - 32); - draw_part(GUI_MISC_SLIDER_BIG_VERT_END, tileset_regular, x + 8, y + height - 32, 16, 16); - - draw_part(GUI_MISC_SLIDER_BIG_HANDLE_VERT, tileset_regular, x + 8, y + 16 + r * ((height - 64) / steps), 16, 32); - - return r; -} - -int ui_do_button_rect(const void *id, const char *text, int checked, const struct rect *r, draw_button_callback draw_func, void *extra) -{ - return ui_do_button((void *)id, text, checked, r->x, r->y, r->w, r->h, draw_func, extra); -} - -void ui_do_label_rect(const struct rect *r, char *str) -{ - float size = r->h; - ui_do_label(r->x + 3, r->y + r->h/2 - size/2, str, size); -} - -void ui_do_edit_box_rect(const void *id, const struct rect *r, char *buffer, int bufferSize) -{ - ui_do_edit_box((void *)id, r->x, r->y, r->w, r->h, buffer, bufferSize); -} - -int ui_do_check_box_rect(const void *id, const struct rect *r, int checked) -{ - return ui_do_check_box((void *)id, r->x, r->y, 32, 32, checked); -} - -int ui_do_key_reader_rect(const void *id, const struct rect *r, int key) -{ - return ui_do_key_reader((void *)id, r->x, r->y, r->w, r->h, key); -} - -int do_scroll_bar_horiz_rect(const void *id, const struct rect *r, int steps, int last_index) -{ - return do_scroll_bar_horiz((void *)id, r->x, r->y, r->w, steps, last_index); - //return do_scroll_bar_horiz((void *)id, r->x, r->y, r->w, r->h, steps, last_index); -} - - -static int do_server_list(float x, float y, int *scroll_index, int *selected_index, int visible_items) -{ - const float spacing = 3.f; - const float item_height = 28; - const float item_width = 728; - const float real_width = item_width + 20; - const float real_height = item_height * visible_items + spacing * (visible_items - 1); - - int num_servers = client_serverbrowse_sorted_num(); - - int r = -1; - - for (int i = 0; i < visible_items; i++) - { - int item_index = i + *scroll_index; - if (item_index >= num_servers) - ; - //ui_do_image(empty_item_texture, x, y + i * item_height + i * spacing, item_width, item_height); - else - { - SERVER_INFO *item = client_serverbrowse_sorted_get(item_index); - - bool clicked = false; - clicked = ui_do_button(item, item->name, 0, x, y + i * item_height + i * spacing, item_width, item_height, - draw_menu_button, (*selected_index == item_index) ? (void *)1 : 0); - - char temp[64]; // plenty of extra room so we don't get sad :o - sprintf(temp, "%i/%i %3d", item->num_players, item->max_players, item->latency); - - ui_do_label(x + 600, y + i * item_height + i * spacing, temp, item_height); - ui_do_label(x + 360, y + i * item_height + i * spacing, item->map, item_height); - - if (clicked) - { - r = item_index; - *selected_index = item_index; - } - } - } - - *scroll_index = do_scroll_bar_vert(scroll_index, x + real_width - 16, y, real_height, - max(num_servers - visible_items, 0), *scroll_index); - - return r; -} - -enum -{ - SCREEN_SERVERS, - SCREEN_NEWS, - SCREEN_HOST, - SCREEN_DISCONNECTED, - SCREEN_CONNECTING, - SCREEN_SETTINGS_GENERAL, - SCREEN_SETTINGS_CONTROLS, - SCREEN_SETTINGS_VIDEO, - SCREEN_SETTINGS_VIDEO_SELECT_MODE, - SCREEN_SETTINGS_VIDEO_CUSTOM, - SCREEN_SETTINGS_SOUND, - SCREEN_KERNING -}; - -static int screen = SCREEN_SERVERS; -static CONFIGURATION config_copy; - -const float column1_x = 250; -const float column2_x = column1_x + 170; -const float column3_x = column2_x + 170; -const float row1_y = 180; -const float row2_y = row1_y + 40; -const float row3_y = row2_y + 40; -const float row4_y = row3_y + 40; -const float row5_y = row4_y + 40; -const float row6_y = row5_y + 40; -const float row7_y = row6_y + 40; - -static char address[128] = "localhost:8303"; - -static float colors[7][3] = -{ - { 0, 0, 1 }, - { 0, 1, 0 }, - { 0, 1, 1 }, - { 1, 0, 0 }, - { 1, 0, 1 }, - { 1, 1, 0 }, - { 1, 1, 1 }, -}; - -static void draw_rect(const struct rect *r) -{ - float *color = colors[rand()%7]; - gfx_setcolor(color[0], color[1], color[2], 1); - - gfx_lines_draw(r->x, r->y, r->x+r->w, r->y); - gfx_lines_draw(r->x+r->w, r->y, r->x+r->w, r->y+r->h); - gfx_lines_draw(r->x+r->w, r->y+r->h, r->x, r->y+r->h); - gfx_lines_draw(r->x, r->y+r->h, r->x, r->y); -} - -void ui_settings_general_render(const struct rect *r) -{ - static struct rect row1; - static struct rect row2; - static struct rect rest; - - static struct rect cells[4]; - - ui_hsplit_t(r, 50, &row1, &rest); - ui_hsplit_t(&rest, 50, &row2, &rest); - - ui_vsplit_l(&row1, 100, &cells[0], &cells[1]); - ui_vsplit_l(&row2, 100, &cells[2], &cells[3]); - - // NAME - ui_do_label_rect(&cells[0], "Name:"); - ui_do_edit_box_rect(config_copy.player_name, &cells[1], config_copy.player_name, sizeof(config_copy.player_name)); - - // Dynamic camera - ui_do_label_rect(&cells[2], "Dynamic Camera:"); - config_set_dynamic_camera(&config_copy, ui_do_check_box_rect(&config_copy.dynamic_camera, &cells[3], config_copy.dynamic_camera)); -} - -typedef void (*assign_func_callback)(CONFIGURATION *config, int value); - -struct key_thing -{ - char name[32]; - int *key; - assign_func_callback assign_func; -}; - -static void ui_settings_controls_render(const struct rect *r) -{ - static int scroll_index = 0; - - const key_thing keys[] = - { - { "Move Left:", &config_copy.key_move_left, config_set_key_move_left }, - { "Move Right:", &config_copy.key_move_right, config_set_key_move_right }, - { "Jump:", &config_copy.key_jump, config_set_key_jump }, - { "Fire:", &config_copy.key_fire, config_set_key_fire }, - { "Hook:", &config_copy.key_hook, config_set_key_hook }, - { "Hammer:", &config_copy.key_weapon1, config_set_key_weapon1 }, - { "Pistol:", &config_copy.key_weapon2, config_set_key_weapon2 }, - { "Shotgun:", &config_copy.key_weapon3, config_set_key_weapon3 }, - { "Grenade:", &config_copy.key_weapon4, config_set_key_weapon4 }, - { "Next Weapon:", &config_copy.key_next_weapon, config_set_key_next_weapon }, - { "Prev. Weapon:", &config_copy.key_prev_weapon, config_set_key_prev_weapon }, - { "Emoticon:", &config_copy.key_emoticon, config_set_key_emoticon }, - { "Screenshot:", &config_copy.key_screenshot, config_set_key_screenshot }, - }; - - const int key_count = sizeof(keys) / sizeof(key_thing); - - struct rect rest = *r; - - for (int i = 0; i < key_count; i++) - { - struct rect row; - struct rect left, right; - - ui_hsplit_t(&rest, 32, &row, &rest); - ui_vsplit_l(&row, 128, &left, &right); - - key_thing key = keys[i + scroll_index]; - - ui_do_label_rect(&left, key.name); - key.assign_func(&config_copy, ui_do_key_reader_rect(key.key, &right, *key.key)); - } -} - -void ui_settings_video_render(const struct rect *r) -{ -} - -void ui_settings_video_render_select_mode(const struct rect *r) -{ -} - -void ui_settings_video_render_custom(const struct rect *r) -{ -} - -void ui_settings_sound_render(const struct rect *r) -{ - struct rect row; - struct rect left, right; - - ui_hsplit_t(r, 32, &row, 0x0); - ui_vsplit_l(&row, 128, &left, &right); - - ui_do_label_rect(&left, "Volume:"); - - config_set_volume(&config_copy, do_scroll_bar_horiz_rect(&config_copy.volume, &right, 256, config_copy.volume)); - snd_set_master_volume(config_copy.volume / 255.0f); -} - -static void tab_menu_button_render(const struct rect *r, char *name, int s) -{ - if (ui_do_button_rect(r, name, 0, r, draw_teewars_button, 0)) - screen = s; -} - -static void tab_menu_render(const struct rect *r) -{ - static struct rect button_news; - static struct rect button_servers; - static struct rect button_host; - static struct rect button_settings; - static struct rect rest; - - ui_vsplit_l(r, 130, &button_news, &rest); - ui_vsplit_l(&rest, 130, &button_servers, &rest); - ui_vsplit_l(&rest, 130, &button_host, &rest); - ui_vsplit_l(&rest, 130, &button_settings, &rest); - - tab_menu_button_render(&button_news, "News", SCREEN_NEWS); - tab_menu_button_render(&button_servers, "Servers", SCREEN_SERVERS); - tab_menu_button_render(&button_host, "Host", SCREEN_HOST); - tab_menu_button_render(&button_settings, "Settings", SCREEN_SETTINGS_GENERAL); -} - -static void settings_tab_menu_render(const struct rect *r) -{ - static struct rect button_general; - static struct rect button_controls; - static struct rect button_video; - static struct rect button_sound; - static struct rect rest; - - ui_hsplit_t(r, 60, &button_general, &rest); - ui_hsplit_t(&rest, 60, &button_controls, &rest); - ui_hsplit_t(&rest, 60, &button_video, &rest); - ui_hsplit_t(&rest, 60, &button_sound, &rest); - - tab_menu_button_render(&button_general, "General", SCREEN_SETTINGS_GENERAL); - tab_menu_button_render(&button_controls, "Controls", SCREEN_SETTINGS_CONTROLS); - tab_menu_button_render(&button_video, "Video", SCREEN_SETTINGS_VIDEO); - tab_menu_button_render(&button_sound, "Sound", SCREEN_SETTINGS_SOUND); -} - -static void ui_settings_render(const struct rect *r) -{ - static struct rect sub_menu_selector; - static struct rect center; - - ui_vsplit_l(r, 100, &sub_menu_selector, ¢er); - - settings_tab_menu_render(&sub_menu_selector); - - switch (screen) - { - case SCREEN_SETTINGS_GENERAL: ui_settings_general_render(¢er); break; - case SCREEN_SETTINGS_CONTROLS: ui_settings_controls_render(¢er); break; - case SCREEN_SETTINGS_VIDEO: ui_settings_video_render(¢er); break; - case SCREEN_SETTINGS_VIDEO_SELECT_MODE: ui_settings_video_render_select_mode(¢er); break; - case SCREEN_SETTINGS_VIDEO_CUSTOM: ui_settings_video_render_custom(¢er); break; - case SCREEN_SETTINGS_SOUND: ui_settings_sound_render(¢er); break; - } -} - -static void middle_render(const struct rect *r) -{ - bool ingame = false; - - switch (screen) - { - case SCREEN_SERVERS: - { - if (ingame) - {} - //return ingame_main_render(); - else - { - static struct rect browser; - static bool inited = false; - - ui_margin(r, 5, &browser); - - { - struct rect button_row; - static struct rect button_refresh, button_connect; - - ui_hsplit_b(&browser, 30, &browser, &button_row); - ui_vsplit_l(&button_row, 100, &button_refresh, &button_row); - ui_vsplit_l(&button_row, 100, &button_connect, &button_row); - - if (ui_do_button_rect(&button_refresh, "Refresh", 0, &button_refresh, draw_teewars_button, 0)) - client_serverbrowse_refresh(0); - - if (ui_do_button_rect(&button_connect, "Connect", 0, &button_connect, draw_teewars_button, 0)) - {} - - } - - if (!inited) - { - client_serverbrowse_refresh(0); - inited = true; - } - - { - int server_count = client_serverbrowse_sorted_num(); - int i; - - struct rect rest = browser; - - struct rect button_row; - - static struct rect button_name, button_players, button_players_max, button_map, button_latency, button_progression; - - ui_hsplit_t(&rest, 32, &button_row, &rest); - ui_margin(&button_row, 1, &button_row); - - ui_vsplit_l(&button_row, 400, &button_name, &button_row); - ui_vsplit_l(&button_row, 40, &button_players, &button_row); - ui_vsplit_l(&button_row, 40, &button_players_max, &button_row); - ui_vsplit_l(&button_row, 80, &button_map, &button_row); - ui_vsplit_l(&button_row, 40, &button_latency, &button_row); - ui_vsplit_l(&button_row, 40, &button_progression, &button_row); - - if (ui_do_button_rect(&button_name, "Name", 0, &button_name, draw_teewars_button, 0)) - config.b_sort = BROWSESORT_NAME; - if (ui_do_button_rect(&button_players, "Players", 0, &button_players, draw_teewars_button, 0)) - config.b_sort = BROWSESORT_NUMPLAYERS; - if (ui_do_button_rect(&button_players_max, "Max Players", 0, &button_players_max, draw_teewars_button, 0)) - config.b_sort = BROWSESORT_NUMPLAYERS; // TODO: real enum here - if (ui_do_button_rect(&button_map, "Map", 0, &button_map, draw_teewars_button, 0)) - config.b_sort = BROWSESORT_MAP; - if (ui_do_button_rect(&button_latency, "Ping", 0, &button_latency, draw_teewars_button, 0)) - config.b_sort = BROWSESORT_PING; - if (ui_do_button_rect(&button_progression, "Progression", 0, &button_progression, draw_teewars_button, 0)) - config.b_sort = BROWSESORT_PING; // TODO: real enum here - - for (i = 0; i < server_count; i++) - { - SERVER_INFO *info = client_serverbrowse_sorted_get(i); - struct rect row; - struct rect col_name, col_players, col_players_max, col_map, col_latency, col_progression; - char temp[16]; - - - ui_hsplit_t(&rest, 32, &row, &rest); - - if (rest.h < 0) - break; - - ui_margin(&row, 1, &row); - - ui_vsplit_l(&row, 400, &col_name, &row); - ui_vsplit_l(&row, 40, &col_players, &row); - ui_vsplit_l(&row, 40, &col_players_max, &row); - ui_vsplit_l(&row, 80, &col_map, &row); - ui_vsplit_l(&row, 40, &col_latency, &row); - ui_vsplit_l(&row, 40, &col_progression, &row); - - ui_do_label_rect(&col_name, info->name); - - sprintf(temp, "%i", info->num_players); - ui_do_label_rect(&col_players, temp); - sprintf(temp, "%i", info->max_players); - ui_do_label_rect(&col_players_max, temp); - ui_do_label_rect(&col_map, info->map); - - sprintf(temp, "%i", info->latency); - ui_do_label_rect(&col_latency, temp); - sprintf(temp, "%i", info->progression); - ui_do_label_rect(&col_progression, temp); - } - } - } - break; - } - case SCREEN_NEWS: - { - break; - } - case SCREEN_HOST: - { - break; - //return disconnected_render(); - } - case SCREEN_CONNECTING: - { - break; - //return connecting_render(); - } - case SCREEN_SETTINGS_GENERAL: - case SCREEN_SETTINGS_CONTROLS: - case SCREEN_SETTINGS_VIDEO: - case SCREEN_SETTINGS_VIDEO_SELECT_MODE: - case SCREEN_SETTINGS_VIDEO_CUSTOM: - case SCREEN_SETTINGS_SOUND: - { - ui_settings_render(r); - break; - } - case SCREEN_KERNING: - { - break; - } - default: dbg_msg("menu", "invalid screen selected..."); break; - } -} - -static int ui_menu_render(const struct rect *r) -{ - static struct rect top; - static struct rect middle; - static struct rect bottom; - - ui_hsplit_t(r, 48, &top, &middle); - ui_hsplit_b(&middle, 32, &middle, &bottom); - tab_menu_render(&top); - middle_render(&middle); - - return -ui_do_button_rect(&bottom, "Quit", 0, &bottom, draw_teewars_button, 0); -} - -static int main_render() -{ - static bool inited = false; - - if (!inited) - { - inited = true; - client_serverbrowse_refresh(0); - } - - static int scoll_index = 0, selected_index = -1; - int last_selected_index = selected_index; - do_server_list(20, 160, &scoll_index, &selected_index, 8); - - ui_do_edit_box(address, 280, 425, 300, 36, address, sizeof(address)); - - if (last_selected_index != selected_index && selected_index != -1) - { - SERVER_INFO *server; - server = client_serverbrowse_get(selected_index); - - strcpy(address, server->address); - } - - static int refresh_button, join_button, quit_button; - static int use_lan = 0; - - - if (ui_do_button(&refresh_button, "Refresh", 0, 20, 460, 170, 48, draw_teewars_button, 0)) - client_serverbrowse_refresh(use_lan); - - ui_do_label(60, 420, "Search LAN ", 36); - int last_lan = use_lan; - use_lan = ui_do_check_box(&use_lan, 20, 424, 32, 32, use_lan); - if (use_lan != last_lan) - client_serverbrowse_refresh(use_lan); - - if (ui_do_button(&join_button, "Join", 0, 620, 420, 128, 48, draw_teewars_button, 0)) - { - client_connect(address); - - return 1; - } - - if (ui_do_button(&quit_button, "Quit", 0, 620, 490, 128, 48, draw_teewars_button, 0)) - return -1; - - static int settings_button; - if (ui_do_button(&settings_button, "Settings", 0, 400, 490, 170, 48, draw_teewars_button, 0)) - { - config_copy = config; - screen = SCREEN_SETTINGS_GENERAL; - } - - // render status text - if(client_serverbrowse_num_requests()) - { - char buf[512]; - sprintf(buf, "Refreshing %d servers...", client_serverbrowse_num_requests()); - ui_do_label(20, 400, buf, 28); - } - else - { - char buf[512]; - sprintf(buf, "%d of %d servers", client_serverbrowse_sorted_num(), client_serverbrowse_num()); - ui_do_label(20, 400, buf, 28); - } - - ui_do_edit_box(&config.b_filter_string, 20+150, 600-80, 200, 36, config.b_filter_string, sizeof(config.b_filter_string)); - config.b_filter_empty = ui_do_check_box(&config.b_filter_empty, 20, 600-80, 32, 32, config.b_filter_empty); - config.b_filter_full = ui_do_check_box(&config.b_filter_full, 20+50, 600-80, 32, 32, config.b_filter_full); - config.b_filter_pw = ui_do_check_box(&config.b_filter_pw, 20+100, 600-80, 32, 32, config.b_filter_pw); - - - return 0; -} - - -static int settings_general_render() -{ - // NAME - ui_do_label(column1_x, row1_y, "Name:", 36); - ui_do_edit_box(config_copy.player_name, column2_x, row1_y, 300, 36, config_copy.player_name, sizeof(config_copy.player_name)); - - // Dynamic camera - ui_do_label(column1_x, row2_y, "Dynamic Camera:", 36); - config_set_dynamic_camera(&config_copy, ui_do_check_box(&config_copy.dynamic_camera, column2_x + 55, row2_y + 4, 32, 32, config_copy.dynamic_camera)); - - return 0; -} - -static int settings_controls_render() -{ - static int scroll_index = 0; - - const key_thing keys[] = - { - { "Move Left:", &config_copy.key_move_left, config_set_key_move_left }, - { "Move Right:", &config_copy.key_move_right, config_set_key_move_right }, - { "Jump:", &config_copy.key_jump, config_set_key_jump }, - { "Fire:", &config_copy.key_fire, config_set_key_fire }, - { "Hook:", &config_copy.key_hook, config_set_key_hook }, - { "Hammer:", &config_copy.key_weapon1, config_set_key_weapon1 }, - { "Pistol:", &config_copy.key_weapon2, config_set_key_weapon2 }, - { "Shotgun:", &config_copy.key_weapon3, config_set_key_weapon3 }, - { "Grenade:", &config_copy.key_weapon4, config_set_key_weapon4 }, - { "Next Weapon:", &config_copy.key_next_weapon, config_set_key_next_weapon }, - { "Prev. Weapon:", &config_copy.key_prev_weapon, config_set_key_prev_weapon }, - { "Emoticon:", &config_copy.key_emoticon, config_set_key_emoticon }, - { "Screenshot:", &config_copy.key_screenshot, config_set_key_screenshot }, - }; - - const int key_count = sizeof(keys) / sizeof(key_thing); - - for (int i = 0; i < 6; i++) - { - key_thing key = keys[i + scroll_index]; - - ui_do_label(column1_x, row1_y + 40 * i, key.name, 36); - key.assign_func(&config_copy, ui_do_key_reader(key.key, column2_x, row1_y + 40 * i, 150, 36, *key.key)); - } - - scroll_index = do_scroll_bar_vert(&scroll_index, 600, row1_y, 40 * 6, key_count - 6, scroll_index); - - ui_do_label(column1_x, row1_y + 40 * 6, "Scroll wheel weapon switch", 22); - config_set_scroll_weapon(&config_copy, ui_do_check_box(&config_copy.scroll_weapon, column2_x + 50, row1_y + 40 * 6, 22, 22, config_copy.scroll_weapon)); - - return 0; -} - -static const int MAX_RESOLUTIONS = 128; -static int settings_video_render_select_mode() -{ - static VIDEO_MODE modes[MAX_RESOLUTIONS]; - static int num_modes = -1; - - if(num_modes == -1) - num_modes = gfx_get_video_modes(modes, MAX_RESOLUTIONS); - - static int scroll_index = 0; - scroll_index = do_scroll_bar_vert(&scroll_index, 500, row1_y, 40 * 7, num_modes - 7, scroll_index); - - for (int i = 0; i < 7; i++) - { - int index = i + scroll_index; - if(index >= num_modes) - break; - - //key_thing key = keys[i + scroll_index]; - int depth = modes[index].red+modes[index].green+modes[index].blue; - if(depth < 16) - depth = 16; - else if(depth > 16) - depth = 24; - - char buf[128]; - int s = 0; - if(modes[index].width == config_copy.gfx_screen_width && - modes[index].height == config_copy.gfx_screen_height && - depth == config_copy.gfx_color_depth) - { - s = 1; - } - - sprintf(buf, "%c %dx%d %d bit %c", s?'>':' ', modes[index].width, modes[index].height, depth, s?'<':' '); - - if(ui_do_button((void*)&modes[index], buf, 0, - column1_x, row1_y + 40 * i, 250, 32.0f, draw_teewars_button, 0)) - { - // select - config_set_gfx_color_depth(&config_copy, depth); - config_set_gfx_screen_width(&config_copy, modes[index].width); - config_set_gfx_screen_height(&config_copy, modes[index].height); - screen = SCREEN_SETTINGS_VIDEO; - } - } - - static int back_button = 0; - if(ui_do_button(&back_button, "Back", 0, column3_x, row7_y, 150, 32, draw_teewars_button, 0)) - screen = SCREEN_SETTINGS_VIDEO; - - return 0; -} - -static int settings_video_render_custom() -{ - ui_do_label(column1_x, row1_y, "Quality Textures:", 36); - config_set_gfx_texture_quality(&config_copy, ui_do_check_box(&config_copy.gfx_texture_quality, column3_x, row1_y + 5, 32, 32, config_copy.gfx_texture_quality)); - - ui_do_label(column1_x, row2_y, "Texture Compression:", 36); - config_set_gfx_texture_compression(&config_copy, ui_do_check_box(&config_copy.gfx_texture_compression, column3_x, row2_y + 5, 32, 32, config_copy.gfx_texture_compression)); - - ui_do_label(column1_x, row3_y, "High Detail:", 36); - config_set_gfx_high_detail(&config_copy, ui_do_check_box(&config_copy.gfx_high_detail, column3_x, row3_y + 5, 32, 32, config_copy.gfx_high_detail)); - - static int back_button = 0; - if(ui_do_button(&back_button, "Back", 0, column3_x, row7_y, 150, 32, draw_teewars_button, 0)) - screen = SCREEN_SETTINGS_VIDEO; - - return 0; -} - -static int settings_video_render() -{ - - ui_do_label(column1_x, row1_y, "Mode:", 36); - - char buf[128]; - sprintf(buf, "%dx%d %d bit", config_copy.gfx_screen_width, config_copy.gfx_screen_height, config_copy.gfx_color_depth); - static int select_button = 0; - if(ui_do_button(&select_button, buf, 0, column2_x, row1_y, 300, 32, draw_teewars_button, 0)) - screen = SCREEN_SETTINGS_VIDEO_SELECT_MODE; - - // we need to draw these bottom up, to make overlapping work correctly - - ui_do_label(column1_x, row2_y, "Fullscreen:", 36); - config_set_gfx_fullscreen(&config_copy, ui_do_check_box(&config_copy.gfx_fullscreen, column2_x, row2_y + 5, 32, 32, config_copy.gfx_fullscreen)); - - ui_do_label(column1_x, row3_y, "V-sync:", 36); - config_set_gfx_vsync(&config_copy, ui_do_check_box(&config_copy.gfx_vsync, column2_x, row3_y + 5, 32, 32, config_copy.gfx_vsync)); - - - int current_level = - (config_copy.gfx_texture_quality<<8)| - (config_copy.gfx_texture_compression<<4)| - (config_copy.gfx_high_detail); - - static const int opt_levels[3] = {0x101,0x001,0x010}; - static const char *opts[] = { - "High", - "Medium", - "Low", - "Custom"}; - - int selected = 0; // custom per default - for(; selected < 3; selected++) - { - if(current_level == opt_levels[selected]) - break; - } - - ui_do_label(column1_x, row4_y, "Quality:", 36); - int new_level = ui_do_combo_box(&config_copy.gfx_texture_quality, column2_x, row4_y, 150, opts, 4, selected); - if(new_level < 3) - { - config_set_gfx_texture_quality(&config_copy, (opt_levels[new_level]>>8)&1); - config_set_gfx_texture_compression(&config_copy, (opt_levels[new_level]>>4)&1); - config_set_gfx_high_detail(&config_copy, opt_levels[new_level]&1); - } - - static int custom_button=0; - if(ui_do_button(&custom_button, "Customize", 0, column3_x, row4_y, 130, 32, draw_teewars_button, 0)) - screen = SCREEN_SETTINGS_VIDEO_CUSTOM; - - ui_do_label(column1_x, row6_y + 50, "(A restart of the game is required for these settings to take effect.)", 20); - - return 0; -} - -static int settings_sound_render() -{ - ui_do_label(column1_x, row1_y, "Volume:", 36); - - config_set_volume(&config_copy, do_scroll_bar_horiz(&config_copy.volume, column2_x, row1_y, 200, 255, config_copy.volume)); - snd_set_master_volume(config_copy.volume / 255.0f); - - return 0; -} - -extern void draw_round_rect(float x, float y, float w, float h, float r); -extern void send_info(bool); - -static int settings_render(bool ingame) -{ - if (ingame) - { - gfx_blend_normal(); - - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(0,0,0,0.5f); - draw_round_rect(10, 120, 780, 460, 30.0f); - gfx_quads_end(); - } - - static int general_button, controls_button, video_button, sound_button; - - if (ui_do_button(&general_button, "General", 0, 30, 200, 170, 48, draw_teewars_button, 0)) - screen = SCREEN_SETTINGS_GENERAL; - if (ui_do_button(&controls_button, "Controls", 0, 30, 250, 170, 48, draw_teewars_button, 0)) - screen = SCREEN_SETTINGS_CONTROLS; - if (ui_do_button(&video_button, "Video", 0, 30, 300, 170, 48, draw_teewars_button, 0)) - screen = SCREEN_SETTINGS_VIDEO; - if (ui_do_button(&sound_button, "Sound", 0, 30, 350, 170, 48, draw_teewars_button, 0)) - screen = SCREEN_SETTINGS_SOUND; - - switch (screen) - { - case SCREEN_SETTINGS_GENERAL: settings_general_render(); break; - case SCREEN_SETTINGS_CONTROLS: settings_controls_render(); break; - case SCREEN_SETTINGS_VIDEO: settings_video_render(); break; - case SCREEN_SETTINGS_VIDEO_SELECT_MODE: settings_video_render_select_mode(); break; - case SCREEN_SETTINGS_VIDEO_CUSTOM: settings_video_render_custom(); break; - case SCREEN_SETTINGS_SOUND: settings_sound_render(); break; - } - - // SAVE BUTTON - static int save_button; - if (ui_do_button(&save_button, "Save", 0, 482, 490, 128, 48, draw_teewars_button, 0)) - { - // did we change our name? - bool name_changed = strcmp(config.player_name, config_copy.player_name) != 0; - - config = config_copy; - - if (ingame && name_changed) - send_info(false); - -#ifdef CONF_PLATFORM_MACOSX - config_save("~/.teewars"); -#else - config_save("default.cfg"); -#endif - screen = SCREEN_SERVERS; - } - - // CANCEL BUTTON - static int cancel_button; - if (ui_do_button(&cancel_button, "Cancel", 0, 620, 490, 150, 48, draw_teewars_button, 0)) - { - snd_set_master_volume(config.volume / 255.0f); - screen = SCREEN_SERVERS; - } - - return 0; -} - -extern int gametype; -static int ingame_main_render() -{ - static int menu_resume, menu_quit, menu_settings; - /*if (gametype == GAMETYPE_TDM) - { - char buf[128]; - // Switch team - ui_do_label(100,100,"Switch Team",40); - sprintf(buf,"Team: %s",local_player->team ? "A" : "B"); - if (ui_do_button(&menu_team, buf, 0, 30, 150, 170, 48, draw_teewars_button)) - { - msg_pack_start(MSG_SWITCHTEAM, MSGFLAG_VITAL); - msg_pack_end(); - client_send_msg(); - menu_active = false; - } - }*/ - - const int column1_x = 275; - const int row1_y = 200; - const int row2_y = row1_y + 60; - const int row3_y = row2_y + 60; - const int row4_y = row3_y + 60; - - gfx_blend_normal(); - - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(0,0,0,0.5f); - draw_round_rect(170, 120, 460, 360, 30.0f); - gfx_quads_end(); - - ui_do_image(data->images[IMAGE_BANNER].id, 214, 150, 384, 96); - - if (ui_do_button(&menu_resume, "Resume Game", 0, column1_x, row2_y, 250, 48, draw_teewars_button, 0)) - { - return 1; - } - - if (ui_do_button(&menu_quit, "Disconnect", 0, column1_x, row4_y, 250, 48, draw_teewars_button, 0)) - { - client_disconnect(); - return 1; - } - - if (ui_do_button(&menu_settings, "Settings", 0, column1_x, row3_y, 250, 48, draw_teewars_button, 0)) - { - config_copy = config; - screen = SCREEN_SETTINGS_GENERAL; - } - - return 0; -} - -extern "C" double extra_kerning[256*256]; - -static int kerning_render() -{ - static bool loaded = false; - static char text[32] = {0}; - - if (!loaded) - { - // TODO: fix me - /* - file_stream file; - - if (file.open_r("kerning.txt")) - { - line_stream lstream(&file); - int i = 0; - char *line; - - while ((line = lstream.get_line())) - extra_kerning[i++] = atof(line); - - file.close(); - } - - if (file.open_r("tracking.txt")) - { - line_stream lstream(&file); - char *line; - - for (int i = 0; i < 256; i++) - { - line = lstream.get_line(); - current_font->m_CharStartTable[i] = atof(line); - line = lstream.get_line(); - current_font->m_CharEndTable[i] = atof(line); - } - - file.close(); - } - */ - - loaded = true; - } - - ui_do_edit_box(text, 160, 20, 300, 36, text, sizeof(text)); - - ui_do_label(160, 250, text, 70); - - int len = strlen(text); - - for (int i = 0; i < len-1; i++) - { - char s[3] = {0}; - s[0] = text[i]; - s[1] = text[i+1]; - ui_do_label(10, 30 * i + 10, s, 45); - - int index = s[0] + s[1] * 256; - - // less - if (ui_do_button((void *)(100 + i * 2), "", 0, 50, 30 * i + 10 + 20, 16, 16, draw_single_part_button, (void *)GUI_MISC_SLIDER_BIG_ARROW_LEFT)) - { - extra_kerning[index] -= 0.01; - } - - // more - if (ui_do_button((void *)(100 + i * 2 + 1), "", 0, 66, 30 * i + 10 + 20, 16, 16, draw_single_part_button, (void *)GUI_MISC_SLIDER_BIG_ARROW_RIGHT)) - { - extra_kerning[index] += 0.01; - } - - char num[16]; - sprintf(num, "(%f)", extra_kerning[index]); - ui_do_label(84, 30 * i + 30, num, 12); - } - - for (int i = 0; i < len; i++) - { - char s[2] = {0}; - s[0] = text[i]; - - ui_do_label(700, 35 * i + 10, s, 45); - - gfx_blend_normal(); - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(0,0,0,0.5); - gfx_quads_drawTL(700,35*i+20,1,30); - gfx_quads_drawTL(700+45*(current_font->m_CharEndTable[(int)s[0]]-current_font->m_CharStartTable[(int)s[0]]),35*i+20,1,30); - gfx_quads_end(); - // less - if (ui_do_button((void *)(200 + i * 2), "", 0, 650, 35 * i + 10 + 15, 16, 16, draw_single_part_button, (void *)GUI_MISC_SLIDER_BIG_ARROW_LEFT)) - { - current_font->m_CharStartTable[(int)s[0]] -= 0.01f; - } - - // more - if (ui_do_button((void *)(200 + i * 2 + 1), "", 0, 666, 35 * i + 10 + 15, 16, 16, draw_single_part_button, (void *)GUI_MISC_SLIDER_BIG_ARROW_RIGHT)) - { - current_font->m_CharStartTable[(int)s[0]] += 0.01f; - } - - char num[16]; - sprintf(num, "(%f)", current_font->m_CharStartTable[(int)s[0]]); - ui_do_label(645, 35 * i + 40, num, 12); - - - - - // less - if (ui_do_button((void *)(300 + i * 2), "", 0, 750, 35 * i + 10 + 15, 16, 16, draw_single_part_button, (void *)GUI_MISC_SLIDER_BIG_ARROW_LEFT)) - { - current_font->m_CharEndTable[(int)s[0]] -= 0.01f; - } - - // more - if (ui_do_button((void *)(300 + i * 2 + 1), "", 0, 766, 35 * i + 10 + 15, 16, 16, draw_single_part_button, (void *)GUI_MISC_SLIDER_BIG_ARROW_RIGHT)) - { - current_font->m_CharEndTable[(int)s[0]] += 0.01f; - } - - sprintf(num, "(%f)", current_font->m_CharEndTable[(int)s[0]]); - ui_do_label(745, 35 * i + 40, num, 12); - - } - - // SAVE BUTTON - static int save_button; - if (ui_do_button(&save_button, "Save", 0, 482, 520, 128, 48, draw_teewars_button, 0)) - { - // TODO: fix or remove me - /* - file_stream file; - - if (file.open_w("kerning.txt")) - { - char t[16]; - - for (int i = 0; i < 256*256; i++) - { - sprintf(t, "%f\n", extra_kerning[i]); - file.write(t, strlen(t)); - } - - file.close(); - } - - if (file.open_w("tracking.txt")) - { - char t[16]; - - for (int i = 0; i < 256; i++) - { - sprintf(t, "%f\n", current_font->m_CharStartTable[i]); - file.write(t, strlen(t)); - sprintf(t, "%f\n", current_font->m_CharEndTable[i]); - file.write(t, strlen(t)); - } - - file.close(); - } - */ - - //screen = 0; - } - - // CANCEL BUTTON - static int cancel_button; - if (ui_do_button(&cancel_button, "Cancel", 0, 620, 520, 150, 48, draw_teewars_button, 0)) - screen = SCREEN_SERVERS; - - return 0; -} - - -int render_popup(const char *caption, const char *text, const char *button_text) -{ - float tw; - - float w = 700; - float h = 300; - float x = 800/2-w/2; - float y = 600/2-h/2; - - gfx_blend_normal(); - - gfx_texture_set(-1); - gfx_quads_begin(); - gfx_setcolor(0,0,0,0.50f); - draw_round_rect(x, y, w, h, 40.0f); - gfx_quads_end(); - - tw = gfx_pretty_text_width(48.0f, caption, -1); - ui_do_label(x+w/2-tw/2, y+20, caption, 48.0f); - - tw = gfx_pretty_text_width(32.0f, text, -1); - gfx_pretty_text(x+w/2-tw/2, y+130, 32.0f, text, -1); - - if(button_text) - { - static int back_button = 0; - if(ui_do_button(&back_button, button_text, 0, x+w/2-100, y+220, 200, 48, draw_teewars_button, 0)) - return 1; - if(inp_key_down(KEY_ESC) || inp_key_down(KEY_ENTER)) - return 1; - } - - return 0; -} - -static int disconnected_render() -{ - if(strlen(client_error_string()) == 0) - screen = SCREEN_SERVERS; - else - { - if(render_popup("Disconnected", client_error_string(), "Back")) - screen = SCREEN_SERVERS; - } - return 0; -} - -static int connecting_render() -{ - char buf[256]; - sprintf(buf, "Server: %s", address); - if(render_popup("Connecting", buf, "Abort")) - { - client_disconnect(); - screen = SCREEN_SERVERS; - } - return 0; -} - - -void menu_do_disconnected() -{ - screen = SCREEN_DISCONNECTED; -} - - -void menu_do_connecting() -{ - screen = SCREEN_CONNECTING; -} - -void menu_do_connected() -{ - screen = SCREEN_SERVERS; -} - -static int menu_render(bool ingame) -{ - if (!ingame) - { - // background color - gfx_clear(0.65f,0.78f,0.9f); - //gfx_clear(89/255.f,122/255.f,0.0); - - // GUI coordsys - gfx_mapscreen(0,0,800.0f,600.0f); - - static int64 start = time_get(); - - float t = double(time_get() - start) / double(time_freq()); - gfx_mapscreen(0,0,1600.0f,1200.0f); - draw_background(t); - gfx_mapscreen(0,0,800.0f,600.0f); - - if (screen != SCREEN_KERNING) - { - ui_do_image(data->images[IMAGE_BANNER].id, 200, 20, 512, 128); - ui_do_label(20.0f, 600.0f-40.0f, "Version: " TEEWARS_VERSION, 36); - if(config.debug) - ui_do_label(20.0f, 600.0f-60.0f, "Nethash: " TEEWARS_NETVERSION_HASH, 24); - } - } - else - { - gfx_mapscreen(0, 0, 800, 600); - } - - if(config.dbg_new_gui) - { - struct rect *screen = ui_screen(); - - static float scale = 1.0f; - - if (inp_key_pressed('I')) - scale += 0.01; - if (inp_key_pressed('O')) - scale -= 0.01; - - ui_scale(scale); - int retn = ui_menu_render(screen); - - /*gfx_texture_set(-1); - gfx_lines_begin(); - ui_foreach_rect(draw_rect); - gfx_lines_end();*/ - - return retn; - } - else - { - switch (screen) - { - case SCREEN_SERVERS: return ingame ? ingame_main_render() : main_render(); - case SCREEN_DISCONNECTED: return disconnected_render(); - case SCREEN_CONNECTING: return connecting_render(); - case SCREEN_SETTINGS_GENERAL: - case SCREEN_SETTINGS_CONTROLS: - case SCREEN_SETTINGS_VIDEO: - case SCREEN_SETTINGS_VIDEO_SELECT_MODE: - case SCREEN_SETTINGS_VIDEO_CUSTOM: - case SCREEN_SETTINGS_SOUND: return settings_render(ingame); - case SCREEN_KERNING: return kerning_render(); - default: dbg_msg("menu", "invalid screen selected..."); return 0; - } - } -} - -extern "C" void modmenu_init() // TODO: nastyness -{ - // TODO: should be removed - current_font->font_texture = gfx_load_texture("data/big_font.png"); -} - -void modmenu_shutdown() -{ -} - -extern int menu2_render(); - -extern "C" int modmenu_render(int ingame) // TODO: nastyness -{ - static int mouse_x = 0; - static int mouse_y = 0; - - // handle mouse movement - float mx, my; - { - int rx, ry; - inp_mouse_relative(&rx, &ry); - mouse_x += rx; - mouse_y += ry; - if(mouse_x < 0) mouse_x = 0; - if(mouse_y < 0) mouse_y = 0; - if(mouse_x > gfx_screenwidth()) mouse_x = gfx_screenwidth(); - if(mouse_y > gfx_screenheight()) mouse_y = gfx_screenheight(); - - // update the ui - mx = (mouse_x/(float)gfx_screenwidth())*800.0f; - my = (mouse_y/(float)gfx_screenheight())*600.0f; - - int buttons = 0; - if(inp_key_pressed(KEY_MOUSE_1)) buttons |= 1; - if(inp_key_pressed(KEY_MOUSE_2)) buttons |= 2; - if(inp_key_pressed(KEY_MOUSE_3)) buttons |= 4; - - ui_update(mx,my,mx*3.0f,my*3.0f,buttons); - } - - //int r = menu_render(server_address, str, max_len); - //int r = menu2_render(ingame); - (void)menu_render; - int r = menu2_render(); - - gfx_texture_set(data->images[IMAGE_CURSOR].id); - gfx_quads_begin(); - gfx_setcolor(1,1,1,1); - gfx_quads_drawTL(mx,my,24,24); - gfx_quads_end(); - - inp_clear(); - - return r; -} - -#endif diff --git a/src/game/game.cpp b/src/game/g_game.cpp index 29e4da14..e5b36ea0 100644 --- a/src/game/game.cpp +++ b/src/game/g_game.cpp @@ -1,5 +1,5 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "game.h" +#include "g_game.h" // TODO: OPT: rewrite this smarter! void move_point(vec2 *inout_pos, vec2 *inout_vel, float elasticity, int *bounces) diff --git a/src/game/game.h b/src/game/g_game.h index c30543d9..70a15a19 100644 --- a/src/game/game.h +++ b/src/game/g_game.h @@ -1,11 +1,11 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/system.h> -#include <game/math.h> +#include <engine/e_system.h> +#include <game/g_math.h> #include <math.h> -#include "../engine/interface.h" -#include "mapres_col.h" +#include "../engine/e_interface.h" +#include "g_mapres_col.h" -#include "game_protocol.h" +#include "g_protocol.h" inline vec2 get_direction(int angle) { diff --git a/src/game/mapres.h b/src/game/g_mapres.h index 77a3ccaa..77a3ccaa 100644 --- a/src/game/mapres.h +++ b/src/game/g_mapres.h diff --git a/src/game/mapres_col.cpp b/src/game/g_mapres_col.cpp index 046272ca..4b391204 100644 --- a/src/game/mapres_col.cpp +++ b/src/game/g_mapres_col.cpp @@ -1,11 +1,11 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/system.h> -#include <game/vmath.h> -#include <game/math.h> +#include <engine/e_system.h> +#include <game/g_vmath.h> +#include <game/g_math.h> #include <math.h> -#include "../engine/interface.h" -#include "mapres_col.h" -#include "mapres.h" +#include "../engine/e_interface.h" +#include "g_mapres_col.h" +#include "g_mapres.h" /* Simple collision rutines! diff --git a/src/game/mapres_col.h b/src/game/g_mapres_col.h index 9b7191c8..5d4427ab 100644 --- a/src/game/mapres_col.h +++ b/src/game/g_mapres_col.h @@ -1,5 +1,5 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <game/vmath.h> +#include <game/g_vmath.h> struct mapres_collision { diff --git a/src/game/math.h b/src/game/g_math.h index e2cf6bd8..e2cf6bd8 100644 --- a/src/game/math.h +++ b/src/game/g_math.h diff --git a/src/game/game_protocol.h b/src/game/g_protocol.h index 4fcc1e5f..4fcc1e5f 100644 --- a/src/game/game_protocol.h +++ b/src/game/g_protocol.h diff --git a/src/game/game_variables.h b/src/game/g_variables.h index 44e52c6f..44e52c6f 100644 --- a/src/game/game_variables.h +++ b/src/game/g_variables.h diff --git a/src/game/version.h b/src/game/g_version.h index a2167ecd..8f261c0f 100644 --- a/src/game/version.h +++ b/src/game/g_version.h @@ -1,4 +1,4 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "nethash.c" +#include "generated/nethash.c" #define TEEWARS_VERSION "0.3.0-dev" #define TEEWARS_NETVERSION "0.3 " TEEWARS_NETVERSION_HASH diff --git a/src/game/vmath.h b/src/game/g_vmath.h index 65f94776..65f94776 100644 --- a/src/game/vmath.h +++ b/src/game/g_vmath.h diff --git a/src/game/generated/createdir.txt b/src/game/generated/createdir.txt new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/src/game/generated/createdir.txt diff --git a/src/game/server/data/createdir.txt b/src/game/server/data/createdir.txt deleted file mode 100644 index 258b42d5..00000000 --- a/src/game/server/data/createdir.txt +++ /dev/null @@ -1 +0,0 @@ -this file is here to make sure that this directory gets created diff --git a/src/game/server/game_server.h b/src/game/server/game_server.h deleted file mode 100644 index 65ef58f4..00000000 --- a/src/game/server/game_server.h +++ /dev/null @@ -1,2 +0,0 @@ -/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ - diff --git a/src/game/server/srv_common.cpp b/src/game/server/gs_common.cpp index 83754780..dc0d5c05 100644 --- a/src/game/server/srv_common.cpp +++ b/src/game/server/gs_common.cpp @@ -1,6 +1,6 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/config.h> -#include "srv_common.h" +#include <engine/e_config.h> +#include "gs_common.h" #include <string.h> gameobject::gameobject() diff --git a/src/game/server/srv_common.h b/src/game/server/gs_common.h index b28d3066..93264f9f 100644 --- a/src/game/server/srv_common.h +++ b/src/game/server/gs_common.h @@ -1,6 +1,6 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "../game.h" -#include "data.h" +#include "../g_game.h" +#include "../generated/gs_data.h" void create_sound_global(int sound, int target=-1); diff --git a/src/game/server/srv_ctf.cpp b/src/game/server/gs_game_ctf.cpp index 2ff4e2df..30d898d9 100644 --- a/src/game/server/srv_ctf.cpp +++ b/src/game/server/gs_game_ctf.cpp @@ -1,6 +1,6 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include "srv_common.h" -#include "srv_ctf.h" +#include "gs_common.h" +#include "gs_game_ctf.h" gameobject_ctf::gameobject_ctf() { diff --git a/src/game/server/srv_ctf.h b/src/game/server/gs_game_ctf.h index 02acef37..02acef37 100644 --- a/src/game/server/srv_ctf.h +++ b/src/game/server/gs_game_ctf.h diff --git a/src/game/server/srv_dm.cpp b/src/game/server/gs_game_dm.cpp index d5720856..98317578 100644 --- a/src/game/server/srv_dm.cpp +++ b/src/game/server/gs_game_dm.cpp @@ -1,7 +1,7 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/config.h> -#include "srv_common.h" -#include "srv_dm.h" +#include <engine/e_config.h> +#include "gs_common.h" +#include "gs_game_dm.h" void gameobject_dm::tick() { diff --git a/src/game/server/srv_dm.h b/src/game/server/gs_game_dm.h index 96bff3ae..96bff3ae 100644 --- a/src/game/server/srv_dm.h +++ b/src/game/server/gs_game_dm.h diff --git a/src/game/server/srv_tdm.cpp b/src/game/server/gs_game_tdm.cpp index bcae397f..7aa12e2b 100644 --- a/src/game/server/srv_tdm.cpp +++ b/src/game/server/gs_game_tdm.cpp @@ -1,7 +1,7 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/config.h> -#include "srv_common.h" -#include "srv_tdm.h" +#include <engine/e_config.h> +#include "gs_common.h" +#include "gs_game_tdm.h" gameobject_tdm::gameobject_tdm() { diff --git a/src/game/server/srv_tdm.h b/src/game/server/gs_game_tdm.h index 70b4646e..70b4646e 100644 --- a/src/game/server/srv_tdm.h +++ b/src/game/server/gs_game_tdm.h diff --git a/src/game/server/game_server.cpp b/src/game/server/gs_server.cpp index 658e72c9..65985371 100644 --- a/src/game/server/game_server.cpp +++ b/src/game/server/gs_server.cpp @@ -2,13 +2,12 @@ #include <stdlib.h> #include <stdio.h> #include <string.h> -#include <engine/config.h> -#include "../version.h" -#include "game_server.h" -#include "srv_common.h" -#include "srv_ctf.h" -#include "srv_tdm.h" -#include "srv_dm.h" +#include <engine/e_config.h> +#include "../g_version.h" +#include "gs_common.h" +#include "gs_game_ctf.h" +#include "gs_game_tdm.h" +#include "gs_game_dm.h" data_container *data = 0x0; diff --git a/src/mastersrv/mastersrv.cpp b/src/mastersrv/mastersrv.cpp index cf32263f..aa799919 100644 --- a/src/mastersrv/mastersrv.cpp +++ b/src/mastersrv/mastersrv.cpp @@ -2,8 +2,8 @@ #include <string.h> extern "C" { - #include <engine/system.h> - #include <engine/network.h> + #include <engine/e_system.h> + #include <engine/e_network.h> } #include "mastersrv.h" diff --git a/src/tools/crapnet.cpp b/src/tools/crapnet.cpp index 0513d484..1321c67f 100644 --- a/src/tools/crapnet.cpp +++ b/src/tools/crapnet.cpp @@ -1,5 +1,5 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/system.h> +#include <engine/e_system.h> #include <cstdlib> diff --git a/src/tools/fake_server.c b/src/tools/fake_server.c index 31e6006d..c81dfaaa 100644 --- a/src/tools/fake_server.c +++ b/src/tools/fake_server.c @@ -1,7 +1,7 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/config.h> -#include <engine/system.h> -#include <engine/network.h> +#include <engine/e_config.h> +#include <engine/e_system.h> +#include <engine/e_network.h> #include <mastersrv/mastersrv.h> #include <stdlib.h> #include <stdio.h> diff --git a/src/tools/map_resave.c b/src/tools/map_resave.c index 69da79e8..37e00904 100644 --- a/src/tools/map_resave.c +++ b/src/tools/map_resave.c @@ -1,5 +1,5 @@ /* copyright (c) 2007 magnus auvinen, see licence.txt for more info */ -#include <engine/datafile.h> +#include <engine/e_datafile.h> int main(int argc, char **argv) { |