Selaa lähdekoodia

engine: remove dead code.

undefined
Sam Hocevar 10 vuotta sitten
vanhempi
commit
2f752030f0
8 muutettua tiedostoa jossa 2 lisäystä ja 360 poistoa
  1. +2
    -2
      src/Makefile.am
  2. +0
    -2
      src/core.h
  3. +0
    -71
      src/layer.cpp
  4. +0
    -43
      src/layer.h
  5. +0
    -4
      src/lolcore.vcxproj
  6. +0
    -15
      src/lolcore.vcxproj.filters
  7. +0
    -180
      src/map.cpp
  8. +0
    -43
      src/map.h

+ 2
- 2
src/Makefile.am Näytä tiedosto

@@ -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 \


+ 0
- 2
src/core.h Näytä tiedosto

@@ -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"


+ 0
- 71
src/layer.cpp Näytä tiedosto

@@ -1,71 +0,0 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// 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 <cstdlib>

#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 */


+ 0
- 43
src/layer.h Näytä tiedosto

@@ -1,43 +0,0 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// 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 <stdint.h>

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__


+ 0
- 4
src/lolcore.vcxproj Näytä tiedosto

@@ -159,9 +159,7 @@
<ClCompile Include="image\render\noise.cpp" />
<ClCompile Include="input\controller.cpp" />
<ClCompile Include="input\input.cpp" />
<ClCompile Include="layer.cpp" />
<ClCompile Include="light.cpp" />
<ClCompile Include="map.cpp" />
<ClCompile Include="math\constants.cpp" />
<ClCompile Include="math\geometry.cpp" />
<ClCompile Include="math\half.cpp" />
@@ -276,7 +274,6 @@
<ClInclude Include="input\input.h" />
<ClInclude Include="input\input_internal.h" />
<ClInclude Include="input\keys.h" />
<ClInclude Include="layer.h" />
<ClInclude Include="light.h" />
<ClInclude Include="loldebug.h" />
<ClInclude Include="lolgl.h" />
@@ -327,7 +324,6 @@
<ClInclude Include="lol\unit.h" />
<ClInclude Include="mesh\mesh.h" />
<ClInclude Include="mesh\primitive.h" />
<ClInclude Include="map.h" />
<ClInclude Include="messageservice.h" />
<ClInclude Include="numeric.h" />
<ClInclude Include="platform.h" />


+ 0
- 15
src/lolcore.vcxproj.filters Näytä tiedosto

@@ -207,18 +207,12 @@
<ClCompile Include="gradient.cpp">
<Filter>...</Filter>
</ClCompile>
<ClCompile Include="layer.cpp">
<Filter>...</Filter>
</ClCompile>
<ClCompile Include="light.cpp">
<Filter>...</Filter>
</ClCompile>
<ClCompile Include="ticker.cpp">
<Filter>...</Filter>
</ClCompile>
<ClCompile Include="map.cpp">
<Filter>...</Filter>
</ClCompile>
<ClCompile Include="platform.cpp">
<Filter>...</Filter>
</ClCompile>
@@ -477,9 +471,6 @@
<ClInclude Include="gradient.h">
<Filter>...</Filter>
</ClInclude>
<ClInclude Include="layer.h">
<Filter>...</Filter>
</ClInclude>
<ClInclude Include="light.h">
<Filter>...</Filter>
</ClInclude>
@@ -489,9 +480,6 @@
<ClInclude Include="lolgl.h">
<Filter>...</Filter>
</ClInclude>
<ClInclude Include="map.h">
<Filter>...</Filter>
</ClInclude>
<ClInclude Include="numeric.h">
<Filter>...</Filter>
</ClInclude>
@@ -570,9 +558,6 @@
<ClInclude Include="platform\ps3\threadbase.h">
<Filter>platform\ps3</Filter>
</ClInclude>
<ClInclude Include="map.h">
<Filter>src\...</Filter>
</ClInclude>
<ClInclude Include="lol\base\array.h">
<Filter>lol\base</Filter>
</ClInclude>


+ 0
- 180
src/map.cpp Näytä tiedosto

@@ -1,180 +0,0 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2013 Sam Hocevar <sam@hocevar.net>
// 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 <cstdio>
#include <cstring>
#include <cstdlib>
#include <ctype.h>

#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<Layer *> 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, " <tileset firstgid=\"%i\"", &i) == 1)
{
/* This is a tileset description. Remember its first gid value. */
gids[data->ntilers] = i;
}
else if (sscanf(tmp, " <image source=\"%[^\"]\"", str) == 1)
{
/* This is a tileset image file. Associate it with firstgid. */
data->tilesets[data->ntilers] = Tiler::Register(str, ivec2(32),
ivec2::zero);
data->ntilers++;
//Log::Debug("new tiler %s\n", str);
}
else if (sscanf(tmp, " <layer name=\"%c%i%c%*[^\"]\" "
"width=\"%i\" height=\"%i\"", &a, &i, &b, &j, &k) == 5)
{
/* This is a layer description. Prepare to read the data. */
orientation = toupper(a) == 'V' ? 1 : 0;
level = i * 32;
data->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 */


+ 0
- 43
src/map.h Näytä tiedosto

@@ -1,43 +0,0 @@
//
// Lol Engine
//
// Copyright: (c) 2010-2011 Sam Hocevar <sam@hocevar.net>
// 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__


Ladataan…
Peruuta
Tallenna