1 // Emacs style mode select   -*- C++ -*-
2 //-----------------------------------------------------------------------------
3 //
4 // $Id: screen.c 1543 2020-08-22 02:36:35Z wesleyjohnson $
5 //
6 // Copyright (C) 1998-2000 by DooM Legacy Team.
7 //
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version 2
11 // of the License, or (at your option) any later version.
12 //
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 // GNU General Public License for more details.
17 //
18 //
19 // $Log: screen.c,v $
20 // Revision 1.14  2004/05/16 20:34:47  hurdler
21 //
22 // Revision 1.13  2002/11/12 00:06:05  ssntails
23 // Support for translated translucent columns in software mode.
24 //
25 // Revision 1.12  2001/08/20 20:40:39  metzgermeister
26 // Revision 1.11  2001/05/16 21:21:14  bpereira
27 //
28 // Revision 1.10  2001/03/13 22:14:20  stroggonmeth
29 // Long time no commit. 3D floors, FraggleScript, portals, ect.
30 //
31 // Revision 1.9  2001/01/25 22:15:44  bpereira
32 // added heretic support
33 //
34 // Revision 1.8  2000/11/02 19:49:37  bpereira
35 // Revision 1.7  2000/08/31 14:30:56  bpereira
36 // Revision 1.6  2000/08/11 19:10:13  metzgermeister
37 // Revision 1.5  2000/08/03 17:57:42  bpereira
38 //
39 // Revision 1.4  2000/04/22 20:27:35  metzgermeister
40 // support for immediate fullscreen switching
41 //
42 // Revision 1.3  2000/04/16 18:38:07  bpereira
43 // Revision 1.2  2000/02/27 00:42:11  hurdler
44 // Revision 1.1.1.1  2000/02/22 20:32:32  hurdler
45 // Initial import into CVS (v1.29 pr3)
46 //
47 //
48 // DESCRIPTION:
49 //      handles multiple resolutions, 8bpp/16bpp(highcolor) modes
50 //
51 //-----------------------------------------------------------------------------
52 
53 // [WDJ] If you need to use a debugger then disable fullscreeen
54 //#define DEBUG_WINDOWED
55 
56 
57 #include "doomincl.h"
58 #include "screen.h"
59 #include "console.h"
60 #include "am_map.h"
61 #include "i_system.h"
62 #include "i_video.h"
63 #include "r_local.h"
64 #include "r_sky.h"
65 #include "m_argv.h"
66 #include "v_video.h"
67 #include "st_stuff.h"
68 #include "hu_stuff.h"
69 #include "z_zone.h"
70 //#include "d_main.h"
71 #include "hardware/hw_main.h"
72 
73 
74 
75 
76 
77 // --------------------------------------------
78 // assembly or c drawer routines for 8bpp/16bpp
79 // --------------------------------------------
80 void (*skycolfunc) (void);       //new sky column drawer draw posts >128 high
81 void (*colfunc) (void);          // standard column upto 128 high posts
82 
83 #ifdef HORIZONTALDRAW
84 //Fab 17-06-98
85 void (*hcolfunc) (void);         // horizontal column drawer optimisation
86 #endif
87 
88 void (*basecolfunc) (void);
89 void (*fuzzcolfunc) (void);      // standard fuzzy effect column drawer
90 void (*skincolfunc) (void);      // skin translation
91 void (*transcolfunc) (void);     // translucent column drawer
92 void (*shadecolfunc) (void);     // smokie test..
93 void (*fogcolfunc) (void);       // fog effects
94 #ifdef ENABLE_DRAW_ALPHA
95 void (*alpha_colfunc) (void);       // fog effects
96 #endif
97 void (*spanfunc) (void);         // span drawer, use a 64x64 tile
98 void (*basespanfunc) (void);     // default span func for color mode
99 void (*fogspanfunc) (void);      // Legacy Fog sheet
100 void (*transspanfunc) (void);    // translucent span drawer
101 
102 // Tails 11-11-2002
103 void (*skintranscolfunc) (void); // skin translation translucent
104 
105 // ------------------
106 // global video state
107 // ------------------
108 viddef_t  vid;
109 // video mode change needed, set by menu ( 0 = NOP )
110 modenum_t setmodeneeded = {MODE_NOP,0};
111 
112 const char * modetype_string[ MODE_other + 1 ] =
113 {
114     "",
115     "window",
116     "fullscreen",
117     "Voodoo",
118     "either",
119     "other",
120 };
121 
122 
123 // use original Doom fuzzy effect instead of translucency?
124 void CV_Fuzzymode_OnChange();
125 //CV_PossibleValue_t fuzzymode_cons_t[]={{0,"Translucent"}, {1,"Fuzzy"}, {0,NULL}};
126 consvar_t   cv_fuzzymode = {"fuzzymode", "Off", CV_SAVE | CV_CALL, CV_OnOff, CV_Fuzzymode_OnChange};
127 
128 
129 CV_PossibleValue_t scr_depth_cons_t[]={{8,"8 bits"}, {15,"15 bits"}, {16,"16 bits"}, {24,"24 bits"}, {32,"32 bits"}, {0,NULL}};
130 
131 //added:03-02-98: default screen mode, as loaded/saved in config
132 consvar_t   cv_scr_width  = {"scr_width",  "320", CV_VALUE|CV_SAVE, CV_uint16};
133 consvar_t   cv_scr_height = {"scr_height", "200", CV_VALUE|CV_SAVE, CV_uint16};
134 consvar_t   cv_scr_depth =  {"scr_depth",  "8 bits",   CV_SAVE, scr_depth_cons_t};
135 consvar_t   cv_fullscreen = {"fullscreen",  "Yes",CV_SAVE | CV_CALL, CV_YesNo, SCR_ChangeFullscreen};
136 
137 // =========================================================================
138 //                           SCREEN VARIABLES
139 // =========================================================================
140 
141 byte*  scr_borderflat; // flat used to fill the reduced view borders
142                        // set at ST_Init ()
143 
144 #if defined( ENABLE_DRAW15 ) || defined( ENABLE_DRAW16 ) || defined( ENABLE_DRAW24 ) || defined( ENABLE_DRAW32 )
145 #define ENABLE_DRAWEXT
146 
147 #if defined( ENABLE_DRAW15 ) || defined( ENABLE_DRAW16 )
148 // hicolor masks  15 bit / 16 bit
149 uint16_t mask_01111 = 0, mask_01110 = 0, mask_11110 = 0, mask_11100 = 0, mask_11000 = 0;
150 uint16_t mask_r = 0, mask_g = 0, mask_b = 0, mask_rb = 0;
151 byte     shift_r, shift_g, shift_b;
152 #endif
153 #endif
154 
155 
156 // =========================================================================
157 
158 //added:27-01-98: tell asm code the new rowbytes value.
159 void ASMCALL ASM_PatchRowBytes(int rowbytes);
160 
161 
162 //  Short and Tall sky drawer, for the current color mode
163 void (*skydrawerfunc[2]) (void);
164 
165 
166 #ifdef PARANOID
R_DrawDummy(void)167 void R_DrawDummy( void )
168 {
169    printf( "R_DrawDummy\n" );
170 }
171 
SCR_Set_dummy_draw(void)172 void SCR_Set_dummy_draw( void )
173 {
174   colfunc = basecolfunc = R_DrawDummy;
175   skincolfunc = transcolfunc = shadecolfunc = R_DrawDummy;
176   fogcolfunc = R_DrawDummy;
177 #ifdef ENABLE_DRAW_ALPHA
178   alpha_colfunc = R_DrawDummy;
179 #endif
180 
181   spanfunc = basespanfunc = R_DrawDummy;
182   fogspanfunc = transspanfunc = R_DrawDummy;
183   skintranscolfunc = R_DrawDummy;
184 
185   skydrawerfunc[0] = R_DrawDummy;
186   skydrawerfunc[1] = R_DrawDummy;
187 }
188 #endif
189 
190 
191 // Called from D_DoomMain, to start Full Graphics.
192 // Called from D_DoomLoop, when setmodeneeded or drawmode_recalc.
193 // Called from D_Display, when setmodeneeded or drawmode_recalc.
194 //   change_flag : 0=initial setup, 1=change existing setup
SCR_SetMode(byte change_flag)195 void SCR_SetMode( byte change_flag )
196 {
197     int ret_value = 0;
198     byte old_HWR_patchstore = HWR_patchstore;
199 
200     if(dedicated)
201         goto done;
202 
203     // Possible change of rendermode
204     if( drawmode_recalc && set_drawmode )
205     {
206         // Switch the drawmode, this may change the rendermode, setmodeneeded.
207         ret_value = V_switch_drawmode( set_drawmode, change_flag );
208         if( setmodeneeded.modetype == MODE_NOP )
209         {
210             if( ! ret_value )  goto done;
211             setmodeneeded = vid.modenum;
212         }
213     }
214 
215     // triggered by V_switch_drawmode
216     if( rendermode_recalc )
217     {
218         if( change_flag )
219         {
220             // Tear down of structures dependent upon rendermode
221             // Release using old HWR_patchstore setting.
222             SB_Heretic_Release_Graphics();
223             ST_Release_Graphics();
224             ST_Release_FaceGraphics();
225             WI_Release_Data();
226             R_Release_Corona();
227 
228 #ifdef HWRENDER
229             if( HWR_patchstore )
230             {
231                 HWR_Shutdown_Render();
232             }
233 #endif
234 
235             Z_FreeTags( PU_PURGELEVEL, PU_UNLOCK_CACHE);
236         }
237 
238 #ifdef HWRENDER
239         // Safe to switch to the new rendermode patch storage..
240         HWR_patchstore = (rendermode > render_soft);
241 #endif
242 
243         I_Rendermode_setup();
244     }
245 
246     // VID_SetMode will clear vid.draw_ready if it has print messages.
247 #ifdef DEBUG_WINDOWED
248     {
249       // Disable fullscreen so can switch to debugger at breakpoints.
250       cv_fullscreen.EV = 0;
251       if( drawmode_recalc )
252       {
253           ret_value = I_RequestFullGraphics( false );
254       }
255       CONS_Printf("Debug Graphics Window...\n");
256       modenum_t mode800 = VID_GetModeForSize(800,600, MODE_window);  // debug window
257       VID_SetMode(mode800);
258       vid.modenum = setmodeneeded; // fix the display
259     }
260 #else
261     // video system interface, sets vid.recalc
262     if( drawmode_recalc )
263     {
264         // Graphics drawmode setup, get video modes
265         // param: req_drawmode, req_bitpp, req_alt_bitpp, req_width, req_height.
266         cv_fullscreen.EV = cv_fullscreen.value && allow_fullscreen;
267         ret_value = I_RequestFullGraphics( cv_fullscreen.EV );
268         if( ret_value < 0 )
269             GenPrintf(EMSG_error, "Change Graphics failed: err=%i, fullscreen=%i\n", ret_value, cv_fullscreen.EV );
270         if( ret_value < 0 && cv_fullscreen.EV )
271         {
272             cv_fullscreen.EV = 0;
273             ret_value = I_RequestFullGraphics( 0 );  // window mode
274         }
275     }
276     else
277     {
278         // Select a video mode, within the drawmode and mode list.
279         // Can switch fullscreen.
280         ret_value = VID_SetMode(setmodeneeded);
281             // sets vid.width, vid.height
282     }
283 #endif
284 
285     // The screens must be setup before any error or verbose messages are
286     // printed, or else it will segfault on the bad screen ptr.
287     // Redundant call, for some video drivers,
288     // but for other cases the video drivers have not setup the screens.
289     // Set the screen[x] ptrs on the new vidbuffers.
290     // Sets vid.draw_ready to indicate ready to draw messages.
291     V_Setup_VideoDraw();
292 
293     // No longer can use display, must fail
294     if( rendermode == render_soft && vid.display == NULL )
295         I_Error( "VID_SetMode failed to provide any display\n" );
296 
297     //
298     //  setup the right draw routines for either 8bpp or 16bpp
299     //
300     //debug_Printf ("SCR_SetMode : vid.bitpp is %d\n", vid.bitpp);
301     // set the appropriate drawer for the sky (tall or short)
302     // vid.bitpp is already protected by V_Setup_VideoDraw
303     switch( vid.bitpp )
304     {
305      case 8:
306         vid.drawmode = DRAW8PAL;
307         colfunc = basecolfunc = R_DrawColumn_8;
308 #ifdef HORIZONTALDRAW
309         hcolfunc = R_DrawHColumn_8;
310 #endif
311         skincolfunc = R_DrawTranslatedColumn_8;  // skin translation
312         transcolfunc = R_DrawTranslucentColumn_8;
313         shadecolfunc = R_DrawShadeColumn_8;  //R_DrawColumn_8;
314         fogcolfunc = R_DrawFogColumn_8;
315 #ifdef ENABLE_DRAW_ALPHA
316         alpha_colfunc = R_DrawAlphaColumn_8;
317 #endif
318 
319         spanfunc = basespanfunc = R_DrawSpan_8;
320         fogspanfunc = R_DrawFogSpan_8;
321         transspanfunc = R_DrawTranslucentSpan_8;
322 
323         // SSNTails 11-11-2002
324         skintranscolfunc = R_DrawTranslatedTranslucentColumn_8;
325 
326         // FIXME: quick fix
327         skydrawerfunc[0] = R_DrawColumn_8;      //old skies
328         skydrawerfunc[1] = R_DrawSkyColumn_8;   //tall sky
329         break;
330 #ifdef ENABLE_DRAW15
331      case 15:
332         vid.drawmode = DRAW15;
333         mask_01111 = 0x3DEF;  // 0 01111 01111 01111 mask out the upper bit of R,G,B
334         mask_01110 = 0x39CE;  // 0 01110 01110 01110 mask out the upper and lowest bit of R,G,B
335         mask_11110 = 0x7BDE;  // 0 11110 11110 11110 mask out the lowest bit of R,G,B
336         mask_11100 = 0x739C;  // 0 11100 11100 11100 mask out the lowest bits of R,G,B
337         mask_11000 = 0x6318;  // 0 11000 11000 11000 mask out the lowest bits of R,G,B
338         mask_r = 0x7C00;  // 0 11111 00000 00000 mask of R
339         mask_g = 0x03E0;  // 0 00000 11111 00000 mask of G
340         mask_b = 0x001F;  // 0 00000 00000 11111 mask of B
341         mask_rb = 0x7C1F;  // 0 11111 00000 11111 mask of R and B
342         shift_r = 10;
343         shift_g = 5;
344         shift_b = 0;
345         goto highcolor_common;
346 #endif
347 #ifdef ENABLE_DRAW16
348      case 16:
349         vid.drawmode = DRAW16;
350 #if 0
351         // by definition, but extra bit in green gives whites a green cast
352         mask_01111 = 0x7BEF;  // 01111 011111 01111 mask out the upper bit of R,G,B
353         mask_01110 = 0x73CE;  // 01110 011110 01110 mask out the upper bit of R,G,B
354         mask_11110 = 0xF7DE;  // 11110 111110 11110 mask out the lowest bit of R,G,B
355         mask_11110 = 0xE79C;  // 11100 111100 11100 mask out the lowest bits of R,G,B
356         mask_11100 = 0xC718;  // 11000 111000 11000 mask out the lowest bits of R,G,B
357         mask_r = 0xF800;  // 11111 000000 00000 mask of R
358         mask_g = 0x07E0;  // 00000 111111 00000 mask of G (green cast due to 1 more bit)
359         mask_b = 0x001F;  // 00000 000000 11111 mask of B
360         mask_rb = 0xF81F;  // 11111 000000 11111 mask of R and B
361 #else
362         // equal number of bits, 5 bits to each color
363         mask_01111 = 0x7BCF;  // 01111 011110 01111 mask out the upper bit of R,G,B
364         mask_01110 = 0x738E;  // 01110 011100 01110 mask out the upper bit of R,G,B
365         mask_11110 = 0xF79E;  // 11110 111100 11110 mask out the lowest bit of R,G,B
366         mask_11100 = 0xE71C;  // 11100 111000 11100 mask out the lowest bits of R,G,B
367         mask_11000 = 0xC618;  // 11000 110000 11000 mask out the lowest bits of R,G,B
368         mask_r = 0xF800;  // 11111 000000 00000 mask of R
369         mask_g = 0x07C0;  // 00000 111110 00000 mask of G (5 bit each)
370         mask_b = 0x001F;  // 00000 000000 11111 mask of B
371         mask_rb = 0xF81F;  // 11111 000000 11111 mask of R and B
372 #endif
373         shift_r = 11;
374         shift_g = 5;
375         shift_b = 0;
376         goto highcolor_common;
377 #endif
378 
379 #if defined( ENABLE_DRAW15 ) || defined( ENABLE_DRAW16 )
380      highcolor_common:
381         CONS_Printf ("using highcolor mode\n");
382 
383         colfunc = basecolfunc = R_DrawColumn_16;
384         skincolfunc = R_DrawTranslatedColumn_16;
385         transcolfunc = R_DrawTranslucentColumn_16;
386         shadecolfunc = R_DrawShadeColumn_16;
387         fogcolfunc = R_DrawFogColumn_16;
388 #ifdef ENABLE_DRAW_ALPHA
389         alpha_colfunc = R_DrawAlphaColumn_16;
390 #endif
391 
392         spanfunc = basespanfunc = R_DrawSpan_16;
393         fogspanfunc = R_DrawFogSpan_16;
394         transspanfunc = R_DrawTranslucentSpan_16;
395 
396         skintranscolfunc = R_DrawTranslatedTranslucentColumn_16;
397 
398         // FIXME: quick fix to think more..
399         skydrawerfunc[0] = R_DrawColumn_16;
400         skydrawerfunc[1] = R_DrawSkyColumn_16;
401         break;
402 #endif
403 #ifdef ENABLE_DRAW24
404      case 24:
405         vid.drawmode = DRAW24;
406         colfunc = basecolfunc = R_DrawColumn_24;
407         skincolfunc = R_DrawTranslatedColumn_24;
408         transcolfunc = R_DrawTranslucentColumn_24;
409         shadecolfunc = R_DrawShadeColumn_24;
410         fogcolfunc = R_DrawFogColumn_24;
411 #ifdef ENABLE_DRAW_ALPHA
412         alpha_colfunc = R_DrawAlphaColumn_24;
413 #endif
414 
415         spanfunc = basespanfunc = R_DrawSpan_24;
416         fogspanfunc = R_DrawFogSpan_24;
417         transspanfunc = R_DrawTranslucentSpan_24;
418 
419         skintranscolfunc = R_DrawTranslatedTranslucentColumn_24;
420 
421         // FIXME: quick fix to think more..
422         skydrawerfunc[0] = R_DrawColumn_24;
423         skydrawerfunc[1] = R_DrawSkyColumn_24;
424         break;
425 #endif
426 #ifdef ENABLE_DRAW32
427      case 32:
428         vid.drawmode = DRAW32;
429         colfunc = basecolfunc = R_DrawColumn_32;
430         skincolfunc = R_DrawTranslatedColumn_32;
431         transcolfunc = R_DrawTranslucentColumn_32;
432         shadecolfunc = R_DrawShadeColumn_32;
433         fogcolfunc = R_DrawFogColumn_32;
434 #ifdef ENABLE_DRAW_ALPHA
435         alpha_colfunc = R_DrawAlphaColumn_32;
436 #endif
437 
438         spanfunc = basespanfunc = R_DrawSpan_32;
439         fogspanfunc = R_DrawFogSpan_32;
440         transspanfunc = R_DrawTranslucentSpan_32;
441 
442         skintranscolfunc = R_DrawTranslatedTranslucentColumn_32;
443 
444         // FIXME: quick fix to think more..
445         skydrawerfunc[0] = R_DrawColumn_32;
446         skydrawerfunc[1] = R_DrawSkyColumn_32;
447         break;
448 #endif
449      default:
450         goto bpp_err;
451     }
452 
453     V_SetPalette (0);
454 
455     // set fuzzcolfunc
456     CV_Fuzzymode_OnChange();
457 
458     if( rendermode_recalc )
459     {
460 #ifdef HWRENDER
461         byte new_HWR_patchstore = HWR_patchstore;
462         // must release with the proper patchstore setting
463         HWR_patchstore = old_HWR_patchstore;
464 #endif
465 
466         // release (if already loaded)
467         HU_Release_Graphics();  // need this until last second, for fonts
468 
469         // Setup patch load, again.
470 #ifdef HWRENDER
471         HWR_patchstore = new_HWR_patchstore;
472 #endif
473         HU_Load_Graphics();  // Load the console fonts.
474         ST_Load_Graphics();  // Doom and Heretic
475         WI_Load_Data();
476 #ifdef HWRENDER
477         if( rendermode != render_soft )
478         {
479             HWR_Preload_Graphics();
480         }
481 #endif
482         R_Load_Corona();
483         R_Setup_SkyDraw();
484      }
485 
486  done:
487      setmodeneeded.modetype = MODE_NOP;  // NULL
488      return;
489 
490  bpp_err:
491      I_Error ("SetMode: cannot draw %i bits per pixel\n", vid.bitpp);
492 }
493 
494 
495 // change drawer function when fuzzymode is changed
CV_Fuzzymode_OnChange(void)496 void CV_Fuzzymode_OnChange(void)
497 {
498   if( (rendermode != render_soft) && cv_fuzzymode.EV )
499       GenPrintf(EMSG_hud, "OpenGL has only translucent shadow.\n" );
500   switch(vid.drawmode)
501   {
502    default:
503    case DRAW8PAL:
504      fuzzcolfunc = (cv_fuzzymode.EV) ? R_DrawFuzzColumn_8 : R_DrawTranslucentColumn_8;
505      break;
506 #if defined(ENABLE_DRAW15) || defined(ENABLE_DRAW16)
507    case DRAW15:
508    case DRAW16:
509      fuzzcolfunc = (cv_fuzzymode.EV) ? R_DrawFuzzColumn_16 : R_DrawTranslucentColumn_16;
510      break;
511 #endif
512 #ifdef ENABLE_DRAW24
513    case DRAW24:
514      fuzzcolfunc = (cv_fuzzymode.EV) ? R_DrawFuzzColumn_24 : R_DrawTranslucentColumn_24;
515      break;
516 #endif
517 #ifdef ENABLE_DRAW32
518    case DRAW32:
519      fuzzcolfunc = (cv_fuzzymode.EV) ? R_DrawFuzzColumn_32 : R_DrawTranslucentColumn_32;
520      break;
521 #endif
522   }
523 }
524 
525 
526 
527 //  do some initial settings for the game loading screen
528 //
529 // Dependent upon vid settings
530 // May be called more than once
SCR_Startup(void)531 void SCR_Startup (void)
532 {
533     if(dedicated)
534         return;
535 
536     V_Setup_VideoDraw();
537 
538 #ifdef USEASM
539     ASM_PatchRowBytes(vid.ybytes);
540 #endif
541 
542     // Called too early to get Doom palette from wad.
543     V_Setup_Wad_VideoResc();
544 
545     V_SetPalette (0);
546 }
547 
548 
549 //added:24-01-98:
550 //
551 // Recalc settings for game drawing, trigger updates to view size and status bar.
552 // Called at new frame, if the video mode has changed
553 // Called from D_DoomLoop upon entry, after SCR_SetMode.
554 // Called from D_Display upon video mode change, after SCR_SetMode.
SCR_Recalc(void)555 void SCR_Recalc (void)
556 {
557     if( ! vid.recalc )
558         return;
559 
560     if( dedicated )
561         return;
562 
563     V_Setup_Wad_VideoResc();
564 
565     // patch the asm code depending on vid buffer rowbytes
566 #ifdef USEASM
567     ASM_PatchRowBytes(vid.ybytes);
568 #endif
569 
570     // toggle off automap because some screensize-dependent values will
571     // be calculated next time the automap is activated.
572     if (automapactive)
573         AM_Stop();
574 
575     // fuzzoffsets for the 'spectre' effect,... this is a quick hack for
576     // compatibility, because I don't use it anymore since transparency
577     // looks much better.
578     R_RecalcFuzzOffsets();
579 
580         // r_plane stuff : visplanes, openings, floorclip, ceilingclip, spanstart,
581         //                 spanstop, yslope, distscale, cachedheight, cacheddistance,
582         //                 cachedxstep, cachedystep
583         //              -> allocated at the maximum vidsize, static.
584 
585     // r_main : x_to_viewangle, allocated at the maximum size.
586     // r_things : clip_screen_top_min, clip_screen_bot_max allocated max. size.
587 
588     // scr_viewsize doesn't change, neither detailLevel, but the pixels
589     // per screenblock is different now, since we've changed resolution.
590     R_SetViewSize ();   //just set setsizeneeded true now ..
591 
592     // vid.recalc lasts only for the next refresh...
593     con_recalc = true;
594 //    CON_ToggleOff ();  // make sure con height is right for new screen height
595 
596     stbar_recalc = true;
597     am_recalc = true;
598 }
599 
600 
601 // Apply the config video settings.
SCR_apply_video_settings(void)602 void SCR_apply_video_settings( void )
603 {
604     // command line settings have precedence
605     if( ! req_command_video_settings )
606     {
607         req_width = cv_scr_width.value;
608         req_height = cv_scr_height.value;
609         req_bitpp = cv_scr_depth.value;
610     }
611 
612     if( verbose )
613     {
614         CONS_Printf("Request video: %d x %d (%d bits)\n", req_width, req_height, req_bitpp );
615     }
616 
617     // returns -1 if not found, (no mode change)
618     setmodeneeded = VID_GetModeForSize( req_width, req_height, vid_mode_table[cv_fullscreen.EV] );
619 }
620 
621 
622 //added:03-02-98: sets the modenum as the new default video mode to be saved
623 //                in the config file
SCR_SetDefaultMode(void)624 void SCR_SetDefaultMode (void)
625 {
626     // remember the default screen size
627     CV_SetValue (&cv_scr_width,  vid.width);
628     CV_SetValue (&cv_scr_height, vid.height);
629     CV_SetValue (&cv_scr_depth,  vid.bitpp);
630     //    CV_SetValue (&cv_fullscreen, vid.fullscreen); // metzgermeister: unnecessary?
631 }
632 
633 // Change fullscreen on/off according to cv_fullscreen
SCR_ChangeFullscreen(void)634 void SCR_ChangeFullscreen (void)
635 {
636     // used to prevent switching to fullscreen during startup
637     if (!allow_fullscreen)  // by I_RequestFullGraphics
638     {
639         cv_fullscreen.EV = 0;
640         return;
641     }
642 
643 //    if( graphics_state >= VGS_fullactive )  // by I_RequestFullGraphics
644 //    if( graphics_state >= VGS_active )  //  by I_StartupGraphics()
645     if( graphics_state >= VGS_startup )  // by I_StartupGraphics()
646     {
647         // I_RequestFullGraphics can cancel allow_fullscreen
648         cv_fullscreen.EV = cv_fullscreen.value;
649         SCR_apply_video_settings();
650     }
651 }
652