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

View File

@ -91,7 +91,7 @@ glRect_t lightmap_rectchange[MAX_LIGHTMAPS];
msurface_t *waterchain = NULL;
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

View File

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