summaryrefslogtreecommitdiffstats
path: root/src/area.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/area.c')
-rw-r--r--src/area.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/src/area.c b/src/area.c
index a41ff62..2e55fe9 100644
--- a/src/area.c
+++ b/src/area.c
@@ -5,12 +5,11 @@
#include "logging.h"
static void init_map_layers(struct area *);
-static void set_layers_palette(struct area *, struct viewport *);
static void blit_map_layers(struct area *);
static void blit_map_layer(struct area *, enum map_layer, enum area_layer);
struct area *
-area_new(struct map *map, struct viewport *vp)
+area_new(struct map *map, SDL_Palette *pal)
{
struct area *a;
@@ -25,12 +24,23 @@ area_new(struct map *map, struct viewport *vp)
a->map = map;
init_map_layers(a);
- set_layers_palette(a, vp);
+ set_area_palette(a, pal);
blit_map_layers(a);
return a;
}
+void
+set_area_palette(struct area *area, SDL_Palette *pal)
+{
+ enum area_layer l;
+
+ for (l = 0; l < AREA_LAYERS_MAX; ++l) {
+ SDL_SetPalette(area->map_layers[l], SDL_LOGPAL,
+ pal->colors, 0, pal->ncolors);
+ }
+}
+
static void
init_map_layers(struct area *area)
{
@@ -59,20 +69,6 @@ init_map_layers(struct area *area)
}
static void
-set_layers_palette(struct area *area, struct viewport *vp)
-{
- enum area_layer l;
- SDL_Palette *pal;
-
- pal = vp->screen->format->palette;
-
- for (l = 0; l < AREA_LAYERS_MAX; ++l) {
- SDL_SetColors(area->map_layers[l],
- pal->colors, 0, pal->ncolors);
- }
-}
-
-static void
blit_map_layers(struct area *area)
{
blit_map_layer(area, MAP_LAYER_GROUND, AREA_LAYER_BOT);