mirror of
https://github.com/nzp-team/fteqw.git
synced 2025-03-22 00:01:32 +00:00
Fixed waterwarp with non-npot cards. Split doom wad support from doom map support.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3566 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
8921e7da9f
commit
c07cef9555
7 changed files with 191 additions and 282 deletions
|
@ -2097,16 +2097,37 @@ static void BE_RenderMeshProgram(const shader_t *shader, const shaderpass_t *pas
|
|||
break;
|
||||
case SP_TOPCOLOURS:
|
||||
R_FetchTopColour(&r, &g, &b);
|
||||
param3[0] = r/255;
|
||||
param3[1] = g/255;
|
||||
param3[2] = b/255;
|
||||
param3[0] = r/255.0f;
|
||||
param3[1] = g/255.0f;
|
||||
param3[2] = b/255.0f;
|
||||
qglUniform3fvARB(s->progparm[i].handle, 1, param3);
|
||||
break;
|
||||
case SP_BOTTOMCOLOURS:
|
||||
R_FetchBottomColour(&r, &g, &b);
|
||||
param3[0] = r/255;
|
||||
param3[1] = g/255;
|
||||
param3[2] = b/255;
|
||||
param3[0] = r/255.0f;
|
||||
param3[1] = g/255.0f;
|
||||
param3[2] = b/255.0f;
|
||||
qglUniform3fvARB(s->progparm[i].handle, 1, param3);
|
||||
break;
|
||||
|
||||
case SP_RENDERTEXTURESCALE:
|
||||
if (gl_config.arb_texture_non_power_of_two)
|
||||
{
|
||||
param3[0] = 1;
|
||||
param3[1] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
r = 1;
|
||||
g = 1;
|
||||
while (r < vid.pixelwidth)
|
||||
r *= 2;
|
||||
while (g < vid.pixelheight)
|
||||
g *= 2;
|
||||
param3[0] = vid.pixelwidth/(float)r;
|
||||
param3[1] = vid.pixelheight/(float)g;
|
||||
}
|
||||
param3[2] = 1;
|
||||
qglUniform3fvARB(s->progparm[i].handle, 1, param3);
|
||||
break;
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ qboolean Mod_LoadQ2BrushModel (model_t *mod, void *buffer);
|
|||
qboolean Mod_LoadHLModel (model_t *mod, void *buffer);
|
||||
model_t *RMod_LoadModel (model_t *mod, qboolean crash);
|
||||
|
||||
#ifdef DOOMWADS
|
||||
#ifdef MAP_DOOM
|
||||
qboolean Mod_LoadDoomLevel(model_t *mod);
|
||||
#endif
|
||||
|
||||
|
@ -633,7 +633,7 @@ model_t *RMod_LoadModel (model_t *mod, qboolean crash)
|
|||
continue;
|
||||
break;
|
||||
#endif
|
||||
#ifdef DOOMWADS
|
||||
#ifdef MAP_DOOM
|
||||
case (('D'<<24)+('A'<<16)+('W'<<8)+'I'): //the id is hacked by the FS .wad loader (main wad).
|
||||
case (('D'<<24)+('A'<<16)+('W'<<8)+'P'): //the id is hacked by the FS .wad loader (patch wad).
|
||||
if (!Mod_LoadDoomLevel (mod))
|
||||
|
@ -666,6 +666,14 @@ model_t *RMod_LoadModel (model_t *mod, qboolean crash)
|
|||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef MAP_PROC
|
||||
if (!strcmp(com_token, "PROC")) //custom format, text based, specifies skeletal models to load and which md5anim files to use.
|
||||
{
|
||||
if (!Mod_LoadMap_Proc (mod, buf))
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
#ifdef TERRAIN
|
||||
if (!strcmp(com_token, "terrain")) //custom format, text based.
|
||||
{
|
||||
|
@ -3490,7 +3498,7 @@ typedef struct {
|
|||
short xpos;
|
||||
short ypos;
|
||||
} doomimage_t;
|
||||
static int FindDoomSprites(char *name, int size, void *param)
|
||||
static int FindDoomSprites(const char *name, int size, void *param)
|
||||
{
|
||||
if (*(int *)param + strlen(name)+1 > 16000)
|
||||
Sys_Error("Too many doom sprites\n");
|
||||
|
@ -3542,8 +3550,6 @@ static void LoadDoomSpriteFrame(char *imagename, mspriteframedesc_t *pdesc, int
|
|||
palette = COM_LoadTempFile("wad/playpal");
|
||||
header = (doomimage_t *)COM_LoadTempFile2(imagename);
|
||||
data = (qbyte *)header;
|
||||
pframe->width = header->width;
|
||||
pframe->height = header->height;
|
||||
pframe->up = +header->ypos;
|
||||
pframe->down = -header->height + header->ypos;
|
||||
|
||||
|
@ -3592,7 +3598,10 @@ static void LoadDoomSpriteFrame(char *imagename, mspriteframedesc_t *pdesc, int
|
|||
}
|
||||
}
|
||||
|
||||
pframe->gl_texturenum = GL_LoadTexture8Pal24(imagename, pframe->width, pframe->height, image, palette, true, true);
|
||||
pframe->shader = R_RegisterShader(imagename,
|
||||
"{\n{\nmap $diffuse\nblendfunc blend\n}\n}\n");
|
||||
pframe->shader->defaulttextures.base = R_LoadTexture8Pal24(imagename, header->width, header->height, image, palette, IF_CLAMP);
|
||||
R_BuildDefaultTexnums(&pframe->shader->defaulttextures, pframe->shader);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -167,7 +167,7 @@ void GL_InitSceneProcessingShaders_WaterWarp (void)
|
|||
{\
|
||||
gl_Position = ftransform();\
|
||||
v_stc = (1.0+(gl_Position.xy / gl_Position.w))/2.0;\
|
||||
v_warp.s = "/*FIXME: Multiply by screen matricies*/"time * 0.25 + gl_MultiTexCoord0.s;\
|
||||
v_warp.s = time * 0.25 + gl_MultiTexCoord0.s;\
|
||||
v_warp.t = time * 0.25 + gl_MultiTexCoord0.t;\
|
||||
v_edge = gl_MultiTexCoord0.xy;\
|
||||
}\
|
||||
|
@ -182,6 +182,7 @@ void GL_InitSceneProcessingShaders_WaterWarp (void)
|
|||
uniform sampler2D texWarp;\
|
||||
uniform sampler2D texEdge;\
|
||||
uniform float ampscale;\
|
||||
uniform vec3 rendertexturescale;\
|
||||
void main (void)\
|
||||
{\
|
||||
float amptemp;\
|
||||
|
@ -195,7 +196,7 @@ void GL_InitSceneProcessingShaders_WaterWarp (void)
|
|||
vec2 temp;\
|
||||
temp.x = v_stc.x + offset.x * amptemp;\
|
||||
temp.y = v_stc.y + offset.y * amptemp;\
|
||||
gl_FragColor = texture2D( texScreen, temp );\
|
||||
gl_FragColor = texture2D( texScreen, temp*rendertexturescale.st );\
|
||||
}\
|
||||
\n"
|
||||
"#endif\n"
|
||||
|
@ -205,6 +206,7 @@ void GL_InitSceneProcessingShaders_WaterWarp (void)
|
|||
"param texture 1 texWarp\n"
|
||||
"param texture 2 texEdge\n"
|
||||
"param time time\n"
|
||||
"param rendertexturescale rendertexturescale\n"
|
||||
"{\n"
|
||||
"map $currentrender\n"
|
||||
"}\n"
|
||||
|
@ -1225,8 +1227,6 @@ r_refdef must be set before the first call
|
|||
*/
|
||||
void R_RenderScene (void)
|
||||
{
|
||||
qboolean GLR_DoomWorld(void);
|
||||
|
||||
if (!cl.worldmodel || (!cl.worldmodel->nodes && cl.worldmodel->type != mod_heightmap))
|
||||
r_refdef.flags |= Q2RDF_NOWORLDMODEL;
|
||||
|
||||
|
@ -1238,13 +1238,8 @@ void R_RenderScene (void)
|
|||
|
||||
if (!(r_refdef.flags & Q2RDF_NOWORLDMODEL))
|
||||
{
|
||||
#ifdef DOOMWADS
|
||||
if (!GLR_DoomWorld ())
|
||||
#endif
|
||||
{
|
||||
TRACE(("dbg: calling R_DrawWorld\n"));
|
||||
Surf_DrawWorld (); // adds static entities to the list
|
||||
}
|
||||
TRACE(("dbg: calling R_DrawWorld\n"));
|
||||
Surf_DrawWorld (); // adds static entities to the list
|
||||
}
|
||||
|
||||
S_ExtraUpdate (); // don't let sound get messed up if going slow
|
||||
|
|
|
@ -784,6 +784,8 @@ static void Shader_ProgramParam ( shader_t *shader, shaderpass_t *pass, char **p
|
|||
parmtype = SP_LIGHTCOLOUR;
|
||||
else if (!Q_stricmp(token, "lightpos"))
|
||||
parmtype = SP_LIGHTPOSITION;
|
||||
else if (!Q_stricmp(token, "rendertexturescale"))
|
||||
parmtype = SP_RENDERTEXTURESCALE;
|
||||
else
|
||||
Con_Printf("shader %s: parameter type \"%s\" not known\n", shader->name, token);
|
||||
|
||||
|
@ -1656,6 +1658,8 @@ void Shader_Shutdown (void)
|
|||
shadercache_t *cache, *cache_next;
|
||||
|
||||
shader = r_shaders;
|
||||
if (!r_shaders)
|
||||
return; /*nothing needs freeing yet*/
|
||||
for (i = 0; i < MAX_SHADERS; i++, shader++)
|
||||
{
|
||||
if ( !shader->uses )
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
#include "quakedef.h"
|
||||
#ifdef DOOMWADS
|
||||
#ifdef MAP_DOOM
|
||||
#ifdef GLQUAKE
|
||||
#include "glquake.h"
|
||||
#include "shader.h"
|
||||
|
||||
#include "doommap.h"
|
||||
|
||||
vec_t VectorNormalize2 (vec3_t v, vec3_t out);
|
||||
int SignbitsForPlane (mplane_t *out);
|
||||
int PlaneTypeForNormal ( vec3_t normal );
|
||||
|
||||
|
@ -17,7 +17,6 @@ int PlaneTypeForNormal ( vec3_t normal );
|
|||
|
||||
//(aol suck)
|
||||
|
||||
void Doom_SetHullFuncs(hull_t *hull);
|
||||
void Doom_SetModelFunc(model_t *mod);
|
||||
|
||||
//skill/dm is appears in rather than quake's excuded in.
|
||||
|
@ -37,49 +36,29 @@ int Doom_SectorNearPoint(vec3_t p);
|
|||
//4. That ALL sectors are fully enclosed, and not made of two areas.
|
||||
//5. That no sectors are inside out.
|
||||
|
||||
enum {
|
||||
THING_PLAYER = 1,
|
||||
THING_PLAYER2 = 2,
|
||||
THING_PLAYER3 = 3,
|
||||
THING_PLAYER4 = 4,
|
||||
THING_DMSPAWN = 11,
|
||||
|
||||
//we need to balance weapons according to ammo types.
|
||||
THING_WCHAINSAW = 2005, //-> quad
|
||||
THING_WSHOTGUN1 = 2001, //-> ng
|
||||
THING_WSHOTGUN2 = 82, //-> sng
|
||||
THING_WCHAINGUN = 2002, //-> ssg
|
||||
THING_WROCKETL = 2003, //-> lightning
|
||||
THING_WPLASMA = 2004, //-> grenade
|
||||
THING_WBFG = 2006 //-> rocket
|
||||
|
||||
|
||||
} THING_TYPES;
|
||||
|
||||
|
||||
|
||||
|
||||
extern ddoomnode_t *nodel;
|
||||
extern dssector_t *ssectorsl;
|
||||
extern dthing_t *thingsl;
|
||||
extern mdoomvertex_t *vertexesl;
|
||||
extern dgl_seg3_t *segsl;
|
||||
extern dlinedef_t *linedefsl;
|
||||
extern msidedef_t *sidedefsm;
|
||||
extern msector_t *sectorm;
|
||||
extern plane_t *nodeplanes;
|
||||
extern plane_t *lineplanes;
|
||||
extern blockmapheader_t *blockmapl;
|
||||
extern unsigned short *blockmapofs;
|
||||
extern unsigned int nodec;
|
||||
extern unsigned int sectorc;
|
||||
extern unsigned int segsc;
|
||||
extern unsigned int ssectorsc;
|
||||
extern unsigned int thingsc;
|
||||
extern unsigned int linedefsc;
|
||||
extern unsigned int sidedefsc;
|
||||
extern unsigned int vertexesc;
|
||||
extern unsigned int vertexsglbase;
|
||||
ddoomnode_t *nodel;
|
||||
dssector_t *ssectorsl;
|
||||
dthing_t *thingsl;
|
||||
mdoomvertex_t *vertexesl;
|
||||
dgl_seg3_t *segsl;
|
||||
dlinedef_t *linedefsl;
|
||||
msidedef_t *sidedefsm;
|
||||
msector_t *sectorm;
|
||||
plane_t *nodeplanes;
|
||||
plane_t *lineplanes;
|
||||
blockmapheader_t *blockmapl;
|
||||
unsigned short *blockmapofs;
|
||||
unsigned int nodec;
|
||||
unsigned int sectorc;
|
||||
unsigned int segsc;
|
||||
unsigned int ssectorsc;
|
||||
unsigned int thingsc;
|
||||
unsigned int linedefsc;
|
||||
unsigned int sidedefsc;
|
||||
unsigned int vertexesc;
|
||||
unsigned int vertexsglbase;
|
||||
|
||||
extern model_t *loadmodel;
|
||||
extern char loadname[];
|
||||
|
@ -98,11 +77,11 @@ static qboolean paletteloaded;
|
|||
void Doom_LoadPalette(void)
|
||||
{
|
||||
char *file;
|
||||
int tex;
|
||||
int greyscale;
|
||||
if (!paletteloaded)
|
||||
{
|
||||
paletteloaded = true;
|
||||
file = COM_LoadMallocFile("wad/playpal");
|
||||
file = FS_LoadMallocFile("wad/playpal");
|
||||
if (file)
|
||||
{
|
||||
memcpy(doompalette, file, 768);
|
||||
|
@ -110,48 +89,53 @@ void Doom_LoadPalette(void)
|
|||
}
|
||||
else
|
||||
{
|
||||
for (tex = 0; tex < 256; tex++)
|
||||
for (greyscale = 0; greyscale < 256; greyscale++)
|
||||
{
|
||||
doompalette[tex*3+0] = tex;
|
||||
doompalette[tex*3+1] = tex;
|
||||
doompalette[tex*3+2] = tex;
|
||||
doompalette[greyscale*3+0] = greyscale;
|
||||
doompalette[greyscale*3+1] = greyscale;
|
||||
doompalette[greyscale*3+2] = greyscale;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int Doom_LoadFlat(char *name)
|
||||
shader_t *Doom_LoadFlat(char *name)
|
||||
{
|
||||
char *file;
|
||||
char texname[64];
|
||||
int tex;
|
||||
shader_t *shad;
|
||||
|
||||
Doom_LoadPalette();
|
||||
|
||||
sprintf(texname, "flat-%-.8s", name);
|
||||
Q_strlwr(texname);
|
||||
tex = R_LoadReplacementTexture(texname, "flats", true, false, true);
|
||||
if (tex)
|
||||
return tex;
|
||||
|
||||
sprintf(texname, "flats/%-.8s", name);
|
||||
Q_strlwr(texname);
|
||||
file = COM_LoadMallocFile(texname);
|
||||
shad = R_RegisterShader(texname, "{\n{\nmap $diffuse\n}\n}\n");
|
||||
file = FS_LoadMallocFile(texname);
|
||||
if (file)
|
||||
{
|
||||
tex = GL_LoadTexture8Pal24(texname, 64, 64, file, doompalette, true, false);
|
||||
shad->defaulttextures.base = R_LoadTexture8Pal24(texname, 64, 64, file, doompalette, 0);
|
||||
Z_Free(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
tex = 0;
|
||||
Con_Printf("Flat %-0.8s not found\n", name);
|
||||
}
|
||||
|
||||
return tex;
|
||||
return shad;
|
||||
}
|
||||
|
||||
static void GLR_DrawWall(unsigned short texnum, unsigned short s, unsigned short t, float x1, float y1, float frontfloor, float x2, float y2, float backfloor, qboolean unpegged)
|
||||
typedef struct
|
||||
{
|
||||
char name[8];
|
||||
shader_t *shader;
|
||||
unsigned short width;
|
||||
unsigned short height;
|
||||
batch_t *batch;
|
||||
} gldoomtexture_t;
|
||||
gldoomtexture_t *gldoomtextures;
|
||||
int numgldoomtextures;
|
||||
|
||||
static void GLR_DrawWall(int texnum, int s, int t, float x1, float y1, float frontfloor, float x2, float y2, float backfloor, qboolean unpegged, unsigned int colour4b)
|
||||
{
|
||||
gldoomtexture_t *tex = gldoomtextures+texnum;
|
||||
float len = sqrt((x1-x2)*(x1-x2) + (y1-y2)*(y1-y2));
|
||||
|
@ -173,6 +157,7 @@ static void GLR_DrawWall(unsigned short texnum, unsigned short s, unsigned short
|
|||
}
|
||||
|
||||
|
||||
#if 0
|
||||
GL_Bind(tex->gltexture);
|
||||
|
||||
qglBegin(GL_QUADS);
|
||||
|
@ -185,6 +170,7 @@ static void GLR_DrawWall(unsigned short texnum, unsigned short s, unsigned short
|
|||
qglTexCoord2f(s2, t2);
|
||||
qglVertex3f(x2, y2, frontfloor);
|
||||
qglEnd();
|
||||
#endif
|
||||
}
|
||||
|
||||
static void GLR_DrawSSector(unsigned int ssec)
|
||||
|
@ -200,8 +186,32 @@ static void GLR_DrawSSector(unsigned int ssec)
|
|||
break;
|
||||
sec = sectorm + sidedefsm[linedefsl[segsl[seg].linedef].sidedef[segsl[seg].direction]].sector;
|
||||
|
||||
qglColor4ub(sec->lightlev, sec->lightlev, sec->lightlev, 255);
|
||||
sec->visframe = r_visframecount;
|
||||
if (sec->visframe != r_visframecount)
|
||||
{
|
||||
#if 0
|
||||
qglColor4ub(sectorm[i].lightlev, sectorm[i].lightlev, sectorm[i].lightlev, 255);
|
||||
GL_Bind(sectorm[i].floortex);
|
||||
qglBegin(GL_TRIANGLES);
|
||||
for (v = 0; v < sectorm[i].numflattris*3; v++)
|
||||
{
|
||||
v1 = sectorm[i].flats[v];
|
||||
qglTexCoord2f(vertexesl[v1].xpos/64.0f, vertexesl[v1].ypos/64.0f);
|
||||
qglVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sectorm[i].floorheight);
|
||||
}
|
||||
qglEnd();
|
||||
|
||||
GL_Bind(sectorm[i].ceilingtex);
|
||||
qglBegin(GL_TRIANGLES);
|
||||
for (v = sectorm[i].numflattris*3-1; v >= 0; v--)
|
||||
{
|
||||
v1 = sectorm[i].flats[v];
|
||||
qglTexCoord2f(vertexesl[v1].xpos/64.0f, vertexesl[v1].ypos/64.0f);
|
||||
qglVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sectorm[i].ceilingheight);
|
||||
}
|
||||
qglEnd();
|
||||
#endif
|
||||
sec->visframe = r_visframecount;
|
||||
}
|
||||
for (seg = ssectorsl[ssec].first + ssectorsl[ssec].segcount-1; seg >= ssectorsl[ssec].first; seg--)
|
||||
{
|
||||
if (segsl[seg].linedef == 0xffff)
|
||||
|
@ -224,32 +234,16 @@ static void GLR_DrawSSector(unsigned int ssec)
|
|||
sidedefsm[ld->sidedef[1-segsl[seg].direction]].texx,
|
||||
sidedefsm[ld->sidedef[1-segsl[seg].direction]].texy,
|
||||
vertexesl[v0].xpos, vertexesl[v0].ypos, sec->floorheight,
|
||||
vertexesl[v1].xpos, vertexesl[v1].ypos, sec2->floorheight, ld->flags & LINEDEF_LOWERUNPEGGED);
|
||||
vertexesl[v1].xpos, vertexesl[v1].ypos, sec2->floorheight, ld->flags & LINEDEF_LOWERUNPEGGED, sec->lightlev);
|
||||
}
|
||||
|
||||
if (sec->ceilingheight > sec2->ceilingheight)
|
||||
{
|
||||
// if (sec2->ceilingheight != sec2->floorheight)
|
||||
// sec2->floorheight = sec2->ceilingheight-32;
|
||||
|
||||
GLR_DrawWall(sidedefsm[sd].uppertex,
|
||||
sidedefsm[ld->sidedef[1-segsl[seg].direction]].texx,
|
||||
sidedefsm[ld->sidedef[1-segsl[seg].direction]].texy,
|
||||
vertexesl[v0].xpos, vertexesl[v0].ypos, sec2->ceilingheight,
|
||||
vertexesl[v1].xpos, vertexesl[v1].ypos, sec->ceilingheight, ld->flags & LINEDEF_UPPERUNPEGGED);
|
||||
|
||||
/*
|
||||
GL_Bind(sidedefsm[sd].uppertex);
|
||||
glBegin(GL_QUADS);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex3f(vertexesl[v0].xpos, vertexesl[v0].ypos, sec2->ceilingheight);
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex3f(vertexesl[v0].xpos, vertexesl[v0].ypos, sec->ceilingheight);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sec->ceilingheight);
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sec2->ceilingheight);
|
||||
glEnd();*/
|
||||
vertexesl[v1].xpos, vertexesl[v1].ypos, sec->ceilingheight, ld->flags & LINEDEF_UPPERUNPEGGED, sec->lightlev);
|
||||
}
|
||||
|
||||
if (sidedefsm[sd].middletex)
|
||||
|
@ -258,40 +252,7 @@ static void GLR_DrawSSector(unsigned int ssec)
|
|||
sidedefsm[ld->sidedef[segsl[seg].direction]].texx,
|
||||
sidedefsm[ld->sidedef[segsl[seg].direction]].texy,
|
||||
vertexesl[v1].xpos, vertexesl[v1].ypos, (sec2->ceilingheight < sec->ceilingheight)?sec2->ceilingheight:sec->ceilingheight,
|
||||
vertexesl[v0].xpos, vertexesl[v0].ypos, (sec2->floorheight > sec->floorheight)?sec2->floorheight:sec->floorheight, false);
|
||||
/*
|
||||
GL_Bind(sidedefsm[sd].middletex);
|
||||
glBegin(GL_QUADS);
|
||||
if (sec2->ceilingheight < sec->ceilingheight)
|
||||
{
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex3f(vertexesl[v0].xpos, vertexesl[v0].ypos, sec2->ceilingheight);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sec2->ceilingheight);
|
||||
}
|
||||
else
|
||||
{
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex3f(vertexesl[v0].xpos, vertexesl[v0].ypos, sec->ceilingheight);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sec->ceilingheight);
|
||||
}
|
||||
if (sec2->floorheight > sec->floorheight)
|
||||
{
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sec2->floorheight);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex3f(vertexesl[v0].xpos, vertexesl[v0].ypos, sec2->floorheight);
|
||||
}
|
||||
else
|
||||
{
|
||||
glTexCoord2f(1, 1);
|
||||
glVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sec->floorheight);
|
||||
glTexCoord2f(0, 1);
|
||||
glVertex3f(vertexesl[v0].xpos, vertexesl[v0].ypos, sec->floorheight);
|
||||
}
|
||||
glEnd();
|
||||
*/
|
||||
vertexesl[v0].xpos, vertexesl[v0].ypos, (sec2->floorheight > sec->floorheight)?sec2->floorheight:sec->floorheight, false, sec->lightlev);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -301,35 +262,7 @@ static void GLR_DrawSSector(unsigned int ssec)
|
|||
sidedefsm[ld->sidedef[segsl[seg].direction]].texx,
|
||||
sidedefsm[ld->sidedef[segsl[seg].direction]].texy,
|
||||
vertexesl[v0].xpos, vertexesl[v0].ypos, sec->floorheight,
|
||||
vertexesl[v1].xpos, vertexesl[v1].ypos, sec->ceilingheight, false);
|
||||
#if 0
|
||||
|
||||
GL_Bind(sidedefsm[sd].middletex);
|
||||
glBegin(GL_QUADS);
|
||||
/* if (ld->flags & LINEDEF_LOWERUNPEGGED)
|
||||
{
|
||||
glTexCoord2f(0, 0);
|
||||
glVertex3f(vertexesl[v0].xpos, vertexesl[v0].ypos, sec->floorheight);
|
||||
glTexCoord2f(0, (sec->ceilingheight-sec->floorheight)/64.0f);
|
||||
glVertex3f(vertexesl[v0].xpos, vertexesl[v0].ypos, sec->ceilingheight);
|
||||
glTexCoord2f(1, (sec->ceilingheight-sec->floorheight)/64.0f);
|
||||
glVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sec->ceilingheight);
|
||||
glTexCoord2f(1, 0);
|
||||
glVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sec->floorheight);
|
||||
}
|
||||
else*/
|
||||
{
|
||||
glTexCoord2f(0, (sec->ceilingheight)/128.0f);
|
||||
glVertex3f(vertexesl[v0].xpos, vertexesl[v0].ypos, sec->floorheight);
|
||||
glTexCoord2f(0, (sec->floorheight)/128.0f);
|
||||
glVertex3f(vertexesl[v0].xpos, vertexesl[v0].ypos, sec->ceilingheight);
|
||||
glTexCoord2f(1, (sec->floorheight)/128.0f);
|
||||
glVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sec->ceilingheight);
|
||||
glTexCoord2f(1, (sec->ceilingheight)/128.0f);
|
||||
glVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sec->floorheight);
|
||||
}
|
||||
glEnd();
|
||||
#endif
|
||||
vertexesl[v1].xpos, vertexesl[v1].ypos, sec->ceilingheight, false, sec->lightlev);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -463,55 +396,13 @@ static void GLR_RecursiveDoomNode(unsigned int node)
|
|||
GLR_RecursiveDoomNode(nodel[node].node2);
|
||||
}
|
||||
|
||||
qboolean GLR_DoomWorld(void)
|
||||
void GLR_DoomWorld(void)
|
||||
{
|
||||
int i, v;
|
||||
int v1;
|
||||
|
||||
if (cl.worldmodel->fromgame != fg_doom)
|
||||
return false;
|
||||
|
||||
if (!nodel || !nodec)
|
||||
return true; //err... buggy
|
||||
return; //err... buggy
|
||||
|
||||
qglTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
qglDisable(GL_BLEND);
|
||||
qglDisable(GL_ALPHA_TEST);
|
||||
qglEnable(GL_CULL_FACE);
|
||||
GL_DisableMultitexture();
|
||||
r_visframecount++;
|
||||
GLR_RecursiveDoomNode(nodec-1);
|
||||
|
||||
if (developer.value)
|
||||
qglPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
for (i = 0; i < sectorc; i++)
|
||||
{
|
||||
if (sectorm[i].visframe == r_visframecount)
|
||||
{
|
||||
qglColor4ub(sectorm[i].lightlev, sectorm[i].lightlev, sectorm[i].lightlev, 255);
|
||||
GL_Bind(sectorm[i].floortex);
|
||||
qglBegin(GL_TRIANGLES);
|
||||
for (v = 0; v < sectorm[i].numflattris*3; v++)
|
||||
{
|
||||
v1 = sectorm[i].flats[v];
|
||||
qglTexCoord2f(vertexesl[v1].xpos/64.0f, vertexesl[v1].ypos/64.0f);
|
||||
qglVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sectorm[i].floorheight);
|
||||
}
|
||||
qglEnd();
|
||||
|
||||
GL_Bind(sectorm[i].ceilingtex);
|
||||
qglBegin(GL_TRIANGLES);
|
||||
for (v = sectorm[i].numflattris*3-1; v >= 0; v--)
|
||||
{
|
||||
v1 = sectorm[i].flats[v];
|
||||
qglTexCoord2f(vertexesl[v1].xpos/64.0f, vertexesl[v1].ypos/64.0f);
|
||||
qglVertex3f(vertexesl[v1].xpos, vertexesl[v1].ypos, sectorm[i].ceilingheight);
|
||||
}
|
||||
qglEnd();
|
||||
}
|
||||
}
|
||||
qglPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -763,7 +654,7 @@ static void Triangulate_Sectors(dsector_t *sectorl, qboolean glbspinuse)
|
|||
int seg, nsec;
|
||||
int i, sec=-1;
|
||||
|
||||
sectorm = BZ_Malloc(sectorc * sizeof(*sectorm));
|
||||
sectorm = Z_Malloc(sectorc * sizeof(*sectorm));
|
||||
|
||||
#ifdef GLQUAKE
|
||||
if (glbspinuse)
|
||||
|
@ -849,9 +740,9 @@ static void *textures2;
|
|||
static char *pnames;
|
||||
static void Doom_LoadTextureInfos(void)
|
||||
{
|
||||
textures1 = COM_LoadMallocFile("wad/texture1");
|
||||
textures2 = COM_LoadMallocFile("wad/texture2");
|
||||
pnames = COM_LoadMallocFile("wad/pnames");
|
||||
textures1 = FS_LoadMallocFile("wad/texture1");
|
||||
textures2 = FS_LoadMallocFile("wad/texture2");
|
||||
pnames = FS_LoadMallocFile("wad/pnames");
|
||||
}
|
||||
|
||||
typedef struct {
|
||||
|
@ -947,12 +838,13 @@ static void Doom_ExtractPName(unsigned int *out, doomimage_t *di, int outwidth,
|
|||
}
|
||||
}
|
||||
|
||||
static int Doom_LoadPatchFromTexWad(char *name, void *texlump, unsigned short *width, unsigned short *height)
|
||||
static texid_t Doom_LoadPatchFromTexWad(char *name, void *texlump, unsigned short *width, unsigned short *height)
|
||||
{
|
||||
char patch[32] = "patches/";
|
||||
unsigned int *tex;
|
||||
ddoomtexture_t *tx;
|
||||
ddoomtexturecomponant_t *tc;
|
||||
texid_t result;
|
||||
int i;
|
||||
int count;
|
||||
|
||||
|
@ -978,15 +870,15 @@ static int Doom_LoadPatchFromTexWad(char *name, void *texlump, unsigned short *w
|
|||
Doom_ExtractPName(tex, (doomimage_t *)COM_LoadTempFile(patch), tx->width, tx->height, tc->xoffset, tc->yoffset);
|
||||
}
|
||||
|
||||
i = GL_LoadTexture32(name, tx->width, tx->height, tex, true, true);
|
||||
result = R_LoadTexture32(name, tx->width, tx->height, tex, 0);
|
||||
BZ_Free(tex);
|
||||
return i;
|
||||
return result;
|
||||
}
|
||||
|
||||
tex++;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return r_nulltex;
|
||||
}
|
||||
static int Doom_LoadPatch(char *name)
|
||||
{
|
||||
|
@ -1007,21 +899,21 @@ static int Doom_LoadPatch(char *name)
|
|||
|
||||
strncpy(gldoomtextures[texnum].name, name, 8);
|
||||
|
||||
gldoomtextures[texnum].shader = R_RegisterShader(name, "{\n{\nmap $diffuse\n}\n}\n");
|
||||
|
||||
if (textures1)
|
||||
{
|
||||
gldoomtextures[texnum].gltexture = Doom_LoadPatchFromTexWad(name, textures1, &gldoomtextures[texnum].width, &gldoomtextures[texnum].height);
|
||||
if (gldoomtextures[texnum].gltexture)
|
||||
gldoomtextures[texnum].shader->defaulttextures.base = Doom_LoadPatchFromTexWad(name, textures1, &gldoomtextures[texnum].width, &gldoomtextures[texnum].height);
|
||||
if (TEXVALID(gldoomtextures[texnum].shader->defaulttextures.base))
|
||||
return texnum;
|
||||
}
|
||||
if (textures2)
|
||||
{
|
||||
gldoomtextures[texnum].gltexture = Doom_LoadPatchFromTexWad(name, textures2, &gldoomtextures[texnum].width, &gldoomtextures[texnum].height);
|
||||
if (gldoomtextures[texnum].gltexture)
|
||||
gldoomtextures[texnum].shader->defaulttextures.base = Doom_LoadPatchFromTexWad(name, textures2, &gldoomtextures[texnum].width, &gldoomtextures[texnum].height);
|
||||
if (TEXVALID(gldoomtextures[texnum].shader->defaulttextures.base))
|
||||
return texnum;
|
||||
}
|
||||
//all else failed.
|
||||
gldoomtextures[texnum].gltexture = Mod_LoadHiResTexture(name, "patches", true, false, true);
|
||||
gldoomtextures[texnum].width = image_width;
|
||||
gldoomtextures[texnum].height = image_height;
|
||||
return texnum;
|
||||
|
@ -1136,13 +1028,13 @@ void QuakifyThings(dthing_t *thingsl)
|
|||
name = "weapon_supershotgun";
|
||||
break;
|
||||
case THING_WROCKETL:
|
||||
name = "weapon_lightning";
|
||||
name = "weapon_rocketlauncher";
|
||||
break;
|
||||
case THING_WPLASMA:
|
||||
name = "weapon_grenadelauncher";
|
||||
break;
|
||||
case THING_WBFG:
|
||||
name = "weapon_rocketlauncher";
|
||||
name = "weapon_lightning";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1220,6 +1112,11 @@ void Doom_GeneratePlanes(ddoomnode_t *nodel)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
doom maps have no network limitations, but has +/-32767 map size limits (same as quake bsp)
|
||||
fte defaults to a +/- 4096 world
|
||||
a lot of maps are off-centered and can be moved to get them to fit fte's constraints, so if we can, do so
|
||||
*/
|
||||
static void MoveWorld(void)
|
||||
{
|
||||
int v;
|
||||
|
@ -1248,13 +1145,16 @@ static void MoveWorld(void)
|
|||
return; //doesn't need adjusting, live with it.
|
||||
|
||||
if (max[0]-min[0]>=8192 || max[1]-min[1]>=8192)
|
||||
{
|
||||
Con_Printf(CON_WARNING "Warning: Map is too large for the network protocol\n");
|
||||
|
||||
Con_Printf("Adjusting map\n");
|
||||
return;
|
||||
}
|
||||
|
||||
adj[0] = (max[0]-4096)&~63; //don't harm the tiling.
|
||||
adj[1] = (max[1]-4096)&~63;
|
||||
|
||||
Con_Printf("Adjusting map (%i %i)\n", -adj[0], -adj[1]);
|
||||
|
||||
for (v = 0; v < vertexesc; v++)
|
||||
{
|
||||
vertexesl[v].xpos -= adj[0];
|
||||
|
@ -1349,9 +1249,9 @@ static void Doom_LoadVerticies(char *name)
|
|||
|
||||
static void Doom_LoadSSectors(char *name)
|
||||
{
|
||||
ssectorsl = (void *)COM_LoadMallocFile (va("%s.gl_ssect", name));
|
||||
ssectorsl = (void *)FS_LoadMallocFile (va("%s.gl_ssect", name));
|
||||
if (!ssectorsl)
|
||||
ssectorsl = (void *)COM_LoadMallocFile (va("%s.ssectors", name));
|
||||
ssectorsl = (void *)FS_LoadMallocFile (va("%s.ssectors", name));
|
||||
//FIXME: "gNd3" means that it's glbsp version 3.
|
||||
ssectorsc = com_filesize/sizeof(*ssectorsl);
|
||||
}
|
||||
|
@ -1365,10 +1265,10 @@ static void Doom_LoadSSegs(char *name)
|
|||
dseg_t *s0;
|
||||
int i;
|
||||
|
||||
file = (void *)COM_LoadMallocFile (va("%s.gl_segs", name));
|
||||
file = (void *)FS_LoadMallocFile (va("%s.gl_segs", name));
|
||||
if (!file)
|
||||
{
|
||||
s0 = (void *)COM_LoadMallocFile (va("%s.segs", name));
|
||||
s0 = (void *)FS_LoadMallocFile (va("%s.segs", name));
|
||||
segsc = com_filesize/sizeof(*s0);
|
||||
|
||||
segsl = BZ_Malloc(segsc * sizeof(*segsl));
|
||||
|
@ -1433,7 +1333,7 @@ qboolean Mod_LoadDoomLevel(model_t *mod)
|
|||
return false;
|
||||
}
|
||||
|
||||
gl_nodes = (void *)COM_LoadMallocFile (va("%s.gl_nodes", name));
|
||||
gl_nodes = (void *)FS_LoadMallocFile (va("%s.gl_nodes", name));
|
||||
if (gl_nodes && com_filesize>0)
|
||||
{
|
||||
nodel = (void *)gl_nodes;
|
||||
|
@ -1442,10 +1342,10 @@ qboolean Mod_LoadDoomLevel(model_t *mod)
|
|||
else
|
||||
{
|
||||
gl_nodes=NULL;
|
||||
nodel = (void *)COM_LoadMallocFile (va("%s.nodes", name));
|
||||
nodel = (void *)FS_LoadMallocFile (va("%s.nodes", name));
|
||||
nodec = com_filesize/sizeof(*nodel);
|
||||
}
|
||||
sectorl = (void *)COM_LoadMallocFile (va("%s.sectors", name));
|
||||
sectorl = (void *)FS_LoadMallocFile (va("%s.sectors", name));
|
||||
sectorc = com_filesize/sizeof(*sectorl);
|
||||
|
||||
#ifndef SERVERONLY
|
||||
|
@ -1459,13 +1359,13 @@ qboolean Mod_LoadDoomLevel(model_t *mod)
|
|||
Doom_LoadSSegs(name);
|
||||
Doom_LoadSSectors(name);
|
||||
|
||||
thingsl = (void *)COM_LoadMallocFile (va("%s.things", name));
|
||||
thingsl = (void *)FS_LoadMallocFile (va("%s.things", name));
|
||||
thingsc = com_filesize/sizeof(*thingsl);
|
||||
linedefsl = (void *)COM_LoadMallocFile (va("%s.linedefs", name));
|
||||
linedefsl = (void *)FS_LoadMallocFile (va("%s.linedefs", name));
|
||||
linedefsc = com_filesize/sizeof(*linedefsl);
|
||||
sidedefsl = (void *)COM_LoadMallocFile (va("%s.sidedefs", name));
|
||||
sidedefsl = (void *)FS_LoadMallocFile (va("%s.sidedefs", name));
|
||||
sidedefsc = com_filesize/sizeof(*sidedefsl);
|
||||
blockmapl = (void *)COM_LoadMallocFile (va("%s.blockmap", name));
|
||||
blockmapl = (void *)FS_LoadMallocFile (va("%s.blockmap", name));
|
||||
// blockmaps = com_filesize;
|
||||
#ifndef SERVERONLY
|
||||
Doom_LoadTextureInfos();
|
||||
|
@ -1491,36 +1391,9 @@ qboolean Mod_LoadDoomLevel(model_t *mod)
|
|||
mod->hulls[0].clip_maxs[2] = 0;
|
||||
mod->hulls[0].available = true;
|
||||
|
||||
mod->hulls[1].clip_mins[0] = -16;
|
||||
mod->hulls[1].clip_mins[1] = -16;
|
||||
mod->hulls[1].clip_mins[2] = -24;
|
||||
mod->hulls[1].clip_maxs[0] = 16;
|
||||
mod->hulls[1].clip_maxs[1] = 16;
|
||||
mod->hulls[1].clip_maxs[2] = 32;
|
||||
mod->hulls[1].available = true;
|
||||
|
||||
mod->hulls[2].clip_mins[0] = -32;
|
||||
mod->hulls[2].clip_mins[1] = -32;
|
||||
mod->hulls[2].clip_mins[2] = -24;
|
||||
mod->hulls[2].clip_maxs[0] = 32;
|
||||
mod->hulls[2].clip_maxs[1] = 32;
|
||||
mod->hulls[2].clip_maxs[2] = 64;
|
||||
mod->hulls[2].available = true;
|
||||
|
||||
mod->hulls[3].clip_mins[0] = -16; //allow a crouched sized hull.
|
||||
mod->hulls[3].clip_mins[1] = -16;
|
||||
mod->hulls[3].clip_mins[2] = -6;
|
||||
mod->hulls[3].clip_maxs[0] = 16;
|
||||
mod->hulls[3].clip_maxs[1] = 16;
|
||||
mod->hulls[3].clip_maxs[2] = 30;
|
||||
mod->hulls[3].available = true;
|
||||
|
||||
for (h = 4; h < MAX_MAP_HULLSM; h++)
|
||||
for (h = 1; h < MAX_MAP_HULLSM; h++)
|
||||
mod->hulls[h].available = false;
|
||||
|
||||
for (h = 0; h < MAX_MAP_HULLSM; h++)
|
||||
Doom_SetHullFuncs(&mod->hulls[h]);
|
||||
|
||||
Doom_SetModelFunc(mod);
|
||||
|
||||
mod->needload = false;
|
||||
|
@ -1535,15 +1408,7 @@ qboolean Mod_LoadDoomLevel(model_t *mod)
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void Doom_SetHullFuncs(hull_t *hull)
|
||||
{
|
||||
hull->funcs.RecursiveHullCheck = Doom_RecursiveHullCheck;
|
||||
hull->funcs.HullPointContents = Doom_PointContents;
|
||||
}
|
||||
|
||||
void Doom_LightPointValues(vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t res_dir)
|
||||
void Doom_LightPointValues(model_t *model, vec3_t point, vec3_t res_diffuse, vec3_t res_ambient, vec3_t res_dir)
|
||||
{
|
||||
msector_t *sec;
|
||||
sec = sectorm + Doom_SectorNearPoint(point);
|
||||
|
@ -1559,16 +1424,17 @@ void Doom_LightPointValues(vec3_t point, vec3_t res_diffuse, vec3_t res_ambient,
|
|||
res_ambient[2] = sec->lightlev;
|
||||
}
|
||||
|
||||
void Doom_FatPVS(vec3_t org, qboolean add)
|
||||
unsigned int Doom_FatPVS(struct model_s *model, vec3_t org, qbyte *pvsbuffer, unsigned int buffersize, qboolean merge)
|
||||
{
|
||||
//FIXME: use REJECT lump.
|
||||
return 0;
|
||||
}
|
||||
|
||||
qboolean Doom_EdictInFatPVS(edict_t *edict)
|
||||
qboolean Doom_EdictInFatPVS(struct model_s *model, struct pvscache_s *edict, qbyte *pvsbuffer)
|
||||
{ //FIXME: use REJECT lump.
|
||||
return true;
|
||||
}
|
||||
void Doom_FindTouchedLeafs(edict_t *edict)
|
||||
void Doom_FindTouchedLeafs(struct model_s *model, struct pvscache_s *ent, vec3_t cullmins, vec3_t cullmaxs)
|
||||
{
|
||||
//work out the sectors this ent is in for easy pvs.
|
||||
}
|
||||
|
@ -1585,12 +1451,19 @@ void Doom_MarkLights(struct dlight_s *light, int bit, struct mnode_s *node)
|
|||
|
||||
void Doom_SetModelFunc(model_t *mod)
|
||||
{
|
||||
//mod->funcs.PurgeModel = ;
|
||||
|
||||
mod->funcs.FatPVS = Doom_FatPVS;
|
||||
mod->funcs.EdictInFatPVS = Doom_EdictInFatPVS;
|
||||
mod->funcs.FindTouchedLeafs_Q1 = Doom_FindTouchedLeafs;
|
||||
mod->funcs.FindTouchedLeafs = Doom_FindTouchedLeafs;
|
||||
|
||||
mod->funcs.LightPointValues = Doom_LightPointValues;
|
||||
mod->funcs.StainNode = Doom_StainNode;
|
||||
mod->funcs.MarkLights = Doom_MarkLights;
|
||||
|
||||
// mod->funcs.LeafPVS) (struct model_s *model, int num, qbyte *buffer, unsigned int buffersize);
|
||||
|
||||
Doom_SetCollisionFuncs(mod);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -356,6 +356,11 @@ void GL_DrawHeightmapModel (entity_t *e);
|
|||
qboolean GL_LoadHeightmapModel (model_t *mod, void *buffer);
|
||||
#endif
|
||||
|
||||
//doom
|
||||
#ifdef MAP_DOOM
|
||||
void GLR_DoomWorld();
|
||||
#endif
|
||||
|
||||
//gl_bloom.c
|
||||
#ifdef GLQUAKE
|
||||
void R_BloomRegister(void);
|
||||
|
|
|
@ -254,6 +254,8 @@ typedef struct {
|
|||
SP_EYEPOS,
|
||||
SP_ENTMATRIX,
|
||||
|
||||
SP_RENDERTEXTURESCALE, /*multiplier for currentrender->texcoord*/
|
||||
|
||||
SP_LIGHTRADIUS,
|
||||
SP_LIGHTCOLOUR,
|
||||
SP_LIGHTPOSITION,
|
||||
|
|
Loading…
Reference in a new issue