Mostly colourmod stuff. A few fixes for q3 menus, some gamma fixes for q2, more verbose messages for pngs, and hopefully a gamma fix.
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2034 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
125150921e
commit
38c36360f6
35 changed files with 745 additions and 266 deletions
|
@ -854,9 +854,9 @@ void DP5_ParseDelta(entity_state_t *s)
|
|||
}
|
||||
if (bits & E5_COLORMOD)
|
||||
{
|
||||
MSG_ReadByte();
|
||||
MSG_ReadByte();
|
||||
MSG_ReadByte();
|
||||
s->colormod[0] = MSG_ReadByte();
|
||||
s->colormod[1] = MSG_ReadByte();
|
||||
s->colormod[2] = MSG_ReadByte();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1707,10 +1707,10 @@ void CL_LinkPacketEntities (void)
|
|||
//set scale
|
||||
ent->scale = state->scale/16.0;
|
||||
#endif
|
||||
#ifdef PEXT_TRANS
|
||||
//set trans
|
||||
ent->alpha = state->trans/255.0;
|
||||
#endif
|
||||
ent->shaderRGBAf[0] = (state->colormod[0]*8.0f)/255;
|
||||
ent->shaderRGBAf[1] = (state->colormod[1]*8.0f)/255;
|
||||
ent->shaderRGBAf[2] = (state->colormod[2]*8.0f)/255;
|
||||
ent->shaderRGBAf[3] = state->trans/255.0f;
|
||||
#ifdef PEXT_FATNESS
|
||||
//set trans
|
||||
ent->fatness = state->fatness/2.0;
|
||||
|
@ -2255,9 +2255,12 @@ void CL_LinkProjectiles (void)
|
|||
#ifdef PEXT_SCALE
|
||||
ent->scale = 1;
|
||||
#endif
|
||||
#ifdef PEXT_TRANS
|
||||
ent->alpha = 1;
|
||||
#endif
|
||||
|
||||
ent->shaderRGBAf[0] = 1;
|
||||
ent->shaderRGBAf[1] = 1;
|
||||
ent->shaderRGBAf[2] = 1;
|
||||
ent->shaderRGBAf[3] = 1;
|
||||
|
||||
VectorCopy (pr->origin, ent->origin);
|
||||
VectorCopy (pr->angles, ent->angles);
|
||||
|
||||
|
@ -2396,7 +2399,7 @@ void CL_ParsePlayerinfo (void)
|
|||
|
||||
state->hullnum = 1;
|
||||
state->scale = 1*16;
|
||||
state->trans = 255;
|
||||
state->alpha = 255;
|
||||
state->fatness = 0;
|
||||
|
||||
state->pm_type = PM_NORMAL;
|
||||
|
@ -2502,7 +2505,7 @@ void CL_ParsePlayerinfo (void)
|
|||
else
|
||||
state->hullnum = 56;
|
||||
state->scale = 1*16;
|
||||
state->trans = 255;
|
||||
state->alpha = 255;
|
||||
state->fatness = 0;
|
||||
|
||||
#ifdef PEXT_SCALE
|
||||
|
@ -2511,7 +2514,7 @@ void CL_ParsePlayerinfo (void)
|
|||
#endif
|
||||
#ifdef PEXT_TRANS
|
||||
if (flags & PF_TRANS_Z && cls.fteprotocolextensions & PEXT_TRANS)
|
||||
state->trans = (float)MSG_ReadByte() / 255;
|
||||
state->alpha = MSG_ReadByte();
|
||||
#endif
|
||||
#ifdef PEXT_FATNESS
|
||||
if (flags & PF_FATNESS_Z && cls.fteprotocolextensions & PEXT_FATNESS)
|
||||
|
@ -2526,6 +2529,19 @@ void CL_ParsePlayerinfo (void)
|
|||
//should be passed to player move func.
|
||||
#endif
|
||||
|
||||
if (cls.fteprotocolextensions & PEXT_COLOURMOD && flags & PF_COLOURMOD)
|
||||
{
|
||||
state->colourmod[0] = MSG_ReadByte();
|
||||
state->colourmod[1] = MSG_ReadByte();
|
||||
state->colourmod[2] = MSG_ReadByte();
|
||||
}
|
||||
else
|
||||
{
|
||||
state->colourmod[0] = 32;
|
||||
state->colourmod[1] = 32;
|
||||
state->colourmod[2] = 32;
|
||||
}
|
||||
|
||||
if (cls.z_ext & Z_EXT_PM_TYPE)
|
||||
{
|
||||
int pm_code;
|
||||
|
@ -2785,9 +2801,11 @@ void CL_LinkPlayers (void)
|
|||
#ifdef PEXT_SCALE
|
||||
ent->scale = state->scale/16.0f;
|
||||
#endif
|
||||
#ifdef PEXT_TRANS
|
||||
ent->alpha = state->trans/255.0f;
|
||||
#endif
|
||||
ent->shaderRGBAf[0] = state->colourmod[0]/32;
|
||||
ent->shaderRGBAf[1] = state->colourmod[1]/32;
|
||||
ent->shaderRGBAf[2] = state->colourmod[2]/32;
|
||||
ent->shaderRGBAf[3] = state->alpha/255;
|
||||
|
||||
ent->fatness = state->fatness/2;
|
||||
//
|
||||
// angles
|
||||
|
@ -2899,6 +2917,7 @@ void CL_LinkViewModel(void)
|
|||
static float lerptime[MAX_SPLITS];
|
||||
static int prevframe[MAX_SPLITS];
|
||||
static int oldframe[MAX_SPLITS];
|
||||
float alpha;
|
||||
|
||||
#ifdef SIDEVIEWS
|
||||
extern qboolean r_secondaryview;
|
||||
|
@ -2930,17 +2949,22 @@ void CL_LinkViewModel(void)
|
|||
return;
|
||||
|
||||
#ifdef PEXT_SCALE
|
||||
ent.scale = 1;
|
||||
ent.scale = r_viewmodelsize.value;
|
||||
#endif
|
||||
if (r_drawviewmodel.value > 0 && r_drawviewmodel.value < 1)
|
||||
ent.alpha = r_drawviewmodel.value;
|
||||
alpha = r_drawviewmodel.value;
|
||||
else
|
||||
ent.alpha = 1;
|
||||
alpha = 1;
|
||||
|
||||
if ((cl.stats[r_refdef.currentplayernum][STAT_ITEMS] & IT_INVISIBILITY)
|
||||
&& r_drawviewmodelinvis.value > 0
|
||||
&& r_drawviewmodelinvis.value < 1)
|
||||
ent.alpha *= r_drawviewmodelinvis.value;
|
||||
alpha *= r_drawviewmodelinvis.value;
|
||||
|
||||
ent.shaderRGBAf[0] = 1;
|
||||
ent.shaderRGBAf[1] = 1;
|
||||
ent.shaderRGBAf[2] = 1;
|
||||
ent.shaderRGBAf[3] = alpha;
|
||||
|
||||
ent.frame = cl.viewent[r_refdef.currentplayernum].frame;
|
||||
ent.oldframe = oldframe[r_refdef.currentplayernum];
|
||||
|
@ -2967,8 +2991,6 @@ void CL_LinkViewModel(void)
|
|||
|
||||
ent.flags = Q2RF_WEAPONMODEL|Q2RF_DEPTHHACK;
|
||||
|
||||
ent.shaderRGBA[3] = ent.alpha*255;
|
||||
|
||||
V_AddEntity(&ent);
|
||||
|
||||
if (!v_powerupshell.value)
|
||||
|
@ -3004,15 +3026,15 @@ void CL_LinkViewModel(void)
|
|||
return;
|
||||
|
||||
ent.fatness = 0.5;
|
||||
ent.alpha *= 0.1;
|
||||
ent.shaderRGBAf[3] /= 10;
|
||||
#ifdef Q3SHADERS //fixme: do better.
|
||||
//fixme: this is woefully gl specific. :(
|
||||
if (qrenderer == QR_OPENGL)
|
||||
{
|
||||
extern void Shader_DefaultSkinShell(char *shortname, shader_t *s);
|
||||
ent.shaderRGBA[0] = (!!(ent.flags & Q2RF_SHELL_RED)) * 255;
|
||||
ent.shaderRGBA[1] = (!!(ent.flags & Q2RF_SHELL_GREEN)) * 255;
|
||||
ent.shaderRGBA[2] = (!!(ent.flags & Q2RF_SHELL_BLUE)) * 255;
|
||||
ent.shaderRGBAf[0] = (!!(ent.flags & Q2RF_SHELL_RED));
|
||||
ent.shaderRGBAf[1] = (!!(ent.flags & Q2RF_SHELL_GREEN));
|
||||
ent.shaderRGBAf[2] = (!!(ent.flags & Q2RF_SHELL_BLUE));
|
||||
ent.forcedshader = R_RegisterCustom("q2/shell", Shader_DefaultSkinShell);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -323,6 +323,7 @@ unsigned int CL_SupportedFTEExtensions(void)
|
|||
fteprotextsupported |= PEXT_FLOATCOORDS;
|
||||
#endif
|
||||
fteprotextsupported |= PEXT_SPAWNSTATIC2;
|
||||
fteprotextsupported |= PEXT_COLOURMOD;
|
||||
fteprotextsupported |= PEXT_SPLITSCREEN;
|
||||
fteprotextsupported |= PEXT_HEXEN2;
|
||||
fteprotextsupported |= PEXT_CUSTOMTEMPEFFECTS;
|
||||
|
|
|
@ -585,6 +585,8 @@ int CL_LoadModels(int stage)
|
|||
#define atstage() ((cl.contentstage == stage++)?++cl.contentstage:false)
|
||||
#define endstage() if (giveuptime<Sys_DoubleTime()) return -1;
|
||||
|
||||
pmove.numphysent = 0;
|
||||
|
||||
#ifdef PEXT_CSQC
|
||||
if (atstage())
|
||||
{
|
||||
|
@ -2261,9 +2263,9 @@ void CL_ParseBaseline (entity_state_t *es)
|
|||
{
|
||||
int i;
|
||||
|
||||
memset(es, 0, sizeof(entity_state_t));
|
||||
memcpy(es, &nullentitystate, sizeof(entity_state_t));
|
||||
|
||||
es->modelindex = MSG_ReadByte ();
|
||||
es->modelindex = MSG_ReadByte ();
|
||||
es->frame = MSG_ReadByte ();
|
||||
es->colormap = MSG_ReadByte();
|
||||
es->skinnum = MSG_ReadByte();
|
||||
|
@ -2273,21 +2275,12 @@ void CL_ParseBaseline (entity_state_t *es)
|
|||
es->origin[i] = MSG_ReadCoord ();
|
||||
es->angles[i] = MSG_ReadAngle ();
|
||||
}
|
||||
#ifdef PEXT_SCALE
|
||||
es->scale = 1*16;
|
||||
#endif
|
||||
#ifdef PEXT_TRANS
|
||||
es->trans = 255;
|
||||
#endif
|
||||
}
|
||||
void CL_ParseBaseline2 (void)
|
||||
{
|
||||
entity_state_t nullst, es;
|
||||
entity_state_t es;
|
||||
|
||||
memset(&nullst, 0, sizeof(entity_state_t));
|
||||
memset(&es, 0, sizeof(entity_state_t));
|
||||
|
||||
CL_ParseDelta(&nullst, &es, MSG_ReadShort(), true);
|
||||
CL_ParseDelta(&nullentitystate, &es, MSG_ReadShort(), true);
|
||||
memcpy(&cl_baselines[es.number], &es, sizeof(es));
|
||||
}
|
||||
|
||||
|
@ -2315,7 +2308,7 @@ void CL_ParseStatic (int version)
|
|||
{
|
||||
entity_t *ent;
|
||||
int i;
|
||||
entity_state_t es, nullstate;
|
||||
entity_state_t es;
|
||||
|
||||
if (version == 1)
|
||||
{
|
||||
|
@ -2325,8 +2318,7 @@ void CL_ParseStatic (int version)
|
|||
}
|
||||
else
|
||||
{
|
||||
memset(&nullstate, 0, sizeof(nullstate));
|
||||
CL_ParseDelta(&nullstate, &es, MSG_ReadShort(), true);
|
||||
CL_ParseDelta(&nullentitystate, &es, MSG_ReadShort(), true);
|
||||
es.number+=MAX_EDICTS;
|
||||
|
||||
for (i = 0; i < cl.num_statics; i++)
|
||||
|
@ -2348,7 +2340,7 @@ void CL_ParseStatic (int version)
|
|||
return;
|
||||
}
|
||||
ent = &cl_static_entities[i];
|
||||
memset(ent, 0, sizeof(*ent));
|
||||
memcpy(ent, &nullentitystate, sizeof(*ent));
|
||||
cl_static_emit[i] = NULL;
|
||||
|
||||
ent->keynum = es.number;
|
||||
|
@ -2365,9 +2357,11 @@ void CL_ParseStatic (int version)
|
|||
#ifdef PEXT_SCALE
|
||||
ent->scale = es.scale/16.0;
|
||||
#endif
|
||||
#ifdef PEXT_TRANS
|
||||
ent->alpha = es.trans/255.0;
|
||||
#endif
|
||||
ent->shaderRGBAf[0] = (8.0f/255.0f)*es.colormod[0];
|
||||
ent->shaderRGBAf[1] = (8.0f/255.0f)*es.colormod[1];
|
||||
ent->shaderRGBAf[2] = (8.0f/255.0f)*es.colormod[2];
|
||||
ent->shaderRGBAf[3] = es.trans/255;
|
||||
|
||||
ent->fatness = es.fatness/2.0;
|
||||
ent->abslight = es.abslight;
|
||||
|
||||
|
|
|
@ -2389,9 +2389,10 @@ entity_t *CL_NewTempEntity (void)
|
|||
#ifdef PEXT_SCALE
|
||||
ent->scale = 1;
|
||||
#endif
|
||||
#ifdef PEXT_TRANS
|
||||
ent->alpha = 1;
|
||||
#endif
|
||||
ent->shaderRGBAf[0] = 1;
|
||||
ent->shaderRGBAf[1] = 1;
|
||||
ent->shaderRGBAf[2] = 1;
|
||||
ent->shaderRGBAf[3] = 1;
|
||||
return ent;
|
||||
}
|
||||
|
||||
|
@ -2574,7 +2575,7 @@ void CL_UpdateBeams (void)
|
|||
ent->model = b->model;
|
||||
ent->drawflags |= MLS_ABSLIGHT;
|
||||
ent->abslight = 192;
|
||||
ent->alpha = b->alpha;
|
||||
ent->shaderRGBAf[3] = b->alpha;
|
||||
|
||||
ent->angles[0] = -pitch;
|
||||
ent->angles[1] = yaw;
|
||||
|
@ -2644,7 +2645,7 @@ void CL_UpdateExplosions (void)
|
|||
ent->frame = (int)f+firstframe;
|
||||
ent->oldframe = of+firstframe;
|
||||
ent->lerpfrac = 1-(f - (int)f);
|
||||
ent->alpha = 1.0 - f/(numframes);
|
||||
ent->shaderRGBAf[3] = 1.0 - f/(numframes);
|
||||
ent->flags = ex->flags;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -385,6 +385,7 @@ void VMUI_fcloseall (int owner)
|
|||
typedef struct {
|
||||
char *initialbuffer;
|
||||
char *buffer;
|
||||
char *dir;
|
||||
int found;
|
||||
int bufferleft;
|
||||
int skip;
|
||||
|
@ -413,24 +414,47 @@ int VMEnum(char *match, int size, void *args)
|
|||
return true;
|
||||
}
|
||||
|
||||
static int IfFound(char *match, int size, void *args)
|
||||
{
|
||||
*(qboolean*)args = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
int VMEnumMods(char *match, int size, void *args)
|
||||
{
|
||||
char *check;
|
||||
char desc[1024];
|
||||
int newlen;
|
||||
int desclen;
|
||||
qboolean foundone;
|
||||
vfsfile_t *f;
|
||||
|
||||
newlen = strlen(match)+1;
|
||||
|
||||
if (*match && match[newlen-2] != '/')
|
||||
return true;
|
||||
match[newlen-2] = '\0';
|
||||
newlen--;
|
||||
|
||||
if (!stricmp(match, "baseq3"))
|
||||
return true; //we don't want baseq3
|
||||
|
||||
foundone = false;
|
||||
Sys_EnumerateFiles(va("%s/%s/", ((vmsearch_t *)args)->dir, match), "*.pk3", IfFound, &foundone);
|
||||
if (foundone == false)
|
||||
return true; //we only count directories with a pk3 file
|
||||
|
||||
Q_strncpyz(desc, match, sizeof(desc));
|
||||
f = FS_OpenVFS(va("%s/%s/description.txt", ((vmsearch_t *)args)->dir, match), "rb", FS_BASE);
|
||||
if (f)
|
||||
{
|
||||
VFS_GETS(f, desc, sizeof(desc));
|
||||
VFS_CLOSE(f);
|
||||
}
|
||||
|
||||
desclen = strlen(desc)+1;
|
||||
|
||||
if (newlen+desclen > ((vmsearch_t *)args)->bufferleft)
|
||||
if (newlen+desclen+5 > ((vmsearch_t *)args)->bufferleft)
|
||||
return false; //too many files for the buffer
|
||||
|
||||
check = ((vmsearch_t *)args)->initialbuffer;
|
||||
|
@ -461,11 +485,12 @@ int VMQ3_GetFileList(char *path, char *ext, char *output, int buffersize)
|
|||
vms.skip = strlen(path)+1;
|
||||
vms.bufferleft = buffersize;
|
||||
vms.found=0;
|
||||
if (*(char *)path == '$')
|
||||
if (!strcmp(path, "$modlist"))
|
||||
{
|
||||
vms.skip=0;
|
||||
Sys_EnumerateFiles(com_quakedir, "*", VMEnumMods, &vms);
|
||||
Sys_EnumerateFiles(com_homedir, "*", VMEnumMods, &vms);
|
||||
Sys_EnumerateFiles((vms.dir=com_quakedir), "*", VMEnumMods, &vms);
|
||||
if (*com_homedir)
|
||||
Sys_EnumerateFiles((vms.dir=com_homedir), "*", VMEnumMods, &vms);
|
||||
}
|
||||
else if (*(char *)ext == '.' || *(char *)ext == '/')
|
||||
COM_EnumerateFiles(va("%s/*%s", path, ext), VMEnum, &vms);
|
||||
|
@ -533,16 +558,19 @@ void VQ3_AddEntity(const q3refEntity_t *q3)
|
|||
ent.oldframe = q3->oldframe;
|
||||
memcpy(ent.axis, q3->axis, sizeof(q3->axis));
|
||||
ent.lerpfrac = q3->backlerp;
|
||||
ent.alpha = 1;
|
||||
ent.scale = q3->radius;
|
||||
ent.rtype = q3->reType;
|
||||
ent.rotation = q3->rotation;
|
||||
|
||||
if (q3->customSkin)
|
||||
ent.skinnum = Mod_SkinForName(ent.model, q3->customSkin);
|
||||
|
||||
ent.shaderRGBAf[0] = q3->shaderRGBA[0]/255.0f;
|
||||
ent.shaderRGBAf[1] = q3->shaderRGBA[1]/255.0f;
|
||||
ent.shaderRGBAf[2] = q3->shaderRGBA[2]/255.0f;
|
||||
ent.shaderRGBAf[3] = q3->shaderRGBA[3]/255.0f;
|
||||
#ifdef Q3SHADERS
|
||||
ent.forcedshader = (void*)q3->customShader;
|
||||
*(int*)ent.shaderRGBA = *(int*)q3->shaderRGBA;
|
||||
ent.shaderTime = q3->shaderTime;
|
||||
#endif
|
||||
if (q3->renderfx & Q3RF_FIRST_PERSON)
|
||||
|
@ -790,11 +818,18 @@ long UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const long *arg)
|
|||
case UI_CVAR_SET:
|
||||
{
|
||||
cvar_t *var;
|
||||
var = Cvar_FindVar(VM_POINTER(arg[0]));
|
||||
if (var)
|
||||
Cvar_Set(var, VM_POINTER(arg[1])); //set it
|
||||
if (!strcmp(VM_POINTER(arg[0]), "fs_game"))
|
||||
{
|
||||
Cbuf_AddText(va("gamedir %s\nui_restart\n", VM_POINTER(arg[1])), RESTRICT_SERVER);
|
||||
}
|
||||
else
|
||||
Cvar_Get(VM_POINTER(arg[0]), VM_POINTER(arg[1]), 0, "UI created"); //create one
|
||||
{
|
||||
var = Cvar_FindVar(VM_POINTER(arg[0]));
|
||||
if (var)
|
||||
Cvar_Set(var, VM_POINTER(arg[1])); //set it
|
||||
else
|
||||
Cvar_Get(VM_POINTER(arg[0]), VM_POINTER(arg[1]), 0, "UI created"); //create one
|
||||
}
|
||||
}
|
||||
break;
|
||||
case UI_CVAR_VARIABLEVALUE:
|
||||
|
@ -915,7 +950,7 @@ long UI_SystemCallsEx(void *offset, unsigned int mask, int fn, const long *arg)
|
|||
UI_RegisterFont(VM_POINTER(arg[0]), arg[1], VM_POINTER(arg[2]));
|
||||
break;
|
||||
case UI_R_REGISTERSHADERNOMIP:
|
||||
if (!Draw_SafeCachePic)
|
||||
if (!Draw_SafeCachePic || !*(char*)VM_POINTER(arg[0]))
|
||||
VM_LONG(ret) = 0;
|
||||
else
|
||||
// VM_LONG(ret) = (long)Draw_SafeCachePic(VM_POINTER(arg[0]));
|
||||
|
|
|
@ -54,9 +54,8 @@ typedef struct
|
|||
#ifdef PEXT_SCALE
|
||||
float scale;
|
||||
#endif
|
||||
#ifdef PEXT_TRANS
|
||||
float trans;
|
||||
#endif
|
||||
qbyte colourmod[3];
|
||||
qbyte alpha;
|
||||
#ifdef PEXT_FATNESS
|
||||
float fatness;
|
||||
#endif
|
||||
|
|
|
@ -1354,7 +1354,10 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
|||
ent.keynum = s1->number;
|
||||
|
||||
ent.scale = 1;
|
||||
ent.alpha = 1;
|
||||
ent.shaderRGBAf[0] = 1;
|
||||
ent.shaderRGBAf[1] = 1;
|
||||
ent.shaderRGBAf[2] = 1;
|
||||
ent.shaderRGBAf[3] = 1;
|
||||
ent.fatness = 0;
|
||||
ent.scoreboard = NULL;
|
||||
|
||||
|
@ -1424,7 +1427,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
|||
// tweak the color of beams
|
||||
if ( renderfx & Q2RF_BEAM )
|
||||
{ // the four beam colors are encoded in 32 bits of skinnum (hack)
|
||||
ent.alpha = 0.30;
|
||||
ent.shaderRGBAf[3] = 0.30;
|
||||
ent.skinnum = (s1->skinnum >> ((rand() % 4)*8)) & 0xff;
|
||||
ent.model = NULL;
|
||||
ent.lerpfrac = 1;
|
||||
|
@ -1489,7 +1492,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
|||
|
||||
// only used for black hole model right now, FIXME: do better
|
||||
if (renderfx == Q2RF_TRANSLUCENT)
|
||||
ent.alpha = 0.70;
|
||||
ent.shaderRGBAf[3] = 0.70;
|
||||
|
||||
// render effects (fullbright, translucent, etc)
|
||||
if ((effects & Q2EF_COLOR_SHELL))
|
||||
|
@ -1554,14 +1557,14 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
|||
if (effects & Q2EF_BFG)
|
||||
{
|
||||
ent.flags |= Q2RF_TRANSLUCENT;
|
||||
ent.alpha = 0.30;
|
||||
ent.shaderRGBAf[3] = 0.30;
|
||||
}
|
||||
|
||||
// RAFAEL
|
||||
if (effects & Q2EF_PLASMA)
|
||||
{
|
||||
ent.flags |= Q2RF_TRANSLUCENT;
|
||||
ent.alpha = 0.6;
|
||||
ent.shaderRGBAf[3] = 0.6;
|
||||
}
|
||||
|
||||
if (effects & Q2EF_SPHERETRANS)
|
||||
|
@ -1569,9 +1572,9 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
|||
ent.flags |= Q2RF_TRANSLUCENT;
|
||||
// PMM - *sigh* yet more EF overloading
|
||||
if (effects & Q2EF_TRACKERTRAIL)
|
||||
ent.alpha = 0.6;
|
||||
ent.shaderRGBAf[3] = 0.6;
|
||||
else
|
||||
ent.alpha = 0.3;
|
||||
ent.shaderRGBAf[3] = 0.3;
|
||||
}
|
||||
//pmm
|
||||
|
||||
|
@ -1619,16 +1622,15 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
|||
}
|
||||
// pmm
|
||||
ent.flags = renderfx | Q2RF_TRANSLUCENT;
|
||||
ent.alpha = 0.30;
|
||||
ent.shaderRGBAf[3] = 0.30;
|
||||
ent.fatness = 1;
|
||||
ent.shaderRGBAf[0] = (!!(renderfx & Q2RF_SHELL_RED));
|
||||
ent.shaderRGBAf[1] = (!!(renderfx & Q2RF_SHELL_GREEN));
|
||||
ent.shaderRGBAf[2] = (!!(renderfx & Q2RF_SHELL_BLUE));
|
||||
#ifdef Q3SHADERS //fixme: do better.
|
||||
//fixme: this is woefully gl specific. :(
|
||||
if (qrenderer == QR_OPENGL)
|
||||
{
|
||||
ent.shaderRGBA[0] = (!!(renderfx & Q2RF_SHELL_RED)) * 255;
|
||||
ent.shaderRGBA[1] = (!!(renderfx & Q2RF_SHELL_GREEN)) * 255;
|
||||
ent.shaderRGBA[2] = (!!(renderfx & Q2RF_SHELL_BLUE)) * 255;
|
||||
ent.shaderRGBA[3] = ent.alpha*255;
|
||||
ent.forcedshader = R_RegisterCustom("q2/shell", Shader_DefaultSkinShell);
|
||||
}
|
||||
#endif
|
||||
|
@ -1641,7 +1643,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
|||
// ent.skin = NULL; // never use a custom skin on others
|
||||
ent.skinnum = 0;
|
||||
ent.flags = 0;
|
||||
ent.alpha = 0;
|
||||
ent.shaderRGBAf[3] = 1;
|
||||
|
||||
// duplicate for linked models
|
||||
if (s1->modelindex2)
|
||||
|
@ -1679,7 +1681,7 @@ void CLQ2_AddPacketEntities (q2frame_t *frame)
|
|||
|
||||
//PGM - make sure these get reset.
|
||||
ent.flags = 0;
|
||||
ent.alpha = 0;
|
||||
ent.shaderRGBAf[3] = 1;
|
||||
//PGM
|
||||
}
|
||||
if (s1->modelindex3)
|
||||
|
@ -1862,10 +1864,10 @@ CL_AddViewWeapon
|
|||
*/
|
||||
void CLQ2_AddViewWeapon (q2player_state_t *ps, q2player_state_t *ops)
|
||||
{
|
||||
#if 1
|
||||
entity_t gun; // view model
|
||||
int i;
|
||||
entity_t *view;
|
||||
extern cvar_t r_viewmodelsize;
|
||||
|
||||
// allow the gun to be completely removed
|
||||
if (!r_drawviewmodel.value)
|
||||
|
@ -1890,13 +1892,14 @@ void CLQ2_AddViewWeapon (q2player_state_t *ps, q2player_state_t *ops)
|
|||
if (!gun.model)
|
||||
return;
|
||||
|
||||
gun.scale = 1;
|
||||
gun.alpha = 1;
|
||||
gun.scale = r_viewmodelsize.value;
|
||||
gun.shaderRGBAf[0] = 1;
|
||||
gun.shaderRGBAf[1] = 1;
|
||||
gun.shaderRGBAf[2] = 1;
|
||||
if (r_drawviewmodel.value < 1 || r_drawviewmodel.value > 0)
|
||||
{
|
||||
gun.alpha = r_drawviewmodel.value;
|
||||
gun.shaderRGBA[3] = gun.alpha*255;
|
||||
}
|
||||
gun.shaderRGBAf[3] = r_drawviewmodel.value;
|
||||
else
|
||||
gun.shaderRGBAf[3] = 1;
|
||||
|
||||
// set up gun position
|
||||
for (i=0 ; i<3 ; i++)
|
||||
|
@ -1926,7 +1929,6 @@ void CLQ2_AddViewWeapon (q2player_state_t *ps, q2player_state_t *ops)
|
|||
gun.lerpfrac = 1-cl.lerpfrac;
|
||||
VectorCopy (gun.origin, gun.oldorigin); // don't lerp at all
|
||||
V_AddEntity (&gun);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -1939,6 +1941,7 @@ Sets r_refdef view values
|
|||
*/
|
||||
void CLQ2_CalcViewValues (void)
|
||||
{
|
||||
extern cvar_t v_gunkick;
|
||||
int i;
|
||||
float lerp, backlerp;
|
||||
q2centity_t *ent;
|
||||
|
@ -2006,7 +2009,7 @@ void CLQ2_CalcViewValues (void)
|
|||
}
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
r_refdef.viewangles[i] += LerpAngle (ops->kick_angles[i], ps->kick_angles[i], lerp);
|
||||
r_refdef.viewangles[i] += v_gunkick.value * LerpAngle (ops->kick_angles[i], ps->kick_angles[i], lerp);
|
||||
|
||||
VectorCopy(r_refdef.vieworg, cl.simorg[0]);
|
||||
VectorCopy(r_refdef.viewangles, cl.simangles[0]);
|
||||
|
|
|
@ -578,7 +578,7 @@ void VARGS readpngdata(png_structp png_ptr,png_bytep data,png_size_t len)
|
|||
}
|
||||
|
||||
qbyte *png_rgba;
|
||||
qbyte *ReadPNGFile(qbyte *buf, int length, int *width, int *height)
|
||||
qbyte *ReadPNGFile(qbyte *buf, int length, int *width, int *height, char *fname)
|
||||
{
|
||||
qbyte header[8], **rowpointers = NULL, *data = NULL;
|
||||
png_structp png;
|
||||
|
@ -655,7 +655,7 @@ error:
|
|||
bitdepth = png_get_bit_depth(png, pnginfo);
|
||||
|
||||
if (bitdepth != 8 || bytesperpixel != 4) {
|
||||
Con_Printf ("Bad PNG color depth and/or bpp\n");
|
||||
Con_Printf ("Bad PNG color depth and/or bpp (%s)\n", fname);
|
||||
png_destroy_read_struct(&png, &pnginfo, NULL);
|
||||
return (png_rgba = NULL);
|
||||
}
|
||||
|
@ -1837,7 +1837,7 @@ int GL_LoadTextureDDS(unsigned char *buffer, int filesize)
|
|||
#endif
|
||||
|
||||
//returns r8g8b8a8
|
||||
qbyte *Read32BitImageFile(qbyte *buf, int len, int *width, int *height)
|
||||
qbyte *Read32BitImageFile(qbyte *buf, int len, int *width, int *height, char *fname)
|
||||
{
|
||||
qbyte *data;
|
||||
if ((data = ReadTargaFile(buf, len, width, height, false)))
|
||||
|
@ -1847,7 +1847,7 @@ qbyte *Read32BitImageFile(qbyte *buf, int len, int *width, int *height)
|
|||
}
|
||||
|
||||
#ifdef AVAIL_PNGLIB
|
||||
if ((buf[0] == 137 && buf[1] == 'P' && buf[2] == 'N' && buf[3] == 'G') && (data = ReadPNGFile(buf, com_filesize, width, height)))
|
||||
if ((buf[0] == 137 && buf[1] == 'P' && buf[2] == 'N' && buf[3] == 'G') && (data = ReadPNGFile(buf, com_filesize, width, height, fname)))
|
||||
{
|
||||
TRACE(("dbg: Read32BitImageFile: png\n"));
|
||||
return data;
|
||||
|
@ -1970,7 +1970,7 @@ int Mod_LoadHiResTexture(char *name, char *subpath, qboolean mipmap, qboolean al
|
|||
TRACE(("dbg: Mod_LoadHiResTexture: trying %s\n", fname));
|
||||
if ((buf = COM_LoadFile (fname, 5)))
|
||||
{
|
||||
if ((data = Read32BitImageFile(buf, com_filesize, &image_width, &image_height)))
|
||||
if ((data = Read32BitImageFile(buf, com_filesize, &image_width, &image_height, fname)))
|
||||
{
|
||||
extern cvar_t vid_hardwaregamma;
|
||||
if (colouradjust && !vid_hardwaregamma.value)
|
||||
|
|
|
@ -926,7 +926,7 @@ qboolean Media_PlayFilm(char *name)
|
|||
qbyte *ReadPCXFile(qbyte *buf, int length, int *width, int *height);
|
||||
qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, int asgrey);
|
||||
qbyte *ReadJPEGFile(qbyte *infile, int length, int *width, int *height);
|
||||
qbyte *ReadPNGFile(qbyte *buf, int length, int *width, int *height);
|
||||
qbyte *ReadPNGFile(qbyte *buf, int length, int *width, int *height, char *fname);
|
||||
|
||||
sprintf(fullname, "pics/%s", name);
|
||||
file = COM_LoadMallocFile(fullname); //read file
|
||||
|
@ -939,7 +939,7 @@ qboolean Media_PlayFilm(char *name)
|
|||
(staticfilmimage = ReadJPEGFile(file, com_filesize, &imagewidth, &imageheight)) ||
|
||||
#endif
|
||||
#ifdef AVAIL_PNGLIB
|
||||
(staticfilmimage = ReadPNGFile(file, com_filesize, &imagewidth, &imageheight)) ||
|
||||
(staticfilmimage = ReadPNGFile(file, com_filesize, &imagewidth, &imageheight, fullname)) ||
|
||||
#endif
|
||||
0)
|
||||
{
|
||||
|
|
|
@ -725,10 +725,13 @@ static qboolean CopyCSQCEdictToEntity(csqcedict_t *in, entity_t *out)
|
|||
out->scoreboard = &cl.players[(int)in->v->colormap-1];
|
||||
} // TODO: DP COLORMAP extension?
|
||||
|
||||
out->shaderRGBAf[0] = 1;
|
||||
out->shaderRGBAf[1] = 1;
|
||||
out->shaderRGBAf[2] = 1;
|
||||
if (!in->v->alpha)
|
||||
out->alpha = 1;
|
||||
out->shaderRGBAf[3] = 1;
|
||||
else
|
||||
out->alpha = in->v->alpha;
|
||||
out->shaderRGBAf[3] = in->v->alpha;
|
||||
|
||||
out->skinnum = in->v->skin;
|
||||
out->fatness = in->v->fatness;
|
||||
|
|
|
@ -59,7 +59,7 @@ typedef struct entity_s
|
|||
vec3_t angles;
|
||||
vec3_t axis[3];
|
||||
|
||||
byte_vec4_t shaderRGBA;
|
||||
vec4_t shaderRGBAf;
|
||||
float shaderTime;
|
||||
|
||||
vec3_t oldorigin;
|
||||
|
@ -102,9 +102,6 @@ typedef struct entity_s
|
|||
#ifdef PEXT_SCALE
|
||||
float scale;
|
||||
#endif
|
||||
#ifdef PEXT_TRANS
|
||||
float alpha;
|
||||
#endif
|
||||
#ifdef PEXT_FATNESS
|
||||
float fatness;
|
||||
#endif
|
||||
|
@ -337,7 +334,7 @@ void WritePCXfile (char *filename, qbyte *data, int width, int height, int rowby
|
|||
qbyte *ReadPCXFile(qbyte *buf, int length, int *width, int *height);
|
||||
qbyte *ReadTargaFile(qbyte *buf, int length, int *width, int *height, int asgrey);
|
||||
qbyte *ReadJPEGFile(qbyte *infile, int length, int *width, int *height);
|
||||
qbyte *ReadPNGFile(qbyte *buf, int length, int *width, int *height);
|
||||
qbyte *ReadPNGFile(qbyte *buf, int length, int *width, int *height, char *name);
|
||||
qbyte *ReadPCXPalette(qbyte *buf, int len, qbyte *out);
|
||||
|
||||
void BoostGamma(qbyte *rgba, int width, int height);
|
||||
|
@ -357,6 +354,7 @@ extern cvar_t r_norefresh;
|
|||
extern cvar_t r_drawentities;
|
||||
extern cvar_t r_drawworld;
|
||||
extern cvar_t r_drawviewmodel;
|
||||
extern cvar_t r_viewmodelsize;
|
||||
extern cvar_t r_drawviewmodelinvis;
|
||||
extern cvar_t r_speeds;
|
||||
extern cvar_t r_waterwarp;
|
||||
|
|
|
@ -29,6 +29,7 @@ extern int gl_anisotropy_factor;
|
|||
//
|
||||
|
||||
cvar_t r_drawviewmodel = SCVAR("r_drawviewmodel","1");
|
||||
cvar_t r_viewmodelsize = SCVAR("r_viewmodelsize","1");
|
||||
cvar_t r_drawviewmodelinvis = SCVAR("r_drawviewmodelinvis", "0");
|
||||
cvar_t r_netgraph = SCVAR("r_netgraph","0");
|
||||
cvar_t r_speeds = SCVARF("r_speeds","0", CVAR_CHEAT);
|
||||
|
@ -176,7 +177,8 @@ cvar_t con_ocranaleds = SCVAR("con_ocranaleds", "2");
|
|||
cvar_t scr_chatmodecvar = SCVAR("scr_chatmode", "0");
|
||||
|
||||
#ifdef Q3SHADERS
|
||||
cvar_t gl_shadeq3 = SCVAR("gl_shadeq3", "1"); //use if you want.
|
||||
cvar_t gl_shadeq3 = SCVARF("gl_shadeq3", "1", CVAR_SEMICHEAT); //use if you want.
|
||||
cvar_t gl_shadeq2 = SCVARF("gl_shadeq2", "0", CVAR_SEMICHEAT); //use if you want.
|
||||
extern cvar_t r_vertexlight;
|
||||
cvar_t gl_shadeq1 = SCVARF("gl_shadeq1", "0", CVAR_CHEAT); //FIXME: :(
|
||||
cvar_t gl_shadeq1_name = SCVAR("gl_shadeq1_name", "*");
|
||||
|
@ -355,6 +357,7 @@ void GLRenderer_Init(void)
|
|||
Cvar_Register (&r_vertexlight, GLRENDEREROPTIONS);
|
||||
Cvar_Register (&gl_shadeq1, GLRENDEREROPTIONS);
|
||||
Cvar_Register (&gl_shadeq1_name, GLRENDEREROPTIONS);
|
||||
Cvar_Register (&gl_shadeq2, GLRENDEREROPTIONS);
|
||||
Cvar_Register (&gl_shadeq3, GLRENDEREROPTIONS);
|
||||
|
||||
Cvar_Register (&gl_blend2d, GLRENDEREROPTIONS);
|
||||
|
@ -518,6 +521,7 @@ void Renderer_Init(void)
|
|||
//renderer
|
||||
Cvar_Register (&r_fullbright, SCREENOPTIONS);
|
||||
Cvar_Register (&r_drawentities, GRAPHICALNICETIES);
|
||||
Cvar_Register (&r_viewmodelsize, GRAPHICALNICETIES);
|
||||
Cvar_Register (&r_drawviewmodel, GRAPHICALNICETIES);
|
||||
Cvar_Register (&r_drawviewmodelinvis, GRAPHICALNICETIES);
|
||||
Cvar_Register (&r_waterwarp, GRAPHICALNICETIES);
|
||||
|
|
|
@ -427,7 +427,7 @@ qbyte *Skin_Cache32 (skin_t *skin)
|
|||
raw = COM_LoadTempFile (name);
|
||||
if (raw)
|
||||
{
|
||||
pix = ReadPNGFile(raw, com_filesize, &skin->width, &skin->height);
|
||||
pix = ReadPNGFile(raw, com_filesize, &skin->width, &skin->height, name);
|
||||
if (pix)
|
||||
{
|
||||
out = Cache_Alloc(&skin->cache, skin->width*skin->height*4, name);
|
||||
|
|
|
@ -1060,9 +1060,6 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
lpBuffer.dwLength = sizeof(MEMORYSTATUS);
|
||||
GlobalMemoryStatus (&lpBuffer);
|
||||
|
||||
GetModuleFileName(NULL, cwd, sizeof(cwd)-1);
|
||||
strcpy(exename, COM_SkipPath(cwd));
|
||||
|
||||
parms.argc = 1;
|
||||
argv[0] = exename;
|
||||
|
||||
|
@ -1084,16 +1081,22 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
*lpCmdLine = 0;
|
||||
lpCmdLine++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
GetModuleFileName(NULL, cwd, sizeof(cwd)-1);
|
||||
strcpy(exename, COM_SkipPath(cwd));
|
||||
parms.argv = argv;
|
||||
|
||||
COM_InitArgv (parms.argc, parms.argv);
|
||||
|
||||
TL_InitLanguages();
|
||||
//tprints are now allowed
|
||||
if (COM_CheckParm("--version") || COM_CheckParm("-v"))
|
||||
{
|
||||
printf("version " DISTRIBUTION " " __TIME__ __DATE__ "\n");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (!GetCurrentDirectory (sizeof(cwd), cwd))
|
||||
Sys_Error ("Couldn't determine current directory");
|
||||
|
@ -1101,6 +1104,9 @@ int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLin
|
|||
if (cwd[Q_strlen(cwd)-1] == '/' || cwd[Q_strlen(cwd)-1] == '\\')
|
||||
cwd[Q_strlen(cwd)-1] = 0;
|
||||
|
||||
TL_InitLanguages();
|
||||
//tprints are now allowed
|
||||
|
||||
parms.basedir = cwd;
|
||||
|
||||
parms.argc = com_argc;
|
||||
|
|
|
@ -1193,6 +1193,7 @@ static void TP_InitMacros(void)
|
|||
// Cmd_AddMacro("mp3info", , false);
|
||||
// Cmd_AddMacro("triggermatch", Macro_LastTrigger_Match, false);
|
||||
|
||||
//new, fte only (at least when first implemented)
|
||||
Cmd_AddMacro("chealth", Macro_CombinedHealth, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
|
||||
usercmd_t nullcmd; // guarenteed to be zero
|
||||
|
||||
entity_state_t nullentitystate; //this is the default state
|
||||
|
||||
static char *largv[MAX_NUM_ARGVS + NUM_SAFE_ARGVS + 1];
|
||||
static char *argvdummy = " ";
|
||||
|
||||
|
@ -2301,6 +2303,16 @@ void COM_Init (void)
|
|||
registered.string = "0";
|
||||
|
||||
Cvar_Register (®istered, "Copy protection");
|
||||
|
||||
|
||||
|
||||
|
||||
nullentitystate.colormod[0] = 32;
|
||||
nullentitystate.colormod[1] = 32;
|
||||
nullentitystate.colormod[2] = 32;
|
||||
nullentitystate.trans = 255;
|
||||
nullentitystate.scale = 16;
|
||||
nullentitystate.abslight = 255;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1183,6 +1183,7 @@ void *Mod_LoadWall(char *name)
|
|||
|
||||
void CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same place
|
||||
{
|
||||
extern cvar_t gl_shadeq2;
|
||||
q2texinfo_t *in;
|
||||
mtexinfo_t *out;
|
||||
int i, j, count;
|
||||
|
@ -1252,6 +1253,8 @@ void CMod_LoadTexInfo (lump_t *l) //yes I know these load from the same place
|
|||
// out->texture = r_notexture_mip; // texture not found
|
||||
// out->flags = 0;
|
||||
}
|
||||
if (gl_shadeq2.value)
|
||||
out->texture->shader = R_RegisterCustom (name, NULL);
|
||||
Q_strncpyz(out->texture->name, in->texture, sizeof(out->texture->name));
|
||||
|
||||
#if !defined(SERVERONLY) && defined(RGLQUAKE)
|
||||
|
|
|
@ -44,7 +44,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|||
#ifdef Q3BSPS
|
||||
#define PEXT_Q3BSP 0x00040000
|
||||
#endif
|
||||
//PEXT_SEEF1 0x00080000
|
||||
|
||||
#define PEXT_COLOURMOD 0x00080000 //this replaces an older value which would rarly have caried any actual data.
|
||||
|
||||
#define PEXT_SPLITSCREEN 0x00100000
|
||||
#define PEXT_HEXEN2 0x00200000 //more stats and working particle builtin.
|
||||
#define PEXT_SPAWNSTATIC2 0x00400000 //Sends an entity delta instead of a baseline.
|
||||
|
@ -321,8 +323,8 @@ enum clcq2_ops_e
|
|||
// playerinfo flags from server
|
||||
// playerinfo always sends: playernum, flags, origin[] and framenumber
|
||||
|
||||
#define PF_MSEC (1<<0)
|
||||
#define PF_COMMAND (1<<1)
|
||||
#define PF_MSEC (1<<0) //msecs says how long the player command was sitting on the server before it was sent back to the client
|
||||
#define PF_COMMAND (1<<1) //angles and movement values for other players (no msec or impulse)
|
||||
#define PF_VELOCITY1 (1<<2)
|
||||
#define PF_VELOCITY2 (1<<3)
|
||||
#define PF_VELOCITY3 (1<<4)
|
||||
|
@ -357,7 +359,7 @@ enum clcq2_ops_e
|
|||
#define PF_HULLSIZE_Z (1<<14)
|
||||
#endif
|
||||
|
||||
//#define PF_ORIGINDBL (1<<19)
|
||||
#define PF_COLOURMOD (1<<19)
|
||||
|
||||
|
||||
|
||||
|
@ -451,7 +453,7 @@ enum clcq2_ops_e
|
|||
#define U_DRAWFLAGS (1<<8) //use an extra qbyte for origin parts, cos one of them is off
|
||||
#define U_ABSLIGHT (1<<9) //Force a lightlevel
|
||||
|
||||
#define U_UNUSED2 (1<<10) //use an extra qbyte for origin parts, cos one of them is off
|
||||
#define U_COLOURMOD (1<<10) //rgb
|
||||
|
||||
#define U_DPFLAGS (1<<11)
|
||||
#define U_TAGINFO (1<<12)
|
||||
|
@ -702,15 +704,14 @@ typedef struct entity_state_s
|
|||
qbyte glowsize;
|
||||
qbyte glowcolour;
|
||||
qbyte scale;
|
||||
qbyte trans;
|
||||
|
||||
char fatness;
|
||||
qbyte hexen2flags;
|
||||
qbyte abslight;
|
||||
qbyte dpflags;
|
||||
|
||||
qbyte pad;
|
||||
qbyte colormod[3];
|
||||
qbyte colormod[3];//multiply this by 8 to read as 0 to 1...
|
||||
qbyte trans;
|
||||
|
||||
qbyte lightstyle;
|
||||
qbyte lightpflags;
|
||||
|
@ -721,6 +722,7 @@ typedef struct entity_state_s
|
|||
unsigned short tagentity;
|
||||
unsigned short tagindex;
|
||||
} entity_state_t;
|
||||
extern entity_state_t nullentitystate;
|
||||
|
||||
|
||||
#define MAX_EXTENDED_PACKET_ENTITIES 256 //sanity limit.
|
||||
|
|
|
@ -138,6 +138,7 @@ typedef struct {
|
|||
int numposes;
|
||||
float rate;
|
||||
int poseofs;
|
||||
char name[64];
|
||||
} galiasgroup_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -393,6 +394,7 @@ static void R_LerpFrames(mesh_t *mesh, galiaspose_t *p1, galiaspose_t *p2, float
|
|||
{
|
||||
if (r_nolightdir.value)
|
||||
{
|
||||
mesh->colors_array = NULL;
|
||||
for (i = 0; i < mesh->numvertexes; i++)
|
||||
{
|
||||
mesh->normals_array[i][0] = p1n[i][0]*lerp + p2n[i][0]*blerp;
|
||||
|
@ -402,11 +404,6 @@ static void R_LerpFrames(mesh_t *mesh, galiaspose_t *p1, galiaspose_t *p2, float
|
|||
mesh->xyz_array[i][0] = p1v[i][0]*lerp + p2v[i][0]*blerp;
|
||||
mesh->xyz_array[i][1] = p1v[i][1]*lerp + p2v[i][1]*blerp;
|
||||
mesh->xyz_array[i][2] = p1v[i][2]*lerp + p2v[i][2]*blerp;
|
||||
|
||||
mesh->colors_array[i][0] = ambientlight[0];
|
||||
mesh->colors_array[i][1] = ambientlight[1];
|
||||
mesh->colors_array[i][2] = ambientlight[2];
|
||||
mesh->colors_array[i][3] = alpha;
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -569,11 +566,12 @@ static void R_BuildSkeletalMesh(mesh_t *mesh, float *plerp, float **pose, int po
|
|||
mesh->normals_array[i][0] = 0;
|
||||
mesh->normals_array[i][1] = 0;
|
||||
mesh->normals_array[i][2] = 1;
|
||||
|
||||
/*
|
||||
mesh->colors_array[i][0] = ambientlight[0];
|
||||
mesh->colors_array[i][1] = ambientlight[1];
|
||||
mesh->colors_array[i][2] = ambientlight[2];
|
||||
mesh->colors_array[i][3] = 255;//alpha;
|
||||
*/
|
||||
/*
|
||||
mesh->xyz_array[i][0] = 0;
|
||||
mesh->xyz_array[i][1] = 0;
|
||||
|
@ -581,6 +579,7 @@ static void R_BuildSkeletalMesh(mesh_t *mesh, float *plerp, float **pose, int po
|
|||
mesh->xyz_array[i][3] = 1;
|
||||
*/
|
||||
}
|
||||
mesh->colors_array = NULL;
|
||||
|
||||
memset(mesh->xyz_array, 0, mesh->numvertexes*sizeof(vec3_t));
|
||||
R_TransformVerticies(bonepose, weights, numweights, (float*)mesh->xyz_array);
|
||||
|
@ -640,69 +639,149 @@ static void R_BuildSkeletalMesh(mesh_t *mesh, float *plerp, float **pose, int po
|
|||
#endif
|
||||
|
||||
#ifndef SERVERONLY
|
||||
|
||||
void R_LightArrays(byte_vec4_t *colours, int vertcount, vec3_t *normals)
|
||||
{
|
||||
int i;
|
||||
float l;
|
||||
int temp;
|
||||
|
||||
for (i = vertcount-1; i >= 0; i--)
|
||||
{
|
||||
l = DotProduct(normals[i], shadevector);
|
||||
|
||||
temp = l*ambientlight[0]+shadelight[0];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
colours[i][0] = temp;
|
||||
|
||||
temp = l*ambientlight[1]+shadelight[1];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
colours[i][1] = temp;
|
||||
|
||||
temp = l*ambientlight[2]+shadelight[2];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
colours[i][2] = temp;
|
||||
}
|
||||
}
|
||||
|
||||
//changes vertex lighting values
|
||||
static void R_GAliasAddDlights(mesh_t *mesh, vec3_t org, vec3_t angles)
|
||||
static void R_GAliasApplyLighting(mesh_t *mesh, vec3_t org, vec3_t angles, float *colormod)
|
||||
{
|
||||
int l, v;
|
||||
vec3_t rel;
|
||||
vec3_t dir;
|
||||
float dot, d, a, f;
|
||||
for (l=0 ; l<MAX_DLIGHTS ; l++)
|
||||
|
||||
if (mesh->colors_array)
|
||||
{
|
||||
if (cl_dlights[l].radius)
|
||||
float l;
|
||||
int temp;
|
||||
int i;
|
||||
byte_vec4_t *colours = mesh->colors_array;
|
||||
vec3_t *normals = mesh->normals_array;
|
||||
vec3_t ambient, shade;
|
||||
qbyte alphab = bound(0, colormod[3]*255, 255);
|
||||
if (!mesh->normals_array)
|
||||
{
|
||||
VectorSubtract (cl_dlights[l].origin,
|
||||
org,
|
||||
dir);
|
||||
if (Length(dir)>cl_dlights[l].radius+mesh->radius) //far out man!
|
||||
continue;
|
||||
mesh->colors_array = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
rel[0] = -DotProduct(dir, currententity->axis[0]);
|
||||
rel[1] = -DotProduct(dir, currententity->axis[1]); //quake's crazy.
|
||||
rel[2] = -DotProduct(dir, currententity->axis[2]);
|
||||
/*
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(0,0,0);
|
||||
glVertex3f(rel[0],rel[1],rel[2]);
|
||||
glEnd();
|
||||
*/
|
||||
for (v = 0; v < mesh->numvertexes; v++)
|
||||
VectorCopy(ambientlight, ambient);
|
||||
VectorCopy(shadelight, shade);
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
{
|
||||
ambient[i] *= colormod[i];
|
||||
shade[i] *= colormod[i];
|
||||
}
|
||||
|
||||
|
||||
for (i = mesh->numvertexes-1; i >= 0; i--)
|
||||
{
|
||||
l = DotProduct(normals[i], shadevector);
|
||||
|
||||
temp = l*ambient[0]+shade[0];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
colours[i][0] = temp;
|
||||
|
||||
temp = l*ambient[1]+shade[1];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
colours[i][1] = temp;
|
||||
|
||||
temp = l*ambient[2]+shade[2];
|
||||
if (temp < 0) temp = 0;
|
||||
else if (temp > 255) temp = 255;
|
||||
colours[i][2] = temp;
|
||||
|
||||
colours[i][3] = alphab;
|
||||
}
|
||||
}
|
||||
|
||||
if (r_vertexdlights.value && mesh->colors_array)
|
||||
{
|
||||
for (l=0 ; l<MAX_DLIGHTS ; l++)
|
||||
{
|
||||
if (cl_dlights[l].radius)
|
||||
{
|
||||
VectorSubtract(mesh->xyz_array[v], rel, dir);
|
||||
dot = DotProduct(dir, mesh->normals_array[v]);
|
||||
if (dot>0)
|
||||
VectorSubtract (cl_dlights[l].origin,
|
||||
org,
|
||||
dir);
|
||||
if (Length(dir)>cl_dlights[l].radius+mesh->radius) //far out man!
|
||||
continue;
|
||||
|
||||
rel[0] = -DotProduct(dir, currententity->axis[0]);
|
||||
rel[1] = -DotProduct(dir, currententity->axis[1]); //quake's crazy.
|
||||
rel[2] = -DotProduct(dir, currententity->axis[2]);
|
||||
/*
|
||||
glBegin(GL_LINES);
|
||||
glVertex3f(0,0,0);
|
||||
glVertex3f(rel[0],rel[1],rel[2]);
|
||||
glEnd();
|
||||
*/
|
||||
for (v = 0; v < mesh->numvertexes; v++)
|
||||
{
|
||||
d = DotProduct(dir, dir);
|
||||
a = 1/d;
|
||||
if (a>0)
|
||||
VectorSubtract(mesh->xyz_array[v], rel, dir);
|
||||
dot = DotProduct(dir, mesh->normals_array[v]);
|
||||
if (dot>0)
|
||||
{
|
||||
a *= 10000000*dot/sqrt(d);
|
||||
f = mesh->colors_array[v][0] + a*cl_dlights[l].color[0];
|
||||
if (f > 255)
|
||||
f = 255;
|
||||
else if (f < 0)
|
||||
f = 0;
|
||||
mesh->colors_array[v][0] = f;
|
||||
d = DotProduct(dir, dir);
|
||||
a = 1/d;
|
||||
if (a>0)
|
||||
{
|
||||
a *= 10000000*dot/sqrt(d);
|
||||
f = mesh->colors_array[v][0] + a*cl_dlights[l].color[0];
|
||||
if (f > 255)
|
||||
f = 255;
|
||||
else if (f < 0)
|
||||
f = 0;
|
||||
mesh->colors_array[v][0] = f;
|
||||
|
||||
f = mesh->colors_array[v][1] + a*cl_dlights[l].color[1];
|
||||
if (f > 255)
|
||||
f = 255;
|
||||
else if (f < 0)
|
||||
f = 0;
|
||||
mesh->colors_array[v][1] = f;
|
||||
f = mesh->colors_array[v][1] + a*cl_dlights[l].color[1];
|
||||
if (f > 255)
|
||||
f = 255;
|
||||
else if (f < 0)
|
||||
f = 0;
|
||||
mesh->colors_array[v][1] = f;
|
||||
|
||||
f = mesh->colors_array[v][2] + a*cl_dlights[l].color[2];
|
||||
if (f > 255)
|
||||
f = 255;
|
||||
else if (f < 0)
|
||||
f = 0;
|
||||
mesh->colors_array[v][2] = f;
|
||||
f = mesh->colors_array[v][2] + a*cl_dlights[l].color[2];
|
||||
if (f > 255)
|
||||
f = 255;
|
||||
else if (f < 0)
|
||||
f = 0;
|
||||
mesh->colors_array[v][2] = f;
|
||||
}
|
||||
// else
|
||||
// mesh->colors_array[v][1] =255;
|
||||
}
|
||||
// else
|
||||
// mesh->colors_array[v][1] =255;
|
||||
// else
|
||||
// mesh->colors_array[v][2] =255;
|
||||
}
|
||||
// else
|
||||
// mesh->colors_array[v][2] =255;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1543,6 +1622,8 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
|
||||
float tmatrix[3][4];
|
||||
|
||||
qboolean needrecolour;
|
||||
|
||||
currententity = e;
|
||||
|
||||
// if (e->flags & Q2RF_VIEWERMODEL && e->keynum == cl.playernum[r_refdef.currentplayernum]+1)
|
||||
|
@ -1677,6 +1758,17 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
shadevector[0] = DotProduct(lightdir, e->axis[0]);
|
||||
shadevector[1] = DotProduct(lightdir, e->axis[1]);
|
||||
shadevector[2] = DotProduct(lightdir, e->axis[2]);
|
||||
|
||||
if (e->flags & Q2RF_WEAPONMODEL)
|
||||
{
|
||||
vec3_t temp;
|
||||
temp[0] = DotProduct(shadevector, vpn);
|
||||
temp[1] = DotProduct(shadevector, vright);
|
||||
temp[2] = DotProduct(shadevector, vup);
|
||||
|
||||
VectorCopy(temp, shadevector);
|
||||
}
|
||||
|
||||
VectorNormalize(shadevector);
|
||||
|
||||
VectorCopy(shadevector, mesh.lightaxis[2]);
|
||||
|
@ -1733,7 +1825,7 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
{
|
||||
qglEnable (GL_BLEND);
|
||||
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
e->alpha = r_wateralpha.value;
|
||||
e->shaderRGBAf[3] = r_wateralpha.value;
|
||||
}
|
||||
else if ((e->model->flags & EF_TRANSPARENT))
|
||||
{
|
||||
|
@ -1746,7 +1838,7 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
// qglEnable (GL_BLEND);
|
||||
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
else if (e->alpha < 1)
|
||||
else if (e->shaderRGBAf[3] < 1)
|
||||
{
|
||||
qglEnable(GL_BLEND);
|
||||
qglBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -1869,19 +1961,19 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
fog = CM_FogForOrigin(currententity->origin);
|
||||
#endif
|
||||
|
||||
qglColor4f(shadelight[0]/255, shadelight[1]/255, shadelight[2]/255, e->alpha);
|
||||
qglColor4f(shadelight[0]/255, shadelight[1]/255, shadelight[2]/255, e->shaderRGBAf[3]);
|
||||
|
||||
memset(&mesh, 0, sizeof(mesh));
|
||||
for(surfnum=0; inf; ((inf->nextsurf)?(inf = (galiasinfo_t*)((char *)inf + inf->nextsurf)):(inf=NULL)), surfnum++)
|
||||
{
|
||||
if (R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->alpha, e->frame1time, e->frame2time) && r_vertexdlights.value)
|
||||
if (mesh.colors_array)
|
||||
R_GAliasAddDlights(&mesh, e->origin, e->angles);
|
||||
needrecolour = R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->shaderRGBAf[3], e->frame1time, e->frame2time);
|
||||
|
||||
c_alias_polys += mesh.numindexes/3;
|
||||
|
||||
if (r_drawflat.value == 2)
|
||||
{
|
||||
if (needrecolour)
|
||||
R_GAliasApplyLighting(&mesh, e->origin, e->angles, e->shaderRGBAf);
|
||||
GL_DrawAliasMesh_Sketch(&mesh);
|
||||
continue;
|
||||
}
|
||||
|
@ -1915,6 +2007,8 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
#endif
|
||||
))
|
||||
{
|
||||
if (needrecolour)
|
||||
R_GAliasApplyLighting(&mesh, e->origin, e->angles, e->shaderRGBAf);
|
||||
GL_DrawAliasMesh_Sketch(&mesh);
|
||||
}
|
||||
#ifdef Q3SHADERS
|
||||
|
@ -1950,6 +2044,9 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
#endif
|
||||
else
|
||||
{
|
||||
if (needrecolour)
|
||||
R_GAliasApplyLighting(&mesh, e->origin, e->angles, e->shaderRGBAf);
|
||||
|
||||
qglEnable(GL_TEXTURE_2D);
|
||||
// if (skin->bump)
|
||||
// GL_DrawMeshBump(&mesh, skin->base, 0, skin->bump, 0);
|
||||
|
@ -1960,7 +2057,7 @@ void R_DrawGAliasModel (entity_t *e)
|
|||
{
|
||||
mesh.colors_array = NULL;
|
||||
qglEnable(GL_BLEND);
|
||||
qglColor4f(1, 1, 1, e->alpha*r_fb_models.value);
|
||||
qglColor4f(e->shaderRGBAf[0], e->shaderRGBAf[1], e->shaderRGBAf[2], e->shaderRGBAf[3]*r_fb_models.value);
|
||||
c_alias_polys += mesh.numindexes/3;
|
||||
|
||||
qglBlendFunc (GL_SRC_ALPHA, GL_ONE);
|
||||
|
@ -2525,6 +2622,9 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius)
|
|||
if (r_noaliasshadows.value)
|
||||
return;
|
||||
|
||||
if (e->shaderRGBAf[3] < 0.5)
|
||||
return;
|
||||
|
||||
RotateLightVector(e->axis, e->origin, lightpos, lightorg);
|
||||
|
||||
if (Length(lightorg) > radius + clmodel->radius)
|
||||
|
@ -2539,7 +2639,7 @@ void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius)
|
|||
{
|
||||
if (inf->ofs_trineighbours)
|
||||
{
|
||||
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, e->alpha, e->frame1time, e->frame2time);
|
||||
R_GAliasBuildMesh(&mesh, inf, e->frame, e->oldframe, e->lerpfrac, 1, e->frame1time, e->frame2time);
|
||||
R_CalcFacing(&mesh, lightorg);
|
||||
R_ProjectShadowVolume(&mesh, lightorg);
|
||||
R_DrawShadowVolume(&mesh);
|
||||
|
@ -2871,6 +2971,7 @@ static void *Q1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
|
|||
galiaspose_t *pose;
|
||||
galiasgroup_t *frame;
|
||||
dtrivertx_t *pinframe;
|
||||
daliasframe_t *frameinfo;
|
||||
int i, j, k;
|
||||
daliasgroup_t *ingroup;
|
||||
daliasinterval_t *intervals;
|
||||
|
@ -2886,12 +2987,15 @@ static void *Q1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
|
|||
switch(LittleLong(pframetype->type))
|
||||
{
|
||||
case ALIAS_SINGLE:
|
||||
pinframe = (dtrivertx_t*)((char *)(pframetype+1)+sizeof(daliasframe_t));
|
||||
frameinfo = (daliasframe_t*)((char *)(pframetype+1));
|
||||
pinframe = (dtrivertx_t*)((char*)frameinfo+sizeof(daliasframe_t));
|
||||
pose = (galiaspose_t *)Hunk_Alloc(sizeof(galiaspose_t) + sizeof(vec3_t)*2*galias->numverts);
|
||||
frame->poseofs = (char *)pose - (char *)frame;
|
||||
frame->numposes = 1;
|
||||
galias->groups++;
|
||||
|
||||
Q_strncpyz(frame->name, frameinfo->name, sizeof(frame->name));
|
||||
|
||||
verts = (vec3_t *)(pose+1);
|
||||
normals = &verts[galias->numverts];
|
||||
pose->ofsverts = (char *)verts - (char *)pose;
|
||||
|
@ -2942,7 +3046,12 @@ static void *Q1_LoadFrameGroup (daliasframetype_t *pframetype, int *seamremaps)
|
|||
pose->ofsnormals = (char *)normals - (char *)pose;
|
||||
#endif
|
||||
|
||||
pinframe = (dtrivertx_t *)((char *)pinframe + sizeof(daliasframe_t));
|
||||
frameinfo = (daliasframe_t*)pinframe;
|
||||
pinframe = (dtrivertx_t *)((char *)frameinfo + sizeof(daliasframe_t));
|
||||
|
||||
if (k == 0)
|
||||
Q_strncpyz(frame->name, frameinfo->name, sizeof(frame->name));
|
||||
|
||||
for (j = 0; j < pq1inmodel->numverts; j++)
|
||||
{
|
||||
verts[j][0] = pinframe[j].v[0]*pq1inmodel->scale[0]+pq1inmodel->scale_origin[0];
|
||||
|
@ -3600,6 +3709,7 @@ void GL_LoadQ2Model (model_t *mod, void *buffer)
|
|||
|
||||
|
||||
pinframe = ( dmd2aliasframe_t * )( ( qbyte * )pq2inmodel + LittleLong (pq2inmodel->ofs_frames) + i * framesize );
|
||||
Q_strncpyz(poutframe->name, pinframe->name, sizeof(poutframe->name));
|
||||
|
||||
for (j=0 ; j<3 ; j++)
|
||||
{
|
||||
|
@ -4132,6 +4242,8 @@ void GL_LoadQ3Model(model_t *mod, void *buffer)
|
|||
pose->scale_origin[1] = 0;
|
||||
pose->scale_origin[2] = 0;
|
||||
|
||||
_snprintf(group->name, sizeof(group->name)-1, "frame%i", i);
|
||||
|
||||
group->numposes = 1;
|
||||
group->rate = 1;
|
||||
group->poseofs = (qbyte*)pose - (qbyte*)group;
|
||||
|
@ -4574,6 +4686,8 @@ void GLMod_LoadZymoticModel(model_t *mod, void *buffer)
|
|||
|
||||
for (i = 0; i < header->numscenes; i++, grp++, inscene++)
|
||||
{
|
||||
Q_strncpyz(grp->name, inscene->name, sizeof(grp->name));
|
||||
|
||||
grp->isheirachical = 1;
|
||||
grp->rate = BigFloat(inscene->framerate);
|
||||
grp->loop = !(BigLong(inscene->flags) & ZYMSCENEFLAG_NOLOOP);
|
||||
|
@ -4880,6 +4994,8 @@ void GLMod_LoadDarkPlacesModel(model_t *mod, void *buffer)
|
|||
inframes[i].maxs[1] = BigLong(inframes[i].maxs[1]);
|
||||
inframes[i].maxs[2] = BigLong(inframes[i].maxs[2]);
|
||||
|
||||
Q_strncpyz(outgroups[i].name, inframes[i].name, sizeof(outgroups[i].name));
|
||||
|
||||
outgroups[i].rate = 10;
|
||||
outgroups[i].numposes = 1;
|
||||
outgroups[i].isheirachical = true;
|
||||
|
@ -5114,6 +5230,8 @@ galiasinfo_t *GLMod_ParseMD5MeshModel(char *buffer)
|
|||
pose->numposes = 1;
|
||||
pose->poseofs = (char*)posedata - (char*)pose;
|
||||
|
||||
Q_strncpyz(pose->name, "base", sizeof(pose->name));
|
||||
|
||||
EXPECT("{");
|
||||
//"name" parent (x y z) (s t u)
|
||||
//stu are a normalized quaternion, which we will convert to a 3*4 matrix for no apparent reason
|
||||
|
@ -5609,6 +5727,7 @@ galiasgroup_t GLMod_ParseMD5Anim(char *buffer, galiasinfo_t *prototype, void**po
|
|||
BZ_Free(boneflags);
|
||||
BZ_Free(baseframe);
|
||||
|
||||
Q_strncpyz(grp.name, "", sizeof(grp.name));
|
||||
grp.isheirachical = true;
|
||||
grp.numposes = numframes;
|
||||
grp.rate = framespersecond;
|
||||
|
@ -5659,7 +5778,7 @@ void GLMod_LoadCompositeAnim(model_t *mod, void *buffer)
|
|||
|
||||
buffer = COM_Parse(buffer);
|
||||
if (strcmp(com_token, "EXTERNALANIM"))
|
||||
Sys_Error("EXTERNALANIM: header is not compleate");
|
||||
Sys_Error("EXTERNALANIM: header is not compleate (%s)", mod->name);
|
||||
|
||||
buffer = COM_Parse(buffer);
|
||||
if (!strcmp(com_token, "model"))
|
||||
|
@ -5668,7 +5787,7 @@ void GLMod_LoadCompositeAnim(model_t *mod, void *buffer)
|
|||
file = COM_LoadTempFile2(com_token);
|
||||
|
||||
if (!file) //FIXME: make non fatal somehow..
|
||||
Sys_Error("Couldn't open %s", com_token);
|
||||
Sys_Error("Couldn't open %s (from %s)", com_token, mod->name);
|
||||
|
||||
root = GLMod_ParseMD5MeshModel(file);
|
||||
newgroup = (galiasgroup_t*)((char*)root + root->groupofs);
|
||||
|
@ -5702,23 +5821,26 @@ void GLMod_LoadCompositeAnim(model_t *mod, void *buffer)
|
|||
file = COM_LoadTempFile2(com_token);
|
||||
if (file) //FIXME: make non fatal somehow..
|
||||
{
|
||||
char namebkup[MAX_QPATH];
|
||||
Q_strncpyz(namebkup, com_token, sizeof(namebkup));
|
||||
grouplist[numgroups] = GLMod_ParseMD5Anim(file, root, &poseofs[numgroups]);
|
||||
Q_strncpyz(grouplist[numgroups].name, namebkup, sizeof(grouplist[numgroups].name));
|
||||
numgroups++;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(com_token, "clampgroup"))
|
||||
{
|
||||
Sys_Error("EXTERNALANIM: clampgroup not yet supported");
|
||||
Sys_Error("EXTERNALANIM: clampgroup not yet supported (%s)", mod->name);
|
||||
return;
|
||||
}
|
||||
else if (!strcmp(com_token, "frames"))
|
||||
{
|
||||
Sys_Error("EXTERNALANIM: frames not yet supported");
|
||||
Sys_Error("EXTERNALANIM: frames not yet supported (%s)", mod->name);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
Sys_Error("EXTERNALANIM: unrecognised token");
|
||||
Sys_Error("EXTERNALANIM: unrecognised token (%s)", mod->name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1387,18 +1387,24 @@ void R_ModifyColor ( meshbuffer_t *mb, shaderpass_t *pass )
|
|||
break;
|
||||
|
||||
case RGB_GEN_ENTITY:
|
||||
((qbyte*)&b)[0] = currententity->shaderRGBAf[0];
|
||||
((qbyte*)&b)[1] = currententity->shaderRGBAf[1];
|
||||
((qbyte*)&b)[2] = currententity->shaderRGBAf[2];
|
||||
((qbyte*)&b)[3] = currententity->shaderRGBAf[3];
|
||||
for ( i = 0; i < numColors; i++, bArray += 4 )
|
||||
{
|
||||
*(int *)bArray = *(int *)currententity->shaderRGBA;
|
||||
*(int *)bArray = b;
|
||||
}
|
||||
break;
|
||||
|
||||
case RGB_GEN_ONE_MINUS_ENTITY:
|
||||
((qbyte*)&b)[0] = 255-currententity->shaderRGBAf[0];
|
||||
((qbyte*)&b)[1] = 255-currententity->shaderRGBAf[1];
|
||||
((qbyte*)&b)[2] = 255-currententity->shaderRGBAf[2];
|
||||
((qbyte*)&b)[3] = 255-currententity->shaderRGBAf[3];
|
||||
for ( i = 0; i < numColors; i++, bArray += 4 )
|
||||
{
|
||||
bArray[0] = 255 - currententity->shaderRGBA[0];
|
||||
bArray[1] = 255 - currententity->shaderRGBA[1];
|
||||
bArray[2] = 255 - currententity->shaderRGBA[2];
|
||||
*(int *)bArray = b;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1523,15 +1529,7 @@ void R_ModifyColor ( meshbuffer_t *mb, shaderpass_t *pass )
|
|||
}
|
||||
else
|
||||
{
|
||||
memcpy ( bArray, vArray, sizeof(byte_vec4_t)*numColors );
|
||||
/*
|
||||
vec3_t dif, amb, dir;
|
||||
cl.worldmodel->funcs.LightPointValues(currententity->origin, dif, amb, dir);
|
||||
bArray[0] = dif[0]*255;
|
||||
bArray[1] = dif[1]*255;
|
||||
bArray[2] = dif[2]*255;
|
||||
//R_LightForEntity ( currententity, bArray );
|
||||
*/
|
||||
R_LightArrays((byte_vec4_t*)bArray, numColors, normalsArray);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1588,8 +1586,13 @@ void R_ModifyColor ( meshbuffer_t *mb, shaderpass_t *pass )
|
|||
break;
|
||||
|
||||
case ALPHA_GEN_ENTITY:
|
||||
for ( i = 0; i < numColors; i++, bArray += 4 ) {
|
||||
bArray[3] = currententity->alpha*255;
|
||||
if (pass->rgbgen != RGB_GEN_ENTITY)
|
||||
{//rgbgenentity copies across ints rather than chars. it comes padded with the alpha too.
|
||||
unsigned char value = bound(0, currententity->shaderRGBAf[3]*255, 255);
|
||||
for ( i = 0; i < numColors; i++, bArray += 4 )
|
||||
{
|
||||
bArray[3] = value;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -403,7 +403,7 @@ mpic_t *GLDraw_SafeCachePic (char *path)
|
|||
mem = ReadTargaFile((qbyte *)data, com_filesize, &pic->pic.width, &height, 0);
|
||||
#ifdef AVAIL_PNGLIB
|
||||
if (!mem);
|
||||
mem = ReadPNGFile((qbyte *)data, com_filesize, &pic->pic.width, &height);
|
||||
mem = ReadPNGFile((qbyte *)data, com_filesize, &pic->pic.width, &height, alternatename);
|
||||
#endif
|
||||
#ifdef AVAIL_JPEGLIB
|
||||
if (!mem)
|
||||
|
@ -1683,12 +1683,12 @@ void GLDraw_ShaderImage (int x, int y, int w, int h, float s1, float t1, float s
|
|||
((int*)draw_mesh_colors)[2] = ((int*)draw_mesh_colors)[0];
|
||||
((int*)draw_mesh_colors)[3] = ((int*)draw_mesh_colors)[0];
|
||||
*/
|
||||
|
||||
/*
|
||||
draw_mesh_colors[0][0] = 255;
|
||||
draw_mesh_colors[0][1] = 255;
|
||||
draw_mesh_colors[0][2] = 255;
|
||||
draw_mesh_colors[0][3] = 255;
|
||||
|
||||
*/
|
||||
draw_mesh.colors_array = draw_mesh_colors;
|
||||
|
||||
draw_mesh.numvertexes = 4;
|
||||
|
@ -3618,6 +3618,7 @@ void GL_Upload8Pal24 (qbyte *data, qbyte *pal, int width, int height, qboolean
|
|||
qboolean noalpha;
|
||||
int p;
|
||||
extern qbyte gammatable[256];
|
||||
extern qboolean gammaworks;
|
||||
|
||||
s = width*height;
|
||||
if (s > sizeofuploadmemorybufferintermediate/4)
|
||||
|
@ -3625,33 +3626,69 @@ void GL_Upload8Pal24 (qbyte *data, qbyte *pal, int width, int height, qboolean
|
|||
|
||||
// if there are no transparent pixels, make it a 3 component
|
||||
// texture even if it was specified as otherwise
|
||||
if (alpha)
|
||||
if (gammaworks)
|
||||
{
|
||||
noalpha = true;
|
||||
for (i=0 ; i<s ; i++)
|
||||
if (alpha)
|
||||
{
|
||||
p = data[i];
|
||||
if (p == 255)
|
||||
noalpha = false;
|
||||
trans[(i<<2)+0] = gammatable[pal[p*3+0]];
|
||||
trans[(i<<2)+1] = gammatable[pal[p*3+1]];
|
||||
trans[(i<<2)+2] = gammatable[pal[p*3+2]];
|
||||
trans[(i<<2)+3] = (p==255)?0:255;
|
||||
noalpha = true;
|
||||
for (i=0 ; i<s ; i++)
|
||||
{
|
||||
p = data[i];
|
||||
if (p == 255)
|
||||
noalpha = false;
|
||||
trans[(i<<2)+0] = pal[p*3+0];
|
||||
trans[(i<<2)+1] = pal[p*3+1];
|
||||
trans[(i<<2)+2] = pal[p*3+2];
|
||||
trans[(i<<2)+3] = (p==255)?0:255;
|
||||
}
|
||||
|
||||
if (alpha && noalpha)
|
||||
alpha = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s&3)
|
||||
Sys_Error ("GL_Upload8: s&3");
|
||||
for (i=0 ; i<s ; i+=1)
|
||||
{
|
||||
trans[(i<<2)+0] = pal[data[i]*3+0];
|
||||
trans[(i<<2)+1] = pal[data[i]*3+1];
|
||||
trans[(i<<2)+2] = pal[data[i]*3+2];
|
||||
trans[(i<<2)+3] = 255;
|
||||
}
|
||||
}
|
||||
|
||||
if (alpha && noalpha)
|
||||
alpha = false;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
if (s&3)
|
||||
Sys_Error ("GL_Upload8: s&3");
|
||||
for (i=0 ; i<s ; i+=1)
|
||||
if (alpha)
|
||||
{
|
||||
trans[(i<<2)+0] = gammatable[pal[data[i]*3+0]];
|
||||
trans[(i<<2)+1] = gammatable[pal[data[i]*3+1]];
|
||||
trans[(i<<2)+2] = gammatable[pal[data[i]*3+2]];
|
||||
trans[(i<<2)+3] = 255;
|
||||
noalpha = true;
|
||||
for (i=0 ; i<s ; i++)
|
||||
{
|
||||
p = data[i];
|
||||
if (p == 255)
|
||||
noalpha = false;
|
||||
trans[(i<<2)+0] = gammatable[pal[p*3+0]];
|
||||
trans[(i<<2)+1] = gammatable[pal[p*3+1]];
|
||||
trans[(i<<2)+2] = gammatable[pal[p*3+2]];
|
||||
trans[(i<<2)+3] = (p==255)?0:255;
|
||||
}
|
||||
|
||||
if (alpha && noalpha)
|
||||
alpha = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (s&3)
|
||||
Sys_Error ("GL_Upload8: s&3");
|
||||
for (i=0 ; i<s ; i+=1)
|
||||
{
|
||||
trans[(i<<2)+0] = gammatable[pal[data[i]*3+0]];
|
||||
trans[(i<<2)+1] = gammatable[pal[data[i]*3+1]];
|
||||
trans[(i<<2)+2] = gammatable[pal[data[i]*3+2]];
|
||||
trans[(i<<2)+3] = 255;
|
||||
}
|
||||
}
|
||||
}
|
||||
GL_Upload32 (NULL, (unsigned*)trans, width, height, mipmap, alpha);
|
||||
|
|
|
@ -54,7 +54,7 @@ void GL_DrawHeightmapModel (entity_t *e)
|
|||
}
|
||||
qglEnable(GL_CULL_FACE);
|
||||
|
||||
qglColor4f(1, 1, 1, e->alpha);
|
||||
qglColor4fv(e->shaderRGBAf);
|
||||
|
||||
for (x = 0; x < hm->numsegs; x++)
|
||||
{
|
||||
|
|
|
@ -506,7 +506,7 @@ void R_DrawHLModel(entity_t *curent)
|
|||
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
|
||||
if (curent->alpha<1)
|
||||
if (curent->shaderRGBAf[3]<1)
|
||||
{
|
||||
qglEnable(GL_BLEND);
|
||||
}
|
||||
|
@ -523,7 +523,7 @@ void R_DrawHLModel(entity_t *curent)
|
|||
{
|
||||
vec3_t difuse, ambient, ldir;
|
||||
cl.worldmodel->funcs.LightPointValues(curent->origin, difuse, ambient, ldir);
|
||||
qglColor4f(difuse[0]/255+ambient[0]/255, difuse[1]/255+ambient[1]/255, difuse[2]/255+ambient[2]/255, curent->alpha);
|
||||
qglColor4f(difuse[0]/255+ambient[0]/255, difuse[1]/255+ambient[1]/255, difuse[2]/255+ambient[2]/255, curent->shaderRGBAf[3]);
|
||||
}
|
||||
|
||||
R_RotateForEntity (curent);
|
||||
|
|
|
@ -378,7 +378,7 @@ static void PPL_BaseChain_NoBump_2TMU_Overbright(msurface_t *s, texture_t *tex)
|
|||
|
||||
PPL_EnableVertexArrays();
|
||||
|
||||
if (tex->alphaed)
|
||||
if (tex->alphaed || currententity->shaderRGBAf[3]<1)
|
||||
{
|
||||
qglEnable(GL_BLEND);
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
|
@ -1541,7 +1541,7 @@ static void PPL_BaseTextureChain(msurface_t *first)
|
|||
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
GL_Bind (t->gl_texturenum);
|
||||
for (; first ; first=first->texturechain)
|
||||
EmitWaterPolys (first, currententity->alpha);
|
||||
EmitWaterPolys (first, currententity->shaderRGBAf[3]);
|
||||
|
||||
qglDisable(GL_BLEND);
|
||||
qglColor4f(1,1,1, 1);
|
||||
|
@ -1642,9 +1642,14 @@ void PPL_BaseTextures(model_t *model)
|
|||
|
||||
GL_DoSwap();
|
||||
|
||||
currententity->shaderRGBAf[0] = 1;
|
||||
currententity->shaderRGBAf[1] = 1;
|
||||
currententity->shaderRGBAf[2] = 1;
|
||||
currententity->shaderRGBAf[3] = 1;
|
||||
|
||||
qglDisable(GL_BLEND);
|
||||
qglDisable(GL_ALPHA_TEST);
|
||||
qglColor4f(1,1,1, 1);
|
||||
qglColor4fv(currententity->shaderRGBAf);
|
||||
// qglDepthFunc(GL_LESS);
|
||||
|
||||
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
@ -1659,7 +1664,6 @@ void PPL_BaseTextures(model_t *model)
|
|||
overbright = 1;
|
||||
|
||||
currentmodel = model;
|
||||
currententity->alpha = 1;
|
||||
|
||||
if (model == cl.worldmodel && skytexturenum>=0)
|
||||
{
|
||||
|
@ -1722,16 +1726,12 @@ void PPL_BaseBModelTextures(entity_t *e)
|
|||
|
||||
GL_TexEnv(GL_MODULATE);
|
||||
|
||||
if (currententity->alpha<1)
|
||||
{
|
||||
if (currententity->shaderRGBAf[3]<1)
|
||||
qglEnable(GL_BLEND);
|
||||
qglColor4f(1, 1, 1, currententity->alpha);
|
||||
}
|
||||
else
|
||||
{
|
||||
qglDisable(GL_BLEND);
|
||||
qglColor4f(1, 1, 1, 1);
|
||||
}
|
||||
|
||||
qglColor4fv(currententity->shaderRGBAf);
|
||||
|
||||
qglBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
|
@ -1870,6 +1870,7 @@ void R_DrawRailCore(entity_t *e)
|
|||
vec2_t texcoords[4] = {{0, 0}, {0, 1}, {1, 1}, {1, 0}};
|
||||
int indexarray[6] = {0, 1, 2, 0, 2, 3};
|
||||
int colors[4];
|
||||
qbyte colorsb[4];
|
||||
|
||||
if (!e->forcedshader)
|
||||
return;
|
||||
|
@ -1899,7 +1900,11 @@ void R_DrawRailCore(entity_t *e)
|
|||
VectorMA(e->oldorigin, scale/2, cr, points[2]);
|
||||
VectorMA(e->oldorigin, -scale/2, cr, points[3]);
|
||||
|
||||
colors[0] = colors[1] = colors[2] = colors[3] = *(int*)e->shaderRGBA;
|
||||
colorsb[0] = e->shaderRGBAf[0]*255;
|
||||
colorsb[1] = e->shaderRGBAf[1]*255;
|
||||
colorsb[2] = e->shaderRGBAf[2]*255;
|
||||
colorsb[3] = e->shaderRGBAf[3]*255;
|
||||
colors[0] = colors[1] = colors[2] = colors[3] = *(int*)colorsb;
|
||||
|
||||
mesh.xyz_array = points;
|
||||
mesh.indexes = indexarray;
|
||||
|
@ -2032,11 +2037,11 @@ void R_DrawBeam( entity_t *e )
|
|||
g = ( d_8to24rgbtable[e->skinnum & 0xFF] >> 8 ) & 0xFF;
|
||||
b = ( d_8to24rgbtable[e->skinnum & 0xFF] >> 16 ) & 0xFF;
|
||||
|
||||
r *= 1/255.0F;
|
||||
g *= 1/255.0F;
|
||||
b *= 1/255.0F;
|
||||
r *= e->shaderRGBAf[0]/255.0F;
|
||||
g *= e->shaderRGBAf[1]/255.0F;
|
||||
b *= e->shaderRGBAf[2]/255.0F;
|
||||
|
||||
qglColor4f( r, g, b, e->alpha );
|
||||
qglColor4f( r, g, b, e->shaderRGBAf[3] );
|
||||
|
||||
qglBegin( GL_TRIANGLE_STRIP );
|
||||
for ( i = 0; i < NUM_BEAM_SEGS; i++ )
|
||||
|
|
|
@ -508,6 +508,7 @@ void R_DrawSpriteModel (entity_t *e)
|
|||
mspriteframe_t *frame;
|
||||
vec3_t forward, right, up;
|
||||
msprite_t *psprite;
|
||||
qbyte coloursb[4];
|
||||
|
||||
#ifdef Q3SHADERS
|
||||
if (e->forcedshader)
|
||||
|
@ -527,8 +528,12 @@ void R_DrawSpriteModel (entity_t *e)
|
|||
VectorSet (e->origin[0] - x*vright[0] - y*vup[0], e->origin[1] - x*vright[1] - y*vup[1], e->origin[2] - x*vright[2] - y*vup[2], vertcoords[2]);
|
||||
VectorSet (e->origin[0] + y*vright[0] - x*vup[0], e->origin[1] + y*vright[1] - x*vup[1], e->origin[2] + y*vright[2] - x*vup[2], vertcoords[1]);
|
||||
VectorSet (e->origin[0] + x*vright[0] + y*vup[0], e->origin[1] + x*vright[1] + y*vup[1], e->origin[2] + x*vright[2] + y*vup[2], vertcoords[0]);
|
||||
*(int*)colours[0] = *(int*)colours[1] = *(int*)colours[2] = *(int*)colours[3] =
|
||||
*(int*)e->shaderRGBA;
|
||||
|
||||
coloursb[0] = e->shaderRGBAf[0]*255;
|
||||
coloursb[1] = e->shaderRGBAf[1]*255;
|
||||
coloursb[2] = e->shaderRGBAf[2]*255;
|
||||
coloursb[3] = e->shaderRGBAf[3]*255;
|
||||
*(int*)colours[0] = *(int*)colours[1] = *(int*)colours[2] = *(int*)colours[3] = *(int*)coloursb;
|
||||
|
||||
mesh.colors_array = colours;
|
||||
mesh.indexes = indexes;
|
||||
|
@ -602,7 +607,7 @@ void R_DrawSpriteModel (entity_t *e)
|
|||
right[1]*=e->scale;
|
||||
right[2]*=e->scale;
|
||||
|
||||
qglColor4f (1,1,1, e->alpha);
|
||||
qglColor4fv (e->shaderRGBAf);
|
||||
|
||||
GL_DisableMultitexture();
|
||||
|
||||
|
@ -630,7 +635,7 @@ void R_DrawSpriteModel (entity_t *e)
|
|||
qglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
qglBlendFunc(GL_SRC_ALPHA, GL_ONE);
|
||||
}
|
||||
else if (e->alpha<1 || gl_blendsprites.value)
|
||||
else if (e->shaderRGBAf[3]<1 || gl_blendsprites.value)
|
||||
{
|
||||
qglEnable(GL_BLEND);
|
||||
qglTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
|
|
@ -66,7 +66,7 @@ extern cvar_t r_loadlits;
|
|||
extern cvar_t r_stainfadetime;
|
||||
extern cvar_t r_stainfadeammount;
|
||||
|
||||
extern cvar_t gl_lightmapmode;
|
||||
//extern cvar_t gl_lightmapmode;
|
||||
|
||||
|
||||
//radius, x y z, r g b
|
||||
|
|
|
@ -723,6 +723,29 @@ static void Shaderpass_AlphaGen ( shader_t *shader, shaderpass_t *pass, char **p
|
|||
pass->alphagen_func.args[0] = fabs( Shader_ParseFloat (ptr) );
|
||||
}
|
||||
}
|
||||
static void Shaderpass_AlphaShift ( shader_t *shader, shaderpass_t *pass, char **ptr ) //for alienarena
|
||||
{
|
||||
float speed;
|
||||
float min, max;
|
||||
pass->alphagen = ALPHA_GEN_WAVE;
|
||||
|
||||
pass->alphagen_func.type = SHADER_FUNC_SIN;
|
||||
|
||||
|
||||
//arg0 = add
|
||||
//arg1 = scale
|
||||
//arg2 = timeshift
|
||||
//arg3 = timescale
|
||||
|
||||
speed = Shader_ParseFloat ( ptr );
|
||||
min = Shader_ParseFloat ( ptr );
|
||||
max = Shader_ParseFloat ( ptr );
|
||||
|
||||
pass->alphagen_func.args[0] = min + (max - min)/2;
|
||||
pass->alphagen_func.args[1] = (max - min)/2;
|
||||
pass->alphagen_func.args[2] = 0;
|
||||
pass->alphagen_func.args[3] = 1/speed;
|
||||
}
|
||||
|
||||
static void Shaderpass_BlendFunc ( shader_t *shader, shaderpass_t *pass, char **ptr )
|
||||
{
|
||||
|
@ -866,6 +889,76 @@ static void Shaderpass_TcMod ( shader_t *shader, shaderpass_t *pass, char **ptr
|
|||
pass->numtcmods++;
|
||||
}
|
||||
|
||||
static void Shaderpass_Scale ( shader_t *shader, shaderpass_t *pass, char **ptr )
|
||||
{
|
||||
//seperate x and y
|
||||
char *token;
|
||||
tcmod_t *tcmod;
|
||||
|
||||
tcmod = &pass->tcmods[pass->numtcmods];
|
||||
|
||||
token = Shader_ParseString ( ptr );
|
||||
if (!strcmp(token, "static"))
|
||||
{
|
||||
tcmod->type = SHADER_TCMOD_SCALE;
|
||||
tcmod->args[0] = Shader_ParseFloat ( ptr );
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Printf("Bad shader scale\n");
|
||||
return;
|
||||
}
|
||||
|
||||
token = Shader_ParseString ( ptr );
|
||||
if (!strcmp(token, "static"))
|
||||
{
|
||||
tcmod->type = SHADER_TCMOD_SCALE;
|
||||
tcmod->args[1] = Shader_ParseFloat ( ptr );
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Printf("Bad shader scale\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pass->numtcmods++;
|
||||
}
|
||||
|
||||
static void Shaderpass_Scroll ( shader_t *shader, shaderpass_t *pass, char **ptr )
|
||||
{
|
||||
//seperate x and y
|
||||
char *token;
|
||||
tcmod_t *tcmod;
|
||||
|
||||
tcmod = &pass->tcmods[pass->numtcmods];
|
||||
|
||||
token = Shader_ParseString ( ptr );
|
||||
if (!strcmp(token, "static"))
|
||||
{
|
||||
tcmod->type = SHADER_TCMOD_SCROLL;
|
||||
tcmod->args[0] = Shader_ParseFloat ( ptr );
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Printf("Bad shader scale\n");
|
||||
return;
|
||||
}
|
||||
|
||||
token = Shader_ParseString ( ptr );
|
||||
if (!strcmp(token, "static"))
|
||||
{
|
||||
tcmod->type = SHADER_TCMOD_SCROLL;
|
||||
tcmod->args[1] = Shader_ParseFloat ( ptr );
|
||||
}
|
||||
else
|
||||
{
|
||||
Con_Printf("Bad shader scale\n");
|
||||
return;
|
||||
}
|
||||
|
||||
pass->numtcmods++;
|
||||
}
|
||||
|
||||
|
||||
static void Shaderpass_TcGen ( shader_t *shader, shaderpass_t *pass, char **ptr )
|
||||
{
|
||||
|
@ -882,12 +975,27 @@ static void Shaderpass_TcGen ( shader_t *shader, shaderpass_t *pass, char **ptr
|
|||
pass->tcgen = TC_GEN_BASE;
|
||||
}
|
||||
}
|
||||
static void Shaderpass_EnvMap ( shader_t *shader, shaderpass_t *pass, char **ptr ) //for alienarena
|
||||
{
|
||||
pass->tcgen = TC_GEN_ENVIRONMENT;
|
||||
}
|
||||
|
||||
static void Shaderpass_Detail ( shader_t *shader, shaderpass_t *pass, char **ptr )
|
||||
{
|
||||
pass->flags |= SHADER_PASS_DETAIL;
|
||||
}
|
||||
|
||||
static void Shaderpass_AlphaMask ( shader_t *shader, shaderpass_t *pass, char **ptr )
|
||||
{
|
||||
pass->flags |= SHADER_PASS_ALPHAFUNC;
|
||||
pass->alphafunc = SHADER_ALPHA_GE128;
|
||||
}
|
||||
|
||||
static void Shaderpass_NoLightMap ( shader_t *shader, shaderpass_t *pass, char **ptr )
|
||||
{
|
||||
pass->rgbgen = RGB_GEN_IDENTITY;
|
||||
}
|
||||
|
||||
static shaderkey_t shaderpasskeys[] =
|
||||
{
|
||||
{"rgbgen", Shaderpass_RGBGen },
|
||||
|
@ -901,7 +1009,13 @@ static shaderkey_t shaderpasskeys[] =
|
|||
{"clampmap", Shaderpass_ClampMap },
|
||||
{"videomap", Shaderpass_VideoMap },
|
||||
{"tcgen", Shaderpass_TcGen },
|
||||
{"envmap", Shaderpass_EnvMap },//for alienarena
|
||||
{"nolightmap", Shaderpass_NoLightMap },//for alienarena
|
||||
{"scale", Shaderpass_Scale },//for alienarena
|
||||
{"scroll", Shaderpass_Scroll },//for alienarena
|
||||
{"alphagen", Shaderpass_AlphaGen },
|
||||
{"alphashift", Shaderpass_AlphaShift },//for alienarena
|
||||
{"alphamask", Shaderpass_AlphaMask },//for alienarena
|
||||
{"detail", Shaderpass_Detail },
|
||||
{NULL, NULL }
|
||||
};
|
||||
|
@ -925,6 +1039,7 @@ qboolean Shader_Init (void)
|
|||
|
||||
COM_EnumerateFiles("shaders/*.shader", Shader_InitCallback, NULL);
|
||||
COM_EnumerateFiles("scripts/*.shader", Shader_InitCallback, NULL);
|
||||
// COM_EnumerateFiles("scripts/*.rscript", Shader_InitCallback, NULL);
|
||||
|
||||
/*
|
||||
char *dirptr;
|
||||
|
@ -2070,6 +2185,11 @@ int R_LoadShader ( char *name, void(*defaultgen)(char *name, shader_t*))
|
|||
s->flags = SHADER_CULL_FRONT;
|
||||
s->registration_sequence = 1;//fizme: registration_sequence;
|
||||
|
||||
// if (!strcmp(COM_FileExtension(ts), "rscript"))
|
||||
// {
|
||||
// Shader_DefaultBSP(shortname, s);
|
||||
// }
|
||||
|
||||
ptr = buf + offset;
|
||||
token = COM_ParseExt (&ptr, true);
|
||||
|
||||
|
|
|
@ -957,12 +957,12 @@ void GLVID_ShiftPalette (unsigned char *palette)
|
|||
if (vid_desktopgamma.value)
|
||||
{
|
||||
HDC hDC = GetDC(GetDesktopWindow());
|
||||
gammaworks = qSetDeviceGammaRamp (hDC, ramps);
|
||||
qSetDeviceGammaRamp (hDC, ramps);
|
||||
ReleaseDC(GetDesktopWindow(), hDC);
|
||||
}
|
||||
else
|
||||
{
|
||||
gammaworks = qSetDeviceGammaRamp (maindc, ramps);
|
||||
qSetDeviceGammaRamp (maindc, ramps);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -1139,7 +1139,6 @@ qboolean GLAppActivate(BOOL fActive, BOOL minimize)
|
|||
}
|
||||
|
||||
v_gamma.modified = true; //so that we can start doing palette flashes and things
|
||||
gammaworks = true;
|
||||
}
|
||||
|
||||
if (!fActive)
|
||||
|
@ -1166,12 +1165,12 @@ qboolean GLAppActivate(BOOL fActive, BOOL minimize)
|
|||
if (vid_desktopgamma.value)
|
||||
{
|
||||
HDC hDC = GetDC(GetDesktopWindow());
|
||||
gammaworks = qSetDeviceGammaRamp (hDC, originalgammaramps);
|
||||
qSetDeviceGammaRamp (hDC, originalgammaramps);
|
||||
ReleaseDC(GetDesktopWindow(), hDC);
|
||||
}
|
||||
else
|
||||
{
|
||||
gammaworks = qSetDeviceGammaRamp(maindc, originalgammaramps);
|
||||
qSetDeviceGammaRamp(maindc, originalgammaramps);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -308,6 +308,7 @@ void GL_SetupSceneProcessingTextures (void);
|
|||
void R_DrawGAliasModel (entity_t *e);
|
||||
void R_DrawGAliasShadowVolume(entity_t *e, vec3_t lightpos, float radius);
|
||||
void R_DrawGAliasModelLighting (entity_t *e, vec3_t lightpos, vec3_t colours, float radius);
|
||||
void R_LightArrays(byte_vec4_t *colours, int vertcount, vec3_t *normals);
|
||||
|
||||
//misc model formats
|
||||
void R_DrawAlias3Model (entity_t *ent);
|
||||
|
|
|
@ -6423,7 +6423,7 @@ lh_extension_t FTE_Protocol_Extensions[] =
|
|||
{"FTE_PEXT_VWEAP"},
|
||||
{"FTE_PEXT_Q2BSP"}, //supports q2 maps. No bugs are apparent.
|
||||
{"FTE_PEXT_Q3BSP"}, //quake3 bsp support. dp probably has an equivelent, but this is queryable per client.
|
||||
{NULL}, //UDC_EXTEFFECT, no longer supported
|
||||
{"DP_ENT_COLORMOD"},
|
||||
{NULL}, //splitscreen - not queryable.
|
||||
{"FTE_HEXEN2"}, //client can use hexen2 maps. server can use hexen2 progs
|
||||
{"FTE_PEXT_SPAWNSTATIC"}, //means that static entities can have alpha/scale and anything else the engine supports on normal ents. (Added for >256 models, while still being compatable - previous system failed with -1 skins)
|
||||
|
@ -9889,6 +9889,8 @@ void PR_RegisterFields(void) //it's just easier to do it this way.
|
|||
fieldfloat(glow_color);
|
||||
fieldfloat(glow_trail);
|
||||
|
||||
fieldvector(colormod);
|
||||
|
||||
fieldvector(color);
|
||||
fieldfloat(light_lev);
|
||||
fieldfloat(style);
|
||||
|
|
|
@ -197,6 +197,7 @@ typedef struct entvars_s
|
|||
float glow_trail;
|
||||
|
||||
vec3_t color;
|
||||
vec3_t colormod;
|
||||
float light_lev;
|
||||
float style;
|
||||
float pflags;
|
||||
|
|
|
@ -534,6 +534,13 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
|
|||
if ( to->abslight != from->abslight && protext & PEXT_HEXEN2)
|
||||
evenmorebits |= U_ABSLIGHT;
|
||||
|
||||
if (to->colormod[0]!=32||to->colormod[1]!=32||to->colormod[2]!=32 && protext & PEXT_COLOURMOD)
|
||||
evenmorebits |= U_COLOURMOD;
|
||||
|
||||
if (to->dpflags != from->dpflags && protext & PEXT_DPFLAGS)
|
||||
evenmorebits |= U_DPFLAGS;
|
||||
|
||||
|
||||
if (to->glowsize != from->glowsize)
|
||||
to->dpflags |= 4;
|
||||
|
||||
|
@ -626,6 +633,13 @@ void SV_WriteDelta (entity_state_t *from, entity_state_t *to, sizebuf_t *msg, qb
|
|||
if (evenmorebits & U_ABSLIGHT)
|
||||
MSG_WriteByte (msg, to->abslight);
|
||||
|
||||
if (evenmorebits & U_COLOURMOD)
|
||||
{
|
||||
MSG_WriteByte (msg, to->colormod[0]);
|
||||
MSG_WriteByte (msg, to->colormod[1]);
|
||||
MSG_WriteByte (msg, to->colormod[2]);
|
||||
}
|
||||
|
||||
if (evenmorebits & U_DPFLAGS)
|
||||
MSG_WriteByte (msg, to->dpflags);
|
||||
|
||||
|
@ -1811,7 +1825,7 @@ int i, eff;
|
|||
float miss;
|
||||
unsigned int bits=0;
|
||||
|
||||
int glowsize=0, glowcolor=0;
|
||||
int glowsize=0, glowcolor=0, colourmod=0;
|
||||
|
||||
for (i=0 ; i<3 ; i++)
|
||||
{
|
||||
|
@ -1879,10 +1893,15 @@ int glowsize=0, glowcolor=0;
|
|||
glowsize = ent->v->glow_size*0.25f;
|
||||
glowcolor = ent->v->glow_color;
|
||||
|
||||
colourmod = ((int)bound(0, ent->v->colormod[0] * (7.0f / 32.0f), 7) << 5) | ((int)bound(0, ent->v->colormod[1] * (7.0f / 32.0f), 7) << 2) | ((int)bound(0, ent->v->colormod[2] * (3.0f / 32.0f), 3) << 0);
|
||||
|
||||
if (0 != glowsize)
|
||||
bits |= DPU_GLOWSIZE;
|
||||
if (0 != glowcolor)
|
||||
bits |= DPU_GLOWCOLOR;
|
||||
|
||||
if (0 != colourmod)
|
||||
bits |= DPU_COLORMOD;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1936,7 +1955,7 @@ int glowsize=0, glowcolor=0;
|
|||
if (bits & DPU_EFFECTS2) MSG_WriteByte(msg, eff >> 8);
|
||||
if (bits & DPU_GLOWSIZE) MSG_WriteByte(msg, glowsize);
|
||||
if (bits & DPU_GLOWCOLOR) MSG_WriteByte(msg, glowcolor);
|
||||
// if (bits & DPU_COLORMOD) MSG_WriteByte(msg, colormod);
|
||||
if (bits & DPU_COLORMOD) MSG_WriteByte(msg, colourmod);
|
||||
if (bits & DPU_FRAME2) MSG_WriteByte(msg, (int)ent->v->frame >> 8);
|
||||
if (bits & DPU_MODEL2) MSG_WriteByte(msg, (int)ent->v->modelindex >> 8);
|
||||
}
|
||||
|
@ -2552,6 +2571,18 @@ void SV_WriteEntitiesToClient (client_t *client, sizebuf_t *msg, qboolean ignore
|
|||
state->effects &= ~ (QWEF_FLAG1|QWEF_FLAG2);
|
||||
}
|
||||
|
||||
if (!ent->v->colormod[0] && !ent->v->colormod[1] && !ent->v->colormod[2])
|
||||
{
|
||||
state->colormod[0] = (256)/8;
|
||||
state->colormod[1] = (256)/8;
|
||||
state->colormod[2] = (256)/8;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = ent->v->colormod[0]*(256/8); state->colormod[0] = bound(0, i, 255);
|
||||
i = ent->v->colormod[1]*(256/8); state->colormod[1] = bound(0, i, 255);
|
||||
i = ent->v->colormod[2]*(256/8); state->colormod[2] = bound(0, i, 255);
|
||||
}
|
||||
state->glowsize = ent->v->glow_size*0.25;
|
||||
state->glowcolour = ent->v->glow_color;
|
||||
if (ent->v->glow_trail)
|
||||
|
|
|
@ -195,6 +195,81 @@ baseline will be transmitted
|
|||
}
|
||||
}
|
||||
*/
|
||||
|
||||
void SV_EdictToEntState (int num, edict_t *ent, entity_state_t *state)
|
||||
{
|
||||
int i;
|
||||
|
||||
state->number = num;
|
||||
state->flags = 0;
|
||||
VectorCopy (ent->v->origin, state->origin);
|
||||
VectorCopy (ent->v->angles, state->angles);
|
||||
state->modelindex = ent->v->modelindex;
|
||||
state->frame = ent->v->frame;
|
||||
state->colormap = ent->v->colormap;
|
||||
state->skinnum = ent->v->skin;
|
||||
state->effects = ent->v->effects;
|
||||
state->hexen2flags = ent->v->drawflags;
|
||||
state->abslight = (int)(ent->v->abslight*255) & 255;
|
||||
state->tagentity = ent->v->tag_entity;
|
||||
state->tagindex = ent->v->tag_index;
|
||||
|
||||
state->light[0] = ent->v->color[0]*255;
|
||||
state->light[1] = ent->v->color[1]*255;
|
||||
state->light[2] = ent->v->color[2]*255;
|
||||
state->light[3] = ent->v->light_lev;
|
||||
state->lightstyle = ent->v->style;
|
||||
state->lightpflags = ent->v->pflags;
|
||||
|
||||
/* if ((int)ent->v->flags & FL_CLASS_DEPENDENT && client->playerclass) //hexen2 wierdness.
|
||||
{
|
||||
char modname[MAX_QPATH];
|
||||
Q_strncpyz(modname, sv.strings.model_precache[state->modelindex], sizeof(modname));
|
||||
if (strlen(modname)>5)
|
||||
{
|
||||
modname[strlen(modname)-5] = client->playerclass+'0';
|
||||
state->modelindex = SV_ModelIndex(modname);
|
||||
}
|
||||
}*/
|
||||
if (/*progstype == PROG_H2 &&*/ ent->v->solid == SOLID_BSP)
|
||||
state->angles[0]*=-1;
|
||||
|
||||
if (state->effects & EF_FULLBRIGHT)
|
||||
{
|
||||
state->hexen2flags |= MLS_FULLBRIGHT;
|
||||
}
|
||||
|
||||
if (!ent->v->alpha)
|
||||
state->trans = 255;
|
||||
else
|
||||
state->trans = ent->v->alpha*255;
|
||||
|
||||
if (!ent->v->colormod[0] && !ent->v->colormod[1] && !ent->v->colormod[2])
|
||||
{
|
||||
state->colormod[0] = (256)/8;
|
||||
state->colormod[1] = (256)/8;
|
||||
state->colormod[2] = (256)/8;
|
||||
}
|
||||
else
|
||||
{
|
||||
i = ent->v->colormod[0]*(256/8); state->colormod[0] = bound(0, i, 255);
|
||||
i = ent->v->colormod[1]*(256/8); state->colormod[1] = bound(0, i, 255);
|
||||
i = ent->v->colormod[2]*(256/8); state->colormod[2] = bound(0, i, 255);
|
||||
}
|
||||
state->glowsize = ent->v->glow_size*0.25;
|
||||
state->glowcolour = ent->v->glow_color;
|
||||
#define RENDER_GLOWTRAIL 2
|
||||
if (ent->v->glow_trail)
|
||||
state->dpflags |= RENDER_GLOWTRAIL;
|
||||
|
||||
if (!ent->v->scale)
|
||||
state->scale = 1*16;
|
||||
else
|
||||
state->scale = ent->v->scale*16;
|
||||
|
||||
state->fatness = ent->v->fatness*2;
|
||||
}
|
||||
|
||||
void SVNQ_CreateBaseline (void)
|
||||
{
|
||||
edict_t *svent;
|
||||
|
@ -226,10 +301,8 @@ void SVNQ_CreateBaseline (void)
|
|||
//
|
||||
// create entity baseline
|
||||
//
|
||||
VectorCopy (svent->v->origin, svent->baseline.origin);
|
||||
VectorCopy (svent->v->angles, svent->baseline.angles);
|
||||
svent->baseline.frame = svent->v->frame;
|
||||
svent->baseline.skinnum = svent->v->skin;
|
||||
SV_EdictToEntState(entnum, svent, &svent->baseline);
|
||||
|
||||
if (entnum > 0 && entnum <= sv.allocated_client_slots)
|
||||
{
|
||||
if (entnum > 0 && entnum <= 16)
|
||||
|
@ -239,11 +312,6 @@ void SVNQ_CreateBaseline (void)
|
|||
|
||||
svent->baseline.modelindex = playermodel;
|
||||
}
|
||||
else
|
||||
{
|
||||
svent->baseline.colormap = 0;
|
||||
svent->baseline.modelindex = svent->v->modelindex;
|
||||
}
|
||||
svent->baseline.modelindex&=255;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3293,6 +3293,7 @@ void SV_InitLocal (void)
|
|||
#endif
|
||||
svs.fteprotocolextensions |= PEXT_SPLITSCREEN;
|
||||
svs.fteprotocolextensions |= PEXT_HEXEN2;
|
||||
svs.fteprotocolextensions |= PEXT_COLOURMOD;
|
||||
svs.fteprotocolextensions |= PEXT_SPAWNSTATIC2;
|
||||
svs.fteprotocolextensions |= PEXT_CUSTOMTEMPEFFECTS;
|
||||
svs.fteprotocolextensions |= PEXT_256PACKETENTITIES;
|
||||
|
|
|
@ -4541,7 +4541,7 @@ haveannothergo:
|
|||
Con_DPrintf ("Failed command checksum for %s(%d) (%d != %d)\n",
|
||||
cl->name, cl->netchan.incoming_sequence, checksum, calculatedChecksum);
|
||||
|
||||
for (; cl; cl = cl->controlled) //FIXME
|
||||
for (cl = cl->controlled; cl; cl = cl->controlled) //FIXME
|
||||
{
|
||||
MSG_ReadDeltaUsercmd (&nullcmd, &oldest);
|
||||
MSG_ReadDeltaUsercmd (&oldest, &oldcmd);
|
||||
|
|
Loading…
Reference in a new issue