Tweak rocket trails. Uglier, but don't bog down rocket snipers. Also a couple tiny optimizations and cleanups.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-09-09 19:37:07 +00:00
parent 882adf295a
commit 28fe1dc004
5 changed files with 88 additions and 97 deletions

View File

@ -62,7 +62,7 @@ R_InitBubble ()
bub_cos = bubble_costable; bub_cos = bubble_costable;
for (i = 32; i >= 0; i--) { for (i = 32; i >= 0; i--) {
a = i / 32.0 * M_PI * 2; a = i * (M_PI / 16.0);
*bub_sin++ = sin (a); *bub_sin++ = sin (a);
*bub_cos++ = cos (a); *bub_cos++ = cos (a);
} }

View File

@ -101,9 +101,9 @@ particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz,
for (j = 0; j < 3; j++) { for (j = 0; j < 3; j++) {
if (org_fuzz) if (org_fuzz)
porg[j] = qfrandom (2.0 * org_fuzz) - org_fuzz + org[j]; porg[j] = qfrandom (org_fuzz * 2) - org_fuzz + org[j];
if (vel_fuzz) if (vel_fuzz)
pvel[j] = qfrandom (2.0 * vel_fuzz) - vel_fuzz; pvel[j] = qfrandom (vel_fuzz * 2) - vel_fuzz;
} }
return particle_new (type, texnum, porg, scale, pvel, die, color, alpha); return particle_new (type, texnum, porg, scale, pvel, die, color, alpha);
} }
@ -440,7 +440,7 @@ R_RocketTrail (entity_t *ent)
while (len > 0) { while (len > 0) {
pscalenext = 1.5 + qfrandom (1.5); pscalenext = 1.5 + qfrandom (1.5);
dist = (pscale + pscalenext) * 1.3; dist = (pscale + pscalenext) * 3.0;
VectorScale (vec, min(dist, len), subtract); VectorScale (vec, min(dist, len), subtract);
VectorAdd (ent->old_origin, subtract, ent->old_origin); VectorAdd (ent->old_origin, subtract, ent->old_origin);

View File

@ -110,8 +110,7 @@ int d_lightstylevalue[256]; // 8.8 fraction of base light value
vec3_t shadecolor; // Ender (Extend) Colormod vec3_t shadecolor; // Ender (Extend) Colormod
float modelalpha; // Ender (Extend) Alpha float modelalpha; // Ender (Extend) Alpha
void R_MarkLeaves (void); void R_MarkLeaves (void);
//qboolean R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org); //qboolean R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org);
@ -135,9 +134,9 @@ R_RotateForEntity (entity_t *e)
static mspriteframe_t * static mspriteframe_t *
R_GetSpriteFrame (entity_t *currententity) R_GetSpriteFrame (entity_t *currententity)
{ {
float fullinterval, targettime, time; float fullinterval, targettime, time;
float *pintervals; float *pintervals;
int frame, numframes, i; int frame, numframes, i;
msprite_t *psprite; msprite_t *psprite;
mspriteframe_t *pspriteframe; mspriteframe_t *pspriteframe;
mspritegroup_t *pspritegroup; mspritegroup_t *pspritegroup;
@ -161,8 +160,7 @@ R_GetSpriteFrame (entity_t *currententity)
time = r_realtime + currententity->syncbase; time = r_realtime + currententity->syncbase;
// when loading in Mod_LoadSpriteGroup, we guaranteed all interval // when loading in Mod_LoadSpriteGroup, we guaranteed all interval
// values // values are positive, so we don't have to worry about division by 0
// are positive, so we don't have to worry about division by 0
targettime = time - ((int) (time / fullinterval)) * fullinterval; targettime = time - ((int) (time / fullinterval)) * fullinterval;
for (i = 0; i < (numframes - 1); i++) { for (i = 0; i < (numframes - 1); i++) {
@ -179,10 +177,10 @@ R_GetSpriteFrame (entity_t *currententity)
static void static void
R_DrawSpriteModel (entity_t *e) R_DrawSpriteModel (entity_t *e)
{ {
float *up, *right; float *up, *right;
msprite_t *psprite; msprite_t *psprite;
mspriteframe_t *frame; mspriteframe_t *frame;
vec3_t point, v_forward, v_right, v_up; vec3_t point, v_forward, v_right, v_up;
// don't even bother culling, because it's just a single // don't even bother culling, because it's just a single
// polygon without a surface cache // polygon without a surface cache
@ -232,7 +230,7 @@ R_DrawSpriteModel (entity_t *e)
#define NUMVERTEXNORMALS 162 #define NUMVERTEXNORMALS 162
float r_avertexnormals[NUMVERTEXNORMALS][3] = { float r_avertexnormals[NUMVERTEXNORMALS][3] = {
#include "anorms.h" #include "anorms.h"
}; };
@ -242,18 +240,18 @@ float r_avertexnormal_dots[SHADEDOT_QUANT][256] =
#include "anorm_dots.h" #include "anorm_dots.h"
; ;
float shadelight; float shadelight;
float *shadedots = r_avertexnormal_dots[0]; float *shadedots = r_avertexnormal_dots[0];
int lastposenum, lastposenum0; int lastposenum, lastposenum0;
vec3_t shadevector; vec3_t shadevector;
static void static void
GL_DrawAliasFrame (vert_order_t *vo, qboolean fb) GL_DrawAliasFrame (vert_order_t *vo, qboolean fb)
{ {
float color[4]; float l;
float l; float color[4];
int count; int count;
int *order; int *order;
blended_vert_t *verts; blended_vert_t *verts;
verts = vo->verts; verts = vo->verts;
@ -313,10 +311,10 @@ extern vec3_t lightspot;
static void static void
GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum) GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
{ {
float height, lheight; float height, lheight;
int count; int count;
int *order; int *order;
vec3_t point; vec3_t point;
trivertx_t *verts; trivertx_t *verts;
lheight = currententity->origin[2] - lightspot[2]; lheight = currententity->origin[2] - lightspot[2];
@ -375,9 +373,9 @@ void
GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2,
entity_t *e) entity_t *e)
{ {
float blend, height, lheight, lerp; float blend, height, lheight, lerp;
int count; int count;
int *order; int *order;
trivertx_t *verts1, *verts2; trivertx_t *verts1, *verts2;
vec3_t point1, point2; vec3_t point1, point2;
@ -442,9 +440,9 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2,
vert_order_t * vert_order_t *
GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e) GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e)
{ {
float interval; float interval;
int count, numposes, pose, i; int count, numposes, pose, i;
trivertx_t *verts; trivertx_t *verts;
vert_order_t *vo; vert_order_t *vo;
if ((frame >= paliashdr->mdl.numframes) || (frame < 0)) { if ((frame >= paliashdr->mdl.numframes) || (frame < 0)) {
@ -539,13 +537,13 @@ GL_GetAliasFrameVerts (int frame, aliashdr_t *paliashdr, entity_t *e)
static void static void
R_DrawAliasModel (entity_t *e, qboolean cull) R_DrawAliasModel (entity_t *e, qboolean cull)
{ {
float add, an; float add, an;
int anim, lnum, skinnum, texture; int anim, lnum, skinnum, texture;
int fb_texture = 0; int fb_texture = 0;
aliashdr_t *paliashdr; aliashdr_t *paliashdr;
model_t *clmodel; model_t *clmodel;
qboolean modelIsFullbright = false; qboolean modelIsFullbright = false;
vec3_t dist, mins, maxs; vec3_t dist, mins, maxs;
vert_order_t *vo; vert_order_t *vo;
clmodel = currententity->model; clmodel = currententity->model;
@ -559,7 +557,7 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
/* /*
if (cull && R_CullBlocked(mins, maxs, currententity->origin)) if (cull && R_CullBlocked(mins, maxs, currententity->origin))
return; return;
*/ */
// FIXME: shadecolor is supposed to be the lighting for the model, not // FIXME: shadecolor is supposed to be the lighting for the model, not
// just colormod // just colormod
@ -606,9 +604,9 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
shadedots = r_avertexnormal_dots[(int) (e->angles[1] * shadedots = r_avertexnormal_dots[(int) (e->angles[1] *
(SHADEDOT_QUANT / 360.0)) & (SHADEDOT_QUANT / 360.0)) &
(SHADEDOT_QUANT - 1)]; (SHADEDOT_QUANT - 1)];
shadelight /= 200.0; shadelight *= 0.005;
an = e->angles[1] / 180 * M_PI; an = e->angles[1] * (M_PI / 180);
shadevector[0] = cos (-an); shadevector[0] = cos (-an);
shadevector[1] = sin (-an); shadevector[1] = sin (-an);
shadevector[2] = 1; shadevector[2] = 1;
@ -717,9 +715,9 @@ R_DrawAliasModel (entity_t *e, qboolean cull)
static void static void
R_ShowNearestLoc (void) R_ShowNearestLoc (void)
{ {
dlight_t *dl; dlight_t *dl;
location_t *nearloc; location_t *nearloc;
vec3_t trueloc; vec3_t trueloc;
if (r_drawentities->int_val) if (r_drawentities->int_val)
return; return;
@ -748,7 +746,7 @@ R_ShowNearestLoc (void)
static void static void
R_DrawEntitiesOnList (void) R_DrawEntitiesOnList (void)
{ {
int i; int i;
if (!r_drawentities->int_val) { if (!r_drawentities->int_val) {
R_ShowNearestLoc(); R_ShowNearestLoc();
@ -812,7 +810,7 @@ R_DrawViewModel (void)
inline static int inline static int
SignbitsForPlane (mplane_t *out) SignbitsForPlane (mplane_t *out)
{ {
int bits, j; int bits, j;
// for fast box on planeside test // for fast box on planeside test
@ -888,7 +886,7 @@ R_SetupFrame (void)
static void static void
MYgluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar) MYgluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
{ {
GLdouble xmin, xmax, ymin, ymax; GLdouble xmin, xmax, ymin, ymax;
ymax = zNear * tan (fovy * M_PI / 360.0); ymax = zNear * tan (fovy * M_PI / 360.0);
ymin = -ymax; ymin = -ymax;
@ -1014,9 +1012,9 @@ void R_RenderBrushPoly (msurface_t *fa);
void void
R_Mirror (void) R_Mirror (void)
{ {
float d; float d;
entity_t **ent; entity_t **ent;
msurface_t *s; msurface_t *s;
if (!mirror) if (!mirror)
return; return;
@ -1117,9 +1115,9 @@ R_RenderView (void)
qboolean qboolean
R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org) R_CullBlocked (vec3_t mins, vec3_t maxs, vec3_t org)
{ {
float rad; float rad;
static struct trace_t trace; static struct trace_t trace;
vec3_t point; vec3_t point;
if (!gl_occlusion->int_val) if (!gl_occlusion->int_val)
return false; return false;

View File

@ -91,7 +91,7 @@ glRect_t lightmap_rectchange[MAX_LIGHTMAPS];
msurface_t *waterchain = NULL; msurface_t *waterchain = NULL;
msurface_t *sky_chain; msurface_t *sky_chain;
extern vec3_t shadecolor; // Ender (Extend) Colormod //extern vec3_t shadecolor; // Ender (Extend) Colormod
// LordHavoc: place for gl_rsurf setup code // LordHavoc: place for gl_rsurf setup code

View File

@ -45,19 +45,18 @@
# include "winquake.h" # include "winquake.h"
#endif #endif
#include "compat.h"
#include "QF/console.h" #include "QF/console.h"
#include "QF/cvar.h" #include "QF/cvar.h"
#include "QF/input.h" #include "QF/input.h"
#include "QF/qargs.h" #include "QF/qargs.h"
#include "QF/sys.h"
#include "QF/vfs.h" #include "QF/vfs.h"
#include "QF/vid.h" #include "QF/vid.h"
#include "QF/sys.h" #include "QF/GL/defines.h"
#include "QF/GL/extensions.h" #include "QF/GL/extensions.h"
#include "QF/GL/funcs.h" #include "QF/GL/funcs.h"
#include "QF/GL/defines.h"
#include "compat.h"
#include "sbar.h" #include "sbar.h"
#define WARP_WIDTH 320 #define WARP_WIDTH 320
@ -68,15 +67,11 @@ unsigned char d_15to8table[65536];
cvar_t *vid_mode; cvar_t *vid_mode;
cvar_t *gl_multitexture; cvar_t *gl_multitexture;
extern byte gammatable[256];
extern qboolean GLF_Init ();
QF_glActiveTextureARB qglActiveTexture = NULL; QF_glActiveTextureARB qglActiveTexture = NULL;
QF_glMultiTexCoord2fARB qglMultiTexCoord2f = NULL; QF_glMultiTexCoord2fARB qglMultiTexCoord2f = NULL;
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST, gl_filter_max = GL_LINEAR; int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST, gl_filter_max = GL_LINEAR;
/*-----------------------------------------------------------------------*/
int texture_extension_number = 1; int texture_extension_number = 1;
float gldepthmin, gldepthmax; float gldepthmin, gldepthmax;
@ -94,13 +89,17 @@ qboolean is8bit = false;
cvar_t *vid_use8bit; cvar_t *vid_use8bit;
/*-----------------------------------------------------------------------*/ extern byte gammatable[256];
extern qboolean GLF_Init ();
void void
GL_Common_Init_Cvars (void) GL_Common_Init_Cvars (void)
{ {
vid_use8bit = Cvar_Get ("vid_use8bit", "0", CVAR_ROM, NULL, "Use 8-bit shared palettes."); vid_use8bit = Cvar_Get ("vid_use8bit", "0", CVAR_ROM, NULL, "Use 8-bit "
gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, NULL, "Use multitexture when available"); "shared palettes.");
gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, NULL,
"Use multitexture when available");
} }
/* /*
@ -124,7 +123,8 @@ CheckMultiTextureExtensions (void)
qfglGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &max_texture_units); qfglGetIntegerv (GL_MAX_TEXTURE_UNITS_ARB, &max_texture_units);
if (max_texture_units >= 2) { if (max_texture_units >= 2) {
Con_Printf ("enabled, %d TMUs.\n", max_texture_units); Con_Printf ("enabled, %d TMUs.\n", max_texture_units);
qglMultiTexCoord2f = QFGL_ExtensionAddress ("glMultiTexCoord2fARB"); qglMultiTexCoord2f = QFGL_ExtensionAddress
("glMultiTexCoord2fARB");
qglActiveTexture = QFGL_ExtensionAddress ("glActiveTextureARB"); qglActiveTexture = QFGL_ExtensionAddress ("glActiveTextureARB");
gl_mtex_enum = GL_TEXTURE0_ARB; gl_mtex_enum = GL_TEXTURE0_ARB;
gl_mtex_capable = true; gl_mtex_capable = true;
@ -140,21 +140,17 @@ void
VID_SetPalette (unsigned char *palette) VID_SetPalette (unsigned char *palette)
{ {
byte *pal; byte *pal;
unsigned int r, g, b;
unsigned int v;
int r1, g1, b1;
int k;
unsigned short i;
unsigned int *table;
VFile *f;
char s[255]; char s[255];
float dist, bestdist; float dist, bestdist;
int r1, g1, b1, k;
unsigned int r, g, b, v;
unsigned short i;
unsigned int *table;
static qboolean palflag = false; static qboolean palflag = false;
VFile *f;
// // 8 8 8 encoding
// 8 8 8 encoding // Con_Printf("Converting 8to24\n");
//
// Con_Printf("Converting 8to24\n");
pal = palette; pal = palette;
table = d_8to24table; table = d_8to24table;
@ -186,10 +182,10 @@ VID_SetPalette (unsigned char *palette)
} else { } else {
for (i = 0; i < (1 << 15); i++) { for (i = 0; i < (1 << 15); i++) {
/* Maps /* Maps
000000000000000 000000000000000
000000000011111 = Red = 0x1F 000000000011111 = Red = 0x1F
000001111100000 = Blue = 0x03E0 000001111100000 = Blue = 0x03E0
111110000000000 = Grn = 0x7C00 111110000000000 = Grn = 0x7C00
*/ */
r = ((i & 0x1F) << 3) + 4; r = ((i & 0x1F) << 3) + 4;
g = ((i & 0x03E0) >> 2) + 4; g = ((i & 0x03E0) >> 2) + 4;
@ -265,9 +261,6 @@ GL_Init_Common (void)
CheckMultiTextureExtensions (); CheckMultiTextureExtensions ();
} }
/*
GL_BeginRendering
*/
void void
GL_BeginRendering (int *x, int *y, int *width, int *height) GL_BeginRendering (int *x, int *y, int *width, int *height)
{ {
@ -282,7 +275,6 @@ VID_Is8bit (void)
return is8bit; return is8bit;
} }
#ifdef GL_SHARED_TEXTURE_PALETTE_EXT #ifdef GL_SHARED_TEXTURE_PALETTE_EXT
void void
Tdfx_Init8bitPalette (void) Tdfx_Init8bitPalette (void)
@ -300,7 +292,8 @@ Tdfx_Init8bitPalette (void)
GLubyte table[256][4]; GLubyte table[256][4];
QF_gl3DfxSetPaletteEXT qgl3DfxSetPaletteEXT = NULL; QF_gl3DfxSetPaletteEXT qgl3DfxSetPaletteEXT = NULL;
if (!(qgl3DfxSetPaletteEXT = QFGL_ExtensionAddress ("gl3DfxSetPaletteEXT"))) { if (!(qgl3DfxSetPaletteEXT = QFGL_ExtensionAddress
("gl3DfxSetPaletteEXT"))) {
Con_Printf ("3DFX_set_global_palette not found.\n"); Con_Printf ("3DFX_set_global_palette not found.\n");
return; return;
} }
@ -324,14 +317,14 @@ Tdfx_Init8bitPalette (void)
} }
/* /*
* The GL_EXT_shared_texture_palette seems like an idea which is The GL_EXT_shared_texture_palette seems like an idea which is
* /almost/ a good idea, but seems to be severely broken with many /almost/ a good idea, but seems to be severely broken with many
* drivers, as such it is disabled. drivers, as such it is disabled.
*
* It should be noted, that a palette object extension as suggested by It should be noted, that a palette object extension as suggested by
* the GL_EXT_shared_texture_palette spec might be a very good idea in the GL_EXT_shared_texture_palette spec might be a very good idea in
* general. general.
*/ */
void void
Shared_Init8bitPalette (void) Shared_Init8bitPalette (void)
{ {