mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-14 08:21:05 +00:00
6d36834f8e
added waterfog command. waterfog overrides regular fog only when the view is in water. fixed 64bit printf format specifiers. should work better on winxp64. fixed some spec angle weirdness. fixed viewsize 99.99 weirdness with ezhud. fixed extra offset on the console (exhibited in 64bit builds, but not limited to). fixed .avi playback, can now actually display frames again. reimplemented line sparks. fixed r_editlights_save flipping the light's pitch. fixed issue with oggs failing to load. fixed condump to cope with unicode properly. made sv_bigcoords default except in quake. hexen2 kinda needs it for bsp angle precision. fixed nq server to not stall weirdly on map changes. fixed qwprogs svc_cdtrack not bugging out with nq clients on the server. fixed restart command to load the last map run by the server, instead of start.bsp (when idle) optimised d3d9 renderer a little. now uses less draw calls, especially with complex scenes. seems to get higher framerates than opengl now. fixed d3d9 renderer to not bug out quite so much when run fullscreen (shader subsystem is now correctly initialised). fixed a couple of bugs from font change. also now supports utf-8 in a few more places. r_editlights_reload no longer generates rtlights inside the void. this resolves a few glitches (but should also help framerates a little). fixed so corona-only lights won't generate shadowmaps and waste lots of time. removed lots of #defines from qclib. I should never have made them in the first place, but I was lazy. obviously there's more left that I cba to remove yet. fixed nested calls with variant-vectors. this fixes csaddon's light editor. fixed qcc hc calling conventions using redundant stores. disabled keywords can still be used by using __keyword instead. fixed ftegccgui grep feature. fixed motionless-dog qcc bug. tweaked qcc warnings a little. -Wall is now a viable setting. you should be able to fix all those warnings. fixed qw svc_intermission + dpp5+ clients bug. fixed annoying spam about disconnecting in hexen2. rewrote status command a little to cope with ipv6 addresses more gracefully fixed significant stall when hibernating/debugging a server with a player sitting on it. fixed truelightning. fixed rocketlight overriding pflags. fixed torches vanishing on vid_restart. fixed issue with decal scaling. fixed findentityfield builtin. fixed fteqcc issue with ptr+1 fixed use of arrays inside class functions. fixed/implemented fteqcc emulation of pointer opcodes. added __inout keyword to fteqcc, so that it doesn't feel so horrendous. fixed sizeof(*foo) fixed *struct = struct; fixed recursive structs. fixed fteqcc warning report. fixed sdl2 controller support, hopefully. attempted to implement xinput, including per-player audio playback. slightly fixed relaxed attitude to mouse focus when running fullscreen. fixed weird warnings/errors with 'ent.arrayhead' terms. now generates sane errors. implemented bindmaps (for csqc). fixed crashing bug with eprint builtin. implemented subset of music_playlist_* functionality. significant changes to music playback. fixed some more dpcsqc compat. fixed binds menu. now displays and accepts modifiers. fixed issues with huge lightmaps. fixed protocol determinism with dp clients connecting to fte servers. the initial getchallenge request now inhibits vanilla nq connection requests. implemented support for 'dupe' userinfo key, allowing clients to request client->server packet duplication. should probably queue them tbh. implemented sv_saveentfile command. fixed resume after breaking inside a stepped-over function. fixed erroneous footer after debugging. (I wonder just how many things I broke with these fixes) git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@4946 fc73d0e0-1445-4013-8a0c-d673dee63da5
142 lines
3.4 KiB
C
142 lines
3.4 KiB
C
#include "quakedef.h"
|
|
#include "winquake.h"
|
|
#ifdef D3D9QUAKE
|
|
#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500)
|
|
#define HMONITOR_DECLARED
|
|
DECLARE_HANDLE(HMONITOR);
|
|
#endif
|
|
#include <d3d9.h>
|
|
extern LPDIRECT3DDEVICE9 pD3DDev9;
|
|
|
|
void D3D9_DestroyTexture (texid_t tex)
|
|
{
|
|
if (!tex)
|
|
return;
|
|
|
|
if (tex->ptr)
|
|
IDirect3DTexture9_Release((IDirect3DTexture9*)tex->ptr);
|
|
tex->ptr = NULL;
|
|
}
|
|
|
|
qboolean D3D9_LoadTextureMips(image_t *tex, struct pendingtextureinfo *mips)
|
|
{
|
|
qbyte *fte_restrict out, *fte_restrict in;
|
|
int x, y, i;
|
|
D3DLOCKED_RECT lock;
|
|
D3DFORMAT fmt;
|
|
D3DSURFACE_DESC desc;
|
|
IDirect3DTexture9 *dt;
|
|
qboolean swap = false;
|
|
unsigned int pixelsize = 4;
|
|
unsigned int blocksize = 0;
|
|
|
|
switch(mips->encoding)
|
|
{
|
|
case PTI_RGB565:
|
|
pixelsize = 2;
|
|
fmt = D3DFMT_R5G6B5;
|
|
break;
|
|
case PTI_RGBA4444://not supported on d3d9
|
|
return false;
|
|
case PTI_ARGB4444:
|
|
pixelsize = 2;
|
|
fmt = D3DFMT_A4R4G4B4;
|
|
break;
|
|
case PTI_RGBA5551://not supported on d3d9
|
|
return false;
|
|
case PTI_ARGB1555:
|
|
pixelsize = 2;
|
|
fmt = D3DFMT_A1R5G5B5;
|
|
break;
|
|
case PTI_RGBA8:
|
|
// fmt = D3DFMT_A8B8G8R8; /*how do we check
|
|
fmt = D3DFMT_A8R8G8B8;
|
|
swap = true;
|
|
break;
|
|
case PTI_RGBX8:
|
|
// fmt = D3DFMT_X8B8G8R8;
|
|
fmt = D3DFMT_X8R8G8B8;
|
|
swap = true;
|
|
break;
|
|
case PTI_BGRA8:
|
|
fmt = D3DFMT_A8R8G8B8;
|
|
break;
|
|
case PTI_BGRX8:
|
|
fmt = D3DFMT_X8R8G8B8;
|
|
break;
|
|
|
|
//too lazy to support these for now
|
|
case PTI_S3RGB1:
|
|
case PTI_S3RGBA1: //d3d doesn't distinguish between these
|
|
fmt = D3DFMT_DXT1;
|
|
blocksize = 8;
|
|
break;
|
|
case PTI_S3RGBA3:
|
|
fmt = D3DFMT_DXT3;
|
|
blocksize = 16;
|
|
break;
|
|
case PTI_S3RGBA5:
|
|
fmt = D3DFMT_DXT5;
|
|
blocksize = 16;
|
|
break;
|
|
|
|
default: //no idea
|
|
return false;
|
|
}
|
|
|
|
if (!pD3DDev9)
|
|
return false; //can happen on errors
|
|
if (FAILED(IDirect3DDevice9_CreateTexture(pD3DDev9, mips->mip[0].width, mips->mip[0].height, mips->mipcount, 0, fmt, D3DPOOL_MANAGED, &dt, NULL)))
|
|
return false;
|
|
|
|
for (i = 0; i < mips->mipcount; i++)
|
|
{
|
|
IDirect3DTexture9_GetLevelDesc(dt, i, &desc);
|
|
|
|
if (mips->mip[i].height != desc.Height || mips->mip[i].width != desc.Width)
|
|
{
|
|
IDirect3DTexture9_Release(dt);
|
|
return false;
|
|
}
|
|
|
|
IDirect3DTexture9_LockRect(dt, i, &lock, NULL, D3DLOCK_NOSYSLOCK|D3DLOCK_DISCARD);
|
|
//can't do it in one go. pitch might contain padding or be upside down.
|
|
if (!mips->mip[i].data)
|
|
;
|
|
else if (blocksize)
|
|
{
|
|
if (lock.Pitch == ((mips->mip[i].width+3)/4)*blocksize)
|
|
//for (y = 0, out = lock.pBits, in = mips->mip[i].data; y < mips->mip[i].height; y++, out += lock.Pitch, in += mips->mip[i].width*pixelsize)
|
|
memcpy(lock.pBits, mips->mip[i].data, mips->mip[i].datasize);
|
|
}
|
|
else if (swap)
|
|
{
|
|
for (y = 0, out = lock.pBits, in = mips->mip[i].data; y < mips->mip[i].height; y++, out += lock.Pitch, in += mips->mip[i].width*4)
|
|
{
|
|
for (x = 0; x < mips->mip[i].width*4; x+=4)
|
|
{
|
|
out[x+0] = in[x+2];
|
|
out[x+1] = in[x+1];
|
|
out[x+2] = in[x+0];
|
|
out[x+3] = in[x+3];
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
for (y = 0, out = lock.pBits, in = mips->mip[i].data; y < mips->mip[i].height; y++, out += lock.Pitch, in += mips->mip[i].width*pixelsize)
|
|
memcpy(out, in, mips->mip[i].width*pixelsize);
|
|
}
|
|
IDirect3DTexture9_UnlockRect(dt, i);
|
|
}
|
|
|
|
D3D9_DestroyTexture(tex);
|
|
tex->ptr = dt;
|
|
|
|
return true;
|
|
}
|
|
void D3D9_UploadLightmap(lightmapinfo_t *lm)
|
|
{
|
|
}
|
|
|
|
#endif
|