Few bug fixes and some q3 compatable shaders.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@354 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
ef1c50ef77
commit
4f36d50f60
43 changed files with 4306 additions and 389 deletions
|
@ -105,8 +105,8 @@ qboolean Cam_DrawViewModel(int pnum)
|
||||||
// returns true if we should draw this player, we don't if we are chase camming
|
// returns true if we should draw this player, we don't if we are chase camming
|
||||||
qboolean Cam_DrawPlayer(int pnum, int playernum)
|
qboolean Cam_DrawPlayer(int pnum, int playernum)
|
||||||
{
|
{
|
||||||
if (playernum == cl.playernum[pnum])
|
// if (playernum == cl.playernum[pnum])
|
||||||
return false;
|
// return false;
|
||||||
if (cl.spectator && autocam[pnum] && locked[pnum] && cl_chasecam.value &&
|
if (cl.spectator && autocam[pnum] && locked[pnum] && cl_chasecam.value &&
|
||||||
spec_track[pnum] == playernum)
|
spec_track[pnum] == playernum)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
// cl_ents.c -- entity parsing and management
|
// cl_ents.c -- entity parsing and management
|
||||||
|
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#include "particles.h"
|
||||||
|
|
||||||
extern cvar_t cl_predict_players;
|
extern cvar_t cl_predict_players;
|
||||||
extern cvar_t cl_predict_players2;
|
extern cvar_t cl_predict_players2;
|
||||||
|
|
|
@ -1064,7 +1064,7 @@ void CL_SendCmd (void)
|
||||||
//
|
//
|
||||||
// deliver the message
|
// deliver the message
|
||||||
//
|
//
|
||||||
Netchan_Transmit (&cls.netchan, buf.cursize, buf.data);
|
Netchan_Transmit (&cls.netchan, buf.cursize, buf.data, 2500);
|
||||||
|
|
||||||
if (cls.netchan.fatal_error)
|
if (cls.netchan.fatal_error)
|
||||||
{
|
{
|
||||||
|
|
|
@ -781,9 +781,9 @@ void CL_Disconnect (void)
|
||||||
final[0] = clc_stringcmd;
|
final[0] = clc_stringcmd;
|
||||||
strcpy (final+1, "drop");
|
strcpy (final+1, "drop");
|
||||||
}
|
}
|
||||||
Netchan_Transmit (&cls.netchan, strlen(final)+1, final);
|
Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500);
|
||||||
Netchan_Transmit (&cls.netchan, strlen(final)+1, final);
|
Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500);
|
||||||
Netchan_Transmit (&cls.netchan, strlen(final)+1, final);
|
Netchan_Transmit (&cls.netchan, strlen(final)+1, final, 2500);
|
||||||
}
|
}
|
||||||
|
|
||||||
cls.state = ca_disconnected;
|
cls.state = ca_disconnected;
|
||||||
|
|
|
@ -567,7 +567,7 @@ void CL_PredictMovePNum (int pnum)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
if (cl.intermission)
|
if (cl.intermission && cl.intermission != 3)
|
||||||
{
|
{
|
||||||
cl.crouch[pnum] = 0;
|
cl.crouch[pnum] = 0;
|
||||||
return;
|
return;
|
||||||
|
@ -598,7 +598,10 @@ void CL_PredictMovePNum (int pnum)
|
||||||
// this is the last frame received from the server
|
// this is the last frame received from the server
|
||||||
from = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
|
from = &cl.frames[cls.netchan.incoming_sequence & UPDATE_MASK];
|
||||||
|
|
||||||
|
if (!cl.intermission)
|
||||||
|
{
|
||||||
VectorCopy (cl.viewangles[pnum], cl.simangles[pnum]);
|
VectorCopy (cl.viewangles[pnum], cl.simangles[pnum]);
|
||||||
|
}
|
||||||
|
|
||||||
vel = from->playerstate[cl.playernum[pnum]].velocity;
|
vel = from->playerstate[cl.playernum[pnum]].velocity;
|
||||||
org = from->playerstate[cl.playernum[pnum]].origin;
|
org = from->playerstate[cl.playernum[pnum]].origin;
|
||||||
|
@ -638,6 +641,8 @@ void CL_PredictMovePNum (int pnum)
|
||||||
cls.netchan.outgoing_sequence; i++)
|
cls.netchan.outgoing_sequence; i++)
|
||||||
{
|
{
|
||||||
to = &cl.frames[(cls.netchan.incoming_sequence+i) & UPDATE_MASK];
|
to = &cl.frames[(cls.netchan.incoming_sequence+i) & UPDATE_MASK];
|
||||||
|
if (cl.intermission)
|
||||||
|
to->playerstate->pm_type = PM_FLY;
|
||||||
CL_PredictUsercmd (pnum, &from->playerstate[cl.playernum[pnum]]
|
CL_PredictUsercmd (pnum, &from->playerstate[cl.playernum[pnum]]
|
||||||
, &to->playerstate[cl.playernum[pnum]], &to->cmd[pnum]);
|
, &to->playerstate[cl.playernum[pnum]], &to->cmd[pnum]);
|
||||||
|
|
||||||
|
|
|
@ -1660,6 +1660,7 @@ CL_UpdateBeams
|
||||||
*/
|
*/
|
||||||
void CL_UpdateBeams (void)
|
void CL_UpdateBeams (void)
|
||||||
{
|
{
|
||||||
|
extern int rt_lightning1;
|
||||||
int i;
|
int i;
|
||||||
beam_t *b;
|
beam_t *b;
|
||||||
vec3_t dist, org;
|
vec3_t dist, org;
|
||||||
|
@ -1741,6 +1742,14 @@ void CL_UpdateBeams (void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
// if (part_type[rt_lightning1].loaded)
|
||||||
|
{
|
||||||
|
trailstate_t ts;
|
||||||
|
memset(&ts, 0, sizeof(ts));
|
||||||
|
R_RocketTrail(b->start, b->end, rt_lightning1, &ts);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// add new entities for the lightning
|
// add new entities for the lightning
|
||||||
VectorCopy (b->start, org);
|
VectorCopy (b->start, org);
|
||||||
d = VectorNormalize(dist);
|
d = VectorNormalize(dist);
|
||||||
|
|
|
@ -74,7 +74,7 @@ typedef struct {
|
||||||
|
|
||||||
static fragstats_t fragstats;
|
static fragstats_t fragstats;
|
||||||
|
|
||||||
void Stats_Message(char *msg, ...)
|
void VARGS Stats_Message(char *msg, ...)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,7 +56,10 @@ int pe_default,
|
||||||
int rt_blastertrail,
|
int rt_blastertrail,
|
||||||
rt_railtrail,
|
rt_railtrail,
|
||||||
rt_bubbletrail,
|
rt_bubbletrail,
|
||||||
rt_rocket;
|
rt_rocket,
|
||||||
|
rt_lightning1,
|
||||||
|
rt_lightning2,
|
||||||
|
rt_lightning3;
|
||||||
|
|
||||||
//triangle fan sparks use these.
|
//triangle fan sparks use these.
|
||||||
static double sint[7] = {0.000000, 0.781832, 0.974928, 0.433884, -0.433884, -0.974928, -0.781832};
|
static double sint[7] = {0.000000, 0.781832, 0.974928, 0.433884, -0.433884, -0.974928, -0.781832};
|
||||||
|
@ -913,6 +916,10 @@ void R_InitParticles (void)
|
||||||
rt_bubbletrail = AllocateParticleType("t_bubbletrail");
|
rt_bubbletrail = AllocateParticleType("t_bubbletrail");
|
||||||
rt_rocket = AllocateParticleType("t_rocket");
|
rt_rocket = AllocateParticleType("t_rocket");
|
||||||
|
|
||||||
|
rt_lightning1 = AllocateParticleType("t_lightning1");
|
||||||
|
rt_lightning2 = AllocateParticleType("t_lightning2");
|
||||||
|
rt_lightning3 = AllocateParticleType("t_lightning3");
|
||||||
|
|
||||||
pt_superbullet = AllocateParticleType("te_superbullet");
|
pt_superbullet = AllocateParticleType("te_superbullet");
|
||||||
pt_bullet = AllocateParticleType("te_bullet");
|
pt_bullet = AllocateParticleType("te_bullet");
|
||||||
pe_default = AllocateParticleType("pe_default");
|
pe_default = AllocateParticleType("pe_default");
|
||||||
|
@ -2036,7 +2043,9 @@ void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up)
|
||||||
|
|
||||||
void CLQ2_RailTrail (vec3_t start, vec3_t end)
|
void CLQ2_RailTrail (vec3_t start, vec3_t end)
|
||||||
{
|
{
|
||||||
R_RocketTrail(start, end, rt_railtrail, 0);
|
trailstate_t ts;
|
||||||
|
memset(&ts, 0, sizeof(ts));
|
||||||
|
R_RocketTrail(start, end, rt_railtrail, &ts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
void R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
|
@ -2092,9 +2101,6 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
|
|
||||||
len = ts->lastdist;
|
len = ts->lastdist;
|
||||||
|
|
||||||
if (len/step > 1024)
|
|
||||||
return;
|
|
||||||
|
|
||||||
b = bfirst = NULL;
|
b = bfirst = NULL;
|
||||||
|
|
||||||
while (len < stop)
|
while (len < stop)
|
||||||
|
@ -2272,7 +2278,6 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
|
|
||||||
b->flags |= BS_LASTSEG;
|
b->flags |= BS_LASTSEG;
|
||||||
ts->lastbeam = b;
|
ts->lastbeam = b;
|
||||||
}
|
|
||||||
|
|
||||||
if (!free_particles || !free_beams)
|
if (!free_particles || !free_beams)
|
||||||
{
|
{
|
||||||
|
@ -2284,6 +2289,7 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type, trailstate_t *ts)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return; //distance the trail actually moved.
|
return; //distance the trail actually moved.
|
||||||
}
|
}
|
||||||
|
@ -2606,7 +2612,7 @@ void GL_DrawParticleBeam_Textured(beamseg_t *b, part_type_t *type)
|
||||||
VectorSubtract(r_refdef.vieworg, q->org, v);
|
VectorSubtract(r_refdef.vieworg, q->org, v);
|
||||||
VectorNormalize(v);
|
VectorNormalize(v);
|
||||||
CrossProduct(c->dir, v, cr);
|
CrossProduct(c->dir, v, cr);
|
||||||
ts = b->texture_s*type->rotationstartmin + particletime*type->rotationmin;
|
ts = (c->texture_s*type->rotationstartmin + particletime*type->rotationmin)/754;
|
||||||
|
|
||||||
VectorMA(q->org, -q->scale, cr, point);
|
VectorMA(q->org, -q->scale, cr, point);
|
||||||
glTexCoord2f(ts, 0);
|
glTexCoord2f(ts, 0);
|
||||||
|
@ -2623,7 +2629,7 @@ void GL_DrawParticleBeam_Textured(beamseg_t *b, part_type_t *type)
|
||||||
VectorSubtract(r_refdef.vieworg, p->org, v);
|
VectorSubtract(r_refdef.vieworg, p->org, v);
|
||||||
VectorNormalize(v);
|
VectorNormalize(v);
|
||||||
CrossProduct(b->dir, v, cr); // replace with old p->dir?
|
CrossProduct(b->dir, v, cr); // replace with old p->dir?
|
||||||
ts = b->texture_s*type->rotationstartmin + particletime*type->rotationmin;
|
ts = (b->texture_s*type->rotationstartmin + particletime*type->rotationmin)/754;
|
||||||
|
|
||||||
VectorMA(p->org, p->scale, cr, point);
|
VectorMA(p->org, p->scale, cr, point);
|
||||||
glTexCoord2f(ts, 1);
|
glTexCoord2f(ts, 1);
|
||||||
|
|
|
@ -137,6 +137,7 @@ cvar_t r_drawdisk = {"r_drawdisk", "1"};
|
||||||
cvar_t gl_compress = {"gl_compress", "0"};
|
cvar_t gl_compress = {"gl_compress", "0"};
|
||||||
cvar_t gl_savecompressedtex = {"gl_savecompressedtex", "0"};
|
cvar_t gl_savecompressedtex = {"gl_savecompressedtex", "0"};
|
||||||
extern cvar_t gl_dither;
|
extern cvar_t gl_dither;
|
||||||
|
extern cvar_t gl_maxdist;
|
||||||
|
|
||||||
#ifdef SPECULAR
|
#ifdef SPECULAR
|
||||||
cvar_t gl_specular = {"gl_specular", "0"};
|
cvar_t gl_specular = {"gl_specular", "0"};
|
||||||
|
@ -268,6 +269,7 @@ void GLRenderer_Init(void)
|
||||||
Cvar_Register (&gl_ztrick, GLRENDEREROPTIONS);
|
Cvar_Register (&gl_ztrick, GLRENDEREROPTIONS);
|
||||||
|
|
||||||
Cvar_Register (&gl_max_size, GLRENDEREROPTIONS);
|
Cvar_Register (&gl_max_size, GLRENDEREROPTIONS);
|
||||||
|
Cvar_Register (&gl_maxdist, GLRENDEREROPTIONS);
|
||||||
Cvar_Register (&gl_2dscale, GLRENDEREROPTIONS);
|
Cvar_Register (&gl_2dscale, GLRENDEREROPTIONS);
|
||||||
|
|
||||||
Cvar_Register (&gl_font, GRAPHICALNICETIES);
|
Cvar_Register (&gl_font, GRAPHICALNICETIES);
|
||||||
|
|
|
@ -67,6 +67,28 @@ void VARGS Sys_DebugLog(char *file, char *fmt, ...)
|
||||||
va_start(argptr, fmt);
|
va_start(argptr, fmt);
|
||||||
_vsnprintf(data, sizeof(data)-1, fmt, argptr);
|
_vsnprintf(data, sizeof(data)-1, fmt, argptr);
|
||||||
va_end(argptr);
|
va_end(argptr);
|
||||||
|
|
||||||
|
#if defined(CRAZYDEBUGGING) && CRAZYDEBUGGING > 1
|
||||||
|
{
|
||||||
|
static int sock;
|
||||||
|
if (!sock)
|
||||||
|
{
|
||||||
|
struct sockaddr_in sa;
|
||||||
|
netadr_t na;
|
||||||
|
int _true = true;
|
||||||
|
int listip;
|
||||||
|
listip = COM_CheckParm("-debugip");
|
||||||
|
NET_StringToAdr(listip?com_argv[listip+1]:"127.0.0.1", &na);
|
||||||
|
NetadrToSockadr(&na, (struct sockaddr_qstorage*)&sa);
|
||||||
|
sa.sin_port = htons(10000);
|
||||||
|
sock = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||||
|
if (-1==connect(sock, (struct sockaddr*)&sa, sizeof(sa)))
|
||||||
|
Sys_Error("Couldn't send debug log lines\n");
|
||||||
|
setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (char*)&_true, sizeof(_true));
|
||||||
|
}
|
||||||
|
send(sock, data, strlen(data), 0);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666);
|
fd = open(file, O_WRONLY | O_CREAT | O_APPEND, 0666);
|
||||||
write(fd, data, strlen(data));
|
write(fd, data, strlen(data));
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
|
@ -86,7 +86,7 @@ static size_t strlcat (char *dst, const char *src, size_t size)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void Q_snprintfz (char *dest, size_t size, char *fmt, ...)
|
static void VARGS Q_snprintfz (char *dest, size_t size, char *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list argptr;
|
va_list argptr;
|
||||||
|
|
||||||
|
|
|
@ -3989,6 +3989,10 @@ void COM_Gamedir (char *dir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
Shader_Init();
|
||||||
|
#endif
|
||||||
|
|
||||||
Validation_FlushFileList(); //prevent previous hacks from making a difference.
|
Validation_FlushFileList(); //prevent previous hacks from making a difference.
|
||||||
|
|
||||||
//FIXME: load new palette, if different cause a vid_restart.
|
//FIXME: load new palette, if different cause a vid_restart.
|
||||||
|
|
|
@ -98,7 +98,7 @@ void Con_ToggleConsole_f (void);
|
||||||
void Con_NotifyBox (char *text); // during startup for sound / cd warnings
|
void Con_NotifyBox (char *text); // during startup for sound / cd warnings
|
||||||
|
|
||||||
#ifdef CRAZYDEBUGGING
|
#ifdef CRAZYDEBUGGING
|
||||||
#define TRACE(x) Con_Print x
|
#define TRACE(x) Con_Printf x
|
||||||
#else
|
#else
|
||||||
#define TRACE(x)
|
#define TRACE(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -332,11 +332,23 @@ int numvertexes;
|
||||||
|
|
||||||
vec2_t *map_vertstmexcoords;
|
vec2_t *map_vertstmexcoords;
|
||||||
vec2_t *map_vertlstmexcoords;
|
vec2_t *map_vertlstmexcoords;
|
||||||
|
byte_vec4_t *map_colors_array;
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
typedef struct {
|
||||||
|
char shader[MAX_QPATH];
|
||||||
|
int brushNum;
|
||||||
|
int visibleSide; // the brush side that ray tests need to clip against (-1 == none)
|
||||||
|
} dfog_t;
|
||||||
|
|
||||||
|
mfog_t *map_fogs;
|
||||||
|
int map_numfogs;
|
||||||
|
#endif
|
||||||
|
|
||||||
q3cface_t *map_faces;
|
q3cface_t *map_faces;
|
||||||
int numfaces;
|
int numfaces;
|
||||||
|
|
||||||
int *map_surfindexes;
|
index_t *map_surfindexes;
|
||||||
int map_numsurfindexes;
|
int map_numsurfindexes;
|
||||||
|
|
||||||
int *map_leaffaces;
|
int *map_leaffaces;
|
||||||
|
@ -1893,6 +1905,7 @@ void CModQ3_LoadVertexes (lump_t *l)
|
||||||
vec4_t *out;
|
vec4_t *out;
|
||||||
int i, count, j;
|
int i, count, j;
|
||||||
vec2_t *lmout, *stout;
|
vec2_t *lmout, *stout;
|
||||||
|
byte_vec4_t *cout;
|
||||||
|
|
||||||
in = (void *)(cmod_base + l->fileofs);
|
in = (void *)(cmod_base + l->fileofs);
|
||||||
if (l->filelen % sizeof(*in))
|
if (l->filelen % sizeof(*in))
|
||||||
|
@ -1905,9 +1918,11 @@ void CModQ3_LoadVertexes (lump_t *l)
|
||||||
out = Hunk_Alloc ( count*sizeof(*out) );
|
out = Hunk_Alloc ( count*sizeof(*out) );
|
||||||
stout = Hunk_Alloc ( count*sizeof(*stout) );
|
stout = Hunk_Alloc ( count*sizeof(*stout) );
|
||||||
lmout = Hunk_Alloc ( count*sizeof(*lmout) );
|
lmout = Hunk_Alloc ( count*sizeof(*lmout) );
|
||||||
|
cout = Hunk_Alloc ( count*sizeof(*cout) );
|
||||||
map_verts = out;
|
map_verts = out;
|
||||||
map_vertstmexcoords = stout;
|
map_vertstmexcoords = stout;
|
||||||
map_vertlstmexcoords = lmout;
|
map_vertlstmexcoords = lmout;
|
||||||
|
map_colors_array = cout;
|
||||||
numvertexes = count;
|
numvertexes = count;
|
||||||
|
|
||||||
for ( i=0 ; i<count ; i++, in++)
|
for ( i=0 ; i<count ; i++, in++)
|
||||||
|
@ -1921,6 +1936,10 @@ void CModQ3_LoadVertexes (lump_t *l)
|
||||||
stout[i][j] = LittleFloat ( ((float *)in->texcoords)[j] );
|
stout[i][j] = LittleFloat ( ((float *)in->texcoords)[j] );
|
||||||
lmout[i][j] = LittleFloat ( ((float *)in->texcoords)[j+2] );
|
lmout[i][j] = LittleFloat ( ((float *)in->texcoords)[j+2] );
|
||||||
}
|
}
|
||||||
|
for ( j=0 ; j < 4 ; j++)
|
||||||
|
{
|
||||||
|
cout[i][j] = in->color[j];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1986,6 +2005,56 @@ void CModQ3_LoadFaces (lump_t *l)
|
||||||
|
|
||||||
#ifdef RGLQUAKE
|
#ifdef RGLQUAKE
|
||||||
|
|
||||||
|
/*
|
||||||
|
=================
|
||||||
|
Mod_LoadFogs
|
||||||
|
=================
|
||||||
|
*/
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
void CModQ3_LoadFogs (lump_t *l)
|
||||||
|
{
|
||||||
|
dfog_t *in;
|
||||||
|
mfog_t *out;
|
||||||
|
q2cbrush_t *brush;
|
||||||
|
q2cbrushside_t *visibleside, *brushsides;
|
||||||
|
int i, j, count;
|
||||||
|
|
||||||
|
in = (void *)(mod_base + l->fileofs);
|
||||||
|
if (l->filelen % sizeof(*in))
|
||||||
|
Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||||
|
count = l->filelen / sizeof(*in);
|
||||||
|
out = Hunk_Alloc ( count*sizeof(*out) );
|
||||||
|
|
||||||
|
map_fogs = out;
|
||||||
|
map_numfogs = count;
|
||||||
|
|
||||||
|
for ( i=0 ; i<count ; i++, in++, out++)
|
||||||
|
{
|
||||||
|
if ( LittleLong ( in->visibleSide ) == -1 )
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
brush = map_brushes + LittleLong ( in->brushNum );
|
||||||
|
brushsides = map_brushsides + brush->firstbrushside;
|
||||||
|
visibleside = brushsides + LittleLong ( in->visibleSide );
|
||||||
|
|
||||||
|
out->visibleplane = visibleside->plane;
|
||||||
|
out->shader = R_RegisterShader ( in->shader );
|
||||||
|
out->numplanes = brush->numsides;
|
||||||
|
out->planes = Hunk_Alloc ( out->numplanes*sizeof(cplane_t *) );
|
||||||
|
|
||||||
|
for ( j = 0; j < out->numplanes; j++ )
|
||||||
|
{
|
||||||
|
out->planes[j] = brushsides[j].plane;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (count)
|
||||||
|
GL_InitFogTexture();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
//Convert a patch in to a list of glpolys
|
//Convert a patch in to a list of glpolys
|
||||||
|
|
||||||
#define MAX_ARRAY_VERTS 2048
|
#define MAX_ARRAY_VERTS 2048
|
||||||
|
@ -2072,13 +2141,17 @@ float ColorNormalize (vec3_t in, vec3_t out)
|
||||||
|
|
||||||
return f;
|
return f;
|
||||||
}
|
}
|
||||||
int tempIndexesArray[MAX_ARRAY_VERTS*3];
|
index_t tempIndexesArray[MAX_ARRAY_VERTS*3];
|
||||||
vec4_t tempxyz_array[MAX_ARRAY_VERTS]; //structure is used only at load.
|
vec4_t tempxyz_array[MAX_ARRAY_VERTS]; //structure is used only at load.
|
||||||
vec3_t tempnormals_array[MAX_ARRAY_VERTS]; //so what harm is there in doing this?
|
vec3_t tempnormals_array[MAX_ARRAY_VERTS]; //so what harm is there in doing this?
|
||||||
vec2_t tempst_array[MAX_ARRAY_VERTS];
|
vec2_t tempst_array[MAX_ARRAY_VERTS];
|
||||||
vec2_t templmst_array[MAX_ARRAY_VERTS];
|
vec2_t templmst_array[MAX_ARRAY_VERTS];
|
||||||
byte_vec4_t tempcolors_array[MAX_ARRAY_VERTS];
|
byte_vec4_t tempcolors_array[MAX_ARRAY_VERTS];
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
#define Hunk_TempAllocMore Hunk_Alloc
|
||||||
|
#endif
|
||||||
|
|
||||||
mesh_t *GL_CreateMeshForPatch ( model_t *mod, q3dface_t *surf )
|
mesh_t *GL_CreateMeshForPatch ( model_t *mod, q3dface_t *surf )
|
||||||
{
|
{
|
||||||
int numverts, numindexes, firstvert, patch_cp[2], step[2], size[2], flat[2], i, u, v, p;
|
int numverts, numindexes, firstvert, patch_cp[2], step[2], size[2], flat[2], i, u, v, p;
|
||||||
|
@ -2086,7 +2159,7 @@ mesh_t *GL_CreateMeshForPatch ( model_t *mod, q3dface_t *surf )
|
||||||
lm_st[MAX_ARRAY_VERTS], tex_st[MAX_ARRAY_VERTS];
|
lm_st[MAX_ARRAY_VERTS], tex_st[MAX_ARRAY_VERTS];
|
||||||
vec4_t c, colors2[MAX_ARRAY_VERTS], normals2[MAX_ARRAY_VERTS], lm_st2[MAX_ARRAY_VERTS], tex_st2[MAX_ARRAY_VERTS];
|
vec4_t c, colors2[MAX_ARRAY_VERTS], normals2[MAX_ARRAY_VERTS], lm_st2[MAX_ARRAY_VERTS], tex_st2[MAX_ARRAY_VERTS];
|
||||||
mesh_t *mesh;
|
mesh_t *mesh;
|
||||||
int *indexes;
|
index_t *indexes;
|
||||||
float subdivlevel;
|
float subdivlevel;
|
||||||
|
|
||||||
patch_cp[0] = LittleLong ( surf->patchwidth );
|
patch_cp[0] = LittleLong ( surf->patchwidth );
|
||||||
|
@ -2105,7 +2178,7 @@ mesh_t *GL_CreateMeshForPatch ( model_t *mod, q3dface_t *surf )
|
||||||
for ( i = 0; i < numverts; i++ ) {
|
for ( i = 0; i < numverts; i++ ) {
|
||||||
VectorCopy ( map_verts[firstvert + i], points[i] );
|
VectorCopy ( map_verts[firstvert + i], points[i] );
|
||||||
// VectorCopy ( mod->bmodel->normals_array[firstvert + i], normals[i] );
|
// VectorCopy ( mod->bmodel->normals_array[firstvert + i], normals[i] );
|
||||||
// Vector4Scale ( mod->bmodel->colors_array[firstvert + i], (1.0 / 255.0), colors[i] );
|
Vector4Scale ( map_colors_array[firstvert + i], (1.0 / 255.0), colors[i] );
|
||||||
Vector2Copy ( map_vertstmexcoords[firstvert + i], tex_st[i] );
|
Vector2Copy ( map_vertstmexcoords[firstvert + i], tex_st[i] );
|
||||||
Vector2Copy ( map_vertlstmexcoords[firstvert + i], lm_st[i] );
|
Vector2Copy ( map_vertlstmexcoords[firstvert + i], lm_st[i] );
|
||||||
}
|
}
|
||||||
|
@ -2186,18 +2259,26 @@ mesh_t *GL_CreateMeshForPatch ( model_t *mod, q3dface_t *surf )
|
||||||
// allocate and fill index table
|
// allocate and fill index table
|
||||||
mesh->numindexes = numindexes;
|
mesh->numindexes = numindexes;
|
||||||
|
|
||||||
mesh->indexes = (int *)Hunk_TempAllocMore ( numindexes * sizeof(int));
|
mesh->indexes = (index_t *)Hunk_TempAllocMore ( numindexes * sizeof(index_t));
|
||||||
memcpy (mesh->indexes, tempIndexesArray, numindexes * sizeof(int) );
|
memcpy (mesh->indexes, tempIndexesArray, numindexes * sizeof(index_t) );
|
||||||
|
|
||||||
return mesh;
|
return mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
#undef Hunk_TempAllocMore
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void CModQ3_LoadRFaces (lump_t *l)
|
void CModQ3_LoadRFaces (lump_t *l)
|
||||||
{
|
{
|
||||||
|
#ifndef Q3SHADERS
|
||||||
int polysize = sizeof(glpoly_t) - VERTEXSIZE*sizeof(float);
|
int polysize = sizeof(glpoly_t) - VERTEXSIZE*sizeof(float);
|
||||||
|
glpoly_t *p;
|
||||||
|
int rv, fi;
|
||||||
|
int gv, v;
|
||||||
|
#endif
|
||||||
q3dface_t *in;
|
q3dface_t *in;
|
||||||
msurface_t *out;
|
msurface_t *out;
|
||||||
mplane_t *pl;
|
mplane_t *pl;
|
||||||
|
@ -2206,11 +2287,8 @@ void CModQ3_LoadRFaces (lump_t *l)
|
||||||
int surfnum;
|
int surfnum;
|
||||||
|
|
||||||
int numverts, numindexes;
|
int numverts, numindexes;
|
||||||
int gv, v;
|
int fv;
|
||||||
int rv;
|
|
||||||
int fv, fi;
|
|
||||||
|
|
||||||
glpoly_t *p;
|
|
||||||
mesh_t *mesh;
|
mesh_t *mesh;
|
||||||
|
|
||||||
|
|
||||||
|
@ -2219,7 +2297,7 @@ void CModQ3_LoadRFaces (lump_t *l)
|
||||||
Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
Host_Error ("MOD_LoadBmodel: funny lump size in %s",loadmodel->name);
|
||||||
count = l->filelen / sizeof(*in);
|
count = l->filelen / sizeof(*in);
|
||||||
out = Hunk_AllocName ( count*sizeof(*out), loadmodel->name );
|
out = Hunk_AllocName ( count*sizeof(*out), loadmodel->name );
|
||||||
pl = Hunk_AllocName (count*sizeof(*p), loadmodel->name);//create a new array of planes for speed.
|
pl = Hunk_AllocName (count*sizeof(*pl), loadmodel->name);//create a new array of planes for speed.
|
||||||
|
|
||||||
loadmodel->surfaces = out;
|
loadmodel->surfaces = out;
|
||||||
loadmodel->numsurfaces = count;
|
loadmodel->numsurfaces = count;
|
||||||
|
@ -2251,12 +2329,31 @@ fv = LittleLong(in->firstvertex);
|
||||||
if (in->fognum!=-1)
|
if (in->fognum!=-1)
|
||||||
continue;
|
continue;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (map_surfaces[in->shadernum].c.value == 0 || map_surfaces[in->shadernum].c.value & Q3CONTENTS_TRANSLUCENT)
|
if (map_surfaces[in->shadernum].c.value == 0 || map_surfaces[in->shadernum].c.value & Q3CONTENTS_TRANSLUCENT)
|
||||||
//q3dm10's thingie is 0
|
//q3dm10's thingie is 0
|
||||||
out->flags |= SURF_DRAWALPHA;
|
out->flags |= SURF_DRAWALPHA;
|
||||||
|
|
||||||
if (loadmodel->texinfo[in->shadernum].flags & SURF_SKY)
|
if (loadmodel->texinfo[in->shadernum].flags & SURF_SKY)
|
||||||
out->flags |= SURF_DRAWSKY;
|
out->flags |= SURF_DRAWSKY;
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
if (!out->texinfo->texture->shader)
|
||||||
|
{
|
||||||
|
extern cvar_t r_vertexlight;
|
||||||
|
if (in->facetype == MST_FLARE)
|
||||||
|
out->texinfo->texture->shader = R_RegisterShader_Flare (out->texinfo->texture->name);
|
||||||
|
else if (in->facetype == MST_TRIANGLE_SOUP || r_vertexlight.value)
|
||||||
|
out->texinfo->texture->shader = R_RegisterShader_Vertex (out->texinfo->texture->name);
|
||||||
|
else
|
||||||
|
out->texinfo->texture->shader = R_RegisterShader(out->texinfo->texture->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (in->fognum == -1)
|
||||||
|
out->fog = NULL;
|
||||||
|
else
|
||||||
|
out->fog = map_fogs + in->fognum;
|
||||||
|
#endif
|
||||||
if (map_surfaces[in->shadernum].c.flags & (Q3SURF_NODRAW | Q3SURF_SKIP))
|
if (map_surfaces[in->shadernum].c.flags & (Q3SURF_NODRAW | Q3SURF_SKIP))
|
||||||
{
|
{
|
||||||
out->mesh = NULL;
|
out->mesh = NULL;
|
||||||
|
@ -2264,9 +2361,11 @@ continue;
|
||||||
}
|
}
|
||||||
else if (in->facetype == MST_PATCH)
|
else if (in->facetype == MST_PATCH)
|
||||||
{
|
{
|
||||||
mesh = GL_CreateMeshForPatch(loadmodel, in);
|
out->mesh = GL_CreateMeshForPatch(loadmodel, in);
|
||||||
out->polys = GL_MeshToGLPoly(mesh);
|
#ifndef Q3SHADERS
|
||||||
|
out->polys = GL_MeshToGLPoly(out->mesh);
|
||||||
out->mesh = NULL;
|
out->mesh = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else if (in->facetype == MST_PLANAR || in->facetype == MST_TRIANGLE_SOUP)
|
else if (in->facetype == MST_PLANAR || in->facetype == MST_TRIANGLE_SOUP)
|
||||||
{
|
{
|
||||||
|
@ -2274,11 +2373,11 @@ continue;
|
||||||
numverts = LittleLong(in->num_vertices);
|
numverts = LittleLong(in->num_vertices);
|
||||||
if (numindexes%3)
|
if (numindexes%3)
|
||||||
Host_Error("mesh indexes should be multiples of 3");
|
Host_Error("mesh indexes should be multiples of 3");
|
||||||
/*
|
|
||||||
out->mesh = Hunk_Alloc(sizeof(mesh_t) + (sizeof(vec3_t) + sizeof(byte_vec4_t)) * numverts);
|
|
||||||
out->mesh->normals_array= (vec3_t *)(out->mesh+1);
|
|
||||||
out->mesh->colors_array = (byte_vec4_t *)(out->mesh->normals_array + numverts);
|
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
out->mesh = Hunk_Alloc(sizeof(mesh_t) + (sizeof(vec3_t)) * numverts);
|
||||||
|
out->mesh->normals_array= (vec3_t *)(out->mesh+1);
|
||||||
|
out->mesh->colors_array = map_colors_array + LittleLong(in->firstindex);
|
||||||
out->mesh->indexes = map_surfindexes + LittleLong(in->firstindex);
|
out->mesh->indexes = map_surfindexes + LittleLong(in->firstindex);
|
||||||
out->mesh->xyz_array = map_verts + LittleLong(in->firstvertex);
|
out->mesh->xyz_array = map_verts + LittleLong(in->firstvertex);
|
||||||
out->mesh->st_array = map_vertstmexcoords + LittleLong(in->firstvertex);
|
out->mesh->st_array = map_vertstmexcoords + LittleLong(in->firstvertex);
|
||||||
|
@ -2286,7 +2385,7 @@ continue;
|
||||||
|
|
||||||
out->mesh->numindexes = numindexes;
|
out->mesh->numindexes = numindexes;
|
||||||
out->mesh->numvertexes = numverts;
|
out->mesh->numvertexes = numverts;
|
||||||
*/
|
#else
|
||||||
|
|
||||||
p = Hunk_AllocName (polysize*numindexes/3, "SDList");
|
p = Hunk_AllocName (polysize*numindexes/3, "SDList");
|
||||||
fv = LittleLong(in->firstvertex);
|
fv = LittleLong(in->firstvertex);
|
||||||
|
@ -2311,7 +2410,31 @@ continue;
|
||||||
out->polys = p;
|
out->polys = p;
|
||||||
p = (glpoly_t *)((char *)p + polysize);
|
p = (glpoly_t *)((char *)p + polysize);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int r, g, b;
|
||||||
|
extern index_t r_quad_indexes[6];
|
||||||
|
|
||||||
|
mesh = out->mesh = (mesh_t *)Hunk_Alloc ( sizeof(mesh_t));
|
||||||
|
mesh->xyz_array = (vec4_t *)Hunk_Alloc ( sizeof(vec4_t));
|
||||||
|
mesh->numvertexes = 1;
|
||||||
|
mesh->indexes = r_quad_indexes;
|
||||||
|
mesh->numindexes = 6;
|
||||||
|
// VectorCopy ( out->origin, mesh->xyz_array[0] );
|
||||||
|
|
||||||
|
/* r = LittleFloat ( in->lightmapVecs[0][0] ) * 255.0f;
|
||||||
|
r = bound ( 0, r, 255 );
|
||||||
|
|
||||||
|
g = LittleFloat ( in->lightmapVecs[0][1] ) * 255.0f;
|
||||||
|
g = bound ( 0, g, 255 );
|
||||||
|
|
||||||
|
b = LittleFloat ( in->lightmapVecs[0][2] ) * 255.0f;
|
||||||
|
b = bound ( 0, b, 255 );
|
||||||
|
|
||||||
|
out->dlightbits = (unsigned int)COLOR_RGB ( r, g, b );
|
||||||
|
*/ }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -3062,6 +3185,9 @@ q2cmodel_t *CM_LoadMap (char *name, char *filein, qboolean clientload, unsigned
|
||||||
GLMod_LoadLighting (&header.lumps[Q3LUMP_LIGHTMAPS]); //fixme: duplicated loading.
|
GLMod_LoadLighting (&header.lumps[Q3LUMP_LIGHTMAPS]); //fixme: duplicated loading.
|
||||||
CModQ3_LoadLightgrid (&header.lumps[Q3LUMP_LIGHTGRID]);
|
CModQ3_LoadLightgrid (&header.lumps[Q3LUMP_LIGHTGRID]);
|
||||||
CModQ3_LoadIndexes (&header.lumps[Q3LUMP_DRAWINDEXES]);
|
CModQ3_LoadIndexes (&header.lumps[Q3LUMP_DRAWINDEXES]);
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
CModQ3_LoadFogs (&header.lumps[Q3LUMP_FOGS]);
|
||||||
|
#endif
|
||||||
CModQ3_LoadRFaces (&header.lumps[Q3LUMP_SURFACES]);
|
CModQ3_LoadRFaces (&header.lumps[Q3LUMP_SURFACES]);
|
||||||
CModQ3_LoadMarksurfaces (&header.lumps[Q3LUMP_LEAFSURFACES]); //fixme: duplicated loading.
|
CModQ3_LoadMarksurfaces (&header.lumps[Q3LUMP_LEAFSURFACES]); //fixme: duplicated loading.
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,7 @@ typedef struct
|
||||||
|
|
||||||
// bandwidth estimator
|
// bandwidth estimator
|
||||||
double cleartime; // if realtime > nc->cleartime, free to go
|
double cleartime; // if realtime > nc->cleartime, free to go
|
||||||
double rate; // seconds / qbyte
|
// double rate; // seconds / qbyte
|
||||||
|
|
||||||
// sequencing variables
|
// sequencing variables
|
||||||
int incoming_sequence;
|
int incoming_sequence;
|
||||||
|
@ -138,15 +138,15 @@ typedef struct
|
||||||
extern int net_drop; // packets dropped before this one
|
extern int net_drop; // packets dropped before this one
|
||||||
|
|
||||||
void Netchan_Init (void);
|
void Netchan_Init (void);
|
||||||
void Netchan_Transmit (netchan_t *chan, int length, qbyte *data);
|
void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate);
|
||||||
void Netchan_OutOfBand (netsrc_t sock, netadr_t adr, int length, qbyte *data);
|
void Netchan_OutOfBand (netsrc_t sock, netadr_t adr, int length, qbyte *data);
|
||||||
void VARGS Netchan_OutOfBandPrint (netsrc_t sock, netadr_t adr, char *format, ...);
|
void VARGS Netchan_OutOfBandPrint (netsrc_t sock, netadr_t adr, char *format, ...);
|
||||||
void VARGS Netchan_OutOfBandTPrintf (netsrc_t sock, netadr_t adr, int language, translation_t text, ...);
|
void VARGS Netchan_OutOfBandTPrintf (netsrc_t sock, netadr_t adr, int language, translation_t text, ...);
|
||||||
qboolean Netchan_Process (netchan_t *chan);
|
qboolean Netchan_Process (netchan_t *chan);
|
||||||
void Netchan_Setup (netsrc_t sock, netchan_t *chan, netadr_t adr, int qport);
|
void Netchan_Setup (netsrc_t sock, netchan_t *chan, netadr_t adr, int qport);
|
||||||
|
|
||||||
qboolean Netchan_CanPacket (netchan_t *chan);
|
qboolean Netchan_CanPacket (netchan_t *chan, int rate);
|
||||||
qboolean Netchan_CanReliable (netchan_t *chan);
|
qboolean Netchan_CanReliable (netchan_t *chan, int rate);
|
||||||
|
|
||||||
#ifdef HUFFNETWORK
|
#ifdef HUFFNETWORK
|
||||||
int Huff_PreferedCompressionCRC (void);
|
int Huff_PreferedCompressionCRC (void);
|
||||||
|
|
|
@ -192,8 +192,6 @@ void Netchan_Setup (netsrc_t sock, netchan_t *chan, netadr_t adr, int qport)
|
||||||
chan->message.maxsize = MAX_QWMSGLEN;//sizeof(chan->message_buf);
|
chan->message.maxsize = MAX_QWMSGLEN;//sizeof(chan->message_buf);
|
||||||
|
|
||||||
chan->qport = qport;
|
chan->qport = qport;
|
||||||
|
|
||||||
chan->rate = 1.0/2500;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -205,11 +203,11 @@ Returns true if the bandwidth choke isn't active
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
#define MAX_BACKUP 200
|
#define MAX_BACKUP 200
|
||||||
qboolean Netchan_CanPacket (netchan_t *chan)
|
qboolean Netchan_CanPacket (netchan_t *chan, int rate)
|
||||||
{
|
{
|
||||||
if (chan->remote_address.type == NA_LOOPBACK)
|
if (chan->remote_address.type == NA_LOOPBACK)
|
||||||
return true; //don't ever drop packets due to possible routing problems when there is no routing.
|
return true; //don't ever drop packets due to possible routing problems when there is no routing.
|
||||||
if (chan->cleartime < realtime + MAX_BACKUP*chan->rate)
|
if (chan->cleartime < realtime + MAX_BACKUP/(float)rate)
|
||||||
return true;
|
return true;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -222,11 +220,11 @@ Netchan_CanReliable
|
||||||
Returns true if the bandwidth choke isn't
|
Returns true if the bandwidth choke isn't
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
qboolean Netchan_CanReliable (netchan_t *chan)
|
qboolean Netchan_CanReliable (netchan_t *chan, int rate)
|
||||||
{
|
{
|
||||||
if (chan->reliable_length)
|
if (chan->reliable_length)
|
||||||
return false; // waiting for ack
|
return false; // waiting for ack
|
||||||
return Netchan_CanPacket (chan);
|
return Netchan_CanPacket (chan, rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SERVERONLY
|
#ifdef SERVERONLY
|
||||||
|
@ -243,7 +241,7 @@ transmition / retransmition of the reliable messages.
|
||||||
A 0 length will still generate a packet and deal with the reliable messages.
|
A 0 length will still generate a packet and deal with the reliable messages.
|
||||||
================
|
================
|
||||||
*/
|
*/
|
||||||
void Netchan_Transmit (netchan_t *chan, int length, qbyte *data)
|
void Netchan_Transmit (netchan_t *chan, int length, qbyte *data, int rate)
|
||||||
{
|
{
|
||||||
sizebuf_t send;
|
sizebuf_t send;
|
||||||
qbyte send_buf[MAX_OVERALLMSGLEN + PACKET_HEADER];
|
qbyte send_buf[MAX_OVERALLMSGLEN + PACKET_HEADER];
|
||||||
|
@ -369,9 +367,9 @@ void Netchan_Transmit (netchan_t *chan, int length, qbyte *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chan->cleartime < realtime)
|
if (chan->cleartime < realtime)
|
||||||
chan->cleartime = realtime + send.cursize*chan->rate;
|
chan->cleartime = realtime + send.cursize/(float)rate;
|
||||||
else
|
else
|
||||||
chan->cleartime += send.cursize*chan->rate;
|
chan->cleartime += send.cursize/(float)rate;
|
||||||
#ifdef SERVERONLY
|
#ifdef SERVERONLY
|
||||||
if (ServerPaused())
|
if (ServerPaused())
|
||||||
chan->cleartime = realtime;
|
chan->cleartime = realtime;
|
||||||
|
|
|
@ -492,7 +492,11 @@ void TranslateReset(void)
|
||||||
|
|
||||||
char *Translate(char *message)
|
char *Translate(char *message)
|
||||||
{
|
{
|
||||||
trans_t *trans;
|
return message;
|
||||||
|
|
||||||
|
//this is pointless.
|
||||||
|
|
||||||
|
/* trans_t *trans;
|
||||||
if (!*message)
|
if (!*message)
|
||||||
return message;
|
return message;
|
||||||
if (Q_strncmp(language.string, lastlang, 8))
|
if (Q_strncmp(language.string, lastlang, 8))
|
||||||
|
@ -522,6 +526,7 @@ char *Translate(char *message)
|
||||||
//strcpy(trans->foreign, message);
|
//strcpy(trans->foreign, message);
|
||||||
|
|
||||||
return message;
|
return message;
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
char *untranslate(char *message)
|
char *untranslate(char *message)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -27,6 +27,18 @@ Package=<4>
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
Project: "hud"=..\..\plugins\hud\hud.dsp - Package Owner=<4>
|
||||||
|
|
||||||
|
Package=<5>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
Package=<4>
|
||||||
|
{{{
|
||||||
|
}}}
|
||||||
|
|
||||||
|
###############################################################################
|
||||||
|
|
||||||
Project: "irc"=..\..\PLUGINS\IRC\irc.dsp - Package Owner=<4>
|
Project: "irc"=..\..\PLUGINS\IRC\irc.dsp - Package Owner=<4>
|
||||||
|
|
||||||
Package=<5>
|
Package=<5>
|
||||||
|
|
|
@ -42,8 +42,6 @@ typedef struct
|
||||||
extern cvar_t gl_part_flame, gl_part_torch, r_fullbrightSkins, r_fb_models;
|
extern cvar_t gl_part_flame, gl_part_torch, r_fullbrightSkins, r_fb_models;
|
||||||
extern cvar_t r_noaliasshadows;
|
extern cvar_t r_noaliasshadows;
|
||||||
void R_TorchEffect (vec3_t pos, int type);
|
void R_TorchEffect (vec3_t pos, int type);
|
||||||
void GL_DrawMesh(mesh_t *mesh, shader_t *shader, int texturenum, int lmtexturenum);
|
|
||||||
|
|
||||||
void GLMod_FloodFillSkin( qbyte *skin, int skinwidth, int skinheight );
|
void GLMod_FloodFillSkin( qbyte *skin, int skinwidth, int skinheight );
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,6 +110,8 @@ typedef struct {
|
||||||
int base;
|
int base;
|
||||||
int bump;
|
int bump;
|
||||||
int fullbright;
|
int fullbright;
|
||||||
|
|
||||||
|
shader_t *shader;
|
||||||
} galiastexnum_t;
|
} galiastexnum_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -375,7 +375,7 @@ static void R_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int frame1, int f
|
||||||
numTempVertexCoords = inf->numverts;
|
numTempVertexCoords = inf->numverts;
|
||||||
}
|
}
|
||||||
|
|
||||||
mesh->indexes = (int*)((char *)inf + inf->ofs_indexes);
|
mesh->indexes = (index_t*)((char *)inf + inf->ofs_indexes);
|
||||||
mesh->numindexes = inf->numindexes;
|
mesh->numindexes = inf->numindexes;
|
||||||
mesh->st_array = (vec2_t*)((char *)inf + inf->ofs_st_array);
|
mesh->st_array = (vec2_t*)((char *)inf + inf->ofs_st_array);
|
||||||
mesh->lmst_array = NULL;
|
mesh->lmst_array = NULL;
|
||||||
|
@ -668,7 +668,7 @@ static void R_CalcFacing(mesh_t *mesh, vec3_t lightpos)
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
int *indexes = mesh->indexes;
|
index_t *indexes = mesh->indexes;
|
||||||
int numtris = mesh->numindexes/3;
|
int numtris = mesh->numindexes/3;
|
||||||
|
|
||||||
|
|
||||||
|
@ -724,7 +724,7 @@ static void R_DrawShadowVolume(mesh_t *mesh)
|
||||||
int t;
|
int t;
|
||||||
vec3_t *proj = ProjectedShadowVerts;
|
vec3_t *proj = ProjectedShadowVerts;
|
||||||
vec4_t *verts = mesh->xyz_array;
|
vec4_t *verts = mesh->xyz_array;
|
||||||
int *indexes = mesh->indexes;
|
index_t *indexes = mesh->indexes;
|
||||||
int *neighbours = mesh->trneighbors;
|
int *neighbours = mesh->trneighbors;
|
||||||
int numtris = mesh->numindexes/3;
|
int numtris = mesh->numindexes/3;
|
||||||
|
|
||||||
|
@ -778,6 +778,48 @@ static void R_DrawShadowVolume(mesh_t *mesh)
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GL_DrawAliasMesh (mesh_t *mesh, int texnum)
|
||||||
|
{
|
||||||
|
extern int gldepthfunc;
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
R_UnlockArrays();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
glDepthFunc(gldepthfunc);
|
||||||
|
glDepthMask(1);
|
||||||
|
|
||||||
|
GL_Bind(texnum);
|
||||||
|
|
||||||
|
glVertexPointer(3, GL_FLOAT, 16, mesh->xyz_array);
|
||||||
|
glEnableClientState( GL_VERTEX_ARRAY );
|
||||||
|
|
||||||
|
if (mesh->normals_array)
|
||||||
|
{
|
||||||
|
glNormalPointer(GL_FLOAT, 0, mesh->normals_array);
|
||||||
|
glEnableClientState( GL_NORMAL_ARRAY );
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mesh->colors_array)
|
||||||
|
{
|
||||||
|
glColorPointer(4, GL_UNSIGNED_BYTE, 0, mesh->colors_array);
|
||||||
|
glEnableClientState( GL_COLOR_ARRAY );
|
||||||
|
}
|
||||||
|
|
||||||
|
glEnableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||||
|
glTexCoordPointer(2, GL_FLOAT, 0, mesh->st_array);
|
||||||
|
|
||||||
|
glDrawElements(GL_TRIANGLES, mesh->numindexes, GL_UNSIGNED_INT, mesh->indexes);
|
||||||
|
|
||||||
|
glDisableClientState( GL_VERTEX_ARRAY );
|
||||||
|
glDisableClientState( GL_COLOR_ARRAY );
|
||||||
|
glDisableClientState( GL_NORMAL_ARRAY );
|
||||||
|
glDisableClientState( GL_TEXTURE_COORD_ARRAY );
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
R_IBrokeTheArrays();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void R_DrawGAliasModel (entity_t *e)
|
void R_DrawGAliasModel (entity_t *e)
|
||||||
{
|
{
|
||||||
model_t *clmodel = e->model;
|
model_t *clmodel = e->model;
|
||||||
|
@ -1090,21 +1132,46 @@ void R_DrawGAliasModel (entity_t *e)
|
||||||
R_GAliasAddDlights(&mesh, e->origin, e->angles);
|
R_GAliasAddDlights(&mesh, e->origin, e->angles);
|
||||||
skin = GL_ChooseSkin(inf, clmodel->name, e);
|
skin = GL_ChooseSkin(inf, clmodel->name, e);
|
||||||
c_alias_polys += mesh.numindexes/3;
|
c_alias_polys += mesh.numindexes/3;
|
||||||
|
|
||||||
if (!skin)
|
if (!skin)
|
||||||
GL_DrawMesh(&mesh, NULL, 1, 0);
|
{
|
||||||
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
GL_DrawAliasMesh(&mesh, 1);
|
||||||
|
}
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
else if (skin->shader)
|
||||||
|
{
|
||||||
|
meshbuffer_t mb;
|
||||||
|
|
||||||
|
mb.entity = &r_worldentity;
|
||||||
|
mb.shader = skin->shader;
|
||||||
|
mb.fog = NULL;
|
||||||
|
mb.mesh = &mesh;
|
||||||
|
mb.infokey = currententity->keynum;
|
||||||
|
mb.dlightbits = 0;
|
||||||
|
|
||||||
|
R_IBrokeTheArrays();
|
||||||
|
|
||||||
|
R_PushMesh(&mesh, skin->shader->features|MF_COLORS);
|
||||||
|
|
||||||
|
R_RenderMeshBuffer ( &mb, false );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (skin->bump)
|
glEnable(GL_TEXTURE_2D);
|
||||||
GL_DrawMeshBump(&mesh, skin->base, 0, skin->bump, 0);
|
// if (skin->bump)
|
||||||
else
|
// GL_DrawMeshBump(&mesh, skin->base, 0, skin->bump, 0);
|
||||||
GL_DrawMesh(&mesh, NULL, skin->base, 0);
|
// else
|
||||||
|
GL_DrawAliasMesh(&mesh, skin->base);
|
||||||
|
|
||||||
if (skin->fullbright && r_fb_models.value && cls.allow_luma)
|
if (skin->fullbright && r_fb_models.value && cls.allow_luma)
|
||||||
{
|
{
|
||||||
mesh.colors_array = NULL;
|
mesh.colors_array = NULL;
|
||||||
glEnable(GL_BLEND);
|
glEnable(GL_BLEND);
|
||||||
glColor4f(1, 1, 1, e->alpha*r_fb_models.value);
|
glColor4f(1, 1, 1, e->alpha*r_fb_models.value);
|
||||||
c_alias_polys += mesh.numindexes/3;
|
c_alias_polys += mesh.numindexes/3;
|
||||||
GL_DrawMesh(&mesh, NULL, 0, skin->fullbright);
|
GL_DrawAliasMesh(&mesh, skin->fullbright);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1299,7 +1366,10 @@ void R_DrawGAliasModelLighting (entity_t *e)
|
||||||
{
|
{
|
||||||
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerptime, e->alpha);
|
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerptime, e->alpha);
|
||||||
mesh.colors_array = NULL;
|
mesh.colors_array = NULL;
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
#else
|
||||||
GL_DrawMesh(&mesh, NULL, 0, 0);
|
GL_DrawMesh(&mesh, NULL, 0, 0);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (inf->nextsurf)
|
if (inf->nextsurf)
|
||||||
inf = (galiasinfo_t*)((char *)inf + inf->nextsurf);
|
inf = (galiasinfo_t*)((char *)inf + inf->nextsurf);
|
||||||
|
@ -1784,7 +1854,7 @@ void GL_LoadQ1Model (model_t *mod, void *buffer)
|
||||||
dstvert_t *pinstverts;
|
dstvert_t *pinstverts;
|
||||||
dtriangle_t *pintriangles;
|
dtriangle_t *pintriangles;
|
||||||
int *seamremap;
|
int *seamremap;
|
||||||
int *indexes;
|
index_t *indexes;
|
||||||
|
|
||||||
int size;
|
int size;
|
||||||
|
|
||||||
|
@ -1950,7 +2020,7 @@ int Mod_ReadFlagsFromMD1(char *name, int md3version)
|
||||||
COM_StripExtension(name, fname);
|
COM_StripExtension(name, fname);
|
||||||
COM_DefaultExtension(fname, ".mdl");
|
COM_DefaultExtension(fname, ".mdl");
|
||||||
|
|
||||||
if (!strcmp(name, fname)) //md3 renamed as mdl
|
if (strcmp(name, fname)) //md3 renamed as mdl
|
||||||
{
|
{
|
||||||
COM_StripExtension(name, fname); //seeing as the md3 is named over the mdl,
|
COM_StripExtension(name, fname); //seeing as the md3 is named over the mdl,
|
||||||
COM_DefaultExtension(fname, ".md1");//read from a file with md1 (one, not an ell)
|
COM_DefaultExtension(fname, ".md1");//read from a file with md1 (one, not an ell)
|
||||||
|
@ -2009,7 +2079,7 @@ void GL_LoadQ2Model (model_t *mod, void *buffer)
|
||||||
int i, j;
|
int i, j;
|
||||||
dmd2stvert_t *pinstverts;
|
dmd2stvert_t *pinstverts;
|
||||||
dmd2triangle_t *pintri;
|
dmd2triangle_t *pintri;
|
||||||
int *indexes;
|
index_t *indexes;
|
||||||
int numindexes;
|
int numindexes;
|
||||||
|
|
||||||
vec3_t min;
|
vec3_t min;
|
||||||
|
@ -2206,6 +2276,7 @@ void GL_LoadQ2Model (model_t *mod, void *buffer)
|
||||||
// move the complete, relocatable alias model to the cache
|
// move the complete, relocatable alias model to the cache
|
||||||
//
|
//
|
||||||
hunkend = Hunk_LowMark ();
|
hunkend = Hunk_LowMark ();
|
||||||
|
Hunk_Alloc(0);
|
||||||
hunktotal = hunkend - hunkstart;
|
hunktotal = hunkend - hunkstart;
|
||||||
|
|
||||||
Cache_Alloc (&mod->cache, hunktotal, loadname);
|
Cache_Alloc (&mod->cache, hunktotal, loadname);
|
||||||
|
@ -2340,13 +2411,13 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
|
||||||
// int version;
|
// int version;
|
||||||
int s, i, j, d;
|
int s, i, j, d;
|
||||||
|
|
||||||
int *indexes;
|
index_t *indexes;
|
||||||
|
|
||||||
vec3_t min;
|
vec3_t min;
|
||||||
vec3_t max;
|
vec3_t max;
|
||||||
|
|
||||||
galiaspose_t *pose;
|
galiaspose_t *pose;
|
||||||
galiasinfo_t *parent;
|
galiasinfo_t *parent, *root;
|
||||||
galiasgroup_t *group;
|
galiasgroup_t *group;
|
||||||
|
|
||||||
galiasskin_t *skin;
|
galiasskin_t *skin;
|
||||||
|
@ -2379,8 +2450,15 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
|
||||||
// if (header->version != sdfs)
|
// if (header->version != sdfs)
|
||||||
// Sys_Error("GL_LoadQ3Model: Bad version\n");
|
// Sys_Error("GL_LoadQ3Model: Bad version\n");
|
||||||
|
|
||||||
|
if (header->numSurfaces < 1)
|
||||||
|
{
|
||||||
|
mod->type = mod_alias;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
parent = NULL;
|
parent = NULL;
|
||||||
|
root = NULL;
|
||||||
|
|
||||||
min[0] = min[1] = min[2] = 0;
|
min[0] = min[1] = min[2] = 0;
|
||||||
max[0] = max[1] = max[2] = 0;
|
max[0] = max[1] = max[2] = 0;
|
||||||
|
@ -2396,7 +2474,10 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
|
||||||
galias->numindexes = surf->numTriangles*3;
|
galias->numindexes = surf->numTriangles*3;
|
||||||
galias->numskins = 1;
|
galias->numskins = 1;
|
||||||
if (parent)
|
if (parent)
|
||||||
parent->nextsurf = (qbyte *)surf - (qbyte *)parent;
|
parent->nextsurf = (qbyte *)galias - (qbyte *)parent;
|
||||||
|
else
|
||||||
|
root = galias;
|
||||||
|
parent = galias;
|
||||||
|
|
||||||
st_array = Hunk_Alloc(sizeof(vec2_t)*galias->numindexes);
|
st_array = Hunk_Alloc(sizeof(vec2_t)*galias->numindexes);
|
||||||
galias->ofs_st_array = (qbyte*)st_array - (qbyte*)galias;
|
galias->ofs_st_array = (qbyte*)st_array - (qbyte*)galias;
|
||||||
|
@ -2478,6 +2559,9 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
|
||||||
skin->skinwidth = 0;
|
skin->skinwidth = 0;
|
||||||
skin->skinheight = 0;
|
skin->skinheight = 0;
|
||||||
skin->skinspeed = 0;
|
skin->skinspeed = 0;
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
texnum->shader = R_RegisterSkin(inshader->name);
|
||||||
|
#else
|
||||||
|
|
||||||
texnum->base = Mod_LoadHiResTexture(inshader->name, true, true, true);
|
texnum->base = Mod_LoadHiResTexture(inshader->name, true, true, true);
|
||||||
if (!texnum->base)
|
if (!texnum->base)
|
||||||
|
@ -2529,7 +2613,7 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
|
||||||
texnum->fullbright = Mod_LoadBumpmapTexture(name);
|
texnum->fullbright = Mod_LoadBumpmapTexture(name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
skin++;
|
skin++;
|
||||||
texnum++;
|
texnum++;
|
||||||
|
@ -2555,9 +2639,11 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
|
||||||
// move the complete, relocatable alias model to the cache
|
// move the complete, relocatable alias model to the cache
|
||||||
//
|
//
|
||||||
|
|
||||||
|
hunkend = Hunk_LowMark ();
|
||||||
|
|
||||||
mod->flags = Mod_ReadFlagsFromMD1(mod->name, 0);
|
mod->flags = Mod_ReadFlagsFromMD1(mod->name, 0);
|
||||||
|
|
||||||
hunkend = Hunk_LowMark ();
|
Hunk_Alloc(0);
|
||||||
hunktotal = hunkend - hunkstart;
|
hunktotal = hunkend - hunkstart;
|
||||||
|
|
||||||
Cache_Alloc (&mod->cache, hunktotal, loadname);
|
Cache_Alloc (&mod->cache, hunktotal, loadname);
|
||||||
|
@ -2567,7 +2653,7 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
|
||||||
Hunk_FreeToLowMark (hunkstart);
|
Hunk_FreeToLowMark (hunkstart);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
memcpy (mod->cache.data, galias, hunktotal);
|
memcpy (mod->cache.data, root, hunktotal);
|
||||||
|
|
||||||
Hunk_FreeToLowMark (hunkstart);
|
Hunk_FreeToLowMark (hunkstart);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -41,7 +41,7 @@ int sizeofuploadmemorybuffer;
|
||||||
qbyte *uploadmemorybufferintermediate;
|
qbyte *uploadmemorybufferintermediate;
|
||||||
int sizeofuploadmemorybufferintermediate;
|
int sizeofuploadmemorybufferintermediate;
|
||||||
|
|
||||||
int r_quad_indexes[6] = {0, 1, 2, 0, 2, 3};
|
index_t r_quad_indexes[6] = {0, 1, 2, 0, 2, 3};
|
||||||
|
|
||||||
extern qbyte gammatable[256];
|
extern qbyte gammatable[256];
|
||||||
|
|
||||||
|
@ -62,8 +62,6 @@ extern cvar_t gl_savecompressedtex;
|
||||||
|
|
||||||
extern cvar_t gl_load24bit;
|
extern cvar_t gl_load24bit;
|
||||||
|
|
||||||
extern qboolean gl_compressable;
|
|
||||||
|
|
||||||
qbyte *draw_chars; // 8*8 graphic characters
|
qbyte *draw_chars; // 8*8 graphic characters
|
||||||
qpic_t *draw_disc;
|
qpic_t *draw_disc;
|
||||||
qpic_t *draw_backtile;
|
qpic_t *draw_backtile;
|
||||||
|
@ -110,25 +108,6 @@ typedef struct gltexture_s
|
||||||
} gltexture_t;
|
} gltexture_t;
|
||||||
|
|
||||||
static gltexture_t *gltextures;
|
static gltexture_t *gltextures;
|
||||||
|
|
||||||
void GL_Bind (int texnum)
|
|
||||||
{
|
|
||||||
if (gl_nobind.value)
|
|
||||||
texnum = char_texture;
|
|
||||||
if (currenttexture == texnum)
|
|
||||||
return;
|
|
||||||
currenttexture = texnum;
|
|
||||||
|
|
||||||
bindTexFunc (GL_TEXTURE_2D, texnum);
|
|
||||||
}
|
|
||||||
void GL_BindType (int type, int texnum)
|
|
||||||
{
|
|
||||||
bindTexFunc (type, texnum);
|
|
||||||
|
|
||||||
currenttexture=-1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============================================================================
|
=============================================================================
|
||||||
|
|
||||||
|
@ -615,6 +594,46 @@ void GLDraw_TextureMode_f (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
#define FOG_TEXTURE_WIDTH 32
|
||||||
|
#define FOG_TEXTURE_HEIGHT 32
|
||||||
|
extern int r_fogtexture;
|
||||||
|
void GL_InitFogTexture (void)
|
||||||
|
{
|
||||||
|
qbyte data[FOG_TEXTURE_WIDTH*FOG_TEXTURE_HEIGHT];
|
||||||
|
int x, y;
|
||||||
|
float tw = 1.0f / ((float)FOG_TEXTURE_WIDTH - 1.0f);
|
||||||
|
float th = 1.0f / ((float)FOG_TEXTURE_HEIGHT - 1.0f);
|
||||||
|
float tx, ty, t;
|
||||||
|
|
||||||
|
if (r_fogtexture)
|
||||||
|
return;
|
||||||
|
|
||||||
|
//
|
||||||
|
// fog texture
|
||||||
|
//
|
||||||
|
for ( y = 0, ty = 0.0f; y < FOG_TEXTURE_HEIGHT; y++, ty += th )
|
||||||
|
{
|
||||||
|
for ( x = 0, tx = 0.0f; x < FOG_TEXTURE_WIDTH; x++, tx += tw )
|
||||||
|
{
|
||||||
|
t = (float)(sqrt( tx ) * 255.0);
|
||||||
|
data[x+y*FOG_TEXTURE_WIDTH] = (qbyte)(min( t, 255.0f ));
|
||||||
|
}
|
||||||
|
|
||||||
|
data[y] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
r_fogtexture = texture_extension_number++;
|
||||||
|
GL_Bind(r_fogtexture);
|
||||||
|
qglTexImage2D (GL_TEXTURE_2D, 0, GL_ALPHA, FOG_TEXTURE_WIDTH, FOG_TEXTURE_HEIGHT, 0, GL_ALPHA, GL_UNSIGNED_BYTE, data);
|
||||||
|
|
||||||
|
qglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
|
||||||
|
qglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||||
|
|
||||||
|
qglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||||
|
qglTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
Draw_Init
|
Draw_Init
|
||||||
|
@ -660,8 +679,11 @@ void GLDraw_ReInit (void)
|
||||||
skyboxtex[0] = 0; skyboxtex[1] = 0; skyboxtex[2] = 0; skyboxtex[3] = 0; skyboxtex[4] = 0; skyboxtex[5] = 0;
|
skyboxtex[0] = 0; skyboxtex[1] = 0; skyboxtex[2] = 0; skyboxtex[3] = 0; skyboxtex[4] = 0; skyboxtex[5] = 0;
|
||||||
lightmap_textures=0;
|
lightmap_textures=0;
|
||||||
filmtexture=0;
|
filmtexture=0;
|
||||||
currenttexture=0;
|
|
||||||
glmenu_numcachepics=0;
|
glmenu_numcachepics=0;
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
r_fogtexture=0;
|
||||||
|
#endif
|
||||||
|
GL_FlushBinds();
|
||||||
// GL_FlushSkinCache();
|
// GL_FlushSkinCache();
|
||||||
TRACE(("dbg: GLDraw_ReInit: GL_GAliasFlushSkinCache\n"));
|
TRACE(("dbg: GLDraw_ReInit: GL_GAliasFlushSkinCache\n"));
|
||||||
GL_GAliasFlushSkinCache();
|
GL_GAliasFlushSkinCache();
|
||||||
|
@ -784,6 +806,11 @@ TRACE(("dbg: GLDraw_ReInit: Allocating upload buffers\n"));
|
||||||
TRACE(("dbg: GLDraw_ReInit: GL_EndRendering\n"));
|
TRACE(("dbg: GLDraw_ReInit: GL_EndRendering\n"));
|
||||||
GL_EndRendering ();
|
GL_EndRendering ();
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
Shader_Init();
|
||||||
|
#endif
|
||||||
|
|
||||||
//now emit the conchars picture as if from a wad.
|
//now emit the conchars picture as if from a wad.
|
||||||
strcpy(glmenu_cachepics[glmenu_numcachepics].name, "conchars");
|
strcpy(glmenu_cachepics[glmenu_numcachepics].name, "conchars");
|
||||||
glmenu_cachepics[glmenu_numcachepics].pic.width = 128;
|
glmenu_cachepics[glmenu_numcachepics].pic.width = 128;
|
||||||
|
@ -990,7 +1017,7 @@ void GLDraw_Init (void)
|
||||||
|
|
||||||
memset(scrap_allocated, 0, sizeof(scrap_allocated));
|
memset(scrap_allocated, 0, sizeof(scrap_allocated));
|
||||||
|
|
||||||
GLR_MeshInit();
|
R_BackendInit();
|
||||||
|
|
||||||
Cmd_AddRemCommand ("gl_texturemode", &GLDraw_TextureMode_f);
|
Cmd_AddRemCommand ("gl_texturemode", &GLDraw_TextureMode_f);
|
||||||
|
|
||||||
|
@ -1007,6 +1034,7 @@ void GLDraw_Init (void)
|
||||||
draw_mesh.normals_array = draw_mesh_normals;
|
draw_mesh.normals_array = draw_mesh_normals;
|
||||||
draw_mesh.st_array = draw_mesh_st;
|
draw_mesh.st_array = draw_mesh_st;
|
||||||
draw_mesh.lmst_array = draw_mesh_lmst;
|
draw_mesh.lmst_array = draw_mesh_lmst;
|
||||||
|
|
||||||
}
|
}
|
||||||
void GLDraw_DeInit (void)
|
void GLDraw_DeInit (void)
|
||||||
{
|
{
|
||||||
|
@ -1021,6 +1049,10 @@ void GLDraw_DeInit (void)
|
||||||
uploadmemorybufferintermediate = NULL;
|
uploadmemorybufferintermediate = NULL;
|
||||||
sizeofuploadmemorybuffer = 0; //and give a nice safe sys_error if we try using it.
|
sizeofuploadmemorybuffer = 0; //and give a nice safe sys_error if we try using it.
|
||||||
sizeofuploadmemorybufferintermediate = 0;
|
sizeofuploadmemorybufferintermediate = 0;
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
Shader_Shutdown();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1075,13 +1107,12 @@ void GLDraw_Character (int x, int y, unsigned int num)
|
||||||
draw_mesh_st[3][0] = fcol;
|
draw_mesh_st[3][0] = fcol;
|
||||||
draw_mesh_st[3][1] = frow+size;
|
draw_mesh_st[3][1] = frow+size;
|
||||||
|
|
||||||
|
#ifndef Q3SHADERS
|
||||||
if (num&CON_2NDCHARSETTEXT)
|
if (num&CON_2NDCHARSETTEXT)
|
||||||
GL_DrawMesh(&draw_mesh, NULL, char_tex2, 0);
|
GL_DrawMesh(&draw_mesh, NULL, char_tex2, 0);
|
||||||
else
|
else
|
||||||
GL_DrawMesh(&draw_mesh, NULL, char_texture, 0);
|
GL_DrawMesh(&draw_mesh, NULL, char_texture, 0);
|
||||||
return;
|
#else
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (num&CON_2NDCHARSETTEXT)
|
if (num&CON_2NDCHARSETTEXT)
|
||||||
GL_Bind (char_tex2);
|
GL_Bind (char_tex2);
|
||||||
|
@ -1107,6 +1138,8 @@ return;
|
||||||
glTexCoord2f (fcol, frow + size);
|
glTexCoord2f (fcol, frow + size);
|
||||||
glVertex2f (x, y+8);
|
glVertex2f (x, y+8);
|
||||||
glEnd ();
|
glEnd ();
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLDraw_ColouredCharacter (int x, int y, unsigned int num)
|
void GLDraw_ColouredCharacter (int x, int y, unsigned int num)
|
||||||
|
@ -1269,6 +1302,7 @@ void GLDraw_Pic (int x, int y, qpic_t *pic)
|
||||||
Scrap_Upload ();
|
Scrap_Upload ();
|
||||||
gl = (glpic_t *)pic->data;
|
gl = (glpic_t *)pic->data;
|
||||||
|
|
||||||
|
#ifndef Q3SHADERS
|
||||||
draw_mesh_xyz[0][0] = x;
|
draw_mesh_xyz[0][0] = x;
|
||||||
draw_mesh_xyz[0][1] = y;
|
draw_mesh_xyz[0][1] = y;
|
||||||
draw_mesh_st[0][0] = gl->sl;
|
draw_mesh_st[0][0] = gl->sl;
|
||||||
|
@ -1290,8 +1324,8 @@ void GLDraw_Pic (int x, int y, qpic_t *pic)
|
||||||
draw_mesh_st[3][1] = gl->th;
|
draw_mesh_st[3][1] = gl->th;
|
||||||
|
|
||||||
GL_DrawMesh(&draw_mesh, NULL, gl->texnum, 0);
|
GL_DrawMesh(&draw_mesh, NULL, gl->texnum, 0);
|
||||||
|
#else
|
||||||
|
|
||||||
/*
|
|
||||||
glColor4f (1,1,1,1);
|
glColor4f (1,1,1,1);
|
||||||
GL_Bind (gl->texnum);
|
GL_Bind (gl->texnum);
|
||||||
glBegin (GL_QUADS);
|
glBegin (GL_QUADS);
|
||||||
|
@ -1304,7 +1338,7 @@ void GLDraw_Pic (int x, int y, qpic_t *pic)
|
||||||
glTexCoord2f (gl->sl, gl->th);
|
glTexCoord2f (gl->sl, gl->th);
|
||||||
glVertex2f (x, y+pic->height);
|
glVertex2f (x, y+pic->height);
|
||||||
glEnd ();
|
glEnd ();
|
||||||
*/
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLDraw_LevelPic (qpic_t *pic) //Fullscreen and stuff
|
void GLDraw_LevelPic (qpic_t *pic) //Fullscreen and stuff
|
||||||
|
@ -1404,7 +1438,11 @@ void GLDraw_SubPic(int x, int y, qpic_t *pic, int srcx, int srcy, int width, int
|
||||||
draw_mesh_st[3][0] = newsl;
|
draw_mesh_st[3][0] = newsl;
|
||||||
draw_mesh_st[3][1] = newth;
|
draw_mesh_st[3][1] = newth;
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
GL_DrawAliasMesh(&draw_mesh, gl->texnum);
|
||||||
|
#else
|
||||||
GL_DrawMesh(&draw_mesh, NULL, gl->texnum, 0);
|
GL_DrawMesh(&draw_mesh, NULL, gl->texnum, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1665,7 +1703,11 @@ void GLDraw_Image(float x, float y, float w, float h, float s1, float t1, float
|
||||||
draw_mesh_st[3][0] = s1;
|
draw_mesh_st[3][0] = s1;
|
||||||
draw_mesh_st[3][1] = t2;
|
draw_mesh_st[3][1] = t2;
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
GL_DrawAliasMesh(&draw_mesh, gl->texnum);
|
||||||
|
#else
|
||||||
GL_DrawMesh(&draw_mesh, NULL, gl->texnum, 0);
|
GL_DrawMesh(&draw_mesh, NULL, gl->texnum, 0);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -2192,7 +2234,7 @@ qboolean GL_UploadCompressed (qbyte *file, int *out_width, int *out_height, unsi
|
||||||
int nummips;
|
int nummips;
|
||||||
#define GETVAR(var) memcpy(var, file, sizeof(*var));file+=sizeof(*var);
|
#define GETVAR(var) memcpy(var, file, sizeof(*var));file+=sizeof(*var);
|
||||||
|
|
||||||
if (!gl_compressable || !gl_compress.value)
|
if (!gl_config.arb_texture_compression || !gl_compress.value)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
GETVAR(&nummips)
|
GETVAR(&nummips)
|
||||||
|
@ -2227,9 +2269,6 @@ qboolean GL_UploadCompressed (qbyte *file, int *out_width, int *out_height, unsi
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
qboolean supported_GL_ARB_texture_non_power_of_two;
|
|
||||||
qboolean supported_GL_SGIS_generate_mipmap;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
GL_Upload32
|
GL_Upload32
|
||||||
|
@ -2244,7 +2283,7 @@ void GL_Upload32 (char *name, unsigned *data, int width, int height, qboolean m
|
||||||
|
|
||||||
TRACE(("dbg: GL_Upload32: %s %i %i\n", name, width, height));
|
TRACE(("dbg: GL_Upload32: %s %i %i\n", name, width, height));
|
||||||
|
|
||||||
if (supported_GL_ARB_texture_non_power_of_two) //NPOT is a simple extension that relaxes errors.
|
if (gl_config.arb_texture_non_power_of_two) //NPOT is a simple extension that relaxes errors.
|
||||||
{
|
{
|
||||||
TRACE(("dbg: GL_Upload32: GL_ARB_texture_non_power_of_two\n"));
|
TRACE(("dbg: GL_Upload32: GL_ARB_texture_non_power_of_two\n"));
|
||||||
scaled_width = width;
|
scaled_width = width;
|
||||||
|
@ -2282,7 +2321,7 @@ void GL_Upload32 (char *name, unsigned *data, int width, int height, qboolean m
|
||||||
Sys_Error ("GL_LoadTexture: too big");
|
Sys_Error ("GL_LoadTexture: too big");
|
||||||
|
|
||||||
samples = alpha ? gl_alpha_format : gl_solid_format;
|
samples = alpha ? gl_alpha_format : gl_solid_format;
|
||||||
if (gl_compressable && gl_compress.value && name&&mipmap)
|
if (gl_config.arb_texture_compression && gl_compress.value && name&&mipmap)
|
||||||
samples = alpha ? GL_COMPRESSED_RGBA_ARB : GL_COMPRESSED_RGB_ARB;
|
samples = alpha ? GL_COMPRESSED_RGBA_ARB : GL_COMPRESSED_RGB_ARB;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -2299,7 +2338,7 @@ void GL_Upload32 (char *name, unsigned *data, int width, int height, qboolean m
|
||||||
#else
|
#else
|
||||||
texels += scaled_width * scaled_height;
|
texels += scaled_width * scaled_height;
|
||||||
|
|
||||||
if (supported_GL_SGIS_generate_mipmap&&mipmap)
|
if (gl_config.sgis_generate_mipmap&&mipmap)
|
||||||
{
|
{
|
||||||
TRACE(("dbg: GL_Upload32: GL_SGIS_generate_mipmap\n"));
|
TRACE(("dbg: GL_Upload32: GL_SGIS_generate_mipmap\n"));
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
|
glTexParameterf(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_TRUE);
|
||||||
|
@ -2307,7 +2346,7 @@ texels += scaled_width * scaled_height;
|
||||||
|
|
||||||
if (scaled_width == width && scaled_height == height)
|
if (scaled_width == width && scaled_height == height)
|
||||||
{
|
{
|
||||||
if (!mipmap||supported_GL_SGIS_generate_mipmap) //gotta love this with NPOT textures... :)
|
if (!mipmap||gl_config.sgis_generate_mipmap) //gotta love this with NPOT textures... :)
|
||||||
{
|
{
|
||||||
TRACE(("dbg: GL_Upload32: non-mipmapped/unscaled\n"));
|
TRACE(("dbg: GL_Upload32: non-mipmapped/unscaled\n"));
|
||||||
glTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
glTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data);
|
||||||
|
@ -2320,7 +2359,7 @@ texels += scaled_width * scaled_height;
|
||||||
|
|
||||||
TRACE(("dbg: GL_Upload32: recaled\n"));
|
TRACE(("dbg: GL_Upload32: recaled\n"));
|
||||||
glTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
|
glTexImage2D (GL_TEXTURE_2D, 0, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
|
||||||
if (mipmap && !supported_GL_SGIS_generate_mipmap)
|
if (mipmap && !gl_config.sgis_generate_mipmap)
|
||||||
{
|
{
|
||||||
miplevel = 0;
|
miplevel = 0;
|
||||||
TRACE(("dbg: GL_Upload32: mips\n"));
|
TRACE(("dbg: GL_Upload32: mips\n"));
|
||||||
|
@ -2337,7 +2376,7 @@ texels += scaled_width * scaled_height;
|
||||||
glTexImage2D (GL_TEXTURE_2D, miplevel, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
|
glTexImage2D (GL_TEXTURE_2D, miplevel, samples, scaled_width, scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (gl_compressable && gl_compress.value && gl_savecompressedtex.value && name&&mipmap)
|
if (gl_config.arb_texture_compression && gl_compress.value && gl_savecompressedtex.value && name&&mipmap)
|
||||||
{
|
{
|
||||||
FILE *out;
|
FILE *out;
|
||||||
int miplevels;
|
int miplevels;
|
||||||
|
@ -2390,7 +2429,7 @@ texels += scaled_width * scaled_height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
done:
|
done:
|
||||||
if (supported_GL_SGIS_generate_mipmap&&mipmap)
|
if (gl_config.sgis_generate_mipmap&&mipmap)
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
|
glTexParameterf(GL_TEXTURE_2D, GL_GENERATE_MIPMAP_SGIS, GL_FALSE);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -2413,7 +2452,7 @@ void GL_Upload8Grey (unsigned char*data, int width, int height, qboolean mipmap
|
||||||
unsigned char *scaled = uploadmemorybuffer;
|
unsigned char *scaled = uploadmemorybuffer;
|
||||||
int scaled_width, scaled_height;
|
int scaled_width, scaled_height;
|
||||||
|
|
||||||
if (supported_GL_ARB_texture_non_power_of_two) //NPOT is a simple extension that relaxes errors.
|
if (gl_config.arb_texture_non_power_of_two) //NPOT is a simple extension that relaxes errors.
|
||||||
{
|
{
|
||||||
TRACE(("dbg: GL_Upload32: GL_ARB_texture_non_power_of_two\n"));
|
TRACE(("dbg: GL_Upload32: GL_ARB_texture_non_power_of_two\n"));
|
||||||
scaled_width = width;
|
scaled_width = width;
|
||||||
|
@ -2629,7 +2668,7 @@ void GL_UploadBump(qbyte *data, int width, int height, qboolean mipmap) {
|
||||||
s = width*height;
|
s = width*height;
|
||||||
|
|
||||||
//Resize to power of 2 and maximum texture size
|
//Resize to power of 2 and maximum texture size
|
||||||
if (supported_GL_ARB_texture_non_power_of_two) //NPOT is a simple extension that relaxes errors.
|
if (gl_config.arb_texture_non_power_of_two) //NPOT is a simple extension that relaxes errors.
|
||||||
{
|
{
|
||||||
TRACE(("dbg: GL_Upload32: GL_ARB_texture_non_power_of_two\n"));
|
TRACE(("dbg: GL_Upload32: GL_ARB_texture_non_power_of_two\n"));
|
||||||
scaled_width = width;
|
scaled_width = width;
|
||||||
|
@ -3187,7 +3226,7 @@ int GL_LoadCompressed(char *name)
|
||||||
gltexture_t *glt;
|
gltexture_t *glt;
|
||||||
char inname[MAX_OSPATH];
|
char inname[MAX_OSPATH];
|
||||||
|
|
||||||
if (!gl_compressable || !gl_compress.value)
|
if (!gl_config.arb_texture_compression || !gl_compress.value)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
||||||
|
@ -3321,10 +3360,3 @@ int GL_LoadPicTexture (qpic_t *pic)
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************/
|
/****************************************/
|
||||||
|
|
||||||
void GL_SelectTexture (GLenum target)
|
|
||||||
{
|
|
||||||
if (!gl_mtexable)
|
|
||||||
return;
|
|
||||||
qglSelectTextureSGIS(target);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1217,6 +1217,7 @@ Mod_LoadLighting
|
||||||
void GLMod_LoadLighting (lump_t *l)
|
void GLMod_LoadLighting (lump_t *l)
|
||||||
{
|
{
|
||||||
qbyte *luxdata = NULL;
|
qbyte *luxdata = NULL;
|
||||||
|
int mapcomeswith24bitcolouredlighting = false;
|
||||||
loadmodel->rgblighting = false;
|
loadmodel->rgblighting = false;
|
||||||
|
|
||||||
//lit file light intensity is made to match the world's light intensity.
|
//lit file light intensity is made to match the world's light intensity.
|
||||||
|
@ -1232,7 +1233,10 @@ void GLMod_LoadLighting (lump_t *l)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_loadlits.value && gl_bumpmappingpossible) //fixme: adjust the light intensities.
|
if (loadmodel->fromgame == fg_halflife || loadmodel->fromgame == fg_quake2 || loadmodel->fromgame == fg_quake3)
|
||||||
|
mapcomeswith24bitcolouredlighting = true;
|
||||||
|
|
||||||
|
if (!mapcomeswith24bitcolouredlighting && r_loadlits.value && gl_bumpmappingpossible) //fixme: adjust the light intensities.
|
||||||
{ //the map util has a '-scalecos X' parameter. use 0 if you're going to use only just lux. without lux scalecos 0 is hideous.
|
{ //the map util has a '-scalecos X' parameter. use 0 if you're going to use only just lux. without lux scalecos 0 is hideous.
|
||||||
char luxname[MAX_QPATH];
|
char luxname[MAX_QPATH];
|
||||||
if (!luxdata)
|
if (!luxdata)
|
||||||
|
@ -1280,7 +1284,7 @@ void GLMod_LoadLighting (lump_t *l)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (r_loadlits.value)
|
if (!mapcomeswith24bitcolouredlighting && r_loadlits.value)
|
||||||
{
|
{
|
||||||
qbyte *litdata = NULL;
|
qbyte *litdata = NULL;
|
||||||
char *litname;
|
char *litname;
|
||||||
|
@ -1364,11 +1368,11 @@ void GLMod_LoadLighting (lump_t *l)
|
||||||
// else
|
// else
|
||||||
//failed to find
|
//failed to find
|
||||||
}
|
}
|
||||||
if (loadmodel->fromgame == fg_halflife || loadmodel->fromgame == fg_quake2 || loadmodel->fromgame == fg_quake3)
|
if (mapcomeswith24bitcolouredlighting)
|
||||||
loadmodel->rgblighting = true;
|
loadmodel->rgblighting = true;
|
||||||
|
|
||||||
#ifdef RUNTIMELIGHTING
|
#ifdef RUNTIMELIGHTING
|
||||||
if (r_loadlits.value == 2 && !lightmodel && (loadmodel->rgblighting != true || (!luxdata && gl_bumpmappingpossible)))
|
else if (r_loadlits.value == 2 && !lightmodel && (loadmodel->rgblighting != true || (!luxdata && gl_bumpmappingpossible)))
|
||||||
{
|
{
|
||||||
qbyte *litdata = NULL;
|
qbyte *litdata = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
|
@ -46,7 +46,7 @@ typedef struct {
|
||||||
int (*LeafForPoint) (vec3_t point, struct model_s *model);
|
int (*LeafForPoint) (vec3_t point, struct model_s *model);
|
||||||
} bspfuncs_t;
|
} bspfuncs_t;
|
||||||
|
|
||||||
|
typedef int index_t;
|
||||||
typedef struct mesh_s
|
typedef struct mesh_s
|
||||||
{
|
{
|
||||||
int numvertexes;
|
int numvertexes;
|
||||||
|
@ -57,7 +57,7 @@ typedef struct mesh_s
|
||||||
byte_vec4_t *colors_array;
|
byte_vec4_t *colors_array;
|
||||||
|
|
||||||
int numindexes;
|
int numindexes;
|
||||||
int *indexes;
|
index_t *indexes;
|
||||||
int *trneighbors;
|
int *trneighbors;
|
||||||
vec3_t *trnormals;
|
vec3_t *trnormals;
|
||||||
|
|
||||||
|
@ -144,6 +144,9 @@ typedef struct texture_s
|
||||||
int gl_texturenumfb;
|
int gl_texturenumfb;
|
||||||
int gl_texturenumbumpmap;
|
int gl_texturenumbumpmap;
|
||||||
int gl_texturenumspec;
|
int gl_texturenumspec;
|
||||||
|
|
||||||
|
struct shader_s *shader;
|
||||||
|
|
||||||
struct msurface_s *texturechain; // for gl_texsort drawing
|
struct msurface_s *texturechain; // for gl_texsort drawing
|
||||||
int anim_total; // total tenths in sequence ( 0 = no)
|
int anim_total; // total tenths in sequence ( 0 = no)
|
||||||
int anim_min, anim_max; // time for this frame min <=time< max
|
int anim_min, anim_max; // time for this frame min <=time< max
|
||||||
|
@ -200,6 +203,18 @@ typedef struct glpoly_s
|
||||||
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2 (ldir_xyz)
|
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2 (ldir_xyz)
|
||||||
} glpoly_t;
|
} glpoly_t;
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
typedef struct mfog_s
|
||||||
|
{
|
||||||
|
struct shader_s *shader;
|
||||||
|
|
||||||
|
mplane_t *visibleplane;
|
||||||
|
|
||||||
|
int numplanes;
|
||||||
|
mplane_t **planes;
|
||||||
|
} mfog_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct msurface_s
|
typedef struct msurface_s
|
||||||
{
|
{
|
||||||
int visframe; // should be drawn when node is crossed
|
int visframe; // should be drawn when node is crossed
|
||||||
|
@ -221,6 +236,9 @@ typedef struct msurface_s
|
||||||
|
|
||||||
int light_s, light_t; // gl lightmap coordinates
|
int light_s, light_t; // gl lightmap coordinates
|
||||||
|
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
mfog_t *fog;
|
||||||
|
#endif
|
||||||
mesh_t *mesh;
|
mesh_t *mesh;
|
||||||
entity_t *ownerent;
|
entity_t *ownerent;
|
||||||
glpoly_t *polys; // multiple if warped
|
glpoly_t *polys; // multiple if warped
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
#ifdef RGLQUAKE
|
#ifdef RGLQUAKE
|
||||||
#include "glquake.h"
|
#include "glquake.h"
|
||||||
|
#include "shader.h"
|
||||||
|
|
||||||
//these are shared with gl_rsurf - move to header
|
//these are shared with gl_rsurf - move to header
|
||||||
void R_MirrorChain (msurface_t *s);
|
void R_MirrorChain (msurface_t *s);
|
||||||
|
@ -326,7 +327,7 @@ static void PPL_BaseChain_NoBump_2TMU(msurface_t *s, texture_t *tex)
|
||||||
qglClientActiveTextureARB(GL_TEXTURE1_ARB);
|
qglClientActiveTextureARB(GL_TEXTURE1_ARB);
|
||||||
qglActiveTextureARB(GL_TEXTURE1_ARB);
|
qglActiveTextureARB(GL_TEXTURE1_ARB);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
glTexCoordPointer(2, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stl);
|
glTexCoordPointer(2, GL_FLOAT, sizeof(surfvertexarray_t), varray_v->stl);
|
||||||
|
|
||||||
|
@ -440,7 +441,7 @@ static void PPL_BaseChain_Bump_2TMU(msurface_t *first, texture_t *tex)
|
||||||
|
|
||||||
qglActiveTextureARB(GL_TEXTURE1_ARB);
|
qglActiveTextureARB(GL_TEXTURE1_ARB);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND);
|
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
vi = -1;
|
vi = -1;
|
||||||
for (s=first; s ; s=s->texturechain)
|
for (s=first; s ; s=s->texturechain)
|
||||||
|
@ -515,7 +516,7 @@ static void PPL_BaseChain_Bump_4TMU(msurface_t *s, texture_t *tex)
|
||||||
|
|
||||||
qglActiveTextureARB(GL_TEXTURE3_ARB);
|
qglActiveTextureARB(GL_TEXTURE3_ARB);
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND);
|
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||||
|
|
||||||
qglClientActiveTextureARB(GL_TEXTURE3_ARB);
|
qglClientActiveTextureARB(GL_TEXTURE3_ARB);
|
||||||
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||||
|
@ -836,7 +837,7 @@ void PPL_LoadSpecularFragmentProgram(void)
|
||||||
|
|
||||||
|
|
||||||
//multiply by inverse lm and output the result.
|
//multiply by inverse lm and output the result.
|
||||||
"SUB lm.rgb, 1, lm;\n"
|
// "SUB lm.rgb, 1, lm;\n"
|
||||||
"MUL_SAT ocol.rgb, diff, lm;\n"
|
"MUL_SAT ocol.rgb, diff, lm;\n"
|
||||||
//that's all folks.
|
//that's all folks.
|
||||||
"END";
|
"END";
|
||||||
|
@ -854,7 +855,7 @@ void PPL_LoadSpecularFragmentProgram(void)
|
||||||
varray_i_polytotri[i*3+2] = i+2;
|
varray_i_polytotri[i*3+2] = i+2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gl_arb_fragment_program)
|
if (!gl_config.arb_fragment_program)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
glEnable(GL_FRAGMENT_PROGRAM_ARB);
|
glEnable(GL_FRAGMENT_PROGRAM_ARB);
|
||||||
|
@ -1232,8 +1233,90 @@ static void PPL_BaseTextureChain(msurface_t *first)
|
||||||
{
|
{
|
||||||
extern cvar_t gl_bump, gl_specular;
|
extern cvar_t gl_bump, gl_specular;
|
||||||
texture_t *t;
|
texture_t *t;
|
||||||
|
#ifdef Q3SHADERS
|
||||||
|
if (first->texinfo->texture->shader)
|
||||||
|
{
|
||||||
|
meshbuffer_t mb;
|
||||||
|
msurface_t *s;
|
||||||
|
int vi=-1;
|
||||||
|
glRect_t *theRect;
|
||||||
|
// GL_PushShader(first->texinfo->texture->shader);
|
||||||
|
if (first->texinfo->texture->shader->flags & SHADER_FLARE )
|
||||||
|
return;
|
||||||
|
|
||||||
|
GL_DisableMultitexture();
|
||||||
|
|
||||||
|
glShadeModel(GL_SMOOTH);
|
||||||
|
|
||||||
|
{
|
||||||
|
for (s = first; s ; s=s->texturechain)
|
||||||
|
{
|
||||||
|
if (vi != s->lightmaptexturenum)
|
||||||
|
{
|
||||||
|
vi = s->lightmaptexturenum;
|
||||||
|
if (vi >= 0)
|
||||||
|
{
|
||||||
|
GL_BindType(GL_TEXTURE_2D, deluxmap_textures[vi] );
|
||||||
|
if (lightmap[vi]->deluxmodified)
|
||||||
|
{
|
||||||
|
lightmap[vi]->deluxmodified = false;
|
||||||
|
theRect = &lightmap[vi]->deluxrectchange;
|
||||||
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t,
|
||||||
|
LMBLOCK_WIDTH, theRect->h, GL_RGB, GL_UNSIGNED_BYTE,
|
||||||
|
lightmap[vi]->deluxmaps+(theRect->t) *LMBLOCK_WIDTH*3);
|
||||||
|
theRect->l = LMBLOCK_WIDTH;
|
||||||
|
theRect->t = LMBLOCK_HEIGHT;
|
||||||
|
theRect->h = 0;
|
||||||
|
theRect->w = 0;
|
||||||
|
}
|
||||||
|
GL_BindType(GL_TEXTURE_2D, lightmap_textures[vi] );
|
||||||
|
if (lightmap[vi]->modified)
|
||||||
|
{
|
||||||
|
lightmap[vi]->modified = false;
|
||||||
|
theRect = &lightmap[vi]->rectchange;
|
||||||
|
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, theRect->t,
|
||||||
|
LMBLOCK_WIDTH, theRect->h, gl_lightmap_format, GL_UNSIGNED_BYTE,
|
||||||
|
lightmap[vi]->lightmaps+(theRect->t) *LMBLOCK_WIDTH*lightmap_bytes);
|
||||||
|
theRect->l = LMBLOCK_WIDTH;
|
||||||
|
theRect->t = LMBLOCK_HEIGHT;
|
||||||
|
theRect->h = 0;
|
||||||
|
theRect->w = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!s->mesh)
|
||||||
|
{
|
||||||
|
Con_Printf("Shaded surface with no mesh\n");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* MF_NONE = 1<<0,
|
||||||
|
MF_NORMALS = 1<<1,
|
||||||
|
MF_TRNORMALS = 1<<2,
|
||||||
|
MF_COLORS = 1<<3,
|
||||||
|
MF_STCOORDS = 1<<4,
|
||||||
|
MF_LMCOORDS = 1<<5,
|
||||||
|
MF_NOCULL = 1<<6*/
|
||||||
|
|
||||||
|
mb.entity = &r_worldentity;
|
||||||
|
mb.shader = first->texinfo->texture->shader;
|
||||||
|
mb.fog = s->fog;
|
||||||
|
mb.mesh = s->mesh;
|
||||||
|
mb.infokey = vi;
|
||||||
|
mb.dlightbits = 0;
|
||||||
|
|
||||||
|
|
||||||
|
R_PushMesh(s->mesh, mb.shader->features);
|
||||||
|
|
||||||
|
R_RenderMeshBuffer ( &mb, false );
|
||||||
|
// GL_PushMesh(s->mesh, deluxmap_textures[vi], lightmap_textures[vi]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// GL_PushShader(NULL); //fixme: remove the need.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
|
||||||
t = GLR_TextureAnimation (first->texinfo->texture);
|
t = GLR_TextureAnimation (first->texinfo->texture);
|
||||||
|
@ -2972,7 +3055,7 @@ void PPL_AddLight(dlight_t *dl)
|
||||||
|
|
||||||
sincrw = GL_INCR;
|
sincrw = GL_INCR;
|
||||||
sdecrw = GL_DECR;
|
sdecrw = GL_DECR;
|
||||||
if (gl_ext_stencil_wrap)
|
if (gl_config.ext_stencil_wrap)
|
||||||
{ //minamlise damage...
|
{ //minamlise damage...
|
||||||
sincrw = GL_INCR_WRAP_EXT;
|
sincrw = GL_INCR_WRAP_EXT;
|
||||||
sdecrw = GL_DECR_WRAP_EXT;
|
sdecrw = GL_DECR_WRAP_EXT;
|
||||||
|
@ -3050,7 +3133,6 @@ void PPL_AddLight(dlight_t *dl)
|
||||||
|
|
||||||
glEnable(GL_CULL_FACE);
|
glEnable(GL_CULL_FACE);
|
||||||
|
|
||||||
glStencilFunc( GL_EQUAL, 0, ~0 );
|
|
||||||
qglActiveStencilFaceEXT(GL_BACK);
|
qglActiveStencilFaceEXT(GL_BACK);
|
||||||
glStencilFunc( GL_EQUAL, 0, ~0 );
|
glStencilFunc( GL_EQUAL, 0, ~0 );
|
||||||
}
|
}
|
||||||
|
@ -3059,6 +3141,8 @@ void PPL_AddLight(dlight_t *dl)
|
||||||
glClearStencil(0);
|
glClearStencil(0);
|
||||||
glClear(GL_STENCIL_BUFFER_BIT);
|
glClear(GL_STENCIL_BUFFER_BIT);
|
||||||
|
|
||||||
|
glEnable(GL_CULL_FACE);
|
||||||
|
|
||||||
glStencilFunc( GL_ALWAYS, 1, ~0 );
|
glStencilFunc( GL_ALWAYS, 1, ~0 );
|
||||||
|
|
||||||
glCullFace(GL_BACK);
|
glCullFace(GL_BACK);
|
||||||
|
@ -3113,10 +3197,12 @@ void PPL_DrawWorld (void)
|
||||||
// if (qglGetError())
|
// if (qglGetError())
|
||||||
// Con_Printf("GL Error before world\n");
|
// Con_Printf("GL Error before world\n");
|
||||||
//glColorMask(0,0,0,0);
|
//glColorMask(0,0,0,0);
|
||||||
|
TRACE(("dbg: calling PPL_BaseTextures\n"));
|
||||||
PPL_BaseTextures(cl.worldmodel);
|
PPL_BaseTextures(cl.worldmodel);
|
||||||
// if (qglGetError())
|
// if (qglGetError())
|
||||||
// Con_Printf("GL Error during base textures\n");
|
// Con_Printf("GL Error during base textures\n");
|
||||||
//glColorMask(1,1,1,1);
|
//glColorMask(1,1,1,1);
|
||||||
|
TRACE(("dbg: calling PPL_BaseEntTextures\n"));
|
||||||
PPL_BaseEntTextures();
|
PPL_BaseEntTextures();
|
||||||
// CL_NewDlightRGB(1, r_refdef.vieworg[0], r_refdef.vieworg[1]-16, r_refdef.vieworg[2]-24, 128, 1, 1, 1, 1);
|
// CL_NewDlightRGB(1, r_refdef.vieworg[0], r_refdef.vieworg[1]-16, r_refdef.vieworg[2]-24, 128, 1, 1, 1, 1);
|
||||||
|
|
||||||
|
@ -3151,6 +3237,7 @@ void PPL_DrawWorld (void)
|
||||||
l->color[1]*=2.5;
|
l->color[1]*=2.5;
|
||||||
l->color[2]*=2.5;
|
l->color[2]*=2.5;
|
||||||
|
|
||||||
|
TRACE(("dbg: calling PPL_AddLight\n"));
|
||||||
PPL_AddLight(l);
|
PPL_AddLight(l);
|
||||||
l->color[0]/=2.5;
|
l->color[0]/=2.5;
|
||||||
l->color[1]/=2.5;
|
l->color[1]/=2.5;
|
||||||
|
@ -3166,6 +3253,7 @@ void PPL_DrawWorld (void)
|
||||||
// if (qglGetError())
|
// if (qglGetError())
|
||||||
// Con_Printf("GL Error on shadow lighting\n");
|
// Con_Printf("GL Error on shadow lighting\n");
|
||||||
|
|
||||||
|
TRACE(("dbg: calling PPL_DrawEntFullBrights\n"));
|
||||||
PPL_DrawEntFullBrights();
|
PPL_DrawEntFullBrights();
|
||||||
|
|
||||||
// if (qglGetError())
|
// if (qglGetError())
|
||||||
|
|
|
@ -55,9 +55,6 @@ int c_brush_polys, c_alias_polys;
|
||||||
|
|
||||||
qboolean envmap; // true during envmap command capture
|
qboolean envmap; // true during envmap command capture
|
||||||
|
|
||||||
int currenttexture = -1; // to avoid unnecessary texture sets
|
|
||||||
|
|
||||||
|
|
||||||
int particletexture; // little dot for particles
|
int particletexture; // little dot for particles
|
||||||
int explosiontexture;
|
int explosiontexture;
|
||||||
int playertextures; // up to 16 color translated skins
|
int playertextures; // up to 16 color translated skins
|
||||||
|
@ -122,6 +119,7 @@ cvar_t gl_reporttjunctions = {"gl_reporttjunctions","0"};
|
||||||
cvar_t gl_finish = {"gl_finish","0"};
|
cvar_t gl_finish = {"gl_finish","0"};
|
||||||
cvar_t gl_contrast = {"gl_contrast", "1"};
|
cvar_t gl_contrast = {"gl_contrast", "1"};
|
||||||
cvar_t gl_dither = {"gl_dither", "1"};
|
cvar_t gl_dither = {"gl_dither", "1"};
|
||||||
|
cvar_t gl_maxdist = {"gl_maxdist", "8192"};
|
||||||
|
|
||||||
extern cvar_t gl_ati_truform;
|
extern cvar_t gl_ati_truform;
|
||||||
extern cvar_t gl_ati_truform_type;
|
extern cvar_t gl_ati_truform_type;
|
||||||
|
@ -1113,7 +1111,7 @@ void R_SetupGL (void)
|
||||||
// yfov = (2.0 * tan (scr_fov.value/360*M_PI)) / screenaspect;
|
// yfov = (2.0 * tan (scr_fov.value/360*M_PI)) / screenaspect;
|
||||||
// yfov = 2*atan((float)r_refdef.vrect.height/r_refdef.vrect.width)*(scr_fov.value*2)/M_PI;
|
// yfov = 2*atan((float)r_refdef.vrect.height/r_refdef.vrect.width)*(scr_fov.value*2)/M_PI;
|
||||||
// MYgluPerspective (yfov, screenaspect, 4, 4096);
|
// MYgluPerspective (yfov, screenaspect, 4, 4096);
|
||||||
MYgluPerspective (r_refdef.fov_y, screenaspect, 4, 4096);
|
MYgluPerspective (r_refdef.fov_y, screenaspect, 4, gl_maxdist.value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1209,8 +1207,10 @@ void R_RenderScene (void)
|
||||||
if (!mirror)
|
if (!mirror)
|
||||||
GLR_SetupFrame ();
|
GLR_SetupFrame ();
|
||||||
|
|
||||||
|
TRACE(("dbg: calling R_SetFrustrum\n"));
|
||||||
R_SetFrustum ();
|
R_SetFrustum ();
|
||||||
|
|
||||||
|
TRACE(("dbg: calling R_SetupGL\n"));
|
||||||
R_SetupGL ();
|
R_SetupGL ();
|
||||||
|
|
||||||
if (!(r_refdef.flags & 1))
|
if (!(r_refdef.flags & 1))
|
||||||
|
@ -1219,23 +1219,31 @@ void R_RenderScene (void)
|
||||||
if (!GLR_DoomWorld ())
|
if (!GLR_DoomWorld ())
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
TRACE(("dbg: calling GLR_MarkLeaves\n"));
|
||||||
GLR_MarkLeaves (); // done here so we know if we're in water
|
GLR_MarkLeaves (); // done here so we know if we're in water
|
||||||
|
TRACE(("dbg: calling R_DrawWorld\n"));
|
||||||
R_DrawWorld (); // adds static entities to the list
|
R_DrawWorld (); // adds static entities to the list
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
S_ExtraUpdate (); // don't let sound get messed up if going slow
|
S_ExtraUpdate (); // don't let sound get messed up if going slow
|
||||||
|
|
||||||
|
TRACE(("dbg: calling GLR_DrawEntitiesOnList\n"));
|
||||||
GLR_DrawEntitiesOnList ();
|
GLR_DrawEntitiesOnList ();
|
||||||
|
|
||||||
// R_DrawDecals();
|
// R_DrawDecals();
|
||||||
|
|
||||||
|
TRACE(("dbg: calling GL_DisableMultitexture\n"));
|
||||||
GL_DisableMultitexture();
|
GL_DisableMultitexture();
|
||||||
|
|
||||||
|
TRACE(("dbg: calling R_RenderDlights\n"));
|
||||||
R_RenderDlights ();
|
R_RenderDlights ();
|
||||||
|
|
||||||
if (cl.worldmodel)
|
if (cl.worldmodel)
|
||||||
|
{
|
||||||
|
TRACE(("dbg: calling R_DrawParticles\n"));
|
||||||
R_DrawParticles ();
|
R_DrawParticles ();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef GLTEST
|
#ifdef GLTEST
|
||||||
Test_Draw ();
|
Test_Draw ();
|
||||||
|
|
|
@ -941,6 +941,7 @@ void GLR_BuildLightMap (msurface_t *surf, qbyte *dest, qbyte *deluxdest, stmap *
|
||||||
|
|
||||||
// bound, invert, and shift
|
// bound, invert, and shift
|
||||||
store:
|
store:
|
||||||
|
#ifdef INVERTLIGHTMAPS
|
||||||
switch (gl_lightmap_format)
|
switch (gl_lightmap_format)
|
||||||
{
|
{
|
||||||
#ifdef PEXT_LIGHTSTYLECOL
|
#ifdef PEXT_LIGHTSTYLECOL
|
||||||
|
@ -1293,6 +1294,360 @@ store:
|
||||||
default:
|
default:
|
||||||
Sys_Error ("Bad lightmap format");
|
Sys_Error ("Bad lightmap format");
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
switch (gl_lightmap_format)
|
||||||
|
{
|
||||||
|
#ifdef PEXT_LIGHTSTYLECOL
|
||||||
|
case GL_RGBA:
|
||||||
|
stride -= (smax<<2);
|
||||||
|
bl = blocklights;
|
||||||
|
blg = greenblklights;
|
||||||
|
blb = blueblklights;
|
||||||
|
|
||||||
|
if (!r_stains.value)
|
||||||
|
isstained = false;
|
||||||
|
else
|
||||||
|
isstained = surf->stained;
|
||||||
|
|
||||||
|
/* if (!gl_lightcomponantreduction.value)
|
||||||
|
{
|
||||||
|
for (i=0 ; i<tmax ; i++, dest += stride)
|
||||||
|
{
|
||||||
|
for (j=0 ; j<smax ; j++)
|
||||||
|
{
|
||||||
|
t = *bl++;
|
||||||
|
t >>= 7;
|
||||||
|
if (t > 255)
|
||||||
|
dest[0] = 0;
|
||||||
|
else if (t < 0)
|
||||||
|
dest[0] = 256;
|
||||||
|
else
|
||||||
|
dest[0] = (255-t);
|
||||||
|
|
||||||
|
t = *blg++;
|
||||||
|
t >>= 7;
|
||||||
|
if (t > 255)
|
||||||
|
dest[1] = 0;
|
||||||
|
else if (t < 0)
|
||||||
|
dest[1] = 256;
|
||||||
|
else
|
||||||
|
dest[1] = (255-t);
|
||||||
|
|
||||||
|
t = *blb++;
|
||||||
|
t >>= 7;
|
||||||
|
if (t > 255)
|
||||||
|
dest[2] = 0;
|
||||||
|
else if (t < 0)
|
||||||
|
dest[2] = 256;
|
||||||
|
else
|
||||||
|
dest[2] = (255-t);
|
||||||
|
|
||||||
|
dest[3] = 0;//(dest[0]+dest[1]+dest[2])/3;
|
||||||
|
dest += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*/ {
|
||||||
|
stmap *stain;
|
||||||
|
for (i=0 ; i<tmax ; i++, dest += stride)
|
||||||
|
{
|
||||||
|
stain = stainsrc + i*LMBLOCK_WIDTH*3;
|
||||||
|
for (j=0 ; j<smax ; j++)
|
||||||
|
{
|
||||||
|
r = *bl++;
|
||||||
|
r >>= 7;
|
||||||
|
|
||||||
|
g = *blg++;
|
||||||
|
g >>= 7;
|
||||||
|
|
||||||
|
b = *blb++;
|
||||||
|
b >>= 7;
|
||||||
|
|
||||||
|
if (isstained) //do we need to add the stain?
|
||||||
|
{
|
||||||
|
r += *stain++;
|
||||||
|
g += *stain++;
|
||||||
|
b += *stain++;
|
||||||
|
}
|
||||||
|
|
||||||
|
cr = 0;
|
||||||
|
cg = 0;
|
||||||
|
cb = 0;
|
||||||
|
|
||||||
|
if (r > 255) //ak too much red
|
||||||
|
{
|
||||||
|
cr -= (255-r)/2;
|
||||||
|
cg += (255-r)/4; //reduce it, and indicate to drop the others too.
|
||||||
|
cb += (255-r)/4;
|
||||||
|
r = 255;
|
||||||
|
}
|
||||||
|
// else if (r < 0)
|
||||||
|
// r = 0;
|
||||||
|
|
||||||
|
if (g > 255)
|
||||||
|
{
|
||||||
|
cr += (255-g)/4;
|
||||||
|
cg -= (255-g)/2;
|
||||||
|
cb += (255-g)/4;
|
||||||
|
g = 255;
|
||||||
|
}
|
||||||
|
// else if (g < 0)
|
||||||
|
// g = 0;
|
||||||
|
|
||||||
|
if (b > 255)
|
||||||
|
{
|
||||||
|
cr += (255-b)/4;
|
||||||
|
cg += (255-b)/4;
|
||||||
|
cb -= (255-b)/2;
|
||||||
|
b = 255;
|
||||||
|
}
|
||||||
|
// else if (b < 0)
|
||||||
|
// b = 0;
|
||||||
|
//*
|
||||||
|
if ((r+cr) > 255)
|
||||||
|
dest[0] = 0; //inverse lighting
|
||||||
|
else if ((r+cr) < 0)
|
||||||
|
dest[0] = 255;
|
||||||
|
else
|
||||||
|
dest[0] = 255-(r+cr);
|
||||||
|
|
||||||
|
if ((g+cg) > 255)
|
||||||
|
dest[1] = 0;
|
||||||
|
else if ((g+cg) < 0)
|
||||||
|
dest[1] = 255;
|
||||||
|
else
|
||||||
|
dest[1] = 255-(g+cg);
|
||||||
|
|
||||||
|
if ((b+cb) > 255)
|
||||||
|
dest[2] = 0;
|
||||||
|
else if ((b+cb) < 0)
|
||||||
|
dest[2] = 255;
|
||||||
|
else
|
||||||
|
dest[2] = 255-(b+cb);
|
||||||
|
/*/
|
||||||
|
if ((r+cr) > 255)
|
||||||
|
dest[0] = 255; //non-inverse lighting
|
||||||
|
else if ((r+cr) < 0)
|
||||||
|
dest[0] = 0;
|
||||||
|
else
|
||||||
|
dest[0] = (r+cr);
|
||||||
|
|
||||||
|
if ((g+cg) > 255)
|
||||||
|
dest[1] = 255;
|
||||||
|
else if ((g+cg) < 0)
|
||||||
|
dest[1] = 0;
|
||||||
|
else
|
||||||
|
dest[1] = (g+cg);
|
||||||
|
|
||||||
|
if ((b+cb) > 255)
|
||||||
|
dest[2] = 255;
|
||||||
|
else if ((b+cb) < 0)
|
||||||
|
dest[2] = 0;
|
||||||
|
else
|
||||||
|
dest[2] = (b+cb);
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dest[3] = (dest[0]+dest[1]+dest[2])/3; //alpha?!?!
|
||||||
|
dest += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case GL_RGB:
|
||||||
|
stride -= smax*3;
|
||||||
|
bl = blocklights;
|
||||||
|
blg = greenblklights;
|
||||||
|
blb = blueblklights;
|
||||||
|
|
||||||
|
if (!r_stains.value)
|
||||||
|
isstained = false;
|
||||||
|
else
|
||||||
|
isstained = surf->stained;
|
||||||
|
|
||||||
|
/* if (!gl_lightcomponantreduction.value)
|
||||||
|
{
|
||||||
|
for (i=0 ; i<tmax ; i++, dest += stride)
|
||||||
|
{
|
||||||
|
for (j=0 ; j<smax ; j++)
|
||||||
|
{
|
||||||
|
t = *bl++;
|
||||||
|
t >>= 7;
|
||||||
|
if (t > 255)
|
||||||
|
dest[0] = 255;
|
||||||
|
else if (t < 0)
|
||||||
|
dest[0] = 0;
|
||||||
|
else
|
||||||
|
dest[0] = t;
|
||||||
|
|
||||||
|
t = *blg++;
|
||||||
|
t >>= 7;
|
||||||
|
if (t > 255)
|
||||||
|
dest[1] = 255;
|
||||||
|
else if (t < 0)
|
||||||
|
dest[1] = 0;
|
||||||
|
else
|
||||||
|
dest[1] = t;
|
||||||
|
|
||||||
|
t = *blb++;
|
||||||
|
t >>= 7;
|
||||||
|
if (t > 255)
|
||||||
|
dest[2] = 255;
|
||||||
|
else if (t < 0)
|
||||||
|
dest[2] = 0;
|
||||||
|
else
|
||||||
|
dest[2] = t;
|
||||||
|
|
||||||
|
dest += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*/ {
|
||||||
|
stmap *stain;
|
||||||
|
for (i=0 ; i<tmax ; i++, dest += stride)
|
||||||
|
{
|
||||||
|
stain = stainsrc + i*LMBLOCK_WIDTH*3;
|
||||||
|
for (j=0 ; j<smax ; j++)
|
||||||
|
{
|
||||||
|
r = *bl++;
|
||||||
|
r >>= 7;
|
||||||
|
|
||||||
|
g = *blg++;
|
||||||
|
g >>= 7;
|
||||||
|
|
||||||
|
b = *blb++;
|
||||||
|
b >>= 7;
|
||||||
|
|
||||||
|
if (isstained) //do we need to add the stain?
|
||||||
|
{
|
||||||
|
r += *stain++;
|
||||||
|
g += *stain++;
|
||||||
|
b += *stain++;
|
||||||
|
}
|
||||||
|
|
||||||
|
cr = 0;
|
||||||
|
cg = 0;
|
||||||
|
cb = 0;
|
||||||
|
|
||||||
|
if (r > 255) //ak too much red
|
||||||
|
{
|
||||||
|
cr -= (255-r)/2;
|
||||||
|
cg += (255-r)/4; //reduce it, and indicate to drop the others too.
|
||||||
|
cb += (255-r)/4;
|
||||||
|
r = 255;
|
||||||
|
}
|
||||||
|
// else if (r < 0)
|
||||||
|
// r = 0;
|
||||||
|
|
||||||
|
if (g > 255)
|
||||||
|
{
|
||||||
|
cr += (255-g)/4;
|
||||||
|
cg -= (255-g)/2;
|
||||||
|
cb += (255-g)/4;
|
||||||
|
g = 255;
|
||||||
|
}
|
||||||
|
// else if (g < 0)
|
||||||
|
// g = 0;
|
||||||
|
|
||||||
|
if (b > 255)
|
||||||
|
{
|
||||||
|
cr += (255-b)/4;
|
||||||
|
cg += (255-b)/4;
|
||||||
|
cb -= (255-b)/2;
|
||||||
|
b = 255;
|
||||||
|
}
|
||||||
|
// else if (b < 0)
|
||||||
|
// b = 0;
|
||||||
|
//*
|
||||||
|
if ((r+cr) > 255)
|
||||||
|
dest[0] = 255; //inverse lighting
|
||||||
|
else if ((r+cr) < 0)
|
||||||
|
dest[0] = 0;
|
||||||
|
else
|
||||||
|
dest[0] = (r+cr);
|
||||||
|
|
||||||
|
if ((g+cg) > 255)
|
||||||
|
dest[1] = 255;
|
||||||
|
else if ((g+cg) < 0)
|
||||||
|
dest[1] = 0;
|
||||||
|
else
|
||||||
|
dest[1] = (g+cg);
|
||||||
|
|
||||||
|
if ((b+cb) > 255)
|
||||||
|
dest[2] = 255;
|
||||||
|
else if ((b+cb) < 0)
|
||||||
|
dest[2] = 0;
|
||||||
|
else
|
||||||
|
dest[2] = (b+cb);
|
||||||
|
/*/
|
||||||
|
if ((r+cr) > 255)
|
||||||
|
dest[0] = 255; //non-inverse lighting
|
||||||
|
else if ((r+cr) < 0)
|
||||||
|
dest[0] = 0;
|
||||||
|
else
|
||||||
|
dest[0] = (r+cr);
|
||||||
|
|
||||||
|
if ((g+cg) > 255)
|
||||||
|
dest[1] = 255;
|
||||||
|
else if ((g+cg) < 0)
|
||||||
|
dest[1] = 0;
|
||||||
|
else
|
||||||
|
dest[1] = (g+cg);
|
||||||
|
|
||||||
|
if ((b+cb) > 255)
|
||||||
|
dest[2] = 255;
|
||||||
|
else if ((b+cb) < 0)
|
||||||
|
dest[2] = 0;
|
||||||
|
else
|
||||||
|
dest[2] = (b+cb);
|
||||||
|
// */
|
||||||
|
dest += 3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#else
|
||||||
|
case GL_RGBA:
|
||||||
|
stride -= (smax<<2);
|
||||||
|
bl = blocklights;
|
||||||
|
for (i=0 ; i<tmax ; i++, dest += stride)
|
||||||
|
{
|
||||||
|
for (j=0 ; j<smax ; j++)
|
||||||
|
{
|
||||||
|
t = *bl++;
|
||||||
|
t >>= 7;
|
||||||
|
if (t > 255)
|
||||||
|
t = 255;
|
||||||
|
dest[3] = t;
|
||||||
|
dest += 4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
case GL_ALPHA:
|
||||||
|
case GL_LUMINANCE:
|
||||||
|
case GL_INTENSITY:
|
||||||
|
bl = blocklights;
|
||||||
|
for (i=0 ; i<tmax ; i++, dest += stride)
|
||||||
|
{
|
||||||
|
for (j=0 ; j<smax ; j++)
|
||||||
|
{
|
||||||
|
t = *bl++;
|
||||||
|
t >>= 7;
|
||||||
|
if (t > 255)
|
||||||
|
t = 255;
|
||||||
|
dest[j] = t;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
Sys_Error ("Bad lightmap format");
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -2796,7 +3151,6 @@ void R_DrawWorld (void)
|
||||||
VectorCopy (r_refdef.vieworg, modelorg);
|
VectorCopy (r_refdef.vieworg, modelorg);
|
||||||
|
|
||||||
currententity = &ent;
|
currententity = &ent;
|
||||||
currenttexture = -1;
|
|
||||||
|
|
||||||
#ifdef TERRAINMAPS
|
#ifdef TERRAINMAPS
|
||||||
if (ent.model->type == mod_terrain)
|
if (ent.model->type == mod_terrain)
|
||||||
|
@ -2836,6 +3190,7 @@ void R_DrawWorld (void)
|
||||||
#endif
|
#endif
|
||||||
GLR_RecursiveWorldNode (cl.worldmodel->nodes);
|
GLR_RecursiveWorldNode (cl.worldmodel->nodes);
|
||||||
|
|
||||||
|
TRACE(("dbg: calling PPL_DrawWorld\n"));
|
||||||
// if (r_shadows.value >= 2 && gl_canstencil && gl_mtexable)
|
// if (r_shadows.value >= 2 && gl_canstencil && gl_mtexable)
|
||||||
PPL_DrawWorld();
|
PPL_DrawWorld();
|
||||||
// else
|
// else
|
||||||
|
|
|
@ -215,6 +215,9 @@ void GLSCR_UpdateScreen (void)
|
||||||
Sbar_FinaleOverlay ();
|
Sbar_FinaleOverlay ();
|
||||||
SCR_CheckDrawCenterString ();
|
SCR_CheckDrawCenterString ();
|
||||||
}
|
}
|
||||||
|
else if (cl.intermission == 3 && key_dest == key_game)
|
||||||
|
{
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Draw_Crosshair();
|
Draw_Crosshair();
|
||||||
|
|
|
@ -67,6 +67,7 @@ void (APIENTRY *qglViewport) (GLint x, GLint y, GLsizei width, GLsizei height);
|
||||||
void (APIENTRY *qglGetTexLevelParameteriv) (GLenum target, GLint level, GLenum pname, GLint *params);
|
void (APIENTRY *qglGetTexLevelParameteriv) (GLenum target, GLint level, GLenum pname, GLint *params);
|
||||||
|
|
||||||
void (APIENTRY *qglDrawElements) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
void (APIENTRY *qglDrawElements) (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
|
||||||
|
void (APIENTRY *qglArrayElement) (GLint i);
|
||||||
void (APIENTRY *qglVertexPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
void (APIENTRY *qglVertexPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||||
void (APIENTRY *qglNormalPointer) (GLenum type, GLsizei stride, const GLvoid *pointer);
|
void (APIENTRY *qglNormalPointer) (GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||||
void (APIENTRY *qglTexCoordPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
void (APIENTRY *qglTexCoordPointer) (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer);
|
||||||
|
@ -86,7 +87,8 @@ PFNGLGETPROGRAMIVARBPROC qglGetProgramivARB;
|
||||||
PFNGLBINDPROGRAMARBPROC qglBindProgramARB;
|
PFNGLBINDPROGRAMARBPROC qglBindProgramARB;
|
||||||
PFNGLGENPROGRAMSARBPROC qglGenProgramsARB;
|
PFNGLGENPROGRAMSARBPROC qglGenProgramsARB;
|
||||||
|
|
||||||
|
PFNGLLOCKARRAYSEXTPROC qglLockArraysEXT;
|
||||||
|
PFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,17 +117,16 @@ PFNGLACTIVESTENCILFACEEXTPROC qglActiveStencilFaceEXT;
|
||||||
BINDTEXFUNCPTR bindTexFunc;
|
BINDTEXFUNCPTR bindTexFunc;
|
||||||
|
|
||||||
|
|
||||||
qboolean gl_ext_stencil_wrap;
|
|
||||||
int gl_mtexarbable=0; //max texture units
|
int gl_mtexarbable=0; //max texture units
|
||||||
qboolean gl_mtexable = false;
|
qboolean gl_mtexable = false;
|
||||||
qboolean gl_compressable=false;
|
|
||||||
int gl_bumpmappingpossible;
|
int gl_bumpmappingpossible;
|
||||||
|
|
||||||
qboolean gl_arb_fragment_program;
|
|
||||||
|
|
||||||
qboolean gammaworks; //if the gl drivers can set proper gamma.
|
qboolean gammaworks; //if the gl drivers can set proper gamma.
|
||||||
|
|
||||||
|
|
||||||
|
gl_config_t gl_config;
|
||||||
|
|
||||||
//int texture_mode = GL_NEAREST;
|
//int texture_mode = GL_NEAREST;
|
||||||
//int texture_mode = GL_NEAREST_MIPMAP_NEAREST;
|
//int texture_mode = GL_NEAREST_MIPMAP_NEAREST;
|
||||||
//int texture_mode = GL_NEAREST_MIPMAP_LINEAR;
|
//int texture_mode = GL_NEAREST_MIPMAP_LINEAR;
|
||||||
|
@ -140,8 +141,8 @@ int texture_extension_number = 1;
|
||||||
void GL_CheckExtensions (void *(*getglfunction) (char *name))
|
void GL_CheckExtensions (void *(*getglfunction) (char *name))
|
||||||
{
|
{
|
||||||
extern cvar_t gl_bump;
|
extern cvar_t gl_bump;
|
||||||
qboolean support_GL_ARB_texture_env_combine, support_GL_ARB_texture_env_dot3, support_GL_ARB_texture_cube_map;
|
|
||||||
|
|
||||||
|
memset(&gl_config, 0, sizeof(gl_config));
|
||||||
|
|
||||||
//multitexture
|
//multitexture
|
||||||
gl_mtexable = false;
|
gl_mtexable = false;
|
||||||
|
@ -157,36 +158,29 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
|
||||||
//none of them bumpmapping possabilities.
|
//none of them bumpmapping possabilities.
|
||||||
gl_bumpmappingpossible = false;
|
gl_bumpmappingpossible = false;
|
||||||
|
|
||||||
//no GL_EXT_stencil_wrap
|
|
||||||
gl_ext_stencil_wrap = false;
|
|
||||||
|
|
||||||
//no GL_ATI_separate_stencil
|
//no GL_ATI_separate_stencil
|
||||||
qglStencilOpSeparateATI = NULL;
|
qglStencilOpSeparateATI = NULL;
|
||||||
|
|
||||||
//no GL_EXT_stencil_two_side
|
//no GL_EXT_stencil_two_side
|
||||||
qglActiveStencilFaceEXT = NULL;
|
qglActiveStencilFaceEXT = NULL;
|
||||||
|
|
||||||
//no GL_ARB_texture_compression
|
|
||||||
gl_compressable = false;
|
|
||||||
|
|
||||||
//no truform. sorry.
|
//no truform. sorry.
|
||||||
qglPNTrianglesfATI = NULL;
|
qglPNTrianglesfATI = NULL;
|
||||||
qglPNTrianglesiATI = NULL;
|
qglPNTrianglesiATI = NULL;
|
||||||
|
|
||||||
//fragment programs
|
//fragment programs
|
||||||
gl_arb_fragment_program = false;
|
|
||||||
qglProgramStringARB = NULL;
|
qglProgramStringARB = NULL;
|
||||||
qglGetProgramivARB = NULL;
|
qglGetProgramivARB = NULL;
|
||||||
qglBindProgramARB = NULL;
|
qglBindProgramARB = NULL;
|
||||||
qglGenProgramsARB = NULL;
|
qglGenProgramsARB = NULL;
|
||||||
|
|
||||||
supported_GL_ARB_texture_non_power_of_two = false;
|
gl_config.arb_texture_non_power_of_two = false;
|
||||||
supported_GL_SGIS_generate_mipmap = false;
|
gl_config.sgis_generate_mipmap = false;
|
||||||
|
|
||||||
if (strstr(gl_extensions, "GL_ARB_texture_non_power_of_two"))
|
if (strstr(gl_extensions, "GL_ARB_texture_non_power_of_two"))
|
||||||
supported_GL_ARB_texture_non_power_of_two = true;
|
gl_config.arb_texture_non_power_of_two = true;
|
||||||
if (strstr(gl_extensions, "GL_SGIS_generate_mipmap"))
|
if (strstr(gl_extensions, "GL_SGIS_generate_mipmap"))
|
||||||
supported_GL_SGIS_generate_mipmap = true;
|
gl_config.sgis_generate_mipmap = true;
|
||||||
|
|
||||||
if (strstr(gl_extensions, "GL_ARB_multitexture") && !COM_CheckParm("-noamtex"))
|
if (strstr(gl_extensions, "GL_ARB_multitexture") && !COM_CheckParm("-noamtex"))
|
||||||
{ //ARB multitexture is the popular choice.
|
{ //ARB multitexture is the popular choice.
|
||||||
|
@ -229,7 +223,7 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr(gl_extensions, "GL_EXT_stencil_wrap"))
|
if (strstr(gl_extensions, "GL_EXT_stencil_wrap"))
|
||||||
gl_ext_stencil_wrap = true;
|
gl_config.ext_stencil_wrap = true;
|
||||||
|
|
||||||
if (strstr(gl_extensions, "GL_ATI_separate_stencil"))
|
if (strstr(gl_extensions, "GL_ATI_separate_stencil"))
|
||||||
qglStencilOpSeparateATI = (void *) getglext("glStencilOpSeparateATI");
|
qglStencilOpSeparateATI = (void *) getglext("glStencilOpSeparateATI");
|
||||||
|
@ -247,7 +241,7 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
|
||||||
qglGetCompressedTexImageARB = NULL;
|
qglGetCompressedTexImageARB = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
gl_compressable = true;
|
gl_config.arb_texture_compression = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strstr(gl_extensions, "GL_ATI_pn_triangles"))
|
if (strstr(gl_extensions, "GL_ATI_pn_triangles"))
|
||||||
|
@ -263,17 +257,21 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name))
|
||||||
bindTexFunc = (void *)getglext("glBindTexture");
|
bindTexFunc = (void *)getglext("glBindTexture");
|
||||||
}
|
}
|
||||||
|
|
||||||
support_GL_ARB_texture_env_combine = !!strstr(gl_extensions, "GL_ARB_texture_env_combine");
|
gl_config.tex_env_combine = !!strstr(gl_extensions, "GL_EXT_texture_env_combine");
|
||||||
support_GL_ARB_texture_env_dot3 = !!strstr(gl_extensions, "GL_ARB_texture_env_dot3");
|
gl_config.env_add = !!strstr(gl_extensions, "GL_EXT_texture_env_add");
|
||||||
support_GL_ARB_texture_cube_map = !!strstr(gl_extensions, "GL_ARB_texture_cube_map");
|
gl_config.nv_tex_env_combine4 = !!strstr(gl_extensions, "GL_NV_texture_env_combine4");
|
||||||
|
|
||||||
if (gl_mtexarbable && support_GL_ARB_texture_cube_map && support_GL_ARB_texture_env_combine && support_GL_ARB_texture_env_dot3 && !COM_CheckParm("-nobump") && gl_bump.value)
|
gl_config.arb_texture_env_combine = !!strstr(gl_extensions, "GL_ARB_texture_env_combine");
|
||||||
|
gl_config.arb_texture_env_dot3 = !!strstr(gl_extensions, "GL_ARB_texture_env_dot3");
|
||||||
|
gl_config.arb_texture_cube_map = !!strstr(gl_extensions, "GL_ARB_texture_cube_map");
|
||||||
|
|
||||||
|
if (gl_mtexarbable && gl_config.arb_texture_cube_map && gl_config.arb_texture_env_combine && gl_config.arb_texture_env_dot3 && !COM_CheckParm("-nobump") && gl_bump.value)
|
||||||
gl_bumpmappingpossible = true;
|
gl_bumpmappingpossible = true;
|
||||||
|
|
||||||
|
|
||||||
if (!!strstr(gl_extensions, "GL_ARB_fragment_program"))
|
if (!!strstr(gl_extensions, "GL_ARB_fragment_program"))
|
||||||
{
|
{
|
||||||
gl_arb_fragment_program = true;
|
gl_config.arb_fragment_program = true;
|
||||||
qglProgramStringARB = (void *)getglext("glProgramStringARB");
|
qglProgramStringARB = (void *)getglext("glProgramStringARB");
|
||||||
qglGetProgramivARB = (void *)getglext("glGetProgramivARB");
|
qglGetProgramivARB = (void *)getglext("glGetProgramivARB");
|
||||||
qglBindProgramARB = (void *)getglext("glBindProgramARB");
|
qglBindProgramARB = (void *)getglext("glBindProgramARB");
|
||||||
|
@ -352,6 +350,7 @@ void GL_Init(void *(*getglfunction) (char *name))
|
||||||
|
|
||||||
//various vertex array stuff.
|
//various vertex array stuff.
|
||||||
qglDrawElements = (void *)getglcore("glDrawElements");
|
qglDrawElements = (void *)getglcore("glDrawElements");
|
||||||
|
qglArrayElement = (void *)getglcore("glArrayElement");
|
||||||
qglVertexPointer = (void *)getglcore("glVertexPointer");
|
qglVertexPointer = (void *)getglcore("glVertexPointer");
|
||||||
qglNormalPointer = (void *)getglcore("glNormalPointer");
|
qglNormalPointer = (void *)getglcore("glNormalPointer");
|
||||||
qglTexCoordPointer = (void *)getglcore("glTexCoordPointer");
|
qglTexCoordPointer = (void *)getglcore("glTexCoordPointer");
|
||||||
|
|
|
@ -320,6 +320,13 @@ void EmitSkyPolys (msurface_t *fa)
|
||||||
vec3_t dir;
|
vec3_t dir;
|
||||||
float length;
|
float length;
|
||||||
|
|
||||||
|
if (fa->mesh)
|
||||||
|
{
|
||||||
|
fa->mesh->colors_array = NULL;
|
||||||
|
GL_DrawAliasMesh(fa->mesh, 1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
for (p=fa->polys ; p ; p=p->next)
|
for (p=fa->polys ; p ; p=p->next)
|
||||||
{
|
{
|
||||||
glBegin (GL_POLYGON);
|
glBegin (GL_POLYGON);
|
||||||
|
@ -344,6 +351,7 @@ void EmitSkyPolys (msurface_t *fa)
|
||||||
glEnd ();
|
glEnd ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
|
@ -386,7 +394,7 @@ void R_DrawSkyChain (msurface_t *s)
|
||||||
|
|
||||||
GL_DisableMultitexture();
|
GL_DisableMultitexture();
|
||||||
|
|
||||||
if (r_fastsky.value) //this is for visability only... we'd otherwise not stoop this low (and this IS low)
|
if (r_fastsky.value||!solidskytexture) //this is for visability only... we'd otherwise not stoop this low (and this IS low)
|
||||||
{
|
{
|
||||||
int fc;
|
int fc;
|
||||||
qbyte *pal;
|
qbyte *pal;
|
||||||
|
@ -720,6 +728,19 @@ void R_DrawSkyBoxChain (msurface_t *s)
|
||||||
// calculate vertex values for sky box
|
// calculate vertex values for sky box
|
||||||
|
|
||||||
for (fa=s ; fa ; fa=fa->texturechain)
|
for (fa=s ; fa ; fa=fa->texturechain)
|
||||||
|
{
|
||||||
|
if (fa->mesh)
|
||||||
|
{
|
||||||
|
//triangulate
|
||||||
|
for (i=2 ; i<fa->mesh->numvertexes ; i++)
|
||||||
|
{
|
||||||
|
VectorSubtract (fa->mesh->xyz_array[0], r_origin, verts[0]);
|
||||||
|
VectorSubtract (fa->mesh->xyz_array[i-1], r_origin, verts[1]);
|
||||||
|
VectorSubtract (fa->mesh->xyz_array[i], r_origin, verts[2]);
|
||||||
|
ClipSkyPolygon (3, verts[0], 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
for (p=fa->polys ; p ; p=p->next)
|
for (p=fa->polys ; p ; p=p->next)
|
||||||
{
|
{
|
||||||
|
@ -730,11 +751,16 @@ void R_DrawSkyBoxChain (msurface_t *s)
|
||||||
ClipSkyPolygon (p->numverts, verts[0], 0);
|
ClipSkyPolygon (p->numverts, verts[0], 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
R_DrawSkyBox (s);
|
R_DrawSkyBox (s);
|
||||||
|
|
||||||
glColorMask(0, 0, 0, 0);
|
glColorMask(0, 0, 0, 0);
|
||||||
for (fa=s ; fa ; fa=fa->texturechain)
|
for (fa=s ; fa ; fa=fa->texturechain)
|
||||||
|
{
|
||||||
|
if (fa->mesh)
|
||||||
|
GL_DrawAliasMesh(fa->mesh, 1);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
for (p=fa->polys ; p ; p=p->next)
|
for (p=fa->polys ; p ; p=p->next)
|
||||||
{
|
{
|
||||||
|
@ -744,6 +770,7 @@ void R_DrawSkyBoxChain (msurface_t *s)
|
||||||
glEnd();
|
glEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
glColorMask(1, 1, 1, 1);
|
glColorMask(1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -891,6 +918,10 @@ glEnable (GL_DEPTH_TEST);
|
||||||
{
|
{
|
||||||
glColorMask(0, 0, 0, 0); //depth only.
|
glColorMask(0, 0, 0, 0); //depth only.
|
||||||
for (fa = s; fa; fa = fa->texturechain)
|
for (fa = s; fa; fa = fa->texturechain)
|
||||||
|
{
|
||||||
|
if (fa->mesh)
|
||||||
|
GL_DrawAliasMesh(fa->mesh, 1);
|
||||||
|
else
|
||||||
{
|
{
|
||||||
for (poly = fa->polys; poly; poly = poly->next)
|
for (poly = fa->polys; poly; poly = poly->next)
|
||||||
{
|
{
|
||||||
|
@ -900,6 +931,7 @@ glEnable (GL_DEPTH_TEST);
|
||||||
glEnd ();
|
glEnd ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
glColorMask(1, 1, 1, 1);
|
glColorMask(1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,6 +86,26 @@ extern PFNGLPNTRIANGLESFATIPROC qglPNTrianglesfATI;
|
||||||
extern int texture_extension_number;
|
extern int texture_extension_number;
|
||||||
extern int texture_mode;
|
extern int texture_mode;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
qboolean tex_env_combine;
|
||||||
|
qboolean nv_tex_env_combine4;
|
||||||
|
qboolean env_add;
|
||||||
|
|
||||||
|
qboolean arb_texture_non_power_of_two;
|
||||||
|
qboolean sgis_generate_mipmap;
|
||||||
|
|
||||||
|
qboolean arb_texture_env_combine;
|
||||||
|
qboolean arb_texture_env_dot3;
|
||||||
|
qboolean arb_texture_cube_map;
|
||||||
|
|
||||||
|
qboolean arb_texture_compression;
|
||||||
|
qboolean arb_fragment_program;
|
||||||
|
qboolean ext_stencil_wrap;
|
||||||
|
int maxtmus; //max texture units
|
||||||
|
} gl_config_t;
|
||||||
|
|
||||||
|
extern gl_config_t gl_config;
|
||||||
|
|
||||||
extern float gldepthmin, gldepthmax;
|
extern float gldepthmin, gldepthmax;
|
||||||
|
|
||||||
void GL_Upload32 (char *name, unsigned *data, int width, int height, qboolean mipmap, qboolean alpha); //name was added for texture compression output
|
void GL_Upload32 (char *name, unsigned *data, int width, int height, qboolean mipmap, qboolean alpha); //name was added for texture compression output
|
||||||
|
@ -172,7 +192,6 @@ extern texture_t *r_notexture_mip;
|
||||||
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
|
||||||
|
|
||||||
extern qboolean envmap;
|
extern qboolean envmap;
|
||||||
extern int currenttexture;
|
|
||||||
extern int particletexture;
|
extern int particletexture;
|
||||||
extern int explosiontexture;
|
extern int explosiontexture;
|
||||||
extern int netgraphtexture; // netgraph texture
|
extern int netgraphtexture; // netgraph texture
|
||||||
|
@ -216,10 +235,8 @@ extern lpMTexFUNC qglMTexCoord2fSGIS;
|
||||||
extern lpSelTexFUNC qglSelectTextureSGIS;
|
extern lpSelTexFUNC qglSelectTextureSGIS;
|
||||||
|
|
||||||
|
|
||||||
extern qboolean gl_ext_stencil_wrap;
|
|
||||||
extern int gl_mtexarbable; //max texture units
|
extern int gl_mtexarbable; //max texture units
|
||||||
extern qboolean gl_mtexable;
|
extern qboolean gl_mtexable;
|
||||||
extern qboolean gl_compressable;
|
|
||||||
|
|
||||||
extern int mtexid0;
|
extern int mtexid0;
|
||||||
extern int mtexid1;
|
extern int mtexid1;
|
||||||
|
@ -229,9 +246,6 @@ extern qboolean gl_mtexable;
|
||||||
void GL_DisableMultitexture(void);
|
void GL_DisableMultitexture(void);
|
||||||
void GL_EnableMultitexture(void);
|
void GL_EnableMultitexture(void);
|
||||||
|
|
||||||
extern qboolean supported_GL_SGIS_generate_mipmap;
|
|
||||||
extern qboolean supported_GL_ARB_texture_non_power_of_two;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// gl_warp.c
|
// gl_warp.c
|
||||||
//
|
//
|
||||||
|
@ -686,6 +700,9 @@ extern PFNGLGETPROGRAMIVARBPROC qglGetProgramivARB;
|
||||||
extern PFNGLBINDPROGRAMARBPROC qglBindProgramARB;
|
extern PFNGLBINDPROGRAMARBPROC qglBindProgramARB;
|
||||||
extern PFNGLGENPROGRAMSARBPROC qglGenProgramsARB;
|
extern PFNGLGENPROGRAMSARBPROC qglGenProgramsARB;
|
||||||
|
|
||||||
|
extern PFNGLLOCKARRAYSEXTPROC qglLockArraysEXT;
|
||||||
|
extern PFNGLUNLOCKARRAYSEXTPROC qglUnlockArraysEXT;
|
||||||
|
|
||||||
|
|
||||||
#define glAlphaFunc qglAlphaFunc
|
#define glAlphaFunc qglAlphaFunc
|
||||||
#define glBlendFunc qglBlendFunc
|
#define glBlendFunc qglBlendFunc
|
||||||
|
|
|
@ -112,6 +112,7 @@ extern qlpMTex2FUNC qglMultiTexCoord2fARB;
|
||||||
|
|
||||||
//some of these were needed.
|
//some of these were needed.
|
||||||
//They were also not in the ones I could find on the web.
|
//They were also not in the ones I could find on the web.
|
||||||
|
//GL_ARB_texture_env_combine
|
||||||
#define GL_COMBINE_ARB 0x8570
|
#define GL_COMBINE_ARB 0x8570
|
||||||
#define GL_COMBINE_RGB_ARB 0x8571
|
#define GL_COMBINE_RGB_ARB 0x8571
|
||||||
#define GL_COMBINE_ALPHA_ARB 0x8572
|
#define GL_COMBINE_ALPHA_ARB 0x8572
|
||||||
|
@ -134,9 +135,41 @@ extern qlpMTex2FUNC qglMultiTexCoord2fARB;
|
||||||
#define GL_CONSTANT_ARB 0x8576
|
#define GL_CONSTANT_ARB 0x8576
|
||||||
#define GL_PRIMARY_COLOR_ARB 0x8577
|
#define GL_PRIMARY_COLOR_ARB 0x8577
|
||||||
#define GL_PREVIOUS_ARB 0x8578
|
#define GL_PREVIOUS_ARB 0x8578
|
||||||
|
|
||||||
|
|
||||||
#define GL_DOT3_RGB_ARB 0x86AE
|
#define GL_DOT3_RGB_ARB 0x86AE
|
||||||
#define GL_DOT3_RGBA_ARB 0x86AF
|
#define GL_DOT3_RGBA_ARB 0x86AF
|
||||||
|
|
||||||
|
//GL_EXT_texture_env_combine
|
||||||
|
#define GL_COMBINE_EXT 0x8570
|
||||||
|
#define GL_COMBINE_RGB_EXT 0x8571
|
||||||
|
#define GL_COMBINE_ALPHA_EXT 0x8572
|
||||||
|
#define GL_SOURCE0_RGB_EXT 0x8580
|
||||||
|
#define GL_SOURCE1_RGB_EXT 0x8581
|
||||||
|
#define GL_SOURCE2_RGB_EXT 0x8582
|
||||||
|
#define GL_SOURCE0_ALPHA_EXT 0x8588
|
||||||
|
#define GL_SOURCE1_ALPHA_EXT 0x8589
|
||||||
|
#define GL_SOURCE2_ALPHA_EXT 0x858A
|
||||||
|
#define GL_OPERAND0_RGB_EXT 0x8590
|
||||||
|
#define GL_OPERAND1_RGB_EXT 0x8591
|
||||||
|
#define GL_OPERAND2_RGB_EXT 0x8592
|
||||||
|
#define GL_OPERAND0_ALPHA_EXT 0x8598
|
||||||
|
#define GL_OPERAND1_ALPHA_EXT 0x8599
|
||||||
|
#define GL_OPERAND2_ALPHA_EXT 0x859A
|
||||||
|
#define GL_RGB_SCALE_EXT 0x8573
|
||||||
|
#define GL_ADD_SIGNED_EXT 0x8574
|
||||||
|
#define GL_INTERPOLATE_EXT 0x8575
|
||||||
|
#define GL_CONSTANT_EXT 0x8576
|
||||||
|
#define GL_PRIMARY_COLOR_EXT 0x8577
|
||||||
|
#define GL_PREVIOUS_EXT 0x8578
|
||||||
|
|
||||||
|
//GL_NV_texture_env_combine4
|
||||||
|
#define GL_COMBINE4_NV 0x8503
|
||||||
|
#define GL_SOURCE3_RGB_NV 0x8583
|
||||||
|
#define GL_SOURCE3_ALPHA_NV 0x858B
|
||||||
|
#define GL_OPERAND3_RGB_NV 0x8593
|
||||||
|
#define GL_OPERAND3_ALPHA_NV 0x859B
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* GL_ARB_texture_compression */
|
/* GL_ARB_texture_compression */
|
||||||
|
@ -392,4 +425,17 @@ typedef GLboolean (APIENTRYP PFNGLISPROGRAMARBPROC) (GLuint program);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef GL_EXT_compiled_vertex_array
|
||||||
|
#define GL_ARRAY_ELEMENT_LOCK_FIRST_EXT 0x81A8
|
||||||
|
#define GL_ARRAY_ELEMENT_LOCK_COUNT_EXT 0x81A9
|
||||||
|
|
||||||
|
#define GL_EXT_compiled_vertex_array 1
|
||||||
|
#ifdef GL_GLEXT_PROTOTYPES
|
||||||
|
extern void APIENTRY glLockArraysEXT (GLint, GLsizei);
|
||||||
|
extern void APIENTRY glUnlockArraysEXT (void);
|
||||||
|
#endif /* GL_GLEXT_PROTOTYPES */
|
||||||
|
typedef void (APIENTRY * PFNGLLOCKARRAYSEXTPROC) (GLint first, GLsizei count);
|
||||||
|
typedef void (APIENTRY * PFNGLUNLOCKARRAYSEXTPROC) (void);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -772,9 +772,10 @@ void LightFace (int surfnum)
|
||||||
//
|
//
|
||||||
// some surfaces don't need lightmaps
|
// some surfaces don't need lightmaps
|
||||||
//
|
//
|
||||||
|
#ifdef UTILITY
|
||||||
for (j=0 ; j<MAXLIGHTMAPS ; j++)
|
for (j=0 ; j<MAXLIGHTMAPS ; j++)
|
||||||
f->styles[j] = 255;
|
f->styles[j] = 255;
|
||||||
|
#endif
|
||||||
if ( bsptexinfo(f->texinfo).flags & TEX_SPECIAL)
|
if ( bsptexinfo(f->texinfo).flags & TEX_SPECIAL)
|
||||||
{ // non-lit texture
|
{ // non-lit texture
|
||||||
#ifdef UTILITY
|
#ifdef UTILITY
|
||||||
|
@ -843,6 +844,11 @@ void LightFace (int surfnum)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef UTILITY
|
||||||
|
for (j=0 ; j<MAXLIGHTMAPS ; j++)
|
||||||
|
f->styles[j] = 255;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// save out the values
|
// save out the values
|
||||||
//
|
//
|
||||||
|
|
|
@ -2,6 +2,37 @@
|
||||||
#define SHADER_MAX_TC_MODS 8
|
#define SHADER_MAX_TC_MODS 8
|
||||||
#define SHADER_DEFORM_MAX 8
|
#define SHADER_DEFORM_MAX 8
|
||||||
#define SHADER_MAX_ANIMFRAMES 8
|
#define SHADER_MAX_ANIMFRAMES 8
|
||||||
|
#define SHADER_ANIM_FRAMES_MAX 16
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SHADER_BSP,
|
||||||
|
SHADER_BSP_VERTEX,
|
||||||
|
SHADER_BSP_FLARE,
|
||||||
|
SHADER_MD3,
|
||||||
|
SHADER_2D
|
||||||
|
} shadertype_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SHADER_SORT_NONE,
|
||||||
|
SHADER_SORT_SKY,
|
||||||
|
SHADER_SORT_PORTAL,
|
||||||
|
SHADER_SORT_OPAQUE,
|
||||||
|
SHADER_SORT_BANNER,
|
||||||
|
SHADER_SORT_UNDERWATER,
|
||||||
|
SHADER_SORT_ADDITIVE,
|
||||||
|
SHADER_SORT_NEAREST
|
||||||
|
} shadersort_t;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
MF_NONE = 1<<0,
|
||||||
|
MF_NORMALS = 1<<1,
|
||||||
|
MF_TRNORMALS = 1<<2,
|
||||||
|
MF_COLORS = 1<<3,
|
||||||
|
MF_STCOORDS = 1<<4,
|
||||||
|
MF_LMCOORDS = 1<<5,
|
||||||
|
MF_NOCULL = 1<<6,
|
||||||
|
MF_NONBATCHED = 1<<7
|
||||||
|
} meshfeatures_t;
|
||||||
|
|
||||||
//colour manipulation
|
//colour manipulation
|
||||||
typedef struct
|
typedef struct
|
||||||
|
@ -12,11 +43,30 @@ typedef struct
|
||||||
SHADER_FUNC_SQUARE,
|
SHADER_FUNC_SQUARE,
|
||||||
SHADER_FUNC_SAWTOOTH,
|
SHADER_FUNC_SAWTOOTH,
|
||||||
SHADER_FUNC_INVERSESAWTOOTH,
|
SHADER_FUNC_INVERSESAWTOOTH,
|
||||||
SHADER_FUNC_NOISE
|
SHADER_FUNC_NOISE,
|
||||||
|
SHADER_FUNC_CONSTANT
|
||||||
} type; // SHADER_FUNC enum
|
} type; // SHADER_FUNC enum
|
||||||
float args[4]; // offset, amplitude, phase_offset, rate
|
float args[4]; // offset, amplitude, phase_offset, rate
|
||||||
} shaderfunc_t;
|
} shaderfunc_t;
|
||||||
|
|
||||||
|
#if _MSC_VER || __BORLANDC__
|
||||||
|
typedef unsigned __int64 msortkey_t;
|
||||||
|
#else
|
||||||
|
typedef unsigned long long msortkey_t;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct meshbuffer_s
|
||||||
|
{
|
||||||
|
msortkey_t sortkey;
|
||||||
|
int infokey; // lightmap number or mesh number
|
||||||
|
unsigned int dlightbits;
|
||||||
|
entity_t *entity;
|
||||||
|
struct shader_s *shader;
|
||||||
|
mesh_t *mesh;
|
||||||
|
struct mfog_s *fog;
|
||||||
|
} meshbuffer_t;
|
||||||
|
|
||||||
|
|
||||||
//tecture coordinate manipulation
|
//tecture coordinate manipulation
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
@ -25,7 +75,10 @@ typedef struct
|
||||||
SHADER_TCMOD_SCALE, //some sorta tabled deformation
|
SHADER_TCMOD_SCALE, //some sorta tabled deformation
|
||||||
SHADER_TCMOD_SCROLL, //boring moving texcoords with time
|
SHADER_TCMOD_SCROLL, //boring moving texcoords with time
|
||||||
SHADER_TCMOD_STRETCH, //constant factor
|
SHADER_TCMOD_STRETCH, //constant factor
|
||||||
SHADER_TCMOD_ROTATE
|
SHADER_TCMOD_ROTATE,
|
||||||
|
SHADER_TCMOD_MAX,
|
||||||
|
SHADER_TCMOD_TRANSFORM,
|
||||||
|
SHADER_TCMOD_TURB
|
||||||
} type;
|
} type;
|
||||||
float args[6];
|
float args[6];
|
||||||
} tcmod_t;
|
} tcmod_t;
|
||||||
|
@ -48,8 +101,8 @@ typedef struct
|
||||||
} deformv_t;
|
} deformv_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct shaderpass_s {
|
||||||
int mergedpasses;
|
int numMergedPasses;
|
||||||
|
|
||||||
shaderfunc_t rgbgen_func;
|
shaderfunc_t rgbgen_func;
|
||||||
shaderfunc_t alphagen_func;
|
shaderfunc_t alphagen_func;
|
||||||
|
@ -71,7 +124,8 @@ typedef struct {
|
||||||
TC_GEN_BASE, //basic specified texture coords
|
TC_GEN_BASE, //basic specified texture coords
|
||||||
TC_GEN_LIGHTMAP, //use loaded lightmap coords
|
TC_GEN_LIGHTMAP, //use loaded lightmap coords
|
||||||
TC_GEN_ENVIRONMENT,
|
TC_GEN_ENVIRONMENT,
|
||||||
TC_GEN_DOTPRODUCT
|
TC_GEN_DOTPRODUCT,
|
||||||
|
TC_GEN_VECTOR
|
||||||
} tcgen;
|
} tcgen;
|
||||||
enum {
|
enum {
|
||||||
RGB_GEN_WAVE,
|
RGB_GEN_WAVE,
|
||||||
|
@ -82,28 +136,40 @@ typedef struct {
|
||||||
RGB_GEN_ONE_MINUS_VERTEX,
|
RGB_GEN_ONE_MINUS_VERTEX,
|
||||||
RGB_GEN_IDENTITY_LIGHTING,
|
RGB_GEN_IDENTITY_LIGHTING,
|
||||||
RGB_GEN_IDENTITY,
|
RGB_GEN_IDENTITY,
|
||||||
RGB_GEN_CONST
|
RGB_GEN_CONST,
|
||||||
|
RGB_GEN_UNKNOWN,
|
||||||
|
RGB_GEN_LIGHTING_DIFFUSE
|
||||||
} rgbgen;
|
} rgbgen;
|
||||||
enum {
|
enum {
|
||||||
ALPHA_GEN_ENTITY,
|
ALPHA_GEN_ENTITY,
|
||||||
ALPHA_GEN_WAVE,
|
ALPHA_GEN_WAVE,
|
||||||
ALPHA_GEN_PORTAL,
|
ALPHA_GEN_PORTAL,
|
||||||
ALPHA_GEN_SPECULAR,
|
ALPHA_GEN_SPECULAR,
|
||||||
ALPHA_GEN_IDENTITY
|
ALPHA_GEN_IDENTITY,
|
||||||
|
ALPHA_GEN_VERTEX,
|
||||||
|
ALPHA_GEN_CONST
|
||||||
} alphagen;
|
} alphagen;
|
||||||
|
|
||||||
int numtcmods;
|
int numtcmods;
|
||||||
tcmod_t tcmod[SHADER_MAX_TC_MODS];
|
tcmod_t tcmods[SHADER_MAX_TC_MODS];
|
||||||
|
|
||||||
|
void (*flush) (meshbuffer_t *mb, struct shaderpass_s *pass);
|
||||||
|
|
||||||
int anim_numframes;
|
int anim_numframes;
|
||||||
int anim_frames[SHADER_MAX_ANIMFRAMES];
|
int anim_frames[SHADER_MAX_ANIMFRAMES];
|
||||||
float fps;
|
float anim_fps;
|
||||||
unsigned int texturetype;
|
unsigned int texturetype;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SHADER_PASS_BLEND = 1 << 0,
|
SHADER_PASS_BLEND = 1 << 0,
|
||||||
SHADER_PASS_ALPHAFUNC = 1 << 1,
|
SHADER_PASS_ALPHAFUNC = 1 << 1,
|
||||||
SHADER_PASS_DEPTHWRITE = 1 << 2
|
SHADER_PASS_DEPTHWRITE = 1 << 2,
|
||||||
|
|
||||||
|
SHADER_PASS_VIDEOMAP = 1 << 3,
|
||||||
|
SHADER_PASS_DETAIL = 1 << 4,
|
||||||
|
SHADER_PASS_LIGHTMAP = 1 << 5,
|
||||||
|
SHADER_PASS_NOCOLORARRAY = 1<< 6,
|
||||||
|
SHADER_PASS_ANIMMAP = 1 << 7
|
||||||
} flags;
|
} flags;
|
||||||
} shaderpass_t;
|
} shaderpass_t;
|
||||||
|
|
||||||
|
@ -114,6 +180,7 @@ typedef struct shader_s {
|
||||||
//end of shared fields.
|
//end of shared fields.
|
||||||
|
|
||||||
byte_vec4_t fog_color;
|
byte_vec4_t fog_color;
|
||||||
|
float fog_dist;
|
||||||
|
|
||||||
int numdeforms;
|
int numdeforms;
|
||||||
deformv_t deforms[SHADER_DEFORM_MAX];
|
deformv_t deforms[SHADER_DEFORM_MAX];
|
||||||
|
@ -125,10 +192,22 @@ typedef struct shader_s {
|
||||||
SHADER_CULL_FRONT = 1 << 3,
|
SHADER_CULL_FRONT = 1 << 3,
|
||||||
SHADER_CULL_BACK = 1 << 4,
|
SHADER_CULL_BACK = 1 << 4,
|
||||||
SHADER_DEFORMV_BULGE = 1 << 5,
|
SHADER_DEFORMV_BULGE = 1 << 5,
|
||||||
SHADER_AUTOSPRITE = 1 << 5
|
SHADER_AUTOSPRITE = 1 << 6,
|
||||||
|
SHADER_FLARE = 1 << 7,
|
||||||
|
SHADER_POLYGONOFFSET = 1 << 8,
|
||||||
|
SHADER_ENTITY_MERGABLE = 1 << 9,
|
||||||
|
SHADER_VIDEOMAP = 1 << 10,
|
||||||
|
SHADER_DEPTHWRITE = 1 << 11,
|
||||||
|
SHADER_AGEN_PORTAL = 1 << 12
|
||||||
} flags;
|
} flags;
|
||||||
|
|
||||||
shaderpass_t pass[SHADER_PASS_MAX];
|
shaderpass_t passes[SHADER_PASS_MAX];
|
||||||
|
|
||||||
|
shadersort_t sort;
|
||||||
|
|
||||||
|
meshfeatures_t features;
|
||||||
|
|
||||||
|
int registration_sequence;
|
||||||
} shader_t;
|
} shader_t;
|
||||||
|
|
||||||
|
|
||||||
|
@ -137,3 +216,8 @@ typedef struct shader_s {
|
||||||
void GLR_MeshInit(void);
|
void GLR_MeshInit(void);
|
||||||
void GL_DrawMesh(mesh_t *mesh, shader_t *shader, int texturenum, int lmtexturenum);
|
void GL_DrawMesh(mesh_t *mesh, shader_t *shader, int texturenum, int lmtexturenum);
|
||||||
void GL_DrawMeshBump(mesh_t *mesh, int texturenum, int lmtexturenum, int bumpnum, int deluxnum);
|
void GL_DrawMeshBump(mesh_t *mesh, int texturenum, int lmtexturenum, int bumpnum, int deluxnum);
|
||||||
|
|
||||||
|
|
||||||
|
void R_RenderMeshGeneric ( meshbuffer_t *mb, shaderpass_t *pass );
|
||||||
|
void R_RenderMeshCombined ( meshbuffer_t *mb, shaderpass_t *pass );
|
||||||
|
void R_RenderMeshMultitextured ( meshbuffer_t *mb, shaderpass_t *pass );
|
|
@ -3,6 +3,11 @@ QCC_OBJS=qccmain.c qcc_cmdlib.c qcc_pr_comp.c qcc_pr_lex.c comprout.c hash.c qcd
|
||||||
all: qcc
|
all: qcc
|
||||||
|
|
||||||
|
|
||||||
|
win_nocyg: $(QCC_OBJS) qccgui.c qccguistuff.c
|
||||||
|
$(CC) -DQCCONLY -o fteqcc.exe -O3 -s $(QCC_OBJS) -mno-cygwin -mwindows
|
||||||
|
nocyg: $(QCC_OBJS) qccgui.c qccguistuff.c
|
||||||
|
$(CC) -DQCCONLY -o fteqcc.exe -O3 -s $(QCC_OBJS) -mno-cygwin
|
||||||
|
win: $(QCC_OBJS) qccgui.c qccguistuff.c
|
||||||
|
$(CC) -DQCCONLY -o fteqcc.exe -O3 -s $(QCC_OBJS) -mwindows
|
||||||
qcc: $(QCC_OBJS)
|
qcc: $(QCC_OBJS)
|
||||||
$(CC) -DQCCONLY -o fteqcc.bin -O3 -s $(QCC_OBJS)
|
$(CC) -DQCCONLY -o fteqcc.bin -O3 -s $(QCC_OBJS)
|
||||||
|
|
|
@ -425,6 +425,41 @@ QCC_opcode_t pr_opcodes[] =
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
{7, "!=", "GSTOREP_I", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GSTOREP_I,
|
||||||
|
{7, "!=", "GSTORE_F", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GSTOREP_F, //190
|
||||||
|
{7, "!=", "GSTORE_ENT", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GSTOREP_ENT,
|
||||||
|
{7, "!=", "GSTORE_FLD", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GSTOREP_FLD, // integers
|
||||||
|
{7, "!=", "GSTORE_S", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GSTOREP_S,
|
||||||
|
{7, "!=", "GSTORE_FNC", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GSTOREP_FNC, // pointers
|
||||||
|
{7, "!=", "GSTORE_V", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GSTOREP_V,
|
||||||
|
|
||||||
|
{7, "!=", "BOUNDCHECK", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GADDRESS,
|
||||||
|
|
||||||
|
{7, "!=", "GLOAD_I", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GLOAD_I,
|
||||||
|
{7, "!=", "GLOAD_F", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GLOAD_F,
|
||||||
|
{7, "!=", "GLOAD_FLD", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GLOAD_FLD,
|
||||||
|
{7, "!=", "GLOAD_ENT", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GLOAD_ENT, //200
|
||||||
|
{7, "!=", "GLOAD_S", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GLOAD_S,
|
||||||
|
{7, "!=", "GLOAD_FNC", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_GLOAD_FNC,
|
||||||
|
|
||||||
|
{7, "!=", "BOUNDCHECK", -1, ASSOC_LEFT, &type_float, &type_float, &type_float},
|
||||||
|
OP_BOUNDCHECK,
|
||||||
|
*/
|
||||||
|
|
||||||
{0, NULL}
|
{0, NULL}
|
||||||
};
|
};
|
||||||
|
|
|
@ -1782,6 +1782,15 @@ int QCC_PR_CheakCompConst(void)
|
||||||
pr_file_p = c->value;
|
pr_file_p = c->value;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
p = strlen(buffer);
|
||||||
|
while(*pr_file_p <= ' ') //copy across whitespace
|
||||||
|
{
|
||||||
|
if (!*pr_file_p)
|
||||||
|
break;
|
||||||
|
buffer[p] = *pr_file_p++;
|
||||||
|
}
|
||||||
|
buffer[p] = 0;
|
||||||
|
|
||||||
pr_file_p = QCC_COM_Parse(pr_file_p);
|
pr_file_p = QCC_COM_Parse(pr_file_p);
|
||||||
if (!pr_file_p)
|
if (!pr_file_p)
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -7315,20 +7315,20 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
||||||
//some of these are a little iffy.
|
//some of these are a little iffy.
|
||||||
//we support them for mvdsv compatability but some of them look very hacky.
|
//we support them for mvdsv compatability but some of them look very hacky.
|
||||||
//these ones are not honoured with numbers, but can be used via the proper means.
|
//these ones are not honoured with numbers, but can be used via the proper means.
|
||||||
{"teamfield", PF_teamfield, 0, 0, 0, 87},
|
{"teamfield", PF_teamfield, 0, 0, 0, 0},
|
||||||
{"substr", PF_substr, 0, 0, 0, 88},
|
{"substr", PF_substr, 0, 0, 0, 0},
|
||||||
{"mvdstrcat", PF_strcat, 0, 0, 0, 89},
|
{"mvdstrcat", PF_strcat, 0, 0, 0, 0},
|
||||||
{"mvdstrlen", PF_strlen, 0, 0, 0, 90},
|
{"mvdstrlen", PF_strlen, 0, 0, 0, 0},
|
||||||
{"str2byte", PF_str2byte, 0, 0, 0, 91},
|
{"str2byte", PF_str2byte, 0, 0, 0, 0},
|
||||||
{"str2short", PF_str2short, 0, 0, 0, 92},
|
{"str2short", PF_str2short, 0, 0, 0, 0},
|
||||||
{"mvdnewstr", PF_newstring, 0, 0, 0, 0},
|
{"mvdnewstr", PF_newstring, 0, 0, 0, 0},
|
||||||
{"mvdfreestr", PF_forgetstring, 0, 0, 0, 0},
|
{"mvdfreestr", PF_forgetstring, 0, 0, 0, 0},
|
||||||
{"conprint", PF_conprint, 0, 0, 0, 95},
|
{"conprint", PF_conprint, 0, 0, 0, 0},
|
||||||
{"readcmd", PF_readcmd, 0, 0, 0, 96},
|
{"readcmd", PF_readcmd, 0, 0, 0, 0},
|
||||||
{"mvdstrcpy", PF_MVDSV_strcpy, 0, 0, 0, 0},
|
{"mvdstrcpy", PF_MVDSV_strcpy, 0, 0, 0, 0},
|
||||||
{"strstr", PF_strstr, 0, 0, 0, 98},
|
{"strstr", PF_strstr, 0, 0, 0, 0},
|
||||||
{"mvdstrncpy", PF_MVDSV_strncpy, 0, 0, 0, 0},
|
{"mvdstrncpy", PF_MVDSV_strncpy, 0, 0, 0, 0},
|
||||||
{"log", PF_log, 0, 0, 0, 100},
|
{"log", PF_log, 0, 0, 0, 0},
|
||||||
// {"redirectcmd", PF_redirectcmd, 0, 0, 0, 101},
|
// {"redirectcmd", PF_redirectcmd, 0, 0, 0, 101},
|
||||||
{"calltimeofday", PF_calltimeofday, 0, 0, 0, 102},
|
{"calltimeofday", PF_calltimeofday, 0, 0, 0, 102},
|
||||||
{"forcedemoframe", PF_forcedemoframe, 0, 0, 0, 103},
|
{"forcedemoframe", PF_forcedemoframe, 0, 0, 0, 103},
|
||||||
|
@ -7601,23 +7601,23 @@ void PR_ResetBuiltins(progstype_t type) //fix all nulls to PF_FIXME and add any
|
||||||
|
|
||||||
if (type == PROG_QW && pr_imitatemvdsv.value>0) //pretend to be mvdsv for a bit.
|
if (type == PROG_QW && pr_imitatemvdsv.value>0) //pretend to be mvdsv for a bit.
|
||||||
{
|
{
|
||||||
if (PR_EnableEBFSBuiltin("teamfield", 0) != 87 ||
|
if (PR_EnableEBFSBuiltin("teamfield", 87) != 87 ||
|
||||||
PR_EnableEBFSBuiltin("substr", 0) != 88 ||
|
PR_EnableEBFSBuiltin("substr", 88) != 88 ||
|
||||||
PR_EnableEBFSBuiltin("mvdstrcat", 0) != 89 ||
|
PR_EnableEBFSBuiltin("mvdstrcat", 89) != 89 ||
|
||||||
PR_EnableEBFSBuiltin("mvdstrlen", 0) != 90 ||
|
PR_EnableEBFSBuiltin("mvdstrlen", 90) != 90 ||
|
||||||
PR_EnableEBFSBuiltin("str2byte", 0) != 91 ||
|
PR_EnableEBFSBuiltin("str2byte", 91) != 91 ||
|
||||||
PR_EnableEBFSBuiltin("str2short", 0) != 92 ||
|
PR_EnableEBFSBuiltin("str2short", 92) != 92 ||
|
||||||
PR_EnableEBFSBuiltin("mvdnewstr", 93) != 93 ||
|
PR_EnableEBFSBuiltin("mvdnewstr", 93) != 93 ||
|
||||||
PR_EnableEBFSBuiltin("mvdfreestr", 94) != 94 ||
|
PR_EnableEBFSBuiltin("mvdfreestr", 94) != 94 ||
|
||||||
PR_EnableEBFSBuiltin("conprint", 0) != 95 ||
|
PR_EnableEBFSBuiltin("conprint", 95) != 95 ||
|
||||||
PR_EnableEBFSBuiltin("readcmd", 0) != 96 ||
|
PR_EnableEBFSBuiltin("readcmd", 96) != 96 ||
|
||||||
PR_EnableEBFSBuiltin("mvdstrcpy", 97) != 97 ||
|
PR_EnableEBFSBuiltin("mvdstrcpy", 97) != 97 ||
|
||||||
PR_EnableEBFSBuiltin("strstr", 0) != 98 ||
|
PR_EnableEBFSBuiltin("strstr", 98) != 98 ||
|
||||||
PR_EnableEBFSBuiltin("mvdstrncpy", 99) != 99 ||
|
PR_EnableEBFSBuiltin("mvdstrncpy", 99) != 99 ||
|
||||||
PR_EnableEBFSBuiltin("log", 0)!= 100 ||
|
PR_EnableEBFSBuiltin("log", 100)!= 100 ||
|
||||||
// PR_EnableEBFSBuiltin("redirectcmd", 0)!= 101 ||
|
// PR_EnableEBFSBuiltin("redirectcmd", 101)!= 101 ||
|
||||||
PR_EnableEBFSBuiltin("calltimeofday", 0)!= 102 ||
|
PR_EnableEBFSBuiltin("calltimeofday", 102)!= 102 ||
|
||||||
PR_EnableEBFSBuiltin("forcedemoframe", 0)!= 103)
|
PR_EnableEBFSBuiltin("forcedemoframe", 103)!= 103)
|
||||||
Con_Printf("Failed to register all MVDSV builtins\n");
|
Con_Printf("Failed to register all MVDSV builtins\n");
|
||||||
else
|
else
|
||||||
Con_Printf("Be aware that MVDSV does not follow standards. Please encourage your mod developers to not require pr_imitatemvdsv to be set.\n");
|
Con_Printf("Be aware that MVDSV does not follow standards. Please encourage your mod developers to not require pr_imitatemvdsv to be set.\n");
|
||||||
|
|
|
@ -433,6 +433,9 @@ typedef struct client_s
|
||||||
|
|
||||||
struct client_s *controller;
|
struct client_s *controller;
|
||||||
struct client_s *controlled;
|
struct client_s *controlled;
|
||||||
|
|
||||||
|
int rate;
|
||||||
|
int drate;
|
||||||
} client_t;
|
} client_t;
|
||||||
|
|
||||||
// a client can leave the server in one of four ways:
|
// a client can leave the server in one of four ways:
|
||||||
|
@ -1040,6 +1043,8 @@ void SV_FlushDemoSignon (void);
|
||||||
// savegame.c
|
// savegame.c
|
||||||
void SV_FlushLevelCache(void);
|
void SV_FlushLevelCache(void);
|
||||||
|
|
||||||
|
int SV_RateForClient(client_t *cl);
|
||||||
|
|
||||||
|
|
||||||
void SVVC_Frame (qboolean enabled);
|
void SVVC_Frame (qboolean enabled);
|
||||||
void SV_CalcPHS (void);
|
void SV_CalcPHS (void);
|
||||||
|
|
|
@ -81,6 +81,7 @@ cvar_t sv_public = {"sv_public", "1"};
|
||||||
cvar_t sv_highchars = {"sv_highchars", "1"};
|
cvar_t sv_highchars = {"sv_highchars", "1"};
|
||||||
cvar_t sv_loadentfiles = {"sv_loadentfiles", "1"};
|
cvar_t sv_loadentfiles = {"sv_loadentfiles", "1"};
|
||||||
cvar_t sv_maxrate = {"sv_maxrate", "10000"};
|
cvar_t sv_maxrate = {"sv_maxrate", "10000"};
|
||||||
|
cvar_t sv_maxdrate = {"sv_maxdrate", "10000"};
|
||||||
|
|
||||||
cvar_t sv_phs = {"sv_phs", "1"};
|
cvar_t sv_phs = {"sv_phs", "1"};
|
||||||
cvar_t sv_resetparms = {"sv_resetparms", "0"};
|
cvar_t sv_resetparms = {"sv_resetparms", "0"};
|
||||||
|
@ -264,7 +265,7 @@ void SV_FinalMessage (char *message)
|
||||||
for (i=0, cl = svs.clients ; i<MAX_CLIENTS ; i++, cl++)
|
for (i=0, cl = svs.clients ; i<MAX_CLIENTS ; i++, cl++)
|
||||||
if (cl->state >= cs_spawned)
|
if (cl->state >= cs_spawned)
|
||||||
Netchan_Transmit (&cl->netchan, sv.datagram.cursize
|
Netchan_Transmit (&cl->netchan, sv.datagram.cursize
|
||||||
, sv.datagram.data);
|
, sv.datagram.data, 10000);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -374,7 +375,7 @@ void SV_DropClient (client_t *drop)
|
||||||
#ifndef SERVERONLY
|
#ifndef SERVERONLY
|
||||||
if (drop->netchan.remote_address.type == NA_LOOPBACK)
|
if (drop->netchan.remote_address.type == NA_LOOPBACK)
|
||||||
{
|
{
|
||||||
Netchan_Transmit(&drop->netchan, 0, "");
|
Netchan_Transmit(&drop->netchan, 0, "", SV_RateForClient(drop));
|
||||||
CL_Disconnect();
|
CL_Disconnect();
|
||||||
drop->state = cs_free; //don't do zombie stuff
|
drop->state = cs_free; //don't do zombie stuff
|
||||||
}
|
}
|
||||||
|
@ -2546,6 +2547,27 @@ void SV_GetConsoleCommands (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int SV_RateForClient(client_t *cl)
|
||||||
|
{
|
||||||
|
int rate;
|
||||||
|
if (cl->download)
|
||||||
|
{
|
||||||
|
rate = cl->drate;
|
||||||
|
if (rate > sv_maxdrate.value)
|
||||||
|
rate = sv_maxdrate.value;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
rate = cl->rate;
|
||||||
|
if (rate > sv_maxrate.value)
|
||||||
|
rate = sv_maxrate.value;
|
||||||
|
}
|
||||||
|
if (rate < 500)
|
||||||
|
rate = 500;
|
||||||
|
|
||||||
|
return rate;
|
||||||
|
}
|
||||||
/*
|
/*
|
||||||
===================
|
===================
|
||||||
SV_CheckVars
|
SV_CheckVars
|
||||||
|
@ -3291,14 +3313,15 @@ void SV_ExtractFromUserinfo (client_t *cl)
|
||||||
// rate command
|
// rate command
|
||||||
val = Info_ValueForKey (cl->userinfo, "rate");
|
val = Info_ValueForKey (cl->userinfo, "rate");
|
||||||
if (strlen(val))
|
if (strlen(val))
|
||||||
{
|
cl->rate = atoi(val);
|
||||||
i = atoi(val);
|
else
|
||||||
if (i < 500)
|
cl->rate = 2500;
|
||||||
i = 500;
|
|
||||||
if (i > sv_maxrate.value)
|
val = Info_ValueForKey (cl->userinfo, "drate");
|
||||||
i = sv_maxrate.value;
|
if (strlen(val))
|
||||||
cl->netchan.rate = 1.0/i;
|
cl->drate = atoi(val);
|
||||||
}
|
else
|
||||||
|
cl->drate = 2500;
|
||||||
|
|
||||||
// msg command
|
// msg command
|
||||||
val = Info_ValueForKey (cl->userinfo, "msg");
|
val = Info_ValueForKey (cl->userinfo, "msg");
|
||||||
|
|
|
@ -2081,6 +2081,11 @@ void SV_MVDInit(void)
|
||||||
{
|
{
|
||||||
MVD_Init();
|
MVD_Init();
|
||||||
|
|
||||||
|
#ifdef SERVERONLY //client command would conflict otherwise.
|
||||||
|
Cmd_AddCommand ("record", SV_MVD_Record_f);
|
||||||
|
Cmd_AddCommand ("stop", SV_MVDStop_f);
|
||||||
|
Cmd_AddCommand ("cancel", SV_MVD_Cancel_f);
|
||||||
|
#endif
|
||||||
Cmd_AddCommand ("mvdrecord", SV_MVD_Record_f);
|
Cmd_AddCommand ("mvdrecord", SV_MVD_Record_f);
|
||||||
Cmd_AddCommand ("easyrecord", SV_MVDEasyRecord_f);
|
Cmd_AddCommand ("easyrecord", SV_MVDEasyRecord_f);
|
||||||
Cmd_AddCommand ("mvdstop", SV_MVDStop_f);
|
Cmd_AddCommand ("mvdstop", SV_MVDStop_f);
|
||||||
|
|
|
@ -1288,7 +1288,7 @@ qboolean SV_SendClientDatagram (client_t *client)
|
||||||
|
|
||||||
// send deltas over reliable stream
|
// send deltas over reliable stream
|
||||||
if (sv.worldmodel)
|
if (sv.worldmodel)
|
||||||
if (!client->isq2client && Netchan_CanReliable (&client->netchan))
|
if (!client->isq2client && Netchan_CanReliable (&client->netchan, SV_RateForClient(client)))
|
||||||
{
|
{
|
||||||
int pnum=1;
|
int pnum=1;
|
||||||
client_t *c;
|
client_t *c;
|
||||||
|
@ -1305,7 +1305,7 @@ qboolean SV_SendClientDatagram (client_t *client)
|
||||||
}
|
}
|
||||||
|
|
||||||
// send the datagram
|
// send the datagram
|
||||||
Netchan_Transmit (&client->netchan, msg.cursize, buf);
|
Netchan_Transmit (&client->netchan, msg.cursize, buf, SV_RateForClient(client));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1614,7 +1614,7 @@ void SV_SendClientMessages (void)
|
||||||
if (!c->send_message)
|
if (!c->send_message)
|
||||||
continue;
|
continue;
|
||||||
c->send_message = false; // try putting this after choke?
|
c->send_message = false; // try putting this after choke?
|
||||||
if (!sv.paused && !Netchan_CanPacket (&c->netchan))
|
if (!sv.paused && !Netchan_CanPacket (&c->netchan, SV_RateForClient(c)))
|
||||||
{
|
{
|
||||||
c->chokecount++;
|
c->chokecount++;
|
||||||
continue; // bandwidth choke
|
continue; // bandwidth choke
|
||||||
|
@ -1623,7 +1623,7 @@ void SV_SendClientMessages (void)
|
||||||
if (c->state == cs_spawned)
|
if (c->state == cs_spawned)
|
||||||
SV_SendClientDatagram (c);
|
SV_SendClientDatagram (c);
|
||||||
else
|
else
|
||||||
Netchan_Transmit (&c->netchan, 0, NULL); // just update reliable
|
Netchan_Transmit (&c->netchan, 0, NULL, SV_RateForClient(c)); // just update reliable
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1951,23 +1951,24 @@ Change the bandwidth estimate for a client
|
||||||
*/
|
*/
|
||||||
void SV_Rate_f (void)
|
void SV_Rate_f (void)
|
||||||
{
|
{
|
||||||
|
extern cvar_t sv_maxrate;
|
||||||
int rate;
|
int rate;
|
||||||
|
|
||||||
if (Cmd_Argc() != 2)
|
if (Cmd_Argc() != 2)
|
||||||
{
|
{
|
||||||
SV_ClientTPrintf (host_client, PRINT_HIGH, STL_CURRENTRATE,
|
SV_ClientTPrintf (host_client, PRINT_HIGH, STL_CURRENTRATE,
|
||||||
(int)(1.0/host_client->netchan.rate + 0.5));
|
host_client->rate);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rate = atoi(Cmd_Argv(1));
|
rate = atoi(Cmd_Argv(1));
|
||||||
if (rate < 500)
|
if (rate < 500)
|
||||||
rate = 500;
|
rate = 500;
|
||||||
if (rate > 10000)
|
if (rate > sv_maxrate.value)
|
||||||
rate = 10000;
|
rate = sv_maxrate.value;
|
||||||
|
|
||||||
SV_ClientTPrintf (host_client, PRINT_HIGH, STL_RATESETTO, rate);
|
SV_ClientTPrintf (host_client, PRINT_HIGH, STL_RATESETTO, rate);
|
||||||
host_client->netchan.rate = 1.0/rate;
|
host_client->rate = rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue