Merge world.h. Also reduced smoke particle textures from 8 to 1, a considerable speedup through reduced texture thrash...

This commit is contained in:
Ragnvald Maartmann-Moe IV 2001-09-24 17:52:13 +00:00
parent c74fc1c0df
commit e2f14519fb
11 changed files with 89 additions and 260 deletions

View file

@ -6,7 +6,7 @@ EXTRA_DIST = asm_i386.h adivtab.h anorm_dots.h anorms.h asm_draw.h block16.h \
d_local.h dga_check.h fbset.h gl_warp_sin.h \ d_local.h dga_check.h fbset.h gl_warp_sin.h \
in_win.h logos.h menu.h old_keys.h quakeasm.h r_cvar.h \ in_win.h logos.h menu.h old_keys.h quakeasm.h r_cvar.h \
r_dynamic.h r_local.h r_shared.h sbar.h stamp-h.in varrays.h \ r_dynamic.h r_local.h r_shared.h sbar.h stamp-h.in varrays.h \
vgamodes.h view.h vregset.h winquake.h \ vgamodes.h view.h vregset.h winquake.h world.h \
\ \
win32/bc/borland.c win32/bc/config.h \ win32/bc/borland.c win32/bc/config.h \
\ \

View file

@ -45,11 +45,13 @@ extern struct cvar_s *r_ambient;
extern struct cvar_s *r_clearcolor; extern struct cvar_s *r_clearcolor;
extern struct cvar_s *r_dlight_lightmap; extern struct cvar_s *r_dlight_lightmap;
extern struct cvar_s *r_drawentities; extern struct cvar_s *r_drawentities;
extern struct cvar_s *r_drawexplosions; // DESPAIR
extern struct cvar_s *r_drawflat; extern struct cvar_s *r_drawflat;
extern struct cvar_s *r_draworder; extern struct cvar_s *r_draworder;
extern struct cvar_s *r_drawviewmodel; extern struct cvar_s *r_drawviewmodel;
extern struct cvar_s *r_dspeeds; extern struct cvar_s *r_dspeeds;
extern struct cvar_s *r_dynamic; extern struct cvar_s *r_dynamic;
extern struct cvar_s *r_explosionclip; // DESPAIR
extern struct cvar_s *r_firecolor; extern struct cvar_s *r_firecolor;
extern struct cvar_s *r_fullbright; extern struct cvar_s *r_fullbright;
extern struct cvar_s *r_graphheight; extern struct cvar_s *r_graphheight;

View file

@ -11,6 +11,6 @@ noinst_LTLIBRARIES = $(GL)
libgl_la_LDFLAGS = -version-info 1:0:0 libgl_la_LDFLAGS = -version-info 1:0:0
libgl_la_SOURCES = gl_draw.c gl_dyn_fires.c gl_dyn_part.c gl_dyn_lights.c \ libgl_la_SOURCES = gl_draw.c gl_dyn_fires.c gl_dyn_part.c gl_dyn_lights.c \
gl_dyn_textures.c gl_graph.c gl_rmain.c gl_rmisc.c gl_rsurf.c \ gl_dyn_textures.c gl_dyn_explosions.c gl_graph.c gl_rmain.c \
gl_screen.c gl_skin.c gl_sky.c gl_sky_clip.c gl_textures.c gl_warp.c \ gl_rmisc.c gl_rsurf.c gl_screen.c gl_skin.c gl_sky.c gl_sky_clip.c \
gl_funcs.c noisetextures.c gl_textures.c gl_warp.c gl_funcs.c noisetextures.c

View file

@ -56,7 +56,7 @@
int ramp[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 }; int ramp[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 };
extern int part_tex_dot, part_tex_spark, part_tex_smoke[8]; extern int part_tex_dot, part_tex_smoke, part_tex_spark;
extern short r_maxparticles, numparticles; extern short r_maxparticles, numparticles;
extern particle_t *particles, **freeparticles; extern particle_t *particles, **freeparticles;
@ -174,11 +174,11 @@ R_ParticleExplosion (vec3_t org)
// else if (numparticles + j >= r_maxparticles) // else if (numparticles + j >= r_maxparticles)
// j = r_maxparticles - numparticles; // j = r_maxparticles - numparticles;
particle_new_random (pt_smokecloud, part_tex_smoke[rand () & 7], org, 4, particle_new_random (pt_smokecloud, part_tex_smoke, org, 4,
30, 8, r_realtime + 5, (rand () & 7) + 8, 30, 8, r_realtime + 5, (rand () & 7) + 8,
128 + (rand () & 63)); 128 + (rand () & 63));
/*
for (i=0; i < j; i++) { /* for (i=0; i < j; i++) {
particle_new_random (pt_fallfadespark, part_tex_spark, org, 16, particle_new_random (pt_fallfadespark, part_tex_spark, org, 16,
1.5, 256, r_realtime + 5, ramp[rand () & 7], 1.5, 256, r_realtime + 5, ramp[rand () & 7],
255); 255);
@ -239,7 +239,7 @@ R_RunSparkEffect (vec3_t org, int count, int ofuzz)
j = r_maxparticles - numparticles; j = r_maxparticles - numparticles;
count = j - 1; count = j - 1;
particle_new (pt_smokecloud, part_tex_smoke[rand () & 7], org, particle_new (pt_smokecloud, part_tex_smoke, org,
ofuzz * 0.08, vec3_origin, r_realtime + 9, ofuzz * 0.08, vec3_origin, r_realtime + 9,
12 + (rand () & 3), 64 + (rand () & 31)); 12 + (rand () & 3), 64 + (rand () & 31));
while (count--) while (count--)
@ -254,7 +254,7 @@ R_BloodPuff (vec3_t org, int count)
if (numparticles >= r_maxparticles) if (numparticles >= r_maxparticles)
return; return;
particle_new (pt_bloodcloud, part_tex_smoke[rand () & 7], org, 9, particle_new (pt_bloodcloud, part_tex_smoke, org, 9,
vec3_origin, r_realtime + 99, 68 + (rand () & 3), 128); vec3_origin, r_realtime + 99, 68 + (rand () & 3), 128);
} }
@ -287,7 +287,7 @@ R_RunPuffEffect (vec3_t org, particle_effect_t type, byte count)
else if (numparticles + count >= r_maxparticles) else if (numparticles + count >= r_maxparticles)
count = r_maxparticles - numparticles - 1; count = r_maxparticles - numparticles - 1;
particle_new (pt_smokecloud, part_tex_smoke[rand () & 7], org, particle_new (pt_smokecloud, part_tex_smoke, org,
3, vec3_origin, r_realtime + 9, 3, vec3_origin, r_realtime + 9,
12 + (rand () & 3), 64 + (rand () & 31)); 12 + (rand () & 3), 64 + (rand () & 31));
while (count--) while (count--)
@ -447,7 +447,7 @@ R_RocketTrail (entity_t *ent)
len -= dist; len -= dist;
// Misty-chan's Easter Egg: change color to (rand () & 255) // Misty-chan's Easter Egg: change color to (rand () & 255)
particle_new (pt_smoke, part_tex_smoke[rand () & 7], ent->old_origin, particle_new (pt_smoke, part_tex_smoke, ent->old_origin,
pscale, vec3_origin, r_realtime + 2.0, pscale, vec3_origin, r_realtime + 2.0,
12 + (rand () & 3), 128 + (rand () & 31)); 12 + (rand () & 3), 128 + (rand () & 31));
pscale = pscalenext; pscale = pscalenext;
@ -479,7 +479,7 @@ R_GrenadeTrail (entity_t *ent)
len -= dist; len -= dist;
// Misty-chan's Easter Egg: change color to (rand () & 255) // Misty-chan's Easter Egg: change color to (rand () & 255)
particle_new (pt_smoke, part_tex_smoke[rand () & 7], ent->old_origin, particle_new (pt_smoke, part_tex_smoke, ent->old_origin,
pscale, vec3_origin, r_realtime + 2.0, (rand () & 3), pscale, vec3_origin, r_realtime + 2.0, (rand () & 3),
128 + (rand () & 31)); 128 + (rand () & 31));
pscale = pscalenext; pscale = pscalenext;
@ -519,7 +519,7 @@ R_BloodTrail (entity_t *ent)
VectorAdd (ent->old_origin, subtract, ent->old_origin); VectorAdd (ent->old_origin, subtract, ent->old_origin);
len -= dist; len -= dist;
particle_new (pt_grav, part_tex_smoke[rand () & 7], porg, pscale, pvel, particle_new (pt_grav, part_tex_smoke, porg, pscale, pvel,
r_realtime + 2.0, 68 + (rand () & 3), 255); r_realtime + 2.0, 68 + (rand () & 3), 255);
pscale = pscalenext; pscale = pscalenext;
} }
@ -558,7 +558,7 @@ R_SlightBloodTrail (entity_t *ent)
VectorAdd (ent->old_origin, subtract, ent->old_origin); VectorAdd (ent->old_origin, subtract, ent->old_origin);
len -= dist; len -= dist;
particle_new (pt_grav, part_tex_smoke[rand () & 7], porg, pscale, pvel, particle_new (pt_grav, part_tex_smoke, porg, pscale, pvel,
r_realtime + 1.5, 68 + (rand () & 3), 192); r_realtime + 1.5, 68 + (rand () & 3), 192);
pscale = pscalenext; pscale = pscalenext;
} }
@ -596,7 +596,7 @@ R_GreenTrail (entity_t *ent)
VectorAdd (ent->old_origin, subtract, ent->old_origin); VectorAdd (ent->old_origin, subtract, ent->old_origin);
len -= dist; len -= dist;
particle_new (pt_fire, part_tex_smoke[rand () & 7], ent->old_origin, particle_new (pt_fire, part_tex_smoke, ent->old_origin,
2.0 + qfrandom (1.0), pvel, r_realtime + 0.5, 2.0 + qfrandom (1.0), pvel, r_realtime + 0.5,
52 + (rand () & 4), 255); 52 + (rand () & 4), 255);
} }
@ -634,7 +634,7 @@ R_FlameTrail (entity_t *ent)
VectorAdd (ent->old_origin, subtract, ent->old_origin); VectorAdd (ent->old_origin, subtract, ent->old_origin);
len -= dist; len -= dist;
particle_new (pt_fire, part_tex_smoke[rand () & 7], ent->old_origin, particle_new (pt_fire, part_tex_smoke, ent->old_origin,
2.0 + qfrandom (1.0), pvel, r_realtime + 0.5, 234, 255); 2.0 + qfrandom (1.0), pvel, r_realtime + 0.5, 234, 255);
} }
} }
@ -767,7 +767,7 @@ R_DrawParticles (void)
part->scale += r_frametime * 4; part->scale += r_frametime * 4;
// part->org[2] += r_frametime * 30 - grav; // part->org[2] += r_frametime * 30 - grav;
break; break;
case pt_smokecloud: case pt_smokecloud: // DESPAIR
if ((part->alpha -= r_frametime * 140) < 1) if ((part->alpha -= r_frametime * 140) < 1)
{ {
part->die = -1; part->die = -1;
@ -785,16 +785,6 @@ R_DrawParticles (void)
part->scale += r_frametime * 4; part->scale += r_frametime * 4;
part->vel[2] -= grav; part->vel[2] -= grav;
break; break;
case pt_fadespark:
if ((part->alpha -= r_frametime * 256) < 1)
part->die = -1;
part->vel[2] -= grav;
break;
case pt_fadespark2:
if ((part->alpha -= r_frametime * 512) < 1)
part->die = -1;
part->vel[2] -= grav;
break;
case pt_fallfadespark: case pt_fallfadespark:
if ((part->alpha -= r_frametime * 256) < 1) if ((part->alpha -= r_frametime * 256) < 1)
part->die = -1; part->die = -1;

View file

@ -37,25 +37,13 @@
#include "QF/GL/funcs.h" #include "QF/GL/funcs.h"
#include "QF/GL/qf_vid.h" #include "QF/GL/qf_vid.h"
int part_tex_dot;
int part_tex_smoke;
int part_tex_spark;
extern void noise_diamondsquare(unsigned char *noise, int size); extern void noise_diamondsquare(unsigned char *noise, int size);
extern void noise_plasma(unsigned char *noise, int size); extern void noise_plasma(unsigned char *noise, int size);
static void GDT_InitDotParticleTexture (void);
static void GDT_InitSparkParticleTexture (void);
static void GDT_InitSmokeParticleTexture (void);
int part_tex_dot;
int part_tex_spark;
int part_tex_smoke[8];
void
GDT_Init (void)
{
GDT_InitDotParticleTexture ();
GDT_InitSparkParticleTexture ();
GDT_InitSmokeParticleTexture ();
}
static void static void
GDT_InitDotParticleTexture (void) GDT_InitDotParticleTexture (void)
@ -123,81 +111,41 @@ GDT_InitSmokeParticleTexture (void)
byte d; byte d;
byte data[32][32][2], noise1[32][32], noise2[32][32]; byte data[32][32][2], noise1[32][32], noise2[32][32];
float dx, dy2; float dx, dy2;
int i, x, y, c; int x, y, c;
for (i = 0; i < 8; i++) { noise_plasma (&noise1[0][0], 32);
noise_plasma (&noise1[0][0], 32); noise_diamondsquare (&noise2[0][0], 32);
noise_diamondsquare (&noise2[0][0], 32); for (y = 0; y < 32; y++)
for (y = 0; y < 32; y++) {
{ dy2 = y - 16;
dy2 = y - 16; dy2 *= dy2;
dy2 *= dy2; for (x = 0; x < 32; x++) {
for (x = 0; x < 32; x++) { dx = x - 16;
dx = x - 16; c = 255 - (dx*dx + dy2);
c = 255 - (dx*dx + dy2); if (c < 1)
if (c < 1) c = 0;
c = 0; d = (noise1[y][x] + noise2[y][x]) / 2;
d = (noise1[y][x] + noise2[y][x]) / 2; if (d > 0) {
if (d > 0) { data[y][x][0] = 255;
data[y][x][0] = 255; data[y][x][1] = (d * c)/255;
data[y][x][1] = (d * c)/255; } else {
} else { data[y][x][0] = 255;
data[y][x][0] = 255; data[y][x][1] = 0;
data[y][x][1] = 0;
}
} }
} }
part_tex_smoke[i] = texture_extension_number++;
qfglBindTexture (GL_TEXTURE_2D, part_tex_smoke[i]);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
qfglTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data);
} }
part_tex_smoke = texture_extension_number++;
qfglBindTexture (GL_TEXTURE_2D, part_tex_smoke);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
qfglTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data);
} }
#if 0 void
static void GDT_Init (void)
GDT_InitSmokeRingParticleTexture (void)
{ {
byte d; GDT_InitDotParticleTexture ();
byte data[32][32][2], noise1[32][32], noise2[32][32]; GDT_InitSparkParticleTexture ();
float dx, dy, c, c2; GDT_InitSmokeParticleTexture ();
int i, x, y, b;
for (i = 0; i < 8; i++) {
noise_diamondsquare (&noise1[0][0], 32);
noise_plasma (&noise2[0][0], 32);
for (y = 0; y < 32; y++)
{
dy = y - 16;
dy *= dy;
for (x = 0; x < 32; x++) {
dx = x - 16;
dx *= dx;
c = 255 - (dx + dy);
c2 = (dx + dy);
if (c < 1) c = 0;
if (c2 < 1) c2 = 0;
//b = ((c / 255) * (c2 / 255)) * 512;
b = (c * c2) * 512 / (255*255);
if (b < 1) b = 0;
d = (noise1[y][x] + noise2[y][x]) / 2;
if (d > 0) {
data[y][x][0] = 255;
data[y][x][1] = (d * b)/255;
} else {
data[y][x][0] = 255;
data[y][x][1] = 0;
}
}
}
part_tex_smoke_ring[i] = texture_extension_number++;
qfglBindTexture (GL_TEXTURE_2D, part_tex_smoke_ring[i]);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
qfglTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
qfglTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA,
GL_UNSIGNED_BYTE, data);
}
} }
#endif

View file

@ -86,10 +86,12 @@ cvar_t *r_ambient;
cvar_t *r_clearcolor; cvar_t *r_clearcolor;
cvar_t *r_dlight_lightmap; cvar_t *r_dlight_lightmap;
cvar_t *r_drawentities; cvar_t *r_drawentities;
cvar_t *r_drawexplosions; // DESPAIR
cvar_t *r_drawflat; cvar_t *r_drawflat;
cvar_t *r_drawviewmodel; cvar_t *r_drawviewmodel;
cvar_t *r_dspeeds; cvar_t *r_dspeeds;
cvar_t *r_dynamic; cvar_t *r_dynamic;
cvar_t *r_explosionclip; // DESPAIR
cvar_t *r_firecolor; cvar_t *r_firecolor;
cvar_t *r_graphheight; cvar_t *r_graphheight;
cvar_t *r_lightmap_components; cvar_t *r_lightmap_components;
@ -252,6 +254,8 @@ R_Init_Cvars (void)
r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, NULL, r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, NULL,
"Toggles drawing of entities (almost " "Toggles drawing of entities (almost "
"everything but the world)"); "everything but the world)");
r_drawexplosions = Cvar_Get ("r_drawexplosions", "1", CVAR_ARCHIVE, NULL,
"Draw explosions."); // DESPAIR
r_drawflat = Cvar_Get ("r_drawflat", "0", CVAR_NONE, NULL, r_drawflat = Cvar_Get ("r_drawflat", "0", CVAR_NONE, NULL,
"Toggles the drawing of textures"); "Toggles the drawing of textures");
r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, NULL, r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, NULL,
@ -260,6 +264,8 @@ R_Init_Cvars (void)
"Toggles the display of drawing speed information"); "Toggles the display of drawing speed information");
r_dynamic = Cvar_Get ("r_dynamic", "1", CVAR_NONE, NULL, r_dynamic = Cvar_Get ("r_dynamic", "1", CVAR_NONE, NULL,
"Set to 0 to disable lightmap changes"); "Set to 0 to disable lightmap changes");
r_explosionclip = Cvar_Get ("r_explosionclip", "0", CVAR_ARCHIVE, NULL,
"Clip explosions."); // DESPAIR
r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.4 0", CVAR_ARCHIVE, NULL, r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.4 0", CVAR_ARCHIVE, NULL,
"color of rocket and lava ball fires"); "color of rocket and lava ball fires");
r_graphheight = Cvar_Get ("r_graphheight", "32", CVAR_NONE, NULL, r_graphheight = Cvar_Get ("r_graphheight", "32", CVAR_NONE, NULL,

View file

@ -62,33 +62,33 @@
#define WARP_WIDTH 320 #define WARP_WIDTH 320
#define WARP_HEIGHT 200 #define WARP_HEIGHT 200
unsigned int d_8to24table[256]; unsigned char d_15to8table[65536];
unsigned char d_15to8table[65536]; unsigned int d_8to24table[256];
cvar_t *vid_mode; QF_glActiveTextureARB qglActiveTexture = NULL;
cvar_t *gl_multitexture; QF_glMultiTexCoord2fARB qglMultiTexCoord2f = NULL;
QF_glActiveTextureARB qglActiveTexture = NULL; const char *gl_extensions;
QF_glMultiTexCoord2fARB qglMultiTexCoord2f = NULL; const char *gl_renderer;
int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST, gl_filter_max = GL_LINEAR; const char *gl_vendor;
const char *gl_version;
int texture_extension_number = 1; int texture_extension_number = 1;
float gldepthmin, gldepthmax; int gl_filter_min = GL_LINEAR_MIPMAP_NEAREST;
int gl_filter_max = GL_LINEAR;
const char *gl_vendor; float gldepthmin, gldepthmax;
const char *gl_renderer;
const char *gl_version;
const char *gl_extensions;
// ARB Multitexture // ARB Multitexture
qboolean gl_mtex_active = false; qboolean gl_mtex_active = false;
qboolean gl_mtex_capable = false; qboolean gl_mtex_capable = false;
GLenum gl_mtex_enum = GL_TEXTURE0_ARB; GLenum gl_mtex_enum = GL_TEXTURE0_ARB;
QF_glColorTableEXT qglColorTableEXT = NULL; QF_glColorTableEXT qglColorTableEXT = NULL;
qboolean is8bit = false; qboolean is8bit = false;
cvar_t *vid_use8bit; cvar_t *gl_multitexture;
cvar_t *vid_mode;
cvar_t *vid_use8bit;
extern byte gammatable[256]; extern byte gammatable[256];
extern qboolean GLF_Init (); extern qboolean GLF_Init ();
@ -139,9 +139,10 @@ CheckMultiTextureExtensions (void)
if (qglMultiTexCoord2f && gl_mtex_enum) if (qglMultiTexCoord2f && gl_mtex_enum)
gl_mtex_capable = true; gl_mtex_capable = true;
else else
Con_Printf ("disabled, could not find required functions\n"); Con_Printf ("Multitexture disabled, could not find required "
"functions\n");
} else { } else {
Con_Printf ("disabled, not enough TMUs.\n"); Con_Printf ("Multitexture disabled, not enough TMUs.\n");
} }
} else { } else {
Con_Printf ("not found.\n"); Con_Printf ("not found.\n");

View file

@ -1,7 +1,5 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
EXTRA_DIST= chase.h client.h conproc.h \ EXTRA_DIST= chase.h client.h conproc.h game.h host.h net.h net_bw.h \
game.h host.h net.h net_bw.h \ net_dgrm.h net_ipx.h net_loop.h net_mp.h net_udp.h net_vcr.h \
net_dgrm.h net_ipx.h net_loop.h net_mp.h net_udp.h \ net_wins.h net_wipx.h protocol.h server.h sv_pr_cmds.h \
net_vcr.h net_wins.h net_wipx.h \ sv_progs.h
protocol.h \
server.h sv_pr_cmds.h sv_progs.h world.h

View file

@ -1,9 +1,7 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS= foreign AUTOMAKE_OPTIONS= foreign
EXTRA_DIST = bothdefs.h cl_cam.h cl_demo.h cl_ents.h cl_input.h \ EXTRA_DIST = bothdefs.h cl_cam.h cl_demo.h cl_ents.h cl_input.h cl_main.h \
cl_main.h cl_parse.h cl_pred.h cl_skin.h cl_slist.h cl_tent.h client.h \ cl_parse.h cl_pred.h cl_skin.h cl_slist.h cl_tent.h client.h \
crudefile.h game.h host.h \ crudefile.h game.h host.h msg_ucmd.h net.h pmove.h \
msg_ucmd.h net.h pmove.h \ protocol.h server.h sv_pr_cmds.h sv_progs.h
protocol.h server.h \
sv_pr_cmds.h sv_progs.h world.h

View file

@ -1,114 +0,0 @@
/*
world.h
@description@
Copyright (C) 1996-1997 Id Software, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to:
Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA
$Id$
*/
#ifndef __world_h
#define __world_h
#include "QF/link.h"
#include "QF/mathlib.h"
#include "QF/model.h"
typedef struct
{
vec3_t normal;
float dist;
} plane_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
plane_t plane; // surface normal at impact
struct edict_s *ent; // entity the surface is on
} trace_t;
#define MOVE_NORMAL 0
#define MOVE_NOMONSTERS 1
#define MOVE_MISSILE 2
typedef struct areanode_s
{
int axis; // -1 = leaf node
float dist;
struct areanode_s *children[2];
link_t trigger_edicts;
link_t solid_edicts;
} areanode_t;
#define AREA_DEPTH 4
#define AREA_NODES 32
extern areanode_t sv_areanodes[AREA_NODES];
void SV_InitHull (hull_t *hull, dclipnode_t *clipnodes, mplane_t *planes);
void SV_ClearWorld (void);
// called after the world model has been loaded, before linking any entities
void SV_UnlinkEdict (struct edict_s *ent);
// call before removing an entity, and before trying to move one,
// so it doesn't clip against itself
// flags ent->v.modified
void SV_LinkEdict (struct edict_s *ent, qboolean touch_triggers);
// Needs to be called any time an entity changes origin, mins, maxs, or solid
// flags ent->v.modified
// sets ent->v.absmin and ent->v.absmax
// if touchtriggers, calls prog functions for the intersected triggers
int SV_PointContents (vec3_t p);
int SV_TruePointContents (vec3_t p);
// returns the CONTENTS_* value from the world at the given point.
// does not check any entities at all
// the non-true version remaps the water current contents to content_water
struct edict_s *SV_TestEntityPosition (struct edict_s *ent);
trace_t SV_Move (vec3_t start, vec3_t mins, vec3_t maxs, vec3_t end, int type, struct edict_s *passedict);
// mins and maxs are reletive
// if the entire move stays in a solid volume, trace.allsolid will be set
// if the starting point is in a solid, it will be allowed to move out
// to an open area
// nomonsters is used for line of sight or edge testing, where mosnters
// shouldn't be considered solid objects
// passedict is explicitly excluded from clipping checks (normally NULL)
struct edict_s *SV_TestPlayerPosition (struct edict_s *ent, vec3_t origin);
int SV_HullPointContents (hull_t *hull, int num, vec3_t p);
hull_t *SV_HullForEntity (struct edict_s *ent, vec3_t mins, vec3_t maxs, vec3_t offset);
#endif // __world_h