summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 4320b72..35d736f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -11,17 +11,17 @@
do { \
vp->x = x + map->tilewidth / 2 - vp->w / 2; \
vp->y = y + map->tileheight / 2 - vp->h / 2; \
- if (i % 720 < 180) { \
+ if (i % i_max < i_max / 4) { \
pal_start = map->palettes[MAP_PALETTE_MORN] \
.palette->palette; \
pal_end = map->palettes[MAP_PALETTE_DAY] \
.palette->palette; \
- } else if (i % 720 < 360) { \
+ } else if (i % i_max < i_max / 4 * 2) { \
pal_start = map->palettes[MAP_PALETTE_DAY] \
.palette->palette; \
pal_end = map->palettes[MAP_PALETTE_EVE] \
.palette->palette; \
- } else if (i % 720 < 540) { \
+ } else if (i % i_max < i_max / 4 * 3) { \
pal_start = map->palettes[MAP_PALETTE_EVE] \
.palette->palette; \
pal_end = map->palettes[MAP_PALETTE_NIGHT] \
@@ -32,7 +32,8 @@
pal_end = map->palettes[MAP_PALETTE_MORN] \
.palette->palette; \
} \
- if (!cycle_palettes_cosine(i, 180, pal_start, pal_end, pal)) { \
+ if (!cycle_palettes_cosine(i, i_max / 4, \
+ pal_start, pal_end, pal)) { \
warn("Failed to cycle palettes"); \
} \
set_area_palette(a, pal); \
@@ -53,7 +54,6 @@ main(void)
struct map *map;
struct area *a;
SDL_Palette *pal;
- int i;
struct map_exit *e;
init();
@@ -86,6 +86,7 @@ main(void)
/* Demo */
{
Uint32 start, end;
+ int i, i_max;
int x, y;
SDL_Palette *pal_start, *pal_end;
@@ -94,6 +95,7 @@ main(void)
pal->ncolors = 59;
i = 0;
+ i_max = 720;
start = SDL_GetTicks();
x = 19 * map->tilewidth ;
y = 38 * map->tileheight;