📄 d_main.c
字号:
// clean up border stuff // see if the border needs to be initially drawn if (gamestate == GS_LEVEL) { if( oldgamestate != GS_LEVEL ) { viewactivestate = false; // view was not active R_FillBackScreen (); // draw the pattern into the back screen } // see if the border needs to be updated to the screen if( !automapactive && (scaledviewwidth!=vid.width) ) { // the menu may draw over parts out of the view window, // which are refreshed only when needed if (menuactive || menuactivestate || !viewactivestate) borderdrawcount = 3; if (borderdrawcount) { R_DrawViewBorder (); // erase old menu stuff borderdrawcount--; } } // draw the view directly if( !automapactive ) { if( players[displayplayer].mo ) {#ifdef CLIENTPREDICTION2 players[displayplayer].mo->flags2 |= MF2_DONTDRAW;#endif#ifdef HWRENDER if( rendermode != render_soft ) HWR_RenderPlayerView (0, &players[displayplayer]); else //if (rendermode == render_soft)#endif R_RenderPlayerView (&players[displayplayer]);#ifdef CLIENTPREDICTION2 players[displayplayer].mo->flags2 &=~MF2_DONTDRAW;#endif } // added 16-6-98: render the second screen if( secondarydisplayplayer != consoleplayer && players[secondarydisplayplayer].mo) {#ifdef CLIENTPREDICTION2 players[secondarydisplayplayer].mo->flags2 |= MF2_DONTDRAW;#endif#ifdef HWRENDER if ( rendermode != render_soft ) HWR_RenderPlayerView (1, &players[secondarydisplayplayer]); else #endif { //faB: Boris hack :P !! viewwindowy = vid.height/2; memcpy(ylookup,ylookup2,viewheight*sizeof(ylookup[0])); R_RenderPlayerView (&players[secondarydisplayplayer]); viewwindowy = 0; memcpy(ylookup,ylookup1,viewheight*sizeof(ylookup[0])); }#ifdef CLIENTPREDICTION2 players[secondarydisplayplayer].mo->flags2 &=~MF2_DONTDRAW;#endif } } HU_Drawer (); ST_Drawer (redrawsbar); } // change gamma if needed if (gamestate != oldgamestate && gamestate != GS_LEVEL) V_SetPalette (0); menuactivestate = menuactive; viewactivestate = viewactive; oldgamestate = wipegamestate = gamestate; // draw pause pic if (paused && (!menuactive || netgame)) { patch_t* patch; if (automapactive) y = 4; else y = viewwindowy+4; patch = W_CachePatchName ("M_PAUSE", PU_CACHE); V_DrawScaledPatch(viewwindowx+(BASEVIDWIDTH - patch->width)/2, y,0,patch); } //added:24-01-98:vid size change is now finished if it was on... vid.recalc = 0; //FIXME: draw either console or menu, not the two CON_Drawer (); M_Drawer (); // menu is drawn even on top of everything NetUpdate (); // send out any new accumulation//// normal update// if (!wipe) { if( cv_netstat.value ) { char s[50]; Net_GetNetStat(); sprintf(s,"get %d b/s",getbps); V_DrawStringWhite (BASEVIDWIDTH-V_StringWidth (s),BASEVIDHEIGHT-ST_HEIGHT-40,s); sprintf(s,"send %d b/s",sendbps); V_DrawStringWhite (BASEVIDWIDTH-V_StringWidth (s),BASEVIDHEIGHT-ST_HEIGHT-30,s); sprintf(s,"GameMiss %.2f%%",gamelostpercent); V_DrawStringWhite (BASEVIDWIDTH-V_StringWidth (s),BASEVIDHEIGHT-ST_HEIGHT-20,s); sprintf(s,"SysMiss %.2f%%",lostpercent); V_DrawStringWhite (BASEVIDWIDTH-V_StringWidth (s),BASEVIDHEIGHT-ST_HEIGHT-10,s); }#ifdef TILTVIEW //added:12-02-98: tilt view when marine dies... just for fun if (gamestate == GS_LEVEL && cv_tiltview.value && players[displayplayer].playerstate==PST_DEAD ) { V_DrawTiltView (screens[0]); } else#endif#ifdef PERSPCORRECT if (gamestate == GS_LEVEL && cv_perspcorr.value ) { V_DrawPerspView (screens[0], players[displayplayer].aiming); } else#endif { //I_BeginProfile(); I_FinishUpdate (); // page flip or blit buffer //CONS_Printf ("last frame update took %d\n", I_EndProfile()); } return; }//// wipe update// if(!cv_screenslink.value) return; wipe_EndScreen(0, 0, vid.width, vid.height); wipestart = I_GetTime () - 1; y=wipestart+2*TICRATE; // init a timeout do { do { nowtime = I_GetTime (); tics = nowtime - wipestart; } while (!tics); wipestart = nowtime; done = wipe_ScreenWipe (cv_screenslink.value-1 , 0, 0, vid.width, vid.height, tics); I_OsPolling (); I_UpdateNoBlit (); M_Drawer (); // menu is drawn even on top of wipes I_FinishUpdate (); // page flip or blit buffer } while (!done && I_GetTime()<(unsigned)y); ST_Invalidate();}// =========================================================================// D_DoomLoop// =========================================================================tic_t rendergametic,oldentertics;boolean supdate;void D_DoomLoop (void){ tic_t oldentertics,entertic,realtics,rendertimeout=-1; if (demorecording) G_BeginRecording (); // user settings COM_BufAddText ("exec autoexec.cfg\n"); // end of loading screen: CONS_Printf() will no more call FinishUpdate() con_startup = false; CONS_Printf ("I_StartupKeyboard...\n"); I_StartupKeyboard ();#ifdef __WIN32__ CONS_Printf ("I_StartupMouse...\n"); I_DoStartupMouse ();#endif oldentertics = I_GetTime (); // make sure to do a d_display to init mode _before_ load a level SCR_SetMode(); // change video mode SCR_Recalc(); while (1) { // get real tics entertic = I_GetTime (); realtics = entertic - oldentertics; oldentertics = entertic; // frame syncronous IO operations // UNUSED for the moment (18/12/98) I_StartFrame ();#ifdef HW3SOUND HW3S_BeginFrameUpdate();#endif // process tics (but maybe not if realtic==0) TryRunTics (realtics);#ifdef CLIENTPREDICTION2 if(singletics || supdate)#else if(singletics || gametic>rendergametic)#endif { rendergametic=gametic; rendertimeout=entertic+TICRATE/17; //added:16-01-98:consoleplayer -> displayplayer (hear sounds from viewpoint) S_UpdateSounds (); // move positional sounds // Update display, next frame, with current state. D_Display (); supdate=false; } else if( rendertimeout < entertic ) // in case the server hang or netsplit D_Display (); // Win32 exe uses DirectSound..#if !defined( __WIN32__) && !defined( __OS2__) // //Other implementations might need to update the sound here. //#ifndef SNDSERV // Sound mixing for the buffer is snychronous. I_UpdateSound();#endif // Synchronous sound output is explicitly called.#ifndef SDL#ifndef SNDINTR // Update sound output. I_SubmitSound();#endif#endif#endif //__WIN32__ // check for media change, loop music.. I_UpdateCD ();#ifdef HW3SOUND HW3S_EndFrameUpdate();#endif }}// =========================================================================// D_AdvanceDemo// =========================================================================//// D_PageTicker// Handles timing for warped projection//void D_PageTicker (void){ if (--pagetic < 0) D_AdvanceDemo ();}//// D_PageDrawer : draw a patch supposed to fill the screen,// fill the borders with a background pattern (a flat)// if the patch doesn't fit all the screen.//void D_PageDrawer (char* lumpname){ byte* src; byte* dest; int x; int y; // software mode which uses generally lower resolutions doesn't look // good when the pic is scaled, so it fills space aorund with a pattern, // and the pic is only scaled to integer multiples (x2, x3...) if (rendermode==render_soft) { if( (vid.width>BASEVIDWIDTH) || (vid.height>BASEVIDHEIGHT) ) { src = scr_borderpatch; dest = screens[0]; for (y=0; y<vid.height; y++) { for (x=0; x<vid.width/64; x++) { memcpy(dest, src+((y&63)<<6), 64); dest += 64; } if (vid.width&63) { memcpy(dest, src+((y&63)<<6), vid.width&63); dest += (vid.width&63); } } } } if (raven && demosequence != 2) // big hack for legacy's credits { V_DrawRawScreen(0, 0, W_GetNumForName(lumpname), 320, 200); if( demosequence == 0 && pagetic<=140 ) V_DrawScaledPatch(4, 160, 0, W_CachePatchName("ADVISOR", PU_CACHE)); } else V_DrawScaledPatch(0,0, 0, W_CachePatchName(lumpname, PU_CACHE) ); //added:08-01-98:if you wanna centre the pages it's here. // I think it's not so beautiful to have the pic centered, // so I leave it in the upper-left corner for now... //V_DrawPatch (0,0, 0, W_CachePatchName(pagename, PU_CACHE));}//// D_AdvanceDemo// Called after each demo or intro demosequence finishes//void D_AdvanceDemo (void){ advancedemo = true;}//// This cycles through the demo sequences.// FIXME - version dependend demo numbers?//void D_DoAdvanceDemo (void){ players[consoleplayer].playerstate = PST_LIVE; // not reborn advancedemo = false; gameaction = ga_nothing; if ( gamemode == retail ) demosequence = (demosequence+1)%7; else demosequence = (demosequence+1)%6; switch (demosequence) { case 0: pagename = "TITLEPIC"; switch( gamemode ) { case hexen : case heretic : pagetic = 210+140; pagename = "TITLE"; S_StartMusic(mus_htitl); break; case commercial : pagetic = TICRATE * 11; S_StartMusic(mus_dm2ttl); break; default : pagetic = 170; S_StartMusic (mus_intro); break; } gamestate = GS_DEMOSCREEN; break; case 1: G_DeferedPlayDemo ("demo1"); pagetic = 9999999; break; case 2: pagetic = 200; gamestate = GS_DEMOSCREEN; pagename = "CREDIT"; break; case 3: G_DeferedPlayDemo ("demo2"); pagetic = 9999999; break; case 4: gamestate = GS_DEMOSCREEN; if ( gamemode == commercial) { pagetic = TICRATE * 11; pagename = "TITLEPIC"; S_StartMusic(mus_dm2ttl); } else if( gamemode == heretic ) { pagetic = 200; if(W_CheckNumForName("e2m1")==-1) pagename = "ORDER"; else pagename = "CREDIT"; } else { pagetic = 200; if ( gamemode == retail ) pagename = text[CREDIT_NUM]; else pagename = text[HELP2_NUM];
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -