diff --git a/src/Makefile.am b/src/Makefile.am index 0ab6a0ed..733989f3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -7,8 +7,8 @@ noinst_LIBRARIES = liblolcore.a liblolcore_a_SOURCES = \ core.h tiler.cpp tiler.h dict.cpp dict.h \ - audio.cpp audio.h scene.cpp scene.h font.cpp font.h layer.cpp layer.h \ - map.cpp map.h entity.cpp entity.h ticker.cpp ticker.h lolgl.h \ + audio.cpp audio.h scene.cpp scene.h font.cpp font.h \ + entity.cpp entity.h ticker.cpp ticker.h lolgl.h \ tileset.cpp tileset.h forge.cpp forge.h video.cpp video.h \ world.cpp world.h sample.cpp sample.h sampler.cpp sampler.h \ profiler.cpp profiler.h text.cpp text.h emitter.cpp emitter.h numeric.h utils.h \ diff --git a/src/core.h b/src/core.h index 5b0f6d21..fd8cbed2 100644 --- a/src/core.h +++ b/src/core.h @@ -195,8 +195,6 @@ static inline int isnan(float f) // Other objects #include "dict.h" -#include "map.h" -#include "layer.h" #include "mesh/mesh.h" #include "mesh/primitive.h" #include "application/application.h" diff --git a/src/layer.cpp b/src/layer.cpp deleted file mode 100644 index d591d9f5..00000000 --- a/src/layer.cpp +++ /dev/null @@ -1,71 +0,0 @@ -// -// Lol Engine -// -// Copyright: (c) 2010-2011 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. -// - -#if defined HAVE_CONFIG_H -# include "config.h" -#endif - -#include - -#include "core.h" - -using namespace std; - -namespace lol -{ - -Layer::Layer(int w, int h, int z, int o, uint32_t *in_data) -{ - width = w; - height = h; - altitude = z; - orientation = o; - data = in_data; - -#if 0 - fread(data, sizeof(unsigned int), width * height, fp); - for (int n = 0; n < width * height; n++) - { - unsigned int i = data[n]; - // XXX: endianness swapping might be necessary here - data[n] = i ? i - 1 : 0; - } -#endif -} - -Layer::~Layer() -{ - free(data); -} - -void Layer::Render(int /* x */, int /* y */, int /* z */) -{ - static int error = 1; - if (error && !(error = 0)) - Log::Error("FIXME: Layer::Render no longer works\n"); -#if 0 - for (int j = 0; j < height; j++) - for (int i = 0; i < width; i++) - if (data[j * width + i]) - scene.AddTile(data[j * width + i], - vec3(x + i * 32, - y + j * 32 - altitude, - altitude + z), - orientation); -#endif -} - -int Layer::GetZ() -{ - return altitude; -} - -} /* namespace lol */ - diff --git a/src/layer.h b/src/layer.h deleted file mode 100644 index 8fc235b2..00000000 --- a/src/layer.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// Lol Engine -// -// Copyright: (c) 2010-2011 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. -// - -// -// The Layer class -// --------------- -// A Layer object is a subset of a Map. -// - -#if !defined __LOL_LAYER_H__ -#define __LOL_LAYER_H__ - -#include - -namespace lol -{ - -class Layer -{ -public: - Layer(int w, int h, int z, int o, uint32_t *data); - ~Layer(); - - int GetZ(); - - void Render(int x, int y, int z); - -private: - int width, height, altitude, orientation; - uint32_t *data; -}; - -} /* namespace lol */ - -#endif // __LOL_LAYER_H__ - diff --git a/src/lolcore.vcxproj b/src/lolcore.vcxproj index 2f0a2f6a..7dfacffe 100644 --- a/src/lolcore.vcxproj +++ b/src/lolcore.vcxproj @@ -159,9 +159,7 @@ - - @@ -276,7 +274,6 @@ - @@ -327,7 +324,6 @@ - diff --git a/src/lolcore.vcxproj.filters b/src/lolcore.vcxproj.filters index 4317e55d..3f9ebd7f 100644 --- a/src/lolcore.vcxproj.filters +++ b/src/lolcore.vcxproj.filters @@ -207,18 +207,12 @@ ... - - ... - ... ... - - ... - ... @@ -477,9 +471,6 @@ ... - - ... - ... @@ -489,9 +480,6 @@ ... - - ... - ... @@ -570,9 +558,6 @@ platform\ps3 - - src\... - lol\base diff --git a/src/map.cpp b/src/map.cpp deleted file mode 100644 index 2357b834..00000000 --- a/src/map.cpp +++ /dev/null @@ -1,180 +0,0 @@ -// -// Lol Engine -// -// Copyright: (c) 2010-2013 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. -// - -#if defined HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include - -#include "core.h" - -using namespace std; - -namespace lol -{ - -/* - * LevelMap implementation class - */ - -class LevelMapData -{ - friend class LevelMap; - - static int const MAX_TILESETS = 128; - -private: - TileSet *tilesets[MAX_TILESETS]; - int ntilers; - - Array m_layers; - - int width, height; -}; - -/* - * Public LevelMap class - */ - -LevelMap::LevelMap(char const *path) - : data(new LevelMapData()) -{ - data->ntilers = 0; - data->width = 0; - data->height = 0; - - char tmp[BUFSIZ]; - int gids[LevelMapData::MAX_TILESETS]; - uint32_t *tiles = nullptr; - int level = 0, orientation = 0, ntiles = 0; - - FILE *fp = fopen(path, "r"); - - if (!fp) - return; - - while (!feof(fp)) - { - char str[1024]; - int i, j, k; - char a, b; - - /* Read a line, then decide what to do with it. */ - fgets(tmp, BUFSIZ, fp); - - if (tiles && !strchr(tmp, '<')) - { - /* We are in the process of reading layer data. Only stop - * when we have read the expected number of tiles. */ - char const *parser = tmp; - while (ntiles < data->width * data->height) - { - uint32_t code = 0; - int id = atoi(parser); - if (id) - { - for (int n = 0; n < data->ntilers; n++) - { - if (id < gids[n]) - continue; - if (n == data->ntilers - 1 - || id < gids[n + 1]) - { - static int error = 1; - if (error && !(error = 0)) - Log::Error("tilesets no longer work this way\n"); - //code = (data->tilesets[n] << 16) | (id - gids[n]); - break; - } - } - } - - int x = ntiles % data->width; - int y = data->height - 1 - (ntiles / data->width); - tiles[y * data->width + x] = code; - ntiles++; - - while (isdigit(*parser)) - parser++; - if (*parser == ',') - parser++; - if (!isdigit(*parser)) - break; - } - - if (ntiles == data->width * data->height) - { - Layer *l = new Layer(data->width, data->height, - level, orientation, tiles); - data->m_layers.Push(l); - tiles = nullptr; - //Log::Debug("new layer %ix%i\n", data->width, data->height); - } - } - else if (sscanf(tmp, " ntilers] = i; - } - else if (sscanf(tmp, " tilesets[data->ntilers] = Tiler::Register(str, ivec2(32), - ivec2::zero); - data->ntilers++; - //Log::Debug("new tiler %s\n", str); - } - else if (sscanf(tmp, " width = j; - data->height = k; - tiles = (uint32_t *)malloc(j * k * sizeof(uint32_t)); - ntiles = 0; - } - } - - fclose(fp); -} - -LevelMap::~LevelMap() -{ - for (int i = 0; i < data->ntilers; i++) - Tiler::Deregister(data->tilesets[i]); - for (int i = 0; i < data->m_layers.Count(); i++) - delete data->m_layers[i]; - delete data; -} - -void LevelMap::Render(int x, int y, int z) -{ - for (int i = 0; i < data->m_layers.Count(); i++) - data->m_layers[i]->Render(x, y, z); -} - -int LevelMap::GetWidth() -{ - return data->width * 32; -} - -int LevelMap::GetHeight() -{ - return data->height * 32; -} - -} /* namespace lol */ - diff --git a/src/map.h b/src/map.h deleted file mode 100644 index cd691585..00000000 --- a/src/map.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// Lol Engine -// -// Copyright: (c) 2010-2011 Sam Hocevar -// This program is free software; you can redistribute it and/or -// modify it under the terms of the Do What The Fuck You Want To -// Public License, Version 2, as published by Sam Hocevar. See -// http://www.wtfpl.net/ for more details. -// - -// -// The LevelMap class -// ------------------ -// A LevelMap object is a collection of Layers and other information (to be -// determined later). -// - -#if !defined __LOL_LEVELMAP_H__ -#define __LOL_LEVELMAP_H__ - -namespace lol -{ - -class LevelMapData; - -class LevelMap -{ -public: - LevelMap(char const *path); - ~LevelMap(); - - void Render(int x, int y, int z); - int GetWidth(); - int GetHeight(); - -private: - LevelMapData *data; -}; - -} /* namespace lol */ - -#endif // __LOL_MAP_H__ -