-svga now works in background. NOTE: mouse and joystick are probably still

grabbed by svgalib.
This commit is contained in:
Bill Currie 2000-12-02 22:19:26 +00:00
parent 7faabf5032
commit 8ed2ff9241

View file

@ -68,6 +68,7 @@ static vga_modeinfo *modes;
static byte vid_current_palette[768]; static byte vid_current_palette[768];
static int svgalib_inited=0; static int svgalib_inited=0;
static int svgalib_backgrounded=0;
static int UseDisplay = 1; static int UseDisplay = 1;
static cvar_t *vid_mode; static cvar_t *vid_mode;
@ -90,7 +91,7 @@ D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height)
{ {
int i, j, k, plane, reps, repshift, offset, vidpage, off; int i, j, k, plane, reps, repshift, offset, vidpage, off;
if (!svgalib_inited || !vid.direct || !vga_oktowrite()) return; if (!svgalib_inited || !vid.direct || svgalib_backgrounded || !vga_oktowrite()) return;
if (vid.aspect > 1.5) { if (vid.aspect > 1.5) {
reps = 2; reps = 2;
@ -150,7 +151,7 @@ D_EndDirectRect (int x, int y, int width, int height)
{ {
int i, j, k, plane, reps, repshift, offset, vidpage, off; int i, j, k, plane, reps, repshift, offset, vidpage, off;
if (!svgalib_inited || !vid.direct || !vga_oktowrite()) return; if (!svgalib_inited || !vid.direct || svgalib_backgrounded || !vga_oktowrite()) return;
if (vid.aspect > 1.5) { if (vid.aspect > 1.5) {
reps = 2; reps = 2;
@ -444,7 +445,7 @@ VID_SetPalette(byte *palette)
int *tp; int *tp;
int i; int i;
if (!svgalib_inited) return; if (!svgalib_inited || svgalib_backgrounded) return;
memcpy(vid_current_palette, palette, sizeof(vid_current_palette)); memcpy(vid_current_palette, palette, sizeof(vid_current_palette));
@ -532,6 +533,18 @@ VID_SetMode (int modenum, unsigned char *palette)
return 1; return 1;
} }
static void
goto_background (void)
{
svgalib_backgrounded = 1;
}
static void
comefrom_background (void)
{
svgalib_backgrounded = 0;
}
void void
VID_Init(unsigned char *palette) VID_Init(unsigned char *palette)
@ -552,6 +565,15 @@ VID_Init(unsigned char *palette)
if (err) if (err)
Sys_Error("SVGALib failed to allocate a new VC\n"); Sys_Error("SVGALib failed to allocate a new VC\n");
if (vga_runinbackground_version () == 1) {
Con_Printf ("SVGALIB background support detected\n");
vga_runinbackground (VGA_GOTOBACK, goto_background);
vga_runinbackground (VGA_COMEFROMBACK, comefrom_background);
vga_runinbackground (1);
} else {
vga_runinbackground (0);
}
VID_InitModes(); VID_InitModes();
Cmd_AddCommand("vid_nummodes", VID_NumModes_f); Cmd_AddCommand("vid_nummodes", VID_NumModes_f);
@ -585,13 +607,7 @@ VID_Init(unsigned char *palette)
VID_SetMode(current_mode, palette); VID_SetMode(current_mode, palette);
VID_SetPalette(palette); VID_SetPalette(palette);
/* XoXus: Running in background is just plain bad... */
vga_runinbackground(0);
} }
/* XoXus: Why was input initialised here?!? */
/* IN_Init(); */
} }
void void
@ -607,7 +623,7 @@ VID_Init_Cvars ()
void void
VID_Update(vrect_t *rects) VID_Update(vrect_t *rects)
{ {
if (!svgalib_inited) return; if (!svgalib_inited || svgalib_backgrounded) return;
if (!vga_oktowrite()) { if (!vga_oktowrite()) {
/* Can't update screen if it's not active */ /* Can't update screen if it's not active */