together with the --enable-experimental flag. Use LOL_DEBUG and LOL_RELEASE instead of the previous values.legacy
| @@ -43,6 +43,8 @@ AC_ARG_ENABLE(debug, | |||
| [ --enable-debug build debug versions of the game (default no)]) | |||
| AC_ARG_ENABLE(release, | |||
| [ --enable-release build final release of the game (default no)]) | |||
| AC_ARG_ENABLE(experimental, | |||
| [ --enable-experimental experimental build (default no)]) | |||
| AC_ARG_ENABLE(cppunit, | |||
| [ --enable-cppunit use cppunit for unit tests (autodetected)]) | |||
| @@ -50,19 +52,23 @@ AC_ARG_ENABLE(cppunit, | |||
| AC_CHECK_HEADERS(stdio.h stdarg.h inttypes.h endian.h stdint.h getopt.h) | |||
| if test "${enable_debug}" = "yes"; then | |||
| AC_DEFINE(_DEBUG, 1, Define to 1 to activate debug) | |||
| AC_DEFINE(LOL_DEBUG, 1, Define to 1 to activate debug) | |||
| OPT="-O0" | |||
| else | |||
| OPT="-O2" | |||
| fi | |||
| if test "${enable_release}" = "yes"; then | |||
| AC_DEFINE(FINAL_RELEASE, 1, Define to 1 to activate final release) | |||
| AC_DEFINE(LOL_RELEASE, 1, Define to 1 to activate final release) | |||
| REL="" | |||
| else | |||
| REL="-g" | |||
| fi | |||
| if test "${enable_experimental}" = "yes"; then | |||
| AC_DEFINE(LOL_EXPERIMENTAL, 1, Define to 1 to activate experimental build) | |||
| fi | |||
| # Optimizations | |||
| CXXFLAGS="${CXXFLAGS} ${REL} ${OPT} -fno-strength-reduce -fomit-frame-pointer" | |||
| # Code qui fait des warnings == code de porc == deux baffes dans ta gueule | |||
| @@ -16,9 +16,6 @@ | |||
| #if !defined __DH_CORE_H__ | |||
| #define __DH_CORE_H__ | |||
| // Temporary stuff | |||
| //#define SHADER_CRAP 1 | |||
| // Base types | |||
| #include "matrix.h" | |||
| #include "numeric.h" | |||
| @@ -41,7 +41,7 @@ public: | |||
| ~DictData() | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (nentities) | |||
| fprintf(stderr, "ERROR: still %i entities in dict\n", nentities); | |||
| #endif | |||
| @@ -27,7 +27,7 @@ Entity::Entity() : | |||
| ref(0), | |||
| destroy(0) | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| state = STATE_IDLE; | |||
| #endif | |||
| gamegroup = GAMEGROUP_DEFAULT; | |||
| @@ -37,7 +37,7 @@ Entity::Entity() : | |||
| Entity::~Entity() | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (!destroy) | |||
| fprintf(stderr, "ERROR: entity destructor called directly\n"); | |||
| #endif | |||
| @@ -50,7 +50,7 @@ char const *Entity::GetName() | |||
| void Entity::TickGame(float deltams) | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (state != STATE_PRETICK_GAME) | |||
| fprintf(stderr, "ERROR: invalid entity game tick\n"); | |||
| state = STATE_POSTTICK_GAME; | |||
| @@ -59,7 +59,7 @@ void Entity::TickGame(float deltams) | |||
| void Entity::TickDraw(float deltams) | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (state != STATE_PRETICK_DRAW) | |||
| fprintf(stderr, "ERROR: invalid entity draw tick\n"); | |||
| state = STATE_POSTTICK_DRAW; | |||
| @@ -62,7 +62,7 @@ protected: | |||
| static int const DRAWGROUP_BEGIN = GAMEGROUP_END; | |||
| static int const ALLGROUP_END = DRAWGROUP_END; | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| enum | |||
| { | |||
| STATE_IDLE = 0, | |||
| @@ -47,7 +47,7 @@ Sample::Sample(char const *path) | |||
| data->chunk = Mix_LoadWAV(path); | |||
| if (!data->chunk) | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| fprintf(stderr, "ERROR: could not load %s\n", path); | |||
| #endif | |||
| SDL_Quit(); | |||
| @@ -35,7 +35,7 @@ struct Tile | |||
| int x, y, z, o; | |||
| }; | |||
| #if SHADER_CRAP | |||
| #if LOL_EXPERIMENTAL | |||
| extern GLuint prog; | |||
| #endif | |||
| @@ -134,7 +134,7 @@ void Scene::Render() // XXX: rename to Blit() | |||
| #endif | |||
| qsort(data->tiles, data->ntiles, sizeof(Tile), SceneData::Compare); | |||
| #if SHADER_CRAP | |||
| #if LOL_EXPERIMENTAL | |||
| float *vertices = new float[18]; | |||
| vertices[0] = -0.5f; vertices[1] = 0.5f; vertices[2] = 0.0f; | |||
| vertices[3] = 0.5f; vertices[4] = 0.5f; vertices[5] = 0.0f; | |||
| @@ -39,7 +39,7 @@ public: | |||
| ~TickerData() | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (nentities) | |||
| fprintf(stderr, "ERROR: still %i entities in ticker\n", nentities); | |||
| if (autolist) | |||
| @@ -94,7 +94,7 @@ void Ticker::Register(Entity *entity) | |||
| void Ticker::Ref(Entity *entity) | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (!entity) | |||
| { | |||
| fprintf(stderr, "ERROR: refing NULL entity\n"); | |||
| @@ -125,7 +125,7 @@ void Ticker::Ref(Entity *entity) | |||
| int Ticker::Unref(Entity *entity) | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (!entity) | |||
| { | |||
| fprintf(stderr, "ERROR: dereferencing NULL entity\n"); | |||
| @@ -192,14 +192,14 @@ void Ticker::TickGame() | |||
| for (Entity *e = data->list[i]; e && n < data->panic; e = e->gamenext) | |||
| if (e->ref) | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| fprintf(stderr, "ERROR: poking %s\n", e->GetName()); | |||
| #endif | |||
| e->ref--; | |||
| n++; | |||
| } | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (n) | |||
| fprintf(stderr, "ERROR: %i entities stuck after %i frames, " | |||
| "poked %i\n", data->nentities, data->quitdelay, n); | |||
| @@ -260,13 +260,13 @@ void Ticker::TickGame() | |||
| for (Entity *e = data->list[i]; e; e = e->gamenext) | |||
| if (!e->destroy) | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (e->state != Entity::STATE_IDLE) | |||
| fprintf(stderr, "ERROR: entity not idle for game tick\n"); | |||
| e->state = Entity::STATE_PRETICK_GAME; | |||
| #endif | |||
| e->TickGame(data->deltams); | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (e->state != Entity::STATE_POSTTICK_GAME) | |||
| fprintf(stderr, "ERROR: entity missed super game tick\n"); | |||
| e->state = Entity::STATE_IDLE; | |||
| @@ -301,13 +301,13 @@ void Ticker::TickDraw() | |||
| for (Entity *e = data->list[i]; e; e = e->drawnext) | |||
| if (!e->destroy) | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (e->state != Entity::STATE_IDLE) | |||
| fprintf(stderr, "ERROR: entity not idle for draw tick\n"); | |||
| e->state = Entity::STATE_PRETICK_DRAW; | |||
| #endif | |||
| e->TickDraw(data->deltams); | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (e->state != Entity::STATE_POSTTICK_DRAW) | |||
| fprintf(stderr, "ERROR: entity missed super draw tick\n"); | |||
| e->state = Entity::STATE_IDLE; | |||
| @@ -26,14 +26,14 @@ static class TilerData | |||
| public: | |||
| TilerData() | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| : lasterror(-1) | |||
| #endif | |||
| { } | |||
| private: | |||
| Dict tilesets; | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| int lasterror; | |||
| #endif | |||
| } | |||
| @@ -53,7 +53,7 @@ int Tiler::Register(char const *path, int2 size, int2 count, float dilate) | |||
| { | |||
| TileSet *tileset = new TileSet(path, size, count, dilate); | |||
| data->tilesets.SetEntity(id, tileset); | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (id == data->lasterror) | |||
| data->lasterror = -1; | |||
| #endif | |||
| @@ -70,7 +70,7 @@ void Tiler::Deregister(int id) | |||
| int2 Tiler::GetSize(int id) | |||
| { | |||
| TileSet *tileset = (TileSet *)data->tilesets.GetEntity(id - 1); | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (!tileset) | |||
| { | |||
| fprintf(stderr, "ERROR: getting size for null tiler #%i\n", id); | |||
| @@ -83,7 +83,7 @@ int2 Tiler::GetSize(int id) | |||
| int2 Tiler::GetCount(int id) | |||
| { | |||
| TileSet *tileset = (TileSet *)data->tilesets.GetEntity(id - 1); | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (!tileset) | |||
| { | |||
| fprintf(stderr, "ERROR: getting count for null tiler #%i\n", id); | |||
| @@ -98,7 +98,7 @@ void Tiler::Bind(uint32_t code) | |||
| int id = (code >> 16) - 1; /* ID 0 is for the empty tileset */ | |||
| TileSet *tileset = (TileSet *)data->tilesets.GetEntity(id); | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (!tileset) | |||
| { | |||
| if (id != data->lasterror) | |||
| @@ -116,7 +116,7 @@ void Tiler::BlitTile(uint32_t code, int x, int y, int z, int o, | |||
| int id = (code >> 16) - 1; /* ID 0 is for the empty tileset */ | |||
| TileSet *tileset = (TileSet *)data->tilesets.GetEntity(id); | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| if (!tileset) | |||
| { | |||
| if (id != data->lasterror) | |||
| @@ -70,7 +70,7 @@ TileSet::TileSet(char const *path, int2 size, int2 count, float dilate) | |||
| if (!data->img) | |||
| { | |||
| #if !FINAL_RELEASE | |||
| #if !LOL_RELEASE | |||
| fprintf(stderr, "ERROR: could not load %s\n", path); | |||
| #endif | |||
| SDL_Quit(); | |||
| @@ -28,14 +28,14 @@ | |||
| #include "core.h" | |||
| #if SHADER_CRAP | |||
| #if LOL_EXPERIMENTAL | |||
| GLuint prog, sh1, sh2; | |||
| GLint uni_m1, uni_m2, uni_m3; | |||
| float4x4 projection_matrix, view_matrix, model_matrix; | |||
| #endif | |||
| #if SHADER_CRAP | |||
| #if LOL_EXPERIMENTAL | |||
| static char const *vertexshader = | |||
| "#version 130\n" | |||
| "\n" | |||
| @@ -85,7 +85,7 @@ void Video::Setup(int width, int height) | |||
| glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); | |||
| #if SHADER_CRAP | |||
| #if LOL_EXPERIMENTAL | |||
| sh1 = glCreateShader(GL_VERTEX_SHADER); | |||
| glShaderSource(sh1, 1, &vertexshader, NULL); | |||
| glCompileShader(sh1); | |||
| @@ -122,7 +122,7 @@ void Video::Setup(int width, int height) | |||
| void Video::SetFov(float theta) | |||
| { | |||
| #if SHADER_CRAP | |||
| #if LOL_EXPERIMENTAL | |||
| float width = GetWidth(); | |||
| float height = GetHeight(); | |||
| //float near = -width - height; | |||
| @@ -185,7 +185,7 @@ void Video::SetDepth(bool set) | |||
| void Video::Clear() | |||
| { | |||
| #if SHADER_CRAP | |||
| #if LOL_EXPERIMENTAL | |||
| glViewport(0, 0, GetWidth(), GetHeight()); | |||
| glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | |||
| @@ -213,7 +213,7 @@ void Video::Clear() | |||
| glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); | |||
| #endif | |||
| #if SHADER_CRAP | |||
| #if LOL_EXPERIMENTAL | |||
| static float time; | |||
| time += 0.01f; | |||
| SetFov(1.0f + sinf(time)); | |||
| @@ -224,7 +224,7 @@ void Video::Clear() | |||
| void Video::Destroy() | |||
| { | |||
| #if SHADER_CRAP | |||
| #if LOL_EXPERIMENTAL | |||
| glDetachShader(prog, sh1); | |||
| glDetachShader(prog, sh2); | |||
| glDeleteShader(sh1); | |||
| @@ -121,7 +121,7 @@ | |||
| </PrecompiledHeader> | |||
| <WarningLevel>Level3</WarningLevel> | |||
| <Optimization>Disabled</Optimization> | |||
| <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |||
| <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;LOL_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |||
| <AdditionalIncludeDirectories>$(SolutionDir)\..\src;$(SdlIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |||
| </ClCompile> | |||
| <Link> | |||
| @@ -121,7 +121,7 @@ | |||
| </PrecompiledHeader> | |||
| <WarningLevel>Level3</WarningLevel> | |||
| <Optimization>Disabled</Optimization> | |||
| <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |||
| <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;LOL_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |||
| <AdditionalIncludeDirectories>$(SolutionDir)\..\src;$(SolutionDir)\..\deushax;$(SdlIncludes);$(GtkIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |||
| </ClCompile> | |||
| <Link> | |||
| @@ -130,7 +130,7 @@ | |||
| </PrecompiledHeader> | |||
| <WarningLevel>Level3</WarningLevel> | |||
| <Optimization>Disabled</Optimization> | |||
| <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |||
| <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;LOL_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions> | |||
| <AdditionalIncludeDirectories>$(SolutionDir)\..\src;$(SdlIncludes);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | |||
| </ClCompile> | |||
| <Link> | |||