diff --git a/.gitignore b/.gitignore index 9fd6d7b..19bccce 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,6 @@ debug_world.bin flight*.zip flight_server flight.zip -ipsettings.h releases/ .vs/ x64/ diff --git a/Flight.vcxproj b/Flight.vcxproj index 2a145c4..cda0cd4 100644 --- a/Flight.vcxproj +++ b/Flight.vcxproj @@ -140,7 +140,7 @@ Level3 true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions);DEBUG_RENDERING;SERVER_ADDRESS="127.0.0.1" + _DEBUG;DEBUG;_CONSOLE;%(PreprocessorDefinitions) true $(ProjectDir)\thirdparty\enet\include;$(ProjectDir)\thirdparty\Chipmunk2D\include\chipmunk;$(ProjectDir)\thirdparty;$(ProjectDir)\thirdparty\Chipmunk2D\include;$(ProjectDir)\thirdparty\minilzo;$(ProjectDir)\thirdparty\opus\include true @@ -156,7 +156,7 @@ Level3 true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions);DEBUG_RENDERING; + _DEBUG;_CONSOLE;%(PreprocessorDefinitions) true C:\Users\Cameron\Documents\flight\thirdparty\enet\include;C:\Users\Cameron\Documents\flight\thirdparty\Chipmunk2D\include\chipmunk;C:\Users\Cameron\Documents\flight\thirdparty;C:\Users\Cameron\Documents\flight\thirdparty\Chipmunk2D\include;C:\Users\Cameron\Documents\flight\thirdparty\minilzo true @@ -173,7 +173,7 @@ true true true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + NDEBUG;RELEASE;_CONSOLE;%(PreprocessorDefinitions) true $(ProjectDir)\thirdparty\enet\include;$(ProjectDir)\thirdparty\Chipmunk2D\include\chipmunk;$(ProjectDir)\thirdparty;$(ProjectDir)\thirdparty\Chipmunk2D\include;$(ProjectDir)\thirdparty\minilzo;$(ProjectDir)\thirdparty\opus\include @@ -236,6 +236,7 @@ + diff --git a/Flight.vcxproj.filters b/Flight.vcxproj.filters index cf40f6e..305979b 100644 --- a/Flight.vcxproj.filters +++ b/Flight.vcxproj.filters @@ -200,6 +200,9 @@ Header Files + + Header Files + diff --git a/build_debug.bat b/build_debug.bat index fb48b24..bcb3f85 100644 --- a/build_debug.bat +++ b/build_debug.bat @@ -1,3 +1,3 @@ call shadergen.bat -set compileopts=/Fe"flight_debug" /Zi /FS /Fd"flight.pdb" /DSERVER_ADDRESS="\"127.0.0.1\"" /DDEBUG_RENDERING +set compileopts=/Fe"flight_debug" /Zi /FS /Fd"flight.pdb" /DDEBUG_RENDERING /DDEBUG call build_msvc.bat \ No newline at end of file diff --git a/build_linux_server_release.sh b/build_linux_server_release.sh index 1ee2ea1..087e800 100755 --- a/build_linux_server_release.sh +++ b/build_linux_server_release.sh @@ -6,4 +6,4 @@ cmake .. cmake --build . cd - -gcc -o flight_server -Wall -O2 -Ithirdparty -Ithirdparty/opus/include -Ithirdparty/enet/include -Ithirdparty/minilzo -Ithirdparty/Chipmunk2D/include -Ithirdparty/Chipmunk2D/include/chipmunk server_main.c server.c debugdraw.c gamestate.c sokol_impl.c thirdparty/minilzo/minilzo.c thirdparty/enet/*.c thirdparty/Chipmunk2D/src/*.c -lm -lpthread -ldl thirdparty/opus/build/libopus.a +gcc -o flight_server -Wall -O2 -DRELEASE -Ithirdparty -Ithirdparty/opus/include -Ithirdparty/enet/include -Ithirdparty/minilzo -Ithirdparty/Chipmunk2D/include -Ithirdparty/Chipmunk2D/include/chipmunk server_main.c server.c debugdraw.c gamestate.c sokol_impl.c thirdparty/minilzo/minilzo.c thirdparty/enet/*.c thirdparty/Chipmunk2D/src/*.c -lm -lpthread -ldl thirdparty/opus/build/libopus.a diff --git a/build_release.bat b/build_release.bat index 3e9df40..b0fcea4 100644 --- a/build_release.bat +++ b/build_release.bat @@ -1,3 +1,3 @@ call shadergen.bat -set compileopts=/Fe"flight_release" /O2 +set compileopts=/Fe"flight_release" /O2 /DRELEASE call build_msvc.bat \ No newline at end of file diff --git a/buildsettings.h b/buildsettings.h new file mode 100644 index 0000000..38f5aa3 --- /dev/null +++ b/buildsettings.h @@ -0,0 +1,29 @@ +#pragma once + +#ifdef SERVER_ADDRESS +#error Don't define server address from the build system, use the build settings header +#endif + + +#ifdef DEBUG + +#define SERVER_ADDRESS "127.0.0.1" + +#define PROFILING +#define DEBUG_RENDERING +#define DEBUG_WORLD +#define UNLOCK_ALL +#define INFINITE_RESOURCES +#define NO_GRAVITY + +#else + +#ifdef RELEASE + +#define SERVER_ADDRESS "207.246.80.160" + +#else +#error Define either DEBUG or RELEASE +#endif + +#endif diff --git a/debugdraw.c b/debugdraw.c index 58f8cf8..3fb517e 100644 --- a/debugdraw.c +++ b/debugdraw.c @@ -1,8 +1,10 @@ +#include "types.h" +#include "buildsettings.h" + #ifdef DEBUG_RENDERING #include "sokol_gfx.h" #include "sokol_gp.h" #endif -#include "types.h" #define MAX_COMMANDS 64 @@ -36,8 +38,6 @@ static THREADLOCAL int command_i = 0; void dbg_drawall() { - // return; - #ifdef DEBUG_RENDERING sgp_set_color(0.4f, 0.8f, 0.2f, 0.8f); for (int i = 0; i < command_i; i++) diff --git a/gamestate.c b/gamestate.c index c5f7e90..03af263 100644 --- a/gamestate.c +++ b/gamestate.c @@ -6,7 +6,7 @@ #define PROFILING_IMPL #include "profiling.h" -#include "ipsettings.h" // debug/developer settings +#include "buildsettings.h" // debug/developer settings #include // assert logging #include // memset @@ -1804,7 +1804,6 @@ cpVect thruster_force(Entity *box) uint64_t tick(GameState *gs) { - // return (uint64_t)floor(gs->time / ((double)TIMESTEP)); return gs->tick; } diff --git a/main.c b/main.c index 372bc1d..4ee386e 100644 --- a/main.c +++ b/main.c @@ -33,7 +33,7 @@ #define MINIAUDIO_IMPLEMENTATION #include "miniaudio.h" -#include "ipsettings.h" +#include "buildsettings.h" #include "profiling.h" // shaders diff --git a/server.c b/server.c index 6e5f40d..6a8bfb7 100644 --- a/server.c +++ b/server.c @@ -132,7 +132,7 @@ void server(void *info_raw) ENetAddress address; ENetHost *enet_host; - int sethost = enet_address_set_host_ip(&address, LOCAL_SERVER_ADDRESS); + int sethost = enet_address_set_host_ip(&address, "0.0.0.0"); if (sethost != 0) { Log("Fishy return value from set host: %d\n", sethost); diff --git a/types.h b/types.h index 41793e4..d244935 100644 --- a/types.h +++ b/types.h @@ -1,6 +1,6 @@ #pragma once -#include "ipsettings.h" +#include "buildsettings.h" #define MAX_BOX_TYPES 64 #define ZOOM_MIN 0.25f @@ -96,9 +96,6 @@ #define ARRLEN(x) (sizeof(x) / sizeof((x)[0])) -// must make this header and set the target address, just #define SERVER_ADDRESS "127.0.0.1" -#include "ipsettings.h" // don't leak IP! - #include "miniaudio.h" // @Robust BAD. using miniaudio mutex construct for server thread synchronization. AWFUL! #include "cpVect.h" // offers vector functions and types for the structs