?? d_main.c
字號:
&RenderViewWindowBuffer);
}
else
{
R_RenderPlayerView (&players[displayplayer],
-((fixed_t)(EyeOffset+1)/2 << FRACBITS),
-Yaw,
&RenderViewWindowBuffer);
}
// DQ end addition
// R_RenderPlayerView (&players[displayplayer]); // original line
}
if (bInGame) // DQ
{
if (gamestate == GS_LEVEL && gametic)
{
// DQ start addition
// always positive offset, so doesn't fall off of left of edge.
// set from edge by 1, as the stereo appears better when not
// adjacent to the edge
HU_Drawer ((iEyeCounter == 0 ? 0 : TextEyeOffset), &RenderBuffer);
// DQ end addition
// HU_Drawer (); // original line
}
// clean up border stuff
if (gamestate != oldgamestate && gamestate != GS_LEVEL)
{
I_SetPalette (W_CacheLumpName ("PLAYPAL",PU_CACHE));
}
// see if the border needs to be initially drawn
if (gamestate == GS_LEVEL && oldgamestate != GS_LEVEL)
{
viewactivestate = false; // view was not active
R_FillBackScreen (&BackgroundBuffer/*DQ*/); // draw the pattern into the back screen
}
// see if the border needs to be updated to the screen
if (gamestate == GS_LEVEL &&
((!automapactive && scaledviewwidth != SCREENWIDTH && viewheight != SCREENHEIGHT)
|| StatusBarRepeat > 0)) // DQ
//if (gamestate == GS_LEVEL && !automapactive && scaledviewwidth != SCREENWIDTH && viewheight != SCREENHEIGHT)
{
if (menuactive || menuactivestate || !viewactivestate)
borderdrawcount = 3;
if (borderdrawcount)
{
R_DrawViewBorder(&RenderBuffer/*DQ*/, &BackgroundBuffer/*DQ*/); // erase old menu stuff
if (iEyeCounter == 1) // DQ
{
borderdrawcount--;
}
}
}
// DQ moved these out of the loop, so they would be the same for both eyes
//menuactivestate = menuactive;
//viewactivestate = viewactive;
//inhelpscreensstate = inhelpscreens;
//oldgamestate = wipegamestate = gamestate;
// DQ end
// draw pause pic
if (paused)
{
if (automapactive)
y = 4;
else
y = viewwindowy+4;
// DQ start addition
// show pause behind the menu (2/3 full distance)
V_DrawPatchDirect(viewwindowx+(scaledviewwidth-68)/2
+ (iEyeCounter == 0 ? -(TextEyeOffset/3) : (TextEyeOffset+2)/3),
y,&RenderBuffer, W_CacheLumpName ("M_PAUSE", PU_CACHE));
// DQ end addition
// V_DrawPatchDirect(viewwindowx+(scaledviewwidth-68)/2,y,0,W_CacheLumpName ("M_PAUSE", PU_CACHE));
}
}
// menus go directly to the screen
// DQ start addition
// return to the menu we were using at the start of this loop. Record the new menu,
// so that we can return to the new selection at the end of the loop. I would prefer
// to not have globals - menuactive and currentMenu. Instead, I would prefer to
// pass the menu to draw as a parameter to M_Drawer. But, I wanted to make the changes
// as minimal as possible. DQFIXME - Perhaps I will return to this later, and add a
// parameter to M_Drawer, and all downstream functions.
Newmenuactive = menuactive; // in case it changes
NewcurrentMenu = currentMenu;
NewitemOn = itemOn;
NewlastOn = currentMenu->lastOn;
menuactive = Prevmenuactive; // so the menu will be drawn the same for both eyes
currentMenu = PrevcurrentMenu;
itemOn = PrevitemOn;
currentMenu->lastOn = PrevlastOn;
if (bInGame)
{
M_Drawer ((iEyeCounter == 0 ? -(TextEyeOffset/2) : (TextEyeOffset+1)/2), &RenderBuffer); // menu is drawn even on top of everything
}
menuactive = Newmenuactive;
currentMenu = NewcurrentMenu;
itemOn = NewitemOn;
currentMenu->lastOn = NewlastOn;
// menu can end the game
// DQ end addition
// original commands:
// M_Drawer (); // menu is drawn even on top of everything
if (bInGame) // DQ
{
CO_Drawer(&RenderBuffer/*DQ*/); // Console is drawn on top of even the menu...
NetUpdate (); // send out any new accumulation
}
if (bInGame)
{
// normal update
if (!wipe)
{
done = TRUE; // DQ
// DQ moved I_FinishUpdate to after the end screens were captured for the wipe
// I_FinishUpdate (); // page flip or blit buffer
// return; // original return
}
// DQ start addition
if (wipe)
{
// if we are wiping, capture the newly rendered screen as the end screen,
// but do not show it. It will be shown during the wipe
if (iEyeCounter == 0)
{
if (RightEndScreen == NULL)
{
RightEndScreen = (byte *)malloc(SCREENWIDTH * SCREENHEIGHT);
RightEndBuffer.Buffer = RightEndScreen;
RightEndBuffer.YLookup = ScreensYLookup;
}
wipe_RightEndScreen(&RightEndBuffer, &RenderBuffer);
}
else
{
wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT,
&LeftEndBuffer,
&RenderBuffer);
}
// If we are going to wipe, we will copy the start image back into this render
// buffer. The new image, which was just captured, will be displayed at the
// end of the wipe
I_ReadScreen(&RenderBuffer, &StartBuffer);
}
if (bInGame)
{
I_FinishUpdate (iEyeCounter == 1, bStereo, &RenderBuffer); // if wiping, don't display
}
}
} // end eye counter loop
if (wipe && bInGame)
{
wipestart = I_GetTime () - 1;
done = FALSE;
do
{
do
{
nowtime = I_GetTime ();
tics = nowtime - wipestart;
}
while(!tics);
wipestart = nowtime;
// display each eye's wipe. The right end is in RightEndScreen, the left end is in
// screens[3]. Rather than change the wiping logic to work with an arbitrary
// surface, we will make my changes work with the old logic of expecting screens[3]
// as the end, screens[2] as the original, and RenderBuffer as the wiped image
// to do this, we will swap screens[3] and RightEndScreen, thus using screens[3] as the
// end screen.
for (iEyeCounter = (bStereo ? 0 : 1);
iEyeCounter < 2;
iEyeCounter++) // 0 = right, 1 = left
{
GetRenderBuffer(iEyeCounter == 1, bStereo, &RenderBuffer, &RenderViewWindowBuffer);
if (RightEndScreen != NULL && bStereo && iEyeCounter == 0)
{
done |= wipe_ScreenWipe(wipe_Melt,
0, 0,
SCREENWIDTH, SCREENHEIGHT,
tics,
(iEyeCounter == 1),
&RenderBuffer,
&StartBuffer,
&RightEndBuffer); // DQ
}
else
{
done |= wipe_ScreenWipe(wipe_Melt,
0, 0,
SCREENWIDTH, SCREENHEIGHT,
tics,
(iEyeCounter == 1),
&RenderBuffer,
&StartBuffer,
&LeftEndBuffer); // DQ
}
I_UpdateNoBlit ();
M_Drawer (iEyeCounter == 0 ? -(TextEyeOffset/2) : (TextEyeOffset+1)/2, &RenderBuffer/*DQ*/); // menu is drawn even on top of everything
CO_Drawer(&RenderBuffer);
if (bInGame)
{
I_FinishUpdate (iEyeCounter == 1, bStereo, &RenderBuffer); // page flip or blit buffer
}
}
}
while(!done);
}
if (RightEndScreen != NULL)
{
free(RightEndScreen);
}
// DQ end addition
menuactivestate = menuactive;
viewactivestate = viewactive;
inhelpscreensstate = inhelpscreens;
oldgamestate = wipegamestate = gamestate;
// the original wiping logic assumed only one original image, one final image,
// and the wipe image was constructed from a combination of the two.
// We ulitimately want two final images, although we could compromize on the
// original image - it just gets garbled.
// original code
// wipe update
//wipe_EndScreen(0, 0, SCREENWIDTH, SCREENHEIGHT);
//wipestart = I_GetTime () - 1;
//do
// {
// do
// {
// nowtime = I_GetTime ();
// tics = nowtime - wipestart;
// }
// while(!tics);
// wipestart = nowtime;
// done = wipe_ScreenWipe(wipe_Melt, 0, 0, SCREENWIDTH, SCREENHEIGHT, tics);
// I_UpdateNoBlit ();
// M_Drawer (); // menu is drawn even on top of wipes
// CO_Drawer(); // Console is drawn on top of even the menu...
// I_FinishUpdate (); // page flip or blit buffer
// }
//while(!done);
}
//
// D_DoomLoop
//
extern int demotype;
extern boolean demorecording;
void D_DoomLoop (void)
{
if (demorecording)
G_BeginRecording ();
if (M_CheckParm ("-debugfile"))
{
char filename[20];
sprintf (filename,"debug%i.txt",consoleplayer);
//printf ("debug output to: %s\n",filename);
sprintf(MsgText, "debug output to: %s\n",filename);
WriteDebug(MsgText);
debugfile = fopen (filename,"w");
}
I_InitGraphics ();
while (1)
{
// frame syncronous IO operations
I_StartFrame ();
// process one or more tics
if (singletics)
{
I_StartTic ();
D_ProcessEvents ();
G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]);
if (advancedemo)
D_DoAdvanceDemo();
M_Ticker ();
G_Ticker ();
gametic++;
maketic++;
}
else
{
TryRunTics (); // will run at least one tic
}
S_UpdateSounds (players[consoleplayer].mo);// move positional sounds
// Update display, next frame, with current state.
D_Display ();
#ifndef SNDSERV
// Sound mixing for the buffer is snychronous.
//I_UpdateSound();
#endif
// Synchronous sound output is explicitly called.
#ifndef SNDINTR
// Update sound output.
//I_SubmitSound();
#endif
}
}
void MY_DoomSetup(void)
{
if (demorecording)
G_BeginRecording ();
//WriteDebug("MY_DoomSetup...\n");
if (M_CheckParm ("-debugfile"))
{
char filename[20];
sprintf (filename,"debug%i.txt",consoleplayer);
//printf ("debug output to: %s\n",filename);
sprintf(MsgText, "debug output to: %s\n",filename);
WriteDebug(MsgText);
debugfile = fopen (filename,"w");
}
I_SetPalette (W_CacheLumpName("PLAYPAL", PU_CACHE));
}
void MY_DoomLoop (void)
{
//WriteDebug("MY_DoomLoop...\n");
// frame syncronous IO operations
I_StartFrame ();
// process one or more tics
if (singletics)
{
//WriteDebug("I_StartTic...\n");
I_StartTic ();
//WriteDebug("D_ProcessEvents...\n");
D_ProcessEvents ();
if (bInGame) // DQ
{
//WriteDebug("MY_DoomLoop calling G_BuildTiccmd...\n");
G_BuildTiccmd (&netcmds[consoleplayer][maketic%BACKUPTICS]);
if (advancedemo)
{
//WriteDebug("D_DoAdvanceDemo...\n");
D_DoAdvanceDemo();
}
CO_Ticker();
//WriteDebug("M_Ticker...\n");
M_Ticker ();
//WriteDebug("G_Ticker...\n");
G_Ticker ();
gametic++;
maketic++;
}
}
else
{
//WriteDebug("TryRunTics...\n");
TryRunTics (); // will run at least one tic
}
if (bInGame) // DQ
{
//WriteDebug("S_UpdateSounds...\n");
S_UpdateSounds (players[consoleplayer].mo);// move positional sounds
// Update display, next frame, with current state.
//WriteDebug("D_Display...\n");
D_Display();
}
#ifndef SNDSERV
// Sound mixing for the buffer is snychronous.
//I_UpdateSound();
#endif
// Synchronous sound output is explicitly called.
#ifndef SNDINTR
// Update sound output.
//I_SubmitSound();
#endif
}
//
// DEMO LOOP
//
int demosequence;
int pagetic;
char *pagename;
//
// D_PageTicker
// Handles timing for warped projection
//
void D_PageTicker (void)
{
if (--pagetic < 0)
D_AdvanceDemo ();
}
//
// D_PageDrawer
//
void D_PageDrawer (PBUFFER RenderBuffer) // DQ
//void D_PageDrawer (void)
{
// DQ start addition
int y;
DWORD * pdwDest;
BYTE * Buffer;
long * YLookup;
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -