void VL_WaitVBL(int vbls) { unsigned long last = get_TimeCount() + vbls; while (last > get_TimeCount()) { INL_Update(); } }
/////////////////////////////////////////////////////////////////////////// // // IN_UserInput() - Waits for the specified delay time (in ticks) or the // user pressing a key or a mouse button. If the clear flag is set, it // then either clears the key or waits for the user to let the mouse // button up. // /////////////////////////////////////////////////////////////////////////// boolean IN_UserInput(longword delay) { longword lasttime; lasttime = get_TimeCount(); IN_StartAck(); do { if (IN_CheckAck()) return true; } while ( (get_TimeCount() - lasttime) < delay ); return false; }
void EndSpear() { EndScreen(END1PALETTE, ENDSCREEN11PIC); VL_CacheScreen(ENDSCREEN3PIC); VW_UpdateScreen(); CA_CacheGrChunk(END3PALETTE); VL_FadeIn(0, 255, grsegs[END3PALETTE], 30); CA_UnCacheGrChunk(END3PALETTE); fontnumber = 0; fontcolor = 0xd0; WindowX = 0; WindowW = 320; PrintX = 0; PrintY = 180; US_CPrint(STR_ENDGAME1"\n"); US_CPrint(STR_ENDGAME2); VW_UpdateScreen(); IN_StartAck (); set_TimeCount(0); while ( !IN_CheckAck () && (get_TimeCount() < 700) ); PrintX = 0; PrintY = 180; VW_Bar(0,180,320,20,0); US_CPrint(STR_ENDGAME3"\n"); US_CPrint(STR_ENDGAME4); VW_UpdateScreen(); IN_StartAck (); set_TimeCount(0); while ( !IN_CheckAck () && (get_TimeCount() < 700) ); VW_FadeOut (); EndScreen (END4PALETTE, ENDSCREEN4PIC); EndScreen (END5PALETTE, ENDSCREEN5PIC); EndScreen (END6PALETTE, ENDSCREEN6PIC); EndScreen (END7PALETTE, ENDSCREEN7PIC); EndScreen (END8PALETTE, ENDSCREEN8PIC); EndScreen (END9PALETTE, ENDSCREEN9PIC); EndScreen (END2PALETTE, ENDSCREEN12PIC); MainMenu[savegame].active = 0; }
// // Breathe Mr. BJ!!! // void BJ_Breathe() { static int which=0,max=10; int pics[2]={L_GUYPIC,L_GUY2PIC}; if (get_TimeCount() > max) { which^=1; VWB_DrawPic(0,16,pics[which]); VW_UpdateScreen(); set_TimeCount(0); max=35; } }
void TimedPicCommand() { ParseTimedCommand(); // // update the screen, and wait for time delay // VW_UpdateScreen(); // // wait for time // set_TimeCount(0); while (get_TimeCount() < picdelay) ; // // draw pic // VWB_DrawPic(picx&~7, picy, picnum); }
/////////////////////////////////////////////////////////////////////////// // // US_LineInput() - Gets a line of user input at (x,y), the string defaults // to whatever is pointed at by def. Input is restricted to maxchars // chars or maxwidth pixels wide. If the user hits escape (and escok is // true), nothing is copied into buf, and false is returned. If the // user hits return, the current string is copied into buf, and true is // returned // /////////////////////////////////////////////////////////////////////////// boolean US_LineInput(int x,int y,char *buf,char *def,boolean escok, int maxchars,int maxwidth) { boolean redraw, cursorvis, cursormoved, done, result = true; ScanCode sc; char c, s[MaxString], olds[MaxString]; word i, cursor, w, h, len, temp; longword lasttime; if (def) strcpy(s,def); else *s = '\0'; *olds = '\0'; cursor = strlen(s); cursormoved = redraw = true; cursorvis = done = false; lasttime = get_TimeCount(); LastASCII = key_None; LastScan = sc_None; while (!done) { if (cursorvis) USL_XORICursor(x,y,s,cursor); IN_CheckAck(); sc = LastScan; LastScan = sc_None; c = LastASCII; LastASCII = key_None; switch (sc) { case sc_LeftArrow: if (cursor) cursor--; c = key_None; cursormoved = true; break; case sc_RightArrow: if (s[cursor]) cursor++; c = key_None; cursormoved = true; break; case sc_Home: cursor = 0; c = key_None; cursormoved = true; break; case sc_End: cursor = strlen(s); c = key_None; cursormoved = true; break; case sc_Return: strcpy(buf,s); done = true; result = true; c = key_None; break; case sc_Escape: if (escok) { done = true; result = false; } c = key_None; break; case sc_BackSpace: if (cursor) { strcpy(s + cursor - 1,s + cursor); cursor--; redraw = true; } c = key_None; cursormoved = true; break; case sc_Delete: if (s[cursor]) { strcpy(s + cursor,s + cursor + 1); redraw = true; } c = key_None; cursormoved = true; break; case 0x4c: // Keypad 5 case sc_UpArrow: case sc_DownArrow: case sc_PgUp: case sc_PgDn: case sc_Insert: c = key_None; break; } if (c) { len = strlen(s); USL_MeasureString(s,&w,&h); if ( isprint(c) && (len < MaxString - 1) && ((!maxchars) || (len < maxchars)) && ((!maxwidth) || (w < maxwidth)) ) { for (i = len + 1;i > cursor;i--) s[i] = s[i - 1]; s[cursor++] = c; redraw = true; } } if (redraw) { px = x; py = y; temp = fontcolor; fontcolor = backcolor; USL_DrawString(olds); fontcolor = temp; strcpy(olds,s); px = x; py = y; USL_DrawString(s); redraw = false; } if (cursormoved) { cursorvis = false; lasttime = get_TimeCount() - TickBase; cursormoved = false; } if ( (get_TimeCount() - lasttime) > (TickBase / 2) ) { lasttime = get_TimeCount(); cursorvis ^= true; } if (cursorvis) USL_XORICursor(x,y,s,cursor); VW_UpdateScreen(); } if (cursorvis) USL_XORICursor(x,y,s,cursor); if (!result) { px = x; py = y; USL_DrawString(olds); } VW_UpdateScreen(); IN_ClearKeysDown(); return(result); }