No more -DGLQUAKE!!!

Took me 9+ hours straight to do it, but its done!
This commit is contained in:
Zephaniah E. Hull 2000-01-22 12:54:51 +00:00
parent 2930814d25
commit 427b74299d
62 changed files with 1700 additions and 2345 deletions

View file

@ -19,6 +19,9 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef _COMMON_QUAKEDEF_H
#define _COMMON_QUAKEDEF_H
// quakedef.h -- primary header for client // quakedef.h -- primary header for client
#define QUAKE_GAME // as opposed to utilities #define QUAKE_GAME // as opposed to utilities
@ -56,15 +59,11 @@ void VID_UnlockBuffer (void);
#include "cmd.h" #include "cmd.h"
#include "sbar.h" #include "sbar.h"
#include "sound.h" #include "sound.h"
#include "render.h"
#include "client.h"
#ifdef GLQUAKE
#include "gl_model.h"
#else
#include "model.h" #include "model.h"
#include "d_iface.h" #include "d_iface.h"
#endif #include "render.h"
#include "client.h"
#include "input.h" #include "input.h"
#include "keys.h" #include "keys.h"
@ -78,9 +77,7 @@ void VID_UnlockBuffer (void);
#include "crc.h" #include "crc.h"
#include "cdaudio.h" #include "cdaudio.h"
#ifdef GLQUAKE
#include "glquake.h" #include "glquake.h"
#endif
#ifndef max #ifndef max
#define max(a,b) ((a) > (b) ? (a) : (b)) #define max(a,b) ((a) > (b) ? (a) : (b))
@ -156,3 +153,4 @@ void Host_ShutdownServer (qboolean crash);
extern qboolean msg_suppress_1; extern qboolean msg_suppress_1;
// suppresses resolution and cache size console output // suppresses resolution and cache size console output
// an fullscreen DIB focus gain/loss // an fullscreen DIB focus gain/loss
#endif // _COMMON_QUAKEDEF_H

24
common/cvars.c Normal file
View file

@ -0,0 +1,24 @@
/*
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
cvar_t gl_flashblend = {"gl_flashblend","1"};

28
common/cvars.h Normal file
View file

@ -0,0 +1,28 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef _CVARS_H
#define _CVARS_H
extert cvar_t gl_flashblend;
#endif _CVARS_H

View file

@ -21,11 +21,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// d_iface.h: interface header file for rasterization driver modules // d_iface.h: interface header file for rasterization driver modules
#ifndef _D_IFACE_H
#define _D_IFACE_H
#define WARP_WIDTH 320 #define WARP_WIDTH 320
#define WARP_HEIGHT 200 #define WARP_HEIGHT 200
#define MAX_LBM_HEIGHT 200 #define MAX_LBM_HEIGHT 200
#include "model.h"
#include "glquake.h"
typedef struct typedef struct
{ {
float u, v; float u, v;
@ -229,3 +235,4 @@ extern vrect_t scr_vrect;
extern byte *r_warpbuffer; extern byte *r_warpbuffer;
#endif // _D_IFACE_H

View file

@ -36,6 +36,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define SURFCACHE_SIZE_AT_320X200 600*1024 #define SURFCACHE_SIZE_AT_320X200 600*1024
/*
typedef struct surfcache_s typedef struct surfcache_s
{ {
struct surfcache_s *next; struct surfcache_s *next;
@ -49,6 +50,7 @@ typedef struct surfcache_s
struct texture_s *texture; // checked for animating textures struct texture_s *texture; // checked for animating textures
byte data[4]; // width*height elements byte data[4]; // width*height elements
} surfcache_t; } surfcache_t;
*/
// !!! if this is changed, it must be changed in asm_draw.h too !!! // !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct sspan_s typedef struct sspan_s

View file

@ -109,7 +109,6 @@ cvar_t gl_texsort = {"gl_texsort","1"};
cvar_t gl_smoothmodels = {"gl_smoothmodels","1"}; cvar_t gl_smoothmodels = {"gl_smoothmodels","1"};
cvar_t gl_affinemodels = {"gl_affinemodels","0"}; cvar_t gl_affinemodels = {"gl_affinemodels","0"};
cvar_t gl_polyblend = {"gl_polyblend","1"}; cvar_t gl_polyblend = {"gl_polyblend","1"};
cvar_t gl_flashblend = {"gl_flashblend","1"};
cvar_t gl_playermip = {"gl_playermip","0"}; cvar_t gl_playermip = {"gl_playermip","0"};
cvar_t gl_nocolors = {"gl_nocolors","0"}; cvar_t gl_nocolors = {"gl_nocolors","0"};
#ifdef QUAKEWORLD #ifdef QUAKEWORLD

122
common/gl_view.c Normal file
View file

@ -0,0 +1,122 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// view.c -- player eye positioning
#include "quakedef.h"
#include "r_local.h"
extern int onground;
/*
=============
V_UpdatePalette
=============
*/
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 ();
//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;
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);
}

View file

@ -21,6 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// disable data conversion warnings // disable data conversion warnings
#ifndef _GLQUAKE_H
#define _GLQUAKE_H
#if !defined(__GNUC__) && !defined(__unix) && !defined(__unix__) #if !defined(__GNUC__) && !defined(__unix) && !defined(__unix__)
#pragma warning(disable : 4244) // MIPS #pragma warning(disable : 4244) // MIPS
#pragma warning(disable : 4136) // X86 #pragma warning(disable : 4136) // X86
@ -33,6 +36,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <GL/gl.h> #include <GL/gl.h>
#include <GL/glu.h> #include <GL/glu.h>
#include "model.h"
#include "client.h"
void GL_BeginRendering (int *x, int *y, int *width, int *height); void GL_BeginRendering (int *x, int *y, int *width, int *height);
void GL_EndRendering (void); void GL_EndRendering (void);
@ -95,7 +100,7 @@ extern PROC glVertexPointerEXT;
#define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0) #define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0)
// normalizing factor so player model works out to about // normalizing factor so player model works out to about
// 1 pixel per triangle // 1 pixel per triangle
#define MAX_LBM_HEIGHT 480 //#define MAX_LBM_HEIGHT 480
#define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf #define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf
@ -125,39 +130,6 @@ typedef struct surfcache_s
} surfcache_t; } surfcache_t;
typedef struct
{
pixel_t *surfdat; // destination for generated surface
int rowbytes; // destination logical width in bytes
msurface_t *surf; // description for surface to generate
fixed8_t lightadj[MAXLIGHTMAPS];
// adjust for lightmap levels for dynamic lighting
texture_t *texture; // corrected for animating textures
int surfmip; // mipmapped ratio of surface texels / world pixels
int surfwidth; // in mipmapped texels
int surfheight; // in mipmapped texels
} drawsurf_t;
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 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;
} particle_t;
//==================================================== //====================================================
@ -184,7 +156,6 @@ extern vec3_t r_origin;
// //
extern refdef_t r_refdef; extern refdef_t r_refdef;
extern mleaf_t *r_viewleaf, *r_oldviewleaf; extern mleaf_t *r_viewleaf, *r_oldviewleaf;
extern texture_t *r_notexture_mip;
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
extern qboolean envmap; extern qboolean envmap;
@ -316,3 +287,5 @@ void GL_BuildLightmaps (void);
// //
void R_NetGraph (void); void R_NetGraph (void);
#endif #endif
#endif // _GLQUAKE_H

View file

@ -172,7 +172,6 @@ extern vec3_t r_origin;
// //
extern refdef_t r_refdef; extern refdef_t r_refdef;
extern mleaf_t *r_viewleaf, *r_oldviewleaf; extern mleaf_t *r_viewleaf, *r_oldviewleaf;
extern texture_t *r_notexture_mip;
extern int d_lightstylevalue[256]; // 8.8 fraction of base light value extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
extern qboolean envmap; extern qboolean envmap;

View file

@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// mathlib.h // mathlib.h
#ifndef _MATHLIB_H
#define _MATHLIB_H
typedef float vec_t; typedef float vec_t;
typedef vec_t vec3_t[3]; typedef vec_t vec3_t[3];
@ -91,3 +93,5 @@ void RotatePointAroundVector( vec3_t dst, const vec3_t dir, const vec3_t point,
) \ ) \
: \ : \
BoxOnPlaneSide( (emins), (emaxs), (p))) BoxOnPlaneSide( (emins), (emaxs), (p)))
#endif // _MATHLIB_H

View file

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __MODEL__ #ifndef __MODEL__
#define __MODEL__ #define __MODEL__
#include "render.h"
#include "modelgen.h" #include "modelgen.h"
#include "spritegn.h" #include "spritegn.h"
@ -137,6 +138,8 @@ typedef struct msurface_s
int firstedge; // look up in model->surfedges[], negative numbers int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges int numedges; // are backwards edges
struct surfcache_s *cachespots[MIPLEVELS];
short texturemins[2]; short texturemins[2];
short extents[2]; short extents[2];
@ -224,6 +227,7 @@ typedef struct mspriteframe_s
int width; int width;
int height; int height;
float up, down, left, right; float up, down, left, right;
byte pixels[4];
int gl_texturenum; int gl_texturenum;
} mspriteframe_t; } mspriteframe_t;
@ -263,6 +267,7 @@ Alias models are position independent, so the cache manager can move them.
typedef struct typedef struct
{ {
aliasframetype_t type;
int firstpose; int firstpose;
int numposes; int numposes;
float interval; float interval;
@ -272,6 +277,12 @@ typedef struct
char name[16]; char name[16];
} maliasframedesc_t; } maliasframedesc_t;
typedef struct
{
aliasskintype_t type;
int skin;
} maliasskindesc_t;
typedef struct typedef struct
{ {
trivertx_t bboxmin; trivertx_t bboxmin;
@ -286,6 +297,13 @@ typedef struct
maliasgroupframedesc_t frames[1]; maliasgroupframedesc_t frames[1];
} maliasgroup_t; } maliasgroup_t;
typedef struct
{
int numskins;
int intervals;
maliasskindesc_t skindescs[1];
} maliasskingroup_t;
// !!! if this is changed, it must be changed in asm_draw.h too !!! // !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct mtriangle_s { typedef struct mtriangle_s {
int facesfront; int facesfront;
@ -311,12 +329,17 @@ typedef struct {
int flags; int flags;
float size; float size;
int numposes; int numposes;
int poseverts; int poseverts;
int posedata; // numposes*poseverts trivert_t int posedata; // numposes*poseverts trivert_t
int commands; // gl command list with embedded s/t int commands; // gl command list with embedded s/t
int gl_texturenum[MAX_SKINS][4]; int gl_texturenum[MAX_SKINS][4];
maliasframedesc_t frames[1]; // variable sized int model;
int stverts;
int skindesc;
int triangles;
int texels[MAX_SKINS]; // only for player skins
maliasframedesc_t frames[1];
} aliashdr_t; } aliashdr_t;
#define MAXALIASVERTS 1024 #define MAXALIASVERTS 1024

View file

@ -38,7 +38,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef QW_SERVER #ifndef QW_SERVER
#ifndef NeXT #ifndef NeXT
#ifndef GLQUAKE
.extern C(d_zistepu) .extern C(d_zistepu)
.extern C(d_pzbuffer) .extern C(d_pzbuffer)
.extern C(d_zistepv) .extern C(d_zistepv)
@ -261,7 +260,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
.extern fp_64kx64k .extern fp_64kx64k
.extern pz .extern pz
.extern spr8entryvec_table .extern spr8entryvec_table
#endif
.extern C(snd_scaletable) .extern C(snd_scaletable)
.extern C(paintbuffer) .extern C(paintbuffer)

View file

@ -21,7 +21,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// r_local.h -- private refresh defs // r_local.h -- private refresh defs
#ifndef GLQUAKE
#include "r_shared.h" #include "r_shared.h"
@ -223,7 +222,7 @@ void R_ZDrawSubmodelPolys (model_t *clmodel);
// Alias models // Alias models
//========================================================= //=========================================================
#define MAXALIASVERTS 2000 // TODO: tune this //#define MAXALIASVERTS 2000 // TODO: tune this
#define ALIAS_Z_CLIP_PLANE 5 #define ALIAS_Z_CLIP_PLANE 5
extern int numverts; extern int numverts;
@ -316,4 +315,3 @@ void R_ClipEdge (mvertex_t *pv0, mvertex_t *pv1, clipplane_t *clip);
void R_SplitEntityOnNode2 (mnode_t *node); void R_SplitEntityOnNode2 (mnode_t *node);
void R_MarkLights (dlight_t *light, int bit, mnode_t *node); void R_MarkLights (dlight_t *light, int bit, mnode_t *node);
#endif //GLQUAKE

View file

@ -19,7 +19,6 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef GLQUAKE
// r_shared.h: general refresh-related stuff shared between the refresh and the // r_shared.h: general refresh-related stuff shared between the refresh and the
// driver // driver
@ -155,5 +154,3 @@ typedef struct edge_s
} edge_t; } edge_t;
#endif // _R_SHARED_H_ #endif // _R_SHARED_H_
#endif // GLQUAKE

View file

@ -20,6 +20,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef _RENDER_H
#define _RENDER_H
#include "vid.h"
#include "model.h"
// refresh.h -- public interface to refresh functions // refresh.h -- public interface to refresh functions
#define MAXCLIPPLANES 11 #define MAXCLIPPLANES 11
@ -118,7 +124,7 @@ extern int reinit_surfcache;
extern refdef_t r_refdef; extern refdef_t r_refdef;
extern vec3_t r_origin, vpn, vright, vup; extern vec3_t r_origin, vpn, vright, vup;
extern struct texture_s *r_notexture_mip; extern struct texture_s *r_notexture_mip;
extern entity_t r_worldentity; extern entity_t r_worldentity;
@ -169,3 +175,4 @@ void R_InitParticles (void);
void R_ClearParticles (void); void R_ClearParticles (void);
void R_DrawParticles (void); void R_DrawParticles (void);
void R_DrawWaterSurfaces (void); void R_DrawWaterSurfaces (void);
#endif // _RENDER_H

View file

@ -251,9 +251,7 @@ void Skin_NextDownload (void)
if (!sc->name[0]) if (!sc->name[0])
continue; continue;
Skin_Cache (sc->skin); Skin_Cache (sc->skin);
#ifdef GLQUAKE
sc->skin = NULL; sc->skin = NULL;
#endif
} }
if (cls.state != ca_active) if (cls.state != ca_active)

View file

@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// snd_dma.c -- main control for any streaming sound output device // snd_dma.c -- main control for any streaming sound output device
#include "quakedef.h" #include "quakedef.h"
#include "model.h"
#ifdef _WIN32 #ifdef _WIN32
#include "winquake.h" #include "winquake.h"

160
common/sw_rpart.c Normal file
View file

@ -0,0 +1,160 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Portions Copyright (C) 1999,2000 Nelson Rush.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#include "r_local.h"
#include "d_iface.h"
#include "glquake.h"
extern particle_t *active_particles, *free_particles;
extern int ramp1[8], ramp2[8], ramp3[8];
/*
===============
R_DrawParticles
===============
*/
extern cvar_t sv_gravity;
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);
#ifdef QUAKEWORLD
frametime = host_frametime;
#else
frametime = cl.time - cl.oldtime;
#endif
time3 = frametime * 15;
time2 = frametime * 10; // 15;
time1 = frametime * 5;
#ifdef QUAKEWORLD
grav = frametime * 800 * 0.05;
#else
grav = frametime * sv_gravity.value * 0.05;
#endif
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_slowgrav:
case pt_grav:
p->vel[2] -= grav;
break;
}
}
D_EndParticles ();
}

101
common/sw_view.c Normal file
View file

@ -0,0 +1,101 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// view.c -- player eye positioning
#include "quakedef.h"
#include "r_local.h"
extern int onground;
/*
=============
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);
}

View file

@ -25,6 +25,7 @@
USA. USA.
*/ */
#include "quakedef.h"
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <limits.h> #include <limits.h>
@ -42,7 +43,6 @@
#include <sys/mman.h> #include <sys/mman.h>
#include <sys/stat.h> #include <sys/stat.h>
#include "quakedef.h"
#ifndef QUAKEWORLD #ifndef QUAKEWORLD
qboolean isDedicated; qboolean isDedicated;
@ -282,11 +282,7 @@ int main (int c, char **v) {
parms.argc = com_argc; parms.argc = com_argc;
parms.argv = com_argv; parms.argv = com_argv;
#ifdef GLQUAKE
parms.memsize = 16*1024*1024; parms.memsize = 16*1024*1024;
#else
parms.memsize = 8*1024*1024;
#endif
j = COM_CheckParm("-mem"); j = COM_CheckParm("-mem");
if (j) if (j)

View file

@ -21,6 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// vid.h -- video driver defs // vid.h -- video driver defs
#ifndef _VID_H
#define _VID_H
#define VID_CBITS 6 #define VID_CBITS 6
#define VID_GRADES (1 << VID_CBITS) #define VID_GRADES (1 << VID_CBITS)
@ -93,7 +96,6 @@ void VID_ExtraOptionDraw(unsigned int);
void VID_ExtraOptionCmd(int options_cursor); void VID_ExtraOptionCmd(int options_cursor);
// commands for the extra menu options of the target // commands for the extra menu options of the target
#ifdef GLQUAKE
qboolean VID_Is8bit(void); qboolean VID_Is8bit(void);
#endif
#endif // _VID_H

View file

@ -32,4 +32,5 @@ void V_Init (void);
void V_RenderView (void); void V_RenderView (void);
float V_CalcRoll (vec3_t angles, vec3_t velocity); float V_CalcRoll (vec3_t angles, vec3_t velocity);
void V_UpdatePalette (void); void V_UpdatePalette (void);
void V_CalcPowerupCshift (void);
qboolean V_CheckGamma (void);

View file

@ -19,6 +19,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef _ZONE_H
#define _ZONE_H
/* /*
memory allocation memory allocation
@ -131,3 +135,4 @@ void Cache_Report (void);
#endif // _ZONE_H

View file

@ -53,6 +53,8 @@ MAKE_SURE_DIR = if test -d "$(BUILD_DIR)/$$DIR"; \
# Client targets # Client targets
# #
COMMON_LIB=common_lib.a
ifeq ($(HAS_OGL),yes) ifeq ($(HAS_OGL),yes)
GLQUAKE =$(BIN_PREFIX)-gl GLQUAKE =$(BIN_PREFIX)-gl
endif endif
@ -90,7 +92,8 @@ endif
soft_targets = $(X11QUAKE) $(SVGAQUAKE) $(GGIQUAKE) $(SDLQUAKE) $(MGLQUAKE) soft_targets = $(X11QUAKE) $(SVGAQUAKE) $(GGIQUAKE) $(SDLQUAKE) $(MGLQUAKE)
gl_targets = $(GLQUAKE) $(TDFXQUAKE) gl_targets = $(GLQUAKE) $(TDFXQUAKE)
targets = $(gl_targets) $(soft_targets) lib_targets = $(COMMON_LIB)
targets = $(lib_targets) $(gl_targets) $(soft_targets)
CLEAN_TARGETS = $(patsubst %,clean-%, $(targets)) CLEAN_TARGETS = $(patsubst %,clean-%, $(targets))
.PHONY: $(targets) $(CLEAN_TARGETS) clean-soft clean-gl .PHONY: $(targets) $(CLEAN_TARGETS) clean-soft clean-gl
@ -157,13 +160,13 @@ QW_NET_SRC = net_udp.c net_com.c mdfour.c
# Common source files # Common source files
MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c \ MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c \
wad.c zone.c wad.c zone.c cvars.c
# GL renderer source # GL renderer source
GL_REND_SRC = gl_screen.c gl_model.c gl_draw.c gl_mesh.c gl_refrag.c \ GL_REND_SRC = gl_screen.c gl_model.c gl_draw.c gl_mesh.c gl_refrag.c \
gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_warp.c \ gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_warp.c \
nonintel.c gl_ngraph.c nonintel.c gl_ngraph.c gl_view.c gl_rpart.c gl_cl_parse.c
# gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_test.c gl_warp.c # gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_test.c gl_warp.c
# Software renderer source # Software renderer source
@ -172,7 +175,7 @@ SW_REND_SRC = screen.c $(SWREND_SRC_PLAT) draw.c \
d_edge.c d_fill.c d_init.c d_modech.c d_part.c d_polyse.c d_scan.c \ 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 r_aclip.c r_alias.c \ d_sky.c d_sprite.c d_surf.c d_vars.c d_zpoint.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_bsp.c r_draw.c r_edge.c r_efrag.c r_light.c r_main.c r_misc.c \
r_sky.c r_sprite.c r_surf.c r_vars.c r_sky.c r_sprite.c r_surf.c r_vars.c sw_view.c sw_rpart.c sw_cl_parse.c
# Client source files # Client source files
@ -213,6 +216,23 @@ GENERAL_SRC = $(CL_COMMON_SRC) \
# Compilation rules # Compilation rules
# #
# Common lib targets.
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/common_lib/%.o: $(QW_COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
# Software targets # Software targets
soft_DIR: soft_DIR:
@DIR=soft; $(MAKE_SURE_DIR) @DIR=soft; $(MAKE_SURE_DIR)
@ -257,14 +277,28 @@ $(BUILD_DIR)/gl/%.o: $(QW_COMMON_DIR)/%.c
# Specific target rules # Specific target rules
# #
# Lib Software targets
ALL_COMMON_LIB_OBJS = $(patsubst %,$(BUILD_DIR)/common_lib/%,$(addsuffix \
.@OBJEXT@, $(basename $(GENERAL_SRC) .c .s)))
common_lib_DIR:
@DIR=common_lib; $(MAKE_SURE_DIR)
$(COMMON_LIB): common_lib_DIR $(BUILD_DIR)/common_lib.a
$(BUILD_DIR)/common_lib.a: $(ALL_COMMON_LIB_OBJS)
ar cru $@ $(ALL_COMMON_LIB_OBJS)
ranlib $@
# X11 Software target # X11 Software target
ifneq ($(X11QUAKE),) ifneq ($(X11QUAKE),)
ALL_X11_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) @X11_VID_SRC@\ ALL_X11_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) @X11_VID_SRC@\
model.c model.c
ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_X11_SRC) .c .s))) $(basename $(ALL_X11_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
X11_CFLAGS = -DX11 @X_CFLAGS@ X11_CFLAGS = -DX11 @X_CFLAGS@
X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@ X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@
@ -288,10 +322,11 @@ endif
# SVGALib software target # SVGALib software target
ifneq ($(SVGAQUAKE),) ifneq ($(SVGAQUAKE),)
ALL_SVGA_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) \ ALL_SVGA_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) \
vid_svgalib.c in_svgalib.c d_copy.s model.c vid_svgalib.c in_svgalib.c d_copy.s model.c
ALL_SVGA_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ ALL_SVGA_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_SVGA_SRC) .c .s))) $(basename $(ALL_SVGA_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
SVGA_CFLAGS = @SVGA_CFLAGS@ SVGA_CFLAGS = @SVGA_CFLAGS@
SVGA_LDFLAGS = @SVGA_LIBS@ SVGA_LDFLAGS = @SVGA_LIBS@
@ -316,10 +351,11 @@ endif
ifneq ($(GGIQUAKE),) ifneq ($(GGIQUAKE),)
# Map the list of source files into a list of object files # Map the list of source files into a list of object files
ALL_GGI_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_ggi.c\ ALL_GGI_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_ggi.c\
model.c model.c
ALL_GGI_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ ALL_GGI_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_GGI_SRC) .c .s))) $(basename $(ALL_GGI_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
GGI_SRC = vid_ggi.c GGI_SRC = vid_ggi.c
GGI_CFLAGS = -DGGI @GGI_CFLAGS@ GGI_CFLAGS = -DGGI @GGI_CFLAGS@
@ -339,10 +375,11 @@ endif
# SDL software target # SDL software target
ifneq ($(SDLQUAKE),) ifneq ($(SDLQUAKE),)
ALL_SDL_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(SDL_SRC) vid_sdl.c cd_sdl.c\ ALL_SDL_SRC = $(SW_REND_SRC) $(SDL_SRC) vid_sdl.c cd_sdl.c\
model.c model.c
ALL_SDL_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ ALL_SDL_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_SDL_SRC) .c .s))) $(basename $(ALL_SDL_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
SDL_CFLAGS = @SDL_CFLAGS@ -DSDL SDL_CFLAGS = @SDL_CFLAGS@ -DSDL
SDL_LDFLAGS = @SDL_LIBS@ SDL_LDFLAGS = @SDL_LIBS@
@ -366,10 +403,11 @@ endif
ifneq ($(MGLQUAKE),) ifneq ($(MGLQUAKE),)
# Map the list of source files into a list of object files # Map the list of source files into a list of object files
ALL_MGL_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) \ ALL_MGL_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) \
vid_win.c in_win.c model.c vid_win.c in_win.c model.c
ALL_MGL_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ ALL_MGL_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_MGL_SRC) .c .s))) $(basename $(ALL_MGL_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
MGL_CFLAGS = -DMGL @MGL_CFLAGS@ MGL_CFLAGS = -DMGL @MGL_CFLAGS@
MGL_LDFLAGS = @MGL_LIBS@ -lm MGL_LDFLAGS = @MGL_LIBS@ -lm
@ -388,12 +426,13 @@ endif
# X11 GL target # X11 GL target
ifneq ($(GLQUAKE),) ifneq ($(GLQUAKE),)
ALL_GL_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(GL_REND_SRC) \ ALL_GL_SRC = $(CD_AUDIO_SRC) $(GL_REND_SRC) \
gl_vidglx.c dga_check.c gl_vidglx.c dga_check.c
ALL_GL_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\ ALL_GL_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_GL_SRC) .c .s))) $(basename $(ALL_GL_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
GL_CFLAGS = -DGLQUAKE @OGL_CFLAGS@ GL_CFLAGS = @OGL_CFLAGS@
GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@ @DGA_LIBS@ @DYN_LIBS@ GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@ @DGA_LIBS@ @DYN_LIBS@
$(BUILD_DIR)/gl/gl_vidglx.o: $(COMMON_DIR)/gl_vidglx.c $(BUILD_DIR)/gl/gl_vidglx.o: $(COMMON_DIR)/gl_vidglx.c
@ -414,12 +453,13 @@ endif
# 3Dfx GL MCD target # 3Dfx GL MCD target
ifneq ($(TDFXQUAKE),) ifneq ($(TDFXQUAKE),)
ALL_TDFX_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(GL_REND_SRC) \ ALL_TDFX_SRC = $(CD_AUDIO_SRC) $(GL_REND_SRC) \
gl_vidlinux_3dfx.c in_svgalib.c gl_vidlinux_3dfx.c in_svgalib.c
ALL_TDFX_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\ ALL_TDFX_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_TDFX_SRC) .c .s))) $(basename $(ALL_TDFX_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
TDFX_CFLAGS = -DGLQUAKE @OGL_CFLAGS@ @GLIDE_CFLAGS@ TDFX_CFLAGS = @OGL_CFLAGS@ @GLIDE_CFLAGS@
TDFX_LDFLAGS = @SVGA_LIBS@ @TDFXGL_LIBS@ TDFX_LDFLAGS = @SVGA_LIBS@ @TDFXGL_LIBS@
$(BUILD_DIR)/gl/gl_vidlinux_3dfx.@OBJEXT@: $(COMMON_DIR)/gl_vidlinux_3dfx.c $(BUILD_DIR)/gl/gl_vidlinux_3dfx.@OBJEXT@: $(COMMON_DIR)/gl_vidlinux_3dfx.c
@ -445,10 +485,10 @@ distclean: clean
$(CLEAN_TARGETS): $(CLEAN_TARGETS):
rm -f $(BUILD_DIR)/../$(subst clean-,,$@) rm -f $(BUILD_DIR)/../$(subst clean-,,$@)
clean-soft clean-gl: clean-soft clean-gl clean-common_lib:
rm -rf $(BUILD_DIR)/$(subst clean-,,$@) rm -rf $(BUILD_DIR)/$(subst clean-,,$@)
clean: clean-soft clean-gl $(CLEAN_TARGETS) clean: clean-soft clean-gl clean-common_lib $(CLEAN_TARGETS)
-rmdir $(BUILD_DIR) -rmdir $(BUILD_DIR)
install: $(targets) install: $(targets)

View file

@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "quakedef.h" #include "quakedef.h"
#include "pmove_simple.h"
void CL_FinishTimeDemo (void); void CL_FinishTimeDemo (void);

View file

@ -815,9 +815,7 @@ void CL_LinkPlayers (void)
continue; // not present this frame continue; // not present this frame
// spawn light flashes, even ones coming from invisible objects // spawn light flashes, even ones coming from invisible objects
#ifdef GLQUAKE
if (!gl_flashblend.value || j != cl.playernum) { if (!gl_flashblend.value || j != cl.playernum) {
#endif
if ((state->effects & (EF_BLUE | EF_RED)) == (EF_BLUE | EF_RED)) if ((state->effects & (EF_BLUE | EF_RED)) == (EF_BLUE | EF_RED))
CL_NewDlight (j, state->origin[0], state->origin[1], state->origin[2], 200 + (rand()&31), 0.1, 3); CL_NewDlight (j, state->origin[0], state->origin[1], state->origin[2], 200 + (rand()&31), 0.1, 3);
else if (state->effects & EF_BLUE) else if (state->effects & EF_BLUE)
@ -828,9 +826,7 @@ void CL_LinkPlayers (void)
CL_NewDlight (j, state->origin[0], state->origin[1], state->origin[2] + 16, 400 + (rand()&31), 0.1, 0); CL_NewDlight (j, state->origin[0], state->origin[1], state->origin[2] + 16, 400 + (rand()&31), 0.1, 0);
else if (state->effects & EF_DIMLIGHT) else if (state->effects & EF_DIMLIGHT)
CL_NewDlight (j, state->origin[0], state->origin[1], state->origin[2], 200 + (rand()&31), 0.1, 0); CL_NewDlight (j, state->origin[0], state->origin[1], state->origin[2], 200 + (rand()&31), 0.1, 0);
#ifdef GLQUAKE
} }
#endif
// the player object never gets added // the player object never gets added
if (j == cl.playernum) if (j == cl.playernum)

View file

@ -26,6 +26,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
#include "winquake.h" #include "winquake.h"
#include "pmove_simple.h"
#ifdef __sun #ifdef __sun
/* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */ /* Sun's model_t in sys/model.h conflicts w/ Quake's model_t */

View file

@ -23,6 +23,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// cl_parse.c -- parse a message received from the server // cl_parse.c -- parse a message received from the server
#include "quakedef.h" #include "quakedef.h"
#include "model.h"
#include "pmove.h"
#include "glquake.h"
char *svc_strings[] = char *svc_strings[] =
{ {
@ -865,71 +868,6 @@ void CL_ParseClientdata (void)
} }
} }
/*
=====================
CL_NewTranslation
=====================
*/
void CL_NewTranslation (int slot)
{
#ifdef GLQUAKE
if (slot > MAX_CLIENTS)
Sys_Error ("CL_NewTranslation: slot > MAX_CLIENTS");
R_TranslatePlayerSkin(slot);
#else
int i, j;
int top, bottom;
byte *dest, *source;
player_info_t *player;
char s[512];
if (slot > MAX_CLIENTS)
Sys_Error ("CL_NewTranslation: slot > MAX_CLIENTS");
player = &cl.players[slot];
strcpy(s, Info_ValueForKey(player->userinfo, "skin"));
COM_StripExtension(s, s);
if (player->skin && !stricmp(s, player->skin->name))
player->skin = NULL;
if (player->_topcolor != player->topcolor ||
player->_bottomcolor != player->bottomcolor || !player->skin) {
player->_topcolor = player->topcolor;
player->_bottomcolor = player->bottomcolor;
dest = player->translations;
source = vid.colormap;
memcpy (dest, vid.colormap, sizeof(player->translations));
top = player->topcolor;
if (top > 13 || top < 0)
top = 13;
top *= 16;
bottom = player->bottomcolor;
if (bottom > 13 || bottom < 0)
bottom = 13;
bottom *= 16;
for (i=0 ; i<VID_GRADES ; i++, dest += 256, source+=256)
{
if (top < 128) // the artists made some backwards ranges. sigh.
memcpy (dest + TOP_RANGE, source + top, 16);
else
for (j=0 ; j<16 ; j++)
dest[TOP_RANGE+j] = source[top+15-j];
if (bottom < 128)
memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
else
for (j=0 ; j<16 ; j++)
dest[BOTTOM_RANGE+j] = source[bottom+15-j];
}
}
#endif
}
/* /*
============== ==============
CL_UpdateUserinfo CL_UpdateUserinfo
@ -1064,11 +1002,9 @@ void CL_MuzzleFlash (void)
if ((unsigned)(i-1) >= MAX_CLIENTS) if ((unsigned)(i-1) >= MAX_CLIENTS)
return; return;
#ifdef GLQUAKE
// don't draw our own muzzle flash in gl if flashblending // don't draw our own muzzle flash in gl if flashblending
if (i-1 == cl.playernum && gl_flashblend.value) if (i-1 == cl.playernum && gl_flashblend.value)
return; return;
#endif
pl = &cl.frames[parsecountmod].playerstate[i-1]; pl = &cl.frames[parsecountmod].playerstate[i-1];

View file

@ -22,6 +22,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// cl_tent.c -- client side temporary entities // cl_tent.c -- client side temporary entities
#include "quakedef.h" #include "quakedef.h"
#include "model.h"
#define MAX_BEAMS 8 #define MAX_BEAMS 8

41
qw_client/gl_cl_parse.c Normal file
View file

@ -0,0 +1,41 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Portions Copyright (C) 1999,2000 Nelson Rush.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cl_parse.c -- parse a message received from the server
#include "quakedef.h"
#include "model.h"
#include "pmove.h"
#include "glquake.h"
/*
=====================
CL_NewTranslation
=====================
*/
void CL_NewTranslation (int slot)
{
if (slot > MAX_CLIENTS)
Sys_Error ("CL_NewTranslation: slot > MAX_CLIENTS");
R_TranslatePlayerSkin(slot);
}

View file

@ -1283,26 +1283,35 @@ void * Mod_LoadAliasFrame (void * pin, maliasframedesc_t *frame)
int i; int i;
daliasframe_t *pdaliasframe; daliasframe_t *pdaliasframe;
printf("pheader->numverts: %d\n", pheader->numverts);
pdaliasframe = (daliasframe_t *)pin; pdaliasframe = (daliasframe_t *)pin;
strcpy (frame->name, pdaliasframe->name); strcpy (frame->name, pdaliasframe->name);
frame->firstpose = posenum; frame->firstpose = posenum;
frame->numposes = 1; frame->numposes = 1;
printf("pheader->numverts: %d\n", pheader->numverts);
for (i=0 ; i<3 ; i++) for (i=0 ; i<3 ; i++)
{ {
// these are byte values, so we don't have to worry about // these are byte values, so we don't have to worry about
// endianness // endianness
frame->bboxmin.v[i] = pdaliasframe->bboxmin.v[i]; frame->bboxmin.v[i] = pdaliasframe->bboxmin.v[i];
printf("1 pheader->numverts: %d\n", pheader->numverts);
frame->bboxmin.v[i] = pdaliasframe->bboxmax.v[i]; frame->bboxmin.v[i] = pdaliasframe->bboxmax.v[i];
printf("2 pheader->numverts: %d\n", pheader->numverts);
} }
printf("pheader->numverts: %d\n", pheader->numverts);
pinframe = (trivertx_t *)(pdaliasframe + 1); pinframe = (trivertx_t *)(pdaliasframe + 1);
printf("pinframe: %p, ", pinframe);
poseverts[posenum] = pinframe; poseverts[posenum] = pinframe;
posenum++; posenum++;
pinframe += pheader->numverts; pinframe += pheader->numverts;
printf("pinframe: %p, ", pinframe);
printf("pheader: %p, ", pheader);
printf("pheader->numverts: %d\n", pheader->numverts);
return (void *)pinframe; return (void *)pinframe;
} }
@ -1649,10 +1658,15 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
posenum = 0; posenum = 0;
pframetype = (daliasframetype_t *)&pintriangles[pheader->numtris]; pframetype = (daliasframetype_t *)&pintriangles[pheader->numtris];
printf("loadmodel->name: '%s'\n", loadmodel->name);
for (i=0 ; i<numframes ; i++) for (i=0 ; i<numframes ; i++)
{ {
aliasframetype_t frametype; aliasframetype_t frametype;
printf("i: %d, pframetype: %p, pframetype->type: %d\n", i, pframetype,
pframetype->type);
frametype = LittleLong (pframetype->type); frametype = LittleLong (pframetype->type);
if (frametype == ALIAS_SINGLE) if (frametype == ALIAS_SINGLE)
@ -1666,6 +1680,7 @@ void Mod_LoadAliasModel (model_t *mod, void *buffer)
Mod_LoadAliasGroup (pframetype + 1, &pheader->frames[i]); Mod_LoadAliasGroup (pframetype + 1, &pheader->frames[i]);
} }
} }
printf("Done\n");
pheader->numposes = posenum; pheader->numposes = posenum;

190
qw_client/gl_rpart.c Normal file
View file

@ -0,0 +1,190 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Portions Copyright (C) 1999,2000 Nelson Rush.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#include "r_local.h"
#include "d_iface.h"
#include "glquake.h"
extern particle_t *active_particles, *free_particles;
extern int ramp1[8], ramp2[8], ramp3[8];
/*
===============
R_DrawParticles
===============
*/
void R_DrawParticles (void)
{
particle_t *p, *kill;
float grav;
int i;
float time2, time3;
float time1;
float dvel;
float frametime;
unsigned char *at;
unsigned char theAlpha;
vec3_t up, right;
float scale;
qboolean alphaTestEnabled;
GL_Bind(particletexture);
alphaTestEnabled = glIsEnabled(GL_ALPHA_TEST);
if (alphaTestEnabled)
glDisable(GL_ALPHA_TEST);
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;
time3 = frametime * 15;
time2 = frametime * 10; // 15;
time1 = frametime * 5;
grav = frametime * 800 * 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;
}
// 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;
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;
glColor4ub (*at, *(at+1), *(at+2), theAlpha);
// glColor3ubv (at);
// 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);
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_slowgrav:
case pt_grav:
p->vel[2] -= grav;
break;
}
}
glEnd ();
glDisable (GL_BLEND);
if (alphaTestEnabled)
glEnable(GL_ALPHA_TEST);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}

View file

@ -24,6 +24,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
#include "r_local.h" #include "r_local.h"
#include "d_iface.h"
#include "glquake.h"
#define MAX_PARTICLES 2048 // default max # of particles at one #define MAX_PARTICLES 2048 // default max # of particles at one
// time // time
#define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter what's #define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter what's
@ -440,179 +443,3 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type)
VectorAdd (start, vec, start); VectorAdd (start, vec, start);
} }
} }
/*
===============
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
unsigned char *at;
unsigned char theAlpha;
vec3_t up, right;
float scale;
qboolean alphaTestEnabled;
GL_Bind(particletexture);
alphaTestEnabled = glIsEnabled(GL_ALPHA_TEST);
if (alphaTestEnabled)
glDisable(GL_ALPHA_TEST);
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 = host_frametime;
time3 = frametime * 15;
time2 = frametime * 10; // 15;
time1 = frametime * 5;
grav = frametime * 800 * 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;
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;
glColor4ub (*at, *(at+1), *(at+2), theAlpha);
// glColor3ubv (at);
// 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_slowgrav:
case pt_grav:
p->vel[2] -= grav;
break;
}
}
#ifdef GLQUAKE
glEnd ();
glDisable (GL_BLEND);
if (alphaTestEnabled)
glEnable(GL_ALPHA_TEST);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
#else
D_EndParticles ();
#endif
}

View file

@ -832,7 +832,6 @@ void Sbar_Draw (void)
else if (sb_showteamscores) else if (sb_showteamscores)
Sbar_TeamOverlay(); Sbar_TeamOverlay();
#ifdef GLQUAKE
if (sb_showscores || sb_showteamscores || if (sb_showscores || sb_showteamscores ||
cl.stats[STAT_HEALTH] <= 0) cl.stats[STAT_HEALTH] <= 0)
sb_updates = 0; sb_updates = 0;
@ -850,7 +849,6 @@ void Sbar_Draw (void)
#endif #endif
if (vid.width > 320 && !headsup) if (vid.width > 320 && !headsup)
Draw_TileClear (320, vid.height - sb_lines, vid.width - 320, sb_lines); Draw_TileClear (320, vid.height - sb_lines, vid.width - 320, sb_lines);
#endif
if (sb_lines > 0) if (sb_lines > 0)
Sbar_MiniDeathmatchOverlay (); Sbar_MiniDeathmatchOverlay ();

85
qw_client/sw_cl_parse.c Normal file
View file

@ -0,0 +1,85 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Portions Copyright (C) 1999,2000 Nelson Rush.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cl_parse.c -- parse a message received from the server
#include "quakedef.h"
#include "model.h"
#include "pmove.h"
#include "glquake.h"
/*
=====================
CL_NewTranslation
=====================
*/
void CL_NewTranslation (int slot)
{
int i, j;
int top, bottom;
byte *dest, *source;
player_info_t *player;
char s[512];
if (slot > MAX_CLIENTS)
Sys_Error ("CL_NewTranslation: slot > MAX_CLIENTS");
player = &cl.players[slot];
strcpy(s, Info_ValueForKey(player->userinfo, "skin"));
COM_StripExtension(s, s);
if (player->skin && !stricmp(s, player->skin->name))
player->skin = NULL;
if (player->_topcolor != player->topcolor ||
player->_bottomcolor != player->bottomcolor || !player->skin) {
player->_topcolor = player->topcolor;
player->_bottomcolor = player->bottomcolor;
dest = player->translations;
source = vid.colormap;
memcpy (dest, vid.colormap, sizeof(player->translations));
top = player->topcolor;
if (top > 13 || top < 0)
top = 13;
top *= 16;
bottom = player->bottomcolor;
if (bottom > 13 || bottom < 0)
bottom = 13;
bottom *= 16;
for (i=0 ; i<VID_GRADES ; i++, dest += 256, source+=256)
{
if (top < 128) // the artists made some backwards ranges. sigh.
memcpy (dest + TOP_RANGE, source + top, 16);
else
for (j=0 ; j<16 ; j++)
dest[TOP_RANGE+j] = source[top+15-j];
if (bottom < 128)
memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
else
for (j=0 ; j<16 ; j++)
dest[BOTTOM_RANGE+j] = source[bottom+15-j];
}
}
}

View file

@ -24,6 +24,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
#include "r_local.h" #include "r_local.h"
extern int onground;
/* /*
The view is allowed to move slightly from it's true position for bobbing, The view is allowed to move slightly from it's true position for bobbing,
@ -61,9 +63,7 @@ cvar_t crosshaircolor = {"crosshaircolor", "79", true};
cvar_t cl_crossx = {"cl_crossx", "0", true}; cvar_t cl_crossx = {"cl_crossx", "0", true};
cvar_t cl_crossy = {"cl_crossy", "0", true}; cvar_t cl_crossy = {"cl_crossy", "0", true};
#ifdef GLQUAKE
cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100", false}; cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100", false};
#endif
cvar_t v_contentblend = {"v_contentblend", "1", false}; cvar_t v_contentblend = {"v_contentblend", "1", false};
@ -269,10 +269,8 @@ cvar_t v_gamma = {"gamma", "1", true};
byte gammatable[256]; // palette is sent through this byte gammatable[256]; // palette is sent through this
#ifdef GLQUAKE
byte ramps[3][256]; byte ramps[3][256];
float v_blend[4]; // rgba 0.0 - 1.0 float v_blend[4]; // rgba 0.0 - 1.0
#endif // GLQUAKE
void BuildGammaTable (float g) void BuildGammaTable (float g)
{ {
@ -490,7 +488,6 @@ void V_CalcPowerupCshift (void)
V_CalcBlend V_CalcBlend
============= =============
*/ */
#ifdef GLQUAKE
void V_CalcBlend (void) void V_CalcBlend (void)
{ {
float r, g, b, a, a2; float r, g, b, a, a2;
@ -528,177 +525,6 @@ void V_CalcBlend (void)
if (v_blend[3] < 0) if (v_blend[3] < 0)
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 ();
//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;
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
/*
=============
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);
}
#endif // !GLQUAKE
/* /*
============================================================================== ==============================================================================
@ -1016,11 +842,8 @@ cl.simangles[ROLL] = 0; // FIXME @@@
R_PushDlights (); R_PushDlights ();
R_RenderView (); R_RenderView ();
#ifndef GLQUAKE
if (crosshair.value) if (crosshair.value)
Draw_Crosshair(); Draw_Crosshair();
#endif
} }
//============================================================================ //============================================================================
@ -1053,9 +876,7 @@ void V_Init (void)
Cvar_RegisterVariable (&crosshair); Cvar_RegisterVariable (&crosshair);
Cvar_RegisterVariable (&cl_crossx); Cvar_RegisterVariable (&cl_crossx);
Cvar_RegisterVariable (&cl_crossy); Cvar_RegisterVariable (&cl_crossy);
#ifdef GLQUAKE
Cvar_RegisterVariable (&gl_cshiftpercent); Cvar_RegisterVariable (&gl_cshiftpercent);
#endif
Cvar_RegisterVariable (&cl_rollspeed); Cvar_RegisterVariable (&cl_rollspeed);
Cvar_RegisterVariable (&cl_rollangle); Cvar_RegisterVariable (&cl_rollangle);

View file

@ -23,6 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
// defs common to client and server // defs common to client and server
#ifndef _BOTHDEFS_H
#define _BOTHDEFS_H
#if (defined(_M_IX86) || defined(__i386__)) #if (defined(_M_IX86) || defined(__i386__))
#define id386 1 #define id386 1
@ -154,3 +156,4 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define PRINT_HIGH 2 // critical messages #define PRINT_HIGH 2 // critical messages
#define PRINT_CHAT 3 // chat messages #define PRINT_CHAT 3 // chat messages
#endif // _BOTHDEFS_H

View file

@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef _BSPFILE_H
#define _BSPFILE_H
// upper design bounds // upper design bounds
@ -271,3 +273,5 @@ void WriteBSPFile (char *filename);
void PrintBSPFileSizes (void); void PrintBSPFileSizes (void);
#endif #endif
#endif // _BSPFILE_H

View file

@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// client.h // client.h
#ifndef _CLIENT_H
#define _CLIENT_H
typedef struct typedef struct
{ {
@ -515,3 +517,5 @@ void Skin_NextDownload (void);
#define RSSHOT_WIDTH 320 #define RSSHOT_WIDTH 320
#define RSSHOT_HEIGHT 200 #define RSSHOT_HEIGHT 200
#endif // _CLIENT_H

View file

@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef _CMD_H
#define _CMD_H
// cmd.h -- Command buffer and command execution // cmd.h -- Command buffer and command execution
//=========================================================================== //===========================================================================
@ -107,3 +110,5 @@ void Cmd_ForwardToServer (void);
// so when they are typed in at the console, they will need to be forwarded. // so when they are typed in at the console, they will need to be forwarded.
void Cmd_StuffCmds_f (void); void Cmd_StuffCmds_f (void);
#endif // _CMD_H

View file

@ -21,6 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// comndef.h -- general definitions // comndef.h -- general definitions
#ifndef _COMMON_H
#define _COMMON_H
#include <bothdefs.h> #include <bothdefs.h>
#include <register_check.h> #include <register_check.h>
@ -220,3 +223,5 @@ unsigned Com_BlockChecksum (void *buffer, int length);
void Com_BlockFullChecksum (void *buffer, int len, unsigned char *outbuf); void Com_BlockFullChecksum (void *buffer, int len, unsigned char *outbuf);
byte COM_BlockSequenceCheckByte (byte *base, int length, int sequence, unsigned mapchecksum); byte COM_BlockSequenceCheckByte (byte *base, int length, int sequence, unsigned mapchecksum);
byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence); byte COM_BlockSequenceCRCByte (byte *base, int length, int sequence);
#endif // _COMMON_H

View file

@ -20,6 +20,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef _CONSOLE_H
#define _CONSOLE_H
// //
// console // console
// //
@ -60,3 +63,4 @@ void Con_ToggleConsole_f (void);
void Con_NotifyBox (char *text); // during startup for sound / cd warnings void Con_NotifyBox (char *text); // during startup for sound / cd warnings
#endif // _CONSOLE_H

View file

@ -21,6 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// cvar.h // cvar.h
#ifndef _CVAR_H
#define _CVAR_H
/* /*
cvar_t variables are used to hold scalar or string variables that can be changed or displayed at the console or prog code as well as accessed directly cvar_t variables are used to hold scalar or string variables that can be changed or displayed at the console or prog code as well as accessed directly
@ -96,3 +99,4 @@ void Cvar_WriteVariables (FILE *f);
cvar_t *Cvar_FindVar (char *var_name); cvar_t *Cvar_FindVar (char *var_name);
extern cvar_t *cvar_vars; extern cvar_t *cvar_vars;
#endif // _CVAR_H

View file

@ -1,404 +0,0 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MODEL__
#define __MODEL__
#include "modelgen.h"
#include "spritegn.h"
/*
d*_t structures are on-disk representations
m*_t structures are in-memory
*/
// entity effects
#define EF_BRIGHTFIELD 1
#define EF_MUZZLEFLASH 2
#define EF_BRIGHTLIGHT 4
#define EF_DIMLIGHT 8
#define EF_FLAG1 16
#define EF_FLAG2 32
#define EF_BLUE 64
#define EF_RED 128
/*
==============================================================================
BRUSH MODELS
==============================================================================
*/
//
// in memory representation
//
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct
{
vec3_t position;
} mvertex_t;
#define SIDE_FRONT 0
#define SIDE_BACK 1
#define SIDE_ON 2
// plane_t structure
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct mplane_s
{
vec3_t normal;
float dist;
byte type; // for texture axis selection and fast side tests
byte signbits; // signx + signy<<1 + signz<<1
byte pad[2];
} mplane_t;
typedef struct texture_s
{
char name[16];
unsigned width, height;
int anim_total; // total tenths in sequence ( 0 = no)
int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frmae 1 use these
unsigned offsets[MIPLEVELS]; // four mip maps stored
} texture_t;
#define SURF_PLANEBACK 2
#define SURF_DRAWSKY 4
#define SURF_DRAWSPRITE 8
#define SURF_DRAWTURB 0x10
#define SURF_DRAWTILED 0x20
#define SURF_DRAWBACKGROUND 0x40
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct
{
unsigned short v[2];
unsigned int cachededgeoffset;
} medge_t;
typedef struct
{
float vecs[2][4];
float mipadjust;
texture_t *texture;
int flags;
} mtexinfo_t;
typedef struct msurface_s
{
int visframe; // should be drawn when node is crossed
int dlightframe;
int dlightbits;
mplane_t *plane;
int flags;
int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges
// surface generation data
struct surfcache_s *cachespots[MIPLEVELS];
short texturemins[2];
short extents[2];
mtexinfo_t *texinfo;
// lighting info
byte styles[MAXLIGHTMAPS];
byte *samples; // [numstyles*surfsize]
} msurface_t;
typedef struct mnode_s
{
// common with leaf
int contents; // 0, to differentiate from leafs
int visframe; // node needs to be traversed if current
short minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
// node specific
mplane_t *plane;
struct mnode_s *children[2];
unsigned short firstsurface;
unsigned short numsurfaces;
} mnode_t;
typedef struct mleaf_s
{
// common with node
int contents; // wil be a negative contents number
int visframe; // node needs to be traversed if current
short minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
// leaf specific
byte *compressed_vis;
struct efrag_s *efrags;
msurface_t **firstmarksurface;
int nummarksurfaces;
int key; // BSP sequence number for leaf's contents
byte ambient_sound_level[NUM_AMBIENTS];
} mleaf_t;
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct
{
dclipnode_t *clipnodes;
mplane_t *planes;
int firstclipnode;
int lastclipnode;
vec3_t clip_mins;
vec3_t clip_maxs;
} hull_t;
/*
==============================================================================
SPRITE MODELS
==============================================================================
*/
// FIXME: shorten these?
typedef struct mspriteframe_s
{
int width;
int height;
void *pcachespot; // remove?
float up, down, left, right;
byte pixels[4];
} mspriteframe_t;
typedef struct
{
int numframes;
float *intervals;
mspriteframe_t *frames[1];
} mspritegroup_t;
typedef struct
{
spriteframetype_t type;
mspriteframe_t *frameptr;
} mspriteframedesc_t;
typedef struct
{
int type;
int maxwidth;
int maxheight;
int numframes;
float beamlength; // remove?
void *cachespot; // remove?
mspriteframedesc_t frames[1];
} msprite_t;
/*
==============================================================================
ALIAS MODELS
Alias models are position independent, so the cache manager can move them.
==============================================================================
*/
typedef struct
{
aliasframetype_t type;
trivertx_t bboxmin;
trivertx_t bboxmax;
int frame;
char name[16];
} maliasframedesc_t;
typedef struct
{
aliasskintype_t type;
void *pcachespot;
int skin;
} maliasskindesc_t;
typedef struct
{
trivertx_t bboxmin;
trivertx_t bboxmax;
int frame;
} maliasgroupframedesc_t;
typedef struct
{
int numframes;
int intervals;
maliasgroupframedesc_t frames[1];
} maliasgroup_t;
typedef struct
{
int numskins;
int intervals;
maliasskindesc_t skindescs[1];
} maliasskingroup_t;
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct mtriangle_s {
int facesfront;
int vertindex[3];
} mtriangle_t;
typedef struct {
int model;
int stverts;
int skindesc;
int triangles;
maliasframedesc_t frames[1];
} aliashdr_t;
//===================================================================
//
// Whole model
//
typedef enum {mod_brush, mod_sprite, mod_alias} modtype_t;
#define EF_ROCKET 1 // leave a trail
#define EF_GRENADE 2 // leave a trail
#define EF_GIB 4 // leave a trail
#define EF_ROTATE 8 // rotate (bonus items)
#define EF_TRACER 16 // green split trail
#define EF_ZOMGIB 32 // small blood trail
#define EF_TRACER2 64 // orange split trail + rotate
#define EF_TRACER3 128 // purple trail
typedef struct model_s
{
char name[MAX_QPATH];
qboolean needload; // bmodels and sprites don't cache normally
modtype_t type;
int numframes;
synctype_t synctype;
int flags;
//
// volume occupied by the model graphics
//
vec3_t mins, maxs;
float radius;
//
// solid volume for clipping (sent from server)
//
qboolean clipbox;
vec3_t clipmins, clipmaxs;
//
// brush model
//
int firstmodelsurface, nummodelsurfaces;
int numsubmodels;
dmodel_t *submodels;
int numplanes;
mplane_t *planes;
int numleafs; // number of visible leafs, not counting 0
mleaf_t *leafs;
int numvertexes;
mvertex_t *vertexes;
int numedges;
medge_t *edges;
int numnodes;
mnode_t *nodes;
int numtexinfo;
mtexinfo_t *texinfo;
int numsurfaces;
msurface_t *surfaces;
int numsurfedges;
int *surfedges;
int numclipnodes;
dclipnode_t *clipnodes;
int nummarksurfaces;
msurface_t **marksurfaces;
hull_t hulls[MAX_MAP_HULLS];
int numtextures;
texture_t **textures;
byte *visdata;
byte *lightdata;
char *entities;
unsigned checksum; // for world models only
unsigned checksum2; // for world models only
//
// additional model data
//
cache_user_t cache; // only access through Mod_Extradata
} model_t;
//============================================================================
void Mod_Init (void);
void Mod_ClearAll (void);
model_t *Mod_ForName (char *name, qboolean crash);
void *Mod_Extradata (model_t *mod); // handles caching
void Mod_TouchModel (char *name);
mleaf_t *Mod_PointInLeaf (float *p, model_t *model);
byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
#endif // __MODEL__

View file

@ -19,6 +19,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef _NET_H
#define _NET_H
// net.h -- quake's interface to the networking layer // net.h -- quake's interface to the networking layer
#define PORT_ANY -1 #define PORT_ANY -1
@ -119,3 +123,4 @@ void Netchan_Setup (netchan_t *chan, netadr_t adr, int qport);
qboolean Netchan_CanPacket (netchan_t *chan); qboolean Netchan_CanPacket (netchan_t *chan);
qboolean Netchan_CanReliable (netchan_t *chan); qboolean Netchan_CanReliable (netchan_t *chan);
#endif // _NET_H

View file

@ -19,11 +19,12 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#include "quakedef.h"
#ifdef HAVE_UNISTD_H #ifdef HAVE_UNISTD_H
#include <unistd.h> #include <unistd.h>
#endif #endif
#include "quakedef.h"
#ifdef _WIN32 #ifdef _WIN32
#include "winquake.h" #include "winquake.h"

View file

@ -23,25 +23,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef __PMOVE_H #ifndef __PMOVE_H
#define __PMOVE_H #define __PMOVE_H
typedef struct #include "pmove_simple.h"
{
vec3_t normal;
float dist;
} pmplane_t;
typedef struct
{
qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area
qboolean inopen, inwater;
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
pmplane_t plane; // surface normal at impact
int ent; // entity the surface is on
} pmtrace_t;
#define MAX_PHYSENTS 32
typedef struct typedef struct
{ {
vec3_t origin; vec3_t origin;
@ -76,33 +59,8 @@ typedef struct
int touchindex[MAX_PHYSENTS]; int touchindex[MAX_PHYSENTS];
} playermove_t; } playermove_t;
typedef struct {
float gravity;
float stopspeed;
float maxspeed;
float spectatormaxspeed;
float accelerate;
float airaccelerate;
float wateraccelerate;
float friction;
float waterfriction;
float entgravity;
} movevars_t;
extern movevars_t movevars;
extern playermove_t pmove; extern playermove_t pmove;
extern int onground;
extern int waterlevel;
extern int watertype;
void PlayerMove (void);
void Pmove_Init (void);
int PM_HullPointContents (hull_t *hull, int num, vec3_t p); int PM_HullPointContents (hull_t *hull, int num, vec3_t p);
int PM_PointContents (vec3_t point);
qboolean PM_TestPlayerPosition (vec3_t point);
pmtrace_t PM_PlayerMove (vec3_t start, vec3_t stop);
#endif // __PMOVE_H #endif // __PMOVE_H

73
qw_common/pmove_simple.h Normal file
View file

@ -0,0 +1,73 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Copyright (C) 1999,2000 contributors of the QuakeForge project
Please see the file "AUTHORS" for a list of contributors
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __PMOVE_SIMPLE_H
#define __PMOVE_SIMPLE_H
typedef struct
{
vec3_t normal;
float dist;
} pmplane_t;
typedef struct
{
qboolean allsolid; // if true, plane is not valid
qboolean startsolid; // if true, the initial point was in a solid area
qboolean inopen, inwater;
float fraction; // time completed, 1.0 = didn't hit anything
vec3_t endpos; // final position
pmplane_t plane; // surface normal at impact
int ent; // entity the surface is on
} pmtrace_t;
#define MAX_PHYSENTS 32
typedef struct {
float gravity;
float stopspeed;
float maxspeed;
float spectatormaxspeed;
float accelerate;
float airaccelerate;
float wateraccelerate;
float friction;
float waterfriction;
float entgravity;
} movevars_t;
extern movevars_t movevars;
extern int onground;
extern int waterlevel;
extern int watertype;
void PlayerMove (void);
void Pmove_Init (void);
int PM_PointContents (vec3_t point);
qboolean PM_TestPlayerPosition (vec3_t point);
pmtrace_t PM_PlayerMove (vec3_t start, vec3_t stop);
#endif // __PMOVE_SIMPLE_H

View file

@ -19,6 +19,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef _PROTOCOL_H
#define _PROTOCOL_H
// protocol.h -- communications protocols // protocol.h -- communications protocols
#define PROTOCOL_VERSION 28 #define PROTOCOL_VERSION 28
@ -282,3 +286,4 @@ typedef struct usercmd_s
byte impulse; byte impulse;
} usercmd_t; } usercmd_t;
#endif // _PROTOCOL_H

View file

@ -19,6 +19,10 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
#ifndef _SCREEN_H
#define _SCREEN_H
// screen.h // screen.h
void SCR_Init (void); void SCR_Init (void);
@ -53,3 +57,5 @@ extern int scr_copyeverything;
qboolean scr_skipupdate; qboolean scr_skipupdate;
qboolean block_drawing; qboolean block_drawing;
#endif // _SCREEN_H

View file

@ -41,7 +41,7 @@ byte mod_novis[MAX_MAP_LEAFS/8];
model_t mod_known[MAX_MOD_KNOWN]; model_t mod_known[MAX_MOD_KNOWN];
int mod_numknown; int mod_numknown;
texture_t r_notexture_mip; texture_t sv_r_notexture_mip;
unsigned *model_checksum; unsigned *model_checksum;
@ -609,7 +609,7 @@ void Mod_LoadTexinfo (lump_t *l)
if (!loadmodel->textures) if (!loadmodel->textures)
{ {
out->texture = &r_notexture_mip; // checkerboard texture out->texture = &sv_r_notexture_mip; // checkerboard texture
out->flags = 0; out->flags = 0;
} }
else else
@ -619,7 +619,7 @@ void Mod_LoadTexinfo (lump_t *l)
out->texture = loadmodel->textures[miptex]; out->texture = loadmodel->textures[miptex];
if (!out->texture) if (!out->texture)
{ {
out->texture = &r_notexture_mip; // texture not found out->texture = &sv_r_notexture_mip; // texture not found
out->flags = 0; out->flags = 0;
} }
} }

View file

@ -57,6 +57,8 @@ MAKE_SURE_DIR = if test -d "$(BUILD_DIR)/$$DIR"; \
# Client targets # Client targets
# #
COMMON_LIB=common_lib.a
ifeq ($(HAS_OGL),yes) ifeq ($(HAS_OGL),yes)
GLQUAKE =$(BIN_PREFIX)-gl GLQUAKE =$(BIN_PREFIX)-gl
endif endif
@ -99,7 +101,8 @@ endif
soft_targets = $(X11QUAKE) $(SVGAQUAKE) $(GGIQUAKE) $(SDLQUAKE) $(MGLQUAKE) \ soft_targets = $(X11QUAKE) $(SVGAQUAKE) $(GGIQUAKE) $(SDLQUAKE) $(MGLQUAKE) \
$(VGAQUAKE) $(VGAQUAKE)
gl_targets = $(GLQUAKE) $(TDFXQUAKE) gl_targets = $(GLQUAKE) $(TDFXQUAKE)
targets = $(gl_targets) $(soft_targets) lib_targets = $(COMMON_LIB)
targets = $(lib_targets) $(gl_targets) $(soft_targets)
CLEAN_TARGETS = $(patsubst %,clean-%, $(targets)) CLEAN_TARGETS = $(patsubst %,clean-%, $(targets))
.PHONY: $(targets) $(CLEAN_TARGETS) clean-soft clean-gl .PHONY: $(targets) $(CLEAN_TARGETS) clean-soft clean-gl
@ -173,12 +176,13 @@ UQ_NET_SRC = net_dgrm.c net_loop.c net_main.c net_vcr.c $(NET_SRC)
# Common source files # Common source files
MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c \ MISC_SRC = common.c crc.c cvar.c cmd.c mathlib.c register_check.c \
wad.c zone.c wad.c zone.c cvars.c
# GL renderer source # GL renderer source
GL_REND_SRC = gl_screen.c gl_model.c gl_draw.c gl_mesh.c gl_refrag.c \ GL_REND_SRC = gl_screen.c gl_model.c gl_draw.c gl_mesh.c gl_refrag.c \
gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_test.c gl_warp.c gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c gl_test.c gl_warp.c \
gl_cl_parse.c gl_rpart.c gl_view.c
# Software renderer source # Software renderer source
@ -186,7 +190,7 @@ SW_REND_SRC = screen.c $(SWREND_SRC_PLAT) draw.c \
d_edge.c d_fill.c d_init.c d_modech.c d_part.c d_polyse.c d_scan.c \ 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 r_aclip.c r_alias.c \ d_sky.c d_sprite.c d_surf.c d_vars.c d_zpoint.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_bsp.c r_draw.c r_edge.c r_efrag.c r_light.c r_main.c r_misc.c \
r_sky.c r_sprite.c r_surf.c r_vars.c r_sky.c r_sprite.c r_surf.c r_vars.c sw_cl_parse.c sw_rpart.c sw_view.c
# Client source files # Client source files
@ -224,6 +228,20 @@ GENERAL_SRC = $(CL_COMMON_SRC) \
# Compilation rules # Compilation rules
# #
# Common lib targets.
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(SRC_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(SRC_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(COMMON_DIR)/%.c
$(CC) $(CFLAGS) -o $@ -c $<
$(BUILD_DIR)/common_lib/%.@OBJEXT@: $(COMMON_DIR)/%.s
$(CC) $(CFLAGS) -x assembler-with-cpp -o $@ -c $<
# Software targets # Software targets
soft_DIR: soft_DIR:
@DIR=soft; $(MAKE_SURE_DIR) @DIR=soft; $(MAKE_SURE_DIR)
@ -262,14 +280,27 @@ $(BUILD_DIR)/gl/%.@OBJEXT@: $(COMMON_DIR)/%.s
# Specific target rules # Specific target rules
# #
# Lib Software targets
ALL_COMMON_LIB_OBJS = $(patsubst %,$(BUILD_DIR)/common_lib/%,$(addsuffix \
.@OBJEXT@, $(basename $(GENERAL_SRC) .c .s)))
common_lib_DIR:
@DIR=common_lib; $(MAKE_SURE_DIR)
$(COMMON_LIB): common_lib_DIR $(BUILD_DIR)/common_lib.a
$(BUILD_DIR)/common_lib.a: $(ALL_COMMON_LIB_OBJS)
ar cru $@ $(ALL_COMMON_LIB_OBJS)
ranlib $@
# X11 software target # X11 software target
ifneq ($(X11QUAKE),) ifneq ($(X11QUAKE),)
ALL_X11_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) @X11_VID_SRC@\ ALL_X11_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) @X11_VID_SRC@ model.c
model.c
ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ ALL_X11_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_X11_SRC) .c .s))) $(basename $(ALL_X11_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
X11_CFLAGS = -DX11 @X_CFLAGS@ X11_CFLAGS = -DX11 @X_CFLAGS@
X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@ X11_LDFLAGS = @X_LIBS@ -lX11 @X11_SHM_LIB@ @X_EXTRA_LIBS@
@ -293,10 +324,11 @@ endif
# SVGALib software target # SVGALib software target
ifneq ($(SVGAQUAKE),) ifneq ($(SVGAQUAKE),)
ALL_SVGA_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) \ ALL_SVGA_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) \
vid_svgalib.c in_svgalib.c d_copy.s model.c vid_svgalib.c in_svgalib.c d_copy.s model.c
ALL_SVGA_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ ALL_SVGA_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_SVGA_SRC) .c .s))) $(basename $(ALL_SVGA_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
SVGA_CFLAGS = @SVGA_CFLAGS@ SVGA_CFLAGS = @SVGA_CFLAGS@
SVGA_LDFLAGS = @SVGA_LIBS@ SVGA_LDFLAGS = @SVGA_LIBS@
@ -321,10 +353,11 @@ endif
ifneq ($(GGIQUAKE),) ifneq ($(GGIQUAKE),)
# Map the list of source files into a list of object files # Map the list of source files into a list of object files
ALL_GGI_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_ggi.c\ ALL_GGI_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) vid_ggi.c\
model.c model.c
ALL_GGI_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ ALL_GGI_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_GGI_SRC) .c .s))) $(basename $(ALL_GGI_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
GGI_SRC = vid_ggi.c GGI_SRC = vid_ggi.c
GGI_CFLAGS = -DGGI @GGI_CFLAGS@ GGI_CFLAGS = -DGGI @GGI_CFLAGS@
@ -344,10 +377,11 @@ endif
# SDL software target # SDL software target
ifneq ($(SDLQUAKE),) ifneq ($(SDLQUAKE),)
ALL_SDL_SRC = $(GENERAL_SRC) $(SW_REND_SRC) $(SDL_SRC) vid_sdl.c cd_sdl.c\ ALL_SDL_SRC = $(SW_REND_SRC) $(SDL_SRC) vid_sdl.c cd_sdl.c\
model.c model.c
ALL_SDL_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ ALL_SDL_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_SDL_SRC) .c .s))) $(basename $(ALL_SDL_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
SDL_CFLAGS = @SDL_CFLAGS@ -DSDL SDL_CFLAGS = @SDL_CFLAGS@ -DSDL
SDL_LDFLAGS = @SDL_LIBS@ SDL_LDFLAGS = @SDL_LIBS@
@ -371,10 +405,11 @@ endif
ifneq ($(MGLQUAKE),) ifneq ($(MGLQUAKE),)
# Map the list of source files into a list of object files # Map the list of source files into a list of object files
ALL_MGL_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) \ ALL_MGL_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) \
vid_win.c in_win.c conproc.c model.c vid_win.c in_win.c conproc.c model.c
ALL_MGL_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ ALL_MGL_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_MGL_SRC) .c .s))) $(basename $(ALL_MGL_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
MGL_CFLAGS = @MGL_CFLAGS@ -DMGL MGL_CFLAGS = @MGL_CFLAGS@ -DMGL
MGL_LDFLAGS = @MGL_LIBS@ MGL_LDFLAGS = @MGL_LIBS@
@ -398,11 +433,12 @@ endif
ifneq ($(VGAQUAKE),) ifneq ($(VGAQUAKE),)
# Map the list of source files into a list of object files # Map the list of source files into a list of object files
ALL_VGA_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(SW_REND_SRC) $(DOS_NET_SRC) \ ALL_VGA_SRC = $(CD_AUDIO_SRC) $(SW_REND_SRC) $(DOS_NET_SRC) \
vid_vga.c vid_ext.c vid_dos.c vregset.c in_dos.c dos_v2.c \ vid_vga.c vid_ext.c vid_dos.c vregset.c in_dos.c dos_v2.c \
d_copy.s model.c d_copy.s model.c
ALL_VGA_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\ ALL_VGA_OBJS = $(patsubst %,$(BUILD_DIR)/soft/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_VGA_SRC) .c .s))) $(basename $(ALL_VGA_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
VGA_CFLAGS = @VGA_CFLAGS@ -DVGA VGA_CFLAGS = @VGA_CFLAGS@ -DVGA
VGA_LDFLAGS = @VGA_LIBS@ VGA_LDFLAGS = @VGA_LIBS@
@ -424,10 +460,11 @@ endif
# X11 GL target # X11 GL target
ifneq ($(GLQUAKE),) ifneq ($(GLQUAKE),)
ALL_GL_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(GL_REND_SRC) \ ALL_GL_SRC = $(CD_AUDIO_SRC) $(GL_REND_SRC) \
gl_vidglx.c dga_check.c gl_vidglx.c dga_check.c
ALL_GL_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\ ALL_GL_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_GL_SRC) .c .s))) $(basename $(ALL_GL_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
GL_CFLAGS = -DGLQUAKE @OGL_CFLAGS@ GL_CFLAGS = -DGLQUAKE @OGL_CFLAGS@
GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@ @DGA_LIBS@ @DYN_LIBS@ GL_LDFLAGS = $(X11_LDFLAGS) @OGL_LIBS@ @DGA_LIBS@ @DYN_LIBS@
@ -450,10 +487,11 @@ endif
# 3Dfx GL MCD target # 3Dfx GL MCD target
ifneq ($(TDFXQUAKE),) ifneq ($(TDFXQUAKE),)
ALL_TDFX_SRC = $(GENERAL_SRC) $(CD_AUDIO_SRC) $(GL_REND_SRC) \ ALL_TDFX_SRC = $(CD_AUDIO_SRC) $(GL_REND_SRC) \
gl_vidlinux_3dfx.c in_svgalib.c gl_vidlinux_3dfx.c in_svgalib.c
ALL_TDFX_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\ ALL_TDFX_OBJS = $(patsubst %,$(BUILD_DIR)/gl/%,$(addsuffix .@OBJEXT@,\
$(basename $(ALL_TDFX_SRC) .c .s))) $(basename $(ALL_TDFX_SRC) .c .s))) \
$(BUILD_DIR)/common_lib.a
TDFX_CFLAGS = -DGLQUAKE @OGL_CFLAGS@ @GLIDE_CFLAGS@ TDFX_CFLAGS = -DGLQUAKE @OGL_CFLAGS@ @GLIDE_CFLAGS@
TDFX_LDFLAGS = @SVGA_LIBS@ @TDFXGL_LIBS@ TDFX_LDFLAGS = @SVGA_LIBS@ @TDFXGL_LIBS@
@ -481,10 +519,10 @@ distclean: clean
$(CLEAN_TARGETS): $(CLEAN_TARGETS):
rm -f $(BUILD_DIR)/../$(subst clean-,,$@) rm -f $(BUILD_DIR)/../$(subst clean-,,$@)
clean-soft clean-gl: clean-soft clean-gl clean-common_lib:
rm -rf $(BUILD_DIR)/$(subst clean-,,$@) rm -rf $(BUILD_DIR)/$(subst clean-,,$@)
clean: clean-soft clean-gl $(CLEAN_TARGETS) clean: clean-soft clean-gl clean-common_lib $(CLEAN_TARGETS)
-rmdir $(BUILD_DIR) -rmdir $(BUILD_DIR)
install: $(targets) install: $(targets)

View file

@ -21,6 +21,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "quakedef.h" #include "quakedef.h"
void CL_ParseUpdate (int bits);
char *svc_strings[] = char *svc_strings[] =
{ {
"svc_bad", "svc_bad",
@ -316,173 +318,6 @@ void CL_ParseServerInfo (void)
} }
/*
==================
CL_ParseUpdate
Parse an entity update message from the server
If an entities model or origin changes from frame to frame, it must be
relinked. Other attributes can change without relinking.
==================
*/
int bitcounts[16];
void CL_ParseUpdate (int bits)
{
model_t *model;
qboolean forcelink;
entity_t *ent;
int modnum, num, i;
if (cls.signon == SIGNONS - 1)
{ // first update is the final signon stage
cls.signon = SIGNONS;
CL_SignonReply ();
}
if (bits & U_MOREBITS)
{
i = MSG_ReadByte ();
bits |= (i<<8);
}
if (bits & U_LONGENTITY)
num = MSG_ReadShort ();
else
num = MSG_ReadByte ();
ent = CL_EntityNum (num);
for (i=0 ; i<16 ; i++)
if (bits&(1<<i))
bitcounts[i]++;
if (ent->msgtime != cl.mtime[1])
forcelink = true; // no previous frame to lerp from
else
forcelink = false;
ent->msgtime = cl.mtime[0];
if (bits & U_MODEL)
{
modnum = MSG_ReadByte ();
if (modnum >= MAX_MODELS)
Host_Error ("CL_ParseModel: bad modnum");
}
else
modnum = ent->baseline.modelindex;
model = cl.model_precache[modnum];
if (model != ent->model)
{
ent->model = model;
// automatic animation (torches, etc) can be either all together
// or randomized
if (model)
{
if (model->synctype == ST_RAND)
ent->syncbase = (float)(rand()&0x7fff) / 0x7fff;
else
ent->syncbase = 0.0;
}
else
forcelink = true; // hack to make null model players work
#ifdef GLQUAKE
if (num > 0 && num <= cl.maxclients)
R_TranslatePlayerSkin (num - 1);
#endif
}
if (bits & U_FRAME)
ent->frame = MSG_ReadByte ();
else
ent->frame = ent->baseline.frame;
if (bits & U_COLORMAP)
i = MSG_ReadByte();
else
i = ent->baseline.colormap;
if (!i)
ent->colormap = vid.colormap;
else
{
if (i > cl.maxclients)
Sys_Error ("i >= cl.maxclients");
ent->colormap = cl.scores[i-1].translations;
}
#ifdef GLQUAKE
{
int skin;
if (bits & U_SKIN)
skin = MSG_ReadByte();
else
skin = ent->baseline.skin;
if (skin != ent->skinnum) {
ent->skinnum = skin;
if (num > 0 && num <= cl.maxclients)
R_TranslatePlayerSkin (num - 1);
}
}
#else
if (bits & U_SKIN)
ent->skinnum = MSG_ReadByte();
else
ent->skinnum = ent->baseline.skin;
#endif
if (bits & U_EFFECTS)
ent->effects = MSG_ReadByte();
else
ent->effects = ent->baseline.effects;
// shift the known values for interpolation
VectorCopy (ent->msg_origins[0], ent->msg_origins[1]);
VectorCopy (ent->msg_angles[0], ent->msg_angles[1]);
if (bits & U_ORIGIN1)
ent->msg_origins[0][0] = MSG_ReadCoord ();
else
ent->msg_origins[0][0] = ent->baseline.origin[0];
if (bits & U_ANGLE1)
ent->msg_angles[0][0] = MSG_ReadAngle();
else
ent->msg_angles[0][0] = ent->baseline.angles[0];
if (bits & U_ORIGIN2)
ent->msg_origins[0][1] = MSG_ReadCoord ();
else
ent->msg_origins[0][1] = ent->baseline.origin[1];
if (bits & U_ANGLE2)
ent->msg_angles[0][1] = MSG_ReadAngle();
else
ent->msg_angles[0][1] = ent->baseline.angles[1];
if (bits & U_ORIGIN3)
ent->msg_origins[0][2] = MSG_ReadCoord ();
else
ent->msg_origins[0][2] = ent->baseline.origin[2];
if (bits & U_ANGLE3)
ent->msg_angles[0][2] = MSG_ReadAngle();
else
ent->msg_angles[0][2] = ent->baseline.angles[2];
if ( bits & U_NOLERP )
ent->forcelink = true;
if ( forcelink )
{ // didn't have an update last message
VectorCopy (ent->msg_origins[0], ent->msg_origins[1]);
VectorCopy (ent->msg_origins[0], ent->origin);
VectorCopy (ent->msg_angles[0], ent->msg_angles[1]);
VectorCopy (ent->msg_angles[0], ent->angles);
ent->forcelink = true;
}
}
/* /*
================== ==================
CL_ParseBaseline CL_ParseBaseline
@ -622,43 +457,6 @@ void CL_ParseClientdata (int bits)
} }
} }
/*
=====================
CL_NewTranslation
=====================
*/
void CL_NewTranslation (int slot)
{
int i, j;
int top, bottom;
byte *dest, *source;
if (slot > cl.maxclients)
Sys_Error ("CL_NewTranslation: slot > cl.maxclients");
dest = cl.scores[slot].translations;
source = vid.colormap;
memcpy (dest, vid.colormap, sizeof(cl.scores[slot].translations));
top = cl.scores[slot].colors & 0xf0;
bottom = (cl.scores[slot].colors &15)<<4;
#ifdef GLQUAKE
R_TranslatePlayerSkin (slot);
#endif
for (i=0 ; i<VID_GRADES ; i++, dest += 256, source+=256)
{
if (top < 128) // the artists made some backwards ranges. sigh.
memcpy (dest + TOP_RANGE, source + top, 16);
else
for (j=0 ; j<16 ; j++)
dest[TOP_RANGE+j] = source[top+15-j];
if (bottom < 128)
memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
else
for (j=0 ; j<16 ; j++)
dest[BOTTOM_RANGE+j] = source[bottom+15-j];
}
}
/* /*
===================== =====================

View file

@ -19,6 +19,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// client.h // client.h
#ifndef _CLIENT_H
#define _CLIENT_H
typedef struct typedef struct
{ {
vec3_t viewangles; vec3_t viewangles;
@ -375,3 +377,4 @@ void V_CalcBlend (void);
// //
void CL_InitTEnts (void); void CL_InitTEnts (void);
void CL_SignonReply (void); void CL_SignonReply (void);
#endif // _CLIENT_H

View file

@ -20,6 +20,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/ */
// console.c // console.c
#include "quakedef.h"
#ifdef NeXT #ifdef NeXT
#include <libc.h> #include <libc.h>
#endif #endif
@ -27,7 +28,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <fcntl.h> #include <fcntl.h>
#include "quakedef.h"
int con_linewidth; int con_linewidth;

216
uquake/gl_cl_parse.c Normal file
View file

@ -0,0 +1,216 @@
/*
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cl_parse.c -- parse a message received from the server
#include "quakedef.h"
entity_t *CL_EntityNum (int num);
/*
==================
CL_ParseUpdate
Parse an entity update message from the server
If an entities model or origin changes from frame to frame, it must be
relinked. Other attributes can change without relinking.
==================
*/
int bitcounts[16];
void CL_ParseUpdate (int bits)
{
model_t *model;
qboolean forcelink;
entity_t *ent;
int modnum, num, i;
if (cls.signon == SIGNONS - 1)
{ // first update is the final signon stage
cls.signon = SIGNONS;
CL_SignonReply ();
}
if (bits & U_MOREBITS)
{
i = MSG_ReadByte ();
bits |= (i<<8);
}
if (bits & U_LONGENTITY)
num = MSG_ReadShort ();
else
num = MSG_ReadByte ();
ent = CL_EntityNum (num);
for (i=0 ; i<16 ; i++)
if (bits&(1<<i))
bitcounts[i]++;
if (ent->msgtime != cl.mtime[1])
forcelink = true; // no previous frame to lerp from
else
forcelink = false;
ent->msgtime = cl.mtime[0];
if (bits & U_MODEL)
{
modnum = MSG_ReadByte ();
if (modnum >= MAX_MODELS)
Host_Error ("CL_ParseModel: bad modnum");
}
else
modnum = ent->baseline.modelindex;
model = cl.model_precache[modnum];
if (model != ent->model)
{
ent->model = model;
// automatic animation (torches, etc) can be either all together
// or randomized
if (model)
{
if (model->synctype == ST_RAND)
ent->syncbase = (float)(rand()&0x7fff) / 0x7fff;
else
ent->syncbase = 0.0;
}
else
forcelink = true; // hack to make null model players work
if (num > 0 && num <= cl.maxclients)
R_TranslatePlayerSkin (num - 1);
}
if (bits & U_FRAME)
ent->frame = MSG_ReadByte ();
else
ent->frame = ent->baseline.frame;
if (bits & U_COLORMAP)
i = MSG_ReadByte();
else
i = ent->baseline.colormap;
if (!i)
ent->colormap = vid.colormap;
else
{
if (i > cl.maxclients)
Sys_Error ("i >= cl.maxclients");
ent->colormap = cl.scores[i-1].translations;
}
{
int skin;
if (bits & U_SKIN)
skin = MSG_ReadByte();
else
skin = ent->baseline.skin;
if (skin != ent->skinnum) {
ent->skinnum = skin;
if (num > 0 && num <= cl.maxclients)
R_TranslatePlayerSkin (num - 1);
}
}
if (bits & U_EFFECTS)
ent->effects = MSG_ReadByte();
else
ent->effects = ent->baseline.effects;
// shift the known values for interpolation
VectorCopy (ent->msg_origins[0], ent->msg_origins[1]);
VectorCopy (ent->msg_angles[0], ent->msg_angles[1]);
if (bits & U_ORIGIN1)
ent->msg_origins[0][0] = MSG_ReadCoord ();
else
ent->msg_origins[0][0] = ent->baseline.origin[0];
if (bits & U_ANGLE1)
ent->msg_angles[0][0] = MSG_ReadAngle();
else
ent->msg_angles[0][0] = ent->baseline.angles[0];
if (bits & U_ORIGIN2)
ent->msg_origins[0][1] = MSG_ReadCoord ();
else
ent->msg_origins[0][1] = ent->baseline.origin[1];
if (bits & U_ANGLE2)
ent->msg_angles[0][1] = MSG_ReadAngle();
else
ent->msg_angles[0][1] = ent->baseline.angles[1];
if (bits & U_ORIGIN3)
ent->msg_origins[0][2] = MSG_ReadCoord ();
else
ent->msg_origins[0][2] = ent->baseline.origin[2];
if (bits & U_ANGLE3)
ent->msg_angles[0][2] = MSG_ReadAngle();
else
ent->msg_angles[0][2] = ent->baseline.angles[2];
if ( bits & U_NOLERP )
ent->forcelink = true;
if ( forcelink )
{ // didn't have an update last message
VectorCopy (ent->msg_origins[0], ent->msg_origins[1]);
VectorCopy (ent->msg_origins[0], ent->origin);
VectorCopy (ent->msg_angles[0], ent->msg_angles[1]);
VectorCopy (ent->msg_angles[0], ent->angles);
ent->forcelink = true;
}
}
/*
=====================
CL_NewTranslation
=====================
*/
void CL_NewTranslation (int slot)
{
int i, j;
int top, bottom;
byte *dest, *source;
if (slot > cl.maxclients)
Sys_Error ("CL_NewTranslation: slot > cl.maxclients");
dest = cl.scores[slot].translations;
source = vid.colormap;
memcpy (dest, vid.colormap, sizeof(cl.scores[slot].translations));
top = cl.scores[slot].colors & 0xf0;
bottom = (cl.scores[slot].colors &15)<<4;
R_TranslatePlayerSkin (slot);
for (i=0 ; i<VID_GRADES ; i++, dest += 256, source+=256)
{
if (top < 128) // the artists made some backwards ranges. sigh.
memcpy (dest + TOP_RANGE, source + top, 16);
else
for (j=0 ; j<16 ; j++)
dest[TOP_RANGE+j] = source[top+15-j];
if (bottom < 128)
memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
else
for (j=0 ; j<16 ; j++)
dest[BOTTOM_RANGE+j] = source[bottom+15-j];
}
}

View file

@ -1,431 +0,0 @@
/*
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MODEL__
#define __MODEL__
#include "modelgen.h"
#include "spritegn.h"
/*
d*_t structures are on-disk representations
m*_t structures are in-memory
*/
// entity effects
#define EF_BRIGHTFIELD 1
#define EF_MUZZLEFLASH 2
#define EF_BRIGHTLIGHT 4
#define EF_DIMLIGHT 8
/*
==============================================================================
BRUSH MODELS
==============================================================================
*/
//
// in memory representation
//
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct
{
vec3_t position;
} mvertex_t;
#define SIDE_FRONT 0
#define SIDE_BACK 1
#define SIDE_ON 2
// plane_t structure
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct mplane_s
{
vec3_t normal;
float dist;
byte type; // for texture axis selection and fast side tests
byte signbits; // signx + signy<<1 + signz<<1
byte pad[2];
} mplane_t;
typedef struct texture_s
{
char name[16];
unsigned width, height;
int gl_texturenum;
struct msurface_s *texturechain; // for gl_texsort drawing
int anim_total; // total tenths in sequence ( 0 = no)
int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frmae 1 use these
unsigned offsets[MIPLEVELS]; // four mip maps stored
} texture_t;
#define SURF_PLANEBACK 2
#define SURF_DRAWSKY 4
#define SURF_DRAWSPRITE 8
#define SURF_DRAWTURB 0x10
#define SURF_DRAWTILED 0x20
#define SURF_DRAWBACKGROUND 0x40
#define SURF_UNDERWATER 0x80
#define SURF_DONTWARP 0x100
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct
{
unsigned short v[2];
unsigned int cachededgeoffset;
} medge_t;
typedef struct
{
float vecs[2][4];
float mipadjust;
texture_t *texture;
int flags;
} mtexinfo_t;
#define VERTEXSIZE 7
typedef struct glpoly_s
{
struct glpoly_s *next;
struct glpoly_s *chain;
int numverts;
int flags; // for SURF_UNDERWATER
float verts[4][VERTEXSIZE]; // variable sized (xyz s1t1 s2t2)
} glpoly_t;
typedef struct msurface_s
{
int visframe; // should be drawn when node is crossed
mplane_t *plane;
int flags;
int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges
short texturemins[2];
short extents[2];
int light_s, light_t; // gl lightmap coordinates
glpoly_t *polys; // multiple if warped
struct msurface_s *texturechain;
mtexinfo_t *texinfo;
// lighting info
int dlightframe;
int dlightbits;
int lightmaptexturenum;
byte styles[MAXLIGHTMAPS];
int cached_light[MAXLIGHTMAPS]; // values currently used in lightmap
qboolean cached_dlight; // true if dynamic light in cache
byte *samples; // [numstyles*surfsize]
} msurface_t;
typedef struct mnode_s
{
// common with leaf
int contents; // 0, to differentiate from leafs
int visframe; // node needs to be traversed if current
float minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
// node specific
mplane_t *plane;
struct mnode_s *children[2];
unsigned short firstsurface;
unsigned short numsurfaces;
} mnode_t;
typedef struct mleaf_s
{
// common with node
int contents; // wil be a negative contents number
int visframe; // node needs to be traversed if current
float minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
// leaf specific
byte *compressed_vis;
efrag_t *efrags;
msurface_t **firstmarksurface;
int nummarksurfaces;
int key; // BSP sequence number for leaf's contents
byte ambient_sound_level[NUM_AMBIENTS];
} mleaf_t;
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct
{
dclipnode_t *clipnodes;
mplane_t *planes;
int firstclipnode;
int lastclipnode;
vec3_t clip_mins;
vec3_t clip_maxs;
} hull_t;
/*
==============================================================================
SPRITE MODELS
==============================================================================
*/
// FIXME: shorten these?
typedef struct mspriteframe_s
{
int width;
int height;
float up, down, left, right;
int gl_texturenum;
} mspriteframe_t;
typedef struct
{
int numframes;
float *intervals;
mspriteframe_t *frames[1];
} mspritegroup_t;
typedef struct
{
spriteframetype_t type;
mspriteframe_t *frameptr;
} mspriteframedesc_t;
typedef struct
{
int type;
int maxwidth;
int maxheight;
int numframes;
float beamlength; // remove?
void *cachespot; // remove?
mspriteframedesc_t frames[1];
} msprite_t;
/*
==============================================================================
ALIAS MODELS
Alias models are position independent, so the cache manager can move them.
==============================================================================
*/
typedef struct
{
int firstpose;
int numposes;
float interval;
trivertx_t bboxmin;
trivertx_t bboxmax;
int frame;
char name[16];
} maliasframedesc_t;
typedef struct
{
trivertx_t bboxmin;
trivertx_t bboxmax;
int frame;
} maliasgroupframedesc_t;
typedef struct
{
int numframes;
int intervals;
maliasgroupframedesc_t frames[1];
} maliasgroup_t;
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct mtriangle_s {
int facesfront;
int vertindex[3];
} mtriangle_t;
#define MAX_SKINS 32
typedef struct {
int ident;
int version;
vec3_t scale;
vec3_t scale_origin;
float boundingradius;
vec3_t eyeposition;
int numskins;
int skinwidth;
int skinheight;
int numverts;
int numtris;
int numframes;
synctype_t synctype;
int flags;
float size;
int numposes;
int poseverts;
int posedata; // numposes*poseverts trivert_t
int commands; // gl command list with embedded s/t
int gl_texturenum[MAX_SKINS][4];
int texels[MAX_SKINS]; // only for player skins
maliasframedesc_t frames[1]; // variable sized
} aliashdr_t;
#define MAXALIASVERTS 1024
#define MAXALIASFRAMES 256
#define MAXALIASTRIS 2048
extern aliashdr_t *pheader;
extern stvert_t stverts[MAXALIASVERTS];
extern mtriangle_t triangles[MAXALIASTRIS];
extern trivertx_t *poseverts[MAXALIASFRAMES];
//===================================================================
//
// Whole model
//
typedef enum {mod_brush, mod_sprite, mod_alias} modtype_t;
#define EF_ROCKET 1 // leave a trail
#define EF_GRENADE 2 // leave a trail
#define EF_GIB 4 // leave a trail
#define EF_ROTATE 8 // rotate (bonus items)
#define EF_TRACER 16 // green split trail
#define EF_ZOMGIB 32 // small blood trail
#define EF_TRACER2 64 // orange split trail + rotate
#define EF_TRACER3 128 // purple trail
typedef struct model_s
{
char name[MAX_QPATH];
qboolean needload; // bmodels and sprites don't cache normally
modtype_t type;
int numframes;
synctype_t synctype;
int flags;
//
// volume occupied by the model graphics
//
vec3_t mins, maxs;
float radius;
//
// solid volume for clipping
//
qboolean clipbox;
vec3_t clipmins, clipmaxs;
//
// brush model
//
int firstmodelsurface, nummodelsurfaces;
int numsubmodels;
dmodel_t *submodels;
int numplanes;
mplane_t *planes;
int numleafs; // number of visible leafs, not counting 0
mleaf_t *leafs;
int numvertexes;
mvertex_t *vertexes;
int numedges;
medge_t *edges;
int numnodes;
mnode_t *nodes;
int numtexinfo;
mtexinfo_t *texinfo;
int numsurfaces;
msurface_t *surfaces;
int numsurfedges;
int *surfedges;
int numclipnodes;
dclipnode_t *clipnodes;
int nummarksurfaces;
msurface_t **marksurfaces;
hull_t hulls[MAX_MAP_HULLS];
int numtextures;
texture_t **textures;
byte *visdata;
byte *lightdata;
char *entities;
//
// additional model data
//
cache_user_t cache; // only access through Mod_Extradata
} model_t;
//============================================================================
void Mod_Init (void);
void Mod_ClearAll (void);
model_t *Mod_ForName (char *name, qboolean crash);
void *Mod_Extradata (model_t *mod); // handles caching
void Mod_TouchModel (char *name);
mleaf_t *Mod_PointInLeaf (float *p, model_t *model);
byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
#endif // __MODEL__

170
uquake/gl_rpart.c Normal file
View file

@ -0,0 +1,170 @@
/*
Copyright (C) 1996-1997 Id Software, Inc.
Portions Copyright (C) 1999,2000 Nelson Rush.
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "quakedef.h"
#include "r_local.h"
extern particle_t *active_particles, *free_particles;
extern int ramp1[8], ramp2[8], ramp3[8];
/*
===============
R_DrawParticles
===============
*/
extern cvar_t sv_gravity;
void R_DrawParticles (void)
{
particle_t *p, *kill;
float grav;
int i;
float time2, time3;
float time1;
float dvel;
float frametime;
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);
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;
}
// 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);
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;
}
}
glEnd ();
glDisable (GL_BLEND);
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
}

View file

@ -1,382 +0,0 @@
/*
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __MODEL__
#define __MODEL__
#include "modelgen.h"
#include "spritegn.h"
/*
d*_t structures are on-disk representations
m*_t structures are in-memory
*/
/*
==============================================================================
BRUSH MODELS
==============================================================================
*/
//
// in memory representation
//
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct
{
vec3_t position;
} mvertex_t;
#define SIDE_FRONT 0
#define SIDE_BACK 1
#define SIDE_ON 2
// plane_t structure
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct mplane_s
{
vec3_t normal;
float dist;
byte type; // for texture axis selection and fast side tests
byte signbits; // signx + signy<<1 + signz<<1
byte pad[2];
} mplane_t;
typedef struct texture_s
{
char name[16];
unsigned width, height;
int anim_total; // total tenths in sequence ( 0 = no)
int anim_min, anim_max; // time for this frame min <=time< max
struct texture_s *anim_next; // in the animation sequence
struct texture_s *alternate_anims; // bmodels in frmae 1 use these
unsigned offsets[MIPLEVELS]; // four mip maps stored
} texture_t;
#define SURF_PLANEBACK 2
#define SURF_DRAWSKY 4
#define SURF_DRAWSPRITE 8
#define SURF_DRAWTURB 0x10
#define SURF_DRAWTILED 0x20
#define SURF_DRAWBACKGROUND 0x40
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct
{
unsigned short v[2];
unsigned int cachededgeoffset;
} medge_t;
typedef struct
{
float vecs[2][4];
float mipadjust;
texture_t *texture;
int flags;
} mtexinfo_t;
typedef struct msurface_s
{
int visframe; // should be drawn when node is crossed
int dlightframe;
int dlightbits;
mplane_t *plane;
int flags;
int firstedge; // look up in model->surfedges[], negative numbers
int numedges; // are backwards edges
// surface generation data
struct surfcache_s *cachespots[MIPLEVELS];
short texturemins[2];
short extents[2];
mtexinfo_t *texinfo;
// lighting info
byte styles[MAXLIGHTMAPS];
byte *samples; // [numstyles*surfsize]
} msurface_t;
typedef struct mnode_s
{
// common with leaf
int contents; // 0, to differentiate from leafs
int visframe; // node needs to be traversed if current
short minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
// node specific
mplane_t *plane;
struct mnode_s *children[2];
unsigned short firstsurface;
unsigned short numsurfaces;
} mnode_t;
typedef struct mleaf_s
{
// common with node
int contents; // wil be a negative contents number
int visframe; // node needs to be traversed if current
short minmaxs[6]; // for bounding box culling
struct mnode_s *parent;
// leaf specific
byte *compressed_vis;
efrag_t *efrags;
msurface_t **firstmarksurface;
int nummarksurfaces;
int key; // BSP sequence number for leaf's contents
byte ambient_sound_level[NUM_AMBIENTS];
} mleaf_t;
// !!! if this is changed, it must be changed in asm_i386.h too !!!
typedef struct
{
dclipnode_t *clipnodes;
mplane_t *planes;
int firstclipnode;
int lastclipnode;
vec3_t clip_mins;
vec3_t clip_maxs;
} hull_t;
/*
==============================================================================
SPRITE MODELS
==============================================================================
*/
// FIXME: shorten these?
typedef struct mspriteframe_s
{
int width;
int height;
void *pcachespot; // remove?
float up, down, left, right;
byte pixels[4];
} mspriteframe_t;
typedef struct
{
int numframes;
float *intervals;
mspriteframe_t *frames[1];
} mspritegroup_t;
typedef struct
{
spriteframetype_t type;
mspriteframe_t *frameptr;
} mspriteframedesc_t;
typedef struct
{
int type;
int maxwidth;
int maxheight;
int numframes;
float beamlength; // remove?
void *cachespot; // remove?
mspriteframedesc_t frames[1];
} msprite_t;
/*
==============================================================================
ALIAS MODELS
Alias models are position independent, so the cache manager can move them.
==============================================================================
*/
typedef struct
{
aliasframetype_t type;
trivertx_t bboxmin;
trivertx_t bboxmax;
int frame;
char name[16];
} maliasframedesc_t;
typedef struct
{
aliasskintype_t type;
void *pcachespot;
int skin;
} maliasskindesc_t;
typedef struct
{
trivertx_t bboxmin;
trivertx_t bboxmax;
int frame;
} maliasgroupframedesc_t;
typedef struct
{
int numframes;
int intervals;
maliasgroupframedesc_t frames[1];
} maliasgroup_t;
typedef struct
{
int numskins;
int intervals;
maliasskindesc_t skindescs[1];
} maliasskingroup_t;
// !!! if this is changed, it must be changed in asm_draw.h too !!!
typedef struct mtriangle_s {
int facesfront;
int vertindex[3];
} mtriangle_t;
typedef struct {
int model;
int stverts;
int skindesc;
int triangles;
maliasframedesc_t frames[1];
} aliashdr_t;
//===================================================================
//
// Whole model
//
typedef enum {mod_brush, mod_sprite, mod_alias} modtype_t;
#define EF_ROCKET 1 // leave a trail
#define EF_GRENADE 2 // leave a trail
#define EF_GIB 4 // leave a trail
#define EF_ROTATE 8 // rotate (bonus items)
#define EF_TRACER 16 // green split trail
#define EF_ZOMGIB 32 // small blood trail
#define EF_TRACER2 64 // orange split trail + rotate
#define EF_TRACER3 128 // purple trail
typedef struct model_s
{
char name[MAX_QPATH];
qboolean needload; // bmodels and sprites don't cache normally
modtype_t type;
int numframes;
synctype_t synctype;
int flags;
//
// volume occupied by the model
//
vec3_t mins, maxs;
float radius;
//
// brush model
//
int firstmodelsurface, nummodelsurfaces;
int numsubmodels;
dmodel_t *submodels;
int numplanes;
mplane_t *planes;
int numleafs; // number of visible leafs, not counting 0
mleaf_t *leafs;
int numvertexes;
mvertex_t *vertexes;
int numedges;
medge_t *edges;
int numnodes;
mnode_t *nodes;
int numtexinfo;
mtexinfo_t *texinfo;
int numsurfaces;
msurface_t *surfaces;
int numsurfedges;
int *surfedges;
int numclipnodes;
dclipnode_t *clipnodes;
int nummarksurfaces;
msurface_t **marksurfaces;
hull_t hulls[MAX_MAP_HULLS];
int numtextures;
texture_t **textures;
byte *visdata;
byte *lightdata;
char *entities;
//
// additional model data
//
cache_user_t cache; // only access through Mod_Extradata
} model_t;
//============================================================================
void Mod_Init (void);
void Mod_ClearAll (void);
model_t *Mod_ForName (char *name, qboolean crash);
void *Mod_Extradata (model_t *mod); // handles caching
void Mod_TouchModel (char *name);
mleaf_t *Mod_PointInLeaf (float *p, model_t *model);
byte *Mod_LeafPVS (mleaf_t *leaf, model_t *model);
#endif // __MODEL__

View file

@ -640,162 +640,3 @@ void R_RocketTrail (vec3_t start, vec3_t end, int type)
} }
/*
===============
R_DrawParticles
===============
*/
extern cvar_t sv_gravity;
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
}

206
uquake/sw_cl_parse.c Normal file
View file

@ -0,0 +1,206 @@
/*
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 the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
// cl_parse.c -- parse a message received from the server
#include "quakedef.h"
entity_t *CL_EntityNum (int num);
/*
==================
CL_ParseUpdate
Parse an entity update message from the server
If an entities model or origin changes from frame to frame, it must be
relinked. Other attributes can change without relinking.
==================
*/
int bitcounts[16];
void CL_ParseUpdate (int bits)
{
model_t *model;
qboolean forcelink;
entity_t *ent;
int modnum, num, i;
if (cls.signon == SIGNONS - 1)
{ // first update is the final signon stage
cls.signon = SIGNONS;
CL_SignonReply ();
}
if (bits & U_MOREBITS)
{
i = MSG_ReadByte ();
bits |= (i<<8);
}
if (bits & U_LONGENTITY)
num = MSG_ReadShort ();
else
num = MSG_ReadByte ();
ent = CL_EntityNum (num);
for (i=0 ; i<16 ; i++)
if (bits&(1<<i))
bitcounts[i]++;
if (ent->msgtime != cl.mtime[1])
forcelink = true; // no previous frame to lerp from
else
forcelink = false;
ent->msgtime = cl.mtime[0];
if (bits & U_MODEL)
{
modnum = MSG_ReadByte ();
if (modnum >= MAX_MODELS)
Host_Error ("CL_ParseModel: bad modnum");
}
else
modnum = ent->baseline.modelindex;
model = cl.model_precache[modnum];
if (model != ent->model)
{
ent->model = model;
// automatic animation (torches, etc) can be either all together
// or randomized
if (model)
{
if (model->synctype == ST_RAND)
ent->syncbase = (float)(rand()&0x7fff) / 0x7fff;
else
ent->syncbase = 0.0;
}
else
forcelink = true; // hack to make null model players work
}
if (bits & U_FRAME)
ent->frame = MSG_ReadByte ();
else
ent->frame = ent->baseline.frame;
if (bits & U_COLORMAP)
i = MSG_ReadByte();
else
i = ent->baseline.colormap;
if (!i)
ent->colormap = vid.colormap;
else
{
if (i > cl.maxclients)
Sys_Error ("i >= cl.maxclients");
ent->colormap = cl.scores[i-1].translations;
}
if (bits & U_SKIN)
ent->skinnum = MSG_ReadByte();
else
ent->skinnum = ent->baseline.skin;
if (bits & U_EFFECTS)
ent->effects = MSG_ReadByte();
else
ent->effects = ent->baseline.effects;
// shift the known values for interpolation
VectorCopy (ent->msg_origins[0], ent->msg_origins[1]);
VectorCopy (ent->msg_angles[0], ent->msg_angles[1]);
if (bits & U_ORIGIN1)
ent->msg_origins[0][0] = MSG_ReadCoord ();
else
ent->msg_origins[0][0] = ent->baseline.origin[0];
if (bits & U_ANGLE1)
ent->msg_angles[0][0] = MSG_ReadAngle();
else
ent->msg_angles[0][0] = ent->baseline.angles[0];
if (bits & U_ORIGIN2)
ent->msg_origins[0][1] = MSG_ReadCoord ();
else
ent->msg_origins[0][1] = ent->baseline.origin[1];
if (bits & U_ANGLE2)
ent->msg_angles[0][1] = MSG_ReadAngle();
else
ent->msg_angles[0][1] = ent->baseline.angles[1];
if (bits & U_ORIGIN3)
ent->msg_origins[0][2] = MSG_ReadCoord ();
else
ent->msg_origins[0][2] = ent->baseline.origin[2];
if (bits & U_ANGLE3)
ent->msg_angles[0][2] = MSG_ReadAngle();
else
ent->msg_angles[0][2] = ent->baseline.angles[2];
if ( bits & U_NOLERP )
ent->forcelink = true;
if ( forcelink )
{ // didn't have an update last message
VectorCopy (ent->msg_origins[0], ent->msg_origins[1]);
VectorCopy (ent->msg_origins[0], ent->origin);
VectorCopy (ent->msg_angles[0], ent->msg_angles[1]);
VectorCopy (ent->msg_angles[0], ent->angles);
ent->forcelink = true;
}
}
/*
=====================
CL_NewTranslation
=====================
*/
void CL_NewTranslation (int slot)
{
int i, j;
int top, bottom;
byte *dest, *source;
if (slot > cl.maxclients)
Sys_Error ("CL_NewTranslation: slot > cl.maxclients");
dest = cl.scores[slot].translations;
source = vid.colormap;
memcpy (dest, vid.colormap, sizeof(cl.scores[slot].translations));
top = cl.scores[slot].colors & 0xf0;
bottom = (cl.scores[slot].colors &15)<<4;
for (i=0 ; i<VID_GRADES ; i++, dest += 256, source+=256)
{
if (top < 128) // the artists made some backwards ranges. sigh.
memcpy (dest + TOP_RANGE, source + top, 16);
else
for (j=0 ; j<16 ; j++)
dest[TOP_RANGE+j] = source[top+15-j];
if (bottom < 128)
memcpy (dest + BOTTOM_RANGE, source + bottom, 16);
else
for (j=0 ; j<16 ; j++)
dest[BOTTOM_RANGE+j] = source[bottom+15-j];
}
}

View file

@ -65,9 +65,7 @@ cvar_t crosshaircolor = {"crosshaircolor", "79", true};
cvar_t cl_crossx = {"cl_crossx", "0", true}; cvar_t cl_crossx = {"cl_crossx", "0", true};
cvar_t cl_crossy = {"cl_crossy", "0", true}; cvar_t cl_crossy = {"cl_crossy", "0", true};
#ifdef GLQUAKE
cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100", false}; cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100", false};
#endif
float v_dmg_time, v_dmg_roll, v_dmg_pitch; float v_dmg_time, v_dmg_roll, v_dmg_pitch;
@ -261,10 +259,8 @@ cvar_t v_gamma = {"gamma", "1", true};
byte gammatable[256]; // palette is sent through this byte gammatable[256]; // palette is sent through this
#ifdef GLQUAKE
byte ramps[3][256]; byte ramps[3][256];
float v_blend[4]; // rgba 0.0 - 1.0 float v_blend[4]; // rgba 0.0 - 1.0
#endif // GLQUAKE
void BuildGammaTable (float g) void BuildGammaTable (float g)
{ {
@ -479,7 +475,6 @@ void V_CalcPowerupCshift (void)
V_CalcBlend V_CalcBlend
============= =============
*/ */
#ifdef GLQUAKE
void V_CalcBlend (void) void V_CalcBlend (void)
{ {
float r, g, b, a, a2; float r, g, b, a, a2;
@ -517,169 +512,6 @@ void V_CalcBlend (void)
if (v_blend[3] < 0) if (v_blend[3] < 0)
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
/* /*
@ -1057,10 +889,8 @@ void V_RenderView (void)
#endif #endif
R_RenderView (); R_RenderView ();
#ifndef GLQUAKE
if (crosshair.value) if (crosshair.value)
Draw_Crosshair(); Draw_Crosshair();
#endif
} }
@ -1095,9 +925,7 @@ void V_Init (void)
Cvar_RegisterVariable (&crosshair); Cvar_RegisterVariable (&crosshair);
Cvar_RegisterVariable (&cl_crossx); Cvar_RegisterVariable (&cl_crossx);
Cvar_RegisterVariable (&cl_crossy); Cvar_RegisterVariable (&cl_crossy);
#ifdef GLQUAKE
Cvar_RegisterVariable (&gl_cshiftpercent); Cvar_RegisterVariable (&gl_cshiftpercent);
#endif
Cvar_RegisterVariable (&scr_ofsx); Cvar_RegisterVariable (&scr_ofsx);
Cvar_RegisterVariable (&scr_ofsy); Cvar_RegisterVariable (&scr_ofsy);