From: Joshua Grams Date: Fri, 8 Jul 2005 21:22:32 +0000 (+0000) Subject: w00t! Finally rearranged the scroll equations so they make sense to me. X-Git-Tag: 0.4~47 X-Git-Url: https://jasonwoof.com/gitweb/?p=vor.git;a=commitdiff_plain;h=9ffdd66ad5f2c29a2125bbd458a700625f178065 w00t! Finally rearranged the scroll equations so they make sense to me. Also moved reset_rocks() call to init_rocks() from main(). --- diff --git a/config.h b/config.h index 641234a..5c7729c 100644 --- a/config.h +++ b/config.h @@ -7,6 +7,9 @@ #define XSIZE 640 #define YSIZE 480 +#define XSCROLLTO (XSIZE/3) +#define YSCROLLTO (YSIZE/2) + #define SCREENDXMIN 7.5 // image file containing font for score stuff. diff --git a/main.c b/main.c index 58d68d7..c32feb3 100644 --- a/main.c +++ b/main.c @@ -613,16 +613,10 @@ gameloop() { shipy += shipdy*t_frame; // SCROLLING - tmp = shipy - (YSIZE / 2); - tmp += shipdy * 25; - tmp /= -25; - tmp = ((screendy * (t_frame - 12)) + (tmp * t_frame)) / 12; - screendy = -tmp; - tmp = shipx - (XSIZE / 3); - tmp += shipdx * 25; - tmp /= -25; - tmp = ((screendx * (t_frame - 12)) + (tmp * t_frame)) / 12; - screendx = -tmp; + tmp = (shipy-YSCROLLTO)/25 + (shipdy-screendy); + screendy += tmp * t_frame/12; + tmp = (shipx-XSCROLLTO)/25 + (shipdx-screendx); + screendx += tmp * t_frame/12; // taper off if we would hit the barrier in under 2 seconds. if(back_dist + (screendx - SCREENDXMIN)*TO_TICKS(2) < 0) { @@ -753,7 +747,6 @@ main(int argc, char **argv) { return 1; } - reset_rocks(); gameloop(); return 0; diff --git a/rocks.c b/rocks.c index d2fda29..0b54b04 100644 --- a/rocks.c +++ b/rocks.c @@ -50,6 +50,7 @@ init_rocks(void) NULLERROR(surf_rock[i] = SDL_DisplayFormat(temp)); get_shape(surf_rock[i], &rock_shapes[i]); } + reset_rocks(); return 0; }