mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-25 21:31:37 +00:00
Misc bugfixes, including q3bsp-rtlights and bloom. Matrix use clarifications. Working towards skeletal glsl code.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3890 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
4dba0e3f28
commit
729d6181c2
70 changed files with 2062 additions and 1311 deletions
|
@ -114,6 +114,9 @@ static void CL_ClearDlight(dlight_t *dl, int key)
|
||||||
dl->axis[2][2] = 1;
|
dl->axis[2][2] = 1;
|
||||||
dl->key = key;
|
dl->key = key;
|
||||||
dl->flags = LFLAG_DYNAMIC;
|
dl->flags = LFLAG_DYNAMIC;
|
||||||
|
dl->color[0] = 1;
|
||||||
|
dl->color[1] = 1;
|
||||||
|
dl->color[2] = 1;
|
||||||
// if (r_shadow_realtime_dlight_shadowmap.value)
|
// if (r_shadow_realtime_dlight_shadowmap.value)
|
||||||
// dl->flags |= LFLAG_SHADOWMAP;
|
// dl->flags |= LFLAG_SHADOWMAP;
|
||||||
}
|
}
|
||||||
|
@ -335,7 +338,13 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits, qboolean
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (bits & U_MODEL)
|
if (bits & U_MODEL)
|
||||||
|
{
|
||||||
to->modelindex = MSG_ReadByte ();
|
to->modelindex = MSG_ReadByte ();
|
||||||
|
if (morebits & U_MODELDBL && cls.fteprotocolextensions & PEXT_MODELDBL)
|
||||||
|
to->modelindex += 256;
|
||||||
|
}
|
||||||
|
else if (morebits & U_MODELDBL && cls.fteprotocolextensions & PEXT_MODELDBL)
|
||||||
|
to->modelindex = MSG_ReadShort();
|
||||||
|
|
||||||
if (bits & U_FRAME)
|
if (bits & U_FRAME)
|
||||||
to->frame = MSG_ReadByte ();
|
to->frame = MSG_ReadByte ();
|
||||||
|
@ -401,8 +410,6 @@ void CL_ParseDelta (entity_state_t *from, entity_state_t *to, int bits, qboolean
|
||||||
to->number += 512;
|
to->number += 512;
|
||||||
if (morebits & U_ENTITYDBL2 && cls.fteprotocolextensions & PEXT_ENTITYDBL2)
|
if (morebits & U_ENTITYDBL2 && cls.fteprotocolextensions & PEXT_ENTITYDBL2)
|
||||||
to->number += 1024;
|
to->number += 1024;
|
||||||
if (morebits & U_MODELDBL && cls.fteprotocolextensions & PEXT_MODELDBL)
|
|
||||||
to->modelindex += 256;
|
|
||||||
|
|
||||||
if (morebits & U_DPFLAGS)// && cls.fteprotocolextensions & PEXT_DPFLAGS)
|
if (morebits & U_DPFLAGS)// && cls.fteprotocolextensions & PEXT_DPFLAGS)
|
||||||
{
|
{
|
||||||
|
@ -2961,7 +2968,7 @@ void CL_LinkPlayers (void)
|
||||||
}
|
}
|
||||||
radius += (flicker+j)&31;
|
radius += (flicker+j)&31;
|
||||||
}
|
}
|
||||||
CL_NewDlightRGB(j+1, org, radius, 0.1, colour[0], colour[1], colour[2])->flags &= ~LFLAG_ALLOW_FLASH;
|
CL_NewDlightRGB(j+1, org, radius, 0.1, colour[0], colour[1], colour[2])->flags &= ~LFLAG_FLASHBLEND;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3096,7 +3103,7 @@ void CL_LinkPlayers (void)
|
||||||
CL_AddFlagModels (ent, 0);
|
CL_AddFlagModels (ent, 0);
|
||||||
else if (state->effects & QWEF_FLAG2)
|
else if (state->effects & QWEF_FLAG2)
|
||||||
CL_AddFlagModels (ent, 1);
|
CL_AddFlagModels (ent, 1);
|
||||||
else if (info->vweapindex)
|
if (info->vweapindex)
|
||||||
CL_AddVWeapModel (ent, cl.model_precache[info->vweapindex]);
|
CL_AddVWeapModel (ent, cl.model_precache[info->vweapindex]);
|
||||||
else if (state->command.impulse)
|
else if (state->command.impulse)
|
||||||
CL_AddVWeapModel (ent, cl.model_precache_vwep[state->command.impulse]);
|
CL_AddVWeapModel (ent, cl.model_precache_vwep[state->command.impulse]);
|
||||||
|
@ -3108,7 +3115,7 @@ void CL_LinkPlayers (void)
|
||||||
{
|
{
|
||||||
dlight_t *dl;
|
dlight_t *dl;
|
||||||
dl = CL_NewDlightRGB(j+1, ent->origin, 300, r_torch.ival, 0.05, 0.05, 0.02);
|
dl = CL_NewDlightRGB(j+1, ent->origin, 300, r_torch.ival, 0.05, 0.05, 0.02);
|
||||||
dl->flags |= LFLAG_SHADOWMAP|LFLAG_ALLOW_FLASH;
|
dl->flags |= LFLAG_SHADOWMAP|LFLAG_FLASHBLEND;
|
||||||
dl->fov = 60;
|
dl->fov = 60;
|
||||||
angles[0] *= 3;
|
angles[0] *= 3;
|
||||||
angles[1] += sin(realtime)*8;
|
angles[1] += sin(realtime)*8;
|
||||||
|
|
|
@ -755,7 +755,7 @@ void CL_UpdatePrydonCursor(usercmd_t *from, float cursor_screen[2], vec3_t curso
|
||||||
temp[2] = 1;
|
temp[2] = 1;
|
||||||
|
|
||||||
VectorCopy(r_origin, cursor_start);
|
VectorCopy(r_origin, cursor_start);
|
||||||
Matrix4_UnProject(temp, cursor_end, cl.viewangles[0], cursor_start, r_refdef.fov_x, r_refdef.fov_y);
|
Matrix4x4_CM_UnProject(temp, cursor_end, cl.viewangles[0], cursor_start, r_refdef.fov_x, r_refdef.fov_y);
|
||||||
|
|
||||||
CL_SetSolidEntities();
|
CL_SetSolidEntities();
|
||||||
//don't bother with players, they don't exist in NQ...
|
//don't bother with players, they don't exist in NQ...
|
||||||
|
|
|
@ -412,6 +412,54 @@ void CL_SupportedFTEExtensions(int *pext1, int *pext2)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
char *CL_GUIDString(void)
|
||||||
|
{
|
||||||
|
static qbyte buf[2048];
|
||||||
|
static int buflen;
|
||||||
|
unsigned int digest[4];
|
||||||
|
char serveraddr[256];
|
||||||
|
void *blocks[2];
|
||||||
|
int lens[2];
|
||||||
|
if (!buflen)
|
||||||
|
{
|
||||||
|
vfsfile_t *f;
|
||||||
|
f = FS_OpenVFS("qkey", "rb", FS_ROOT);
|
||||||
|
if (f)
|
||||||
|
{
|
||||||
|
buflen = VFS_GETLEN(f);
|
||||||
|
if (buflen > 2048)
|
||||||
|
buflen = 2048;
|
||||||
|
buflen = VFS_READ(f, buf, buflen);
|
||||||
|
VFS_CLOSE(f);
|
||||||
|
}
|
||||||
|
if (buflen < 16)
|
||||||
|
{
|
||||||
|
buflen = sizeof(buf);
|
||||||
|
if (!Sys_RandomBytes(buf, buflen))
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
srand(time(NULL));
|
||||||
|
for (i = 0; i < buflen; i++)
|
||||||
|
buf[i] = rand() & 0xff;
|
||||||
|
}
|
||||||
|
f = FS_OpenVFS("qkey", "wb", FS_ROOT);
|
||||||
|
if (f)
|
||||||
|
{
|
||||||
|
VFS_WRITE(f, buf, buflen);
|
||||||
|
VFS_CLOSE(f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
NET_AdrToString(serveraddr, sizeof(serveraddr), cls.netchan.remote_address);
|
||||||
|
|
||||||
|
blocks[0] = buf;lens[0] = buflen;
|
||||||
|
blocks[1] = serveraddr;lens[1] = strlen(serveraddr);
|
||||||
|
Com_BlocksChecksum(2, blocks, lens, (void*)digest);
|
||||||
|
|
||||||
|
return va("%08x%08x%08x%08x", digest[0], digest[1], digest[2], digest[3]);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=======================
|
=======================
|
||||||
CL_SendConnectPacket
|
CL_SendConnectPacket
|
||||||
|
@ -429,6 +477,7 @@ void CL_SendConnectPacket (
|
||||||
extern cvar_t qport;
|
extern cvar_t qport;
|
||||||
netadr_t adr;
|
netadr_t adr;
|
||||||
char data[2048];
|
char data[2048];
|
||||||
|
char *info;
|
||||||
double t1, t2;
|
double t1, t2;
|
||||||
#ifdef PROTOCOL_VERSION_FTE
|
#ifdef PROTOCOL_VERSION_FTE
|
||||||
int fteprotextsupported=0;
|
int fteprotextsupported=0;
|
||||||
|
@ -569,6 +618,10 @@ void CL_SendConnectPacket (
|
||||||
#endif
|
#endif
|
||||||
cls.netchan.compress = false;
|
cls.netchan.compress = false;
|
||||||
|
|
||||||
|
info = CL_GUIDString();
|
||||||
|
if (info)
|
||||||
|
Q_strncatz(data, va("0x%x \"%s\"\n", PROTOCOL_INFO_GUID, info), sizeof(data));
|
||||||
|
|
||||||
NET_SendPacket (NS_CLIENT, strlen(data), data, adr);
|
NET_SendPacket (NS_CLIENT, strlen(data), data, adr);
|
||||||
|
|
||||||
cl.splitclients = 0;
|
cl.splitclients = 0;
|
||||||
|
@ -3844,7 +3897,7 @@ Con_TPrintf (TL_NL);
|
||||||
Con_Printf ("%s", version_string());
|
Con_Printf ("%s", version_string());
|
||||||
Con_TPrintf (TL_NL);
|
Con_TPrintf (TL_NL);
|
||||||
|
|
||||||
Con_TPrintf (TLC_QUAKEWORLD_INITED);
|
Con_TPrintf (TLC_QUAKEWORLD_INITED, fs_gamename.string);
|
||||||
|
|
||||||
Con_DPrintf("This program is free software; you can redistribute it and/or "
|
Con_DPrintf("This program is free software; you can redistribute it and/or "
|
||||||
"modify it under the terms of the GNU General Public License "
|
"modify it under the terms of the GNU General Public License "
|
||||||
|
|
|
@ -2067,7 +2067,7 @@ void CL_ClearParseState(void)
|
||||||
CL_ParseServerData
|
CL_ParseServerData
|
||||||
==================
|
==================
|
||||||
*/
|
*/
|
||||||
void CL_ParseServerData (void)
|
void CLQW_ParseServerData (void)
|
||||||
{
|
{
|
||||||
int pnum;
|
int pnum;
|
||||||
int clnum;
|
int clnum;
|
||||||
|
@ -3537,6 +3537,9 @@ void CLNQ_ParseStartSoundPacket(void)
|
||||||
channel &= 7;
|
channel &= 7;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*unpack mangling*/
|
||||||
|
channel = (channel & 7) | ((channel & 0x0f1) << 1);
|
||||||
|
|
||||||
if (field_mask & DPSND_LARGESOUND)
|
if (field_mask & DPSND_LARGESOUND)
|
||||||
sound_num = (unsigned short)MSG_ReadShort();
|
sound_num = (unsigned short)MSG_ReadShort();
|
||||||
else
|
else
|
||||||
|
@ -4760,10 +4763,12 @@ void CL_ParseStuffCmd(char *msg, int destsplit) //this protects stuffcmds from n
|
||||||
|
|
||||||
void CL_ParsePrecache(void)
|
void CL_ParsePrecache(void)
|
||||||
{
|
{
|
||||||
int i = (unsigned short)MSG_ReadShort();
|
int i, code = (unsigned short)MSG_ReadShort();
|
||||||
char *s = MSG_ReadString();
|
char *s = MSG_ReadString();
|
||||||
if (i < 32768)
|
i = code & 0x1fff;
|
||||||
|
switch(code & 0xe000)
|
||||||
{
|
{
|
||||||
|
case 0x0000:
|
||||||
if (i >= 1 && i < MAX_MODELS)
|
if (i >= 1 && i < MAX_MODELS)
|
||||||
{
|
{
|
||||||
model_t *model;
|
model_t *model;
|
||||||
|
@ -4778,10 +4783,8 @@ void CL_ParsePrecache(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Con_Printf("svc_precache: model index %i outside range %i...%i\n", i, 1, MAX_MODELS);
|
Con_Printf("svc_precache: model index %i outside range %i...%i\n", i, 1, MAX_MODELS);
|
||||||
}
|
break;
|
||||||
else
|
case 0x8000:
|
||||||
{
|
|
||||||
i -= 32768;
|
|
||||||
if (i >= 1 && i < MAX_SOUNDS)
|
if (i >= 1 && i < MAX_SOUNDS)
|
||||||
{
|
{
|
||||||
sfx_t *sfx;
|
sfx_t *sfx;
|
||||||
|
@ -4795,6 +4798,7 @@ void CL_ParsePrecache(void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Con_Printf("svc_precache: sound index %i outside range %i...%i\n", i, 1, MAX_SOUNDS);
|
Con_Printf("svc_precache: sound index %i outside range %i...%i\n", i, 1, MAX_SOUNDS);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4985,7 +4989,7 @@ void CL_ParseServerMessage (void)
|
||||||
|
|
||||||
case svc_serverdata:
|
case svc_serverdata:
|
||||||
Cbuf_Execute (); // make sure any stuffed commands are done
|
Cbuf_Execute (); // make sure any stuffed commands are done
|
||||||
CL_ParseServerData ();
|
CLQW_ParseServerData ();
|
||||||
vid.recalc_refdef = true; // leave full screen intermission
|
vid.recalc_refdef = true; // leave full screen intermission
|
||||||
break;
|
break;
|
||||||
#ifdef PEXT_SETVIEW
|
#ifdef PEXT_SETVIEW
|
||||||
|
|
|
@ -1024,7 +1024,7 @@ void SCR_CrosshairPosition(int pnum, int *x, int *y)
|
||||||
adj+=v_viewheight.value;
|
adj+=v_viewheight.value;
|
||||||
|
|
||||||
start[2]+=adj;
|
start[2]+=adj;
|
||||||
Matrix4_Project(tr.endpos, end, cl.simangles[pnum], start, r_refdef.fov_x, r_refdef.fov_y);
|
Matrix4x4_CM_Project(tr.endpos, end, cl.simangles[pnum], start, r_refdef.fov_x, r_refdef.fov_y);
|
||||||
*x = rect.x+rect.width*end[0];
|
*x = rect.x+rect.width*end[0];
|
||||||
*y = rect.y+rect.height*(1-end[1]);
|
*y = rect.y+rect.height*(1-end[1]);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -582,7 +582,7 @@ void VQ3_RenderView(const q3refdef_t *ref)
|
||||||
{
|
{
|
||||||
dlight_t *dl;
|
dlight_t *dl;
|
||||||
dl = CL_NewDlightRGB(0, ref->vieworg, 300, r_torch.ival, 0.05, 0.05, 0.02);
|
dl = CL_NewDlightRGB(0, ref->vieworg, 300, r_torch.ival, 0.05, 0.05, 0.02);
|
||||||
dl->flags |= LFLAG_SHADOWMAP|LFLAG_ALLOW_FLASH;
|
dl->flags |= LFLAG_SHADOWMAP|LFLAG_FLASHBLEND;
|
||||||
dl->fov = 60;
|
dl->fov = 60;
|
||||||
VectorCopy(ref->viewaxis[0], dl->axis[0]);
|
VectorCopy(ref->viewaxis[0], dl->axis[0]);
|
||||||
VectorCopy(ref->viewaxis[1], dl->axis[1]);
|
VectorCopy(ref->viewaxis[1], dl->axis[1]);
|
||||||
|
|
|
@ -240,16 +240,15 @@ typedef struct
|
||||||
#define DL_LAST (sizeof(unsigned int)*8-1)
|
#define DL_LAST (sizeof(unsigned int)*8-1)
|
||||||
#define RTL_FIRST (sizeof(unsigned int)*8)
|
#define RTL_FIRST (sizeof(unsigned int)*8)
|
||||||
|
|
||||||
#define LFLAG_NORMALMODE (1<<0)
|
#define LFLAG_NORMALMODE (1<<0) /*ppl with r_shadow_realtime_dlight*/
|
||||||
#define LFLAG_REALTIMEMODE (1<<1)
|
#define LFLAG_REALTIMEMODE (1<<1) /*ppl with r_shadow_realtime_world*/
|
||||||
|
#define LFLAG_LIGHTMAP (1<<2)
|
||||||
|
#define LFLAG_FLASHBLEND (1<<3)
|
||||||
|
|
||||||
#define LFLAG_NOSHADOWS (1<<15)
|
#define LFLAG_NOSHADOWS (1<<8)
|
||||||
#define LFLAG_ALLOW_LMHACK (1<<16)
|
#define LFLAG_SHADOWMAP (1<<9)
|
||||||
#define LFLAG_ALLOW_FLASH (1<<17)
|
|
||||||
#define LFLAG_ALLOW_PPL (1<<18)
|
|
||||||
#define LFLAG_SHADOWMAP (1<<19)
|
|
||||||
|
|
||||||
#define LFLAG_DYNAMIC (LFLAG_ALLOW_PPL | LFLAG_ALLOW_LMHACK | LFLAG_ALLOW_FLASH | LFLAG_NORMALMODE | LFLAG_REALTIMEMODE)
|
#define LFLAG_DYNAMIC (LFLAG_LIGHTMAP | LFLAG_FLASHBLEND | LFLAG_NORMALMODE | LFLAG_REALTIMEMODE)
|
||||||
|
|
||||||
typedef struct dlight_s
|
typedef struct dlight_s
|
||||||
{
|
{
|
||||||
|
|
|
@ -558,7 +558,7 @@ void M_DrawSources (void)
|
||||||
{"Max ping", &sb_maxping, 1},
|
{"Max ping", &sb_maxping, 1},
|
||||||
{"GameDir", &sb_gamedir, 2},
|
{"GameDir", &sb_gamedir, 2},
|
||||||
{"Using map", &sb_mapname, 2},
|
{"Using map", &sb_mapname, 2},
|
||||||
{"Game name", &com_gamename, 2}
|
{"Game", &com_protocolname, 2}
|
||||||
};
|
};
|
||||||
|
|
||||||
void M_DrawSListOptions (void)
|
void M_DrawSListOptions (void)
|
||||||
|
|
|
@ -1211,7 +1211,7 @@ void MasterInfo_Request(master_t *mast, qboolean evenifwedonthavethefiles)
|
||||||
case MT_MASTERDP:
|
case MT_MASTERDP:
|
||||||
{
|
{
|
||||||
char *str;
|
char *str;
|
||||||
str = va("%c%c%c%cgetservers %s %u empty full\x0A\n", 255, 255, 255, 255, com_gamename.string, 3);
|
str = va("%c%c%c%cgetservers %s %u empty full\x0A\n", 255, 255, 255, 255, com_protocolname.string, 3);
|
||||||
NET_SendPollPacket (strlen(str), str, mast->adr);
|
NET_SendPollPacket (strlen(str), str, mast->adr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -53,7 +53,8 @@ static qboolean csqc_isdarkplaces;
|
||||||
static char csqc_printbuffer[8192];
|
static char csqc_printbuffer[8192];
|
||||||
|
|
||||||
#define CSQCPROGSGROUP "CSQC progs control"
|
#define CSQCPROGSGROUP "CSQC progs control"
|
||||||
cvar_t pr_csmaxedicts = CVAR("pr_csmaxedicts", "3072"); //not tied to protocol nor server.
|
cvar_t pr_csqc_maxedicts = CVAR("pr_csqc_maxedicts", "3072"); //not tied to protocol nor server.
|
||||||
|
cvar_t pr_csqc_memsize = CVAR("pr_csqc_memsize", "-1");
|
||||||
cvar_t cl_csqcdebug = CVAR("cl_csqcdebug", "0"); //prints entity numbers which arrive (so I can tell people not to apply it to players...)
|
cvar_t cl_csqcdebug = CVAR("cl_csqcdebug", "0"); //prints entity numbers which arrive (so I can tell people not to apply it to players...)
|
||||||
cvar_t cl_nocsqc = CVAR("cl_nocsqc", "0");
|
cvar_t cl_nocsqc = CVAR("cl_nocsqc", "0");
|
||||||
cvar_t pr_csqc_coreonerror = CVAR("pr_csqc_coreonerror", "1");
|
cvar_t pr_csqc_coreonerror = CVAR("pr_csqc_coreonerror", "1");
|
||||||
|
@ -767,8 +768,12 @@ static void QCBUILTIN PF_R_DynamicLight_Set(progfuncs_t *prinst, struct globalva
|
||||||
dlight_t *l;
|
dlight_t *l;
|
||||||
unsigned int lno = G_FLOAT(OFS_PARM0);
|
unsigned int lno = G_FLOAT(OFS_PARM0);
|
||||||
int field = G_FLOAT(OFS_PARM1);
|
int field = G_FLOAT(OFS_PARM1);
|
||||||
if (lno >= cl_maxdlights)
|
while (lno >= cl_maxdlights)
|
||||||
return;
|
{
|
||||||
|
if (lno > 1000)
|
||||||
|
return;
|
||||||
|
CL_AllocSlight();
|
||||||
|
}
|
||||||
l = cl_dlights+lno;
|
l = cl_dlights+lno;
|
||||||
switch (field)
|
switch (field)
|
||||||
{
|
{
|
||||||
|
@ -782,6 +787,8 @@ static void QCBUILTIN PF_R_DynamicLight_Set(progfuncs_t *prinst, struct globalva
|
||||||
case 2:
|
case 2:
|
||||||
l->radius = G_FLOAT(OFS_PARM2);
|
l->radius = G_FLOAT(OFS_PARM2);
|
||||||
l->rebuildcache = true;
|
l->rebuildcache = true;
|
||||||
|
if (lno >= rtlights_max)
|
||||||
|
rtlights_max = lno+1;
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
l->flags = G_FLOAT(OFS_PARM2);
|
l->flags = G_FLOAT(OFS_PARM2);
|
||||||
|
@ -790,6 +797,12 @@ static void QCBUILTIN PF_R_DynamicLight_Set(progfuncs_t *prinst, struct globalva
|
||||||
case 4:
|
case 4:
|
||||||
l->style = G_FLOAT(OFS_PARM2);
|
l->style = G_FLOAT(OFS_PARM2);
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
AngleVectors(G_VECTOR(OFS_PARM2), l->axis[0], l->axis[1], l->axis[2]);
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
l->fov = G_FLOAT(OFS_PARM2);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -825,6 +838,12 @@ static void QCBUILTIN PF_R_DynamicLight_Get(progfuncs_t *prinst, struct globalva
|
||||||
case 4:
|
case 4:
|
||||||
G_FLOAT(OFS_RETURN) = l->style;
|
G_FLOAT(OFS_RETURN) = l->style;
|
||||||
break;
|
break;
|
||||||
|
case 5:
|
||||||
|
VectorAngles(l->axis[0], l->axis[2], G_VECTOR(OFS_RETURN));
|
||||||
|
break;
|
||||||
|
case 6:
|
||||||
|
G_FLOAT(OFS_RETURN) = l->fov;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_INT(OFS_RETURN) = 0;
|
G_INT(OFS_RETURN) = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -907,7 +926,7 @@ static int csqc_startpolyvert;
|
||||||
// #306 void(string texturename) R_BeginPolygon (EXT_CSQC_???)
|
// #306 void(string texturename) R_BeginPolygon (EXT_CSQC_???)
|
||||||
static void QCBUILTIN PF_R_PolygonBegin(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
static void QCBUILTIN PF_R_PolygonBegin(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||||
{
|
{
|
||||||
csqc_shadern = R_RegisterSkin(PR_GetStringOfs(prinst, OFS_PARM0));
|
csqc_shadern = R_RegisterSkin(PR_GetStringOfs(prinst, OFS_PARM0), NULL);
|
||||||
csqc_startpolyvert = cl_numstrisvert;
|
csqc_startpolyvert = cl_numstrisvert;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -984,8 +1003,8 @@ float csqc_proj_matrix_inverse[16];
|
||||||
float proj[16];
|
float proj[16];
|
||||||
|
|
||||||
/*build modelview and projection*/
|
/*build modelview and projection*/
|
||||||
Matrix4_ModelViewMatrix(modelview, r_refdef.viewangles, r_refdef.vieworg);
|
Matrix4x4_CM_ModelViewMatrix(modelview, r_refdef.viewangles, r_refdef.vieworg);
|
||||||
Matrix4_Projection2(proj, r_refdef.fov_x, r_refdef.fov_y, 4);
|
Matrix4x4_CM_Projection2(proj, r_refdef.fov_x, r_refdef.fov_y, 4);
|
||||||
|
|
||||||
/*build the project matrix*/
|
/*build the project matrix*/
|
||||||
Matrix4_Multiply(proj, modelview, csqc_proj_matrix);
|
Matrix4_Multiply(proj, modelview, csqc_proj_matrix);
|
||||||
|
@ -1011,7 +1030,7 @@ static void QCBUILTIN PF_cs_project (progfuncs_t *prinst, struct globalvars_s *p
|
||||||
v[2] = in[2];
|
v[2] = in[2];
|
||||||
v[3] = 1;
|
v[3] = 1;
|
||||||
|
|
||||||
Matrix4_Transform4(csqc_proj_matrix, v, tempv);
|
Matrix4x4_CM_Transform4(csqc_proj_matrix, v, tempv);
|
||||||
|
|
||||||
tempv[0] /= tempv[3];
|
tempv[0] /= tempv[3];
|
||||||
tempv[1] /= tempv[3];
|
tempv[1] /= tempv[3];
|
||||||
|
@ -1052,7 +1071,7 @@ static void QCBUILTIN PF_cs_unproject (progfuncs_t *prinst, struct globalvars_s
|
||||||
if (v[2] >= 1)
|
if (v[2] >= 1)
|
||||||
v[2] = 0.999999;
|
v[2] = 0.999999;
|
||||||
|
|
||||||
Matrix4_Transform4(csqc_proj_matrix_inverse, v, tempv);
|
Matrix4x4_CM_Transform4(csqc_proj_matrix_inverse, v, tempv);
|
||||||
|
|
||||||
out[0] = tempv[0]/tempv[3];
|
out[0] = tempv[0]/tempv[3];
|
||||||
out[1] = tempv[1]/tempv[3];
|
out[1] = tempv[1]/tempv[3];
|
||||||
|
@ -1529,18 +1548,7 @@ static void QCBUILTIN PF_cs_tracebox(progfuncs_t *prinst, struct globalvars_s *p
|
||||||
trace = World_Move (&csqc_world, v1, mins, maxs, v2, nomonsters, (wedict_t*)ent);
|
trace = World_Move (&csqc_world, v1, mins, maxs, v2, nomonsters, (wedict_t*)ent);
|
||||||
ent->xv->hull = savedhull;
|
ent->xv->hull = savedhull;
|
||||||
|
|
||||||
*csqcg.trace_allsolid = trace.allsolid;
|
cs_settracevars(&trace);
|
||||||
*csqcg.trace_startsolid = trace.startsolid;
|
|
||||||
*csqcg.trace_fraction = trace.fraction;
|
|
||||||
*csqcg.trace_inwater = trace.inwater;
|
|
||||||
*csqcg.trace_inopen = trace.inopen;
|
|
||||||
VectorCopy (trace.endpos, csqcg.trace_endpos);
|
|
||||||
VectorCopy (trace.plane.normal, csqcg.trace_plane_normal);
|
|
||||||
*csqcg.trace_plane_dist = trace.plane.dist;
|
|
||||||
if (trace.ent)
|
|
||||||
*csqcg.trace_ent = EDICT_TO_PROG(prinst, (void*)trace.ent);
|
|
||||||
else
|
|
||||||
*csqcg.trace_ent = EDICT_TO_PROG(prinst, (void*)csqc_world.edicts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static trace_t CS_Trace_Toss (csqcedict_t *tossent, csqcedict_t *ignore)
|
static trace_t CS_Trace_Toss (csqcedict_t *tossent, csqcedict_t *ignore)
|
||||||
|
@ -1598,18 +1606,7 @@ static void QCBUILTIN PF_cs_tracetoss (progfuncs_t *prinst, struct globalvars_s
|
||||||
|
|
||||||
trace = CS_Trace_Toss (ent, ignore);
|
trace = CS_Trace_Toss (ent, ignore);
|
||||||
|
|
||||||
*csqcg.trace_allsolid = trace.allsolid;
|
cs_settracevars(&trace);
|
||||||
*csqcg.trace_startsolid = trace.startsolid;
|
|
||||||
*csqcg.trace_fraction = trace.fraction;
|
|
||||||
*csqcg.trace_inwater = trace.inwater;
|
|
||||||
*csqcg.trace_inopen = trace.inopen;
|
|
||||||
VectorCopy (trace.endpos, csqcg.trace_endpos);
|
|
||||||
VectorCopy (trace.plane.normal, csqcg.trace_plane_normal);
|
|
||||||
*csqcg.trace_plane_dist = trace.plane.dist;
|
|
||||||
if (trace.ent)
|
|
||||||
*csqcg.trace_ent = EDICT_TO_PROG(prinst, trace.ent);
|
|
||||||
else
|
|
||||||
*csqcg.trace_ent = EDICT_TO_PROG(prinst, (void*)csqc_world.edicts);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int CS_PointContents(vec3_t org)
|
static int CS_PointContents(vec3_t org)
|
||||||
|
@ -3412,7 +3409,7 @@ static void QCBUILTIN PF_shaderforname (progfuncs_t *prinst, struct globalvars_s
|
||||||
char *str = PF_VarString(prinst, 0, pr_globals);
|
char *str = PF_VarString(prinst, 0, pr_globals);
|
||||||
|
|
||||||
shader_t *shad;
|
shader_t *shad;
|
||||||
shad = R_RegisterSkin(str);
|
shad = R_RegisterSkin(str, NULL);
|
||||||
if (shad)
|
if (shad)
|
||||||
G_FLOAT(OFS_RETURN) = shad-r_shaders + 1;
|
G_FLOAT(OFS_RETURN) = shad-r_shaders + 1;
|
||||||
else
|
else
|
||||||
|
@ -3525,7 +3522,6 @@ static void QCBUILTIN PF_skel_create (progfuncs_t *prinst, struct globalvars_s *
|
||||||
//float(float skel, entity ent, float modelindex, float retainfrac, float firstbone, float lastbone) skel_build (FTE_CSQC_SKELETONOBJECTS)
|
//float(float skel, entity ent, float modelindex, float retainfrac, float firstbone, float lastbone) skel_build (FTE_CSQC_SKELETONOBJECTS)
|
||||||
static void QCBUILTIN PF_skel_build(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
static void QCBUILTIN PF_skel_build(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||||
{
|
{
|
||||||
#define MAX_BONES 256
|
|
||||||
int skelidx = G_FLOAT(OFS_PARM0);
|
int skelidx = G_FLOAT(OFS_PARM0);
|
||||||
csqcedict_t *ent = (csqcedict_t*)G_EDICT(prinst, OFS_PARM1);
|
csqcedict_t *ent = (csqcedict_t*)G_EDICT(prinst, OFS_PARM1);
|
||||||
int midx = G_FLOAT(OFS_PARM2);
|
int midx = G_FLOAT(OFS_PARM2);
|
||||||
|
@ -3955,6 +3951,12 @@ static void QCBUILTIN PF_cs_walkmove (progfuncs_t *prinst, struct globalvars_s *
|
||||||
*csqcg.self = oldself;
|
*csqcg.self = oldself;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PF_cs_touchtriggers(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||||
|
{
|
||||||
|
wedict_t *ent = (wedict_t*)PROG_TO_EDICT(prinst, *csqcg.self);
|
||||||
|
World_LinkEdict (&csqc_world, ent, true);
|
||||||
|
}
|
||||||
|
|
||||||
static void QCBUILTIN PF_cs_movetogoal (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
static void QCBUILTIN PF_cs_movetogoal (progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||||
{
|
{
|
||||||
wedict_t *ent;
|
wedict_t *ent;
|
||||||
|
@ -4746,6 +4748,7 @@ static struct {
|
||||||
{"frameduration", PF_frameduration, 277},//void(float modidx, float framenum) frameduration = #277 (FTE_CSQC_SKELETONOBJECTS)
|
{"frameduration", PF_frameduration, 277},//void(float modidx, float framenum) frameduration = #277 (FTE_CSQC_SKELETONOBJECTS)
|
||||||
|
|
||||||
{"terrain_edit", PF_cs_terrain_edit, 278},//void(float action, vector pos, float radius, float quant) terrain_edit = #278 (??FTE_TERRAIN_EDIT??)
|
{"terrain_edit", PF_cs_terrain_edit, 278},//void(float action, vector pos, float radius, float quant) terrain_edit = #278 (??FTE_TERRAIN_EDIT??)
|
||||||
|
{"touchtriggers", PF_cs_touchtriggers, 279},//void() touchtriggers = #279;
|
||||||
//300
|
//300
|
||||||
{"clearscene", PF_R_ClearScene, 300}, // #300 void() clearscene (EXT_CSQC)
|
{"clearscene", PF_R_ClearScene, 300}, // #300 void() clearscene (EXT_CSQC)
|
||||||
{"addentities", PF_R_AddEntityMask, 301}, // #301 void(float mask) addentities (EXT_CSQC)
|
{"addentities", PF_R_AddEntityMask, 301}, // #301 void(float mask) addentities (EXT_CSQC)
|
||||||
|
@ -5355,7 +5358,7 @@ qboolean CSQC_Init (unsigned int checksum)
|
||||||
csqcprogs = InitProgs(&csqcprogparms);
|
csqcprogs = InitProgs(&csqcprogparms);
|
||||||
csqc_world.progs = csqcprogs;
|
csqc_world.progs = csqcprogs;
|
||||||
csqc_world.usesolidcorpse = true;
|
csqc_world.usesolidcorpse = true;
|
||||||
PR_Configure(csqcprogs, -1, 16);
|
PR_Configure(csqcprogs, pr_csqc_memsize.ival, 16);
|
||||||
csqc_world.worldmodel = cl.worldmodel;
|
csqc_world.worldmodel = cl.worldmodel;
|
||||||
csqc_world.Event_Touch = CSQC_Event_Touch;
|
csqc_world.Event_Touch = CSQC_Event_Touch;
|
||||||
csqc_world.GetCModel = CSQC_World_ModelForIndex;
|
csqc_world.GetCModel = CSQC_World_ModelForIndex;
|
||||||
|
@ -5396,7 +5399,7 @@ qboolean CSQC_Init (unsigned int checksum)
|
||||||
csqc_fakereadbyte = -1;
|
csqc_fakereadbyte = -1;
|
||||||
memset(csqcent, 0, sizeof(*csqcent)*maxcsqcentities); //clear the server->csqc entity translations.
|
memset(csqcent, 0, sizeof(*csqcent)*maxcsqcentities); //clear the server->csqc entity translations.
|
||||||
|
|
||||||
csqcentsize = PR_InitEnts(csqcprogs, pr_csmaxedicts.value);
|
csqcentsize = PR_InitEnts(csqcprogs, pr_csqc_maxedicts.value);
|
||||||
|
|
||||||
ED_Alloc(csqcprogs); //we need a world entity.
|
ED_Alloc(csqcprogs); //we need a world entity.
|
||||||
|
|
||||||
|
@ -5625,7 +5628,8 @@ void CSQC_RegisterCvarsAndThings(void)
|
||||||
Cmd_AddCommand("cl_cmd", CSQC_GameCommand_f);
|
Cmd_AddCommand("cl_cmd", CSQC_GameCommand_f);
|
||||||
Cmd_AddCommand("breakpoint_csqc", CSQC_Breakpoint_f);
|
Cmd_AddCommand("breakpoint_csqc", CSQC_Breakpoint_f);
|
||||||
|
|
||||||
Cvar_Register(&pr_csmaxedicts, CSQCPROGSGROUP);
|
Cvar_Register(&pr_csqc_memsize, CSQCPROGSGROUP);
|
||||||
|
Cvar_Register(&pr_csqc_maxedicts, CSQCPROGSGROUP);
|
||||||
Cvar_Register(&cl_csqcdebug, CSQCPROGSGROUP);
|
Cvar_Register(&cl_csqcdebug, CSQCPROGSGROUP);
|
||||||
Cvar_Register(&cl_nocsqc, CSQCPROGSGROUP);
|
Cvar_Register(&cl_nocsqc, CSQCPROGSGROUP);
|
||||||
Cvar_Register(&pr_csqc_coreonerror, CSQCPROGSGROUP);
|
Cvar_Register(&pr_csqc_coreonerror, CSQCPROGSGROUP);
|
||||||
|
@ -5685,10 +5689,13 @@ qboolean CSQC_DrawView(void)
|
||||||
|
|
||||||
csqc_resortfrags = true;
|
csqc_resortfrags = true;
|
||||||
|
|
||||||
if (csqcg.clientcommandframe)
|
if (!cl.paused)
|
||||||
*csqcg.clientcommandframe = cls.netchan.outgoing_sequence;
|
{
|
||||||
if (csqcg.servercommandframe)
|
if (csqcg.clientcommandframe)
|
||||||
*csqcg.servercommandframe = cl.ackedinputsequence;
|
*csqcg.clientcommandframe = cls.netchan.outgoing_sequence;
|
||||||
|
if (csqcg.servercommandframe)
|
||||||
|
*csqcg.servercommandframe = cl.ackedinputsequence;
|
||||||
|
}
|
||||||
if (csqcg.intermission)
|
if (csqcg.intermission)
|
||||||
*csqcg.intermission = cl.intermission;
|
*csqcg.intermission = cl.intermission;
|
||||||
|
|
||||||
|
|
|
@ -227,7 +227,8 @@ extern qboolean noclip_anglehack;
|
||||||
//
|
//
|
||||||
extern quakeparms_t host_parms;
|
extern quakeparms_t host_parms;
|
||||||
|
|
||||||
extern cvar_t com_gamename;
|
extern cvar_t fs_gamename;
|
||||||
|
extern cvar_t com_protocolname;
|
||||||
extern cvar_t com_modname;
|
extern cvar_t com_modname;
|
||||||
extern cvar_t sys_ticrate;
|
extern cvar_t sys_ticrate;
|
||||||
extern cvar_t sys_nostdout;
|
extern cvar_t sys_nostdout;
|
||||||
|
|
|
@ -310,8 +310,8 @@ static qboolean D3_PolyBounds(vec_t result[4], int count, vec4_t *vlist)
|
||||||
result[3] = -10000;
|
result[3] = -10000;
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
Matrix4_Transform4(r_refdef.m_view, vlist[i], tempv);
|
Matrix4x4_CM_Transform4(r_refdef.m_view, vlist[i], tempv);
|
||||||
Matrix4_Transform4(r_refdef.m_projection, tempv, v);
|
Matrix4x4_CM_Transform4(r_refdef.m_projection, tempv, v);
|
||||||
|
|
||||||
v[0] /= v[3];
|
v[0] /= v[3];
|
||||||
v[1] /= v[3];
|
v[1] /= v[3];
|
||||||
|
|
|
@ -340,7 +340,7 @@ static void Surf_AddDynamicLights (msurface_t *surf)
|
||||||
if ( !(surf->dlightbits & (1<<lnum) ) )
|
if ( !(surf->dlightbits & (1<<lnum) ) )
|
||||||
continue; // not lit by this light
|
continue; // not lit by this light
|
||||||
|
|
||||||
if (!(cl_dlights[lnum].flags & LFLAG_ALLOW_LMHACK))
|
if (!(cl_dlights[lnum].flags & LFLAG_LIGHTMAP))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
rad = cl_dlights[lnum].radius;
|
rad = cl_dlights[lnum].radius;
|
||||||
|
@ -1884,7 +1884,7 @@ void Surf_GenBrushBatches(batch_t **batches, entity_t *ent)
|
||||||
{
|
{
|
||||||
if (!cl_dlights[k].radius)
|
if (!cl_dlights[k].radius)
|
||||||
continue;
|
continue;
|
||||||
if (!(cl_dlights[k].flags & LFLAG_ALLOW_LMHACK))
|
if (!(cl_dlights[k].flags & LFLAG_LIGHTMAP))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
model->funcs.MarkLights (&cl_dlights[k], 1<<k,
|
model->funcs.MarkLights (&cl_dlights[k], 1<<k,
|
||||||
|
@ -2263,7 +2263,35 @@ static int Surf_LM_FillBlock (int texnum, int w, int h, int x, int y)
|
||||||
|
|
||||||
if (cl.worldmodel->lightdata)
|
if (cl.worldmodel->lightdata)
|
||||||
{
|
{
|
||||||
memcpy(lightmap[i]->lightmaps, cl.worldmodel->lightdata+3*LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
|
if (lightmap_bytes == 4)
|
||||||
|
{
|
||||||
|
int j;
|
||||||
|
if (lightmap_bgra)
|
||||||
|
{
|
||||||
|
for (j = 0; j < LMBLOCK_HEIGHT*LMBLOCK_HEIGHT; j++)
|
||||||
|
{
|
||||||
|
lightmap[i]->lightmaps[(j<<2)+0] = (cl.worldmodel->lightdata+3*(j + LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i))[2];
|
||||||
|
lightmap[i]->lightmaps[(j<<2)+1] = (cl.worldmodel->lightdata+3*(j + LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i))[1];
|
||||||
|
lightmap[i]->lightmaps[(j<<2)+2] = (cl.worldmodel->lightdata+3*(j + LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i))[0];
|
||||||
|
lightmap[i]->lightmaps[(j<<2)+3] = 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (j = 0; j < LMBLOCK_HEIGHT*LMBLOCK_HEIGHT; j++)
|
||||||
|
{
|
||||||
|
lightmap[i]->lightmaps[(j<<2)+0] = (cl.worldmodel->lightdata+3*(j + LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i))[0];
|
||||||
|
lightmap[i]->lightmaps[(j<<2)+1] = (cl.worldmodel->lightdata+3*(j + LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i))[1];
|
||||||
|
lightmap[i]->lightmaps[(j<<2)+2] = (cl.worldmodel->lightdata+3*(j + LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i))[2];
|
||||||
|
lightmap[i]->lightmaps[(j<<2)+3] = 255;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*BUG: assumes RGB. if its BGR then wrong colours, but whys that going to happen*/
|
||||||
|
memcpy(lightmap[i]->lightmaps, cl.worldmodel->lightdata+3*LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*i, LMBLOCK_HEIGHT*LMBLOCK_HEIGHT*3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -2300,7 +2328,6 @@ void Surf_BuildSurfaceDisplayList (model_t *model, msurface_t *fa)
|
||||||
int vertpage;
|
int vertpage;
|
||||||
float *vec;
|
float *vec;
|
||||||
float s, t;
|
float s, t;
|
||||||
int lm;
|
|
||||||
|
|
||||||
// reconstruct the polygon
|
// reconstruct the polygon
|
||||||
pedges = model->edges;
|
pedges = model->edges;
|
||||||
|
@ -2361,13 +2388,11 @@ void Surf_BuildSurfaceDisplayList (model_t *model, msurface_t *fa)
|
||||||
mesh->st_array[i][1] = t/fa->texinfo->texture->height;
|
mesh->st_array[i][1] = t/fa->texinfo->texture->height;
|
||||||
|
|
||||||
s -= fa->texturemins[0];
|
s -= fa->texturemins[0];
|
||||||
lm = s*fa->light_t;
|
|
||||||
s += fa->light_s*16;
|
s += fa->light_s*16;
|
||||||
s += 8;
|
s += 8;
|
||||||
s /= LMBLOCK_WIDTH*16;
|
s /= LMBLOCK_WIDTH*16;
|
||||||
|
|
||||||
t -= fa->texturemins[1];
|
t -= fa->texturemins[1];
|
||||||
lm += t;
|
|
||||||
t += fa->light_t*16;
|
t += fa->light_t*16;
|
||||||
t += 8;
|
t += 8;
|
||||||
t /= LMBLOCK_HEIGHT*16;
|
t /= LMBLOCK_HEIGHT*16;
|
||||||
|
|
|
@ -179,8 +179,8 @@ void BE_GenModelBatches(struct batch_s **batches);
|
||||||
//gl_alias.c
|
//gl_alias.c
|
||||||
void R_GAlias_DrawBatch(struct batch_s *batch);
|
void R_GAlias_DrawBatch(struct batch_s *batch);
|
||||||
void R_GAlias_GenerateBatches(entity_t *e, struct batch_s **batches);
|
void R_GAlias_GenerateBatches(entity_t *e, struct batch_s **batches);
|
||||||
void R_LightArraysByte_BGR(vecV_t *coords, byte_vec4_t *colours, int vertcount, vec3_t *normals);
|
void R_LightArraysByte_BGR(const entity_t *entity, vecV_t *coords, byte_vec4_t *colours, int vertcount, vec3_t *normals);
|
||||||
void R_LightArrays(vecV_t *coords, vec4_t *colours, int vertcount, vec3_t *normals);
|
void R_LightArrays(const entity_t *entity, vecV_t *coords, vec4_t *colours, int vertcount, vec3_t *normals);
|
||||||
|
|
||||||
void R_DrawSkyChain (struct batch_s *batch); /*called from the backend, and calls back into it*/
|
void R_DrawSkyChain (struct batch_s *batch); /*called from the backend, and calls back into it*/
|
||||||
void R_InitSky (struct texnums_s *ret, struct texture_s *mt, qbyte *src); /*generate q1 sky texnums*/
|
void R_InitSky (struct texnums_s *ret, struct texture_s *mt, qbyte *src); /*generate q1 sky texnums*/
|
||||||
|
|
|
@ -49,6 +49,32 @@ HWND sys_parentwindow;
|
||||||
unsigned int sys_parentwidth; //valid if sys_parentwindow is set
|
unsigned int sys_parentwidth; //valid if sys_parentwindow is set
|
||||||
unsigned int sys_parentheight;
|
unsigned int sys_parentheight;
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
================
|
||||||
|
Sys_RandomBytes
|
||||||
|
================
|
||||||
|
*/
|
||||||
|
#include <wincrypt.h>
|
||||||
|
qboolean Sys_RandomBytes(qbyte *string, int len)
|
||||||
|
{
|
||||||
|
HCRYPTPROV prov;
|
||||||
|
|
||||||
|
if(!CryptAcquireContext( &prov, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!CryptGenRandom(prov, len, (BYTE *)string))
|
||||||
|
{
|
||||||
|
CryptReleaseContext( prov, 0);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
CryptReleaseContext(prov, 0);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Sys_CloseLibrary(dllhandle_t *lib)
|
void Sys_CloseLibrary(dllhandle_t *lib)
|
||||||
{
|
{
|
||||||
FreeLibrary((HMODULE)lib);
|
FreeLibrary((HMODULE)lib);
|
||||||
|
|
|
@ -1286,7 +1286,7 @@ void R_DrawNameTags(void)
|
||||||
{
|
{
|
||||||
VectorCopy(nametagorg[i], tagcenter);
|
VectorCopy(nametagorg[i], tagcenter);
|
||||||
tagcenter[2] += 32;
|
tagcenter[2] += 32;
|
||||||
Matrix4_Project(tagcenter, center, r_refdef.viewangles, r_refdef.vieworg, r_refdef.fov_x, r_refdef.fov_y);
|
Matrix4x4_CM_Project(tagcenter, center, r_refdef.viewangles, r_refdef.vieworg, r_refdef.fov_x, r_refdef.fov_y);
|
||||||
if (center[2] > 1)
|
if (center[2] > 1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ void W_LoadWadFile (char *filename)
|
||||||
if (!wad_base)
|
if (!wad_base)
|
||||||
{
|
{
|
||||||
wad_numlumps = 0;
|
wad_numlumps = 0;
|
||||||
Con_Printf ("W_LoadWadFile: couldn't load %s\n", filename);
|
Con_DPrintf ("W_LoadWadFile: couldn't load %s\n", filename);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -160,7 +160,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define DPMMODELS //darkplaces model format (which I've never seen anyone use)
|
#define DPMMODELS //darkplaces model format (which I've never seen anyone use)
|
||||||
#define PSKMODELS //PSK model format (ActorX stuff from UT, though not the format the game itself uses)
|
#define PSKMODELS //PSK model format (ActorX stuff from UT, though not the format the game itself uses)
|
||||||
#define HALFLIFEMODELS //halflife model support (experimental)
|
#define HALFLIFEMODELS //halflife model support (experimental)
|
||||||
// #define INTERQUAKEMODELS
|
#define INTERQUAKEMODELS
|
||||||
|
|
||||||
#define HUFFNETWORK //huffman network compression
|
#define HUFFNETWORK //huffman network compression
|
||||||
//#define DOOMWADS //doom wad/sprite support
|
//#define DOOMWADS //doom wad/sprite support
|
||||||
|
@ -444,8 +444,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define MAX_EDICTS 32767 // FIXME: ouch! ouch! ouch!
|
#define MAX_EDICTS 32767 // FIXME: ouch! ouch! ouch!
|
||||||
#define MAX_LIGHTSTYLES 255
|
#define MAX_LIGHTSTYLES 255
|
||||||
#define MAX_STANDARDLIGHTSTYLES 64
|
#define MAX_STANDARDLIGHTSTYLES 64
|
||||||
#define MAX_MODELS 512 // these are sent over the net as bytes
|
#define MAX_MODELS 1024 // these are sent over the net as bytes
|
||||||
#define MAX_SOUNDS 512 // so they cannot be blindly increased
|
#define MAX_SOUNDS 1024 // so they cannot be blindly increased
|
||||||
#define MAX_VWEP_MODELS 32
|
#define MAX_VWEP_MODELS 32
|
||||||
|
|
||||||
#define MAX_CSQCMODELS 256 // these live entirly clientside
|
#define MAX_CSQCMODELS 256 // these live entirly clientside
|
||||||
|
|
|
@ -180,7 +180,7 @@ typedef struct
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
int planenum;
|
int planenum;
|
||||||
short children[2]; // negative numbers are contents
|
int children[2]; // negative numbers are contents
|
||||||
} mclipnode_t;
|
} mclipnode_t;
|
||||||
|
|
||||||
typedef struct texinfo_s
|
typedef struct texinfo_s
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -7,8 +7,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_BONES 256
|
|
||||||
|
|
||||||
int HLMod_BoneForName(model_t *mod, char *name);
|
int HLMod_BoneForName(model_t *mod, char *name);
|
||||||
int HLMod_FrameForName(model_t *mod, char *name);
|
int HLMod_FrameForName(model_t *mod, char *name);
|
||||||
|
|
||||||
|
@ -23,8 +21,8 @@ typedef struct {
|
||||||
int ofsskins;
|
int ofsskins;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
qboolean sharesverts; //used with models with two shaders using the same vertex - use last mesh's verts
|
int shares_verts; //used with models with two shaders using the same vertex. set to the surface number to inherit from (or itself).
|
||||||
qboolean sharesbones; //use last mesh's bones (please, never set this on the first mesh!)
|
int shares_bones; //use last mesh's bones. set to the surface number to inherit from (or itself).
|
||||||
|
|
||||||
int numverts;
|
int numverts;
|
||||||
|
|
||||||
|
@ -41,8 +39,15 @@ typedef struct {
|
||||||
#ifdef SKELETALMODELS
|
#ifdef SKELETALMODELS
|
||||||
int numbones;
|
int numbones;
|
||||||
int ofsbones;
|
int ofsbones;
|
||||||
int numtransforms;
|
int numswtransforms;
|
||||||
int ofstransforms;
|
int ofsswtransforms;
|
||||||
|
|
||||||
|
int ofs_skel_xyz;
|
||||||
|
int ofs_skel_norm;
|
||||||
|
int ofs_skel_svect;
|
||||||
|
int ofs_skel_tvect;
|
||||||
|
int ofs_skel_idx;
|
||||||
|
int ofs_skel_weight;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//these exist only in the root mesh.
|
//these exist only in the root mesh.
|
||||||
|
@ -122,9 +127,8 @@ float *Alias_GetBonePositions(galiasinfo_t *inf, framestate_t *fstate, float *bu
|
||||||
#ifdef SKELETALMODELS
|
#ifdef SKELETALMODELS
|
||||||
void Alias_TransformVerticies(float *bonepose, galisskeletaltransforms_t *weights, int numweights, vecV_t *xyzout, vec3_t *normout);
|
void Alias_TransformVerticies(float *bonepose, galisskeletaltransforms_t *weights, int numweights, vecV_t *xyzout, vec3_t *normout);
|
||||||
#endif
|
#endif
|
||||||
qboolean Alias_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf,
|
qboolean Alias_GAliasBuildMesh(mesh_t *mesh, galiasinfo_t *inf, int surfnum, entity_t *e, qboolean allowskel);
|
||||||
entity_t *e,
|
void Alias_FlushCache(void);
|
||||||
float alpha, qboolean nolightdir);
|
|
||||||
|
|
||||||
void Mod_DoCRC(model_t *mod, char *buffer, int buffersize);
|
void Mod_DoCRC(model_t *mod, char *buffer, int buffersize);
|
||||||
|
|
||||||
|
|
|
@ -1405,9 +1405,9 @@ static void World_Physics_Frame_BodyToEntity(world_t *world, wedict_t *ed)
|
||||||
up[2] = r[10];
|
up[2] = r[10];
|
||||||
VectorCopy(vel, velocity);
|
VectorCopy(vel, velocity);
|
||||||
VectorCopy(avel, spinvelocity);
|
VectorCopy(avel, spinvelocity);
|
||||||
Matrix4Q_FromVectors(bodymatrix, forward, left, up, origin);
|
Matrix4x4_RM_FromVectors(bodymatrix, forward, left, up, origin);
|
||||||
Matrix4_Multiply(ed->ode.ode_offsetimatrix, bodymatrix, entitymatrix);
|
Matrix4_Multiply(ed->ode.ode_offsetimatrix, bodymatrix, entitymatrix);
|
||||||
Matrix4Q_ToVectors(entitymatrix, forward, left, up, origin);
|
Matrix3x4_RM_ToVectors(entitymatrix, forward, left, up, origin);
|
||||||
|
|
||||||
VectorAngles(forward, up, angles);
|
VectorAngles(forward, up, angles);
|
||||||
angles[0]*=-1;
|
angles[0]*=-1;
|
||||||
|
@ -1847,7 +1847,7 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
|
||||||
switch(solid)
|
switch(solid)
|
||||||
{
|
{
|
||||||
case SOLID_BSP:
|
case SOLID_BSP:
|
||||||
Matrix4_Identity(ed->ode.ode_offsetmatrix);
|
Matrix4x4_Identity(ed->ode.ode_offsetmatrix);
|
||||||
ed->ode.ode_geom = NULL;
|
ed->ode.ode_geom = NULL;
|
||||||
if (!model)
|
if (!model)
|
||||||
{
|
{
|
||||||
|
@ -1863,7 +1863,7 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Matrix4Q_CreateTranslate(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2]);
|
Matrix4x4_RM_CreateTranslate(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2]);
|
||||||
// now create the geom
|
// now create the geom
|
||||||
dataID = dGeomTriMeshDataCreate();
|
dataID = dGeomTriMeshDataCreate();
|
||||||
dGeomTriMeshDataBuildSingle(dataID, (void*)ed->ode.ode_vertex3f, sizeof(float[3]), ed->ode.ode_numvertices, ed->ode.ode_element3i, ed->ode.ode_numtriangles*3, sizeof(int[3]));
|
dGeomTriMeshDataBuildSingle(dataID, (void*)ed->ode.ode_vertex3f, sizeof(float[3]), ed->ode.ode_numvertices, ed->ode.ode_element3i, ed->ode.ode_numtriangles*3, sizeof(int[3]));
|
||||||
|
@ -1874,12 +1874,12 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
|
||||||
case SOLID_SLIDEBOX:
|
case SOLID_SLIDEBOX:
|
||||||
case SOLID_CORPSE:
|
case SOLID_CORPSE:
|
||||||
case SOLID_PHYSICS_BOX:
|
case SOLID_PHYSICS_BOX:
|
||||||
Matrix4Q_CreateTranslate(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2]);
|
Matrix4x4_RM_CreateTranslate(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2]);
|
||||||
ed->ode.ode_geom = (void *)dCreateBox(world->ode.ode_space, geomsize[0], geomsize[1], geomsize[2]);
|
ed->ode.ode_geom = (void *)dCreateBox(world->ode.ode_space, geomsize[0], geomsize[1], geomsize[2]);
|
||||||
dMassSetBoxTotal(&mass, massval, geomsize[0], geomsize[1], geomsize[2]);
|
dMassSetBoxTotal(&mass, massval, geomsize[0], geomsize[1], geomsize[2]);
|
||||||
break;
|
break;
|
||||||
case SOLID_PHYSICS_SPHERE:
|
case SOLID_PHYSICS_SPHERE:
|
||||||
Matrix4Q_CreateTranslate(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2]);
|
Matrix4x4_RM_CreateTranslate(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2]);
|
||||||
ed->ode.ode_geom = (void *)dCreateSphere(world->ode.ode_space, geomsize[0] * 0.5f);
|
ed->ode.ode_geom = (void *)dCreateSphere(world->ode.ode_space, geomsize[0] * 0.5f);
|
||||||
dMassSetSphereTotal(&mass, massval, geomsize[0] * 0.5f);
|
dMassSetSphereTotal(&mass, massval, geomsize[0] * 0.5f);
|
||||||
break;
|
break;
|
||||||
|
@ -1895,11 +1895,11 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
|
||||||
// transform to it
|
// transform to it
|
||||||
memset(capsulerot, 0, sizeof(capsulerot));
|
memset(capsulerot, 0, sizeof(capsulerot));
|
||||||
if (axisindex == 0)
|
if (axisindex == 0)
|
||||||
Matrix4_ModelMatrix(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2], 0, 0, 90, 1);
|
Matrix4x4_CM_ModelMatrix(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2], 0, 0, 90, 1);
|
||||||
else if (axisindex == 1)
|
else if (axisindex == 1)
|
||||||
Matrix4_ModelMatrix(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2], 90, 0, 0, 1);
|
Matrix4x4_CM_ModelMatrix(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2], 90, 0, 0, 1);
|
||||||
else
|
else
|
||||||
Matrix4_ModelMatrix(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2], 0, 0, 0, 1);
|
Matrix4x4_CM_ModelMatrix(ed->ode.ode_offsetmatrix, geomcenter[0], geomcenter[1], geomcenter[2], 0, 0, 0, 1);
|
||||||
radius = geomsize[!axisindex] * 0.5f; // any other axis is the radius
|
radius = geomsize[!axisindex] * 0.5f; // any other axis is the radius
|
||||||
length = geomsize[axisindex] - radius*2;
|
length = geomsize[axisindex] - radius*2;
|
||||||
// because we want to support more than one axisindex, we have to
|
// because we want to support more than one axisindex, we have to
|
||||||
|
@ -1911,7 +1911,7 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
|
||||||
default:
|
default:
|
||||||
Sys_Error("World_Physics_BodyFromEntity: unrecognized solid value %i was accepted by filter\n", solid);
|
Sys_Error("World_Physics_BodyFromEntity: unrecognized solid value %i was accepted by filter\n", solid);
|
||||||
}
|
}
|
||||||
Matrix4Q_Invert_Simple(ed->ode.ode_offsetmatrix, ed->ode.ode_offsetimatrix);
|
Matrix3x4_InvertTo4x4_Simple(ed->ode.ode_offsetmatrix, ed->ode.ode_offsetimatrix);
|
||||||
ed->ode.ode_massbuf = BZ_Malloc(sizeof(dMass));
|
ed->ode.ode_massbuf = BZ_Malloc(sizeof(dMass));
|
||||||
memcpy(ed->ode.ode_massbuf, &mass, sizeof(dMass));
|
memcpy(ed->ode.ode_massbuf, &mass, sizeof(dMass));
|
||||||
}
|
}
|
||||||
|
@ -2065,9 +2065,9 @@ static void World_Physics_Frame_BodyFromEntity(world_t *world, wedict_t *ed)
|
||||||
VectorCopy(avelocity, ed->ode.ode_avelocity);
|
VectorCopy(avelocity, ed->ode.ode_avelocity);
|
||||||
ed->ode.ode_gravity = gravity;
|
ed->ode.ode_gravity = gravity;
|
||||||
|
|
||||||
Matrix4Q_FromVectors(entitymatrix, forward, left, up, origin);
|
Matrix4x4_RM_FromVectors(entitymatrix, forward, left, up, origin);
|
||||||
Matrix4_Multiply(ed->ode.ode_offsetmatrix, entitymatrix, bodymatrix);
|
Matrix4_Multiply(ed->ode.ode_offsetmatrix, entitymatrix, bodymatrix);
|
||||||
Matrix4Q_ToVectors(bodymatrix, forward, left, up, origin);
|
Matrix3x4_RM_ToVectors(bodymatrix, forward, left, up, origin);
|
||||||
r[0][0] = forward[0];
|
r[0][0] = forward[0];
|
||||||
r[1][0] = forward[1];
|
r[1][0] = forward[1];
|
||||||
r[2][0] = forward[2];
|
r[2][0] = forward[2];
|
||||||
|
|
|
@ -92,7 +92,8 @@ cvar_t registered = CVARD("registered","0","Set if quake's pak1.pak is available
|
||||||
cvar_t gameversion = CVARFD("gameversion","", CVAR_SERVERINFO, "gamecode version for server browsers");
|
cvar_t gameversion = CVARFD("gameversion","", CVAR_SERVERINFO, "gamecode version for server browsers");
|
||||||
cvar_t gameversion_min = CVARD("gameversion_min","", "gamecode version for server browsers");
|
cvar_t gameversion_min = CVARD("gameversion_min","", "gamecode version for server browsers");
|
||||||
cvar_t gameversion_max = CVARD("gameversion_max","", "gamecode version for server browsers");
|
cvar_t gameversion_max = CVARD("gameversion_max","", "gamecode version for server browsers");
|
||||||
cvar_t com_gamename = CVARD("com_gamename", "", "The game name used for dpmaster queries");
|
cvar_t fs_gamename = CVARFD("fs_gamename", "", CVAR_NOSET, "The filesystem is trying to run this game");
|
||||||
|
cvar_t com_protocolname = CVARD("com_gamename", "", "The game name used for dpmaster queries");
|
||||||
cvar_t com_modname = CVARD("com_modname", "", "dpmaster information");
|
cvar_t com_modname = CVARD("com_modname", "", "dpmaster information");
|
||||||
cvar_t com_parseutf8 = CVARD("com_parseutf8", "0", "Interpret console messages/playernames/etc as UTF-8. Requires special fonts."); //1 parse. 2 parse, but stop parsing that string if a char was malformed.
|
cvar_t com_parseutf8 = CVARD("com_parseutf8", "0", "Interpret console messages/playernames/etc as UTF-8. Requires special fonts."); //1 parse. 2 parse, but stop parsing that string if a char was malformed.
|
||||||
|
|
||||||
|
|
|
@ -432,6 +432,7 @@ void Info_SetValueForStarKey (char *s, const char *key, const char *value, int m
|
||||||
void Info_Print (char *s);
|
void Info_Print (char *s);
|
||||||
void Info_WriteToFile(vfsfile_t *f, char *info, char *commandname, int cvarflags);
|
void Info_WriteToFile(vfsfile_t *f, char *info, char *commandname, int cvarflags);
|
||||||
|
|
||||||
|
void Com_BlocksChecksum (int blocks, void **buffer, int *len, unsigned char *outbuf);
|
||||||
unsigned int Com_BlockChecksum (void *buffer, int length);
|
unsigned int Com_BlockChecksum (void *buffer, int length);
|
||||||
void Com_BlockFullChecksum (void *buffer, int len, unsigned char *outbuf);
|
void Com_BlockFullChecksum (void *buffer, int len, unsigned char *outbuf);
|
||||||
qbyte COM_BlockSequenceCheckByte (qbyte *base, int length, int sequence, unsigned mapchecksum);
|
qbyte COM_BlockSequenceCheckByte (qbyte *base, int length, int sequence, unsigned mapchecksum);
|
||||||
|
|
|
@ -659,8 +659,8 @@ cvar_t *Cvar_SetCore (cvar_t *var, const char *value, qboolean force)
|
||||||
#ifndef CLIENTONLY
|
#ifndef CLIENTONLY
|
||||||
if (var->flags & CVAR_SERVERINFO)
|
if (var->flags & CVAR_SERVERINFO)
|
||||||
{
|
{
|
||||||
char *old = Info_ValueForKey(svs.info, var->name);
|
// char *old = Info_ValueForKey(svs.info, var->name);
|
||||||
if (strcmp(old, value)) //only spam the server if it actually changed
|
// if (strcmp(old, value)) //only spam the server if it actually changed
|
||||||
{
|
{
|
||||||
Info_SetValueForKey (svs.info, var->name, value, MAX_SERVERINFO_STRING);
|
Info_SetValueForKey (svs.info, var->name, value, MAX_SERVERINFO_STRING);
|
||||||
SV_SendServerInfoChange(var->name, value);
|
SV_SendServerInfoChange(var->name, value);
|
||||||
|
|
|
@ -1665,7 +1665,9 @@ const gamemode_info_t gamemode_info[] = {
|
||||||
{"Darkplaces-Rogue", "rogue", "-rogue", {NULL}, NULL, {"id1", "qw", "rogue", "fte"}, "Quake: Dissolution of Eternity"},
|
{"Darkplaces-Rogue", "rogue", "-rogue", {NULL}, NULL, {"id1", "qw", "rogue", "fte"}, "Quake: Dissolution of Eternity"},
|
||||||
{"Nexuiz", "nexuiz", "-nexuiz", {"nexuiz.exe"}, NEXCFG, {"data", "ftedata"}, "Nexuiz"},
|
{"Nexuiz", "nexuiz", "-nexuiz", {"nexuiz.exe"}, NEXCFG, {"data", "ftedata"}, "Nexuiz"},
|
||||||
{"Xonotic", "xonotic", "-xonotic", {"xonotic.exe"}, NEXCFG, {"data", "ftedata"}, "Xonotic"},
|
{"Xonotic", "xonotic", "-xonotic", {"xonotic.exe"}, NEXCFG, {"data", "ftedata"}, "Xonotic"},
|
||||||
{"DMF", "dmf", "-dmf", {"base/src/progs.src"}, DMFCFG, {"base", }, "DMF"},
|
{"DMF", "dmf", "-dmf", {"base/src/progs.src",
|
||||||
|
"base/qwprogs.dat",
|
||||||
|
"base/pak0.pak"}, DMFCFG, {"base", }, "DMF"},
|
||||||
|
|
||||||
//supported commercial mods (some are currently only partially supported)
|
//supported commercial mods (some are currently only partially supported)
|
||||||
{"FTE-H2MP", "h2mp", "-portals", {"portals/hexen.rc",
|
{"FTE-H2MP", "h2mp", "-portals", {"portals/hexen.rc",
|
||||||
|
@ -1673,12 +1675,14 @@ const gamemode_info_t gamemode_info[] = {
|
||||||
{"FTE-Hexen2", "hexen2", "-hexen2", {"data1/pak0.pak"}, HEX2CFG,{"data1", "fteh2"}, "Hexen II"},
|
{"FTE-Hexen2", "hexen2", "-hexen2", {"data1/pak0.pak"}, HEX2CFG,{"data1", "fteh2"}, "Hexen II"},
|
||||||
{"FTE-Quake2", "q2", "-q2", {"baseq2/pak0.pak"}, NULL, {"baseq2", "fteq2"}, "Quake II"},
|
{"FTE-Quake2", "q2", "-q2", {"baseq2/pak0.pak"}, NULL, {"baseq2", "fteq2"}, "Quake II"},
|
||||||
{"FTE-Quake3", "q3", "-q3", {"baseq3/pak0.pk3"}, Q3CFG, {"baseq3", "fteq3"}, "Quake III Arena"},
|
{"FTE-Quake3", "q3", "-q3", {"baseq3/pak0.pk3"}, Q3CFG, {"baseq3", "fteq3"}, "Quake III Arena"},
|
||||||
|
|
||||||
|
//the rest are not officially supported.
|
||||||
{"FTE-Quake4", "q4", "-q4", {"q4base/pak00.pk4"}, NULL, {"q4base", "fteq4"}, "Quake 4"},
|
{"FTE-Quake4", "q4", "-q4", {"q4base/pak00.pk4"}, NULL, {"q4base", "fteq4"}, "Quake 4"},
|
||||||
{"FTE-EnemyTerritory", "et", "-et", {"etmain/pak0.pk3"}, NULL, {"etmain", "fteet"}, "Wolfenstein - Enemy Territory"},
|
{"FTE-EnemyTerritory", "et", "-et", {"etmain/pak0.pk3"}, NULL, {"etmain", "fteet"}, "Wolfenstein - Enemy Territory"},
|
||||||
|
|
||||||
{"FTE-JK2", "jk2", "-jk2", {"base/assets0.pk3"}, NULL, {"base", "fte"}, "Jedi Knight II: Jedi Outcast"},
|
{"FTE-JK2", "jk2", "-jk2", {"base/assets0.pk3"}, NULL, {"base", "fte"}, "Jedi Knight II: Jedi Outcast"},
|
||||||
|
|
||||||
{"FTE-HalfLife", "hl", "-halflife", {"valve/liblist.gam"} ,NULL, {"valve", "ftehl"}, "Half-Life"},
|
{"FTE-HalfLife", "hl", "-halflife", {"valve/liblist.gam"}, NULL, {"valve", "ftehl"}, "Half-Life"},
|
||||||
|
|
||||||
{NULL}
|
{NULL}
|
||||||
};
|
};
|
||||||
|
@ -2145,7 +2149,8 @@ void FS_StartupWithGame(int gamenum)
|
||||||
LibZ_Init();
|
LibZ_Init();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Cvar_Set(&com_gamename, gamemode_info[gamenum].protocolname);
|
Cvar_Set(&com_protocolname, gamemode_info[gamenum].protocolname);
|
||||||
|
Cvar_ForceSet(&fs_gamename, gamemode_info[gamenum].poshname);
|
||||||
|
|
||||||
//
|
//
|
||||||
// start up with id1 by default
|
// start up with id1 by default
|
||||||
|
@ -2258,8 +2263,9 @@ void COM_InitFilesystem (void)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Cvar_Register(&com_gamename, "evil hacks");
|
Cvar_Register(&fs_gamename, "FS");
|
||||||
Cvar_Register(&com_modname, "evil hacks");
|
Cvar_Register(&com_protocolname, "Server Info");
|
||||||
|
Cvar_Register(&com_modname, "Server Info");
|
||||||
//identify the game from a telling file
|
//identify the game from a telling file
|
||||||
for (i = 0; gamemode_info[i].argname && gamenum==-1; i++)
|
for (i = 0; gamemode_info[i].argname && gamenum==-1; i++)
|
||||||
{
|
{
|
||||||
|
|
|
@ -2230,7 +2230,7 @@ qboolean CModQ3_LoadFaces (lump_t *l)
|
||||||
out->patch_cp[1] = LittleLong ( in->patchheight );
|
out->patch_cp[1] = LittleLong ( in->patchheight );
|
||||||
}
|
}
|
||||||
|
|
||||||
loadmodel->numsurfaces = i;\
|
loadmodel->numsurfaces = i;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2507,9 +2507,7 @@ qboolean CModQ3_LoadRFaces (lump_t *l)
|
||||||
out->light_t = LittleLong(in->lightmap_y);
|
out->light_t = LittleLong(in->lightmap_y);
|
||||||
out->extents[0] = (LittleLong(in->lightmap_width)-1)<<4;
|
out->extents[0] = (LittleLong(in->lightmap_width)-1)<<4;
|
||||||
out->extents[1] = (LittleLong(in->lightmap_height)-1)<<4;
|
out->extents[1] = (LittleLong(in->lightmap_height)-1)<<4;
|
||||||
out->samples = loadmodel->lightdata + 3*(out->light_s + out->light_t*128 + out->lightmaptexturenum*128*128);
|
out->samples=NULL;
|
||||||
if (out->lightmaptexturenum<0)
|
|
||||||
out->samples=NULL;
|
|
||||||
|
|
||||||
fv = LittleLong(in->firstvertex);
|
fv = LittleLong(in->firstvertex);
|
||||||
{
|
{
|
||||||
|
@ -2628,8 +2626,8 @@ qboolean CModQ3_LoadRFaces (lump_t *l)
|
||||||
Vector4Copy(mesh->colors4b_array[0], mesh->colors4b_array[2]);
|
Vector4Copy(mesh->colors4b_array[0], mesh->colors4b_array[2]);
|
||||||
Vector4Copy(mesh->colors4b_array[0], mesh->colors4b_array[3]);
|
Vector4Copy(mesh->colors4b_array[0], mesh->colors4b_array[3]);
|
||||||
}
|
}
|
||||||
if (out->mesh->numindexes == 0)
|
if (out->mesh->numindexes == 0)
|
||||||
Con_Printf("foo\n");
|
Con_Printf("foo\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
Mod_NormaliseTextureVectors(map_normals_array, map_svector_array, map_tvector_array, numvertexes);
|
Mod_NormaliseTextureVectors(map_normals_array, map_svector_array, map_tvector_array, numvertexes);
|
||||||
|
@ -2677,9 +2675,7 @@ qboolean CModRBSP_LoadRFaces (lump_t *l)
|
||||||
out->light_t = in->lightmap_offs[0][0];
|
out->light_t = in->lightmap_offs[0][0];
|
||||||
out->extents[0] = (in->lightmap_width-1)<<4;
|
out->extents[0] = (in->lightmap_width-1)<<4;
|
||||||
out->extents[1] = (in->lightmap_height-1)<<4;
|
out->extents[1] = (in->lightmap_height-1)<<4;
|
||||||
out->samples = loadmodel->lightdata + 3*(out->light_s + out->light_t*128 + out->lightmaptexturenum*128*128);
|
out->samples=NULL;
|
||||||
if (out->lightmaptexturenum<0)
|
|
||||||
out->samples=NULL;
|
|
||||||
|
|
||||||
fv = LittleLong(in->firstvertex);
|
fv = LittleLong(in->firstvertex);
|
||||||
{
|
{
|
||||||
|
|
|
@ -844,7 +844,7 @@ void QuaternionSlerp( const vec4_t p, vec4_t q, float t, vec4_t qt )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
//This function is GL stylie (use as 2nd arg to ML_MultMatrix4).
|
//This function is GL stylie (use as 2nd arg to ML_MultMatrix4).
|
||||||
float *Matrix4_NewRotation(float a, float x, float y, float z)
|
float *Matrix4x4_CM_NewRotation(float a, float x, float y, float z)
|
||||||
{
|
{
|
||||||
static float ret[16];
|
static float ret[16];
|
||||||
float c = cos(a* M_PI / 180.0);
|
float c = cos(a* M_PI / 180.0);
|
||||||
|
@ -873,7 +873,7 @@ float *Matrix4_NewRotation(float a, float x, float y, float z)
|
||||||
}
|
}
|
||||||
|
|
||||||
//This function is GL stylie (use as 2nd arg to ML_MultMatrix4).
|
//This function is GL stylie (use as 2nd arg to ML_MultMatrix4).
|
||||||
float *Matrix4_NewTranslation(float x, float y, float z)
|
float *Matrix4x4_CM_NewTranslation(float x, float y, float z)
|
||||||
{
|
{
|
||||||
static float ret[16];
|
static float ret[16];
|
||||||
ret[0] = 1;
|
ret[0] = 1;
|
||||||
|
@ -923,7 +923,7 @@ void Matrix4_Multiply(const float *a, const float *b, float *out)
|
||||||
}
|
}
|
||||||
|
|
||||||
//transform 4d vector by a 4d matrix.
|
//transform 4d vector by a 4d matrix.
|
||||||
void Matrix4_Transform4(const float *matrix, const float *vector, float *product)
|
void Matrix4x4_CM_Transform4(const float *matrix, const float *vector, float *product)
|
||||||
{
|
{
|
||||||
product[0] = matrix[0]*vector[0] + matrix[4]*vector[1] + matrix[8]*vector[2] + matrix[12]*vector[3];
|
product[0] = matrix[0]*vector[0] + matrix[4]*vector[1] + matrix[8]*vector[2] + matrix[12]*vector[3];
|
||||||
product[1] = matrix[1]*vector[0] + matrix[5]*vector[1] + matrix[9]*vector[2] + matrix[13]*vector[3];
|
product[1] = matrix[1]*vector[0] + matrix[5]*vector[1] + matrix[9]*vector[2] + matrix[13]*vector[3];
|
||||||
|
@ -931,14 +931,14 @@ void Matrix4_Transform4(const float *matrix, const float *vector, float *product
|
||||||
product[3] = matrix[3]*vector[0] + matrix[7]*vector[1] + matrix[11]*vector[2] + matrix[15]*vector[3];
|
product[3] = matrix[3]*vector[0] + matrix[7]*vector[1] + matrix[11]*vector[2] + matrix[15]*vector[3];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4_Transform3(const float *matrix, const float *vector, float *product)
|
void Matrix4x4_CM_Transform3(const float *matrix, const float *vector, float *product)
|
||||||
{
|
{
|
||||||
product[0] = matrix[0]*vector[0] + matrix[4]*vector[1] + matrix[8]*vector[2] + matrix[12];
|
product[0] = matrix[0]*vector[0] + matrix[4]*vector[1] + matrix[8]*vector[2] + matrix[12];
|
||||||
product[1] = matrix[1]*vector[0] + matrix[5]*vector[1] + matrix[9]*vector[2] + matrix[13];
|
product[1] = matrix[1]*vector[0] + matrix[5]*vector[1] + matrix[9]*vector[2] + matrix[13];
|
||||||
product[2] = matrix[2]*vector[0] + matrix[6]*vector[1] + matrix[10]*vector[2] + matrix[14];
|
product[2] = matrix[2]*vector[0] + matrix[6]*vector[1] + matrix[10]*vector[2] + matrix[14];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4_ModelViewMatrix(float *modelview, const vec3_t viewangles, const vec3_t vieworg)
|
void Matrix4x4_CM_ModelViewMatrix(float *modelview, const vec3_t viewangles, const vec3_t vieworg)
|
||||||
{
|
{
|
||||||
float tempmat[16];
|
float tempmat[16];
|
||||||
//load identity.
|
//load identity.
|
||||||
|
@ -949,8 +949,8 @@ void Matrix4_ModelViewMatrix(float *modelview, const vec3_t viewangles, const ve
|
||||||
modelview[10] = 1;
|
modelview[10] = 1;
|
||||||
modelview[15] = 1;
|
modelview[15] = 1;
|
||||||
|
|
||||||
Matrix4_Multiply(modelview, Matrix4_NewRotation(-90, 1, 0, 0), tempmat); // put Z going up
|
Matrix4_Multiply(modelview, Matrix4_CM_NewRotation(-90, 1, 0, 0), tempmat); // put Z going up
|
||||||
Matrix4_Multiply(tempmat, Matrix4_NewRotation(90, 0, 0, 1), modelview); // put Z going up
|
Matrix4_Multiply(tempmat, Matrix4_CM_NewRotation(90, 0, 0, 1), modelview); // put Z going up
|
||||||
#else
|
#else
|
||||||
//use this lame wierd and crazy identity matrix..
|
//use this lame wierd and crazy identity matrix..
|
||||||
modelview[2] = -1;
|
modelview[2] = -1;
|
||||||
|
@ -961,19 +961,37 @@ void Matrix4_ModelViewMatrix(float *modelview, const vec3_t viewangles, const ve
|
||||||
//figure out the current modelview matrix
|
//figure out the current modelview matrix
|
||||||
|
|
||||||
//I would if some of these, but then I'd still need a couple of copys
|
//I would if some of these, but then I'd still need a couple of copys
|
||||||
Matrix4_Multiply(modelview, Matrix4_NewRotation(-viewangles[2], 1, 0, 0), tempmat);
|
Matrix4_Multiply(modelview, Matrix4x4_CM_NewRotation(-viewangles[2], 1, 0, 0), tempmat);
|
||||||
Matrix4_Multiply(tempmat, Matrix4_NewRotation(-viewangles[0], 0, 1, 0), modelview);
|
Matrix4_Multiply(tempmat, Matrix4x4_CM_NewRotation(-viewangles[0], 0, 1, 0), modelview);
|
||||||
Matrix4_Multiply(modelview, Matrix4_NewRotation(-viewangles[1], 0, 0, 1), tempmat);
|
Matrix4_Multiply(modelview, Matrix4x4_CM_NewRotation(-viewangles[1], 0, 0, 1), tempmat);
|
||||||
|
|
||||||
Matrix4_Multiply(tempmat, Matrix4_NewTranslation(-vieworg[0], -vieworg[1], -vieworg[2]), modelview); // put Z going up
|
Matrix4_Multiply(tempmat, Matrix4x4_CM_NewTranslation(-vieworg[0], -vieworg[1], -vieworg[2]), modelview); // put Z going up
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4_CreateTranslate (float *out, float x, float y, float z)
|
void Matrix4x4_CM_CreateTranslate (float *out, float x, float y, float z)
|
||||||
{
|
{
|
||||||
memcpy(out, Matrix4_NewTranslation(x, y, z), 16*sizeof(float));
|
out[0] = 1;
|
||||||
|
out[1] = 0;
|
||||||
|
out[2] = 0;
|
||||||
|
out[3] = 0;
|
||||||
|
|
||||||
|
out[4] = 0;
|
||||||
|
out[5] = 1;
|
||||||
|
out[6] = 0;
|
||||||
|
out[7] = 0;
|
||||||
|
|
||||||
|
out[8] = 0;
|
||||||
|
out[9] = 0;
|
||||||
|
out[10] = 1;
|
||||||
|
out[11] = 0;
|
||||||
|
|
||||||
|
out[12] = x;
|
||||||
|
out[13] = y;
|
||||||
|
out[14] = z;
|
||||||
|
out[15] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4Q_CreateTranslate (float *out, float x, float y, float z)
|
void Matrix4x4_RM_CreateTranslate (float *out, float x, float y, float z)
|
||||||
{
|
{
|
||||||
out[0] = 1;
|
out[0] = 1;
|
||||||
out[4] = 0;
|
out[4] = 0;
|
||||||
|
@ -996,7 +1014,7 @@ void Matrix4Q_CreateTranslate (float *out, float x, float y, float z)
|
||||||
out[15] = 1;
|
out[15] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4_ModelViewMatrixFromAxis(float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg)
|
void Matrix4x4_CM_ModelViewMatrixFromAxis(float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg)
|
||||||
{
|
{
|
||||||
float tempmat[16];
|
float tempmat[16];
|
||||||
|
|
||||||
|
@ -1017,11 +1035,11 @@ void Matrix4_ModelViewMatrixFromAxis(float *modelview, const vec3_t pn, const ve
|
||||||
tempmat[14] = 0;
|
tempmat[14] = 0;
|
||||||
tempmat[15] = 1;
|
tempmat[15] = 1;
|
||||||
|
|
||||||
Matrix4_Multiply(tempmat, Matrix4_NewTranslation(-vieworg[0], -vieworg[1], -vieworg[2]), modelview); // put Z going up
|
Matrix4_Multiply(tempmat, Matrix4x4_CM_NewTranslation(-vieworg[0], -vieworg[1], -vieworg[2]), modelview); // put Z going up
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Matrix4Q_ToVectors(const float *in, float vx[3], float vy[3], float vz[3], float t[3])
|
void Matrix3x4_RM_ToVectors(const float *in, float vx[3], float vy[3], float vz[3], float t[3])
|
||||||
{
|
{
|
||||||
vx[0] = in[0];
|
vx[0] = in[0];
|
||||||
vx[1] = in[4];
|
vx[1] = in[4];
|
||||||
|
@ -1040,7 +1058,7 @@ void Matrix4Q_ToVectors(const float *in, float vx[3], float vy[3], float vz[3],
|
||||||
t [2] = in[11];
|
t [2] = in[11];
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4Q_FromVectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3])
|
void Matrix4x4_RM_FromVectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3])
|
||||||
{
|
{
|
||||||
out[0] = vx[0];
|
out[0] = vx[0];
|
||||||
out[1] = vy[0];
|
out[1] = vy[0];
|
||||||
|
@ -1060,7 +1078,23 @@ void Matrix4Q_FromVectors(float *out, const float vx[3], const float vy[3], cons
|
||||||
out[15] = 1.0f;
|
out[15] = 1.0f;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4_ModelMatrixFromAxis(float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg)
|
void Matrix3x4_RM_FromVectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3])
|
||||||
|
{
|
||||||
|
out[0] = vx[0];
|
||||||
|
out[1] = vy[0];
|
||||||
|
out[2] = vz[0];
|
||||||
|
out[3] = t[0];
|
||||||
|
out[4] = vx[1];
|
||||||
|
out[5] = vy[1];
|
||||||
|
out[6] = vz[1];
|
||||||
|
out[7] = t[1];
|
||||||
|
out[8] = vx[2];
|
||||||
|
out[9] = vy[2];
|
||||||
|
out[10] = vz[2];
|
||||||
|
out[11] = t[2];
|
||||||
|
}
|
||||||
|
|
||||||
|
void Matrix4x4_CM_ModelMatrixFromAxis(float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg)
|
||||||
{
|
{
|
||||||
float tempmat[16];
|
float tempmat[16];
|
||||||
|
|
||||||
|
@ -1081,10 +1115,10 @@ void Matrix4_ModelMatrixFromAxis(float *modelview, const vec3_t pn, const vec3_t
|
||||||
tempmat[14] = 0;
|
tempmat[14] = 0;
|
||||||
tempmat[15] = 1;
|
tempmat[15] = 1;
|
||||||
|
|
||||||
Matrix4_Multiply(Matrix4_NewTranslation(vieworg[0], vieworg[1], vieworg[2]), tempmat, modelview); // put Z going up
|
Matrix4_Multiply(Matrix4x4_CM_NewTranslation(vieworg[0], vieworg[1], vieworg[2]), tempmat, modelview); // put Z going up
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4_ModelMatrix(float *modelview, vec_t x, vec_t y, vec_t z, vec_t pitch, vec_t yaw, vec_t roll, vec_t scale)
|
void Matrix4x4_CM_ModelMatrix(float *modelview, vec_t x, vec_t y, vec_t z, vec_t pitch, vec_t yaw, vec_t roll, vec_t scale)
|
||||||
{
|
{
|
||||||
float tempmat[16];
|
float tempmat[16];
|
||||||
//load identity.
|
//load identity.
|
||||||
|
@ -1095,8 +1129,8 @@ void Matrix4_ModelMatrix(float *modelview, vec_t x, vec_t y, vec_t z, vec_t pitc
|
||||||
modelview[10] = 1;
|
modelview[10] = 1;
|
||||||
modelview[15] = 1;
|
modelview[15] = 1;
|
||||||
|
|
||||||
Matrix4_Multiply(modelview, Matrix4_NewRotation(-90, 1, 0, 0), tempmat); // put Z going up
|
Matrix4_Multiply(modelview, Matrix4x4_CM_NewRotation(-90, 1, 0, 0), tempmat); // put Z going up
|
||||||
Matrix4_Multiply(tempmat, Matrix4_NewRotation(90, 0, 0, 1), modelview); // put Z going up
|
Matrix4_Multiply(tempmat, Matrix4x4_CM_NewRotation(90, 0, 0, 1), modelview); // put Z going up
|
||||||
#else
|
#else
|
||||||
//use this lame wierd and crazy identity matrix..
|
//use this lame wierd and crazy identity matrix..
|
||||||
modelview[2] = -1;
|
modelview[2] = -1;
|
||||||
|
@ -1107,14 +1141,14 @@ void Matrix4_ModelMatrix(float *modelview, vec_t x, vec_t y, vec_t z, vec_t pitc
|
||||||
//figure out the current modelview matrix
|
//figure out the current modelview matrix
|
||||||
|
|
||||||
//I would if some of these, but then I'd still need a couple of copys
|
//I would if some of these, but then I'd still need a couple of copys
|
||||||
Matrix4_Multiply(modelview, Matrix4_NewRotation(-roll, 1, 0, 0), tempmat);
|
Matrix4_Multiply(modelview, Matrix4x4_CM_NewRotation(-roll, 1, 0, 0), tempmat);
|
||||||
Matrix4_Multiply(tempmat, Matrix4_NewRotation(-pitch, 0, 1, 0), modelview);
|
Matrix4_Multiply(tempmat, Matrix4x4_CM_NewRotation(-pitch, 0, 1, 0), modelview);
|
||||||
Matrix4_Multiply(modelview, Matrix4_NewRotation(-yaw, 0, 0, 1), tempmat);
|
Matrix4_Multiply(modelview, Matrix4x4_CM_NewRotation(-yaw, 0, 0, 1), tempmat);
|
||||||
|
|
||||||
Matrix4_Multiply(tempmat, Matrix4_NewTranslation(x, y, z), modelview);
|
Matrix4_Multiply(tempmat, Matrix4x4_CM_NewTranslation(x, y, z), modelview);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4_Identity(float *outm)
|
void Matrix4x4_Identity(float *outm)
|
||||||
{
|
{
|
||||||
outm[ 0] = 1;
|
outm[ 0] = 1;
|
||||||
outm[ 1] = 0;
|
outm[ 1] = 0;
|
||||||
|
@ -1134,7 +1168,7 @@ void Matrix4_Identity(float *outm)
|
||||||
outm[15] = 1;
|
outm[15] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4_Projection_Far(float *proj, float fovx, float fovy, float neard, float fard)
|
void Matrix4x4_CM_Projection_Far(float *proj, float fovx, float fovy, float neard, float fard)
|
||||||
{
|
{
|
||||||
double xmin, xmax, ymin, ymax;
|
double xmin, xmax, ymin, ymax;
|
||||||
|
|
||||||
|
@ -1174,7 +1208,7 @@ void Matrix4_Projection_Far(float *proj, float fovx, float fovy, float neard, fl
|
||||||
proj[15] = 0;
|
proj[15] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4_Projection_Inf(float *proj, float fovx, float fovy, float neard)
|
void Matrix4x4_CM_Projection_Inf(float *proj, float fovx, float fovy, float neard)
|
||||||
{
|
{
|
||||||
float xmin, xmax, ymin, ymax;
|
float xmin, xmax, ymin, ymax;
|
||||||
float nudge = 1;
|
float nudge = 1;
|
||||||
|
@ -1214,7 +1248,7 @@ void Matrix4_Projection_Inf(float *proj, float fovx, float fovy, float neard)
|
||||||
proj[11] = -1;
|
proj[11] = -1;
|
||||||
proj[15] = 0;
|
proj[15] = 0;
|
||||||
}
|
}
|
||||||
void Matrix4_Projection2(float *proj, float fovx, float fovy, float neard)
|
void Matrix4x4_CM_Projection2(float *proj, float fovx, float fovy, float neard)
|
||||||
{
|
{
|
||||||
float xmin, xmax, ymin, ymax;
|
float xmin, xmax, ymin, ymax;
|
||||||
float nudge = 1;
|
float nudge = 1;
|
||||||
|
@ -1247,7 +1281,7 @@ void Matrix4_Projection2(float *proj, float fovx, float fovy, float neard)
|
||||||
proj[15] = 0;
|
proj[15] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4_Orthographic(float *proj, float xmin, float xmax, float ymin, float ymax,
|
void Matrix4x4_CM_Orthographic(float *proj, float xmin, float xmax, float ymin, float ymax,
|
||||||
float znear, float zfar)
|
float znear, float zfar)
|
||||||
{
|
{
|
||||||
proj[0] = 2/(xmax-xmin);
|
proj[0] = 2/(xmax-xmin);
|
||||||
|
@ -1270,7 +1304,7 @@ void Matrix4_Orthographic(float *proj, float xmin, float xmax, float ymin, float
|
||||||
proj[11] = 0;
|
proj[11] = 0;
|
||||||
proj[15] = 1;
|
proj[15] = 1;
|
||||||
}
|
}
|
||||||
void Matrix4_OrthographicD3D(float *proj, float xmin, float xmax, float ymax, float ymin,
|
void Matrix4x4_CM_OrthographicD3D(float *proj, float xmin, float xmax, float ymax, float ymin,
|
||||||
float znear, float zfar)
|
float znear, float zfar)
|
||||||
{
|
{
|
||||||
proj[0] = 2/(xmax-xmin);
|
proj[0] = 2/(xmax-xmin);
|
||||||
|
@ -1472,7 +1506,7 @@ qboolean Matrix4_Invert(const float *m, float *out)
|
||||||
#undef SWAP_ROWS
|
#undef SWAP_ROWS
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix3_Invert_Simple (const vec3_t in1[3], vec3_t out[3])
|
void Matrix3x3_RM_Invert_Simple (const vec3_t in1[3], vec3_t out[3])
|
||||||
{
|
{
|
||||||
// we only support uniform scaling, so assume the first row is enough
|
// we only support uniform scaling, so assume the first row is enough
|
||||||
// (note the lack of sqrt here, because we're trying to undo the scaling,
|
// (note the lack of sqrt here, because we're trying to undo the scaling,
|
||||||
|
@ -1503,7 +1537,7 @@ void Matrix3_Invert_Simple (const vec3_t in1[3], vec3_t out[3])
|
||||||
out[2][2] = in1[2][2] * scale;
|
out[2][2] = in1[2][2] * scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix4Q_Invert_Simple (const float *in1, float *out)
|
void Matrix3x4_Invert_Simple (const float *in1, float *out)
|
||||||
{
|
{
|
||||||
// we only support uniform scaling, so assume the first row is enough
|
// we only support uniform scaling, so assume the first row is enough
|
||||||
// (note the lack of sqrt here, because we're trying to undo the scaling,
|
// (note the lack of sqrt here, because we're trying to undo the scaling,
|
||||||
|
@ -1531,29 +1565,19 @@ void Matrix4Q_Invert_Simple (const float *in1, float *out)
|
||||||
out[9] = in1[6] * scale;
|
out[9] = in1[6] * scale;
|
||||||
out[10] = in1[10] * scale;
|
out[10] = in1[10] * scale;
|
||||||
|
|
||||||
#ifdef MATRIX4x4_OPENGLORIENTATION
|
|
||||||
// invert the translate
|
|
||||||
out->m[12] = -(in1[12] * out[0] + in1[13] * out[4] + in1[14] * out[8]);
|
|
||||||
out->m[13] = -(in1[12] * out[1] + in1[13] * out[5] + in1[14] * out[9]);
|
|
||||||
out->m[14] = -(in1[12] * out[2] + in1[13] * out[6] + in1[14] * out[10]);
|
|
||||||
|
|
||||||
// don't know if there's anything worth doing here
|
|
||||||
out[3] = 0;
|
|
||||||
out[7] = 0;
|
|
||||||
out[11] = 0;
|
|
||||||
out[15] = 1;
|
|
||||||
#else
|
|
||||||
// invert the translate
|
// invert the translate
|
||||||
out[3] = -(in1[3] * out[0] + in1[7] * out[1] + in1[11] * out[2]);
|
out[3] = -(in1[3] * out[0] + in1[7] * out[1] + in1[11] * out[2]);
|
||||||
out[7] = -(in1[3] * out[4] + in1[7] * out[5] + in1[11] * out[6]);
|
out[7] = -(in1[3] * out[4] + in1[7] * out[5] + in1[11] * out[6]);
|
||||||
out[11] = -(in1[3] * out[8] + in1[7] * out[9] + in1[11] * out[10]);
|
out[11] = -(in1[3] * out[8] + in1[7] * out[9] + in1[11] * out[10]);
|
||||||
|
}
|
||||||
|
|
||||||
// don't know if there's anything worth doing here
|
void Matrix3x4_InvertTo4x4_Simple (const float *in1, float *out)
|
||||||
|
{
|
||||||
|
Matrix3x4_Invert_Simple(in1, out);
|
||||||
out[12] = 0;
|
out[12] = 0;
|
||||||
out[13] = 0;
|
out[13] = 0;
|
||||||
out[14] = 0;
|
out[14] = 0;
|
||||||
out[15] = 1;
|
out[15] = 1;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Matrix3x4_InvertTo3x3(float *in, float *result)
|
void Matrix3x4_InvertTo3x3(float *in, float *result)
|
||||||
|
@ -1590,14 +1614,14 @@ void Matrix3x4_InvertTo3x3(float *in, float *result)
|
||||||
|
|
||||||
//screen->3d
|
//screen->3d
|
||||||
|
|
||||||
void Matrix4_UnProject(const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy)
|
void Matrix4x4_CM_UnProject(const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy)
|
||||||
{
|
{
|
||||||
float modelview[16];
|
float modelview[16];
|
||||||
float proj[16];
|
float proj[16];
|
||||||
float tempm[16];
|
float tempm[16];
|
||||||
|
|
||||||
Matrix4_ModelViewMatrix(modelview, viewangles, vieworg);
|
Matrix4x4_CM_ModelViewMatrix(modelview, viewangles, vieworg);
|
||||||
Matrix4_Projection_Inf(proj, fovx, fovy, 4);
|
Matrix4x4_CM_Projection_Inf(proj, fovx, fovy, 4);
|
||||||
Matrix4_Multiply(proj, modelview, tempm);
|
Matrix4_Multiply(proj, modelview, tempm);
|
||||||
|
|
||||||
Matrix4_Invert(tempm, proj);
|
Matrix4_Invert(tempm, proj);
|
||||||
|
@ -1613,7 +1637,7 @@ void Matrix4_UnProject(const vec3_t in, vec3_t out, const vec3_t viewangles, con
|
||||||
if (v[2] >= 1)
|
if (v[2] >= 1)
|
||||||
v[2] = 0.999999;
|
v[2] = 0.999999;
|
||||||
|
|
||||||
Matrix4_Transform4(proj, v, tempv);
|
Matrix4x4_CM_Transform4(proj, v, tempv);
|
||||||
|
|
||||||
out[0] = tempv[0]/tempv[3];
|
out[0] = tempv[0]/tempv[3];
|
||||||
out[1] = tempv[1]/tempv[3];
|
out[1] = tempv[1]/tempv[3];
|
||||||
|
@ -1624,13 +1648,13 @@ void Matrix4_UnProject(const vec3_t in, vec3_t out, const vec3_t viewangles, con
|
||||||
//returns fractions of screen.
|
//returns fractions of screen.
|
||||||
//uses GL style rotations and translations and stuff.
|
//uses GL style rotations and translations and stuff.
|
||||||
//3d -> screen (fixme: offscreen return values needed)
|
//3d -> screen (fixme: offscreen return values needed)
|
||||||
void Matrix4_Project (const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy)
|
void Matrix4x4_CM_Project (const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy)
|
||||||
{
|
{
|
||||||
float modelview[16];
|
float modelview[16];
|
||||||
float proj[16];
|
float proj[16];
|
||||||
|
|
||||||
Matrix4_ModelViewMatrix(modelview, viewangles, vieworg);
|
Matrix4x4_CM_ModelViewMatrix(modelview, viewangles, vieworg);
|
||||||
Matrix4_Projection_Inf(proj, fovx, fovy, 4);
|
Matrix4x4_CM_Projection_Inf(proj, fovx, fovy, 4);
|
||||||
|
|
||||||
{
|
{
|
||||||
float v[4], tempv[4];
|
float v[4], tempv[4];
|
||||||
|
@ -1639,8 +1663,8 @@ void Matrix4_Project (const vec3_t in, vec3_t out, const vec3_t viewangles, cons
|
||||||
v[2] = in[2];
|
v[2] = in[2];
|
||||||
v[3] = 1;
|
v[3] = 1;
|
||||||
|
|
||||||
Matrix4_Transform4(modelview, v, tempv);
|
Matrix4x4_CM_Transform4(modelview, v, tempv);
|
||||||
Matrix4_Transform4(proj, tempv, v);
|
Matrix4x4_CM_Transform4(proj, tempv, v);
|
||||||
|
|
||||||
v[0] /= v[3];
|
v[0] /= v[3];
|
||||||
v[1] /= v[3];
|
v[1] /= v[3];
|
||||||
|
|
|
@ -129,34 +129,46 @@ vec_t Length (vec3_t v);
|
||||||
void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up);
|
void MakeNormalVectors (vec3_t forward, vec3_t right, vec3_t up);
|
||||||
float Q_rsqrt(float number);
|
float Q_rsqrt(float number);
|
||||||
|
|
||||||
//used for crosshair stuff.
|
/*
|
||||||
|
_CM means column major.
|
||||||
|
_RM means row major
|
||||||
|
Note that openGL is column-major.
|
||||||
|
Logical C code uses row-major.
|
||||||
|
mat3x4 is always row-major (and functions can accept many RM mat4x4)
|
||||||
|
*/
|
||||||
|
|
||||||
void Matrix3_Multiply (vec3_t *in1, vec3_t *in2, vec3_t *out);
|
void Matrix3_Multiply (vec3_t *in1, vec3_t *in2, vec3_t *out);
|
||||||
void Matrix4_Identity(float *outm);
|
void Matrix4x4_Identity(float *outm);
|
||||||
qboolean Matrix4_Invert(const float *m, float *out);
|
qboolean Matrix4_Invert(const float *m, float *out);
|
||||||
void Matrix4Q_Invert_Simple (const float *in1, float *out);
|
void Matrix3x4_Invert_Simple (const float *in1, float *out);
|
||||||
void Matrix3_Invert_Simple(const vec3_t in[3], vec3_t out[3]);
|
void Matrix3x4_InvertTo4x4_Simple (const float *in1, float *out);
|
||||||
void Matrix4_CreateTranslate (float *out, float x, float y, float z);
|
void Matrix3x3_RM_Invert_Simple(const vec3_t in[3], vec3_t out[3]);
|
||||||
void Matrix4Q_CreateTranslate (float *out, float x, float y, float z);
|
void Matrix4x4_RM_CreateTranslate (float *out, float x, float y, float z);
|
||||||
void Matrix4_ModelMatrixFromAxis (float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg);
|
void Matrix4x4_CM_CreateTranslate (float *out, float x, float y, float z);
|
||||||
void Matrix4_ModelMatrix(float *modelview, vec_t x, vec_t y, vec_t z, vec_t pitch, vec_t yaw, vec_t roll, vec_t scale);
|
void Matrix4x4_CM_ModelMatrixFromAxis (float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg);
|
||||||
void Matrix4_ModelViewMatrix (float *modelview, const vec3_t viewangles, const vec3_t vieworg);
|
void Matrix4x4_CM_ModelMatrix(float *modelview, vec_t x, vec_t y, vec_t z, vec_t pitch, vec_t yaw, vec_t roll, vec_t scale);
|
||||||
void Matrix4_ModelViewMatrixFromAxis (float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg);
|
void Matrix4x4_CM_ModelViewMatrix (float *modelview, const vec3_t viewangles, const vec3_t vieworg);
|
||||||
|
void Matrix4x4_CM_ModelViewMatrixFromAxis (float *modelview, const vec3_t pn, const vec3_t right, const vec3_t up, const vec3_t vieworg);
|
||||||
void Matrix4_CreateFromQuakeEntity (float *matrix, float x, float y, float z, float pitch, float yaw, float roll, float scale);
|
void Matrix4_CreateFromQuakeEntity (float *matrix, float x, float y, float z, float pitch, float yaw, float roll, float scale);
|
||||||
void Matrix4_Multiply (const float *a, const float *b, float *out);
|
void Matrix4_Multiply (const float *a, const float *b, float *out);
|
||||||
void Matrix4_Project (const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy);
|
void Matrix4x4_CM_Project (const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy);
|
||||||
void Matrix4_Transform3 (const float *matrix, const float *vector, float *product);
|
void Matrix4x4_CM_Transform3 (const float *matrix, const float *vector, float *product);
|
||||||
void Matrix4_Transform4 (const float *matrix, const float *vector, float *product);
|
void Matrix4x4_CM_Transform4 (const float *matrix, const float *vector, float *product);
|
||||||
void Matrix4_UnProject (const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy);
|
void Matrix4x4_CM_UnProject (const vec3_t in, vec3_t out, const vec3_t viewangles, const vec3_t vieworg, float fovx, float fovy);
|
||||||
void Matrix4Q_FromVectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3]);
|
void Matrix3x4_RM_FromVectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3]);
|
||||||
void Matrix4Q_ToVectors(const float *in, float vx[3], float vy[3], float vz[3], float t[3]);
|
void Matrix4x4_RM_FromVectors(float *out, const float vx[3], const float vy[3], const float vz[3], const float t[3]);
|
||||||
|
void Matrix3x4_RM_ToVectors(const float *in, float vx[3], float vy[3], float vz[3], float t[3]);
|
||||||
|
|
||||||
|
float *Matrix4x4_CM_NewRotation(float a, float x, float y, float z);
|
||||||
|
float *Matrix4x4_CM_NewTranslation(float x, float y, float z);
|
||||||
|
|
||||||
#define AngleVectorsFLU(a,f,l,u) do{AngleVectors(a,f,l,u);VectorNegate(l,l);}while(0)
|
#define AngleVectorsFLU(a,f,l,u) do{AngleVectors(a,f,l,u);VectorNegate(l,l);}while(0)
|
||||||
|
|
||||||
//projection matricies of different types... gesh
|
//projection matricies of different types... gesh
|
||||||
void Matrix4_Orthographic (float *proj, float xmin, float xmax, float ymax, float ymin, float znear, float zfar);
|
void Matrix4x4_CM_Orthographic (float *proj, float xmin, float xmax, float ymax, float ymin, float znear, float zfar);
|
||||||
void Matrix4_Projection_Far(float *proj, float fovx, float fovy, float neard, float fard);
|
void Matrix4x4_CM_Projection_Far(float *proj, float fovx, float fovy, float neard, float fard);
|
||||||
void Matrix4_Projection2 (float *proj, float fovx, float fovy, float neard);
|
void Matrix4x4_CM_Projection2 (float *proj, float fovx, float fovy, float neard);
|
||||||
void Matrix4_Projection_Inf(float *proj, float fovx, float fovy, float neard);
|
void Matrix4x4_CM_Projection_Inf(float *proj, float fovx, float fovy, float neard);
|
||||||
|
|
||||||
fixed16_t Mul16_30 (fixed16_t multiplier, fixed16_t multiplicand);
|
fixed16_t Mul16_30 (fixed16_t multiplier, fixed16_t multiplicand);
|
||||||
int Q_log2 (int val);
|
int Q_log2 (int val);
|
||||||
|
|
|
@ -300,3 +300,16 @@ void Com_BlockFullChecksum (void *buffer, int len, unsigned char *outbuf)
|
||||||
MD4Update (&ctx, (unsigned char *)buffer, len);
|
MD4Update (&ctx, (unsigned char *)buffer, len);
|
||||||
MD4Final ( outbuf, &ctx);
|
MD4Final ( outbuf, &ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Com_BlocksChecksum (int blocks, void **buffer, int *len, unsigned char *outbuf)
|
||||||
|
{
|
||||||
|
MD4_CTX ctx;
|
||||||
|
|
||||||
|
MD4Init (&ctx);
|
||||||
|
while(blocks --> 0)
|
||||||
|
{
|
||||||
|
MD4Update (&ctx, (unsigned char *)*buffer++, *len++);
|
||||||
|
}
|
||||||
|
MD4Final (outbuf, &ctx);
|
||||||
|
}
|
||||||
|
|
|
@ -99,6 +99,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define PROTOCOL_VERSION_HUFFMAN (('H'<<0) + ('U'<<8) + ('F'<<16) + ('F' << 24)) //packet compression
|
#define PROTOCOL_VERSION_HUFFMAN (('H'<<0) + ('U'<<8) + ('F'<<16) + ('F' << 24)) //packet compression
|
||||||
#define PROTOCOL_VERSION_VARLENGTH (('v'<<0) + ('l'<<8) + ('e'<<16) + ('n' << 24)) //packet compression
|
#define PROTOCOL_VERSION_VARLENGTH (('v'<<0) + ('l'<<8) + ('e'<<16) + ('n' << 24)) //packet compression
|
||||||
|
|
||||||
|
#define PROTOCOL_INFO_GUID (('G'<<0) + ('U'<<8) + ('I'<<16) + ('D' << 24)) //globally 'unique' client id info.
|
||||||
|
|
||||||
#define PROTOCOL_VERSION_QW 28
|
#define PROTOCOL_VERSION_QW 28
|
||||||
#define PROTOCOL_VERSION_Q2_MIN 31
|
#define PROTOCOL_VERSION_Q2_MIN 31
|
||||||
#define PROTOCOL_VERSION_Q2 34
|
#define PROTOCOL_VERSION_Q2 34
|
||||||
|
|
|
@ -444,7 +444,7 @@ qboolean Q1BSP_Trace(model_t *model, int forcehullnum, int frame, vec3_t axis[3]
|
||||||
{
|
{
|
||||||
vec3_t iaxis[3];
|
vec3_t iaxis[3];
|
||||||
vec3_t norm;
|
vec3_t norm;
|
||||||
Matrix3_Invert_Simple((void *)axis, iaxis);
|
Matrix3x3_RM_Invert_Simple((void *)axis, iaxis);
|
||||||
VectorCopy(trace->plane.normal, norm);
|
VectorCopy(trace->plane.normal, norm);
|
||||||
trace->plane.normal[0] = DotProduct(norm, iaxis[0]);
|
trace->plane.normal[0] = DotProduct(norm, iaxis[0]);
|
||||||
trace->plane.normal[1] = DotProduct(norm, iaxis[1]);
|
trace->plane.normal[1] = DotProduct(norm, iaxis[1]);
|
||||||
|
|
|
@ -1061,6 +1061,16 @@ void *VM_MemoryBase(vm_t *vm)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
quintptr_t VM_MemoryMask(vm_t *vm)
|
||||||
|
{
|
||||||
|
switch(vm->type)
|
||||||
|
{
|
||||||
|
case VM_BYTECODE:
|
||||||
|
return ((qvm_t*)vm->hInst)->ds_mask;
|
||||||
|
default:
|
||||||
|
return ~(quintptr_t)0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*returns true if we're running a 32bit vm on a 64bit host (in case we need workarounds)*/
|
/*returns true if we're running a 32bit vm on a 64bit host (in case we need workarounds)*/
|
||||||
qboolean VM_NonNative(vm_t *vm)
|
qboolean VM_NonNative(vm_t *vm)
|
||||||
|
|
|
@ -63,6 +63,7 @@ qboolean LibPNG_Init(void);
|
||||||
|
|
||||||
unsigned int Sys_Milliseconds (void);
|
unsigned int Sys_Milliseconds (void);
|
||||||
double Sys_DoubleTime (void);
|
double Sys_DoubleTime (void);
|
||||||
|
qboolean Sys_RandomBytes(qbyte *string, int len);
|
||||||
|
|
||||||
char *Sys_ConsoleInput (void);
|
char *Sys_ConsoleInput (void);
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
"STL_VOTE \"%s casts a vote for '%s'\\n\"\n"
|
"STL_VOTE \"%s casts a vote for '%s'\\n\"\n"
|
||||||
"STL_SPEEDCHEATKICKED \"%s was kicked for speedcheating (%s)\\n\"\n"
|
"STL_SPEEDCHEATKICKED \"%s was kicked for speedcheating (%s)\\n\"\n"
|
||||||
"STL_SPEEDCHEATPOSSIBLE \"Speed cheat possibility, analyzing:\\n %d %.1f %d for: %s\\n\"\n"
|
"STL_SPEEDCHEATPOSSIBLE \"Speed cheat possibility, analyzing:\\n %d %.1f %d for: %s\\n\"\n"
|
||||||
"STL_INITED \"======== QuakeWorld Initialized ========\\n\"\n"
|
"STL_INITED \"======== %s Initialized ========\\n\"\n"
|
||||||
"STL_BACKBUFSET \"WARNING %s: [SV_New] Back buffered (%d0, clearing)\\n\"\n"
|
"STL_BACKBUFSET \"WARNING %s: [SV_New] Back buffered (%d0, clearing)\\n\"\n"
|
||||||
"STL_MESSAGEOVERFLOW \"WARNING: backbuf [%d] reliable overflow for %s\\n\"\n"
|
"STL_MESSAGEOVERFLOW \"WARNING: backbuf [%d] reliable overflow for %s\\n\"\n"
|
||||||
"STL_BUILDINGPHS \"Building PHS...\\n\"\n"
|
"STL_BUILDINGPHS \"Building PHS...\\n\"\n"
|
||||||
|
|
|
@ -74,7 +74,7 @@ static char *defaultlanguagetext =
|
||||||
"STL_VOTE \"%s casts a vote for '%s'\\n\"\n"
|
"STL_VOTE \"%s casts a vote for '%s'\\n\"\n"
|
||||||
"STL_SPEEDCHEATKICKED \"%s was kicked for speedcheating (%s)\\n\"\n"
|
"STL_SPEEDCHEATKICKED \"%s was kicked for speedcheating (%s)\\n\"\n"
|
||||||
"STL_SPEEDCHEATPOSSIBLE \"Speed cheat possibility, analyzing:\\n %d %.1f %d for: %s\\n\"\n"
|
"STL_SPEEDCHEATPOSSIBLE \"Speed cheat possibility, analyzing:\\n %d %.1f %d for: %s\\n\"\n"
|
||||||
"STL_INITED \"======== FTE QuakeWorld Initialized ========\\n\"\n"
|
"STL_INITED \"======== %s Initialized ========\\n\"\n"
|
||||||
"STL_BACKBUFSET \"WARNING %s: [SV_New] Back buffered (%d0, clearing)\\n\"\n"
|
"STL_BACKBUFSET \"WARNING %s: [SV_New] Back buffered (%d0, clearing)\\n\"\n"
|
||||||
"STL_MESSAGEOVERFLOW \"WARNING: backbuf [%d] reliable overflow for %s\\n\"\n"
|
"STL_MESSAGEOVERFLOW \"WARNING: backbuf [%d] reliable overflow for %s\\n\"\n"
|
||||||
"STL_BUILDINGPHS \"Building PHS...\\n\"\n"
|
"STL_BUILDINGPHS \"Building PHS...\\n\"\n"
|
||||||
|
@ -230,7 +230,7 @@ static char *defaultlanguagetext =
|
||||||
"TLC_HOSTFATALERROR \"Host_Error: %s\\n\"\n"
|
"TLC_HOSTFATALERROR \"Host_Error: %s\\n\"\n"
|
||||||
"TLC_CONFIGCFG_WRITEFAILED \"Couldn't write config.cfg.\\n\"\n"
|
"TLC_CONFIGCFG_WRITEFAILED \"Couldn't write config.cfg.\\n\"\n"
|
||||||
"TLC_HOSTSPEEDSOUTPUT \"%3i tot %3i server %3i gfx %3i snd\\n\"\n"
|
"TLC_HOSTSPEEDSOUTPUT \"%3i tot %3i server %3i gfx %3i snd\\n\"\n"
|
||||||
"TLC_QUAKEWORLD_INITED \"^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081 QuakeWorld Initialized ^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082\\n\"\n"
|
"TLC_QUAKEWORLD_INITED \"^Ue080^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081 %s Initialized ^Ue081^Ue081^Ue081^Ue081^Ue081^Ue081^Ue082\\n\"\n"
|
||||||
"TLC_DEDICATEDCANNOTCONNECT \"Connect ignored - dedicated. set a renderer first\\n\"\n"
|
"TLC_DEDICATEDCANNOTCONNECT \"Connect ignored - dedicated. set a renderer first\\n\"\n"
|
||||||
"TLC_Q2CONLESSPACKET_UNKNOWN \"unknown connectionless packet for q2: %s\\n\"\n"
|
"TLC_Q2CONLESSPACKET_UNKNOWN \"unknown connectionless packet for q2: %s\\n\"\n"
|
||||||
"TL_NORELATIVEPATHS \"Refusing to download a path with ..\\n\"\n"
|
"TL_NORELATIVEPATHS \"Refusing to download a path with ..\\n\"\n"
|
||||||
|
|
|
@ -59,6 +59,7 @@ qboolean VM_Restart(vm_t *vm);
|
||||||
qintptr_t VARGS VM_Call(vm_t *vm, qintptr_t instruction, ...);
|
qintptr_t VARGS VM_Call(vm_t *vm, qintptr_t instruction, ...);
|
||||||
qboolean VM_NonNative(vm_t *vm);
|
qboolean VM_NonNative(vm_t *vm);
|
||||||
void *VM_MemoryBase(vm_t *vm);
|
void *VM_MemoryBase(vm_t *vm);
|
||||||
|
quintptr_t VM_MemoryMask(vm_t *vm);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ typedef struct q2trace_s
|
||||||
#define MOVE_HITMODEL 4
|
#define MOVE_HITMODEL 4
|
||||||
#define MOVE_RESERVED 8 //so we are less likly to get into tricky situations when we want to steal annother future DP extension.
|
#define MOVE_RESERVED 8 //so we are less likly to get into tricky situations when we want to steal annother future DP extension.
|
||||||
#define MOVE_TRIGGERS 16 //triggers must be marked with FINDABLE_NONSOLID (an alternative to solid-corpse)
|
#define MOVE_TRIGGERS 16 //triggers must be marked with FINDABLE_NONSOLID (an alternative to solid-corpse)
|
||||||
#define MOVE_EVERYTHING 32 //doesn't use the area grid stuff, and can return triggers and non-solid items if they're marked with FINDABLE_NONSOLID
|
#define MOVE_EVERYTHING 32 //can return triggers and non-solid items if they're marked with FINDABLE_NONSOLID (works even if the items are not properly linked)
|
||||||
#define MOVE_LAGGED 64 //trace touches current last-known-state, instead of actual ents (just affects players for now)
|
#define MOVE_LAGGED 64 //trace touches current last-known-state, instead of actual ents (just affects players for now)
|
||||||
|
|
||||||
typedef struct areanode_s
|
typedef struct areanode_s
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "quakedef.h"
|
#include "quakedef.h"
|
||||||
|
#include "glquake.h"
|
||||||
#ifdef D3DQUAKE
|
#ifdef D3DQUAKE
|
||||||
#include "shader.h"
|
#include "shader.h"
|
||||||
#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500)
|
#if !defined(HMONITOR_DECLARED) && (WINVER < 0x0500)
|
||||||
|
@ -780,7 +781,7 @@ static void colourgenbyte(const shaderpass_t *pass, int cnt, byte_vec4_t *src, b
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R_LightArraysByte_BGR(mesh->xyz_array, dst, cnt, mesh->normals_array);
|
R_LightArraysByte_BGR(shaderstate.curentity , mesh->xyz_array, dst, cnt, mesh->normals_array);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RGB_GEN_WAVE:
|
case RGB_GEN_WAVE:
|
||||||
|
@ -1979,7 +1980,6 @@ static void BE_RotateForEntity (const entity_t *e, const model_t *mod)
|
||||||
|
|
||||||
if (e->flags & Q2RF_WEAPONMODEL && r_refdef.currentplayernum>=0)
|
if (e->flags & Q2RF_WEAPONMODEL && r_refdef.currentplayernum>=0)
|
||||||
{
|
{
|
||||||
float *Matrix4_NewRotation(float a, float x, float y, float z);
|
|
||||||
/*FIXME: no bob*/
|
/*FIXME: no bob*/
|
||||||
float iv[16];
|
float iv[16];
|
||||||
Matrix4_Invert(r_refdef.m_view, iv);
|
Matrix4_Invert(r_refdef.m_view, iv);
|
||||||
|
@ -2438,6 +2438,8 @@ void D3DBE_DrawWorld (qbyte *vis)
|
||||||
RSpeedEnd(RSPEED_DRAWENTITIES);
|
RSpeedEnd(RSPEED_DRAWENTITIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GLR_RenderDlights ();
|
||||||
|
|
||||||
BE_RotateForEntity(&r_worldentity, NULL);
|
BE_RotateForEntity(&r_worldentity, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1042,6 +1042,7 @@
|
||||||
UseOfMFC="0"
|
UseOfMFC="0"
|
||||||
ATLMinimizesCRunTimeLibraryUsage="false"
|
ATLMinimizesCRunTimeLibraryUsage="false"
|
||||||
CharacterSet="2"
|
CharacterSet="2"
|
||||||
|
WholeProgramOptimization="1"
|
||||||
>
|
>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCPreBuildEventTool"
|
Name="VCPreBuildEventTool"
|
||||||
|
@ -1067,8 +1068,10 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="2"
|
Optimization="2"
|
||||||
InlineFunctionExpansion="1"
|
InlineFunctionExpansion="2"
|
||||||
AdditionalIncludeDirectories="../libs/speex,..\client,../libs/freetype2/include,../common,../server,../gl,../sw,../qclib,../libs,../libs/dxsdk7/include"
|
FavorSizeOrSpeed="1"
|
||||||
|
OmitFramePointers="true"
|
||||||
|
AdditionalIncludeDirectories="../libs/speex;..\client;../libs/freetype2/include;../common;../server;../gl;../sw;../qclib;../libs;../libs/dxsdk9/include;../libs/dxsdk7/include"
|
||||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;GLQUAKE;D3DQUAKE"
|
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;GLQUAKE;D3DQUAKE"
|
||||||
StringPooling="true"
|
StringPooling="true"
|
||||||
RuntimeLibrary="0"
|
RuntimeLibrary="0"
|
||||||
|
@ -1080,7 +1083,6 @@
|
||||||
AssemblerListingLocation=".\MRelease/"
|
AssemblerListingLocation=".\MRelease/"
|
||||||
ObjectFile=".\MRelease/"
|
ObjectFile=".\MRelease/"
|
||||||
ProgramDataBaseFileName=".\MRelease/"
|
ProgramDataBaseFileName=".\MRelease/"
|
||||||
BrowseInformation="2"
|
|
||||||
BrowseInformationFile=".\MRelease/"
|
BrowseInformationFile=".\MRelease/"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="true"
|
||||||
DisableSpecificWarnings="4996"
|
DisableSpecificWarnings="4996"
|
||||||
|
@ -1103,11 +1105,13 @@
|
||||||
LinkIncremental="1"
|
LinkIncremental="1"
|
||||||
SuppressStartupBanner="true"
|
SuppressStartupBanner="true"
|
||||||
AdditionalLibraryDirectories="../libs/dxsdk7/lib"
|
AdditionalLibraryDirectories="../libs/dxsdk7/lib"
|
||||||
|
GenerateManifest="false"
|
||||||
IgnoreDefaultLibraryNames="libc.lib;msvcrt.lib"
|
IgnoreDefaultLibraryNames="libc.lib;msvcrt.lib"
|
||||||
GenerateMapFile="true"
|
GenerateMapFile="true"
|
||||||
MapFileName=".\MRelease/fteqw.map"
|
MapFileName=".\MRelease/fteqw.map"
|
||||||
SubSystem="2"
|
SubSystem="2"
|
||||||
TargetMachine="1"
|
TargetMachine="1"
|
||||||
|
Profile="false"
|
||||||
/>
|
/>
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCALinkTool"
|
Name="VCALinkTool"
|
||||||
|
@ -27618,6 +27622,194 @@
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
|
<File
|
||||||
|
RelativePath="..\gl\gl_rlight.c"
|
||||||
|
>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="MinGLDebug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="MinGLDebug|x64"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="D3DDebug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="D3DDebug|x64"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="MinGLRelease|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="MinGLRelease|x64"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="GLDebug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="GLDebug|x64"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release Dedicated Server|Win32"
|
||||||
|
ExcludedFromBuild="true"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Release Dedicated Server|x64"
|
||||||
|
ExcludedFromBuild="true"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="MRelease|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="MRelease|x64"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug Dedicated Server|Win32"
|
||||||
|
ExcludedFromBuild="true"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="Debug Dedicated Server|x64"
|
||||||
|
ExcludedFromBuild="true"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="MDebug|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="MDebug|x64"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="GLRelease|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="GLRelease|x64"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="D3DRelease|Win32"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
<FileConfiguration
|
||||||
|
Name="D3DRelease|x64"
|
||||||
|
>
|
||||||
|
<Tool
|
||||||
|
Name="VCCLCompilerTool"
|
||||||
|
AdditionalIncludeDirectories=""
|
||||||
|
PreprocessorDefinitions=""
|
||||||
|
/>
|
||||||
|
</FileConfiguration>
|
||||||
|
</File>
|
||||||
<File
|
<File
|
||||||
RelativePath="..\gl\gl_shader.c"
|
RelativePath="..\gl\gl_shader.c"
|
||||||
>
|
>
|
||||||
|
@ -29524,194 +29716,6 @@
|
||||||
/>
|
/>
|
||||||
</FileConfiguration>
|
</FileConfiguration>
|
||||||
</File>
|
</File>
|
||||||
<File
|
|
||||||
RelativePath="..\gl\gl_rlight.c"
|
|
||||||
>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="MinGLDebug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="MinGLDebug|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="D3DDebug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="D3DDebug|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="MinGLRelease|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="MinGLRelease|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="GLDebug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="GLDebug|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release Dedicated Server|Win32"
|
|
||||||
ExcludedFromBuild="true"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Release Dedicated Server|x64"
|
|
||||||
ExcludedFromBuild="true"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="MRelease|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="MRelease|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug Dedicated Server|Win32"
|
|
||||||
ExcludedFromBuild="true"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="Debug Dedicated Server|x64"
|
|
||||||
ExcludedFromBuild="true"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="MDebug|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="MDebug|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="GLRelease|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="GLRelease|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="D3DRelease|Win32"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
<FileConfiguration
|
|
||||||
Name="D3DRelease|x64"
|
|
||||||
>
|
|
||||||
<Tool
|
|
||||||
Name="VCCLCompilerTool"
|
|
||||||
AdditionalIncludeDirectories=""
|
|
||||||
PreprocessorDefinitions=""
|
|
||||||
/>
|
|
||||||
</FileConfiguration>
|
|
||||||
</File>
|
|
||||||
<File
|
<File
|
||||||
RelativePath="..\gl\gl_rmain.c"
|
RelativePath="..\gl\gl_rmain.c"
|
||||||
>
|
>
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
#include <alloca.h>
|
#include <alloca.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define MAX_BONES 256
|
|
||||||
|
|
||||||
#include "com_mesh.h"
|
#include "com_mesh.h"
|
||||||
|
|
||||||
//FIXME
|
//FIXME
|
||||||
|
@ -186,7 +184,7 @@ static texnums_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum,
|
||||||
if (e->skinnum >= 100 && e->skinnum < 110)
|
if (e->skinnum >= 100 && e->skinnum < 110)
|
||||||
{
|
{
|
||||||
shader_t *s;
|
shader_t *s;
|
||||||
s = R_RegisterSkin(va("gfx/skin%d.lmp", e->skinnum));
|
s = R_RegisterSkin(va("gfx/skin%d.lmp", e->skinnum), NULL);
|
||||||
if (!TEXVALID(s->defaulttextures.base))
|
if (!TEXVALID(s->defaulttextures.base))
|
||||||
s->defaulttextures.base = R_LoadHiResTexture(va("gfx/skin%d.lmp", e->skinnum), NULL, 0);
|
s->defaulttextures.base = R_LoadHiResTexture(va("gfx/skin%d.lmp", e->skinnum), NULL, 0);
|
||||||
s->defaulttextures.shader = s;
|
s->defaulttextures.shader = s;
|
||||||
|
@ -306,7 +304,7 @@ static texnums_t *GL_ChooseSkin(galiasinfo_t *inf, model_t *model, int surfnum,
|
||||||
cm->texnum.base = r_nulltex;
|
cm->texnum.base = r_nulltex;
|
||||||
cm->texnum.loweroverlay = r_nulltex;
|
cm->texnum.loweroverlay = r_nulltex;
|
||||||
cm->texnum.upperoverlay = r_nulltex;
|
cm->texnum.upperoverlay = r_nulltex;
|
||||||
cm->texnum.shader = texnums?texnums->shader:R_RegisterSkin(skinname);
|
cm->texnum.shader = texnums?texnums->shader:R_RegisterSkin(skinname, NULL);
|
||||||
|
|
||||||
if (!texnums)
|
if (!texnums)
|
||||||
{ //load just the skin
|
{ //load just the skin
|
||||||
|
@ -935,7 +933,7 @@ void R_GAlias_DrawBatch(batch_t *batch)
|
||||||
{
|
{
|
||||||
if (batch->surf_first == surfnum)
|
if (batch->surf_first == surfnum)
|
||||||
{
|
{
|
||||||
needrecolour = Alias_GAliasBuildMesh(&mesh, inf, e, e->shaderRGBAf[3], nolightdir);
|
needrecolour = Alias_GAliasBuildMesh(&mesh, inf, surfnum, e, true);
|
||||||
batch->mesh = &meshl;
|
batch->mesh = &meshl;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1321,6 +1319,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius)
|
||||||
galiasinfo_t *inf;
|
galiasinfo_t *inf;
|
||||||
mesh_t mesh;
|
mesh_t mesh;
|
||||||
vec3_t lightorg;
|
vec3_t lightorg;
|
||||||
|
int surfnum = 0;
|
||||||
|
|
||||||
if (clmodel->engineflags & (MDLF_FLAME | MDLF_BOLT))
|
if (clmodel->engineflags & (MDLF_FLAME | MDLF_BOLT))
|
||||||
return;
|
return;
|
||||||
|
@ -1342,7 +1341,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius)
|
||||||
{
|
{
|
||||||
if (inf->ofs_trineighbours)
|
if (inf->ofs_trineighbours)
|
||||||
{
|
{
|
||||||
Alias_GAliasBuildMesh(&mesh, inf, e, 1, true);
|
Alias_GAliasBuildMesh(&mesh, inf, surfnum, e, false);
|
||||||
R_CalcFacing(&mesh, lightorg);
|
R_CalcFacing(&mesh, lightorg);
|
||||||
R_ProjectShadowVolume(&mesh, lightorg);
|
R_ProjectShadowVolume(&mesh, lightorg);
|
||||||
R_DrawShadowVolume(&mesh);
|
R_DrawShadowVolume(&mesh);
|
||||||
|
@ -1352,6 +1351,8 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius)
|
||||||
inf = (galiasinfo_t*)((char *)inf + inf->nextsurf);
|
inf = (galiasinfo_t*)((char *)inf + inf->nextsurf);
|
||||||
else
|
else
|
||||||
inf = NULL;
|
inf = NULL;
|
||||||
|
|
||||||
|
surfnum++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1904,6 +1905,8 @@ void BE_GenModelBatches(batch_t **batches)
|
||||||
if (!r_drawentities.ival)
|
if (!r_drawentities.ival)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Alias_FlushCache();
|
||||||
|
|
||||||
#if defined(TERRAIN)
|
#if defined(TERRAIN)
|
||||||
if (cl.worldmodel && cl.worldmodel->type == mod_heightmap)
|
if (cl.worldmodel && cl.worldmodel->type == mod_heightmap)
|
||||||
GL_DrawHeightmapModel(batches, &r_worldentity);
|
GL_DrawHeightmapModel(batches, &r_worldentity);
|
||||||
|
|
|
@ -248,6 +248,7 @@ static const char LIGHTPASS_SHADER[] = "\
|
||||||
!!permu SPECULAR\n\
|
!!permu SPECULAR\n\
|
||||||
!!permu FULLBRIGHT\n\
|
!!permu FULLBRIGHT\n\
|
||||||
!!permu OFFSETMAPPING\n\
|
!!permu OFFSETMAPPING\n\
|
||||||
|
!!permu SKELETAL\n\
|
||||||
#define LIGHTPASS\n\
|
#define LIGHTPASS\n\
|
||||||
%s\n\
|
%s\n\
|
||||||
}\n\
|
}\n\
|
||||||
|
@ -640,7 +641,7 @@ static void BE_EnableShaderAttributes(unsigned int newm)
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
if (newm == shaderstate.sha_attr)
|
if (newm == shaderstate.sha_attr)
|
||||||
return;
|
return;
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 10; i++)
|
||||||
{
|
{
|
||||||
#ifndef FORCESTATE
|
#ifndef FORCESTATE
|
||||||
if ((newm^shaderstate.sha_attr) & (1u<<i))
|
if ((newm^shaderstate.sha_attr) & (1u<<i))
|
||||||
|
@ -791,6 +792,8 @@ static void RevertToKnownState(void)
|
||||||
qglDepthMask(GL_TRUE);
|
qglDepthMask(GL_TRUE);
|
||||||
|
|
||||||
qglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
qglColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
|
||||||
|
|
||||||
|
GL_DeSelectProgram();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PPL_RevertToKnownState(void)
|
void PPL_RevertToKnownState(void)
|
||||||
|
@ -1459,7 +1462,7 @@ static void colourgen(const shaderpass_t *pass, int cnt, vec4_t *src, vec4_t *ds
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
R_LightArrays(mesh->xyz_array, dst, cnt, mesh->normals_array);
|
R_LightArrays(shaderstate.curentity, mesh->xyz_array, dst, cnt, mesh->normals_array);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case RGB_GEN_WAVE:
|
case RGB_GEN_WAVE:
|
||||||
|
@ -2366,6 +2369,14 @@ static unsigned int BE_Program_Set_Attribute(const shaderprogparm_t *p, unsigned
|
||||||
GL_SelectVBO(shaderstate.sourcevbo->vbotvector);
|
GL_SelectVBO(shaderstate.sourcevbo->vbotvector);
|
||||||
qglVertexAttribPointer(p->handle[perm], 3, GL_FLOAT, GL_FALSE, sizeof(vec3_t), shaderstate.sourcevbo->tvector);
|
qglVertexAttribPointer(p->handle[perm], 3, GL_FLOAT, GL_FALSE, sizeof(vec3_t), shaderstate.sourcevbo->tvector);
|
||||||
return 1u<<p->handle[perm];
|
return 1u<<p->handle[perm];
|
||||||
|
case SP_ATTR_BONENUMS:
|
||||||
|
GL_SelectVBO(shaderstate.sourcevbo->vbobonenums);
|
||||||
|
qglVertexAttribPointer(p->handle[perm], 4, GL_UNSIGNED_BYTE, GL_FALSE, sizeof(byte_vec4_t), shaderstate.sourcevbo->bonenums);
|
||||||
|
return 1u<<p->handle[perm];
|
||||||
|
case SP_ATTR_BONEWEIGHTS:
|
||||||
|
GL_SelectVBO(shaderstate.sourcevbo->vboboneweights);
|
||||||
|
qglVertexAttribPointer(p->handle[perm], 4, GL_FLOAT, GL_FALSE, sizeof(vec4_t), shaderstate.sourcevbo->boneweights);
|
||||||
|
return 1u<<p->handle[perm];
|
||||||
|
|
||||||
case SP_VIEWMATRIX:
|
case SP_VIEWMATRIX:
|
||||||
qglUniformMatrix4fvARB(p->handle[perm], 1, false, r_refdef.m_view);
|
qglUniformMatrix4fvARB(p->handle[perm], 1, false, r_refdef.m_view);
|
||||||
|
@ -2383,7 +2394,7 @@ static unsigned int BE_Program_Set_Attribute(const shaderprogparm_t *p, unsigned
|
||||||
case SP_ENTMATRIX:
|
case SP_ENTMATRIX:
|
||||||
{
|
{
|
||||||
float m16[16];
|
float m16[16];
|
||||||
Matrix4_ModelMatrixFromAxis(m16, shaderstate.curentity->axis[0], shaderstate.curentity->axis[1], shaderstate.curentity->axis[2], shaderstate.curentity->origin);
|
Matrix4x4_CM_ModelMatrixFromAxis(m16, shaderstate.curentity->axis[0], shaderstate.curentity->axis[1], shaderstate.curentity->axis[2], shaderstate.curentity->origin);
|
||||||
/* VectorCopy(shaderstate.curentity->axis[0], m16+0);
|
/* VectorCopy(shaderstate.curentity->axis[0], m16+0);
|
||||||
m16[3] = 0;
|
m16[3] = 0;
|
||||||
VectorCopy(shaderstate.curentity->axis[1], m16+1);
|
VectorCopy(shaderstate.curentity->axis[1], m16+1);
|
||||||
|
@ -2396,7 +2407,11 @@ static unsigned int BE_Program_Set_Attribute(const shaderprogparm_t *p, unsigned
|
||||||
qglUniformMatrix4fvARB(p->handle[perm], 1, false, m16);
|
qglUniformMatrix4fvARB(p->handle[perm], 1, false, m16);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SP_ENTBONEMATRICIES:
|
||||||
|
{
|
||||||
|
qglUniformMatrix3x4fv(p->handle[perm], shaderstate.sourcevbo->numbones, false, shaderstate.sourcevbo->bones);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case SP_ENTCOLOURS:
|
case SP_ENTCOLOURS:
|
||||||
qglUniform4fvARB(p->handle[perm], 1, (GLfloat*)shaderstate.curentity->shaderRGBAf);
|
qglUniform4fvARB(p->handle[perm], 1, (GLfloat*)shaderstate.curentity->shaderRGBAf);
|
||||||
|
@ -2457,8 +2472,8 @@ static unsigned int BE_Program_Set_Attribute(const shaderprogparm_t *p, unsigned
|
||||||
#endif
|
#endif
|
||||||
// vec3_t t1;
|
// vec3_t t1;
|
||||||
vec3_t t2;
|
vec3_t t2;
|
||||||
Matrix4_ModelMatrixFromAxis(m16, shaderstate.curentity->axis[0], shaderstate.curentity->axis[1], shaderstate.curentity->axis[2], shaderstate.curentity->origin);
|
Matrix4x4_CM_ModelMatrixFromAxis(m16, shaderstate.curentity->axis[0], shaderstate.curentity->axis[1], shaderstate.curentity->axis[2], shaderstate.curentity->origin);
|
||||||
Matrix4_Transform3(m16, r_origin, t2);
|
Matrix4x4_CM_Transform3(m16, r_origin, t2);
|
||||||
// VectorSubtract(r_origin, shaderstate.curentity->origin, t1);
|
// VectorSubtract(r_origin, shaderstate.curentity->origin, t1);
|
||||||
// Matrix3_Multiply_Vec3(shaderstate.curentity->axis, t1, t2);
|
// Matrix3_Multiply_Vec3(shaderstate.curentity->axis, t1, t2);
|
||||||
qglUniform3fvARB(p->handle[perm], 1, t2);
|
qglUniform3fvARB(p->handle[perm], 1, t2);
|
||||||
|
@ -2475,9 +2490,9 @@ static unsigned int BE_Program_Set_Attribute(const shaderprogparm_t *p, unsigned
|
||||||
vec3_t t2;
|
vec3_t t2;
|
||||||
qboolean Matrix4_Invert(const float *m, float *out);
|
qboolean Matrix4_Invert(const float *m, float *out);
|
||||||
|
|
||||||
Matrix4_ModelMatrixFromAxis(m16, shaderstate.curentity->axis[0], shaderstate.curentity->axis[1], shaderstate.curentity->axis[2], shaderstate.curentity->origin);
|
Matrix4x4_CM_ModelMatrixFromAxis(m16, shaderstate.curentity->axis[0], shaderstate.curentity->axis[1], shaderstate.curentity->axis[2], shaderstate.curentity->origin);
|
||||||
Matrix4_Invert(m16, inv);
|
Matrix4_Invert(m16, inv);
|
||||||
Matrix4_Transform3(inv, shaderstate.lightorg, t2);
|
Matrix4x4_CM_Transform3(inv, shaderstate.lightorg, t2);
|
||||||
// VectorSubtract(shaderstate.lightorg, shaderstate.curentity->origin, t1);
|
// VectorSubtract(shaderstate.lightorg, shaderstate.curentity->origin, t1);
|
||||||
// Matrix3_Multiply_Vec3(shaderstate.curentity->axis, t1, t2);
|
// Matrix3_Multiply_Vec3(shaderstate.curentity->axis, t1, t2);
|
||||||
qglUniform3fvARB(p->handle[perm], 1, t2);
|
qglUniform3fvARB(p->handle[perm], 1, t2);
|
||||||
|
@ -2538,6 +2553,13 @@ static void BE_RenderMeshProgram(const shader_t *shader, const shaderpass_t *pas
|
||||||
int perm;
|
int perm;
|
||||||
|
|
||||||
perm = 0;
|
perm = 0;
|
||||||
|
if (shaderstate.sourcevbo->numbones)
|
||||||
|
{
|
||||||
|
if (p->handle[perm|PERMUTATION_SKELETAL].glsl)
|
||||||
|
perm |= PERMUTATION_SKELETAL;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (TEXVALID(shaderstate.curtexnums->bump) && p->handle[perm|PERMUTATION_BUMPMAP].glsl)
|
if (TEXVALID(shaderstate.curtexnums->bump) && p->handle[perm|PERMUTATION_BUMPMAP].glsl)
|
||||||
perm |= PERMUTATION_BUMPMAP;
|
perm |= PERMUTATION_BUMPMAP;
|
||||||
if (TEXVALID(shaderstate.curtexnums->specular) && p->handle[perm|PERMUTATION_SPECULAR].glsl)
|
if (TEXVALID(shaderstate.curtexnums->specular) && p->handle[perm|PERMUTATION_SPECULAR].glsl)
|
||||||
|
@ -3001,6 +3023,10 @@ void GLBE_DrawMesh_List(shader_t *shader, int nummeshes, mesh_t **meshlist, vbo_
|
||||||
shaderstate.dummyvbo.tvector = m->tnormals_array;
|
shaderstate.dummyvbo.tvector = m->tnormals_array;
|
||||||
shaderstate.dummyvbo.colours4f = m->colors4f_array;
|
shaderstate.dummyvbo.colours4f = m->colors4f_array;
|
||||||
shaderstate.dummyvbo.colours4ub = m->colors4b_array;
|
shaderstate.dummyvbo.colours4ub = m->colors4b_array;
|
||||||
|
shaderstate.dummyvbo.bones = m->bones;
|
||||||
|
shaderstate.dummyvbo.numbones = m->numbones;
|
||||||
|
shaderstate.dummyvbo.bonenums = m->bonenums;
|
||||||
|
shaderstate.dummyvbo.boneweights = m->boneweights;
|
||||||
|
|
||||||
shaderstate.meshcount = 1;
|
shaderstate.meshcount = 1;
|
||||||
shaderstate.meshes = &m;
|
shaderstate.meshes = &m;
|
||||||
|
@ -3051,6 +3077,10 @@ void GLBE_SubmitBatch(batch_t *batch)
|
||||||
shaderstate.dummyvbo.tvector = batch->mesh[0]->tnormals_array;
|
shaderstate.dummyvbo.tvector = batch->mesh[0]->tnormals_array;
|
||||||
shaderstate.dummyvbo.colours4f = batch->mesh[0]->colors4f_array;
|
shaderstate.dummyvbo.colours4f = batch->mesh[0]->colors4f_array;
|
||||||
shaderstate.dummyvbo.colours4ub = batch->mesh[0]->colors4b_array;
|
shaderstate.dummyvbo.colours4ub = batch->mesh[0]->colors4b_array;
|
||||||
|
shaderstate.dummyvbo.bones = batch->mesh[0]->bones;
|
||||||
|
shaderstate.dummyvbo.numbones = batch->mesh[0]->numbones;
|
||||||
|
shaderstate.dummyvbo.bonenums = batch->mesh[0]->bonenums;
|
||||||
|
shaderstate.dummyvbo.boneweights = batch->mesh[0]->boneweights;
|
||||||
shaderstate.sourcevbo = &shaderstate.dummyvbo;
|
shaderstate.sourcevbo = &shaderstate.dummyvbo;
|
||||||
lm = -1;
|
lm = -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -445,8 +445,6 @@ void GL_Set2D (void)
|
||||||
extern cvar_t gl_screenangle;
|
extern cvar_t gl_screenangle;
|
||||||
float rad, ang;
|
float rad, ang;
|
||||||
float tmp[16], tmp2[16];
|
float tmp[16], tmp2[16];
|
||||||
float *Matrix4_NewRotation(float a, float x, float y, float z);
|
|
||||||
float *Matrix4_NewTranslation(float x, float y, float z);
|
|
||||||
float w = vid.width, h = vid.height;
|
float w = vid.width, h = vid.height;
|
||||||
|
|
||||||
ang = (gl_screenangle.value>0?(gl_screenangle.value+45):(gl_screenangle.value-45))/90;
|
ang = (gl_screenangle.value>0?(gl_screenangle.value+45):(gl_screenangle.value-45))/90;
|
||||||
|
@ -458,16 +456,16 @@ void GL_Set2D (void)
|
||||||
w = fabs(cos(rad)) * (vid.width) + fabs(sin(rad)) * (vid.height);
|
w = fabs(cos(rad)) * (vid.width) + fabs(sin(rad)) * (vid.height);
|
||||||
h = fabs(sin(rad)) * (vid.width) + fabs(cos(rad)) * (vid.height);
|
h = fabs(sin(rad)) * (vid.width) + fabs(cos(rad)) * (vid.height);
|
||||||
|
|
||||||
Matrix4_Orthographic(r_refdef.m_projection, w/-2.0f, w/2.0f, h/2.0f, h/-2.0f, -99999, 99999);
|
Matrix4x4_CM_Orthographic(r_refdef.m_projection, w/-2.0f, w/2.0f, h/2.0f, h/-2.0f, -99999, 99999);
|
||||||
|
|
||||||
Matrix4_Identity(tmp);
|
Matrix4x4_Identity(tmp);
|
||||||
Matrix4_Multiply(Matrix4_NewTranslation((vid.width/-2.0f), (vid.height/-2.0f), 0), tmp, tmp2);
|
Matrix4_Multiply(Matrix4x4_CM_NewTranslation((vid.width/-2.0f), (vid.height/-2.0f), 0), tmp, tmp2);
|
||||||
Matrix4_Multiply(Matrix4_NewRotation(-ang, 0, 0, 1), tmp2, r_refdef.m_view);
|
Matrix4_Multiply(Matrix4x4_CM_NewRotation(-ang, 0, 0, 1), tmp2, r_refdef.m_view);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Matrix4_Orthographic(r_refdef.m_projection, 0, vid.width, vid.height, 0, -99999, 99999);
|
Matrix4x4_CM_Orthographic(r_refdef.m_projection, 0, vid.width, vid.height, 0, -99999, 99999);
|
||||||
Matrix4_Identity(r_refdef.m_view);
|
Matrix4x4_Identity(r_refdef.m_view);
|
||||||
}
|
}
|
||||||
r_refdef.time = realtime;
|
r_refdef.time = realtime;
|
||||||
/*flush that gl state*/
|
/*flush that gl state*/
|
||||||
|
|
|
@ -37,6 +37,7 @@ FT_Error (VARGS *pFT_Init_FreeType) (FT_Library *alibrary);
|
||||||
FT_Error (VARGS *pFT_Load_Char) (FT_Face face, FT_ULong char_code, FT_Int32 load_flags);
|
FT_Error (VARGS *pFT_Load_Char) (FT_Face face, FT_ULong char_code, FT_Int32 load_flags);
|
||||||
FT_Error (VARGS *pFT_Set_Pixel_Sizes) (FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height);
|
FT_Error (VARGS *pFT_Set_Pixel_Sizes) (FT_Face face, FT_UInt pixel_width, FT_UInt pixel_height);
|
||||||
FT_Error (VARGS *pFT_New_Face) (FT_Library library, const char *pathname, FT_Long face_index, FT_Face *aface);
|
FT_Error (VARGS *pFT_New_Face) (FT_Library library, const char *pathname, FT_Long face_index, FT_Face *aface);
|
||||||
|
FT_Error (VARGS *pFT_New_Memory_Face) (FT_Library library, const FT_Byte* file_base, FT_Long file_size, FT_Long face_index, FT_Face *aface);
|
||||||
FT_Error (VARGS *pFT_Done_Face) (FT_Face face);
|
FT_Error (VARGS *pFT_Done_Face) (FT_Face face);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -185,6 +186,7 @@ typedef struct font_s
|
||||||
texid_t singletexture;
|
texid_t singletexture;
|
||||||
#ifdef AVAIL_FREETYPE
|
#ifdef AVAIL_FREETYPE
|
||||||
FT_Face face;
|
FT_Face face;
|
||||||
|
void *membuf;
|
||||||
#endif
|
#endif
|
||||||
} font_t;
|
} font_t;
|
||||||
|
|
||||||
|
@ -601,8 +603,10 @@ static struct charcache_s *Font_TryLoadGlyph(font_t *f, CHARIDXTYPE charidx)
|
||||||
qboolean Font_LoadFreeTypeFont(struct font_s *f, int height, char *fontfilename)
|
qboolean Font_LoadFreeTypeFont(struct font_s *f, int height, char *fontfilename)
|
||||||
{
|
{
|
||||||
#ifdef AVAIL_FREETYPE
|
#ifdef AVAIL_FREETYPE
|
||||||
FT_Face face;
|
FT_Face face = NULL;
|
||||||
int error;
|
FT_Error error;
|
||||||
|
flocation_t loc;
|
||||||
|
void *fbase = NULL;
|
||||||
if (!fontlib)
|
if (!fontlib)
|
||||||
{
|
{
|
||||||
dllfunction_t ft2funcs[] =
|
dllfunction_t ft2funcs[] =
|
||||||
|
@ -611,6 +615,7 @@ qboolean Font_LoadFreeTypeFont(struct font_s *f, int height, char *fontfilename)
|
||||||
{(void**)&pFT_Load_Char, "FT_Load_Char"},
|
{(void**)&pFT_Load_Char, "FT_Load_Char"},
|
||||||
{(void**)&pFT_Set_Pixel_Sizes, "FT_Set_Pixel_Sizes"},
|
{(void**)&pFT_Set_Pixel_Sizes, "FT_Set_Pixel_Sizes"},
|
||||||
{(void**)&pFT_New_Face, "FT_New_Face"},
|
{(void**)&pFT_New_Face, "FT_New_Face"},
|
||||||
|
{(void**)&pFT_New_Memory_Face, "FT_New_Memory_Face"},
|
||||||
{(void**)&pFT_Init_FreeType, "FT_Init_FreeType"},
|
{(void**)&pFT_Init_FreeType, "FT_Init_FreeType"},
|
||||||
{(void**)&pFT_Done_Face, "FT_Done_Face"},
|
{(void**)&pFT_Done_Face, "FT_Done_Face"},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
|
@ -631,8 +636,31 @@ qboolean Font_LoadFreeTypeFont(struct font_s *f, int height, char *fontfilename)
|
||||||
/*any other errors leave freetype open*/
|
/*any other errors leave freetype open*/
|
||||||
}
|
}
|
||||||
|
|
||||||
//fixme: use FT_Open_Face eventually
|
error = FT_Err_Cannot_Open_Resource;
|
||||||
error = pFT_New_Face(fontlib, fontfilename, 0, &face);
|
if (FS_FLocateFile(fontfilename, FSLFRT_LENGTH, &loc)>0)
|
||||||
|
{
|
||||||
|
if (*loc.rawname && !loc.offset)
|
||||||
|
{
|
||||||
|
fbase = NULL;
|
||||||
|
/*File is directly fopenable with no bias (not in a pk3/pak). Use the system-path form, so we don't have to eat the memory cost*/
|
||||||
|
error = pFT_New_Face(fontlib, loc.rawname, 0, &face);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*File is inside an archive, we need to read it and pass it as memory (and keep it available)*/
|
||||||
|
vfsfile_t *f;
|
||||||
|
f = FS_OpenReadLocation(&loc);
|
||||||
|
if (f && loc.len > 0)
|
||||||
|
{
|
||||||
|
fbase = malloc(loc.len);
|
||||||
|
VFS_READ(f, fbase, loc.len);
|
||||||
|
VFS_CLOSE(f);
|
||||||
|
|
||||||
|
error = pFT_New_Memory_Face(fontlib, fbase, loc.len, 0, &face);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
|
@ -664,20 +692,22 @@ qboolean Font_LoadFreeTypeFont(struct font_s *f, int height, char *fontfilename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (error)
|
if (!error)
|
||||||
return false;
|
|
||||||
|
|
||||||
error = pFT_Set_Pixel_Sizes(face, 0, height);
|
|
||||||
if (error)
|
|
||||||
{
|
{
|
||||||
return false;
|
error = pFT_Set_Pixel_Sizes(face, 0, height);
|
||||||
|
if (!error)
|
||||||
|
{
|
||||||
|
/*success!*/
|
||||||
|
f->membuf = fbase;
|
||||||
|
f->face = face;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (fbase)
|
||||||
f->face = face;
|
free(fbase);
|
||||||
return true;
|
|
||||||
#else
|
|
||||||
return false;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static texid_t Font_LoadReplacementConchars(void)
|
static texid_t Font_LoadReplacementConchars(void)
|
||||||
|
@ -958,6 +988,8 @@ void Font_Free(struct font_s *f)
|
||||||
#ifdef AVAIL_FREETYPE
|
#ifdef AVAIL_FREETYPE
|
||||||
if (f->face)
|
if (f->face)
|
||||||
pFT_Done_Face(f->face);
|
pFT_Done_Face(f->face);
|
||||||
|
if (f->membuf)
|
||||||
|
free(f->membuf);
|
||||||
#endif
|
#endif
|
||||||
free(f);
|
free(f);
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,10 +62,6 @@ void QuaternionGLAngle(const vec3_t angles, vec4_t quaternion)
|
||||||
quaternion[3] = cosr * cosp * cosy + sinr * sinp * siny;
|
quaternion[3] = cosr * cosp * cosy + sinr * sinp * siny;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_BONES 128
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
matrix3x4 transform_matrix[MAX_BONES]; /* Vertex transformation matrix */
|
matrix3x4 transform_matrix[MAX_BONES]; /* Vertex transformation matrix */
|
||||||
|
|
||||||
void GL_Draw_HL_AliasFrame(short *order, vec3_t *transformed, float tex_w, float tex_h);
|
void GL_Draw_HL_AliasFrame(short *order, vec3_t *transformed, float tex_w, float tex_h);
|
||||||
|
|
|
@ -773,7 +773,8 @@ couldntload:
|
||||||
if (crash)
|
if (crash)
|
||||||
Host_EndGame ("Mod_NumForName: %s not found or couldn't load", mod->name);
|
Host_EndGame ("Mod_NumForName: %s not found or couldn't load", mod->name);
|
||||||
|
|
||||||
Con_Printf(CON_ERROR "Unable to load or replace %s\n", mod->name);
|
if (*mod->name != '*')
|
||||||
|
Con_Printf(CON_ERROR "Unable to load or replace %s\n", mod->name);
|
||||||
mod->type = mod_dummy;
|
mod->type = mod_dummy;
|
||||||
mod->mins[0] = -16;
|
mod->mins[0] = -16;
|
||||||
mod->mins[1] = -16;
|
mod->mins[1] = -16;
|
||||||
|
@ -1050,7 +1051,15 @@ TRACE(("dbg: RMod_LoadTextures: inittexturedescs\n"));
|
||||||
|
|
||||||
if (!l->filelen)
|
if (!l->filelen)
|
||||||
{
|
{
|
||||||
loadmodel->textures = NULL;
|
loadmodel->numtextures = 1;
|
||||||
|
loadmodel->textures = Hunk_AllocName (1 * sizeof(*loadmodel->textures), loadname);
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
tx = Hunk_AllocName (sizeof(texture_t), loadname );
|
||||||
|
memcpy(tx, r_notexture_mip, sizeof(texture_t));
|
||||||
|
sprintf(tx->name, "unnamed%i", i);
|
||||||
|
loadmodel->textures[i] = tx;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
m = (dmiptexlump_t *)(mod_base + l->fileofs);
|
m = (dmiptexlump_t *)(mod_base + l->fileofs);
|
||||||
|
@ -1389,6 +1398,10 @@ void RMod_NowLoadExternal(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!TEXVALID(tn.base))
|
||||||
|
{
|
||||||
|
tn.base = R_LoadTexture8("notexture", 16, 16, r_notexture_mip+1, IF_NOALPHA, 0);
|
||||||
|
}
|
||||||
Mod_FinishTexture(tx, tn);
|
Mod_FinishTexture(tx, tn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1910,20 +1923,12 @@ qboolean RMod_LoadTexinfo (lump_t *l)
|
||||||
miptex = LittleLong (in->miptex);
|
miptex = LittleLong (in->miptex);
|
||||||
out->flags = LittleLong (in->flags);
|
out->flags = LittleLong (in->flags);
|
||||||
|
|
||||||
if (!loadmodel->textures || miptex < 0 || miptex >= loadmodel->numtextures)
|
out->texture = loadmodel->textures[miptex % loadmodel->numtextures];
|
||||||
|
if (!out->texture)
|
||||||
{
|
{
|
||||||
out->texture = r_notexture_mip; // checkerboard texture
|
out->texture = r_notexture_mip; // texture not found
|
||||||
out->flags = 0;
|
out->flags = 0;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
out->texture = loadmodel->textures[miptex];
|
|
||||||
if (!out->texture)
|
|
||||||
{
|
|
||||||
out->texture = r_notexture_mip; // texture not found
|
|
||||||
out->flags = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -1977,8 +1982,8 @@ void CalcSurfaceExtents (msurface_t *s);
|
||||||
bmins[i] = floor(mins[i]/16);
|
bmins[i] = floor(mins[i]/16);
|
||||||
bmaxs[i] = ceil(maxs[i]/16);
|
bmaxs[i] = ceil(maxs[i]/16);
|
||||||
|
|
||||||
s->texturemins[i] = bmins[i] * 16;
|
s->texturemins[i] = bmins[i];
|
||||||
s->extents[i] = (bmaxs[i] - bmins[i]) * 16;
|
s->extents[i] = (bmaxs[i] - bmins[i]);
|
||||||
|
|
||||||
// if ( !(tex->flags & TEX_SPECIAL) && s->extents[i] > 512 ) //q2 uses 512.
|
// if ( !(tex->flags & TEX_SPECIAL) && s->extents[i] > 512 ) //q2 uses 512.
|
||||||
// Sys_Error ("Bad surface extents");
|
// Sys_Error ("Bad surface extents");
|
||||||
|
@ -2310,6 +2315,7 @@ qboolean RMod_LoadClipnodes (lump_t *l)
|
||||||
mclipnode_t *out;
|
mclipnode_t *out;
|
||||||
int i, count;
|
int i, count;
|
||||||
hull_t *hull;
|
hull_t *hull;
|
||||||
|
short cn, c;
|
||||||
|
|
||||||
in = (void *)(mod_base + l->fileofs);
|
in = (void *)(mod_base + l->fileofs);
|
||||||
if (l->filelen % sizeof(*in))
|
if (l->filelen % sizeof(*in))
|
||||||
|
@ -2483,11 +2489,34 @@ qboolean RMod_LoadClipnodes (lump_t *l)
|
||||||
hull->available = false;
|
hull->available = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i=0 ; i<count ; i++, out++, in++)
|
if (count > 32767)
|
||||||
{
|
{
|
||||||
out->planenum = LittleLong(in->planenum);
|
/*
|
||||||
out->children[0] = LittleShort(in->children[0]);
|
if the map contains more than 32767 clipnodes, some of them will overflow
|
||||||
out->children[1] = LittleShort(in->children[1]);
|
typically this will happen in the second hull, and you thus might not notice it.
|
||||||
|
|
||||||
|
*/
|
||||||
|
for (i=0 ; i<count ; i++, out++, in++)
|
||||||
|
{
|
||||||
|
out->planenum = LittleLong(in->planenum);
|
||||||
|
for (c = 0; c < 2; c++)
|
||||||
|
{
|
||||||
|
cn = LittleShort(in->children[c]);
|
||||||
|
if (cn < -10)
|
||||||
|
out->children[c] = (unsigned short)cn;
|
||||||
|
else
|
||||||
|
out->children[c] = cn;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (i=0 ; i<count ; i++, out++, in++)
|
||||||
|
{
|
||||||
|
out->planenum = LittleLong(in->planenum);
|
||||||
|
out->children[0] = LittleShort(in->children[0]);
|
||||||
|
out->children[1] = LittleShort(in->children[1]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numsuplementryclipnodes) //now load the crouch ones.
|
if (numsuplementryclipnodes) //now load the crouch ones.
|
||||||
|
|
|
@ -47,6 +47,8 @@ typedef enum {
|
||||||
SHADER_SORT_COUNT
|
SHADER_SORT_COUNT
|
||||||
} shadersort_t;
|
} shadersort_t;
|
||||||
|
|
||||||
|
#define MAX_BONES 128
|
||||||
|
|
||||||
typedef struct mesh_s
|
typedef struct mesh_s
|
||||||
{
|
{
|
||||||
int numvertexes;
|
int numvertexes;
|
||||||
|
@ -73,6 +75,10 @@ typedef struct mesh_s
|
||||||
vec3_t *trnormals;
|
vec3_t *trnormals;
|
||||||
|
|
||||||
qboolean istrifan; /*if its a fan/poly/single quad (permits optimisations)*/
|
qboolean istrifan; /*if its a fan/poly/single quad (permits optimisations)*/
|
||||||
|
float *bones;
|
||||||
|
int numbones;
|
||||||
|
byte_vec4_t *bonenums;
|
||||||
|
vec4_t *boneweights;
|
||||||
} mesh_t;
|
} mesh_t;
|
||||||
extern mesh_t nullmesh;
|
extern mesh_t nullmesh;
|
||||||
|
|
||||||
|
@ -235,6 +241,16 @@ typedef struct vbo_s
|
||||||
int vbocolours;
|
int vbocolours;
|
||||||
vec4_t *colours4f;
|
vec4_t *colours4f;
|
||||||
byte_vec4_t *colours4ub;
|
byte_vec4_t *colours4ub;
|
||||||
|
|
||||||
|
int vbobonenums;
|
||||||
|
byte_vec4_t *bonenums;
|
||||||
|
|
||||||
|
int vboboneweights;
|
||||||
|
vec4_t *boneweights;
|
||||||
|
|
||||||
|
int vbobones;
|
||||||
|
float *bones;
|
||||||
|
int numbones;
|
||||||
} vbo_t;
|
} vbo_t;
|
||||||
void GL_SelectVBO(int vbo);
|
void GL_SelectVBO(int vbo);
|
||||||
void GL_SelectEBO(int vbo);
|
void GL_SelectEBO(int vbo);
|
||||||
|
|
|
@ -116,7 +116,6 @@ void R_InitBubble(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GLQUAKE
|
|
||||||
#define FLASHBLEND_VERTS 16
|
#define FLASHBLEND_VERTS 16
|
||||||
avec4_t flashblend_colours[FLASHBLEND_VERTS+1];
|
avec4_t flashblend_colours[FLASHBLEND_VERTS+1];
|
||||||
vecV_t flashblend_vcoords[FLASHBLEND_VERTS+1];
|
vecV_t flashblend_vcoords[FLASHBLEND_VERTS+1];
|
||||||
|
@ -238,7 +237,7 @@ void GLR_RenderDlights (void)
|
||||||
l = cl_dlights+rtlights_first;
|
l = cl_dlights+rtlights_first;
|
||||||
for (i=rtlights_first; i<rtlights_max; i++, l++)
|
for (i=rtlights_first; i<rtlights_max; i++, l++)
|
||||||
{
|
{
|
||||||
if (!l->radius || !(l->flags & LFLAG_ALLOW_FLASH))
|
if (!l->radius || !(l->flags & LFLAG_FLASHBLEND))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
//dlights emitting from the local player are not visible as flashblends
|
//dlights emitting from the local player are not visible as flashblends
|
||||||
|
@ -255,7 +254,6 @@ void GLR_RenderDlights (void)
|
||||||
R_RenderDlight (l, beflags);
|
R_RenderDlight (l, beflags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============================================================================
|
=============================================================================
|
||||||
|
@ -265,154 +263,6 @@ DYNAMIC LIGHTS
|
||||||
=============================================================================
|
=============================================================================
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
=============
|
|
||||||
R_MarkLights
|
|
||||||
=============
|
|
||||||
*/
|
|
||||||
/*void GLR_MarkLights (dlight_t *light, int bit, mnode_t *node)
|
|
||||||
{
|
|
||||||
mplane_t *splitplane;
|
|
||||||
float dist;
|
|
||||||
msurface_t *surf;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (node->contents < 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
splitplane = node->plane;
|
|
||||||
dist = DotProduct (light->origin, splitplane->normal) - splitplane->dist;
|
|
||||||
|
|
||||||
if (dist > light->radius)
|
|
||||||
{
|
|
||||||
GLR_MarkLights (light, bit, node->children[0]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (dist < -light->radius)
|
|
||||||
{
|
|
||||||
GLR_MarkLights (light, bit, node->children[1]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// mark the polygons
|
|
||||||
surf = cl.worldmodel->surfaces + node->firstsurface;
|
|
||||||
for (i=0 ; i<node->numsurfaces ; i++, surf++)
|
|
||||||
{
|
|
||||||
if (surf->dlightframe != r_dlightframecount)
|
|
||||||
{
|
|
||||||
surf->dlightbits = 0;
|
|
||||||
surf->dlightframe = r_dlightframecount;
|
|
||||||
}
|
|
||||||
surf->dlightbits |= bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLR_MarkLights (light, bit, node->children[0]);
|
|
||||||
GLR_MarkLights (light, bit, node->children[1]);
|
|
||||||
}*/
|
|
||||||
/*void Q2BSP_MarkLights (dlight_t *light, int bit, mnode_t *node)
|
|
||||||
{
|
|
||||||
mplane_t *splitplane;
|
|
||||||
float dist;
|
|
||||||
msurface_t *surf;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (node->contents != -1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
splitplane = node->plane;
|
|
||||||
dist = DotProduct (light->origin, splitplane->normal) - splitplane->dist;
|
|
||||||
|
|
||||||
if (dist > light->radius)
|
|
||||||
{
|
|
||||||
Q2BSP_MarkLights (light, bit, node->children[0]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (dist < -light->radius)
|
|
||||||
{
|
|
||||||
Q2BSP_MarkLights (light, bit, node->children[1]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// mark the polygons
|
|
||||||
surf = cl.worldmodel->surfaces + node->firstsurface;
|
|
||||||
for (i=0 ; i<node->numsurfaces ; i++, surf++)
|
|
||||||
{
|
|
||||||
if (surf->dlightframe != r_dlightframecount)
|
|
||||||
{
|
|
||||||
surf->dlightbits = 0;
|
|
||||||
surf->dlightframe = r_dlightframecount;
|
|
||||||
}
|
|
||||||
surf->dlightbits |= bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
Q2BSP_MarkLights (light, bit, node->children[0]);
|
|
||||||
Q2BSP_MarkLights (light, bit, node->children[1]);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
void GLR_MarkQ3Lights (dlight_t *light, int bit, mnode_t *node)
|
|
||||||
{
|
|
||||||
mplane_t *splitplane;
|
|
||||||
float dist;
|
|
||||||
msurface_t *surf;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
return; //we need to get the texinfos right first.
|
|
||||||
|
|
||||||
/*
|
|
||||||
//mark all
|
|
||||||
for (surf = cl.worldmodel->surfaces, i = 0; i < cl.worldmodel->numsurfaces; i++, surf++)
|
|
||||||
{
|
|
||||||
if (surf->dlightframe != r_dlightframecount)
|
|
||||||
{
|
|
||||||
surf->dlightbits = 0;
|
|
||||||
surf->dlightframe = r_dlightframecount;
|
|
||||||
}
|
|
||||||
surf->dlightbits |= bit;
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
*/
|
|
||||||
if (node->contents != -1)
|
|
||||||
{
|
|
||||||
msurface_t **mark;
|
|
||||||
mleaf_t *leaf;
|
|
||||||
|
|
||||||
// mark the polygons
|
|
||||||
leaf = (mleaf_t *)node;
|
|
||||||
mark = leaf->firstmarksurface;
|
|
||||||
for (i=0 ; i<leaf->nummarksurfaces ; i++, surf++)
|
|
||||||
{
|
|
||||||
surf = *mark++;
|
|
||||||
if (surf->dlightframe != r_dlightframecount)
|
|
||||||
{
|
|
||||||
surf->dlightbits = 0;
|
|
||||||
surf->dlightframe = r_dlightframecount;
|
|
||||||
}
|
|
||||||
surf->dlightbits |= bit;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
splitplane = node->plane;
|
|
||||||
dist = DotProduct (light->origin, splitplane->normal) - splitplane->dist;
|
|
||||||
|
|
||||||
if (dist > light->radius)
|
|
||||||
{
|
|
||||||
GLR_MarkQ3Lights (light, bit, node->children[0]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (dist < -light->radius)
|
|
||||||
{
|
|
||||||
GLR_MarkQ3Lights (light, bit, node->children[1]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GLR_MarkQ3Lights (light, bit, node->children[0]);
|
|
||||||
GLR_MarkQ3Lights (light, bit, node->children[1]);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
=============
|
=============
|
||||||
R_PushDlights
|
R_PushDlights
|
||||||
|
@ -437,7 +287,7 @@ void R_PushDlights (void)
|
||||||
l = cl_dlights+rtlights_first;
|
l = cl_dlights+rtlights_first;
|
||||||
for (i=rtlights_first ; i <= DL_LAST ; i++, l++)
|
for (i=rtlights_first ; i <= DL_LAST ; i++, l++)
|
||||||
{
|
{
|
||||||
if (!l->radius || !(l->flags & LFLAG_ALLOW_LMHACK))
|
if (!l->radius || !(l->flags & LFLAG_LIGHTMAP))
|
||||||
continue;
|
continue;
|
||||||
currentmodel->funcs.MarkLights( l, 1<<i, currentmodel->nodes );
|
currentmodel->funcs.MarkLights( l, 1<<i, currentmodel->nodes );
|
||||||
}
|
}
|
||||||
|
@ -632,8 +482,7 @@ int GLRecursiveLightPoint (mnode_t *node, vec3_t start, vec3_t end)
|
||||||
s = DotProduct (mid, tex->vecs[0]) + tex->vecs[0][3];
|
s = DotProduct (mid, tex->vecs[0]) + tex->vecs[0][3];
|
||||||
t = DotProduct (mid, tex->vecs[1]) + tex->vecs[1][3];;
|
t = DotProduct (mid, tex->vecs[1]) + tex->vecs[1][3];;
|
||||||
|
|
||||||
if (s < surf->texturemins[0] ||
|
if (s < surf->texturemins[0] || t < surf->texturemins[1])
|
||||||
t < surf->texturemins[1])
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
ds = s - surf->texturemins[0];
|
ds = s - surf->texturemins[0];
|
||||||
|
|
|
@ -447,7 +447,7 @@ void R_RotateForEntity (float *modelview, const entity_t *e, const model_t *mod)
|
||||||
ang[0] = 0;
|
ang[0] = 0;
|
||||||
ang[1] = 0;
|
ang[1] = 0;
|
||||||
ang[2] = gl_screenangle.value;
|
ang[2] = gl_screenangle.value;
|
||||||
Matrix4_ModelViewMatrix(simpleview, ang, vec3_origin);
|
Matrix4x4_CM_ModelViewMatrix(simpleview, ang, vec3_origin);
|
||||||
Matrix4_Multiply(simpleview, m, modelview);
|
Matrix4_Multiply(simpleview, m, modelview);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -529,26 +529,26 @@ void R_SetupGL (void)
|
||||||
// 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);
|
||||||
|
|
||||||
Matrix4_Projection_Far(r_refdef.m_projection, fov_x, fov_y, gl_mindist.value, gl_maxdist.value);
|
Matrix4x4_CM_Projection_Far(r_refdef.m_projection, fov_x, fov_y, gl_mindist.value, gl_maxdist.value);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Matrix4_Projection_Inf(r_refdef.m_projection, fov_x, fov_y, gl_mindist.value);
|
Matrix4x4_CM_Projection_Inf(r_refdef.m_projection, fov_x, fov_y, gl_mindist.value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (gl_maxdist.value>=1)
|
if (gl_maxdist.value>=1)
|
||||||
Matrix4_Orthographic(r_refdef.m_projection, -fov_x/2, fov_x/2, fov_y/2, -fov_y/2, -gl_maxdist.value, gl_maxdist.value);
|
Matrix4x4_CM_Orthographic(r_refdef.m_projection, -fov_x/2, fov_x/2, fov_y/2, -fov_y/2, -gl_maxdist.value, gl_maxdist.value);
|
||||||
else
|
else
|
||||||
Matrix4_Orthographic(r_refdef.m_projection, 0, r_refdef.vrect.width, 0, r_refdef.vrect.height, -9999, 9999);
|
Matrix4x4_CM_Orthographic(r_refdef.m_projection, 0, r_refdef.vrect.width, 0, r_refdef.vrect.height, -9999, 9999);
|
||||||
}
|
}
|
||||||
|
|
||||||
VectorCopy(r_refdef.viewangles, newa);
|
VectorCopy(r_refdef.viewangles, newa);
|
||||||
newa[0] = r_refdef.viewangles[0];
|
newa[0] = r_refdef.viewangles[0];
|
||||||
newa[1] = r_refdef.viewangles[1];
|
newa[1] = r_refdef.viewangles[1];
|
||||||
newa[2] = r_refdef.viewangles[2] + gl_screenangle.value;
|
newa[2] = r_refdef.viewangles[2] + gl_screenangle.value;
|
||||||
Matrix4_ModelViewMatrix(r_refdef.m_view, newa, r_refdef.vieworg);
|
Matrix4x4_CM_ModelViewMatrix(r_refdef.m_view, newa, r_refdef.vieworg);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (qglLoadMatrixf)
|
if (qglLoadMatrixf)
|
||||||
|
@ -813,7 +813,7 @@ void GLR_DrawPortal(batch_t *batch, batch_t **blist)
|
||||||
TransformDir(vright, paxis, vaxis, vright);
|
TransformDir(vright, paxis, vaxis, vright);
|
||||||
TransformDir(vup, paxis, vaxis, vup);
|
TransformDir(vup, paxis, vaxis, vup);
|
||||||
}
|
}
|
||||||
Matrix4_ModelViewMatrixFromAxis(r_refdef.m_view, vpn, vright, vup, r_refdef.vieworg);
|
Matrix4x4_CM_ModelViewMatrixFromAxis(r_refdef.m_view, vpn, vright, vup, r_refdef.vieworg);
|
||||||
VectorAngles(vpn, vup, r_refdef.viewangles);
|
VectorAngles(vpn, vup, r_refdef.viewangles);
|
||||||
VectorCopy(r_refdef.vieworg, r_origin);
|
VectorCopy(r_refdef.vieworg, r_origin);
|
||||||
|
|
||||||
|
|
|
@ -247,13 +247,6 @@ R_Init
|
||||||
*/
|
*/
|
||||||
void GLR_ReInit (void)
|
void GLR_ReInit (void)
|
||||||
{
|
{
|
||||||
#if 0
|
|
||||||
extern int gl_bumpmappingpossible;
|
|
||||||
if (gl_bumpmappingpossible)
|
|
||||||
GenerateNormalisationCubeMap();
|
|
||||||
else
|
|
||||||
normalisationCubeMap = 0;
|
|
||||||
#endif
|
|
||||||
netgraphtexture = GL_AllocNewTexture(0, 0);
|
netgraphtexture = GL_AllocNewTexture(0, 0);
|
||||||
|
|
||||||
R_InitBloomTextures();
|
R_InitBloomTextures();
|
||||||
|
@ -717,9 +710,8 @@ static void R_ImportRTLights(char *entlump)
|
||||||
VectorCopy(color, dl->color);
|
VectorCopy(color, dl->color);
|
||||||
dl->flags = 0;
|
dl->flags = 0;
|
||||||
dl->flags |= LFLAG_REALTIMEMODE;
|
dl->flags |= LFLAG_REALTIMEMODE;
|
||||||
dl->flags |= (pflags & PFLAGS_CORONA)?LFLAG_ALLOW_FLASH:0;
|
dl->flags |= (pflags & PFLAGS_CORONA)?LFLAG_FLASHBLEND:0;
|
||||||
dl->flags |= (pflags & PFLAGS_NOSHADOW)?LFLAG_NOSHADOWS:0;
|
dl->flags |= (pflags & PFLAGS_NOSHADOW)?LFLAG_NOSHADOWS:0;
|
||||||
dl->flags |= LFLAG_ALLOW_PPL;
|
|
||||||
dl->style = style+1;
|
dl->style = style+1;
|
||||||
|
|
||||||
//FIXME: cubemaps if skin >= 16
|
//FIXME: cubemaps if skin >= 16
|
||||||
|
@ -833,7 +825,7 @@ static void R_LoadRTLights(void)
|
||||||
dl->radius = radius;
|
dl->radius = radius;
|
||||||
VectorCopy(rgb, dl->color);
|
VectorCopy(rgb, dl->color);
|
||||||
dl->die = 0;
|
dl->die = 0;
|
||||||
dl->flags = flags|LFLAG_ALLOW_PPL;
|
dl->flags = flags;
|
||||||
/*if (*cubename)
|
/*if (*cubename)
|
||||||
{
|
{
|
||||||
dl->fov = 90;
|
dl->fov = 90;
|
||||||
|
|
|
@ -754,6 +754,7 @@ static void Shader_LoadPermutations(char *name, program_t *prog, char *script, i
|
||||||
"#define LOWER\n",
|
"#define LOWER\n",
|
||||||
"#define UPPER\n",
|
"#define UPPER\n",
|
||||||
"#define OFFSETMAPPING\n",
|
"#define OFFSETMAPPING\n",
|
||||||
|
"#define SKELETAL\n",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
char *permutationdefines[sizeof(permutationname)/sizeof(permutationname[0])];
|
char *permutationdefines[sizeof(permutationname)/sizeof(permutationname[0])];
|
||||||
|
@ -1165,6 +1166,7 @@ struct sbuiltin_s
|
||||||
"!!permu FULLBRIGHT\n"
|
"!!permu FULLBRIGHT\n"
|
||||||
"!!permu LOWER\n"
|
"!!permu LOWER\n"
|
||||||
"!!permu UPPER\n"
|
"!!permu UPPER\n"
|
||||||
|
"!!permu SKELETAL\n"
|
||||||
"#ifdef VERTEX_SHADER\n"
|
"#ifdef VERTEX_SHADER\n"
|
||||||
"attribute vec2 v_texcoord;\n"
|
"attribute vec2 v_texcoord;\n"
|
||||||
"varying vec2 tc;\n"
|
"varying vec2 tc;\n"
|
||||||
|
@ -1177,9 +1179,9 @@ struct sbuiltin_s
|
||||||
|
|
||||||
"void main (void)\n"
|
"void main (void)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
" gl_Position = ftetransform();\n"
|
||||||
" light = e_light_ambient + (dot(v_normal,e_light_dir)*e_light_mul);\n"
|
" light = e_light_ambient + (dot(v_normal,e_light_dir)*e_light_mul);\n"
|
||||||
" tc = v_texcoord;\n"
|
" tc = v_texcoord;\n"
|
||||||
" gl_Position = ftetransform();\n"
|
|
||||||
"}\n"
|
"}\n"
|
||||||
"#endif\n"
|
"#endif\n"
|
||||||
|
|
||||||
|
@ -1221,10 +1223,11 @@ struct sbuiltin_s
|
||||||
"}\n"
|
"}\n"
|
||||||
"#endif\n"
|
"#endif\n"
|
||||||
},
|
},
|
||||||
{QR_OPENGL, 110, "defaultskin",
|
{QR_OPENGL, 120, "defaultskin",
|
||||||
"!!permu FULLBRIGHT\n"
|
"!!permu FULLBRIGHT\n"
|
||||||
"!!permu LOWER\n"
|
"!!permu LOWER\n"
|
||||||
"!!permu UPPER\n"
|
"!!permu UPPER\n"
|
||||||
|
"!!permu SKELETAL\n"
|
||||||
"#ifdef VERTEX_SHADER\n"
|
"#ifdef VERTEX_SHADER\n"
|
||||||
"attribute vec2 v_texcoord;\n"
|
"attribute vec2 v_texcoord;\n"
|
||||||
"varying vec2 tc;\n"
|
"varying vec2 tc;\n"
|
||||||
|
@ -1234,12 +1237,12 @@ struct sbuiltin_s
|
||||||
"uniform vec3 e_light_mul;\n"
|
"uniform vec3 e_light_mul;\n"
|
||||||
"uniform vec3 e_light_ambient;\n"
|
"uniform vec3 e_light_ambient;\n"
|
||||||
"varying vec3 light;\n"
|
"varying vec3 light;\n"
|
||||||
|
"#ifndef SKELETAL\nattribute vec4 v_weight;\n#endif\n"
|
||||||
"void main (void)\n"
|
"void main (void)\n"
|
||||||
"{\n"
|
"{\n"
|
||||||
|
" gl_Position = ftetransform();\n"
|
||||||
" light = e_light_ambient + (dot(v_normal,e_light_dir)*e_light_mul);\n"
|
" light = e_light_ambient + (dot(v_normal,e_light_dir)*e_light_mul);\n"
|
||||||
" tc = v_texcoord;\n"
|
" tc = v_texcoord;\n"
|
||||||
" gl_Position = ftetransform();\n"
|
|
||||||
"}\n"
|
"}\n"
|
||||||
"#endif\n"
|
"#endif\n"
|
||||||
|
|
||||||
|
@ -1455,6 +1458,8 @@ static void Shader_ProgAutoFields(program_t *prog, char **cvarfnames)
|
||||||
{"v_normal", SP_ATTR_NORMALS},
|
{"v_normal", SP_ATTR_NORMALS},
|
||||||
{"v_svector", SP_ATTR_SNORMALS},
|
{"v_svector", SP_ATTR_SNORMALS},
|
||||||
{"v_tvector", SP_ATTR_TNORMALS},
|
{"v_tvector", SP_ATTR_TNORMALS},
|
||||||
|
{"v_bone", SP_ATTR_BONENUMS},
|
||||||
|
{"v_weight", SP_ATTR_BONEWEIGHTS},
|
||||||
|
|
||||||
/*matricies*/
|
/*matricies*/
|
||||||
{"m_model", SP_MODELMATRIX},
|
{"m_model", SP_MODELMATRIX},
|
||||||
|
@ -1462,6 +1467,7 @@ static void Shader_ProgAutoFields(program_t *prog, char **cvarfnames)
|
||||||
{"m_modelview", SP_MODELVIEWMATRIX},
|
{"m_modelview", SP_MODELVIEWMATRIX},
|
||||||
{"m_projection", SP_PROJECTIONMATRIX},
|
{"m_projection", SP_PROJECTIONMATRIX},
|
||||||
{"m_modelviewprojection", SP_MODELVIEWPROJECTIONMATRIX},
|
{"m_modelviewprojection", SP_MODELVIEWPROJECTIONMATRIX},
|
||||||
|
{"m_bones", SP_ENTBONEMATRICIES},
|
||||||
|
|
||||||
/*ent properties*/
|
/*ent properties*/
|
||||||
{"e_time", SP_TIME},
|
{"e_time", SP_TIME},
|
||||||
|
@ -3146,7 +3152,7 @@ void Shader_Finish (shader_t *s)
|
||||||
if (TEXVALID(s->defaulttextures.base))
|
if (TEXVALID(s->defaulttextures.base))
|
||||||
s->flags &= ~SHADER_NOIMAGE;
|
s->flags &= ~SHADER_NOIMAGE;
|
||||||
|
|
||||||
if (!s->numpasses && !(s->flags & (SHADER_NODRAW|SHADER_SKY)) && !s->fog_dist)
|
if (!s->numpasses && s->sort != SHADER_SORT_PORTAL && !(s->flags & (SHADER_NODRAW|SHADER_SKY)) && !s->fog_dist)
|
||||||
{
|
{
|
||||||
pass = &s->passes[s->numpasses++];
|
pass = &s->passes[s->numpasses++];
|
||||||
pass = &s->passes[0];
|
pass = &s->passes[0];
|
||||||
|
@ -4350,9 +4356,29 @@ shader_t *R_RegisterShader_Flare (char *name)
|
||||||
return &r_shaders[R_LoadShader (name, Shader_DefaultBSPFlare, NULL)];
|
return &r_shaders[R_LoadShader (name, Shader_DefaultBSPFlare, NULL)];
|
||||||
}
|
}
|
||||||
|
|
||||||
shader_t *R_RegisterSkin (char *name)
|
shader_t *R_RegisterSkin (char *shadername, char *modname)
|
||||||
{
|
{
|
||||||
return &r_shaders[R_LoadShader (name, Shader_DefaultSkin, NULL)];
|
shader_t *shader;
|
||||||
|
if (modname && !strchr(shadername, '/'))
|
||||||
|
{
|
||||||
|
char newsname[MAX_QPATH];
|
||||||
|
char *b = COM_SkipPath(modname);
|
||||||
|
if (b != modname && b-modname + strlen(shadername)+1 < sizeof(newsname))
|
||||||
|
{
|
||||||
|
memcpy(newsname, modname, b - modname);
|
||||||
|
memcpy(newsname + (b-modname), shadername, strlen(shadername)+1);
|
||||||
|
/*if the specified shader does not contain a path, try and load one relative to the name of the model*/
|
||||||
|
shader = &r_shaders[R_LoadShader (newsname, Shader_DefaultSkin, NULL)];
|
||||||
|
|
||||||
|
R_BuildDefaultTexnums(&shader->defaulttextures, shader);
|
||||||
|
|
||||||
|
/*if its a valid shader with valid textures, use it*/
|
||||||
|
if (!(shader->flags & SHADER_NOIMAGE))
|
||||||
|
return shader;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
shader = &r_shaders[R_LoadShader (shadername, Shader_DefaultSkin, NULL)];
|
||||||
|
return shader;
|
||||||
}
|
}
|
||||||
shader_t *R_RegisterCustom (char *name, shader_gen_t *defaultgen, const void *args)
|
shader_t *R_RegisterCustom (char *name, shader_gen_t *defaultgen, const void *args)
|
||||||
{
|
{
|
||||||
|
|
|
@ -114,7 +114,7 @@ static void SHM_Vertex3fv (const GLfloat *v)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SHM_TriangleFan(int numverts, vecV_t *verts, vec3_t lightorg, float pd)
|
static void SHM_TriangleFan(int numverts, vecV_t *verts, vec3_t lightorg, float pd)
|
||||||
{
|
{
|
||||||
int v, i, idxs;
|
int v, i, idxs;
|
||||||
float *v1;
|
float *v1;
|
||||||
|
@ -196,7 +196,7 @@ static void SHM_Shadow_Cache_Leaf(mleaf_t *leaf)
|
||||||
sh_shmesh->litleaves[i>>3] |= 1<<(i&7);
|
sh_shmesh->litleaves[i>>3] |= 1<<(i&7);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SH_FreeShadowMesh(shadowmesh_t *sm)
|
static void SH_FreeShadowMesh(shadowmesh_t *sm)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
for (i = 0; i < sm->numsurftextures; i++)
|
for (i = 0; i < sm->numsurftextures; i++)
|
||||||
|
@ -738,7 +738,7 @@ static void SHM_MarkLeavesQ1(dlight_t *dl, unsigned char *lvis)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef Q3BSPS
|
#ifdef Q3BSPS
|
||||||
void SHM_RecursiveWorldNodeQ3_r (dlight_t *dl, mnode_t *node)
|
static void SHM_RecursiveWorldNodeQ3_r (dlight_t *dl, mnode_t *node)
|
||||||
{
|
{
|
||||||
mplane_t *splitplane;
|
mplane_t *splitplane;
|
||||||
float dist;
|
float dist;
|
||||||
|
@ -788,6 +788,7 @@ void SHM_RecursiveWorldNodeQ3_r (dlight_t *dl, mnode_t *node)
|
||||||
|
|
||||||
static void SHM_ComposeVolume_BruteForce(dlight_t *dl)
|
static void SHM_ComposeVolume_BruteForce(dlight_t *dl)
|
||||||
{
|
{
|
||||||
|
/*FIXME: This function is not complete*/
|
||||||
shadowmeshsurfs_t *sms;
|
shadowmeshsurfs_t *sms;
|
||||||
unsigned int tno;
|
unsigned int tno;
|
||||||
unsigned int sno;
|
unsigned int sno;
|
||||||
|
@ -859,7 +860,7 @@ static void SHM_ComposeVolume_BruteForce(dlight_t *dl)
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct shadowmesh_s *SHM_BuildShadowVolumeMesh(dlight_t *dl, unsigned char *lvis, unsigned char *vvis)
|
static struct shadowmesh_s *SHM_BuildShadowMesh(dlight_t *dl, unsigned char *lvis, unsigned char *vvis, qboolean surfonly)
|
||||||
{
|
{
|
||||||
float *v1, *v2;
|
float *v1, *v2;
|
||||||
vec3_t v3, v4;
|
vec3_t v3, v4;
|
||||||
|
@ -879,7 +880,8 @@ static struct shadowmesh_s *SHM_BuildShadowVolumeMesh(dlight_t *dl, unsigned cha
|
||||||
SHM_BeginShadowMesh(dl);
|
SHM_BeginShadowMesh(dl);
|
||||||
sh_shadowframe++;
|
sh_shadowframe++;
|
||||||
SHM_RecursiveWorldNodeQ3_r(dl, cl.worldmodel->nodes);
|
SHM_RecursiveWorldNodeQ3_r(dl, cl.worldmodel->nodes);
|
||||||
SHM_ComposeVolume_BruteForce(dl);
|
if (!surfonly)
|
||||||
|
SHM_ComposeVolume_BruteForce(dl);
|
||||||
return SHM_FinishShadowMesh(dl);
|
return SHM_FinishShadowMesh(dl);
|
||||||
// SHM_RecursiveWorldNodeQ3_r(cl.worldmodel->nodes);
|
// SHM_RecursiveWorldNodeQ3_r(cl.worldmodel->nodes);
|
||||||
|
|
||||||
|
@ -901,41 +903,44 @@ static struct shadowmesh_s *SHM_BuildShadowVolumeMesh(dlight_t *dl, unsigned cha
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
SHM_BeginQuads();
|
if (!surfonly)
|
||||||
while(firstedge)
|
|
||||||
{
|
{
|
||||||
//border
|
SHM_BeginQuads();
|
||||||
v1 = cl.worldmodel->vertexes[cl.worldmodel->edges[firstedge].v[0]].position;
|
while(firstedge)
|
||||||
v2 = cl.worldmodel->vertexes[cl.worldmodel->edges[firstedge].v[1]].position;
|
|
||||||
|
|
||||||
//get positions of v3 and v4 based on the light position
|
|
||||||
v3[0] = v1[0] + ( v1[0]-dl->origin[0] )*PROJECTION_DISTANCE;
|
|
||||||
v3[1] = v1[1] + ( v1[1]-dl->origin[1] )*PROJECTION_DISTANCE;
|
|
||||||
v3[2] = v1[2] + ( v1[2]-dl->origin[2] )*PROJECTION_DISTANCE;
|
|
||||||
|
|
||||||
v4[0] = v2[0] + ( v2[0]-dl->origin[0] )*PROJECTION_DISTANCE;
|
|
||||||
v4[1] = v2[1] + ( v2[1]-dl->origin[1] )*PROJECTION_DISTANCE;
|
|
||||||
v4[2] = v2[2] + ( v2[2]-dl->origin[2] )*PROJECTION_DISTANCE;
|
|
||||||
|
|
||||||
if (edge[firstedge].count > 0)
|
|
||||||
{
|
{
|
||||||
SHM_Vertex3fv(v3);
|
//border
|
||||||
SHM_Vertex3fv(v4);
|
v1 = cl.worldmodel->vertexes[cl.worldmodel->edges[firstedge].v[0]].position;
|
||||||
SHM_Vertex3fv(v2);
|
v2 = cl.worldmodel->vertexes[cl.worldmodel->edges[firstedge].v[1]].position;
|
||||||
SHM_Vertex3fv(v1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SHM_Vertex3fv(v1);
|
|
||||||
SHM_Vertex3fv(v2);
|
|
||||||
SHM_Vertex3fv(v4);
|
|
||||||
SHM_Vertex3fv(v3);
|
|
||||||
}
|
|
||||||
edge[firstedge].count=0;
|
|
||||||
|
|
||||||
firstedge = edge[firstedge].next;
|
//get positions of v3 and v4 based on the light position
|
||||||
|
v3[0] = v1[0] + ( v1[0]-dl->origin[0] )*PROJECTION_DISTANCE;
|
||||||
|
v3[1] = v1[1] + ( v1[1]-dl->origin[1] )*PROJECTION_DISTANCE;
|
||||||
|
v3[2] = v1[2] + ( v1[2]-dl->origin[2] )*PROJECTION_DISTANCE;
|
||||||
|
|
||||||
|
v4[0] = v2[0] + ( v2[0]-dl->origin[0] )*PROJECTION_DISTANCE;
|
||||||
|
v4[1] = v2[1] + ( v2[1]-dl->origin[1] )*PROJECTION_DISTANCE;
|
||||||
|
v4[2] = v2[2] + ( v2[2]-dl->origin[2] )*PROJECTION_DISTANCE;
|
||||||
|
|
||||||
|
if (edge[firstedge].count > 0)
|
||||||
|
{
|
||||||
|
SHM_Vertex3fv(v3);
|
||||||
|
SHM_Vertex3fv(v4);
|
||||||
|
SHM_Vertex3fv(v2);
|
||||||
|
SHM_Vertex3fv(v1);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SHM_Vertex3fv(v1);
|
||||||
|
SHM_Vertex3fv(v2);
|
||||||
|
SHM_Vertex3fv(v4);
|
||||||
|
SHM_Vertex3fv(v3);
|
||||||
|
}
|
||||||
|
edge[firstedge].count=0;
|
||||||
|
|
||||||
|
firstedge = edge[firstedge].next;
|
||||||
|
}
|
||||||
|
SHM_End();
|
||||||
}
|
}
|
||||||
SHM_End();
|
|
||||||
|
|
||||||
firstedge=0;
|
firstedge=0;
|
||||||
|
|
||||||
|
@ -1082,7 +1087,7 @@ static qboolean Sh_ScissorForBox(vec3_t mins, vec3_t maxs)
|
||||||
v[1] = (i & 2) ? mins[1] : maxs[1];
|
v[1] = (i & 2) ? mins[1] : maxs[1];
|
||||||
v[2] = (i & 4) ? mins[2] : maxs[2];
|
v[2] = (i & 4) ? mins[2] : maxs[2];
|
||||||
v[3] = 1.0f;
|
v[3] = 1.0f;
|
||||||
Matrix4_Project(v, v2, r_refdef.viewangles, r_refdef.vieworg, r_refdef.fov_x, r_refdef.fov_y);
|
Matrix4x4_CM_Project(v, v2, r_refdef.viewangles, r_refdef.vieworg, r_refdef.fov_x, r_refdef.fov_y);
|
||||||
v2[0]*=r_view_width;
|
v2[0]*=r_view_width;
|
||||||
v2[1]*=r_view_height;
|
v2[1]*=r_view_height;
|
||||||
// GL_TransformToScreen(v, v2);
|
// GL_TransformToScreen(v, v2);
|
||||||
|
@ -1154,7 +1159,7 @@ static qboolean Sh_ScissorForBox(vec3_t mins, vec3_t maxs)
|
||||||
v[1] = v2[0] * vright[1] + v2[1] * vup[1] + v2[2] * vpn[1] + r_refdef.vieworg[1];
|
v[1] = v2[0] * vright[1] + v2[1] * vup[1] + v2[2] * vpn[1] + r_refdef.vieworg[1];
|
||||||
v[2] = v2[0] * vright[2] + v2[1] * vup[2] + v2[2] * vpn[2] + r_refdef.vieworg[2];
|
v[2] = v2[0] * vright[2] + v2[1] * vup[2] + v2[2] * vpn[2] + r_refdef.vieworg[2];
|
||||||
v[3] = 1.0f;
|
v[3] = 1.0f;
|
||||||
Matrix4_Project(v, v2, r_refdef.viewangles, r_refdef.vieworg, r_refdef.fov_x, r_refdef.fov_y);
|
Matrix4x4_CM_Project(v, v2, r_refdef.viewangles, r_refdef.vieworg, r_refdef.fov_x, r_refdef.fov_y);
|
||||||
v2[0]*=r_view_width;
|
v2[0]*=r_view_width;
|
||||||
v2[1]*=r_view_height;
|
v2[1]*=r_view_height;
|
||||||
//Con_Printf("%.3f %.3f %.3f %.3f transformed to %.3f %.3f %.3f %.3f\n", v[0], v[1], v[2], v[3], v2[0], v2[1], v2[2], v2[3]);
|
//Con_Printf("%.3f %.3f %.3f %.3f transformed to %.3f %.3f %.3f %.3f\n", v[0], v[1], v[2], v[3], v2[0], v2[1], v2[2], v2[3]);
|
||||||
|
@ -1183,7 +1188,7 @@ static qboolean Sh_ScissorForBox(vec3_t mins, vec3_t maxs)
|
||||||
v[1] = (i & 2) ? mins[1] : maxs[1];
|
v[1] = (i & 2) ? mins[1] : maxs[1];
|
||||||
v[2] = (i & 4) ? mins[2] : maxs[2];
|
v[2] = (i & 4) ? mins[2] : maxs[2];
|
||||||
v[3] = 1.0f;
|
v[3] = 1.0f;
|
||||||
Matrix4_Project(v, v2, r_refdef.viewangles, r_refdef.vieworg, r_refdef.fov_x, r_refdef.fov_y);
|
Matrix4x4_CM_Project(v, v2, r_refdef.viewangles, r_refdef.vieworg, r_refdef.fov_x, r_refdef.fov_y);
|
||||||
v2[0]*=r_view_width;
|
v2[0]*=r_view_width;
|
||||||
v2[1]*=r_view_height;
|
v2[1]*=r_view_height;
|
||||||
//Con_Printf("%.3f %.3f %.3f %.3f transformed to %.3f %.3f %.3f %.3f\n", v[0], v[1], v[2], v[3], v2[0], v2[1], v2[2], v2[3]);
|
//Con_Printf("%.3f %.3f %.3f %.3f transformed to %.3f %.3f %.3f %.3f\n", v[0], v[1], v[2], v[3], v2[0], v2[1], v2[2], v2[3]);
|
||||||
|
@ -1251,7 +1256,8 @@ void GL_EndRenderBuffer_DepthOnly(texid_t depthtexture, int texsize)
|
||||||
|
|
||||||
static void Sh_GenShadowFace(dlight_t *l, shadowmesh_t *smesh, int face, float proj[16])
|
static void Sh_GenShadowFace(dlight_t *l, shadowmesh_t *smesh, int face, float proj[16])
|
||||||
{
|
{
|
||||||
float mvm[16];
|
qboolean oxv;
|
||||||
|
float mvm[16], sav[16];
|
||||||
vec3_t t1,t2;
|
vec3_t t1,t2;
|
||||||
|
|
||||||
int smsize = SHADOWMAP_SIZE;
|
int smsize = SHADOWMAP_SIZE;
|
||||||
|
@ -1270,38 +1276,40 @@ static void Sh_GenShadowFace(dlight_t *l, shadowmesh_t *smesh, int face, float p
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
//forward
|
//forward
|
||||||
Matrix4_ModelViewMatrixFromAxis(mvm, l->axis[0], l->axis[1], l->axis[2], l->origin);
|
Matrix4x4_CM_ModelViewMatrixFromAxis(mvm, l->axis[0], l->axis[1], l->axis[2], l->origin);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
//back
|
//back
|
||||||
VectorNegate(l->axis[0], t1);
|
VectorNegate(l->axis[0], t1);
|
||||||
VectorNegate(l->axis[1], t2);
|
VectorNegate(l->axis[1], t2);
|
||||||
Matrix4_ModelViewMatrixFromAxis(mvm, t1, t2, l->axis[2], l->origin);
|
Matrix4x4_CM_ModelViewMatrixFromAxis(mvm, t1, t2, l->axis[2], l->origin);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
//left
|
//left
|
||||||
VectorNegate(l->axis[1], t1);
|
VectorNegate(l->axis[1], t1);
|
||||||
VectorNegate(l->axis[0], t2);
|
VectorNegate(l->axis[0], t2);
|
||||||
Matrix4_ModelViewMatrixFromAxis(mvm, l->axis[1], t2, l->axis[2], l->origin);
|
Matrix4x4_CM_ModelViewMatrixFromAxis(mvm, l->axis[1], t2, l->axis[2], l->origin);
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
//right
|
//right
|
||||||
VectorNegate(l->axis[1], t1);
|
VectorNegate(l->axis[1], t1);
|
||||||
Matrix4_ModelViewMatrixFromAxis(mvm, t1, l->axis[0], l->axis[2], l->origin);
|
Matrix4x4_CM_ModelViewMatrixFromAxis(mvm, t1, l->axis[0], l->axis[2], l->origin);
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
//up
|
//up
|
||||||
VectorNegate(l->axis[0], t2);
|
VectorNegate(l->axis[0], t2);
|
||||||
Matrix4_ModelViewMatrixFromAxis(mvm, l->axis[2], l->axis[1], t2, l->origin);
|
Matrix4x4_CM_ModelViewMatrixFromAxis(mvm, l->axis[2], l->axis[1], t2, l->origin);
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
//down
|
//down
|
||||||
VectorNegate(l->axis[2], t1);
|
VectorNegate(l->axis[2], t1);
|
||||||
Matrix4_ModelViewMatrixFromAxis(mvm, t1, l->axis[1], l->axis[0], l->origin);
|
Matrix4x4_CM_ModelViewMatrixFromAxis(mvm, t1, l->axis[1], l->axis[0], l->origin);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
qglMatrixMode(GL_MODELVIEW);
|
qglMatrixMode(GL_MODELVIEW);
|
||||||
|
memcpy(sav, r_refdef.m_view, sizeof(r_refdef.m_view));
|
||||||
|
memcpy(r_refdef.m_view, mvm, sizeof(r_refdef.m_view));
|
||||||
qglLoadMatrixf(mvm);
|
qglLoadMatrixf(mvm);
|
||||||
|
|
||||||
R_SetFrustum(proj, mvm);
|
R_SetFrustum(proj, mvm);
|
||||||
|
@ -1317,7 +1325,11 @@ static void Sh_GenShadowFace(dlight_t *l, shadowmesh_t *smesh, int face, float p
|
||||||
}
|
}
|
||||||
|
|
||||||
BE_SelectMode(BEM_DEPTHONLY);
|
BE_SelectMode(BEM_DEPTHONLY);
|
||||||
|
/*shadow meshes are always drawn as an external view*/
|
||||||
|
oxv = r_refdef.externalview;
|
||||||
|
r_refdef.externalview = true;
|
||||||
BE_BaseEntTextures();
|
BE_BaseEntTextures();
|
||||||
|
r_refdef.externalview = oxv;
|
||||||
|
|
||||||
if (0)
|
if (0)
|
||||||
{
|
{
|
||||||
|
@ -1341,6 +1353,8 @@ static void Sh_GenShadowFace(dlight_t *l, shadowmesh_t *smesh, int face, float p
|
||||||
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP);
|
||||||
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
memcpy(r_refdef.m_view, sav, sizeof(r_refdef.m_view));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sh_Shutdown(void)
|
void Sh_Shutdown(void)
|
||||||
|
@ -1373,7 +1387,7 @@ void Sh_GenShadowMap (dlight_t *l, qbyte *lvis)
|
||||||
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
qglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP);
|
||||||
}
|
}
|
||||||
|
|
||||||
smesh = SHM_BuildShadowVolumeMesh(l, lvis, NULL);
|
smesh = SHM_BuildShadowMesh(l, lvis, NULL, true);
|
||||||
|
|
||||||
/*polygon offsets. urgh.*/
|
/*polygon offsets. urgh.*/
|
||||||
qglEnable(GL_POLYGON_OFFSET_FILL);
|
qglEnable(GL_POLYGON_OFFSET_FILL);
|
||||||
|
@ -1386,7 +1400,7 @@ void Sh_GenShadowMap (dlight_t *l, qbyte *lvis)
|
||||||
|
|
||||||
if (l->fov)
|
if (l->fov)
|
||||||
{
|
{
|
||||||
Matrix4_Projection_Far(proj, l->fov, l->fov, nearplane, l->radius);
|
Matrix4x4_CM_Projection_Far(proj, l->fov, l->fov, nearplane, l->radius);
|
||||||
qglMatrixMode(GL_PROJECTION);
|
qglMatrixMode(GL_PROJECTION);
|
||||||
qglLoadMatrixf(proj);
|
qglLoadMatrixf(proj);
|
||||||
|
|
||||||
|
@ -1395,7 +1409,7 @@ void Sh_GenShadowMap (dlight_t *l, qbyte *lvis)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Matrix4_Projection_Far(proj, 90, 90, nearplane, l->radius);
|
Matrix4x4_CM_Projection_Far(proj, 90, 90, nearplane, l->radius);
|
||||||
qglMatrixMode(GL_PROJECTION);
|
qglMatrixMode(GL_PROJECTION);
|
||||||
qglLoadMatrixf(proj);
|
qglLoadMatrixf(proj);
|
||||||
|
|
||||||
|
@ -1485,11 +1499,11 @@ static void Sh_DrawShadowMapLight(dlight_t *l, vec3_t colour, qbyte *vvis)
|
||||||
Sh_GenShadowMap(l, lvis);
|
Sh_GenShadowMap(l, lvis);
|
||||||
|
|
||||||
if (l->fov)
|
if (l->fov)
|
||||||
Matrix4_Projection_Far(proj, l->fov, l->fov, nearplane, l->radius);
|
Matrix4x4_CM_Projection_Far(proj, l->fov, l->fov, nearplane, l->radius);
|
||||||
else
|
else
|
||||||
Matrix4_Projection_Far(proj, 90, 90, nearplane, l->radius);
|
Matrix4x4_CM_Projection_Far(proj, 90, 90, nearplane, l->radius);
|
||||||
VectorMA(l->origin, 0, l->axis[0], biasorg);
|
VectorMA(l->origin, 0, l->axis[0], biasorg);
|
||||||
Matrix4_ModelViewMatrixFromAxis(view, l->axis[0], l->axis[1], l->axis[2], l->origin);
|
Matrix4x4_CM_ModelViewMatrixFromAxis(view, l->axis[0], l->axis[1], l->axis[2], l->origin);
|
||||||
|
|
||||||
//bp = shadowprojectionbias*proj*view;
|
//bp = shadowprojectionbias*proj*view;
|
||||||
Matrix4_Multiply(shadowprojectionbias, proj, t);
|
Matrix4_Multiply(shadowprojectionbias, proj, t);
|
||||||
|
@ -1716,7 +1730,7 @@ static void Sh_DrawStencilLightShadows(dlight_t *dl, qbyte *lvis, qbyte *vvis, q
|
||||||
|
|
||||||
BE_PushOffsetShadow(false);
|
BE_PushOffsetShadow(false);
|
||||||
|
|
||||||
sm = SHM_BuildShadowVolumeMesh(dl, lvis, vvis);
|
sm = SHM_BuildShadowMesh(dl, lvis, vvis, false);
|
||||||
if (!sm)
|
if (!sm)
|
||||||
Sh_DrawBrushModelShadow(dl, &r_worldentity);
|
Sh_DrawBrushModelShadow(dl, &r_worldentity);
|
||||||
else
|
else
|
||||||
|
@ -2009,8 +2023,7 @@ static void Sh_DrawShadowlessLight(dlight_t *dl, vec3_t colour, qbyte *vvis)
|
||||||
leaf = cl.worldmodel->funcs.LeafnumForPoint(cl.worldmodel, dl->origin);
|
leaf = cl.worldmodel->funcs.LeafnumForPoint(cl.worldmodel, dl->origin);
|
||||||
lvis = cl.worldmodel->funcs.LeafPVS(cl.worldmodel, leaf, lvisb, sizeof(lvisb));
|
lvis = cl.worldmodel->funcs.LeafPVS(cl.worldmodel, leaf, lvisb, sizeof(lvisb));
|
||||||
|
|
||||||
if (!dl->die)
|
SHM_BuildShadowMesh(dl, lvis, vvis, false);
|
||||||
SHM_BuildShadowVolumeMesh(dl, lvis, vvis);
|
|
||||||
|
|
||||||
if (!Sh_VisOverlaps(lvis, vvis)) //The two viewing areas do not intersect.
|
if (!Sh_VisOverlaps(lvis, vvis)) //The two viewing areas do not intersect.
|
||||||
{
|
{
|
||||||
|
|
|
@ -155,7 +155,9 @@ FTEPFNGLGETVERTEXATTRIBIV qglGetVertexAttribiv;
|
||||||
FTEPFNGLENABLEVERTEXATTRIBARRAY qglEnableVertexAttribArray;
|
FTEPFNGLENABLEVERTEXATTRIBARRAY qglEnableVertexAttribArray;
|
||||||
FTEPFNGLDISABLEVERTEXATTRIBARRAY qglDisableVertexAttribArray;
|
FTEPFNGLDISABLEVERTEXATTRIBARRAY qglDisableVertexAttribArray;
|
||||||
FTEPFNGLGETUNIFORMLOCATIONARBPROC qglGetUniformLocationARB;
|
FTEPFNGLGETUNIFORMLOCATIONARBPROC qglGetUniformLocationARB;
|
||||||
FTEPFNGLUNIFORMMATRIX4FVARBPROC qglUniformMatrix4fvARB;
|
FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4fvARB;
|
||||||
|
FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix3x4fv;
|
||||||
|
FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4x3fv;
|
||||||
FTEPFNGLUNIFORM4FARBPROC qglUniform4fARB;
|
FTEPFNGLUNIFORM4FARBPROC qglUniform4fARB;
|
||||||
FTEPFNGLUNIFORM4FVARBPROC qglUniform4fvARB;
|
FTEPFNGLUNIFORM4FVARBPROC qglUniform4fvARB;
|
||||||
FTEPFNGLUNIFORM3FARBPROC qglUniform3fARB;
|
FTEPFNGLUNIFORM3FARBPROC qglUniform3fARB;
|
||||||
|
@ -569,7 +571,42 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name), float ver)
|
||||||
// glslang
|
// glslang
|
||||||
//the gf2 to gf4 cards emulate vertex_shader and thus supports shader_objects.
|
//the gf2 to gf4 cards emulate vertex_shader and thus supports shader_objects.
|
||||||
//but our code kinda requires both for clean workings.
|
//but our code kinda requires both for clean workings.
|
||||||
if (GL_CheckExtension("GL_ARB_fragment_shader")
|
if (gl_config.glversion >= 2)
|
||||||
|
{
|
||||||
|
/*core names are different from extension names (more functions too)*/
|
||||||
|
gl_config.arb_shader_objects = true;
|
||||||
|
qglCreateProgramObjectARB = (void *)getglext( "glCreateProgram");
|
||||||
|
qglDeleteProgramObject_ = (void *)getglext( "glDeleteProgram");
|
||||||
|
qglDeleteShaderObject_ = (void *)getglext( "glDeleteShader");
|
||||||
|
qglUseProgramObjectARB = (void *)getglext( "glUseProgram");
|
||||||
|
qglCreateShaderObjectARB = (void *)getglext( "glCreateShader");
|
||||||
|
qglGetProgramParameteriv_ = (void *)getglext( "glGetProgramiv");
|
||||||
|
qglGetShaderParameteriv_ = (void *)getglext( "glGetShaderiv");
|
||||||
|
qglAttachObjectARB = (void *)getglext( "glAttachShader");
|
||||||
|
qglGetProgramInfoLog_ = (void *)getglext( "glGetProgramInfoLog");
|
||||||
|
qglGetShaderInfoLog_ = (void *)getglext( "glGetShaderInfoLog");
|
||||||
|
qglShaderSourceARB = (void *)getglext("glShaderSource");
|
||||||
|
qglCompileShaderARB = (void *)getglext("glCompileShader");
|
||||||
|
qglLinkProgramARB = (void *)getglext("glLinkProgram");
|
||||||
|
qglBindAttribLocationARB = (void *)getglext("glBindAttribLocation");
|
||||||
|
qglGetAttribLocationARB = (void *)getglext("glGetAttribLocation");
|
||||||
|
qglVertexAttribPointer = (void *)getglext("glVertexAttribPointer");
|
||||||
|
qglGetVertexAttribiv = (void *)getglext("glGetVertexAttribiv");
|
||||||
|
qglEnableVertexAttribArray = (void *)getglext("glEnableVertexAttribArray");
|
||||||
|
qglDisableVertexAttribArray = (void *)getglext("glDisableVertexAttribArray");
|
||||||
|
qglGetUniformLocationARB = (void *)getglext("glGetUniformLocation");
|
||||||
|
qglUniformMatrix4fvARB = (void *)getglext("glUniformMatrix4fv");
|
||||||
|
qglUniformMatrix3x4fv = (void *)getglext("glUniformMatrix3x4fv");
|
||||||
|
qglUniformMatrix4x3fv = (void *)getglext("glUniformMatrix4x3fv");
|
||||||
|
qglUniform4fARB = (void *)getglext("glUniform4f");
|
||||||
|
qglUniform4fvARB = (void *)getglext("glUniform4fv");
|
||||||
|
qglUniform3fARB = (void *)getglext("glUniform3f");
|
||||||
|
qglUniform3fvARB = (void *)getglext("glUniform3fv");
|
||||||
|
qglUniform1iARB = (void *)getglext("glUniform1i");
|
||||||
|
qglUniform1fARB = (void *)getglext("glUniform1f");
|
||||||
|
Con_DPrintf("GLSL available\n");
|
||||||
|
}
|
||||||
|
else if (GL_CheckExtension("GL_ARB_fragment_shader")
|
||||||
&& GL_CheckExtension("GL_ARB_vertex_shader")
|
&& GL_CheckExtension("GL_ARB_vertex_shader")
|
||||||
&& GL_CheckExtension("GL_ARB_shader_objects"))
|
&& GL_CheckExtension("GL_ARB_shader_objects"))
|
||||||
{
|
{
|
||||||
|
@ -595,6 +632,8 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name), float ver)
|
||||||
qglDisableVertexAttribArray = (void *)getglext("glDisableVertexAttribArrayARB");
|
qglDisableVertexAttribArray = (void *)getglext("glDisableVertexAttribArrayARB");
|
||||||
qglGetUniformLocationARB = (void *)getglext("glGetUniformLocationARB");
|
qglGetUniformLocationARB = (void *)getglext("glGetUniformLocationARB");
|
||||||
qglUniformMatrix4fvARB = (void *)getglext("glUniformMatrix4fvARB");
|
qglUniformMatrix4fvARB = (void *)getglext("glUniformMatrix4fvARB");
|
||||||
|
qglUniformMatrix3x4fv = (void *)getglext("glUniformMatrix3x4fvARB");
|
||||||
|
qglUniformMatrix4x3fv = (void *)getglext("glUniformMatrix4x3fvARB");
|
||||||
qglUniform4fARB = (void *)getglext("glUniform4fARB");
|
qglUniform4fARB = (void *)getglext("glUniform4fARB");
|
||||||
qglUniform4fvARB = (void *)getglext("glUniform4fvARB");
|
qglUniform4fvARB = (void *)getglext("glUniform4fvARB");
|
||||||
qglUniform3fARB = (void *)getglext("glUniform3fARB");
|
qglUniform3fARB = (void *)getglext("glUniform3fARB");
|
||||||
|
@ -604,39 +643,6 @@ void GL_CheckExtensions (void *(*getglfunction) (char *name), float ver)
|
||||||
|
|
||||||
Con_DPrintf("GLSL available\n");
|
Con_DPrintf("GLSL available\n");
|
||||||
}
|
}
|
||||||
else if (gl_config.gles && gl_config.glversion >= 2)
|
|
||||||
{
|
|
||||||
/*core names are different from extension names (more functions too)*/
|
|
||||||
gl_config.arb_shader_objects = true;
|
|
||||||
qglCreateProgramObjectARB = (void *)getglext( "glCreateProgram");
|
|
||||||
qglDeleteProgramObject_ = (void *)getglext( "glDeleteProgram");
|
|
||||||
qglDeleteShaderObject_ = (void *)getglext( "glDeleteShader");
|
|
||||||
qglUseProgramObjectARB = (void *)getglext( "glUseProgram");
|
|
||||||
qglCreateShaderObjectARB = (void *)getglext( "glCreateShader");
|
|
||||||
qglGetProgramParameteriv_ = (void *)getglext( "glGetProgramiv");
|
|
||||||
qglGetShaderParameteriv_ = (void *)getglext( "glGetShaderiv");
|
|
||||||
qglAttachObjectARB = (void *)getglext( "glAttachShader");
|
|
||||||
qglGetProgramInfoLog_ = (void *)getglext( "glGetProgramInfoLog");
|
|
||||||
qglGetShaderInfoLog_ = (void *)getglext( "glGetShaderInfoLog");
|
|
||||||
qglShaderSourceARB = (void *)getglext("glShaderSource");
|
|
||||||
qglCompileShaderARB = (void *)getglext("glCompileShader");
|
|
||||||
qglLinkProgramARB = (void *)getglext("glLinkProgram");
|
|
||||||
qglBindAttribLocationARB = (void *)getglext("glBindAttribLocation");
|
|
||||||
qglGetAttribLocationARB = (void *)getglext("glGetAttribLocation");
|
|
||||||
qglVertexAttribPointer = (void *)getglext("glVertexAttribPointer");
|
|
||||||
qglGetVertexAttribiv = (void *)getglext("glGetVertexAttribiv");
|
|
||||||
qglEnableVertexAttribArray = (void *)getglext("glEnableVertexAttribArray");
|
|
||||||
qglDisableVertexAttribArray = (void *)getglext("glDisableVertexAttribArray");
|
|
||||||
qglGetUniformLocationARB = (void *)getglext("glGetUniformLocation");
|
|
||||||
qglUniformMatrix4fvARB = (void *)getglext("glUniformMatrix4fv");
|
|
||||||
qglUniform4fARB = (void *)getglext("glUniform4f");
|
|
||||||
qglUniform4fvARB = (void *)getglext("glUniform4fv");
|
|
||||||
qglUniform3fARB = (void *)getglext("glUniform3f");
|
|
||||||
qglUniform3fvARB = (void *)getglext("glUniform3fv");
|
|
||||||
qglUniform1iARB = (void *)getglext("glUniform1i");
|
|
||||||
qglUniform1fARB = (void *)getglext("glUniform1f");
|
|
||||||
Con_DPrintf("GLSL available\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GL_CheckExtension("GL_EXT_framebuffer_object"))
|
if (GL_CheckExtension("GL_EXT_framebuffer_object"))
|
||||||
{
|
{
|
||||||
|
@ -683,6 +689,9 @@ GLhandleARB GLSlang_CreateShader (char *name, char *versionline, char **precompi
|
||||||
if (versionline)
|
if (versionline)
|
||||||
prstrings[strings++] = versionline;
|
prstrings[strings++] = versionline;
|
||||||
|
|
||||||
|
while(*precompilerconstants)
|
||||||
|
prstrings[strings++] = *precompilerconstants++;
|
||||||
|
|
||||||
prstrings[strings++] = "#define ENGINE_"DISTRIBUTION"\n";
|
prstrings[strings++] = "#define ENGINE_"DISTRIBUTION"\n";
|
||||||
switch (shadertype)
|
switch (shadertype)
|
||||||
{
|
{
|
||||||
|
@ -697,22 +706,44 @@ GLhandleARB GLSlang_CreateShader (char *name, char *versionline, char **precompi
|
||||||
prstrings[strings++] = "#define VERTEX_SHADER\n";
|
prstrings[strings++] = "#define VERTEX_SHADER\n";
|
||||||
if (gl_config.gles)
|
if (gl_config.gles)
|
||||||
{
|
{
|
||||||
prstrings[strings++] = "#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
|
prstrings[strings++] =
|
||||||
"precision highp float;\n"
|
"#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
|
||||||
"#else\n"
|
"precision highp float;\n"
|
||||||
"precision mediump float;\n"
|
"#else\n"
|
||||||
"#endif\n";
|
"precision mediump float;\n"
|
||||||
|
"#endif\n";
|
||||||
}
|
}
|
||||||
if (gl_config.nofixedfunc)
|
if (gl_config.nofixedfunc)
|
||||||
{
|
{
|
||||||
prstrings[strings++] = "#define ftetransform() (m_projection * m_modelview * vec4(v_position, 1.0))\n"
|
prstrings[strings++] =
|
||||||
"uniform mat4 m_modelview, m_projection;\n"
|
"#define ftetransform() (m_projection * m_modelview * vec4(v_position, 1.0))\n"
|
||||||
"attribute vec3 v_position;\n";
|
"uniform mat4 m_modelview, m_projection;\n"
|
||||||
|
"attribute vec3 v_position;\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
prstrings[strings++] = "#define ftetransform() ftransform()\n"
|
prstrings[strings++] =
|
||||||
"#define v_position gl_Vertex\n";
|
"#ifdef SKELETAL\n"
|
||||||
|
"attribute vec4 v_bone;\n"
|
||||||
|
"attribute vec4 v_weight;\n"
|
||||||
|
"uniform mat4 m_modelview, m_projection;\n"
|
||||||
|
"uniform mat3x4 m_bones["STRINGIFY(MAX_BONES)"];\n"
|
||||||
|
"#define v_position gl_Vertex\n"
|
||||||
|
|
||||||
|
"vec4 skeletaltransform()\n"
|
||||||
|
"{"
|
||||||
|
" mat3x4 wmat;\n"
|
||||||
|
" wmat = m_bones[int(v_bone.x)] * v_weight.x;\n"
|
||||||
|
" wmat += m_bones[int(v_bone.y)] * v_weight.y;\n"
|
||||||
|
" wmat += m_bones[int(v_bone.z)] * v_weight.z;\n"
|
||||||
|
" wmat += m_bones[int(v_bone.w)] * v_weight.w;\n"
|
||||||
|
" return m_projection * m_modelview * vec4(v_position * wmat, v_position.w);\n"
|
||||||
|
"}\n"
|
||||||
|
"#define ftetransform() skeletaltransform()\n"
|
||||||
|
"#else\n"
|
||||||
|
"#define ftetransform() ftransform()\n"
|
||||||
|
"#define v_position gl_Vertex\n"
|
||||||
|
"#endif\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
@ -720,8 +751,6 @@ GLhandleARB GLSlang_CreateShader (char *name, char *versionline, char **precompi
|
||||||
prstrings[strings++] = "#define UNKNOWN_SHADER\n";
|
prstrings[strings++] = "#define UNKNOWN_SHADER\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
while(*precompilerconstants)
|
|
||||||
prstrings[strings++] = *precompilerconstants++;
|
|
||||||
prstrings[strings++] = shadersource;
|
prstrings[strings++] = shadersource;
|
||||||
|
|
||||||
shader = qglCreateShaderObjectARB(shadertype);
|
shader = qglCreateShaderObjectARB(shadertype);
|
||||||
|
@ -789,6 +818,8 @@ GLhandleARB GLSlang_CreateProgramObject (GLhandleARB vert, GLhandleARB frag)
|
||||||
qglBindAttribLocationARB(program, 4, "v_normal");
|
qglBindAttribLocationARB(program, 4, "v_normal");
|
||||||
qglBindAttribLocationARB(program, 5, "v_snormal");
|
qglBindAttribLocationARB(program, 5, "v_snormal");
|
||||||
qglBindAttribLocationARB(program, 6, "v_tnormal");
|
qglBindAttribLocationARB(program, 6, "v_tnormal");
|
||||||
|
qglBindAttribLocationARB(program, 8, "v_bone");
|
||||||
|
qglBindAttribLocationARB(program, 9, "v_weight");
|
||||||
|
|
||||||
qglLinkProgramARB(program);
|
qglLinkProgramARB(program);
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ typedef void (APIENTRYP FTEPFNGLDISABLEVERTEXATTRIBARRAY) (GLuint index);
|
||||||
typedef GLint (APIENTRYP FTEPFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
|
typedef GLint (APIENTRYP FTEPFNGLGETUNIFORMLOCATIONARBPROC) (GLhandleARB programObj, const GLcharARB *name);
|
||||||
typedef void (APIENTRYP FTEPFNGLGETVERTEXATTRIBIV) (GLuint index, GLenum pname, GLint *params);
|
typedef void (APIENTRYP FTEPFNGLGETVERTEXATTRIBIV) (GLuint index, GLenum pname, GLint *params);
|
||||||
typedef void (APIENTRYP FTEPFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
typedef void (APIENTRYP FTEPFNGLUNIFORM4FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3);
|
||||||
typedef void (APIENTRYP FTEPFNGLUNIFORMMATRIX4FVARBPROC) (GLint location, GLsizei count, GLboolean transpose, GLfloat *value);
|
typedef void (APIENTRYP FTEPFNGLUNIFORMMATRIXPROC) (GLint location, GLsizei count, GLboolean transpose, GLfloat *value);
|
||||||
typedef void (APIENTRYP FTEPFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, GLfloat *value);
|
typedef void (APIENTRYP FTEPFNGLUNIFORM4FVARBPROC) (GLint location, GLsizei count, GLfloat *value);
|
||||||
typedef void (APIENTRYP FTEPFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
typedef void (APIENTRYP FTEPFNGLUNIFORM3FARBPROC) (GLint location, GLfloat v0, GLfloat v1, GLfloat v2);
|
||||||
typedef void (APIENTRYP FTEPFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, GLfloat *value);
|
typedef void (APIENTRYP FTEPFNGLUNIFORM3FVARBPROC) (GLint location, GLsizei count, GLfloat *value);
|
||||||
|
@ -332,10 +332,9 @@ void R_DrawHLModel(entity_t *curent);
|
||||||
//
|
//
|
||||||
// gl_rlight.c
|
// gl_rlight.c
|
||||||
//
|
//
|
||||||
#ifdef GLQUAKE
|
|
||||||
void GLR_MarkLights (dlight_t *light, int bit, mnode_t *node);
|
|
||||||
void GLR_MarkQ2Lights (dlight_t *light, int bit, mnode_t *node);
|
|
||||||
void GLR_RenderDlights (void);
|
void GLR_RenderDlights (void);
|
||||||
|
#ifdef GLQUAKE
|
||||||
|
void GLR_MarkQ2Lights (dlight_t *light, int bit, mnode_t *node);
|
||||||
void R_InitFlashblends (void);
|
void R_InitFlashblends (void);
|
||||||
int GLR_LightPoint (vec3_t p);
|
int GLR_LightPoint (vec3_t p);
|
||||||
#endif
|
#endif
|
||||||
|
@ -781,7 +780,9 @@ extern FTEPFNGLGETVERTEXATTRIBIV qglGetVertexAttribiv;
|
||||||
extern FTEPFNGLENABLEVERTEXATTRIBARRAY qglEnableVertexAttribArray;
|
extern FTEPFNGLENABLEVERTEXATTRIBARRAY qglEnableVertexAttribArray;
|
||||||
extern FTEPFNGLDISABLEVERTEXATTRIBARRAY qglDisableVertexAttribArray;
|
extern FTEPFNGLDISABLEVERTEXATTRIBARRAY qglDisableVertexAttribArray;
|
||||||
extern FTEPFNGLGETUNIFORMLOCATIONARBPROC qglGetUniformLocationARB;
|
extern FTEPFNGLGETUNIFORMLOCATIONARBPROC qglGetUniformLocationARB;
|
||||||
extern FTEPFNGLUNIFORMMATRIX4FVARBPROC qglUniformMatrix4fvARB;
|
extern FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4fvARB;
|
||||||
|
extern FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix4x3fv;
|
||||||
|
extern FTEPFNGLUNIFORMMATRIXPROC qglUniformMatrix3x4fv;
|
||||||
extern FTEPFNGLUNIFORM4FARBPROC qglUniform4fARB;
|
extern FTEPFNGLUNIFORM4FARBPROC qglUniform4fARB;
|
||||||
extern FTEPFNGLUNIFORM4FVARBPROC qglUniform4fvARB;
|
extern FTEPFNGLUNIFORM4FVARBPROC qglUniform4fvARB;
|
||||||
extern FTEPFNGLUNIFORM3FARBPROC qglUniform3fARB;
|
extern FTEPFNGLUNIFORM3FARBPROC qglUniform3fARB;
|
||||||
|
|
|
@ -253,8 +253,9 @@ enum{
|
||||||
PERMUTATION_LOWER = 8,
|
PERMUTATION_LOWER = 8,
|
||||||
PERMUTATION_UPPER = 16,
|
PERMUTATION_UPPER = 16,
|
||||||
PERMUTATION_OFFSET = 32,
|
PERMUTATION_OFFSET = 32,
|
||||||
|
PERMUTATION_SKELETAL = 64,
|
||||||
|
|
||||||
PERMUTATIONS = 64
|
PERMUTATIONS = 128
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
@ -268,6 +269,8 @@ typedef struct {
|
||||||
SP_ATTR_NORMALS,
|
SP_ATTR_NORMALS,
|
||||||
SP_ATTR_SNORMALS,
|
SP_ATTR_SNORMALS,
|
||||||
SP_ATTR_TNORMALS,
|
SP_ATTR_TNORMALS,
|
||||||
|
SP_ATTR_BONENUMS, /*skeletal only*/
|
||||||
|
SP_ATTR_BONEWEIGHTS, /*skeletal only*/
|
||||||
|
|
||||||
SP_FIRSTUNIFORM, //never set
|
SP_FIRSTUNIFORM, //never set
|
||||||
|
|
||||||
|
@ -281,6 +284,7 @@ typedef struct {
|
||||||
SP_E_L_MUL,
|
SP_E_L_MUL,
|
||||||
SP_E_L_AMBIENT,
|
SP_E_L_AMBIENT,
|
||||||
|
|
||||||
|
SP_ENTBONEMATRICIES,
|
||||||
SP_EYEPOS,
|
SP_EYEPOS,
|
||||||
SP_ENTMATRIX,
|
SP_ENTMATRIX,
|
||||||
SP_VIEWMATRIX,
|
SP_VIEWMATRIX,
|
||||||
|
@ -405,7 +409,7 @@ shader_t *R_RegisterShader (char *name, const char *shaderscript);
|
||||||
shader_t *R_RegisterShader_Lightmap (char *name);
|
shader_t *R_RegisterShader_Lightmap (char *name);
|
||||||
shader_t *R_RegisterShader_Vertex (char *name);
|
shader_t *R_RegisterShader_Vertex (char *name);
|
||||||
shader_t *R_RegisterShader_Flare (char *name);
|
shader_t *R_RegisterShader_Flare (char *name);
|
||||||
shader_t *R_RegisterSkin (char *name);
|
shader_t *R_RegisterSkin (char *shadername, char *modname);
|
||||||
shader_t *R_RegisterCustom (char *name, shader_gen_t *defaultgen, const void *args);
|
shader_t *R_RegisterCustom (char *name, shader_gen_t *defaultgen, const void *args);
|
||||||
void R_BuildDefaultTexnums(texnums_t *tn, shader_t *shader);
|
void R_BuildDefaultTexnums(texnums_t *tn, shader_t *shader);
|
||||||
|
|
||||||
|
|
|
@ -69,12 +69,16 @@ void PRAddressableFlush(progfuncs_t *progfuncs, int totalammount)
|
||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addressablehunk)
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
VirtualFree(addressablehunk, 0, MEM_RELEASE); //doesn't this look complicated? :p
|
if (addressablehunk && addressablesize != totalammount)
|
||||||
addressablehunk = VirtualAlloc (NULL, totalammount, MEM_RESERVE, PAGE_NOACCESS);
|
{
|
||||||
|
VirtualFree(addressablehunk, 0, MEM_RELEASE); //doesn't this look complicated? :p
|
||||||
|
addressablehunk = NULL;
|
||||||
|
}
|
||||||
|
addressablehunk = VirtualAlloc (addressablehunk, totalammount, MEM_RESERVE, PAGE_NOACCESS);
|
||||||
#else
|
#else
|
||||||
free(addressablehunk);
|
if (addressablehunk)
|
||||||
|
free(addressablehunk);
|
||||||
addressablehunk = malloc(totalammount); //linux will allocate-on-use anyway, which is handy.
|
addressablehunk = malloc(totalammount); //linux will allocate-on-use anyway, which is handy.
|
||||||
// memset(addressablehunk, 0xff, totalammount);
|
// memset(addressablehunk, 0xff, totalammount);
|
||||||
#endif
|
#endif
|
||||||
|
@ -507,6 +511,7 @@ char *ASMCALL PR_StringToNative (progfuncs_t *progfuncs, string_t str)
|
||||||
int i = str & ~0x80000000;
|
int i = str & ~0x80000000;
|
||||||
if (i >= prinst->numallocedstrings)
|
if (i >= prinst->numallocedstrings)
|
||||||
{
|
{
|
||||||
|
printf("invalid string %x\n", str);
|
||||||
pr_trace = 1;
|
pr_trace = 1;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -514,6 +519,7 @@ char *ASMCALL PR_StringToNative (progfuncs_t *progfuncs, string_t str)
|
||||||
return prinst->allocedstrings[i];
|
return prinst->allocedstrings[i];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
printf("invalid string %x\n", str);
|
||||||
pr_trace = 1;
|
pr_trace = 1;
|
||||||
return ""; //urm, was freed...
|
return ""; //urm, was freed...
|
||||||
}
|
}
|
||||||
|
@ -523,6 +529,7 @@ char *ASMCALL PR_StringToNative (progfuncs_t *progfuncs, string_t str)
|
||||||
int i = str & ~0x40000000;
|
int i = str & ~0x40000000;
|
||||||
if (i >= prinst->numtempstrings)
|
if (i >= prinst->numtempstrings)
|
||||||
{
|
{
|
||||||
|
printf("invalid temp string %x\n", str);
|
||||||
pr_trace = 1;
|
pr_trace = 1;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -532,6 +539,7 @@ char *ASMCALL PR_StringToNative (progfuncs_t *progfuncs, string_t str)
|
||||||
|
|
||||||
if (str >= progfuncs->stringtablesize)
|
if (str >= progfuncs->stringtablesize)
|
||||||
{
|
{
|
||||||
|
printf("invalid string offset %x\n", str);
|
||||||
pr_trace = 1;
|
pr_trace = 1;
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -774,8 +782,8 @@ void CloseProgs(progfuncs_t *inst)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (inst->prinst->allocedstrings)
|
if (inst->prinst->allocedstrings)
|
||||||
f(inst->prinst->allocedstrings);
|
f(inst->prinst->allocedstrings);
|
||||||
inst->prinst->allocedstrings = NULL;
|
inst->prinst->allocedstrings = NULL;
|
||||||
if (inst->prinst->tempstrings)
|
if (inst->prinst->tempstrings)
|
||||||
f(inst->prinst->tempstrings);
|
f(inst->prinst->tempstrings);
|
||||||
inst->prinst->tempstrings = NULL;
|
inst->prinst->tempstrings = NULL;
|
||||||
|
|
|
@ -436,6 +436,7 @@ char *EvaluateDebugString(progfuncs_t *progfuncs, char *key)
|
||||||
int type;
|
int type;
|
||||||
ddef32_t fakedef;
|
ddef32_t fakedef;
|
||||||
eval_t fakeval;
|
eval_t fakeval;
|
||||||
|
edictrun_t *ed;
|
||||||
|
|
||||||
assignment = strchr(key, '=');
|
assignment = strchr(key, '=');
|
||||||
if (assignment)
|
if (assignment)
|
||||||
|
@ -478,7 +479,10 @@ char *EvaluateDebugString(progfuncs_t *progfuncs, char *key)
|
||||||
if (c)*c = '.';
|
if (c)*c = '.';
|
||||||
if (!fdef)
|
if (!fdef)
|
||||||
return "(Bad string)";
|
return "(Bad string)";
|
||||||
val = (eval_t *) (((char *)PROG_TO_EDICT(progfuncs, val->_int)->fields) + fdef->ofs*4);
|
ed = PROG_TO_EDICT(progfuncs, val->_int);
|
||||||
|
if (!ed)
|
||||||
|
return "(Invalid Entity)";
|
||||||
|
val = (eval_t *) (((char *)ed->fields) + fdef->ofs*4);
|
||||||
type = fdef->type;
|
type = fdef->type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -859,9 +863,9 @@ void PR_ExecuteCode (progfuncs_t *progfuncs, int s)
|
||||||
|
|
||||||
prinst->continuestatement = -1;
|
prinst->continuestatement = -1;
|
||||||
#ifdef QCJIT
|
#ifdef QCJIT
|
||||||
if (prinst->jit)
|
if (current_progstate->jit)
|
||||||
{
|
{
|
||||||
PR_EnterJIT(progfuncs, prinst->jit, s);
|
PR_EnterJIT(progfuncs, current_progstate->jit, s);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -94,7 +94,7 @@ progsnum_t PR_LoadProgs(progfuncs_t *progfuncs, char *s, int headercrc, builtin_
|
||||||
progfuncs->numprogs = a+1;
|
progfuncs->numprogs = a+1;
|
||||||
|
|
||||||
#ifdef QCJIT
|
#ifdef QCJIT
|
||||||
prinst->jit = PR_GenerateJit(progfuncs);
|
current_progstate->jit = PR_GenerateJit(progfuncs);
|
||||||
#endif
|
#endif
|
||||||
if (oldtype>=0)
|
if (oldtype>=0)
|
||||||
PR_SwitchProgs(progfuncs, oldtype);
|
PR_SwitchProgs(progfuncs, oldtype);
|
||||||
|
@ -122,6 +122,10 @@ void PR_Clear(progfuncs_t *progfuncs)
|
||||||
unsigned int a;
|
unsigned int a;
|
||||||
for (a = 0; a < maxprogs; a++)
|
for (a = 0; a < maxprogs; a++)
|
||||||
{
|
{
|
||||||
|
#ifdef QCJIT
|
||||||
|
if (pr_progstate[a].jit)
|
||||||
|
PR_CloseJit(pr_progstate[a].jit);
|
||||||
|
#endif
|
||||||
pr_progstate[a].progs = NULL;
|
pr_progstate[a].progs = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -208,13 +208,17 @@ int ASMCALL PR_EnterFunction (progfuncs_t *progfuncs, dfunction_t *f, int progsn
|
||||||
|
|
||||||
void PR_CloseJit(struct jitstate *jit)
|
void PR_CloseJit(struct jitstate *jit)
|
||||||
{
|
{
|
||||||
free(jit->statementjumps);
|
if (jit)
|
||||||
free(jit->statementoffsets);
|
{
|
||||||
|
free(jit->statementjumps);
|
||||||
|
free(jit->statementoffsets);
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
munmap(jit->code, jit->jitstatements * 500);
|
munmap(jit->code, jit->jitstatements * 500);
|
||||||
#else
|
#else
|
||||||
free(jit->code);
|
free(jit->code);
|
||||||
#endif
|
#endif
|
||||||
|
free(jit)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define EmitByte(v) EmitByte(jit, v)
|
#define EmitByte(v) EmitByte(jit, v)
|
||||||
|
|
|
@ -201,6 +201,10 @@ typedef struct progstate_s
|
||||||
int *linenums; //debug versions only
|
int *linenums; //debug versions only
|
||||||
|
|
||||||
progstructtype_t structtype;
|
progstructtype_t structtype;
|
||||||
|
|
||||||
|
#ifdef QCJIT
|
||||||
|
struct jitstate *jit;
|
||||||
|
#endif
|
||||||
} progstate_t;
|
} progstate_t;
|
||||||
|
|
||||||
typedef struct extensionbuiltin_s {
|
typedef struct extensionbuiltin_s {
|
||||||
|
@ -343,9 +347,6 @@ void PR_SetBuiltins(int type);
|
||||||
#define vars(type, name, size) type name[size]
|
#define vars(type, name, size) type name[size]
|
||||||
|
|
||||||
typedef struct prinst_s {
|
typedef struct prinst_s {
|
||||||
#ifdef QCJIT
|
|
||||||
struct jitstate *jit;
|
|
||||||
#endif
|
|
||||||
char **tempstrings;
|
char **tempstrings;
|
||||||
int maxtempstrings;
|
int maxtempstrings;
|
||||||
int numtempstrings;
|
int numtempstrings;
|
||||||
|
@ -481,6 +482,7 @@ pbool CompileFile(progfuncs_t *progfuncs, char *filename);
|
||||||
struct jitstate;
|
struct jitstate;
|
||||||
struct jitstate *PR_GenerateJit(progfuncs_t *progfuncs);
|
struct jitstate *PR_GenerateJit(progfuncs_t *progfuncs);
|
||||||
void PR_EnterJIT(progfuncs_t *progfuncs, struct jitstate *jitstate, int statement);
|
void PR_EnterJIT(progfuncs_t *progfuncs, struct jitstate *jitstate, int statement);
|
||||||
|
void PR_CloseJit(struct jitstate *jit);
|
||||||
|
|
||||||
char *QCC_COM_Parse (char *data);
|
char *QCC_COM_Parse (char *data);
|
||||||
extern char qcc_token[1024];
|
extern char qcc_token[1024];
|
||||||
|
|
|
@ -2581,8 +2581,19 @@ QCC_def_t *QCC_PR_ParseImmediate (void)
|
||||||
|
|
||||||
if (pr_immediate_type == type_string)
|
if (pr_immediate_type == type_string)
|
||||||
{
|
{
|
||||||
cn = QCC_MakeStringDef(pr_immediate_string);
|
char tmp[8192];
|
||||||
QCC_PR_Lex ();
|
strcpy(tmp, pr_immediate_string);
|
||||||
|
|
||||||
|
for(;;)
|
||||||
|
{
|
||||||
|
QCC_PR_Lex ();
|
||||||
|
if (pr_token_type == tt_immediate && pr_token_type == tt_immediate)
|
||||||
|
strcat(tmp, pr_immediate_string);
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
cn = QCC_MakeStringDef(tmp);
|
||||||
return cn;
|
return cn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9396,6 +9407,11 @@ void QCC_PR_ParseDefs (char *classname)
|
||||||
G_FUNCTION(def->ofs+arraypart*type->size+parttype->ofs) = G_FUNCTION(d->ofs);
|
G_FUNCTION(def->ofs+arraypart*type->size+parttype->ofs) = G_FUNCTION(d->ofs);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ev_struct:
|
||||||
|
case ev_union:
|
||||||
|
QCC_PR_ParseError(ERR_TYPEINVALIDINSTRUCT, "nested struct intializers are not supported");
|
||||||
|
QCC_PR_Lex();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
QCC_PR_ParseError(ERR_TYPEINVALIDINSTRUCT, "type %i not valid in a struct", parttype->type);
|
QCC_PR_ParseError(ERR_TYPEINVALIDINSTRUCT, "type %i not valid in a struct", parttype->type);
|
||||||
QCC_PR_Lex();
|
QCC_PR_Lex();
|
||||||
|
|
|
@ -36,46 +36,47 @@ void ED_Print (struct progfuncs_s *progfuncs, struct edict_s *ed);
|
||||||
int PR_EnableEBFSBuiltin(char *name, int binum);
|
int PR_EnableEBFSBuiltin(char *name, int binum);
|
||||||
|
|
||||||
/*cvars for the gamecode only*/
|
/*cvars for the gamecode only*/
|
||||||
cvar_t nomonsters = SCVAR("nomonsters", "0");
|
cvar_t nomonsters = CVAR("nomonsters", "0");
|
||||||
cvar_t gamecfg = SCVAR("gamecfg", "0");
|
cvar_t gamecfg = CVAR("gamecfg", "0");
|
||||||
cvar_t scratch1 = SCVAR("scratch1", "0");
|
cvar_t scratch1 = CVAR("scratch1", "0");
|
||||||
cvar_t scratch2 = SCVAR("scratch2", "0");
|
cvar_t scratch2 = CVAR("scratch2", "0");
|
||||||
cvar_t scratch3 = SCVAR("scratch3", "0");
|
cvar_t scratch3 = CVAR("scratch3", "0");
|
||||||
cvar_t scratch4 = SCVAR("scratch4", "0");
|
cvar_t scratch4 = CVAR("scratch4", "0");
|
||||||
cvar_t savedgamecfg = SCVARF("savedgamecfg", "0", CVAR_ARCHIVE);
|
cvar_t savedgamecfg = CVARF("savedgamecfg", "0", CVAR_ARCHIVE);
|
||||||
cvar_t saved1 = SCVARF("saved1", "0", CVAR_ARCHIVE);
|
cvar_t saved1 = CVARF("saved1", "0", CVAR_ARCHIVE);
|
||||||
cvar_t saved2 = SCVARF("saved2", "0", CVAR_ARCHIVE);
|
cvar_t saved2 = CVARF("saved2", "0", CVAR_ARCHIVE);
|
||||||
cvar_t saved3 = SCVARF("saved3", "0", CVAR_ARCHIVE);
|
cvar_t saved3 = CVARF("saved3", "0", CVAR_ARCHIVE);
|
||||||
cvar_t saved4 = SCVARF("saved4", "0", CVAR_ARCHIVE);
|
cvar_t saved4 = CVARF("saved4", "0", CVAR_ARCHIVE);
|
||||||
cvar_t temp1 = SCVARF("temp1", "0", CVAR_ARCHIVE);
|
cvar_t temp1 = CVARF("temp1", "0", CVAR_ARCHIVE);
|
||||||
cvar_t noexit = SCVAR("noexit", "0");
|
cvar_t noexit = CVAR("noexit", "0");
|
||||||
|
cvar_t pr_ssqc_memsize = CVAR("pr_ssqc_memsize", "-1");
|
||||||
|
|
||||||
/*cvars purely for compat with others*/
|
/*cvars purely for compat with others*/
|
||||||
cvar_t dpcompat_trailparticles = SCVAR("dpcompat_trailparticles", "0");
|
cvar_t dpcompat_trailparticles = CVAR("dpcompat_trailparticles", "0");
|
||||||
cvar_t pr_imitatemvdsv = SCVARF("pr_imitatemvdsv", "0", CVAR_LATCH);
|
cvar_t pr_imitatemvdsv = CVARF("pr_imitatemvdsv", "0", CVAR_LATCH);
|
||||||
|
|
||||||
/*compat with frikqcc's arrays (ensures that unknown fields are at the same offsets*/
|
/*compat with frikqcc's arrays (ensures that unknown fields are at the same offsets*/
|
||||||
cvar_t pr_fixbrokenqccarrays = SCVARF("pr_fixbrokenqccarrays", "1", CVAR_LATCH);
|
cvar_t pr_fixbrokenqccarrays = CVARF("pr_fixbrokenqccarrays", "1", CVAR_LATCH);
|
||||||
|
|
||||||
/*other stuff*/
|
/*other stuff*/
|
||||||
cvar_t pr_maxedicts = SCVARF("pr_maxedicts", "2048", CVAR_LATCH);
|
cvar_t pr_maxedicts = CVARF("pr_maxedicts", "2048", CVAR_LATCH);
|
||||||
|
|
||||||
cvar_t pr_no_playerphysics = SCVARF("pr_no_playerphysics", "0", CVAR_LATCH);
|
cvar_t pr_no_playerphysics = CVARF("pr_no_playerphysics", "0", CVAR_LATCH);
|
||||||
cvar_t pr_no_parsecommand = SCVARF("pr_no_parsecommand", "0", 0);
|
cvar_t pr_no_parsecommand = CVARF("pr_no_parsecommand", "0", 0);
|
||||||
|
|
||||||
cvar_t progs = CVARAF("progs", "", "sv_progs", CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_NOTFROMSERVER);
|
cvar_t progs = CVARAF("progs", "", "sv_progs", CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_NOTFROMSERVER);
|
||||||
cvar_t qc_nonetaccess = SCVAR("qc_nonetaccess", "0"); //prevent write_... builtins from doing anything. This means we can run any mod, specific to any engine, on the condition that it also has a qw or nq crc.
|
cvar_t qc_nonetaccess = CVAR("qc_nonetaccess", "0"); //prevent write_... builtins from doing anything. This means we can run any mod, specific to any engine, on the condition that it also has a qw or nq crc.
|
||||||
|
|
||||||
cvar_t pr_overridebuiltins = SCVAR("pr_overridebuiltins", "1");
|
cvar_t pr_overridebuiltins = CVAR("pr_overridebuiltins", "1");
|
||||||
|
|
||||||
cvar_t pr_compatabilitytest = SCVARF("pr_compatabilitytest", "0", CVAR_LATCH);
|
cvar_t pr_compatabilitytest = CVARF("pr_compatabilitytest", "0", CVAR_LATCH);
|
||||||
|
|
||||||
cvar_t pr_ssqc_coreonerror = SCVAR("pr_coreonerror", "1");
|
cvar_t pr_ssqc_coreonerror = CVAR("pr_coreonerror", "1");
|
||||||
|
|
||||||
cvar_t pr_droptofloorunits = SCVAR("pr_droptofloorunits", "");
|
cvar_t pr_droptofloorunits = CVAR("pr_droptofloorunits", "");
|
||||||
|
|
||||||
cvar_t sv_gameplayfix_honest_tracelines = SCVAR("sv_gameplayfix_honest_tracelines", "1");
|
cvar_t sv_gameplayfix_honest_tracelines = CVAR("sv_gameplayfix_honest_tracelines", "1");
|
||||||
cvar_t sv_gameplayfix_blowupfallenzombies = SCVAR("sv_gameplayfix_blowupfallenzombies", "0");
|
cvar_t sv_gameplayfix_blowupfallenzombies = CVAR("sv_gameplayfix_blowupfallenzombies", "0");
|
||||||
extern cvar_t sv_gameplayfix_noairborncorpse;
|
extern cvar_t sv_gameplayfix_noairborncorpse;
|
||||||
|
|
||||||
cvar_t sv_addon[MAXADDONS];
|
cvar_t sv_addon[MAXADDONS];
|
||||||
|
@ -525,6 +526,10 @@ void PR_LoadGlabalStruct(void)
|
||||||
static float dimension_send_default;
|
static float dimension_send_default;
|
||||||
static float zero_default;
|
static float zero_default;
|
||||||
//static vec3_t vecwriteonly; // 523:16: warning: unused variable ‘vecwriteonly’
|
//static vec3_t vecwriteonly; // 523:16: warning: unused variable ‘vecwriteonly’
|
||||||
|
static float input_buttons_default;
|
||||||
|
static float input_timelength_default;
|
||||||
|
static vec3_t input_angles_default;
|
||||||
|
static vec3_t input_movevalues_default;
|
||||||
int i;
|
int i;
|
||||||
int *v;
|
int *v;
|
||||||
nqglobalvars_t *pr_globals = pr_nqglobal_struct;
|
nqglobalvars_t *pr_globals = pr_nqglobal_struct;
|
||||||
|
@ -593,12 +598,17 @@ void PR_LoadGlabalStruct(void)
|
||||||
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
for (i = 0; i < NUM_SPAWN_PARMS; i++)
|
||||||
spawnparamglobals[i] = (float *)PR_FindGlobal(svprogfuncs, va("parm%i", i+1), 0, NULL);
|
spawnparamglobals[i] = (float *)PR_FindGlobal(svprogfuncs, va("parm%i", i+1), 0, NULL);
|
||||||
|
|
||||||
#define ensurefloat(name,var) if (!((nqglobalvars_t*)pr_globals)->name) ((nqglobalvars_t*)pr_globals)->name = &var;
|
#define ensureglobal(name,var) if (!((nqglobalvars_t*)pr_globals)->name) ((nqglobalvars_t*)pr_globals)->name = &var;
|
||||||
|
|
||||||
// make sure these entries are always valid pointers
|
// make sure these entries are always valid pointers
|
||||||
ensurefloat(dimension_send, dimension_send_default);
|
ensureglobal(dimension_send, dimension_send_default);
|
||||||
ensurefloat(trace_endcontents, writeonly);
|
ensureglobal(trace_endcontents, writeonly);
|
||||||
ensurefloat(trace_surfaceflags, writeonly);
|
ensureglobal(trace_surfaceflags, writeonly);
|
||||||
|
|
||||||
|
ensureglobal(input_timelength, input_timelength_default);
|
||||||
|
ensureglobal(input_angles, input_angles_default);
|
||||||
|
ensureglobal(input_movevalues, input_movevalues_default);
|
||||||
|
ensureglobal(input_buttons, input_buttons_default);
|
||||||
|
|
||||||
// qtest renames and missing variables
|
// qtest renames and missing variables
|
||||||
if (!((nqglobalvars_t*)pr_globals)->V_trace_plane_normal)
|
if (!((nqglobalvars_t*)pr_globals)->V_trace_plane_normal)
|
||||||
|
@ -619,16 +629,16 @@ void PR_LoadGlabalStruct(void)
|
||||||
if (!((nqglobalvars_t*)pr_globals)->trace_fraction)
|
if (!((nqglobalvars_t*)pr_globals)->trace_fraction)
|
||||||
SV_Error("Could not find export trace_fraction in progs\n");
|
SV_Error("Could not find export trace_fraction in progs\n");
|
||||||
}
|
}
|
||||||
ensurefloat(serverflags, zero_default);
|
ensureglobal(serverflags, zero_default);
|
||||||
ensurefloat(total_secrets, zero_default);
|
ensureglobal(total_secrets, zero_default);
|
||||||
ensurefloat(total_monsters, zero_default);
|
ensureglobal(total_monsters, zero_default);
|
||||||
ensurefloat(found_secrets, zero_default);
|
ensureglobal(found_secrets, zero_default);
|
||||||
ensurefloat(killed_monsters, zero_default);
|
ensureglobal(killed_monsters, zero_default);
|
||||||
ensurefloat(trace_allsolid, writeonly);
|
ensureglobal(trace_allsolid, writeonly);
|
||||||
ensurefloat(trace_startsolid, writeonly);
|
ensureglobal(trace_startsolid, writeonly);
|
||||||
ensurefloat(trace_plane_dist, writeonly);
|
ensureglobal(trace_plane_dist, writeonly);
|
||||||
ensurefloat(trace_inopen, writeonly);
|
ensureglobal(trace_inopen, writeonly);
|
||||||
ensurefloat(trace_inwater, writeonly);
|
ensureglobal(trace_inwater, writeonly);
|
||||||
|
|
||||||
pr_global_struct->dimension_send = 255;
|
pr_global_struct->dimension_send = 255;
|
||||||
pr_global_struct->serverflags = 0;
|
pr_global_struct->serverflags = 0;
|
||||||
|
@ -871,7 +881,7 @@ void PR_Decompile_f(void)
|
||||||
if (!svprogfuncs)
|
if (!svprogfuncs)
|
||||||
{
|
{
|
||||||
Q_SetProgsParms(false);
|
Q_SetProgsParms(false);
|
||||||
PR_Configure(svprogfuncs, -1, MAX_PROGS);
|
PR_Configure(svprogfuncs, pr_ssqc_memsize.ival, MAX_PROGS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -884,7 +894,7 @@ void PR_Compile_f(void)
|
||||||
{
|
{
|
||||||
int argc=3;
|
int argc=3;
|
||||||
double time = Sys_DoubleTime();
|
double time = Sys_DoubleTime();
|
||||||
char *argv[64] = {"", "-src", "src", "-srcfile", "qwprogs.src"};
|
char *argv[64] = {"", "-src", "src", "-srcfile", "progs.src"};
|
||||||
|
|
||||||
if (Cmd_Argc()>2)
|
if (Cmd_Argc()>2)
|
||||||
{
|
{
|
||||||
|
@ -943,7 +953,7 @@ void PR_ApplyCompilation_f (void)
|
||||||
s = PR_SaveEnts(svprogfuncs, NULL, &len, 1);
|
s = PR_SaveEnts(svprogfuncs, NULL, &len, 1);
|
||||||
|
|
||||||
|
|
||||||
PR_Configure(svprogfuncs, -1, MAX_PROGS);
|
PR_Configure(svprogfuncs, pr_ssqc_memsize.ival, MAX_PROGS);
|
||||||
PR_RegisterFields();
|
PR_RegisterFields();
|
||||||
PR_InitEnts(svprogfuncs, sv.world.max_edicts);
|
PR_InitEnts(svprogfuncs, sv.world.max_edicts);
|
||||||
|
|
||||||
|
@ -1093,6 +1103,7 @@ void PR_Init(void)
|
||||||
Cvar_Register (&pr_overridebuiltins, cvargroup_progs);
|
Cvar_Register (&pr_overridebuiltins, cvargroup_progs);
|
||||||
|
|
||||||
Cvar_Register (&pr_ssqc_coreonerror, cvargroup_progs);
|
Cvar_Register (&pr_ssqc_coreonerror, cvargroup_progs);
|
||||||
|
Cvar_Register (&pr_ssqc_memsize, cvargroup_progs);
|
||||||
|
|
||||||
Cvar_Register (&pr_droptofloorunits, cvargroup_progs);
|
Cvar_Register (&pr_droptofloorunits, cvargroup_progs);
|
||||||
|
|
||||||
|
@ -1131,7 +1142,7 @@ void Q_InitProgs(void)
|
||||||
|
|
||||||
|
|
||||||
// load progs to get entity field count
|
// load progs to get entity field count
|
||||||
PR_Configure(svprogfuncs, -1, MAX_PROGS);
|
PR_Configure(svprogfuncs, pr_ssqc_memsize.ival, MAX_PROGS);
|
||||||
|
|
||||||
PR_RegisterFields();
|
PR_RegisterFields();
|
||||||
|
|
||||||
|
@ -3683,6 +3694,12 @@ static void QCBUILTIN PF_walkmove (progfuncs_t *prinst, struct globalvars_s *pr_
|
||||||
pr_global_struct->self = oldself;
|
pr_global_struct->self = oldself;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PF_sv_touchtriggers(progfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||||
|
{
|
||||||
|
wedict_t *ent = (wedict_t*)PROG_TO_EDICT(prinst, pr_global_struct->self);
|
||||||
|
World_LinkEdict (&sv.world, ent, true);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===============
|
===============
|
||||||
PF_droptofloor
|
PF_droptofloor
|
||||||
|
@ -4953,6 +4970,8 @@ char *PF_infokey_Internal (int entnum, char *key)
|
||||||
sprintf(ov, "%d", SV_CalcPing (&svs.clients[entnum-1], false));
|
sprintf(ov, "%d", SV_CalcPing (&svs.clients[entnum-1], false));
|
||||||
else if (!strcmp(key, "svping"))
|
else if (!strcmp(key, "svping"))
|
||||||
sprintf(ov, "%d", SV_CalcPing (&svs.clients[entnum-1], true));
|
sprintf(ov, "%d", SV_CalcPing (&svs.clients[entnum-1], true));
|
||||||
|
else if (!strcmp(key, "guid"))
|
||||||
|
sprintf(ov, "%s", svs.clients[entnum-1].guid);
|
||||||
else if (!strcmp(key, "*userid"))
|
else if (!strcmp(key, "*userid"))
|
||||||
sprintf(ov, "%d", svs.clients[entnum-1].userid);
|
sprintf(ov, "%d", svs.clients[entnum-1].userid);
|
||||||
else if (!strcmp(key, "download"))
|
else if (!strcmp(key, "download"))
|
||||||
|
@ -8424,9 +8443,9 @@ qboolean SV_RunFullQCMovement(client_t *client, usercmd_t *ucmd)
|
||||||
|
|
||||||
if (host_client->state && host_client->protocol != SCP_BAD)
|
if (host_client->state && host_client->protocol != SCP_BAD)
|
||||||
{
|
{
|
||||||
sv_player->xv->movement[0] = ucmd->forwardmove * host_frametime;
|
sv_player->xv->movement[0] = ucmd->forwardmove;
|
||||||
sv_player->xv->movement[1] = ucmd->sidemove * host_frametime;
|
sv_player->xv->movement[1] = ucmd->sidemove;
|
||||||
sv_player->xv->movement[2] = ucmd->upmove * host_frametime;
|
sv_player->xv->movement[2] = ucmd->upmove;
|
||||||
}
|
}
|
||||||
|
|
||||||
SV_CheckVelocity(sv_player);
|
SV_CheckVelocity(sv_player);
|
||||||
|
@ -9106,6 +9125,7 @@ BuiltinList_t BuiltinList[] = { //nq qw h2 ebfs
|
||||||
{"frameduration", PF_frameduration, 0, 0, 0, 277},//float(float modidx, float framenum) frameduration = #277 (FTE_CSQC_SKELETONOBJECTS)
|
{"frameduration", PF_frameduration, 0, 0, 0, 277},//float(float modidx, float framenum) frameduration = #277 (FTE_CSQC_SKELETONOBJECTS)
|
||||||
|
|
||||||
{"terrain_edit", PF_sv_terrain_edit, 0, 0, 0, 278},//void(float action, vector pos, float radius, float quant) terrain_edit = #278 (??FTE_TERRAIN_EDIT??
|
{"terrain_edit", PF_sv_terrain_edit, 0, 0, 0, 278},//void(float action, vector pos, float radius, float quant) terrain_edit = #278 (??FTE_TERRAIN_EDIT??
|
||||||
|
{"touchtriggers", PF_sv_touchtriggers,0, 0, 0, 279},//void() touchtriggers = #279;
|
||||||
|
|
||||||
//EXT_CSQC
|
//EXT_CSQC
|
||||||
// {"setmodelindex", PF_sv_SetModelIndex,0, 0, 0, 333}, // #333 void(entity e, float mdlindex) setmodelindex (EXT_CSQC)
|
// {"setmodelindex", PF_sv_SetModelIndex,0, 0, 0, 333}, // #333 void(entity e, float mdlindex) setmodelindex (EXT_CSQC)
|
||||||
|
@ -9470,7 +9490,8 @@ 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("executecommand", 83) != 83 ||
|
if (
|
||||||
|
PR_EnableEBFSBuiltin("executecommand", 83) != 83 ||
|
||||||
PR_EnableEBFSBuiltin("mvdtokenize", 84) != 84 ||
|
PR_EnableEBFSBuiltin("mvdtokenize", 84) != 84 ||
|
||||||
PR_EnableEBFSBuiltin("mvdargc", 85) != 85 ||
|
PR_EnableEBFSBuiltin("mvdargc", 85) != 85 ||
|
||||||
PR_EnableEBFSBuiltin("mvdargv", 86) != 86 ||
|
PR_EnableEBFSBuiltin("mvdargv", 86) != 86 ||
|
||||||
|
|
|
@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
|
||||||
#define GAME_API_VERSION 13
|
#define GAME_API_VERSION 13
|
||||||
#define MAX_Q1QVM_EDICTS 768 //according to ktx at api version 12 (fte's protocols go to 2048)
|
#define MAX_Q1QVM_EDICTS 768 //according to ktx at api version 12 (fte's protocols go to 2048)
|
||||||
|
#define MAPNAME_LEN 64
|
||||||
|
|
||||||
#define VMFSID_Q1QVM 57235 //a cookie
|
#define VMFSID_Q1QVM 57235 //a cookie
|
||||||
|
|
||||||
|
@ -1452,6 +1453,9 @@ qboolean PR_LoadQ1QVM(void)
|
||||||
sv.world.progs = &q1qvmprogfuncs;
|
sv.world.progs = &q1qvmprogfuncs;
|
||||||
sv.world.edicts = (wedict_t*)EDICT_NUM(svprogfuncs, 0);
|
sv.world.edicts = (wedict_t*)EDICT_NUM(svprogfuncs, 0);
|
||||||
sv.world.usesolidcorpse = true;
|
sv.world.usesolidcorpse = true;
|
||||||
|
|
||||||
|
if ((unsigned)gd->global->mapname && (unsigned)gd->global->mapname+MAPNAME_LEN < VM_MemoryMask(q1qvm))
|
||||||
|
Q_strncpyz((char*)VM_MemoryBase(q1qvm) + gd->global->mapname, sv.mapname, MAPNAME_LEN);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -370,6 +370,7 @@ typedef struct client_s
|
||||||
char *name;
|
char *name;
|
||||||
char namebuf[32]; // for printing to other people
|
char namebuf[32]; // for printing to other people
|
||||||
// extracted from userinfo
|
// extracted from userinfo
|
||||||
|
char guid[32];
|
||||||
int messagelevel; // for filtering printed messages
|
int messagelevel; // for filtering printed messages
|
||||||
|
|
||||||
// the datagram is written to after every frame, but only cleared
|
// the datagram is written to after every frame, but only cleared
|
||||||
|
@ -504,6 +505,7 @@ typedef struct client_s
|
||||||
#endif
|
#endif
|
||||||
unsigned long zquake_extensions;
|
unsigned long zquake_extensions;
|
||||||
unsigned int max_net_ents;
|
unsigned int max_net_ents;
|
||||||
|
unsigned int maxmodels; /*max models supported by whatever the protocol is*/
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
SCP_BAD, //don't send (a bot)
|
SCP_BAD, //don't send (a bot)
|
||||||
|
|
|
@ -503,7 +503,11 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
|
||||||
if (to->modelindex > 255)
|
if (to->modelindex > 255)
|
||||||
{
|
{
|
||||||
if (protext & PEXT_MODELDBL)
|
if (protext & PEXT_MODELDBL)
|
||||||
|
{
|
||||||
|
if (to->modelindex > 512)
|
||||||
|
bits &= ~U_MODEL;
|
||||||
evenmorebits |= U_MODELDBL;
|
evenmorebits |= U_MODELDBL;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -602,6 +606,9 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
|
||||||
|
|
||||||
if (bits & U_MODEL)
|
if (bits & U_MODEL)
|
||||||
MSG_WriteByte (msg, to->modelindex&255);
|
MSG_WriteByte (msg, to->modelindex&255);
|
||||||
|
else if (evenmorebits & U_MODELDBL)
|
||||||
|
MSG_WriteShort(msg, to->modelindex);
|
||||||
|
|
||||||
if (bits & U_FRAME)
|
if (bits & U_FRAME)
|
||||||
MSG_WriteByte (msg, to->frame);
|
MSG_WriteByte (msg, to->frame);
|
||||||
if (bits & U_COLORMAP)
|
if (bits & U_COLORMAP)
|
||||||
|
|
|
@ -1116,7 +1116,7 @@ void SVC_GetInfo (char *challenge, int fullstatus)
|
||||||
//this is a DP protocol, so some QW fields are not needed
|
//this is a DP protocol, so some QW fields are not needed
|
||||||
Info_RemoveKey(resp, "maxclients");
|
Info_RemoveKey(resp, "maxclients");
|
||||||
Info_RemoveKey(resp, "map");
|
Info_RemoveKey(resp, "map");
|
||||||
Info_SetValueForKey(resp, "gamename", com_gamename.string, sizeof(response) - (resp-response));
|
Info_SetValueForKey(resp, "gamename", com_protocolname.string, sizeof(response) - (resp-response));
|
||||||
Info_SetValueForKey(resp, "modname", com_modname.string, sizeof(response) - (resp-response));
|
Info_SetValueForKey(resp, "modname", com_modname.string, sizeof(response) - (resp-response));
|
||||||
Info_SetValueForKey(resp, "protocol", va("%d", NET_PROTOCOL_VERSION), sizeof(response) - (resp-response));
|
Info_SetValueForKey(resp, "protocol", va("%d", NET_PROTOCOL_VERSION), sizeof(response) - (resp-response));
|
||||||
Info_SetValueForKey(resp, "clients", va("%d", numclients), sizeof(response) - (resp-response));
|
Info_SetValueForKey(resp, "clients", va("%d", numclients), sizeof(response) - (resp-response));
|
||||||
|
@ -1673,6 +1673,7 @@ client_t *SVC_DirectConnect(void)
|
||||||
int version;
|
int version;
|
||||||
int challenge;
|
int challenge;
|
||||||
int huffcrc = 0;
|
int huffcrc = 0;
|
||||||
|
char guid[128] = "";
|
||||||
|
|
||||||
int maxpacketentities;
|
int maxpacketentities;
|
||||||
|
|
||||||
|
@ -1838,6 +1839,10 @@ client_t *SVC_DirectConnect(void)
|
||||||
huffcrc = Q_atoi(Cmd_Argv(1));
|
huffcrc = Q_atoi(Cmd_Argv(1));
|
||||||
Con_DPrintf("Client supports huffman compression. crc 0x%x\n", huffcrc);
|
Con_DPrintf("Client supports huffman compression. crc 0x%x\n", huffcrc);
|
||||||
break;
|
break;
|
||||||
|
case PROTOCOL_INFO_GUID:
|
||||||
|
Q_strncpyz(guid, Cmd_Argv(1), sizeof(guid));
|
||||||
|
Con_DPrintf("GUID %s\n", Cmd_Argv(1));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
msg_badread=false;
|
msg_badread=false;
|
||||||
|
@ -1914,6 +1919,7 @@ client_t *SVC_DirectConnect(void)
|
||||||
newcl->fteprotocolextensions = protextsupported;
|
newcl->fteprotocolextensions = protextsupported;
|
||||||
newcl->fteprotocolextensions2 = protextsupported2;
|
newcl->fteprotocolextensions2 = protextsupported2;
|
||||||
newcl->protocol = protocol;
|
newcl->protocol = protocol;
|
||||||
|
Q_strncpyz(newcl->guid, guid, sizeof(newcl->guid));
|
||||||
|
|
||||||
if (protocol == SCP_QUAKEWORLD) //readd?
|
if (protocol == SCP_QUAKEWORLD) //readd?
|
||||||
{
|
{
|
||||||
|
@ -4681,7 +4687,7 @@ void SV_Init (quakeparms_t *parms)
|
||||||
|
|
||||||
Con_Printf ("%s\n", version_string());
|
Con_Printf ("%s\n", version_string());
|
||||||
|
|
||||||
Con_TPrintf (STL_INITED);
|
Con_TPrintf (STL_INITED, fs_gamename.string);
|
||||||
|
|
||||||
i = COM_CheckParm("+gamedir");
|
i = COM_CheckParm("+gamedir");
|
||||||
if (i)
|
if (i)
|
||||||
|
|
|
@ -2176,8 +2176,8 @@ qboolean SV_Physics (void)
|
||||||
SV_RunEntity(ent);
|
SV_RunEntity(ent);
|
||||||
SV_RunNewmis ();
|
SV_RunNewmis ();
|
||||||
}
|
}
|
||||||
else
|
// else
|
||||||
World_LinkEdict(&sv.world, (wedict_t*)ent, true);
|
// World_LinkEdict(&sv.world, (wedict_t*)ent, true);
|
||||||
continue; // clients are run directly from packets
|
continue; // clients are run directly from packets
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -840,11 +840,12 @@ void SV_StartSound (int ent, vec3_t origin, int seenmask, int channel, char *sam
|
||||||
if (channel & 8)
|
if (channel & 8)
|
||||||
reliable = true; // sounds that break the phs are reliable
|
reliable = true; // sounds that break the phs are reliable
|
||||||
use_phs = false;
|
use_phs = false;
|
||||||
channel &= 7;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
use_phs = attenuation!=0;
|
use_phs = attenuation!=0;
|
||||||
|
|
||||||
|
channel = (channel & 7) | ((channel & 0x1f0) >> 1);
|
||||||
|
|
||||||
// if (channel == CHAN_BODY || channel == CHAN_VOICE)
|
// if (channel == CHAN_BODY || channel == CHAN_VOICE)
|
||||||
// reliable = true;
|
// reliable = true;
|
||||||
|
|
||||||
|
@ -1491,7 +1492,7 @@ void SV_UpdateClientStats (client_t *client, int pnum)
|
||||||
statsi[STAT_WEAPON] = SV_ModelIndex(PR_GetString(svprogfuncs, ent->v->weaponmodel));
|
statsi[STAT_WEAPON] = SV_ModelIndex(PR_GetString(svprogfuncs, ent->v->weaponmodel));
|
||||||
if (host_client->fteprotocolextensions & PEXT_MODELDBL)
|
if (host_client->fteprotocolextensions & PEXT_MODELDBL)
|
||||||
{
|
{
|
||||||
if ((unsigned)statsi[STAT_WEAPON] >= 512)
|
if ((unsigned)statsi[STAT_WEAPON] >= MAX_MODELS)
|
||||||
statsi[STAT_WEAPON] = 0;
|
statsi[STAT_WEAPON] = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -957,7 +957,6 @@ void SV_Modellist_f (void)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
unsigned int n;
|
unsigned int n;
|
||||||
unsigned int maxclientsupportedmodels;
|
|
||||||
|
|
||||||
if (host_client->state != cs_connected)
|
if (host_client->state != cs_connected)
|
||||||
{
|
{
|
||||||
|
@ -1041,10 +1040,10 @@ void SV_Modellist_f (void)
|
||||||
MSG_WriteByte (&host_client->netchan.message, n);
|
MSG_WriteByte (&host_client->netchan.message, n);
|
||||||
}
|
}
|
||||||
|
|
||||||
maxclientsupportedmodels = 256;
|
host_client->maxmodels = 256;
|
||||||
#ifdef PEXT_MODELDBL
|
#ifdef PEXT_MODELDBL
|
||||||
if (host_client->fteprotocolextensions & PEXT_MODELDBL)
|
if (host_client->fteprotocolextensions & PEXT_MODELDBL)
|
||||||
maxclientsupportedmodels *= 2;
|
host_client->maxmodels = MAX_MODELS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SERVER_DEMO_PLAYBACK
|
#ifdef SERVER_DEMO_PLAYBACK
|
||||||
|
@ -1062,7 +1061,7 @@ void SV_Modellist_f (void)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
for (i = 1+n;
|
for (i = 1+n;
|
||||||
i < maxclientsupportedmodels && sv.strings.model_precache[i] && (((i-1)&255)==0 || host_client->netchan.message.cursize < (MAX_QWMSGLEN/2)); //make sure we don't send a 0 next...
|
i < host_client->maxmodels && sv.strings.model_precache[i] && (((i-1)&255)==0 || host_client->netchan.message.cursize < (MAX_QWMSGLEN/2)); //make sure we don't send a 0 next...
|
||||||
i++)
|
i++)
|
||||||
{
|
{
|
||||||
MSG_WriteString (&host_client->netchan.message, sv.strings.model_precache[i]);
|
MSG_WriteString (&host_client->netchan.message, sv.strings.model_precache[i]);
|
||||||
|
@ -1073,7 +1072,7 @@ void SV_Modellist_f (void)
|
||||||
n = 0;
|
n = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i == maxclientsupportedmodels)
|
if (i == host_client->maxmodels)
|
||||||
n = 0; //doh!
|
n = 0; //doh!
|
||||||
|
|
||||||
MSG_WriteByte (&host_client->netchan.message, 0);
|
MSG_WriteByte (&host_client->netchan.message, 0);
|
||||||
|
@ -4188,242 +4187,6 @@ void SV_STFU_f(void)
|
||||||
ClientReliableWrite_String(host_client, msg);
|
ClientReliableWrite_String(host_client, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SV_MVDList_f (void);
|
|
||||||
void SV_MVDInfo_f (void);
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
char *name;
|
|
||||||
void (*func) (void);
|
|
||||||
qboolean noqchandling;
|
|
||||||
} ucmd_t;
|
|
||||||
|
|
||||||
ucmd_t ucmds[] =
|
|
||||||
{
|
|
||||||
{"new", SV_New_f, true},
|
|
||||||
{"pk3list", SV_PK3List_f, true},
|
|
||||||
{"modellist", SV_Modellist_f, true},
|
|
||||||
{"soundlist", SV_Soundlist_f, true},
|
|
||||||
{"prespawn", SV_PreSpawn_f, true},
|
|
||||||
{"spawn", SV_Spawn_f, true},
|
|
||||||
{"begin", SV_Begin_f, true},
|
|
||||||
|
|
||||||
{"al", SV_STFU_f, true},
|
|
||||||
|
|
||||||
{"join", Cmd_Join_f},
|
|
||||||
{"observe", Cmd_Observe_f},
|
|
||||||
|
|
||||||
{"drop", SV_Drop_f},
|
|
||||||
{"disconnect", SV_Drop_f},
|
|
||||||
{"pings", SV_Pings_f},
|
|
||||||
|
|
||||||
// issued by hand at client consoles
|
|
||||||
{"rate", SV_Rate_f},
|
|
||||||
{"kill", SV_Kill_f},
|
|
||||||
{"pause", SV_Pause_f},
|
|
||||||
{"msg", SV_Msg_f},
|
|
||||||
|
|
||||||
{"sayone", SV_SayOne_f},
|
|
||||||
{"say", SV_Say_f},
|
|
||||||
{"say_team", SV_Say_Team_f},
|
|
||||||
|
|
||||||
{"setinfo", SV_SetInfo_f},
|
|
||||||
|
|
||||||
{"serverinfo", SV_ShowServerinfo_f},
|
|
||||||
|
|
||||||
{"dlsize", SV_DownloadSize_f},
|
|
||||||
{"download", SV_BeginDownload_f},
|
|
||||||
{"nextdl", SV_NextDownload_f},
|
|
||||||
|
|
||||||
{"ptrack", SV_PTrack_f}, //ZOID - used with autocam
|
|
||||||
{"enablecsqc", SV_EnableClientsCSQC},
|
|
||||||
{"disablecsqc", SV_DisableClientsCSQC},
|
|
||||||
|
|
||||||
{"snap", SV_NoSnap_f},
|
|
||||||
{"vote", SV_Vote_f},
|
|
||||||
|
|
||||||
#ifdef SVRANKING
|
|
||||||
{"topten", Rank_ListTop10_f},
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{"efpslist", Cmd_FPSList_f}, //don't conflict with the ktpro one
|
|
||||||
{"god", Cmd_God_f},
|
|
||||||
{"give", Cmd_Give_f},
|
|
||||||
{"noclip", Cmd_Noclip_f},
|
|
||||||
{"fly", Cmd_Fly_f},
|
|
||||||
{"notarget", Cmd_Notarget_f},
|
|
||||||
{"setpos", Cmd_SetPos_f},
|
|
||||||
|
|
||||||
{"stopdownload", SV_StopDownload_f},
|
|
||||||
{"demolist", SV_UserCmdMVDList_f},
|
|
||||||
{"demoinfo", SV_MVDInfo_f},
|
|
||||||
|
|
||||||
#ifdef VOICECHAT
|
|
||||||
{"voicetarg", SV_Voice_Target_f},
|
|
||||||
{"vignore", SV_Voice_Ignore_f}, /*ignore/mute specific player*/
|
|
||||||
{"muteall", SV_Voice_MuteAll_f}, /*disables*/
|
|
||||||
{"unmuteall", SV_Voice_UnmuteAll_f}, /*reenables*/
|
|
||||||
#endif
|
|
||||||
|
|
||||||
{NULL, NULL}
|
|
||||||
};
|
|
||||||
|
|
||||||
#ifdef Q2SERVER
|
|
||||||
ucmd_t ucmdsq2[] = {
|
|
||||||
{"new", SV_New_f, true},
|
|
||||||
{"configstrings", SVQ2_ConfigStrings_f, true},
|
|
||||||
{"baselines", SVQ2_BaseLines_f, true},
|
|
||||||
{"begin", SV_Begin_f, true},
|
|
||||||
|
|
||||||
// {"setinfo", SV_SetInfo_f, true},
|
|
||||||
|
|
||||||
{"serverinfo", SV_ShowServerinfo_f, true},
|
|
||||||
{"info", SV_ShowServerinfo_f, true},
|
|
||||||
|
|
||||||
{"download", SV_BeginDownload_f, true},
|
|
||||||
{"nextdl", SV_NextDownload_f, true},
|
|
||||||
|
|
||||||
{"nextserver", SVQ2_NextServer_f, true},
|
|
||||||
|
|
||||||
{"vote", SV_Vote_f, true},
|
|
||||||
|
|
||||||
//#ifdef SVRANKING
|
|
||||||
// {"topten", Rank_ListTop10_f, true},
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
{"drop", SV_Drop_f, true},
|
|
||||||
{"disconnect", SV_Drop_f, true},
|
|
||||||
|
|
||||||
{NULL, NULL}
|
|
||||||
};
|
|
||||||
#endif
|
|
||||||
|
|
||||||
extern ucmd_t nqucmds[];
|
|
||||||
/*
|
|
||||||
==================
|
|
||||||
SV_ExecuteUserCommand
|
|
||||||
==================
|
|
||||||
*/
|
|
||||||
void SV_ExecuteUserCommand (char *s, qboolean fromQC)
|
|
||||||
{
|
|
||||||
ucmd_t *u;
|
|
||||||
client_t *oldhost = host_client;
|
|
||||||
char adr[MAX_ADR_SIZE];
|
|
||||||
|
|
||||||
Con_DPrintf("Client command: %s\n", s);
|
|
||||||
|
|
||||||
Cmd_TokenizeString (s, false, false);
|
|
||||||
sv_player = host_client->edict;
|
|
||||||
|
|
||||||
Cmd_ExecLevel=1;
|
|
||||||
|
|
||||||
if (host_client->controlled && atoi(Cmd_Argv(0))>0) //now see if it's meant to be from a slave client
|
|
||||||
{
|
|
||||||
int pnum = atoi(Cmd_Argv(0));
|
|
||||||
client_t *s;
|
|
||||||
for (s = host_client; s; s = s->controlled)
|
|
||||||
{
|
|
||||||
if (!--pnum)
|
|
||||||
{
|
|
||||||
host_client = s;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
sv_player = host_client->edict;
|
|
||||||
Cmd_ShiftArgs(1, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef Q2SERVER
|
|
||||||
if (ISQ2CLIENT(host_client))
|
|
||||||
u = ucmdsq2;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
#ifdef NQPROT
|
|
||||||
if (ISNQCLIENT(host_client))
|
|
||||||
u = nqucmds;
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
u=ucmds;
|
|
||||||
|
|
||||||
for ( ; u->name ; u++)
|
|
||||||
if (!strcmp (Cmd_Argv(0), u->name) )
|
|
||||||
{
|
|
||||||
if (!fromQC && !u->noqchandling)
|
|
||||||
if (PR_KrimzonParseCommand(s)) //KRIMZON_SV_PARSECLIENTCOMMAND has the opertunity to parse out certain commands.
|
|
||||||
{
|
|
||||||
host_client = oldhost;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// SV_BeginRedirect (RD_CLIENT, host_client->language);
|
|
||||||
if (u->func)
|
|
||||||
u->func ();
|
|
||||||
host_client = oldhost;
|
|
||||||
// SV_EndRedirect ();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!u->name)
|
|
||||||
{
|
|
||||||
#ifdef HLSERVER
|
|
||||||
if (HLSV_ClientCommand(host_client))
|
|
||||||
{
|
|
||||||
host_client = oldhost;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!fromQC)
|
|
||||||
if (PR_UserCmd(s)) //Q2 and MVDSV command handling only happens if the engine didn't recognise it.
|
|
||||||
{
|
|
||||||
host_client = oldhost;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#ifdef SVRANKING
|
|
||||||
if (sv_cmdlikercon.value && host_client->rankid)
|
|
||||||
{
|
|
||||||
char remaining[1024];
|
|
||||||
int i;
|
|
||||||
rankstats_t stats;
|
|
||||||
|
|
||||||
if (!Rank_GetPlayerStats(host_client->rankid, &stats))
|
|
||||||
{
|
|
||||||
host_client = oldhost;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Con_Printf ("cmd from %s:\n%s\n"
|
|
||||||
, host_client->name, net_message.data+4);
|
|
||||||
|
|
||||||
SV_BeginRedirect (RD_CLIENT, host_client->language);
|
|
||||||
|
|
||||||
remaining[0] = 0;
|
|
||||||
|
|
||||||
for (i=0 ; i<Cmd_Argc() ; i++)
|
|
||||||
{
|
|
||||||
if (strlen(remaining)+strlen(Cmd_Argv(i))>=sizeof(remaining)-1)
|
|
||||||
{
|
|
||||||
Con_Printf("cmd was too long\n");
|
|
||||||
host_client = oldhost;
|
|
||||||
SV_EndRedirect ();
|
|
||||||
Con_Printf ("cmd from %s:\n%s\n"
|
|
||||||
, NET_AdrToString (adr, sizeof(adr), net_from), "Was too long - possible buffer overflow attempt");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
strcat (remaining, Cmd_Argv(i) );
|
|
||||||
strcat (remaining, " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
Cmd_ExecuteString (remaining, stats.trustlevel);
|
|
||||||
host_client = oldhost;
|
|
||||||
SV_EndRedirect ();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
Con_Printf ("Bad user command: %s\n", Cmd_Argv(0));
|
|
||||||
}
|
|
||||||
|
|
||||||
host_client = oldhost;
|
|
||||||
SV_EndRedirect ();
|
|
||||||
}
|
|
||||||
#ifdef NQPROT
|
#ifdef NQPROT
|
||||||
void SVNQ_Spawn_f (void)
|
void SVNQ_Spawn_f (void)
|
||||||
{
|
{
|
||||||
|
@ -4822,6 +4585,163 @@ void SV_Pext_f(void)
|
||||||
SV_New_f();
|
SV_New_f();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
void SVNQ_ExecuteUserCommand (char *s)
|
||||||
|
{
|
||||||
|
client_t *oldhost = host_client;
|
||||||
|
ucmd_t *u;
|
||||||
|
|
||||||
|
Cmd_TokenizeString (s, false, false);
|
||||||
|
sv_player = host_client->edict;
|
||||||
|
|
||||||
|
Cmd_ExecLevel=1;
|
||||||
|
|
||||||
|
for (u=nqucmds ; u->name ; u++)
|
||||||
|
{
|
||||||
|
if (!strcmp (Cmd_Argv(0), u->name) )
|
||||||
|
{
|
||||||
|
if (/ *!fromQC && * /!u->noqchandling)
|
||||||
|
if (PR_UserCmd(s))
|
||||||
|
{
|
||||||
|
host_client = oldhost;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!u->func)
|
||||||
|
{
|
||||||
|
SV_BeginRedirect (RD_CLIENT, host_client->language);
|
||||||
|
Con_Printf("Command was disabled\n");
|
||||||
|
SV_EndRedirect ();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SV_BeginRedirect (RD_CLIENT, host_client->language);
|
||||||
|
u->func ();
|
||||||
|
SV_EndRedirect ();
|
||||||
|
}
|
||||||
|
|
||||||
|
host_client = oldhost;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!u->name)
|
||||||
|
Con_Printf("%s tried to \"%s\"\n", host_client->name, s);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
void SV_MVDList_f (void);
|
||||||
|
void SV_MVDInfo_f (void);
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
char *name;
|
||||||
|
void (*func) (void);
|
||||||
|
qboolean noqchandling;
|
||||||
|
} ucmd_t;
|
||||||
|
|
||||||
|
ucmd_t ucmds[] =
|
||||||
|
{
|
||||||
|
{"new", SV_New_f, true},
|
||||||
|
{"pk3list", SV_PK3List_f, true},
|
||||||
|
{"modellist", SV_Modellist_f, true},
|
||||||
|
{"soundlist", SV_Soundlist_f, true},
|
||||||
|
{"prespawn", SV_PreSpawn_f, true},
|
||||||
|
{"spawn", SV_Spawn_f, true},
|
||||||
|
{"begin", SV_Begin_f, true},
|
||||||
|
|
||||||
|
{"al", SV_STFU_f, true},
|
||||||
|
|
||||||
|
{"join", Cmd_Join_f},
|
||||||
|
{"observe", Cmd_Observe_f},
|
||||||
|
|
||||||
|
{"drop", SV_Drop_f},
|
||||||
|
{"disconnect", SV_Drop_f},
|
||||||
|
{"pings", SV_Pings_f},
|
||||||
|
|
||||||
|
// issued by hand at client consoles
|
||||||
|
{"rate", SV_Rate_f},
|
||||||
|
{"kill", SV_Kill_f},
|
||||||
|
{"pause", SV_Pause_f},
|
||||||
|
{"msg", SV_Msg_f},
|
||||||
|
|
||||||
|
{"sayone", SV_SayOne_f},
|
||||||
|
{"say", SV_Say_f},
|
||||||
|
{"say_team", SV_Say_Team_f},
|
||||||
|
|
||||||
|
{"setinfo", SV_SetInfo_f},
|
||||||
|
|
||||||
|
{"serverinfo", SV_ShowServerinfo_f},
|
||||||
|
|
||||||
|
{"dlsize", SV_DownloadSize_f},
|
||||||
|
{"download", SV_BeginDownload_f},
|
||||||
|
{"nextdl", SV_NextDownload_f},
|
||||||
|
|
||||||
|
{"ptrack", SV_PTrack_f}, //ZOID - used with autocam
|
||||||
|
{"enablecsqc", SV_EnableClientsCSQC},
|
||||||
|
{"disablecsqc", SV_DisableClientsCSQC},
|
||||||
|
|
||||||
|
{"snap", SV_NoSnap_f},
|
||||||
|
{"vote", SV_Vote_f},
|
||||||
|
|
||||||
|
#ifdef SVRANKING
|
||||||
|
{"topten", Rank_ListTop10_f},
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{"efpslist", Cmd_FPSList_f}, //don't conflict with the ktpro one
|
||||||
|
{"god", Cmd_God_f},
|
||||||
|
{"give", Cmd_Give_f},
|
||||||
|
{"noclip", Cmd_Noclip_f},
|
||||||
|
{"fly", Cmd_Fly_f},
|
||||||
|
{"notarget", Cmd_Notarget_f},
|
||||||
|
{"setpos", Cmd_SetPos_f},
|
||||||
|
|
||||||
|
{"stopdownload", SV_StopDownload_f},
|
||||||
|
{"demolist", SV_UserCmdMVDList_f},
|
||||||
|
{"demoinfo", SV_MVDInfo_f},
|
||||||
|
|
||||||
|
#ifdef VOICECHAT
|
||||||
|
{"voicetarg", SV_Voice_Target_f},
|
||||||
|
{"vignore", SV_Voice_Ignore_f}, /*ignore/mute specific player*/
|
||||||
|
{"muteall", SV_Voice_MuteAll_f}, /*disables*/
|
||||||
|
{"unmuteall", SV_Voice_UnmuteAll_f}, /*reenables*/
|
||||||
|
#endif
|
||||||
|
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
|
||||||
|
#ifdef Q2SERVER
|
||||||
|
ucmd_t ucmdsq2[] = {
|
||||||
|
{"new", SV_New_f, true},
|
||||||
|
{"configstrings", SVQ2_ConfigStrings_f, true},
|
||||||
|
{"baselines", SVQ2_BaseLines_f, true},
|
||||||
|
{"begin", SV_Begin_f, true},
|
||||||
|
|
||||||
|
// {"setinfo", SV_SetInfo_f, true},
|
||||||
|
|
||||||
|
{"serverinfo", SV_ShowServerinfo_f, true},
|
||||||
|
{"info", SV_ShowServerinfo_f, true},
|
||||||
|
|
||||||
|
{"download", SV_BeginDownload_f, true},
|
||||||
|
{"nextdl", SV_NextDownload_f, true},
|
||||||
|
|
||||||
|
{"nextserver", SVQ2_NextServer_f, true},
|
||||||
|
|
||||||
|
{"vote", SV_Vote_f, true},
|
||||||
|
|
||||||
|
//#ifdef SVRANKING
|
||||||
|
// {"topten", Rank_ListTop10_f, true},
|
||||||
|
//#endif
|
||||||
|
|
||||||
|
{"drop", SV_Drop_f, true},
|
||||||
|
{"disconnect", SV_Drop_f, true},
|
||||||
|
|
||||||
|
{NULL, NULL}
|
||||||
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef NQPROT
|
||||||
ucmd_t nqucmds[] =
|
ucmd_t nqucmds[] =
|
||||||
{
|
{
|
||||||
{"new", SVNQ_New_f, true},
|
{"new", SVNQ_New_f, true},
|
||||||
|
@ -4874,52 +4794,134 @@ ucmd_t nqucmds[] =
|
||||||
|
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
void SVNQ_ExecuteUserCommand (char *s)
|
==================
|
||||||
|
SV_ExecuteUserCommand
|
||||||
|
==================
|
||||||
|
*/
|
||||||
|
void SV_ExecuteUserCommand (char *s, qboolean fromQC)
|
||||||
{
|
{
|
||||||
client_t *oldhost = host_client;
|
|
||||||
ucmd_t *u;
|
ucmd_t *u;
|
||||||
|
client_t *oldhost = host_client;
|
||||||
|
char adr[MAX_ADR_SIZE];
|
||||||
|
|
||||||
|
Con_DPrintf("Client command: %s\n", s);
|
||||||
|
|
||||||
Cmd_TokenizeString (s, false, false);
|
Cmd_TokenizeString (s, false, false);
|
||||||
sv_player = host_client->edict;
|
sv_player = host_client->edict;
|
||||||
|
|
||||||
Cmd_ExecLevel=1;
|
Cmd_ExecLevel=1;
|
||||||
|
|
||||||
for (u=nqucmds ; u->name ; u++)
|
if (host_client->controlled && atoi(Cmd_Argv(0))>0) //now see if it's meant to be from a slave client
|
||||||
{
|
{
|
||||||
|
int pnum = atoi(Cmd_Argv(0));
|
||||||
|
client_t *s;
|
||||||
|
for (s = host_client; s; s = s->controlled)
|
||||||
|
{
|
||||||
|
if (!--pnum)
|
||||||
|
{
|
||||||
|
host_client = s;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sv_player = host_client->edict;
|
||||||
|
Cmd_ShiftArgs(1, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef Q2SERVER
|
||||||
|
if (ISQ2CLIENT(host_client))
|
||||||
|
u = ucmdsq2;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
#ifdef NQPROT
|
||||||
|
if (ISNQCLIENT(host_client))
|
||||||
|
u = nqucmds;
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
u=ucmds;
|
||||||
|
|
||||||
|
for ( ; u->name ; u++)
|
||||||
if (!strcmp (Cmd_Argv(0), u->name) )
|
if (!strcmp (Cmd_Argv(0), u->name) )
|
||||||
{
|
{
|
||||||
if (/ *!fromQC && * /!u->noqchandling)
|
if (!fromQC && !u->noqchandling)
|
||||||
if (PR_UserCmd(s))
|
if (PR_KrimzonParseCommand(s)) //KRIMZON_SV_PARSECLIENTCOMMAND has the opertunity to parse out certain commands.
|
||||||
{
|
{
|
||||||
host_client = oldhost;
|
host_client = oldhost;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// SV_BeginRedirect (RD_CLIENT, host_client->language);
|
||||||
if (!u->func)
|
if (u->func)
|
||||||
{
|
|
||||||
SV_BeginRedirect (RD_CLIENT, host_client->language);
|
|
||||||
Con_Printf("Command was disabled\n");
|
|
||||||
SV_EndRedirect ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SV_BeginRedirect (RD_CLIENT, host_client->language);
|
|
||||||
u->func ();
|
u->func ();
|
||||||
SV_EndRedirect ();
|
host_client = oldhost;
|
||||||
}
|
// SV_EndRedirect ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!u->name)
|
||||||
|
{
|
||||||
|
#ifdef HLSERVER
|
||||||
|
if (HLSV_ClientCommand(host_client))
|
||||||
|
{
|
||||||
host_client = oldhost;
|
host_client = oldhost;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (!u->name)
|
|
||||||
Con_Printf("%s tried to \"%s\"\n", host_client->name, s);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (!fromQC)
|
||||||
|
if (PR_UserCmd(s)) //Q2 and MVDSV command handling only happens if the engine didn't recognise it.
|
||||||
|
{
|
||||||
|
host_client = oldhost;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#ifdef SVRANKING
|
||||||
|
if (sv_cmdlikercon.value && host_client->rankid)
|
||||||
|
{
|
||||||
|
char remaining[1024];
|
||||||
|
int i;
|
||||||
|
rankstats_t stats;
|
||||||
|
|
||||||
|
if (!Rank_GetPlayerStats(host_client->rankid, &stats))
|
||||||
|
{
|
||||||
|
host_client = oldhost;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Con_Printf ("cmd from %s:\n%s\n"
|
||||||
|
, host_client->name, net_message.data+4);
|
||||||
|
|
||||||
|
SV_BeginRedirect (RD_CLIENT, host_client->language);
|
||||||
|
|
||||||
|
remaining[0] = 0;
|
||||||
|
|
||||||
|
for (i=0 ; i<Cmd_Argc() ; i++)
|
||||||
|
{
|
||||||
|
if (strlen(remaining)+strlen(Cmd_Argv(i))>=sizeof(remaining)-1)
|
||||||
|
{
|
||||||
|
Con_Printf("cmd was too long\n");
|
||||||
|
host_client = oldhost;
|
||||||
|
SV_EndRedirect ();
|
||||||
|
Con_Printf ("cmd from %s:\n%s\n"
|
||||||
|
, NET_AdrToString (adr, sizeof(adr), net_from), "Was too long - possible buffer overflow attempt");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
strcat (remaining, Cmd_Argv(i) );
|
||||||
|
strcat (remaining, " ");
|
||||||
|
}
|
||||||
|
|
||||||
|
Cmd_ExecuteString (remaining, stats.trustlevel);
|
||||||
|
host_client = oldhost;
|
||||||
|
SV_EndRedirect ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
Con_Printf ("Bad user command: %s\n", Cmd_Argv(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
host_client = oldhost;
|
||||||
|
SV_EndRedirect ();
|
||||||
|
}
|
||||||
|
|
||||||
int implevels[256];
|
int implevels[256];
|
||||||
qboolean SV_FilterImpulse(int imp, int level)
|
qboolean SV_FilterImpulse(int imp, int level)
|
||||||
|
|
|
@ -111,7 +111,7 @@ int SVQ1_RecursiveLightPoint3C (model_t *model, mnode_t *node, vec3_t start, vec
|
||||||
tex = surf->texinfo;
|
tex = surf->texinfo;
|
||||||
|
|
||||||
s = DotProduct (mid, tex->vecs[0]) + tex->vecs[0][3];
|
s = DotProduct (mid, tex->vecs[0]) + tex->vecs[0][3];
|
||||||
t = DotProduct (mid, tex->vecs[1]) + tex->vecs[1][3];;
|
t = DotProduct (mid, tex->vecs[1]) + tex->vecs[1][3];
|
||||||
|
|
||||||
if (s < surf->texturemins[0] ||
|
if (s < surf->texturemins[0] ||
|
||||||
t < surf->texturemins[1])
|
t < surf->texturemins[1])
|
||||||
|
@ -126,23 +126,20 @@ int SVQ1_RecursiveLightPoint3C (model_t *model, mnode_t *node, vec3_t start, vec
|
||||||
if (!surf->samples)
|
if (!surf->samples)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
ds >>= 4;
|
|
||||||
dt >>= 4;
|
|
||||||
|
|
||||||
lightmap = surf->samples;
|
lightmap = surf->samples;
|
||||||
r = 0;
|
r = 0;
|
||||||
if (lightmap)
|
if (lightmap)
|
||||||
{
|
{
|
||||||
|
|
||||||
lightmap += (dt * ((surf->extents[0]>>4)+1) + ds)*3;
|
lightmap += (dt * ((surf->extents[0])+1) + ds)*3;
|
||||||
|
|
||||||
for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
|
for (maps = 0 ; maps < MAXLIGHTMAPS && surf->styles[maps] != 255 ;
|
||||||
maps++)
|
maps++)
|
||||||
{
|
{
|
||||||
scale = sv.strings.lightstyles[surf->styles[maps]][0];
|
scale = sv.strings.lightstyles[surf->styles[maps]][0];
|
||||||
r += (lightmap[0]+lightmap[1]+lightmap[2])/3 * scale;
|
r += (lightmap[0]+lightmap[1]+lightmap[2])/3 * scale;
|
||||||
lightmap += ((surf->extents[0]>>4)+1) *
|
lightmap += ((surf->extents[0])+1) *
|
||||||
((surf->extents[1]>>4)+1)*3;
|
((surf->extents[1])+1)*3;
|
||||||
}
|
}
|
||||||
|
|
||||||
r >>= 8;
|
r >>= 8;
|
||||||
|
@ -1018,8 +1015,8 @@ void CalcSurfaceExtents (msurface_t *s);
|
||||||
bmins[i] = floor(mins[i]/16);
|
bmins[i] = floor(mins[i]/16);
|
||||||
bmaxs[i] = ceil(maxs[i]/16);
|
bmaxs[i] = ceil(maxs[i]/16);
|
||||||
|
|
||||||
s->texturemins[i] = bmins[i] * 16;
|
s->texturemins[i] = bmins[i];
|
||||||
s->extents[i] = (bmaxs[i] - bmins[i]) * 16;
|
s->extents[i] = (bmaxs[i] - bmins[i]);
|
||||||
// if ( !(tex->flags & TEX_SPECIAL) && s->extents[i] > 256)
|
// if ( !(tex->flags & TEX_SPECIAL) && s->extents[i] > 256)
|
||||||
// SV_Error ("Bad surface extents");
|
// SV_Error ("Bad surface extents");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue