diff -u -b -B sdlscav-137/Makefile sdlscav/Makefile --- sdlscav-137/Makefile Sun Aug 22 11:44:44 1999 +++ sdlscav/Makefile Mon Aug 21 17:57:27 2000 @@ -15,4 +15,4 @@ anim.o: anim.c scav.h anim.h clean: - rm *.o sdlscav + rm -f *.o sdlscav *~ Common subdirectories: sdlscav-137/data and sdlscav/data diff -u -b -B sdlscav-137/gfx.c sdlscav/gfx.c --- sdlscav-137/gfx.c Sun Aug 22 12:25:43 1999 +++ sdlscav/gfx.c Mon Aug 21 17:58:00 2000 @@ -19,6 +19,8 @@ unsigned char mymap[768],currentmap[768]; +int gottimer; /* every timer event will set this */ + drawstring(){} colormapon(){} colormapoff(){} @@ -308,6 +310,12 @@ SDL_PollEvent(0); } +/* Reset the number of input events */ +void resetinput() +{ + numdown=0; + mousebd=0; +} void scaninput(void) { @@ -315,8 +323,6 @@ int key,mod; int bs=0; - numdown=0; - mousebd=0; while(SDL_PollEvent(&event)) { switch(event.type) @@ -348,6 +354,9 @@ mousex=event.motion.x; mousey=event.motion.y; break; + case SDL_USEREVENT: + gottimer = 1; + break; } } } diff -u -b -B sdlscav-137/scav.c sdlscav/scav.c --- sdlscav-137/scav.c Sun Aug 22 12:24:57 1999 +++ sdlscav/scav.c Tue Aug 15 17:57:38 2000 @@ -1021,7 +1021,8 @@ copyup(); for(;;) { - pause(); + SDL_WaitEvent(NULL); + resetinput(); scaninput(); if(checkdown(' ') || checkdown(0x1b)) /* space or ESC */ break; @@ -1188,16 +1189,16 @@ int iterate() { uchar pausing; - pause(); randcount2++; pausing=0; + gottimer = 0; + resetinput(); do { - if(pausing) pause(); scaninput(); if(checkdown('x' | MYALTED) || checkdown('q' | MYALTED)) return 1; /* alt-x */ if(checkdown(MYPAUSE) && playing) pausing^=1; - } while(pausing); + } while(pausing || !gottimer); mbuttons=(checkbutton(1) ? 1 : 0) | (checkbutton(3) ? 2 : 0); mbuttons2=(checkbuttondown(1) ? 1 : 0) | (checkbuttondown(3) ? 2 : 0); @@ -1537,12 +1538,20 @@ return 1; } unsigned char havepulse,interrupted; -Uint32 sdlhandler(Uint32 time) +static Uint32 sdlhandler(Uint32 time) { + SDL_Event timeevent; + + timeevent.type = SDL_USEREVENT; + hc++; interrupted=1; + + SDL_PeepEvents(&timeevent, 1, SDL_ADDEVENT, 0); + return time; } + pulseon() { if(havepulse) return; @@ -1656,6 +1665,7 @@ while(!iterate()); + pulseoff(); soundclose(); closegfx(); @@ -2579,8 +2589,9 @@ copyup(); changed=0; } + SDL_WaitEvent(NULL); + resetinput(); scaninput(); - pause(); /* p=keylist; for(;;) @@ -2626,7 +2637,8 @@ copyup(); for(;;) { - pause(); + resetinput(); + SDL_WaitEvent(NULL); scaninput(); if(!anydown()) continue; code=firstdown(); @@ -2858,5 +2870,5 @@ void waitsound() { - while(soundactive) pause(); + while(soundactive) SDL_Delay(100); } diff -u -b -B sdlscav-137/scav.h sdlscav/scav.h --- sdlscav-137/scav.h Sun Aug 22 12:06:45 1999 +++ sdlscav/scav.h Tue Aug 15 17:47:06 2000 @@ -524,5 +524,6 @@ #define MYSHIFTED 0x40 #define MYALTED 0x200 +extern int gottimer; #endif