diff options
Diffstat (limited to 'src/area.c')
-rw-r--r-- | src/area.c | 30 |
1 files changed, 13 insertions, 17 deletions
@@ -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); |