X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fscreen.c;h=ea9bb943c3f1a1237a0c46884be7b40bbd874178;hp=362a15c8a1fd6a8f55c32860665791d7641cef48;hb=7cffbf057545fb303ad8f53e432ef42f7708e16d;hpb=c912e59b898fe1ac461a1468e4a2e1937de286d7 diff --git a/src/screen.c b/src/screen.c index 362a15c..ea9bb94 100644 --- a/src/screen.c +++ b/src/screen.c @@ -4,6 +4,8 @@ #include #include "screen.h" #include "demo.h" +#include "gfxutil.h" +#include "timer.h" #define DBG_SCRCHG \ do { \ @@ -24,6 +26,10 @@ struct screen *greets_screen(void); struct screen *infcubes_screen(void); struct screen *hairball_screen(void); +void start_loadscr(void); +void end_loadscr(void); +void loadscr(int n, int count); + #define NUM_SCR 32 static struct screen *scr[NUM_SCR]; static int num_screens; @@ -35,6 +41,8 @@ int scr_init(void) { int i, idx = 0; + start_loadscr(); + if(!(scr[idx++] = tunnel_screen())) { return -1; } @@ -73,10 +81,13 @@ int scr_init(void) assert(num_screens <= NUM_SCR); for(i=0; iinit() == -1) { return -1; } } + + end_loadscr(); return 0; } @@ -169,3 +180,49 @@ int scr_change(struct screen *s, long trans_time) } return 0; } + +/* loading screen */ +extern uint16_t loading_pixels[]; + +void start_loadscr(void) +{ + swap_buffers(loading_pixels); +} + +#define SPLAT_X 288 +#define SPLAT_Y 104 + +#define FING_X 217 +#define FING_LAST_X 291 +#define FING_Y 151 +#define FING_W 7 +#define FING_H 8 + +void end_loadscr(void) +{ + blitfb(loading_pixels + SPLAT_Y * 320 + SPLAT_X, loading_pixels + 320 * 240, 32, 72, 32); + blitfb_key(loading_pixels + FING_Y * 320 + FING_LAST_X, loading_pixels + 247 * 320 + 64, + FING_W, FING_H, FING_W, 0); + swap_buffers(loading_pixels); + sleep_msec(300); +} + +void loadscr(int n, int count) +{ + int xoffs = 75 * n / (count - 1); + static int prev_xoffs; + uint16_t *sptr, *dptr; + + sptr = loading_pixels + 247 * 320 + 64; + dptr = loading_pixels + FING_Y * 320 + FING_X + prev_xoffs; + + while(prev_xoffs < xoffs) { + blitfb_key(dptr, sptr, FING_W, FING_H, FING_W, 0); + dptr++; + prev_xoffs++; + } + + swap_buffers(loading_pixels); + + /*sleep_msec(200);*/ +}