void I_UpdateVideoMode(void) { int init_flags; int i; video_mode_t mode; lprintf(LO_INFO, "I_UpdateVideoMode: %dx%d (%s)\n", SCREENWIDTH, SCREENHEIGHT, desired_fullscreen ? "fullscreen" : "nofullscreen"); mode = I_GetModeFromString(default_videomode); if ((i=M_CheckParm("-vidmode")) && i<myargc-1) { mode = I_GetModeFromString(myargv[i+1]); } V_InitMode(mode); V_DestroyUnusedTrueColorPalettes(); V_FreeScreens(); I_SetRes(); screens[0].not_on_heap = false; screens[0].width = SCREENWIDTH; screens[0].height = SCREENHEIGHT; screens[0].byte_pitch = SCREENPITCH; screens[0].short_pitch = screens[0].byte_pitch/2; screens[0].int_pitch = screens[0].short_pitch/2; V_AllocScreens(); R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); }
void I_UpdateVideoMode(void) { unsigned int w, h; // int init_flags; lprintf(LO_INFO, "I_UpdateVideoMode: %dx%d (%s)\n", SCREENWIDTH, SCREENHEIGHT, use_fullscreen ? "fullscreen" : "nofullscreen"); w = SCREENWIDTH; h = SCREENHEIGHT; //screen = SDL_SetVideoMode(w, h, 8, init_flags); /* if(screen == NULL) { I_Error("Couldn't set %dx%d video mode [%s]", w, h, SDL_GetError()); }*/ // 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"); //mouse_currently_grabbed = false; // Get the info needed to render to the display if (!out_buffer) free(out_buffer); out_buffer = calloc(SCREENWIDTH*SCREENHEIGHT, 1); screens[0] = out_buffer; R_InitBuffer(w,h); }
void I_UpdateVideoMode(void) { int init_flags; int i; video_mode_t mode; lprintf(LO_INFO, "I_UpdateVideoMode: %dx%d (%s)\n", SCREENWIDTH, SCREENHEIGHT, desired_fullscreen ? "fullscreen" : "nofullscreen"); // For now, use 8-bit rendering but default 24-bit framebuffer mode = I_GetModeFromString(default_videomode); if ((i=M_CheckParm("-vidmode")) && i<myargc-1) { mode = I_GetModeFromString(myargv[i+1]); } // reset video modes gfxExit(); // disable console Done_ConsoleWin(); gfxInit(GSP_BGR8_OES, GSP_BGR8_OES, false); I_ClearFrameBuffer(GFX_TOP, GFX_LEFT); I_ClearFrameBuffer(GFX_TOP, GFX_RIGHT); I_ClearFrameBuffer(GFX_BOTTOM, 0); V_InitMode(mode); V_DestroyUnusedTrueColorPalettes(); V_FreeScreens(); I_SetRes(); V_AllocScreens(); R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); }
void I_InitGraphics(void) { int i; V_InitMode(); V_FreeScreens(); I_CalculateRes(SCREENWIDTH, SCREENHEIGHT); for (i = 0; i < 3; i++) { screens[i].width = SCREENWIDTH; screens[i].height = SCREENHEIGHT; screens[i].byte_pitch = SCREENPITCH; } screens[4].width = SCREENWIDTH; screens[4].height = (ST_SCALED_HEIGHT + 1); screens[4].byte_pitch = SCREENPITCH; surface = SDL_SetVideoMode(SCREENWIDTH, SCREENHEIGHT, 8, SDL_DOUBLEBUF | SDL_HWPALETTE | SDL_FULLSCREEN); if (surface == NULL) I_Error("I_InitGraphics: Couldn't set %dx%d video mode [%s]", SCREENWIDTH, SCREENHEIGHT, SDL_GetError()); if (!SDL_MUSTLOCK(surface)) { screens[0].not_on_heap = true; screens[0].data = (unsigned char *)(surface->pixels); screens[0].byte_pitch = surface->pitch; } else { screens[0].not_on_heap = false; } V_AllocScreens(); R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); SDL_ShowCursor(0); SDL_WM_GrabInput(SDL_GRAB_ON); SDL_WarpMouse((unsigned short)(SCREENWIDTH / 2), (unsigned short)(SCREENHEIGHT / 2)); }
static void I_UpdateVideoMode(void) { if (log_cb) log_cb(RETRO_LOG_INFO, "I_UpdateVideoMode: %dx%d\n", SCREENWIDTH, SCREENHEIGHT); V_InitMode(); V_DestroyUnusedTrueColorPalettes(); V_FreeScreens(); I_SetRes(); screens[0].not_on_heap = true; screens[0].data = (unsigned char *)screen_buf; V_AllocScreens(); R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); }
void R_ExecuteSetViewSize (void) { int i; setsizeneeded = false; if (setblocks == 11) { scaledviewwidth = SCREENWIDTH; viewheight = SCREENHEIGHT; } // proff 09/24/98: Added for high-res else if (setblocks == 10) { scaledviewwidth = SCREENWIDTH; viewheight = SCREENHEIGHT-ST_SCALED_HEIGHT; } else { // proff 08/17/98: Changed for high-res scaledviewwidth = setblocks*SCREENWIDTH/10; viewheight = (setblocks*(SCREENHEIGHT-ST_SCALED_HEIGHT)/10) & ~7; } viewwidth = scaledviewwidth; centery = viewheight/2; centerx = viewwidth/2; centerxfrac = centerx<<FRACBITS; centeryfrac = centery<<FRACBITS; projection = centerxfrac; // proff 11/06/98: Added for high-res projectiony = ((SCREENHEIGHT * centerx * 320) / 200) / SCREENWIDTH * FRACUNIT; R_InitBuffer (scaledviewwidth, viewheight); R_InitTextureMapping(); // psprite scales // proff 08/17/98: Changed for high-res pspritescale = FRACUNIT*viewwidth/320; pspriteiscale = FRACUNIT*320/viewwidth; // proff 11/06/98: Added for high-res pspriteyscale = (((SCREENHEIGHT*viewwidth)/SCREENWIDTH) << FRACBITS) / 200; // thing clipping for (i=0 ; i<viewwidth ; i++) screenheightarray[i] = viewheight; // planes for (i=0 ; i<viewheight ; i++) { // killough 5/2/98: reformatted fixed_t dy = D_abs(((i-viewheight/2)<<FRACBITS)+FRACUNIT/2); // proff 08/17/98: Changed for high-res yslope[i] = FixedDiv(projectiony, dy); } for (i=0 ; i<viewwidth ; i++) { fixed_t cosadj = D_abs(finecosine[xtoviewangle[i]>>ANGLETOFINESHIFT]); distscale[i] = FixedDiv(FRACUNIT,cosadj); } }
void I_UpdateVideoMode(void) { int init_flags; int i; video_mode_t mode; lprintf(LO_INFO, "I_UpdateVideoMode: %dx%d (%s)\n", SCREENWIDTH, SCREENHEIGHT, desired_fullscreen ? "fullscreen" : "nofullscreen"); mode = I_GetModeFromString(default_videomode); if ((i=M_CheckParm("-vidmode")) && i<myargc-1) { mode = I_GetModeFromString(myargv[i+1]); } V_InitMode(mode); V_DestroyUnusedTrueColorPalettes(); V_FreeScreens(); I_SetRes(); // 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 _DEBUG init_flags |= SDL_HWPALETTE; #endif } if ( desired_fullscreen ) init_flags |= SDL_FULLSCREEN; if (V_GetMode() == VID_MODEGL) { 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 ); screen = SDL_SetVideoMode(SCREENWIDTH, SCREENHEIGHT, gl_colorbuffer_bits, init_flags); } else { screen = SDL_SetVideoMode(SCREENWIDTH, SCREENHEIGHT, V_GetNumPixelBits(), init_flags); } if(screen == NULL) { I_Error("Couldn't set %dx%d video mode [%s]", SCREENWIDTH, SCREENHEIGHT, SDL_GetError()); } 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 (!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(); // Hide pointer while over this window SDL_ShowCursor(0); I_PrepareMouse(1); R_InitBuffer(SCREENWIDTH, SCREENHEIGHT); 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); #ifdef GL_DOOM gld_Init(SCREENWIDTH, SCREENHEIGHT); #endif } }
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 }
// // R_ExecuteSetViewSize // void R_ExecuteSetViewSize(void) { fixed_t cosadj; fixed_t dy; int i; int j; int level; int startmap; setsizeneeded = false; if (setblocks == 11) { scaledviewwidth = SCREENWIDTH; viewheight = SCREENHEIGHT; } else { scaledviewwidth = setblocks * 64; viewheight = ((setblocks * 168 / 10) & ~7) * 2; } viewwidth = scaledviewwidth; viewheightfrac = viewheight << FRACBITS; centery = viewheight / 2; centerx = viewwidth / 2; centerxfrac = centerx << FRACBITS; centeryfrac = centery << FRACBITS; projection = centerxfrac; projectiony = ((SCREENHEIGHT * centerx * ORIGINALWIDTH) / ORIGINALHEIGHT) / SCREENWIDTH * FRACUNIT; colfunc = basecolfunc = R_DrawColumn; fuzzcolfunc = R_DrawFuzzColumn; tlcolfunc = R_DrawTranslucentColumn; tl50colfunc = R_DrawTranslucent50Column; tl33colfunc = R_DrawTranslucent33Column; tlgreencolfunc = R_DrawTranslucentGreenColumn; tlredcolfunc = R_DrawTranslucentRedColumn; tlredwhitecolfunc = R_DrawTranslucentRedWhiteColumn; tlbluecolfunc = R_DrawTranslucentBlueColumn; tlgreen50colfunc = R_DrawTranslucentGreen50Column; tlred50colfunc = R_DrawTranslucentRed50Column; tlredwhite50colfunc = R_DrawTranslucentRedWhite50Column; tlblue50colfunc = R_DrawTranslucentBlue50Column; redtobluecolfunc = R_DrawRedToBlueColumn; tlredtoblue50colfunc = R_DrawTranslucentRedToBlue50Column; transcolfunc = R_DrawTranslatedColumn; spanfunc = R_DrawSpan; skycolfunc = R_DrawSkyColumn; redtogreencolfunc = R_DrawRedToGreenColumn; tlredtogreen50colfunc = R_DrawTranslucentRedToGreen50Column; wallcolfunc = R_DrawWallColumn; fbwallcolfunc = R_DrawFullbrightWallColumn; psprcolfunc = R_DrawPlayerSpriteColumn; R_InitBuffer(scaledviewwidth, viewheight); R_InitTextureMapping(); // psprite scales pspritexscale = (centerx << FRACBITS) / (ORIGINALWIDTH / 2); pspriteyscale = (((SCREENHEIGHT * viewwidth) / SCREENWIDTH) << FRACBITS) / ORIGINALHEIGHT; pspriteiscale = FixedDiv(FRACUNIT, pspritexscale); // thing clipping for (i = 0; i < viewwidth; i++) screenheightarray[i] = viewheight; // planes for (i = 0; i < viewheight; i++) { dy = ABS(((i - viewheight / 2) << FRACBITS) + FRACUNIT / 2); yslope[i] = FixedDiv(projectiony, dy); } for (i = 0; i < viewwidth; i++) { cosadj = ABS(finecosine[xtoviewangle[i] >> ANGLETOFINESHIFT]); distscale[i] = FixedDiv(FRACUNIT, cosadj); } // Calculate the light levels to use // for each level / scale combination. for (i = 0; i < LIGHTLEVELS; i++) { startmap = ((LIGHTLEVELS - 1 - i) * 2) * NUMCOLORMAPS / LIGHTLEVELS; for (j = 0; j < MAXLIGHTSCALE; j++) { level = startmap - j * SCREENWIDTH / (viewwidth * DISTMAP); if (level < 0) level = 0; else if (level >= NUMCOLORMAPS) level = NUMCOLORMAPS - 1; scalelight[i][j] = colormaps + level * 256; // [BH] calculate separate light levels to use when drawing // player's weapon, so it stays consistent regardless of view size level = startmap - j / DISTMAP; if (level < 0) level = 0; else if (level >= NUMCOLORMAPS) level = NUMCOLORMAPS - 1; scalelight2[i][j] = colormaps + level * 256; } } }
void R_ExecuteSetViewSize (void) { int i; setsizeneeded = false; if (setblocks == 11) { scaledviewwidth = SCREENWIDTH; viewheight = SCREENHEIGHT; } // proff 09/24/98: Added for high-res else if (setblocks == 10) { scaledviewwidth = SCREENWIDTH; viewheight = SCREENHEIGHT-st_height; } else { // proff 08/17/98: Changed for high-res scaledviewwidth = setblocks*SCREENWIDTH/10; viewheight = (setblocks*(SCREENHEIGHT-st_height)/10) & ~7; } viewwidth = scaledviewwidth; centery = viewheight/2; centerx = viewwidth/2; centerxfrac = centerx<<FRACBITS; centeryfrac = centery<<FRACBITS; projection = centerxfrac; // proff 11/06/98: Added for high-res projectiony = ((SCREENHEIGHT * centerx * 320) / 200) / SCREENWIDTH * FRACUNIT; R_InitBuffer (scaledviewwidth, viewheight); R_InitTextureMapping(); // psprite scales // proff 08/17/98: Changed for high-res pspritescale = FRACUNIT*viewwidth/320; pspriteiscale = FRACUNIT*320/viewwidth; // proff 11/06/98: Added for high-res pspriteyscale = (((SCREENHEIGHT*viewwidth)/SCREENWIDTH) << FRACBITS) / 200; // thing clipping for (i=0 ; i<viewwidth ; i++) screenheightarray[i] = viewheight; // planes for (i=0 ; i<viewheight ; i++) { // killough 5/2/98: reformatted fixed_t dy = abs(((i-viewheight/2)<<FRACBITS)+FRACUNIT/2); // proff 08/17/98: Changed for high-res yslope[i] = FixedDiv(projectiony, dy); } for (i=0 ; i<viewwidth ; i++) { fixed_t cosadj = abs(finecosine[xtoviewangle[i]>>ANGLETOFINESHIFT]); distscale[i] = FixedDiv(FRACUNIT,cosadj); } // Calculate the light levels to use // for each level / scale combination. for (i=0; i<LIGHTLEVELS; i++) { int j, startmap = ((LIGHTLEVELS-1-i)*2)*NUMCOLORMAPS/LIGHTLEVELS; for (j=0 ; j<MAXLIGHTSCALE ; j++) { int t, level = startmap - j*320/viewwidth/DISTMAP; if (level < 0) level = 0; if (level >= NUMCOLORMAPS) level = NUMCOLORMAPS-1; // killough 3/20/98: initialize multiple colormaps level *= 256; for (t=0; t<numcolormaps; t++) // killough 4/4/98 c_scalelight[t][i][j] = colormaps[t] + level; } } }