mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
First pass at updating nq particles. Compiles. Crashes. Taniwha wanted a look. Flee in terror.
Also has bunches of cleanups, including string.h/strings.h ifdefs, whitespace, and removal of pointless comments.
This commit is contained in:
parent
80814f5437
commit
f6374b48ce
56 changed files with 2934 additions and 2989 deletions
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
client.h
|
||||
|
||||
@description@
|
||||
Client definitions
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -31,15 +31,16 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/info.h"
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/model.h"
|
||||
#include "QF/quakefs.h"
|
||||
#include "QF/sound.h"
|
||||
|
||||
#include "protocol.h"
|
||||
#include "net.h"
|
||||
#include "QF/model.h"
|
||||
#include "QF/sound.h"
|
||||
#include "render.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/quakefs.h"
|
||||
#include "game.h"
|
||||
|
||||
typedef struct usercmd_s
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
d_iface.h
|
||||
|
||||
@description@
|
||||
Interface header file for rasterization modules
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -29,6 +29,7 @@
|
|||
#ifndef __d_iface_h
|
||||
#define __d_iface_h
|
||||
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/model.h"
|
||||
#include "render.h"
|
||||
|
||||
|
@ -169,6 +170,7 @@ void D_DrawZPoint (void);
|
|||
void D_EnableBackBufferAccess (void);
|
||||
void D_EndParticles (void);
|
||||
void D_Init (void);
|
||||
void D_Init_Cvars (void);
|
||||
void D_ViewChanged (void);
|
||||
void D_SetupFrame (void);
|
||||
void D_StartParticles (void);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
draw.h
|
||||
|
||||
@description@
|
||||
Video buffer handling definitions and prototypes
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
|||
extern qpic_t *draw_disc; // also used on sbar
|
||||
|
||||
void Draw_Init (void);
|
||||
void Draw_Init_Cvars (void);
|
||||
void Draw_Character8 (int x, int y, int num);
|
||||
void Draw_DebugChar (char num);
|
||||
void Draw_Pic (int x, int y, qpic_t *pic);
|
||||
|
@ -49,7 +50,7 @@ void Draw_FadeScreen (void);
|
|||
void Draw_String8 (int x, int y, char *str);
|
||||
void Draw_Crosshair(void);
|
||||
qpic_t *Draw_PicFromWad (char *name);
|
||||
qpic_t *Draw_CachePic (char *path);
|
||||
qpic_t *Draw_CachePic (char *path, qboolean alpha);
|
||||
void Draw_Crosshair(void);
|
||||
|
||||
#endif // __draw_h
|
||||
|
|
56
nq/include/r_dynamic.h
Normal file
56
nq/include/r_dynamic.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
render.h
|
||||
|
||||
public interface to refresh functions
|
||||
|
||||
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 _R_DYNAMIC_H
|
||||
#define _R_DYNAMIC_H
|
||||
|
||||
#include "QF/mathlib.h"
|
||||
|
||||
void R_ParseParticleEffect (void);
|
||||
struct entity_s;
|
||||
void R_RocketTrail (int type, struct entity_s *ent);
|
||||
void R_RunParticleEffect (vec3_t org, int color, int count);
|
||||
void R_RunPuffEffect (vec3_t org, byte type, byte count);
|
||||
void R_RunSpikeEffect (vec3_t org, byte type);
|
||||
|
||||
#ifdef QUAKE2
|
||||
void R_DarkFieldParticles (entity_t *ent);
|
||||
#endif
|
||||
void R_EntityParticles (entity_t *ent);
|
||||
void R_BlobExplosion (vec3_t org);
|
||||
void R_ParticleExplosion (vec3_t org);
|
||||
void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);
|
||||
void R_LavaSplash (vec3_t org);
|
||||
void R_TeleportSplash (vec3_t org);
|
||||
void R_PushDlights (vec3_t entorigin);
|
||||
|
||||
void R_InitParticles (void);
|
||||
void R_ClearParticles (void);
|
||||
void R_DrawParticles (void);
|
||||
|
||||
#endif // _R_DYNAMIC_H
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
render.h
|
||||
|
||||
@description@
|
||||
public interface to refresh functions
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -29,9 +29,10 @@
|
|||
#ifndef __render_h
|
||||
#define __render_h
|
||||
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/vid.h"
|
||||
|
||||
#include "protocol.h"
|
||||
|
||||
#define MAXCLIPPLANES 11
|
||||
|
@ -45,15 +46,16 @@ typedef struct entity_s
|
|||
{
|
||||
qboolean forcelink; // model changed
|
||||
|
||||
int keynum; // FIXME: hack to match qw
|
||||
int update_type;
|
||||
|
||||
entity_state_t baseline; // to fill in defaults in updates
|
||||
|
||||
double msgtime; // time of last update
|
||||
vec3_t msg_origins[2]; // last two updates (0 is newest)
|
||||
vec3_t msg_origins[2]; // last two updates (0 is newest)
|
||||
vec3_t origin;
|
||||
vec3_t msg_angles[2]; // last two updates (0 is newest)
|
||||
vec3_t angles;
|
||||
vec3_t angles;
|
||||
struct model_s *model; // NULL = no model
|
||||
struct efrag_s *efrag; // linked list of efrags
|
||||
int frame;
|
||||
|
@ -61,17 +63,14 @@ typedef struct entity_s
|
|||
byte *colormap;
|
||||
int effects; // light, particals, etc
|
||||
int skinnum; // for Alias models
|
||||
int visframe; // last frame this entity was
|
||||
// found in an active leaf
|
||||
int visframe; // last frame this entity was found in an active leaf
|
||||
|
||||
int dlightframe; // dynamic lighting
|
||||
int dlightbits;
|
||||
|
||||
// FIXME: could turn these into a union
|
||||
int trivial_accept;
|
||||
struct mnode_s *topnode; // for bmodels, first world node
|
||||
// that splits bmodel, or NULL if
|
||||
// not split
|
||||
struct mnode_s *topnode; // for bmodels, first world node that splits bmodel, or NULL if not split
|
||||
} entity_t;
|
||||
|
||||
// !!! if this is changed, it must be changed in asm_draw.h too !!!
|
||||
|
@ -133,8 +132,11 @@ void R_NewMap (void);
|
|||
|
||||
|
||||
void R_ParseParticleEffect (void);
|
||||
void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
|
||||
void R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent);
|
||||
struct entity_s;
|
||||
void R_RocketTrail (int type, struct entity_s *ent);
|
||||
void R_RunParticleEffect (vec3_t org, int color, int count);
|
||||
void R_RunPuffEffect (vec3_t org, byte type, byte count);
|
||||
void R_RunSpikeEffect (vec3_t org, byte type);
|
||||
|
||||
#ifdef QUAKE2
|
||||
void R_DarkFieldParticles (entity_t *ent);
|
||||
|
|
|
@ -46,10 +46,8 @@ soft_ASM= d_draw.S d_draw16.S d_parta.S d_polysa.S d_scana.S d_spr8.S \
|
|||
surf16.S surf8.S
|
||||
common_ASM= sys_ia32.S worlda.S $(math_ASM)
|
||||
|
||||
common_SOURCES= game.c wad.c world.c \
|
||||
model.c model_alias.c model_brush.c model_sprite.c \
|
||||
com.c \
|
||||
$(common_ASM)
|
||||
common_SOURCES= game.c wad.c world.c model.c model_alias.c model_brush.c \
|
||||
model_sprite.c com.c $(common_ASM)
|
||||
|
||||
# ... System type
|
||||
if SYSTYPE_WIN32
|
||||
|
@ -90,7 +88,7 @@ combined_SOURCES= $(common_SOURCES) $(client_SOURCES) $(server_SOURCES) \
|
|||
soft_SOURCES= d_edge.c d_fill.c d_init.c d_modech.c d_part.c d_polyse.c \
|
||||
d_scan.c d_sky.c d_sprite.c d_surf.c d_vars.c d_zpoint.c \
|
||||
draw.c sw_raclip.c sw_ralias.c sw_rbsp.c sw_rdraw.c sw_redge.c sw_refrag.c \
|
||||
sw_rlight.c sw_rmain.c sw_rmisc.c sw_part.c sw_rsky.c sw_rsprite.c \
|
||||
sw_rlight.c sw_rmain.c sw_rmisc.c sw_rpart.c sw_rsky.c sw_rsprite.c \
|
||||
sw_rsurf.c sw_rvars.c screen.c sw_model_alias.c sw_model_brush.c \
|
||||
sw_model_sprite.c sw_view.c $(soft_ASM)
|
||||
|
||||
|
@ -122,10 +120,11 @@ nq_x11_DEPENDENCIES=$(client_LIB_DEPS)
|
|||
|
||||
# OpenGL-using targets
|
||||
# ... Common stuff
|
||||
ogl_SOURCES= gl_draw.c gl_mesh.c gl_part.c gl_refrag.c gl_rlight.c \
|
||||
gl_rmain.c gl_rmisc.c gl_rsurf.c gl_screen.c gl_view.c \
|
||||
gl_warp.c gl_model_alias.c gl_model_brush.c gl_model_fullbright.c \
|
||||
gl_model_sprite.c
|
||||
ogl_SOURCES= noisetextures.c gl_textures.c gl_draw.c gl_dyn_fires.c \
|
||||
gl_dyn_part.c gl_dyn_textures.c gl_mesh.c \
|
||||
gl_refrag.c gl_rlight.c gl_rmain.c gl_rmisc.c gl_rsurf.c \
|
||||
gl_screen.c gl_view.c gl_warp.c gl_model_alias.c \
|
||||
gl_model_brush.c gl_model_fullbright.c gl_model_sprite.c
|
||||
|
||||
# ... 3Dfx Voodoo 1 and 2 SVGAlib-based console GL
|
||||
nq_3dfx_SOURCES= $(combined_SOURCES) $(ogl_SOURCES)
|
||||
|
|
|
@ -29,7 +29,6 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
|
@ -70,14 +69,10 @@ Cmd_ForwardToServer (void)
|
|||
SZ_Print (&cls.message, "\n");
|
||||
}
|
||||
|
||||
/*
|
||||
cl_Cmd_Init
|
||||
*/
|
||||
|
||||
void
|
||||
cl_Cmd_Init (void)
|
||||
{
|
||||
//
|
||||
// register our commands
|
||||
//
|
||||
// register our commands
|
||||
Cmd_AddCommand ("cmd", Cmd_ForwardToServer, "No Description");
|
||||
}
|
||||
|
|
|
@ -30,8 +30,12 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/qendian.h"
|
||||
#include "QF/va.h"
|
||||
|
@ -330,12 +334,7 @@ CL_PlayDemo_f (void)
|
|||
// fscanf (cls.demofile, "%i\n", &cls.forcetrack);
|
||||
}
|
||||
|
||||
/*
|
||||
====================
|
||||
CL_FinishTimeDemo
|
||||
|
||||
====================
|
||||
*/
|
||||
void
|
||||
CL_FinishTimeDemo (void)
|
||||
{
|
||||
|
|
|
@ -29,18 +29,22 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "QF/msg.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/compat.h"
|
||||
#include "QF/keys.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/keys.h"
|
||||
#include "QF/msg.h"
|
||||
|
||||
#include "host.h"
|
||||
#include "client.h"
|
||||
#include "host.h"
|
||||
|
||||
/*
|
||||
===============================================================================
|
||||
|
@ -103,6 +107,7 @@ KeyDown (kbutton_t *b)
|
|||
b->state |= 1 + 2; // down + impulse down
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
KeyUp (kbutton_t *b)
|
||||
{
|
||||
|
@ -164,6 +169,7 @@ IN_MLookUp (void)
|
|||
if (!(in_mlook.state & 1) && lookspring->int_val)
|
||||
V_StartPitchDrift ();
|
||||
}
|
||||
|
||||
void
|
||||
IN_UpDown (void)
|
||||
{
|
||||
|
@ -350,6 +356,7 @@ IN_Impulse (void)
|
|||
in_impulse = atoi (Cmd_Argv (1));
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_KeyState
|
||||
|
@ -402,8 +409,6 @@ CL_KeyState (kbutton_t *key)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//==========================================================================
|
||||
|
||||
cvar_t *cl_upspeed;
|
||||
|
@ -473,6 +478,7 @@ CL_AdjustAngles (void)
|
|||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
CL_BaseMove
|
||||
|
@ -538,7 +544,6 @@ CL_BaseMove (usercmd_t *cmd)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
CL_SendMove
|
||||
|
@ -616,11 +621,7 @@ CL_SendMove (usercmd_t *cmd)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
============
|
||||
CL_InitInput
|
||||
============
|
||||
*/
|
||||
|
||||
void
|
||||
CL_InitInput (void)
|
||||
{
|
||||
|
@ -659,5 +660,4 @@ CL_InitInput (void)
|
|||
Cmd_AddCommand ("-klook", IN_KLookUp, "No Description");
|
||||
Cmd_AddCommand ("+mlook", IN_MLookDown, "No Description");
|
||||
Cmd_AddCommand ("-mlook", IN_MLookUp, "No Description");
|
||||
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/*
|
||||
cl_main.c
|
||||
|
||||
@description@
|
||||
entity parsing and management
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -31,19 +31,21 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "QF/msg.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/va.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "chase.h"
|
||||
#include "QF/input.h"
|
||||
#include "host.h"
|
||||
#include "QF/va.h"
|
||||
#include "host.h"
|
||||
#include "render.h"
|
||||
#include "server.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/cmd.h"
|
||||
|
||||
byte *vid_colormap;
|
||||
|
||||
|
@ -67,6 +69,8 @@ cvar_t *m_yaw;
|
|||
cvar_t *m_forward;
|
||||
cvar_t *m_side;
|
||||
|
||||
cvar_t *r_firecolor;
|
||||
|
||||
cvar_t *show_fps;
|
||||
cvar_t *show_time;
|
||||
|
||||
|
@ -85,74 +89,61 @@ dlight_t cl_dlights[MAX_DLIGHTS];
|
|||
int cl_numvisedicts;
|
||||
entity_t *cl_visedicts[MAX_VISEDICTS];
|
||||
|
||||
|
||||
void
|
||||
CL_InitCvars (void)
|
||||
{
|
||||
show_fps =
|
||||
Cvar_Get ("show_fps", "0", CVAR_NONE, NULL,
|
||||
"display realtime frames per second");
|
||||
// Misty: I like to be able to see the time when I play
|
||||
|
||||
r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.4 0", CVAR_ARCHIVE, NULL,
|
||||
"color of rocket and lava ball fires");
|
||||
show_fps = Cvar_Get ("show_fps", "0", CVAR_NONE, NULL,
|
||||
"display realtime frames per second");
|
||||
show_time = Cvar_Get ("show_time", "0", CVAR_NONE, NULL,
|
||||
"display the current time");
|
||||
cl_warncmd =
|
||||
Cvar_Get ("cl_warncmd", "0", CVAR_NONE, NULL,
|
||||
"inform when execing a command");
|
||||
"display the current time");
|
||||
cl_warncmd = Cvar_Get ("cl_warncmd", "0", CVAR_NONE, NULL,
|
||||
"inform when execing a command");
|
||||
cl_name = Cvar_Get ("_cl_name", "player", CVAR_ARCHIVE, NULL,
|
||||
"Player name");
|
||||
cl_color = Cvar_Get ("_cl_color", "0", CVAR_ARCHIVE, NULL, "Player color");
|
||||
cl_upspeed =
|
||||
Cvar_Get ("cl_upspeed", "200", CVAR_NONE, NULL,
|
||||
"swim/fly up/down speed");
|
||||
cl_forwardspeed =
|
||||
Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE, NULL,
|
||||
"forward speed");
|
||||
cl_backspeed =
|
||||
Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, NULL, "backward speed");
|
||||
"Player name");
|
||||
cl_color = Cvar_Get ("_cl_color", "0", CVAR_ARCHIVE, NULL,
|
||||
"Player color");
|
||||
cl_upspeed = Cvar_Get ("cl_upspeed", "200", CVAR_NONE, NULL,
|
||||
"swim/fly up/down speed");
|
||||
cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE,
|
||||
NULL, "forward speed");
|
||||
cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, NULL,
|
||||
"backward speed");
|
||||
cl_sidespeed = Cvar_Get ("cl_sidespeed", "350", CVAR_NONE, NULL,
|
||||
"strafe speed");
|
||||
cl_movespeedkey =
|
||||
Cvar_Get ("cl_movespeedkey", "2.0", CVAR_NONE, NULL,
|
||||
"move `run' speed multiplier");
|
||||
"strafe speed");
|
||||
cl_movespeedkey = Cvar_Get ("cl_movespeedkey", "2.0", CVAR_NONE, NULL,
|
||||
"move `run' speed multiplier");
|
||||
cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, NULL,
|
||||
"turning speed");
|
||||
cl_pitchspeed =
|
||||
Cvar_Get ("cl_pitchspeed", "150", CVAR_NONE, NULL,
|
||||
"look up/down speed");
|
||||
cl_anglespeedkey =
|
||||
Cvar_Get ("cl_anglespeedkey", "1.5", CVAR_NONE, NULL,
|
||||
"turn `run' speed multiplier");
|
||||
cl_shownet =
|
||||
Cvar_Get ("cl_shownet", "0", CVAR_NONE, NULL,
|
||||
"show network packets. 0=off, 1=basic, 2=verbose");
|
||||
cl_nolerp =
|
||||
Cvar_Get ("cl_nolerp", "0", CVAR_NONE, NULL,
|
||||
"linear motion interpolation");
|
||||
cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, NULL, "status bar mode");
|
||||
cl_hudswap =
|
||||
Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, NULL,
|
||||
"new HUD on left side?");
|
||||
"turning speed");
|
||||
cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "150", CVAR_NONE, NULL,
|
||||
"look up/down speed");
|
||||
cl_anglespeedkey = Cvar_Get ("cl_anglespeedkey", "1.5", CVAR_NONE,
|
||||
NULL, "turn `run' speed multiplier");
|
||||
cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_NONE, NULL,
|
||||
"show network packets. 0=off, 1=basic, 2=verbose");
|
||||
cl_nolerp = Cvar_Get ("cl_nolerp", "0", CVAR_NONE, NULL,
|
||||
"linear motion interpolation");
|
||||
cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, NULL,
|
||||
"status bar mode");
|
||||
cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, NULL,
|
||||
"new HUD on left side?");
|
||||
lookspring =
|
||||
Cvar_Get ("lookspring", "0", CVAR_ARCHIVE, NULL,
|
||||
"Snap view to center when moving and no mlook/klook");
|
||||
m_pitch =
|
||||
Cvar_Get ("m_pitch", "0.022", CVAR_ARCHIVE, NULL,
|
||||
"mouse pitch (up/down) multipier");
|
||||
m_yaw =
|
||||
Cvar_Get ("m_yaw", "0.022", CVAR_ARCHIVE, NULL,
|
||||
"mouse yaw (left/right) multipiler");
|
||||
m_forward =
|
||||
Cvar_Get ("m_forward", "1", CVAR_ARCHIVE, NULL,
|
||||
"mouse forward/back speed");
|
||||
"Snap view to center when moving and no mlook/klook");
|
||||
m_pitch = Cvar_Get ("m_pitch", "0.022", CVAR_ARCHIVE, NULL,
|
||||
"mouse pitch (up/down) multipier");
|
||||
m_yaw = Cvar_Get ("m_yaw", "0.022", CVAR_ARCHIVE, NULL,
|
||||
"mouse yaw (left/right) multipiler");
|
||||
m_forward = Cvar_Get ("m_forward", "1", CVAR_ARCHIVE, NULL,
|
||||
"mouse forward/back speed");
|
||||
m_side = Cvar_Get ("m_side", "0.8", CVAR_ARCHIVE, NULL,
|
||||
"mouse strafe speed");
|
||||
"mouse strafe speed");
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_ClearState
|
||||
|
||||
=====================
|
||||
*/
|
||||
void
|
||||
CL_ClearState (void)
|
||||
{
|
||||
|
@ -183,6 +174,7 @@ CL_ClearState (void)
|
|||
cl.free_efrags[i].entnext = NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_Disconnect
|
||||
|
@ -232,8 +224,6 @@ CL_Disconnect_f (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_EstablishConnection
|
||||
|
@ -263,6 +253,7 @@ CL_EstablishConnection (char *host)
|
|||
// before playing
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_SignonReply
|
||||
|
@ -309,6 +300,7 @@ CL_SignonReply (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_NextDemo
|
||||
|
@ -340,11 +332,7 @@ CL_NextDemo (void)
|
|||
cls.demonum++;
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
CL_PrintEntities_f
|
||||
==============
|
||||
*/
|
||||
|
||||
void
|
||||
CL_PrintEntities_f (void)
|
||||
{
|
||||
|
@ -404,12 +392,7 @@ SetPal (int i)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_AllocDlight
|
||||
|
||||
===============
|
||||
*/
|
||||
dlight_t *
|
||||
CL_AllocDlight (int key)
|
||||
{
|
||||
|
@ -446,11 +429,7 @@ CL_AllocDlight (int key)
|
|||
return dl;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_NewDlight
|
||||
===============
|
||||
*/
|
||||
|
||||
void
|
||||
CL_NewDlight (int key, float x, float y, float z, float radius, float time,
|
||||
int type)
|
||||
|
@ -488,12 +467,7 @@ CL_NewDlight (int key, float x, float y, float z, float radius, float time,
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_DecayLights
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
CL_DecayLights (void)
|
||||
{
|
||||
|
@ -562,11 +536,6 @@ CL_LerpPoint (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_RelinkEntities
|
||||
===============
|
||||
*/
|
||||
void
|
||||
CL_RelinkEntities (void)
|
||||
{
|
||||
|
@ -705,24 +674,27 @@ CL_RelinkEntities (void)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (ent->model->flags & EF_GIB)
|
||||
R_RocketTrail (oldorg, ent->origin, 2, ent);
|
||||
else if (ent->model->flags & EF_ZOMGIB)
|
||||
R_RocketTrail (oldorg, ent->origin, 4, ent);
|
||||
else if (ent->model->flags & EF_TRACER)
|
||||
R_RocketTrail (oldorg, ent->origin, 3, ent);
|
||||
else if (ent->model->flags & EF_TRACER2)
|
||||
R_RocketTrail (oldorg, ent->origin, 5, ent);
|
||||
else if (ent->model->flags & EF_ROCKET) {
|
||||
R_RocketTrail (oldorg, ent->origin, 0, ent);
|
||||
if (VectorDistance_fast(ent->msg_origins[1], ent->origin) > (256*256))
|
||||
VectorCopy (ent ->origin, ent->msg_origins[1]);
|
||||
if (ent->model->flags & EF_ROCKET) {
|
||||
dl = CL_AllocDlight (i);
|
||||
VectorCopy (ent->origin, dl->origin);
|
||||
VectorCopy (r_firecolor->vec, dl->color);
|
||||
dl->radius = 200;
|
||||
dl->die = cl.time + 0.01;
|
||||
dl->die = cl.time + 0.1;
|
||||
R_RocketTrail (0, ent);
|
||||
} else if (ent->model->flags & EF_GRENADE)
|
||||
R_RocketTrail (oldorg, ent->origin, 1, ent);
|
||||
R_RocketTrail (1, ent);
|
||||
else if (ent->model->flags & EF_GIB)
|
||||
R_RocketTrail (2, ent);
|
||||
else if (ent->model->flags & EF_ZOMGIB)
|
||||
R_RocketTrail (4, ent);
|
||||
else if (ent->model->flags & EF_TRACER)
|
||||
R_RocketTrail (3, ent);
|
||||
else if (ent->model->flags & EF_TRACER2)
|
||||
R_RocketTrail (5, ent);
|
||||
else if (ent->model->flags & EF_TRACER3)
|
||||
R_RocketTrail (oldorg, ent->origin, 6, ent);
|
||||
R_RocketTrail (6, ent);
|
||||
|
||||
ent->forcelink = false;
|
||||
|
||||
|
|
|
@ -30,8 +30,12 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "client.h"
|
||||
#include "host.h"
|
||||
|
@ -47,6 +51,7 @@
|
|||
#include "game.h"
|
||||
#include "QF/input.h"
|
||||
|
||||
|
||||
char *svc_strings[] = {
|
||||
"svc_bad",
|
||||
"svc_nop",
|
||||
|
@ -97,6 +102,7 @@ char *svc_strings[] = {
|
|||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
CL_EntityNum
|
||||
|
@ -120,11 +126,6 @@ CL_EntityNum (int num)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_ParseStartSoundPacket
|
||||
==================
|
||||
*/
|
||||
void
|
||||
CL_ParseStartSoundPacket (void)
|
||||
{
|
||||
|
@ -164,6 +165,7 @@ CL_ParseStartSoundPacket (void)
|
|||
volume / 255.0, attenuation);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_KeepaliveMessage
|
||||
|
@ -226,11 +228,7 @@ CL_KeepaliveMessage (void)
|
|||
|
||||
struct model_s **snd_worldmodel = &cl.worldmodel;
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_ParseServerInfo
|
||||
==================
|
||||
*/
|
||||
|
||||
void
|
||||
CL_ParseServerInfo (void)
|
||||
{
|
||||
|
@ -488,11 +486,7 @@ CL_ParseUpdate (int bits)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
CL_ParseBaseline
|
||||
==================
|
||||
*/
|
||||
|
||||
void
|
||||
CL_ParseBaseline (entity_t *ent)
|
||||
{
|
||||
|
@ -615,11 +609,7 @@ CL_ParseClientdata (int bits)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_NewTranslation
|
||||
=====================
|
||||
*/
|
||||
|
||||
void
|
||||
CL_NewTranslation (int slot)
|
||||
{
|
||||
|
@ -652,11 +642,7 @@ CL_NewTranslation (int slot)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=====================
|
||||
CL_ParseStatic
|
||||
=====================
|
||||
*/
|
||||
|
||||
void
|
||||
CL_ParseStatic (void)
|
||||
{
|
||||
|
@ -682,11 +668,7 @@ CL_ParseStatic (void)
|
|||
R_AddEfrags (ent);
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
CL_ParseStaticSound
|
||||
===================
|
||||
*/
|
||||
|
||||
void
|
||||
CL_ParseStaticSound (void)
|
||||
{
|
||||
|
@ -707,11 +689,7 @@ CL_ParseStaticSound (void)
|
|||
#define SHOWNET(x) if(cl_shownet->int_val==2)Con_Printf ("%3i:%s\n", net_message->readcount-1, x);
|
||||
|
||||
int snd_viewentity;
|
||||
/*
|
||||
=====================
|
||||
CL_ParseServerMessage
|
||||
=====================
|
||||
*/
|
||||
|
||||
void
|
||||
CL_ParseServerMessage (void)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
cl_tent.c
|
||||
|
||||
@description@
|
||||
client side temporary entities
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -30,11 +30,13 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "protocol.h"
|
||||
#include "client.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/msg.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/console.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "protocol.h"
|
||||
#include "render.h"
|
||||
|
||||
int num_temp_entities;
|
||||
entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
|
||||
|
@ -47,17 +49,12 @@ sfx_t *cl_sfx_ric1;
|
|||
sfx_t *cl_sfx_ric2;
|
||||
sfx_t *cl_sfx_ric3;
|
||||
sfx_t *cl_sfx_r_exp3;
|
||||
|
||||
#ifdef QUAKE2
|
||||
sfx_t *cl_sfx_imp;
|
||||
sfx_t *cl_sfx_rail;
|
||||
#endif
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_ParseTEnt
|
||||
=================
|
||||
*/
|
||||
|
||||
void
|
||||
CL_InitTEnts (void)
|
||||
{
|
||||
|
@ -74,11 +71,7 @@ CL_InitTEnts (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_ParseBeam
|
||||
=================
|
||||
*/
|
||||
|
||||
void
|
||||
CL_ParseBeam (model_t *m)
|
||||
{
|
||||
|
@ -121,51 +114,46 @@ CL_ParseBeam (model_t *m)
|
|||
Con_Printf ("beam list overflow!\n");
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_ParseTEnt
|
||||
=================
|
||||
*/
|
||||
|
||||
void
|
||||
CL_ParseTEnt (void)
|
||||
{
|
||||
int type;
|
||||
vec3_t pos;
|
||||
|
||||
#ifdef QUAKE2
|
||||
vec3_t endpos;
|
||||
#endif
|
||||
dlight_t *dl;
|
||||
int rnd;
|
||||
int cnt = -1;
|
||||
int colorStart, colorLength;
|
||||
|
||||
type = MSG_ReadByte (net_message);
|
||||
switch (type) {
|
||||
case TE_WIZSPIKE: // spike hitting wall
|
||||
case TE_WIZSPIKE: // spike hitting wall
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunParticleEffect (pos, vec3_origin, 20, 30);
|
||||
R_RunSpikeEffect (pos, type);
|
||||
// R_RunParticleEffect (pos, vec3_origin, 20, 30);
|
||||
S_StartSound (-1, 0, cl_sfx_wizhit, pos, 1, 1);
|
||||
break;
|
||||
|
||||
case TE_KNIGHTSPIKE: // spike hitting wall
|
||||
case TE_KNIGHTSPIKE: // spike hitting wall
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunParticleEffect (pos, vec3_origin, 226, 20);
|
||||
R_RunSpikeEffect (pos, type);
|
||||
// R_RunParticleEffect (pos, vec3_origin, 226, 20);
|
||||
S_StartSound (-1, 0, cl_sfx_knighthit, pos, 1, 1);
|
||||
break;
|
||||
|
||||
case TE_SPIKE: // spike hitting wall
|
||||
case TE_SPIKE: // spike hitting wall
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
#ifdef GLTEST
|
||||
Test_Spawn (pos);
|
||||
#else
|
||||
R_RunParticleEffect (pos, vec3_origin, 0, 10);
|
||||
#endif
|
||||
R_RunSpikeEffect (pos, type);
|
||||
// R_RunParticleEffect (pos, vec3_origin, 0, 10);
|
||||
if (rand () % 5)
|
||||
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
|
||||
else {
|
||||
|
@ -178,11 +166,13 @@ CL_ParseTEnt (void)
|
|||
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
|
||||
}
|
||||
break;
|
||||
case TE_SUPERSPIKE: // super spike hitting wall
|
||||
|
||||
case TE_SUPERSPIKE: // super spike hitting wall
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunParticleEffect (pos, vec3_origin, 0, 20);
|
||||
R_RunSpikeEffect (pos, type);
|
||||
// R_RunParticleEffect (pos, vec3_origin, 0, 20);
|
||||
|
||||
if (rand () % 5)
|
||||
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
|
||||
|
@ -197,18 +187,14 @@ CL_ParseTEnt (void)
|
|||
}
|
||||
break;
|
||||
|
||||
case TE_GUNSHOT: // bullet hitting wall
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunParticleEffect (pos, vec3_origin, 0, 20);
|
||||
break;
|
||||
|
||||
case TE_EXPLOSION: // rocket explosion
|
||||
case TE_EXPLOSION: // rocket explosion
|
||||
// particles
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_ParticleExplosion (pos);
|
||||
|
||||
// light
|
||||
dl = CL_AllocDlight (0);
|
||||
VectorCopy (pos, dl->origin);
|
||||
dl->radius = 350;
|
||||
|
@ -217,10 +203,20 @@ CL_ParseTEnt (void)
|
|||
dl->color[0] = 0.86;
|
||||
dl->color[1] = 0.31;
|
||||
dl->color[2] = 0.24;
|
||||
|
||||
// sound
|
||||
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
|
||||
|
||||
/* CL_AllocExplosion?
|
||||
// sprite
|
||||
ex = CL_AllocExplosion ();
|
||||
VectorCopy (pos, ex->ent.origin);
|
||||
ex->start = cl.time;
|
||||
ex->ent.model = Mod_ForName ("progs/s_explod.spr", true);
|
||||
*/
|
||||
break;
|
||||
|
||||
case TE_TAREXPLOSION: // tarbaby explosion
|
||||
case TE_TAREXPLOSION: // tarbaby explosion
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
|
@ -229,39 +225,39 @@ CL_ParseTEnt (void)
|
|||
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
|
||||
break;
|
||||
|
||||
case TE_LIGHTNING1: // lightning bolts
|
||||
case TE_LIGHTNING1: // lightning bolts
|
||||
CL_ParseBeam (Mod_ForName ("progs/bolt.mdl", true));
|
||||
break;
|
||||
|
||||
case TE_LIGHTNING2: // lightning bolts
|
||||
case TE_LIGHTNING2: // lightning bolts
|
||||
CL_ParseBeam (Mod_ForName ("progs/bolt2.mdl", true));
|
||||
break;
|
||||
|
||||
case TE_LIGHTNING3: // lightning bolts
|
||||
case TE_LIGHTNING3: // lightning bolts
|
||||
CL_ParseBeam (Mod_ForName ("progs/bolt3.mdl", true));
|
||||
break;
|
||||
|
||||
// PGM 01/21/97
|
||||
case TE_BEAM: // grappling hook beam
|
||||
case TE_BEAM: // grappling hook beam
|
||||
CL_ParseBeam (Mod_ForName ("progs/beam.mdl", true));
|
||||
break;
|
||||
// PGM 01/21/97
|
||||
|
||||
case TE_LAVASPLASH:
|
||||
case TE_LAVASPLASH:
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_LavaSplash (pos);
|
||||
break;
|
||||
|
||||
case TE_TELEPORT:
|
||||
case TE_TELEPORT:
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_TeleportSplash (pos);
|
||||
break;
|
||||
|
||||
case TE_EXPLOSION2: // color mapped explosion
|
||||
case TE_EXPLOSION2: // color mapped explosion
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
|
@ -279,15 +275,23 @@ CL_ParseTEnt (void)
|
|||
S_StartSound (-1, 0, cl_sfx_r_exp3, pos, 1, 1);
|
||||
break;
|
||||
|
||||
case TE_GUNSHOT: // bullet hitting wall
|
||||
cnt = MSG_ReadByte (net_message);
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
R_RunPuffEffect (pos, type, cnt);
|
||||
break;
|
||||
|
||||
#ifdef QUAKE2
|
||||
case TE_IMPLOSION:
|
||||
case TE_IMPLOSION:
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
S_StartSound (-1, 0, cl_sfx_imp, pos, 1, 1);
|
||||
break;
|
||||
|
||||
case TE_RAILTRAIL:
|
||||
case TE_RAILTRAIL:
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
pos[2] = MSG_ReadCoord (net_message);
|
||||
|
@ -296,8 +300,10 @@ CL_ParseTEnt (void)
|
|||
endpos[2] = MSG_ReadCoord (net_message);
|
||||
S_StartSound (-1, 0, cl_sfx_rail, pos, 1, 1);
|
||||
S_StartSound (-1, 1, cl_sfx_r_exp3, endpos, 1, 1);
|
||||
/* Need updating to new Particle API
|
||||
R_RocketTrail (pos, endpos, 0 + 128);
|
||||
R_ParticleExplosion (endpos);
|
||||
*/
|
||||
dl = CL_AllocDlight (-1);
|
||||
VectorCopy (endpos, dl->origin);
|
||||
dl->radius = 350;
|
||||
|
@ -309,18 +315,13 @@ CL_ParseTEnt (void)
|
|||
break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
default:
|
||||
Sys_Error ("CL_ParseTEnt: bad type");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_NewTempEntity
|
||||
=================
|
||||
*/
|
||||
entity_t *
|
||||
entity_t *
|
||||
CL_NewTempEntity (void)
|
||||
{
|
||||
entity_t *ent;
|
||||
|
@ -340,11 +341,6 @@ CL_NewTempEntity (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
CL_UpdateTEnts
|
||||
=================
|
||||
*/
|
||||
void
|
||||
CL_UpdateTEnts (void)
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
d_part.c
|
||||
|
||||
@description@
|
||||
software driver module for drawing particles
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -33,11 +33,6 @@
|
|||
#include "d_local.h"
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
D_EndParticles
|
||||
==============
|
||||
*/
|
||||
void
|
||||
D_EndParticles (void)
|
||||
{
|
||||
|
@ -45,11 +40,6 @@ D_EndParticles (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
D_StartParticles
|
||||
==============
|
||||
*/
|
||||
void
|
||||
D_StartParticles (void)
|
||||
{
|
||||
|
@ -57,13 +47,8 @@ D_StartParticles (void)
|
|||
}
|
||||
|
||||
|
||||
#ifndef USE_INTEL_ASM
|
||||
#ifndef USE_INTEL_ASM
|
||||
|
||||
/*
|
||||
==============
|
||||
D_DrawParticle
|
||||
==============
|
||||
*/
|
||||
void
|
||||
D_DrawParticle (particle_t *pparticle)
|
||||
{
|
||||
|
|
|
@ -29,13 +29,18 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <sys/segments.h>
|
||||
#include <go32.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/nearptr.h>
|
||||
#include <dos.h>
|
||||
#include <string.h>
|
||||
#include <dpmi.h>
|
||||
// #include <osfcn.h>
|
||||
#include <bios.h>
|
||||
|
|
|
@ -65,19 +65,15 @@ cachepic_t menu_cachepics[MAX_CACHED_PICS];
|
|||
int menu_numcachepics;
|
||||
|
||||
|
||||
qpic_t *
|
||||
qpic_t *
|
||||
Draw_PicFromWad (char *name)
|
||||
{
|
||||
return W_GetLumpName (name);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
Draw_CachePic
|
||||
================
|
||||
*/
|
||||
qpic_t *
|
||||
Draw_CachePic (char *path)
|
||||
|
||||
qpic_t *
|
||||
Draw_CachePic (char *path, qboolean alpha)
|
||||
{
|
||||
cachepic_t *pic;
|
||||
int i;
|
||||
|
@ -565,7 +561,7 @@ Draw_ConsoleBackground (int lines)
|
|||
int f, fstep;
|
||||
qpic_t *conback;
|
||||
|
||||
conback = Draw_CachePic ("gfx/conback.lmp");
|
||||
conback = Draw_CachePic ("gfx/conback.lmp", true);
|
||||
|
||||
// draw the pic
|
||||
if (r_pixbytes == 1) {
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/compat.h"
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include "QF/cvar.h"
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include "QF/cvar.h"
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/console.h"
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include "QF/cvar.h"
|
||||
|
|
|
@ -1,8 +1,13 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include "QF/cvar.h"
|
||||
|
|
1074
nq/source/gl_draw.c
1074
nq/source/gl_draw.c
File diff suppressed because it is too large
Load diff
210
nq/source/gl_dyn_fires.c
Normal file
210
nq/source/gl_dyn_fires.c
Normal file
|
@ -0,0 +1,210 @@
|
|||
/*
|
||||
gl_dyn_fires.c
|
||||
|
||||
dynamic fires
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/console.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "glquake.h"
|
||||
#include "render.h"
|
||||
|
||||
#define MAX_FIRES 128 // rocket flames
|
||||
|
||||
static fire_t r_fires[MAX_FIRES];
|
||||
extern cvar_t *gl_fires;
|
||||
extern cvar_t *r_firecolor;
|
||||
|
||||
|
||||
/*
|
||||
R_AddFire
|
||||
|
||||
Nifty ball of fire GL effect. Kinda a meshing of the dlight and
|
||||
particle engine code.
|
||||
*/
|
||||
void
|
||||
R_AddFire (vec3_t start, vec3_t end, entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
fire_t *f;
|
||||
vec3_t vec;
|
||||
int key;
|
||||
|
||||
if (!gl_fires->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (end, start, vec);
|
||||
len = VectorNormalize (vec);
|
||||
key = ent->keynum;
|
||||
|
||||
if (len) {
|
||||
f = R_AllocFire (key);
|
||||
VectorCopy (end, f->origin);
|
||||
VectorCopy (start, f->owner);
|
||||
f->size = 10;
|
||||
f->die = cl.time + 0.5;
|
||||
f->decay = 1;
|
||||
VectorCopy (r_firecolor->vec, f->color);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
R_AllocFire
|
||||
|
||||
Clears out and returns a new fireball
|
||||
*/
|
||||
fire_t *
|
||||
R_AllocFire (int key)
|
||||
{
|
||||
int i;
|
||||
fire_t *f;
|
||||
|
||||
if (key) // first try to find/reuse a keyed
|
||||
// spot
|
||||
{
|
||||
f = r_fires;
|
||||
for (i = 0; i < MAX_FIRES; i++, f++)
|
||||
if (f->key == key) {
|
||||
memset (f, 0, sizeof (*f));
|
||||
f->key = key;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
f = r_fires; // no match, look for a free spot
|
||||
for (i = 0; i < MAX_FIRES; i++, f++) {
|
||||
if (f->die < cl.time) {
|
||||
memset (f, 0, sizeof (*f));
|
||||
f->key = key;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
f = &r_fires[0];
|
||||
memset (f, 0, sizeof (*f));
|
||||
f->key = key;
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
R_DrawFire
|
||||
|
||||
draws one fireball - probably never need to call this directly
|
||||
*/
|
||||
void
|
||||
R_DrawFire (fire_t *f)
|
||||
{
|
||||
int i, j;
|
||||
vec3_t vec, vec2;
|
||||
float radius;
|
||||
float *b_sin, *b_cos;
|
||||
|
||||
b_sin = bubble_sintable;
|
||||
b_cos = bubble_costable;
|
||||
|
||||
radius = f->size - 0.5;
|
||||
|
||||
// figure out if we're inside the area of effect
|
||||
VectorSubtract (f->origin, r_origin, vec);
|
||||
if (Length (vec) < radius) {
|
||||
AddLightBlend (f->color[0], f->color[1], f->color[2], f->size * 0.0003); // we are
|
||||
return;
|
||||
}
|
||||
// we're not - draw it
|
||||
glBegin (GL_TRIANGLE_FAN);
|
||||
if (lighthalf)
|
||||
glColor3f (f->color[0] * 0.5, f->color[1] * 0.5, f->color[2] * 0.5);
|
||||
else
|
||||
glColor3fv (f->color);
|
||||
for (i = 0; i < 3; i++)
|
||||
vec[i] = f->origin[i] - vpn[i] * radius;
|
||||
glVertex3fv (vec);
|
||||
glColor3f (0.0, 0.0, 0.0);
|
||||
|
||||
// don't panic, this just draws a bubble...
|
||||
for (i = 16; i >= 0; i--) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
vec[j] = f->origin[j] + (*b_cos * vright[j]
|
||||
+ vup[j] * (*b_sin)) * radius;
|
||||
vec2[j] = f->owner[j] + (*b_cos * vright[j]
|
||||
+ vup[j] * (*b_sin)) * radius;
|
||||
}
|
||||
glVertex3fv (vec);
|
||||
glVertex3fv (vec2);
|
||||
|
||||
b_sin += 2;
|
||||
b_cos += 2;
|
||||
}
|
||||
glEnd ();
|
||||
glColor3ubv (lighthalf_v);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
R_UpdateFires
|
||||
|
||||
Draws each fireball in sequence
|
||||
*/
|
||||
void
|
||||
R_UpdateFires (void)
|
||||
{
|
||||
int i;
|
||||
fire_t *f;
|
||||
|
||||
if (!gl_fires->int_val)
|
||||
return;
|
||||
|
||||
glDepthMask (GL_FALSE);
|
||||
glDisable (GL_TEXTURE_2D);
|
||||
glBlendFunc (GL_ONE, GL_ONE);
|
||||
|
||||
f = r_fires;
|
||||
for (i = 0; i < MAX_FIRES; i++, f++) {
|
||||
if (f->die < cl.time || !f->size)
|
||||
continue;
|
||||
f->size += f->decay;
|
||||
R_DrawFire (f);
|
||||
}
|
||||
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthMask (GL_TRUE);
|
||||
}
|
768
nq/source/gl_dyn_part.c
Normal file
768
nq/source/gl_dyn_part.c
Normal file
|
@ -0,0 +1,768 @@
|
|||
/*
|
||||
gl_dyn_part.c
|
||||
|
||||
OpenGL particle system.
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/varrays.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "glquake.h"
|
||||
#include "host.h"
|
||||
#include "render.h"
|
||||
#include "r_dynamic.h"
|
||||
|
||||
typedef enum {
|
||||
pt_static, pt_grav, pt_blob, pt_blob2,
|
||||
pt_smoke, pt_smokering, pt_smokecloud, pt_bloodcloud,
|
||||
pt_fadespark, pt_fadespark2, pt_fallfadespark
|
||||
} ptype_t;
|
||||
|
||||
typedef struct particle_s {
|
||||
vec3_t org;
|
||||
vec3_t up;
|
||||
vec3_t right;
|
||||
int tex;
|
||||
float color;
|
||||
float alpha;
|
||||
float scale;
|
||||
vec3_t vel;
|
||||
float ramp;
|
||||
float die;
|
||||
ptype_t type;
|
||||
} particle_t;
|
||||
|
||||
static particle_t *particles, **freeparticles;
|
||||
static short r_numparticles, numparticles;
|
||||
|
||||
extern qboolean lighthalf;
|
||||
|
||||
extern cvar_t *cl_max_particles;
|
||||
|
||||
extern int part_tex_dot;
|
||||
extern int part_tex_spark;
|
||||
extern int part_tex_smoke[8];
|
||||
extern int part_tex_smoke_ring[8];
|
||||
|
||||
int ramp[8] = { 0x6d, 0x6b, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01 };
|
||||
|
||||
|
||||
inline particle_t *
|
||||
particle_new (ptype_t type, int texnum, vec3_t org, float scale, vec3_t vel,
|
||||
float die, byte color, byte alpha, vec3_t up, vec3_t right)
|
||||
{
|
||||
particle_t *part;
|
||||
|
||||
if (numparticles >= r_numparticles) {
|
||||
// Con_Printf("FAILED PARTICLE ALLOC!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
part = &particles[numparticles++];
|
||||
|
||||
part->type = type;
|
||||
VectorCopy (org, part->org);
|
||||
VectorCopy (vel, part->vel);
|
||||
part->die = die;
|
||||
part->color = color;
|
||||
part->alpha = alpha;
|
||||
part->tex = texnum;
|
||||
part->scale = scale;
|
||||
|
||||
VectorScale (up, 1.5, part->up);
|
||||
VectorScale (right, 1.5, part->right);
|
||||
|
||||
return part;
|
||||
}
|
||||
|
||||
|
||||
inline particle_t *
|
||||
particle_new_random (ptype_t type, int texnum, vec3_t org, int org_fuzz,
|
||||
float scale, int vel_fuzz, float die, byte color,
|
||||
byte alpha)
|
||||
{
|
||||
vec3_t porg, pvel;
|
||||
int j;
|
||||
|
||||
for (j = 0; j < 3; j++) {
|
||||
if (org_fuzz)
|
||||
porg[j] = lhrandom (-org_fuzz, org_fuzz) + org[j];
|
||||
if (vel_fuzz)
|
||||
pvel[j] = lhrandom (-vel_fuzz, vel_fuzz);
|
||||
}
|
||||
return particle_new (type, texnum, porg, scale, pvel, die, color, alpha, vec3_origin, vec3_origin);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
R_MaxParticlesCheck
|
||||
|
||||
Misty-chan: Dynamically change the maximum amount of particles on the fly.
|
||||
Thanks to a LOT of help from Taniwha, Deek, Mercury, Lordhavoc, and
|
||||
lots of others.
|
||||
*/
|
||||
void
|
||||
R_MaxParticlesCheck (cvar_t *var)
|
||||
{
|
||||
/*
|
||||
Catchall. If the user changed the setting to a number less than zero
|
||||
*or* if we had a wacky cfg get past the init code check, this will
|
||||
make sure we don't have problems. Also note that grabbing the
|
||||
var->int_val is IMPORTANT:
|
||||
|
||||
Prevents a segfault since if we grabbed the int_val of
|
||||
cl_max_particles we'd sig11 right here at startup.
|
||||
*/
|
||||
r_numparticles = max(var->int_val, 0);
|
||||
|
||||
// Be very careful the next time we do something like this.
|
||||
// calloc/free are IMPORTANT and the compiler doesn't know when we
|
||||
// do bad things with them.
|
||||
free (particles);
|
||||
free (freeparticles);
|
||||
|
||||
particles = (particle_t *)
|
||||
calloc (r_numparticles, sizeof (particle_t));
|
||||
freeparticles = (particle_t **)
|
||||
calloc (r_numparticles, sizeof (particle_t*));
|
||||
|
||||
R_ClearParticles();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_Particles_Init_Cvars (void)
|
||||
{
|
||||
// Misty-chan: This is a cvar that does callbacks. Whenever it
|
||||
// changes, it calls the function R_MaxParticlesCheck and therefore
|
||||
// is very nifty.
|
||||
Cvar_Get ("cl_max_particles", "2048", CVAR_ARCHIVE, R_MaxParticlesCheck,
|
||||
"Maximum amount of particles to display. No maximum, minimum is 0, although it's best to use r_particles 0 instead.");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_ClearParticles (void)
|
||||
{
|
||||
numparticles = 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_ReadPointFile_f (void)
|
||||
{
|
||||
QFile *f;
|
||||
vec3_t org;
|
||||
int r;
|
||||
int c;
|
||||
char name[MAX_OSPATH], *mapname, *t1;
|
||||
|
||||
mapname = strdup (cl.worldmodel->name);
|
||||
if (!mapname)
|
||||
Sys_Error ("Can't duplicate mapname!");
|
||||
t1 = strrchr (mapname, '.');
|
||||
if (!t1)
|
||||
Sys_Error ("Can't find .!");
|
||||
t1[0] = '\0';
|
||||
|
||||
snprintf (name, sizeof (name), "%s.pts", mapname);
|
||||
free (mapname);
|
||||
|
||||
COM_FOpenFile (name, &f);
|
||||
if (!f) {
|
||||
Con_Printf ("couldn't open %s\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
Con_Printf ("Reading %s...\n", name);
|
||||
c = 0;
|
||||
for (;;) {
|
||||
char buf[64];
|
||||
|
||||
Qgets (f, buf, sizeof (buf));
|
||||
r = sscanf (buf, "%f %f %f\n", &org[0], &org[1], &org[2]);
|
||||
if (r != 3)
|
||||
break;
|
||||
c++;
|
||||
|
||||
if (!particle_new (pt_static, part_tex_dot, org, 1.5, vec3_origin,
|
||||
99999, (-c) & 15, 255, vec3_origin, vec3_origin)) {
|
||||
Con_Printf ("Not enough free particles\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Qclose (f);
|
||||
Con_Printf ("%i points read\n", c);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_ParticleExplosion (vec3_t org)
|
||||
{
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
particle_new_random (pt_smokecloud, part_tex_smoke[rand () & 7], org, 4, 30,
|
||||
8, cl.time + 5, (rand () & 7) + 8,
|
||||
128 + (rand () & 63));
|
||||
}
|
||||
|
||||
void
|
||||
R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
|
||||
{
|
||||
int i;
|
||||
int colorMod = 0;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 512; i++) {
|
||||
particle_new_random (pt_blob, part_tex_dot, org, 16, 2, 256, (cl.time + 0.3), (colorStart + (colorMod % colorLength)), 255);
|
||||
colorMod++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_BlobExplosion (vec3_t org)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 512; i++) {
|
||||
particle_new_random (pt_blob, part_tex_dot, org, 12, 2, 256,
|
||||
(cl.time + 1 + (rand () & 8) * 0.05),
|
||||
(66 + rand () % 6), 255);
|
||||
}
|
||||
for (i = 0; i < 512; i++) {
|
||||
particle_new_random (pt_blob2, part_tex_dot, org, 12, 2, 256,
|
||||
(cl.time + 1 + (rand () & 8) * 0.05),
|
||||
(150 + rand () % 6), 255);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
R_RunSparkEffect (vec3_t org, int count, int ofuzz)
|
||||
{
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
particle_new (pt_smokecloud, part_tex_smoke[rand () & 7], org,
|
||||
(ofuzz / 8) * .75, vec3_origin, cl.time + 99,
|
||||
12 + (rand () & 3), 96, vec3_origin, vec3_origin);
|
||||
while (count--)
|
||||
particle_new_random (pt_fallfadespark, part_tex_spark, org, ofuzz * .75,
|
||||
1, 96, cl.time + 5, ramp[rand () % 6],
|
||||
lhrandom (0, 255));
|
||||
}
|
||||
|
||||
static void
|
||||
R_RunGunshotEffect (vec3_t org, int count)
|
||||
{
|
||||
int scale;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
if (count > 6)
|
||||
scale = 3;
|
||||
else
|
||||
scale = 2;
|
||||
|
||||
R_RunSparkEffect (org, count * 10, 8 * scale);
|
||||
return;
|
||||
}
|
||||
|
||||
static void
|
||||
R_BloodPuff (vec3_t org, int count)
|
||||
{
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
particle_new (pt_bloodcloud, part_tex_smoke[rand () & 7], org, 9,
|
||||
vec3_origin, cl.time + 99, 68 + (rand () & 3), 128,
|
||||
vec3_origin, vec3_origin);
|
||||
}
|
||||
|
||||
/*
|
||||
R_RunPuffEffect
|
||||
*/
|
||||
void
|
||||
R_RunPuffEffect (vec3_t org, byte type, byte count)
|
||||
{
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
switch (type) {
|
||||
case TE_GUNSHOT:
|
||||
R_RunGunshotEffect (org, count);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
R_RunParticleEffect
|
||||
*/
|
||||
void
|
||||
R_RunParticleEffect (vec3_t org, int color, int count)
|
||||
{
|
||||
int i, j, scale;
|
||||
vec3_t porg;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
if (count > 130)
|
||||
scale = 3;
|
||||
else if (count > 20)
|
||||
scale = 2;
|
||||
else
|
||||
scale = 1;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
porg[j] = org[j] + scale * ((rand () & 15) - 8);
|
||||
}
|
||||
particle_new (pt_grav, part_tex_dot, porg, 1.5, vec3_origin,
|
||||
(cl.time + 0.1 * (rand () % 5)),
|
||||
(color & ~7) + (rand () & 7), 255, vec3_origin, vec3_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_RunSpikeEffect (vec3_t org, byte type)
|
||||
{
|
||||
switch (type) {
|
||||
case TE_SPIKE:
|
||||
R_RunSparkEffect (org, 5, 8);
|
||||
break;
|
||||
case TE_SUPERSPIKE:
|
||||
R_RunSparkEffect (org, 10, 8);
|
||||
break;
|
||||
case TE_KNIGHTSPIKE:
|
||||
R_RunSparkEffect (org, 10, 8);
|
||||
break;
|
||||
case TE_WIZSPIKE:
|
||||
R_RunSparkEffect (org, 15, 16);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
R_LavaSplash
|
||||
*/
|
||||
void
|
||||
R_LavaSplash (vec3_t org)
|
||||
{
|
||||
int i, j;
|
||||
float vel;
|
||||
vec3_t dir, porg, pvel;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
for (i = -8; i < 8; i++) {
|
||||
for (j = -8; j < 8; j++) {
|
||||
dir[0] = j * 16 + (rand () & 7);
|
||||
dir[1] = i * 16 + (rand () & 7);
|
||||
dir[2] = 256;
|
||||
|
||||
porg[0] = org[0] + dir[0];
|
||||
porg[1] = org[1] + dir[1];
|
||||
porg[2] = org[2] + (rand () & 63);
|
||||
|
||||
VectorNormalize (dir);
|
||||
vel = 50 + (rand () & 63);
|
||||
VectorScale (dir, vel, pvel);
|
||||
particle_new (pt_grav, part_tex_dot, porg, 3, pvel,
|
||||
(cl.time + 2 + (rand () & 31) * 0.02),
|
||||
(224 + (rand () & 7)), 193, vec3_origin, vec3_origin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
R_TeleportSplash
|
||||
*/
|
||||
void
|
||||
R_TeleportSplash (vec3_t org)
|
||||
{
|
||||
int i, j, k;
|
||||
float vel;
|
||||
vec3_t dir, porg, pvel;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
for (i = -16; i < 16; i += 4)
|
||||
for (j = -16; j < 16; j += 4)
|
||||
for (k = -24; k < 32; k += 4) {
|
||||
dir[0] = j * 8;
|
||||
dir[1] = i * 8;
|
||||
dir[2] = k * 8;
|
||||
|
||||
porg[0] = org[0] + i + (rand () & 3);
|
||||
porg[1] = org[1] + j + (rand () & 3);
|
||||
porg[2] = org[2] + k + (rand () & 3);
|
||||
|
||||
VectorNormalize (dir);
|
||||
vel = 50 + (rand () & 63);
|
||||
VectorScale (dir, vel, pvel);
|
||||
particle_new (pt_grav, part_tex_spark, porg, 0.6, pvel,
|
||||
(cl.time + 0.2 + (rand () & 7) * 0.02),
|
||||
(7 + (rand () & 7)), 255, vec3_origin, vec3_origin);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_RocketTrail (int type, entity_t *ent)
|
||||
{
|
||||
vec3_t vec, subtract;
|
||||
float len, dist;
|
||||
int j, ptex;
|
||||
ptype_t ptype;
|
||||
vec3_t porg, pvel, up, right;
|
||||
float pdie, pscale;
|
||||
byte palpha, pcolor;
|
||||
|
||||
if (type == 0)
|
||||
R_AddFire (ent->msg_origins[1], ent->origin, ent);
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (ent->origin, ent->msg_origins[1], vec);
|
||||
len = VectorNormalize (vec);
|
||||
while (len > 0) {
|
||||
VectorCopy (vec3_origin, up);
|
||||
VectorCopy (vec3_origin, right);
|
||||
VectorCopy (vec3_origin, pvel);
|
||||
pdie = cl.time + 2;
|
||||
ptype = pt_static;
|
||||
ptex = part_tex_dot;
|
||||
palpha = 255;
|
||||
pcolor = 0;
|
||||
pscale = 6;
|
||||
dist = 40;
|
||||
|
||||
switch (type) {
|
||||
case 0: // rocket trail
|
||||
pdie = cl.time + 60;
|
||||
// ptype = pt_smokering; // Mercury's Rings
|
||||
ptype = pt_smoke;
|
||||
pscale = lhrandom (6, 8);
|
||||
// pcolor = (rand () & 255); // Misty-chan's Easter Egg
|
||||
pcolor = (rand () & 3) + 12;
|
||||
palpha = 128 + (rand () & 31);
|
||||
// VectorVectors(vec, right, up); // Mercury's Rings
|
||||
VectorCopy (ent->msg_origins[1], porg);
|
||||
// ptex = part_tex_smoke_ring[rand () & 7]; // Mercury's Rings
|
||||
ptex = part_tex_smoke[rand () & 7];
|
||||
break;
|
||||
case 1: // grenade trail
|
||||
ptype = pt_smoke;
|
||||
pscale = lhrandom (7, 10);
|
||||
// pcolor = (rand () & 255); // Misty-chan's Easter Egg
|
||||
pcolor = (rand () & 3);
|
||||
palpha = 128 + (rand () & 31);
|
||||
VectorCopy (ent->msg_origins[1], porg);
|
||||
ptex = part_tex_smoke[rand () & 7];
|
||||
break;
|
||||
case 2: // blood
|
||||
pscale = 5;
|
||||
case 4: // slight blood
|
||||
pscale += lhrandom (1, 4);
|
||||
ptex = part_tex_smoke[rand () & 7];
|
||||
pcolor = 68 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++) {
|
||||
pvel[j] = lhrandom (-3, 3) * type;
|
||||
porg[j] = ent->msg_origins[1][j] + lhrandom (-1.5, 1.5);
|
||||
}
|
||||
ptype = pt_grav;
|
||||
break;
|
||||
case 6: // voor trail
|
||||
// Use smoke ring effects here, once merged with nq? --Despair
|
||||
dist = 3;
|
||||
pcolor = 9 * 16 + 8 + (rand () & 3);
|
||||
ptype = pt_static;
|
||||
pscale = lhrandom (.75, 1.5);
|
||||
pdie = cl.time + 0.3;
|
||||
for (j = 0; j < 3; j++)
|
||||
porg[j] = ent->msg_origins[1][j] + lhrandom (-8, 8);
|
||||
break;
|
||||
case 3:
|
||||
case 5: // tracer
|
||||
{
|
||||
static int tracercount;
|
||||
|
||||
dist = 3;
|
||||
pdie = cl.time + 0.5;
|
||||
ptype = pt_static;
|
||||
pscale = lhrandom (1.5, 3);
|
||||
if (type == 3)
|
||||
pcolor = 52 + ((tracercount & 4) << 1);
|
||||
else
|
||||
pcolor = 230 + ((tracercount & 4) << 1);
|
||||
|
||||
tracercount++;
|
||||
|
||||
VectorCopy (ent->msg_origins[1], porg);
|
||||
if (tracercount & 1) {
|
||||
pvel[0] = 30 * vec[1];
|
||||
pvel[1] = 30 * -vec[0];
|
||||
} else {
|
||||
pvel[0] = 30 * -vec[1];
|
||||
pvel[1] = 30 * vec[0];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
VectorScale (vec, min(dist, len), subtract);
|
||||
VectorAdd (ent->msg_origins[1], subtract, ent->msg_origins[1]);
|
||||
len -= dist;
|
||||
|
||||
particle_new (ptype, ptex, porg, pscale, pvel, pdie, pcolor, palpha,
|
||||
up, right);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
R_DrawParticles
|
||||
*/
|
||||
void
|
||||
R_DrawParticles (void)
|
||||
{
|
||||
byte i;
|
||||
float grav, fast_grav, dvel;
|
||||
float minparticledist;
|
||||
unsigned char *at;
|
||||
byte alpha;
|
||||
float scale;
|
||||
particle_t *part;
|
||||
vec3_t up, right, o_up, o_right;
|
||||
vec3_t up_scale, right_scale, up_right_scale;
|
||||
int activeparticles, maxparticle, j, k;
|
||||
|
||||
// LordHavoc: particles should not affect zbuffer
|
||||
glDepthMask (GL_FALSE);
|
||||
|
||||
VectorScale (vup, 1.5, o_up);
|
||||
VectorScale (vright, 1.5, o_right);
|
||||
|
||||
varray[0].texcoord[0] = 0; varray[0].texcoord[1] = 1;
|
||||
varray[1].texcoord[0] = 0; varray[1].texcoord[1] = 0;
|
||||
varray[2].texcoord[0] = 1; varray[2].texcoord[1] = 0;
|
||||
varray[3].texcoord[0] = 1; varray[3].texcoord[1] = 1;
|
||||
|
||||
grav = (fast_grav = host_frametime * 800) * 0.05;
|
||||
dvel = 4 * host_frametime;
|
||||
|
||||
minparticledist = DotProduct (r_refdef.vieworg, vpn) + 32.0f;
|
||||
|
||||
activeparticles = 0;
|
||||
maxparticle = -1;
|
||||
j = 0;
|
||||
|
||||
for (k = 0, part = particles; k < numparticles; k++, part++) {
|
||||
// LordHavoc: this is probably no longer necessary, as it is
|
||||
// checked at the end, but could still happen on weird particle
|
||||
// effects, left for safety...
|
||||
if (part->die <= cl.time) {
|
||||
freeparticles[j++] = part;
|
||||
continue;
|
||||
}
|
||||
maxparticle = k;
|
||||
activeparticles++;
|
||||
|
||||
// Don't render particles too close to us.
|
||||
// Note, we must still do physics and such on them.
|
||||
if (!(DotProduct (part->org, vpn) < minparticledist) &&
|
||||
r_particles->int_val) {
|
||||
at = (byte *) & d_8to24table[(byte) part->color];
|
||||
alpha = part->alpha;
|
||||
|
||||
#define mVectorCompare(x, y) ((x[0] == y[0]) && (x[1] == y[1]) && (x[2] == y[2]))
|
||||
if (mVectorCompare(part->up, part->right)) {
|
||||
memcpy(up, o_up, sizeof(up));
|
||||
memcpy(right, o_right, sizeof(right));
|
||||
} else {
|
||||
memcpy(up, part->up, sizeof(up));
|
||||
memcpy(right, part->right, sizeof(right));
|
||||
}
|
||||
|
||||
if (lighthalf) {
|
||||
varray[0].color[0] = (float) ((int) at[0] >> 1) / 255;
|
||||
varray[0].color[1] = (float) ((int) at[1] >> 1) / 255;
|
||||
varray[0].color[2] = (float) ((int) at[2] >> 1) / 255;
|
||||
} else {
|
||||
varray[0].color[0] = (float) at[0] / 255;
|
||||
varray[0].color[1] = (float) at[1] / 255;
|
||||
varray[0].color[2] = (float) at[2] / 255;
|
||||
}
|
||||
varray[0].color[3] = (float) alpha / 255;
|
||||
|
||||
memcpy(varray[1].color, varray[0].color, sizeof(varray[0].color));
|
||||
memcpy(varray[2].color, varray[0].color, sizeof(varray[0].color));
|
||||
memcpy(varray[3].color, varray[0].color, sizeof(varray[0].color));
|
||||
|
||||
scale = part->scale;
|
||||
|
||||
up_scale[0] = up[0] * scale;
|
||||
up_scale[1] = up[1] * scale;
|
||||
up_scale[2] = up[2] * scale;
|
||||
|
||||
right_scale[0] = right[0] * scale;
|
||||
right_scale[1] = right[1] * scale;
|
||||
right_scale[2] = right[2] * scale;
|
||||
|
||||
up_right_scale[0] = (up[0] + right[0]) * scale;
|
||||
up_right_scale[1] = (up[1] + right[1]) * scale;
|
||||
up_right_scale[2] = (up[2] + right[2]) * scale;
|
||||
|
||||
varray[0].vertex[0] = part->org[0] + up_right_scale[0];
|
||||
varray[0].vertex[1] = part->org[1] + up_right_scale[1];
|
||||
varray[0].vertex[2] = part->org[2] + up_right_scale[2];
|
||||
|
||||
varray[1].vertex[0] = part->org[0] - up_scale[0] + right_scale[0];
|
||||
varray[1].vertex[1] = part->org[1] - up_scale[1] + right_scale[1];
|
||||
varray[1].vertex[2] = part->org[2] - up_scale[2] + right_scale[2];
|
||||
|
||||
varray[2].vertex[0] = part->org[0] - up_right_scale[0];
|
||||
varray[2].vertex[1] = part->org[1] - up_right_scale[1];
|
||||
varray[2].vertex[2] = part->org[2] - up_right_scale[2];
|
||||
|
||||
varray[3].vertex[0] = part->org[0] + up_scale[0] - right_scale[0];
|
||||
varray[3].vertex[1] = part->org[1] + up_scale[1] - right_scale[1];
|
||||
varray[3].vertex[2] = part->org[2] + up_scale[2] - right_scale[2];
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, part->tex);
|
||||
glDrawArrays (GL_QUADS, 0, 4);
|
||||
}
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
part->org[i] += part->vel[i] * host_frametime;
|
||||
|
||||
switch (part->type) {
|
||||
case pt_static:
|
||||
break;
|
||||
case pt_blob:
|
||||
for (i = 0; i < 3; i++)
|
||||
part->vel[i] += part->vel[i] * dvel;
|
||||
part->vel[2] -= grav;
|
||||
break;
|
||||
case pt_blob2:
|
||||
for (i = 0; i < 2; i++)
|
||||
part->vel[i] -= part->vel[i] * dvel;
|
||||
part->vel[2] -= grav;
|
||||
break;
|
||||
case pt_grav:
|
||||
part->vel[2] -= grav;
|
||||
break;
|
||||
case pt_smoke:
|
||||
if ((part->alpha -= host_frametime * 90) < 1)
|
||||
part->die = -1;
|
||||
part->scale += host_frametime * 6;
|
||||
// part->org[2] += host_frametime * 30;
|
||||
break;
|
||||
case pt_smokering:
|
||||
if ((part->alpha -= host_frametime * 130) < 1)
|
||||
part->die = -1;
|
||||
part->scale += host_frametime * 10;
|
||||
// part->org[2] += host_frametime * 30;
|
||||
break;
|
||||
case pt_smokecloud:
|
||||
if ((part->alpha -= host_frametime * 128) < 1)
|
||||
{
|
||||
part->die = -1;
|
||||
break;
|
||||
}
|
||||
part->scale += host_frametime * 60;
|
||||
part->org[2] += host_frametime * 30;
|
||||
break;
|
||||
case pt_bloodcloud:
|
||||
if ((part->alpha -= host_frametime * 64) < 1)
|
||||
{
|
||||
part->die = -1;
|
||||
break;
|
||||
}
|
||||
part->scale += host_frametime * 4;
|
||||
part->vel[2] -= grav;
|
||||
break;
|
||||
case pt_fadespark:
|
||||
if ((part->alpha -= host_frametime * 256) < 1)
|
||||
part->die = -1;
|
||||
part->vel[2] -= grav;
|
||||
break;
|
||||
case pt_fadespark2:
|
||||
if ((part->alpha -= host_frametime * 512) < 1)
|
||||
part->die = -1;
|
||||
part->vel[2] -= grav;
|
||||
break;
|
||||
case pt_fallfadespark:
|
||||
if ((part->alpha -= host_frametime * 256) < 1)
|
||||
part->die = -1;
|
||||
part->vel[2] -= fast_grav;
|
||||
break;
|
||||
}
|
||||
// LordHavoc: immediate removal of unnecessary particles (must
|
||||
// be done to ensure compactor below operates properly in all
|
||||
// cases)
|
||||
if (part->die <= cl.time)
|
||||
freeparticles[j++] = part;
|
||||
}
|
||||
k = 0;
|
||||
while (maxparticle >= activeparticles) {
|
||||
*freeparticles[k++] = particles[maxparticle--];
|
||||
while (maxparticle >= activeparticles &&
|
||||
particles[maxparticle].die <= cl.time)
|
||||
maxparticle--;
|
||||
}
|
||||
numparticles = activeparticles;
|
||||
|
||||
glColor3ubv (lighthalf_v);
|
||||
glDepthMask (GL_TRUE);
|
||||
}
|
200
nq/source/gl_dyn_textures.c
Normal file
200
nq/source/gl_dyn_textures.c
Normal file
|
@ -0,0 +1,200 @@
|
|||
/*
|
||||
gl_dyn_textures.c
|
||||
|
||||
Dynamic texture generation.
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "glquake.h"
|
||||
|
||||
extern void noise_diamondsquare(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);
|
||||
static void GDT_InitSmokeRingParticleTexture (void);
|
||||
|
||||
int part_tex_dot;
|
||||
int part_tex_spark;
|
||||
int part_tex_smoke[8];
|
||||
int part_tex_smoke_ring[8];
|
||||
|
||||
void
|
||||
GDT_Init (void)
|
||||
{
|
||||
GDT_InitDotParticleTexture ();
|
||||
GDT_InitSparkParticleTexture ();
|
||||
GDT_InitSmokeParticleTexture ();
|
||||
GDT_InitSmokeRingParticleTexture ();
|
||||
}
|
||||
|
||||
static void
|
||||
GDT_InitDotParticleTexture (void)
|
||||
{
|
||||
int x, y, dx2, dy, d;
|
||||
byte data[16][16][2];
|
||||
|
||||
for (x = 0; x < 16; x++) {
|
||||
dx2 = x - 8;
|
||||
dx2 *= dx2;
|
||||
for (y = 0; y < 16; y++) {
|
||||
dy = y - 8;
|
||||
d = 255 - 4 * (dx2 + (dy * dy));
|
||||
if (d<=0) {
|
||||
d = 0;
|
||||
data[y][x][0] = 0;
|
||||
} else
|
||||
data[y][x][0] = 255;
|
||||
|
||||
data[y][x][1] = (byte) d;
|
||||
}
|
||||
}
|
||||
part_tex_dot = texture_extension_number++;
|
||||
glBindTexture (GL_TEXTURE_2D, part_tex_dot);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA,
|
||||
GL_UNSIGNED_BYTE, data);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
GDT_InitSparkParticleTexture (void)
|
||||
{
|
||||
int x, y, dx2, dy, d;
|
||||
byte data[16][16][2];
|
||||
|
||||
for (x = 0; x < 16; x++) {
|
||||
dx2 = 8 - abs(x - 8);
|
||||
dx2 *= dx2;
|
||||
for (y = 0; y < 16; y++) {
|
||||
dy = 8 - abs(y - 8);
|
||||
d = 3 * (dx2 + dy * dy) - 100;
|
||||
if (d>255)
|
||||
d = 255;
|
||||
if (d<1) {
|
||||
d = 0;
|
||||
data[y][x][0] = 0;
|
||||
} else
|
||||
data[y][x][0] = 255;
|
||||
|
||||
data[y][x][1] = (byte) d;
|
||||
}
|
||||
}
|
||||
part_tex_spark = texture_extension_number++;
|
||||
glBindTexture (GL_TEXTURE_2D, part_tex_spark);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, 2, 16, 16, 0, GL_LUMINANCE_ALPHA,
|
||||
GL_UNSIGNED_BYTE, data);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
GDT_InitSmokeParticleTexture (void)
|
||||
{
|
||||
int i, x, y, c;
|
||||
float dx, dy2;
|
||||
byte d, data[32][32][2], noise1[32][32], noise2[32][32];
|
||||
|
||||
for (i = 0; i < 8; i++) {
|
||||
noise_plasma (&noise1[0][0], 32);
|
||||
noise_diamondsquare (&noise2[0][0], 32);
|
||||
for (y = 0; y < 32; y++)
|
||||
{
|
||||
dy2 = y - 16;
|
||||
dy2 *= dy2;
|
||||
for (x = 0; x < 32; x++) {
|
||||
dx = x - 16;
|
||||
c = 255 - (dx*dx + dy2);
|
||||
if (c < 1)
|
||||
c = 0;
|
||||
d = (noise1[y][x] + noise2[y][x]) / 2;
|
||||
if (d > 0) {
|
||||
data[y][x][0] = 255;
|
||||
data[y][x][1] = (d * c)/255;
|
||||
} else {
|
||||
data[y][x][0] = 255;
|
||||
data[y][x][1] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
part_tex_smoke[i] = texture_extension_number++;
|
||||
glBindTexture (GL_TEXTURE_2D, part_tex_smoke[i]);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA,
|
||||
GL_UNSIGNED_BYTE, data);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
GDT_InitSmokeRingParticleTexture (void)
|
||||
{
|
||||
int i, x, y, b;
|
||||
float dx, dy, c, c2;
|
||||
byte d, data[32][32][2], noise1[32][32], noise2[32][32];
|
||||
|
||||
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++;
|
||||
glBindTexture (GL_TEXTURE_2D, part_tex_smoke_ring[i]);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, 2, 32, 32, 0, GL_LUMINANCE_ALPHA,
|
||||
GL_UNSIGNED_BYTE, data);
|
||||
}
|
||||
}
|
|
@ -1,402 +0,0 @@
|
|||
|
||||
/*
|
||||
gl_part.c
|
||||
|
||||
OpenGL particle rendering
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "r_shared.h"
|
||||
#include "r_local.h"
|
||||
#include "glquake.h"
|
||||
#include "server.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/cmd.h"
|
||||
|
||||
#define MAX_FIRES 128 // rocket flames
|
||||
fire_t r_fires[MAX_FIRES];
|
||||
|
||||
/*
|
||||
===============
|
||||
R_DrawParticles
|
||||
===============
|
||||
*/
|
||||
|
||||
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;
|
||||
|
||||
unsigned char *at;
|
||||
unsigned char theAlpha;
|
||||
qboolean alphaTestEnabled;
|
||||
qboolean blendEnabled;
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, particletexture);
|
||||
// LordHavoc: particles should not affect zbuffer
|
||||
glDepthMask (0);
|
||||
|
||||
if (!(blendEnabled = glIsEnabled (GL_BLEND))) {
|
||||
glEnable (GL_BLEND);
|
||||
}
|
||||
if ((alphaTestEnabled = glIsEnabled (GL_ALPHA_TEST))) {
|
||||
glDisable (GL_ALPHA_TEST);
|
||||
}
|
||||
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 = frametime * 4;
|
||||
|
||||
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;
|
||||
else
|
||||
theAlpha = 255;
|
||||
if (lighthalf)
|
||||
glColor4ub ((byte) ((int) at[0] >> 1), (byte) ((int) at[1] >> 1),
|
||||
(byte) ((int) at[2] >> 1), theAlpha);
|
||||
else
|
||||
glColor4ub (at[0], at[1], at[2], theAlpha);
|
||||
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 ();
|
||||
if (alphaTestEnabled) {
|
||||
glEnable (GL_ALPHA_TEST);
|
||||
}
|
||||
if (!blendEnabled) {
|
||||
glDisable (GL_BLEND);
|
||||
}
|
||||
glDepthMask (1);
|
||||
}
|
||||
|
||||
/*
|
||||
R_AddFire
|
||||
|
||||
Nifty ball of fire GL effect. Kinda a meshing of the dlight and
|
||||
particle engine code.
|
||||
*/
|
||||
float r_firecolor_flame[3] = { 0.9, 0.7, 0.3 };
|
||||
float r_firecolor_light[3] = { 0.9, 0.7, 0.3 };
|
||||
|
||||
void
|
||||
R_AddFire (vec3_t start, vec3_t end, entity_t *ent)
|
||||
{
|
||||
float len;
|
||||
fire_t *f;
|
||||
dlight_t *dl;
|
||||
vec3_t vec;
|
||||
int key;
|
||||
|
||||
if (!gl_fires->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (end, start, vec);
|
||||
len = VectorNormalize (vec);
|
||||
key = ent - cl_entities + 1;
|
||||
|
||||
if (len) {
|
||||
f = R_AllocFire (key);
|
||||
VectorCopy (end, f->origin);
|
||||
VectorCopy (start, f->owner);
|
||||
f->size = 10;
|
||||
f->die = cl.time + 0.5;
|
||||
f->decay = 1;
|
||||
VectorCopy (r_firecolor_flame, f->color);
|
||||
|
||||
dl = CL_AllocDlight (key);
|
||||
VectorCopy (end, dl->origin);
|
||||
dl->radius = 200;
|
||||
dl->die = cl.time + 0.5;
|
||||
VectorCopy (r_firecolor_light, dl->color);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
R_AllocFire
|
||||
|
||||
Clears out and returns a new fireball
|
||||
*/
|
||||
fire_t *
|
||||
R_AllocFire (int key)
|
||||
{
|
||||
int i;
|
||||
fire_t *f;
|
||||
|
||||
if (key) // first try to find/reuse a keyed
|
||||
// spot
|
||||
{
|
||||
f = r_fires;
|
||||
for (i = 0; i < MAX_FIRES; i++, f++)
|
||||
if (f->key == key) {
|
||||
memset (f, 0, sizeof (*f));
|
||||
f->key = key;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
f = r_fires; // no match, look for a free spot
|
||||
for (i = 0; i < MAX_FIRES; i++, f++) {
|
||||
if (f->die < cl.time) {
|
||||
memset (f, 0, sizeof (*f));
|
||||
f->key = key;
|
||||
return f;
|
||||
}
|
||||
}
|
||||
|
||||
f = &r_fires[0];
|
||||
memset (f, 0, sizeof (*f));
|
||||
f->key = key;
|
||||
return f;
|
||||
}
|
||||
|
||||
/*
|
||||
R_DrawFire
|
||||
|
||||
draws one fireball - probably never need to call this directly
|
||||
*/
|
||||
void
|
||||
R_DrawFire (fire_t *f)
|
||||
{
|
||||
int i, j;
|
||||
vec3_t vec, vec2;
|
||||
float radius;
|
||||
float *b_sin, *b_cos;
|
||||
|
||||
b_sin = bubble_sintable;
|
||||
b_cos = bubble_costable;
|
||||
|
||||
radius = f->size - 0.5;
|
||||
|
||||
// figure out if we're inside the area of effect
|
||||
VectorSubtract (f->origin, r_origin, vec);
|
||||
if (Length (vec) < radius) {
|
||||
AddLightBlend (1, 0.5, 0, f->size * 0.0003); // we are
|
||||
return;
|
||||
}
|
||||
// we're not - draw it
|
||||
glBegin (GL_TRIANGLE_FAN);
|
||||
if (lighthalf)
|
||||
glColor3f (f->color[0] * 0.5, f->color[1] * 0.5, f->color[2] * 0.5);
|
||||
else
|
||||
glColor3fv (f->color);
|
||||
for (i = 0; i < 3; i++)
|
||||
vec[i] = f->origin[i] - vpn[i] * radius;
|
||||
glVertex3fv (vec);
|
||||
glColor3f (0.0, 0.0, 0.0);
|
||||
|
||||
// don't panic, this just draws a bubble...
|
||||
for (i = 16; i >= 0; i--) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
vec[j] = f->origin[j] + (*b_cos * vright[j]
|
||||
+ vup[j] * (*b_sin)) * radius;
|
||||
vec2[j] = f->owner[j] + (*b_cos * vright[j]
|
||||
+ vup[j] * (*b_sin)) * radius;
|
||||
}
|
||||
glVertex3fv (vec);
|
||||
glVertex3fv (vec2);
|
||||
|
||||
b_sin += 2;
|
||||
b_cos += 2;
|
||||
}
|
||||
glEnd ();
|
||||
}
|
||||
|
||||
/*
|
||||
R_UpdateFires
|
||||
|
||||
Draws each fireball in sequence
|
||||
*/
|
||||
void
|
||||
R_UpdateFires (void)
|
||||
{
|
||||
int i;
|
||||
fire_t *f;
|
||||
|
||||
if (!gl_fires->int_val)
|
||||
return;
|
||||
|
||||
glDepthMask (0);
|
||||
glDisable (GL_TEXTURE_2D);
|
||||
glShadeModel (GL_SMOOTH);
|
||||
glEnable (GL_BLEND);
|
||||
glBlendFunc (GL_ONE, GL_ONE);
|
||||
|
||||
f = r_fires;
|
||||
for (i = 0; i < MAX_FIRES; i++, f++) {
|
||||
if (f->die < cl.time || !f->size)
|
||||
continue;
|
||||
f->size += f->decay;
|
||||
R_DrawFire (f);
|
||||
}
|
||||
|
||||
glColor3f (1.0, 1.0, 1.0);
|
||||
glDisable (GL_BLEND);
|
||||
glEnable (GL_TEXTURE_2D);
|
||||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
glDepthMask (1);
|
||||
}
|
||||
|
||||
void
|
||||
R_FireColor_f (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (Cmd_Argc () == 1) {
|
||||
Con_Printf ("r_firecolor %f %f %f\n",
|
||||
r_firecolor_flame[0],
|
||||
r_firecolor_flame[1], r_firecolor_flame[2]);
|
||||
return;
|
||||
}
|
||||
if (Cmd_Argc () == 5 || Cmd_Argc () == 6) {
|
||||
Con_Printf
|
||||
("Warning: obsolete 4th and 5th parameters to r_firecolor ignored\n");
|
||||
} else if (Cmd_Argc () != 4) {
|
||||
Con_Printf ("Usage r_firecolor R G B\n");
|
||||
return;
|
||||
}
|
||||
for (i = 0; i < 4; i++) {
|
||||
r_firecolor_flame[i] = atof (Cmd_Argv (i + 1));
|
||||
r_firecolor_light[i] = r_firecolor_flame[i];
|
||||
}
|
||||
}
|
|
@ -30,14 +30,15 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "render.h"
|
||||
#include "QF/model.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/console.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "d_iface.h"
|
||||
// #include "d_iface.h"
|
||||
#include "glquake.h"
|
||||
#include "render.h"
|
||||
#include "r_local.h"
|
||||
|
||||
mnode_t *r_pefragtopnode;
|
||||
|
||||
|
@ -97,11 +98,7 @@ R_RemoveEfrags (entity_t *ent)
|
|||
ent->efrag = NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
===================
|
||||
R_SplitEntityOnNode
|
||||
===================
|
||||
*/
|
||||
|
||||
void
|
||||
R_SplitEntityOnNode (mnode_t *node)
|
||||
{
|
||||
|
@ -163,12 +160,6 @@ R_SplitEntityOnNode (mnode_t *node)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
===========
|
||||
R_AddEfrags
|
||||
===========
|
||||
*/
|
||||
void
|
||||
R_AddEfrags (entity_t *ent)
|
||||
{
|
||||
|
|
|
@ -29,24 +29,30 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/compat.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/console.h"
|
||||
#include "r_local.h"
|
||||
#include "view.h"
|
||||
#include "QF/model.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/sys.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "chase.h"
|
||||
#include "game.h"
|
||||
#include "glquake.h"
|
||||
#include "client.h"
|
||||
#include "QF/model.h"
|
||||
#include "render.h"
|
||||
#include "QF/sys.h"
|
||||
#include "chase.h"
|
||||
#include "r_local.h"
|
||||
#include "view.h"
|
||||
|
||||
entity_t r_worldentity;
|
||||
|
||||
|
@ -64,13 +70,7 @@ int r_framecount; // used for dlight push checking
|
|||
|
||||
int c_brush_polys, c_alias_polys;
|
||||
|
||||
qboolean envmap; // true during envmap command capture
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
|
||||
//
|
||||
qboolean envmap; // true during envmap command capture
|
||||
|
||||
|
||||
int particletexture; // little dot for particles
|
||||
|
@ -128,7 +128,7 @@ cvar_t *gl_playermip;
|
|||
cvar_t *gl_nocolors;
|
||||
cvar_t *gl_keeptjunctions;
|
||||
cvar_t *gl_reporttjunctions;
|
||||
cvar_t *gl_particles;
|
||||
cvar_t *r_particles;
|
||||
|
||||
cvar_t *r_skyname;
|
||||
cvar_t *gl_skymultipass;
|
||||
|
@ -207,11 +207,7 @@ R_RotateForEntity (entity_t *e)
|
|||
=============================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
================
|
||||
R_GetSpriteFrame
|
||||
================
|
||||
*/
|
||||
|
||||
static mspriteframe_t *
|
||||
R_GetSpriteFrame (entity_t *currententity)
|
||||
{
|
||||
|
@ -256,12 +252,6 @@ R_GetSpriteFrame (entity_t *currententity)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
R_DrawSpriteModel
|
||||
|
||||
=================
|
||||
*/
|
||||
static void
|
||||
R_DrawSpriteModel (entity_t *e)
|
||||
{
|
||||
|
@ -320,6 +310,7 @@ R_DrawSpriteModel (entity_t *e)
|
|||
glDisable (GL_ALPHA_TEST);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=============================================================
|
||||
|
||||
|
@ -328,7 +319,6 @@ R_DrawSpriteModel (entity_t *e)
|
|||
=============================================================
|
||||
*/
|
||||
|
||||
|
||||
#define NUMVERTEXNORMALS 162
|
||||
|
||||
float r_avertexnormals[NUMVERTEXNORMALS][3] = {
|
||||
|
@ -348,11 +338,7 @@ float *shadedots = r_avertexnormal_dots[0];
|
|||
|
||||
int lastposenum;
|
||||
|
||||
/*
|
||||
=============
|
||||
GL_DrawAliasFrame
|
||||
=============
|
||||
*/
|
||||
|
||||
static void
|
||||
GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb)
|
||||
{
|
||||
|
@ -402,11 +388,7 @@ GL_DrawAliasFrame (aliashdr_t *paliashdr, int posenum, qboolean fb)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
GL_DrawAliasShadow
|
||||
=============
|
||||
*/
|
||||
|
||||
extern vec3_t lightspot;
|
||||
|
||||
static void
|
||||
|
@ -468,13 +450,6 @@ GL_DrawAliasShadow (aliashdr_t *paliashdr, int posenum)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
R_SetupAliasFrame
|
||||
|
||||
=================
|
||||
*/
|
||||
static void
|
||||
R_SetupAliasFrame (int frame, aliashdr_t *paliashdr, qboolean fb)
|
||||
{
|
||||
|
@ -498,12 +473,6 @@ R_SetupAliasFrame (int frame, aliashdr_t *paliashdr, qboolean fb)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
R_DrawAliasModel
|
||||
|
||||
=================
|
||||
*/
|
||||
static void
|
||||
R_DrawAliasModel (entity_t *e)
|
||||
{
|
||||
|
@ -671,11 +640,7 @@ R_DrawAliasModel (entity_t *e)
|
|||
|
||||
//==================================================================================
|
||||
|
||||
/*
|
||||
=============
|
||||
R_DrawEntitiesOnList
|
||||
=============
|
||||
*/
|
||||
|
||||
static void
|
||||
R_DrawEntitiesOnList (void)
|
||||
{
|
||||
|
@ -713,11 +678,7 @@ R_DrawEntitiesOnList (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
R_DrawViewModel
|
||||
=============
|
||||
*/
|
||||
|
||||
static void
|
||||
R_DrawViewModel (void)
|
||||
{
|
||||
|
@ -734,6 +695,7 @@ R_DrawViewModel (void)
|
|||
glDepthRange (gldepthmin, gldepthmax);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
SignbitsForPlane (mplane_t *out)
|
||||
{
|
||||
|
@ -787,12 +749,6 @@ R_SetFrustum (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_SetupFrame
|
||||
===============
|
||||
*/
|
||||
static void
|
||||
R_SetupFrame (void)
|
||||
{
|
||||
|
@ -839,11 +795,6 @@ MYgluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
R_SetupGL
|
||||
=============
|
||||
*/
|
||||
static void
|
||||
R_SetupGL (void)
|
||||
{
|
||||
|
@ -926,6 +877,7 @@ R_SetupGL (void)
|
|||
glShadeModel (GL_SMOOTH);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
R_RenderScene
|
||||
|
@ -958,11 +910,6 @@ R_RenderScene (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
R_Clear
|
||||
=============
|
||||
*/
|
||||
static void
|
||||
R_Clear (void)
|
||||
{
|
||||
|
@ -977,13 +924,7 @@ R_Clear (void)
|
|||
glDepthRange (gldepthmin, gldepthmax);
|
||||
}
|
||||
|
||||
#if 0 // !!! FIXME, Zoid, mirror is
|
||||
// disabled for now
|
||||
/*
|
||||
=============
|
||||
R_Mirror
|
||||
=============
|
||||
*/
|
||||
#if 0 // !!! FIXME, Zoid, mirror is disabled for now
|
||||
void
|
||||
R_Mirror (void)
|
||||
{
|
||||
|
@ -1048,6 +989,7 @@ R_Mirror (void)
|
|||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
R_RenderView
|
||||
|
|
|
@ -29,47 +29,47 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/vid.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/mathlib.h" // needed by: protocol.h, render.h,
|
||||
// client.h,
|
||||
// modelgen.h, glmodel.h
|
||||
#include "QF/wad.h"
|
||||
#include "draw.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "net.h" // needed by: client.h
|
||||
#include "protocol.h" // needed by: client.h
|
||||
#include <stdio.h>
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "sbar.h"
|
||||
#include "render.h" // needed by: client.h, gl_model.h,
|
||||
// glquake.h
|
||||
#include "client.h" // need cls in this file
|
||||
#include "QF/model.h" // needed by: glquake.h
|
||||
#include "QF/console.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/model.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/varrays.h"
|
||||
#include "QF/vid.h"
|
||||
#include "QF/wad.h"
|
||||
|
||||
#include "client.h"
|
||||
#include "draw.h"
|
||||
#include "glquake.h"
|
||||
#include "net.h"
|
||||
#include "protocol.h"
|
||||
#include "sbar.h"
|
||||
#include "render.h"
|
||||
#include "r_dynamic.h"
|
||||
#include "r_local.h"
|
||||
|
||||
extern entity_t r_worldentity;
|
||||
extern void GDT_Init ();
|
||||
|
||||
varray_t2f_c4f_v3f_t varray[MAX_VARRAY_VERTS];
|
||||
|
||||
qboolean VID_Is8bit (void);
|
||||
void R_InitBubble ();
|
||||
void R_FireColor_f (void);
|
||||
|
||||
cvar_t *gl_fires;
|
||||
qboolean allowskybox; // allow skyboxes? --KB
|
||||
|
||||
/*
|
||||
==================
|
||||
R_InitTextures
|
||||
==================
|
||||
*/
|
||||
|
||||
void
|
||||
R_InitTextures (void)
|
||||
{
|
||||
|
@ -100,59 +100,11 @@ R_InitTextures (void)
|
|||
}
|
||||
}
|
||||
|
||||
byte dottexture[8][8] = {
|
||||
{0, 1, 1, 0, 0, 0, 0, 0}
|
||||
,
|
||||
{1, 1, 1, 1, 0, 0, 0, 0}
|
||||
,
|
||||
{1, 1, 1, 1, 0, 0, 0, 0}
|
||||
,
|
||||
{0, 1, 1, 0, 0, 0, 0, 0}
|
||||
,
|
||||
{0, 0, 0, 0, 0, 0, 0, 0}
|
||||
,
|
||||
{0, 0, 0, 0, 0, 0, 0, 0}
|
||||
,
|
||||
{0, 0, 0, 0, 0, 0, 0, 0}
|
||||
,
|
||||
{0, 0, 0, 0, 0, 0, 0, 0}
|
||||
,
|
||||
};
|
||||
void
|
||||
R_InitParticleTexture (void)
|
||||
{
|
||||
int x, y;
|
||||
byte data[8][8][4];
|
||||
|
||||
//
|
||||
// particle texture
|
||||
//
|
||||
particletexture = texture_extension_number++;
|
||||
glBindTexture (GL_TEXTURE_2D, particletexture);
|
||||
|
||||
for (x = 0; x < 8; x++) {
|
||||
for (y = 0; y < 8; y++) {
|
||||
data[y][x][0] = 255;
|
||||
data[y][x][1] = 255;
|
||||
data[y][x][2] = 255;
|
||||
data[y][x][3] = dottexture[x][y] * 255;
|
||||
}
|
||||
}
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, gl_alpha_format, 8, 8, 0, GL_RGBA,
|
||||
GL_UNSIGNED_BYTE, data);
|
||||
|
||||
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
|
||||
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_Envmap_f
|
||||
R_Envmap_f
|
||||
|
||||
Grab six views for environment mapping tests
|
||||
===============
|
||||
Grab six views for environment mapping tests
|
||||
*/
|
||||
void
|
||||
R_Envmap_f (void)
|
||||
|
@ -214,9 +166,7 @@ R_Envmap_f (void)
|
|||
GL_EndRendering ();
|
||||
}
|
||||
|
||||
/*
|
||||
R_LoadSky_f
|
||||
*/
|
||||
|
||||
void
|
||||
R_LoadSky_f (void)
|
||||
{
|
||||
|
@ -229,11 +179,6 @@ R_LoadSky_f (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_Init
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_Init (void)
|
||||
{
|
||||
|
@ -245,8 +190,6 @@ R_Init (void)
|
|||
Cmd_AddCommand ("pointfile", R_ReadPointFile_f, "No Description");
|
||||
Cmd_AddCommand ("loadsky", R_LoadSky_f, "No Description");
|
||||
|
||||
Cmd_AddCommand ("r_firecolor", R_FireColor_f, "No Description");
|
||||
|
||||
r_norefresh = Cvar_Get ("r_norefresh", "0", CVAR_NONE, NULL, "None");
|
||||
r_lightmap = Cvar_Get ("r_lightmap", "0", CVAR_NONE, NULL, "None");
|
||||
r_fullbright = Cvar_Get ("r_fullbright", "0", CVAR_NONE, NULL, "None");
|
||||
|
@ -278,8 +221,8 @@ R_Init (void)
|
|||
gl_fires = Cvar_Get ("gl_fires", "0", CVAR_ARCHIVE, NULL,
|
||||
"Toggles lavaball and rocket fireballs");
|
||||
|
||||
gl_particles = Cvar_Get ("gl_particles", "1", CVAR_ARCHIVE, NULL,
|
||||
"whether or not to draw particles");
|
||||
r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, NULL,
|
||||
"whether or not to draw particles");
|
||||
|
||||
gl_fb_models = Cvar_Get ("gl_fb_models", "1", CVAR_ARCHIVE, NULL,
|
||||
"Toggles fullbright color support for models.. "
|
||||
|
@ -299,13 +242,13 @@ R_Init (void)
|
|||
|
||||
R_InitBubble ();
|
||||
|
||||
R_InitParticles ();
|
||||
R_InitParticleTexture ();
|
||||
GDT_Init ();
|
||||
|
||||
playertextures = texture_extension_number;
|
||||
texture_extension_number += 16;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_TranslatePlayerSkin
|
||||
|
@ -455,11 +398,7 @@ R_TranslatePlayerSkin (int playernum)
|
|||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_NewMap
|
||||
===============
|
||||
*/
|
||||
|
||||
void
|
||||
R_NewMap (void)
|
||||
{
|
||||
|
@ -539,6 +478,7 @@ R_TimeRefresh_f (void)
|
|||
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
D_FlushCaches (void)
|
||||
{
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/*
|
||||
gl_rsurf.c
|
||||
|
||||
|
@ -31,9 +30,14 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "QF/compat.h"
|
||||
|
@ -41,20 +45,16 @@
|
|||
#include "QF/qargs.h"
|
||||
#include "QF/vid.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/mathlib.h" // needed by: protocol.h, render.h,
|
||||
// client.h,
|
||||
// modelgen.h, glmodel.h
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/wad.h"
|
||||
#include "draw.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "net.h" // needed by: client.h
|
||||
#include "protocol.h" // needed by: client.h
|
||||
#include "protocol.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "sbar.h"
|
||||
#include "render.h" // needed by: client.h, gl_model.h,
|
||||
// glquake.h
|
||||
#include "client.h" // need cls in this file
|
||||
#include "QF/model.h" // needed by: glquake.h
|
||||
#include "render.h"
|
||||
#include "client.h"
|
||||
#include "QF/model.h"
|
||||
#include "QF/console.h"
|
||||
#include "glquake.h"
|
||||
|
||||
|
@ -69,6 +69,7 @@ int lightmap_textures;
|
|||
unsigned blocklights[18 * 18 * 3];
|
||||
|
||||
cvar_t *gl_colorlights;
|
||||
cvar_t *gl_lightmap_components;
|
||||
|
||||
#define BLOCK_WIDTH 128
|
||||
#define BLOCK_HEIGHT 128
|
||||
|
@ -97,6 +98,7 @@ msurface_t *waterchain = NULL;
|
|||
|
||||
extern qboolean lighthalf;
|
||||
|
||||
|
||||
// LordHavoc: place for gl_rsurf setup code
|
||||
void
|
||||
glrsurf_init ()
|
||||
|
@ -104,6 +106,7 @@ glrsurf_init ()
|
|||
memset (&lightmaps, 0, sizeof (lightmaps));
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
recursivelightupdate (mnode_t *node)
|
||||
{
|
||||
|
@ -119,6 +122,7 @@ recursivelightupdate (mnode_t *node)
|
|||
c--, surf++) surf->cached_dlight = true;
|
||||
}
|
||||
|
||||
|
||||
// LordHavoc: function to force all lightmaps to be updated
|
||||
void
|
||||
R_ForceLightUpdate ()
|
||||
|
@ -128,6 +132,7 @@ R_ForceLightUpdate ()
|
|||
recursivelightupdate (cl.worldmodel->nodes);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
R_AddDynamicLights
|
||||
|
||||
|
@ -136,11 +141,6 @@ R_ForceLightUpdate ()
|
|||
int dlightdivtable[8192];
|
||||
int dlightdivtableinitialized = 0;
|
||||
|
||||
/*
|
||||
===============
|
||||
R_AddDynamicLights
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_AddDynamicLights (msurface_t *surf)
|
||||
{
|
||||
|
@ -244,6 +244,7 @@ R_AddDynamicLights (msurface_t *surf)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
R_BuildLightMap
|
||||
|
||||
|
@ -363,6 +364,7 @@ R_BuildLightMap (msurface_t *surf, byte * dest, int stride)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_TextureAnimation
|
||||
|
@ -423,6 +425,7 @@ GL_UploadLightmap (int i, int x, int y, int w, int h)
|
|||
lightmaps[i] + (y * BLOCK_WIDTH) * lightmap_bytes);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
R_DrawSequentialPoly
|
||||
|
@ -494,11 +497,7 @@ R_DrawMultitexturePoly (msurface_t *s)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_BlendLightmaps
|
||||
================
|
||||
*/
|
||||
|
||||
void
|
||||
R_BlendLightmaps (void)
|
||||
{
|
||||
|
@ -541,11 +540,6 @@ R_BlendLightmaps (void)
|
|||
glDepthMask (1); // back to normal Z buffering
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
R_RenderFullbrights
|
||||
|
||||
*/
|
||||
|
||||
void
|
||||
R_RenderFullbrights (void)
|
||||
|
@ -577,11 +571,7 @@ R_RenderFullbrights (void)
|
|||
glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_RenderBrushPoly
|
||||
================
|
||||
*/
|
||||
|
||||
void
|
||||
R_RenderBrushPoly (msurface_t *fa)
|
||||
{
|
||||
|
@ -651,6 +641,7 @@ R_RenderBrushPoly (msurface_t *fa)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
GL_WaterSurface (msurface_t *s)
|
||||
{
|
||||
|
@ -672,11 +663,7 @@ GL_WaterSurface (msurface_t *s)
|
|||
glTexEnvf (GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
|
||||
}
|
||||
|
||||
/*
|
||||
================
|
||||
R_DrawWaterSurfaces
|
||||
================
|
||||
*/
|
||||
|
||||
void
|
||||
R_DrawWaterSurfaces (void)
|
||||
{
|
||||
|
@ -715,11 +702,6 @@ R_DrawWaterSurfaces (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
DrawTextureChains
|
||||
================
|
||||
*/
|
||||
void
|
||||
DrawTextureChains (void)
|
||||
{
|
||||
|
@ -736,11 +718,7 @@ DrawTextureChains (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_DrawBrushModel
|
||||
=================
|
||||
*/
|
||||
|
||||
void
|
||||
R_DrawBrushModel (entity_t *e)
|
||||
{
|
||||
|
@ -858,11 +836,7 @@ R_DrawBrushModel (entity_t *e)
|
|||
=============================================================
|
||||
*/
|
||||
|
||||
/*
|
||||
================
|
||||
R_RecursiveWorldNode
|
||||
================
|
||||
*/
|
||||
|
||||
void
|
||||
R_RecursiveWorldNode (mnode_t *node)
|
||||
{
|
||||
|
@ -967,12 +941,6 @@ R_RecursiveWorldNode (mnode_t *node)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
R_DrawWorld
|
||||
=============
|
||||
*/
|
||||
void
|
||||
R_DrawWorld (void)
|
||||
{
|
||||
|
@ -1010,11 +978,6 @@ R_DrawWorld (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_MarkLeaves
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_MarkLeaves (void)
|
||||
{
|
||||
|
@ -1052,7 +1015,6 @@ R_MarkLeaves (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
=============================================================================
|
||||
|
||||
|
@ -1111,11 +1073,6 @@ model_t *currentmodel;
|
|||
|
||||
int nColinElim;
|
||||
|
||||
/*
|
||||
================
|
||||
BuildSurfaceDisplayList
|
||||
================
|
||||
*/
|
||||
void
|
||||
BuildSurfaceDisplayList (msurface_t *fa)
|
||||
{
|
||||
|
@ -1223,11 +1180,7 @@ BuildSurfaceDisplayList (msurface_t *fa)
|
|||
|
||||
}
|
||||
|
||||
/*
|
||||
========================
|
||||
GL_CreateSurfaceLightmap
|
||||
========================
|
||||
*/
|
||||
|
||||
void
|
||||
GL_CreateSurfaceLightmap (msurface_t *surf)
|
||||
{
|
||||
|
|
|
@ -29,9 +29,14 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
|
@ -41,24 +46,21 @@
|
|||
#include "QF/qendian.h"
|
||||
#include "QF/vid.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/mathlib.h" // needed by: protocol.h, render.h,
|
||||
// client.h,
|
||||
// modelgen.h, glmodel.h
|
||||
#include "QF/mathlib.h"
|
||||
#include "QF/wad.h"
|
||||
#include "draw.h"
|
||||
#include "QF/cvar.h"
|
||||
#include "net.h" // needed by: client.h
|
||||
#include "protocol.h" // needed by: client.h
|
||||
#include "net.h"
|
||||
#include "protocol.h"
|
||||
#include "QF/keys.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "sbar.h"
|
||||
#include "QF/sound.h"
|
||||
#include "QF/screen.h"
|
||||
#include "r_local.h"
|
||||
#include "render.h" // needed by: client.h, gl_model.h,
|
||||
// glquake.h
|
||||
#include "client.h" // need cls in this file
|
||||
#include "QF/model.h" // needed by: glquake.h
|
||||
#include "render.h"
|
||||
#include "client.h"
|
||||
#include "QF/model.h"
|
||||
#include "QF/console.h"
|
||||
#include "glquake.h"
|
||||
#include "view.h"
|
||||
|
@ -176,6 +178,7 @@ int scr_center_lines;
|
|||
int scr_erase_lines;
|
||||
int scr_erase_center;
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_CenterPrint
|
||||
|
@ -247,6 +250,7 @@ SCR_DrawCenterString (void)
|
|||
} while (1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SCR_CheckDrawCenterString (void)
|
||||
{
|
||||
|
@ -266,11 +270,7 @@ SCR_CheckDrawCenterString (void)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
/*
|
||||
====================
|
||||
CalcFov
|
||||
====================
|
||||
*/
|
||||
|
||||
float
|
||||
CalcFov (float fov_x, float width, float height)
|
||||
{
|
||||
|
@ -289,6 +289,7 @@ CalcFov (float fov_x, float width, float height)
|
|||
return a;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
SCR_CalcRefdef
|
||||
|
@ -410,11 +411,6 @@ SCR_SizeDown_f (void)
|
|||
|
||||
//============================================================================
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_Init
|
||||
==================
|
||||
*/
|
||||
void
|
||||
SCR_Init_Cvars (void)
|
||||
{
|
||||
|
@ -431,6 +427,7 @@ SCR_Init_Cvars (void)
|
|||
"None");
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SCR_Init (void)
|
||||
{
|
||||
|
@ -449,12 +446,6 @@ SCR_Init (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawRam
|
||||
==============
|
||||
*/
|
||||
void
|
||||
SCR_DrawRam (void)
|
||||
{
|
||||
|
@ -467,11 +458,7 @@ SCR_DrawRam (void)
|
|||
Draw_Pic (scr_vrect.x + 32, scr_vrect.y, scr_ram);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawTurtle
|
||||
==============
|
||||
*/
|
||||
|
||||
void
|
||||
SCR_DrawTurtle (void)
|
||||
{
|
||||
|
@ -492,11 +479,6 @@ SCR_DrawTurtle (void)
|
|||
Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawFPS
|
||||
==============
|
||||
*/
|
||||
|
||||
void
|
||||
SCR_DrawFPS (void)
|
||||
|
@ -528,6 +510,7 @@ SCR_DrawFPS (void)
|
|||
|
||||
}
|
||||
|
||||
|
||||
/* Misty: I like to see the time */
|
||||
void
|
||||
SCR_DrawTime (void)
|
||||
|
@ -563,11 +546,7 @@ SCR_DrawTime (void)
|
|||
Draw_String8 (x, y, st);
|
||||
}
|
||||
|
||||
/*
|
||||
==============
|
||||
DrawPause
|
||||
==============
|
||||
*/
|
||||
|
||||
void
|
||||
SCR_DrawPause (void)
|
||||
{
|
||||
|
@ -579,18 +558,12 @@ SCR_DrawPause (void)
|
|||
if (!cl.paused)
|
||||
return;
|
||||
|
||||
pic = Draw_CachePic ("gfx/pause.lmp");
|
||||
pic = Draw_CachePic ("gfx/pause.lmp", true);
|
||||
Draw_Pic ((vid.width - pic->width) / 2,
|
||||
(vid.height - 48 - pic->height) / 2, pic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawLoading
|
||||
==============
|
||||
*/
|
||||
void
|
||||
SCR_DrawLoading (void)
|
||||
{
|
||||
|
@ -599,21 +572,15 @@ SCR_DrawLoading (void)
|
|||
if (!scr_drawloading)
|
||||
return;
|
||||
|
||||
pic = Draw_CachePic ("gfx/loading.lmp");
|
||||
pic = Draw_CachePic ("gfx/loading.lmp", true);
|
||||
Draw_Pic ((vid.width - pic->width) / 2,
|
||||
(vid.height - 48 - pic->height) / 2, pic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_SetUpToDrawConsole
|
||||
==================
|
||||
*/
|
||||
void
|
||||
SCR_SetUpToDrawConsole (void)
|
||||
{
|
||||
|
@ -650,11 +617,7 @@ SCR_SetUpToDrawConsole (void)
|
|||
con_notifylines = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_DrawConsole
|
||||
==================
|
||||
*/
|
||||
|
||||
void
|
||||
SCR_DrawConsole (void)
|
||||
{
|
||||
|
@ -686,11 +649,6 @@ typedef struct _TargaHeader {
|
|||
} TargaHeader;
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_ScreenShot_f
|
||||
==================
|
||||
*/
|
||||
void
|
||||
SCR_ScreenShot_f (void)
|
||||
{
|
||||
|
@ -747,12 +705,6 @@ SCR_ScreenShot_f (void)
|
|||
//=============================================================================
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
SCR_BeginLoadingPlaque
|
||||
|
||||
================
|
||||
*/
|
||||
void
|
||||
SCR_BeginLoadingPlaque (void)
|
||||
{
|
||||
|
@ -779,12 +731,7 @@ SCR_BeginLoadingPlaque (void)
|
|||
scr_fullupdate = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
SCR_EndLoadingPlaque
|
||||
|
||||
================
|
||||
*/
|
||||
void
|
||||
SCR_EndLoadingPlaque (void)
|
||||
{
|
||||
|
@ -798,6 +745,7 @@ SCR_EndLoadingPlaque (void)
|
|||
char *scr_notifystring;
|
||||
qboolean scr_drawdialog;
|
||||
|
||||
|
||||
void
|
||||
SCR_DrawNotifyString (void)
|
||||
{
|
||||
|
@ -869,6 +817,7 @@ SCR_ModalMessage (char *text)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
SCR_BringDownConsole
|
||||
|
@ -891,6 +840,7 @@ SCR_BringDownConsole (void)
|
|||
VID_SetPalette (vid_basepal);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SCR_TileClear (void)
|
||||
{
|
||||
|
@ -918,8 +868,10 @@ SCR_TileClear (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
|
||||
float oldsbar = 0;
|
||||
extern void R_ForceLightUpdate ();
|
||||
unsigned char lighthalf_v[3];
|
||||
qboolean lighthalf;
|
||||
extern cvar_t *gl_lightmode;
|
||||
|
||||
|
|
600
nq/source/gl_textures.c
Normal file
600
nq/source/gl_textures.c
Normal file
|
@ -0,0 +1,600 @@
|
|||
/*
|
||||
gl_textures.c
|
||||
|
||||
Texture format setup.
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
Copyright (C) 2001 Ragnvald Maartmann-Moe IV
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/crc.h"
|
||||
#include "draw.h"
|
||||
#include "glquake.h"
|
||||
#include "sbar.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/vid.h"
|
||||
|
||||
extern int gl_filter_min, gl_filter_max;
|
||||
extern unsigned char d_15to8table[65536];
|
||||
extern cvar_t *gl_picmip;
|
||||
|
||||
typedef struct {
|
||||
int texnum;
|
||||
char identifier[64];
|
||||
int width, height;
|
||||
int bytesperpixel;
|
||||
// int texelformat; // eventually replace bytesperpixel
|
||||
qboolean mipmap;
|
||||
unsigned short crc; // LordHavoc: CRC for texure validation
|
||||
} gltexture_t;
|
||||
|
||||
static gltexture_t gltextures[MAX_GLTEXTURES];
|
||||
static int numgltextures = 0;
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
int minimize, maximize;
|
||||
} glmode_t;
|
||||
|
||||
static glmode_t modes[] = {
|
||||
{"GL_NEAREST", GL_NEAREST, GL_NEAREST},
|
||||
{"GL_LINEAR", GL_LINEAR, GL_LINEAR},
|
||||
{"GL_NEAREST_MIPMAP_NEAREST", GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST},
|
||||
{"GL_NEAREST_MIPMAP_LINEAR", GL_NEAREST_MIPMAP_LINEAR, GL_NEAREST},
|
||||
{"GL_LINEAR_MIPMAP_NEAREST", GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR},
|
||||
{"GL_LINEAR_MIPMAP_LINEAR", GL_LINEAR_MIPMAP_LINEAR, GL_LINEAR}
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
char *name;
|
||||
int format;
|
||||
} glformat_t;
|
||||
|
||||
static glformat_t formats[] = {
|
||||
/*
|
||||
1-4 are standardly supported formats by GL, not exactly the
|
||||
evil magic numbers they appear to be. Provided mostly as a
|
||||
way to avoid ugly code for supporting a shortcut, partly for
|
||||
consistency. --Despair
|
||||
*/
|
||||
{"1", 1},
|
||||
{"2", 2},
|
||||
{"3", 3},
|
||||
{"4", 4},
|
||||
{"GL_ALPHA", GL_ALPHA},
|
||||
{"GL_ALPHA4", GL_ALPHA4},
|
||||
{"GL_ALPHA8", GL_ALPHA8},
|
||||
{"GL_ALPHA12", GL_ALPHA12},
|
||||
{"GL_ALPHA16", GL_ALPHA16},
|
||||
{"GL_LUMINANCE", GL_LUMINANCE},
|
||||
{"GL_LUMINANCE4", GL_LUMINANCE4},
|
||||
{"GL_LUMINANCE8", GL_LUMINANCE8},
|
||||
{"GL_LUMINANCE12", GL_LUMINANCE12},
|
||||
{"GL_LUMINANCE16", GL_LUMINANCE16},
|
||||
{"GL_LUMINANCE_ALPHA", GL_LUMINANCE_ALPHA},
|
||||
{"GL_LUMINANCE4_ALPHA4", GL_LUMINANCE4_ALPHA4},
|
||||
{"GL_LUMINANCE6_ALPHA2", GL_LUMINANCE6_ALPHA2},
|
||||
{"GL_LUMINANCE8_ALPHA8", GL_LUMINANCE8_ALPHA8},
|
||||
{"GL_LUMINANCE12_ALPHA4", GL_LUMINANCE12_ALPHA4},
|
||||
{"GL_LUMINANCE12_ALPHA12", GL_LUMINANCE12_ALPHA12},
|
||||
{"GL_LUMINANCE16_ALPHA16", GL_LUMINANCE16_ALPHA16},
|
||||
{"GL_INTENSITY", GL_INTENSITY},
|
||||
{"GL_INTENSITY4", GL_INTENSITY4},
|
||||
{"GL_INTENSITY8", GL_INTENSITY8},
|
||||
{"GL_INTENSITY12", GL_INTENSITY12},
|
||||
{"GL_INTENSITY16", GL_INTENSITY16},
|
||||
{"GL_R3_G3_B2", GL_R3_G3_B2},
|
||||
{"GL_RGB", GL_RGB},
|
||||
{"GL_RGB4", GL_RGB4},
|
||||
{"GL_RGB5", GL_RGB5},
|
||||
{"GL_RGB8", GL_RGB8},
|
||||
{"GL_RGB10", GL_RGB10},
|
||||
{"GL_RGB12", GL_RGB12},
|
||||
{"GL_RGB16", GL_RGB16},
|
||||
{"GL_RGBA", GL_RGBA},
|
||||
{"GL_RGBA2", GL_RGBA2},
|
||||
{"GL_RGBA4", GL_RGBA4},
|
||||
{"GL_RGB5_A1", GL_RGB5_A1},
|
||||
{"GL_RGBA8", GL_RGBA8},
|
||||
{"GL_RGB10_A2", GL_RGB10_A2},
|
||||
{"GL_RGBA12", GL_RGBA12},
|
||||
{"GL_RGBA16", GL_RGBA16},
|
||||
/* EXT_paletted_textures
|
||||
{"COLOR_INDEX1_EXT", COLOR_INDEX1_EXT}.
|
||||
{"COLOR_INDEX2_EXT", COLOR_INDEX2_EXT},
|
||||
{"COLOR_INDEX4_EXT", COLOR_INDEX4_EXT},
|
||||
{"COLOR_INDEX8_EXT", COLOR_INDEX8_EXT},
|
||||
{"COLOR_INDEX12_EXT", COLOR_INDEX12_EXT},
|
||||
{"COLOR_INDEX16_EXT", COLOR_INDEX16_EXT},
|
||||
*/
|
||||
/* EXT_cmyka
|
||||
{"CMYK_EXT", CMYK_EXT},
|
||||
{"CMYKA_EXT", CMYKA_EXT},
|
||||
*/
|
||||
/* EXT_422_pixels
|
||||
{"422_EXT", 422_EXT},
|
||||
{"422_REV_EXT", 422_REV_EXT},
|
||||
{"422_AVERAGE_EXT", 422_AVERAGE_EXT},
|
||||
{"422_REV_AVERAGE_EXT", 422_REV_AVERAGE_EXT},
|
||||
*/
|
||||
/* EXT_abgr
|
||||
{"ABGR_EXT", ABGR_EXT},
|
||||
*/
|
||||
/* EXT_bgra
|
||||
{"BGR_EXT", BGR_EXT},
|
||||
{"BGRA_EXT", BGRA_EXT},
|
||||
*/
|
||||
/* ARB_texture_compression
|
||||
* only applicable for CompressedTexImage and CompressedTexSubimage
|
||||
* which will complicate upload paths. *ponder*
|
||||
{"COMPRESSED_ALPHA_ARB", COMPRESSED_ALPHA_ARB},
|
||||
{"COMPRESSED_LUMINANCE_ARB", COMPRESSED_LUMINANCE_ARB},
|
||||
{"COMPRESSED_LUMINANCE_ALPHA_ARB", COMPRESSED_LUMINANCE_ALPHA_ARB},
|
||||
{"COMPRESSED_INTENSITY_ARB", COMPRESSED_INTENSITY_ARB},
|
||||
{"COMPRESSED_RGB_ARB", COMPRESSED_RGB_ARB},
|
||||
{"COMPRESSED_RGBA_ARB", COMPRESSED_RGBA_ARB},
|
||||
*/
|
||||
{"NULL", 0}
|
||||
};
|
||||
|
||||
int gl_alpha_format = 4, gl_lightmap_format = 4, gl_solid_format = 3;
|
||||
|
||||
void
|
||||
GL_TextureMode_f (void)
|
||||
{
|
||||
int i;
|
||||
gltexture_t *glt;
|
||||
|
||||
if (Cmd_Argc () == 1) {
|
||||
for (i = 0; i < 6; i++)
|
||||
if (gl_filter_min == modes[i].minimize) {
|
||||
Con_Printf ("%s\n", modes[i].name);
|
||||
return;
|
||||
}
|
||||
Con_Printf ("current filter is unknown?\n");
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < 6; i++) {
|
||||
if (!strcasecmp (modes[i].name, Cmd_Argv (1)))
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 6) {
|
||||
Con_Printf ("bad filter name\n");
|
||||
return;
|
||||
}
|
||||
|
||||
gl_filter_min = modes[i].minimize;
|
||||
gl_filter_max = modes[i].maximize;
|
||||
|
||||
// change all the existing mipmap texture objects
|
||||
for (i = 0, glt = gltextures; i < numgltextures; i++, glt++) {
|
||||
if (glt->mipmap) {
|
||||
glBindTexture (GL_TEXTURE_2D, glt->texnum);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
|
||||
gl_filter_min);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,
|
||||
gl_filter_max);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
GL_TextureDepth_f (int format)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 42; i++) {
|
||||
if (format == formats[i].format) {
|
||||
Con_Printf ("%s\n", formats[i].name);
|
||||
return GL_RGBA;
|
||||
}
|
||||
Con_Printf ("Current texture format is unknown.\n");
|
||||
return GL_RGBA;
|
||||
}
|
||||
|
||||
for (i = 0; formats[i].format != 0; i++) {
|
||||
if (!strcasecmp (formats[i].name, Cmd_Argv (1)))
|
||||
break;
|
||||
}
|
||||
|
||||
if (formats[i].format == 0) {
|
||||
Con_Printf ("bad texture format name\n");
|
||||
return GL_RGBA;
|
||||
}
|
||||
|
||||
return formats[i].format;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
GL_ResampleTexture (unsigned int *in, int inwidth, int inheight,
|
||||
unsigned int *out, int outwidth, int outheight)
|
||||
{
|
||||
int i, j;
|
||||
unsigned int *inrow;
|
||||
unsigned int frac, fracstep;
|
||||
|
||||
if (!outwidth || !outheight)
|
||||
return;
|
||||
fracstep = inwidth * 0x10000 / outwidth;
|
||||
for (i = 0; i < outheight; i++, out += outwidth) {
|
||||
inrow = in + inwidth * (i * inheight / outheight);
|
||||
frac = fracstep >> 1;
|
||||
for (j = 0; j < outwidth; j ++) {
|
||||
out[j] = inrow[frac >> 16];
|
||||
frac += fracstep;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#if defined(GL_SHARED_TEXTURE_PALETTE_EXT) && defined(HAVE_GL_COLOR_INDEX8_EXT)
|
||||
static void
|
||||
GL_Resample8BitTexture (unsigned char *in, int inwidth, int inheight,
|
||||
unsigned char *out, int outwidth, int outheight)
|
||||
{
|
||||
int i, j;
|
||||
unsigned char *inrow;
|
||||
unsigned int frac, fracstep;
|
||||
|
||||
if (!outwidth || !outheight)
|
||||
return;
|
||||
fracstep = inwidth * 0x10000 / outwidth;
|
||||
for (i = 0; i < outheight; i++, out += outwidth) {
|
||||
inrow = in + inwidth * (i * inheight / outheight);
|
||||
frac = fracstep >> 1;
|
||||
for (j = 0; j < outwidth; j ++) {
|
||||
out[j] = inrow[frac >> 16];
|
||||
frac += fracstep;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
GL_MipMap
|
||||
|
||||
Operates in place, quartering the size of the texture.
|
||||
*/
|
||||
static void
|
||||
GL_MipMap (byte * in, int width, int height)
|
||||
{
|
||||
int i, j;
|
||||
byte *out;
|
||||
|
||||
width <<= 2;
|
||||
height >>= 1;
|
||||
out = in;
|
||||
|
||||
for (i = 0; i < height; i++, in += width) {
|
||||
for (j = 0; j < width; j += 8, out += 4, in += 8) {
|
||||
out[0] = (in[0] + in[4] + in[width + 0] + in[width + 4]) >> 2;
|
||||
out[1] = (in[1] + in[5] + in[width + 1] + in[width + 5]) >> 2;
|
||||
out[2] = (in[2] + in[6] + in[width + 2] + in[width + 6]) >> 2;
|
||||
out[3] = (in[3] + in[7] + in[width + 3] + in[width + 7]) >> 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
GL_MipMap8Bit
|
||||
|
||||
Mipping for 8 bit textures
|
||||
*/
|
||||
#if defined(GL_SHARED_TEXTURE_PALETTE_EXT) && defined(HAVE_GL_COLOR_INDEX8_EXT)
|
||||
static void
|
||||
GL_MipMap8Bit (byte * in, int width, int height)
|
||||
{
|
||||
int i, j;
|
||||
byte *out;
|
||||
unsigned short r, g, b;
|
||||
byte *at1, *at2, *at3, *at4;
|
||||
|
||||
height >>= 1;
|
||||
out = in;
|
||||
|
||||
for (i = 0; i < height; i++, in += width)
|
||||
for (j = 0; j < width; j += 2, out += 1, in += 2) {
|
||||
at1 = (byte *) & d_8to24table[in[0]];
|
||||
at2 = (byte *) & d_8to24table[in[1]];
|
||||
at3 = (byte *) & d_8to24table[in[width + 0]];
|
||||
at4 = (byte *) & d_8to24table[in[width + 1]];
|
||||
|
||||
r = (at1[0] + at2[0] + at3[0] + at4[0]);
|
||||
r >>= 5;
|
||||
g = (at1[1] + at2[1] + at3[1] + at4[1]);
|
||||
g >>= 5;
|
||||
b = (at1[2] + at2[2] + at3[2] + at4[2]);
|
||||
b >>= 5;
|
||||
|
||||
out[0] = d_15to8table[(r << 0) + (g << 5) + (b << 10)];
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
static void
|
||||
GL_Upload32 (unsigned int *data, int width, int height, qboolean mipmap,
|
||||
qboolean alpha)
|
||||
{
|
||||
unsigned int *scaled;
|
||||
int scaled_width, scaled_height, intformat;
|
||||
|
||||
if (!width || !height)
|
||||
return; // Null texture
|
||||
|
||||
// Snap the height and width to a power of 2.
|
||||
for (scaled_width = 1; scaled_width < width; scaled_width <<= 1);
|
||||
for (scaled_height = 1; scaled_height < height; scaled_height <<= 1);
|
||||
|
||||
scaled_width >>= gl_picmip->int_val;
|
||||
scaled_height >>= gl_picmip->int_val;
|
||||
|
||||
scaled_width = min (scaled_width, gl_max_size->int_val);
|
||||
scaled_height = min (scaled_height, gl_max_size->int_val);
|
||||
|
||||
if (!(scaled = malloc (scaled_width * scaled_height * sizeof (GLuint))))
|
||||
Sys_Error ("GL_LoadTexture: too big");
|
||||
|
||||
intformat = alpha ? gl_alpha_format : gl_solid_format;
|
||||
|
||||
// If the real width/height and the 'scaled' width/height then we
|
||||
// rescale it.
|
||||
|
||||
if (scaled_width == width && scaled_height == height) {
|
||||
memcpy (scaled, data, width * height * sizeof (GLuint));
|
||||
} else {
|
||||
GL_ResampleTexture (data, width, height, scaled, scaled_width,
|
||||
scaled_height);
|
||||
}
|
||||
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, intformat, scaled_width, scaled_height, 0,
|
||||
GL_RGBA, GL_UNSIGNED_BYTE, scaled);
|
||||
|
||||
if (mipmap) {
|
||||
int miplevel = 0;
|
||||
|
||||
while (scaled_width > 1 || scaled_height > 1) {
|
||||
GL_MipMap ((byte *) scaled, scaled_width, scaled_height);
|
||||
scaled_width >>= 1;
|
||||
scaled_height >>= 1;
|
||||
scaled_width = max (scaled_width, 1);
|
||||
scaled_height = max (scaled_height, 1);
|
||||
miplevel++;
|
||||
glTexImage2D (GL_TEXTURE_2D, miplevel, intformat, scaled_width,
|
||||
scaled_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, scaled);
|
||||
}
|
||||
}
|
||||
|
||||
if (mipmap) {
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
} else {
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
|
||||
if (gl_picmip->int_val)
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
else
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
}
|
||||
|
||||
free (scaled);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
GL_Upload8_EXT
|
||||
|
||||
If we have shared or global palettes, upload an 8-bit texture.
|
||||
If we don't, this function does nothing.
|
||||
*/
|
||||
void
|
||||
GL_Upload8_EXT (byte * data, int width, int height, qboolean mipmap,
|
||||
qboolean alpha)
|
||||
{
|
||||
#if defined(GL_SHARED_TEXTURE_PALETTE_EXT) && defined(HAVE_GL_COLOR_INDEX8_EXT)
|
||||
byte *scaled;
|
||||
int scaled_width, scaled_height;
|
||||
|
||||
// Snap the height and width to a power of 2.
|
||||
for (scaled_width = 1; scaled_width < width; scaled_width <<= 1);
|
||||
for (scaled_height = 1; scaled_height < height; scaled_height <<= 1);
|
||||
|
||||
scaled_width >>= gl_picmip->int_val;
|
||||
scaled_height >>= gl_picmip->int_val;
|
||||
|
||||
scaled_width = min (scaled_width, gl_max_size->int_val);
|
||||
scaled_height = min (scaled_height, gl_max_size->int_val);
|
||||
|
||||
if (!(scaled = malloc (scaled_width * scaled_height)))
|
||||
Sys_Error ("GL_LoadTexture: too big");
|
||||
|
||||
// If the real width/height and the 'scaled' width/height then we
|
||||
// rescale it.
|
||||
if (scaled_width == width && scaled_height == height) {
|
||||
memcpy (scaled, data, width * height);
|
||||
} else {
|
||||
GL_Resample8BitTexture (data, width, height, scaled, scaled_width,
|
||||
scaled_height);
|
||||
}
|
||||
glTexImage2D (GL_TEXTURE_2D, 0, GL_COLOR_INDEX8_EXT, scaled_width,
|
||||
scaled_height, 0, GL_COLOR_INDEX, GL_UNSIGNED_BYTE, scaled);
|
||||
|
||||
if (mipmap) {
|
||||
int miplevel;
|
||||
|
||||
miplevel = 0;
|
||||
while (scaled_width > 1 || scaled_height > 1) {
|
||||
GL_MipMap8Bit ((byte *) scaled, scaled_width, scaled_height);
|
||||
scaled_width >>= 1;
|
||||
scaled_height >>= 1;
|
||||
scaled_width = max (scaled_width, 1);
|
||||
scaled_height = max (scaled_height, 1);
|
||||
miplevel++;
|
||||
glTexImage2D (GL_TEXTURE_2D, miplevel, GL_COLOR_INDEX8_EXT,
|
||||
scaled_width, scaled_height, 0, GL_COLOR_INDEX,
|
||||
GL_UNSIGNED_BYTE, scaled);
|
||||
}
|
||||
}
|
||||
|
||||
if (mipmap) {
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_min);
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
} else {
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, gl_filter_max);
|
||||
if (gl_picmip->int_val)
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
else
|
||||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, gl_filter_max);
|
||||
}
|
||||
|
||||
free (scaled);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
extern qboolean VID_Is8bit (void);
|
||||
|
||||
void
|
||||
GL_Upload8 (byte * data, int width, int height, qboolean mipmap, qboolean alpha)
|
||||
{
|
||||
unsigned int *trans = NULL;
|
||||
int i, s, p;
|
||||
|
||||
s = width * height;
|
||||
trans = malloc (s * sizeof (unsigned int));
|
||||
|
||||
// if there are no transparent pixels, make it a 3 component
|
||||
// texture even if it was specified as otherwise
|
||||
if (alpha) {
|
||||
alpha = false;
|
||||
for (i = 0; i < s; i++) {
|
||||
p = data[i];
|
||||
if (p == 255)
|
||||
alpha = true;
|
||||
trans[i] = d_8to24table[p];
|
||||
}
|
||||
} else {
|
||||
if (s & 3)
|
||||
Sys_Error ("GL_Upload8: width*height divisible by 3");
|
||||
for (i = 0; i < s; i += 4) {
|
||||
trans[i] = d_8to24table[data[i]];
|
||||
trans[i + 1] = d_8to24table[data[i + 1]];
|
||||
trans[i + 2] = d_8to24table[data[i + 2]];
|
||||
trans[i + 3] = d_8to24table[data[i + 3]];
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(GL_SHARED_TEXTURE_PALETTE_EXT) && defined(HAVE_GL_COLOR_INDEX8_EXT)
|
||||
if (VID_Is8bit () && !alpha) {
|
||||
GL_Upload8_EXT (data, width, height, mipmap, alpha);
|
||||
} else {
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
GL_Upload32 (trans, width, height, mipmap, alpha);
|
||||
}
|
||||
|
||||
free (trans);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
GL_LoadTexture (char *identifier, int width, int height, byte * data,
|
||||
qboolean mipmap, qboolean alpha, int bytesperpixel)
|
||||
{
|
||||
gltexture_t *glt;
|
||||
int i, crc;
|
||||
|
||||
// LordHavoc: now just using a standard CRC for texture validation
|
||||
crc = CRC_Block (data, width * height * bytesperpixel);
|
||||
|
||||
// see if the texture is already present
|
||||
if (identifier[0]) {
|
||||
for (i = 0, glt = gltextures; i < numgltextures; i++, glt++) {
|
||||
if (strequal (identifier, glt->identifier)) {
|
||||
if (crc != glt->crc
|
||||
|| width != glt->width
|
||||
|| height != glt->height
|
||||
|| bytesperpixel != glt->bytesperpixel) goto SetupTexture;
|
||||
else
|
||||
return gltextures[i].texnum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (numgltextures == MAX_GLTEXTURES)
|
||||
Sys_Error ("numgltextures == MAX_GLTEXTURES");
|
||||
|
||||
glt = &gltextures[numgltextures];
|
||||
numgltextures++;
|
||||
|
||||
strncpy (glt->identifier, identifier, sizeof (glt->identifier) - 1);
|
||||
glt->identifier[sizeof (glt->identifier) - 1] = '\0';
|
||||
|
||||
glt->texnum = texture_extension_number;
|
||||
texture_extension_number++;
|
||||
|
||||
SetupTexture:
|
||||
glt->crc = crc;
|
||||
glt->width = width;
|
||||
glt->height = height;
|
||||
glt->bytesperpixel = bytesperpixel;
|
||||
glt->mipmap = mipmap;
|
||||
|
||||
glBindTexture (GL_TEXTURE_2D, glt->texnum);
|
||||
|
||||
switch (glt->bytesperpixel) {
|
||||
case 1:
|
||||
GL_Upload8 (data, width, height, mipmap, alpha);
|
||||
break;
|
||||
case 4:
|
||||
GL_Upload32 ((GLuint *) data, width, height, mipmap, alpha);
|
||||
break;
|
||||
default:
|
||||
Sys_Error ("SetupTexture: unknown bytesperpixel %i",
|
||||
glt->bytesperpixel);
|
||||
}
|
||||
|
||||
return glt->texnum;
|
||||
}
|
|
@ -29,14 +29,16 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#ifdef HAVE_STRINGS_H
|
||||
#include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/qtypes.h"
|
||||
#include "QF/compat.h"
|
||||
|
@ -66,6 +68,7 @@ msurface_t *warpface;
|
|||
|
||||
extern cvar_t *gl_subdivide_size;
|
||||
|
||||
|
||||
void
|
||||
BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
|
||||
{
|
||||
|
@ -84,6 +87,7 @@ BoundPoly (int numverts, float *verts, vec3_t mins, vec3_t maxs)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SubdividePolygon (int numverts, float *verts)
|
||||
{
|
||||
|
@ -167,6 +171,7 @@ SubdividePolygon (int numverts, float *verts)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
================
|
||||
GL_SubdivideSurface
|
||||
|
@ -207,8 +212,6 @@ GL_SubdivideSurface (msurface_t *fa)
|
|||
|
||||
//=========================================================
|
||||
|
||||
|
||||
|
||||
// speed up sin calculations - Ed
|
||||
float turbsin[] = {
|
||||
# include "gl_warp_sin.h"
|
||||
|
@ -216,6 +219,7 @@ float turbsin[] = {
|
|||
|
||||
#define TURBSCALE (256.0 / (2 * M_PI))
|
||||
|
||||
|
||||
/*
|
||||
=============
|
||||
EmitWaterPolys
|
||||
|
@ -258,7 +262,6 @@ EmitWaterPolys (msurface_t *fa)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================================================================
|
||||
|
||||
|
@ -692,6 +695,7 @@ R_DrawSkyDome (void)
|
|||
glDepthRange (gldepthmin, gldepthmax);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_DrawSky (void)
|
||||
{
|
||||
|
@ -701,8 +705,6 @@ R_DrawSky (void)
|
|||
R_DrawSkyDome ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
//===============================================================
|
||||
|
||||
/*
|
||||
|
@ -771,11 +773,7 @@ R_InitSky (texture_t *mt)
|
|||
glTexParameterf (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
}
|
||||
|
||||
/*
|
||||
=============
|
||||
EmitSkyPolys
|
||||
=============
|
||||
*/
|
||||
|
||||
void
|
||||
EmitSkyPolys (msurface_t *fa)
|
||||
{
|
||||
|
@ -809,11 +807,7 @@ EmitSkyPolys (msurface_t *fa)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
=================
|
||||
R_DrawSkyChain
|
||||
=================
|
||||
*/
|
||||
|
||||
void
|
||||
R_DrawSkyChain (msurface_t *s)
|
||||
{
|
||||
|
@ -838,6 +832,7 @@ R_DrawSkyChain (msurface_t *s)
|
|||
glDisable (GL_BLEND);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
EmitBothSkyLayers
|
||||
|
|
|
@ -30,8 +30,12 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/sys.h"
|
||||
|
|
|
@ -29,8 +29,12 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/msg.h"
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#ifdef HAVE_SYS_SOCKET_H
|
||||
|
@ -56,7 +62,6 @@
|
|||
# include <winsock.h>
|
||||
#endif
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef HAVE_UNISTD_H
|
||||
|
|
130
nq/source/noisetextures.c
Normal file
130
nq/source/noisetextures.c
Normal file
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
noisetextures.c
|
||||
|
||||
Noise texture generators
|
||||
|
||||
noise_plasma
|
||||
Copyright (C) 2001 Ragnvald `Despair` Maartmann-Moe IV.
|
||||
|
||||
noise_diamondsquare (originally fractalnoise)
|
||||
Copyright (C) 2000 Forest `LordHavoc` Hale.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "QF/mathlib.h"
|
||||
|
||||
void
|
||||
noise_diamondsquare (unsigned char *noise, int size)
|
||||
{
|
||||
int x, y, g, g2, amplitude, min, max, size1 = size - 1;
|
||||
int *noisebuf;
|
||||
|
||||
#define n(x,y) noisebuf[((y)&size1)*size+((x)&size1)]
|
||||
noisebuf = calloc (size * size, sizeof (int));
|
||||
|
||||
amplitude = 32767;
|
||||
g2 = size;
|
||||
n (0, 0) = 0;
|
||||
for (; (g = g2 >> 1) >= 1; g2 >>= 1) {
|
||||
// subdivide, diamond-square algorythm (really this has little
|
||||
// to do with squares)
|
||||
// diamond
|
||||
for (y = 0; y < size; y += g2)
|
||||
for (x = 0; x < size; x += g2)
|
||||
n (x + g, y + g) =
|
||||
(n (x, y) + n (x + g2, y) + n (x, y + g2) +
|
||||
n (x + g2, y + g2)) >> 2;
|
||||
// square
|
||||
for (y = 0; y < size; y += g2)
|
||||
for (x = 0; x < size; x += g2) {
|
||||
n (x + g, y) =
|
||||
(n (x, y) + n (x + g2, y) + n (x + g, y - g) +
|
||||
n (x + g, y + g)) >> 2;
|
||||
n (x, y + g) =
|
||||
(n (x, y) + n (x, y + g2) + n (x - g, y + g) +
|
||||
n (x + g, y + g)) >> 2;
|
||||
}
|
||||
// Brownian motion ( at every smaller level, random behavior )
|
||||
amplitude >>= 1;
|
||||
for (y = 0; y < size; y += g)
|
||||
for (x = 0; x < size; x += g)
|
||||
n (x, y) += (rand () & amplitude);
|
||||
}
|
||||
// find range of noise values
|
||||
min = max = 0;
|
||||
for (y = 0; y < size; y++)
|
||||
for (x = 0; x < size; x++) {
|
||||
if (n (x, y) < min)
|
||||
min = n (x, y);
|
||||
if (n (x, y) > max)
|
||||
max = n (x, y);
|
||||
}
|
||||
max -= min;
|
||||
// normalize noise and copy to output
|
||||
for (y = 0; y < size; y++)
|
||||
for (x = 0; x < size; x++)
|
||||
*noise++ = (n (x, y) - min) * 255 / max;
|
||||
free (noisebuf);
|
||||
#undef n
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
noise_plasma (unsigned char *noise, int size)
|
||||
{
|
||||
int a, b, c, d, i, j, k;
|
||||
|
||||
if (128 >= size)
|
||||
d = 64 / size;
|
||||
else
|
||||
d = -size / 64;
|
||||
|
||||
memset(noise, 128, sizeof (*noise));
|
||||
|
||||
for (i=size; i > 0; i/=2) {
|
||||
for (j=0; j < size; j+=i) {
|
||||
for (k=0; k < size; k+=i) {
|
||||
if (d>=0)
|
||||
c = i * d;
|
||||
else
|
||||
c = -i / d;
|
||||
|
||||
c=lhrandom(-c, c);
|
||||
|
||||
for (a=j; a < j+i; a++)
|
||||
for (b=k; b < k+i; b++)
|
||||
noise[a*size+b] += c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -29,8 +29,12 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include "QF/console.h"
|
||||
#include "QF/compat.h"
|
||||
|
|
|
@ -31,23 +31,20 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "r_local.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "server.h"
|
||||
#include "QF/msg.h"
|
||||
|
||||
#include "r_local.h"
|
||||
#include "server.h"
|
||||
|
||||
#define MAX_PARTICLES 2048 // default max # of particles at one
|
||||
// time
|
||||
#define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter
|
||||
// what's
|
||||
// on the command line
|
||||
|
||||
int ramp1[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 };
|
||||
int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 };
|
||||
int ramp3[8] = { 0x6d, 0x6b, 6, 5, 4, 3 };
|
||||
|
||||
particle_t *active_particles, *free_particles;
|
||||
|
||||
particle_t *particles;
|
||||
|
@ -55,13 +52,8 @@ int r_numparticles;
|
|||
|
||||
vec3_t r_pright, r_pup, r_ppn;
|
||||
|
||||
extern cvar_t *gl_particles;
|
||||
|
||||
/*
|
||||
===============
|
||||
R_InitParticles
|
||||
===============
|
||||
*/
|
||||
|
||||
void
|
||||
R_InitParticles (void)
|
||||
{
|
||||
|
@ -124,12 +116,6 @@ R_DarkFieldParticles (entity_t *ent)
|
|||
#endif
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_EntityParticles
|
||||
===============
|
||||
*/
|
||||
|
||||
#define NUMVERTEXNORMALS 162
|
||||
extern float r_avertexnormals[NUMVERTEXNORMALS][3];
|
||||
vec3_t avelocities[NUMVERTEXNORMALS];
|
||||
|
@ -197,74 +183,6 @@ R_EntityParticles (entity_t *ent)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_ClearParticles
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_ClearParticles (void)
|
||||
{
|
||||
int i;
|
||||
|
||||
free_particles = &particles[0];
|
||||
active_particles = NULL;
|
||||
|
||||
for (i = 0; i < r_numparticles; i++)
|
||||
particles[i].next = &particles[i + 1];
|
||||
particles[r_numparticles - 1].next = NULL;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_ReadPointFile_f (void)
|
||||
{
|
||||
QFile *f;
|
||||
vec3_t org;
|
||||
int r;
|
||||
int c;
|
||||
particle_t *p;
|
||||
char name[MAX_OSPATH];
|
||||
char buf[256];
|
||||
|
||||
snprintf (name, sizeof (name), "maps/%s.pts", sv.name);
|
||||
|
||||
COM_FOpenFile (name, &f);
|
||||
if (!f) {
|
||||
Con_Printf ("couldn't open %s\n", name);
|
||||
return;
|
||||
}
|
||||
|
||||
Con_Printf ("Reading %s...\n", name);
|
||||
c = 0;
|
||||
for (;;) {
|
||||
if (!Qgets (f, buf, sizeof (buf)))
|
||||
break;
|
||||
r = sscanf (buf, "%f %f %f\n", &org[0], &org[1], &org[2]);
|
||||
if (r != 3)
|
||||
break;
|
||||
c++;
|
||||
|
||||
if (!free_particles) {
|
||||
Con_Printf ("Not enough free particles\n");
|
||||
break;
|
||||
}
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = 99999;
|
||||
p->color = (-c) & 15;
|
||||
p->type = pt_static;
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
VectorCopy (org, p->org);
|
||||
}
|
||||
|
||||
Qclose (f);
|
||||
Con_Printf ("%i points read\n", c);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_ParseParticleEffect
|
||||
|
@ -290,356 +208,5 @@ R_ParseParticleEffect (void)
|
|||
else
|
||||
count = msgcount;
|
||||
|
||||
R_RunParticleEffect (org, dir, color, count);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_ParticleExplosion
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_ParticleExplosion (vec3_t org)
|
||||
{
|
||||
int i, j;
|
||||
particle_t *p;
|
||||
|
||||
for (i = 0; i < 1024; i++) {
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = cl.time + 5;
|
||||
p->color = ramp1[0];
|
||||
p->ramp = rand () & 3;
|
||||
if (i & 1) {
|
||||
p->type = pt_explode;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + ((rand () % 32) - 16);
|
||||
p->vel[j] = (rand () % 512) - 256;
|
||||
}
|
||||
} else {
|
||||
p->type = pt_explode2;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + ((rand () % 32) - 16);
|
||||
p->vel[j] = (rand () % 512) - 256;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_ParticleExplosion2
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
|
||||
{
|
||||
int i, j;
|
||||
particle_t *p;
|
||||
int colorMod = 0;
|
||||
|
||||
for (i = 0; i < 512; i++) {
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = cl.time + 0.3;
|
||||
p->color = colorStart + (colorMod % colorLength);
|
||||
colorMod++;
|
||||
|
||||
p->type = pt_blob;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + ((rand () % 32) - 16);
|
||||
p->vel[j] = (rand () % 512) - 256;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_BlobExplosion
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_BlobExplosion (vec3_t org)
|
||||
{
|
||||
int i, j;
|
||||
particle_t *p;
|
||||
|
||||
for (i = 0; i < 1024; i++) {
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = cl.time + 1 + (rand () & 8) * 0.05;
|
||||
|
||||
if (i & 1) {
|
||||
p->type = pt_blob;
|
||||
p->color = 66 + rand () % 6;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + ((rand () % 32) - 16);
|
||||
p->vel[j] = (rand () % 512) - 256;
|
||||
}
|
||||
} else {
|
||||
p->type = pt_blob2;
|
||||
p->color = 150 + rand () % 6;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + ((rand () % 32) - 16);
|
||||
p->vel[j] = (rand () % 512) - 256;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_RunParticleEffect
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
|
||||
{
|
||||
int i, j;
|
||||
particle_t *p;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
if (count == 1024) { // rocket explosion
|
||||
p->die = cl.time + 5;
|
||||
p->color = ramp1[0];
|
||||
p->ramp = rand () & 3;
|
||||
if (i & 1) {
|
||||
p->type = pt_explode;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + ((rand () % 32) - 16);
|
||||
p->vel[j] = (rand () % 512) - 256;
|
||||
}
|
||||
} else {
|
||||
p->type = pt_explode2;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + ((rand () % 32) - 16);
|
||||
p->vel[j] = (rand () % 512) - 256;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
p->die = cl.time + 0.1 * (rand () % 5);
|
||||
p->color = (color & ~7) + (rand () & 7);
|
||||
p->type = pt_slowgrav;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + ((rand () & 15) - 8);
|
||||
p->vel[j] = dir[j] * 15; // + (rand()%300)-150;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_LavaSplash
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_LavaSplash (vec3_t org)
|
||||
{
|
||||
int i, j, k;
|
||||
particle_t *p;
|
||||
float vel;
|
||||
vec3_t dir;
|
||||
|
||||
for (i = -16; i < 16; i++)
|
||||
for (j = -16; j < 16; j++)
|
||||
for (k = 0; k < 1; k++) {
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = cl.time + 2 + (rand () & 31) * 0.02;
|
||||
p->color = 224 + (rand () & 7);
|
||||
p->type = pt_slowgrav;
|
||||
|
||||
dir[0] = j * 8 + (rand () & 7);
|
||||
dir[1] = i * 8 + (rand () & 7);
|
||||
dir[2] = 256;
|
||||
|
||||
p->org[0] = org[0] + dir[0];
|
||||
p->org[1] = org[1] + dir[1];
|
||||
p->org[2] = org[2] + (rand () & 63);
|
||||
|
||||
VectorNormalize (dir);
|
||||
vel = 50 + (rand () & 63);
|
||||
VectorScale (dir, vel, p->vel);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_TeleportSplash
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_TeleportSplash (vec3_t org)
|
||||
{
|
||||
int i, j, k;
|
||||
particle_t *p;
|
||||
float vel;
|
||||
vec3_t dir;
|
||||
|
||||
for (i = -16; i < 16; i += 4)
|
||||
for (j = -16; j < 16; j += 4)
|
||||
for (k = -24; k < 32; k += 4) {
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = cl.time + 0.2 + (rand () & 7) * 0.02;
|
||||
p->color = 7 + (rand () & 7);
|
||||
p->type = pt_slowgrav;
|
||||
|
||||
dir[0] = j * 8;
|
||||
dir[1] = i * 8;
|
||||
dir[2] = k * 8;
|
||||
|
||||
p->org[0] = org[0] + i + (rand () & 3);
|
||||
p->org[1] = org[1] + j + (rand () & 3);
|
||||
p->org[2] = org[2] + k + (rand () & 3);
|
||||
|
||||
VectorNormalize (dir);
|
||||
vel = 50 + (rand () & 63);
|
||||
VectorScale (dir, vel, p->vel);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
|
||||
{
|
||||
vec3_t vec;
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
int dec;
|
||||
static int tracercount;
|
||||
|
||||
if (type == 0)
|
||||
R_AddFire (start, end, ent);
|
||||
|
||||
if (!gl_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (end, start, vec);
|
||||
len = VectorNormalize (vec);
|
||||
if (type < 128)
|
||||
dec = 3;
|
||||
else {
|
||||
dec = 1;
|
||||
type -= 128;
|
||||
}
|
||||
|
||||
while (len > 0) {
|
||||
len -= dec;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
VectorCopy (vec3_origin, p->vel);
|
||||
p->die = cl.time + 2;
|
||||
|
||||
switch (type) {
|
||||
case 0: // rocket trail
|
||||
p->ramp = (rand () & 3);
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = start[j] + ((rand () % 6) - 3);
|
||||
break;
|
||||
|
||||
case 1: // smoke smoke
|
||||
p->ramp = (rand () & 3) + 2;
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = start[j] + ((rand () % 6) - 3);
|
||||
break;
|
||||
|
||||
case 2: // blood
|
||||
p->type = pt_grav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = start[j] + ((rand () % 6) - 3);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
case 5: // tracer
|
||||
p->die = cl.time + 0.5;
|
||||
p->type = pt_static;
|
||||
if (type == 3)
|
||||
p->color = 52 + ((tracercount & 4) << 1);
|
||||
else
|
||||
p->color = 230 + ((tracercount & 4) << 1);
|
||||
|
||||
tracercount++;
|
||||
|
||||
VectorCopy (start, p->org);
|
||||
if (tracercount & 1) {
|
||||
p->vel[0] = 30 * vec[1];
|
||||
p->vel[1] = 30 * -vec[0];
|
||||
} else {
|
||||
p->vel[0] = 30 * -vec[1];
|
||||
p->vel[1] = 30 * vec[0];
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // slight blood
|
||||
p->type = pt_grav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = start[j] + ((rand () % 6) - 3);
|
||||
len -= 3;
|
||||
break;
|
||||
|
||||
case 6: // voor trail
|
||||
p->color = 9 * 16 + 8 + (rand () & 3);
|
||||
p->type = pt_static;
|
||||
p->die = cl.time + 0.3;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = start[j] + ((rand () & 15) - 8);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
VectorAdd (start, vec, start);
|
||||
}
|
||||
R_RunParticleEffect (org, color, count);
|
||||
}
|
||||
|
|
|
@ -31,15 +31,16 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "QF/compat.h"
|
||||
#include "sbar.h"
|
||||
#include "game.h"
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/compat.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/vid.h"
|
||||
#include "QF/va.h"
|
||||
#include "draw.h"
|
||||
#include "QF/wad.h"
|
||||
#include "QF/screen.h"
|
||||
|
||||
#include "sbar.h"
|
||||
#include "game.h"
|
||||
#include "draw.h"
|
||||
#include "client.h"
|
||||
#include "server.h"
|
||||
|
||||
|
@ -213,10 +214,10 @@ void
|
|||
Sbar_DrawTransPic (int x, int y, qpic_t *pic)
|
||||
{
|
||||
if (sbar_centered)
|
||||
Draw_TransPic (x + ((vid.width - 320) >> 1),
|
||||
Draw_Pic (x + ((vid.width - 320) >> 1),
|
||||
y + (vid.height - SBAR_HEIGHT), pic);
|
||||
else
|
||||
Draw_TransPic (x, y + (vid.height - SBAR_HEIGHT), pic);
|
||||
Draw_Pic (x, y + (vid.height - SBAR_HEIGHT), pic);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -981,7 +982,7 @@ Sbar_IntermissionNumber (int x, int y, int num, int digits, int color)
|
|||
else
|
||||
frame = *ptr - '0';
|
||||
|
||||
Draw_TransPic (x, y, sb_nums[color][frame]);
|
||||
Draw_Pic (x, y, sb_nums[color][frame]);
|
||||
x += 24;
|
||||
ptr++;
|
||||
}
|
||||
|
@ -1006,7 +1007,7 @@ Sbar_DeathmatchOverlay (void)
|
|||
scr_copyeverything = 1;
|
||||
scr_fullupdate = 0;
|
||||
|
||||
pic = Draw_CachePic ("gfx/ranking.lmp");
|
||||
pic = Draw_CachePic ("gfx/ranking.lmp", true);
|
||||
Draw_Pic (160 - pic->width / 2, 0, pic);
|
||||
|
||||
// scores
|
||||
|
@ -1152,26 +1153,26 @@ Sbar_IntermissionOverlay (void)
|
|||
return;
|
||||
}
|
||||
|
||||
pic = Draw_CachePic ("gfx/complete.lmp");
|
||||
pic = Draw_CachePic ("gfx/complete.lmp", true);
|
||||
Draw_Pic (64, 24, pic);
|
||||
|
||||
pic = Draw_CachePic ("gfx/inter.lmp");
|
||||
Draw_TransPic (0, 56, pic);
|
||||
pic = Draw_CachePic ("gfx/inter.lmp", true);
|
||||
Draw_Pic (0, 56, pic);
|
||||
|
||||
// time
|
||||
dig = cl.completed_time / 60;
|
||||
Sbar_IntermissionNumber (160, 64, dig, 3, 0);
|
||||
num = cl.completed_time - dig * 60;
|
||||
Draw_TransPic (234, 64, sb_colon);
|
||||
Draw_TransPic (246, 64, sb_nums[0][num / 10]);
|
||||
Draw_TransPic (266, 64, sb_nums[0][num % 10]);
|
||||
Draw_Pic (234, 64, sb_colon);
|
||||
Draw_Pic (246, 64, sb_nums[0][num / 10]);
|
||||
Draw_Pic (266, 64, sb_nums[0][num % 10]);
|
||||
|
||||
Sbar_IntermissionNumber (160, 104, cl.stats[STAT_SECRETS], 3, 0);
|
||||
Draw_TransPic (232, 104, sb_slash);
|
||||
Draw_Pic (232, 104, sb_slash);
|
||||
Sbar_IntermissionNumber (240, 104, cl.stats[STAT_TOTALSECRETS], 3, 0);
|
||||
|
||||
Sbar_IntermissionNumber (160, 144, cl.stats[STAT_MONSTERS], 3, 0);
|
||||
Draw_TransPic (232, 144, sb_slash);
|
||||
Draw_Pic (232, 144, sb_slash);
|
||||
Sbar_IntermissionNumber (240, 144, cl.stats[STAT_TOTALMONSTERS], 3, 0);
|
||||
}
|
||||
|
||||
|
@ -1189,8 +1190,8 @@ Sbar_FinaleOverlay (void)
|
|||
|
||||
scr_copyeverything = 1;
|
||||
|
||||
pic = Draw_CachePic ("gfx/finale.lmp");
|
||||
Draw_TransPic ((vid.width - pic->width) / 2, 16, pic);
|
||||
pic = Draw_CachePic ("gfx/finale.lmp", true);
|
||||
Draw_Pic ((vid.width - pic->width) / 2, 16, pic);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
screen.c
|
||||
|
||||
@description@
|
||||
master for refresh, status bar, console, chat, notify, etc
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -31,19 +31,21 @@
|
|||
#endif
|
||||
|
||||
#include <time.h>
|
||||
#include "r_local.h"
|
||||
|
||||
#include "QF/cmd.h"
|
||||
#include "QF/compat.h"
|
||||
#include "QF/screen.h"
|
||||
#include "sbar.h"
|
||||
#include "QF/input.h"
|
||||
#include "view.h"
|
||||
#include "host.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/qendian.h"
|
||||
#include "QF/input.h"
|
||||
#include "QF/keys.h"
|
||||
#include "QF/screen.h"
|
||||
#include "QF/sys.h"
|
||||
#include "QF/qendian.h"
|
||||
|
||||
#include "draw.h"
|
||||
#include "host.h"
|
||||
#include "r_local.h"
|
||||
#include "sbar.h"
|
||||
#include "view.h"
|
||||
|
||||
// only the refresh window will be updated unless these variables are flagged
|
||||
int scr_copytop;
|
||||
|
@ -90,6 +92,7 @@ qboolean block_drawing;
|
|||
|
||||
void SCR_ScreenShot_f (void);
|
||||
|
||||
|
||||
void
|
||||
SCR_Init_Cvars (void)
|
||||
{
|
||||
|
@ -110,6 +113,7 @@ int scr_center_lines;
|
|||
int scr_erase_lines;
|
||||
int scr_erase_center;
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_CenterPrint
|
||||
|
@ -134,6 +138,7 @@ SCR_CenterPrint (char *str)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SCR_EraseCenterString (void)
|
||||
{
|
||||
|
@ -153,6 +158,7 @@ SCR_EraseCenterString (void)
|
|||
Draw_TileClear (0, y, vid.width, 8 * scr_erase_lines);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SCR_DrawCenterString (void)
|
||||
{
|
||||
|
@ -199,6 +205,7 @@ SCR_DrawCenterString (void)
|
|||
} while (1);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SCR_CheckDrawCenterString (void)
|
||||
{
|
||||
|
@ -218,6 +225,7 @@ SCR_CheckDrawCenterString (void)
|
|||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
/*
|
||||
====================
|
||||
CalcFov
|
||||
|
@ -241,6 +249,7 @@ CalcFov (float fov_x, float width, float height)
|
|||
return a;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
=================
|
||||
SCR_CalcRefdef
|
||||
|
@ -342,6 +351,7 @@ SCR_SizeDown_f (void)
|
|||
|
||||
//============================================================================
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_Init
|
||||
|
@ -374,7 +384,6 @@ SCR_Init (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawRam
|
||||
|
@ -392,6 +401,7 @@ SCR_DrawRam (void)
|
|||
Draw_Pic (scr_vrect.x + 32, scr_vrect.y, scr_ram);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawTurtle
|
||||
|
@ -417,6 +427,7 @@ SCR_DrawTurtle (void)
|
|||
Draw_Pic (scr_vrect.x, scr_vrect.y, scr_turtle);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawNet
|
||||
|
@ -433,6 +444,7 @@ SCR_DrawNet (void)
|
|||
Draw_Pic (scr_vrect.x + 64, scr_vrect.y, scr_net);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SCR_DrawFPS (void)
|
||||
{
|
||||
|
@ -462,6 +474,7 @@ SCR_DrawFPS (void)
|
|||
Draw_String8 (x, y, st);
|
||||
}
|
||||
|
||||
|
||||
/* Misty: I like to see the time */
|
||||
void
|
||||
SCR_DrawTime (void)
|
||||
|
@ -497,6 +510,7 @@ SCR_DrawTime (void)
|
|||
Draw_String8 (x, y, st);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
DrawPause
|
||||
|
@ -513,13 +527,12 @@ SCR_DrawPause (void)
|
|||
if (!cl.paused)
|
||||
return;
|
||||
|
||||
pic = Draw_CachePic ("gfx/pause.lmp");
|
||||
pic = Draw_CachePic ("gfx/pause.lmp", true);
|
||||
Draw_Pic ((vid.width - pic->width) / 2,
|
||||
(vid.height - 48 - pic->height) / 2, pic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==============
|
||||
SCR_DrawLoading
|
||||
|
@ -533,21 +546,14 @@ SCR_DrawLoading (void)
|
|||
if (!scr_drawloading)
|
||||
return;
|
||||
|
||||
pic = Draw_CachePic ("gfx/loading.lmp");
|
||||
pic = Draw_CachePic ("gfx/loading.lmp", true);
|
||||
Draw_Pic ((vid.width - pic->width) / 2,
|
||||
(vid.height - 48 - pic->height) / 2, pic);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_SetUpToDrawConsole
|
||||
==================
|
||||
*/
|
||||
void
|
||||
SCR_SetUpToDrawConsole (void)
|
||||
{
|
||||
|
@ -589,11 +595,7 @@ SCR_SetUpToDrawConsole (void)
|
|||
con_notifylines = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_DrawConsole
|
||||
==================
|
||||
*/
|
||||
|
||||
void
|
||||
SCR_DrawConsole (void)
|
||||
{
|
||||
|
@ -607,7 +609,6 @@ SCR_DrawConsole (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==============================================================================
|
||||
|
||||
|
@ -633,11 +634,7 @@ typedef struct {
|
|||
unsigned char data; // unbounded
|
||||
} pcx_t;
|
||||
|
||||
/*
|
||||
==============
|
||||
WritePCXfile
|
||||
==============
|
||||
*/
|
||||
|
||||
void
|
||||
WritePCXfile (char *filename, byte * data, int width, int height,
|
||||
int rowbytes, byte * palette)
|
||||
|
@ -695,12 +692,6 @@ WritePCXfile (char *filename, byte * data, int width, int height,
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_ScreenShot_f
|
||||
==================
|
||||
*/
|
||||
void
|
||||
SCR_ScreenShot_f (void)
|
||||
{
|
||||
|
@ -742,16 +733,9 @@ SCR_ScreenShot_f (void)
|
|||
Con_Printf ("Wrote %s\n", pcxname);
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
SCR_BeginLoadingPlaque
|
||||
|
||||
================
|
||||
*/
|
||||
void
|
||||
SCR_BeginLoadingPlaque (void)
|
||||
{
|
||||
|
@ -778,12 +762,7 @@ SCR_BeginLoadingPlaque (void)
|
|||
scr_fullupdate = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
SCR_EndLoadingPlaque
|
||||
|
||||
================
|
||||
*/
|
||||
void
|
||||
SCR_EndLoadingPlaque (void)
|
||||
{
|
||||
|
@ -797,6 +776,7 @@ SCR_EndLoadingPlaque (void)
|
|||
char *scr_notifystring;
|
||||
qboolean scr_drawdialog;
|
||||
|
||||
|
||||
void
|
||||
SCR_DrawNotifyString (void)
|
||||
{
|
||||
|
@ -829,6 +809,7 @@ SCR_DrawNotifyString (void)
|
|||
} while (1);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_ModalMessage
|
||||
|
@ -865,9 +846,9 @@ SCR_ModalMessage (char *text)
|
|||
return key_lastpress == 'y';
|
||||
}
|
||||
|
||||
|
||||
//=============================================================================
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
SCR_BringDownConsole
|
||||
|
@ -1055,11 +1036,6 @@ SCR_UpdateScreen (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
==================
|
||||
SCR_UpdateWholeScreen
|
||||
==================
|
||||
*/
|
||||
void
|
||||
SCR_UpdateWholeScreen (void)
|
||||
{
|
||||
|
|
|
@ -1,161 +0,0 @@
|
|||
|
||||
/*
|
||||
r_part.c
|
||||
|
||||
@description@
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
$Id$
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "r_shared.h"
|
||||
#include "r_local.h"
|
||||
#include "client.h"
|
||||
#include "server.h"
|
||||
|
||||
/*
|
||||
===============
|
||||
R_DrawParticles
|
||||
===============
|
||||
*/
|
||||
|
||||
void
|
||||
R_DrawParticles (void)
|
||||
{
|
||||
particle_t *p, *kill;
|
||||
float grav;
|
||||
int i;
|
||||
float time2, time3;
|
||||
float time1;
|
||||
float dvel;
|
||||
float frametime;
|
||||
|
||||
D_StartParticles ();
|
||||
|
||||
VectorScale (vright, xscaleshrink, r_pright);
|
||||
VectorScale (vup, yscaleshrink, r_pup);
|
||||
VectorCopy (vpn, r_ppn);
|
||||
|
||||
frametime = cl.time - cl.oldtime;
|
||||
time3 = frametime * 15;
|
||||
time2 = frametime * 10; // 15;
|
||||
time1 = frametime * 5;
|
||||
grav = frametime * sv_gravity->value * 0.05;
|
||||
dvel = 4 * frametime;
|
||||
|
||||
for (;;) {
|
||||
kill = active_particles;
|
||||
if (kill && kill->die < cl.time) {
|
||||
active_particles = kill->next;
|
||||
kill->next = free_particles;
|
||||
free_particles = kill;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
for (p = active_particles; p; p = p->next) {
|
||||
for (;;) {
|
||||
kill = p->next;
|
||||
if (kill && kill->die < cl.time) {
|
||||
p->next = kill->next;
|
||||
kill->next = free_particles;
|
||||
free_particles = kill;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
D_DrawParticle (p);
|
||||
|
||||
p->org[0] += p->vel[0] * frametime;
|
||||
p->org[1] += p->vel[1] * frametime;
|
||||
p->org[2] += p->vel[2] * frametime;
|
||||
|
||||
switch (p->type) {
|
||||
case pt_static:
|
||||
break;
|
||||
case pt_fire:
|
||||
p->ramp += time1;
|
||||
if (p->ramp >= 6)
|
||||
p->die = -1;
|
||||
else
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->vel[2] += grav;
|
||||
break;
|
||||
|
||||
case pt_explode:
|
||||
p->ramp += time2;
|
||||
if (p->ramp >= 8)
|
||||
p->die = -1;
|
||||
else
|
||||
p->color = ramp1[(int) p->ramp];
|
||||
for (i = 0; i < 3; i++)
|
||||
p->vel[i] += p->vel[i] * dvel;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_explode2:
|
||||
p->ramp += time3;
|
||||
if (p->ramp >= 8)
|
||||
p->die = -1;
|
||||
else
|
||||
p->color = ramp2[(int) p->ramp];
|
||||
for (i = 0; i < 3; i++)
|
||||
p->vel[i] -= p->vel[i] * frametime;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_blob:
|
||||
for (i = 0; i < 3; i++)
|
||||
p->vel[i] += p->vel[i] * dvel;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_blob2:
|
||||
for (i = 0; i < 2; i++)
|
||||
p->vel[i] -= p->vel[i] * dvel;
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
|
||||
case pt_grav:
|
||||
#ifdef QUAKE2
|
||||
p->vel[2] -= grav * 20;
|
||||
break;
|
||||
#endif
|
||||
case pt_slowgrav:
|
||||
p->vel[2] -= grav;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
D_EndParticles ();
|
||||
}
|
||||
|
||||
void
|
||||
R_AddFire (vec3_t start, vec3_t end, entity_t *ent)
|
||||
{
|
||||
}
|
|
@ -136,7 +136,7 @@ float se_time1, se_time2, de_time1, de_time2, dv_time1, dv_time2;
|
|||
|
||||
void R_MarkLeaves (void);
|
||||
|
||||
cvar_t *gl_particles;
|
||||
cvar_t *r_particles;
|
||||
cvar_t *r_draworder;
|
||||
cvar_t *r_speeds;
|
||||
cvar_t *r_timegraph;
|
||||
|
@ -215,8 +215,8 @@ R_Init (void)
|
|||
Cmd_AddCommand ("timerefresh", R_TimeRefresh_f, "No Description");
|
||||
Cmd_AddCommand ("pointfile", R_ReadPointFile_f, "No Description");
|
||||
|
||||
gl_particles = Cvar_Get ("gl_particles", "1", CVAR_ARCHIVE | CVAR_ROM,
|
||||
NULL, "whether or not to draw particles");
|
||||
r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, NULL,
|
||||
"whether or not to draw particles");
|
||||
|
||||
r_draworder = Cvar_Get ("r_draworder", "0", CVAR_NONE, NULL, "None");
|
||||
r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, NULL, "None");
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
/*
|
||||
r_part.c
|
||||
sw_rpart.c
|
||||
|
||||
@description@
|
||||
(description)
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
@ -31,17 +30,15 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "r_local.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/console.h"
|
||||
#include "server.h"
|
||||
#include "QF/msg.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
#define MAX_PARTICLES 2048 // default max # of particles at one
|
||||
// time
|
||||
#define ABSOLUTE_MIN_PARTICLES 512 // no fewer than this no matter
|
||||
// what's
|
||||
// on the command line
|
||||
#include "QF/compat.h"
|
||||
#include "QF/console.h"
|
||||
#include "QF/qargs.h"
|
||||
#include "QF/quakefs.h"
|
||||
|
||||
#include "host.h"
|
||||
#include "r_local.h"
|
||||
|
||||
int ramp1[8] = { 0x6f, 0x6d, 0x6b, 0x69, 0x67, 0x65, 0x63, 0x61 };
|
||||
int ramp2[8] = { 0x6f, 0x6e, 0x6d, 0x6c, 0x6b, 0x6a, 0x68, 0x66 };
|
||||
|
@ -53,154 +50,42 @@ particle_t *particles;
|
|||
int r_numparticles;
|
||||
|
||||
vec3_t r_pright, r_pup, r_ppn;
|
||||
|
||||
extern cvar_t *gl_particles;
|
||||
cvar_t *r_particles;
|
||||
|
||||
/*
|
||||
===============
|
||||
R_InitParticles
|
||||
===============
|
||||
R_MaxParticlesCheck
|
||||
Misty-chan: EXTREME heavy lifting and bugfixing thanks goes out to taniwha - I built this, and he got it working :)
|
||||
*/
|
||||
void
|
||||
R_InitParticles (void)
|
||||
R_MaxParticlesCheck (cvar_t *var)
|
||||
{
|
||||
int i;
|
||||
|
||||
i = COM_CheckParm ("-particles");
|
||||
|
||||
if (i) {
|
||||
r_numparticles = (int) (atoi (com_argv[i + 1]));
|
||||
if (r_numparticles < ABSOLUTE_MIN_PARTICLES)
|
||||
r_numparticles = ABSOLUTE_MIN_PARTICLES;
|
||||
} else {
|
||||
r_numparticles = MAX_PARTICLES;
|
||||
}
|
||||
|
||||
particles = (particle_t *)
|
||||
Hunk_AllocName (r_numparticles * sizeof (particle_t), "particles");
|
||||
}
|
||||
|
||||
#ifdef QUAKE2
|
||||
void
|
||||
R_DarkFieldParticles (entity_t *ent)
|
||||
{
|
||||
int i, j, k;
|
||||
particle_t *p;
|
||||
float vel;
|
||||
vec3_t dir;
|
||||
vec3_t org;
|
||||
|
||||
org[0] = ent->origin[0];
|
||||
org[1] = ent->origin[1];
|
||||
org[2] = ent->origin[2];
|
||||
for (i = -16; i < 16; i += 8)
|
||||
for (j = -16; j < 16; j += 8)
|
||||
for (k = 0; k < 32; k += 8) {
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = cl.time + 0.2 + (rand () & 7) * 0.02;
|
||||
p->color = 150 + rand () % 6;
|
||||
p->type = pt_slowgrav;
|
||||
|
||||
dir[0] = j * 8;
|
||||
dir[1] = i * 8;
|
||||
dir[2] = k * 8;
|
||||
|
||||
p->org[0] = org[0] + i + (rand () & 3);
|
||||
p->org[1] = org[1] + j + (rand () & 3);
|
||||
p->org[2] = org[2] + k + (rand () & 3);
|
||||
|
||||
VectorNormalize (dir);
|
||||
vel = 50 + (rand () & 63);
|
||||
VectorScale (dir, vel, p->vel);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_EntityParticles
|
||||
===============
|
||||
*/
|
||||
|
||||
#define NUMVERTEXNORMALS 162
|
||||
extern float r_avertexnormals[NUMVERTEXNORMALS][3];
|
||||
vec3_t avelocities[NUMVERTEXNORMALS];
|
||||
float beamlength = 16;
|
||||
vec3_t avelocity = { 23, 7, 3 };
|
||||
float partstep = 0.01;
|
||||
float timescale = 0.01;
|
||||
|
||||
void
|
||||
R_EntityParticles (entity_t *ent)
|
||||
{
|
||||
int count;
|
||||
int i;
|
||||
particle_t *p;
|
||||
float angle;
|
||||
float sr, sp, sy, cr, cp, cy;
|
||||
vec3_t forward;
|
||||
float dist;
|
||||
|
||||
dist = 64;
|
||||
count = 50;
|
||||
|
||||
if (!avelocities[0][0]) {
|
||||
for (i = 0; i < NUMVERTEXNORMALS * 3; i++)
|
||||
avelocities[0][i] = (rand () & 255) * 0.01;
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < NUMVERTEXNORMALS; i++) {
|
||||
angle = cl.time * avelocities[i][0];
|
||||
sy = sin (angle);
|
||||
cy = cos (angle);
|
||||
angle = cl.time * avelocities[i][1];
|
||||
sp = sin (angle);
|
||||
cp = cos (angle);
|
||||
angle = cl.time * avelocities[i][2];
|
||||
sr = sin (angle);
|
||||
cr = cos (angle);
|
||||
|
||||
forward[0] = cp * cy;
|
||||
forward[1] = cp * sy;
|
||||
forward[2] = -sp;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
free_particles = p->next;
|
||||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
p->die = cl.time + 0.01;
|
||||
p->color = 0x6f;
|
||||
p->type = pt_explode;
|
||||
|
||||
p->org[0] =
|
||||
ent->origin[0] + r_avertexnormals[i][0] * dist +
|
||||
forward[0] * beamlength;
|
||||
p->org[1] =
|
||||
ent->origin[1] + r_avertexnormals[i][1] * dist +
|
||||
forward[1] * beamlength;
|
||||
p->org[2] =
|
||||
ent->origin[2] + r_avertexnormals[i][2] * dist +
|
||||
forward[2] * beamlength;
|
||||
}
|
||||
// Do not use 0 in this! sw doesn't grok 0 and it's going to segfault if we do!
|
||||
r_numparticles = max(var->int_val, 1);
|
||||
|
||||
/*
|
||||
Debugging code. will print what the above was set to, and is also useful
|
||||
for checking if this is accidentally being run all the time.
|
||||
Con_Printf ("%d", r_numparticles);
|
||||
*/
|
||||
|
||||
if (particles)
|
||||
free (particles);
|
||||
|
||||
particles = (particle_t *) calloc (r_numparticles, sizeof (particle_t));
|
||||
|
||||
R_ClearParticles ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_Particles_Init_Cvars (void)
|
||||
{
|
||||
// Does a callback to R_MaxParticleCheck when the cvar changes. Neat trick.
|
||||
Cvar_Get ("cl_max_particles", "2048", CVAR_ARCHIVE, R_MaxParticlesCheck,
|
||||
"Maximum amount of particles to display. No maximum, minimum is 1.");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_ClearParticles
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_ClearParticles (void)
|
||||
{
|
||||
|
@ -224,9 +109,8 @@ R_ReadPointFile_f (void)
|
|||
int c;
|
||||
particle_t *p;
|
||||
char name[MAX_OSPATH];
|
||||
char buf[256];
|
||||
|
||||
snprintf (name, sizeof (name), "maps/%s.pts", sv.name);
|
||||
// FIXME snprintf (name, sizeof (name), "maps/%s.pts", sv.name);
|
||||
|
||||
COM_FOpenFile (name, &f);
|
||||
if (!f) {
|
||||
|
@ -237,8 +121,9 @@ R_ReadPointFile_f (void)
|
|||
Con_Printf ("Reading %s...\n", name);
|
||||
c = 0;
|
||||
for (;;) {
|
||||
if (!Qgets (f, buf, sizeof (buf)))
|
||||
break;
|
||||
char buf[64];
|
||||
|
||||
Qgets (f, buf, sizeof (buf));
|
||||
r = sscanf (buf, "%f %f %f\n", &org[0], &org[1], &org[2]);
|
||||
if (r != 3)
|
||||
break;
|
||||
|
@ -264,46 +149,50 @@ R_ReadPointFile_f (void)
|
|||
Con_Printf ("%i points read\n", c);
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_ParseParticleEffect
|
||||
|
||||
Parse an effect out of the server message
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_ParseParticleEffect (void)
|
||||
R_RunSpikeEffect (vec3_t pos, byte type)
|
||||
{
|
||||
vec3_t org, dir;
|
||||
int i, count, msgcount, color;
|
||||
|
||||
for (i = 0; i < 3; i++)
|
||||
org[i] = MSG_ReadCoord (net_message);
|
||||
for (i = 0; i < 3; i++)
|
||||
dir[i] = MSG_ReadChar (net_message) * (1.0 / 16);
|
||||
msgcount = MSG_ReadByte (net_message);
|
||||
color = MSG_ReadByte (net_message);
|
||||
|
||||
if (msgcount == 255)
|
||||
count = 1024;
|
||||
else
|
||||
count = msgcount;
|
||||
|
||||
R_RunParticleEffect (org, dir, color, count);
|
||||
switch (type) {
|
||||
case TE_WIZSPIKE:
|
||||
R_RunParticleEffect (pos, 20, 30);
|
||||
break;
|
||||
case TE_KNIGHTSPIKE:
|
||||
R_RunParticleEffect (pos, 226, 20);
|
||||
break;
|
||||
case TE_SPIKE:
|
||||
R_RunParticleEffect (pos, 0, 10);
|
||||
break;
|
||||
case TE_SUPERSPIKE:
|
||||
R_RunParticleEffect (pos, 0, 20);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_RunPuffEffect (vec3_t pos, byte type, byte cnt)
|
||||
{
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
switch (type) {
|
||||
case TE_GUNSHOT:
|
||||
R_RunParticleEffect (pos, 0, 20 * cnt);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_ParticleExplosion
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_ParticleExplosion (vec3_t org)
|
||||
{
|
||||
int i, j;
|
||||
particle_t *p;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 1024; i++) {
|
||||
if (!free_particles)
|
||||
return;
|
||||
|
@ -331,20 +220,16 @@ R_ParticleExplosion (vec3_t org)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_ParticleExplosion2
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
|
||||
{
|
||||
int i, j;
|
||||
particle_t *p;
|
||||
int colorMod = 0;
|
||||
int i, j;
|
||||
particle_t *p;
|
||||
int colorMod = 0;
|
||||
|
||||
for (i = 0; i < 512; i++) {
|
||||
for (i=0; i<512; i++)
|
||||
{
|
||||
if (!free_particles)
|
||||
return;
|
||||
p = free_particles;
|
||||
|
@ -357,25 +242,24 @@ R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength)
|
|||
colorMod++;
|
||||
|
||||
p->type = pt_blob;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + ((rand () % 32) - 16);
|
||||
p->vel[j] = (rand () % 512) - 256;
|
||||
for (j=0 ; j<3 ; j++)
|
||||
{
|
||||
p->org[j] = org[j] + ((rand()%32)-16);
|
||||
p->vel[j] = (rand()%512)-256;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_BlobExplosion
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_BlobExplosion (vec3_t org)
|
||||
{
|
||||
int i, j;
|
||||
particle_t *p;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
for (i = 0; i < 1024; i++) {
|
||||
if (!free_particles)
|
||||
return;
|
||||
|
@ -404,17 +288,23 @@ R_BlobExplosion (vec3_t org)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_RunParticleEffect
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
|
||||
R_RunParticleEffect (vec3_t org, int color, int count)
|
||||
{
|
||||
int i, j;
|
||||
particle_t *p;
|
||||
int scale;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
if (count > 130)
|
||||
scale = 3;
|
||||
else if (count > 20)
|
||||
scale = 2;
|
||||
else
|
||||
scale = 1;
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
if (!free_particles)
|
||||
|
@ -424,42 +314,17 @@ R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count)
|
|||
p->next = active_particles;
|
||||
active_particles = p;
|
||||
|
||||
if (count == 1024) { // rocket explosion
|
||||
p->die = cl.time + 5;
|
||||
p->color = ramp1[0];
|
||||
p->ramp = rand () & 3;
|
||||
if (i & 1) {
|
||||
p->type = pt_explode;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + ((rand () % 32) - 16);
|
||||
p->vel[j] = (rand () % 512) - 256;
|
||||
}
|
||||
} else {
|
||||
p->type = pt_explode2;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + ((rand () % 32) - 16);
|
||||
p->vel[j] = (rand () % 512) - 256;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
p->die = cl.time + 0.1 * (rand () % 5);
|
||||
p->color = (color & ~7) + (rand () & 7);
|
||||
p->type = pt_slowgrav;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + ((rand () & 15) - 8);
|
||||
p->vel[j] = dir[j] * 15; // + (rand()%300)-150;
|
||||
}
|
||||
p->die = cl.time + 0.1 * (rand () % 5);
|
||||
p->color = (color & ~7) + (rand () & 7);
|
||||
p->type = pt_grav;
|
||||
for (j = 0; j < 3; j++) {
|
||||
p->org[j] = org[j] + scale * ((rand () & 15) - 8);
|
||||
p->vel[j] = vec3_origin[j]; // + (rand()%300)-150;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
===============
|
||||
R_LavaSplash
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_LavaSplash (vec3_t org)
|
||||
{
|
||||
|
@ -468,6 +333,9 @@ R_LavaSplash (vec3_t org)
|
|||
float vel;
|
||||
vec3_t dir;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
for (i = -16; i < 16; i++)
|
||||
for (j = -16; j < 16; j++)
|
||||
for (k = 0; k < 1; k++) {
|
||||
|
@ -480,7 +348,7 @@ R_LavaSplash (vec3_t org)
|
|||
|
||||
p->die = cl.time + 2 + (rand () & 31) * 0.02;
|
||||
p->color = 224 + (rand () & 7);
|
||||
p->type = pt_slowgrav;
|
||||
p->type = pt_grav;
|
||||
|
||||
dir[0] = j * 8 + (rand () & 7);
|
||||
dir[1] = i * 8 + (rand () & 7);
|
||||
|
@ -496,12 +364,7 @@ R_LavaSplash (vec3_t org)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
===============
|
||||
R_TeleportSplash
|
||||
|
||||
===============
|
||||
*/
|
||||
void
|
||||
R_TeleportSplash (vec3_t org)
|
||||
{
|
||||
|
@ -510,6 +373,9 @@ R_TeleportSplash (vec3_t org)
|
|||
float vel;
|
||||
vec3_t dir;
|
||||
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
for (i = -16; i < 16; i += 4)
|
||||
for (j = -16; j < 16; j += 4)
|
||||
for (k = -24; k < 32; k += 4) {
|
||||
|
@ -522,7 +388,7 @@ R_TeleportSplash (vec3_t org)
|
|||
|
||||
p->die = cl.time + 0.2 + (rand () & 7) * 0.02;
|
||||
p->color = 7 + (rand () & 7);
|
||||
p->type = pt_slowgrav;
|
||||
p->type = pt_grav;
|
||||
|
||||
dir[0] = j * 8;
|
||||
dir[1] = i * 8;
|
||||
|
@ -538,33 +404,22 @@ R_TeleportSplash (vec3_t org)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
|
||||
R_RocketTrail (int type, entity_t *ent)
|
||||
{
|
||||
vec3_t vec;
|
||||
float len;
|
||||
int j;
|
||||
particle_t *p;
|
||||
int dec;
|
||||
static int tracercount;
|
||||
|
||||
if (type == 0)
|
||||
R_AddFire (start, end, ent);
|
||||
|
||||
if (!gl_particles->int_val)
|
||||
if (!r_particles->int_val)
|
||||
return;
|
||||
|
||||
VectorSubtract (end, start, vec);
|
||||
VectorSubtract (ent->origin, ent->msg_origins[1], vec);
|
||||
len = VectorNormalize (vec);
|
||||
if (type < 128)
|
||||
dec = 3;
|
||||
else {
|
||||
dec = 1;
|
||||
type -= 128;
|
||||
}
|
||||
|
||||
while (len > 0) {
|
||||
len -= dec;
|
||||
len -= 3;
|
||||
|
||||
if (!free_particles)
|
||||
return;
|
||||
|
@ -576,32 +431,38 @@ R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
|
|||
VectorCopy (vec3_origin, p->vel);
|
||||
p->die = cl.time + 2;
|
||||
|
||||
switch (type) {
|
||||
case 0: // rocket trail
|
||||
p->ramp = (rand () & 3);
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
if (type == 4) { // slight blood
|
||||
p->type = pt_slowgrav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = start[j] + ((rand () % 6) - 3);
|
||||
break;
|
||||
|
||||
case 1: // smoke smoke
|
||||
p->org[j] = ent->msg_origins[1][j] + ((rand () % 6) - 3);
|
||||
len -= 3;
|
||||
} else if (type == 2) { // blood
|
||||
p->type = pt_slowgrav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->msg_origins[1][j] + ((rand () % 6) - 3);
|
||||
} else if (type == 6) { // voor trail
|
||||
p->color = 9 * 16 + 8 + (rand () & 3);
|
||||
p->type = pt_static;
|
||||
p->die = cl.time + 0.3;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = ent->msg_origins[1][j] + ((rand () & 15) - 8);
|
||||
} else if (type == 1) { // smoke smoke
|
||||
p->ramp = (rand () & 3) + 2;
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = start[j] + ((rand () % 6) - 3);
|
||||
break;
|
||||
|
||||
case 2: // blood
|
||||
p->type = pt_grav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
p->org[j] = ent->msg_origins[1][j] + ((rand () % 6) - 3);
|
||||
} else if (type == 0) { // rocket trail
|
||||
p->ramp = (rand () & 3);
|
||||
p->color = ramp3[(int) p->ramp];
|
||||
p->type = pt_fire;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = start[j] + ((rand () % 6) - 3);
|
||||
break;
|
||||
p->org[j] = ent->msg_origins[1][j] + ((rand () % 6) - 3);
|
||||
} else if (type == 3 || type == 5) { // tracer
|
||||
static int tracercount;
|
||||
|
||||
case 3:
|
||||
case 5: // tracer
|
||||
p->die = cl.time + 0.5;
|
||||
p->type = pt_static;
|
||||
if (type == 3)
|
||||
|
@ -611,7 +472,7 @@ R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
|
|||
|
||||
tracercount++;
|
||||
|
||||
VectorCopy (start, p->org);
|
||||
VectorCopy (ent->msg_origins[1], p->org);
|
||||
if (tracercount & 1) {
|
||||
p->vel[0] = 30 * vec[1];
|
||||
p->vel[1] = 30 * -vec[0];
|
||||
|
@ -619,26 +480,106 @@ R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent)
|
|||
p->vel[0] = 30 * -vec[1];
|
||||
p->vel[1] = 30 * vec[0];
|
||||
}
|
||||
break;
|
||||
|
||||
case 4: // slight blood
|
||||
p->type = pt_grav;
|
||||
p->color = 67 + (rand () & 3);
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = start[j] + ((rand () % 6) - 3);
|
||||
len -= 3;
|
||||
break;
|
||||
|
||||
case 6: // voor trail
|
||||
p->color = 9 * 16 + 8 + (rand () & 3);
|
||||
p->type = pt_static;
|
||||
p->die = cl.time + 0.3;
|
||||
for (j = 0; j < 3; j++)
|
||||
p->org[j] = start[j] + ((rand () & 15) - 8);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
VectorAdd (start, vec, start);
|
||||
VectorAdd (ent->msg_origins[1], vec, ent->msg_origins[1]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
R_DrawParticles (void)
|
||||
{
|
||||
particle_t *p, **particle;
|
||||
float grav;
|
||||
int i;
|
||||
float time2, time3;
|
||||
float time1;
|
||||
float dvel;
|
||||
float frametime;
|
||||
|
||||
D_StartParticles ();
|
||||
|
||||
VectorScale (vright, xscaleshrink, r_pright);
|
||||
VectorScale (vup, yscaleshrink, r_pup);
|
||||
VectorCopy (vpn, r_ppn);
|
||||
|
||||
frametime = host_frametime;
|
||||
time3 = frametime * 15;
|
||||
time2 = frametime * 10; // 15;
|
||||
time1 = frametime * 5;
|
||||
grav = frametime * 800 * 0.05;
|
||||
dvel = 4 * frametime;
|
||||
|
||||
for (particle = &active_particles; *particle;) {
|
||||
if ((*particle)->die < cl.time) {
|
||||
p = (*particle)->next;
|
||||
(*particle)->next = free_particles;
|
||||
free_particles = (*particle);
|
||||
(*particle) = p;
|
||||
} else {
|
||||
p = *particle;
|
||||
particle = &(*particle)->next;
|
||||
|
||||
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 ();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
@ -43,7 +49,6 @@
|
|||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <dpmi.h>
|
||||
#include <sys/nearptr.h>
|
||||
#include <conio.h>
|
||||
|
|
|
@ -30,6 +30,12 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -40,7 +46,6 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/mman.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#include "QF/sys.h"
|
||||
|
|
|
@ -29,6 +29,12 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
#ifdef HAVE_STRING_H
|
||||
# include <string.h>
|
||||
#endif
|
||||
#ifdef HAVE_STRINGS_H
|
||||
# include <strings.h>
|
||||
#endif
|
||||
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
|
@ -42,7 +48,6 @@
|
|||
#include <sys/ipc.h>
|
||||
#include <sys/shm.h>
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/mman.h>
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
client.h
|
||||
cl_ents.h
|
||||
|
||||
Client definitions
|
||||
Client entity definitions
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
|
|
@ -30,13 +30,14 @@
|
|||
#define _CLIENT_H
|
||||
|
||||
#include "QF/info.h"
|
||||
#include "net.h"
|
||||
#include "protocol.h"
|
||||
#include "QF/quakefs.h"
|
||||
#include "render.h"
|
||||
#include "QF/vid.h"
|
||||
#include "QF/zone.h"
|
||||
|
||||
#include "net.h"
|
||||
#include "protocol.h"
|
||||
#include "render.h"
|
||||
|
||||
// player_state_t is the information needed by a player entity
|
||||
// to do move prediction and to generate a drawable entity
|
||||
typedef struct player_state_s {
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
|
||||
#define MAX_BEAMS 8
|
||||
#define MAX_BEAM_ENTS 20
|
||||
|
||||
typedef struct {
|
||||
int entity;
|
||||
struct model_s *model;
|
||||
|
@ -64,6 +65,7 @@ typedef struct {
|
|||
beam_t cl_beams[MAX_BEAMS];
|
||||
|
||||
#define MAX_EXPLOSIONS 8
|
||||
|
||||
typedef struct {
|
||||
float start;
|
||||
entity_t ent;
|
||||
|
@ -80,9 +82,7 @@ sfx_t *cl_sfx_ric2;
|
|||
sfx_t *cl_sfx_ric3;
|
||||
sfx_t *cl_sfx_r_exp3;
|
||||
|
||||
/*
|
||||
CL_TEnts_Init
|
||||
*/
|
||||
|
||||
void
|
||||
CL_TEnts_Init (void)
|
||||
{
|
||||
|
@ -95,12 +95,7 @@ CL_TEnts_Init (void)
|
|||
cl_sfx_r_exp3 = S_PrecacheSound ("weapons/r_exp3.wav");
|
||||
}
|
||||
|
||||
/*
|
||||
CL_Init_Entity
|
||||
|
||||
Set the fields of the entity to reasonable defaults. Especially
|
||||
the extended fields.
|
||||
*/
|
||||
void
|
||||
CL_Init_Entity (entity_t *ent)
|
||||
{
|
||||
|
@ -115,9 +110,7 @@ CL_Init_Entity (entity_t *ent)
|
|||
ent->pose1 = ent->pose2 = -1;
|
||||
}
|
||||
|
||||
/*
|
||||
CL_ClearTEnts
|
||||
*/
|
||||
|
||||
void
|
||||
CL_ClearTEnts (void)
|
||||
{
|
||||
|
@ -136,9 +129,7 @@ CL_ClearTEnts (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CL_AllocExplosion
|
||||
*/
|
||||
|
||||
explosion_t *
|
||||
CL_AllocExplosion (void)
|
||||
{
|
||||
|
@ -161,9 +152,7 @@ CL_AllocExplosion (void)
|
|||
return &cl_explosions[index];
|
||||
}
|
||||
|
||||
/*
|
||||
CL_ParseBeam
|
||||
*/
|
||||
|
||||
void
|
||||
CL_ParseBeam (model_t *m)
|
||||
{
|
||||
|
@ -206,9 +195,7 @@ CL_ParseBeam (model_t *m)
|
|||
Con_Printf ("beam list overflow!\n");
|
||||
}
|
||||
|
||||
/*
|
||||
CL_ParseTEnt
|
||||
*/
|
||||
|
||||
void
|
||||
CL_ParseTEnt (void)
|
||||
{
|
||||
|
@ -258,6 +245,7 @@ CL_ParseTEnt (void)
|
|||
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case TE_SUPERSPIKE: // super spike hitting wall
|
||||
pos[0] = MSG_ReadCoord (net_message);
|
||||
pos[1] = MSG_ReadCoord (net_message);
|
||||
|
@ -357,9 +345,6 @@ CL_ParseTEnt (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
CL_NewTempEntity
|
||||
*/
|
||||
entity_t **
|
||||
CL_NewTempEntity (void)
|
||||
{
|
||||
|
@ -369,9 +354,7 @@ CL_NewTempEntity (void)
|
|||
return &cl_visedicts[cl_numvisedicts++];
|
||||
}
|
||||
|
||||
/*
|
||||
CL_UpdateBeams
|
||||
*/
|
||||
|
||||
void
|
||||
CL_UpdateBeams (void)
|
||||
{
|
||||
|
@ -433,9 +416,7 @@ CL_UpdateBeams (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CL_UpdateExplosions
|
||||
*/
|
||||
|
||||
void
|
||||
CL_UpdateExplosions (void)
|
||||
{
|
||||
|
@ -461,9 +442,7 @@ CL_UpdateExplosions (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
CL_UpdateTEnts
|
||||
*/
|
||||
|
||||
void
|
||||
CL_UpdateTEnts (void)
|
||||
{
|
||||
|
|
|
@ -32,9 +32,7 @@
|
|||
|
||||
#include "d_local.h"
|
||||
|
||||
/*
|
||||
D_EndParticles
|
||||
*/
|
||||
|
||||
void
|
||||
D_EndParticles (void)
|
||||
{
|
||||
|
@ -42,9 +40,6 @@ D_EndParticles (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
D_StartParticles
|
||||
*/
|
||||
void
|
||||
D_StartParticles (void)
|
||||
{
|
||||
|
@ -54,9 +49,6 @@ D_StartParticles (void)
|
|||
|
||||
#ifndef USE_INTEL_ASM
|
||||
|
||||
/*
|
||||
D_DrawParticle
|
||||
*/
|
||||
void
|
||||
D_DrawParticle (particle_t *pparticle)
|
||||
{
|
||||
|
|
|
@ -88,8 +88,7 @@ typedef struct {
|
|||
float sl, tl, sh, th;
|
||||
} glpic_t;
|
||||
|
||||
//=============================================================================
|
||||
/* Support Routines */
|
||||
extern int gl_filter_min, gl_filter_max;
|
||||
|
||||
typedef struct cachepic_s {
|
||||
char name[MAX_QPATH];
|
||||
|
@ -104,8 +103,6 @@ static int numcachepics;
|
|||
|
||||
static byte menuplyr_pixels[4096];
|
||||
|
||||
extern int gl_filter_min, gl_filter_max;
|
||||
|
||||
|
||||
qpic_t *
|
||||
Draw_PicFromWad (char *name)
|
||||
|
@ -509,8 +506,6 @@ Draw_SubPic (int x, int y, qpic_t *pic, int srcx, int srcy, int width,
|
|||
}
|
||||
|
||||
|
||||
extern int gl_filter_min, gl_filter_max;
|
||||
|
||||
/*
|
||||
Draw_TransPicTranslate
|
||||
|
||||
|
|
|
@ -171,13 +171,7 @@ R_RotateForEntity (entity_t *e)
|
|||
glRotatef (e->angles[2], 1, 0, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
SPRITE MODELS
|
||||
*/
|
||||
|
||||
/*
|
||||
R_GetSpriteFrame
|
||||
*/
|
||||
static mspriteframe_t *
|
||||
R_GetSpriteFrame (entity_t *currententity)
|
||||
{
|
||||
|
@ -222,9 +216,6 @@ R_GetSpriteFrame (entity_t *currententity)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
R_DrawSpriteModel
|
||||
*/
|
||||
static void
|
||||
R_DrawSpriteModel (entity_t *e)
|
||||
{
|
||||
|
@ -278,11 +269,11 @@ R_DrawSpriteModel (entity_t *e)
|
|||
glDisable (GL_ALPHA_TEST);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
ALIAS MODELS
|
||||
*/
|
||||
|
||||
|
||||
#define NUMVERTEXNORMALS 162
|
||||
|
||||
float r_avertexnormals[NUMVERTEXNORMALS][3] = {
|
||||
|
@ -568,11 +559,6 @@ GL_DrawAliasBlendedShadow (aliashdr_t *paliashdr, int pose1, int pose2, entity_t
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
R_SetupAliasFrame
|
||||
|
||||
*/
|
||||
static void
|
||||
R_SetupAliasFrame (int frame, aliashdr_t *paliashdr, qboolean fb)
|
||||
{
|
||||
|
@ -595,11 +581,7 @@ R_SetupAliasFrame (int frame, aliashdr_t *paliashdr, qboolean fb)
|
|||
GL_DrawAliasFrame (paliashdr, pose, fb);
|
||||
}
|
||||
|
||||
/*
|
||||
R_SetupAliasBlendedFrame
|
||||
|
||||
|
||||
*/
|
||||
void
|
||||
R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolean fb)
|
||||
{
|
||||
|
@ -651,9 +633,6 @@ R_SetupAliasBlendedFrame (int frame, aliashdr_t *paliashdr, entity_t *e, qboolea
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
R_DrawAliasModel
|
||||
*/
|
||||
static void
|
||||
R_DrawAliasModel (entity_t *e)
|
||||
{
|
||||
|
@ -882,6 +861,7 @@ R_ShowNearestLoc (void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
R_DrawEntitiesOnList
|
||||
|
||||
|
@ -926,9 +906,7 @@ R_DrawEntitiesOnList (void)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
R_DrawViewModel
|
||||
*/
|
||||
|
||||
static void
|
||||
R_DrawViewModel (void)
|
||||
{
|
||||
|
@ -949,6 +927,7 @@ R_DrawViewModel (void)
|
|||
glDepthRange (gldepthmin, gldepthmax);
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
SignbitsForPlane (mplane_t *out)
|
||||
{
|
||||
|
@ -1002,10 +981,6 @@ R_SetFrustum (void)
|
|||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
R_SetupFrame
|
||||
*/
|
||||
void
|
||||
R_SetupFrame (void)
|
||||
{
|
||||
|
@ -1050,9 +1025,6 @@ MYgluPerspective (GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
R_SetupGL
|
||||
*/
|
||||
static void
|
||||
R_SetupGL (void)
|
||||
{
|
||||
|
@ -1117,9 +1089,6 @@ R_SetupGL (void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
R_Clear
|
||||
*/
|
||||
static void
|
||||
R_Clear (void)
|
||||
{
|
||||
|
@ -1134,6 +1103,7 @@ R_Clear (void)
|
|||
glDepthRange (gldepthmin, gldepthmax);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
R_RenderView
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ typedef struct {
|
|||
char identifier[64];
|
||||
int width, height;
|
||||
int bytesperpixel;
|
||||
// int texelformat; // eventually replace bytesperpixel
|
||||
qboolean mipmap;
|
||||
unsigned short crc; // LordHavoc: CRC for texure validation
|
||||
} gltexture_t;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
sbar.c
|
||||
|
||||
status bar code
|
||||
Status bar
|
||||
|
||||
Copyright (C) 1996-1997 Id Software, Inc.
|
||||
|
||||
|
|
Loading…
Reference in a new issue