|
|
1.1.1.2 ! root 1: /* ! 2: Copyright (C) 1997-2001 Id Software, Inc. ! 3: ! 4: This program is free software; you can redistribute it and/or ! 5: modify it under the terms of the GNU General Public License ! 6: as published by the Free Software Foundation; either version 2 ! 7: of the License, or (at your option) any later version. ! 8: ! 9: This program is distributed in the hope that it will be useful, ! 10: but WITHOUT ANY WARRANTY; without even the implied warranty of ! 11: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. ! 12: ! 13: See the GNU General Public License for more details. ! 14: ! 15: You should have received a copy of the GNU General Public License ! 16: along with this program; if not, write to the Free Software ! 17: Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ! 18: ! 19: */ 1.1 root 20: // vid_null.c -- null video driver to aid porting efforts 21: // this assumes that one of the refs is statically linked to the executable 22: 23: #include "../client/client.h" 24: 25: viddef_t viddef; // global video state 26: 27: refexport_t re; 28: 29: refexport_t GetRefAPI (refimport_t rimp); 30: 31: /* 32: ========================================================================== 33: 34: DIRECT LINK GLUE 35: 36: ========================================================================== 37: */ 38: 39: #define MAXPRINTMSG 4096 40: void VID_Printf (int print_level, char *fmt, ...) 41: { 42: va_list argptr; 43: char msg[MAXPRINTMSG]; 44: 45: va_start (argptr,fmt); 46: vsprintf (msg,fmt,argptr); 47: va_end (argptr); 48: 49: if (print_level == PRINT_ALL) 50: Com_Printf ("%s", msg); 51: else 52: Com_DPrintf ("%s", msg); 53: } 54: 55: void VID_Error (int err_level, char *fmt, ...) 56: { 57: va_list argptr; 58: char msg[MAXPRINTMSG]; 59: 60: va_start (argptr,fmt); 61: vsprintf (msg,fmt,argptr); 62: va_end (argptr); 63: 64: Com_Error (err_level, "%s", msg); 65: } 66: 67: void VID_NewWindow (int width, int height) 68: { 69: viddef.width = width; 70: viddef.height = height; 71: } 72: 73: /* 74: ** VID_GetModeInfo 75: */ 76: typedef struct vidmode_s 77: { 78: const char *description; 79: int width, height; 80: int mode; 81: } vidmode_t; 82: 83: vidmode_t vid_modes[] = 84: { 85: { "Mode 0: 320x240", 320, 240, 0 }, 86: { "Mode 1: 400x300", 400, 300, 1 }, 87: { "Mode 2: 512x384", 512, 384, 2 }, 88: { "Mode 3: 640x480", 640, 480, 3 }, 89: { "Mode 4: 800x600", 800, 600, 4 }, 90: { "Mode 5: 960x720", 960, 720, 5 }, 91: { "Mode 6: 1024x768", 1024, 768, 6 }, 92: { "Mode 7: 1152x864", 1152, 864, 7 }, 93: { "Mode 8: 1280x960", 1280, 960, 8 }, 1.1.1.2 ! root 94: { "Mode 9: 1600x1200", 1600, 1200, 9 }, ! 95: { "Mode 10: 2048x1536", 2048, 1536, 10 } 1.1 root 96: }; 97: #define VID_NUM_MODES ( sizeof( vid_modes ) / sizeof( vid_modes[0] ) ) 98: 99: qboolean VID_GetModeInfo( int *width, int *height, int mode ) 100: { 101: if ( mode < 0 || mode >= VID_NUM_MODES ) 102: return false; 103: 104: *width = vid_modes[mode].width; 105: *height = vid_modes[mode].height; 106: 107: return true; 108: } 109: 110: 111: void VID_Init (void) 112: { 113: refimport_t ri; 114: 115: viddef.width = 320; 116: viddef.height = 240; 117: 118: ri.Cmd_AddCommand = Cmd_AddCommand; 119: ri.Cmd_RemoveCommand = Cmd_RemoveCommand; 120: ri.Cmd_Argc = Cmd_Argc; 121: ri.Cmd_Argv = Cmd_Argv; 122: ri.Cmd_ExecuteText = Cbuf_ExecuteText; 123: ri.Con_Printf = VID_Printf; 124: ri.Sys_Error = VID_Error; 125: ri.FS_LoadFile = FS_LoadFile; 126: ri.FS_FreeFile = FS_FreeFile; 127: ri.FS_Gamedir = FS_Gamedir; 128: ri.Vid_NewWindow = VID_NewWindow; 129: ri.Cvar_Get = Cvar_Get; 130: ri.Cvar_Set = Cvar_Set; 131: ri.Cvar_SetValue = Cvar_SetValue; 132: ri.Vid_GetModeInfo = VID_GetModeInfo; 133: 134: re = GetRefAPI(ri); 135: 136: if (re.api_version != API_VERSION) 137: Com_Error (ERR_FATAL, "Re has incompatible api_version"); 138: 139: // call the init function 140: if (re.Init (NULL, NULL) == -1) 141: Com_Error (ERR_FATAL, "Couldn't start refresh"); 142: } 143: 144: void VID_Shutdown (void) 145: { 146: if (re.Shutdown) 147: re.Shutdown (); 148: } 149: 150: void VID_CheckChanges (void) 151: { 152: } 153: 154: void VID_MenuInit (void) 155: { 156: } 157: 158: void VID_MenuDraw (void) 159: { 160: } 161: 162: const char *VID_MenuKey( int k) 163: { 164: return NULL; 165: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.