@@ -52,8 +52,8 @@ void DebugSprite::TickRender(float delta_time) | |||||
{ | { | ||||
Asset::TickRender(delta_time); | Asset::TickRender(delta_time); | ||||
data->game->GetScene()->AddTile((data->tiler << 16) | 15, 300, 200, 32, 1); | |||||
data->game->GetScene()->AddTile((data->tiler << 16) | 31, 300, 200, 0, 1); | |||||
data->game->GetScene()->AddTile((data->tiler << 16) | 15, 320, 240, 32, 1); | |||||
data->game->GetScene()->AddTile((data->tiler << 16) | 31, 320, 240, 0, 1); | |||||
} | } | ||||
DebugSprite::~DebugSprite() | DebugSprite::~DebugSprite() | ||||
@@ -7,7 +7,7 @@ | |||||
# include "config.h" | # include "config.h" | ||||
#endif | #endif | ||||
#include <stdlib.h> | |||||
#include <cstdlib> | |||||
#include "layer.h" | #include "layer.h" | ||||
@@ -40,7 +40,8 @@ void Layer::Render(Scene *scene, int x, int y, int z) | |||||
for (int j = 0; j < height; j++) | for (int j = 0; j < height; j++) | ||||
for (int i = 0; i < width; i++) | for (int i = 0; i < width; i++) | ||||
if (data[j * width + i]) | if (data[j * width + i]) | ||||
scene->AddTile(data[j * width + i], x + i * 32, y + j * 32, | |||||
scene->AddTile(data[j * width + i], | |||||
x + i * 32, y + j * 32 + altitude, | |||||
altitude + z, orientation); | altitude + z, orientation); | ||||
} | } | ||||
@@ -130,6 +130,7 @@ Map::Map(char const *path) | |||||
data->layers = (Layer **)realloc(data->layers, | data->layers = (Layer **)realloc(data->layers, | ||||
sizeof(Layer **) * (data->nlayers + 1)); | sizeof(Layer **) * (data->nlayers + 1)); | ||||
orientation = toupper(a) == 'V' ? 1 : 0; | orientation = toupper(a) == 'V' ? 1 : 0; | ||||
level = i * 32; | |||||
data->width = j; | data->width = j; | ||||
data->height = k; | data->height = k; | ||||
tiles = (uint32_t *)malloc(j * k * sizeof(uint32_t)); | tiles = (uint32_t *)malloc(j * k * sizeof(uint32_t)); | ||||
@@ -72,7 +72,7 @@ void Scene::AddTile(uint32_t code, int x, int y, int z, int o) | |||||
if ((data->ntiles % 1024) == 0) | if ((data->ntiles % 1024) == 0) | ||||
data->tiles = (Tile *)realloc(data->tiles, | data->tiles = (Tile *)realloc(data->tiles, | ||||
(data->ntiles + 1024) * sizeof(Tile)); | (data->ntiles + 1024) * sizeof(Tile)); | ||||
data->tiles[data->ntiles].prio = y - 2 * 32 * z + (o ? 0 : 32); | |||||
data->tiles[data->ntiles].prio = -y - 2 * 32 * z + (o ? 0 : 32); | |||||
data->tiles[data->ntiles].code = code; | data->tiles[data->ntiles].code = code; | ||||
data->tiles[data->ntiles].x = x; | data->tiles[data->ntiles].x = x; | ||||
data->tiles[data->ntiles].y = y; | data->tiles[data->ntiles].y = y; | ||||