X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fgrise.c;h=2aaf9253628bf70a340e517fdeed428e0542483f;hb=5d9ec41cc62ebddf5d406511714e561e88884987;hp=210b0cf939a65456f673d7e29611c9969731f594;hpb=a4f6e872b20660bcc65104e2cb46fedeca83c628;p=dosdemo diff --git a/src/grise.c b/src/grise.c index 210b0cf..2aaf925 100644 --- a/src/grise.c +++ b/src/grise.c @@ -31,7 +31,7 @@ static int init(void); static void destroy(void); static void start(long trans_time); -static void stop(long trans_time); +/*static void stop(long trans_time);*/ static void draw(void); static void convert32To16(unsigned int *src32, unsigned short *dst16, unsigned int pixelCount); @@ -42,8 +42,8 @@ static void updateScrollTables(float dt); static void rleEncode(unsigned char *pixels, unsigned int w, unsigned int h); static unsigned short *background = 0; -static unsigned int backgroundW = 0; -static unsigned int backgroundH = 0; +static int backgroundW = 0; +static int backgroundH = 0; static unsigned int lastFrameTime = 0; static float lastFrameDuration = 0.0f; @@ -59,11 +59,11 @@ static int scrollModTable[REFLECTION_HEIGHT]; static float nearScrollAmount = 0.0f; static struct screen scr = { - "Galaxy rise", + "galaxyrise", init, destroy, start, - stop, + 0, draw }; @@ -124,12 +124,17 @@ static void start(long trans_time) lastFrameTime = time_msec; } +/* XXX add the stop function when you have an out-transition, otherwise + * it just delays the change to the next effect. + */ +/* static void stop(long trans_time) { } +*/ static void draw(void) -{ +{ int scroll = MIN_SCROLL + (MAX_SCROLL - MIN_SCROLL) * mouse_x / fb_width; unsigned short *dst = backBuffer + PIXEL_PADDING; unsigned short *src = background + scroll; @@ -147,7 +152,7 @@ static void draw(void) src += backgroundW; dst += BB_SIZE; } - + /* Create scroll opffsets for all scanlines of the normalmap */ updateScrollTables(lastFrameDuration); @@ -173,6 +178,8 @@ static void draw(void) src += BB_SIZE; dst += fb_width; } + + swap_buffers(fb_pixels); } /* src and dst can be the same */ @@ -254,7 +261,7 @@ static void initScrollTables() { static void updateScrollTables(float dt) { int i = 0; - + nearScrollAmount += dt * NEAR_SCROLL_SPEED; nearScrollAmount = (float) fmod(nearScrollAmount, 512.0f); @@ -272,8 +279,8 @@ static void rleEncode(unsigned char *pixels, unsigned int w, unsigned int h) { for (scanline = 0; scanline < h; scanline++) { for (i = 0; i < w; i++) { if (*pixels++) { - + } } } -} \ No newline at end of file +}