summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/area.c50
-rw-r--r--src/layer.h8
2 files changed, 30 insertions, 28 deletions
diff --git a/src/area.c b/src/area.c
index 1914dad..f90cc09 100644
--- a/src/area.c
+++ b/src/area.c
@@ -27,10 +27,27 @@ area_new(struct map *map)
static void
blit_map_layers(struct map *map, struct area *area)
{
- blit_map_layer(map, MAP_LAYER_GROUND, area, AREA_LAYER_GROUND);
- blit_map_layer(map, MAP_LAYER_OBJ_LOW, area, AREA_LAYER_OBJ_LOW);
- blit_map_layer(map, MAP_LAYER_OBJ_MID, area, AREA_LAYER_OBJ_MID);
- blit_map_layer(map, MAP_LAYER_OBJ_HIGH, area, AREA_LAYER_OBJ_HIGH);
+ area->map_layers[AREA_LAYER_BOT] = SDL_CreateRGBSurface(
+ SDL_HWSURFACE | SDL_SRCCOLORKEY,
+ map->width * map->tilewidth,
+ map->height * map->tileheight,
+ 32, 0, 0, 0, 0);
+ blit_map_layer(map, MAP_LAYER_GROUND, area, AREA_LAYER_BOT);
+ blit_map_layer(map, MAP_LAYER_OBJ_LOW, area, AREA_LAYER_BOT);
+
+ area->map_layers[AREA_LAYER_MID] = SDL_CreateRGBSurface(
+ SDL_HWSURFACE | SDL_SRCCOLORKEY,
+ map->width * map->tilewidth,
+ map->height * map->tileheight,
+ 32, 0, 0, 0, 0);
+ blit_map_layer(map, MAP_LAYER_OBJ_MID, area, AREA_LAYER_MID);
+
+ area->map_layers[AREA_LAYER_TOP] = SDL_CreateRGBSurface(
+ SDL_HWSURFACE | SDL_SRCCOLORKEY,
+ map->width * map->tilewidth,
+ map->height * map->tileheight,
+ 32, 0, 0, 0, 0);
+ blit_map_layer(map, MAP_LAYER_OBJ_HIGH, area, AREA_LAYER_TOP);
}
static void
@@ -44,15 +61,6 @@ blit_map_layer(struct map *map, enum map_layer_id map_layer,
Uint32 mts_lastgid;
SDL_Rect tilerect, layerrect;
- area->map_layers[area_layer] = SDL_CreateRGBSurface(
- SDL_HWSURFACE | SDL_SRCCOLORKEY | SDL_SRCALPHA,
- map->width * map->tilewidth,
- map->height * map->tileheight,
- 32,
- 0x000000FF,
- 0x0000FF00,
- 0x00FF0000,
- 0x00000000);
SDL_SetColorKey(area->map_layers[area_layer], SDL_SRCCOLORKEY, 0);
for (i = 0; i < map->width * map->height; ++i) {
gid = map->layers[map_layer].tiles[i];
@@ -156,12 +164,8 @@ render_area_to_surface(struct area *area, SDL_Rect *arearect,
dstrect.w, dstrect.h, dstrect.x, dstrect.y);
#endif
- /* Blit ground layer. */
- SDL_BlitSurface(area->map_layers[AREA_LAYER_GROUND], &srcrect,
- surface, &dstrect);
-
- /* Blit low objects layer. */
- SDL_BlitSurface(area->map_layers[AREA_LAYER_OBJ_LOW], &srcrect,
+ /* Blit bottom layer. */
+ SDL_BlitSurface(area->map_layers[AREA_LAYER_BOT], &srcrect,
surface, &dstrect);
/* return;*/
@@ -171,13 +175,13 @@ render_area_to_surface(struct area *area, SDL_Rect *arearect,
SDL_FillRect(surface, &tmprect,
SDL_MapRGB(surface->format, 31, 31, 127));
- /* Blit middle objects layer. */
- SDL_BlitSurface(area->map_layers[AREA_LAYER_OBJ_MID], &srcrect,
+ /* Blit middle layer. */
+ SDL_BlitSurface(area->map_layers[AREA_LAYER_MID], &srcrect,
surface, &dstrect);
/* TODO: Blit high sprites. */
- /* Blit high objects layer. */
- SDL_BlitSurface(area->map_layers[AREA_LAYER_OBJ_HIGH], &srcrect,
+ /* Blit top layer. */
+ SDL_BlitSurface(area->map_layers[AREA_LAYER_TOP], &srcrect,
surface, &dstrect);
}
diff --git a/src/layer.h b/src/layer.h
index 5cb7afc..c771eff 100644
--- a/src/layer.h
+++ b/src/layer.h
@@ -2,11 +2,9 @@
#define LAYER_H
enum area_layer_id {
- AREA_LAYER_GROUND = 0,
- AREA_LAYER_OBJ_LOW,
- AREA_LAYER_OBJ_MID,
- AREA_LAYER_OBJ_HIGH,
- AREA_LAYER_WEATHER,
+ AREA_LAYER_BOT = 0,
+ AREA_LAYER_MID,
+ AREA_LAYER_TOP,
AREA_LAYERS_MAX
};