📄 win_vid.c
字号:
// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id: win_vid.c,v 1.19 2001/03/30 17:12:52 bpereira Exp $
//
// Copyright (C) 1998-2000 by DooM Legacy Team.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
//
// $Log: win_vid.c,v $
// Revision 1.19 2001/03/30 17:12:52 bpereira
// no message
//
// Revision 1.18 2001/02/10 12:27:15 bpereira
// no message
//
// Revision 1.17 2001/01/25 22:15:45 bpereira
// added heretic support
//
// Revision 1.16 2001/01/06 22:21:08 judgecutor
// Added NoDirectInput mouse input
//
// Revision 1.15 2001/01/05 18:19:48 hurdler
// add renderer version checking
//
// Revision 1.14 2000/11/04 16:23:45 bpereira
// no message
//
// Revision 1.13 2000/11/02 19:49:40 bpereira
// no message
//
// Revision 1.12 2000/10/21 08:43:32 bpereira
// no message
//
// Revision 1.11 2000/10/04 16:25:57 hurdler
// Change all those "3dfx names" to more appropriate names
//
// Revision 1.10 2000/10/01 10:18:23 bpereira
// no message
//
// Revision 1.9 2000/09/28 20:57:22 bpereira
// no message
//
// Revision 1.8 2000/09/25 19:30:17 hurdler
// Enable Direct3D support as OpenGL
//
// Revision 1.7 2000/09/01 19:34:38 bpereira
// no message
//
// Revision 1.6 2000/08/10 19:58:05 bpereira
// no message
//
// Revision 1.5 2000/08/10 17:04:22 hurdler
// add ticrate to hardware mode
//
// Revision 1.4 2000/08/10 14:19:56 hurdler
// add waitvbl
//
// Revision 1.3 2000/02/27 00:42:12 hurdler
// fix CR+LF problem
//
// Revision 1.2 2000/02/26 00:28:42 hurdler
// Mostly bug fix (see borislog.txt 23-2-2000, 24-2-2000)
//
//
// DESCRIPTION:
// win32 video driver for Doom Legacy
//
//-----------------------------------------------------------------------------
#include "../doomdef.h"
#include <stdlib.h>
#include <stdarg.h>
#include "../i_system.h"
#include "../m_argv.h"
#include "../v_video.h"
#include "../st_stuff.h"
#include "../i_video.h"
#include "../z_zone.h"
#include "fabdxlib.h" //wow! I can make use of my win32 test stuff!!
#include "win_main.h"
#include "win_vid.h"
#include "win_dll.h" //loading the Glide Render DLL
#include "../hardware/hw_drv.h" //calling Driver Init & Shutdown
#include "../hardware/hw_main.h" //calling HWR module Init & Shutdown
// -------
// Globals
// -------
// this is the CURRENT rendermode!! very important : used by w_wad, and many other code
rendermode_t rendermode=render_soft;
// synchronize page flipping with screen refresh
consvar_t cv_vidwait = {"vid_wait","1",CV_SAVE,CV_OnOff};
boolean highcolor;
static BOOL bDIBMode; // means we are using DIB instead of DirectDraw surfaces
static BITMAPINFO* bmiMain = NULL;
static HDC hDCMain = NULL;
// -----------------
// Video modes stuff
// -----------------
#define MAX_EXTRA_MODES 30
static vmode_t extra_modes[MAX_EXTRA_MODES] = {{NULL, NULL}};
static char names[MAX_EXTRA_MODES][10];
static int totalvidmem;
int numvidmodes; //total number of DirectDraw display modes
vmode_t *pvidmodes; //start of videomodes list.
vmode_t *pcurrentmode; // the current active videomode.
static int VID_SetWindowedDisplayMode (viddef_t *lvid, vmode_t *pcurrentmode);
// this holds description of the startup video mode,
// the resolution is 320x200, windowed on the desktop
#define NUMSPECIALMODES 1
vmode_t specialmodes[NUMSPECIALMODES] = {
{
NULL,
"320x200W", //faB: W to make sure it's the windowed mode
320, 200, //(200.0/320.0)*(320.0/240.0),
320, 1, // rowbytes, bytes per pixel
1, 2, // windowed (TRUE), numpages
NULL,
VID_SetWindowedDisplayMode,
0 // misc
}
};
// ------
// Protos
// ------
static void VID_Command_NumModes_f (void);
static void VID_Command_ModeInfo_f (void);
static void VID_Command_ModeList_f (void);
static void VID_Command_Mode_f (void);
static int VID_SetDirectDrawMode (viddef_t *lvid, vmode_t *pcurrentmode);
static int VID_SetWindowedDisplayMode (viddef_t *lvid, vmode_t *pcurrentmode);
vmode_t *VID_GetModePtr (int modenum);
void VID_Init (void);
// judgecutor:
extern void I_RestartSysMouse();
// -----------------
// I_StartupGraphics
// Initialize video mode, setup dynamic screen size variables,
// and allocate screens.
// -----------------
void I_StartupGraphics(void)
{
if (graphics_started)
return;
// 0 for 256 color, else use highcolor modes
//highcolor = M_CheckParm ("-highcolor");
if (M_CheckParm ("-3dfx"))
rendermode = render_glide;
else if (M_CheckParm ("-opengl"))
rendermode = render_opengl;
else if (M_CheckParm ("-minigl")) // MiniGL is considered like ...
rendermode = render_opengl; // ... OpenGL in the main code
else if (M_CheckParm ("-d3d"))
rendermode = render_d3d;
else
rendermode = render_soft;
VID_Init();
//added:03-01-98: register exit code for graphics
I_AddExitFunc (I_ShutdownGraphics);
graphics_started = TRUE;
}
// ------------------
// I_ShutdownGraphics
// Close the screen, restore previous video mode.
// ------------------
void I_ShutdownGraphics (void)
{
if (!graphics_started)
return;
CONS_Printf ("I_ShutdownGraphics()\n");
// release windowed startup stuff
if (hDCMain) {
ReleaseDC (hWndMain, hDCMain);
hDCMain = NULL;
}
if (bmiMain) {
GlobalFree (bmiMain);
bmiMain = NULL;
}
if ( rendermode != render_soft )
{
// Hurdler: swap des deux lignes comme 鏰 on close
// l'environnement OpenGL/glide apr鑣 avoir
// vid
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -