Enable D3D renderer in windows merged clients, some other small fixes to help MinGW get closer to compiling the D3D renderer (things are undefined)

git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3722 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Lance 2011-01-28 05:06:20 +00:00
parent f2ea7731e8
commit 8b74b55034
3 changed files with 1058 additions and 1043 deletions

View File

@ -419,10 +419,8 @@ GLQUAKE_OBJS = \
gl_hlmdl.o gl_hlmdl.o
D3DQUAKE_OBJS = \ D3DQUAKE_OBJS = \
d3d_draw.o \ d3d_backend.o \
d3d_mesh.o \ d3d_image.o \
d3d_rmain.o \
d3d_rsurf.o \
vid_d3d.o \ vid_d3d.o \
d3d9_draw.o \ d3d9_draw.o \
d3d9_mesh.o \ d3d9_mesh.o \
@ -590,7 +588,7 @@ ifeq ($(FTE_TARGET),win32_SDL)
MB_DIR=m_mgw_sdl$(BITS) MB_DIR=m_mgw_sdl$(BITS)
M_EXE_NAME=../fteqw_sdl.exe M_EXE_NAME=../fteqw_sdl.exe
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o resources.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o resources.o
M_CFLAGS=-D_MINGW_VFPRINTF -D_SDL -I./libs/ -I./libs/mingw-libs/ -I./libs/dxsdk7/include/ -I./libs/mingw-libs $(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL M_CFLAGS=-D_MINGW_VFPRINTF -D_SDL -I./libs/ -I./libs/mingw-libs/ -I./libs/dxsdk7/include/ -I./libs/mingw-libs $(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS)
@ -627,7 +625,7 @@ ifeq ($(FTE_TARGET),win64_SDL)
MB_DIR=m_mgw_sdl$(BITS) MB_DIR=m_mgw_sdl$(BITS)
M_EXE_NAME=../fteqw_sdl64.exe M_EXE_NAME=../fteqw_sdl64.exe
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o resources.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) gl_vidsdl.o snd_sdl.o cd_sdl.o sys_sdl.o in_sdl.o snd_directx.o resources.o
M_CFLAGS=-D_MINGW_VFPRINTF -D_SDL -I./libs/ -I./libs/mingw64-libs/ -I./libs/dxsdk7/include/ -I./libs/mingw64-libs $(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL M_CFLAGS=-D_MINGW_VFPRINTF -D_SDL -I./libs/ -I./libs/mingw64-libs/ -I./libs/dxsdk7/include/ -I./libs/mingw64-libs $(GLCFLAGS) `sdl-config --cflags` -D_MERGED_SDL
M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS) M_LDFLAGS=$(GLLDFLAGS) $(IMAGELDFLAGS)
@ -711,9 +709,9 @@ endif
NPQTVCL_DIR=npqtvcl_mgw NPQTVCL_DIR=npqtvcl_mgw
ifeq ($(USEASM),true) ifeq ($(USEASM),true)
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) fs_win32.o gl_vidnt.o vid_ddraw.o vid_dib.o vid_win2.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o sys_dosa.o resources.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o sys_dosa.o resources.o
else else
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) fs_win32.o gl_vidnt.o vid_ddraw.o vid_dib.o vid_win2.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o
endif endif
M_EXE_NAME=../fteqw.exe M_EXE_NAME=../fteqw.exe
MCL_EXE_NAME=../fteqwcl.exe MCL_EXE_NAME=../fteqwcl.exe
@ -777,9 +775,9 @@ endif
NPQTVCL_DIR=npqtvcl_mgw64 NPQTVCL_DIR=npqtvcl_mgw64
ifeq ($(USEASM),true) ifeq ($(USEASM),true)
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) fs_win32.o gl_vidnt.o vid_ddraw.o vid_dib.o vid_win2.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o sys_dosa.o resources.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o sys_dosa.o resources.o
else else
MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) fs_win32.o gl_vidnt.o vid_ddraw.o vid_dib.o vid_win2.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o MCL_OBJS=$(GLQUAKE_OBJS) $(SOFTWARE_OBJS) $(D3DQUAKE_OBJS) fs_win32.o gl_vidnt.o snd_win.o snd_directx.o cd_win.o in_win.o sys_win.o resources.o
endif endif
M_EXE_NAME=../fteqw64.exe M_EXE_NAME=../fteqw64.exe
MCL_EXE_NAME=../fteqwcl64.exe MCL_EXE_NAME=../fteqwcl64.exe
@ -968,10 +966,10 @@ SV_DIR?=sv_sdl
.default: help .default: help
all: rel all: rel
rel: sv-rel gl-rel mingl-rel rel: sv-rel gl-rel mingl-rel m-rel
dbg: sv-dbg gl-dbg mingl-dbg dbg: sv-dbg gl-dbg mingl-dbg m-dbg
relcl: glcl-rel mcl-rel relcl: glcl-rel mcl-rel
profile: sv-profile gl-profile mingl-profile profile: sv-profile gl-profile mingl-profile m-profile
releases: releases:
#this is for releasing things from a linux box #this is for releasing things from a linux box

File diff suppressed because it is too large Load Diff

View File

@ -1,162 +1,164 @@
//#include "ddraw.h" #ifdef MINGW
#include "ddraw.h" // resolve DDLOCK_NOSYSLOCK
#ifndef D3D9QUAKE_H #endif
#define D3D9QUAKE_H
#ifndef D3D9QUAKE_H
#define D3D9QUAKE_H
#include "d3d9.h"
#include "com_mesh.h"
#include "glquake.h" #include "d3d9.h"
#include "com_mesh.h"
// #include "glquake.h"
// d3d9_draw.c
// //
void D3D9_Draw_Alt_String (int x, int y, const qbyte *str); // d3d9_draw.c
mpic_t* D3D9_Draw_CachePic (char *path); //
void D3D9_Draw_Character (int x, int y, unsigned int num); void D3D9_Draw_Alt_String (int x, int y, const qbyte *str);
void D3D9_Draw_ColouredCharacter (int x, int y, unsigned int num); mpic_t* D3D9_Draw_CachePic (char *path);
void D3D9_Draw_ConsoleBackground (int firstline, int lastline, qboolean forceopaque); void D3D9_Draw_Character (int x, int y, unsigned int num);
void D3D9_Draw_DebugChar (qbyte num); void D3D9_Draw_ColouredCharacter (int x, int y, unsigned int num);
void D3D9_Draw_EditorBackground (int lines); void D3D9_Draw_ConsoleBackground (int firstline, int lastline, qboolean forceopaque);
void D3D9_Draw_Image (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic); void D3D9_Draw_DebugChar (qbyte num);
void D3D9_Draw_ImageColours (float r, float g, float b, float a); void D3D9_Draw_EditorBackground (int lines);
mpic_t* D3D9_Draw_SafeCachePic (char *path); void D3D9_Draw_Image (float x, float y, float w, float h, float s1, float t1, float s2, float t2, mpic_t *pic);
mpic_t* D3D9_Draw_SafePicFromWad (char *name); void D3D9_Draw_ImageColours (float r, float g, float b, float a);
void D3D9_Draw_ScalePic (int x, int y, int width, int height, mpic_t *pic); mpic_t* D3D9_Draw_SafeCachePic (char *path);
void D3D9_Draw_String (int x, int y, const qbyte *str); mpic_t* D3D9_Draw_SafePicFromWad (char *name);
void D3D9_Draw_SubPic (int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight); void D3D9_Draw_ScalePic (int x, int y, int width, int height, mpic_t *pic);
void D3D9_Draw_TileClear (int x, int y, int w, int h); void D3D9_Draw_String (int x, int y, const qbyte *str);
void D3D9_InitParticleTexture (void); void D3D9_Draw_SubPic (int x, int y, int width, int height, mpic_t *pic, int srcx, int srcy, int srcwidth, int srcheight);
LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_32 (char *name, unsigned int *data, int width, int height, int flags); void D3D9_Draw_TileClear (int x, int y, int w, int h);
LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_8_Pal24 (char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette, int transparentpix); void D3D9_InitParticleTexture (void);
LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_8_Pal32 (char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette); LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_32 (char *name, unsigned int *data, int width, int height, int flags);
void D3D9_Media_ShowFrame8bit (qbyte *framedata, int inwidth, int inheight, qbyte *palette); LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_8_Pal24 (char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette, int transparentpix);
void D3D9_Media_ShowFrameBGR_24_Flip (qbyte *framedata, int inwidth, int inheight); LPDIRECT3DBASETEXTURE9 D3D9_LoadTexture_8_Pal32 (char *name, unsigned char *data, int width, int height, int flags, unsigned char *palette);
void D3D9_Media_ShowFrameRGBA_32 (qbyte *framedata, int inwidth, int inheight); void D3D9_Media_ShowFrame8bit (qbyte *framedata, int inwidth, int inheight, qbyte *palette);
void D3D9_MipMap (qbyte *out, qbyte *in, int width, int height); void D3D9_Media_ShowFrameBGR_24_Flip (qbyte *framedata, int inwidth, int inheight);
void D3D9_RoundDimensions (int *scaled_width, int *scaled_height, qboolean mipmap); void D3D9_Media_ShowFrameRGBA_32 (qbyte *framedata, int inwidth, int inheight);
void D3D9_UnloadTexture (LPDIRECT3DBASETEXTURE9 tex); void D3D9_MipMap (qbyte *out, qbyte *in, int width, int height);
static void Upload_Texture_32(LPDIRECT3DTEXTURE9 surf, unsigned int *data, int width, int height); void D3D9_RoundDimensions (int *scaled_width, int *scaled_height, qboolean mipmap);
void D3D9_UnloadTexture (LPDIRECT3DBASETEXTURE9 tex);
// static void Upload_Texture_32(LPDIRECT3DTEXTURE9 surf, unsigned int *data, int width, int height);
// d3d9_mesh.c
// //
void D3D9_DrawAliasModel (void); // d3d9_mesh.c
void D3D9_DrawMesh (mesh_t *mesh); //
void d3d9_GAliasFlushSkinCache (void); void D3D9_DrawAliasModel (void);
static void LotsOfLightDirectionHacks (entity_t *e, model_t *m, vec3_t lightaxis[3]); void D3D9_DrawMesh (mesh_t *mesh);
void d3d9_GAliasFlushSkinCache (void);
// static void LotsOfLightDirectionHacks (entity_t *e, model_t *m, vec3_t lightaxis[3]);
// d3d9_rmain.c
// //
void D3D9_BaseBModelTextures (entity_t *e); // d3d9_rmain.c
/* //
void D3D9_DrawParticleBeam (beamseg_t *b, part_type_t *type); void D3D9_BaseBModelTextures (entity_t *e);
void D3D9_DrawParticleBeamUT (beamseg_t *b, part_type_t *type); /*
void D3D9_DrawParticleBlob (particle_t *p, part_type_t *type); void D3D9_DrawParticleBeam (beamseg_t *b, part_type_t *type);
void D3D9_DrawParticleSpark (particle_t *p, part_type_t *type); void D3D9_DrawParticleBeamUT (beamseg_t *b, part_type_t *type);
*/ void D3D9_DrawParticleBlob (particle_t *p, part_type_t *type);
void D3D9_DrawParticles (float ptime); void D3D9_DrawParticleSpark (particle_t *p, part_type_t *type);
static void D3D9_DrawSpriteModel (entity_t *e); */
void D3D9_DrawTextureChains (void); void D3D9_DrawParticles (float ptime);
void D3D9_DrawWorld (void); static void D3D9_DrawSpriteModel (entity_t *e);
void D3D9_R_DrawEntitiesOnList (void); void D3D9_DrawTextureChains (void);
void D3D9_R_ReInit (void); void D3D9_DrawWorld (void);
void D3D9_R_RenderScene (void); void D3D9_R_DrawEntitiesOnList (void);
static void D3D9_RecursiveQ2WorldNode (mnode_t *node); void D3D9_R_ReInit (void);
static void D3D9_RecursiveWorldNode (mnode_t *node); void D3D9_R_RenderScene (void);
void D3D9_SetupFrame (void); static void D3D9_RecursiveQ2WorldNode (mnode_t *node);
qboolean D3D9_ShouldDraw (void); static void D3D9_RecursiveWorldNode (mnode_t *node);
void D3D9R_DrawSprite(int count, void **e, void *parm); void D3D9_SetupFrame (void);
void IDirect3DDevice9_DrawIndexedPrimitive7 (LPDIRECT3DDEVICE9 pD3DDev9, int mode, int fvf, void *verts, int numverts, index_t *indicies, int numindicies, int wasted); qboolean D3D9_ShouldDraw (void);
void D3D9R_DrawSprite(int count, void **e, void *parm);
// void IDirect3DDevice9_DrawIndexedPrimitive7 (LPDIRECT3DDEVICE9 pD3DDev9, int mode, int fvf, void *verts, int numverts, index_t *indicies, int numindicies, int wasted);
// d3d9_rsurf.c
// //
int D3D9_AllocBlock (int w, int h, int *x, int *y); // d3d9_rsurf.c
void D3D9_BuildLightmaps (void); //
void D3D9_BuildSurfaceDisplayList (msurface_t *fa); int D3D9_AllocBlock (int w, int h, int *x, int *y);
void D3D9_CreateSurfaceLightmap (msurface_t *surf, int shift); void D3D9_BuildLightmaps (void);
void D3D9_DrawSkyMesh(int pass, int texture, void *verts, int numverts, void *indicies, int numelements); void D3D9_BuildSurfaceDisplayList (msurface_t *fa);
int D3D9_FillBlock (int texnum, int w, int h, int x, int y); void D3D9_CreateSurfaceLightmap (msurface_t *surf, int shift);
LPDIRECT3DTEXTURE9 D3D9_NewLightmap (void); void D3D9_DrawSkyMesh(int pass, int texture, void *verts, int numverts, void *indicies, int numelements);
//void D3D9R_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, stmap *stainsrc, int shift); int D3D9_FillBlock (int texnum, int w, int h, int x, int y);
void D3D9R_RenderDynamicLightmaps (msurface_t *fa, int shift); LPDIRECT3DTEXTURE9 D3D9_NewLightmap (void);
//void D3D9R_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, stmap *stainsrc, int shift);
// void D3D9R_RenderDynamicLightmaps (msurface_t *fa, int shift);
// vid_d3d9.c
// //
void D3D9_D_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height); // vid_d3d9.c
void D3D9_D_EndDirectRect (int x, int y, int width, int height); //
void D3D9_Mod_ClearAll (void); void D3D9_D_BeginDirectRect (int x, int y, qbyte *pbitmap, int width, int height);
void* D3D9_Mod_Extradata (struct model_s *mod); void D3D9_D_EndDirectRect (int x, int y, int width, int height);
struct model_s* D3D9_Mod_FindName (char *name); void D3D9_Mod_ClearAll (void);
struct model_s* D3D9_Mod_ForName (char *name, qboolean crash); void* D3D9_Mod_Extradata (struct model_s *mod);
void D3D9_Mod_Init (void); struct model_s* D3D9_Mod_FindName (char *name);
void D3D9_Mod_NowLoadExternal (void); struct model_s* D3D9_Mod_ForName (char *name, qboolean crash);
int D3D9_Mod_SkinForName (struct model_s *model, char *name); void D3D9_Mod_Init (void);
void D3D9_Mod_Think (void); void D3D9_Mod_NowLoadExternal (void);
void D3D9_Mod_TouchModel (char *name); int D3D9_Mod_SkinForName (struct model_s *model, char *name);
qboolean D3D9_R_CheckSky (void); void D3D9_Mod_Think (void);
void D3D9_Set2D (void); void D3D9_Mod_TouchModel (char *name);
void D3D9_VID_ForceLockState (int lk); qboolean D3D9_R_CheckSky (void);
int D3D9_VID_ForceUnlockedAndReturnState (void); void D3D9_Set2D (void);
void D3D9_VID_LockBuffer (void); void D3D9_VID_ForceLockState (int lk);
void D3D9_VID_UnlockBuffer (void); int D3D9_VID_ForceUnlockedAndReturnState (void);
static LRESULT WINAPI D3D9_WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); void D3D9_VID_LockBuffer (void);
void D3D9_VID_UnlockBuffer (void);
texid_t D3D9_LoadTexture (char *identifier, int width, int height, enum uploadfmt fmt, void *data, unsigned int flags); static LRESULT WINAPI D3D9_WindowProc (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
texid_t D3D9_LoadTexture8Pal24 (char *identifier, int width, int height, qbyte *data, qbyte *palette24, unsigned int flags);
texid_t D3D9_LoadTexture8Pal32 (char *identifier, int width, int height, qbyte *data, qbyte *palette32, unsigned int flags); texid_t D3D9_LoadTexture (char *identifier, int width, int height, enum uploadfmt fmt, void *data, unsigned int flags);
texid_t D3D9_LoadCompressed (char *name); texid_t D3D9_LoadTexture8Pal24 (char *identifier, int width, int height, qbyte *data, qbyte *palette24, unsigned int flags);
texid_t D3D9_FindTexture (char *identifier); texid_t D3D9_LoadTexture8Pal32 (char *identifier, int width, int height, qbyte *data, qbyte *palette32, unsigned int flags);
texid_t D3D9_AllocNewTexture (int w, int h); texid_t D3D9_LoadCompressed (char *name);
void D3D9_Upload (texid_t tex, char *name, enum uploadfmt fmt, void *data, void *palette, int width, int height, unsigned int flags); texid_t D3D9_FindTexture (char *identifier);
void D3D9_DestroyTexture (texid_t tex); texid_t D3D9_AllocNewTexture (int w, int h);
void D3D9_Upload (texid_t tex, char *name, enum uploadfmt fmt, void *data, void *palette, int width, int height, unsigned int flags);
extern LPDIRECT3DDEVICE9 pD3DDev9; void D3D9_DestroyTexture (texid_t tex);
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value extern LPDIRECT3DDEVICE9 pD3DDev9;
#define lightmap_bytes 4 extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
#define lightmap_bytes 4
extern int numlightmaps;
extern mvertex_t *r_pcurrentvertbase; extern int numlightmaps;
#ifndef LMBLOCK_WIDTH extern mvertex_t *r_pcurrentvertbase;
#define LMBLOCK_WIDTH 128
#define LMBLOCK_HEIGHT LMBLOCK_WIDTH #ifndef LMBLOCK_WIDTH
typedef struct glRect_s { #define LMBLOCK_WIDTH 128
unsigned char l,t,w,h; #define LMBLOCK_HEIGHT LMBLOCK_WIDTH
} glRect_t; typedef struct glRect_s {
typedef unsigned char stmap; unsigned char l,t,w,h;
} glRect_t;
typedef struct { typedef unsigned char stmap;
qboolean modified;
qboolean deluxmodified; typedef struct {
glRect_t rectchange; qboolean modified;
glRect_t deluxrectchange; qboolean deluxmodified;
int allocated[LMBLOCK_WIDTH]; glRect_t rectchange;
qbyte lightmaps[4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; glRect_t deluxrectchange;
qbyte deluxmaps[4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; //fixme: make seperate structure for easy disabling with less memory usage. int allocated[LMBLOCK_WIDTH];
stmap stainmaps[3*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; //rgb no a. added to lightmap for added (hopefully) speed. qbyte lightmaps[4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT];
} lightmapinfo_t; qbyte deluxmaps[4*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; //fixme: make seperate structure for easy disabling with less memory usage.
#endif stmap stainmaps[3*LMBLOCK_WIDTH*LMBLOCK_HEIGHT]; //rgb no a. added to lightmap for added (hopefully) speed.
} lightmapinfo_t;
extern LPDIRECT3DTEXTURE9 *lightmap_d3d9textures; #endif
extern LPDIRECT3DTEXTURE9 *deluxmap_d3d9textures;
extern lightmapinfo_t **lightmap; extern LPDIRECT3DTEXTURE9 *lightmap_d3d9textures;
extern LPDIRECT3DTEXTURE9 *deluxmap_d3d9textures;
extern void *d3dexplosiontexture; extern lightmapinfo_t **lightmap;
extern void *d3dballtexture;
extern void *d3dexplosiontexture;
extern index_t dummyindex; extern void *d3dballtexture;
#if sizeof_index_t == 2
#define D3DFMT_QINDEX D3DFMT_INDEX16 extern index_t dummyindex;
#else #if sizeof_index_t == 2
#define D3DFMT_QINDEX D3DFMT_INDEX32 #define D3DFMT_QINDEX D3DFMT_INDEX16
#endif #else
#define D3DFMT_QINDEX D3DFMT_INDEX32
#endif #endif
#endif