void CHumanInterface::OnAnimate (void) // OnAnimate // // Paint an animation frame { if (m_pCurSession) { bool bCrash = false; try { m_pCurSession->HIAnimate(GetScreen()); } catch (...) { bCrash = true; } // If we crashed, report it if (bCrash) HardCrash(CONSTLIT("animating")); } else { GetScreen().Fill(0, 0, GetScreen().GetWidth(), GetScreen().GetHeight(), CG16bitImage::RGBValue(0, 0, 0)); BltScreen(); FlipScreen(); } }
void VID_Update (vrect_t *rects) { vrect_t rect; if (palette_changed) { palette_changed = false; rect.x = 0; rect.y = 0; rect.width = vid.width; rect.height = vid.height; rect.pnext = NULL; rects = ▭ } // We've drawn the frame; copy it to the screen FlipScreen (rects); // handle the mouse state when windowed if that's changed #if 0 // change to 1 if dont want to disable mouse in fullscreen if (modestate == MS_WINDOWED) #endif if (_enable_mouse.integer != enable_mouse) { if (_enable_mouse.integer) IN_ActivateMouse (); else IN_DeactivateMouse (); enable_mouse = _enable_mouse.integer; } }
// ---------------------------------------------------------------------------- void Main() { FlipScreen(); InitLines(); LoadFile( BOUNCINGFXCODE_BB00Z80BINPCK_TRACKFILEID, CODESEGMENT0000 ); Unpack( 0xBB00, CODESEGMENT0000 ); bank_memcpy( BANKC0, VIDEOSEGMENT0000, VIDEOSEGMENTC000, VIDEOSEGMENTC000_SIZE ); InitBounceTransit(); LoadFile( ANGELTITLE2BIGFILE_TRACKFILEID, ANGELTITLE2H_DATAPTR ); BankUnpack( BANKC4, 0x4080, ANGELASDEMONBMPTOPBINPCK_PTR ); BankUnpack( BANKC1, 0xC000, ANGELASDEMONBMPBOTTOMBINPCK_PTR ); bank_memcpy( BANKC6, 0x4000, VIDEOSEGMENT8000, VIDEOSEGMENT8000_SIZE ); BankUnpack( BANKC4, 0x6800, BOUNCINGDELTAY_1BINPCK_PTR ); BankUnpack( BANKC6, 0x6800, BOUNCINGDELTAY_2BINPCK_PTR ); bank_memcpy( BANKC0, VIDEOSEGMENT0000, VIDEOSEGMENT8000, VIDEOSEGMENT8000_SIZE ); bank_memcpy( BANKC0, VIDEOSEGMENT4000, VIDEOSEGMENTC000, VIDEOSEGMENTC000_SIZE ); DrawBounceTransit(); FlipScreen(); PushBank (BANKC1); LoadFile( ANGELSCROLLOFFSETBINPCK_TRACKFILEID, CODESEGMENT4000 ); LoadFile( ANGELSCROLLIMAGEBINPCK_TRACKFILEID, CODESEGMENT4000 + 0x200 ); PopBank(); bank_memcpy( BANKC4, VIDEOSEGMENT0000, 0x4080, VIDEOSEGMENT0000_SIZE ); bank_memcpy( BANKC6, 0x4080, VIDEOSEGMENT0000, VIDEOSEGMENT0000_SIZE ); LoadFile( ANGELBMPTOPBINPCK_TRACKFILEID, VIDEOSEGMENT0000 ); BankUnpack( BANKC4, 0x4080, VIDEOSEGMENT0000 ); LoadFile( ANGELBMPBOTTOMBINPCK_TRACKFILEID, VIDEOSEGMENT0000 ); PushBank (BANKC1); Unpack( VIDEOSEGMENT4000, VIDEOSEGMENT0000 ); PopBank(); bank_memcpy( BANKC0, VIDEOSEGMENT0000, VIDEOSEGMENT8000, VIDEOSEGMENT8000_SIZE ); }
void CHumanInterface::EndSessionUpdate (void) // EndSessionUpdate // // Called in DefaultOnAnimate { // If necessary, flip FlipScreen(); }
// ---------------------------------------------------------------------------- void DrawFrameFX() { isScreenFlipped = IsScreenFlipped(); __asm ld a, (_isScreenFlipped) call &BB03 __endasm; FlipScreen(); }
void CHumanInterface::OnAnimate (void) // OnAnimate // // Paint an animation frame { int i; // If minimized, bail out if (m_ScreenMgr.IsMinimized()) return; // DirectDraw if (!m_ScreenMgr.CheckIsReady()) return; // Paint the current session if (m_pCurSession) { bool bCrash = false; try { // Paint the background sessions for (i = 0; i < m_BackgroundSessions.GetCount(); i++) m_BackgroundSessions[i]->HIAnimate(GetScreen(), false); // Paint the current session m_pCurSession->HIAnimate(GetScreen(), true); } catch (...) { bCrash = true; } // If we crashed, report it if (bCrash) HardCrash(CONSTLIT("OnAnimate")); } else { GetScreen().Fill(0, 0, GetScreen().GetWidth(), GetScreen().GetHeight(), CG16bitImage::RGBValue(0, 0, 0)); BltScreen(); FlipScreen(); } }
void CHumanInterface::EndSessionUpdate (bool bTopMost) // EndSessionUpdate // // Called in DefaultOnAnimate { // If necessary, flip if (bTopMost) FlipScreen(); }
void FadeToColor(unsigned msecs, RGBA color) { IMAGE image = GrabImage(0, 0, GetScreenWidth(), GetScreenHeight()); dword time = GetTime(); while (GetTime() - time < msecs) { color.alpha = (byte)((GetTime() - time) * 255 / msecs); BlitImage(image, 0, 0, CImage32::BLEND); ApplyColorMask(color); FlipScreen(); } DestroyImage(image); }
// ---------------------------------------------------------------------------- void Main() { PushBank( BANKC1 ); LoadFile( ANGELTITLE1BIGFILE_TRACKFILEID, ANGELTITLE1H_DATAPTR ); // TITLE TOP IN C1-CODESEGMENT4000 memcpy( CODESEGMENT4000, ANGELTITLEBMPTOPBINPCK_PTR, ANGELTITLEBMPTOPBINPCK_SIZE ); PopBank(); // TITLE BOTTOM IN C3-CODESEGMENT4000 bank_memcpy( 0xC0, CODESEGMENTC000, ANGELTITLEBMPBOTTOMBINPCK_PTR, ANGELTITLEBMPBOTTOMBINPCK_SIZE ); Unpack( VIDEOSEGMENTC000, ANGELTILEBMPSPRRAWDATA1PCK_PTR ); ShiftTile( VIDEOSEGMENTC000 ); SetPaletteFrom8( GetPalette() ); // Cloud BankUnpack( 0xC4, CODESEGMENT0000, VIDEOSEGMENT0000 ); // Draw Cloud PushBank( BANKC1 ); DrawTiles(MASKTYPE_NOMASK, VIDEOSEGMENT0000, VIDEOSEGMENT4000, VIDEOSEGMENTC000 ); PopBank(); DrawCloud_VIDEOSEGMENT8000(); // Apply Part palette UnshiftTile( VIDEOSEGMENTC000 ); PushBank( BANKC1 ); DrawTiles(MASKTYPE_NOMASK, VIDEOSEGMENT0000, VIDEOSEGMENT4000, VIDEOSEGMENTC000 ); PopBank(); WaitVBL(); SetPalette( GetPalette() ); FlipScreen(); // Load Cloud LoadFile( ANGELTITLECLOUDBMPBINPCK_TRACKFILEID, VIDEOSEGMENT8000 ); BankUnpack( 0xC4, CODESEGMENT0000, VIDEOSEGMENT8000 ); BankUnpack( 0xC1, VIDEOSEGMENT8000, CODESEGMENT4000 ); BankUnpack( 0xC0, VIDEOSEGMENTC000, CODESEGMENTC000 ); PushBank( BANKC3 ); DrawTiles(MASKTYPE_MASK, VIDEOSEGMENT8000, VIDEOSEGMENT4000, VIDEOSEGMENTC000 ); PopBank(); DrawCloudReverse_VIDEOSEGMENT0000(); }
int yesNoQuestion (data_t * gfx, game_t * game, char *text) { int w = (GRIDWIDTH - 2) * BLOCKSIZE; int h = BLOCKSIZE + SFont_AlignedHeight (gfx->textfont, w - 2 * BLOCKSIZE, 0, text); int x = gfx->gameX + BLOCKSIZE; int y = gfx->gameY + (GRIDHEIGHT * BLOCKSIZE - h) / 2; int ret = FALSE; int done = FALSE; SDL_Event event; drawAnimatedSquare (gfx, gfx->gcolor, gfx->galpha, x, y, w, h, MSGTIME); x += BLOCKSIZE; y += BLOCKSIZE / 2; w -= 2 * BLOCKSIZE; SFont_WriteAligned (gfx->textfont, x, y, w, 0, ACENTER, text); FlipScreen (); while (!done) { while (SDL_PollEvent (&event)) { if (event.type == SDL_KEYDOWN) { if (event.key.keysym.sym == KEY_QUIT || event.key.keysym.sym == SDLK_n) { ret = FALSE; done = TRUE; } else if (event.key.keysym.sym == SDLK_y || event.key.keysym.sym == SDLK_RETURN) { ret = TRUE; done = TRUE; } } } SDL_WaitEvent (NULL); } return ret; }
// unused in hexenworld void D_ShowLoadingSize (void) { vrect_t rect; viddef_t save_vid; // global video state if (!vid_showload.integer) return; if (!vid_initialized) return; save_vid = vid; if (vid.numpages == 1) { VID_LockBuffer (); if (!vid.direct) Sys_Error ("NULL vid.direct pointer"); vid.buffer = vid.direct; SCR_DrawLoading(); VID_UnlockBuffer (); rect.x = 0; rect.y = 0; rect.width = vid.width; rect.height = 112; rect.pnext = NULL; FlipScreen (&rect); } else { vid.buffer = (byte *)screen->pixels; vid.rowbytes = screen->pitch; SCR_DrawLoading(); } vid = save_vid; }
// ---------------------------------------------------------------------------- void Main() { // Load Tile (8-15 pixel index range) LoadFile( PLASMATILE2BMPSPRRAWDATA1PCK_TRACKFILEID, VIDEOSEGMENT0000 ); Unpack( VIDEOSEGMENTC000, VIDEOSEGMENT0000 ); ShiftTile( VIDEOSEGMENTC000 ); SetPaletteFrom8( GetPalette() ); // Load Transit Data LoadFile( TRANSITLINESFX2BINPCK_TRACKFILEID, VIDEOSEGMENT0000 ); BankUnpack( 0xC4, 0x6880, VIDEOSEGMENT0000 ); // Load Transit Code LoadFile( MAINDRAWTRIANGLEONLYZ80BINPCK_TRACKFILEID_2, VIDEOSEGMENT0000 ); Unpack( CODESEGMENT0000, VIDEOSEGMENT0000 ); // Draw Transit Line FX PushBank( BANKC1 ); DrawTiles(MASKTYPE_NOMASK, VIDEOSEGMENT0000, VIDEOSEGMENT4000, VIDEOSEGMENTC000 ); PopBank(); bank_memcpy( 0xC6, 0x4080, VIDEOSEGMENT8000, VIDEOSEGMENT8000_SIZE ); bank_memcpy( 0xC7, VIDEOSEGMENT4000, VIDEOSEGMENTC000, VIDEOSEGMENTC000_SIZE ); bank_memcpy( 0xC4, 0x4080, VIDEOSEGMENT0000, VIDEOSEGMENT0000_SIZE); bank_memcpy( 0xC0, 0x7000, VIDEOSEGMENT4000, 0x1000 ); bank_memcpy( 0xC0, 0xE800, 0x5000, 0x1800 ); __asm call _IsScreenFlipped ld a, l call &2800 __endasm; // PATCH bank_memcpy( 0xC0, VIDEOSEGMENTC000, VIDEOSEGMENT4000, VIDEOSEGMENT4000_SIZE ); // Load title PushBank( BANKC1 ); LoadFile( PLASMATITLEBIGFILE_TRACKFILEID, CODESEGMENT4000 ); PopBank(); // Load Cloud LoadFile( PLASMATITLECLOUDBMPBINPCK_TRACKFILEID, VIDEOSEGMENT0000 ); BankUnpack( 0xC4, CODESEGMENT0000, VIDEOSEGMENT0000 ); // Apply Part palette LoadFile( PLASMATILE2BMPSPRRAWDATA1PCK_TRACKFILEID_2, VIDEOSEGMENT0000 ); Unpack( VIDEOSEGMENTC000, VIDEOSEGMENT0000 ); UnshiftTile( VIDEOSEGMENTC000 ); PushBank( BANKC1 ); DrawTiles(MASKTYPE_NOMASK, VIDEOSEGMENT0000, VIDEOSEGMENT4000, VIDEOSEGMENTC000 ); PopBank(); WaitVBL(); SetPalette( GetPalette() ); FlipScreen(); // Load title BankUnpack( 0xC0, VIDEOSEGMENT8000, PLASMATITLEBMPTOPBINPCK_PTR ); BankUnpack( 0xC0, VIDEOSEGMENTC000, PLASMATITLEBMPBOTTOMBINPCK_PTR ); PushBank( BANKC3 ); DrawTiles(MASKTYPE_MASK, VIDEOSEGMENT8000, VIDEOSEGMENT4000, VIDEOSEGMENTC000 ); PopBank(); // Prepare for part bank_memcpy( 0xC6, CODESEGMENT4000, CODESEGMENT0000, CODESEGMENT0000_SIZE ); DrawCloudReverse_VIDEOSEGMENT0000(); FlipScreen(); // Load Cloud LoadFile( PLASMATITLECLOUD3BMPBINPCK_TRACKFILEID, VIDEOSEGMENT0000 ); BankUnpack( 0xC4, CODESEGMENT0000, VIDEOSEGMENT0000 ); bank_memcpy( 0xC6, CODESEGMENT4000, CODESEGMENT0000, CODESEGMENT0000_SIZE ); LoadFile( PLASMABACKGROUNDBMPTOPBINPCK_TRACKFILEID, VIDEOSEGMENT0000 ); BankUnpack( 0xC6, VIDEOSEGMENT4000, VIDEOSEGMENT0000 ); LoadFile( PLASMADATA1BIGFILEPCK_TRACKFILEID, CODESEGMENT0000 ); PushBank( BANKC1 ); Unpack( CODESEGMENT4000, CODESEGMENT0000 ); PopBank(); bank_memcpy( 0xC0, CODESEGMENTC000, CODESEGMENT4000, CODESEGMENT4000_SIZE ); bank_memcpy( 0xC6, VIDEOSEGMENT0000, VIDEOSEGMENT4000, VIDEOSEGMENT0000_SIZE ); LoadFile( PLASMABACKGROUNDBMPBOTTOMBINPCK_TRACKFILEID, CODESEGMENT0000 ); PushBank( BANKC1 ); Unpack( VIDEOSEGMENT4000, CODESEGMENT0000 ); PopBank(); LoadFile( PLASMATITLECLOUD2BMPBINPCK_TRACKFILEID, VIDEOSEGMENTC000 ); }
void drawRecords (data_t * gfx, records_t * rtab, int hl) { int x, x1, x2, x3, x4, x5, x6, y, w, h, i; char buf[128]; x = gfx->gameX + 2 * BLOCKSIZE; w = GRIDWIDTH * BLOCKSIZE - 4 * BLOCKSIZE; h = BLOCKSIZE + 12 * gfx->textfont->Surface->h + SFont_AlignedHeight (gfx->textfont, w - 2 * BLOCKSIZE, 0, _ ("Press any key to continue. Read the README or the 'man' page to learn the meaning of the 'mode' column.")); y = gfx->gameY + (GRIDHEIGHT * BLOCKSIZE - h) / 2; drawAnimatedSquare (gfx, gfx->gcolor, gfx->galpha, x, y, w, h, MSGTIME); /* x1:# x2:Name x3:Floor x4:Mode x5:Time x6: Date --------------------------------------------------------------------- */ y += BLOCKSIZE; x1 = x + BLOCKSIZE; x2 = x1 + SFont_TextWidth (gfx->textfont, "# "); sprintf (buf, "%s %s %s %s", _("Floor"), _("Mode"), _("Time"), rtab[0].date); x3 = x1 + w - 2 * BLOCKSIZE - SFont_TextWidth (gfx->textfont, buf); sprintf (buf, "%s %s %s %s", _("Floor"), _("Mode"), _("Time"), _("Date")); SFont_Write (gfx->textfont, x3, y, buf); sprintf (buf, "%s ", _("Floor")); x4 = x3 + SFont_TextWidth (gfx->textfont, buf); sprintf (buf, "%s ", _("Mode")); x5 = x4 + SFont_TextWidth (gfx->textfont, buf); sprintf (buf, "%s ", _("Time")); x6 = x5 + SFont_TextWidth (gfx->textfont, buf); sprintf (buf, "# %s ", _("Date")); SFont_Write (gfx->textfont, x1, y, buf); for (i = 0; i < MAX_RECORDS; i++) { y += gfx->textfont->Surface->h - 1; if (hl == i) { sprintf (buf, ">"); SFont_Write (gfx->textfont, x1 - SFont_TextWidth (gfx->textfont, buf), y, buf); } sprintf (buf, "%d", i + 1); SFont_Write (gfx->textfont, x1, y, buf); SFont_Write (gfx->textfont, x2, y, rtab[i].pname); SFont_FillWith (gfx->textfont, x2 + SFont_TextWidth (gfx->textfont, rtab[i].pname) + 3, y, x3 - 6 - (x2 + SFont_TextWidth (gfx->textfont, rtab[i].pname)), '.'); sprintf (buf, "%d", rtab[i].floor); SFont_Write (gfx->textfont, x3, y, buf); SFont_Write (gfx->textfont, x4, y, rtab[i].mode); sprintf (buf, "%d", rtab[i].time); SFont_Write (gfx->textfont, x5, y, buf); sprintf (buf, "%s", rtab[i].date); SFont_Write (gfx->textfont, x6, y, buf); } y += gfx->textfont->Surface->h * 2; SFont_WriteAligned (gfx->textfont, x1, y, w - 2 * BLOCKSIZE, 0, ALEFT, _ ("Press any key to continue. Read the README or the 'man' page to learn the meaning of the 'mode' column.")); FlipScreen (); }
void drawCredits (data_t * gfx) { int x, y, w, h; x = gfx->gameX + 2 * BLOCKSIZE; w = GRIDWIDTH * BLOCKSIZE - 4 * BLOCKSIZE; h = BLOCKSIZE + 10 * SFont_TextHeight (gfx->textfont); y = gfx->gameY + (GRIDHEIGHT * BLOCKSIZE - h) / 2; drawAnimatedSquare (gfx, gfx->gcolor, gfx->galpha, x, y, w, h, MSGTIME); y += SFont_TextHeight (gfx->textfont); x += BLOCKSIZE; SFont_WriteAligned (gfx->textfont, x, y, w - 2 * BLOCKSIZE, 0, ACENTER, _("SOURCE CODE AUTHOR")); y += SFont_AlignedHeight (gfx->textfont, w - 2 * BLOCKSIZE, 0, _("SOURCE CODE AUTHOR")); SFont_WriteAligned (gfx->textfont, x, y, w - 2 * BLOCKSIZE, 0, ACENTER, AUTHOR); y += SFont_AlignedHeight (gfx->textfont, w - 2 * BLOCKSIZE, 0, AUTHOR) + SFont_TextHeight (gfx->textfont); SFont_WriteAligned (gfx->textfont, x, y, w - 2 * BLOCKSIZE, 0, ACENTER, _("THIS GRAPHICS THEME AUTHOR")); y += SFont_AlignedHeight (gfx->textfont, w - 2 * BLOCKSIZE, 0, _("THIS GRAPHICS THEME AUTHOR")); SFont_WriteAligned (gfx->textfont, x, y, w - 2 * BLOCKSIZE, 0, ACENTER, gfx->gfxauth); y += SFont_AlignedHeight (gfx->textfont, w - 2 * BLOCKSIZE, 0, gfx->gfxauth) + SFont_TextHeight (gfx->textfont); SFont_WriteAligned (gfx->textfont, x, y, w - 2 * BLOCKSIZE, 0, ACENTER, _("THIS SOUND THEME AUTHOR")); y += SFont_AlignedHeight (gfx->textfont, w - 2 * BLOCKSIZE, 0, _("THIS SOUND THEME AUTHOR")); SFont_WriteAligned (gfx->textfont, x, y, w - 2 * BLOCKSIZE, 0, ACENTER, gfx->sndauth); y += SFont_AlignedHeight (gfx->textfont, w - 2 * BLOCKSIZE, 0, gfx->sndauth) + SFont_TextHeight (gfx->textfont); /* No idea how to get the translation author with gettext */ /* SFont_WriteAligned(gfx->textfont, x, y, w-2*BLOCKSIZE, 0, ACENTER, _("THIS TRANSLATION AUTHOR")); y += SFont_AlignedHeight(gfx->textfont, w-2*BLOCKSIZE, 0, _("THIS TRANSLATION AUTHOR")); SFont_WriteAligned(gfx->textfont, x, y, w-2*BLOCKSIZE, 0, ACENTER, gfx->langauth); y += SFont_AlignedHeight(gfx->textfont, w-2*BLOCKSIZE, 0, gfx->langauth) + SFont_TextHeight(gfx->textfont); */ FlipScreen (); }