mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
In OpenGL modes, save savegame screenshots as they appear on the screen.
Instead of drawing the rooms and masks with the classic renderer once. The captured scene is transformed to use the base palette, so that the screenshot will also show up in classic. No aspect correction is done. git-svn-id: https://svn.eduke32.com/eduke32@2567 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
c5d8aa29ee
commit
4e904839dc
1 changed files with 49 additions and 8 deletions
|
@ -3528,10 +3528,8 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
|||
walock[TILE_SAVESHOT] = 199;
|
||||
if (waloff[TILE_SAVESHOT] == 0)
|
||||
allocache(&waloff[TILE_SAVESHOT],200*320,&walock[TILE_SAVESHOT]);
|
||||
#ifdef DEBUG_VALGRIND_NO_SMC
|
||||
Bmemset((void *)waloff[TILE_SAVESHOT], 0, 200*320);
|
||||
return;
|
||||
#endif
|
||||
|
||||
if (getrendermode()==0)
|
||||
setviewtotile(TILE_SAVESHOT,200L,320L);
|
||||
}
|
||||
else if (getrendermode() == 0 && ((ud.screen_tilting && p->rotscrnang) || ud.detail==0))
|
||||
|
@ -3733,11 +3731,54 @@ void G_DrawRooms(int32_t snum, int32_t smoothratio)
|
|||
drawing_ror = 0;
|
||||
drawmasks();
|
||||
|
||||
if (g_screenCapture == 1)
|
||||
if (g_screenCapture)
|
||||
{
|
||||
g_screenCapture = 0;
|
||||
|
||||
if (getrendermode()==0)
|
||||
{
|
||||
setviewback();
|
||||
g_screenCapture = 0;
|
||||
// walock[TILE_SAVESHOT] = 1;
|
||||
// walock[TILE_SAVESHOT] = 1;
|
||||
}
|
||||
#ifdef USE_OPENGL
|
||||
else
|
||||
{
|
||||
// Save OpenGL screenshot with Duke3D palette
|
||||
// NOTE: maybe need to move this to the engine...
|
||||
begindrawing();
|
||||
{
|
||||
palette_t *const frame = Bcalloc(xdim*ydim, 4);
|
||||
char *const pic = (char *)waloff[TILE_SAVESHOT];
|
||||
|
||||
int32_t x, y;
|
||||
const int32_t xf = divscale16(xdim, 320); // (xdim<<16)/320
|
||||
const int32_t yf = divscale16(ydim, 200); // (ydim<<16)/200
|
||||
|
||||
if (!frame)
|
||||
{
|
||||
Bmemset(pic, 0, 320*200);
|
||||
}
|
||||
else
|
||||
{
|
||||
bglReadPixels(0,0,xdim,ydim,GL_RGBA,GL_UNSIGNED_BYTE,frame);
|
||||
|
||||
for (y=0; y<200; y++)
|
||||
{
|
||||
const int32_t base = mulscale16(200-y-1, yf)*xdim;
|
||||
|
||||
for (x=0; x<320; x++)
|
||||
{
|
||||
const palette_t *pix = &frame[base + mulscale16(x, xf)];
|
||||
pic[320*y + x] = getclosestcol(pix->r>>2, pix->g>>2, pix->b>>2);
|
||||
}
|
||||
}
|
||||
|
||||
Bfree(frame);
|
||||
}
|
||||
}
|
||||
enddrawing();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else if (getrendermode() == 0 && ((ud.screen_tilting && p->rotscrnang) || ud.detail==0))
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue