- Moved renderer dependent part of savegame pic creation into DFrameBuffer

as a virtual function so that it can be overridden.


SVN r700 (trunk)
This commit is contained in:
Christoph Oelckers 2008-01-12 12:49:05 +00:00
parent f691c973d4
commit 2e613c3557
4 changed files with 28 additions and 10 deletions

View file

@ -1,4 +1,6 @@
January 12, 2008 (Changes by Graf Zahl) January 12, 2008 (Changes by Graf Zahl)
- Moved renderer dependent part of savegame pic creation into DFrameBuffer
as a virtual function so that it can be overridden.
- Fixed: M_SaveBitmap::prior was too small. It must be 3 bytes per pixel, - Fixed: M_SaveBitmap::prior was too small. It must be 3 bytes per pixel,
not 1. not 1.
- Replaced INVGEM** graphics with PNG versions so that they have the - Replaced INVGEM** graphics with PNG versions so that they have the

View file

@ -1969,17 +1969,8 @@ static void PutSavePic (FILE *file, int width, int height)
} }
else else
{ {
DCanvas *pic = new DSimpleCanvas (width, height);
PalEntry palette[256];
// Take a snapshot of the player's view
pic->Lock ();
P_CheckPlayerSprites(); P_CheckPlayerSprites();
R_RenderViewToCanvas (players[consoleplayer].mo, pic, 0, 0, width, height); screen->WriteSavePic(&players[consoleplayer], file, width, height);
screen->GetFlashedPalette (palette);
M_CreatePNG (file, pic->GetBuffer(), palette, SS_PAL, width, height, pic->GetPitch());
pic->Unlock ();
delete pic;
} }
} }

View file

@ -61,6 +61,7 @@
#include "hardware.h" #include "hardware.h"
#include "r_translate.h" #include "r_translate.h"
#include "f_wipe.h" #include "f_wipe.h"
#include "m_png.h"
IMPLEMENT_ABSTRACT_CLASS (DCanvas) IMPLEMENT_ABSTRACT_CLASS (DCanvas)
IMPLEMENT_ABSTRACT_CLASS (DFrameBuffer) IMPLEMENT_ABSTRACT_CLASS (DFrameBuffer)
@ -1310,6 +1311,7 @@ void DFrameBuffer::CopyPixelData(BYTE * buffer, int texpitch, int texheight, int
// Render the view // Render the view
// //
//=========================================================================== //===========================================================================
void DFrameBuffer::RenderView(player_t *player) void DFrameBuffer::RenderView(player_t *player)
{ {
R_RenderActorView (player->mo); R_RenderActorView (player->mo);
@ -1318,6 +1320,26 @@ void DFrameBuffer::RenderView(player_t *player)
FCanvasTextureInfo::UpdateAll (); FCanvasTextureInfo::UpdateAll ();
} }
//===========================================================================
//
// Render the view to a savegame picture
//
//===========================================================================
void DFrameBuffer::WriteSavePic (player_t *player, FILE *file, int width, int height)
{
DCanvas *pic = new DSimpleCanvas (width, height);
PalEntry palette[256];
// Take a snapshot of the player's view
pic->Lock ();
R_RenderViewToCanvas (player->mo, pic, 0, 0, width, height);
GetFlashedPalette (palette);
M_CreatePNG (file, pic->GetBuffer(), palette, SS_PAL, width, height, pic->GetPitch());
pic->Unlock ();
delete pic;
}
FNativePalette::~FNativePalette() FNativePalette::~FNativePalette()

View file

@ -346,6 +346,9 @@ public:
// render 3D view // render 3D view
virtual void RenderView(player_t *player); virtual void RenderView(player_t *player);
// renders view to a savegame picture
virtual void WriteSavePic (player_t *player, FILE *file, int width, int height);
bool Accel2D; // If true, 2D drawing can be accelerated. bool Accel2D; // If true, 2D drawing can be accelerated.
// Begin 2D drawing operations. This is like Update, but it doesn't end // Begin 2D drawing operations. This is like Update, but it doesn't end