⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 d_main.c

📁 The source code of Doom legacy for windows
💻 C
📖 第 1 页 / 共 4 页
字号:
// Emacs style mode select   -*- C++ -*- //-----------------------------------------------------------------------------//// $Id: d_main.c,v 1.46 2001/04/27 13:32:13 bpereira Exp $//// Copyright (C) 1993-1996 by id Software, Inc.// Portions 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: d_main.c,v $// Revision 1.46  2001/04/27 13:32:13  bpereira// no message//// Revision 1.45  2001/04/17 22:26:07  calumr// Initial Mac add//// Revision 1.44  2001/04/04 20:24:21  judgecutor// Added support for the 3D Sound//// Revision 1.43  2001/04/02 18:54:32  bpereira// no message//// Revision 1.42  2001/04/01 17:35:06  bpereira// no message//// Revision 1.41  2001/03/30 17:12:49  bpereira// no message//// Revision 1.40  2001/03/19 18:25:02  hurdler// Is there a GOOD reason to check for modified game with shareware version?//// Revision 1.39  2001/03/03 19:43:09  ydario// OS/2 code cleanup//// Revision 1.38  2001/02/24 13:35:19  bpereira// no message//// Revision 1.37  2001/02/10 12:27:13  bpereira// no message//// Revision 1.36  2001/01/25 22:15:41  bpereira// added heretic support//// Revision 1.35  2000/11/06 20:52:15  bpereira// no message//// Revision 1.34  2000/11/03 03:27:17  stroggonmeth// Again with the bug fixing...//// Revision 1.33  2000/11/02 19:49:35  bpereira// no message//// Revision 1.32  2000/11/02 17:50:06  stroggonmeth// Big 3Dfloors & FraggleScript commit!!//// Revision 1.31  2000/10/21 08:43:28  bpereira// no message//// Revision 1.30  2000/10/08 13:29:59  bpereira// no message//// Revision 1.29  2000/10/02 18:25:44  bpereira// no message//// Revision 1.28  2000/10/01 10:18:16  bpereira// no message//// Revision 1.27  2000/09/28 20:57:14  bpereira// no message//// Revision 1.26  2000/08/31 14:30:55  bpereira// no message//// Revision 1.25  2000/08/29 15:53:47  hurdler// Remove master server connect timeout on LAN (not connected to Internet)//// Revision 1.24  2000/08/21 21:13:00  metzgermeister// Implementation of I_GetKey() in Linux//// Revision 1.23  2000/08/10 14:50:19  ydario// OS/2 port//// Revision 1.22  2000/05/07 08:27:56  metzgermeister// no message//// Revision 1.21  2000/04/30 10:30:10  bpereira// no message//// Revision 1.20  2000/04/25 19:49:46  metzgermeister// support for automatic wad search//// Revision 1.19  2000/04/24 20:24:38  bpereira// no message//// Revision 1.18  2000/04/23 16:19:52  bpereira// no message//// Revision 1.17  2000/04/22 20:27:35  metzgermeister// support for immediate fullscreen switching//// Revision 1.16  2000/04/21 20:04:20  hurdler// fix a problem with my last SDL merge//// Revision 1.15  2000/04/19 15:21:02  hurdler// add SDL midi support//// Revision 1.14  2000/04/18 12:55:39  hurdler// join with Boris' code//// Revision 1.13  2000/04/16 18:38:07  bpereira// no message//// Revision 1.12  2000/04/07 23:10:15  metzgermeister// fullscreen support under X in Linux//// Revision 1.11  2000/04/06 20:40:22  hurdler// Mostly remove warnings under windows//// Revision 1.10  2000/04/05 15:47:46  stroggonmeth// Added hack for Dehacked lumps. Transparent sprites are now affected by colormaps.//// Revision 1.9  2000/04/04 00:32:45  stroggonmeth// Initial Boom compatability plus few misc changes all around.//// Revision 1.8  2000/03/29 19:39:48  bpereira// no message//// Revision 1.7  2000/03/28 16:18:41  linuxcub// Added a command to the Linux sound-server which sets a master volume.// Someone needs to check that this isn't too much of a performance drop// on slow machines. (Works for me).//// Added code to the main parts of doomlegacy which uses this command to// implement volume control for sound effects.//// Added code so the (really cool) cd music works for me. The volume didn't// work for me (with a Teac 532E drive): It always started at max (31) no-// matter what the setting in the config-file was. The added code "jiggles"// the volume-control, and now it works for me :-)// If this code is unacceptable, perhaps another solution is to periodically// compare the cd_volume.value with an actual value _read_ from the drive.// Ie. not trusting that calling the ioctl with the correct value actually// sets the hardware-volume to the requested value. Right now, the ioctl// is assumed to work perfectly, and the value in cd_volume.value is// compared periodically with cdvolume.//// Updated the spec file, so an updated RPM can easily be built, with// a minimum of editing. Where can I upload my pre-built (S)RPMS to ?//// Erling Jacobsen, linuxcub@email.dk//// Revision 1.6  2000/03/23 22:54:00  metzgermeister// added support for HOME/.legacy under Linux//// Revision 1.5  2000/03/06 17:33:36  hurdler// compiler warning removed//// Revision 1.4  2000/03/05 17:10:56  bpereira// no message//// Revision 1.3  2000/02/27 00:42:10  hurdler// fix CR+LF problem////// DESCRIPTION://      DOOM main program (D_DoomMain) and game loop (D_DoomLoop),//      plus functions to determine game mode (shareware, registered),//      parse command line parameters, configure game parameters (turbo),//      and call the startup functions.////-----------------------------------------------------------------------------#ifdef LINUX#include <sys/stat.h>#include <sys/types.h>#endif#ifndef __WIN32__#include <unistd.h>             // for access#else#include <direct.h>#endif#include <fcntl.h>#ifdef __OS2__#include "I_os2.h"#endif#include "doomdef.h"#include "command.h"#include "console.h"#include "doomstat.h"#include "am_map.h"#include "d_net.h"#include "d_netcmd.h"#include "dehacked.h"#include "dstrings.h"#include "f_wipe.h"#include "f_finale.h"#include "g_game.h"#include "g_input.h"#include "hu_stuff.h"#include "i_sound.h"#include "i_system.h"#include "i_video.h"#include "m_argv.h"#include "m_menu.h"#include "m_misc.h"#include "p_setup.h"#include "p_fab.h"#include "p_info.h"#include "r_main.h"#include "r_local.h"#include "s_sound.h"#include "st_stuff.h"#include "t_script.h"#include "v_video.h"#include "wi_stuff.h"#include "w_wad.h"#include "z_zone.h"#include "d_main.h"#include "d_netfil.h"#include "p_heretic.h"#include "m_cheat.h"#ifdef HWRENDER#include "hardware/hw_main.h"   // 3D View Rendering#endif#ifdef HW3SOUND#include "hardware/hw3sound.h"#endif////  DEMO LOOP//int             demosequence;int             pagetic;char            *pagename="TITLEPIC";//  PROTOSvoid D_PageDrawer (char* lumpname);void D_AdvanceDemo (void);#ifdef LINUXvoid VID_PrepareModeList(void); // FIXME: very dirty; will use a proper include file#endifchar*           startupwadfiles[MAX_WADFILES];boolean         devparm;        // started game with -devparmboolean         nomonsters;     // checkparm of -nomonstersboolean         singletics = false; // timedemoboolean         nomusic;    boolean         nosound;boolean         advancedemo;char            wadfile[1024];          // primary wad filechar            mapdir[1024];           // directory of development maps//// EVENT HANDLING//// Events are asynchronous inputs generally generated by the game user.// Events can be discarded if no responder claims them// referenced from i_system.c for I_GetKey()event_t         events[MAXEVENTS];int             eventhead;int             eventtail;//// D_PostEvent// Called by the I/O functions when input is detected//void D_PostEvent (const event_t* ev){    events[eventhead] = *ev;    eventhead = (++eventhead)&(MAXEVENTS-1);}// just for lock this function#ifdef PC_DOSvoid D_PostEvent_end(void) {};#endif//// D_ProcessEvents// Send all the events of the given timestamp down the responder chain//void D_ProcessEvents (void){    event_t*    ev;    for ( ; eventtail != eventhead ; eventtail = (++eventtail)&(MAXEVENTS-1) )    {        ev = &events[eventtail];        // Menu input        if (M_Responder (ev))            continue;              // menu ate the event        // console input        if (CON_Responder (ev))            continue;              // ate the event        G_Responder (ev);    }}//// D_Display//  draw current display, possibly wiping it from the previous//#ifdef __WIN32__void I_DoStartupMouse (void);   //win_sys.c#endif// wipegamestate can be set to -1 to force a wipe on the next draw// added comment : there is a wipe eatch change of the gamestategamestate_t  wipegamestate = GS_DEMOSCREEN;CV_PossibleValue_t screenslink_cons_t[]={{0,"None"},{wipe_ColorXForm+1,"Color"},{wipe_Melt+1,"Melt"},{0,NULL}};consvar_t cv_screenslink    = {"screenlink","2", CV_SAVE,screenslink_cons_t};void D_Display (void){    static  boolean             viewactivestate = false;    static  boolean             menuactivestate = false;    static  gamestate_t         oldgamestate = -1;    static  int                 borderdrawcount;    tic_t                       nowtime;    tic_t                       tics;    tic_t                       wipestart;    int                         y;    boolean                     done;    boolean                     wipe;    boolean                     redrawsbar;    if (nodrawers)        return;                    // for comparative timing / profiling    redrawsbar = false;    //added:21-01-98: check for change of screen size (video mode)    if (setmodeneeded)        SCR_SetMode();  // change video mode    if (vid.recalc)        //added:26-01-98: NOTE! setsizeneeded is set by SCR_Recalc()        SCR_Recalc();    // change the view size if needed    if( setsizeneeded )    {        R_ExecuteSetViewSize ();        oldgamestate = -1;                      // force background redraw        borderdrawcount = 3;        redrawsbar = true;    }    // save the current screen if about to wipe    if (gamestate != wipegamestate &&        rendermode == render_soft)    {        wipe = true;        wipe_StartScreen(0, 0, vid.width, vid.height);    }    else        wipe = false;    // draw buffered stuff to screen    // BP: Used only by linux GGI version    I_UpdateNoBlit ();    // do buffered drawing    switch (gamestate)    {      case GS_LEVEL:        if (!gametic)            break;        HU_Erase();        if (automapactive)            AM_Drawer ();        if (wipe || menuactivestate#ifdef HWRENDER                 || rendermode != render_soft#endif                 || vid.recalc)            redrawsbar = true;        break;      case GS_INTERMISSION:        WI_Drawer ();        break;      case GS_FINALE:        F_Drawer ();        break;      case GS_DEDICATEDSERVER:      case GS_DEMOSCREEN:        D_PageDrawer (pagename);      case GS_WAITINGPLAYERS:      case GS_NULL:        break;    }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -