diff --git a/docs/rh-log.txt b/docs/rh-log.txt index 9bba7de561..7c9f61533a 100644 --- a/docs/rh-log.txt +++ b/docs/rh-log.txt @@ -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. diff --git a/src/d_main.cpp b/src/d_main.cpp index 59f705406c..0a1984b2d7 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -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 diff --git a/src/sdl/hardware.h b/src/sdl/hardware.h index 39579be962..073a555b19 100644 --- a/src/sdl/hardware.h +++ b/src/sdl/hardware.h @@ -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 (); diff --git a/src/v_video.cpp b/src/v_video.cpp index 5f03c0fe3c..fc71eaddb0 100644 --- a/src/v_video.cpp +++ b/src/v_video.cpp @@ -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); diff --git a/src/v_video.h b/src/v_video.h index e9cbc465ed..5762408d6e 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -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 diff --git a/src/win32/hardware.h b/src/win32/hardware.h index fd1e92d45f..bdff41cf85 100644 --- a/src/win32/hardware.h +++ b/src/win32/hardware.h @@ -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 ();