Working QMB (#31)

* Add initial non working qmb

* fix bit parsing

* Fix loading_name messages

* Fix rendering issue, add some QMB translation

* Working particles :)
This commit is contained in:
Ryan Baldwin 2022-08-01 12:01:12 -07:00 committed by GitHub
parent 4d8f3e18dd
commit e7c0cfb0f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 4823 additions and 153 deletions

View file

@ -102,8 +102,10 @@ COMMON_OBJS = chase.c \
snd_ctr.c \
in_null.c \
cd_null.c \
gl_decal.c \
gl_qmb.c \
gl_draw.c \
gl_fog.c \
gl_fog.c \
gl_mesh.c \
gl_model.c \
gl_refrag.c \

Binary file not shown.

Binary file not shown.

View file

@ -49,6 +49,10 @@ cvar_t m_side = {"m_side","0", true};
client_static_t cls;
client_state_t cl;
// FIXME: put these on hunk?
modelindex_t cl_modelindex[NUM_MODELINDEX];
char *cl_modelnames[NUM_MODELINDEX];
efrag_t cl_efrags[MAX_EFRAGS];
entity_t cl_entities[MAX_EDICTS];
entity_t cl_static_entities[MAX_STATIC_ENTITIES];
@ -360,6 +364,35 @@ dlight_t *CL_AllocDlight (int key)
return dl;
}
void CL_NewDlight (int key, vec3_t origin, float radius, float time, int type)
{
dlight_t *dl;
dl = CL_AllocDlight (key);
VectorCopy (origin, dl->origin);
dl->radius = radius;
dl->die = cl.time + time;
dl->type = type;
}
dlighttype_t SetDlightColor (float f, dlighttype_t def, qboolean random)
{
dlighttype_t colors[NUM_DLIGHTTYPES-4] = {lt_red, lt_blue, lt_redblue, lt_green};
if ((int)f == 1)
return lt_red;
else if ((int)f == 2)
return lt_blue;
else if ((int)f == 3)
return lt_redblue;
else if ((int)f == 4)
return lt_green;
else if (((int)f == NUM_DLIGHTTYPES - 3) && random)
return colors[rand()%(NUM_DLIGHTTYPES-4)];
else
return def;
}
/*
===============
@ -404,7 +437,7 @@ float CL_LerpPoint (void)
if (!f || cl_nolerp.value || cls.timedemo || sv.active)
{
cl.time = cl.mtime[0];
cl.ctime = cl.time = cl.mtime[0];
return 1;
}
@ -413,14 +446,14 @@ float CL_LerpPoint (void)
cl.mtime[1] = cl.mtime[0] - 0.1;
f = 0.1;
}
frac = (cl.time - cl.mtime[1]) / f;
frac = (cl.ctime - cl.mtime[1]) / f;
//Con_Printf ("frac: %f\n",frac);
if (frac < 0)
{
if (frac < -0.01)
{
SetPal(1);
cl.time = cl.mtime[1];
cl.ctime = cl.time = cl.mtime[1];
// Con_Printf ("low frac\n");
}
frac = 0;
@ -430,7 +463,7 @@ SetPal(1);
if (frac > 1.01)
{
SetPal(2);
cl.time = cl.mtime[0];
cl.ctime = cl.time = cl.mtime[0];
// Con_Printf ("high frac\n");
}
frac = 1;
@ -541,42 +574,66 @@ void CL_RelinkEntities (void)
if (ent->effects & EF_BRIGHTFIELD)
R_EntityParticles (ent);
#ifdef QUAKE2
if (ent->effects & EF_DARKFIELD)
R_DarkFieldParticles (ent);
#endif
if (ent->effects & EF_MUZZLEFLASH)
{
vec3_t fv, rv, uv;
if (i == cl.viewentity && qmb_initialized && r_part_muzzleflash.value)
{
vec3_t start, smokeorg, v_forward, v_right, v_up;
vec3_t tempangles;
float forward_offset, up_offset, right_offset;
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->origin[2] += 16;
AngleVectors (ent->angles, fv, rv, uv);
VectorMA (dl->origin, 18, fv, dl->origin);
dl->radius = 200 + (rand()&31);
dl->minlight = 32;
dl->die = cl.time + 0.1;
VectorAdd(cl.viewangles,CWeaponRot,tempangles);
VectorAdd(tempangles,cl.gun_kick,tempangles);
AngleVectors (tempangles, v_forward, v_right, v_up);
VectorCopy (cl_entities[cl.viewentity].origin, smokeorg);
smokeorg[2] += 32;
VectorCopy(smokeorg,start);
right_offset = sv_player->v.Flash_Offset[0];
up_offset = sv_player->v.Flash_Offset[1];
forward_offset = sv_player->v.Flash_Offset[2];
right_offset = right_offset/1000;
up_offset = up_offset/1000;
forward_offset = forward_offset/1000;
VectorMA (start, forward_offset, v_forward ,smokeorg);
VectorMA (smokeorg, up_offset, v_up ,smokeorg);
VectorMA (smokeorg, right_offset, v_right ,smokeorg);
VectorAdd(smokeorg,CWeaponOffset,smokeorg);
if (sv_player->v.weapon != W_RAY && sv_player->v.weapon != W_PORTER) {
QMB_MuzzleFlash (smokeorg);
} else {
QMB_RayFlash(smokeorg, sv_player->v.weapon);
}
}
}
if (ent->effects & EF_BRIGHTLIGHT)
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->origin[2] += 16;
dl->radius = 400 + (rand()&31);
dl->die = cl.time + 0.001;
if (ent->modelindex != cl_modelindex[mi_player] && ent->model->modhint != MOD_PLAYER)
{
if (ent->effects & EF_BRIGHTLIGHT)
{
vec3_t tmp;
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, tmp);
tmp[2] += 16;
dl->color[0] = 1;
dl->color[1] = 0.8;
dl->color[2] = 0.5;
CL_NewDlight (i, tmp, 400 + (rand() & 31), 0.1, lt_default);
}
}
if (ent->effects & EF_DIMLIGHT)
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200 + (rand()&31);
dl->die = cl.time + 0.001;
}
#ifdef QUAKE2
if (ent->effects & EF_DARKLIGHT)
{
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200.0 + (rand()&31);
@ -584,34 +641,174 @@ void CL_RelinkEntities (void)
dl->dark = true;
}
if (ent->effects & EF_LIGHT)
{
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200;
dl->die = cl.time + 0.001;
}
#endif
if (ent->model->flags & EF_GIB)
R_RocketTrail (oldorg, ent->origin, 2);
else if (ent->model->flags & EF_ZOMGIB)
R_RocketTrail (oldorg, ent->origin, 4);
else if (ent->model->flags & EF_TRACER)
R_RocketTrail (oldorg, ent->origin, 3);
else if (ent->model->flags & EF_TRACER2)
R_RocketTrail (oldorg, ent->origin, 5);
else if (ent->model->flags & EF_ROCKET)
if (ent->effects & EF_BLUELIGHT)
{
R_RocketTrail (oldorg, ent->origin, 0);
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->die = cl.time + 0.001;
dl->radius = 100;
dl->color[0] = 0.25;
dl->color[1] = 0.25;
dl->color[2] = 2;
}
if (ent->effects & EF_REDLIGHT)
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->die = cl.time + 0.001;
dl->radius = 100;
dl->color[0] = 2;
dl->color[1] = 0.25;
dl->color[2] = 0.25;
}
if (ent->effects & EF_ORANGELIGHT)
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->die = cl.time + 0.001;
dl->radius = 100;
dl->color[0] = 2;
dl->color[1] = 1;
dl->color[2] = 0;
}
if (ent->effects & EF_GREENLIGHT)
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->die = cl.time + 0.001;
dl->radius = 100;
dl->color[0] = 0.25;
dl->color[1] = 2;
dl->color[2] = 0.25;
}
if (ent->effects & EF_ORANGELIGHT)
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->die = cl.time + 0.001;
dl->radius = 100;
dl->color[0] = 2;
dl->color[1] = 1;
dl->color[2] = 0;
}
if (ent->effects & EF_GREENLIGHT)
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->die = cl.time + 0.001;
dl->radius = 100;
dl->color[0] = 0.25;
dl->color[1] = 2;
dl->color[2] = 0.25;
}
if (ent->effects & EF_PURPLELIGHT)
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->die = cl.time + 0.001;
dl->radius = 100;
dl->color[0] = 2;
dl->color[1] = 0.25;
dl->color[2] = 2;
}
if (ent->effects & EF_RAYGREEN)
{
R_RocketTrail (oldorg, ent->origin, 12);
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200;
dl->radius = 25;
dl->die = cl.time + 0.01;
dl->color[0] = 0;
dl->color[1] = 255;
dl->color[2] = 0;
dl->type = SetDlightColor (2, lt_rocket, true);
}
else if (ent->model->flags & EF_GRENADE)
R_RocketTrail (oldorg, ent->origin, 1);
else if (ent->model->flags & EF_TRACER3)
R_RocketTrail (oldorg, ent->origin, 6);
if (ent->effects & EF_RAYRED)
{
R_RocketTrail (oldorg, ent->origin, 13);
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 25;
dl->die = cl.time + 0.01;
dl->color[0] = 255;
dl->color[1] = 0;
dl->color[2] = 0;
dl->type = SetDlightColor (2, lt_rocket, true);
}
if (!strcmp(ent->model->name, "progs/flame2.mdl"))
{
if (qmb_initialized && r_part_flames.value)
{
//QMB_BigTorchFlame (ent->origin);
if (qmb_initialized && r_part_trails.value)
R_RocketTrail (oldorg, ent->origin, LAVA_TRAIL);
}
}
if ((!strcmp(ent->model->name, "progs/s_spike.mdl"))||(!strcmp(ent->model->name, "progs/spike.mdl")))
{
if (qmb_initialized && r_part_trails.value)
{
R_RocketTrail (oldorg, ent->origin, NAIL_TRAIL);
}
}
if (ent->model->flags)
{
if (ent->model->flags & EF_GIB)
R_RocketTrail (oldorg, ent->origin, 2);
else if (ent->model->flags & EF_ZOMGIB)
R_RocketTrail (oldorg, ent->origin, 4);
else if (ent->model->flags & EF_TRACER)
R_RocketTrail (oldorg, ent->origin, 3);
else if (ent->model->flags & EF_TRACER2)
R_RocketTrail (oldorg, ent->origin, 5);
else if (ent->model->flags & EF_ROCKET)
{
R_RocketTrail (oldorg, ent->origin, 0);
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 200;
dl->die = cl.time + 0.01;
dl->color[0] = 0.2;
dl->color[1] = 0.1;
dl->color[2] = 0.5;
dl->type = SetDlightColor (2, lt_rocket, true);
}
else if (ent->model->flags & EF_GRENADE)
R_RocketTrail (oldorg, ent->origin, 1);
else if (ent->model->flags & EF_TRACER3)
R_RocketTrail (oldorg, ent->origin, 6);
}
// Tomaz - QC Glow Begin
if (ISLMPOINT(ent))
{
dl = CL_AllocDlight (i);
VectorCopy (ent->origin, dl->origin);
dl->radius = 150;
dl->die = cl.time + 0.001;
dl->color[0] = ent->rendercolor[0];
dl->color[1] = ent->rendercolor[1];
dl->color[2] = ent->rendercolor[2];
}
// Tomaz - QC Glow End
ent->forcelink = false;

View file

@ -258,6 +258,10 @@ void CL_ParseServerInfo (void)
// needlessly purge it
//
// precache models
for (i=0 ; i<NUM_MODELINDEX ; i++)
cl_modelindex[i] = -1;
// precache models
memset (cl.model_precache, 0, sizeof(cl.model_precache));
for (nummodels=1 ; ; nummodels++)
@ -272,6 +276,13 @@ void CL_ParseServerInfo (void)
}
strcpy (model_precache[nummodels], str);
Mod_TouchModel (str);
if (!strcmp(model_precache[nummodels], "models/player.mdl"))
cl_modelindex[mi_player] = nummodels;
else if (!strcmp(model_precache[nummodels], "progs/flame.mdl"))
cl_modelindex[mi_flame1] = nummodels;
else if (!strcmp(model_precache[nummodels], "progs/flame2.mdl"))
cl_modelindex[mi_flame2] = nummodels;
}
// precache sounds
@ -294,25 +305,41 @@ void CL_ParseServerInfo (void)
// now we try to load everything else until a cache allocation fails
//
for (i=1 ; i<nummodels ; i++)
loading_num_step = loading_num_step +nummodels + numsounds;
loading_step = 1;
for (i=1 ; i<nummodels ; i++)
{
cl.model_precache[i] = Mod_ForName (model_precache[i], false);
if (cl.model_precache[i] == NULL)
{
Con_Printf("Model %s not found\n", model_precache[i]);
loading_cur_step++;
return;
}
CL_KeepaliveMessage ();
loading_cur_step++;
strcpy(loading_name, model_precache[i]);
SCR_UpdateScreen ();
}
SCR_UpdateScreen ();
loading_step = 4;
S_BeginPrecaching ();
for (i=1 ; i<numsounds ; i++)
{
cl.sound_precache[i] = S_PrecacheSound (sound_precache[i]);
CL_KeepaliveMessage ();
loading_cur_step++;
strcpy(loading_name, sound_precache[i]);
SCR_UpdateScreen ();
}
S_EndPrecaching ();
SCR_UpdateScreen ();
Clear_LoadingFill ();
// local state
cl_entities[0].model = cl.worldmodel = cl.model_precache[1];
@ -359,6 +386,18 @@ void CL_ParseUpdate (int bits)
bits |= (i<<8);
}
// Tomaz - QC Control Begin
if (bits & U_EXTEND1)
{
bits |= MSG_ReadByte() << 16;
if (bits & U_EXTEND2)
{
bits |= MSG_ReadByte() << 24;
}
}
// Tomaz - QC Control End
if (bits & U_LONGENTITY)
num = MSG_ReadShort ();
else
@ -479,6 +518,33 @@ if (bits&(1<<i))
else
ent->msg_angles[0][2] = ent->baseline.angles[2];
// Tomaz - QC Alpha Scale Glow Begin
if (bits & U_RENDERAMT)
ent->renderamt = MSG_ReadFloat();
else
ent->renderamt = 0;
if (bits & U_RENDERMODE)
ent->rendermode = MSG_ReadFloat();
else
ent->rendermode = 0;
if (bits & U_RENDERCOLOR1)
ent->rendercolor[0] = MSG_ReadFloat();
else
ent->rendercolor[0] = 0;
if (bits & U_RENDERCOLOR2)
ent->rendercolor[1] = MSG_ReadFloat();
else
ent->rendercolor[1] = 0;
if (bits & U_RENDERCOLOR3)
ent->rendercolor[2] = MSG_ReadFloat();
else
ent->rendercolor[2] = 0;
// Tomaz - QC Alpha Scale Glow End
if ( bits & U_NOLERP )
ent->forcelink = true;

View file

@ -262,6 +262,30 @@ entity_t *CL_NewTempEntity (void)
return ent;
}
/*
=================
TraceLineN
=================
*/
qboolean TraceLineN (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal)
{
trace_t trace;
memset (&trace, 0, sizeof(trace));
if (!SV_RecursiveHullCheck(cl.worldmodel->hulls, 0, 0, 1, start, end, &trace))
{
if (trace.fraction < 1)
{
VectorCopy (trace.endpos, impact);
if (normal)
VectorCopy (trace.plane.normal, normal);
return true;
}
}
return false;
}
/*
=================

View file

@ -54,6 +54,13 @@ typedef struct
int percent; // 0-256
} cshift_t;
typedef enum
{
lt_default, lt_muzzleflash, lt_explosion, lt_rocket,
lt_red, lt_blue, lt_redblue, lt_green, NUM_DLIGHTTYPES,
lt_explosion2, lt_explosion3, lt_rayred, lt_raygreen
} dlighttype_t;
#define CSHIFT_CONTENTS 0
#define CSHIFT_DAMAGE 1
#define CSHIFT_BONUS 2
@ -78,11 +85,9 @@ typedef struct
float decay; // drop this each second
float minlight; // don't add when contributing less
int key;
#ifdef QUAKE2
qboolean dark; // subtracts light instead of adding
#endif
vec3_t color; //LordHavoc Lit. Support
vec3_t color; //LordHavoc Lit. Support
int type; // color
} dlight_t;
@ -204,9 +209,11 @@ typedef struct
// a lerp point for other data
double oldtime; // previous cl.time, time-oldtime is used
// to decay light values and smooth step ups
double ctime; // joe: copy of cl.time, to avoid incidents caused by rewind
float last_received_message; // (realtime) for net trouble icon
double laser_point_time;
//
// information that is static for the entire time connected to a server
@ -318,6 +325,32 @@ void CL_NextDemo (void);
extern int cl_numvisedicts;
extern entity_t *cl_visedicts[MAX_VISEDICTS];
// model indexes
typedef enum modelindex_s
{
mi_player,
mi_eyes,
mi_flame0,
mi_flame1,
mi_flame2,
mi_q3torso,
mi_q3head,
/*
mi_vw_light,
mi_vw_nail1,
mi_vw_nail2,
mi_vw_rock1,
mi_vw_rock2,
mi_vw_shot1,
mi_vw_shot2,
mi_vw_player,
*/
NUM_MODELINDEX
} modelindex_t;
extern modelindex_t cl_modelindex[NUM_MODELINDEX];
extern char *cl_modelnames[NUM_MODELINDEX];
//
// cl_input
//
@ -384,3 +417,5 @@ void V_SetContentsColor (int contents);
//
void CL_InitTEnts (void);
void CL_SignonReply (void);
qboolean TraceLineN (vec3_t start, vec3_t end, vec3_t impact, vec3_t normal);

View file

@ -37,6 +37,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
(x_ > valmax_) ? valmax_ : x_; \
})
#define bound(a, b, c) ((a) >= (c) ? (a) : (b) < (a) ? (a) : (b) > (c) ? (c) : (b))
#if !defined BYTE_DEFINED
typedef unsigned char byte;
#define BYTE_DEFINED 1

View file

@ -35,9 +35,16 @@ void Draw_ConsoleBackground (int lines);
void Draw_BeginDisc (void);
void Draw_EndDisc (void);
void Draw_TileClear (int x, int y, int w, int h);
void Draw_Fill (int x, int y, int w, int h, int r, int g, int b);
void Draw_Fill (int x, int y, int w, int h, int r, int g, int b, int a);
void Draw_FadeScreen (void);
void Draw_String (int x, int y, char *str);
void Draw_ColoredString(int x, int y, char *text, float r, float g, float b, float a, int scale);
qpic_t *Draw_PicFromWad (char *name);
qpic_t *Draw_CachePic (char *path);
extern float loading_cur_step;
extern int loading_step;
extern char loading_name[32];
extern float loading_num_step;
void Clear_LoadingFill (void);

156
source/gl_decal.c Normal file
View file

@ -0,0 +1,156 @@
#include "quakedef.h"
void R_SpawnDecal (vec3_t center, vec3_t normal, vec3_t tangent, int tex, int size, int isbsp)
{
// naievil -- fixme
/*
int a;
float width, height, depth, d, one_over_w, one_over_h;
vec3_t binormal, test = {0.5, 0.5, 0.5};
decal_t *dec;
if (!qmb_initialized)
return;
// allocate decal
if (!free_decals)
return;
dec = free_decals;
free_decals = dec->next;
dec->next = active_decals;
active_decals = dec;
VectorNormalize (test);
CrossProduct (normal, test, tangent);
VectorCopy (center, dec->origin);
VectorCopy (tangent, dec->tangent);
VectorCopy (normal, dec->normal);
VectorNormalize (tangent);
VectorNormalize (normal);
CrossProduct (normal, tangent, binormal);
VectorNormalize (binormal);
width = RandomMinMax (size * 0.5, size);
height = width;
depth = width * 0.5;
dec->radius = fmax(fmax(width, height), depth);
dec->starttime = cl.time;
dec->bspdecal = isbsp;
dec->die = (isbsp ? 0 : cl.time + r_decaltime.value);
dec->texture = tex;
// Calculate boundary planes
d = DotProduct (center, tangent);
VectorCopy (tangent, leftPlane.normal);
leftPlane.dist = -(width * 0.5 - d);
VectorNegate (tangent, tangent);
VectorCopy (tangent, rightPlane.normal);
VectorNegate (tangent, tangent);
rightPlane.dist = -(width * 0.5 + d);
d = DotProduct (center, binormal);
VectorCopy (binormal, bottomPlane.normal);
bottomPlane.dist = -(height * 0.5 - d);
VectorNegate (binormal, binormal);
VectorCopy (binormal, topPlane.normal);
VectorNegate (binormal, binormal);
topPlane.dist = -(height * 0.5 + d);
d = DotProduct (center, normal);
VectorCopy (normal, backPlane.normal);
backPlane.dist = -(depth - d);
VectorNegate (normal, normal);
VectorCopy (normal, frontPlane.normal);
VectorNegate (normal, normal);
frontPlane.dist = -(depth + d);
// Begin with empty mesh
dec->vertexCount = 0;
dec->triangleCount = 0;
// Clip decal to bsp
DecalWalkBsp_R (dec, cl.worldmodel->nodes);
// This happens when a decal is to far from any surface or the surface is to steeply sloped
if (dec->triangleCount == 0)
{ // deallocate decal
active_decals = dec->next;
dec->next = free_decals;
free_decals = dec;
return;
}
// Assign texture mapping coordinates
one_over_w = 1.0F / width;
one_over_h = 1.0F / height;
for (a = 0 ; a < dec->vertexCount ; a++)
{
float s, t;
vec3_t v;
VectorSubtract (dec->vertexArray[a], center, v);
s = DotProduct (v, tangent) * one_over_w + 0.5F;
t = DotProduct (v, binormal) * one_over_h + 0.5F;
dec->texcoordArray[a][0] = s;
dec->texcoordArray[a][1] = t;
}
*/
}
//Revamped by blubs
void R_SpawnDecalStatic (vec3_t org, int tex, int size)
{
/*
int i;
float frac, bestfrac;
vec3_t tangent, v, bestorg, normal, bestnormal, org2;
vec3_t tempVec;
if (!qmb_initialized)
return;
VectorClear (bestorg);
VectorClear (bestnormal);
VectorClear(tempVec);
bestfrac = 10;
for (i = 0 ; i < 26 ; i++)
{
//Reference: i = 0: check straight up, i = 1: check straight down
//1 < i < 10: Check sideways in increments of 45 degrees
//9 < i < 18: Check angled 45 degrees down in increments of 45 degrees
//17 < i : Check angled 45 degrees up in increments of 45 degrees
org2[0] = (((((i - 2) % 8) < 2) || (((i - 2) % 8) == 7)) ? 1 : 0 ) + ((((i - 2) % 8) > 2 && ((i - 2) % 8) < 6) ? -1 : 0 );
org2[1] = ((((i - 2) % 8) > 0 && ((i - 2) % 8) < 4) ? 1 : 0 ) + ((((i - 2) % 8) > 4 && ((i - 2) % 8) < 7) ? -1 : 0 );
org2[2] = ((i == 0) ? 1 : 0) + ((i == 1) ? -1 : 0) + (((i > 9) && (i < 18)) ? 1 : 0) + ((i > 17) ? -1 : 0);
VectorCopy(org,tempVec);
VectorMA(tempVec, -0.1,org2,tempVec);
VectorMA (org, 20, org2, org2);
TraceLineN (tempVec, org2, v, normal);
VectorSubtract(org2,tempVec,org2);//goal
VectorSubtract(v,tempVec,tempVec);//collision
if(VectorLength(org2) == 0)
return;
frac = VectorLength(tempVec) / VectorLength(org2);
if(frac < 1 && frac < bestfrac)
{
bestfrac = frac;
VectorCopy(v,bestorg);
VectorCopy(normal, bestnormal);
CrossProduct(normal,bestnormal,tangent);
}
}
if (bestfrac < 1)
R_SpawnDecal (bestorg, bestnormal, tangent, tex, size, 0);
*/
}

2
source/gl_decal.h Normal file
View file

@ -0,0 +1,2 @@
void R_SpawnDecal (vec3_t center, vec3_t normal, vec3_t tangent, int tex, int size, int isbsp);
void R_SpawnDecalStatic (vec3_t org, int tex, int size);

View file

@ -60,6 +60,13 @@ int texels;
int GL_LoadPicTexture (qpic_t *pic);
//Loading Fill by Crow_bar
float loading_cur_step;
char loading_name[32];
float loading_num_step;
int loading_step;
float loading_cur_step_bk;
typedef struct
{
int texnum;
@ -439,6 +446,8 @@ void Draw_Init (void)
// get the other pics we need
//
sniper_scope = Draw_CachePic ("gfx/hud/scope");
Clear_LoadingFill ();
}
@ -731,7 +740,7 @@ Draw_ConsoleBackground
*/
void Draw_ConsoleBackground (int lines)
{
Draw_Fill(0, 0, vid.width, lines, 0, 0, 0);
Draw_Fill(0, 0, vid.width, lines, 0, 0, 0, 255);
}
@ -759,6 +768,63 @@ void Draw_TileClear (int x, int y, int w, int h)
glEnd ();
}
/*
================
Draw_LoadingFill
By Crow_bar
================
*/
void Draw_LoadingFill(void)
{
if(!loading_num_step)
return;
int size = 8;
int max_step = 350;
int x = (vid.width / 2) - (max_step / 2);
int y = vid.height - (size/ 2) - 25;
int l;
char str[64];
char* text;
if(loading_cur_step > loading_num_step)
loading_cur_step = loading_num_step;
if (loading_cur_step < loading_cur_step_bk)
loading_cur_step = loading_cur_step_bk;
if (loading_cur_step == loading_num_step && loading_cur_step_bk != loading_num_step)
loading_cur_step = loading_cur_step_bk;
float loadsize = loading_cur_step * (max_step / loading_num_step);
Draw_FillByColor (x - 2, y - 2, max_step + 4, size + 4, 69, 69, 69, 255);
Draw_FillByColor (x, y, loadsize, size, 0, 0, 0, 200);
switch(loading_step) {
case 1: text = "Loading Models.."; break;
case 2: text = "Loading World.."; break;
case 3: text = "Running Test Frame.."; break;
case 4: text = "Loading Sounds.."; break;
default: text = "Initializing.."; break;
}
l = strlen (text);
Draw_String((vid.width - l*8)/2, y, text);
loading_cur_step_bk = loading_cur_step;
}
void Clear_LoadingFill (void)
{
//it is end loading
loading_cur_step = 0;
loading_cur_step_bk = 0;
loading_num_step = 0;
loading_step = -1;
memset(loading_name, 0, sizeof(loading_name));
}
/*
=============
Draw_FillByColor
@ -766,9 +832,9 @@ Draw_FillByColor
Fills a box of pixels with a single color
=============
*/
void Draw_FillByColor (int x, int y, int w, int h, int r, int g, int b)
void Draw_FillByColor (int x, int y, int w, int h, int r, int g, int b, int a)
{
Draw_Fill(x, y, w, h, r, g, b);
Draw_Fill(x, y, w, h, r, g, b, a);
}
/*
@ -778,10 +844,10 @@ Draw_Fill
Fills a box of pixels with a single color
=============
*/
void Draw_Fill (int x, int y, int w, int h, int r, int g, int b)
void Draw_Fill (int x, int y, int w, int h, int r, int g, int b, int a)
{
glDisable (GL_TEXTURE_2D);
glColor3f (r/255, g/255, b/255);
glColor4f (r/255, g/255, b/255, a/255);
glBegin (GL_QUADS);
@ -791,7 +857,7 @@ void Draw_Fill (int x, int y, int w, int h, int r, int g, int b)
glVertex2f (x, y+h);
glEnd ();
glColor3f (1,1,1);
glColor4f (1,1,1,1);
glEnable (GL_TEXTURE_2D);
}
//=============================================================================
@ -1112,19 +1178,19 @@ void Draw_Crosshair (void)
x_value = (vid.width - 3)/2 - crosshair_offset_step;
y_value = (vid.height - 1)/2;
Draw_FillByColor(x_value, y_value, 3, 1, 255, (int)col, (int)col);
Draw_FillByColor(x_value, y_value, 3, 1, 255, (int)col, (int)col, 255);
x_value = (vid.width - 3)/2 + crosshair_offset_step;
y_value = (vid.height - 1)/2;
Draw_FillByColor(x_value, y_value, 3, 1, 255, (int)col, (int)col);
Draw_FillByColor(x_value, y_value, 3, 1, 255, (int)col, (int)col, 255);
x_value = (vid.width - 1)/2;
y_value = (vid.height - 3)/2 - crosshair_offset_step;
Draw_FillByColor(x_value, y_value, 1, 3, 255, (int)col, (int)col);
Draw_FillByColor(x_value, y_value, 1, 3, 255, (int)col, (int)col, 255);
x_value = (vid.width - 1)/2;
y_value = (vid.height - 3)/2 + crosshair_offset_step;
Draw_FillByColor(x_value, y_value, 1, 3, 255, (int)col, (int)col);
Draw_FillByColor(x_value, y_value, 1, 3, 255, (int)col, (int)col, 255);
}
else if (crosshair.value && cl.stats[STAT_ZOOM] != 1 && cl.stats[STAT_ZOOM] != 2)
Draw_CharacterRGBA((vid.width - 8)/2, (vid.height - 8)/2, '.', 255, col, col, crosshair_opacity, 1);
@ -2237,8 +2303,10 @@ int loadtextureimage (char* filename, int matchwidth, int matchheight, qboolean
{
int texnum;
byte *data;
if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight)))
if (!(data = loadimagepixels (filename, complain, matchwidth, matchheight))) {
Con_DPrintf("Cannot load image %s\n", filename);
return 0;
}
texnum = GL_LoadTexture (filename, image_width, image_height, data, mipmap, qtrue, 4);
free(data);
return texnum;

View file

@ -363,6 +363,8 @@ void Mod_LoadTextures (lump_t *l)
loadmodel->numtextures = m->nummiptex;
loadmodel->textures = Hunk_AllocName (m->nummiptex * sizeof(*loadmodel->textures) , loadname);
loading_num_step = loading_num_step + m->nummiptex;
for (i=0 ; i<m->nummiptex ; i++)
{
m->dataofs[i] = LittleLong(m->dataofs[i]);
@ -418,6 +420,9 @@ void Mod_LoadTextures (lump_t *l)
texture_mode = GL_LINEAR;
}
}
strcpy(loading_name, mt->name);
loading_cur_step++;
SCR_UpdateScreen();
}
//
@ -1287,23 +1292,104 @@ void Mod_LoadBrushModel (model_t *mod, void *buffer)
// load into heap
loading_num_step = loading_num_step + 16;
loading_step = 2;
strcpy(loading_name, "Vertexes");
SCR_UpdateScreen ();
Mod_LoadVertexes (&header->lumps[LUMP_VERTEXES]);
loading_cur_step++;
strcpy(loading_name, "Edges");
SCR_UpdateScreen ();
Mod_LoadEdges (&header->lumps[LUMP_EDGES]);
loading_cur_step++;
strcpy(loading_name, "Surfedges");
SCR_UpdateScreen ();
Mod_LoadSurfedges (&header->lumps[LUMP_SURFEDGES]);
loading_cur_step++;
strcpy(loading_name, "Entities");
SCR_UpdateScreen ();
Mod_LoadEntities (&header->lumps[LUMP_ENTITIES]);
loading_cur_step++;
strcpy(loading_name, "Textures");
SCR_UpdateScreen ();
Mod_LoadTextures (&header->lumps[LUMP_TEXTURES]);
Mod_LoadLighting (&header->lumps[LUMP_LIGHTING]);
loading_cur_step++;
SCR_UpdateScreen ();
Mod_LoadPlanes (&header->lumps[LUMP_PLANES]);
loading_cur_step++;
strcpy(loading_name, "Texinfo");
SCR_UpdateScreen ();
Mod_LoadTexinfo (&header->lumps[LUMP_TEXINFO]);
loading_cur_step++;
strcpy(loading_name, "Faces");
SCR_UpdateScreen ();
Mod_LoadFaces (&header->lumps[LUMP_FACES]);
loading_cur_step++;
strcpy(loading_name, "Marksurfaces");
SCR_UpdateScreen ();
Mod_LoadMarksurfaces (&header->lumps[LUMP_MARKSURFACES]);
loading_cur_step++;
strcpy(loading_name, "Visibility");
SCR_UpdateScreen ();
Mod_LoadVisibility (&header->lumps[LUMP_VISIBILITY]);
loading_cur_step++;
strcpy(loading_name, "Leafs");
SCR_UpdateScreen ();
Mod_LoadLeafs (&header->lumps[LUMP_LEAFS]);
loading_cur_step++;
strcpy(loading_name, "Nodes");
SCR_UpdateScreen ();
Mod_LoadNodes (&header->lumps[LUMP_NODES]);
loading_cur_step++;
strcpy(loading_name, "Clipnodes");
SCR_UpdateScreen ();
Mod_LoadClipnodes (&header->lumps[LUMP_CLIPNODES]);
Mod_LoadEntities (&header->lumps[LUMP_ENTITIES]);
loading_cur_step++;
strcpy(loading_name, "Submodels");
SCR_UpdateScreen ();
Mod_LoadSubmodels (&header->lumps[LUMP_MODELS]);
loading_cur_step++;
strcpy(loading_name, "Hull");
SCR_UpdateScreen ();
Mod_MakeHull0 ();
loading_cur_step++;
loading_step = 2;
strcpy(loading_name, "Screen");
loading_cur_step++;
SCR_UpdateScreen ();
mod->numframes = 2; // regular and alternate animation
@ -1620,6 +1706,35 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
daliasframetype_t *pframetype;
daliasskintype_t *pskintype;
int start, end, total;
// some models are special
// NOTE: comparing not only with player.mdl, but with all models
// begin with "player" coz we need to support DME models as well!
if (!strncmp(mod->name, "progs/player", 12))
mod->modhint = MOD_PLAYER;
else if (!strcmp(mod->name, "progs/eyes.mdl"))
mod->modhint = MOD_EYES;
else if (!strcmp(mod->name, "progs/flame0.mdl") ||
!strcmp(mod->name, "progs/flame.mdl") ||
!strcmp(mod->name, "progs/flame2.mdl"))
mod->modhint = MOD_FLAME;
else if (!strcmp(mod->name, "progs/bolt.mdl") ||
!strcmp(mod->name, "models/misc/bolt2.mdl") ||
!strcmp(mod->name, "progs/bolt3.mdl"))
mod->modhint = MOD_THUNDERBOLT;
else if (!strcmp(mod->name, "progs/VModels/v_Colt.mdl") || //JUKKI Add nzp weapons here please plox
!strcmp(mod->name, "progs/VModels/v_kar.mdl") ||
!strcmp(mod->name, "progs/VModels/v_thomp.mdl"))
mod->modhint = MOD_WEAPON;
else if (!strcmp(mod->name, "progs/lavaball.mdl"))
mod->modhint = MOD_LAVABALL;
else if (!strcmp(mod->name, "progs/spike.mdl") ||
!strcmp(mod->name, "progs/s_spike.mdl"))
mod->modhint = MOD_SPIKE;
else if (!strcmp(mod->name, "progs/shambler.mdl"))
mod->modhint = MOD_SHAMBLER;
else
mod->modhint = MOD_NORMAL;
start = Hunk_LowMark ();

View file

@ -33,10 +33,21 @@ m*_t structures are in-memory
// entity effects
#define EF_BRIGHTFIELD 1
#define EF_BLUELIGHT 1
#define EF_MUZZLEFLASH 2
#define EF_BRIGHTLIGHT 4
#define EF_DIMLIGHT 8
#define EF_REDLIGHT 8
#define EF_ORANGELIGHT 16
#define EF_GREENLIGHT 32
#define EF_LIGHT 64
#define EF_NODRAW 128
#define EF_BRIGHTFIELD 256
#define EF_FULLBRIGHT 512
#define EF_DARKLIGHT 1024
#define EF_DARKFIELD 2048
#define EF_PURPLELIGHT 4096
#define EF_RAYRED 8196 // red trail for porter x2
#define EF_RAYGREEN 16384 // gree trail for ray gun
/*
@ -119,6 +130,7 @@ typedef struct glpoly_s
int numverts;
int flags; // for SURF_UNDERWATER
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
// vec3_t midpoint;//MHQuake // naievil -- fixme: this guy is causing some kind of rendering issue
} glpoly_t;
typedef struct msurface_s
@ -343,11 +355,31 @@ typedef enum {mod_brush, mod_sprite, mod_alias} modtype_t;
#define MOD_NOLERP 256
//johnfits
// some models are special
typedef enum
{
MOD_NORMAL,
MOD_PLAYER,
MOD_EYES,
MOD_FLAME,
MOD_THUNDERBOLT,
MOD_WEAPON,
MOD_LAVABALL,
MOD_SPIKE,
MOD_SHAMBLER,
MOD_SPR,
MOD_SPR32,
// MOD_GKEY,
// MOD_SKEY,
} modhint_t;
typedef struct model_s
{
char name[MAX_QPATH];
qboolean needload; // bmodels and sprites don't cache normally
modhint_t modhint;
modtype_t type;
int numframes;
synctype_t synctype;

3505
source/gl_qmb.c Normal file

File diff suppressed because it is too large Load diff

View file

@ -101,6 +101,28 @@ cvar_t gl_keeptjunctions = {"gl_keeptjunctions","0"};
cvar_t gl_reporttjunctions = {"gl_reporttjunctions","0"};
cvar_t gl_doubleeyes = {"gl_doubleeys", "1"};
//QMB
cvar_t r_explosiontype = {"r_explosiontype", "0",qtrue};
cvar_t r_laserpoint = {"r_laserpoint", "0",qtrue};
cvar_t r_part_explosions = {"r_part_explosions", "1",qtrue};
cvar_t r_part_trails = {"r_part_trails", "1",qtrue};
cvar_t r_part_sparks = {"r_part_sparks", "1",qtrue};
cvar_t r_part_spikes = {"r_part_spikes", "1",qtrue};
cvar_t r_part_gunshots = {"r_part_gunshots", "1",qtrue};
cvar_t r_part_blood = {"r_part_blood", "1",qtrue};
cvar_t r_part_telesplash = {"r_part_telesplash", "1",qtrue};
cvar_t r_part_blobs = {"r_part_blobs", "1",qtrue};
cvar_t r_part_lavasplash = {"r_part_lavasplash", "1",qtrue};
cvar_t r_part_flames = {"r_part_flames", "1",qtrue};
cvar_t r_part_lightning = {"r_part_lightning", "1",qtrue};
cvar_t r_part_flies = {"r_part_flies", "1",qtrue};
cvar_t r_part_muzzleflash = {"r_part_muzzleflash", "1",qtrue};
cvar_t r_flametype = {"r_flametype", "2",qtrue};
//Shpuld
cvar_t r_model_brightness = { "r_model_brightness", "1", qtrue}; // Toggle high brightness model lighting
cvar_t r_farclip = {"r_farclip", "4096"}; //far cliping for q3 models
//johnfitz -- struct for passing lerp information to drawing functions
typedef struct {
short pose1;
@ -617,9 +639,39 @@ void R_DrawAliasModel (entity_t *e)
VectorAdd (currententity->origin, clmodel->mins, mins);
VectorAdd (currententity->origin, clmodel->maxs, maxs);
// naievil -- fixme: on psp this is == 2 ?
if (R_CullBox (mins, maxs))
return;
// naievil -- fixme: need to translate
/*
if(ISADDITIVE(e))
{
float deg = e->renderamt;
float alpha_val = deg;
float alpha_val2 = 1 - deg;
if(deg <= 0.7)
sceGuDepthMask(GU_TRUE);
sceGuEnable (GU_BLEND);
sceGuBlendFunc(GU_ADD, GU_FIX, GU_FIX,
GU_COLOR(alpha_val,alpha_val,alpha_val,alpha_val),
GU_COLOR(alpha_val2,alpha_val2,alpha_val2,alpha_val2));
}
else if(ISGLOW(e))
{
sceGuDepthMask(GU_TRUE);
sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_FIX, 0, 0xFFFFFFFF);
sceGuTexFunc(GU_TFX_MODULATE , GU_TCC_RGBA);
}
else if (ISSOLID(e))
{
sceGuEnable(GU_ALPHA_TEST);
float c = (e->renderamt) * 255.0f;
sceGuAlphaFunc(GU_GREATER, 0x88, c);
}
*/
VectorCopy (currententity->origin, r_entorigin);
VectorSubtract (r_origin, r_entorigin, modelorg);

View file

@ -191,6 +191,8 @@ void R_Init (void)
Cvar_RegisterVariable (&r_lerpmodels);
Cvar_RegisterVariable (&r_lerpmove);
Cvar_RegisterVariable (&r_farclip);
Cvar_RegisterVariable (&gl_finish);
Cvar_RegisterVariable (&gl_clear);
Cvar_RegisterVariable (&gl_texsort);
@ -211,6 +213,23 @@ void R_Init (void)
Cvar_RegisterVariable (&gl_doubleeyes);
Cvar_RegisterVariable (&r_explosiontype);
Cvar_RegisterVariable (&r_laserpoint);
Cvar_RegisterVariable (&r_part_explosions);
Cvar_RegisterVariable (&r_part_trails);
Cvar_RegisterVariable (&r_part_sparks);
Cvar_RegisterVariable (&r_part_gunshots);
Cvar_RegisterVariable (&r_part_blood);
Cvar_RegisterVariable (&r_part_telesplash);
Cvar_RegisterVariable (&r_part_blobs);
Cvar_RegisterVariable (&r_part_lavasplash);
Cvar_RegisterVariable (&r_part_flames);
Cvar_RegisterVariable (&r_part_lightning);
Cvar_RegisterVariable (&r_part_flies);
Cvar_RegisterVariable (&r_part_muzzleflash);
Cvar_RegisterVariable (&r_flametype);
//Cvar_RegisterVariable (&r_model_brightness);
R_InitParticles ();
R_InitParticleTexture ();
Fog_Init ();

View file

@ -132,12 +132,30 @@ void R_AddDynamicLights (msurface_t *surf)
else
dist = td + (sd>>1);
if (dist < minlight){
// LordHavoc: .lit support begin
brightness = rad - dist;
bl[0] += (int) (brightness * cred);
bl[1] += (int) (brightness * cgreen);
bl[2] += (int) (brightness * cblue);
// LordHavoc: .lit support end
if (!cl_dlights[lnum].dark)
{
bl[0] += (int) (brightness * cred);
bl[1] += (int) (brightness * cgreen);
bl[2] += (int) (brightness * cblue);
}
else
{
if(bl[0] > (int) (brightness * cred))
bl[0] -= (int) (brightness * cred);
else
bl[0] = 0;
if(bl[1] > (int) (brightness * cgreen))
bl[1] -= (int) (brightness * cgreen);
else
bl[1] = 0;
if(bl[2] > (int) (brightness * cblue))
bl[2] -= (int) (brightness * cblue);
else
bl[2] = 0;
}
}
bl += 3;
}
@ -1178,6 +1196,54 @@ void R_DrawBrushModel (entity_t *e)
}
glPushMatrix ();
// naievil -- fixme
/*
//Crow_bar half_life render.
if (ISADDITIVE(e))
{
//Con_DPrintf("ISADDITIVE:brush\n");
float deg = e->renderamt;
float alpha1 = deg;
float alpha2 = 1 - deg;
if(deg <= 0.7)
sceGuDepthMask(GU_TRUE);
sceGuEnable (GU_BLEND);
sceGuBlendFunc(GU_ADD, GU_FIX, GU_FIX,
GU_COLOR(alpha1,alpha1,alpha1,alpha1),
GU_COLOR(alpha2,alpha2,alpha2,alpha2));
dlight = qfalse;
}
else if (ISSOLID(e))
{
sceGuEnable(GU_ALPHA_TEST);
int c = (int)(e->renderamt * 255.0f);
sceGuAlphaFunc(GU_GREATER, c, 0xff);
dlight = qfalse;
}
else if (ISGLOW(e))
{
sceGuTexFunc(GU_TFX_MODULATE , GU_TCC_RGBA);
sceGuDepthMask(GU_TRUE);
sceGuBlendFunc(GU_ADD, GU_SRC_ALPHA, GU_FIX, 0, 0xFFFFFFFF);
R_GlowSetupBegin(e);
}
else if (ISTEXTURE(e))
{
sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
sceGuColor(GU_RGBA(255, 255, 255, (int)(e->renderamt * 255.0f)));
dlight = qfalse;
}
else if (ISCOLOR(e))
{
sceGuTexFunc(GU_TFX_MODULATE, GU_TCC_RGBA);
sceGuColor(GU_RGBA((int)(e->rendercolor[0] * 255.0f),
(int)(e->rendercolor[1] * 255.0f),
(int)(e->rendercolor[2] * 255.0f), 255));
}
*/
e->angles[0] = -e->angles[0]; // stupid quake bug
R_RotateForEntity (e);
e->angles[0] = -e->angles[0]; // stupid quake bug

View file

@ -1506,13 +1506,11 @@ void SCR_UpdateScreen (void)
SCR_DrawConsole ();
M_Draw ();
// naievil -- fixme
if(scr_loadscreen.value) {
SCR_DrawLoadScreen();
}
// naievil -- fixme
//Draw_LoadingFill();
Draw_LoadingFill();
V_UpdatePalette ();

View file

@ -74,6 +74,39 @@ extern PROC glTexturePointerEXT;
extern PROC glVertexPointerEXT;
#endif
/*
---------------------------------
half-life Render Modes. Crow_bar
---------------------------------
*/
#define TEX_COLOR 1
#define TEX_TEXTURE 2
#define TEX_GLOW 3
#define TEX_SOLID 4
#define TEX_ADDITIVE 5
#define TEX_LMPOINT 6 //for light point
#define ISCOLOR(ent) ((ent)->rendermode == TEX_COLOR && ((ent)->rendercolor[0] <= 1|| \
(ent)->rendercolor[1] <= 1|| \
(ent)->rendercolor[2] <= 1))
#define ISTEXTURE(ent) ((ent)->rendermode == TEX_TEXTURE && (ent)->renderamt > 0 && (ent)->renderamt <= 1)
#define ISGLOW(ent) ((ent)->rendermode == TEX_GLOW && (ent)->renderamt > 0 && (ent)->renderamt <= 1)
#define ISSOLID(ent) ((ent)->rendermode == TEX_SOLID && (ent)->renderamt > 0 && (ent)->renderamt <= 1)
#define ISADDITIVE(ent) ((ent)->rendermode == TEX_ADDITIVE && (ent)->renderamt > 0 && (ent)->renderamt <= 1)
#define ISLMPOINT(ent) ((ent)->rendermode == TEX_LMPOINT && ((ent)->rendercolor[0] <= 1|| \
(ent)->rendercolor[1] <= 1|| \
(ent)->rendercolor[2] <= 1))
/*
---------------------------------
//half-life Render Modes
---------------------------------
*/
// r_local.h -- private refresh defs
#define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0)
@ -108,6 +141,10 @@ typedef struct surfcache_s
byte data[4]; // width*height elements
} surfcache_t;
typedef enum
{
pm_classic, pm_qmb, pm_quake3, pm_mixed
} part_mode_t;
typedef struct
{
@ -127,18 +164,25 @@ typedef enum {
pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2
} ptype_t;
// !!! if this is changed, it must be changed in d_ifacea.h too !!!
typedef byte col_t[4];
typedef struct particle_s
{
// driver-usable fields
vec3_t org;
float color;
// drivers never touch the following fields
struct particle_s *next;
vec3_t vel;
float ramp;
float die;
ptype_t type;
struct particle_s *next;
vec3_t org, endorg;
col_t color;
float growth;
vec3_t vel;
float ramp;
ptype_t type;
float rotangle;
float rotspeed;
float size;
float start;
float die;
byte hit;
byte texindex;
byte bounces;
} particle_t;
@ -194,6 +238,32 @@ extern cvar_t r_dynamic;
extern cvar_t r_novis;
extern cvar_t r_lerpmodels;
extern cvar_t r_lerpmove;
extern cvar_t r_farclip;
extern cvar_t r_laserpoint;
extern cvar_t r_particle_count;
extern cvar_t r_part_explosions;
extern cvar_t r_part_trails;
extern cvar_t r_part_sparks;
extern cvar_t r_part_spikes;
extern cvar_t r_part_gunshots;
extern cvar_t r_part_blood;
extern cvar_t r_part_telesplash;
extern cvar_t r_part_blobs;
extern cvar_t r_part_lavasplash;
extern cvar_t r_part_flames;
extern cvar_t r_part_lightning;
extern cvar_t r_part_flies;
extern cvar_t r_bounceparticles;
extern cvar_t r_explosiontype;
extern cvar_t r_part_muzzleflash;
extern cvar_t r_flametype;
extern cvar_t r_bounceparticles;
extern cvar_t r_decal_blood;
extern cvar_t r_decal_bullets;
extern cvar_t r_decal_sparks;
extern cvar_t r_decal_explosions;
extern cvar_t r_coronas;
extern cvar_t gl_clear;
extern cvar_t gl_cull;
@ -260,4 +330,36 @@ void Fog_NewMap (void);
void Fog_Init (void);
void Fog_SetupState (void);
qboolean VID_Is8bit(void);
qboolean VID_Is8bit(void);
// naievil -- fixme: none of these work
//-----------------------------------------------------
void QMB_InitParticles (void);
void QMB_ClearParticles (void);
void QMB_DrawParticles (void);
void QMB_Q3TorchFlame (vec3_t org, float size);
void QMB_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
void QMB_RocketTrail (vec3_t start, vec3_t end, trail_type_t type);
void QMB_RayFlash (vec3_t org, float weapon);
void QMB_BlobExplosion (vec3_t org);
void QMB_ParticleExplosion (vec3_t org);
void QMB_LavaSplash (vec3_t org);
void QMB_TeleportSplash (vec3_t org);
void QMB_InfernoFlame (vec3_t org);
void QMB_StaticBubble (entity_t *ent);
void QMB_ColorMappedExplosion (vec3_t org, int colorStart, int colorLength);
void QMB_TorchFlame (vec3_t org);
void QMB_FlameGt (vec3_t org, float size, float time);
void QMB_BigTorchFlame (vec3_t org);
void QMB_ShamblerCharge (vec3_t org);
void QMB_LightningBeam (vec3_t start, vec3_t end);
//void QMB_GenSparks (vec3_t org, byte col[3], float count, float size, float life);
void QMB_EntityParticles (entity_t *ent);
void QMB_MuzzleFlash (vec3_t org);
void QMB_MuzzleFlashLG (vec3_t org);
void QMB_Q3Gunshot (vec3_t org, int skinnum, float alpha);
void QMB_Q3Teleport (vec3_t org, float alpha);
void QMB_Q3TorchFlame (vec3_t org, float size);
extern qboolean qmb_initialized;

View file

@ -68,11 +68,7 @@ cvar_t teamplay = {"teamplay","0",false,true};
cvar_t samelevel = {"samelevel","0"};
cvar_t noexit = {"noexit","0",false,true};
#ifdef QUAKE2
cvar_t developer = {"developer","1"}; // should be 0 for release!
#else
cvar_t developer = {"developer","0"};
#endif
cvar_t developer = {"developer","0"}; // should be 0 for release!
cvar_t skill = {"skill","1"}; // 0 - 3
cvar_t deathmatch = {"deathmatch","0"}; // 0, 1, or 2
@ -119,6 +115,8 @@ void Host_EndGame (char *message, ...)
else
CL_Disconnect ();
Clear_LoadingFill ();
longjmp (host_abortserver, 1);
}
@ -155,6 +153,8 @@ void Host_Error (char *error, ...)
CL_Disconnect ();
cls.demonum = -1;
Clear_LoadingFill ();
inerror = false;
longjmp (host_abortserver, 1);
@ -981,6 +981,8 @@ void Host_Shutdown(void)
// keep Con_Printf from trying to update the screen
scr_disabled_for_loading = true;
Clear_LoadingFill ();
Host_WriteConfiguration ();
CDAudio_Shutdown ();

View file

@ -27,6 +27,30 @@ void Sys_Error (char *error, ...);
vec3_t vec3_origin = {0,0,0};
int nanmask = 255<<23;
int _mathlib_temp_int1, _mathlib_temp_int2, _mathlib_temp_int3;
float _mathlib_temp_float1, _mathlib_temp_float2, _mathlib_temp_float3;
vec3_t _mathlib_temp_vec1, _mathlib_temp_vec2, _mathlib_temp_vec3;
float rsqrt( float number )
{
int i;
float x, y;
if( number == 0.0f )
return 0.0f;
x = number * 0.5f;
i = *(int *)&number; // evil floating point bit level hacking
i = 0x5f3759df - (i >> 1); // what the fuck?
y = *(float *)&i;
y = y * (1.5f - (x * y * y)); // first iteration
return y;
}
/*-----------------------------------------------------------------*/
void ProjectPointOnPlane( vec3_t dst, const vec3_t p, const vec3_t normal )

View file

@ -45,9 +45,13 @@ extern int nanmask;
#define VectorSubtract(a,b,c) {c[0]=a[0]-b[0];c[1]=a[1]-b[1];c[2]=a[2]-b[2];}
#define VectorAdd(a,b,c) {c[0]=a[0]+b[0];c[1]=a[1]+b[1];c[2]=a[2]+b[2];}
#define VectorCopy(a,b) {b[0]=a[0];b[1]=a[1];b[2]=a[2];}
#define VectorClear(a) ((a)[0] = (a)[1] = (a)[2] = 0)
#define VectorSet(v, x, y, z) ((v)[0] = (x), (v)[1] = (y), (v)[2] = (z))
#define VectorNegate(a, b) ((b)[0] = -(a)[0], (b)[1] = -(a)[1], (b)[2] = -(a)[2])
#define DEG2RAD( a ) ( a * M_PI ) / 180.0F
#define VectorNormalizeFast( v ){float ilength = (float)rsqrt(DotProduct(v,v));v[0] *= ilength;v[1] *= ilength;v[2] *= ilength; }
void VectorMA (vec3_t veca, float scale, vec3_t vecb, vec3_t vecc);
vec_t _DotProduct (vec3_t v1, vec3_t v2);
@ -79,7 +83,22 @@ void AngleVectors (vec3_t angles, vec3_t forward, vec3_t right, vec3_t up);
int BoxOnPlaneSide (vec3_t emins, vec3_t emaxs, struct mplane_s *plane);
float anglemod(float a);
extern int _mathlib_temp_int1, _mathlib_temp_int2, _mathlib_temp_int3;
extern float _mathlib_temp_float1, _mathlib_temp_float2, _mathlib_temp_float3;
extern vec3_t _mathlib_temp_vec1, _mathlib_temp_vec2, _mathlib_temp_vec3;
#define VectorL2Compare(v, w, m) \
(_mathlib_temp_float1 = (m) * (m), \
_mathlib_temp_vec1[0] = (v)[0] - (w)[0], _mathlib_temp_vec1[1] = (v)[1] - (w)[1], _mathlib_temp_vec1[2] = (v)[2] - (w)[2],\
_mathlib_temp_vec1[0] * _mathlib_temp_vec1[0] + \
_mathlib_temp_vec1[1] * _mathlib_temp_vec1[1] + \
_mathlib_temp_vec1[2] * _mathlib_temp_vec1[2] < _mathlib_temp_float1)
#define VectorSupCompare(v, w, m) \
(_mathlib_temp_float1 = m, \
(v)[0] - (w)[0] > -_mathlib_temp_float1 && (v)[0] - (w)[0] < _mathlib_temp_float1 && \
(v)[1] - (w)[1] > -_mathlib_temp_float1 && (v)[1] - (w)[1] < _mathlib_temp_float1 && \
(v)[2] - (w)[2] > -_mathlib_temp_float1 && (v)[2] - (w)[2] < _mathlib_temp_float1)
#define BOX_ON_PLANE_SIDE(emins, emaxs, p) \
(((p)->type < 3)? \
@ -96,3 +115,6 @@ float anglemod(float a);
) \
: \
BoxOnPlaneSide( (emins), (emaxs), (p)))
float rsqrt( float number );

View file

@ -227,8 +227,8 @@ void M_Main_Draw (void)
Draw_String(vid.width/4, vid.height/4 + (16 * i), MAIN_MENU_ITEMS[i]);
}
Draw_Fill(vid.width/4, vid.height/4 - 3 + (16 * m_main_cursor), strlen(MAIN_MENU_ITEMS[m_main_cursor])*8, 1, 255, 255, 255);
Draw_Fill(vid.width/4, vid.height/4 + 2 + 8 + (16 * m_main_cursor), strlen(MAIN_MENU_ITEMS[m_main_cursor])*8, 1, 255, 255, 255);
Draw_Fill(vid.width/4, vid.height/4 - 3 + (16 * m_main_cursor), strlen(MAIN_MENU_ITEMS[m_main_cursor])*8, 1, 255, 255, 255, 255);
Draw_Fill(vid.width/4, vid.height/4 + 2 + 8 + (16 * m_main_cursor), strlen(MAIN_MENU_ITEMS[m_main_cursor])*8, 1, 255, 255, 255, 255);
}
@ -305,8 +305,8 @@ void M_SinglePlayer_Draw (void)
Draw_String(vid.width/4, vid.height/4 + (16 * i), SINGLE_MENU_ITEMS[i]);
}
Draw_Fill(vid.width/4, vid.height/4 - 3 + (16 * m_singleplayer_cursor), strlen(SINGLE_MENU_ITEMS[m_singleplayer_cursor])*8, 1, 255, 255, 255);
Draw_Fill(vid.width/4, vid.height/4 + 2 + 8 + (16 * m_singleplayer_cursor), strlen(SINGLE_MENU_ITEMS[m_singleplayer_cursor])*8, 1, 255, 255, 255);
Draw_Fill(vid.width/4, vid.height/4 - 3 + (16 * m_singleplayer_cursor), strlen(SINGLE_MENU_ITEMS[m_singleplayer_cursor])*8, 1, 255, 255, 255, 255);
Draw_Fill(vid.width/4, vid.height/4 + 2 + 8 + (16 * m_singleplayer_cursor), strlen(SINGLE_MENU_ITEMS[m_singleplayer_cursor])*8, 1, 255, 255, 255, 255);
}

View file

@ -60,6 +60,36 @@ typedef struct {
static gefv_cache gefvCache[GEFV_CACHESIZE] = {{NULL, ""}, {NULL, ""}};
// evaluation shortcuts
int eval_gravity;
int eval_idealpitch, eval_pitch_speed;
// Half_life modes. Crow_bar
int eval_renderamt, eval_rendermode, eval_rendercolor;
ddef_t *ED_FindField (char *name);
int FindFieldOffset (char *field)
{
ddef_t *d;
if (!(d = ED_FindField(field)))
return 0;
return d->ofs*4;
}
void FindEdictFieldOffsets (void)
{
eval_gravity = FindFieldOffset ("gravity");
eval_idealpitch = FindFieldOffset ("idealpitch");
eval_pitch_speed = FindFieldOffset ("pitch_speed");
eval_renderamt = FindFieldOffset ("renderamt");
eval_rendermode = FindFieldOffset ("rendermode");
eval_rendercolor = FindFieldOffset ("rendercolor");
}
/*
=================
ED_ClearEdict
@ -1061,6 +1091,7 @@ void PR_LoadProgs (void)
for (i=0 ; i<progs->numglobals ; i++)
((int *)pr_globals)[i] = LittleLong (((int *)pr_globals)[i]);
FindEdictFieldOffsets ();
EndFrame = 0;
if ((f = ED_FindFunction ("EndFrame")) != NULL)

View file

@ -47,6 +47,10 @@ typedef struct edict_s
// other fields from progs come immediately after
} edict_t;
#define EDICT_FROM_AREA(l) STRUCT_FROM_LINK(l,edict_t,area)
extern int eval_gravity;
extern int eval_idealpitch, eval_pitch_speed;
// Half_life modes. Crow_bar
extern int eval_renderamt, eval_rendermode, eval_rendercolor;
//============================================================================
@ -131,4 +135,4 @@ void ED_PrintEdicts (void);
void ED_PrintNum (int ent);
eval_t *GetEdictFieldValue(edict_t *ed, char *field);
#define GETEDICTFIELDVALUE(ed, fieldoffset) (fieldoffset ? (eval_t *)((byte *)&ed->v + fieldoffset) : NULL)

View file

@ -32,14 +32,24 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define U_SIGNAL (1<<7) // just differentiates from other updates
// svc_update can pass all of the fast update bits, plus more
#define U_ANGLE1 (1<<8)
#define U_ANGLE3 (1<<9)
#define U_MODEL (1<<10)
#define U_COLORMAP (1<<11)
#define U_SKIN (1<<12)
#define U_EFFECTS (1<<13)
#define U_LONGENTITY (1<<14)
#define U_EXTEND1 (1<<8)
#define U_ANGLE1 (1<<9)
#define U_ANGLE3 (1<<10)
#define U_MODEL (1<<11)
#define U_COLORMAP (1<<12)
#define U_SKIN (1<<13)
#define U_EFFECTS (1<<14)
// Tomaz - QC Alpha Scale Glow Control Begin
#define U_LONGENTITY (1<<15)//blubs here, U_EXTEND1 used to be here, but it needs to be in the byte above, so moved it to the 1<<8 position, and moved the rest down
#define U_RENDERMODE (1<<16)
#define U_RENDERAMT (1<<17)
#define U_RENDERCOLOR1 (1<<18)
#define U_RENDERCOLOR2 (1<<19)
#define U_RENDERCOLOR3 (1<<20)
#define U_EXTEND2 (1<<21) // another byte to follow
#define U_FRAMETIME (1<<22) // another byte to follow
// Tomaz - QC Alpha Scale Glow Control End
#define SU_VIEWHEIGHT (1<<0)
#define SU_IDEALPITCH (1<<1)

View file

@ -298,6 +298,11 @@ typedef struct
int colormap;
int skin;
int effects;
// dr_mabuse1981: HalfLife rendermodes fixed START
unsigned short renderamt;
unsigned short rendermode;
unsigned short rendercolor;
// dr_mabuse1981: HalfLife rendermodes fixed END
} entity_state_t;
@ -337,6 +342,8 @@ typedef struct
#include "cl_hud.h"
#include "gl_decal.h"
//=============================================================================
// the host system specifies the base of the directory tree, the
@ -400,6 +407,11 @@ extern qboolean isDedicated;
extern int minimum_memory;
#define ISUNDERWATER(x) ((x) == CONTENTS_WATER || (x) == CONTENTS_SLIME || (x) == CONTENTS_LAVA)
int SV_HullPointContents (hull_t *hull, int num, vec3_t p);
#define TruePointContents(p) SV_HullPointContents(&cl.worldmodel->hulls[0], 0, p)
//
// chase
//
@ -441,4 +453,4 @@ extern func_t EndFrame;
#define VERTEXARRAYSIZE 18360
extern float gVertexBuffer[VERTEXARRAYSIZE];
extern float gColorBuffer[VERTEXARRAYSIZE];
extern float gTexCoordBuffer[VERTEXARRAYSIZE];
extern float gTexCoordBuffer[VERTEXARRAYSIZE];

View file

@ -62,9 +62,10 @@ void R_InitParticles (void)
particles = (particle_t *)
Hunk_AllocName (r_numparticles * sizeof(particle_t), "particles");
QMB_InitParticles();
}
#ifdef QUAKE2
void R_DarkFieldParticles (entity_t *ent)
{
int i, j, k;
@ -88,7 +89,7 @@ void R_DarkFieldParticles (entity_t *ent)
active_particles = p;
p->die = cl.time + 0.2 + (rand()&7) * 0.02;
p->color = 150 + rand()%6;
p->color[0] = p->color[1] = p->color[2] = 150 + rand()%6;
p->type = pt_slowgrav;
dir[0] = j*8;
@ -104,7 +105,6 @@ void R_DarkFieldParticles (entity_t *ent)
VectorScale (dir, vel, p->vel);
}
}
#endif
/*
@ -134,11 +134,11 @@ void R_EntityParticles (entity_t *ent)
dist = 64;
count = 50;
if (!avelocities[0][0])
{
for (i=0 ; i<NUMVERTEXNORMALS*3 ; i++)
avelocities[0][i] = (rand()&255) * 0.01;
}
if (!avelocities[0][0])
{
for (i=0 ; i<NUMVERTEXNORMALS*3 ; i++)
avelocities[0][i] = (rand()&255) * 0.01;
}
for (i=0 ; i<NUMVERTEXNORMALS ; i++)
@ -165,7 +165,7 @@ avelocities[0][i] = (rand()&255) * 0.01;
active_particles = p;
p->die = cl.time + 0.01;
p->color = 0x6f;
p->color[0] = p->color[1] = p->color[2] = 0x6f;
p->type = pt_explode;
p->org[0] = ent->origin[0] + r_avertexnormals[i][0]*dist + forward[0]*beamlength;
@ -180,7 +180,7 @@ avelocities[0][i] = (rand()&255) * 0.01;
R_ClearParticles
===============
*/
void R_ClearParticles (void)
void R_Clear_Classic_Particles (void)
{
int i;
@ -192,6 +192,12 @@ void R_ClearParticles (void)
particles[r_numparticles-1].next = NULL;
}
void R_ClearParticles (void)
{
QMB_ClearParticles ();
R_Clear_Classic_Particles();
}
void R_ReadPointFile_f (void)
{
@ -231,7 +237,7 @@ void R_ReadPointFile_f (void)
active_particles = p;
p->die = 99999;
p->color = (-c)&15;
p->color[0] = p->color[1] = p->color[2] = (-c)&15;
p->type = pt_static;
VectorCopy (vec3_origin, p->vel);
VectorCopy (org, p->org);
@ -289,7 +295,7 @@ void R_ParticleExplosion (vec3_t org)
active_particles = p;
p->die = cl.time + 5;
p->color = ramp1[0];
p->color[0] = p->color[1] = p->color[2] = ramp1[0];
p->ramp = rand()&3;
if (i & 1)
{
@ -334,7 +340,7 @@ void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
active_particles = p;
p->die = cl.time + 0.3;
p->color = colorStart + (colorMod % colorLength);
p->color[0] = p->color[1] = p->color[2] = colorStart + (colorMod % colorLength);
colorMod++;
p->type = pt_blob;
@ -371,7 +377,7 @@ void R_BlobExplosion (vec3_t org)
if (i & 1)
{
p->type = pt_blob;
p->color = 66 + rand()%6;
p->color[0] = p->color[1] = p->color[2] = 66 + rand()%6;
for (j=0 ; j<3 ; j++)
{
p->org[j] = org[j] + ((rand()%32)-16);
@ -381,7 +387,7 @@ void R_BlobExplosion (vec3_t org)
else
{
p->type = pt_blob2;
p->color = 150 + rand()%6;
p->color[0] = p->color[1] = p->color[2] = 150 + rand()%6;
for (j=0 ; j<3 ; j++)
{
p->org[j] = org[j] + ((rand()%32)-16);
@ -414,7 +420,7 @@ void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
if (count == 1024)
{ // rocket explosion
p->die = cl.time + 5;
p->color = ramp1[0];
p->color[0] = p->color[1] = p->color[2] = ramp1[0];
p->ramp = rand()&3;
if (i & 1)
{
@ -438,7 +444,7 @@ void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
else
{
p->die = cl.time + 0.1*(rand()%5);
p->color = (color&~7) + (rand()&7);
p->color[0] = p->color[1] = p->color[2] = (color&~7) + (rand()&7);
p->type = pt_slowgrav;
for (j=0 ; j<3 ; j++)
{
@ -475,7 +481,7 @@ void R_LavaSplash (vec3_t org)
active_particles = p;
p->die = cl.time + 2 + (rand()&31) * 0.02;
p->color = 224 + (rand()&7);
p->color[0] = p->color[1] = p->color[2] = 224 + (rand()&7);
p->type = pt_slowgrav;
dir[0] = j*8 + (rand()&7);
@ -517,7 +523,7 @@ void R_TeleportSplash (vec3_t org)
active_particles = p;
p->die = cl.time + 0.2 + (rand()&7) * 0.02;
p->color = 7 + (rand()&7);
p->color[0] = p->color[1] = p->color[2] = 7 + (rand()&7);
p->type = pt_slowgrav;
dir[0] = j*8;
@ -571,7 +577,7 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type)
{
case 0: // rocket trail
p->ramp = (rand()&3);
p->color = ramp3[(int)p->ramp];
p->color[0] = p->color[1] = p->color[2] = ramp3[(int)p->ramp];
p->type = pt_fire;
for (j=0 ; j<3 ; j++)
p->org[j] = start[j] + ((rand()%6)-3);
@ -579,7 +585,7 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type)
case 1: // smoke smoke
p->ramp = (rand()&3) + 2;
p->color = ramp3[(int)p->ramp];
p->color[0] = p->color[1] = p->color[2] = ramp3[(int)p->ramp];
p->type = pt_fire;
for (j=0 ; j<3 ; j++)
p->org[j] = start[j] + ((rand()%6)-3);
@ -587,7 +593,7 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type)
case 2: // blood
p->type = pt_grav;
p->color = 67 + (rand()&3);
p->color[0] = p->color[1] = p->color[2] = 67 + (rand()&3);
for (j=0 ; j<3 ; j++)
p->org[j] = start[j] + ((rand()%6)-3);
break;
@ -597,9 +603,9 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type)
p->die = cl.time + 0.5;
p->type = pt_static;
if (type == 3)
p->color = 52 + ((tracercount&4)<<1);
p->color[0] = p->color[1] = p->color[2] = 52 + ((tracercount&4)<<1);
else
p->color = 230 + ((tracercount&4)<<1);
p->color[0] = p->color[1] = p->color[2] = 230 + ((tracercount&4)<<1);
tracercount++;
@ -618,14 +624,14 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type)
case 4: // slight blood
p->type = pt_grav;
p->color = 67 + (rand()&3);
p->color[0] = p->color[1] = p->color[2] = 67 + (rand()&3);
for (j=0 ; j<3 ; j++)
p->org[j] = start[j] + ((rand()%6)-3);
len -= 3;
break;
case 6: // voor trail
p->color = 9*16 + 8 + (rand()&3);
p->color[0] = p->color[1] = p->color[2] = 9*16 + 8 + (rand()&3);
p->type = pt_static;
p->die = cl.time + 0.3;
for (j=0 ; j<3 ; j++)
@ -641,12 +647,12 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type)
/*
===============
R_DrawParticles
R_Classic_DrawParticles
===============
*/
extern cvar_t sv_gravity;
void R_DrawParticles (void)
void R_Classic_DrawParticles (void)
{
particle_t *p, *kill;
float grav;
@ -717,7 +723,8 @@ void R_DrawParticles (void)
scale = 1;
else
scale = 1 + scale * 0.004;
glColor3ubv ((byte *)&d_8to24table[(int)p->color]);
glColor4ubv (p->color);
glTexCoord2f (0,0);
glVertex3fv (p->org);
glTexCoord2f (1,0);
@ -740,7 +747,7 @@ void R_DrawParticles (void)
if (p->ramp >= 6)
p->die = -1;
else
p->color = ramp3[(int)p->ramp];
p->color[0] = p->color[1] = p->color[2] = ramp3[(int)p->ramp];
p->vel[2] += grav;
break;
@ -749,7 +756,7 @@ void R_DrawParticles (void)
if (p->ramp >=8)
p->die = -1;
else
p->color = ramp1[(int)p->ramp];
p->color[0] = p->color[1] = p->color[2] = ramp1[(int)p->ramp];
for (i=0 ; i<3 ; i++)
p->vel[i] += p->vel[i]*dvel;
p->vel[2] -= grav;
@ -760,7 +767,7 @@ void R_DrawParticles (void)
if (p->ramp >=8)
p->die = -1;
else
p->color = ramp2[(int)p->ramp];
p->color[0] = p->color[1] = p->color[2] = ramp2[(int)p->ramp];
for (i=0 ; i<3 ; i++)
p->vel[i] -= p->vel[i]*frametime;
p->vel[2] -= grav;
@ -798,3 +805,14 @@ void R_DrawParticles (void)
#endif
}
/*
===============
R_DrawParticles
===============
*/
void R_DrawParticles (void)
{
R_Classic_DrawParticles ();
QMB_DrawParticles ();
}

View file

@ -56,6 +56,13 @@ typedef struct entity_s
vec3_t origin;
vec3_t msg_angles[2]; // last two updates (0 is newest)
vec3_t angles;
// Tomaz - QC Alpha Scale Glow Begin
float renderamt;
float rendermode;
float rendercolor[3];
//Crow_bar
struct model_s *model; // NULL = no model
struct efrag_s *efrag; // linked list of efrags
int frame;
@ -88,6 +95,7 @@ typedef struct entity_s
vec3_t previousangles; //johnfitz -- transform lerping
vec3_t currentangles; //johnfitz -- transform lerping
int modelindex;
int z_head;
int z_larm;
@ -152,6 +160,14 @@ void R_RemoveEfrags (entity_t *ent);
void R_NewMap (void);
// particles
typedef enum trail_type_s
{
ROCKET_TRAIL, GRENADE_TRAIL, BLOOD_TRAIL, TRACER1_TRAIL, SLIGHT_BLOOD_TRAIL,NAIL_TRAIL,
TRACER2_TRAIL, VOOR_TRAIL, ALT_ROCKET_TRAIL, LAVA_TRAIL, BUBBLE_TRAIL, NEHAHRA_SMOKE,
RAYGREEN_TRAIL, RAYRED_TRAIL
} trail_type_t;
void R_ParseParticleEffect (void);
void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
@ -181,4 +197,3 @@ void D_FlushCaches (void);
void D_DeleteSurfaceCache (void);
void D_InitCaches (void *buffer, int size);
void R_SetVrect (vrect_t *pvrect, vrect_t *pvrectin, int lineadj);

View file

@ -168,16 +168,18 @@ typedef struct client_s
// entity effects
#define EF_BRIGHTFIELD 1
#define EF_BLUELIGHT 1
#define EF_MUZZLEFLASH 2
#define EF_BRIGHTLIGHT 4
#define EF_DIMLIGHT 8
#ifdef QUAKE2
#define EF_DARKLIGHT 16
#define EF_DARKFIELD 32
#define EF_LIGHT 64
#define EF_NODRAW 128
#endif
#define EF_REDLIGHT 8
#define EF_ORANGELIGHT 16
#define EF_GREENLIGHT 32
#define EF_LIGHT 64
#define EF_NODRAW 128
#define EF_BRIGHTFIELD 256
#define EF_FULLBRIGHT 512
#define EF_DARKLIGHT 1024
#define EF_DARKFIELD 2048
#define SPAWNFLAG_NOT_EASY 256
#define SPAWNFLAG_NOT_MEDIUM 512

View file

@ -433,6 +433,15 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
float miss;
edict_t *ent;
// Tomaz - QC Alpha Scale Glow Begin
eval_t *val;
float renderamt = 0;
float rendermode = 0;
float rendercolor[3];
memset(rendercolor, 0, sizeof(rendercolor));
// Tomaz - QC Alpha Scale Glow End
// find the client's PVS
VectorAdd (clent->v.origin, clent->v.view_ofs, org);
pvs = SV_FatPVS (org);
@ -505,12 +514,59 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
if (ent->baseline.modelindex != ent->v.modelindex)
bits |= U_MODEL;
if (e >= 256)
// Tomaz - QC Alpha Scale Glow Begin
{
//Smal Size
if ((val = GETEDICTFIELDVALUE(ent, eval_renderamt)) && val->_float != 255.0) // HalfLife support
renderamt = val->_float / 255.0f;
if ((val = GETEDICTFIELDVALUE(ent, eval_rendermode)) && val->_float != 0) // HalfLife support
rendermode = val->_float;
if ((val = GETEDICTFIELDVALUE(ent, eval_rendercolor))) // HalfLife support
{
rendercolor[0] = val->vector[0] / 255.0f;
rendercolor[1] = val->vector[1] / 255.0f;
rendercolor[2] = val->vector[2] / 255.0f;
}
if (renderamt > 0)
bits |= U_RENDERAMT;
if (rendermode > 0)
bits |= U_RENDERMODE;
if (rendercolor[0] > 0)
{
bits |= U_RENDERCOLOR1;
}
if (rendercolor[1] > 0 )
{
bits |= U_RENDERCOLOR2;
}
if (rendercolor[2] > 0 )
{
bits |= U_RENDERCOLOR3;
}
}
// Tomaz - QC Alpha Scale Glow End
if (e >= 256)//We have more than 256 entities
bits |= U_LONGENTITY;
if (bits >= 256)
if (bits >= 256)//this is we've exceded some old 8-bit message
bits |= U_MOREBITS;
// Tomaz - QC Control Begin
if (bits >= 65536)//this is if we've excited the original 16-bit message
bits |= U_EXTEND1;
if (bits >= 16777216)
bits |= U_EXTEND2;
// Tomaz - QC Control End
//
// write the message
//
@ -518,6 +574,14 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
if (bits & U_MOREBITS)
MSG_WriteByte (msg, bits>>8);
// Tomaz - QC Control Begin
if (bits & U_EXTEND1)
MSG_WriteByte (msg, bits>>16);
if (bits & U_EXTEND2)
MSG_WriteByte (msg, bits>>24);
// Tomaz - QC Control End
if (bits & U_LONGENTITY)
MSG_WriteShort (msg,e);
else
@ -545,6 +609,23 @@ void SV_WriteEntitiesToClient (edict_t *clent, sizebuf_t *msg)
MSG_WriteCoord (msg, ent->v.origin[2]);
if (bits & U_ANGLE3)
MSG_WriteAngle(msg, ent->v.angles[2]);
// Tomaz - QC Alpha Scale Glow Begin
if (bits & U_RENDERAMT)
MSG_WriteFloat(msg, renderamt);
if (bits & U_RENDERMODE)
MSG_WriteFloat(msg, rendermode);
if (bits & U_RENDERCOLOR1)
MSG_WriteFloat(msg, rendercolor[0]);
if (bits & U_RENDERCOLOR2)
MSG_WriteFloat(msg, rendercolor[1]);
if (bits & U_RENDERCOLOR3)
MSG_WriteFloat(msg, rendercolor[2]);
// Tomaz - QC Alpha Scale Glow End
}
}

View file

@ -27,6 +27,7 @@ extern float v_blend[4];
extern cvar_t lcd_x;
extern vec3_t CWeaponRot;
extern vec3_t CWeaponOffset;//blubs declared this
void V_Init (void);
void V_RenderView (void);