From 4df4ba3a7839e79e4b62ae502663de98a75be50a Mon Sep 17 00:00:00 2001 From: Sam Hocevar Date: Thu, 17 Feb 2011 18:06:33 +0000 Subject: [PATCH] Get rid of the SHADER_CRAP macro and use LOL_EXPERIMENTAL instead, together with the --enable-experimental flag. Use LOL_DEBUG and LOL_RELEASE instead of the previous values. --- configure.ac | 10 ++++++++-- src/core.h | 3 --- src/dict.cpp | 2 +- src/entity.cpp | 8 ++++---- src/entity.h | 2 +- src/sample.cpp | 2 +- src/scene.cpp | 4 ++-- src/ticker.cpp | 18 +++++++++--------- src/tiler.cpp | 14 +++++++------- src/tileset.cpp | 2 +- src/video.cpp | 14 +++++++------- win32/deushax.vcxproj | 2 +- win32/editor.vcxproj | 2 +- win32/monsterz.vcxproj | 2 +- 14 files changed, 44 insertions(+), 41 deletions(-) diff --git a/configure.ac b/configure.ac index d86d7fb9..219ea585 100644 --- a/configure.ac +++ b/configure.ac @@ -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 diff --git a/src/core.h b/src/core.h index cd81db0d..e7778baa 100644 --- a/src/core.h +++ b/src/core.h @@ -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" diff --git a/src/dict.cpp b/src/dict.cpp index 650eb9fd..e1f782c4 100644 --- a/src/dict.cpp +++ b/src/dict.cpp @@ -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 diff --git a/src/entity.cpp b/src/entity.cpp index 135c3147..7796ccfc 100644 --- a/src/entity.cpp +++ b/src/entity.cpp @@ -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; diff --git a/src/entity.h b/src/entity.h index 7a36317c..56c5f45a 100644 --- a/src/entity.h +++ b/src/entity.h @@ -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, diff --git a/src/sample.cpp b/src/sample.cpp index 7a24fedd..d60297dd 100644 --- a/src/sample.cpp +++ b/src/sample.cpp @@ -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(); diff --git a/src/scene.cpp b/src/scene.cpp index 0e8ac934..e8a33e5d 100644 --- a/src/scene.cpp +++ b/src/scene.cpp @@ -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; diff --git a/src/ticker.cpp b/src/ticker.cpp index a0893add..dd20ab0f 100644 --- a/src/ticker.cpp +++ b/src/ticker.cpp @@ -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; diff --git a/src/tiler.cpp b/src/tiler.cpp index 0359d60b..4c22e5de 100644 --- a/src/tiler.cpp +++ b/src/tiler.cpp @@ -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) diff --git a/src/tileset.cpp b/src/tileset.cpp index 0bd53b16..97ba47ed 100644 --- a/src/tileset.cpp +++ b/src/tileset.cpp @@ -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(); diff --git a/src/video.cpp b/src/video.cpp index 3f063f4e..b1ea98cd 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -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); diff --git a/win32/deushax.vcxproj b/win32/deushax.vcxproj index 733e0462..df7e4cf8 100644 --- a/win32/deushax.vcxproj +++ b/win32/deushax.vcxproj @@ -121,7 +121,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;LOL_DEBUG;%(PreprocessorDefinitions) $(SolutionDir)\..\src;$(SdlIncludes);%(AdditionalIncludeDirectories) diff --git a/win32/editor.vcxproj b/win32/editor.vcxproj index d4018e8a..0e365c4e 100644 --- a/win32/editor.vcxproj +++ b/win32/editor.vcxproj @@ -121,7 +121,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;LOL_DEBUG;%(PreprocessorDefinitions) $(SolutionDir)\..\src;$(SolutionDir)\..\deushax;$(SdlIncludes);$(GtkIncludes);%(AdditionalIncludeDirectories) diff --git a/win32/monsterz.vcxproj b/win32/monsterz.vcxproj index b9fcdc41..26150e99 100644 --- a/win32/monsterz.vcxproj +++ b/win32/monsterz.vcxproj @@ -130,7 +130,7 @@ Level3 Disabled - WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + WIN32;_DEBUG;_CONSOLE;LOL_DEBUG;%(PreprocessorDefinitions) $(SolutionDir)\..\src;$(SdlIncludes);%(AdditionalIncludeDirectories)