summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-03-04 21:30:44 (EST)
committer P. J. McDermott <pjm@nac.net>2013-03-04 21:30:44 (EST)
commit826cfc5a4d6cf322cb82e5f889f16235720919f8 (patch)
treec57de419f3fa835c96107db203065e9373a26d58 /src
parent4735d4ba2d19dbc47012bef9b31749dba6ad43b3 (diff)
downloadoverworld-rpg-826cfc5a4d6cf322cb82e5f889f16235720919f8.zip
overworld-rpg-826cfc5a4d6cf322cb82e5f889f16235720919f8.tar.gz
overworld-rpg-826cfc5a4d6cf322cb82e5f889f16235720919f8.tar.bz2
src/main.c: Make demo day length less hardcoded.
Diffstat (limited to 'src')
-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;