- Moved the code that renders the view from D_Display into a virtual function

of the frame buffer so I can get rid of the last remaining renderer check
  outside the display code in GZDoom.
- made V_SetResolution a virtual function in IVideo. It's probably not a perfect
  solution but at least it allows overriding it (which I need in GZDoom.)
  Note: There's a lot of redundancy between hardware.cpp/h in the SDL and Win32
  folders so some cleaning up might be a good idea.


SVN r692 (trunk)
This commit is contained in:
Christoph Oelckers 2008-01-11 21:04:22 +00:00
parent a9dc8ddce3
commit e06c645310
6 changed files with 36 additions and 9 deletions

View file

@ -7,6 +7,13 @@ January 10, 2008
- Applied Karate Chris's TEAMINFO logo patch.
January 10, 2008 (Changes by Graf Zahl)
- Moved the code that renders the view from D_Display into a virtual function
of the frame buffer so I can get rid of the last remaining renderer check
outside the display code in GZDoom.
- made V_SetResolution a virtual function in IVideo. It's probably not a perfect
solution but at least it allows overriding it (which I need in GZDoom.)
Note: There's a lot of redundancy between hardware.cpp/h in the SDL and Win32
folders so some cleaning up might be a good idea.
- defined a constant for the crosshair menu entry's index to get a direct
reference out of the function code. In GZDoom the menu contains different
information.

View file

@ -89,6 +89,7 @@
#include "st_start.h"
#include "templates.h"
#include "teaminfo.h"
#include "hardware.h"
// MACROS ------------------------------------------------------------------
@ -466,7 +467,7 @@ void D_Display ()
if (setmodeneeded)
{
// Change screen mode.
if (V_SetResolution (NewWidth, NewHeight, NewBits))
if (Video->SetResolution (NewWidth, NewHeight, NewBits))
{
// Recalculate various view parameters.
setsizeneeded = true;
@ -556,10 +557,7 @@ void D_Display ()
screen->SetBlendingRect(viewwindowx, viewwindowy,
viewwindowx + realviewwidth, viewwindowy + realviewheight);
P_CheckPlayerSprites();
R_RenderActorView (players[consoleplayer].mo);
R_DetailDouble (); // [RH] Apply detail mode expansion
// [RH] Let cameras draw onto textures that were visible this frame.
FCanvasTextureInfo::UpdateAll ();
screen->RenderView(&players[consoleplayer]);
if ((hw2d = screen->Begin2D(viewactive)))
{
// Redraw everything every frame when using 2D accel

View file

@ -49,6 +49,9 @@ class IVideo
virtual void StartModeIterator (int bits, bool fs) = 0;
virtual bool NextMode (int *width, int *height, bool *letterbox) = 0;
virtual bool SetResolution (int width, int height, int bits);
};
void I_InitGraphics ();

View file

@ -1008,6 +1008,21 @@ void DFrameBuffer::CopyPixelData(BYTE * buffer, int texpitch, int texheight, int
}
}
//===========================================================================
//
// Render the view
//
//===========================================================================
void DFrameBuffer::RenderView(player_t *player)
{
R_RenderActorView (player->mo);
R_DetailDouble (); // [RH] Apply detail mode expansion
// [RH] Let cameras draw onto textures that were visible this frame.
FCanvasTextureInfo::UpdateAll ();
}
FNativePalette::~FNativePalette()
{
}
@ -1106,7 +1121,7 @@ bool V_DoModeSetup (int width, int height, int bits)
return true;
}
bool V_SetResolution (int width, int height, int bits)
bool IVideo::SetResolution (int width, int height, int bits)
{
int oldwidth, oldheight;
int oldbits;
@ -1253,7 +1268,7 @@ void V_Init2()
I_InitGraphics();
I_ClosestResolution (&width, &height, 8);
if (!V_SetResolution (width, height, 8))
if (!Video->SetResolution (width, height, 8))
I_FatalError ("Could not set resolution to %d x %d x %d", width, height, 8);
else
Printf ("Resolution: %d x %d\n", SCREENWIDTH, SCREENHEIGHT);

View file

@ -336,6 +336,9 @@ public:
// Set the rect defining the area effected by blending.
virtual void SetBlendingRect (int x1, int y1, int x2, int y2);
// render 3D view
virtual void RenderView(player_t *player);
bool Accel2D; // If true, 2D drawing can be accelerated.
// Begin 2D drawing operations. This is like Update, but it doesn't end
@ -422,8 +425,6 @@ FString V_GetColorStringByName (const char *name);
// Tries to get color by name, then by string
int V_GetColor (const DWORD *palette, const char *str);
bool V_SetResolution (int width, int height, int bpp);
#ifdef USEASM
extern "C" void ASM_PatchPitch (void);
#endif

View file

@ -49,6 +49,9 @@ class IVideo
virtual void StartModeIterator (int bits, bool fs) = 0;
virtual bool NextMode (int *width, int *height, bool *letterbox) = 0;
virtual bool SetResolution (int width, int height, int bits);
};
void I_InitGraphics ();