#include "quakedef.h"
-cvar_t chase_back = {"chase_back", "48", true};
-cvar_t chase_up = {"chase_up", "48", true};
-cvar_t chase_active = {"chase_active", "0", true};
+cvar_t chase_back = {CVAR_SAVE, "chase_back", "48"};
+cvar_t chase_up = {CVAR_SAVE, "chase_up", "48"};
+cvar_t chase_active = {CVAR_SAVE, "chase_active", "0"};
void Chase_Init (void)
{
effect_t effect[MAX_EFFECTS];
-cvar_t r_draweffects = {"r_draweffects", "1"};
+cvar_t r_draweffects = {0, "r_draweffects", "1"};
void r_effects_start(void)
{
if (k == b->down[0] || k == b->down[1])
return; // repeating key
-
+
if (!b->down[0])
b->down[0] = k;
else if (!b->down[1])
//==========================================================================
-cvar_t cl_upspeed = {"cl_upspeed","400"};
-cvar_t cl_forwardspeed = {"cl_forwardspeed","400", true};
-cvar_t cl_backspeed = {"cl_backspeed","400", true};
-cvar_t cl_sidespeed = {"cl_sidespeed","350", true};
+cvar_t cl_upspeed = {CVAR_SAVE, "cl_upspeed","400"};
+cvar_t cl_forwardspeed = {CVAR_SAVE, "cl_forwardspeed","400"};
+cvar_t cl_backspeed = {CVAR_SAVE, "cl_backspeed","400"};
+cvar_t cl_sidespeed = {CVAR_SAVE, "cl_sidespeed","350"};
-cvar_t cl_movespeedkey = {"cl_movespeedkey","2.0"};
+cvar_t cl_movespeedkey = {CVAR_SAVE, "cl_movespeedkey","2.0"};
-cvar_t cl_yawspeed = {"cl_yawspeed","140"};
-cvar_t cl_pitchspeed = {"cl_pitchspeed","150"};
+cvar_t cl_yawspeed = {CVAR_SAVE, "cl_yawspeed","140"};
+cvar_t cl_pitchspeed = {CVAR_SAVE, "cl_pitchspeed","150"};
-cvar_t cl_anglespeedkey = {"cl_anglespeedkey","1.5"};
+cvar_t cl_anglespeedkey = {CVAR_SAVE, "cl_anglespeedkey","1.5"};
/*
{
float speed;
float up, down;
-
+
if (in_speed.state & 1)
speed = cl.frametime * cl_anglespeedkey.value;
else
cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * CL_KeyState (&in_forward);
cl.viewangles[PITCH] += speed*cl_pitchspeed.value * CL_KeyState (&in_back);
}
-
+
up = CL_KeyState (&in_lookup);
down = CL_KeyState(&in_lookdown);
-
+
cl.viewangles[PITCH] -= speed*cl_pitchspeed.value * up;
cl.viewangles[PITCH] += speed*cl_pitchspeed.value * down;
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
// references them even when on a unix system.
// these two are not intended to be set directly
-cvar_t cl_name = {"_cl_name", "player", true};
-cvar_t cl_color = {"_cl_color", "0", true};
-cvar_t cl_pmodel = {"_cl_pmodel", "0", true};
+cvar_t cl_name = {CVAR_SAVE, "_cl_name", "player"};
+cvar_t cl_color = {CVAR_SAVE, "_cl_color", "0"};
+cvar_t cl_pmodel = {CVAR_SAVE, "_cl_pmodel", "0"};
-cvar_t cl_shownet = {"cl_shownet","0"}; // can be 0, 1, or 2
-cvar_t cl_nolerp = {"cl_nolerp","0"};
+cvar_t cl_shownet = {0, "cl_shownet","0"};
+cvar_t cl_nolerp = {0, "cl_nolerp", "0"};
-cvar_t lookspring = {"lookspring","0", true};
-cvar_t lookstrafe = {"lookstrafe","0", true};
-cvar_t sensitivity = {"sensitivity","3", true};
+cvar_t lookspring = {CVAR_SAVE, "lookspring","0"};
+cvar_t lookstrafe = {CVAR_SAVE, "lookstrafe","0"};
+cvar_t sensitivity = {CVAR_SAVE, "sensitivity","3", 1, 30};
-cvar_t m_pitch = {"m_pitch","0.022", true};
-cvar_t m_yaw = {"m_yaw","0.022", true};
-cvar_t m_forward = {"m_forward","1", true};
-cvar_t m_side = {"m_side","0.8", true};
+cvar_t m_pitch = {CVAR_SAVE, "m_pitch","0.022"};
+cvar_t m_yaw = {CVAR_SAVE, "m_yaw","0.022"};
+cvar_t m_forward = {CVAR_SAVE, "m_forward","1"};
+cvar_t m_side = {CVAR_SAVE, "m_side","0.8"};
-cvar_t freelook = {"freelook", "1", true};
+cvar_t freelook = {CVAR_SAVE, "freelook", "1"};
client_static_t cls;
client_state_t cl;
if (cls.demoplayback)
{
- // interpolate the angles
+ // interpolate the angles
for (j = 0;j < 3;j++)
{
d = cl.mviewangles[0][j] - cl.mviewangles[1][j];
{
// get basic movement from keyboard
CL_BaseMove (&cmd);
-
+
// allow mice or other external controllers to add to the move
IN_Move (&cmd);
CL_Parse_Init();
}
-
//=============================================================================
-cvar_t demo_nehahra = {"demo_nehahra", "0"};
+cvar_t demo_nehahra = {0, "demo_nehahra", "0"};
void CL_Parse_Init(void)
{
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
#include "quakedef.h"
-cvar_t r_glowinglightning = {"r_glowinglightning", "1", true};
+cvar_t r_glowinglightning = {CVAR_SAVE, "r_glowinglightning", "1"};
int num_temp_entities;
entity_t cl_temp_entities[MAX_TEMP_ENTITIES];
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*/
// common.c -- misc functions used in client and server
+#include <stdlib.h>
#include <fcntl.h>
#ifdef WIN32
#include <io.h>
#else
#include <unistd.h>
#endif
-#include <stdlib.h>
#include "quakedef.h"
static char *safeargvs[NUM_SAFE_ARGVS] =
{"-stdvid", "-nolan", "-nosound", "-nocdaudio", "-nojoy", "-nomouse", "-dibonly"};
-cvar_t registered = {"registered","0"};
-cvar_t cmdline = {"cmdline","0", false, true};
+cvar_t registered = {0, "registered","0"};
+cvar_t cmdline = {0, "cmdline","0"};
qboolean com_modified; // set true if using non-id files
-qboolean proghack;
+//qboolean proghack;
-int static_registered = 1; // only for startup check, then set
+//int static_registered = 1; // only for startup check, then set
qboolean msg_suppress_1 = 0;
int com_argc;
char **com_argv;
-#define CMDLINE_LENGTH 256
+// LordHavoc: made commandline 1024 characters instead of 256
+#define CMDLINE_LENGTH 1024
char com_cmdline[CMDLINE_LENGTH];
qboolean standard_quake = true, rogue = false, hipnotic = false, nehahra = false;
int val;
int sign;
int c;
-
+
if (*str == '-')
{
sign = -1;
{
Cvar_Set ("cmdline", com_cmdline);
- static_registered = 0;
+// static_registered = 0;
if (!Sys_FileTime("gfx/pop.lmp"))
{
// Cvar_Set ("cmdline", com_cmdline);
Cvar_Set ("registered", "1");
- static_registered = 1;
+// static_registered = 1;
Con_Printf ("Playing registered version.\n");
}
// search through the path, one element at a time
//
search = com_searchpaths;
- if (proghack)
- { // gross hack to use quake 1 progs with quake 2 maps
- if (!strcmp(filename, "progs.dat"))
- search = search->next;
- }
+// if (proghack)
+// { // gross hack to use quake 1 progs with quake 2 maps
+// if (!strcmp(filename, "progs.dat"))
+// search = search->next;
+// }
for ( ; search ; search = search->next)
{
}
}
- if (COM_CheckParm ("-proghack"))
- proghack = true;
+// if (COM_CheckParm ("-proghack"))
+// proghack = true;
}
int COM_FileExists(char *filename)
int con_x; // offset in current line for next print
char *con_text = 0;
-cvar_t con_notifytime = {"con_notifytime","3"}; //seconds
-cvar_t logfile = {"logfile","0"};
+cvar_t con_notifytime = {CVAR_SAVE, "con_notifytime","3"}; //seconds
+cvar_t logfile = {0, "logfile","0"};
#define NUM_CON_TIMES 4
float con_times[NUM_CON_TIMES]; // realtime time the line was generated
cvar_t *Cvar_FindVar (char *var_name)
{
cvar_t *var;
-
+
for (var=cvar_vars ; var ; var=var->next)
if (!strcmp (var_name, var->name))
return var;
float Cvar_VariableValue (char *var_name)
{
cvar_t *var;
-
+
var = Cvar_FindVar (var_name);
if (!var)
return 0;
char *Cvar_VariableString (char *var_name)
{
cvar_t *var;
-
+
var = Cvar_FindVar (var_name);
if (!var)
return cvar_null_string;
{
cvar_t *cvar;
int len;
-
+
len = strlen(partial);
-
+
if (!len)
return NULL;
-
+
// check functions
for (cvar=cvar_vars ; cvar ; cvar=cvar->next)
if (!strncmp (partial,cvar->name, len))
cvar_t *cvar;
int len;
int h;
-
+
h = 0;
len = strlen(partial);
-
+
if (!len)
return 0;
-
+
// Loop through the cvars and count all possible matches
for (cvar = cvar_vars; cvar; cvar = cvar->next)
if (!strncasecmp(partial, cvar->name, len))
h++;
-
+
return h;
}
buf[bpos] = NULL;
return buf;
-}
+}
/*
============
{
cvar_t *var;
qboolean changed;
-
+
var = Cvar_FindVar (var_name);
if (!var)
{ // there is an error in C code if this happens
}
changed = strcmp(var->string, value);
-
+
Z_Free (var->string); // free the old value string
-
+
var->string = Z_Malloc (strlen(value)+1);
strcpy (var->string, value);
var->value = atof (var->string);
- if (var->server && changed)
+ if ((var->flags & CVAR_NOTIFY) && changed)
{
if (sv.active)
SV_BroadcastPrintf ("\"%s\" changed to \"%s\"\n", var->name, var->string);
void Cvar_SetValue (char *var_name, float value)
{
char val[32];
-
+
// LordHavoc: changed from %f to %g to use shortest representation
sprintf (val, "%g",value);
Cvar_Set (var_name, val);
}
-
/*
============
Cvar_RegisterVariable
void Cvar_RegisterVariable (cvar_t *variable)
{
char *oldstr;
-
+
// first check to see if it has already been defined
if (Cvar_FindVar (variable->name))
{
Con_Printf ("Can't register variable %s, already defined\n", variable->name);
return;
}
-
+
// check for overlap with a command
if (Cmd_Exists (variable->name))
{
Con_Printf ("Cvar_RegisterVariable: %s is a command\n", variable->name);
return;
}
-
+
// copy the value off, because future sets will Z_Free it
oldstr = variable->string;
- variable->string = Z_Malloc (strlen(variable->string)+1);
+ variable->string = Z_Malloc (strlen(variable->string)+1);
strcpy (variable->string, oldstr);
variable->value = atof (variable->string);
-
+
// link the variable in
variable->next = cvar_vars;
cvar_vars = variable;
v = Cvar_FindVar (Cmd_Argv(0));
if (!v)
return false;
-
+
// perform a variable print or set
if (Cmd_Argc() == 1)
{
void Cvar_WriteVariables (QFile *f)
{
cvar_t *var;
-
+
for (var = cvar_vars ; var ; var = var->next)
- if (var->archive)
+ if (var->flags & CVAR_SAVE)
Qprintf (f, "%s \"%s\"\n", var->name, var->string);
}
interface from being ambiguous.
*/
+// cvar flags
+#define CVAR_SAVE 1
+#define CVAR_NOTIFY 2
+
+// type of a cvar for menu purposes
+#define CVARMENUTYPE_FLOAT 1
+#define CVARMENUTYPE_INTEGER 2
+#define CVARMENUTYPE_SLIDER 3
+#define CVARMENUTYPE_BOOL 4
+#define CVARMENUTYPE_STRING 5
+#define CVARMENUTYPE_OPTION 6
+
+// which menu to put a cvar in
+#define CVARMENU_GRAPHICS 1
+#define CVARMENU_SOUND 2
+#define CVARMENU_INPUT 3
+#define CVARMENU_NETWORK 4
+#define CVARMENU_SERVER 5
+
+#define MAX_CVAROPTIONS 16
+
+typedef struct
+{
+ int value;
+ char *name;
+}
+cvaroption_t;
+
+typedef struct
+{
+ int type;
+ float valuemin, valuemax, valuestep;
+ int numoptions;
+ cvaroption_t optionlist[MAX_CVAROPTIONS];
+}
+menucvar_t;
+
typedef struct cvar_s
{
- char *name;
- char *string;
- qboolean archive; // set to true to cause it to be saved to vars.rc
- qboolean server; // notifies players when changed
- float value;
- struct cvar_s *next;
+ int flags;
+ char *name;
+ char *string;
+// qboolean archive; // set to true to cause it to be saved to vars.rc
+// qboolean server; // notifies players when changed
+ int intvalue;
+ float value;
+ float vector[3];
+ menucvar_t menuinfo;
+ struct cvar_s *next;
} cvar_t;
-void Cvar_RegisterVariable (cvar_t *variable);
+void Cvar_MenuSlider(cvar_t *variable, int menu, float slider_min, float slider_max, float slider_step);
+void Cvar_MenuBool(cvar_t *variable, int menu, char *name_false, char *name_true);
+void Cvar_MenuFloat(cvar_t *variable, int menu, float range_min, float range_max);
+void Cvar_MenuInteger(cvar_t *variable, int menu, int range_min, int range_max);
+void Cvar_MenuString(cvar_t *variable, int menu);
+void Cvar_MenuOption(cvar_t *variable, int menu, int value[16], char *name[16]);
+
+void Cvar_RegisterVariable (cvar_t *variable);
// registers a cvar that already has the name, string, and optionally the
// archive elements set.
-void Cvar_Set (char *var_name, char *value);
+void Cvar_Set (char *var_name, char *value);
// equivelant to "<name> <variable>" typed at the console
void Cvar_SetValue (char *var_name, float value);
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
void Draw_Character (int x, int y, int num);
void Draw_GenericPic (rtexture_t *tex, float red, float green, float blue, float alpha, int x, int y, int width, int height);
void Draw_Pic (int x, int y, qpic_t *pic);
+void Draw_AdditivePic (int x, int y, qpic_t *pic);
void Draw_PicTranslate (int x, int y, qpic_t *pic, byte *translation);
void Draw_ConsoleBackground (int lines);
void Draw_Fill (int x, int y, int w, int h, int c);
//#define GL_COLOR_INDEX8_EXT 0x80E5
-cvar_t scr_conalpha = {"scr_conalpha", "1"};
+cvar_t scr_conalpha = {CVAR_SAVE, "scr_conalpha", "1"};
byte *draw_chars; // 8*8 graphic characters
qpic_t *draw_disc;
*/
void Draw_AlphaPic (int x, int y, qpic_t *pic, float alpha)
{
- Draw_GenericPic(((glpic_t *)pic->data)->tex, 1,1,1,alpha, x,y,pic->width, pic->height);
+ if (pic)
+ Draw_GenericPic(((glpic_t *)pic->data)->tex, 1,1,1,alpha, x,y,pic->width, pic->height);
}
*/
void Draw_Pic (int x, int y, qpic_t *pic)
{
- Draw_GenericPic(((glpic_t *)pic->data)->tex, 1,1,1,1, x,y,pic->width, pic->height);
+ if (pic)
+ Draw_GenericPic(((glpic_t *)pic->data)->tex, 1,1,1,1, x,y,pic->width, pic->height);
+}
+
+
+void Draw_AdditivePic (int x, int y, qpic_t *pic)
+{
+ if (pic)
+ {
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+ Draw_GenericPic(((glpic_t *)pic->data)->tex, 1,1,1,1, x,y,pic->width, pic->height);
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ }
}
byte *trans, *src, *dest;
rtexture_t *rt;
+ if (pic == NULL)
+ return;
+
c = pic->width * pic->height;
src = menuplyr_pixels;
dest = trans = qmalloc(c);
#include "quakedef.h"
-cvar_t gl_transform = {"gl_transform", "1"};
-cvar_t gl_lockarrays = {"gl_lockarrays", "1"};
+cvar_t gl_transform = {0, "gl_transform", "1"};
+cvar_t gl_lockarrays = {0, "gl_lockarrays", "1"};
typedef struct
{
void LoadSky_f(void);
-cvar_t r_multitexture = {"r_multitexture", "1"};
-cvar_t r_skyquality = {"r_skyquality", "2", true};
-cvar_t r_mergesky = {"r_mergesky", "0", true};
+cvar_t r_multitexture = {0, "r_multitexture", "1"};
+cvar_t r_skyquality = {CVAR_SAVE, "r_skyquality", "2"};
+cvar_t r_mergesky = {CVAR_SAVE, "r_mergesky", "0"};
char skyworldname[1024];
rtexture_t *mergeskytexture;
void R_MarkLeaves (void);
-//cvar_t r_norefresh = {"r_norefresh","0"};
-cvar_t r_drawentities = {"r_drawentities","1"};
-cvar_t r_drawviewmodel = {"r_drawviewmodel","1"};
-cvar_t r_speeds = {"r_speeds","0"};
-cvar_t r_speeds2 = {"r_speeds2","0"};
-cvar_t r_fullbright = {"r_fullbright","0"};
-//cvar_t r_lightmap = {"r_lightmap","0"};
-cvar_t r_wateralpha = {"r_wateralpha","1"};
-cvar_t r_dynamic = {"r_dynamic","1"};
-cvar_t r_waterripple = {"r_waterripple","0"};
-cvar_t r_fullbrights = {"r_fullbrights", "1"};
-
-cvar_t gl_lightmode = {"gl_lightmode", "1", true}; // LordHavoc: overbright lighting
-//cvar_t r_dynamicbothsides = {"r_dynamicbothsides", "1"}; // LordHavoc: can disable dynamic lighting of backfaces, but quake maps are weird so it doesn't always work right...
-cvar_t r_farclip = {"r_farclip", "6144"};
-
-cvar_t gl_fogenable = {"gl_fogenable", "0"};
-cvar_t gl_fogdensity = {"gl_fogdensity", "0.25"};
-cvar_t gl_fogred = {"gl_fogred","0.3"};
-cvar_t gl_foggreen = {"gl_foggreen","0.3"};
-cvar_t gl_fogblue = {"gl_fogblue","0.3"};
-cvar_t gl_fogstart = {"gl_fogstart", "0"};
-cvar_t gl_fogend = {"gl_fogend","0"};
-cvar_t glfog = {"glfog", "0"};
+//cvar_t r_norefresh = {0, "r_norefresh","0"};
+cvar_t r_drawentities = {0, "r_drawentities","1"};
+cvar_t r_drawviewmodel = {0, "r_drawviewmodel","1"};
+cvar_t r_speeds = {0, "r_speeds","0"};
+cvar_t r_speeds2 = {0, "r_speeds2","0"};
+cvar_t r_fullbright = {0, "r_fullbright","0"};
+//cvar_t r_lightmap = {0, "r_lightmap","0"};
+cvar_t r_wateralpha = {CVAR_SAVE, "r_wateralpha","1"};
+cvar_t r_dynamic = {CVAR_SAVE, "r_dynamic","1"};
+cvar_t r_waterripple = {CVAR_SAVE, "r_waterripple","0"};
+cvar_t r_fullbrights = {CVAR_SAVE, "r_fullbrights", "1"};
+
+cvar_t gl_lightmode = {CVAR_SAVE, "gl_lightmode", "1"}; // LordHavoc: overbright lighting
+//cvar_t r_dynamicbothsides = {CVAR_SAVE, "r_dynamicbothsides", "1"}; // LordHavoc: can disable dynamic lighting of backfaces, but quake maps are weird so it doesn't always work right...
+cvar_t r_farclip = {0, "r_farclip", "6144"}; // FIXME: make this go away (calculate based on farthest visible object/polygon)
+
+cvar_t gl_fogenable = {0, "gl_fogenable", "0"};
+cvar_t gl_fogdensity = {0, "gl_fogdensity", "0.25"};
+cvar_t gl_fogred = {0, "gl_fogred","0.3"};
+cvar_t gl_foggreen = {0, "gl_foggreen","0.3"};
+cvar_t gl_fogblue = {0, "gl_fogblue","0.3"};
+cvar_t gl_fogstart = {0, "gl_fogstart", "0"};
+cvar_t gl_fogend = {0, "gl_fogend","0"};
+cvar_t glfog = {0, "glfog", "0"};
/*
int R_VisibleCullBox (vec3_t mins, vec3_t maxs)
node = nodestack[--stack];
goto loc0;
}
-
+
sides = BOX_ON_PLANE_SIDE(mins, maxs, node->plane);
-
+
// recurse down the contacted sides
if (sides & 1)
{
Cvar_RegisterVariable (&gl_fogenable);
Cvar_RegisterVariable (&gl_fogdensity);
Cvar_RegisterVariable (&gl_fogred);
- Cvar_RegisterVariable (&gl_foggreen);
+ Cvar_RegisterVariable (&gl_foggreen);
Cvar_RegisterVariable (&gl_fogblue);
Cvar_RegisterVariable (&gl_fogstart);
Cvar_RegisterVariable (&gl_fogend);
extern void R_Explosion_Init(void);
extern void CL_Effects_Init(void);
extern void R_Clip_Init(void);
+extern void ui_init(void);
void Render_Init(void)
{
R_Explosion_Init();
CL_Effects_Init();
R_Decals_Init();
+ ui_init();
R_Modules_Start();
}
signed int blocklights[BLOCK_WIDTH*BLOCK_HEIGHT*3]; // LordHavoc: *3 for colored lighting
int lightmapalign, lightmapalignmask; // LordHavoc: NVIDIA's broken subimage fix, see BuildLightmaps for notes
-cvar_t gl_lightmapalign = {"gl_lightmapalign", "4"};
-cvar_t gl_lightmaprgba = {"gl_lightmaprgba", "1"};
-cvar_t gl_nosubimagefragments = {"gl_nosubimagefragments", "0"};
-cvar_t gl_nosubimage = {"gl_nosubimage", "0"};
-cvar_t r_ambient = {"r_ambient", "0"};
-cvar_t gl_vertex = {"gl_vertex", "0"};
-cvar_t r_dlightmap = {"r_dlightmap", "1"};
-cvar_t r_drawportals = {"r_drawportals", "0"};
-cvar_t r_testvis = {"r_testvis", "0"};
-cvar_t r_solidworldnode = {"r_solidworldnode", "1"};
+cvar_t gl_lightmapalign = {0, "gl_lightmapalign", "4"};
+cvar_t gl_lightmaprgba = {0, "gl_lightmaprgba", "1"};
+cvar_t gl_nosubimagefragments = {0, "gl_nosubimagefragments", "0"};
+cvar_t gl_nosubimage = {0, "gl_nosubimage", "0"};
+cvar_t r_ambient = {0, "r_ambient", "0"};
+cvar_t gl_vertex = {0, "gl_vertex", "0"};
+cvar_t r_dlightmap = {CVAR_SAVE, "r_dlightmap", "1"};
+cvar_t r_drawportals = {0, "r_drawportals", "0"};
+cvar_t r_testvis = {0, "r_testvis", "0"};
+cvar_t r_solidworldnode = {0, "r_solidworldnode", "1"};
qboolean lightmaprgba, nosubimagefragments, nosubimage;
int lightmapbytes;
}
*/
-/*
-#define MAXRECURSIVEPORTALPLANES 1024
-#define MAXRECURSIVEPORTALS 256
-
-tinyplane_t portalplanes[MAXRECURSIVEPORTALPLANES];
-int portalplanestack[MAXRECURSIVEPORTALS];
-int portalplanecount;
-int ranoutofportalplanes;
-int ranoutofportals;
-int ranoutofleafs;
-int portalcantseeself;
-int portalrecursion;
-
-int R_ClipPolygonToPlane(float *in, float *out, int inpoints, int maxoutpoints, tinyplane_t *p)
-{
- int i, outpoints, prevside, side;
- float *prevpoint, prevdist, dist, dot;
-
- if (inpoints < 3)
- return inpoints;
- // begin with the last point, then enter the loop with the first point as current
- prevpoint = in + 3 * (inpoints - 1);
- prevdist = DotProduct(prevpoint, p->normal) - p->dist;
- prevside = prevdist >= 0 ? SIDE_FRONT : SIDE_BACK;
- i = 0;
- outpoints = 0;
- goto begin;
- for (;i < inpoints;i++)
- {
- prevpoint = in;
- prevdist = dist;
- prevside = side;
- in += 3;
-
-begin:
- dist = DotProduct(in, p->normal) - p->dist;
- side = dist >= 0 ? SIDE_FRONT : SIDE_BACK;
-
- if (prevside == SIDE_FRONT)
- {
- if (outpoints >= maxoutpoints)
- return -1;
- VectorCopy(prevpoint, out);
- out += 3;
- outpoints++;
- if (side == SIDE_FRONT)
- continue;
- }
- else if (side == SIDE_BACK)
- continue;
-
- // generate a split point
- if (outpoints >= maxoutpoints)
- return -1;
- dot = prevdist / (prevdist - dist);
- out[0] = prevpoint[0] + dot * (in[0] - prevpoint[0]);
- out[1] = prevpoint[1] + dot * (in[1] - prevpoint[1]);
- out[2] = prevpoint[2] + dot * (in[2] - prevpoint[2]);
- out += 3;
- outpoints++;
- }
-
- return outpoints;
-}
-
-float portaltemppoints[2][256][3];
-float portaltemppoints2[256][3];
-
-int R_FrustumTestPolygon(float *points, int numpoints, int stride)
-{
- int i;
- float *out;
- if (numpoints < 3)
- return numpoints;
- out = &portaltemppoints[0][0][0];
- for (i = 0;i < numpoints;i++)
- {
- VectorCopy(points, portaltemppoints[0][i]);
- (byte *)points += stride;
- }
- numpoints = R_ClipPolygonToPlane(&portaltemppoints[0][0][0], &portaltemppoints[1][0][0], numpoints, 256, (tinyplane_t *)&frustum[0]);
- if (numpoints < 3)
- return numpoints;
- numpoints = R_ClipPolygonToPlane(&portaltemppoints[1][0][0], &portaltemppoints[0][0][0], numpoints, 256, (tinyplane_t *)&frustum[1]);
- if (numpoints < 3)
- return numpoints;
- numpoints = R_ClipPolygonToPlane(&portaltemppoints[0][0][0], &portaltemppoints[1][0][0], numpoints, 256, (tinyplane_t *)&frustum[2]);
- if (numpoints < 3)
- return numpoints;
- return R_ClipPolygonToPlane(&portaltemppoints[1][0][0], &portaltemppoints[0][0][0], numpoints, 256, (tinyplane_t *)&frustum[3]);
-}
-
-void R_TriangleToPlane(vec3_t point1, vec3_t point2, vec3_t point3, tinyplane_t *p)
-{
- vec3_t v1, v2;
- VectorSubtract(point1, point2, v1);
- VectorSubtract(point3, point2, v2);
- CrossProduct(v1, v2, p->normal);
-// VectorNormalize(p->normal);
- VectorNormalizeFast(p->normal);
- p->dist = DotProduct(point1, p->normal);
-}
-
-int R_PortalThroughPortalPlanes(tinyplane_t *clipplanes, int clipnumplanes, float *targpoints, int targnumpoints, float *out, int maxpoints)
-{
- int numpoints, i;
- if (targnumpoints < 3)
- return targnumpoints;
- if (maxpoints < 3)
- return -1;
- numpoints = targnumpoints;
- memcpy(&portaltemppoints[0][0][0], targpoints, numpoints * 3 * sizeof(float));
- for (i = 0;i < clipnumplanes;i++)
- {
- numpoints = R_ClipPolygonToPlane(&portaltemppoints[0][0][0], &portaltemppoints[1][0][0], numpoints, 256, clipplanes + i);
- if (numpoints < 3)
- return numpoints;
- memcpy(&portaltemppoints[0][0][0], &portaltemppoints[1][0][0], numpoints * 3 * sizeof(float));
- }
- if (numpoints > maxpoints)
- return -1;
- memcpy(out, &portaltemppoints[1][0][0], numpoints * 3 * sizeof(float));
- return numpoints;
-}
-
-#define MAXRECURSIVEPORTALLEAFS 256
-
-//mleaf_t *leafstack[MAXRECURSIVEPORTALLEAFS];
-//int leafstackpos;
-int r_portalframecount;
-
-void R_RecursivePortalWorldNode (mleaf_t *leaf, int firstclipplane, int numclipplanes)
-{
- mportal_t *p;
-
-// if (leafstackpos >= MAXRECURSIVEPORTALLEAFS)
-// {
-// ranoutofleafs = true;
-// return;
-// }
-
-// leafstack[leafstackpos++] = leaf;
-
- if (leaf->visframe != r_framecount)
- {
- c_leafs++;
- leaf->visframe = r_framecount;
- if (leaf->nummarksurfaces)
- {
- msurface_t *surf, **mark, **endmark;
- mark = leaf->firstmarksurface;
- endmark = mark + leaf->nummarksurfaces;
- do
- {
- surf = *mark++;
- // make sure surfaces are only processed once
- if (surf->worldnodeframe == r_framecount)
- continue;
- surf->worldnodeframe = r_framecount;
- if (PlaneDist(modelorg, surf->plane) < surf->plane->dist)
- {
- if (surf->flags & SURF_PLANEBACK)
- RSurf_DoVisible(surf);
- }
- else
- {
- if (!(surf->flags & SURF_PLANEBACK))
- RSurf_DoVisible(surf);
- }
- }
- while (mark < endmark);
- }
- }
-
- // follow portals into other leafs
- for (p = leaf->portals;p;p = p->next)
- {
- int newpoints, i, prev;
- vec3_t center;
- vec3_t v1, v2;
- tinyplane_t *newplanes;
- // only flow through portals facing away from the viewer
- if (PlaneDiff(r_origin, (&p->plane)) < 0)
- {
-*/
- /*
- for (i = 0;i < leafstackpos;i++)
- if (leafstack[i] == p->past)
- break;
- if (i < leafstackpos)
- {
- portalrecursion = true;
- continue;
- }
- */
-/*
- newpoints = R_PortalThroughPortalPlanes(&portalplanes[firstclipplane], numclipplanes, (float *) p->points, p->numpoints, &portaltemppoints2[0][0], 256);
- if (newpoints < 3)
- continue;
- else if (firstclipplane + numclipplanes + newpoints > MAXRECURSIVEPORTALPLANES)
- ranoutofportalplanes = true;
- else
- {
- // go ahead and mark the leaf early, nothing can abort here
- if (!r_testvis.value)
- p->visframe = r_portalframecount;
-
- // find the center by averaging
- VectorClear(center);
- for (i = 0;i < newpoints;i++)
- VectorAdd(center, portaltemppoints2[i], center);
- // ixtable is a 1.0f / N table
- VectorScale(center, ixtable[newpoints], center);
- // calculate the planes, and make sure the polygon can see it's own center
- newplanes = &portalplanes[firstclipplane + numclipplanes];
- for (prev = newpoints - 1, i = 0;i < newpoints;prev = i, i++)
- {
-// R_TriangleToPlane(r_origin, portaltemppoints2[i], portaltemppoints2[prev], newplanes + i);
- VectorSubtract(r_origin, portaltemppoints2[i], v1);
- VectorSubtract(portaltemppoints2[prev], portaltemppoints2[i], v2);
- CrossProduct(v1, v2, newplanes[i].normal);
- VectorNormalizeFast(newplanes[i].normal);
- newplanes[i].dist = DotProduct(r_origin, newplanes[i].normal);
- if (DotProduct(newplanes[i].normal, center) <= newplanes[i].dist)
- {
- // polygon can't see it's own center, discard and use parent portal
- break;
- }
- }
- if (i == newpoints)
- R_RecursivePortalWorldNode(p->past, firstclipplane + numclipplanes, newpoints);
- else
- R_RecursivePortalWorldNode(p->past, firstclipplane, numclipplanes);
- }
- }
- }
-// leafstackpos--;
-}
-
-//float viewportalpoints[16*3];
-
-*/
int r_portalframecount = 0;
}
}
- /*
- if (!r_testvis.value)
- r_portalframecount = r_framecount;
- portalplanecount = 0;
-// leafstackpos = 0;
- ranoutofportalplanes = false;
- ranoutofportals = false;
- ranoutofleafs = false;
- portalcantseeself = 0;
- portalrecursion = false;
- memcpy(&portalplanes[0], &frustum[0], sizeof(tinyplane_t));
- memcpy(&portalplanes[1], &frustum[1], sizeof(tinyplane_t));
- memcpy(&portalplanes[2], &frustum[2], sizeof(tinyplane_t));
- memcpy(&portalplanes[3], &frustum[3], sizeof(tinyplane_t));
- R_RecursivePortalWorldNode(r_viewleaf, 0, 4);
- if (ranoutofportalplanes)
- Con_Printf("R_RecursivePortalWorldNode: ran out of %d plane stack when recursing through portals\n", MAXRECURSIVEPORTALPLANES);
- if (ranoutofportals)
- Con_Printf("R_RecursivePortalWorldNode: ran out of %d portal stack when recursing through portals\n", MAXRECURSIVEPORTALS);
- if (ranoutofleafs)
- Con_Printf("R_RecursivePortalWorldNode: ran out of %d leaf stack when recursing through portals\n", MAXRECURSIVEPORTALLEAFS);
-// if (portalcantseeself)
-// Con_Printf("R_RecursivePortalWorldNode: %d portals could not see themself during clipping\n", portalcantseeself);
- if (portalrecursion)
- Con_Printf("R_RecursivePortalWorldNode: portal saw into previously encountered leaf??\n");
- */
-
/*
void R_OldPortalWorldNode (void)
{
float scr_conlines; // lines of console to display
float oldscreensize, oldfov;
-cvar_t scr_viewsize = {"viewsize","100", true};
-cvar_t scr_fov = {"fov","90"}; // 10 - 170
-cvar_t scr_conspeed = {"scr_conspeed","300"};
-cvar_t scr_centertime = {"scr_centertime","2"};
-cvar_t scr_showram = {"showram","1"};
-cvar_t scr_showturtle = {"showturtle","0"};
-cvar_t scr_showpause = {"showpause","1"};
-cvar_t scr_printspeed = {"scr_printspeed","8"};
-cvar_t showfps = {"showfps", "0", true};
-cvar_t r_render = {"r_render", "1"};
-cvar_t r_brightness = {"r_brightness", "1", true}; // LordHavoc: a method of operating system independent color correction
-cvar_t r_contrast = {"r_contrast", "1", true}; // LordHavoc: a method of operating system independent color correction
+cvar_t scr_viewsize = {CVAR_SAVE, "viewsize","100"};
+cvar_t scr_fov = {CVAR_SAVE, "fov","90"}; // 10 - 170
+cvar_t scr_conspeed = {CVAR_SAVE, "scr_conspeed","900"}; // LordHavoc: quake used 300
+cvar_t scr_centertime = {0, "scr_centertime","2"};
+cvar_t scr_showram = {CVAR_SAVE, "showram","1"};
+cvar_t scr_showturtle = {CVAR_SAVE, "showturtle","0"};
+cvar_t scr_showpause = {CVAR_SAVE, "showpause","1"};
+cvar_t scr_printspeed = {0, "scr_printspeed","8"};
+cvar_t showfps = {CVAR_SAVE, "showfps", "0"};
+cvar_t r_render = {0, "r_render", "1"};
+cvar_t r_brightness = {CVAR_SAVE, "r_brightness", "1"}; // LordHavoc: a method of operating system independent color correction
+cvar_t r_contrast = {CVAR_SAVE, "r_contrast", "1"}; // LordHavoc: a method of operating system independent color correction
qboolean scr_initialized; // ready to draw
scr_erase_lines = scr_center_lines;
scr_centertime_off -= host_frametime;
-
+
if (scr_centertime_off <= 0 && !cl.intermission)
return;
if (key_dest != key_game)
char filename[80];
char checkname[MAX_OSPATH];
int i;
-//
+//
// find a file name to save it to
//
strcpy(filename,"dp0000.tga");
GL_BeginRendering (&glx, &gly, &glwidth, &glheight);
-
+
//
// determine size of refresh window
//
else if (cl.intermission == 2)
Sbar_FinaleOverlay();
- SCR_DrawConsole();
+ SCR_DrawConsole();
M_Draw();
+ ui_draw();
+
// if (scr_drawloading)
// SCR_DrawLoading();
}
// LordHavoc: only print info if renderer is being used
- if (r_speeds2.value && cl.worldmodel != NULL)
+ if (r_speeds2.value && !con_forcedup)
{
int i, j, lines, y;
lines = 1;
#include "quakedef.h"
-cvar_t r_max_size = {"r_max_size", "2048"};
-cvar_t r_picmip = {"r_picmip", "0"};
-cvar_t r_lerpimages = {"r_lerpimages", "1"};
-cvar_t r_upload = {"r_upload", "1"};
-cvar_t r_precachetextures = {"r_precachetextures", "1", true};
+cvar_t r_max_size = {0, "r_max_size", "2048"};
+cvar_t r_picmip = {0, "r_picmip", "0"};
+cvar_t r_lerpimages = {CVAR_SAVE, "r_lerpimages", "1"};
+cvar_t r_upload = {0, "r_upload", "1"};
+cvar_t r_precachetextures = {CVAR_SAVE, "r_precachetextures", "1"};
int gl_filter_min = GL_LINEAR_MIPMAP_LINEAR; //NEAREST;
int gl_filter_max = GL_LINEAR;
jmp_buf host_abortserver;
-cvar_t host_framerate = {"host_framerate","0"}; // set for slow motion
-cvar_t host_speeds = {"host_speeds","0"}; // set for running times
-cvar_t slowmo = {"slowmo", "1.0"}; // LordHavoc: framerate independent slowmo
-cvar_t host_minfps = {"host_minfps", "10"}; // LordHavoc: game logic lower cap on framerate (if framerate is below this is, it pretends it is this, so game logic will run normally)
-cvar_t host_maxfps = {"host_maxfps", "1000"}; // LordHavoc: framerate upper cap
+cvar_t host_framerate = {0, "host_framerate","0"}; // set for slow motion
+cvar_t host_speeds = {0, "host_speeds","0"}; // set for running times
+cvar_t slowmo = {0, "slowmo", "1.0"}; // LordHavoc: framerate independent slowmo
+cvar_t host_minfps = {CVAR_SAVE, "host_minfps", "10"}; // LordHavoc: game logic lower cap on framerate (if framerate is below this is, it pretends it is this, so game logic will run normally)
+cvar_t host_maxfps = {CVAR_SAVE, "host_maxfps", "1000"}; // LordHavoc: framerate upper cap
-cvar_t sys_ticrate = {"sys_ticrate","0.05"};
-cvar_t serverprofile = {"serverprofile","0"};
+cvar_t sys_ticrate = {CVAR_SAVE, "sys_ticrate","0.05"};
+cvar_t serverprofile = {0, "serverprofile","0"};
-cvar_t fraglimit = {"fraglimit","0",false,true};
-cvar_t timelimit = {"timelimit","0",false,true};
-cvar_t teamplay = {"teamplay","0",false,true};
+cvar_t fraglimit = {CVAR_NOTIFY, "fraglimit","0"};
+cvar_t timelimit = {CVAR_NOTIFY, "timelimit","0"};
+cvar_t teamplay = {CVAR_NOTIFY, "teamplay","0"};
-cvar_t samelevel = {"samelevel","0"};
-cvar_t noexit = {"noexit","0",false,true};
+cvar_t samelevel = {0, "samelevel","0"};
+cvar_t noexit = {CVAR_NOTIFY, "noexit","0"};
-cvar_t developer = {"developer","0"};
+cvar_t developer = {0, "developer","0"};
-cvar_t skill = {"skill","1"}; // 0 - 3
-cvar_t deathmatch = {"deathmatch","0"}; // 0, 1, or 2
-cvar_t coop = {"coop","0"}; // 0 or 1
+cvar_t skill = {0, "skill","1"}; // 0 - 3
+cvar_t deathmatch = {0, "deathmatch","0"}; // 0, 1, or 2
+cvar_t coop = {0, "coop","0"}; // 0 or 1
-cvar_t pausable = {"pausable","1"};
+cvar_t pausable = {0, "pausable","1"};
-cvar_t temp1 = {"temp1","0"};
+cvar_t temp1 = {0, "temp1","0"};
-cvar_t timestamps = {"timestamps", "0", true};
-cvar_t timeformat = {"timeformat", "[%b %e %X] ", true};
+cvar_t timestamps = {CVAR_SAVE, "timestamps", "0"};
+cvar_t timeformat = {CVAR_SAVE, "timeformat", "[%b %e %X] "};
/*
================
{
va_list argptr;
char string[1024];
-
+
va_start (argptr,message);
vsprintf (string,message,argptr);
va_end (argptr);
Con_DPrintf ("Host_EndGame: %s\n",string);
-
+
if (sv.active)
Host_ShutdownServer (false);
if (cls.state == ca_dedicated)
Sys_Error ("Host_EndGame: %s\n",string); // dedicated servers exit
-
+
if (cls.demonum != -1)
CL_NextDemo ();
else
// keep the random time dependent
rand ();
-
+
// decide the simulation time
if (!Host_FilterTime (time))
{
Sys_Sleep();
return;
}
-
+
// get new key events
Sys_SendKeyEvents ();
// if running the server locally, make intentions now
if (sv.active)
CL_SendCmd ();
-
+
//-------------------
//
// server operations
// check for commands typed to the host
Host_GetConsoleCommands ();
-
+
if (sv.active)
Host_ServerFrame ();
if (cls.state == ca_connected)
CL_ReadFromServer ();
+ ui_update();
+
// update video
if (host_speeds.value)
time1 = Sys_DoubleTime ();
-
+
SCR_UpdateScreen ();
if (host_speeds.value)
time2 = Sys_DoubleTime ();
-
+
// update audio
if (cls.signon == SIGNONS)
{
}
else
S_Update (vec3_origin, vec3_origin, vec3_origin, vec3_origin);
-
+
CDAudio_Update();
if (host_speeds.value)
Con_Printf ("%6ius total %6ius server %6ius gfx %6ius snd\n",
pass1+pass2+pass3, pass1, pass2, pass3);
}
-
+
host_framecount++;
}
static int mouse_oldbuttonstate;
static float mouse_x, mouse_y;
static float old_mouse_x, old_mouse_y;
-static int mx, my;
+static int mx, my, uimx, uimy;
static void IN_init_kb(void);
static void IN_init_mouse(void);
-cvar_t m_filter = {"m_filter","0"};
+cvar_t m_filter = {CVAR_SAVE, "m_filter","0"};
static void keyhandler(int scancode, int state)
{
static void mousehandler(int buttonstate, int dx, int dy, int dz, int drx, int dry, int drz)
{
mouse_buttonstate = buttonstate;
+ uimx += dx;
+ uimy += dy;
mx += dx;
my += dy;
if (drx > 0) {
if (COM_CheckParm("-nokbd")) UseKeyboard = 0;
if (COM_CheckParm("-nomouse")) UseMouse = 0;
+ uimx = uimy = 0;
if (UseKeyboard)
IN_init_kb();
if (UseMouse)
{
Con_Printf("IN_Shutdown\n");
- if (UseMouse) mouse_close();
- if (UseKeyboard) keyboard_close();
+ if (UseMouse)
+ mouse_close();
+ if (UseKeyboard)
+ keyboard_close();
in_svgalib_inited = 0;
}
void IN_Move(usercmd_t *cmd)
{
int mouselook = (in_mlook.state & 1) || freelook.value;
- if (!UseMouse) return;
+ if (!UseMouse)
+ return;
/* Poll mouse values */
while (mouse_update())
;
+ if (key_dest != key_game)
+ {
+ ui_mouseupdaterelative(uimx, uimy);
+ uimx = uimy = 0;
+ return;
+ }
+ uimx = uimy = 0;
+
if (m_filter.value)
{
mouse_x = (mx + old_mouse_x) * 0.5;
else
cl.viewangles[YAW] -= m_yaw.value * mouse_x;
- if (mouselook) V_StopPitchDrift();
+ if (mouselook)
+ V_StopPitchDrift();
// LordHavoc: changed limits on pitch from -70 to 80, to -90 to 90
if (mouselook && !(in_strafe.state & 1))
LPDIRECTINPUT * lplpDirectInput, LPUNKNOWN punkOuter);
// mouse variables
-cvar_t m_filter = {"m_filter","0"};
+cvar_t m_filter = {CVAR_SAVE, "m_filter","0"};
int mouse_buttons;
int mouse_oldbuttonstate;
HRESULT hr;
if (!mouseactive)
+ {
+ GetCursorPos (¤t_pos);
+ ui_updatemouse(current_pos.x - window_x, current_pos.y - window_y);
return;
+ }
if (dinput)
{
else
mstate_di &= ~(1<<1);
break;
-
+
case DIMOFS_BUTTON2:
if (od.dwData & 0x80)
mstate_di |= (1<<2);
{
Key_Event (K_MOUSE1 + i, false);
}
- }
-
+ }
+
mouse_oldbuttonstate = mstate_di;
}
else
#SND=snd_oss.o
#SOUNDLIB=
-OBJECTS= buildnumber.o cd_linux.o chase.o cl_demo.o cl_input.o cl_main.o cl_parse.o cl_tent.o cmd.o common.o console.o crc.o cvar.o fractalnoise.o gl_draw.o gl_poly.o gl_rmain.o gl_rmisc.o gl_rsurf.o gl_screen.o gl_warp.o host.o host_cmd.o image.o keys.o mathlib.o menu.o model_alias.o model_brush.o model_shared.o model_sprite.o net_bsd.o net_udp.o net_dgrm.o net_loop.o net_main.o pr_cmds.o pr_edict.o pr_exec.o r_light.o r_part.o r_explosion.o sbar.o snd_dma.o snd_mem.o snd_mix.o $(SND) sv_main.o sv_move.o sv_phys.o sv_user.o sv_light.o sys_linux.o transform.o view.o wad.o world.o zone.o vid_shared.o palette.o r_crosshairs.o gl_textures.o gl_models.o r_sprites.o r_modules.o r_explosion.o r_lerpanim.o cl_effects.o r_decals.o protocol.o quakeio.o r_clip.o
+OBJECTS= buildnumber.o cd_linux.o chase.o cl_demo.o cl_input.o cl_main.o cl_parse.o cl_tent.o cmd.o common.o console.o crc.o cvar.o fractalnoise.o gl_draw.o gl_poly.o gl_rmain.o gl_rmisc.o gl_rsurf.o gl_screen.o gl_warp.o host.o host_cmd.o image.o keys.o mathlib.o menu.o model_alias.o model_brush.o model_shared.o model_sprite.o net_bsd.o net_udp.o net_dgrm.o net_loop.o net_main.o pr_cmds.o pr_edict.o pr_exec.o r_light.o r_part.o r_explosion.o sbar.o snd_dma.o snd_mem.o snd_mix.o $(SND) sv_main.o sv_move.o sv_phys.o sv_user.o sv_light.o sys_linux.o transform.o view.o wad.o world.o zone.o vid_shared.o palette.o r_crosshairs.o gl_textures.o gl_models.o r_sprites.o r_modules.o r_explosion.o r_lerpanim.o cl_effects.o r_decals.o protocol.o quakeio.o r_clip.o ui.o portals.o
#K6/athlon optimizations
CPUOPTIMIZATIONS=-march=k6
#this is used to ensure that all released versions are free of warnings.
#normal compile
-#OPTIMIZATIONS= -O6 -ffast-math -funroll-loops $(NOPROFILEOPTIMIZATIONS) -fexpensive-optimizations $(CPUOPTIMIZATIONS)
-#CFLAGS= -MD -Wall -Werror -I/usr/X11R6/include -I/usr/include/glide $(OPTIMIZATIONS) $(PROFILEOPTION)
+OPTIMIZATIONS= -O6 -ffast-math -funroll-loops $(NOPROFILEOPTIMIZATIONS) -fexpensive-optimizations $(CPUOPTIMIZATIONS)
+CFLAGS= -MD -Wall -Werror -I/usr/X11R6/include -I/usr/include/glide $(OPTIMIZATIONS) $(PROFILEOPTION)
#debug compile
-OPTIMIZATIONS= -O -g
-CFLAGS= -MD -Wall -Werror -I/usr/X11R6/include -ggdb $(OPTIMIZATIONS) $(PROFILEOPTION)
+#OPTIMIZATIONS= -O -g
+#CFLAGS= -MD -Wall -Werror -I/usr/X11R6/include -ggdb $(OPTIMIZATIONS) $(PROFILEOPTION)
LDFLAGS= -L/usr/X11R6/lib -lm -lX11 -lXext -lXIE -lXxf86dga -lXxf86vm -lGL -ldl $(SOUNDLIB) -lz $(PROFILEOPTION)
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
#include "quakedef.h"
-cvar_t r_mipskins = {"r_mipskins", "1", true};
+cvar_t r_mipskins = {CVAR_SAVE, "r_mipskins", "1"};
/*
===============
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
qboolean hlbsp; // LordHavoc: true if it is a HalfLife BSP file (version 30)
-cvar_t gl_subdivide_size = {"gl_subdivide_size", "128", true};
-cvar_t halflifebsp = {"halflifebsp", "0"};
-cvar_t r_novis = {"r_novis", "0"};
+cvar_t gl_subdivide_size = {CVAR_SAVE, "gl_subdivide_size", "128"};
+cvar_t halflifebsp = {0, "halflifebsp", "0"};
+cvar_t r_novis = {0, "r_novis", "0"};
/*
===============
// leaf specific
// int visframe; // visible if current (r_framecount)
// int worldnodeframe; // used by certain worldnode variants to avoid processing the same leaf twice in a frame
+ int portalmarkid; // used by polygon-through-portals visibility checker
// for bounding box culling
vec3_t mins;
#include "quakedef.h"
-cvar_t r_mipsprites = {"r_mipsprites", "1", true};
+cvar_t r_mipsprites = {CVAR_SAVE, "r_mipsprites", "1"};
/*
===============
Mod_LoadSpriteFrame
=================
*/
-void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t *frame, int framenum, int bytesperpixel)
+void * Mod_LoadSpriteFrame (void * pin, mspriteframe_t *frame, int framenum, int bytesperpixel, byte *palette)
{
dspriteframe_t *pinframe;
mspriteframe_t *pspriteframe;
sprintf (name, "%s_%i", tempname, framenum);
pspriteframe->texture = loadtextureimagewithmask(name, 0, 0, false, r_mipsprites.value, true);
pspriteframe->fogtexture = image_masktex;
- if (!pspriteframe->texture)
+
+ pixbuf = qmalloc(width*height*4);
+
+ inpixel = (byte *)(pinframe + 1);
+ pixel = pixbuf;
+ if (bytesperpixel == 1)
{
- pspriteframe->texture = R_LoadTexture (name, width, height, (byte *)(pinframe + 1), TEXF_ALPHA | (bytesperpixel > 1 ? TEXF_RGBA : 0) | (r_mipsprites.value ? TEXF_MIPMAP : 0) | TEXF_PRECACHE);
- // make fog version (just alpha)
- pixbuf = pixel = qmalloc(width*height*4);
- inpixel = (byte *)(pinframe + 1);
- if (bytesperpixel == 1)
+ for (i = 0;i < width * height;i++)
{
- for (i = 0;i < width*height;i++)
- {
- *pixel++ = 255;
- *pixel++ = 255;
- *pixel++ = 255;
- if (*inpixel++ != 255)
- *pixel++ = 255;
- else
- *pixel++ = 0;
- }
+ *pixel++ = palette[inpixel[i]*4+0];
+ *pixel++ = palette[inpixel[i]*4+1];
+ *pixel++ = palette[inpixel[i]*4+2];
+ *pixel++ = palette[inpixel[i]*4+3];
}
- else
+ }
+ else
+ memcpy(pixel, inpixel, width*height*4);
+
+ if (!pspriteframe->texture)
+ {
+ pspriteframe->texture = R_LoadTexture (name, width, height, pixbuf, TEXF_ALPHA | TEXF_RGBA | (r_mipsprites.value ? TEXF_MIPMAP : 0) | TEXF_PRECACHE);
+ // make fog version (just alpha)
+ pixel = pixbuf;
+ for (i = 0;i < width*height;i++)
{
- inpixel+=3;
- for (i = 0;i < width*height;i++)
- {
- *pixel++ = 255;
- *pixel++ = 255;
- *pixel++ = 255;
- *pixel++ = *inpixel;
- inpixel+=4;
- }
+ *pixel++ = 255;
+ *pixel++ = 255;
+ *pixel++ = 255;
+ pixel++;
}
sprintf (name, "%s_%ifog", loadmodel->name, framenum);
pspriteframe->fogtexture = R_LoadTexture (name, width, height, pixbuf, TEXF_ALPHA | TEXF_RGBA | (r_mipsprites.value ? TEXF_MIPMAP : 0) | TEXF_PRECACHE);
- qfree(pixbuf);
}
+ qfree(pixbuf);
+
return (void *)((byte *)pinframe + sizeof (dspriteframe_t) + size);
}
Mod_LoadSpriteGroup
=================
*/
+/*
void *Mod_LoadSpriteGroup (void * pin, mspriteframe_t *frame, int numframes, int framenum, int bytesperpixel)
{
int i;
return ptemp;
}
-
-
-/*
-=================
-Mod_LoadSpriteModel
-=================
*/
-void Mod_LoadSpriteModel (model_t *mod, void *buffer)
+
+// this actually handles both quake sprite and darkplaces sprite32
+void Mod_LoadQuakeSprite (model_t *mod, void *buffer)
{
int i, j, version, numframes, realframes, size, bytesperpixel, start, end, total, maxwidth, maxheight;
dsprite_t *pin;
pin = (dsprite_t *)buffer;
version = LittleLong (pin->version);
- if (version == 2)
- {
- version = 32;
- Con_Printf("warning: %s is a version 2 sprite (RGBA), supported for now, please hex edit to version 32 incase HalfLife sprites might be supported at some point.\n", mod->name);
- }
// LordHavoc: 32bit textures
- if (version != SPRITE_VERSION && version != SPRITE32_VERSION)
- Host_Error ("%s has wrong version number (%i should be %i or %i)", mod->name, version, SPRITE_VERSION, SPRITE32_VERSION);
bytesperpixel = 1;
if (version == SPRITE32_VERSION)
bytesperpixel = 4;
mod->maxs[0] = mod->maxs[1] = maxwidth/2;
mod->mins[2] = -maxheight/2;
mod->maxs[2] = maxheight/2;
-
+
//
// load the frames
//
if (numframes < 1)
- Host_Error ("Mod_LoadSpriteModel: Invalid # of frames: %d\n", numframes);
+ Host_Error ("Mod_LoadQuakeSprite: Invalid # of frames: %d\n", numframes);
mod->numframes = numframes;
{
for (j = 0;j < animscenes[i].framecount;j++)
{
- Mod_LoadSpriteFrame (framedata[realframes], frames + realframes, i, bytesperpixel);
+ Mod_LoadSpriteFrame (framedata[realframes], frames + realframes, i, bytesperpixel, (byte *)&d_8to24table);
+ realframes++;
+ }
+ }
+
+ psprite->ofs_frames = (int) frames - (int) psprite;
+
+ qfree(framedata);
+
+ mod->type = mod_sprite;
+
+// move the complete, relocatable sprite model to the cache
+ end = Hunk_LowMark ();
+ mod->cachesize = total = end - start;
+
+ Cache_Alloc (&mod->cache, total, loadname);
+ if (!mod->cache.data)
+ return;
+ memcpy (mod->cache.data, psprite, total);
+
+ Hunk_FreeToLowMark (start);
+}
+
+void Mod_LoadHLSprite (model_t *mod, void *buffer)
+{
+ int i, j, numframes, realframes, size, start, end, total, maxwidth, maxheight, rendermode;
+ byte palette[256][4], *in;
+ dspritehl_t *pin;
+ msprite_t *psprite;
+ dspriteframetype_t *pframetype;
+ dspriteframe_t *pframe;
+ animscene_t *animscenes;
+ mspriteframe_t *frames;
+ dspriteframe_t **framedata;
+
+ start = Hunk_LowMark ();
+
+ mod->flags = EF_FULLBRIGHT;
+
+ // build a list of frames while parsing
+ framedata = qmalloc(65536*sizeof(dspriteframe_t));
+
+ pin = (dspritehl_t *)buffer;
+
+ numframes = LittleLong (pin->numframes);
+
+ psprite = Hunk_AllocName (sizeof(msprite_t), va("%s info", loadname));
+
+ psprite->type = LittleLong (pin->type);
+ maxwidth = LittleLong (pin->width);
+ maxheight = LittleLong (pin->height);
+ mod->synctype = LittleLong (pin->synctype);
+ rendermode = pin->rendermode;
+
+ mod->mins[0] = mod->mins[1] = -maxwidth/2;
+ mod->maxs[0] = mod->maxs[1] = maxwidth/2;
+ mod->mins[2] = -maxheight/2;
+ mod->maxs[2] = maxheight/2;
+
+//
+// load the frames
+//
+ if (numframes < 1)
+ Host_Error ("Mod_LoadHLSprite: Invalid # of frames: %d\n", numframes);
+
+ mod->numframes = numframes;
+
+ in = (byte *)(pin + 1);
+ i = in[0] + in[1] * 256;
+ if (i != 256)
+ Host_Error ("Mod_LoadHLSprite: unexpected number of palette colors %i (should be 256)", i);
+ in += 2;
+ switch(rendermode)
+ {
+ case SPRHL_NORMAL:
+ for (i = 0;i < 256;i++)
+ {
+ palette[i][0] = *in++;
+ palette[i][1] = *in++;
+ palette[i][2] = *in++;
+ palette[i][3] = 255;
+ }
+ palette[255][0] = palette[255][1] = palette[255][2] = palette[255][3] = 0;
+ break;
+ case SPRHL_ADDITIVE:
+ for (i = 0;i < 256;i++)
+ {
+ palette[i][0] = *in++;
+ palette[i][1] = *in++;
+ palette[i][2] = *in++;
+ palette[i][3] = 255;
+ }
+// palette[255][0] = palette[255][1] = palette[255][2] = palette[255][3] = 0;
+ mod->flags |= EF_ADDITIVE;
+ break;
+ case SPRHL_INDEXALPHA:
+ for (i = 0;i < 256;i++)
+ {
+ palette[i][0] = 255;
+ palette[i][1] = 255;
+ palette[i][2] = 255;
+ palette[i][3] = i;
+ in += 3;
+ }
+ break;
+ case SPRHL_ALPHATEST:
+ for (i = 0;i < 256;i++)
+ {
+ palette[i][0] = *in++;
+ palette[i][1] = *in++;
+ palette[i][2] = *in++;
+ palette[i][3] = 255;
+ }
+ palette[0][0] = palette[0][1] = palette[0][2] = palette[0][3] = 0;
+ break;
+ default:
+ Host_Error("Mod_LoadHLSprite: unknown texFormat (%i, should be 0, 1, 2, or 3)\n", i);
+ return;
+ }
+
+ pframetype = (dspriteframetype_t *)in;
+
+ animscenes = Hunk_AllocName(sizeof(animscene_t) * mod->numframes, va("%s sceneinfo", loadname));
+
+ realframes = 0;
+
+ for (i = 0;i < numframes;i++)
+ {
+ spriteframetype_t frametype;
+
+ frametype = LittleLong (pframetype->type);
+
+ sprintf(animscenes[i].name, "frame%i", i);
+ animscenes[i].firstframe = realframes;
+ animscenes[i].loop = true;
+ if (frametype == SPR_SINGLE)
+ {
+ animscenes[i].framecount = 1;
+ animscenes[i].framerate = 10;
+ pframe = (dspriteframe_t *) (pframetype + 1);
+ framedata[realframes] = pframe;
+ size = LittleLong(pframe->width) * LittleLong(pframe->height);
+ pframetype = (dspriteframetype_t *) (size + sizeof(dspriteframe_t) + (int) pframe);
+ realframes++;
+ }
+ else
+ {
+ j = LittleLong(((dspritegroup_t *) (sizeof(dspriteframetype_t) + (int) pframetype))->numframes);
+ animscenes[i].framecount = j;
+ // FIXME: support variable framerate?
+ animscenes[i].framerate = 1.0f / LittleFloat(((dspriteinterval_t *) (sizeof(dspritegroup_t) + sizeof(dspriteframetype_t) + (int) pframetype))->interval);
+ pframe = (dspriteframe_t *) (sizeof(dspriteinterval_t) * j + sizeof(dspritegroup_t) + sizeof(dspriteframetype_t) + (int) pframetype);
+ while (j--)
+ {
+ framedata[realframes] = pframe;
+ size = LittleLong(pframe->width) * LittleLong(pframe->height);
+ pframe = (dspriteframe_t *) (size + sizeof(dspriteframe_t) + (int) pframe);
+ realframes++;
+ }
+ pframetype = (dspriteframetype_t *) pframe;
+ }
+ }
+
+ mod->ofs_scenes = (int) animscenes - (int) psprite;
+
+ frames = Hunk_AllocName(sizeof(mspriteframe_t) * realframes, va("%s frames", loadname));
+
+ realframes = 0;
+ for (i = 0;i < numframes;i++)
+ {
+ for (j = 0;j < animscenes[i].framecount;j++)
+ {
+ Mod_LoadSpriteFrame (framedata[realframes], frames + realframes, i, 1, &palette[0][0]);
realframes++;
}
}
// move the complete, relocatable sprite model to the cache
end = Hunk_LowMark ();
mod->cachesize = total = end - start;
-
+
Cache_Alloc (&mod->cache, total, loadname);
if (!mod->cache.data)
return;
Hunk_FreeToLowMark (start);
}
+
+
+/*
+=================
+Mod_LoadSpriteModel
+=================
+*/
+void Mod_LoadSpriteModel (model_t *mod, void *buffer)
+{
+ int version;
+ version = ((dsprite_t *)buffer)->version;
+ switch(version)
+ {
+ case SPRITEHL_VERSION:
+ Mod_LoadHLSprite (mod, buffer);
+ break;
+ case SPRITE_VERSION:
+ case SPRITE32_VERSION:
+ Mod_LoadQuakeSprite(mod, buffer);
+ break;
+ default:
+ Host_Error ("Mod_LoadSpriteModel: %s has wrong version number (%i should be 1 (quake) or 32 (sprite32) or 2 (halflife)", mod->name, version);
+ break;
+ }
+}
// search for the next server cvar
while (var)
{
- if (var->server)
+ if (var->flags & CVAR_NOTIFY)
break;
var = var->next;
}
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
int unreliableMessagesSent = 0;
int unreliableMessagesReceived = 0;
-cvar_t net_messagetimeout = {"net_messagetimeout","300"};
-cvar_t hostname = {"hostname", "UNNAMED"};
+cvar_t net_messagetimeout = {0, "net_messagetimeout","300"};
+cvar_t hostname = {CVAR_SAVE, "hostname", "UNNAMED"};
qboolean configRestored = false;
static float texture_gamma = 1.0;
-cvar_t vid_gamma = {"vid_gamma", "1", true};
-cvar_t vid_brightness = {"vid_brightness", "1", true};
-cvar_t vid_contrast = {"vid_contrast", "1", true};
+cvar_t vid_gamma = {CVAR_SAVE, "vid_gamma", "1"};
+cvar_t vid_brightness = {CVAR_SAVE, "vid_brightness", "1"};
+cvar_t vid_contrast = {CVAR_SAVE, "vid_contrast", "1"};
void Palette_Setup8to24(void)
{
--- /dev/null
+
+#include "quakedef.h"
+
+#define MAXRECURSIVEPORTALPLANES 1024
+#define MAXRECURSIVEPORTALS 256
+
+tinyplane_t portalplanes[MAXRECURSIVEPORTALPLANES];
+int portalplanestack[MAXRECURSIVEPORTALS];
+int portalplanecount;
+int ranoutofportalplanes;
+int ranoutofportals;
+
+int R_ClipPolygonToPlane(float *in, float *out, int inpoints, int maxoutpoints, tinyplane_t *p)
+{
+ int i, outpoints, prevside, side;
+ float *prevpoint, prevdist, dist, dot;
+
+ if (inpoints < 3)
+ return inpoints;
+ // begin with the last point, then enter the loop with the first point as current
+ prevpoint = in + 3 * (inpoints - 1);
+ prevdist = DotProduct(prevpoint, p->normal) - p->dist;
+ prevside = prevdist >= 0 ? SIDE_FRONT : SIDE_BACK;
+ i = 0;
+ outpoints = 0;
+ goto begin;
+ for (;i < inpoints;i++)
+ {
+ prevpoint = in;
+ prevdist = dist;
+ prevside = side;
+ in += 3;
+
+begin:
+ dist = DotProduct(in, p->normal) - p->dist;
+ side = dist >= 0 ? SIDE_FRONT : SIDE_BACK;
+
+ if (prevside == SIDE_FRONT)
+ {
+ if (outpoints >= maxoutpoints)
+ return -1;
+ VectorCopy(prevpoint, out);
+ out += 3;
+ outpoints++;
+ if (side == SIDE_FRONT)
+ continue;
+ }
+ else if (side == SIDE_BACK)
+ continue;
+
+ // generate a split point
+ if (outpoints >= maxoutpoints)
+ return -1;
+ dot = prevdist / (prevdist - dist);
+ out[0] = prevpoint[0] + dot * (in[0] - prevpoint[0]);
+ out[1] = prevpoint[1] + dot * (in[1] - prevpoint[1]);
+ out[2] = prevpoint[2] + dot * (in[2] - prevpoint[2]);
+ out += 3;
+ outpoints++;
+ }
+
+ return outpoints;
+}
+
+float portaltemppoints[2][256][3];
+float portaltemppoints2[256][3];
+
+/*
+void R_TriangleToPlane(vec3_t point1, vec3_t point2, vec3_t point3, tinyplane_t *p)
+{
+ vec3_t v1, v2;
+ VectorSubtract(point1, point2, v1);
+ VectorSubtract(point3, point2, v2);
+ CrossProduct(v1, v2, p->normal);
+// VectorNormalize(p->normal);
+ VectorNormalizeFast(p->normal);
+ p->dist = DotProduct(point1, p->normal);
+}
+*/
+
+int R_PortalThroughPortalPlanes(tinyplane_t *clipplanes, int clipnumplanes, float *targpoints, int targnumpoints, float *out, int maxpoints)
+{
+ int numpoints, i;
+ if (targnumpoints < 3)
+ return targnumpoints;
+ if (maxpoints < 3)
+ return -1;
+ numpoints = targnumpoints;
+ memcpy(&portaltemppoints[0][0][0], targpoints, numpoints * 3 * sizeof(float));
+ for (i = 0;i < clipnumplanes;i++)
+ {
+ numpoints = R_ClipPolygonToPlane(&portaltemppoints[0][0][0], &portaltemppoints[1][0][0], numpoints, 256, clipplanes + i);
+ if (numpoints < 3)
+ return numpoints;
+ memcpy(&portaltemppoints[0][0][0], &portaltemppoints[1][0][0], numpoints * 3 * sizeof(float));
+ }
+ if (numpoints > maxpoints)
+ return -1;
+ memcpy(out, &portaltemppoints[1][0][0], numpoints * 3 * sizeof(float));
+ return numpoints;
+}
+
+static int portal_markid = 0;
+
+int Portal_RecursiveFlowSearch (mleaf_t *leaf, vec3_t eye, int firstclipplane, int numclipplanes)
+{
+ mportal_t *p;
+
+ if (leaf->portalmarkid == portal_markid)
+ return true;
+
+ // follow portals into other leafs
+ for (p = leaf->portals;p;p = p->next)
+ {
+ int newpoints, i, prev;
+ vec3_t center;
+ vec3_t v1, v2;
+ tinyplane_t *newplanes;
+ // only flow through portals facing away from the viewer
+ if (PlaneDiff(eye, (&p->plane)) < 0)
+ {
+ newpoints = R_PortalThroughPortalPlanes(&portalplanes[firstclipplane], numclipplanes, (float *) p->points, p->numpoints, &portaltemppoints2[0][0], 256);
+ if (newpoints < 3)
+ continue;
+ else if (firstclipplane + numclipplanes + newpoints > MAXRECURSIVEPORTALPLANES)
+ ranoutofportalplanes = true;
+ else
+ {
+ // find the center by averaging
+ VectorClear(center);
+ for (i = 0;i < newpoints;i++)
+ VectorAdd(center, portaltemppoints2[i], center);
+ // ixtable is a 1.0f / N table
+ VectorScale(center, ixtable[newpoints], center);
+ // calculate the planes, and make sure the polygon can see it's own center
+ newplanes = &portalplanes[firstclipplane + numclipplanes];
+ for (prev = newpoints - 1, i = 0;i < newpoints;prev = i, i++)
+ {
+// R_TriangleToPlane(eye, portaltemppoints2[i], portaltemppoints2[prev], newplanes + i);
+ VectorSubtract(eye, portaltemppoints2[i], v1);
+ VectorSubtract(portaltemppoints2[prev], portaltemppoints2[i], v2);
+ CrossProduct(v1, v2, newplanes[i].normal);
+ VectorNormalizeFast(newplanes[i].normal);
+ newplanes[i].dist = DotProduct(eye, newplanes[i].normal);
+ if (DotProduct(newplanes[i].normal, center) <= newplanes[i].dist)
+ {
+ // polygon can't see it's own center, discard and use parent portal
+ break;
+ }
+ }
+ if (i == newpoints)
+ {
+ if (Portal_RecursiveFlowSearch(p->past, eye, firstclipplane + numclipplanes, newpoints))
+ return true;
+ }
+ else
+ {
+ if (Portal_RecursiveFlowSearch(p->past, eye, firstclipplane, numclipplanes))
+ return true;
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+//float viewportalpoints[16*3];
+
+void Portal_PolygonRecursiveMarkLeafs(mnode_t *node, float *polypoints, int numpoints)
+{
+ int i, front;
+ float *p;
+
+loc0:
+ if (node->contents < 0)
+ {
+ ((mleaf_t *)node)->portalmarkid = portal_markid;
+ return;
+ }
+
+ front = 0;
+ for (i = 0, p = polypoints;i < numpoints;i++, p += 3)
+ {
+ if (DotProduct(p, node->plane->normal) > node->plane->dist)
+ front++;
+ }
+ if (front > 0)
+ {
+ if (front == numpoints)
+ {
+ node = node->children[0];
+ goto loc0;
+ }
+ else
+ Portal_PolygonRecursiveMarkLeafs(node->children[0], polypoints, numpoints);
+ }
+ node = node->children[1];
+ goto loc0;
+}
+
+int Portal_CheckPolygon(model_t *model, vec3_t eye, float *polypoints, int numpoints)
+{
+ int i, prev, returnvalue;
+ mleaf_t *eyeleaf;
+ vec3_t center, v1, v2;
+
+ portal_markid++;
+
+ Portal_PolygonRecursiveMarkLeafs(model->nodes, polypoints, numpoints);
+
+ eyeleaf = Mod_PointInLeaf(eye, model);
+
+ // find the center by averaging
+ VectorClear(center);
+ for (i = 0;i < numpoints;i++)
+ VectorAdd(center, (&polypoints[i * 3]), center);
+ // ixtable is a 1.0f / N table
+ VectorScale(center, ixtable[numpoints], center);
+
+ // calculate the planes, and make sure the polygon can see it's own center
+ for (prev = numpoints - 1, i = 0;i < numpoints;prev = i, i++)
+ {
+// R_TriangleToPlane(eye, portaltemppoints2[i], portaltemppoints2[prev], newplanes + i);
+ VectorSubtract(eye, (&polypoints[i * 3]), v1);
+ VectorSubtract((&polypoints[prev * 3]), (&polypoints[i * 3]), v2);
+ CrossProduct(v1, v2, portalplanes[i].normal);
+ VectorNormalizeFast(portalplanes[i].normal);
+ portalplanes[i].dist = DotProduct(eye, portalplanes[i].normal);
+ if (DotProduct(portalplanes[i].normal, center) <= portalplanes[i].dist)
+ {
+ // polygon can't see it's own center, discard
+ return false;
+ }
+ }
+
+ portalplanecount = 0;
+ ranoutofportalplanes = false;
+ ranoutofportals = false;
+
+ returnvalue = Portal_RecursiveFlowSearch(eyeleaf, eye, 0, numpoints);
+
+ if (ranoutofportalplanes)
+ Con_Printf("Portal_RecursiveFlowSearch: ran out of %d plane stack when recursing through portals\n", MAXRECURSIVEPORTALPLANES);
+ if (ranoutofportals)
+ Con_Printf("Portal_RecursiveFlowSearch: ran out of %d portal stack when recursing through portals\n", MAXRECURSIVEPORTALS);
+
+ return returnvalue;
+}
+
+float boxpoints[4*3];
+
+#define Portal_MinsBoxPolygon(axis, axisvalue, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4) \
+{\
+ if (eye[(axis)] < ((axisvalue) - 0.5f))\
+ {\
+ boxpoints[ 0] = x1;boxpoints[ 1] = y1;boxpoints[ 2] = z1;\
+ boxpoints[ 3] = x2;boxpoints[ 4] = y2;boxpoints[ 5] = z2;\
+ boxpoints[ 6] = x3;boxpoints[ 7] = y3;boxpoints[ 8] = z3;\
+ boxpoints[ 9] = x4;boxpoints[10] = y4;boxpoints[11] = z4;\
+ if (Portal_CheckPolygon(model, eye, boxpoints, 4))\
+ return true;\
+ }\
+}
+
+#define Portal_MaxsBoxPolygon(axis, axisvalue, x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4) \
+{\
+ if (eye[(axis)] > ((axisvalue) + 0.5f))\
+ {\
+ boxpoints[ 0] = x1;boxpoints[ 1] = y1;boxpoints[ 2] = z1;\
+ boxpoints[ 3] = x2;boxpoints[ 4] = y2;boxpoints[ 5] = z2;\
+ boxpoints[ 6] = x3;boxpoints[ 7] = y3;boxpoints[ 8] = z3;\
+ boxpoints[ 9] = x4;boxpoints[10] = y4;boxpoints[11] = z4;\
+ if (Portal_CheckPolygon(model, eye, boxpoints, 4))\
+ return true;\
+ }\
+}
+
+int Portal_CheckBox(model_t *model, vec3_t eye, vec3_t a, vec3_t b)
+{
+ if (eye[0] >= (a[0] - 1.0f) && eye[0] < (b[0] + 1.0f)
+ && eye[1] >= (a[1] - 1.0f) && eye[1] < (b[1] + 1.0f)
+ && eye[2] >= (a[2] - 1.0f) && eye[2] < (b[2] + 1.0f))
+ {
+ return true;
+ }
+
+ Portal_MinsBoxPolygon
+ (
+ 0, a[0],
+ a[0], a[1], a[2],
+ a[0], b[1], a[2],
+ a[0], b[1], b[2],
+ a[0], a[1], b[2]
+ );
+ Portal_MaxsBoxPolygon
+ (
+ 0, b[0],
+ b[0], b[1], a[2],
+ b[0], a[1], a[2],
+ b[0], a[1], b[2],
+ b[0], b[1], b[2]
+ );
+ Portal_MinsBoxPolygon
+ (
+ 1, a[1],
+ b[0], a[1], a[2],
+ a[0], a[1], a[2],
+ a[0], a[1], b[2],
+ b[0], a[1], b[2]
+ );
+ Portal_MaxsBoxPolygon
+ (
+ 1, b[1],
+ a[0], b[1], a[2],
+ b[0], b[1], a[2],
+ b[0], b[1], b[2],
+ a[0], b[1], b[2]
+ );
+ Portal_MinsBoxPolygon
+ (
+ 2, a[2],
+ a[0], a[1], a[2],
+ b[0], a[1], a[2],
+ b[0], b[1], a[2],
+ a[0], b[1], a[2]
+ );
+ Portal_MaxsBoxPolygon
+ (
+ 2, b[2],
+ b[0], a[1], b[2],
+ a[0], a[1], b[2],
+ a[0], b[1], b[2],
+ b[0], b[1], b[2]
+ );
+
+ return false;
+}
--- /dev/null
+
+int Portal_CheckPolygon(model_t *model, vec3_t eye, float *polypoints, int numpoints);
+int Portal_CheckBox(model_t *model, vec3_t eye, vec3_t a, vec3_t b);
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
#include "quakedef.h"
+cvar_t sv_aim = {CVAR_SAVE, "sv_aim", "2"}; //"0.93"}; // LordHavoc: disabled autoaim by default
+
#define RETURN_EDICT(e) (((int *)pr_globals)[OFS_RETURN] = EDICT_TO_PROG(e))
{
int i;
static char out[256];
-
+
out[0] = 0;
for (i=first ; i<pr_argc ; i++)
{
{
float *value1;
float new;
-
+
value1 = G_VECTOR(OFS_PARM0);
new = value1[0] * value1[0] + value1[1] * value1[1] + value1[2]*value1[2];
if (sv.state != ss_loading)
PR_RunError ("PF_Precache_*: Precache can only be done in spawn functions");
-
+
s = G_STRING(OFS_PARM0);
G_INT(OFS_RETURN) = G_INT(OFS_PARM0);
PR_CheckEmptyString (s);
vector aim(entity, missilespeed)
=============
*/
-cvar_t sv_aim = {"sv_aim", "0.93"};
void PF_aim (void)
{
edict_t *ent, *check, *bestent;
ddef_t *ED_FieldAtOfs (int ofs);
qboolean ED_ParseEpair (void *base, ddef_t *key, char *s);
-cvar_t pr_checkextension = {"pr_checkextension", "1"};
-cvar_t nomonsters = {"nomonsters", "0"};
-cvar_t gamecfg = {"gamecfg", "0"};
-cvar_t scratch1 = {"scratch1", "0"};
-cvar_t scratch2 = {"scratch2", "0"};
-cvar_t scratch3 = {"scratch3", "0"};
-cvar_t scratch4 = {"scratch4", "0"};
-cvar_t savedgamecfg = {"savedgamecfg", "0", true};
-cvar_t saved1 = {"saved1", "0", true};
-cvar_t saved2 = {"saved2", "0", true};
-cvar_t saved3 = {"saved3", "0", true};
-cvar_t saved4 = {"saved4", "0", true};
-cvar_t decors = {"decors", "0"};
-cvar_t nehx00 = {"nehx00", "0"};cvar_t nehx01 = {"nehx01", "0"};
-cvar_t nehx02 = {"nehx02", "0"};cvar_t nehx03 = {"nehx03", "0"};
-cvar_t nehx04 = {"nehx04", "0"};cvar_t nehx05 = {"nehx05", "0"};
-cvar_t nehx06 = {"nehx06", "0"};cvar_t nehx07 = {"nehx07", "0"};
-cvar_t nehx08 = {"nehx08", "0"};cvar_t nehx09 = {"nehx09", "0"};
-cvar_t nehx10 = {"nehx10", "0"};cvar_t nehx11 = {"nehx11", "0"};
-cvar_t nehx12 = {"nehx12", "0"};cvar_t nehx13 = {"nehx13", "0"};
-cvar_t nehx14 = {"nehx14", "0"};cvar_t nehx15 = {"nehx15", "0"};
-cvar_t nehx16 = {"nehx16", "0"};cvar_t nehx17 = {"nehx17", "0"};
-cvar_t nehx18 = {"nehx18", "0"};cvar_t nehx19 = {"nehx19", "0"};
-cvar_t cutscene = {"cutscene", "1"};
+cvar_t pr_checkextension = {0, "pr_checkextension", "1"};
+cvar_t nomonsters = {0, "nomonsters", "0"};
+cvar_t gamecfg = {0, "gamecfg", "0"};
+cvar_t scratch1 = {0, "scratch1", "0"};
+cvar_t scratch2 = {0,"scratch2", "0"};
+cvar_t scratch3 = {0, "scratch3", "0"};
+cvar_t scratch4 = {0, "scratch4", "0"};
+cvar_t savedgamecfg = {CVAR_SAVE, "savedgamecfg", "0"};
+cvar_t saved1 = {CVAR_SAVE, "saved1", "0"};
+cvar_t saved2 = {CVAR_SAVE, "saved2", "0"};
+cvar_t saved3 = {CVAR_SAVE, "saved3", "0"};
+cvar_t saved4 = {CVAR_SAVE, "saved4", "0"};
+cvar_t decors = {0, "decors", "0"};
+cvar_t nehx00 = {0, "nehx00", "0"};cvar_t nehx01 = {0, "nehx01", "0"};
+cvar_t nehx02 = {0, "nehx02", "0"};cvar_t nehx03 = {0, "nehx03", "0"};
+cvar_t nehx04 = {0, "nehx04", "0"};cvar_t nehx05 = {0, "nehx05", "0"};
+cvar_t nehx06 = {0, "nehx06", "0"};cvar_t nehx07 = {0, "nehx07", "0"};
+cvar_t nehx08 = {0, "nehx08", "0"};cvar_t nehx09 = {0, "nehx09", "0"};
+cvar_t nehx10 = {0, "nehx10", "0"};cvar_t nehx11 = {0, "nehx11", "0"};
+cvar_t nehx12 = {0, "nehx12", "0"};cvar_t nehx13 = {0, "nehx13", "0"};
+cvar_t nehx14 = {0, "nehx14", "0"};cvar_t nehx15 = {0, "nehx15", "0"};
+cvar_t nehx16 = {0, "nehx16", "0"};cvar_t nehx17 = {0, "nehx17", "0"};
+cvar_t nehx18 = {0, "nehx18", "0"};cvar_t nehx19 = {0, "nehx19", "0"};
+cvar_t cutscene = {0, "cutscene", "1"};
// LordHavoc: optional runtime bounds checking (speed drain, but worth it for security, on by default - breaks most QCCX features (used by CRMod and others))
-cvar_t pr_boundscheck = {"pr_boundscheck", "1"};
+cvar_t pr_boundscheck = {0, "pr_boundscheck", "1"};
#define MAX_FIELD_LEN 64
#define GEFV_CACHESIZE 2
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
*/
// quakedef.h -- primary header for client
-#define QUAKE_GAME // as opposed to utilities
+#define QUAKE_GAME // as opposed to utilities
+
+#define VERSION 1.50
-#define VERSION 1.50
extern int buildnumber;
#ifndef FALSE
#include "glquake.h"
+#include "ui.h"
+
+#include "portals.h"
+
//=============================================================================
// the host system specifies the base of the directory tree, the
clipedge_t edgehead, edgetail;
clipedge_t maxedge = {2000000000.0f};
-cvar_t r_clipwidth = {"r_clipwidth", "800"};
-cvar_t r_clipheight = {"r_clipheight", "600"};
-cvar_t r_clipedges = {"r_clipedges", "32768", true};
-cvar_t r_clipsurfaces = {"r_clipsurfaces", "8192", true};
+cvar_t r_clipwidth = {0, "r_clipwidth", "800"};
+cvar_t r_clipheight = {0, "r_clipheight", "600"};
+cvar_t r_clipedges = {CVAR_SAVE, "r_clipedges", "32768"};
+cvar_t r_clipsurfaces = {CVAR_SAVE, "r_clipsurfaces", "8192"};
int clipwidth = 0, clipheight = 0;
int maxclipsurfs = 0, maxclipedges = 0;
#include "quakedef.h"
-cvar_t crosshair_brightness = {"crosshair_brightness", "1.0", true};
-cvar_t crosshair_alpha = {"crosshair_alpha", "1.0", true};
-cvar_t crosshair_flashspeed = {"crosshair_flashspeed", "2", true};
-cvar_t crosshair_flashrange = {"crosshair_flashrange", "0.1", true};
+cvar_t crosshair_brightness = {CVAR_SAVE, "crosshair_brightness", "1.0"};
+cvar_t crosshair_alpha = {CVAR_SAVE, "crosshair_alpha", "1.0"};
+cvar_t crosshair_flashspeed = {CVAR_SAVE, "crosshair_flashspeed", "2"};
+cvar_t crosshair_flashrange = {CVAR_SAVE, "crosshair_flashrange", "0.1"};
#define NUMCROSSHAIRS 5
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
decal_t *decals;
int currentdecal; // wraps around in decal array, replacing old ones when a new one is needed
-cvar_t r_drawdecals = {"r_drawdecals", "1"};
-cvar_t r_decals_lighting = {"r_decals_lighting", "1"};
+cvar_t r_drawdecals = {0, "r_drawdecals", "1"};
+cvar_t r_decals_lighting = {0, "r_decals_lighting", "1"};
void r_decals_start(void)
{
rtexture_t *explosiontexture;
rtexture_t *explosiontexturefog;
-cvar_t r_explosionclip = {"r_explosionclip", "0", true};
-cvar_t r_drawexplosions = {"r_drawexplosions", "1"};
+cvar_t r_explosionclip = {CVAR_SAVE, "r_explosionclip", "1"};
+cvar_t r_drawexplosions = {0, "r_drawexplosions", "1"};
int R_ExplosionVert(int column, int row)
{
#include "quakedef.h"
-cvar_t r_lightmodels = {"r_lightmodels", "1"};
+cvar_t r_lightmodels = {0, "r_lightmodels", "1"};
void r_light_start(void)
{
int numparticles;
particle_t **freeparticles; // list used only in compacting particles array
-cvar_t r_particles = {"r_particles", "1", true};
-cvar_t r_drawparticles = {"r_drawparticles", "1"};
-cvar_t r_particles_lighting = {"r_particles_lighting", "1", true};
-cvar_t r_particles_bloodshowers = {"r_particles_bloodshowers", "1", true};
-cvar_t r_particles_blood = {"r_particles_blood", "1", true};
-cvar_t r_particles_smoke = {"r_particles_smoke", "1", true};
-cvar_t r_particles_sparks = {"r_particles_sparks", "1", true};
-cvar_t r_particles_bubbles = {"r_particles_bubbles", "1", true};
+cvar_t r_particles = {CVAR_SAVE, "r_particles", "1"};
+cvar_t r_drawparticles = {0, "r_drawparticles", "1"};
+cvar_t r_particles_lighting = {CVAR_SAVE, "r_particles_lighting", "1"};
+cvar_t r_particles_bloodshowers = {CVAR_SAVE, "r_particles_bloodshowers", "1"};
+cvar_t r_particles_blood = {CVAR_SAVE, "r_particles_blood", "1"};
+cvar_t r_particles_smoke = {CVAR_SAVE, "r_particles_smoke", "1"};
+cvar_t r_particles_sparks = {CVAR_SAVE, "r_particles_sparks", "1"};
+cvar_t r_particles_bubbles = {CVAR_SAVE, "r_particles_bubbles", "1"};
byte shadebubble(float dx, float dy, vec3_t light)
{
{
byte alphaub;
alphaub = bound(0, alpha, 255);
- transpolybegin(R_GetTexture(frame->texture), 0, R_GetTexture(frame->fogtexture), currententity->render.effects & EF_ADDITIVE ? TPOLYTYPE_ADD : TPOLYTYPE_ALPHA);
+ transpolybegin(R_GetTexture(frame->texture), 0, R_GetTexture(frame->fogtexture), ((currententity->render.effects & EF_ADDITIVE) || (currententity->render.model->flags & EF_ADDITIVE)) ? TPOLYTYPE_ADD : TPOLYTYPE_ALPHA);
transpolyvertub(origin[0] + frame->down * up[0] + frame->left * right[0], origin[1] + frame->down * up[1] + frame->left * right[1], origin[2] + frame->down * up[2] + frame->left * right[2], 0, 1, red, green, blue, alphaub);
transpolyvertub(origin[0] + frame->up * up[0] + frame->left * right[0], origin[1] + frame->up * up[1] + frame->left * right[1], origin[2] + frame->up * up[2] + frame->left * right[2], 0, 0, red, green, blue, alphaub);
transpolyvertub(origin[0] + frame->up * up[0] + frame->right * right[0], origin[1] + frame->up * up[1] + frame->right * right[1], origin[2] + frame->up * up[2] + frame->right * right[2], 1, 0, red, green, blue, alphaub);
int sound_started=0;
-cvar_t bgmvolume = {"bgmvolume", "1", true};
-cvar_t volume = {"volume", "0.7", true};
-
-cvar_t nosound = {"nosound", "0"};
-cvar_t precache = {"precache", "1"};
-//cvar_t loadas8bit = {"loadas8bit", "0"};
-cvar_t bgmbuffer = {"bgmbuffer", "4096"};
-cvar_t ambient_level = {"ambient_level", "0.3"};
-cvar_t ambient_fade = {"ambient_fade", "100"};
-cvar_t snd_noextraupdate = {"snd_noextraupdate", "0"};
-cvar_t snd_show = {"snd_show", "0"};
-cvar_t _snd_mixahead = {"_snd_mixahead", "0.1", true};
-cvar_t snd_swapstereo = {"snd_swapstereo", "0", true};
+// FIXME: make bgmvolume/volume always be registered for sake of config saving, and add check for whether sound is enabled to menu
+cvar_t bgmvolume = {CVAR_SAVE, "bgmvolume", "1"};
+cvar_t volume = {CVAR_SAVE, "volume", "0.7"};
+
+cvar_t nosound = {0, "nosound", "0"};
+cvar_t precache = {0, "precache", "1"};
+//cvar_t loadas8bit = {0, "loadas8bit", "0"};
+cvar_t bgmbuffer = {0, "bgmbuffer", "4096"};
+cvar_t ambient_level = {0, "ambient_level", "0.3"};
+cvar_t ambient_fade = {0, "ambient_fade", "100"};
+cvar_t snd_noextraupdate = {0, "snd_noextraupdate", "0"};
+cvar_t snd_show = {0, "snd_show", "0"};
+cvar_t _snd_mixahead = {CVAR_SAVE, "_snd_mixahead", "0.1"};
+cvar_t snd_swapstereo = {CVAR_SAVE, "snd_swapstereo", "0"};
// ====================================================================
//-------------------------------------------------------
#define SPRITE_VERSION 1
-#define HALFLIFESPRITE_VERSION 2
+#define SPRITEHL_VERSION 2
#define SPRITE32_VERSION 32
-// TODO: shorten these?
-typedef struct {
+typedef struct
+{
int ident;
int version;
int type;
synctype_t synctype;
} dsprite_t;
+typedef struct
+{
+ int ident;
+ int version;
+ int type;
+ int rendermode;
+ float boundingradius;
+ int width;
+ int height;
+ int numframes;
+ float beamlength;
+ synctype_t synctype;
+} dspritehl_t;
+
#define SPR_VP_PARALLEL_UPRIGHT 0
#define SPR_FACING_UPRIGHT 1
#define SPR_VP_PARALLEL 2
#define SPR_ORIENTED 3
#define SPR_VP_PARALLEL_ORIENTED 4
+#define SPRHL_NORMAL 0
+#define SPRHL_ADDITIVE 1
+// no idea how to handle these two rendering modes
+#define SPRHL_INDEXALPHA 2
+#define SPRHL_ALPHATEST 3
+
typedef struct {
int origin[2];
int width;
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
#include "quakedef.h"
+cvar_t sv_vischeckentities = {0, "sv_vischeckentities", "1"};
+cvar_t sv_reportvischeckentities = {0, "sv_reportvischeckentities", "0"};
+int sv_vischeckentitycullcount = 0;
+
server_t sv;
server_static_t svs;
Cvar_RegisterVariable (&sv_nostep);
Cvar_RegisterVariable (&sv_predict);
Cvar_RegisterVariable (&sv_deltacompress);
+ Cvar_RegisterVariable (&sv_vischeckentities);
+ Cvar_RegisterVariable (&sv_reportvischeckentities);
for (i = 0;i < MAX_MODELS;i++)
sprintf (localmodels[i], "*%i", i);
=============================================================================
*/
-/*
+/*
==================
SV_StartParticle
int i, v;
if (sv.datagram.cursize > MAX_DATAGRAM-16)
- return;
+ return;
MSG_WriteByte (&sv.datagram, svc_particle);
MSG_WriteFloatCoord (&sv.datagram, org[0]);
MSG_WriteFloatCoord (&sv.datagram, org[1]);
}
MSG_WriteByte (&sv.datagram, count);
MSG_WriteByte (&sv.datagram, color);
-}
+}
-/*
+/*
==================
SV_StartEffect
void SV_StartEffect (vec3_t org, int modelindex, int startframe, int framecount, int framerate)
{
if (sv.datagram.cursize > MAX_DATAGRAM-18)
- return;
+ return;
if (modelindex >= 256 || startframe >= 256)
{
MSG_WriteByte (&sv.datagram, svc_effect2);
MSG_WriteByte (&sv.datagram, framecount);
MSG_WriteByte (&sv.datagram, framerate);
}
-}
+}
-/*
+/*
==================
SV_StartSound
Larger attenuations will drop off. (max 4 attenuation)
==================
-*/
+*/
void SV_StartSound (edict_t *entity, int channel, char *sample, int volume,
float attenuation)
-{
+{
int sound_num;
int field_mask;
int i;
int ent;
-
+
if (volume < 0 || volume > 255)
Host_Error ("SV_StartSound: volume = %i", volume);
Host_Error ("SV_StartSound: channel = %i", channel);
if (sv.datagram.cursize > MAX_DATAGRAM-16)
- return;
+ return;
// find precache number for sound
for (sound_num=1 ; sound_num<MAX_SOUNDS
// set up the client_t
netconnection = client->netconnection;
-
+
if (sv.loadgame)
memcpy (spawn_parms, client->spawn_parms, sizeof(spawn_parms));
memset (client, 0, sizeof(*client));
//
// init a new client structure
- //
+ //
for (i=0 ; i<svs.maxclients ; i++)
if (!svs.clients[i].active)
break;
{
int e, i, clentnum, bits, alpha, glowcolor, glowsize, scale, colormod, effects;
byte *pvs;
- vec3_t org, origin, angles;
+ vec3_t org, origin, angles, entmins, entmaxs;
float movelerp, moveilerp, nextfullupdate;
edict_t *ent;
eval_t *val;
for (i = 0;i < ent->num_leafs;i++)
if (pvs[ent->leafnums[i] >> 3] & (1 << (ent->leafnums[i]&7) ))
break;
-
+
if (i == ent->num_leafs)
{
// not visible
continue;
}
+
+ VectorAdd(ent->v.mins, ent->v.origin, entmins);
+ VectorAdd(ent->v.maxs, ent->v.origin, entmaxs);
+ entmins[0] -= 1.0f;entmins[1] -= 1.0f;entmins[2] -= 1.0f;
+ entmaxs[0] += 1.0f;entmaxs[1] += 1.0f;entmaxs[2] += 1.0f;
+ if (!Portal_CheckBox(sv.worldmodel, org, entmins, entmaxs))
+ {
+ sv_vischeckentitycullcount++;
+ continue;
+ }
}
}
if (ent->v.movetype == MOVETYPE_STEP)
bits |= U_STEP;
-
+
if (ent->v.movetype == MOVETYPE_STEP && ((int) ent->v.flags & (FL_ONGROUND | FL_FLY | FL_SWIM))) // monsters have smoothed walking/flying/swimming movement
{
if (!ent->steplerptime || ent->steplerptime > sv.time) // when the level just started...
if (bits & U_FRAME2) MSG_WriteByte(msg, (int)ent->v.frame >> 8);
if (bits & U_MODEL2) MSG_WriteByte(msg, (int)ent->v.modelindex >> 8);
}
+
+ if (sv_reportvischeckentities.value)
+ Con_Printf("sv_vischeck culled entities: %d\n", sv_vischeckentitycullcount);
+ sv_vischeckentitycullcount = 0;
}
/*
{
int e;
edict_t *ent;
-
+
ent = NEXT_EDICT(sv.edicts);
for (e=1 ; e<sv.num_edicts ; e++, ent = NEXT_EDICT(ent))
{
MSG_WriteByte (msg, ent->v.dmg_take);
for (i=0 ; i<3 ; i++)
MSG_WriteFloatCoord (msg, other->v.origin[i] + 0.5*(other->v.mins[i] + other->v.maxs[i]));
-
+
ent->v.dmg_take = 0;
ent->v.dmg_save = 0;
}
}
bits = 0;
-
+
if (ent->v.view_ofs[2] != DEFAULT_VIEWHEIGHT)
bits |= SU_VIEWHEIGHT;
-
+
if (ent->v.idealpitch)
bits |= SU_IDEALPITCH;
if (ent->v.velocity[i])
bits |= (SU_VELOCITY1<<i);
}
-
+
if (ent->v.weaponframe)
bits |= SU_WEAPONFRAME;
SV_DropClient (true);// if the message couldn't send, kick off
return false;
}
-
+
return true;
}
sv.signon.maxsize = sizeof(sv.signon_buf);
sv.signon.cursize = 0;
sv.signon.data = sv.signon_buf;
-
+
// leave slots at start for clients only
sv.num_edicts = svs.maxclients+1;
for (i=0 ; i<svs.maxclients ; i++)
return;
}
sv.models[1] = sv.worldmodel;
-
+
//
// clear world interaction links
//
// all setup is completed, any further precache statements are errors
sv.state = ss_active;
-
+
// run two frames to allow everything to settle
sv.frametime = pr_global_struct->frametime = host_frametime = 0.1;
SV_Physics ();
for (i=0,host_client = svs.clients ; i<svs.maxclients ; i++, host_client++)
if (host_client->active)
SV_SendServerinfo (host_client);
-
+
Con_DPrintf ("Server spawned.\n");
}
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
pushmove objects do not obey gravity, and do not interact with each other or trigger fields, but block normal movement and push normal objects when they move.
-onground is set for toss objects when they come to a complete rest. it is set for steping or walking objects
+onground is set for toss objects when they come to a complete rest. it is set for steping or walking objects
doors, plats, etc are SOLID_BSP, and MOVETYPE_PUSH
bonus items are SOLID_TRIGGER touch, and MOVETYPE_TOSS
*/
-cvar_t sv_friction = {"sv_friction","4",false,true};
-cvar_t sv_stopspeed = {"sv_stopspeed","100"};
-cvar_t sv_gravity = {"sv_gravity","800",false,true};
-cvar_t sv_maxvelocity = {"sv_maxvelocity","2000"};
-cvar_t sv_nostep = {"sv_nostep","0"};
+cvar_t sv_friction = {CVAR_NOTIFY, "sv_friction","4"};
+cvar_t sv_stopspeed = {0, "sv_stopspeed","100"};
+cvar_t sv_gravity = {CVAR_NOTIFY, "sv_gravity","800"};
+cvar_t sv_maxvelocity = {0, "sv_maxvelocity","2000"};
+cvar_t sv_nostep = {0, "sv_nostep","0"};
#define MOVE_EPSILON 0.01
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.
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
edict_t *sv_player;
-cvar_t sv_edgefriction = {"edgefriction", "2"};
-cvar_t sv_predict = {"sv_predict", "1"};
-cvar_t sv_deltacompress = {"sv_deltacompress", "1"};
+cvar_t sv_edgefriction = {0, "edgefriction", "2"};
+cvar_t sv_predict = {0, "sv_predict", "1"};
+cvar_t sv_deltacompress = {0, "sv_deltacompress", "1"};
+cvar_t sv_idealpitchscale = {0, "sv_idealpitchscale","0.8"};
+cvar_t sv_maxspeed = {CVAR_NOTIFY, "sv_maxspeed", "320"};
+cvar_t sv_accelerate = {0, "sv_accelerate", "10"};
static vec3_t forward, right, up;
usercmd_t cmd;
-cvar_t sv_idealpitchscale = {"sv_idealpitchscale","0.8"};
-
/*
===============
SV_Accelerate
==============
*/
-cvar_t sv_maxspeed = {"sv_maxspeed", "320", false, true};
-cvar_t sv_accelerate = {"sv_accelerate", "10"};
#if 0
void SV_Accelerate (vec3_t wishvel)
{
--- /dev/null
+
+#include "quakedef.h"
+
+cvar_t ui_showname = {0, "ui_showname", "0"};
+
+#define ITEM_CLICKABLE 1
+#define ITEM_DRAWABLE 2
+
+#define UIKEY_LEFT 1
+#define UIKEY_RIGHT 2
+#define UIKEY_UP 3
+#define UIKEY_DOWN 4
+#define UIKEY_ENTER 5
+
+#define UI_MOUSEBUTTONS 3
+
+static int ui_alive, ui_active;
+static float ui_mouse_x, ui_mouse_y;
+static int ui_mousebutton[UI_MOUSEBUTTONS], ui_mouseclick;
+static int ui_keyui, ui_keyitem;
+static ui_item_t *ui_keyrealitem;
+
+static ui_t *ui_list[MAX_UI_COUNT];
+
+static qpic_t *ui_mousepointer;
+
+void ui_start(void)
+{
+ ui_mousepointer = Draw_CachePic("ui/mousepointer.lmp");
+ ui_mouse_x = vid.width * 0.5;
+ ui_mouse_y = vid.height * 0.5;
+ ui_alive = true;
+}
+
+void ui_shutdown(void)
+{
+ ui_mousepointer = NULL;
+ ui_alive = false;
+}
+
+void ui_newmap(void)
+{
+}
+
+void ui_init(void)
+{
+ Cvar_RegisterVariable(&ui_showname);
+ R_RegisterModule("UI", ui_start, ui_shutdown, ui_newmap);
+}
+
+void ui_mouseupdate(float x, float y)
+{
+ if (ui_alive)
+ {
+ ui_mouse_x = bound(0, x, vid.width);
+ ui_mouse_y = bound(0, y, vid.height);
+ }
+}
+
+void ui_mouseupdaterelative(float x, float y)
+{
+ if (ui_alive)
+ {
+ ui_mouse_x += x;
+ ui_mouse_y += y;
+ ui_mouse_x = bound(0, ui_mouse_x, vid.width);
+ ui_mouse_y = bound(0, ui_mouse_y, vid.height);
+ }
+}
+
+ui_t *ui_create(void)
+{
+ ui_t *ui;
+ ui = qmalloc(sizeof(*ui));
+ if (ui == NULL)
+ Sys_Error("ui_create: unable to allocate memory for new ui\n");
+ memset(ui, 0, sizeof(*ui));
+ return ui;
+}
+
+void ui_free(ui_t *ui)
+{
+ if (ui)
+ qfree(ui);
+}
+
+void ui_clear(ui_t *ui)
+{
+ ui->item_count = 0;
+}
+
+void ui_item
+(
+ ui_t *ui, char *basename, int number,
+ float x, float y, qpic_t *pic,
+ float left, float top, float width, float height,
+ void(*leftkey)(void *nativedata1, void *nativedata2, float data1, float data2),
+ void(*rightkey)(void *nativedata1, void *nativedata2, float data1, float data2),
+ void(*enterkey)(void *nativedata1, void *nativedata2, float data1, float data2),
+ void(*mouseclick)(void *nativedata1, void *nativedata2, float data1, float data2, float xfrac, float yfrac),
+ void *nativedata1, void *nativedata2, float data1, float data2
+)
+{
+ int i;
+ ui_item_t *it;
+ char itemname[32];
+ snprintf(itemname, sizeof(itemname), "%s%04d", basename, number);
+ for (it = ui->items, i = 0;i < ui->item_count;it++, i++)
+ if (it->name == NULL || !strncmp(itemname, it->name, 32))
+ break;
+ if (i == ui->item_count)
+ {
+ if (i == MAX_UI_ITEMS)
+ {
+ Con_Printf("ui_item: ran out of UI item slots\n");
+ return;
+ }
+ ui->item_count++;
+ }
+ strncpy(it->name, itemname, 32);
+ it->flags = 0;
+ if (leftkey || rightkey || enterkey || mouseclick)
+ it->flags |= ITEM_CLICKABLE;
+ if (pic)
+ it->flags |= ITEM_DRAWABLE;
+ it->draw_x = x;
+ it->draw_y = y;
+ it->click_x = x + left;
+ it->click_y = y + top;
+ it->click_x2 = it->click_x + width;
+ it->click_y2 = it->click_y + height;
+ it->leftkey = leftkey;
+ it->rightkey = rightkey;
+ it->enterkey = enterkey;
+ it->mouseclick = mouseclick;
+ if (it->mouseclick == NULL)
+ it->mouseclick = (void *)it->enterkey;
+ if (it->leftkey == NULL)
+ it->leftkey = it->enterkey;
+ if (it->rightkey == NULL)
+ it->rightkey = it->enterkey;
+ it->nativedata1 = nativedata1;
+ it->nativedata2 = nativedata2;
+}
+
+void ui_item_remove(ui_t *ui, char *basename, int number)
+{
+ int i;
+ ui_item_t *it;
+ char itemname[32];
+ snprintf(itemname, sizeof(itemname), "%s%04d", basename, number);
+ for (it = ui->items, i = 0;i < ui->item_count;it++, i++)
+ if (it->name && !strncmp(itemname, it->name, 32))
+ break;
+ if (i < ui->item_count)
+ it->name[0] = 0;
+}
+
+ui_item_t *ui_hititem(float x, float y)
+{
+ int i, j;
+ ui_item_t *it;
+ ui_t *ui;
+ for (j = 0;j < MAX_UI_COUNT;j++)
+ if ((ui = ui_list[j]))
+ for (it = ui->items, i = 0;i < ui->item_count;it++, i++)
+ if (it->name[0] && (it->flags & ITEM_CLICKABLE))
+ if (x >= it->click_x && y >= it->click_y && x < it->click_x2 && y < it->click_y2)
+ return it;
+ return NULL;
+}
+
+int ui_uiactive(ui_t *ui)
+{
+ int i;
+ for (i = 0;i < MAX_UI_COUNT;i++)
+ if (ui_list[i] == ui)
+ return true;
+ return false;
+}
+
+void ui_activate(ui_t *ui, int yes)
+{
+ int i;
+ if (yes)
+ {
+ if (ui_uiactive(ui))
+ return;
+
+ for (i = 0;i < MAX_UI_COUNT;i++)
+ {
+ if (ui_list[i] == NULL)
+ {
+ ui_list[i] = ui;
+ return;
+ }
+ }
+
+ Con_Printf("ui_activate: ran out of active ui list items\n");
+ }
+ else
+ {
+ for (i = 0;i < MAX_UI_COUNT;i++)
+ {
+ if (ui_list[i] == ui)
+ {
+ ui_list[i] = NULL;
+ return;
+ }
+ }
+ }
+}
+
+int ui_isactive(void)
+{
+ int j;
+ ui_t *ui;
+ if (ui_alive)
+ {
+ for (j = 0;j < MAX_UI_COUNT;j++)
+ if ((ui = ui_list[j]))
+ if (ui->item_count)
+ return true;
+ }
+ return false;
+}
+
+#define UI_QUEUE_SIZE 256
+static byte ui_keyqueue[UI_QUEUE_SIZE];
+static int ui_keyqueuepos = 0;
+
+void ui_leftkeyupdate(int pressed)
+{
+ static int key = false;
+ if (pressed && !key && ui_keyqueuepos < UI_QUEUE_SIZE)
+ ui_keyqueue[ui_keyqueuepos++] = UIKEY_LEFT;
+ key = pressed;
+}
+
+void ui_rightkeyupdate(int pressed)
+{
+ static int key = false;
+ if (pressed && !key && ui_keyqueuepos < UI_QUEUE_SIZE)
+ ui_keyqueue[ui_keyqueuepos++] = UIKEY_RIGHT;
+ key = pressed;
+}
+
+void ui_upkeyupdate(int pressed)
+{
+ static int key = false;
+ if (pressed && !key && ui_keyqueuepos < UI_QUEUE_SIZE)
+ ui_keyqueue[ui_keyqueuepos++] = UIKEY_UP;
+ key = pressed;
+}
+
+void ui_downkeyupdate(int pressed)
+{
+ static int key = false;
+ if (pressed && !key && ui_keyqueuepos < UI_QUEUE_SIZE)
+ ui_keyqueue[ui_keyqueuepos++] = UIKEY_DOWN;
+ key = pressed;
+}
+
+void ui_mousebuttonupdate(int button, int pressed)
+{
+ if (button < 0 || button >= UI_MOUSEBUTTONS)
+ return;
+ if (button == 0 && ui_mousebutton[button] && !pressed)
+ ui_mouseclick = true;
+ ui_mousebutton[button] = pressed;
+}
+
+void ui_update(void)
+{
+ ui_item_t *startitem, *it;
+ if (ui_alive)
+ {
+ ui_mouse_x = bound(0, ui_mouse_x, vid.width);
+ ui_mouse_y = bound(0, ui_mouse_y, vid.height);
+
+ if ((ui_active = ui_isactive()))
+ {
+ // validate currently selected item
+ if(ui_list[ui_keyui] == NULL)
+ {
+ while (ui_list[ui_keyui] == NULL)
+ ui_keyui = (ui_keyui + 1) % MAX_UI_COUNT;
+ ui_keyitem = 0;
+ }
+ ui_keyitem = bound(0, ui_keyitem, ui_list[ui_keyui]->item_count - 1);
+ startitem = ui_keyrealitem = &ui_list[ui_keyui]->items[ui_keyitem];
+ if ((ui_keyrealitem->flags & ITEM_CLICKABLE) == 0)
+ {
+ do
+ {
+ // FIXME: cycle through UIs as well as items in a UI
+ ui_keyitem = (ui_keyitem - 1) % ui_list[ui_keyui]->item_count - 1;
+ ui_keyrealitem = &ui_list[ui_keyui]->items[ui_keyitem];
+ }
+ while (ui_keyrealitem != startitem && (ui_keyrealitem->flags & ITEM_CLICKABLE) == 0);
+ }
+
+ if (ui_keyqueuepos)
+ {
+ int i;
+ for (i = 0;i < ui_keyqueuepos;i++)
+ {
+ startitem = ui_keyrealitem;
+ switch(ui_keyqueue[i])
+ {
+ case UIKEY_UP:
+ do
+ {
+ ui_keyitem--;
+ if (ui_keyitem < 0)
+ {
+ do
+ ui_keyui = (ui_keyui - 1) % MAX_UI_COUNT;
+ while(ui_list[ui_keyui] == NULL);
+ ui_keyitem = ui_list[ui_keyui]->item_count - 1;
+ }
+ ui_keyrealitem = &ui_list[ui_keyui]->items[ui_keyitem];
+ }
+ while (ui_keyrealitem != startitem && (ui_keyrealitem->flags & ITEM_CLICKABLE) == 0);
+ break;
+ case UIKEY_DOWN:
+ do
+ {
+ ui_keyitem++;
+ if (ui_keyitem >= ui_list[ui_keyui]->item_count)
+ {
+ do
+ ui_keyui = (ui_keyui + 1) % MAX_UI_COUNT;
+ while(ui_list[ui_keyui] == NULL);
+ ui_keyitem = 0;
+ }
+ ui_keyrealitem = &ui_list[ui_keyui]->items[ui_keyitem];
+ }
+ while (ui_keyrealitem != startitem && (ui_keyrealitem->flags & ITEM_CLICKABLE) == 0);
+ break;
+ case UIKEY_LEFT:
+ if (ui_keyrealitem->leftkey)
+ ui_keyrealitem->leftkey(ui_keyrealitem->nativedata1, ui_keyrealitem->nativedata2, ui_keyrealitem->data1, ui_keyrealitem->data2);
+ break;
+ case UIKEY_RIGHT:
+ if (ui_keyrealitem->rightkey)
+ ui_keyrealitem->rightkey(ui_keyrealitem->nativedata1, ui_keyrealitem->nativedata2, ui_keyrealitem->data1, ui_keyrealitem->data2);
+ break;
+ case UIKEY_ENTER:
+ if (ui_keyrealitem->enterkey)
+ ui_keyrealitem->enterkey(ui_keyrealitem->nativedata1, ui_keyrealitem->nativedata2, ui_keyrealitem->data1, ui_keyrealitem->data2);
+ break;
+ }
+ }
+ }
+ ui_keyqueuepos = 0;
+
+ if (ui_mouseclick && (it = ui_hititem(ui_mouse_x, ui_mouse_y)) && it->mouseclick)
+ it->mouseclick(it->nativedata1, it->nativedata2, it->data1, it->data2, ui_mouse_x - it->click_x, ui_mouse_y - it->click_y);
+ }
+ }
+ ui_mouseclick = false;
+}
+
+void ui_draw(void)
+{
+ int i, j;
+ ui_item_t *it;
+ ui_t *ui;
+ if (ui_alive && ui_active)
+ {
+ for (j = 0;j < MAX_UI_COUNT;j++)
+ if ((ui = ui_list[j]))
+ if (ui->item_count)
+ for (i = 0, it = ui->items;i < ui->item_count;i++, it++)
+ if (it->flags & ITEM_DRAWABLE)
+ Draw_Pic(it->draw_x, it->draw_y, it->draw_pic);
+
+ if ((it = ui_hititem(ui_mouse_x, ui_mouse_y)))
+ {
+ Draw_AdditivePic(it->draw_x, it->draw_y, it->draw_pic);
+ if (ui_showname.value)
+ Draw_String(ui_mouse_x, ui_mouse_y + 16, it->name, 9999);
+ }
+
+ it = ui_keyrealitem;
+ Draw_AdditivePic(it->draw_x, it->draw_y, it->draw_pic);
+
+ Draw_Pic(ui_mouse_x, ui_mouse_y, ui_mousepointer);
+ }
+}
--- /dev/null
+
+#define MAX_UI_COUNT 16
+#define MAX_UI_ITEMS 256
+
+typedef struct
+{
+ char name[32];
+ int flags;
+ qpic_t *draw_pic;
+ int draw_x, draw_y;
+ int click_x, click_y, click_x2, click_y2;
+ void(*leftkey)(void *nativedata1, void *nativedata2, float data1, float data2);
+ void(*rightkey)(void *nativedata1, void *nativedata2, float data1, float data2);
+ void(*enterkey)(void *nativedata1, void *nativedata2, float data1, float data2);
+ void(*mouseclick)(void *nativedata1, void *nativedata2, float data1, float data2, float xfrac, float yfrac);
+ void *nativedata1, *nativedata2;
+ float data1, data2;
+}
+ui_item_t;
+
+typedef struct
+{
+ int item_count;
+ int pad;
+ ui_item_t items[MAX_UI_ITEMS];
+}
+ui_t;
+
+void ui_init(void);
+void ui_mouseupdate(float x, float y);
+void ui_mouseupdaterelative(float x, float y);
+ui_t *ui_create(void);
+void ui_free(ui_t *ui);
+void ui_clear(ui_t *ui);
+void ui_item
+(
+ ui_t *ui, char *basename, int number,
+ float x, float y, qpic_t *pic,
+ float left, float top, float width, float height,
+ void(*leftkey)(void *nativedata1, void *nativedata2, float data1, float data2),
+ void(*rightkey)(void *nativedata1, void *nativedata2, float data1, float data2),
+ void(*enterkey)(void *nativedata1, void *nativedata2, float data1, float data2),
+ void(*mouseclick)(void *nativedata1, void *nativedata2, float data1, float data2, float xfrac, float yfrac),
+ void *nativedata1, void *nativedata2, float data1, float data2
+);
+void ui_item_remove(ui_t *ui, char *basename, int number);
+int ui_uiactive(ui_t *ui);
+void ui_activate(ui_t *ui, int yes);
+void ui_leftkeyupdate(int pressed);
+void ui_rightkeyupdate(int pressed);
+void ui_upkeyupdate(int pressed);
+void ui_downkeyupdate(int pressed);
+void ui_mousebuttonupdate(int button, int pressed);
+void ui_update(void);
+void ui_draw(void);
static float old_mouse_x, old_mouse_y;
static int p_mouse_x, p_mouse_y;
-cvar_t vid_dga = {"vid_dga", "1", true};
-cvar_t vid_dga_mouseaccel = {"vid_dga_mouseaccel", "1", false};
-cvar_t m_filter = {"m_filter", "0"};
+cvar_t vid_dga = {CVAR_SAVE, "vid_dga", "1"};
+cvar_t vid_dga_mouseaccel = {0, "vid_dga_mouseaccel", "1"};
+cvar_t m_filter = {0, "m_filter", "0"};
qboolean vidmode_ext = false;
{
if (!event.xmotion.send_event)
{
- mouse_x += (event.xmotion.x - p_mouse_x);
- mouse_y += (event.xmotion.y - p_mouse_y);
+ mouse_x += event.xmotion.x - p_mouse_x;
+ mouse_y += event.xmotion.y - p_mouse_y;
if (abs(vid.width/2 - event.xmotion.x) > vid.width / 4 || abs(vid.height/2 - event.xmotion.y) > vid.height / 4)
dowarp = true;
}
p_mouse_y = event.xmotion.y;
}
}
+ else
+ ui_mouseupdate(event.xmotion.x, event.xmotion.y);
break;
case ButtonPress:
Con_Printf("...using GL_ARB_multitexture\n");
qglMTexCoord2f = (void *) dlsym(prjobj, "glMultiTexCoord2fARB");
qglSelectTexture = (void *) dlsym(prjobj, "glActiveTextureARB");
- gl_mtexable = true;
- gl_mtex_enum = GL_TEXTURE0_ARB;
+ if (qglMTexCoord2f != NULL && qglSelectTexture != NULL)
+ {
+ gl_mtexable = true;
+ gl_mtex_enum = GL_TEXTURE0_ARB;
+ }
+ else
+ {
+ if (qglMTexCoord2f == NULL)
+ Con_Printf("dlsym(prjobj, \"glMultiTexCoord2fARB\") == NULL!\n");
+ if (qglSelectTexture == NULL)
+ Con_Printf("dlsym(prjobj, \"glActiveTextureARB\") == NULL!\n");
+ }
}
- else if (strstr(gl_extensions, "GL_SGIS_multitexture ")) // Test for SGIS_multitexture (if ARB_multitexture not found)
+ if (!gl_mtexable && strstr(gl_extensions, "GL_SGIS_multitexture ")) // Test for SGIS_multitexture (if ARB_multitexture not found)
{
Con_Printf("...using GL_SGIS_multitexture\n");
qglMTexCoord2f = (void *) dlsym(prjobj, "glMTexCoord2fSGIS");
qglSelectTexture = (void *) dlsym(prjobj, "glSelectTextureSGIS");
- gl_mtexable = true;
- gl_mtex_enum = TEXTURE0_SGIS;
+ if (qglMTexCoord2f != NULL && qglSelectTexture != NULL)
+ {
+ gl_mtexable = true;
+ gl_mtex_enum = TEXTURE0_SGIS;
+ }
+ else
+ {
+ if (qglMTexCoord2f == NULL)
+ Con_Printf("dlsym(prjobj, \"glMTexCoord2fSGIS\") == NULL!\n");
+ if (qglSelectTexture == NULL)
+ Con_Printf("dlsym(prjobj, \"glSelectTextureSGIS\") == NULL!\n");
+ }
}
- else
+ if (!gl_mtexable)
Con_Printf("...multitexture disabled (not detected)\n");
dlclose(prjobj);
}
Con_Printf("...using compiled vertex arrays\n");
qglLockArraysEXT = (void *) dlsym(prjobj, "glLockArraysEXT");
qglUnlockArraysEXT = (void *) dlsym(prjobj, "glUnlockArraysEXT");
- gl_supportslockarrays = true;
+ if (qglLockArraysEXT != NULL && qglUnlockArraysEXT != NULL)
+ gl_supportslockarrays = true;
+ else
+ {
+ if (qglLockArraysEXT == NULL)
+ Con_Printf("dlsym(prjobj, \"glLockArraysEXT\") == NULL!\n");
+ if (qglUnlockArraysEXT == NULL)
+ Con_Printf("dlsym(prjobj, \"glUnlockArraysEXT\") == NULL!\n");
+ Con_Printf("...compiled vertex arrays disabled\n");
+ }
}
dlclose(prjobj);
}
qboolean gl_mtexable = false;
int gl_mtex_enum = 0;
-cvar_t vid_mode = {"vid_mode", "0", false};
-cvar_t vid_mouse = {"vid_mouse", "1", true};
-cvar_t vid_fullscreen = {"vid_fullscreen", "1"};
+cvar_t vid_mode = {0, "vid_mode", "0"};
+cvar_t vid_mouse = {CVAR_SAVE, "vid_mouse", "1"};
+cvar_t vid_fullscreen = {0, "vid_fullscreen", "1"};
void (GLAPIENTRY *qglMTexCoord2f) (GLenum, GLfloat, GLfloat);
void (GLAPIENTRY *qglSelectTexture) (GLenum);
*/
-cvar_t cl_rollspeed = {"cl_rollspeed", "200"};
-cvar_t cl_rollangle = {"cl_rollangle", "2.0"};
+cvar_t cl_rollspeed = {0, "cl_rollspeed", "200"};
+cvar_t cl_rollangle = {0, "cl_rollangle", "2.0"};
-cvar_t cl_bob = {"cl_bob","0.02", false};
-cvar_t cl_bobcycle = {"cl_bobcycle","0.6", false};
-cvar_t cl_bobup = {"cl_bobup","0.5", false};
+cvar_t cl_bob = {0, "cl_bob","0.02"};
+cvar_t cl_bobcycle = {0, "cl_bobcycle","0.6"};
+cvar_t cl_bobup = {0, "cl_bobup","0.5"};
-cvar_t v_kicktime = {"v_kicktime", "0.5", false};
-cvar_t v_kickroll = {"v_kickroll", "0.6", false};
-cvar_t v_kickpitch = {"v_kickpitch", "0.6", false};
+cvar_t v_kicktime = {0, "v_kicktime", "0.5"};
+cvar_t v_kickroll = {0, "v_kickroll", "0.6"};
+cvar_t v_kickpitch = {0, "v_kickpitch", "0.6"};
-cvar_t v_punch = {"v_punch", "1", false};
+cvar_t v_punch = {0, "v_punch", "1"};
-cvar_t v_iyaw_cycle = {"v_iyaw_cycle", "2", false};
-cvar_t v_iroll_cycle = {"v_iroll_cycle", "0.5", false};
-cvar_t v_ipitch_cycle = {"v_ipitch_cycle", "1", false};
-cvar_t v_iyaw_level = {"v_iyaw_level", "0.3", false};
-cvar_t v_iroll_level = {"v_iroll_level", "0.1", false};
-cvar_t v_ipitch_level = {"v_ipitch_level", "0.3", false};
+cvar_t v_iyaw_cycle = {0, "v_iyaw_cycle", "2"};
+cvar_t v_iroll_cycle = {0, "v_iroll_cycle", "0.5"};
+cvar_t v_ipitch_cycle = {0, "v_ipitch_cycle", "1"};
+cvar_t v_iyaw_level = {0, "v_iyaw_level", "0.3"};
+cvar_t v_iroll_level = {0, "v_iroll_level", "0.1"};
+cvar_t v_ipitch_level = {0, "v_ipitch_level", "0.3"};
-cvar_t v_idlescale = {"v_idlescale", "0", false};
+cvar_t v_idlescale = {0, "v_idlescale", "0"};
-cvar_t crosshair = {"crosshair", "0", true};
-cvar_t cl_crossx = {"cl_crossx", "0", false};
-cvar_t cl_crossy = {"cl_crossy", "0", false};
+cvar_t crosshair = {CVAR_SAVE, "crosshair", "0"};
-//cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100", false};
-cvar_t gl_polyblend = {"gl_polyblend", "1", true};
+//cvar_t gl_cshiftpercent = {0, "gl_cshiftpercent", "100"};
+cvar_t gl_polyblend = {CVAR_SAVE, "gl_polyblend", "1"};
+
+cvar_t v_centermove = {0, "v_centermove", "0.15"};
+cvar_t v_centerspeed = {0, "v_centerspeed","500"};
float v_dmg_time, v_dmg_roll, v_dmg_pitch;
side = side * value / cl_rollspeed.value;
else
side = value;
-
+
return side*sign;
-
+
}
//=============================================================================
-cvar_t v_centermove = {"v_centermove", "0.15", false};
-cvar_t v_centerspeed = {"v_centerspeed","500"};
-
-
void V_StartPitchDrift (void)
{
#if 1
mlook and mouse, or klook and keyboard, pitch drifting is constantly stopped.
Drifting is enabled when the center view key is hit, mlook is released and
-lookspring is non 0, or when
+lookspring is non 0, or when
===============
*/
void V_DriftPitch (void)
V_CalcPowerupCshift ();
new = false;
-
+
for (i=0 ; i<NUM_CSHIFTS ; i++)
{
if (cl.cshifts[i].percent != cl.prev_cshifts[i].percent)
if (oldyaw - move > yaw)
yaw = oldyaw - move;
}
-
+
if (pitch > oldpitch)
{
if (oldpitch + move < pitch)
Cvar_RegisterVariable (&v_idlescale);
Cvar_RegisterVariable (&crosshair);
- Cvar_RegisterVariable (&cl_crossx);
- Cvar_RegisterVariable (&cl_crossy);
// Cvar_RegisterVariable (&gl_cshiftpercent);
Cvar_RegisterVariable (&gl_polyblend);