// Update the value of window_focused when we get a focus event // // We try to make ourselves be well-behaved: the grab on the mouse // is removed if we lose focus (such as a popup window appearing), // and we dont move the mouse around if we aren't focused either. static void UpdateFocus(void) { Uint8 state; state = SDL_GetAppState(); // We should have input (keyboard) focus and be visible // (not minimised) window_focused = (state & SDL_APPINPUTFOCUS) && (state & SDL_APPACTIVE); // e6y // Reuse of a current palette to avoid black screen at software fullscreen modes // after switching to OS and back if (desired_fullscreen && window_focused) { // currentPaletteIndex? if (st_palette < 0) st_palette = 0; V_SetPalette(st_palette); } #ifdef GL_DOOM if (V_GetMode() == VID_MODEGL) { if (gl_hardware_gamma) { if (!window_focused) { // e6y: Restore of startup gamma if window loses focus gld_SetGammaRamp(-1); } else { gld_SetGammaRamp(useglgamma); } } } #endif // Should the screen be grabbed? // screenvisible = (state & SDL_APPACTIVE) != 0; }
static void D_Display(void) { static boolean menuactivestate = false; static gamestate_t oldgamestate = -1; boolean redrawsbar = false; static boolean wipe = false; INT32 wipedefindex = 0; if (dedicated) return; if (nodrawers) return; // for comparative timing/profiling // check for change of screen size (video mode) if (setmodeneeded && !wipe) SCR_SetMode(); // change video mode if (vid.recalc) SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc() // change the view size if needed if (setsizeneeded) { R_ExecuteSetViewSize(); oldgamestate = -1; // force background redraw redrawsbar = true; } // save the current screen if about to wipe if (gamestate != wipegamestate) { wipe = true; F_WipeStartScreen(); } else wipe = false; // draw buffered stuff to screen // Used only by linux GGI version I_UpdateNoBlit(); if (wipe) { // set for all later wipedefindex = gamestate; // wipe_xxx_toblack if (gamestate == GS_INTERMISSION) { if (intertype == int_spec) // Special Stage wipedefindex = wipe_specinter_toblack; else if (intertype != int_coop) // Multiplayer wipedefindex = wipe_multinter_toblack; } if (rendermode != render_none) { // Fade to black first if (gamestate != GS_LEVEL // fades to black on its own timing, always && wipedefs[wipedefindex] != UINT8_MAX) { V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); #ifdef HWRENDER if(rendermode != render_soft) HWR_PrepFadeToBlack(); #endif F_WipeEndScreen(); F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK); } F_WipeStartScreen(); } } // do buffered drawing switch (gamestate) { case GS_LEVEL: if (!gametic) break; HU_Erase(); if (automapactive) AM_Drawer(); if (wipe || menuactivestate || (rendermode != render_soft && rendermode != render_none) || vid.recalc) redrawsbar = true; break; case GS_INTERMISSION: Y_IntermissionDrawer(); HU_Erase(); HU_Drawer(); break; case GS_TIMEATTACK: break; case GS_INTRO: F_IntroDrawer(); if (wipegamestate == (gamestate_t)-1) wipe = true; break; case GS_CUTSCENE: F_CutsceneDrawer(); HU_Erase(); HU_Drawer(); break; case GS_GAMEEND: F_GameEndDrawer(); break; case GS_EVALUATION: F_GameEvaluationDrawer(); HU_Drawer(); break; case GS_CONTINUING: F_ContinueDrawer(); break; case GS_CREDITS: F_CreditDrawer(); HU_Erase(); HU_Drawer(); break; case GS_TITLESCREEN: F_TitleScreenDrawer(); break; case GS_WAITINGPLAYERS: // The clientconnect drawer is independent... case GS_DEDICATEDSERVER: case GS_NULL: break; } // clean up border stuff // see if the border needs to be initially drawn if (gamestate == GS_LEVEL) { #if 0 if (oldgamestate != GS_LEVEL) R_FillBackScreen(); // draw the pattern into the back screen #endif // draw the view directly if (!automapactive && !dedicated && cv_renderview.value) { if (players[displayplayer].mo || players[displayplayer].playerstate == PST_DEAD) { topleft = screens[0] + viewwindowy*vid.width + viewwindowx; objectsdrawn = 0; #ifdef HWRENDER if (rendermode != render_soft) HWR_RenderPlayerView(0, &players[displayplayer]); else #endif if (rendermode != render_none) R_RenderPlayerView(&players[displayplayer]); } // render the second screen if (splitscreen && players[secondarydisplayplayer].mo) { #ifdef HWRENDER if (rendermode != render_soft) HWR_RenderPlayerView(1, &players[secondarydisplayplayer]); else #endif if (rendermode != render_none) { viewwindowy = vid.height / 2; M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0])); topleft = screens[0] + viewwindowy*vid.width + viewwindowx; R_RenderPlayerView(&players[secondarydisplayplayer]); viewwindowy = 0; M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0])); } } // Image postprocessing effect if (postimgtype) V_DoPostProcessor(0, postimgtype, postimgparam); if (postimgtype2) V_DoPostProcessor(1, postimgtype2, postimgparam2); } if (lastdraw) { if (rendermode == render_soft) VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes); lastdraw = false; } ST_Drawer(redrawsbar); HU_Drawer(); } // change gamma if needed if (gamestate != oldgamestate && gamestate != GS_LEVEL) V_SetPalette(0); menuactivestate = menuactive; oldgamestate = wipegamestate = gamestate; // draw pause pic if (paused && cv_showhud.value && (!menuactive || netgame)) { INT32 py; patch_t *patch; if (automapactive) py = 4; else py = viewwindowy + 4; patch = W_CachePatchName("M_PAUSE", PU_CACHE); V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, 0, patch); } // vid size change is now finished if it was on... vid.recalc = 0; // FIXME: draw either console or menu, not the two if (gamestate != GS_TIMEATTACK) CON_Drawer(); M_Drawer(); // menu is drawn even on top of everything NetUpdate(); // send out any new accumulation // It's safe to end the game now. if (G_GetExitGameFlag()) { Command_ExitGame_f(); G_ClearExitGameFlag(); } // // normal update // if (!wipe) { if (cv_netstat.value) { char s[50]; Net_GetNetStat(); s[sizeof s - 1] = '\0'; snprintf(s, sizeof s - 1, "get %d b/s", getbps); V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-40, V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "send %d b/s", sendbps); V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-30, V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "GameMiss %.2f%%", gamelostpercent); V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-20, V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "SysMiss %.2f%%", lostpercent); V_DrawRightAlignedString(BASEVIDWIDTH, BASEVIDHEIGHT-ST_HEIGHT-10, V_YELLOWMAP, s); } I_FinishUpdate(); // page flip or blit buffer return; } // // wipe update // wipedefindex += WIPEFINALSHIFT; if (rendermode != render_none) { F_WipeEndScreen(); F_RunWipe(wipedefs[wipedefindex], gamestate != GS_TIMEATTACK); } }
void D_Display (void) { static boolean isborderstate IDATA_ATTR= false; static boolean borderwillneedredraw IDATA_ATTR= false; static gamestate_t oldgamestate IDATA_ATTR= -1; boolean wipe; boolean viewactive = false, isborder = false; if (nodrawers) // for comparative timing / profiling return; // save the current screen if about to wipe if ((wipe = gamestate != wipegamestate)) wipe_StartScreen(0, 0, SCREENWIDTH, SCREENHEIGHT); if (gamestate != GS_LEVEL) { // Not a level switch (oldgamestate) { case (gamestate_t)-1: case GS_LEVEL: V_SetPalette(0); // cph - use default (basic) palette default: break; } switch (gamestate) { case GS_INTERMISSION: WI_Drawer(); break; case GS_FINALE: F_Drawer(); break; case GS_DEMOSCREEN: D_PageDrawer(); break; default: break; } } else if (gametic != basetic) { // In a level boolean redrawborderstuff; HU_Erase(); if (setsizeneeded) { // change the view size if needed R_ExecuteSetViewSize(); oldgamestate = -1; // force background redraw } // Work out if the player view is visible, and if there is a border viewactive = (!(automapmode & am_active) || (automapmode & am_overlay)) && !inhelpscreens; isborder = viewactive ? (viewheight != SCREENHEIGHT) : (!inhelpscreens && (automapmode & am_active)); if (oldgamestate != GS_LEVEL) { R_FillBackScreen (); // draw the pattern into the back screen redrawborderstuff = isborder; } else { // CPhipps - // If there is a border, and either there was no border last time, // or the border might need refreshing, then redraw it. redrawborderstuff = isborder && (!isborderstate || borderwillneedredraw); // The border may need redrawing next time if the border surrounds the screen, // and there is a menu being displayed borderwillneedredraw = menuactive && isborder && viewactive && (viewwidth != SCREENWIDTH); } if (redrawborderstuff) R_DrawViewBorder(); // Now do the drawing if (viewactive) R_RenderPlayerView (&players[displayplayer]); if (automapmode & am_active) AM_Drawer(); ST_Drawer((viewheight != SCREENHEIGHT) || ((automapmode & am_active) && !(automapmode & am_overlay)), redrawborderstuff); R_DrawViewBorder(); HU_Drawer(); } isborderstate = isborder; oldgamestate = wipegamestate = gamestate; // draw pause pic if (paused) { static int x; if (!x) { // Cache results of x pos calc int lump = W_GetNumForName("M_PAUSE"); const patch_t* p = W_CacheLumpNum(lump); x = (320 - SHORT(p->width))/2; W_UnlockLumpNum(lump); } // CPhipps - updated for new patch drawing V_DrawNamePatch(x, (!(automapmode & am_active) || (automapmode & am_overlay)) ? 4+(viewwindowy*200/SCREENHEIGHT) : 4, // cph - Must un-stretch viewwindowy 0, "M_PAUSE", CR_DEFAULT, VPT_STRETCH); } // menus go directly to the screen M_Drawer(); // menu is drawn even on top of everything D_BuildNewTiccmds(); // normal update if (!wipe) I_FinishUpdate (); // page flip or blit buffer else { // wipe update wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT); D_Wipe(); } }
void D_Display (void) { static boolean inhelpscreensstate = false; static boolean isborderstate = false; static boolean borderwillneedredraw = false; static gamestate_t oldgamestate = -1; boolean wipe; boolean viewactive = false, isborder = false; if (nodrawers) // for comparative timing / profiling return; if (!I_StartDisplay()) return; // save the current screen if about to wipe if ((wipe = gamestate != wipegamestate) && (V_GetMode() != VID_MODEGL)) wipe_StartScreen(); if (gamestate != GS_LEVEL) { // Not a level switch (oldgamestate) { case -1: case GS_LEVEL: V_SetPalette(0); // cph - use default (basic) palette default: break; } switch (gamestate) { case GS_INTERMISSION: WI_Drawer(); break; case GS_FINALE: F_Drawer(); break; case GS_DEMOSCREEN: D_PageDrawer(); break; default: break; } } else if (gametic != basetic) { // In a level boolean redrawborderstuff; HU_Erase(); if (setsizeneeded) { // change the view size if needed R_ExecuteSetViewSize(); oldgamestate = -1; // force background redraw } // Work out if the player view is visible, and if there is a border viewactive = (!(automapmode & am_active) || (automapmode & am_overlay)) && !inhelpscreens; isborder = viewactive ? (viewheight != SCREENHEIGHT) : (!inhelpscreens && (automapmode & am_active)); if (oldgamestate != GS_LEVEL) { R_FillBackScreen (); // draw the pattern into the back screen redrawborderstuff = isborder; } else { // CPhipps - // If there is a border, and either there was no border last time, // or the border might need refreshing, then redraw it. redrawborderstuff = isborder && (!isborderstate || borderwillneedredraw); // The border may need redrawing next time if the border surrounds the screen, // and there is a menu being displayed borderwillneedredraw = menuactive && isborder && viewactive && (viewwidth != SCREENWIDTH); } if (redrawborderstuff || (V_GetMode() == VID_MODEGL)) R_DrawViewBorder(); // Now do the drawing if (viewactive) R_RenderPlayerView (&players[displayplayer]); if (automapmode & am_active) AM_Drawer(); ST_Drawer((viewheight != SCREENHEIGHT) || ((automapmode & am_active) && !(automapmode & am_overlay)), redrawborderstuff); if (V_GetMode() != VID_MODEGL) R_DrawViewBorder(); HU_Drawer(); } inhelpscreensstate = inhelpscreens; isborderstate = isborder; oldgamestate = wipegamestate = gamestate; // draw pause pic if (paused) { // Simplified the "logic" here and no need for x-coord caching - POPE V_DrawNamePatch((320 - V_NamePatchWidth("M_PAUSE"))/2, 4, 0, "M_PAUSE", CR_DEFAULT, VPT_STRETCH); } // menus go directly to the screen M_Drawer(); // menu is drawn even on top of everything #ifdef HAVE_NET NetUpdate(); // send out any new accumulation #else D_BuildNewTiccmds(); #endif // normal update if (!wipe || (V_GetMode() == VID_MODEGL)) I_FinishUpdate (); // page flip or blit buffer else { // wipe update wipe_EndScreen(); D_Wipe(); } I_EndDisplay(); //e6y: don't thrash cpu during pausing if (paused) { I_uSleep(1000); } }
static void D_Display(void) { static boolean menuactivestate = false; static gamestate_t oldgamestate = -1; boolean redrawsbar = false; static boolean wipe = false; if (dedicated) return; if (nodrawers) return; // for comparative timing/profiling // check for change of screen size (video mode) if (setmodeneeded && !wipe) SCR_SetMode(); // change video mode if (vid.recalc) SCR_Recalc(); // NOTE! setsizeneeded is set by SCR_Recalc() // change the view size if needed if (setsizeneeded) { R_ExecuteSetViewSize(); oldgamestate = -1; // force background redraw redrawsbar = true; } // save the current screen if about to wipe if (gamestate != wipegamestate) { wipe = true; #ifndef SHUFFLE if (rendermode == render_soft) #endif F_WipeStartScreen(); } else wipe = false; // Hardware mode does not fade wipe. // Thus, don't delay it unless needed for synchronisity. #ifndef SHUFFLE if (rendermode != render_soft /*&& !netgame*/) { if (gamestate != GS_INTRO && gamestate != GS_INTRO2 && gamestate != GS_CUTSCENE) wipe = false; } #endif // draw buffered stuff to screen // Used only by linux GGI version I_UpdateNoBlit(); // Fade to black first if (rendermode != render_none) { if (wipe) { if (!(mapheaderinfo[gamemap-1]->interscreen[0] == '#' && gamestate == GS_INTERMISSION)) { V_DrawFill(0, 0, BASEVIDWIDTH, BASEVIDHEIGHT, 31); #if defined (SHUFFLE) && defined (HWRENDER) if(rendermode != render_soft) { HWR_PrepFadeToBlack(); } #endif } F_WipeEndScreen(0, 0, vid.width, vid.height); F_RunWipe(2*TICRATE, gamestate != GS_TIMEATTACK); WipeInAction = false; } F_WipeStartScreen(); } // do buffered drawing switch (gamestate) { case GS_LEVEL: if (!gametic) break; HU_Erase(); if (automapactive) AM_Drawer(); if (wipe || menuactivestate || (rendermode != render_soft && rendermode != render_none) || vid.recalc) redrawsbar = true; break; case GS_INTERMISSION: Y_IntermissionDrawer(); HU_Erase(); HU_Drawer(); break; case GS_TIMEATTACK: break; case GS_INTRO: case GS_INTRO2: F_IntroDrawer(); break; case GS_CUTSCENE: F_CutsceneDrawer(); HU_Erase(); HU_Drawer(); break; case GS_GAMEEND: F_GameEndDrawer(); break; case GS_EVALUATION: F_GameEvaluationDrawer(); break; case GS_CREDITS: F_CreditDrawer(); HU_Erase(); HU_Drawer(); break; case GS_TITLESCREEN: F_TitleScreenDrawer(); break; case GS_DEMOSCREEN: D_PageDrawer(pagename); case GS_DEDICATEDSERVER: case GS_WAITINGPLAYERS: case GS_NULL: break; } // Transitions for Introduction if (gamestate == GS_INTRO && oldgamestate == GS_INTRO2) wipe = true; else if (gamestate == GS_INTRO2 && oldgamestate == GS_INTRO) wipe = true; // clean up border stuff // see if the border needs to be initially drawn if (gamestate == GS_LEVEL) { if (oldgamestate != GS_LEVEL) { #if 0 R_FillBackScreen(); // draw the pattern into the back screen #endif } // draw the view directly if (!automapactive && !dedicated && cv_renderview.value) { if (players[displayplayer].mo) { topleft = screens[0] + viewwindowy*vid.width + viewwindowx; #ifdef HWRENDER if (rendermode != render_soft) HWR_RenderPlayerView(0, &players[displayplayer]); else #endif if (rendermode != render_none) R_RenderPlayerView(&players[displayplayer]); } // render the second screen if (secondarydisplayplayer != consoleplayer && players[secondarydisplayplayer].mo) { #ifdef HWRENDER if (rendermode != render_soft) HWR_RenderPlayerView(1, &players[secondarydisplayplayer]); else #endif if (rendermode != render_none) { viewwindowy = vid.height / 2; M_Memcpy(ylookup, ylookup2, viewheight*sizeof (ylookup[0])); topleft = screens[0] + viewwindowy*vid.width + viewwindowx; R_RenderPlayerView(&players[secondarydisplayplayer]); viewwindowy = 0; M_Memcpy(ylookup, ylookup1, viewheight*sizeof (ylookup[0])); } } // Image postprocessing effect if (postimgtype) V_DoPostProcessor(0, postimgtype, postimgparam); if (postimgtype2) V_DoPostProcessor(1, postimgtype2, postimgparam2); } if (lastdraw) { if (rendermode == render_soft) VID_BlitLinearScreen(screens[0], screens[1], vid.width*vid.bpp, vid.height, vid.width*vid.bpp, vid.rowbytes); lastdraw = false; } ST_Drawer(redrawsbar); HU_Drawer(); } // change gamma if needed if (gamestate != oldgamestate && gamestate != GS_LEVEL) V_SetPalette(0); menuactivestate = menuactive; oldgamestate = wipegamestate = gamestate; // draw pause pic if (paused && (!menuactive || netgame)) { INT32 py; patch_t *patch; if (automapactive) py = 4; else py = viewwindowy + 4; patch = W_CachePatchName("M_PAUSE", PU_CACHE); V_DrawScaledPatch(viewwindowx + (BASEVIDWIDTH - SHORT(patch->width))/2, py, 0, patch); } // vid size change is now finished if it was on... vid.recalc = 0; // FIXME: draw either console or menu, not the two if (gamestate != GS_TIMEATTACK) CON_Drawer(); M_Drawer(); // menu is drawn even on top of everything NetUpdate(); // send out any new accumulation // It's safe to end the game now. if (G_GetExitGameFlag()) { Command_ExitGame_f(); G_ClearExitGameFlag(); } // // normal update // if (!wipe) { if (cv_netstat.value) { char s[50]; Net_GetNetStat(); s[sizeof s - 1] = '\0'; snprintf(s, sizeof s - 1, "get %d b/s", getbps); V_DrawString(BASEVIDWIDTH - V_StringWidth(s), BASEVIDHEIGHT-ST_HEIGHT-40, V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "send %d b/s", sendbps); V_DrawString(BASEVIDWIDTH - V_StringWidth(s), BASEVIDHEIGHT-ST_HEIGHT-30, V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "GameMiss %.2f%%", gamelostpercent); V_DrawString(BASEVIDWIDTH - V_StringWidth(s), BASEVIDHEIGHT-ST_HEIGHT-20, V_YELLOWMAP, s); snprintf(s, sizeof s - 1, "SysMiss %.2f%%", lostpercent); V_DrawString(BASEVIDWIDTH - V_StringWidth(s), BASEVIDHEIGHT-ST_HEIGHT-10, V_YELLOWMAP, s); } I_FinishUpdate(); // page flip or blit buffer if (takescreenshot) // Only take screenshots after drawing. M_DoScreenShot(); return; } // // wipe update // if (rendermode != render_none) { F_WipeEndScreen(0, 0, vid.width, vid.height); F_RunWipe(2*TICRATE, gamestate != GS_TIMEATTACK); WipeInAction = false; } }
void SCR_SetMode(void) { if (dedicated) return; if (!setmodeneeded || WipeInAction) return; // should never happen and don't change it during a wipe, BAD! VID_SetMode(--setmodeneeded); V_SetPalette(0); // // setup the right draw routines for either 8bpp or 16bpp // if (true)//vid.bpp == 1) //Always run in 8bpp. todo: remove all 16bpp code? { spanfunc = basespanfunc = R_DrawSpan_8; splatfunc = R_DrawSplat_8; transcolfunc = R_DrawTranslatedColumn_8; transtransfunc = R_DrawTranslatedTranslucentColumn_8; colfunc = basecolfunc = R_DrawColumn_8; shadecolfunc = R_DrawShadeColumn_8; fuzzcolfunc = R_DrawTranslucentColumn_8; walldrawerfunc = R_DrawWallColumn_8; twosmultipatchfunc = R_Draw2sMultiPatchColumn_8; twosmultipatchtransfunc = R_Draw2sMultiPatchTranslucentColumn_8; #ifdef RUSEASM if (R_ASM) { if (R_MMX) { colfunc = basecolfunc = R_DrawColumn_8_MMX; //shadecolfunc = R_DrawShadeColumn_8_ASM; //fuzzcolfunc = R_DrawTranslucentColumn_8_ASM; walldrawerfunc = R_DrawWallColumn_8_MMX; twosmultipatchfunc = R_Draw2sMultiPatchColumn_8_MMX; spanfunc = basespanfunc = R_DrawSpan_8_MMX; } else { colfunc = basecolfunc = R_DrawColumn_8_ASM; //shadecolfunc = R_DrawShadeColumn_8_ASM; //fuzzcolfunc = R_DrawTranslucentColumn_8_ASM; walldrawerfunc = R_DrawWallColumn_8_ASM; twosmultipatchfunc = R_Draw2sMultiPatchColumn_8_ASM; } } #endif } /* else if (vid.bpp > 1) { I_OutputMsg("using highcolor mode\n"); spanfunc = basespanfunc = R_DrawSpan_16; transcolfunc = R_DrawTranslatedColumn_16; transtransfunc = R_DrawTranslucentColumn_16; // No 16bit operation for this function colfunc = basecolfunc = R_DrawColumn_16; shadecolfunc = NULL; // detect error if used somewhere.. fuzzcolfunc = R_DrawTranslucentColumn_16; walldrawerfunc = R_DrawWallColumn_16; }*/ else I_Error("unknown bytes per pixel mode %d\n", vid.bpp); /*#if !defined (DC) && !defined (WII) if (SCR_IsAspectCorrect(vid.width, vid.height)) CONS_Alert(CONS_WARNING, M_GetText("Resolution is not aspect-correct!\nUse a multiple of %dx%d\n"), BASEVIDWIDTH, BASEVIDHEIGHT); #endif*/ // set the apprpriate drawer for the sky (tall or INT16) setmodeneeded = 0; }
// do some initial settings for the game loading screen // void SCR_Startup(void) { const CPUInfoFlags *RCpuInfo = I_CPUInfo(); if (!M_CheckParm("-NOCPUID") && RCpuInfo) { #if defined (__i386__) || defined (_M_IX86) || defined (__WATCOMC__) R_486 = true; #endif if (RCpuInfo->RDTSC) R_586 = true; if (RCpuInfo->MMX) R_MMX = true; if (RCpuInfo->AMD3DNow) R_3DNow = true; if (RCpuInfo->MMXExt) R_MMXExt = true; if (RCpuInfo->SSE) R_SSE = true; if (RCpuInfo->SSE2) R_SSE2 = true; CONS_Printf("CPU Info: 486: %i, 586: %i, MMX: %i, 3DNow: %i, MMXExt: %i, SSE2: %i\n", R_486, R_586, R_MMX, R_3DNow, R_MMXExt, R_SSE2); } if (M_CheckParm("-noASM")) R_ASM = false; if (M_CheckParm("-486")) R_486 = true; if (M_CheckParm("-586")) R_586 = true; if (M_CheckParm("-MMX")) R_MMX = true; if (M_CheckParm("-3DNow")) R_3DNow = true; if (M_CheckParm("-MMXExt")) R_MMXExt = true; if (M_CheckParm("-SSE")) R_SSE = true; if (M_CheckParm("-noSSE")) R_SSE = false; if (M_CheckParm("-SSE2")) R_SSE2 = true; M_SetupMemcpy(); if (dedicated) { V_Init(); V_SetPalette(0); return; } vid.modenum = 0; vid.dupx = vid.width / BASEVIDWIDTH; vid.dupy = vid.height / BASEVIDHEIGHT; vid.dupx = vid.dupy = (vid.dupx < vid.dupy ? vid.dupx : vid.dupy); vid.fdupx = FixedDiv(vid.width*FRACUNIT, BASEVIDWIDTH*FRACUNIT); vid.fdupy = FixedDiv(vid.height*FRACUNIT, BASEVIDHEIGHT*FRACUNIT); #ifdef HWRENDER if (rendermode != render_opengl && rendermode != render_none) // This was just placing it incorrectly at non aspect correct resolutions in opengl #endif vid.fdupx = vid.fdupy = (vid.fdupx < vid.fdupy ? vid.fdupx : vid.fdupy); vid.meddupx = (UINT8)(vid.dupx >> 1) + 1; vid.meddupy = (UINT8)(vid.dupy >> 1) + 1; #ifdef HWRENDER vid.fmeddupx = vid.meddupx*FRACUNIT; vid.fmeddupy = vid.meddupy*FRACUNIT; #endif vid.smalldupx = (UINT8)(vid.dupx / 3) + 1; vid.smalldupy = (UINT8)(vid.dupy / 3) + 1; #ifdef HWRENDER vid.fsmalldupx = vid.smalldupx*FRACUNIT; vid.fsmalldupy = vid.smalldupy*FRACUNIT; #endif vid.baseratio = FRACUNIT; V_Init(); CV_RegisterVar(&cv_ticrate); CV_RegisterVar(&cv_constextsize); V_SetPalette(0); }
void I_UpdateVideoMode(void) { int init_flags; if(screen) { // video capturing cannot be continued with new screen settings I_CaptureFinish(); #ifdef GL_DOOM if (V_GetMode() == VID_MODEGL) { gld_CleanMemory(); // hires patches gld_CleanStaticMemory(); } #endif I_InitScreenResolution(); SDL_FreeSurface(screen); screen = NULL; #ifdef GL_DOOM if (vid_8ingl.surface) { SDL_FreeSurface(vid_8ingl.surface); vid_8ingl.surface = NULL; } #endif SMP_Free(); } // e6y: initialisation of screen_multiply screen_multiply = render_screen_multiply; // Initialize SDL with this graphics mode if (V_GetMode() == VID_MODEGL) { init_flags = SDL_OPENGL; } else { if (use_doublebuffer) init_flags = SDL_DOUBLEBUF; else init_flags = SDL_SWSURFACE; #ifndef PRBOOM_DEBUG init_flags |= SDL_HWPALETTE; #endif } if ( desired_fullscreen ) init_flags |= SDL_FULLSCREEN; // In windowed mode, the window can be resized while the game is // running. This feature is disabled on OS X, as it adds an ugly // scroll handle to the corner of the screen. #ifndef MACOSX if (!desired_fullscreen) init_flags |= SDL_RESIZABLE; #endif if (sdl_video_window_pos && sdl_video_window_pos[0]) { char buf[80]; strcpy(buf, "SDL_VIDEO_WINDOW_POS="); strncat(buf, sdl_video_window_pos, sizeof(buf) - sizeof(buf[0]) - strlen(buf)); putenv(buf); } #ifdef GL_DOOM vid_8ingl.enabled = false; #endif if (V_GetMode() == VID_MODEGL) { #ifdef GL_DOOM SDL_GL_SetAttribute( SDL_GL_RED_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_ACCUM_RED_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_ACCUM_GREEN_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_ACCUM_BLUE_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, 0 ); SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); SDL_GL_SetAttribute( SDL_GL_BUFFER_SIZE, gl_colorbuffer_bits ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, gl_depthbuffer_bits ); SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE, 8 ); //e6y: vertical sync #if !SDL_VERSION_ATLEAST(1, 3, 0) SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, (gl_vsync ? 1 : 0)); #endif //e6y: anti-aliasing gld_MultisamplingInit(); screen = SDL_SetVideoMode(REAL_SCREENWIDTH, REAL_SCREENHEIGHT, gl_colorbuffer_bits, init_flags); gld_CheckHardwareGamma(); #endif } else { #ifdef GL_DOOM if (use_gl_surface) { int flags = SDL_OPENGL; if ( desired_fullscreen ) flags |= SDL_FULLSCREEN; SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 ); SDL_GL_SetAttribute( SDL_GL_BUFFER_SIZE, gl_colorbuffer_bits ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, gl_depthbuffer_bits ); //e6y: vertical sync #if !SDL_VERSION_ATLEAST(1, 3, 0) SDL_GL_SetAttribute(SDL_GL_SWAP_CONTROL, (gl_vsync ? 1 : 0)); #endif vid_8ingl.surface = SDL_SetVideoMode( REAL_SCREENWIDTH, REAL_SCREENHEIGHT, gl_colorbuffer_bits, flags); if(vid_8ingl.surface == NULL) I_Error("Couldn't set %dx%d video mode [%s]", REAL_SCREENWIDTH, REAL_SCREENHEIGHT, SDL_GetError()); screen = SDL_CreateRGBSurface( init_flags & ~SDL_FULLSCREEN, REAL_SCREENWIDTH, REAL_SCREENHEIGHT, V_GetNumPixelBits(), 0, 0, 0, 0); vid_8ingl.screen = screen; vid_8ingl.enabled = true; } else #endif { screen = SDL_SetVideoMode(REAL_SCREENWIDTH, REAL_SCREENHEIGHT, V_GetNumPixelBits(), init_flags); } } if(screen == NULL) { I_Error("Couldn't set %dx%d video mode [%s]", REAL_SCREENWIDTH, REAL_SCREENHEIGHT, SDL_GetError()); } SMP_Init(); #if SDL_VERSION_ATLEAST(1, 3, 0) #ifdef GL_DOOM if (V_GetMode() == VID_MODEGL) { SDL_GL_SetSwapInterval((gl_vsync ? 1 : 0)); } #endif #endif #ifdef GL_DOOM /*if (V_GetMode() == VID_MODEGL) gld_MultisamplingCheck();*/ #endif lprintf(LO_INFO, "I_UpdateVideoMode: 0x%x, %s, %s\n", init_flags, screen->pixels ? "SDL buffer" : "own buffer", SDL_MUSTLOCK(screen) ? "lock-and-copy": "direct access"); // Get the info needed to render to the display if (screen_multiply==1 && !SDL_MUSTLOCK(screen)) { screens[0].not_on_heap = true; screens[0].data = (unsigned char *) (screen->pixels); screens[0].byte_pitch = screen->pitch; screens[0].short_pitch = screen->pitch / V_GetModePixelDepth(VID_MODE16); screens[0].int_pitch = screen->pitch / V_GetModePixelDepth(VID_MODE32); } else { screens[0].not_on_heap = false; } V_AllocScreens(); R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); // e6y: wide-res // Need some initialisations before level precache R_ExecuteSetViewSize(); V_SetPalette(0); I_UploadNewPalette(0, true); ST_SetResolution(); AM_SetResolution(); #ifdef GL_DOOM if (V_GetMode() == VID_MODEGL) { int temp; lprintf(LO_INFO,"SDL OpenGL PixelFormat:\n"); SDL_GL_GetAttribute( SDL_GL_RED_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_RED_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_GREEN_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_GREEN_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_BLUE_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_BLUE_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_STENCIL_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_STENCIL_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_ACCUM_RED_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_ACCUM_RED_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_ACCUM_GREEN_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_ACCUM_GREEN_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_ACCUM_BLUE_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_ACCUM_BLUE_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_ACCUM_ALPHA_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_ACCUM_ALPHA_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_DOUBLEBUFFER, &temp ); lprintf(LO_INFO," SDL_GL_DOUBLEBUFFER: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_BUFFER_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_BUFFER_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_DEPTH_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_DEPTH_SIZE: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_MULTISAMPLESAMPLES, &temp ); lprintf(LO_INFO," SDL_GL_MULTISAMPLESAMPLES: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_MULTISAMPLEBUFFERS, &temp ); lprintf(LO_INFO," SDL_GL_MULTISAMPLEBUFFERS: %i\n",temp); SDL_GL_GetAttribute( SDL_GL_STENCIL_SIZE, &temp ); lprintf(LO_INFO," SDL_GL_STENCIL_SIZE: %i\n",temp); gld_Init(SCREENWIDTH, SCREENHEIGHT); } if (vid_8ingl.enabled) { gld_Init8InGLMode(); } if (V_GetMode() == VID_MODEGL) { M_ChangeFOV(); M_ChangeRenderPrecise(); deh_changeCompTranslucency(); } #endif }
void SCR_SetMode(void) { if (dedicated) return; if (!setmodeneeded || WipeInAction) return; // should never happen and don't change it during a wipe, BAD! VID_SetMode(--setmodeneeded); V_SetPalette(0); // // setup the right draw routines for either 8bpp or 16bpp // if (true)//vid.bpp == 1) //Always run in 8bpp. todo: remove all 16bpp code? { basespanfunc = R_DrawSpan_8; spanfunc = basespanfunc; splatfunc = R_DrawSplat_8; transcolfunc = R_DrawTranslatedColumn_8; transtransfunc = R_DrawTranslatedTranslucentColumn_8; colfunc = basecolfunc = R_DrawColumn_8; shadecolfunc = R_DrawShadeColumn_8; fuzzcolfunc = R_DrawTranslucentColumn_8; walldrawerfunc = R_DrawWallColumn_8; #ifdef RUSEASM if (R_ASM) { //colfunc = basecolfunc = R_DrawColumn_8_ASM; shadecolfunc = R_DrawShadeColumn_8_ASM; // fuzzcolfunc = R_DrawTranslucentColumn_8_ASM; //walldrawerfunc = R_DrawWallColumn_8_ASM; } /* if (R_486) { colfunc = basecolfunc = R_DrawColumn_8_NOMMX; CONS_Printf("using 486 code\n"); } if (R_586) { colfunc = basecolfunc = R_DrawColumn_8_Pentium; CONS_Printf("upgrading to 586 code\n"); } if (R_MMX) { colfunc = basecolfunc = R_DrawColumn_8_K6_MMX; CONS_Printf("now using cool MMX code\n"); }*/ #endif } /* else if (vid.bpp > 1) { CONS_Printf("using highcolor mode\n"); spanfunc = basespanfunc = R_DrawSpan_16; transcolfunc = R_DrawTranslatedColumn_16; transtransfunc = R_DrawTranslucentColumn_16; // No 16bit operation for this function colfunc = basecolfunc = R_DrawColumn_16; shadecolfunc = NULL; // detect error if used somewhere.. fuzzcolfunc = R_DrawTranslucentColumn_16; walldrawerfunc = R_DrawWallColumn_16; }*/ else I_Error("unknown bytes per pixel mode %d\n", vid.bpp); #ifndef DC if (vid.width % BASEVIDWIDTH || vid.height % BASEVIDHEIGHT) CONS_Printf("WARNING: Resolution is not aspect-correct!\n" "Use a multiple of %dx%d\n", BASEVIDWIDTH, BASEVIDHEIGHT); #endif // set the apprpriate drawer for the sky (tall or INT16) setmodeneeded = 0; }
// do some initial settings for the game loading screen // void SCR_Startup(void) { const CPUInfoFlags *RCpuInfo = I_CPUInfo(); if (!M_CheckParm("-NOCPUID") && RCpuInfo) { #if defined (__i386__) || defined (_M_IX86) || defined (__WATCOMC__) R_486 = true; #endif if (RCpuInfo->RDTSC) R_586 = true; if (RCpuInfo->MMX) R_MMX = true; if (RCpuInfo->AMD3DNow) R_3DNow = true; if (RCpuInfo->MMXExt) R_MMXExt = true; if (RCpuInfo->SSE2) R_SSE2 = true; if (RCpuInfo->CPUs > 1) { R_ASM = false; //with more than 1 CPU, ASM go BOOM! } CONS_Printf("CPU Info: 486: %i, 586: %i, MMX: %i, 3DNow: %i, MMXExt: %i, SSE2: %i\n", R_486, R_586, R_MMX, R_3DNow, R_MMXExt, R_SSE2); } if (M_CheckParm("-noASM")) R_ASM = false; if (M_CheckParm("-486")) R_486 = true; if (M_CheckParm("-586")) R_586 = true; if (M_CheckParm("-MMX")) R_MMX = true; if (M_CheckParm("-3DNow")) R_3DNow = true; if (M_CheckParm("-MMXExt")) R_MMXExt = true; if (M_CheckParm("-SSE2")) R_SSE2 = true; #if defined (_WIN32) && !defined (_WIN32_WCE) && !defined (_XBOX) if (!RCpuInfo || !RCpuInfo->CPUs) //bad CPUID code? { LPCSTR cNOP = I_GetEnv("NUMBER_OF_PROCESSORS"); if (cNOP && atoi(cNOP) > 1 && !M_CheckParm("-ASM")) { R_ASM = false; CONS_Printf("Disabling ASM code\n"); } } #endif M_SetupMemcpy(); if (dedicated) { V_Init(); V_SetPalette(0); return; } vid.modenum = 0; vid.fdupx = (float)vid.width/BASEVIDWIDTH; vid.fdupy = (float)vid.height/BASEVIDHEIGHT; vid.dupx = (INT32)vid.fdupx; vid.dupy = (INT32)vid.fdupy; vid.baseratio = FRACUNIT; #ifdef RUSEASM if (R_ASM) ASM_PatchRowBytes(vid.rowbytes); // if (R_486 || R_586 || R_MMX) // MMX_PatchRowBytes(vid.rowbytes); #endif V_Init(); CV_RegisterVar(&cv_ticrate); V_SetPalette(0); }
void D_Display (void) { boolean wipe, viewactive, isborder; static boolean isborderstate = FALSE; static boolean borderwillneedredraw = FALSE; static gamestate_t oldgamestate = -1; // Reentrancy. if (in_d_wipe) { D_Wipe(); return; } if (!I_StartDisplay()) return; // save the current screen if about to wipe if ((wipe = gamestate != wipegamestate)) wipe_StartScreen(); if (gamestate != GS_LEVEL) { // Not a level switch (oldgamestate) { case -1: case GS_LEVEL: V_SetPalette(0); // cph - use default (basic) palette default: break; } switch (gamestate) { case GS_INTERMISSION: WI_Drawer(); break; case GS_FINALE: F_Drawer(); break; case GS_DEMOSCREEN: D_PageDrawer(); break; default: break; } } else if (gametic != basetic) { // In a level boolean redrawborderstuff; HU_Erase(); if (setsizeneeded) { // change the view size if needed R_ExecuteSetViewSize(); oldgamestate = -1; // force background redraw } // Work out if the player view is visible, and if there is a border viewactive = (!(automapmode & am_active) || (automapmode & am_overlay)) && !inhelpscreens; isborder = viewactive ? (viewheight != SCREENHEIGHT) : (!inhelpscreens && (automapmode & am_active)); if (oldgamestate != GS_LEVEL) { redrawborderstuff = isborder; } else { // CPhipps - // If there is a border, and either there was no border last time, // or the border might need refreshing, then redraw it. redrawborderstuff = isborder && (!isborderstate || borderwillneedredraw); // The border may need redrawing next time if the border surrounds the screen, // and there is a menu being displayed borderwillneedredraw = viewactive ? (menuactive && isborder) : (!inhelpscreens && menuactive == mnact_full); } // Now do the drawing if (viewactive) R_RenderPlayerView (&players[displayplayer]); if (automapmode & am_active) AM_Drawer(); ST_Drawer( ((viewheight != SCREENHEIGHT) || ((automapmode & am_active) && !(automapmode & am_overlay))), redrawborderstuff, (menuactive == mnact_full)); HU_Drawer(); } isborderstate = isborder; oldgamestate = wipegamestate = gamestate; // draw pause pic if (paused && (menuactive != mnact_full)) { // Simplified the "logic" here and no need for x-coord caching - POPE V_DrawNamePatch((320 - V_NamePatchWidth("M_PAUSE"))/2, 4, 0, "M_PAUSE", CR_DEFAULT, VPT_NONE); } // menus go directly to the screen M_Drawer(); // menu is drawn even on top of everything #ifdef HAVE_NET NetUpdate(); // send out any new accumulation #else D_BuildNewTiccmds(); #endif // normal update if (!wipe) I_FinishUpdate (); // page flip or blit buffer else { // wipe update wipe_EndScreen(); D_Wipe(); } I_EndDisplay(); }