X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Fscreen.c;h=2387d52471baa3ede9fbc480d71ca3074779094c;hp=a949fc467a127e14ee51764ca8c0931a72be79ca;hb=6e4f1008ad81b6cc108c11736dbf9366a38092fc;hpb=62b7a04b073e5a605cf2a455908b5f8607b6f2ae diff --git a/src/screen.c b/src/screen.c index a949fc4..2387d52 100644 --- a/src/screen.c +++ b/src/screen.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "screen.h" #include "demo.h" @@ -9,6 +10,7 @@ struct screen *fract_screen(void); #define NUM_SCR 32 static struct screen *scr[NUM_SCR]; +static int num_screens; static struct screen *cur, *prev, *next; static long trans_start, trans_dur; @@ -23,9 +25,12 @@ int scr_init(void) if(!(scr[idx++] = fract_screen())) { return -1; } + num_screens = idx; - for(i=0; iinit() == -1) { + assert(num_screens <= NUM_SCR); + + for(i=0; iinit() == -1) { return -1; } } @@ -35,8 +40,7 @@ int scr_init(void) void scr_shutdown(void) { int i; - for(i=0; ishutdown(); } } @@ -64,8 +68,7 @@ void scr_draw(void) struct screen *scr_lookup(const char *name) { int i; - for(i=0; iname, name) == 0) { return scr[i]; } @@ -73,6 +76,16 @@ struct screen *scr_lookup(const char *name) return 0; } +struct screen *scr_screen(int idx) +{ + return scr[idx]; +} + +int scr_num_screens(void) +{ + return num_screens; +} + int scr_change(struct screen *s, long trans_time) { if(!s) return -1;