mirror of
https://git.code.sf.net/p/quake/nuq
synced 2024-11-25 05:21:41 +00:00
finally, nuq-glx works. Still needs lots of work, but getting there :)
This commit is contained in:
parent
438a2bbcd2
commit
1ddf60ea24
17 changed files with 562 additions and 1038 deletions
|
@ -199,6 +199,7 @@ extern cvar_t *gl_finish;
|
|||
extern cvar_t *gl_clear;
|
||||
extern cvar_t *gl_subdivide_size;
|
||||
extern cvar_t *gl_particles;
|
||||
extern cvar_t *gl_fires;
|
||||
|
||||
extern int gl_lightmap_format;
|
||||
extern int gl_solid_format;
|
||||
|
@ -209,6 +210,7 @@ extern cvar_t *gl_playermip;
|
|||
|
||||
extern int mirrortexturenum; // quake texturenum, not gltexturenum
|
||||
extern qboolean mirror;
|
||||
extern qboolean lighthalf;
|
||||
extern mplane_t *mirror_plane;
|
||||
|
||||
extern float r_world_matrix[16];
|
||||
|
|
|
@ -310,6 +310,9 @@ extern int r_clipflags;
|
|||
extern int r_dlightframecount;
|
||||
extern qboolean r_fov_greater_than_90;
|
||||
|
||||
extern particle_t *active_particles, *free_particles;
|
||||
extern int ramp1[],ramp2[],ramp3[];
|
||||
|
||||
void R_StoreEfrags (efrag_t **ppefrag);
|
||||
void R_TimeRefresh_f (void);
|
||||
void R_TimeGraph (void);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#ifndef __view_h
|
||||
#define __view_h
|
||||
|
||||
#include "qtypes.h"
|
||||
#include "cvar.h"
|
||||
|
||||
extern byte gammatable[256]; // palette is sent through this
|
||||
|
@ -46,4 +47,19 @@ float V_CalcRoll (vec3_t angles, vec3_t velocity);
|
|||
void V_UpdatePalette (void);
|
||||
void V_CalcBlend (void);
|
||||
|
||||
void V_CalcIntermissionRefdef (void);
|
||||
void V_CalcRefdef (void);
|
||||
void V_CalcPowerupCshift (void);
|
||||
qboolean V_CheckGamma (void);
|
||||
|
||||
extern cvar_t *scr_ofsx;
|
||||
extern cvar_t *scr_ofsy;
|
||||
extern cvar_t *scr_ofsz;
|
||||
extern cvar_t *lcd_yaw;
|
||||
extern cvar_t *cl_crossx;
|
||||
extern cvar_t *cl_crossy;
|
||||
extern cvar_t *gl_cshiftpercent;
|
||||
|
||||
extern vec3_t forward, right, up;
|
||||
|
||||
#endif // __cvar_h
|
||||
|
|
|
@ -49,7 +49,7 @@ common_ASM= sys_ia32.S worlda.S $(math_ASM)
|
|||
#endif
|
||||
|
||||
common_SOURCES= crc.c cvar.c cmd.c mathlib.c wad.c world.c \
|
||||
msg.c sizebuf.c qendian.c qargs.c quakefs.c \
|
||||
msg.c r_part.c sizebuf.c qendian.c qargs.c quakefs.c \
|
||||
va.c quakeio.c link.c com.c \
|
||||
zone.c $(common_ASM)
|
||||
|
||||
|
@ -113,7 +113,7 @@ EXTRA_libqfcd_a_SOURCES=net_dos.c net_bw.c net_ipx.c net_mp.c net_ser.c \
|
|||
client_LIBS= -L. -lqfsys -lqfsnd -lqfcd -lqfnet $(SOUND_LIBS) $(NET_LIBS)
|
||||
|
||||
client_SOURCES= cl_cam.c cl_demo.c cl_input.c cl_main.c cl_parse.c \
|
||||
cl_tent.c console.c keys.c menu.c sbar.c view.c \
|
||||
cl_tent.c console.c keys.c menu.c sbar.c r_view.c \
|
||||
nonintel.c
|
||||
|
||||
server_SOURCES= host.c host_cmd.c \
|
||||
|
@ -131,8 +131,8 @@ combined_SOURCES= $(common_SOURCES) $(client_SOURCES) $(server_SOURCES)
|
|||
soft_SOURCES= d_edge.c d_fill.c d_init.c d_modech.c d_part.c d_polyse.c \
|
||||
d_scan.c d_sky.c d_sprite.c d_surf.c d_vars.c d_zpoint.c \
|
||||
draw.c r_aclip.c r_alias.c r_bsp.c r_draw.c r_edge.c r_efrag.c \
|
||||
r_light.c r_main.c r_misc.c r_part.c r_sky.c r_sprite.c \
|
||||
r_surf.c r_vars.c screen.c model.c $(soft_ASM)
|
||||
r_light.c r_main.c r_misc.c sw_part.c r_sky.c r_sprite.c \
|
||||
r_surf.c r_vars.c screen.c model.c sw_view.c $(soft_ASM)
|
||||
|
||||
#
|
||||
# ... GGI
|
||||
|
|
519
source/gl_part.c
519
source/gl_part.c
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
r_part.c
|
||||
|
||||
(description)
|
||||
@description@
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -27,481 +27,24 @@
|
|||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# include "config.h"
|
||||
#endif
|
||||
#include "qargs.h"
|
||||
#include "d_iface.h"
|
||||
#include "bspfile.h" // needed by: glquake.h
|
||||
#include "vid.h"
|
||||
#include "sys.h"
|
||||
#include "mathlib.h" // needed by: protocol.h, render.h, client.h,
|
||||
#include "host.h"
|
||||
// modelgen.h, glmodel.h
|
||||
#include "wad.h"
|
||||
#include "draw.h"
|
||||
#include "cvar.h"
|
||||
#include "menu.h"
|
||||
#include "net.h" // needed by: client.h
|
||||
#include "protocol.h" // needed by: client.h
|
||||
#include "cmd.h"
|
||||
#include "sbar.h"
|
||||
#include "render.h" // needed by: client.h, gl_model.h, glquake.h
|
||||
#include "client.h" // need cls in this file
|
||||
#include "model.h" // needed by: glquake.h
|
||||
#include "console.h"
|
||||
|
||||
#include "r_shared.h"
|
||||
#include "r_local.h"
|
||||
#include "glquake.h"
|
||||
#include "quakefs.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MAX_PARTICLES 2048 // default max # of particles at one
|
||||
// time
|
||||
#define MAX_FIRES 128 // rocket flames
|
||||
#define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter what's
|
||||
// on the command line
|
||||
|
||||
int ramp1[8] = {0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61};
|
||||
int ramp2[8] = {0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66};
|
||||
int ramp3[8] = {0x6d, 0x6b, 6, 5, 4, 3};
|
||||
|
||||
particle_t *active_particles, *free_particles;
|
||||
|
||||
particle_t *particles;
|
||||
int r_numparticles;
|
||||
|
||||
vec3_t r_pright, r_pup, r_ppn;
|
||||
#include "server.h"
|
||||
#include "console.h"
|
||||
|
||||
#define MAX_FIRES 128 // rocket flames
|
||||
fire_t r_fires[MAX_FIRES];
|
||||
extern cvar_t *gl_fires;
|
||||
extern qboolean lighthalf;
|
||||
|
||||
/*
|
||||
===============
|
||||
R_InitParticles
|
||||
===============
|
||||
*/
|
||||
void R_InitParticles (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = COM_CheckParm ("-particles");
|
||||
|
||||
if (i)
|
||||
{
|
||||
r_numparticles = (int)(atoi(com_argv[i+1]));
|
||||
if (r_numparticles < ABSOLUTE_MIN_PARTICLES)
|
||||
r_numparticles = ABSOLUTE_MIN_PARTICLES;
|
||||
}
|
||||
else
|
||||
{
|
||||
r_numparticles = MAX_PARTICLES;
|
||||
}
|
||||
|
||||
particles = (particle_t *)
|
||||
Hunk_AllocName (r_numparticles * sizeof(particle_t), "particles");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_ClearParticles
|
||||
===============
|
||||
*/
|
||||
void R_ClearParticles (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
free_particles = &particles[0];
|
||||
active_particles = NULL;
|
||||
|
||||
for (i=0 ;i<r_numparticles ; i++)
|
||||
particles[i].next = &particles[i+1];
|
||||
particles[r_numparticles-1].next = NULL;
|
||||
}
|
||||
|
||||
|
||||
void R_ReadPointFile_f (void)
|
||||
{
|
||||
FILE *f;
|
||||
vec3_t org;
|
||||
int r;
|
||||
int c;
|
||||
particle_t *p;
|
||||
char name[MAX_OSPATH];
|
||||
|
||||
// FIXME sprintf (name,"maps/%s.pts", sv.name);
|
||||
|
||||
COM_FOpenFile (name, &f);
|
||||
if (!f)
|
||||
{
|
||||
Con_Printf ("couldn't open %s\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
Con_Printf ("Reading %s...\n", name);
|
||||
c = 0;
|
||||
for ( ;; )
|
||||
{
|
||||
r = fscanf (f,"%f %f %f\n", &org[0], &org[1], &org[2]);
|
||||
if (r != 3)
|
||||
break;
|
||||
c++;
|
||||
|
||||
if (!free_particles)
|
||||
{
|
||||
Con_Printf ("Not enough free particles\n");
|
||||
break;
|
||||
}
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = 99999;
|
||||
p->color = (-c)&15;
|
||||
p->type = pt_static;
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
VectorCopy (org, p->org);
|
||||
}
|
||||
|
||||
fclose (f);
|
||||
Con_Printf ("%i points read\n", c);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_ParticleExplosion
|
||||
|
||||
===============
|
||||
*/
|
||||
void R_ParticleExplosion (vec3_t org)
|
||||
{
|
||||
int i, j;
|
||||
particle_t *p;
|
||||
|
||||
if (!gl_particles->value)
|
||||
return;
|
||||
|
||||
for (i=0 ; i<1024 ; i++)
|
||||
{
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = cl.time + 5;
|
||||
p->color = ramp1[0];
|
||||
p->ramp = rand()&3;
|
||||
if (i & 1)
|
||||
{
|
||||
p->type = pt_explode;
|
||||
for (j=0 ; j<3 ; j++)
|
||||
{
|
||||
p->org[j] = org[j] + ((rand()%32)-16);
|
||||
p->vel[j] = (rand()%512)-256;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
p->type = pt_explode2;
|
||||
for (j=0 ; j<3 ; j++)
|
||||
{
|
||||
p->org[j] = org[j] + ((rand()%32)-16);
|
||||
p->vel[j] = (rand()%512)-256;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_BlobExplosion
|
||||
|
||||
===============
|
||||
*/
|
||||
void R_BlobExplosion (vec3_t org)
|
||||
{
|
||||
int i, j;
|
||||
particle_t *p;
|
||||
|
||||
if (!gl_particles->value)
|
||||
return;
|
||||
|
||||
for (i=0 ; i<1024 ; i++)
|
||||
{
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = cl.time + 1 + (rand()&8)*0.05;
|
||||
|
||||
if (i & 1)
|
||||
{
|
||||
p->type = pt_blob;
|
||||
p->color = 66 + rand()%6;
|
||||
for (j=0 ; j<3 ; j++)
|
||||
{
|
||||
p->org[j] = org[j] + ((rand()%32)-16);
|
||||
p->vel[j] = (rand()%512)-256;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
p->type = pt_blob2;
|
||||
p->color = 150 + rand()%6;
|
||||
for (j=0 ; j<3 ; j++)
|
||||
{
|
||||
p->org[j] = org[j] + ((rand()%32)-16);
|
||||
p->vel[j] = (rand()%512)-256;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_RunParticleEffect
|
||||
|
||||
===============
|
||||
*/
|
||||
void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
|
||||
{
|
||||
int i, j;
|
||||
particle_t *p;
|
||||
int scale;
|
||||
|
||||
if (!gl_particles->value)
|
||||
return;
|
||||
|
||||
if (count > 130)
|
||||
scale = 3;
|
||||
else if (count > 20)
|
||||
scale = 2;
|
||||
else
|
||||
scale = 1;
|
||||
|
||||
for (i=0 ; i<count ; i++)
|
||||
{
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = cl.time + 0.1*(rand()%5);
|
||||
p->color = (color&~7) + (rand()&7);
|
||||
p->type = pt_grav;
|
||||
for (j=0 ; j<3 ; j++)
|
||||
{
|
||||
p->org[j] = org[j] + scale*((rand()&15)-8);
|
||||
p->vel[j] = dir[j]*15;// + (rand()%300)-150;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_LavaSplash
|
||||
|
||||
===============
|
||||
*/
|
||||
void R_LavaSplash (vec3_t org)
|
||||
{
|
||||
int i, j, k;
|
||||
particle_t *p;
|
||||
float vel;
|
||||
vec3_t dir;
|
||||
|
||||
if (!gl_particles->value)
|
||||
return;
|
||||
|
||||
for (i=-16 ; i<16 ; i++)
|
||||
for (j=-16 ; j<16 ; j++)
|
||||
for (k=0 ; k<1 ; k++)
|
||||
{
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = cl.time + 2 + (rand()&31) * 0.02;
|
||||
p->color = 224 + (rand()&7);
|
||||
p->type = pt_grav;
|
||||
|
||||
dir[0] = j*8 + (rand()&7);
|
||||
dir[1] = i*8 + (rand()&7);
|
||||
dir[2] = 256;
|
||||
|
||||
p->org[0] = org[0] + dir[0];
|
||||
p->org[1] = org[1] + dir[1];
|
||||
p->org[2] = org[2] + (rand()&63);
|
||||
|
||||
VectorNormalize (dir);
|
||||
vel = 50 + (rand()&63);
|
||||
VectorScale (dir, vel, p->vel);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_TeleportSplash
|
||||
|
||||
===============
|
||||
*/
|
||||
void R_TeleportSplash (vec3_t org)
|
||||
{
|
||||
int i, j, k;
|
||||
particle_t *p;
|
||||
float vel;
|
||||
vec3_t dir;
|
||||
|
||||
if (!gl_particles->value)
|
||||
return;
|
||||
|
||||
for (i=-16 ; i<16 ; i+=4)
|
||||
for (j=-16 ; j<16 ; j+=4)
|
||||
for (k=-24 ; k<32 ; k+=4)
|
||||
{
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = cl.time + 0.2 + (rand()&7) * 0.02;
|
||||
p->color = 7 + (rand()&7);
|
||||
p->type = pt_grav;
|
||||
|
||||
dir[0] = j*8;
|
||||
dir[1] = i*8;
|
||||
dir[2] = k*8;
|
||||
|
||||
p->org[0] = org[0] + i + (rand()&3);
|
||||
p->org[1] = org[1] + j + (rand()&3);
|
||||
p->org[2] = org[2] + k + (rand()&3);
|
||||
|
||||
VectorNormalize (dir);
|
||||
vel = 50 + (rand()&63);
|
||||
VectorScale (dir, vel, p->vel);
|
||||
}
|
||||
}
|
||||
|
||||
void R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
|
||||
{
|
||||
vec3_t vec;
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
|
||||
if (type == 0)
|
||||
R_AddFire (start, end, ent);
|
||||
|
||||
if (!gl_particles->value)
|
||||
return;
|
||||
|
||||
VectorSubtract (end, start, vec);
|
||||
len = VectorNormalize (vec);
|
||||
while (len > 0)
|
||||
{
|
||||
len -= 3;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
p->die = cl.time + 2;
|
||||
|
||||
if (type == 4)
|
||||
{ // slight blood
|
||||
p->type = pt_slowgrav;
|
||||
p->color = 67 + (rand()&3);
|
||||
for (j=0 ; j<3 ; j++)
|
||||
p->org[j] = start[j] + ((rand()%6)-3);
|
||||
len -= 3;
|
||||
}
|
||||
else if (type == 2)
|
||||
{ // blood
|
||||
p->type = pt_slowgrav;
|
||||
p->color = 67 + (rand()&3);
|
||||
for (j=0 ; j<3 ; j++)
|
||||
p->org[j] = start[j] + ((rand()%6)-3);
|
||||
}
|
||||
else if (type == 6)
|
||||
{ // voor trail
|
||||
p->color = 9*16 + 8 + (rand()&3);
|
||||
p->type = pt_static;
|
||||
p->die = cl.time + 0.3;
|
||||
for (j=0 ; j<3 ; j++)
|
||||
p->org[j] = start[j] + ((rand()&15)-8);
|
||||
}
|
||||
else if (type == 1)
|
||||
{ // smoke smoke
|
||||
p->ramp = (rand()&3) + 2;
|
||||
p->color = ramp3[(int)p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j=0 ; j<3 ; j++)
|
||||
p->org[j] = start[j] + ((rand()%6)-3);
|
||||
}
|
||||
else if (type == 0)
|
||||
{ // rocket trail
|
||||
p->ramp = (rand()&3);
|
||||
p->color = ramp3[(int)p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j=0 ; j<3 ; j++)
|
||||
p->org[j] = start[j] + ((rand()%6)-3);
|
||||
}
|
||||
else if (type == 3 || type == 5)
|
||||
{ // tracer
|
||||
static int tracercount;
|
||||
|
||||
p->die = cl.time + 0.5;
|
||||
p->type = pt_static;
|
||||
if (type == 3)
|
||||
p->color = 52 + ((tracercount&4)<<1);
|
||||
else
|
||||
p->color = 230 + ((tracercount&4)<<1);
|
||||
|
||||
tracercount++;
|
||||
|
||||
VectorCopy (start, p->org);
|
||||
if (tracercount & 1)
|
||||
{
|
||||
p->vel[0] = 30*vec[1];
|
||||
p->vel[1] = 30*-vec[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
p->vel[0] = 30*-vec[1];
|
||||
p->vel[1] = 30*vec[0];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
VectorAdd (start, vec, start);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_DrawParticles
|
||||
===============
|
||||
*/
|
||||
|
||||
void R_DrawParticles (void)
|
||||
{
|
||||
particle_t *p, *kill;
|
||||
|
@ -511,29 +54,23 @@ void R_DrawParticles (void)
|
|||
float time1;
|
||||
float dvel;
|
||||
float frametime;
|
||||
unsigned char *at;
|
||||
unsigned char theAlpha;
|
||||
|
||||
vec3_t up, right;
|
||||
float scale;
|
||||
qboolean alphaTestEnabled;
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, particletexture);
|
||||
// LordHavoc: particles should not affect zbuffer
|
||||
glDepthMask(0);
|
||||
alphaTestEnabled = glIsEnabled(GL_ALPHA_TEST);
|
||||
|
||||
if (alphaTestEnabled)
|
||||
glDisable(GL_ALPHA_TEST);
|
||||
GL_Bind(particletexture);
|
||||
glEnable (GL_BLEND);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glBegin (GL_TRIANGLES);
|
||||
|
||||
VectorScale (vup, 1.5, up);
|
||||
VectorScale (vright, 1.5, right);
|
||||
|
||||
frametime = host_frametime;
|
||||
frametime = cl.time - cl.oldtime;
|
||||
time3 = frametime * 15;
|
||||
time2 = frametime * 10; // 15;
|
||||
time1 = frametime * 5;
|
||||
grav = frametime * 800 * 0.05;
|
||||
grav = frametime * sv_gravity->value * 0.05;
|
||||
dvel = 4*frametime;
|
||||
|
||||
for ( ;; )
|
||||
|
@ -571,20 +108,7 @@ void R_DrawParticles (void)
|
|||
scale = 1;
|
||||
else
|
||||
scale = 1 + scale * 0.004;
|
||||
at = (byte *)&d_8to24table[(int)p->color];
|
||||
if (p->type==pt_fire)
|
||||
theAlpha = 255*(6-p->ramp)/6;
|
||||
// theAlpha = 192;
|
||||
// else if (p->type==pt_explode || p->type==pt_explode2)
|
||||
// theAlpha = 255*(8-p->ramp)/8;
|
||||
else
|
||||
theAlpha = 255;
|
||||
if (lighthalf)
|
||||
glColor4ub((byte) ((int) at[0] >> 1), (byte) ((int) at[1] >> 1), (byte) ((int) at[2] >> 1), theAlpha);
|
||||
else
|
||||
glColor4ub(at[0], at[1], at[2], theAlpha);
|
||||
// glColor3ubv (at);
|
||||
// glColor3ubv ((byte *)&d_8to24table[(int)p->color]);
|
||||
glColor3ubv ((byte *)&d_8to24table[(int)p->color]);
|
||||
glTexCoord2f (0,0);
|
||||
glVertex3fv (p->org);
|
||||
glTexCoord2f (1,0);
|
||||
|
@ -643,17 +167,20 @@ void R_DrawParticles (void)
|
|||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_slowgrav:
|
||||
case pt_grav:
|
||||
#ifdef QUAKE2
|
||||
p->vel[2] -= grav * 20;
|
||||
break;
|
||||
#endif
|
||||
case pt_slowgrav:
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
glEnd ();
|
||||
if (alphaTestEnabled)
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glDepthMask(1);
|
||||
glDisable (GL_BLEND);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -85,6 +85,23 @@ void AddLightBlend (float r, float g, float b, float a2)
|
|||
v_blend[2] = v_blend[2]*(1-a2) + b*a2;
|
||||
}
|
||||
|
||||
float bubble_sintable[33], bubble_costable[33];
|
||||
|
||||
void R_InitBubble() {
|
||||
float a;
|
||||
int i;
|
||||
float *bub_sin, *bub_cos;
|
||||
|
||||
bub_sin = bubble_sintable;
|
||||
bub_cos = bubble_costable;
|
||||
|
||||
for (i=32 ; i>=0 ; i--) {
|
||||
a = i/32.0 * M_PI*2;
|
||||
*bub_sin++ = sin(a);
|
||||
*bub_cos++ = cos(a);
|
||||
}
|
||||
}
|
||||
|
||||
void R_RenderDlight (dlight_t *light)
|
||||
{
|
||||
int i, j;
|
||||
|
|
|
@ -115,6 +115,8 @@ cvar_t *gl_nocolors;
|
|||
cvar_t *gl_keeptjunctions;
|
||||
cvar_t *gl_reporttjunctions;
|
||||
cvar_t *gl_doubleeyes;
|
||||
cvar_t *gl_particles;
|
||||
cvar_t *gl_fires;
|
||||
|
||||
/*
|
||||
=================
|
||||
|
@ -991,27 +993,6 @@ void R_Clear (void)
|
|||
gldepthmax = 0.5;
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
}
|
||||
else if (gl_ztrick->value)
|
||||
{
|
||||
static int trickframe;
|
||||
|
||||
if (gl_clear->value)
|
||||
glClear (GL_COLOR_BUFFER_BIT);
|
||||
|
||||
trickframe++;
|
||||
if (trickframe & 1)
|
||||
{
|
||||
gldepthmin = 0;
|
||||
gldepthmax = 0.49999;
|
||||
glDepthFunc (GL_LEQUAL);
|
||||
}
|
||||
else
|
||||
{
|
||||
gldepthmin = 1;
|
||||
gldepthmax = 0.5;
|
||||
glDepthFunc (GL_GEQUAL);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (gl_clear->value)
|
||||
|
|
|
@ -213,6 +213,12 @@ void R_Init (void)
|
|||
gl_playermip = Cvar_Get("gl_playermip", "0", CVAR_NONE, "None");
|
||||
gl_nocolors = Cvar_Get("gl_nocolors", "0", CVAR_NONE, "None");
|
||||
|
||||
gl_fires = Cvar_Get ("gl_fires", "0", CVAR_ARCHIVE,
|
||||
"Toggles lavaball and rocket fireballs");
|
||||
|
||||
gl_particles = Cvar_Get ("gl_particles", "1", CVAR_ARCHIVE,
|
||||
"whether or not to draw particles");
|
||||
|
||||
gl_keeptjunctions = Cvar_Get("gl_keeptjunctions", "0", CVAR_NONE, "None");
|
||||
gl_reporttjunctions = Cvar_Get("gl_reporttjunctions", "0", CVAR_NONE, "None");
|
||||
|
||||
|
|
|
@ -76,6 +76,7 @@ msurface_t *skychain = NULL;
|
|||
msurface_t *waterchain = NULL;
|
||||
|
||||
lpMTexFUNC qglMTexCoord2f = NULL;
|
||||
lpSelTexFUNC qglSelectTexture = NULL;
|
||||
|
||||
void R_RenderDynamicLightmaps (msurface_t *fa);
|
||||
|
||||
|
@ -1602,7 +1603,6 @@ void GL_BuildLightmaps (void)
|
|||
{
|
||||
int i, j;
|
||||
model_t *m;
|
||||
extern qboolean isPermedia;
|
||||
|
||||
memset (allocated, 0, sizeof(allocated));
|
||||
|
||||
|
@ -1615,9 +1615,6 @@ void GL_BuildLightmaps (void)
|
|||
}
|
||||
|
||||
gl_lightmap_format = GL_LUMINANCE;
|
||||
// default differently on the Permedia
|
||||
if (isPermedia)
|
||||
gl_lightmap_format = GL_RGBA;
|
||||
|
||||
if (COM_CheckParm ("-lm_1"))
|
||||
gl_lightmap_format = GL_LUMINANCE;
|
||||
|
|
|
@ -114,6 +114,8 @@ cvar_t *gl_triplebuffer;
|
|||
|
||||
qboolean scr_initialized; // ready to draw
|
||||
|
||||
qboolean lighthalf;
|
||||
|
||||
qpic_t *scr_ram;
|
||||
qpic_t *scr_net;
|
||||
qpic_t *scr_turtle;
|
||||
|
@ -137,6 +139,11 @@ qboolean block_drawing;
|
|||
|
||||
void SCR_ScreenShot_f (void);
|
||||
|
||||
void
|
||||
SCR_InitCvars(void)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
||||
|
|
186
source/gl_view.c
186
source/gl_view.c
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
gl_view.c
|
||||
view.c
|
||||
|
||||
player eye positioning
|
||||
@description@
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -27,53 +27,25 @@
|
|||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
# include "config.h"
|
||||
#endif
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "bspfile.h" // needed by: glquake.h
|
||||
#include "vid.h"
|
||||
#include "sys.h"
|
||||
#include "mathlib.h" // needed by: protocol.h, render.h, client.h,
|
||||
// modelgen.h, glmodel.h
|
||||
#include "compat.h"
|
||||
#include "wad.h"
|
||||
#include "draw.h"
|
||||
#include "cvar.h"
|
||||
#include "net.h" // needed by: client.h
|
||||
#include "protocol.h" // needed by: client.h
|
||||
#include "cmd.h"
|
||||
#include "sbar.h"
|
||||
#include "render.h" // needed by: client.h, model.h, glquake.h
|
||||
#include "client.h" // need cls in this file
|
||||
#include "model.h" // needed by: glquake.h
|
||||
#include "view.h"
|
||||
#include "client.h"
|
||||
#include "host.h"
|
||||
#include "console.h"
|
||||
#include "glquake.h"
|
||||
|
||||
extern byte *host_basepal;
|
||||
extern double host_frametime;
|
||||
extern int onground;
|
||||
extern byte gammatable[256];
|
||||
|
||||
extern cvar_t *gl_cshiftpercent;
|
||||
|
||||
byte ramps[3][256];
|
||||
float v_blend[4];
|
||||
|
||||
void V_CalcPowerupCshift (void);
|
||||
qboolean V_CheckGamma (void);
|
||||
byte ramps[3][256];
|
||||
float v_blend[4]; // rgba 0.0 - 1.0
|
||||
|
||||
/*
|
||||
V_CalcBlend
|
||||
|
||||
LordHavoc made this a real, (messy,) true alpha blend. Cleaned it up
|
||||
a bit, but otherwise this is his code. --KB
|
||||
=============
|
||||
V_CalcBlend
|
||||
=============
|
||||
*/
|
||||
void
|
||||
V_CalcBlend (void)
|
||||
void V_CalcBlend (void)
|
||||
{
|
||||
float r, g, b, a, a2, a3;
|
||||
float r, g, b, a, a2;
|
||||
int j;
|
||||
|
||||
r = 0;
|
||||
|
@ -88,33 +60,25 @@ V_CalcBlend (void)
|
|||
|
||||
a2 = ((cl.cshifts[j].percent * gl_cshiftpercent->value) / 100.0) / 255.0;
|
||||
|
||||
// a2 = cl.cshifts[j].percent/255.0;
|
||||
if (!a2)
|
||||
continue;
|
||||
|
||||
a2 = min(a2, 1.0);
|
||||
r += (cl.cshifts[j].destcolor[0]-r) * a2;
|
||||
g += (cl.cshifts[j].destcolor[1]-g) * a2;
|
||||
b += (cl.cshifts[j].destcolor[2]-b) * a2;
|
||||
|
||||
a3 = (1.0 - a) * (1.0 - a2);
|
||||
a = 1.0 - a3;
|
||||
a = a + a2*(1-a);
|
||||
//Con_Printf ("j:%i a:%f\n", j, a);
|
||||
a2 = a2/a;
|
||||
r = r*(1-a2) + cl.cshifts[j].destcolor[0]*a2;
|
||||
g = g*(1-a2) + cl.cshifts[j].destcolor[1]*a2;
|
||||
b = b*(1-a2) + cl.cshifts[j].destcolor[2]*a2;
|
||||
}
|
||||
|
||||
// LordHavoc: saturate color
|
||||
if (a)
|
||||
{
|
||||
a2 = 1.0 / a;
|
||||
r *= a2;
|
||||
g *= a2;
|
||||
b *= a2;
|
||||
if (a > 1) // clamp alpha blend too
|
||||
a = 1;
|
||||
}
|
||||
|
||||
v_blend[0] = min(r, 255.0)/255.0;
|
||||
v_blend[1] = min(g, 255.0)/255.0;
|
||||
v_blend[2] = min(b, 255.0)/255.0;
|
||||
v_blend[3] = bound (0.0, a, 1.0);
|
||||
v_blend[0] = r/255.0;
|
||||
v_blend[1] = g/255.0;
|
||||
v_blend[2] = b/255.0;
|
||||
v_blend[3] = a;
|
||||
if (v_blend[3] > 1)
|
||||
v_blend[3] = 1;
|
||||
if (v_blend[3] < 0)
|
||||
v_blend[3] = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -122,7 +86,6 @@ V_CalcBlend (void)
|
|||
V_UpdatePalette
|
||||
=============
|
||||
*/
|
||||
|
||||
void V_UpdatePalette (void)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -168,8 +131,6 @@ void V_UpdatePalette (void)
|
|||
|
||||
V_CalcBlend ();
|
||||
|
||||
//Con_Printf("b: %4.2f %4.2f %4.2f %4.6f\n", v_blend[0], v_blend[1], v_blend[2], v_blend[3]);
|
||||
|
||||
a = v_blend[3];
|
||||
r = 255*v_blend[0]*a;
|
||||
g = 255*v_blend[1]*a;
|
||||
|
@ -178,9 +139,15 @@ void V_UpdatePalette (void)
|
|||
a = 1-a;
|
||||
for (i=0 ; i<256 ; i++)
|
||||
{
|
||||
ir = min(i*a + r, 255);
|
||||
ig = min(i*a + g, 255);
|
||||
ib = min(i*a + b, 255);
|
||||
ir = i*a + r;
|
||||
ig = i*a + g;
|
||||
ib = i*a + b;
|
||||
if (ir > 255)
|
||||
ir = 255;
|
||||
if (ig > 255)
|
||||
ig = 255;
|
||||
if (ib > 255)
|
||||
ib = 255;
|
||||
|
||||
ramps[0][i] = gammatable[ir];
|
||||
ramps[1][i] = gammatable[ig];
|
||||
|
@ -206,3 +173,82 @@ void V_UpdatePalette (void)
|
|||
VID_ShiftPalette (pal);
|
||||
}
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
VIEW RENDERING
|
||||
|
||||
==============================================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
==================
|
||||
V_RenderView
|
||||
|
||||
The player's clipping box goes from (-16 -16 -24) to (16 16 32) from
|
||||
the entity origin, so any view position inside that will be valid
|
||||
==================
|
||||
*/
|
||||
extern vrect_t scr_vrect;
|
||||
|
||||
void V_RenderView (void)
|
||||
{
|
||||
if (con_forcedup)
|
||||
return;
|
||||
|
||||
// don't allow cheats in multiplayer
|
||||
if (cl.maxclients > 1)
|
||||
{
|
||||
Cvar_Set(scr_ofsx, "0");
|
||||
Cvar_Set(scr_ofsy, "0");
|
||||
Cvar_Set(scr_ofsz, "0");
|
||||
}
|
||||
|
||||
if (cl.intermission)
|
||||
{ // intermission / finale rendering
|
||||
V_CalcIntermissionRefdef ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!cl.paused /* && (sv.maxclients > 1 || key_dest == key_game) */ )
|
||||
V_CalcRefdef ();
|
||||
}
|
||||
|
||||
R_PushDlights ();
|
||||
|
||||
if (lcd_x->value)
|
||||
{
|
||||
//
|
||||
// render two interleaved views
|
||||
//
|
||||
int i;
|
||||
|
||||
vid.rowbytes <<= 1;
|
||||
vid.aspect *= 0.5;
|
||||
|
||||
r_refdef.viewangles[YAW] -= lcd_yaw->value;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
r_refdef.vieworg[i] -= right[i]*lcd_x->value;
|
||||
R_RenderView ();
|
||||
|
||||
vid.buffer += vid.rowbytes>>1;
|
||||
|
||||
R_PushDlights ();
|
||||
|
||||
r_refdef.viewangles[YAW] += lcd_yaw->value*2;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
r_refdef.vieworg[i] += 2*right[i]*lcd_x->value;
|
||||
R_RenderView ();
|
||||
|
||||
vid.buffer -= vid.rowbytes>>1;
|
||||
|
||||
r_refdef.vrect.height <<= 1;
|
||||
|
||||
vid.rowbytes >>= 1;
|
||||
vid.aspect *= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
R_RenderView ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,6 +129,7 @@ float se_time1, se_time2, de_time1, de_time2, dv_time1, dv_time2;
|
|||
|
||||
void R_MarkLeaves (void);
|
||||
|
||||
cvar_t *gl_particles;
|
||||
cvar_t *r_draworder;
|
||||
cvar_t *r_speeds;
|
||||
cvar_t *r_timegraph;
|
||||
|
@ -204,6 +205,9 @@ void R_Init (void)
|
|||
Cmd_AddCommand ("timerefresh", R_TimeRefresh_f);
|
||||
Cmd_AddCommand ("pointfile", R_ReadPointFile_f);
|
||||
|
||||
gl_particles = Cvar_Get ("gl_particles", "1", CVAR_ARCHIVE|CVAR_ROM,
|
||||
"whether or not to draw particles");
|
||||
|
||||
r_draworder = Cvar_Get("r_draworder", "0", CVAR_NONE, "None");
|
||||
r_speeds = Cvar_Get("r_speeds", "0", CVAR_NONE, "None");
|
||||
r_timegraph = Cvar_Get("r_timegraph", "0", CVAR_NONE, "None");
|
||||
|
|
166
source/r_part.c
166
source/r_part.c
|
@ -35,6 +35,7 @@
|
|||
#include "console.h"
|
||||
#include "server.h"
|
||||
#include "msg.h"
|
||||
#include "glquake.h"
|
||||
|
||||
#define MAX_PARTICLES 2048 // default max # of particles at one
|
||||
// time
|
||||
|
@ -558,6 +559,12 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
|
|||
int dec;
|
||||
static int tracercount;
|
||||
|
||||
if (type == 0)
|
||||
R_AddFire (start, end, ent);
|
||||
|
||||
if (!gl_particles->value)
|
||||
return;
|
||||
|
||||
VectorSubtract (end, start, vec);
|
||||
len = VectorNormalize (vec);
|
||||
if (type < 128)
|
||||
|
@ -653,162 +660,3 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_DrawParticles
|
||||
===============
|
||||
*/
|
||||
|
||||
void R_DrawParticles (void)
|
||||
{
|
||||
particle_t *p, *kill;
|
||||
float grav;
|
||||
int i;
|
||||
float time2, time3;
|
||||
float time1;
|
||||
float dvel;
|
||||
float frametime;
|
||||
|
||||
#ifdef GLQUAKE
|
||||
vec3_t up, right;
|
||||
float scale;
|
||||
|
||||
GL_Bind(particletexture);
|
||||
glEnable (GL_BLEND);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
glBegin (GL_TRIANGLES);
|
||||
|
||||
VectorScale (vup, 1.5, up);
|
||||
VectorScale (vright, 1.5, right);
|
||||
#else
|
||||
D_StartParticles ();
|
||||
|
||||
VectorScale (vright, xscaleshrink, r_pright);
|
||||
VectorScale (vup, yscaleshrink, r_pup);
|
||||
VectorCopy (vpn, r_ppn);
|
||||
#endif
|
||||
frametime = cl.time - cl.oldtime;
|
||||
time3 = frametime * 15;
|
||||
time2 = frametime * 10; // 15;
|
||||
time1 = frametime * 5;
|
||||
grav = frametime * sv_gravity->value * 0.05;
|
||||
dvel = 4*frametime;
|
||||
|
||||
for ( ;; )
|
||||
{
|
||||
kill = active_particles;
|
||||
if (kill && kill->die < cl.time)
|
||||
{
|
||||
active_particles = kill->next;
|
||||
kill->next = free_particles;
|
||||
free_particles = kill;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (p=active_particles ; p ; p=p->next)
|
||||
{
|
||||
for ( ;; )
|
||||
{
|
||||
kill = p->next;
|
||||
if (kill && kill->die < cl.time)
|
||||
{
|
||||
p->next = kill->next;
|
||||
kill->next = free_particles;
|
||||
free_particles = kill;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
#ifdef GLQUAKE
|
||||
// hack a scale up to keep particles from disapearing
|
||||
scale = (p->org[0] - r_origin[0])*vpn[0] + (p->org[1] - r_origin[1])*vpn[1]
|
||||
+ (p->org[2] - r_origin[2])*vpn[2];
|
||||
if (scale < 20)
|
||||
scale = 1;
|
||||
else
|
||||
scale = 1 + scale * 0.004;
|
||||
glColor3ubv ((byte *)&d_8to24table[(int)p->color]);
|
||||
glTexCoord2f (0,0);
|
||||
glVertex3fv (p->org);
|
||||
glTexCoord2f (1,0);
|
||||
glVertex3f (p->org[0] + up[0]*scale, p->org[1] + up[1]*scale, p->org[2] + up[2]*scale);
|
||||
glTexCoord2f (0,1);
|
||||
glVertex3f (p->org[0] + right[0]*scale, p->org[1] + right[1]*scale, p->org[2] + right[2]*scale);
|
||||
#else
|
||||
D_DrawParticle (p);
|
||||
#endif
|
||||
p->org[0] += p->vel[0]*frametime;
|
||||
p->org[1] += p->vel[1]*frametime;
|
||||
p->org[2] += p->vel[2]*frametime;
|
||||
|
||||
switch (p->type)
|
||||
{
|
||||
case pt_static:
|
||||
break;
|
||||
case pt_fire:
|
||||
p->ramp += time1;
|
||||
if (p->ramp >= 6)
|
||||
p->die = -1;
|
||||
else
|
||||
p->color = ramp3[(int)p->ramp];
|
||||
p->vel[2] += grav;
|
||||
break;
|
||||
|
||||
case pt_explode:
|
||||
p->ramp += time2;
|
||||
if (p->ramp >=8)
|
||||
p->die = -1;
|
||||
else
|
||||
p->color = ramp1[(int)p->ramp];
|
||||
for (i=0 ; i<3 ; i++)
|
||||
p->vel[i] += p->vel[i]*dvel;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_explode2:
|
||||
p->ramp += time3;
|
||||
if (p->ramp >=8)
|
||||
p->die = -1;
|
||||
else
|
||||
p->color = ramp2[(int)p->ramp];
|
||||
for (i=0 ; i<3 ; i++)
|
||||
p->vel[i] -= p->vel[i]*frametime;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_blob:
|
||||
for (i=0 ; i<3 ; i++)
|
||||
p->vel[i] += p->vel[i]*dvel;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_blob2:
|
||||
for (i=0 ; i<2 ; i++)
|
||||
p->vel[i] -= p->vel[i]*dvel;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_grav:
|
||||
#ifdef QUAKE2
|
||||
p->vel[2] -= grav * 20;
|
||||
break;
|
||||
#endif
|
||||
case pt_slowgrav:
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef GLQUAKE
|
||||
glEnd ();
|
||||
glDisable (GL_BLEND);
|
||||
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
#else
|
||||
D_EndParticles ();
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -277,11 +277,6 @@ cvar_t *v_gamma;
|
|||
|
||||
byte gammatable[256]; // palette is sent through this
|
||||
|
||||
#ifdef GLQUAKE
|
||||
byte ramps[3][256];
|
||||
float v_blend[4]; // rgba 0.0 - 1.0
|
||||
#endif // GLQUAKE
|
||||
|
||||
void BuildGammaTable (float g)
|
||||
{
|
||||
int i, inf;
|
||||
|
@ -490,213 +485,6 @@ void V_CalcPowerupCshift (void)
|
|||
cl.cshifts[CSHIFT_POWERUP].percent = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
V_CalcBlend
|
||||
=============
|
||||
*/
|
||||
#ifdef GLQUAKE
|
||||
void V_CalcBlend (void)
|
||||
{
|
||||
float r, g, b, a, a2;
|
||||
int j;
|
||||
|
||||
r = 0;
|
||||
g = 0;
|
||||
b = 0;
|
||||
a = 0;
|
||||
|
||||
for (j=0 ; j<NUM_CSHIFTS ; j++)
|
||||
{
|
||||
if (!gl_cshiftpercent->value)
|
||||
continue;
|
||||
|
||||
a2 = ((cl.cshifts[j].percent * gl_cshiftpercent->value) / 100.0) / 255.0;
|
||||
|
||||
// a2 = cl.cshifts[j].percent/255.0;
|
||||
if (!a2)
|
||||
continue;
|
||||
a = a + a2*(1-a);
|
||||
//Con_Printf ("j:%i a:%f\n", j, a);
|
||||
a2 = a2/a;
|
||||
r = r*(1-a2) + cl.cshifts[j].destcolor[0]*a2;
|
||||
g = g*(1-a2) + cl.cshifts[j].destcolor[1]*a2;
|
||||
b = b*(1-a2) + cl.cshifts[j].destcolor[2]*a2;
|
||||
}
|
||||
|
||||
v_blend[0] = r/255.0;
|
||||
v_blend[1] = g/255.0;
|
||||
v_blend[2] = b/255.0;
|
||||
v_blend[3] = a;
|
||||
if (v_blend[3] > 1)
|
||||
v_blend[3] = 1;
|
||||
if (v_blend[3] < 0)
|
||||
v_blend[3] = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
=============
|
||||
V_UpdatePalette
|
||||
=============
|
||||
*/
|
||||
#ifdef GLQUAKE
|
||||
void V_UpdatePalette (void)
|
||||
{
|
||||
int i, j;
|
||||
qboolean new;
|
||||
byte *basepal, *newpal;
|
||||
byte pal[768];
|
||||
float r,g,b,a;
|
||||
int ir, ig, ib;
|
||||
qboolean force;
|
||||
|
||||
V_CalcPowerupCshift ();
|
||||
|
||||
new = false;
|
||||
|
||||
for (i=0 ; i<NUM_CSHIFTS ; i++)
|
||||
{
|
||||
if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent)
|
||||
{
|
||||
new = true;
|
||||
cl.prev_cshifts[i].percent = cl.cshifts[i].percent;
|
||||
}
|
||||
for (j=0 ; j<3 ; j++)
|
||||
if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j])
|
||||
{
|
||||
new = true;
|
||||
cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j];
|
||||
}
|
||||
}
|
||||
|
||||
// drop the damage value
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime*150;
|
||||
if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
|
||||
|
||||
// drop the bonus value
|
||||
cl.cshifts[CSHIFT_BONUS].percent -= host_frametime*100;
|
||||
if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
|
||||
cl.cshifts[CSHIFT_BONUS].percent = 0;
|
||||
|
||||
force = V_CheckGamma ();
|
||||
if (!new && !force)
|
||||
return;
|
||||
|
||||
V_CalcBlend ();
|
||||
|
||||
a = v_blend[3];
|
||||
r = 255*v_blend[0]*a;
|
||||
g = 255*v_blend[1]*a;
|
||||
b = 255*v_blend[2]*a;
|
||||
|
||||
a = 1-a;
|
||||
for (i=0 ; i<256 ; i++)
|
||||
{
|
||||
ir = i*a + r;
|
||||
ig = i*a + g;
|
||||
ib = i*a + b;
|
||||
if (ir > 255)
|
||||
ir = 255;
|
||||
if (ig > 255)
|
||||
ig = 255;
|
||||
if (ib > 255)
|
||||
ib = 255;
|
||||
|
||||
ramps[0][i] = gammatable[ir];
|
||||
ramps[1][i] = gammatable[ig];
|
||||
ramps[2][i] = gammatable[ib];
|
||||
}
|
||||
|
||||
basepal = host_basepal;
|
||||
newpal = pal;
|
||||
|
||||
for (i=0 ; i<256 ; i++)
|
||||
{
|
||||
ir = basepal[0];
|
||||
ig = basepal[1];
|
||||
ib = basepal[2];
|
||||
basepal += 3;
|
||||
|
||||
newpal[0] = ramps[0][ir];
|
||||
newpal[1] = ramps[1][ig];
|
||||
newpal[2] = ramps[2][ib];
|
||||
newpal += 3;
|
||||
}
|
||||
|
||||
VID_ShiftPalette (pal);
|
||||
}
|
||||
#else // !GLQUAKE
|
||||
void V_UpdatePalette (void)
|
||||
{
|
||||
int i, j;
|
||||
qboolean new;
|
||||
byte *basepal, *newpal;
|
||||
byte pal[768];
|
||||
int r,g,b;
|
||||
qboolean force;
|
||||
|
||||
V_CalcPowerupCshift ();
|
||||
|
||||
new = false;
|
||||
|
||||
for (i=0 ; i<NUM_CSHIFTS ; i++)
|
||||
{
|
||||
if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent)
|
||||
{
|
||||
new = true;
|
||||
cl.prev_cshifts[i].percent = cl.cshifts[i].percent;
|
||||
}
|
||||
for (j=0 ; j<3 ; j++)
|
||||
if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j])
|
||||
{
|
||||
new = true;
|
||||
cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j];
|
||||
}
|
||||
}
|
||||
|
||||
// drop the damage value
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime*150;
|
||||
if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
|
||||
|
||||
// drop the bonus value
|
||||
cl.cshifts[CSHIFT_BONUS].percent -= host_frametime*100;
|
||||
if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
|
||||
cl.cshifts[CSHIFT_BONUS].percent = 0;
|
||||
|
||||
force = V_CheckGamma ();
|
||||
if (!new && !force)
|
||||
return;
|
||||
|
||||
basepal = host_basepal;
|
||||
newpal = pal;
|
||||
|
||||
for (i=0 ; i<256 ; i++)
|
||||
{
|
||||
r = basepal[0];
|
||||
g = basepal[1];
|
||||
b = basepal[2];
|
||||
basepal += 3;
|
||||
|
||||
for (j=0 ; j<NUM_CSHIFTS ; j++)
|
||||
{
|
||||
r += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[0]-r))>>8;
|
||||
g += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[1]-g))>>8;
|
||||
b += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[2]-b))>>8;
|
||||
}
|
||||
|
||||
newpal[0] = gammatable[r];
|
||||
newpal[1] = gammatable[g];
|
||||
newpal[2] = gammatable[b];
|
||||
newpal += 3;
|
||||
}
|
||||
|
||||
VID_ShiftPalette (pal);
|
||||
}
|
||||
#endif // !GLQUAKE
|
||||
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
@ -1009,75 +797,6 @@ the entity origin, so any view position inside that will be valid
|
|||
*/
|
||||
extern vrect_t scr_vrect;
|
||||
|
||||
void V_RenderView (void)
|
||||
{
|
||||
if (con_forcedup)
|
||||
return;
|
||||
|
||||
// don't allow cheats in multiplayer
|
||||
if (cl.maxclients > 1)
|
||||
{
|
||||
Cvar_Set(scr_ofsx, "0");
|
||||
Cvar_Set(scr_ofsy, "0");
|
||||
Cvar_Set(scr_ofsz, "0");
|
||||
}
|
||||
|
||||
if (cl.intermission)
|
||||
{ // intermission / finale rendering
|
||||
V_CalcIntermissionRefdef ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!cl.paused /* && (sv.maxclients > 1 || key_dest == key_game) */ )
|
||||
V_CalcRefdef ();
|
||||
}
|
||||
|
||||
R_PushDlights ();
|
||||
|
||||
if (lcd_x->value)
|
||||
{
|
||||
//
|
||||
// render two interleaved views
|
||||
//
|
||||
int i;
|
||||
|
||||
vid.rowbytes <<= 1;
|
||||
vid.aspect *= 0.5;
|
||||
|
||||
r_refdef.viewangles[YAW] -= lcd_yaw->value;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
r_refdef.vieworg[i] -= right[i]*lcd_x->value;
|
||||
R_RenderView ();
|
||||
|
||||
vid.buffer += vid.rowbytes>>1;
|
||||
|
||||
R_PushDlights ();
|
||||
|
||||
r_refdef.viewangles[YAW] += lcd_yaw->value*2;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
r_refdef.vieworg[i] += 2*right[i]*lcd_x->value;
|
||||
R_RenderView ();
|
||||
|
||||
vid.buffer -= vid.rowbytes>>1;
|
||||
|
||||
r_refdef.vrect.height <<= 1;
|
||||
|
||||
vid.rowbytes >>= 1;
|
||||
vid.aspect *= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
R_RenderView ();
|
||||
}
|
||||
|
||||
#ifndef GLQUAKE
|
||||
if (crosshair->value)
|
||||
Draw_Character (scr_vrect.x + scr_vrect.width/2 + cl_crossx->value,
|
||||
scr_vrect.y + scr_vrect.height/2 + cl_crossy->value, '+');
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
//============================================================================
|
||||
|
||||
/*
|
165
source/sw_part.c
Normal file
165
source/sw_part.c
Normal file
|
@ -0,0 +1,165 @@
|
|||
/*
|
||||
r_part.c
|
||||
|
||||
@description@
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "r_shared.h"
|
||||
#include "r_local.h"
|
||||
#include "client.h"
|
||||
#include "server.h"
|
||||
|
||||
/*
|
||||
===============
|
||||
R_DrawParticles
|
||||
===============
|
||||
*/
|
||||
|
||||
void R_DrawParticles (void)
|
||||
{
|
||||
particle_t *p, *kill;
|
||||
float grav;
|
||||
int i;
|
||||
float time2, time3;
|
||||
float time1;
|
||||
float dvel;
|
||||
float frametime;
|
||||
|
||||
D_StartParticles ();
|
||||
|
||||
VectorScale (vright, xscaleshrink, r_pright);
|
||||
VectorScale (vup, yscaleshrink, r_pup);
|
||||
VectorCopy (vpn, r_ppn);
|
||||
|
||||
frametime = cl.time - cl.oldtime;
|
||||
time3 = frametime * 15;
|
||||
time2 = frametime * 10; // 15;
|
||||
time1 = frametime * 5;
|
||||
grav = frametime * sv_gravity->value * 0.05;
|
||||
dvel = 4*frametime;
|
||||
|
||||
for ( ;; )
|
||||
{
|
||||
kill = active_particles;
|
||||
if (kill && kill->die < cl.time)
|
||||
{
|
||||
active_particles = kill->next;
|
||||
kill->next = free_particles;
|
||||
free_particles = kill;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (p=active_particles ; p ; p=p->next)
|
||||
{
|
||||
for ( ;; )
|
||||
{
|
||||
kill = p->next;
|
||||
if (kill && kill->die < cl.time)
|
||||
{
|
||||
p->next = kill->next;
|
||||
kill->next = free_particles;
|
||||
free_particles = kill;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
D_DrawParticle (p);
|
||||
|
||||
p->org[0] += p->vel[0]*frametime;
|
||||
p->org[1] += p->vel[1]*frametime;
|
||||
p->org[2] += p->vel[2]*frametime;
|
||||
|
||||
switch (p->type)
|
||||
{
|
||||
case pt_static:
|
||||
break;
|
||||
case pt_fire:
|
||||
p->ramp += time1;
|
||||
if (p->ramp >= 6)
|
||||
p->die = -1;
|
||||
else
|
||||
p->color = ramp3[(int)p->ramp];
|
||||
p->vel[2] += grav;
|
||||
break;
|
||||
|
||||
case pt_explode:
|
||||
p->ramp += time2;
|
||||
if (p->ramp >=8)
|
||||
p->die = -1;
|
||||
else
|
||||
p->color = ramp1[(int)p->ramp];
|
||||
for (i=0 ; i<3 ; i++)
|
||||
p->vel[i] += p->vel[i]*dvel;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_explode2:
|
||||
p->ramp += time3;
|
||||
if (p->ramp >=8)
|
||||
p->die = -1;
|
||||
else
|
||||
p->color = ramp2[(int)p->ramp];
|
||||
for (i=0 ; i<3 ; i++)
|
||||
p->vel[i] -= p->vel[i]*frametime;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_blob:
|
||||
for (i=0 ; i<3 ; i++)
|
||||
p->vel[i] += p->vel[i]*dvel;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_blob2:
|
||||
for (i=0 ; i<2 ; i++)
|
||||
p->vel[i] -= p->vel[i]*dvel;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_grav:
|
||||
#ifdef QUAKE2
|
||||
p->vel[2] -= grav * 20;
|
||||
break;
|
||||
#endif
|
||||
case pt_slowgrav:
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
D_EndParticles ();
|
||||
}
|
||||
|
||||
void
|
||||
R_AddFire(vec3_t start, vec3_t end, entity_t *ent)
|
||||
{
|
||||
}
|
186
source/sw_view.c
Normal file
186
source/sw_view.c
Normal file
|
@ -0,0 +1,186 @@
|
|||
/*
|
||||
view.c
|
||||
|
||||
@description@
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "view.h"
|
||||
#include "vid.h"
|
||||
#include "console.h"
|
||||
#include "host.h"
|
||||
#include "client.h"
|
||||
#include "draw.h"
|
||||
|
||||
/*
|
||||
V_UpdatePalette
|
||||
*/
|
||||
void
|
||||
V_UpdatePalette (void)
|
||||
{
|
||||
int i, j;
|
||||
qboolean new;
|
||||
byte *basepal, *newpal;
|
||||
byte pal[768];
|
||||
int r,g,b;
|
||||
qboolean force;
|
||||
|
||||
V_CalcPowerupCshift ();
|
||||
|
||||
new = false;
|
||||
|
||||
for (i=0 ; i<NUM_CSHIFTS ; i++)
|
||||
{
|
||||
if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent)
|
||||
{
|
||||
new = true;
|
||||
cl.prev_cshifts[i].percent = cl.cshifts[i].percent;
|
||||
}
|
||||
for (j=0 ; j<3 ; j++)
|
||||
if (cl.cshifts[i].destcolor[j] != cl.prev_cshifts[i].destcolor[j])
|
||||
{
|
||||
new = true;
|
||||
cl.prev_cshifts[i].destcolor[j] = cl.cshifts[i].destcolor[j];
|
||||
}
|
||||
}
|
||||
|
||||
// drop the damage value
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent -= host_frametime*150;
|
||||
if (cl.cshifts[CSHIFT_DAMAGE].percent <= 0)
|
||||
cl.cshifts[CSHIFT_DAMAGE].percent = 0;
|
||||
|
||||
// drop the bonus value
|
||||
cl.cshifts[CSHIFT_BONUS].percent -= host_frametime*100;
|
||||
if (cl.cshifts[CSHIFT_BONUS].percent <= 0)
|
||||
cl.cshifts[CSHIFT_BONUS].percent = 0;
|
||||
|
||||
force = V_CheckGamma ();
|
||||
if (!new && !force)
|
||||
return;
|
||||
|
||||
basepal = host_basepal;
|
||||
newpal = pal;
|
||||
|
||||
for (i=0 ; i<256 ; i++)
|
||||
{
|
||||
r = basepal[0];
|
||||
g = basepal[1];
|
||||
b = basepal[2];
|
||||
basepal += 3;
|
||||
|
||||
for (j=0 ; j<NUM_CSHIFTS ; j++)
|
||||
{
|
||||
r += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[0]-r))>>8;
|
||||
g += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[1]-g))>>8;
|
||||
b += (cl.cshifts[j].percent*(cl.cshifts[j].destcolor[2]-b))>>8;
|
||||
}
|
||||
|
||||
newpal[0] = gammatable[r];
|
||||
newpal[1] = gammatable[g];
|
||||
newpal[2] = gammatable[b];
|
||||
newpal += 3;
|
||||
}
|
||||
|
||||
VID_ShiftPalette (pal);
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
V_RenderView
|
||||
|
||||
The player's clipping box goes from (-16 -16 -24) to (16 16 32) from
|
||||
the entity origin, so any view position inside that will be valid
|
||||
==================
|
||||
*/
|
||||
extern vrect_t scr_vrect;
|
||||
|
||||
void V_RenderView (void)
|
||||
{
|
||||
if (con_forcedup)
|
||||
return;
|
||||
|
||||
// don't allow cheats in multiplayer
|
||||
if (cl.maxclients > 1)
|
||||
{
|
||||
Cvar_Set(scr_ofsx, "0");
|
||||
Cvar_Set(scr_ofsy, "0");
|
||||
Cvar_Set(scr_ofsz, "0");
|
||||
}
|
||||
|
||||
if (cl.intermission)
|
||||
{ // intermission / finale rendering
|
||||
V_CalcIntermissionRefdef ();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!cl.paused /* && (sv.maxclients > 1 || key_dest == key_game) */ )
|
||||
V_CalcRefdef ();
|
||||
}
|
||||
|
||||
R_PushDlights ();
|
||||
|
||||
if (lcd_x->value)
|
||||
{
|
||||
//
|
||||
// render two interleaved views
|
||||
//
|
||||
int i;
|
||||
|
||||
vid.rowbytes <<= 1;
|
||||
vid.aspect *= 0.5;
|
||||
|
||||
r_refdef.viewangles[YAW] -= lcd_yaw->value;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
r_refdef.vieworg[i] -= right[i]*lcd_x->value;
|
||||
R_RenderView ();
|
||||
|
||||
vid.buffer += vid.rowbytes>>1;
|
||||
|
||||
R_PushDlights ();
|
||||
|
||||
r_refdef.viewangles[YAW] += lcd_yaw->value*2;
|
||||
for (i=0 ; i<3 ; i++)
|
||||
r_refdef.vieworg[i] += 2*right[i]*lcd_x->value;
|
||||
R_RenderView ();
|
||||
|
||||
vid.buffer -= vid.rowbytes>>1;
|
||||
|
||||
r_refdef.vrect.height <<= 1;
|
||||
|
||||
vid.rowbytes >>= 1;
|
||||
vid.aspect *= 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
R_RenderView ();
|
||||
}
|
||||
|
||||
if (crosshair->value)
|
||||
Draw_Character (scr_vrect.x + scr_vrect.width/2 + cl_crossx->value,
|
||||
scr_vrect.y + scr_vrect.height/2 + cl_crossy->value, '+');
|
||||
}
|
|
@ -705,7 +705,7 @@ void VID_Init(unsigned char *palette)
|
|||
snprintf(gldir, sizeof(gldir), "%s/glquake", com_gamedir);
|
||||
Sys_mkdir (gldir);
|
||||
|
||||
GL_CheckGamma (palette);
|
||||
//XXXGL_CheckGamma (palette);
|
||||
VID_SetPalette (palette);
|
||||
|
||||
// Check for 3DFX Extensions and initialize them.
|
||||
|
|
Loading…
Reference in a new issue