1
0
Fork 0
forked from fte/fteqw

compile fix for d3d.

changed screenshot message to show the full path of the screenshot (so you can find it in your profile dir and stuff).
removed a couple of warnings.
fixed the screenshot code for windowed mode and privacy concerns.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3782 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2011-04-25 13:48:30 +00:00
parent 528b27b719
commit 5edcd6c0e8
5 changed files with 52 additions and 40 deletions

View file

@ -1857,6 +1857,7 @@ SCR_ScreenShot_f
*/
void SCR_ScreenShot_f (void)
{
char sysname[1024];
char pcxname[80];
int i;
vfsfile_t *vfs;
@ -1902,8 +1903,10 @@ void SCR_ScreenShot_f (void)
}
}
FS_NativePath(pcxname, FS_GAMEONLY, sysname, sizeof(sysname));
if (SCR_ScreenShot(pcxname))
Con_Printf ("Wrote %s\n", pcxname);
Con_Printf ("Wrote %s\n", sysname);
else
Con_Printf ("Screenshot failed\n");
}

View file

@ -606,7 +606,7 @@ static model_t *CSQC_GetModelForIndex(int index)
static qboolean CopyCSQCEdictToEntity(csqcedict_t *in, entity_t *out)
{
int i, ival;
int ival;
model_t *model;
unsigned int rflags;

View file

@ -201,8 +201,8 @@ extern cvar_t r_novis;
extern cvar_t r_speeds;
extern cvar_t r_waterwarp;
extern cvar_t r_polygonoffset_submodel_factor;
extern cvar_t r_polygonoffset_submodel_offset;
cvar_t r_polygonoffset_submodel_factor = SCVAR("r_polygonoffset_submodel_factor", "0.05");
cvar_t r_polygonoffset_submodel_offset = SCVAR("r_polygonoffset_submodel_offset", "25");
rendererstate_t currentrendererstate;
@ -388,9 +388,6 @@ void GLRenderer_Init(void)
// Cvar_Register (&gl_lightmapmode, GLRENDEREROPTIONS);
Cvar_Register (&r_polygonoffset_submodel_factor, GLRENDEREROPTIONS);
Cvar_Register (&r_polygonoffset_submodel_offset, GLRENDEREROPTIONS);
Cvar_Register (&gl_picmip, GLRENDEREROPTIONS);
Cvar_Register (&gl_picmip2d, GLRENDEREROPTIONS);
@ -601,6 +598,8 @@ void Renderer_Init(void)
Cvar_Register (&r_replacemodels, GRAPHICALNICETIES);
Cvar_Register (&r_polygonoffset_submodel_factor, GLRENDEREROPTIONS);
Cvar_Register (&r_polygonoffset_submodel_offset, GLRENDEREROPTIONS);
// misc
Cvar_Register(&con_ocranaleds, "Console controls");

View file

@ -798,45 +798,58 @@ static void (D3D9_VID_ShiftPalette) (unsigned char *palette)
}
static char *(D3D9_VID_GetRGBInfo) (int prepad, int *truevidwidth, int *truevidheight)
{
IDirect3DSurface9 *surf;
IDirect3DSurface9 *backbuf, *surf;
D3DLOCKED_RECT rect;
D3DSURFACE_DESC desc;
int i, j, c;
qbyte *ret = BZ_Malloc(prepad + vid.pixelwidth*vid.pixelheight*3);
qbyte *ret = NULL;
qbyte *p;
HRESULT res;
// TODO: this captures the entire screen on windowed display..
// also might break on multi-monitor
IDirect3DDevice9_CreateOffscreenPlainSurface(pD3DDev9,
GetSystemMetrics(SM_CXSCREEN),
GetSystemMetrics(SM_CYSCREEN),
D3DFMT_A8R8G8B8,
D3DPOOL_SYSTEMMEM,
&surf,
NULL);
IDirect3DDevice9_GetFrontBufferData(pD3DDev9, 0, surf);
IDirect3DSurface9_LockRect(surf, &rect, NULL, D3DLOCK_NO_DIRTY_UPDATE|D3DLOCK_READONLY|D3DLOCK_NOSYSLOCK);
/*DON'T read the front buffer.
this function can be used by the quakeworld remote screenshot 'snap' feature,
so DO NOT read the frontbuffer because it can show other information than just quake to third parties*/
// read surface rect and convert 32 bgra to 24 rgb and flip
c = prepad+vid.pixelwidth*vid.pixelheight*3;
p = (qbyte *)rect.pBits;
for (i=c-(3*vid.pixelwidth); i>=prepad; i-=(3*vid.pixelwidth))
if (!FAILED(IDirect3DDevice9_GetRenderTarget(pD3DDev9, 0, &backbuf)))
{
for (j=0; j<vid.pixelwidth; j++)
if (!FAILED(IDirect3DSurface9_GetDesc(backbuf, &desc)))
if (desc.Format == D3DFMT_X8R8G8B8 || desc.Format == D3DFMT_A8R8G8B8)
if (!FAILED(IDirect3DDevice9_CreateOffscreenPlainSurface(pD3DDev9,
desc.Width, desc.Height, desc.Format,
D3DPOOL_SYSTEMMEM, &surf, NULL))
)
{
ret[i+j*3+0] = p[j*4+2];
ret[i+j*3+1] = p[j*4+1];
ret[i+j*3+2] = p[j*4+0];
if (!FAILED(IDirect3DDevice9_GetRenderTargetData(pD3DDev9, backbuf, surf)))
if (!FAILED(IDirect3DSurface9_LockRect(surf, &rect, NULL, D3DLOCK_NO_DIRTY_UPDATE|D3DLOCK_READONLY|D3DLOCK_NOSYSLOCK)))
{
ret = BZ_Malloc(prepad + desc.Width*desc.Height*3);
if (ret)
{
// read surface rect and convert 32 bgra to 24 rgb and flip
c = prepad+desc.Width*desc.Height*3;
p = (qbyte *)rect.pBits;
for (i=c-(3*desc.Height); i>=prepad; i-=(3*desc.Height))
{
for (j=0; j<desc.Width; j++)
{
ret[i+j*3+0] = p[j*4+2];
ret[i+j*3+1] = p[j*4+1];
ret[i+j*3+2] = p[j*4+0];
}
p += rect.Pitch;
}
*truevidwidth = desc.Width;
*truevidheight = desc.Height;
}
IDirect3DSurface9_UnlockRect(surf);
}
IDirect3DSurface9_Release(surf);
}
p += rect.Pitch;
IDirect3DSurface9_Release(backbuf);
}
*truevidwidth = vid.pixelwidth;
*truevidheight = vid.pixelheight;
IDirect3DSurface9_UnlockRect(surf);
IDirect3DSurface9_Release(surf);
return ret;
}

View file

@ -82,9 +82,6 @@ cvar_t gl_dither = SCVAR("gl_dither", "1");
extern cvar_t gl_screenangle;
cvar_t r_polygonoffset_submodel_factor = SCVAR("r_polygonoffset_submodel_factor", "0.05");
cvar_t r_polygonoffset_submodel_offset = SCVAR("r_polygonoffset_submodel_offset", "25");
extern cvar_t gl_mindist;
extern cvar_t ffov;