From 6430b9b21493b68ba55a46c02f121f7c8b09077c Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 11 Feb 2006 02:09:43 +0000 Subject: [PATCH] added a macro for specifying all the cvar properties. This will simplify stuff for Q2. Also added trace_endcontents and trace_surfaceflags. File system (still too selectivly) reads gz files. Fixed a buffer overflow in the http client. Made server downloads decompress zipped files to a temporary file. This should make it download them faster. git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1943 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_cam.c | 4 +- engine/client/cl_demo.c | 3 +- engine/client/cl_ignore.c | 12 +- engine/client/cl_input.c | 30 ++-- engine/client/cl_main.c | 137 ++++++++++--------- engine/client/cl_pred.c | 4 +- engine/client/cl_screen.c | 18 +-- engine/client/cl_tent.c | 8 +- engine/client/console.c | 10 +- engine/client/image.c | 4 +- engine/client/in_win.c | 62 ++++----- engine/client/keys.c | 20 ++- engine/client/m_download.c | 1 - engine/client/m_items.c | 1 - engine/client/m_master.c | 40 +++--- engine/client/m_mp3.c | 14 +- engine/client/m_script.c | 2 +- engine/client/menu.c | 2 +- engine/client/net_master.c | 4 +- engine/client/pr_csqc.c | 14 +- engine/client/pr_menu.c | 4 +- engine/client/quakedef.h | 4 +- engine/client/r_bulleten.c | 32 ++--- engine/client/r_part.c | 22 +-- engine/client/renderer.c | 272 ++++++++++++++++++------------------- engine/client/skin.c | 4 +- engine/client/snd_dma.c | 38 +++--- engine/client/sys_win.c | 4 +- engine/client/textedit.c | 8 +- engine/client/valid.c | 10 +- engine/client/view.c | 94 ++++++------- engine/client/zqtp.c | 11 +- engine/common/cmd.c | 12 +- engine/common/common.c | 4 +- engine/common/common.h | 2 + engine/common/cvar.c | 6 +- engine/common/cvar.h | 5 + engine/common/fs.c | 199 ++++++++++++++++++++++++++- engine/common/gl_q2bsp.c | 8 +- engine/common/log.c | 16 +-- engine/common/net_chan.c | 6 +- engine/common/plugin.c | 4 +- engine/common/translate.c | 2 +- engine/gl/gl_backend.c | 6 +- engine/gl/gl_rmain.c | 50 +++---- engine/gl/gl_rmisc.c | 2 +- engine/gl/gl_shader.c | 2 +- engine/http/httpclient.c | 2 +- engine/http/iwebiface.c | 10 +- engine/server/pr_cmds.c | 72 ++++++---- engine/server/progdefs.h | 2 + engine/server/sv_ccmds.c | 2 +- engine/server/sv_main.c | 156 ++++++++++----------- engine/server/sv_mvd.c | 28 ++-- engine/server/sv_phys.c | 32 ++--- engine/server/sv_rankin.c | 6 +- engine/server/sv_user.c | 62 ++++++--- 57 files changed, 931 insertions(+), 658 deletions(-) diff --git a/engine/client/cl_cam.c b/engine/client/cl_cam.c index 6d91354cd..bec9cab7a 100644 --- a/engine/client/cl_cam.c +++ b/engine/client/cl_cam.c @@ -42,9 +42,9 @@ static int oldbuttons[MAX_SPLITS]; char cl_spectatorgroup[] = "Spectator Tracking"; // track high fragger -cvar_t cl_hightrack = {"cl_hightrack", "0" }; +cvar_t cl_hightrack = SCVAR("cl_hightrack", "0"); -cvar_t cl_chasecam = {"cl_chasecam", "1"}; +cvar_t cl_chasecam = SCVAR("cl_chasecam", "1"); //cvar_t cl_camera_maxpitch = {"cl_camera_maxpitch", "10" }; //cvar_t cl_camera_maxyaw = {"cl_camera_maxyaw", "30" }; diff --git a/engine/client/cl_demo.c b/engine/client/cl_demo.c index c3d81d4b3..fad384e76 100644 --- a/engine/client/cl_demo.c +++ b/engine/client/cl_demo.c @@ -1204,7 +1204,8 @@ void CL_PlayDemo(char *demoname) Q_strncpyz (lastdemoname, demoname, sizeof(lastdemoname)); Con_Printf ("Playing demo from %s.\n", name); - if (!Q_strcasecmp(name + strlen(name) - 3, "mvd")) + if (!Q_strcasecmp(name + strlen(name) - 3, "mvd") || + !Q_strcasecmp(name + strlen(name) - 6, "mvd.gz")) { cls.demoplayback = DPB_MVD; cls.findtrack = true; diff --git a/engine/client/cl_ignore.c b/engine/client/cl_ignore.c index 7bba50404..fdd422c41 100644 --- a/engine/client/cl_ignore.c +++ b/engine/client/cl_ignore.c @@ -86,12 +86,12 @@ char *Player_MyName (void) { -cvar_t ignore_spec = {"ignore_spec", "0"}; -cvar_t ignore_qizmo_spec = {"ignore_qizmo_spec", "0"}; -cvar_t ignore_mode = {"ignore_mode", "0"}; -cvar_t ignore_flood_duration = {"ignore_flood_duration", "4"}; -cvar_t ignore_flood = {"ignore_flood", "0"}; -cvar_t ignore_opponents = {"ignore_opponents", "0"}; +cvar_t ignore_spec = SCVAR("ignore_spec", "0"); +cvar_t ignore_qizmo_spec = SCVAR("ignore_qizmo_spec", "0"); +cvar_t ignore_mode = SCVAR("ignore_mode", "0"); +cvar_t ignore_flood_duration = SCVAR("ignore_flood_duration", "4"); +cvar_t ignore_flood = SCVAR("ignore_flood", "0"); +cvar_t ignore_opponents = SCVAR("ignore_opponents", "0"); char ignoreteamlist[MAX_TEAMIGNORELIST][16 + 1]; diff --git a/engine/client/cl_input.c b/engine/client/cl_input.c index 8440b7f60..57da2e4eb 100644 --- a/engine/client/cl_input.c +++ b/engine/client/cl_input.c @@ -27,17 +27,17 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. float in_sensitivityscale = 1; -cvar_t cl_nodelta = {"cl_nodelta","0"}; +cvar_t cl_nodelta = SCVAR("cl_nodelta","0"); -cvar_t cl_c2spps = {"cl_c2spps", "0"}; -cvar_t cl_c2sImpulseBackup = {"cl_c2sImpulseBackup","3"}; +cvar_t cl_c2spps = SCVAR("cl_c2spps", "0"); +cvar_t cl_c2sImpulseBackup = SCVAR("cl_c2sImpulseBackup","3"); -cvar_t cl_netfps = {"cl_netfps", "0"}; +cvar_t cl_netfps = SCVAR("cl_netfps", "0"); -cvar_t cl_smartjump = {"cl_smartjump", "1"}; +cvar_t cl_smartjump = SCVAR("cl_smartjump", "1"); -cvar_t cl_prydoncursor = {"cl_prydoncursor", "0"}; //for dp protocol -cvar_t cl_instantrotate = {"cl_instantrotate", "1", NULL, CVAR_SEMICHEAT}; +cvar_t cl_prydoncursor = SCVAR("cl_prydoncursor", "0"); //for dp protocol +cvar_t cl_instantrotate = SCVARF("cl_instantrotate", "1", CVAR_SEMICHEAT); usercmd_t independantphysics[MAX_SPLITS]; @@ -387,17 +387,17 @@ float CL_KeyState (kbutton_t *key, int pnum) //========================================================================== -cvar_t cl_upspeed = {"cl_upspeed","400"}; -cvar_t cl_forwardspeed = {"cl_forwardspeed","400", NULL, CVAR_ARCHIVE}; -cvar_t cl_backspeed = {"cl_backspeed","400", NULL, CVAR_ARCHIVE}; -cvar_t cl_sidespeed = {"cl_sidespeed","400"}; +cvar_t cl_upspeed = SCVAR("cl_upspeed","400"); +cvar_t cl_forwardspeed = SCVARF("cl_forwardspeed","400", CVAR_ARCHIVE); +cvar_t cl_backspeed = SCVARF("cl_backspeed","400", CVAR_ARCHIVE); +cvar_t cl_sidespeed = SCVAR("cl_sidespeed","400"); -cvar_t cl_movespeedkey = {"cl_movespeedkey","2.0"}; +cvar_t cl_movespeedkey = SCVAR("cl_movespeedkey","2.0"); -cvar_t cl_yawspeed = {"cl_yawspeed","140"}; -cvar_t cl_pitchspeed = {"cl_pitchspeed","150"}; +cvar_t cl_yawspeed = SCVAR("cl_yawspeed","140"); +cvar_t cl_pitchspeed = SCVAR("cl_pitchspeed","150"); -cvar_t cl_anglespeedkey = {"cl_anglespeedkey","1.5"}; +cvar_t cl_anglespeedkey = SCVAR("cl_anglespeedkey","1.5"); /* ================ diff --git a/engine/client/cl_main.c b/engine/client/cl_main.c index 5bf2492c4..a3d1b4c71 100644 --- a/engine/client/cl_main.c +++ b/engine/client/cl_main.c @@ -35,94 +35,94 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. qboolean noclip_anglehack; // remnant from old quake -cvar_t rcon_password = {"rcon_password", ""}; +cvar_t rcon_password = SCVAR("rcon_password", ""); -cvar_t rcon_address = {"rcon_address", ""}; +cvar_t rcon_address = SCVAR("rcon_address", ""); -cvar_t cl_timeout = {"cl_timeout", "60"}; +cvar_t cl_timeout = SCVAR("cl_timeout", "60"); -cvar_t cl_shownet = {"cl_shownet","0"}; // can be 0, 1, or 2 +cvar_t cl_shownet = SCVAR("cl_shownet","0"); // can be 0, 1, or 2 -cvar_t cl_sbar = {"cl_sbar", "0", NULL, CVAR_ARCHIVE}; -cvar_t cl_hudswap = {"cl_hudswap", "0", NULL, CVAR_ARCHIVE}; -cvar_t cl_maxfps = {"cl_maxfps", "1000", NULL, CVAR_ARCHIVE}; -cvar_t cl_nopext = {"cl_nopext", "0", NULL, CVAR_ARCHIVE}; -cvar_t cl_nolerp = {"cl_nolerp", "1"}; -cvar_t hud_tracking_show = {"hud_tracking_show", "1"}; +cvar_t cl_sbar = SCVARF("cl_sbar", "0", CVAR_ARCHIVE); +cvar_t cl_hudswap = SCVARF("cl_hudswap", "0", CVAR_ARCHIVE); +cvar_t cl_maxfps = SCVARF("cl_maxfps", "1000", CVAR_ARCHIVE); +cvar_t cl_nopext = SCVARF("cl_nopext", "0", CVAR_ARCHIVE); +cvar_t cl_nolerp = SCVAR("cl_nolerp", "1"); +cvar_t hud_tracking_show = SCVAR("hud_tracking_show", "1"); -cvar_t cfg_save_name = {"cfg_save_name", "fte", NULL, CVAR_ARCHIVE}; +cvar_t cfg_save_name = SCVARF("cfg_save_name", "fte", CVAR_ARCHIVE); -cvar_t cl_splitscreen = {"cl_splitscreen", "0"}; +cvar_t cl_splitscreen = SCVAR("cl_splitscreen", "0"); -cvar_t lookspring = {"lookspring","0", NULL, CVAR_ARCHIVE}; -cvar_t lookstrafe = {"lookstrafe","0", NULL, CVAR_ARCHIVE}; -cvar_t sensitivity = {"sensitivity","10", NULL, CVAR_ARCHIVE}; +cvar_t lookspring = SCVARF("lookspring","0", CVAR_ARCHIVE); +cvar_t lookstrafe = SCVARF("lookstrafe","0", CVAR_ARCHIVE); +cvar_t sensitivity = SCVARF("sensitivity","10", CVAR_ARCHIVE); -cvar_t cl_staticsounds = {"cl_staticsounds", "1"}; +cvar_t cl_staticsounds = SCVAR("cl_staticsounds", "1"); -cvar_t m_pitch = {"m_pitch","0.022", NULL, CVAR_ARCHIVE}; -cvar_t m_yaw = {"m_yaw","0.022"}; -cvar_t m_forward = {"m_forward","1"}; -cvar_t m_side = {"m_side","0.8"}; +cvar_t m_pitch = SCVARF("m_pitch","0.022", CVAR_ARCHIVE); +cvar_t m_yaw = SCVAR("m_yaw","0.022"); +cvar_t m_forward = SCVAR("m_forward","1"); +cvar_t m_side = SCVAR("m_side","0.8"); -cvar_t entlatency = {"entlatency", "20"}; -cvar_t cl_predict_players = {"cl_predict_players", "1"}; -cvar_t cl_predict_players2 = {"cl_predict_players2", "1"}; -cvar_t cl_solid_players = {"cl_solid_players", "1"}; -cvar_t cl_noblink = {"cl_noblink", "0"}; +cvar_t entlatency = SCVAR("entlatency", "20"); +cvar_t cl_predict_players = SCVAR("cl_predict_players", "1"); +cvar_t cl_predict_players2 = SCVAR("cl_predict_players2", "1"); +cvar_t cl_solid_players = SCVAR("cl_solid_players", "1"); +cvar_t cl_noblink = SCVAR("cl_noblink", "0"); -cvar_t cl_demospeed = {"cl_demospeed", "1"}; +cvar_t cl_demospeed = SCVAR("cl_demospeed", "1"); -cvar_t cl_indepphysics = {"cl_indepphysics", "0"}; +cvar_t cl_indepphysics = SCVAR("cl_indepphysics", "0"); -cvar_t localid = {"localid", ""}; +cvar_t localid = SCVAR("localid", ""); -cvar_t cl_antibunch = {"cl_antibunch", "0"}; +cvar_t cl_antibunch = SCVAR("cl_antibunch", "0"); static qboolean allowremotecmd = true; // // info mirrors // -cvar_t password = {"password", "", NULL, CVAR_USERINFO}; //this is parhaps slightly dodgy... -cvar_t spectator = {"spectator", "", NULL, CVAR_USERINFO}; -cvar_t name = {"name", "unnamed", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; -cvar_t team = {"team", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; -cvar_t skin = {"skin", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; -cvar_t model = {"model", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; -cvar_t topcolor = {"topcolor", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; -cvar_t bottomcolor = {"bottomcolor", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; -cvar_t rate = {"rate", "2500", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; -cvar_t drate = {"drate", "100000", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; // :) -cvar_t noaim = {"noaim", "", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; -cvar_t msg = {"msg", "1", NULL, CVAR_ARCHIVE | CVAR_USERINFO}; -cvar_t cl_nofake = {"cl_nofake", "2"}; -cvar_t cl_chatsound = {"cl_chatsound", "1"}; -cvar_t cl_enemychatsound = {"cl_enemychatsound", "misc/talk.wav"}; -cvar_t cl_teamchatsound = {"cl_teamchatsound", "misc/talk.wav"}; +cvar_t password = SCVARF("password", "", CVAR_USERINFO); //this is parhaps slightly dodgy... +cvar_t spectator = SCVARF("spectator", "", CVAR_USERINFO); +cvar_t name = SCVARF("name", "unnamed", CVAR_ARCHIVE | CVAR_USERINFO); +cvar_t team = SCVARF("team", "", CVAR_ARCHIVE | CVAR_USERINFO); +cvar_t skin = SCVARF("skin", "", CVAR_ARCHIVE | CVAR_USERINFO); +cvar_t model = SCVARF("model", "", CVAR_ARCHIVE | CVAR_USERINFO); +cvar_t topcolor = SCVARF("topcolor", "", CVAR_ARCHIVE | CVAR_USERINFO); +cvar_t bottomcolor = SCVARF("bottomcolor", "", CVAR_ARCHIVE | CVAR_USERINFO); +cvar_t rate = SCVARF("rate", "2500", CVAR_ARCHIVE | CVAR_USERINFO); +cvar_t drate = SCVARF("drate", "100000", CVAR_ARCHIVE | CVAR_USERINFO); // :) +cvar_t noaim = SCVARF("noaim", "", CVAR_ARCHIVE | CVAR_USERINFO); +cvar_t msg = SCVARF("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO); +cvar_t cl_nofake = SCVAR("cl_nofake", "2"); +cvar_t cl_chatsound = SCVAR("cl_chatsound","1"); +cvar_t cl_enemychatsound = SCVAR("cl_enemychatsound", "misc/talk.wav"); +cvar_t cl_teamchatsound = SCVAR("cl_teamchatsound", "misc/talk.wav"); -cvar_t r_rocketlight = {"r_rocketlight", "1"}; -cvar_t r_lightflicker = {"r_lightflicker", "1"}; -cvar_t cl_r2g = {"cl_r2g", "0"}; -cvar_t r_powerupglow = {"r_powerupglow", "1"}; -cvar_t v_powerupshell = {"v_powerupshell", "0"}; -cvar_t cl_gibfilter = {"cl_gibfilter", "0"}; -cvar_t cl_deadbodyfilter = {"cl_deadbodyfilter", "0"}; +cvar_t r_rocketlight = SCVAR("r_rocketlight", "1"); +cvar_t r_lightflicker = SCVAR("r_lightflicker", "1"); +cvar_t cl_r2g = SCVAR("cl_r2g", "0"); +cvar_t r_powerupglow = SCVAR("r_powerupglow", "1"); +cvar_t v_powerupshell = SCVAR("v_powerupshell", "0"); +cvar_t cl_gibfilter = SCVAR("cl_gibfilter", "0"); +cvar_t cl_deadbodyfilter = SCVAR("cl_deadbodyfilter", "0"); -cvar_t allow_download_csprogs = {"allow_download_csprogs", "0"}; +cvar_t allow_download_csprogs = SCVAR("allow_download_csprogs", "0"); -cvar_t cl_muzzleflash = {"cl_muzzleflash", "1"}; +cvar_t cl_muzzleflash = SCVAR("cl_muzzleflash", "1"); -cvar_t cl_item_bobbing = {"cl_model_bobbing", "0"}; +cvar_t cl_item_bobbing = SCVAR("cl_model_bobbing", "0"); -cvar_t requiredownloads = {"requiredownloads","1", NULL, CVAR_ARCHIVE}; -cvar_t cl_standardchat = {"cl_standardchat", "0"}; -cvar_t msg_filter = {"msg_filter", "0"}; //0 for neither, 1 for mm1, 2 for mm2, 3 for both -cvar_t cl_standardmsg = {"cl_standardmsg", "0"}; -cvar_t cl_parsewhitetext = {"cl_parsewhitetext", "0"}; +cvar_t requiredownloads = SCVARF("requiredownloads","1", CVAR_ARCHIVE); +cvar_t cl_standardchat = SCVAR("cl_standardchat", "0"); +cvar_t msg_filter = SCVAR("msg_filter", "0"); //0 for neither, 1 for mm1, 2 for mm2, 3 for both +cvar_t cl_standardmsg = SCVAR("cl_standardmsg", "0"); +cvar_t cl_parsewhitetext = SCVAR("cl_parsewhitetext", "0"); -cvar_t host_mapname = {"host_mapname", ""}; +cvar_t host_mapname = SCVAR("host_mapname", ""); extern cvar_t cl_hightrack; @@ -170,11 +170,11 @@ int host_hunklevel; qbyte *host_basepal; qbyte *host_colormap; -cvar_t host_speeds = {"host_speeds","0"}; // set for running times +cvar_t host_speeds = SCVAR("host_speeds","0"); // set for running times #ifdef CRAZYDEBUGGING -cvar_t developer = {"developer","1"}; +cvar_t developer = SCVAR("developer","1"); #else -cvar_t developer = {"developer","0"}; +cvar_t developer = SCVAR("developer","0"); #endif int fps_count; @@ -2479,7 +2479,14 @@ void CL_Windows_f (void) void CL_ServerInfo_f(void) { if (!sv.state && cls.state) - Cmd_ForwardToServer (); + { + if (cls.demoplayback) + { + Info_Print (cl.serverinfo); + } + else + Cmd_ForwardToServer (); + } else { SV_Serverinfo_f(); //allow it to be set... (whoops) diff --git a/engine/client/cl_pred.c b/engine/client/cl_pred.c index a9d014e5b..fe752fb3d 100644 --- a/engine/client/cl_pred.c +++ b/engine/client/cl_pred.c @@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" #include "winquake.h" -cvar_t cl_nopred = {"cl_nopred","0"}; -cvar_t cl_pushlatency = {"pushlatency","-999"}; +cvar_t cl_nopred = SCVAR("cl_nopred","0"); +cvar_t cl_pushlatency = SCVAR("pushlatency","-999"); extern frame_t *view_frame; diff --git a/engine/client/cl_screen.c b/engine/client/cl_screen.c index f5a8f45f7..55831d973 100644 --- a/engine/client/cl_screen.c +++ b/engine/client/cl_screen.c @@ -135,15 +135,15 @@ float oldsbar = 0; void SCR_ScreenShot_f (void); void SCR_RSShot_f (void); -cvar_t show_fps = {"show_fps", "0"}; -cvar_t show_fps_x = {"show_fps_x", "-1"}; -cvar_t show_fps_y = {"show_fps_y", "-1"}; -cvar_t show_clock = {"cl_clock", "0"}; -cvar_t show_clock_x = {"cl_clock_x", "0"}; -cvar_t show_clock_y = {"cl_clock_y", "-1"}; -cvar_t show_speed = {"show_speed", "0"}; -cvar_t show_speed_x = {"show_speed_x", "-1"}; -cvar_t show_speed_y = {"show_speed_y", "-9"}; +cvar_t show_fps = SCVAR("show_fps", "0"); +cvar_t show_fps_x = SCVAR("show_fps_x", "-1"); +cvar_t show_fps_y = SCVAR("show_fps_y", "-1"); +cvar_t show_clock = SCVAR("cl_clock", "0"); +cvar_t show_clock_x = SCVAR("cl_clock_x", "0"); +cvar_t show_clock_y = SCVAR("cl_clock_y", "-1"); +cvar_t show_speed = SCVAR("show_speed", "0"); +cvar_t show_speed_x = SCVAR("show_speed_x", "-1"); +cvar_t show_speed_y = SCVAR("show_speed_y", "-9"); extern char cl_screengroup[]; void CLSCR_Init(void) diff --git a/engine/client/cl_tent.c b/engine/client/cl_tent.c index 2cc8f51cf..6bd216a6c 100644 --- a/engine/client/cl_tent.c +++ b/engine/client/cl_tent.c @@ -158,10 +158,10 @@ sfx_t *cl_sfx_ric2; sfx_t *cl_sfx_ric3; sfx_t *cl_sfx_r_exp3; -cvar_t cl_expsprite = {"cl_expsprite", "0"}; -cvar_t r_explosionlight = {"r_explosionlight", "1"}; -cvar_t cl_truelightning = {"cl_truelightning", "0", NULL, CVAR_SEMICHEAT}; -cvar_t cl_beam_trace = {"cl_beam_trace", "0"}; +cvar_t cl_expsprite = SCVAR("cl_expsprite", "0"); +cvar_t r_explosionlight = SCVAR("r_explosionlight", "1"); +cvar_t cl_truelightning = SCVARF("cl_truelightning", "0", CVAR_SEMICHEAT); +cvar_t cl_beam_trace = SCVAR("cl_beam_trace", "0"); typedef struct { sfx_t **sfx; diff --git a/engine/client/console.c b/engine/client/console.c index 8cc7f6fe0..e6f225bbf 100644 --- a/engine/client/console.c +++ b/engine/client/console.c @@ -84,11 +84,11 @@ qterm_t *activeqterm; float con_cursorspeed = 4; -cvar_t con_numnotifylines = {"con_notifylines","4"}; //max lines to show -cvar_t con_notifytime = {"con_notifytime","3"}; //seconds -cvar_t con_centernotify = {"con_centernotify", "0"}; -cvar_t con_displaypossabilities = {"con_displaypossabilities", "1"}; -cvar_t cl_chatmode = {"cl_chatmode", "2"}; +cvar_t con_numnotifylines = SCVAR("con_notifylines","4"); //max lines to show +cvar_t con_notifytime = SCVAR("con_notifytime","3"); //seconds +cvar_t con_centernotify = SCVAR("con_centernotify", "0"); +cvar_t con_displaypossabilities = SCVAR("con_displaypossabilities", "1"); +cvar_t cl_chatmode = SCVAR("cl_chatmode", "2"); #define NUM_CON_TIMES 24 float con_times[NUM_CON_TIMES]; // realtime time the line was generated diff --git a/engine/client/image.c b/engine/client/image.c index ff759a977..234a5e3d7 100644 --- a/engine/client/image.c +++ b/engine/client/image.c @@ -3,13 +3,13 @@ #include "glquake.h" #endif -cvar_t r_dodgytgafiles = {"r_dodgytgafiles", "0"}; //Certain tgas are upside down. +cvar_t r_dodgytgafiles = SCVAR("r_dodgytgafiles", "0"); //Certain tgas are upside down. //This is due to a bug in tenebrae. //(normally) the textures are actually the right way around. //but some people have gone and 'fixed' those broken ones by flipping. //these images appear upside down in any editor but correct in tenebrae //set this to 1 to emulate tenebrae's bug. -cvar_t r_dodgypcxfiles = {"r_dodgypcxfiles", "0"}; //Quake 2's PCX loading isn't complete, +cvar_t r_dodgypcxfiles = SCVAR("r_dodgypcxfiles", "0"); //Quake 2's PCX loading isn't complete, //and some Q2 mods include PCX files //that only work with this assumption diff --git a/engine/client/in_win.c b/engine/client/in_win.c index abeb82bd7..ca9f1dbfc 100644 --- a/engine/client/in_win.c +++ b/engine/client/in_win.c @@ -52,16 +52,16 @@ HRESULT (WINAPI *pDirectInputCreate)(HINSTANCE hinst, DWORD dwVersion, #define DINPUT_VERSION_DX7 0x0700 // mouse variables -cvar_t m_filter = {"m_filter","0"}; -cvar_t m_accel = {"m_accel", "0"}; -cvar_t m_forcewheel = {"m_forcewheel", "1"}; -cvar_t in_mwhook = {"in_mwhook","0", NULL, CVAR_ARCHIVE}; -cvar_t in_dinput = {"in_dinput","0", NULL, CVAR_ARCHIVE}; +cvar_t m_filter = SCVAR("m_filter","0"); +cvar_t m_accel = SCVAR("m_accel", "0"); +cvar_t m_forcewheel = SCVAR("m_forcewheel", "1"); +cvar_t in_mwhook = SCVARF("in_mwhook","0", CVAR_ARCHIVE); +cvar_t in_dinput = SCVARF("in_dinput","0", CVAR_ARCHIVE); -cvar_t m_accel_noforce = {"m_accel_noforce", "0"}; -cvar_t m_threshold_noforce = {"m_threshold_noforce", "0"}; +cvar_t m_accel_noforce = SCVAR("m_accel_noforce", "0"); +cvar_t m_threshold_noforce = SCVAR("m_threshold_noforce", "0"); -cvar_t cl_keypad = {"cl_keypad", "0"}; +cvar_t cl_keypad = SCVAR("cl_keypad", "0"); qboolean CSQC_MouseMove(float xdelta, float ydelta); @@ -134,7 +134,7 @@ DWORD dwControlMap[JOY_MAX_AXES]; PDWORD pdwRawValue[JOY_MAX_AXES]; #ifdef IN_XFLIP -cvar_t in_xflip = {"in_xflip", "0"}; +cvar_t in_xflip = SCVAR("in_xflip", "0"); #endif // none of these cvars are saved over a session @@ -142,25 +142,25 @@ cvar_t in_xflip = {"in_xflip", "0"}; // each time. this avoids any problems with getting back to a default usage // or when changing from one controller to another. this way at least something // works. -cvar_t in_joystick = {"joystick","0", NULL, CVAR_ARCHIVE}; -cvar_t joy_name = {"joyname", "joystick"}; -cvar_t joy_advanced = {"joyadvanced", "0"}; -cvar_t joy_advaxisx = {"joyadvaxisx", "0"}; -cvar_t joy_advaxisy = {"joyadvaxisy", "0"}; -cvar_t joy_advaxisz = {"joyadvaxisz", "0"}; -cvar_t joy_advaxisr = {"joyadvaxisr", "0"}; -cvar_t joy_advaxisu = {"joyadvaxisu", "0"}; -cvar_t joy_advaxisv = {"joyadvaxisv", "0"}; -cvar_t joy_forwardthreshold = {"joyforwardthreshold", "0.15"}; -cvar_t joy_sidethreshold = {"joysidethreshold", "0.15"}; -cvar_t joy_pitchthreshold = {"joypitchthreshold", "0.15"}; -cvar_t joy_yawthreshold = {"joyyawthreshold", "0.15"}; -cvar_t joy_forwardsensitivity = {"joyforwardsensitivity", "-1.0"}; -cvar_t joy_sidesensitivity = {"joysidesensitivity", "-1.0"}; -cvar_t joy_pitchsensitivity = {"joypitchsensitivity", "1.0"}; -cvar_t joy_yawsensitivity = {"joyyawsensitivity", "-1.0"}; -cvar_t joy_wwhack1 = {"joywwhack1", "0.0"}; -cvar_t joy_wwhack2 = {"joywwhack2", "0.0"}; +cvar_t in_joystick = SCVARF("joystick","0", CVAR_ARCHIVE); +cvar_t joy_name = SCVAR("joyname", "joystick"); +cvar_t joy_advanced = SCVAR("joyadvanced", "0"); +cvar_t joy_advaxisx = SCVAR("joyadvaxisx", "0"); +cvar_t joy_advaxisy = SCVAR("joyadvaxisy", "0"); +cvar_t joy_advaxisz = SCVAR("joyadvaxisz", "0"); +cvar_t joy_advaxisr = SCVAR("joyadvaxisr", "0"); +cvar_t joy_advaxisu = SCVAR("joyadvaxisu", "0"); +cvar_t joy_advaxisv = SCVAR("joyadvaxisv", "0"); +cvar_t joy_forwardthreshold = SCVAR("joyforwardthreshold", "0.15"); +cvar_t joy_sidethreshold = SCVAR("joysidethreshold", "0.15"); +cvar_t joy_pitchthreshold = SCVAR("joypitchthreshold", "0.15"); +cvar_t joy_yawthreshold = SCVAR("joyyawthreshold", "0.15"); +cvar_t joy_forwardsensitivity = SCVAR("joyforwardsensitivity", "-1.0"); +cvar_t joy_sidesensitivity = SCVAR("joysidesensitivity", "-1.0"); +cvar_t joy_pitchsensitivity = SCVAR("joypitchsensitivity", "1.0"); +cvar_t joy_yawsensitivity = SCVAR("joyyawsensitivity", "-1.0"); +cvar_t joy_wwhack1 = SCVAR("joywwhack1", "0.0"); +cvar_t joy_wwhack2 = SCVAR("joywwhack2", "0.0"); qboolean joy_avail, joy_advancedinit, joy_haspov; DWORD joy_oldbuttonstate, joy_oldpovstate; @@ -265,9 +265,9 @@ int rawmicecount; RAWINPUT *raw; int ribuffersize; -cvar_t in_rawinput = {"in_rawinput", "0"}; -cvar_t in_rawinput_combine = {"in_rawinput_combine", "0"}; -cvar_t in_rawinput_rdp = {"in_rawinput_rdp", "0"}; +cvar_t in_rawinput = SCVAR("in_rawinput", "0"); +cvar_t in_rawinput_combine = SCVAR("in_rawinput_combine", "0"); +cvar_t in_rawinput_rdp = SCVAR("in_rawinput_rdp", "0"); void IN_RawInput_DeRegister(void); int IN_RawInput_Register(void); diff --git a/engine/client/keys.c b/engine/client/keys.c index 60ca9d55c..43ad3b0ee 100644 --- a/engine/client/keys.c +++ b/engine/client/keys.c @@ -55,6 +55,7 @@ qboolean keydown[K_MAX]; qboolean deltaused[K_MAX][KEY_MODIFIERSTATES]; extern cvar_t con_displaypossabilities; +cvar_t con_selectioncolour = SCVAR("con_selectioncolour", "0"); extern cvar_t cl_chatmode; static int KeyModifier (qboolean shift, qboolean alt, qboolean ctrl) @@ -390,8 +391,6 @@ void Key_ConsoleDrawSelectionBox(void) extern int mousecursor_x, mousecursor_y; int xpos, ypos, temp; int xpos2, ypos2; - char *buf, *bufhead; - int x, y; if (!con_mousedown[2]) return; @@ -425,22 +424,26 @@ void Key_ConsoleDrawSelectionBox(void) } ypos++; - Draw_Fill(xpos2*8, ypos2*8, (xpos - xpos2)*8, (ypos - ypos2)*8, 0); + Draw_Fill(xpos2*8, ypos2*8, (xpos - xpos2)*8, (ypos - ypos2)*8, con_selectioncolour.value); } void Key_ConsoleRelease(int key) { - if (key == K_MOUSE1 && con_mousedown[2]) + if (key == K_MOUSE1) + con_mousedown[2] = false; + if (key == K_MOUSE2 && con_mousedown[2]) { extern cvar_t vid_conwidth, vid_conheight; extern int mousecursor_x, mousecursor_y; int xpos, ypos, temp; char *buf, *bufhead; int x, y; + + con_mousedown[2] = false; + xpos = (int)((mousecursor_x*vid_conwidth.value)/(vid.width*8)); ypos = (int)((mousecursor_y*vid_conheight.value)/(vid.height*8)); - con_mousedown[2] = false; if (con_mousedown[0] < 1) con_mousedown[0] = 1; if (xpos < 1) @@ -555,8 +558,11 @@ void Key_Console (int key) } } } - else + else if (key == K_MOUSE2) con_mousedown[2] = true; + else + con_mousedown[2] = false; + return; } @@ -1264,6 +1270,8 @@ void Key_Init (void) Cmd_AddCommand ("bindlevel",Key_BindLevel_f); Cmd_AddCommand ("unbind",Key_Unbind_f); Cmd_AddCommand ("unbindall",Key_Unbindall_f); + + Cvar_Register (&con_selectioncolour, "Console variables"); } /* diff --git a/engine/client/m_download.c b/engine/client/m_download.c index 8490f9c60..da3cab2ac 100644 --- a/engine/client/m_download.c +++ b/engine/client/m_download.c @@ -392,7 +392,6 @@ void M_AddItemsToDownloadMenu(menu_t *m) int y; package_t *p; menucustom_t *c; - int slashpos; char *slash; menuoption_t *mo; dlmenu_t *info = m->data; diff --git a/engine/client/m_items.c b/engine/client/m_items.c index 6a6965a3a..dae030838 100644 --- a/engine/client/m_items.c +++ b/engine/client/m_items.c @@ -991,7 +991,6 @@ void M_Complex_Draw(void) extern int mousecursor_x, mousecursor_y; menu_t *menu, *cmenu; qboolean foundexclusive = false; - mpic_t *p; if (omousex != mousecursor_x || omousey != mousecursor_y) mousemoved = true; diff --git a/engine/client/m_master.c b/engine/client/m_master.c index ea69580e0..0358e9de7 100644 --- a/engine/client/m_master.c +++ b/engine/client/m_master.c @@ -16,28 +16,28 @@ int slist_firstoption; int slist_type; //filtering -cvar_t sb_hideempty = {"sb_hideempty", "0", NULL, CVAR_ARCHIVE}; -cvar_t sb_hidenotempty = {"sb_hidenotempty", "0", NULL, CVAR_ARCHIVE}; -cvar_t sb_hidefull = {"sb_hidefull", "0", NULL, CVAR_ARCHIVE}; -cvar_t sb_hidedead = {"sb_hidedead", "1", NULL, CVAR_ARCHIVE}; -cvar_t sb_hidequake2 = {"sb_hidequake2", "1", NULL, CVAR_ARCHIVE}; -cvar_t sb_hidequake3 = {"sb_hidequake3", "1", NULL, CVAR_ARCHIVE}; -cvar_t sb_hidenetquake = {"sb_hidenetquake", "1", NULL, CVAR_ARCHIVE}; -cvar_t sb_hidequakeworld = {"sb_hidequakeworld", "0", NULL, CVAR_ARCHIVE}; -cvar_t sb_maxping = {"sb_maxping", "0", NULL, CVAR_ARCHIVE}; -cvar_t sb_gamedir = {"sb_gamedir", "", NULL, CVAR_ARCHIVE}; -cvar_t sb_mapname = {"sb_mapname", "", NULL, CVAR_ARCHIVE}; +cvar_t sb_hideempty = SCVARF("sb_hideempty", "0", CVAR_ARCHIVE); +cvar_t sb_hidenotempty = SCVARF("sb_hidenotempty", "0", CVAR_ARCHIVE); +cvar_t sb_hidefull = SCVARF("sb_hidefull", "0", CVAR_ARCHIVE); +cvar_t sb_hidedead = SCVARF("sb_hidedead", "1", CVAR_ARCHIVE); +cvar_t sb_hidequake2 = SCVARF("sb_hidequake2", "1", CVAR_ARCHIVE); +cvar_t sb_hidequake3 = SCVARF("sb_hidequake3", "1", CVAR_ARCHIVE); +cvar_t sb_hidenetquake = SCVARF("sb_hidenetquake", "1", CVAR_ARCHIVE); +cvar_t sb_hidequakeworld = SCVARF("sb_hidequakeworld","0", CVAR_ARCHIVE); +cvar_t sb_maxping = SCVARF("sb_maxping", "0", CVAR_ARCHIVE); +cvar_t sb_gamedir = SCVARF("sb_gamedir", "", CVAR_ARCHIVE); +cvar_t sb_mapname = SCVARF("sb_mapname", "", CVAR_ARCHIVE); -cvar_t sb_showping = {"sb_showping", "1", NULL, CVAR_ARCHIVE}; -cvar_t sb_showaddress = {"sb_showaddress", "0", NULL, CVAR_ARCHIVE}; -cvar_t sb_showmap = {"sb_showmap", "0", NULL, CVAR_ARCHIVE}; -cvar_t sb_showgamedir = {"sb_showgamedir", "0", NULL, CVAR_ARCHIVE}; -cvar_t sb_showplayers = {"sb_showplayers", "1", NULL, CVAR_ARCHIVE}; -cvar_t sb_showfraglimit = {"sb_showfraglimit", "0", NULL, CVAR_ARCHIVE}; -cvar_t sb_showtimelimit = {"sb_showtimelimit", "0", NULL, CVAR_ARCHIVE}; +cvar_t sb_showping = SCVARF("sb_showping", "1", CVAR_ARCHIVE); +cvar_t sb_showaddress = SCVARF("sb_showaddress", "0", CVAR_ARCHIVE); +cvar_t sb_showmap = SCVARF("sb_showmap", "0", CVAR_ARCHIVE); +cvar_t sb_showgamedir = SCVARF("sb_showgamedir", "0", CVAR_ARCHIVE); +cvar_t sb_showplayers = SCVARF("sb_showplayers", "1", CVAR_ARCHIVE); +cvar_t sb_showfraglimit = SCVARF("sb_showfraglimit","0", CVAR_ARCHIVE); +cvar_t sb_showtimelimit = SCVARF("sb_showtimelimit","0", CVAR_ARCHIVE); -cvar_t sb_filterkey = {"sb_filterkey", "hostname", NULL, CVAR_ARCHIVE}; -cvar_t sb_filtervalue = {"sb_filtervalue", "", NULL, CVAR_ARCHIVE}; +cvar_t sb_filterkey = SCVARF("sb_filterkey", "hostname", CVAR_ARCHIVE); +cvar_t sb_filtervalue = SCVARF("sb_filtervalue", "", CVAR_ARCHIVE); extern cvar_t slist_writeserverstxt; extern cvar_t slist_cacheinfo; diff --git a/engine/client/m_mp3.c b/engine/client/m_mp3.c index 1bc85066a..9c291cb40 100644 --- a/engine/client/m_mp3.c +++ b/engine/client/m_mp3.c @@ -39,10 +39,10 @@ static mediatrack_t currenttrack; int lasttrackplayed; int media_playing=true;//try to continue from the standard playlist -cvar_t media_shuffle = {"media_shuffle", "1"}; -cvar_t media_repeat = {"media_repeat", "1"}; +cvar_t media_shuffle = SCVAR("media_shuffle", "1"); +cvar_t media_repeat = SCVAR("media_repeat", "1"); #ifdef WINAMP -cvar_t media_hijackwinamp = {"media_hijackwinamp", "0"}; +cvar_t media_hijackwinamp = SCVAR("media_hijackwinamp", "0"); #endif int selectedoption=-1; @@ -1307,10 +1307,10 @@ char *capturevideomem; short *captureaudiomem; int captureaudiosamples; captureframe; -cvar_t capturerate = {"capturerate", "15"}; -cvar_t capturecodec = {"capturecodec", "divx"}; -cvar_t capturesound = {"capturesound", "1"}; -cvar_t capturemessage = {"capturemessage", ""}; +cvar_t capturerate = SCVAR("capturerate", "15"); +cvar_t capturecodec = SCVAR("capturecodec", "divx"); +cvar_t capturesound = SCVAR("capturesound", "1"); +cvar_t capturemessage = SCVAR("capturemessage", ""); qboolean recordingdemo; enum { CT_NONE, diff --git a/engine/client/m_script.c b/engine/client/m_script.c index 140dcf5b7..d37aaf6dd 100644 --- a/engine/client/m_script.c +++ b/engine/client/m_script.c @@ -4,7 +4,7 @@ int selectitem; menu_t *menu_script; -cvar_t menualias = {"menualias", ""}; +cvar_t menualias = SCVAR("menualias", ""); void M_Script_Remove (menu_t *menu) { diff --git a/engine/client/menu.c b/engine/client/menu.c index 5b81490cc..6343a390c 100644 --- a/engine/client/menu.c +++ b/engine/client/menu.c @@ -42,7 +42,7 @@ char m_return_reason [32]; void M_ConfigureNetSubsystem(void); -cvar_t m_helpismedia = {"m_helpismedia", "0"}; +cvar_t m_helpismedia = SCVAR("m_helpismedia", "0"); //============================================================================= /* Support Routines */ diff --git a/engine/client/net_master.c b/engine/client/net_master.c index 0f0a88a27..7671158e5 100644 --- a/engine/client/net_master.c +++ b/engine/client/net_master.c @@ -46,8 +46,8 @@ typedef int SOCKET; //the number of servers should be limited only by memory. -cvar_t slist_cacheinfo = {"slist_cacheinfo", "0"}; //this proves dangerous, memory wise. -cvar_t slist_writeserverstxt = {"slist_writeservers", "0"}; +cvar_t slist_cacheinfo = SCVAR("slist_cacheinfo", "0"); //this proves dangerous, memory wise. +cvar_t slist_writeserverstxt = SCVAR("slist_writeservers", "0"); void CL_MasterListParse(int type, qboolean slashpad); void CL_QueryServers(void); diff --git a/engine/client/pr_csqc.c b/engine/client/pr_csqc.c index 60f278aea..03f208759 100644 --- a/engine/client/pr_csqc.c +++ b/engine/client/pr_csqc.c @@ -27,10 +27,10 @@ qboolean csqc_addcrosshair; static int num_csqc_edicts; #define CSQCPROGSGROUP "CSQC progs control" -cvar_t pr_csmaxedicts = {"pr_csmaxedicts", "3072"}; -cvar_t cl_csqcdebug = {"cl_csqcdebug", "0"}; //prints entity numbers which arrive (so I can tell people not to apply it to players...) -cvar_t cl_nocsqc = {"cl_nocsqc", "0"}; -cvar_t pr_csqc_coreonerror = {"pr_csqc_coreonerror", "1"}; +cvar_t pr_csmaxedicts = SCVAR("pr_csmaxedicts", "3072"); +cvar_t cl_csqcdebug = SCVAR("cl_csqcdebug", "0"); //prints entity numbers which arrive (so I can tell people not to apply it to players...) +cvar_t cl_nocsqc = SCVAR("cl_nocsqc", "0"); +cvar_t pr_csqc_coreonerror = SCVAR("pr_csqc_coreonerror", "1"); // standard effect cvars/sounds extern cvar_t r_explosionlight; @@ -77,6 +77,8 @@ extern sfx_t *cl_sfx_r_exp3; globalvector(trace_plane_normal, "trace_plane_normal"); /*vector written by traceline*/ \ globalfloat(trace_plane_dist, "trace_plane_dist"); /*float written by traceline*/ \ globalentity(trace_ent, "trace_ent"); /*entity written by traceline*/ \ + globalfloat(trace_surfaceflags, "trace_surfaceflags"); /*float written by traceline*/ \ + globalfloat(trace_endcontents, "trace_endcontents"); /*float written by traceline*/ \ \ globalfloat(clientcommandframe, "clientcommandframe"); \ globalfloat(servercommandframe, "servercommandframe"); \ @@ -1116,7 +1118,7 @@ static void PF_R_RenderScene(progfuncs_t *prinst, struct globalvars_s *pr_global } #endif - #ifdef RGLQUAKE +#ifdef RGLQUAKE if (qrenderer == QR_OPENGL) { qglDisable(GL_ALPHA_TEST); @@ -1208,6 +1210,8 @@ static void cs_settracevars(trace_t *tr) VectorCopy (tr->endpos, csqcg.trace_endpos); VectorCopy (tr->plane.normal, csqcg.trace_plane_normal); *csqcg.trace_plane_dist = tr->plane.dist; + *csqcg.trace_surfaceflags = tr->surface?tr->surface->flags:0; + *csqcg.trace_endcontents = tr->contents; if (tr->ent) *csqcg.trace_ent = EDICT_TO_PROG(csqcprogs, (void*)tr->ent); else diff --git a/engine/client/pr_menu.c b/engine/client/pr_menu.c index 356fcbbec..aec52b1e3 100644 --- a/engine/client/pr_menu.c +++ b/engine/client/pr_menu.c @@ -27,8 +27,8 @@ int menuentsize; // cvars #define MENUPROGSGROUP "Menu progs control" -cvar_t forceqmenu = {"forceqmenu", "0"}; -cvar_t pr_menuqc_coreonerror = {"pr_menuqc_coreonerror", "1"}; +cvar_t forceqmenu = SCVAR("forceqmenu", "0"); +cvar_t pr_menuqc_coreonerror = SCVAR("pr_menuqc_coreonerror", "1"); //new generic functions. diff --git a/engine/client/quakedef.h b/engine/client/quakedef.h index 160d7926f..ed77988b3 100644 --- a/engine/client/quakedef.h +++ b/engine/client/quakedef.h @@ -76,7 +76,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #pragma warning(3:4674) // dtor of thrown object is inaccessible #pragma warning(3:4705) // statement has no effect (example: a+1;) -#pragma warning(3:4013) // function undefined, assuming extern returning int +#pragma warning(4:4013) // function undefined, assuming extern returning int #pragma warning( 4 : 4267) //truncation from const double to float @@ -112,7 +112,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include -#if defined(AVAIL_PNGLIB) && defined(PNG_SUCKS_WITH_SETJMP) +#if defined(AVAIL_PNGLIB) && defined(PNG_SUCKS_WITH_SETJMP) && !defined(SERVERONLY) #include #else #include diff --git a/engine/client/r_bulleten.c b/engine/client/r_bulleten.c index a0a85437f..83135db7a 100644 --- a/engine/client/r_bulleten.c +++ b/engine/client/r_bulleten.c @@ -47,23 +47,23 @@ Effects: 9: */ -cvar_t bul_text1 = {"bul_text1", "0Cheesy Forethoug\\nht entertainment"}; -cvar_t bul_text2 = {"bul_text2", "2"}; -cvar_t bul_text3 = {"bul_text3", "0Join Shubs Army\\nFight for Fear"}; -cvar_t bul_text4 = {"bul_text4", "0Need a gun?\\nGoto bobs place!"}; -cvar_t bul_text5 = {"bul_text5", "0Beware the fans\\nThey can hurt."}; -cvar_t bul_text6 = {"bul_text6", "2Quake B Arena"}; +cvar_t bul_text1 = SCVAR("bul_text1", "0Cheesy Forethoug\\nht entertainment"); +cvar_t bul_text2 = SCVAR("bul_text2", "2"); +cvar_t bul_text3 = SCVAR("bul_text3", "0Join Shubs Army\\nFight for Fear"); +cvar_t bul_text4 = SCVAR("bul_text4", "0Need a gun?\\nGoto bobs place!"); +cvar_t bul_text5 = SCVAR("bul_text5", "0Beware the fans\\nThey can hurt."); +cvar_t bul_text6 = SCVAR("bul_text6", "2Quake B Arena"); -cvar_t bul_scrollspeedx = {"bul_scrollspeedx", "-20"}; //pixels per second -cvar_t bul_scrollspeedy = {"bul_scrollspeedy", "-10"}; //pixels per second -cvar_t bul_backcol = {"bul_backcolour", "1"}; -cvar_t bul_textpalette = {"bul_textpalette", "0"}; -cvar_t bul_norender = {"bul_norender", "0"}; -cvar_t bul_sparkle = {"bul_sparkle", "7"}; -cvar_t bul_forcemode = {"bul_forcemode", "-1"}; -cvar_t bul_ripplespeed = {"bul_ripplespeed", "32"}; -cvar_t bul_rippleamount = {"bul_rippleamount", "2"}; -cvar_t bul_nowater = {"bul_nowater", "1"}; +cvar_t bul_scrollspeedx = SCVAR("bul_scrollspeedx", "-20"); //pixels per second +cvar_t bul_scrollspeedy = SCVAR("bul_scrollspeedy", "-10"); //pixels per second +cvar_t bul_backcol = SCVAR("bul_backcolour", "1"); +cvar_t bul_textpalette = SCVAR("bul_textpalette", "0"); +cvar_t bul_norender = SCVAR("bul_norender", "0"); +cvar_t bul_sparkle = SCVAR("bul_sparkle", "7"); +cvar_t bul_forcemode = SCVAR("bul_forcemode", "-1"); +cvar_t bul_ripplespeed = SCVAR("bul_ripplespeed", "32"); +cvar_t bul_rippleamount = SCVAR("bul_rippleamount", "2"); +cvar_t bul_nowater = SCVAR("bul_nowater", "1"); int bultextpallete = 0; diff --git a/engine/client/r_part.c b/engine/client/r_part.c index 67dc13538..9a3b58316 100644 --- a/engine/client/r_part.c +++ b/engine/client/r_part.c @@ -122,20 +122,20 @@ extern cvar_t r_part_rain; extern cvar_t r_bloodstains; extern cvar_t gl_part_flame; -cvar_t r_particlesdesc = {"r_particlesdesc", "spikeset", NULL, CVAR_LATCH|CVAR_SEMICHEAT}; +cvar_t r_particlesdesc = SCVARF("r_particlesdesc", "spikeset", CVAR_LATCH|CVAR_SEMICHEAT); -cvar_t r_part_rain_quantity = {"r_part_rain_quantity", "1"}; +cvar_t r_part_rain_quantity = SCVAR("r_part_rain_quantity", "1"); -cvar_t r_rockettrail = {"r_rockettrail", "1", NULL, CVAR_SEMICHEAT}; -cvar_t r_grenadetrail = {"r_grenadetrail", "1", NULL, CVAR_SEMICHEAT}; +cvar_t r_rockettrail = SCVARF("r_rockettrail", "1", CVAR_SEMICHEAT); +cvar_t r_grenadetrail = SCVARF("r_grenadetrail", "1", CVAR_SEMICHEAT); -cvar_t r_particle_tracelimit = {"r_particle_tracelimit", "250"}; -cvar_t r_part_sparks = {"r_part_sparks", "1"}; -cvar_t r_part_sparks_trifan = {"r_part_sparks_trifan", "1"}; -cvar_t r_part_sparks_textured = {"r_part_sparks_textured", "1"}; -cvar_t r_part_beams = {"r_part_beams", "1"}; -cvar_t r_part_beams_textured = {"r_part_beams_textured", "1"}; -cvar_t r_part_contentswitch = {"r_part_contentswitch", "1"}; +cvar_t r_particle_tracelimit = SCVAR("r_particle_tracelimit", "250"); +cvar_t r_part_sparks = SCVAR("r_part_sparks", "1"); +cvar_t r_part_sparks_trifan = SCVAR("r_part_sparks_trifan", "1"); +cvar_t r_part_sparks_textured = SCVAR("r_part_sparks_textured", "1"); +cvar_t r_part_beams = SCVAR("r_part_beams", "1"); +cvar_t r_part_beams_textured = SCVAR("r_part_beams_textured", "1"); +cvar_t r_part_contentswitch = SCVAR("r_part_contentswitch", "1"); static float particletime; diff --git a/engine/client/renderer.c b/engine/client/renderer.c index cf95d832f..76920f6c9 100644 --- a/engine/client/renderer.c +++ b/engine/client/renderer.c @@ -28,161 +28,161 @@ extern int gl_anisotropy_factor; // -cvar_t r_drawviewmodel = {"r_drawviewmodel","1"}; -cvar_t r_drawviewmodelinvis = {"r_drawviewmodelinvis", "0"}; -cvar_t r_netgraph = {"r_netgraph","0"}; -cvar_t r_speeds = {"r_speeds","0", NULL, CVAR_CHEAT}; -cvar_t r_waterwarp = {"r_waterwarp","1"}; -cvar_t r_drawentities = {"r_drawentities","1"}; -cvar_t r_fullbright = {"r_fullbright","0", NULL, CVAR_CHEAT}; -cvar_t r_ambient = {"r_ambient", "0", NULL, CVAR_CHEAT}; +cvar_t r_drawviewmodel = SCVAR("r_drawviewmodel","1"); +cvar_t r_drawviewmodelinvis = SCVAR("r_drawviewmodelinvis", "0"); +cvar_t r_netgraph = SCVAR("r_netgraph","0"); +cvar_t r_speeds = SCVARF("r_speeds","0", CVAR_CHEAT); +cvar_t r_waterwarp = SCVAR("r_waterwarp","1"); +cvar_t r_drawentities = SCVAR("r_drawentities","1"); +cvar_t r_fullbright = SCVARF("r_fullbright","0", CVAR_CHEAT); +cvar_t r_ambient = SCVARF("r_ambient", "0", CVAR_CHEAT); #if defined(SWQUAKE) -cvar_t r_draworder = {"r_draworder","0", NULL, CVAR_CHEAT}; -cvar_t r_timegraph = {"r_timegraph","0"}; -cvar_t r_zgraph = {"r_zgraph","0"}; -cvar_t r_graphheight = {"r_graphheight","15"}; -cvar_t r_clearcolor = {"r_clearcolor","218"}; -cvar_t r_aliasstats = {"r_polymodelstats","0"}; -cvar_t r_dspeeds = {"r_dspeeds","0"}; -//cvar_t r_drawflat = {"r_drawflat", "0", NULL, CVAR_CHEAT}; -cvar_t r_reportsurfout = {"r_reportsurfout", "0"}; -cvar_t r_maxsurfs = {"r_maxsurfs", "0"}; -cvar_t r_numsurfs = {"r_numsurfs", "0"}; -cvar_t r_reportedgeout = {"r_reportedgeout", "0"}; -cvar_t r_maxedges = {"r_maxedges", "0"}; -cvar_t r_numedges = {"r_numedges", "0"}; -cvar_t r_aliastransbase = {"r_aliastransbase", "200"}; -cvar_t r_aliastransadj = {"r_aliastransadj", "100"}; -cvar_t d_smooth = {"d_smooth", "0"}; +cvar_t r_draworder = SCVARF("r_draworder","0", CVAR_CHEAT); +cvar_t r_timegraph = SCVAR("r_timegraph","0"); +cvar_t r_zgraph = SCVAR("r_zgraph","0"); +cvar_t r_graphheight = SCVAR("r_graphheight","15"); +cvar_t r_clearcolor = SCVAR("r_clearcolor","218"); +cvar_t r_aliasstats = SCVAR("r_polymodelstats","0"); +cvar_t r_dspeeds = SCVAR("r_dspeeds","0"); +//cvar_t r_drawflat = SCVARF("r_drawflat", "0", CVAR_CHEAT); +cvar_t r_reportsurfout = SCVAR("r_reportsurfout", "0"); +cvar_t r_maxsurfs = SCVAR("r_maxsurfs", "0"); +cvar_t r_numsurfs = SCVAR("r_numsurfs", "0"); +cvar_t r_reportedgeout = SCVAR("r_reportedgeout", "0"); +cvar_t r_maxedges = SCVAR("r_maxedges", "0"); +cvar_t r_numedges = SCVAR("r_numedges", "0"); +cvar_t r_aliastransbase = SCVAR("r_aliastransbase", "200"); +cvar_t r_aliastransadj = SCVAR("r_aliastransadj", "100"); +cvar_t d_smooth = SCVAR("d_smooth", "0"); #endif -cvar_t gl_skyboxdist = {"gl_skyboxdist", "2300"}; +cvar_t gl_skyboxdist = SCVAR("gl_skyboxdist", "2300"); -cvar_t r_vertexdlights = {"r_vertexdlights", "1"}; +cvar_t r_vertexdlights = SCVAR("r_vertexdlights", "1"); -cvar_t cl_cursor = {"cl_cursor", ""}; -cvar_t cl_cursorsize = {"cl_cursorsize", "32"}; -cvar_t cl_cursorbias = {"cl_cursorbias", "4"}; +cvar_t cl_cursor = SCVAR("cl_cursor", ""); +cvar_t cl_cursorsize = SCVAR("cl_cursorsize", "32"); +cvar_t cl_cursorbias = SCVAR("cl_cursorbias", "4"); extern cvar_t r_dodgytgafiles; extern cvar_t r_dodgypcxfiles; -cvar_t r_nolerp = {"r_nolerp", "0"}; -cvar_t r_nolightdir = {"r_nolightdir", "0"}; +cvar_t r_nolerp = SCVAR("r_nolerp", "0"); +cvar_t r_nolightdir = SCVAR("r_nolightdir", "0"); -cvar_t r_sirds = {"r_sirds", "0", NULL, CVAR_SEMICHEAT};//whack in a value of 2 and you get easily visible players. +cvar_t r_sirds = SCVARF("r_sirds", "0", CVAR_SEMICHEAT);//whack in a value of 2 and you get easily visible players. -cvar_t r_loadlits = {"r_loadlit", "1"}; +cvar_t r_loadlits = SCVAR("r_loadlit", "1"); -cvar_t r_stains = {"r_stains", "0.75", NULL, CVAR_ARCHIVE}; -cvar_t r_stainfadetime = {"r_stainfadetime", "1"}; -cvar_t r_stainfadeammount = {"r_stainfadeammount", "1"}; +cvar_t r_stains = SCVARF("r_stains", "0.75", CVAR_ARCHIVE); +cvar_t r_stainfadetime = SCVAR("r_stainfadetime", "1"); +cvar_t r_stainfadeammount = SCVAR("r_stainfadeammount", "1"); -cvar_t _windowed_mouse = {"_windowed_mouse","1"}; -cvar_t vid_wait = {"vid_wait","0"}; -cvar_t _vid_wait_override = {"_vid_wait_override", "", NULL, CVAR_ARCHIVE}; +cvar_t _windowed_mouse = SCVAR("_windowed_mouse","1"); +cvar_t vid_wait = SCVAR("vid_wait","0"); +cvar_t _vid_wait_override = SCVARF("_vid_wait_override", "", CVAR_ARCHIVE); -static cvar_t vid_stretch = {"vid_stretch","1", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; -//cvar_t _windowed_mouse = {"_windowed_mouse","1", CVAR_ARCHIVE}; -static cvar_t gl_driver = {"gl_driver","", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; //opengl library -cvar_t vid_renderer = {"vid_renderer", "", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; //see R_RestartRenderer_f for the effective default 'if (newr.renderer == -1)'. +static cvar_t vid_stretch = SCVARF("vid_stretch","1", CVAR_ARCHIVE|CVAR_RENDERERLATCH); +//cvar_t _windowed_mouse = SCVARF("_windowed_mouse","1", CVAR_ARCHIVE); +static cvar_t gl_driver = SCVARF("gl_driver","", CVAR_ARCHIVE|CVAR_RENDERERLATCH); //opengl library +cvar_t vid_renderer = SCVARF("vid_renderer", "", CVAR_ARCHIVE|CVAR_RENDERERLATCH); //see R_RestartRenderer_f for the effective default 'if (newr.renderer == -1)'. -static cvar_t vid_bpp = {"vid_bpp", "32", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; -static cvar_t vid_allow_modex = {"vid_allow_modex", "1", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; -static cvar_t vid_fullscreen = {"vid_fullscreen", "1", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; -static cvar_t vid_width = {"vid_width", "640", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; //more readable defaults to match conwidth/conheight. -static cvar_t vid_height = {"vid_height", "480", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; -static cvar_t vid_refreshrate = {"vid_displayfrequency", "0", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; +static cvar_t vid_bpp = SCVARF("vid_bpp", "32", CVAR_ARCHIVE|CVAR_RENDERERLATCH); +static cvar_t vid_allow_modex = SCVARF("vid_allow_modex", "1", CVAR_ARCHIVE|CVAR_RENDERERLATCH); +static cvar_t vid_fullscreen = SCVARF("vid_fullscreen", "1", CVAR_ARCHIVE|CVAR_RENDERERLATCH); +static cvar_t vid_width = SCVARF("vid_width", "640", CVAR_ARCHIVE|CVAR_RENDERERLATCH); //more readable defaults to match conwidth/conheight. +static cvar_t vid_height = SCVARF("vid_height", "480", CVAR_ARCHIVE|CVAR_RENDERERLATCH); +static cvar_t vid_refreshrate = SCVARF("vid_displayfrequency", "0", CVAR_ARCHIVE|CVAR_RENDERERLATCH); -cvar_t gl_texturemode = {"gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST"}; -cvar_t gl_motionblur = {"gl_motionblur", "0"}; -cvar_t gl_motionblurscale = {"gl_motionblurscale", "1"}; -cvar_t gl_fontedgeclamp = {"gl_fontedgeclamp", "0"}; //gl blends. Set this to 1 to stop the outside of your conchars from being visible -cvar_t gl_font = {"gl_font", ""}; -cvar_t gl_conback = {"gl_conback", ""}; -cvar_t gl_smoothfont = {"gl_smoothfont", "1"}; -cvar_t gl_part_flame = {"gl_part_flame", "1"}; -cvar_t r_part_rain = {"r_part_rain", "0"}; +cvar_t gl_texturemode = SCVAR("gl_texturemode", "GL_LINEAR_MIPMAP_NEAREST"); +cvar_t gl_motionblur = SCVAR("gl_motionblur", "0"); +cvar_t gl_motionblurscale = SCVAR("gl_motionblurscale", "1"); +cvar_t gl_fontedgeclamp = SCVAR("gl_fontedgeclamp", "0"); //gl blends. Set this to 1 to stop the outside of your conchars from being visible +cvar_t gl_font = SCVAR("gl_font", ""); +cvar_t gl_conback = SCVAR("gl_conback", ""); +cvar_t gl_smoothfont = SCVAR("gl_smoothfont", "1"); +cvar_t gl_part_flame = SCVAR("gl_part_flame", "1"); +cvar_t r_part_rain = SCVAR("r_part_rain", "0"); -cvar_t r_bouncysparks = {"r_bouncysparks", "0"}; +cvar_t r_bouncysparks = SCVAR("r_bouncysparks", "0"); -cvar_t r_fullbrightSkins = {"r_fullbrightSkins", "1", NULL, CVAR_SEMICHEAT}; -cvar_t r_fb_models = {"gl_fb_models", "1", NULL, CVAR_SEMICHEAT|CVAR_RENDERERLATCH}; //as it can highlight the gun a little... ooo nooo.... -cvar_t r_fb_bmodels = {"gl_fb_bmodels", "1", NULL, CVAR_SEMICHEAT|CVAR_RENDERERLATCH}; //as it can highlight the gun a little... ooo nooo.... +cvar_t r_fullbrightSkins = SCVARF("r_fullbrightSkins", "1", CVAR_SEMICHEAT); +cvar_t r_fb_models = SCVARF("gl_fb_models", "1", CVAR_SEMICHEAT|CVAR_RENDERERLATCH); //as it can highlight the gun a little... ooo nooo.... +cvar_t r_fb_bmodels = SCVARF("gl_fb_bmodels", "1", CVAR_SEMICHEAT|CVAR_RENDERERLATCH); //as it can highlight the gun a little... ooo nooo.... -cvar_t r_shadow_bumpscale_basetexture = {"r_shadow_bumpscale_basetexture", "4"}; -cvar_t r_shadow_bumpscale_bumpmap = {"r_shadow_bumpscale_bumpmap", "10"}; -cvar_t gl_nocolors = {"gl_nocolors","0"}; -cvar_t gl_load24bit = {"gl_load24bit", "1"}; -cvar_t vid_conwidth = {"vid_conwidth", "640", NULL, CVAR_ARCHIVE}; -cvar_t vid_conheight = {"vid_conheight", "480", NULL, CVAR_ARCHIVE}; -cvar_t gl_nobind = {"gl_nobind", "0"}; -cvar_t gl_max_size = {"gl_max_size", "1024"}; -cvar_t gl_picmip = {"gl_picmip", "0"}; -cvar_t gl_picmip2d = {"gl_picmip2d", "0"}; -cvar_t r_drawdisk = {"r_drawdisk", "1"}; -cvar_t gl_compress = {"gl_compress", "0"}; -cvar_t gl_savecompressedtex = {"gl_savecompressedtex", "0"}; +cvar_t r_shadow_bumpscale_basetexture = SCVAR("r_shadow_bumpscale_basetexture", "4"); +cvar_t r_shadow_bumpscale_bumpmap = SCVAR("r_shadow_bumpscale_bumpmap", "10"); +cvar_t gl_nocolors = SCVAR("gl_nocolors","0"); +cvar_t gl_load24bit = SCVAR("gl_load24bit", "1"); +cvar_t vid_conwidth = SCVARF("vid_conwidth", "640", CVAR_ARCHIVE); +cvar_t vid_conheight = SCVARF("vid_conheight", "480", CVAR_ARCHIVE); +cvar_t gl_nobind = SCVAR("gl_nobind", "0"); +cvar_t gl_max_size = SCVAR("gl_max_size", "1024"); +cvar_t gl_picmip = SCVAR("gl_picmip", "0"); +cvar_t gl_picmip2d = SCVAR("gl_picmip2d", "0"); +cvar_t r_drawdisk = SCVAR("r_drawdisk", "1"); +cvar_t gl_compress = SCVAR("gl_compress", "0"); +cvar_t gl_savecompressedtex = SCVAR("gl_savecompressedtex", "0"); extern cvar_t gl_dither; extern cvar_t gl_maxdist; extern cvar_t gl_mindist; extern cvar_t gl_bloom; -cvar_t gl_detail = {"gl_detail", "0", NULL, CVAR_ARCHIVE}; -cvar_t gl_detailscale = {"gl_detailscale", "5"}; -cvar_t gl_overbright = {"gl_overbright", "0", NULL, CVAR_ARCHIVE}; -cvar_t r_shadows = {"r_shadows", "0", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; -cvar_t r_shadow_realtime_world = {"r_shadow_realtime_world", "0", NULL, CVAR_CHEAT}; -cvar_t r_shadow_realtime_world_lightmaps = {"r_shadow_realtime_world_lightmaps", "0.8", NULL, CVAR_CHEAT}; -cvar_t r_noaliasshadows = {"r_noaliasshadows", "0", NULL, CVAR_ARCHIVE}; -cvar_t gl_maxshadowlights = {"gl_maxshadowlights", "2", NULL, CVAR_ARCHIVE}; -cvar_t gl_bump = {"gl_bump", "0", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; -cvar_t r_shadow_glsl_offsetmapping = {"r_shadow_glsl_offsetmapping", "0"}; -cvar_t r_shadow_glsl_offsetmapping_scale = {"r_shadow_glsl_offsetmapping_scale", "-0.04"}; -cvar_t r_shadow_glsl_offsetmapping_bias = {"r_shadow_glsl_offsetmapping_bias", "0.04"}; +cvar_t gl_detail = SCVARF("gl_detail", "0", CVAR_ARCHIVE); +cvar_t gl_detailscale = SCVAR("gl_detailscale", "5"); +cvar_t gl_overbright = SCVARF("gl_overbright", "0", CVAR_ARCHIVE); +cvar_t r_shadows = SCVARF("r_shadows", "0", CVAR_ARCHIVE|CVAR_RENDERERLATCH); +cvar_t r_shadow_realtime_world = SCVARF("r_shadow_realtime_world", "0", CVAR_CHEAT); +cvar_t r_shadow_realtime_world_lightmaps = SCVARF("r_shadow_realtime_world_lightmaps", "0.8", CVAR_CHEAT); +cvar_t r_noaliasshadows = SCVARF("r_noaliasshadows", "0", CVAR_ARCHIVE); +cvar_t gl_maxshadowlights = SCVARF("gl_maxshadowlights", "2", CVAR_ARCHIVE); +cvar_t gl_bump = SCVARF("gl_bump", "0", CVAR_ARCHIVE|CVAR_RENDERERLATCH); +cvar_t r_shadow_glsl_offsetmapping = SCVAR("r_shadow_glsl_offsetmapping", "0"); +cvar_t r_shadow_glsl_offsetmapping_scale = SCVAR("r_shadow_glsl_offsetmapping_scale", "-0.04"); +cvar_t r_shadow_glsl_offsetmapping_bias = SCVAR("r_shadow_glsl_offsetmapping_bias", "0.04"); #ifdef SPECULAR -cvar_t gl_specular = {"gl_specular", "0"}; +cvar_t gl_specular = SCVAR("gl_specular", "0"); #endif -cvar_t gl_lightmapmode = {"gl_lightmapmode", "", NULL, CVAR_ARCHIVE}; +cvar_t gl_lightmapmode = SCVARF("gl_lightmapmode", "", CVAR_ARCHIVE); -cvar_t gl_ati_truform = {"gl_ati_truform", "0"}; -cvar_t gl_ati_truform_type = {"gl_ati_truform_type", "1"}; -cvar_t gl_ati_truform_tesselation = {"gl_ati_truform_tesselation", "3"}; +cvar_t gl_ati_truform = SCVAR("gl_ati_truform", "0"); +cvar_t gl_ati_truform_type = SCVAR("gl_ati_truform_type", "1"); +cvar_t gl_ati_truform_tesselation = SCVAR("gl_ati_truform_tesselation", "3"); -cvar_t mod_md3flags = {"mod_md3flags", "1"}; +cvar_t mod_md3flags = SCVAR("mod_md3flags", "1"); -cvar_t gl_lateswap = {"gl_lateswap", "0"}; +cvar_t gl_lateswap = SCVAR("gl_lateswap", "0"); -cvar_t gl_mylumassuck = {"gl_mylumassuck", "0"}; +cvar_t gl_mylumassuck = SCVAR("gl_mylumassuck", "0"); -cvar_t scr_sshot_type = {"scr_sshot_type", "jpg"}; +cvar_t scr_sshot_type = SCVAR("scr_sshot_type", "jpg"); -cvar_t scr_centersbar = {"scr_centersbar", "0"}; -cvar_t scr_consize = {"scr_consize", "0.5"}; -cvar_t scr_viewsize = {"viewsize","100", NULL, CVAR_ARCHIVE}; -cvar_t scr_fov = {"fov","90", NULL, CVAR_ARCHIVE}; // 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 scr_allowsnap = {"scr_allowsnap", "1", NULL, CVAR_NOTFROMSERVER}; //otherwise it would defeat the point. -cvar_t con_ocranaleds = {"con_ocranaleds", "2"}; +cvar_t scr_centersbar = SCVAR("scr_centersbar", "0"); +cvar_t scr_consize = SCVAR("scr_consize", "0.5"); +cvar_t scr_viewsize = SCVARF("viewsize","100", CVAR_ARCHIVE); +cvar_t scr_fov = SCVARF("fov","90", CVAR_ARCHIVE); // 10 - 170 +cvar_t scr_conspeed = SCVAR("scr_conspeed","300"); +cvar_t scr_centertime = SCVAR("scr_centertime","2"); +cvar_t scr_showram = SCVAR("showram","1"); +cvar_t scr_showturtle = SCVAR("showturtle","0"); +cvar_t scr_showpause = SCVAR("showpause","1"); +cvar_t scr_printspeed = SCVAR("scr_printspeed","8"); +cvar_t scr_allowsnap = SCVARF("scr_allowsnap", "1", CVAR_NOTFROMSERVER); //otherwise it would defeat the point. +cvar_t con_ocranaleds = SCVAR("con_ocranaleds", "2"); -cvar_t scr_chatmodecvar = {"scr_chatmode", "0"}; +cvar_t scr_chatmodecvar = SCVAR("scr_chatmode", "0"); #ifdef Q3SHADERS -cvar_t gl_shadeq3 = {"gl_shadeq3", "1"}; //use if you want. +cvar_t gl_shadeq3 = SCVAR("gl_shadeq3", "1"); //use if you want. extern cvar_t r_vertexlight; -cvar_t gl_shadeq1 = {"gl_shadeq1", "0", NULL, CVAR_CHEAT}; //FIXME: :( -cvar_t gl_shadeq1_name = {"gl_shadeq1_name", "*"}; +cvar_t gl_shadeq1 = SCVARF("gl_shadeq1", "0", CVAR_CHEAT); //FIXME: :( +cvar_t gl_shadeq1_name = SCVAR("gl_shadeq1_name", "*"); #endif -cvar_t gl_blend2d = {"gl_blend2d", "1"}; -cvar_t gl_blendsprites = {"gl_blendsprites", "1"}; +cvar_t gl_blend2d = SCVAR("gl_blend2d", "1"); +cvar_t gl_blendsprites = SCVAR("gl_blendsprites", "1"); -cvar_t r_bloodstains = {"r_bloodstains", "1"}; +cvar_t r_bloodstains = SCVAR("r_bloodstains", "1"); extern cvar_t r_norefresh; extern cvar_t r_drawentities; @@ -194,21 +194,21 @@ extern cvar_t r_fullbright; extern cvar_t r_shadows; extern cvar_t r_mirroralpha; extern cvar_t r_wateralpha; -cvar_t r_dynamic = {"r_dynamic","1"}; -cvar_t r_flashblend = {"gl_flashblend","0"}; -cvar_t r_lightstylesmooth = {"r_lightstylesmooth", "0"}; -cvar_t r_lightstylespeed = {"r_lightstylespeed", "10"}; +cvar_t r_dynamic = SCVAR("r_dynamic","1"); +cvar_t r_flashblend = SCVAR("gl_flashblend","0"); +cvar_t r_lightstylesmooth = SCVAR("r_lightstylesmooth", "0"); +cvar_t r_lightstylespeed = SCVAR("r_lightstylespeed", "10"); extern cvar_t r_novis; extern cvar_t r_netgraph; -cvar_t r_drawflat = {"r_drawflat","0", NULL, CVAR_SEMICHEAT}; -cvar_t r_wallcolour = {"r_wallcolour","0 0 1"}; -cvar_t r_floorcolour = {"r_floorcolour","0.5 0.5 1"}; +cvar_t r_drawflat = SCVARF("r_drawflat","0", CVAR_SEMICHEAT); +cvar_t r_wallcolour = SCVAR("r_wallcolour","0 0 1"); +cvar_t r_floorcolour = SCVAR("r_floorcolour","0.5 0.5 1"); -cvar_t d_palconvwrite = {"d_palconvwrite", "1"}; -cvar_t d_palremapsize = {"d_palremapsize", "64", NULL, CVAR_RENDERERLATCH}; +cvar_t d_palconvwrite = SCVAR("d_palconvwrite", "1"); +cvar_t d_palremapsize = SCVARF("d_palremapsize", "64", CVAR_RENDERERLATCH); -cvar_t r_lightmap_saturation = {"r_lightmap_saturation", "1"}; +cvar_t r_lightmap_saturation = SCVAR("r_lightmap_saturation", "1"); extern cvar_t bul_text1; extern cvar_t bul_text2; @@ -231,20 +231,20 @@ void R_BulletenForce_f (void); rendererstate_t currentrendererstate; -cvar_t gl_skyboxname = {"r_skybox", ""}; -cvar_t r_fastsky = {"r_fastsky", "0"}; -cvar_t r_fastskycolour = {"r_fastskycolour", "0"}; +cvar_t gl_skyboxname = SCVAR("r_skybox", ""); +cvar_t r_fastsky = SCVAR("r_fastsky", "0"); +cvar_t r_fastskycolour = SCVAR("r_fastskycolour", "0"); -cvar_t r_menutint = {"r_menutint", "0.68 0.4 0.13"}; +cvar_t r_menutint = SCVAR("r_menutint", "0.68 0.4 0.13"); #if defined(RGLQUAKE) -cvar_t gl_schematics = {"gl_schematics","0"}; -cvar_t gl_ztrick = {"gl_ztrick","1"}; -cvar_t gl_lerpimages = {"gl_lerpimages", "1"}; +cvar_t gl_schematics = SCVAR("gl_schematics","0"); +cvar_t gl_ztrick = SCVAR("gl_ztrick","1"); +cvar_t gl_lerpimages = SCVAR("gl_lerpimages", "1"); extern cvar_t r_waterlayers; -cvar_t gl_triplebuffer = {"gl_triplebuffer", "1", NULL, CVAR_ARCHIVE}; -cvar_t vid_hardwaregamma = {"vid_hardwaregamma", "1", NULL, CVAR_ARCHIVE}; -cvar_t vid_desktopgamma = {"vid_desktopgamma", "0", NULL, CVAR_ARCHIVE|CVAR_RENDERERLATCH}; +cvar_t gl_triplebuffer = SCVARF("gl_triplebuffer", "1", CVAR_ARCHIVE); +cvar_t vid_hardwaregamma = SCVARF("vid_hardwaregamma", "1", CVAR_ARCHIVE); +cvar_t vid_desktopgamma = SCVARF("vid_desktopgamma", "0", CVAR_ARCHIVE|CVAR_RENDERERLATCH); void GLRenderer_Init(void) { diff --git a/engine/client/skin.c b/engine/client/skin.c index 86a4e7f3f..7dc9d91a4 100644 --- a/engine/client/skin.c +++ b/engine/client/skin.c @@ -20,8 +20,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -cvar_t baseskin = {"baseskin", "base"}; -cvar_t noskins = {"noskins", "0"}; +cvar_t baseskin = SCVAR("baseskin", "base"); +cvar_t noskins = SCVAR("noskins", "0"); extern cvar_t cl_teamskin; extern cvar_t cl_enemyskin; diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index 714d240e7..fbb6fa705 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -61,28 +61,28 @@ int desired_bits = 16; int sound_started=0; -cvar_t bgmvolume = {"musicvolume", "0", NULL, CVAR_ARCHIVE}; -cvar_t volume = {"volume", "0.7", NULL, CVAR_ARCHIVE}; +cvar_t bgmvolume = SCVARF("musicvolume", "0", CVAR_ARCHIVE); +cvar_t volume = SCVARF("volume", "0.7", CVAR_ARCHIVE); -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_khz = {"snd_khz", "11"}; -cvar_t snd_inactive = {"snd_inactive", "0"}; //set if you want sound even when tabbed out. -cvar_t _snd_mixahead = {"_snd_mixahead", "0.2", NULL, CVAR_ARCHIVE}; -cvar_t snd_leftisright = {"snd_leftisright", "0", NULL, CVAR_ARCHIVE}; -cvar_t snd_eax = {"snd_eax", "0"}; -cvar_t snd_speakers = {"snd_numspeakers", "2"}; -cvar_t snd_playersoundvolume = {"snd_localvolume", "1"}; //sugested by crunch +cvar_t nosound = SCVAR("nosound", "0"); +cvar_t precache = SCVAR("precache", "1"); +cvar_t loadas8bit = SCVAR("loadas8bit", "0"); +cvar_t bgmbuffer = SCVAR("bgmbuffer", "4096"); +cvar_t ambient_level = SCVAR("ambient_level", "0.3"); +cvar_t ambient_fade = SCVAR("ambient_fade", "100"); +cvar_t snd_noextraupdate = SCVAR("snd_noextraupdate", "0"); +cvar_t snd_show = SCVAR("snd_show", "0"); +cvar_t snd_khz = SCVAR("snd_khz", "11"); +cvar_t snd_inactive = SCVAR("snd_inactive", "0"); //set if you want sound even when tabbed out. +cvar_t _snd_mixahead = SCVARF("_snd_mixahead", "0.2", CVAR_ARCHIVE); +cvar_t snd_leftisright = SCVARF("snd_leftisright", "0", CVAR_ARCHIVE); +cvar_t snd_eax = SCVAR("snd_eax", "0"); +cvar_t snd_speakers = SCVAR("snd_numspeakers", "2"); +cvar_t snd_playersoundvolume = SCVAR("snd_localvolume", "1"); //sugested by crunch -cvar_t snd_capture = {"snd_capture", "0"}; +cvar_t snd_capture = SCVAR("snd_capture", "0"); -cvar_t snd_usemultipledevices = {"snd_multipledevices", "0"}; +cvar_t snd_usemultipledevices = SCVAR("snd_multipledevices", "0"); // ==================================================================== diff --git a/engine/client/sys_win.c b/engine/client/sys_win.c index dd1c05216..2db740934 100644 --- a/engine/client/sys_win.c +++ b/engine/client/sys_win.c @@ -232,8 +232,8 @@ int *debug; HHOOK llkeyboardhook; -cvar_t sys_disableWinKeys = {"sys_disableWinKeys", "0"}; -cvar_t sys_disableTaskSwitch = {"sys_disableTaskSwitch", "0", NULL, CVAR_NOTFROMSERVER}; // please don't encourage people to use this... +cvar_t sys_disableWinKeys = SCVAR("sys_disableWinKeys", "0"); +cvar_t sys_disableTaskSwitch = SCVARF("sys_disableTaskSwitch", "0", CVAR_NOTFROMSERVER); // please don't encourage people to use this... LRESULT CALLBACK LowLevelKeyboardProc (INT nCode, WPARAM wParam, LPARAM lParam) { diff --git a/engine/client/textedit.c b/engine/client/textedit.c index 32cbb49f5..99cce778d 100644 --- a/engine/client/textedit.c +++ b/engine/client/textedit.c @@ -16,10 +16,10 @@ F11 will step through. #include "quakedef.h" #ifdef TEXTEDITOR -cvar_t alloweditor = {"alloweditor", "1"}; //disallow loading editor for stepbystep debugging. -cvar_t editstripcr = {"edit_stripcr", "1"}; //remove \r from eols (on load). -cvar_t editaddcr = {"edit_addcr", "1"}; //make sure that each line ends with a \r (on save). -cvar_t edittabspacing = {"edit_tabsize", "4"}; +cvar_t alloweditor = SCVAR("alloweditor", "1"); //disallow loading editor for stepbystep debugging. +cvar_t editstripcr = SCVAR("edit_stripcr", "1"); //remove \r from eols (on load). +cvar_t editaddcr = SCVAR("edit_addcr", "1"); //make sure that each line ends with a \r (on save). +cvar_t edittabspacing = SCVAR("edit_tabsize", "4"); #undef pr_trace diff --git a/engine/client/valid.c b/engine/client/valid.c index 196e056a8..2e1ee4752 100644 --- a/engine/client/valid.c +++ b/engine/client/valid.c @@ -33,11 +33,11 @@ qboolean f_modified_particles; qboolean f_modified_staticlights; -cvar_t allow_f_version = {"allow_f_version", "1"}; -cvar_t allow_f_server = {"allow_f_server", "1"}; -cvar_t allow_f_modified = {"allow_f_modified", "1"}; -cvar_t allow_f_skins = {"allow_f_skins", "1"}; -cvar_t auth_validateclients = {"auth_validateclients", "1"}; +cvar_t allow_f_version = SCVAR("allow_f_version", "1"); +cvar_t allow_f_server = SCVAR("allow_f_server", "1"); +cvar_t allow_f_modified = SCVAR("allow_f_modified", "1"); +cvar_t allow_f_skins = SCVAR("allow_f_skins", "1"); +cvar_t auth_validateclients = SCVAR("auth_validateclients", "1"); void QCRC_AddBlock (unsigned short *crcvalue, qbyte *start, int count) diff --git a/engine/client/view.c b/engine/client/view.c index 8231b4241..67575d0cc 100644 --- a/engine/client/view.c +++ b/engine/client/view.c @@ -29,8 +29,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #ifdef FISH void R_RenderView_fisheye(void); -cvar_t ffov = {"ffov", "0"}; -cvar_t fviews = {"fviews", "6"}; +cvar_t ffov = SCVAR("ffov", "0"); +cvar_t fviews = SCVAR("fviews", "6"); #endif /* @@ -43,60 +43,60 @@ when crossing a water boudnary. */ #ifdef SIDEVIEWS -cvar_t vsec_enabled[SIDEVIEWS] = {{"v2_enabled", "0"}, {"v3_enabled", "0"}, {"v4_enabled", "0"}, {"v5_enabled", "0"}}; -cvar_t vsec_x[SIDEVIEWS] = {{"v2_x", "0"}, {"v3_x", "0.25"}, {"v4_x", "0.5"}, {"v5_x", "0.75"}}; -cvar_t vsec_y[SIDEVIEWS] = {{"v2_y", "0"}, {"v3_y", "0"}, {"v4_y", "0"}, {"v5_y", "0"}}; -cvar_t vsec_scalex[SIDEVIEWS] = {{"v2_scalex", "0.25"}, {"v3_scalex", "0.25"}, {"v4_scalex", "0.25"}, {"v5_scalex", "0.25"}}; -cvar_t vsec_scaley[SIDEVIEWS] = {{"v2_scaley", "0.25"}, {"v3_scaley", "0.25"}, {"v4_scaley", "0.25"}, {"v5_scaley", "0.25"}}; -cvar_t vsec_yaw[SIDEVIEWS] = {{"v2_yaw", "180"}, {"v3_yaw", "90"}, {"v4_yaw", "270"}, {"v5_yaw", "0"}}; +cvar_t vsec_enabled[SIDEVIEWS] = {SCVAR("v2_enabled", "0"), SCVAR("v3_enabled", "0"), SCVAR("v4_enabled", "0"), SCVAR("v5_enabled", "0")}; +cvar_t vsec_x[SIDEVIEWS] = {SCVAR("v2_x", "0"), SCVAR("v3_x", "0.25"), SCVAR("v4_x", "0.5"), SCVAR("v5_x", "0.75")}; +cvar_t vsec_y[SIDEVIEWS] = {SCVAR("v2_y", "0"), SCVAR("v3_y", "0"), SCVAR("v4_y", "0"), SCVAR("v5_y", "0")}; +cvar_t vsec_scalex[SIDEVIEWS] = {SCVAR("v2_scalex", "0.25"), SCVAR("v3_scalex", "0.25"), SCVAR("v4_scalex", "0.25"), SCVAR("v5_scalex", "0.25")}; +cvar_t vsec_scaley[SIDEVIEWS] = {SCVAR("v2_scaley", "0.25"), SCVAR("v3_scaley", "0.25"), SCVAR("v4_scaley", "0.25"), SCVAR("v5_scaley", "0.25")}; +cvar_t vsec_yaw[SIDEVIEWS] = {SCVAR("v2_yaw", "180"), SCVAR("v3_yaw", "90"), SCVAR("v4_yaw", "270"), SCVAR("v5_yaw", "0")}; #endif -cvar_t lcd_x = {"lcd_x", "0"}; // FIXME: make this work sometime... +cvar_t lcd_x = SCVAR("lcd_x", "0"); // FIXME: make this work sometime... -cvar_t cl_rollspeed = {"cl_rollspeed", "200"}; -cvar_t cl_rollangle = {"cl_rollangle", "2.0"}; -cvar_t v_deathtilt = {"v_deathtilt", "1"}; +cvar_t cl_rollspeed = SCVAR("cl_rollspeed", "200"); +cvar_t cl_rollangle = SCVAR("cl_rollangle", "2.0"); +cvar_t v_deathtilt = SCVAR("v_deathtilt", "1"); -cvar_t cl_bob = {"cl_bob","0.02"}; -cvar_t cl_bobcycle = {"cl_bobcycle","0.6"}; -cvar_t cl_bobup = {"cl_bobup","0.5"}; +cvar_t cl_bob = SCVAR("cl_bob","0.02"); +cvar_t cl_bobcycle = SCVAR("cl_bobcycle","0.6"); +cvar_t cl_bobup = SCVAR("cl_bobup","0.5"); -cvar_t v_kicktime = {"v_kicktime", "0.5"}; -cvar_t v_kickroll = {"v_kickroll", "0.6"}; -cvar_t v_kickpitch = {"v_kickpitch", "0.6"}; +cvar_t v_kicktime = SCVAR("v_kicktime", "0.5"); +cvar_t v_kickroll = SCVAR("v_kickroll", "0.6"); +cvar_t v_kickpitch = SCVAR("v_kickpitch", "0.6"); -cvar_t v_iyaw_cycle = {"v_iyaw_cycle", "2", NULL}; -cvar_t v_iroll_cycle = {"v_iroll_cycle", "0.5", NULL}; -cvar_t v_ipitch_cycle = {"v_ipitch_cycle", "1", NULL}; -cvar_t v_iyaw_level = {"v_iyaw_level", "0.3", NULL}; -cvar_t v_iroll_level = {"v_iroll_level", "0.1", NULL}; -cvar_t v_ipitch_level = {"v_ipitch_level", "0.3", NULL}; -cvar_t v_idlescale = {"v_idlescale", "0", NULL}; +cvar_t v_iyaw_cycle = SCVAR("v_iyaw_cycle", "2"); +cvar_t v_iroll_cycle = SCVAR("v_iroll_cycle", "0.5"); +cvar_t v_ipitch_cycle = SCVAR("v_ipitch_cycle", "1"); +cvar_t v_iyaw_level = SCVAR("v_iyaw_level", "0.3"); +cvar_t v_iroll_level = SCVAR("v_iroll_level", "0.1"); +cvar_t v_ipitch_level = SCVAR("v_ipitch_level", "0.3"); +cvar_t v_idlescale = SCVAR("v_idlescale", "0"); -cvar_t crosshair = {"crosshair", "0", NULL, CVAR_ARCHIVE}; -cvar_t crosshaircolor = {"crosshaircolor", "79", NULL, CVAR_ARCHIVE}; -cvar_t crosshairsize = {"crosshairsize", "8", NULL, CVAR_ARCHIVE}; +cvar_t crosshair = SCVARF("crosshair", "0", CVAR_ARCHIVE); +cvar_t crosshaircolor = SCVARF("crosshaircolor", "79", CVAR_ARCHIVE); +cvar_t crosshairsize = SCVARF("crosshairsize", "8", CVAR_ARCHIVE); -cvar_t cl_crossx = {"cl_crossx", "0", NULL, CVAR_ARCHIVE}; -cvar_t cl_crossy = {"cl_crossy", "0", NULL, CVAR_ARCHIVE}; -cvar_t crosshaircorrect = {"crosshaircorrect", "0", NULL, CVAR_SEMICHEAT}; -cvar_t crosshairimage = {"crosshairimage", ""}; -cvar_t crosshairalpha = {"crosshairalpha", "1"}; +cvar_t cl_crossx = SCVARF("cl_crossx", "0", CVAR_ARCHIVE); +cvar_t cl_crossy = SCVARF("cl_crossy", "0", CVAR_ARCHIVE); +cvar_t crosshaircorrect = SCVARF("crosshaircorrect", "0", CVAR_SEMICHEAT); +cvar_t crosshairimage = SCVAR("crosshairimage", ""); +cvar_t crosshairalpha = SCVAR("crosshairalpha", "1"); -cvar_t gl_cshiftpercent = {"gl_cshiftpercent", "100"}; +cvar_t gl_cshiftpercent = SCVAR("gl_cshiftpercent", "100"); -cvar_t v_bonusflash = {"v_bonusflash", "0"}; +cvar_t v_bonusflash = SCVAR("v_bonusflash", "0"); -cvar_t v_contentblend = {"v_contentblend", "0"}; -cvar_t v_damagecshift = {"v_damagecshift", "0"}; -cvar_t v_quadcshift = {"v_quadcshift", "0"}; -cvar_t v_suitcshift = {"v_suitcshift", "0"}; -cvar_t v_ringcshift = {"v_ringcshift", "0"}; -cvar_t v_pentcshift = {"v_pentcshift", "0"}; +cvar_t v_contentblend = SCVAR("v_contentblend", "0"); +cvar_t v_damagecshift = SCVAR("v_damagecshift", "0"); +cvar_t v_quadcshift = SCVAR("v_quadcshift", "0"); +cvar_t v_suitcshift = SCVAR("v_suitcshift", "0"); +cvar_t v_ringcshift = SCVAR("v_ringcshift", "0"); +cvar_t v_pentcshift = SCVAR("v_pentcshift", "0"); -cvar_t v_viewheight = {"v_viewheight", "0"}; +cvar_t v_viewheight = SCVAR("v_viewheight", "0"); -cvar_t scr_autoid = {"scr_autoid", "0"}; +cvar_t scr_autoid = SCVAR("scr_autoid", "0"); extern cvar_t cl_chasecam; @@ -184,8 +184,8 @@ float V_CalcBob (int pnum) //============================================================================= -cvar_t v_centermove = {"v_centermove", "0.15"}; -cvar_t v_centerspeed = {"v_centerspeed","500"}; +cvar_t v_centermove = SCVAR("v_centermove", "0.15"); +cvar_t v_centerspeed = SCVAR("v_centerspeed","500"); void V_StartPitchDrift (int pnum) @@ -303,8 +303,8 @@ cshift_t cshift_lava = { {255,80,0}, 150 }; cshift_t cshift_server = { {130,80,50}, 0 }; -cvar_t v_gamma = {"gamma", "0.5", NULL, CVAR_ARCHIVE}; -cvar_t v_contrast = {"contrast", "2", NULL, CVAR_ARCHIVE}; +cvar_t v_gamma = SCVARF("gamma", "0.8", CVAR_ARCHIVE); +cvar_t v_contrast = SCVARF("contrast", "1.4", CVAR_ARCHIVE); qbyte gammatable[256]; // palette is sent through this diff --git a/engine/client/zqtp.c b/engine/client/zqtp.c index 0fbb01a3d..cf7b0be1d 100644 --- a/engine/client/zqtp.c +++ b/engine/client/zqtp.c @@ -185,7 +185,7 @@ static size_t strlcat (char *dst, const char *src, size_t size) TP_CVAR(loc_name_suit, "suit") //create the globals for all the TP cvars. -#define TP_CVAR(name,def) cvar_t name = {#name, def} +#define TP_CVAR(name,def) cvar_t name = SCVAR(#name, def) TP_CVARS; #undef TP_CVAR @@ -3215,14 +3215,18 @@ void CL_Say (qboolean team, char *extra) { // s++; *d++ = '^'; - *d++ = '1'; + *d++ = 's'; + *d++ = '^'; + *d++ = '&'; + *d++ = '4'; + *d++ = '0'; if (*s == 'z') *d++ = 'x'; else *d++ = 139; *d++ = '^'; - *d++ = '1'; + *d++ = 'r'; d--; while(*s != '\xff') @@ -3237,6 +3241,7 @@ void CL_Say (qboolean team, char *extra) else *d = *s; } + *d++ = '\n'; *d = '\0'; { diff --git a/engine/common/cmd.c b/engine/common/cmd.c index 1ee8c4b5c..9bfce8179 100644 --- a/engine/common/cmd.c +++ b/engine/common/cmd.c @@ -21,9 +21,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "quakedef.h" -cvar_t com_fs_cache = {"fs_cache", "0", NULL, CVAR_ARCHIVE}; -cvar_t rcon_level = {"rcon_level", "50"}; -cvar_t cmd_maxbuffersize = {"cmd_maxbuffersize", "65536"}; +cvar_t com_fs_cache = SCVARF("fs_cache", "0", CVAR_ARCHIVE); +cvar_t rcon_level = SCVAR("rcon_level", "50"); +cvar_t cmd_maxbuffersize = SCVAR("cmd_maxbuffersize", "65536"); int Cmd_ExecLevel; void Cmd_ForwardToServer (void); @@ -44,10 +44,10 @@ typedef struct cmdalias_s cmdalias_t *cmd_alias; -cvar_t cl_warncmd = {"cl_warncmd", "0"}; -cvar_t cl_aliasoverlap = {"cl_aliasoverlap", "1", NULL, CVAR_NOTFROMSERVER}; +cvar_t cl_warncmd = SCVAR("cl_warncmd", "0"); +cvar_t cl_aliasoverlap = SCVARF("cl_aliasoverlap", "1", CVAR_NOTFROMSERVER); -cvar_t tp_disputablemacros = {"tp_disputablemacros", "1", NULL, CVAR_SEMICHEAT}; +cvar_t tp_disputablemacros = SCVARF("tp_disputablemacros", "1", CVAR_SEMICHEAT); //============================================================================= diff --git a/engine/common/common.c b/engine/common/common.c index 7375f610a..095eda747 100644 --- a/engine/common/common.c +++ b/engine/common/common.c @@ -42,8 +42,8 @@ static char *argvdummy = " "; static char *safeargvs[NUM_SAFE_ARGVS] = {"-stdvid", "-nolan", "-nosound", "-nocdaudio", "-nojoy", "-nomouse"}; -cvar_t registered = {"registered","0"}; -cvar_t com_gamename = {"com_gamename", ""}; +cvar_t registered = SCVAR("registered","0"); +cvar_t com_gamename = SCVAR("com_gamename", ""); qboolean com_modified; // set true if using non-id files diff --git a/engine/common/common.h b/engine/common/common.h index 1b2e55b91..5f5134469 100644 --- a/engine/common/common.h +++ b/engine/common/common.h @@ -310,6 +310,7 @@ typedef struct vfsfile_s { unsigned long (*GetLen) (struct vfsfile_s *file); //could give some lag void (*Close) (struct vfsfile_s *file); void (*Flush) (struct vfsfile_s *file); + qboolean seekingisabadplan; } vfsfile_t; #define VFS_CLOSE(vf) (vf->Close(vf)) @@ -326,6 +327,7 @@ void FS_CreatePath(char *pname, int relativeto); int FS_Rename(char *oldf, char *newf, int relativeto); //0 on success, non-0 on error int FS_Remove(char *fname, int relativeto); //0 on success, non-0 on error vfsfile_t *FS_OpenVFS(char *filename, char *mode, int relativeto); +vfsfile_t *FS_OpenTemp(void); enum { FS_GAME, FS_BASE, diff --git a/engine/common/cvar.c b/engine/common/cvar.c index e1ac73057..75a833f17 100644 --- a/engine/common/cvar.c +++ b/engine/common/cvar.c @@ -616,9 +616,11 @@ cvar_t *Cvar_SetCore (cvar_t *var, const char *value, qboolean force) if (var->flags & CVAR_SERVEROVERRIDE && !force) latch = "variable %s is under server control - latched\n"; else if (var->flags & CVAR_LATCH) - latch = "variable %s is latched\n"; + latch = "variable %s is latched and will be applied for the start of the next map\n"; +// else if (var->flags & CVAR_LATCHFLUSH) +// latch = "variable %s is latched (type flush)\n"; else if (var->flags & CVAR_RENDERERLATCH && qrenderer) - latch = "variable %s will be changed after a renderer restart\n"; + latch = "variable %s will be changed after a vid_restart\n"; #ifndef SERVERONLY else if (var->flags & CVAR_CHEAT && !cls.allow_cheats && cls.state) latch = "variable %s is a cheat variable - latched\n"; diff --git a/engine/common/cvar.h b/engine/common/cvar.h index e323c7b3d..2f01fe950 100644 --- a/engine/common/cvar.h +++ b/engine/common/cvar.h @@ -66,10 +66,15 @@ typedef struct cvar_s //free style :) char *name2; + char *defaultstr; //default qbyte restriction; } cvar_t; +#define FCVAR(ConsoleName,ConsoleName2,Value,Flags) {ConsoleName, Value, NULL, Flags, 0, 0, 0, ConsoleName2} +#define SCVARF(ConsoleName,Value, Flags) FCVAR(ConsoleName, NULL, Value, Flags) +#define SCVAR(ConsoleName,Value) FCVAR(ConsoleName, NULL, Value, 0) + typedef struct cvar_group_s { const char *name; diff --git a/engine/common/fs.c b/engine/common/fs.c index 43601b3e9..fc2fdcac9 100644 --- a/engine/common/fs.c +++ b/engine/common/fs.c @@ -208,6 +208,28 @@ void VFSOS_Close(vfsfile_t *file) fclose(intfile->handle); Z_Free(file); } + +vfsfile_t *FS_OpenTemp(void) +{ + FILE *f; + vfsosfile_t *file; + + f = tmpfile(); + if (!f) + return NULL; + + file = Z_Malloc(sizeof(vfsosfile_t)); + file->funcs.ReadBytes = VFSOS_ReadBytes; + file->funcs.WriteBytes = VFSOS_WriteBytes; + file->funcs.Seek = VFSOS_Seek; + file->funcs.Tell = VFSOS_Tell; + file->funcs.GetLen = VFSOS_GetSize; + file->funcs.Close = VFSOS_Close; + file->handle = f; + + return (vfsfile_t*)file; +} + vfsfile_t *VFSOS_Open(char *osname, char *mode) { FILE *f; @@ -998,6 +1020,7 @@ vfsfile_t *FSZIP_OpenVFS(void *handle, flocation_t *loc, char *mode) vfsz->funcs.Seek = VFSZIP_Seek; vfsz->funcs.Tell = VFSZIP_Tell; vfsz->funcs.WriteBytes = NULL; + vfsz->funcs.seekingisabadplan = true; unzLocateFileMy(vfsz->parent->handle, vfsz->index, vfsz->startpos); rawofs = unzGetCurrentFileUncompressedPos(zip->handle); @@ -1593,6 +1616,180 @@ qboolean Sys_PathProtection(char *pattern) return true; } +typedef struct { + unsigned char ident1; + unsigned char ident2; + unsigned char cm; + unsigned char flags; + unsigned int mtime; + unsigned char xflags; + unsigned char os; +} gzheader_t; +#define sizeofgzheader_t 10 + +#define GZ_FTEXT 1 +#define GZ_FHCRC 2 +#define GZ_FEXTRA 4 +#define GZ_FNAME 8 +#define GZ_FCOMMENT 16 +#define GZ_RESERVED (32|64|128) + +#include + +vfsfile_t *FS_DecompressGZip(vfsfile_t *infile, gzheader_t *header) +{ + char inchar; + unsigned short inshort; + vfsfile_t *temp; + + if (header->flags & GZ_RESERVED) + { //reserved bits should be 0 + //this is probably static, so it's not a gz. doh. + VFS_SEEK(infile, 0); + return infile; + } + + if (header->flags & GZ_FEXTRA) + { + VFS_READ(infile, &inshort, sizeof(inshort)); + inshort = LittleShort(inshort); + VFS_SEEK(infile, VFS_TELL(infile) + inshort); + } + + if (header->flags & GZ_FNAME) + { + Con_Printf("gzipped file name: "); + do { + if (VFS_READ(infile, &inchar, sizeof(inchar)) != 1) + break; + Con_Printf("%c", inchar); + } while(inchar); + Con_Printf("\n"); + } + + if (header->flags & GZ_FCOMMENT) + { + Con_Printf("gzipped file comment: "); + do { + if (VFS_READ(infile, &inchar, sizeof(inchar)) != 1) + break; + Con_Printf("%c", inchar); + } while(inchar); + Con_Printf("\n"); + } + + if (header->flags & GZ_FHCRC) + { + VFS_READ(infile, &inshort, sizeof(inshort)); + } + + + + temp = FS_OpenTemp(); + if (!temp) + { + VFS_SEEK(infile, 0); //doh + return infile; + } + + + { + char inbuffer[16384]; + char outbuffer[16384]; + int ret; + + z_stream strm = { + inbuffer, + 0, + 0, + + outbuffer, + sizeof(outbuffer), + 0, + + NULL, + NULL, + + NULL, + NULL, + NULL, + + Z_UNKNOWN, + 0, + 0 + }; + + strm.avail_in = VFS_READ(infile, inbuffer, sizeof(inbuffer)); + strm.next_in = inbuffer; + + inflateInit2(&strm, -MAX_WBITS); + + while ((ret=inflate(&strm, Z_SYNC_FLUSH)) != Z_STREAM_END) + { + if (strm.avail_in == 0 || strm.avail_out == 0) + { + if (strm.avail_in == 0) + { + strm.avail_in = VFS_READ(infile, inbuffer, sizeof(inbuffer)); + strm.next_in = inbuffer; + } + + if (strm.avail_out == 0) + { + strm.next_out = outbuffer; + VFS_WRITE(temp, outbuffer, strm.total_out); + strm.total_out = 0; + strm.avail_out = sizeof(outbuffer); + } + continue; + } + + //doh, it terminated for no reason + inflateEnd(&strm); + if (ret != Z_STREAM_END) + { + Con_Printf("Couldn't decompress gz file\n"); + VFS_CLOSE(temp); + VFS_CLOSE(infile); + return NULL; + } + } + //we got to the end + VFS_WRITE(temp, outbuffer, strm.total_out); + + inflateEnd(&strm); + + VFS_SEEK(temp, 0); + } + VFS_CLOSE(infile); + + return temp; +} + +vfsfile_t *VFS_Filter(char *filename, vfsfile_t *handle) +{ +// char *ext; + + if (!handle || handle->WriteBytes || handle->seekingisabadplan) //only on readonly files + return handle; + +// ext = COM_FileExtension (filename); +// if (!stricmp(ext, ".gz")) + { + gzheader_t gzh; + if (VFS_READ(handle, &gzh, sizeofgzheader_t) == sizeofgzheader_t) + { + if (gzh.ident1 == 0x1f && gzh.ident2 == 0x8b && gzh.cm == 8) + { //it'll do + return FS_DecompressGZip(handle, &gzh); + } + } + VFS_SEEK(handle, 0); + } + + return handle; +} + vfsfile_t *FS_OpenVFS(char *filename, char *mode, int relativeto) { char fullname[MAX_OSPATH]; @@ -1659,7 +1856,7 @@ vfsfile_t *FS_OpenVFS(char *filename, char *mode, int relativeto) if (loc.search) { com_file_copyprotected = loc.search->copyprotected; - return loc.search->funcs->OpenVFS(loc.search->handle, &loc, mode); + return VFS_Filter(filename, loc.search->funcs->OpenVFS(loc.search->handle, &loc, mode)); } //if we're meant to be writing, best write to it. diff --git a/engine/common/gl_q2bsp.c b/engine/common/gl_q2bsp.c index 601563291..1cd474fa7 100644 --- a/engine/common/gl_q2bsp.c +++ b/engine/common/gl_q2bsp.c @@ -317,10 +317,10 @@ qbyte portalopen[MAX_Q2MAP_AREAPORTALS]; //memset will work if it's a qbyte, rea static int mapisq3; -cvar_t map_noareas = {"map_noareas", "1"}; //1 for lack of mod support. -cvar_t map_noCurves = {"map_noCurves", "0", NULL, CVAR_CHEAT}; -cvar_t map_autoopenportals = {"map_autoopenportals", "1"}; //1 for lack of mod support. -cvar_t r_subdivisions = {"r_subdivisions", "2"}; +cvar_t map_noareas = SCVAR("map_noareas", "1"); //1 for lack of mod support. +cvar_t map_noCurves = SCVARF("map_noCurves", "0", CVAR_CHEAT); +cvar_t map_autoopenportals = SCVAR("map_autoopenportals", "1"); //1 for lack of mod support. +cvar_t r_subdivisions = SCVAR("r_subdivisions", "2"); int CM_NumInlineModels (model_t *model); q2cmodel_t *CM_InlineModel (char *name); diff --git a/engine/common/log.c b/engine/common/log.c index b2348310a..402b02595 100644 --- a/engine/common/log.c +++ b/engine/common/log.c @@ -4,14 +4,14 @@ // cvars #define CONLOGGROUP "Console logging" -cvar_t log_name = {"log_name", "", NULL, CVAR_NOTFROMSERVER}; -cvar_t log_dir = {"log_dir", "", NULL, CVAR_NOTFROMSERVER}; -cvar_t log_readable = {"log_readable", "0", NULL, CVAR_NOTFROMSERVER}; -cvar_t log_enable = {"log_enable", "0", NULL, CVAR_NOTFROMSERVER}; -cvar_t log_developer = {"log_developer", "0", NULL, CVAR_NOTFROMSERVER}; -cvar_t log_rotate_files = {"log_rotate_files", "0", NULL, CVAR_NOTFROMSERVER}; -cvar_t log_rotate_size = {"log_rotate_size", "131072", NULL, CVAR_NOTFROMSERVER}; -cvar_t log_dosformat = {"log_dosformat", "0", NULL, CVAR_NOTFROMSERVER}; +cvar_t log_name = SCVARF("log_name", "", CVAR_NOTFROMSERVER); +cvar_t log_dir = SCVARF("log_dir", "", CVAR_NOTFROMSERVER); +cvar_t log_readable = SCVARF("log_readable", "0", CVAR_NOTFROMSERVER); +cvar_t log_enable = SCVARF("log_enable", "0", CVAR_NOTFROMSERVER); +cvar_t log_developer = SCVARF("log_developer", "0", CVAR_NOTFROMSERVER); +cvar_t log_rotate_files = SCVARF("log_rotate_files", "0", CVAR_NOTFROMSERVER); +cvar_t log_rotate_size = SCVARF("log_rotate_size", "131072", CVAR_NOTFROMSERVER); +cvar_t log_dosformat = SCVARF("log_dosformat", "0", CVAR_NOTFROMSERVER); // externals int COM_FileSize(char *path); diff --git a/engine/common/net_chan.c b/engine/common/net_chan.c index 7866fa437..530d614fc 100644 --- a/engine/common/net_chan.c +++ b/engine/common/net_chan.c @@ -78,9 +78,9 @@ to the new value before sending out any replies. */ int net_drop; -cvar_t showpackets = {"showpackets", "0"}; -cvar_t showdrop = {"showdrop", "0"}; -cvar_t qport = {"qport", "0"}; +cvar_t showpackets = SCVAR("showpackets", "0"); +cvar_t showdrop = SCVAR("showdrop", "0"); +cvar_t qport = SCVAR("qport", "0"); /* =============== diff --git a/engine/common/plugin.c b/engine/common/plugin.c index f1f124a83..e9ab3051e 100644 --- a/engine/common/plugin.c +++ b/engine/common/plugin.c @@ -95,8 +95,8 @@ qboolean Init_GNUTLS(void) {return true;} #endif -cvar_t plug_sbar = {"plug_sbar", "1"}; -cvar_t plug_loaddefault = {"plug_loaddefault", "1"}; +cvar_t plug_sbar = SCVAR("plug_sbar", "1"); +cvar_t plug_loaddefault = SCVAR("plug_loaddefault", "1"); #ifdef RGLQUAKE #include "glquake.h" diff --git a/engine/common/translate.c b/engine/common/translate.c index 5f35526f1..97ef3b084 100644 --- a/engine/common/translate.c +++ b/engine/common/translate.c @@ -273,7 +273,7 @@ static char *defaultlanguagetext = -cvar_t language = {"language", "uk"}; +cvar_t language = SCVAR("language", "uk"); char lastlang[9]; typedef struct trans_s { diff --git a/engine/gl/gl_backend.c b/engine/gl/gl_backend.c index d0c880520..955bbaaa4 100644 --- a/engine/gl/gl_backend.c +++ b/engine/gl/gl_backend.c @@ -141,9 +141,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define MAX_ARRAY_TRIANGLES (8192/3) #define M_TWO_PI (M_PI*2) -cvar_t r_detailtextures = {"r_detailtextures", "1"}; -cvar_t r_showtris = {"r_showtris", "1"}; -cvar_t r_shownormals = {"r_shownormals", "1"}; +cvar_t r_detailtextures = SCVAR("r_detailtextures", "1"); +cvar_t r_showtris = SCVAR("r_showtris", "1"); +cvar_t r_shownormals = SCVAR("r_shownormals", "1"); float Q_rsqrt( float number ) { diff --git a/engine/gl/gl_rmain.c b/engine/gl/gl_rmain.c index 1d2507c4e..d9e96f478 100644 --- a/engine/gl/gl_rmain.c +++ b/engine/gl/gl_rmain.c @@ -99,34 +99,34 @@ int d_lightstylevalue[256]; // 8.8 fraction of base light value void GLR_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_fullbright = {"r_fullbright","0"}; -cvar_t r_mirroralpha = {"r_mirroralpha","1", NULL, CVAR_CHEAT}; -cvar_t r_wateralpha = {"r_wateralpha","1", NULL}; -//cvar_t r_waterwarp = {"r_waterwarp", "0"}; -cvar_t r_novis = {"r_novis","0"}; -//cvar_t r_netgraph = {"r_netgraph","0"}; +cvar_t r_norefresh = SCVAR("r_norefresh","0"); +//cvar_t r_drawentities = SCVAR("r_drawentities","1"); +//cvar_t r_drawviewmodel = SCVAR("r_drawviewmodel","1"); +//cvar_t r_speeds = SCVAR("r_speeds","0"); +//cvar_t r_fullbright = SCVAR("r_fullbright","0"); +cvar_t r_mirroralpha = SCVARF("r_mirroralpha","1", CVAR_CHEAT); +cvar_t r_wateralpha = SCVAR("r_wateralpha","1"); +//cvar_t r_waterwarp = SCVAR("r_waterwarp", "0"); +cvar_t r_novis = SCVAR("r_novis","0"); +//cvar_t r_netgraph = SCVAR("r_netgraph","0"); extern cvar_t gl_part_flame; -cvar_t gl_clear = {"gl_clear","0"}; -cvar_t gl_cull = {"gl_cull","1"}; -cvar_t gl_smoothmodels = {"gl_smoothmodels","1"}; -cvar_t gl_affinemodels = {"gl_affinemodels","0"}; -cvar_t gl_polyblend = {"gl_polyblend","1"}; -cvar_t gl_playermip = {"gl_playermip","0"}; -cvar_t gl_keeptjunctions = {"gl_keeptjunctions","1"}; -cvar_t gl_reporttjunctions = {"gl_reporttjunctions","0"}; -cvar_t gl_finish = {"gl_finish","0"}; -cvar_t gl_contrast = {"gl_contrast", "1"}; -cvar_t gl_dither = {"gl_dither", "1"}; -cvar_t gl_maxdist = {"gl_maxdist", "8192"}; -cvar_t gl_mindist = {"gl_mindist", "4", NULL, CVAR_CHEAT}; //by setting to 64 or something, you can use this as a wallhack +cvar_t gl_clear = SCVAR("gl_clear","0"); +cvar_t gl_cull = SCVAR("gl_cull","1"); +cvar_t gl_smoothmodels = SCVAR("gl_smoothmodels","1"); +cvar_t gl_affinemodels = SCVAR("gl_affinemodels","0"); +cvar_t gl_polyblend = SCVAR("gl_polyblend","1"); +cvar_t gl_playermip = SCVAR("gl_playermip","0"); +cvar_t gl_keeptjunctions = SCVAR("gl_keeptjunctions","1"); +cvar_t gl_reporttjunctions = SCVAR("gl_reporttjunctions","0"); +cvar_t gl_finish = SCVAR("gl_finish","0"); +cvar_t gl_contrast = SCVAR("gl_contrast", "1"); +cvar_t gl_dither = SCVAR("gl_dither", "1"); +cvar_t gl_maxdist = SCVAR("gl_maxdist", "8192"); +cvar_t gl_mindist = SCVARF("gl_mindist", "4", CVAR_CHEAT); //by setting to 64 or something, you can use this as a wallhack -cvar_t gl_bloom = {"gl_bloom", "0"}; +cvar_t gl_bloom = SCVAR("gl_bloom", "0"); extern cvar_t gl_motionblur; extern cvar_t gl_motionblurscale; @@ -137,7 +137,7 @@ extern cvar_t gl_ati_truform_tesselation; extern cvar_t gl_blendsprites; #ifdef R_XFLIP -cvar_t r_xflip = {"leftisright", "0"}; +cvar_t r_xflip = SCVAR("leftisright", "0"); #endif extern cvar_t gl_ztrick; diff --git a/engine/gl/gl_rmisc.c b/engine/gl/gl_rmisc.c index 0b81515ca..5580289f6 100644 --- a/engine/gl/gl_rmisc.c +++ b/engine/gl/gl_rmisc.c @@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "gl_draw.h" #ifdef WATERLAYERS -cvar_t r_waterlayers = {"r_waterlayers","3"}; +cvar_t r_waterlayers = SCVAR("r_waterlayers","3"); #endif extern void R_InitBubble(); diff --git a/engine/gl/gl_shader.c b/engine/gl/gl_shader.c index aa056a252..1f6bee99c 100644 --- a/engine/gl/gl_shader.c +++ b/engine/gl/gl_shader.c @@ -39,7 +39,7 @@ extern int missing_texture; #ifdef Q3SHADERS -cvar_t r_vertexlight = {"r_vertexlight", "0"}; +cvar_t r_vertexlight = SCVAR("r_vertexlight", "0"); #define Q_stricmp stricmp #define Com_sprintf _snprintf diff --git a/engine/http/httpclient.c b/engine/http/httpclient.c index c53a7639c..4958f9151 100644 --- a/engine/http/httpclient.c +++ b/engine/http/httpclient.c @@ -487,7 +487,7 @@ qboolean HTTP_CL_Get(char *url, char *localfile, void (*NotifyFunction)(char *lo con->NotifyFunction = NotifyFunction; if (!NotifyFunction) Con_Printf("No NotifyFunction\n"); - strcpy(con->filename, localfile); + Q_strncpyz(con->filename, localfile, sizeof(con->filename)); slash = strchr(con->filename, '?'); if (slash) diff --git a/engine/http/iwebiface.c b/engine/http/iwebiface.c index 60347d475..c8becd508 100644 --- a/engine/http/iwebiface.c +++ b/engine/http/iwebiface.c @@ -308,11 +308,11 @@ IWEBFILE *IWebFOpenRead(char *name) //fread(name, "rb"); #else #ifndef CLIENTONLY -cvar_t ftpserver = {"sv_ftp", "0"}; -cvar_t httpserver = {"sv_http", "0"}; -cvar_t sv_readlevel = {"sv_readlevel", "0"}; //default to allow anyone -cvar_t sv_writelevel = {"sv_writelevel", "35"}; //allowed to write to uploads/uname -cvar_t sv_fulllevel = {"sv_fulllevel", "51"}; //allowed to write anywhere, replace any file... +cvar_t ftpserver = SCVAR("sv_ftp", "0"); +cvar_t httpserver = SCVAR("sv_http", "0"); +cvar_t sv_readlevel = SCVAR("sv_readlevel", "0"); //default to allow anyone +cvar_t sv_writelevel = SCVAR("sv_writelevel", "35"); //allowed to write to uploads/uname +cvar_t sv_fulllevel = SCVAR("sv_fulllevel", "51"); //allowed to write anywhere, replace any file... #endif //this file contains functions called from each side. diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 7d3891f6f..a0f655e6b 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -31,39 +31,39 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. void ED_Print (struct progfuncs_s *progfuncs, struct edict_s *ed); int PR_EnableEBFSBuiltin(char *name, int binum); -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", NULL, CVAR_ARCHIVE}; -cvar_t saved1 = {"saved1", "0", NULL, CVAR_ARCHIVE}; -cvar_t saved2 = {"saved2", "0", NULL, CVAR_ARCHIVE}; -cvar_t saved3 = {"saved3", "0", NULL, CVAR_ARCHIVE}; -cvar_t saved4 = {"saved4", "0", NULL, CVAR_ARCHIVE}; -cvar_t temp1 = {"temp1", "0", NULL, CVAR_ARCHIVE}; -cvar_t noexit = {"noexit", "0", NULL}; +cvar_t nomonsters = SCVAR("nomonsters", "0"); +cvar_t gamecfg = SCVAR("gamecfg", "0"); +cvar_t scratch1 = SCVAR("scratch1", "0"); +cvar_t scratch2 = SCVAR("scratch2", "0"); +cvar_t scratch3 = SCVAR("scratch3", "0"); +cvar_t scratch4 = SCVAR("scratch4", "0"); +cvar_t savedgamecfg = SCVARF("savedgamecfg", "0", CVAR_ARCHIVE); +cvar_t saved1 = SCVARF("saved1", "0", CVAR_ARCHIVE); +cvar_t saved2 = SCVARF("saved2", "0", CVAR_ARCHIVE); +cvar_t saved3 = SCVARF("saved3", "0", CVAR_ARCHIVE); +cvar_t saved4 = SCVARF("saved4", "0", CVAR_ARCHIVE); +cvar_t temp1 = SCVARF("temp1", "0", CVAR_ARCHIVE); +cvar_t noexit = SCVAR("noexit", "0"); -cvar_t pr_maxedicts = {"pr_maxedicts", "2048", NULL, CVAR_LATCH}; -cvar_t pr_imitatemvdsv = {"pr_imitatemvdsv", "0", NULL, CVAR_LATCH}; -cvar_t pr_fixbrokenqccarrays = {"pr_fixbrokenqccarrays", "1", NULL, CVAR_LATCH}; +cvar_t pr_maxedicts = SCVARF("pr_maxedicts", "2048", CVAR_LATCH); +cvar_t pr_imitatemvdsv = SCVARF("pr_imitatemvdsv", "0", CVAR_LATCH); +cvar_t pr_fixbrokenqccarrays = SCVARF("pr_fixbrokenqccarrays", "1", CVAR_LATCH); -cvar_t pr_no_playerphysics = {"pr_no_playerphysics", "0", NULL, CVAR_LATCH}; +cvar_t pr_no_playerphysics = SCVARF("pr_no_playerphysics", "0", CVAR_LATCH); -cvar_t progs = {"progs", "", NULL, CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_NOTFROMSERVER}; -cvar_t qc_nonetaccess = {"qc_nonetaccess", "0"}; //prevent write_... builtins from doing anything. This means we can run any mod, specific to any engine, on the condition that it also has a qw or nq crc. +cvar_t progs = SCVARF("progs", "", CVAR_ARCHIVE | CVAR_SERVERINFO | CVAR_NOTFROMSERVER); +cvar_t qc_nonetaccess = SCVAR("qc_nonetaccess", "0"); //prevent write_... builtins from doing anything. This means we can run any mod, specific to any engine, on the condition that it also has a qw or nq crc. -cvar_t pr_overridebuiltins = {"pr_overridebuiltins", "1"}; +cvar_t pr_overridebuiltins = SCVAR("pr_overridebuiltins", "1"); -cvar_t pr_compatabilitytest = {"pr_compatabilitytest", "0", NULL, CVAR_LATCH}; +cvar_t pr_compatabilitytest = SCVARF("pr_compatabilitytest", "0", CVAR_LATCH); -cvar_t pr_ssqc_coreonerror = {"pr_coreonerror", "1"}; +cvar_t pr_ssqc_coreonerror = SCVAR("pr_coreonerror", "1"); -cvar_t pr_tempstringcount = {"pr_tempstringcount", "16"}; -cvar_t pr_tempstringsize = {"pr_tempstringsize", "4096"}; +cvar_t pr_tempstringcount = SCVAR("pr_tempstringcount", "16"); +cvar_t pr_tempstringsize = SCVAR("pr_tempstringsize", "4096"); -cvar_t sv_gameplayfix_blowupfallenzombies = {"sv_gameplayfix_blowupfallenzombies", "0"}; +cvar_t sv_gameplayfix_blowupfallenzombies = SCVAR("sv_gameplayfix_blowupfallenzombies", "0"); cvar_t sv_addon[MAXADDONS]; char cvargroup_progs[] = "Progs variables"; @@ -438,6 +438,7 @@ void PR_Deinit(void) void PR_LoadGlabalStruct(void) { + static float writeonly; static float dimension_send_default; int i; int *v; @@ -476,6 +477,9 @@ void PR_LoadGlabalStruct(void) globalint (true, trace_ent); globalfloat (true, trace_inopen); globalfloat (true, trace_inwater); + globalfloat (false, trace_endcontents); + globalfloat (false, trace_surfaceflags); + globalfloat (false, cycle_wrapped); globalint (false, msg_entity); globalfunc (false, main); globalfunc (true, StartFrame); @@ -501,6 +505,14 @@ void PR_LoadGlabalStruct(void) { //make sure dimension send is always a valid pointer. ((nqglobalvars_t*)pr_globals)->dimension_send = &dimension_send_default; } + if (!((nqglobalvars_t*)pr_globals)->trace_endcontents) + { //make sure dimension send is always a valid pointer. + ((nqglobalvars_t*)pr_globals)->trace_endcontents = &writeonly; + } + if (!((nqglobalvars_t*)pr_globals)->trace_surfaceflags) + { //make sure dimension send is always a valid pointer. + ((nqglobalvars_t*)pr_globals)->trace_surfaceflags = &writeonly; + } pr_global_struct->dimension_send = 255; @@ -2817,6 +2829,8 @@ static void PF_traceline (progfuncs_t *prinst, struct globalvars_s *pr_globals) pr_global_struct->trace_fraction = trace.fraction; pr_global_struct->trace_inwater = trace.inwater; pr_global_struct->trace_inopen = trace.inopen; + pr_global_struct->trace_surfaceflags = trace.surface?trace.surface->flags:0; + pr_global_struct->trace_endcontents = trace.contents; // if (trace.fraction != 1) // VectorMA (trace.endpos, 4, trace.plane.normal, P_VEC(trace_endpos)); // else @@ -2854,6 +2868,8 @@ static void PF_traceboxh2 (progfuncs_t *prinst, struct globalvars_s *pr_globals) pr_global_struct->trace_fraction = trace.fraction; pr_global_struct->trace_inwater = trace.inwater; pr_global_struct->trace_inopen = trace.inopen; + pr_global_struct->trace_surfaceflags = trace.surface?trace.surface->flags:0; + pr_global_struct->trace_endcontents = trace.contents; VectorCopy (trace.endpos, P_VEC(trace_endpos)); VectorCopy (trace.plane.normal, P_VEC(trace_plane_normal)); pr_global_struct->trace_plane_dist = trace.plane.dist; @@ -2888,6 +2904,8 @@ static void PF_traceboxdp (progfuncs_t *prinst, struct globalvars_s *pr_globals) pr_global_struct->trace_fraction = trace.fraction; pr_global_struct->trace_inwater = trace.inwater; pr_global_struct->trace_inopen = trace.inopen; + pr_global_struct->trace_surfaceflags = trace.surface?trace.surface->flags:0; + pr_global_struct->trace_endcontents = trace.contents; // if (trace.fraction != 1) // VectorMA (trace.endpos, 4, trace.plane.normal, P_VEC(trace_endpos)); // else @@ -2919,6 +2937,8 @@ static void PF_TraceToss (progfuncs_t *prinst, struct globalvars_s *pr_globals) pr_global_struct->trace_fraction = trace.fraction; pr_global_struct->trace_inwater = trace.inwater; pr_global_struct->trace_inopen = trace.inopen; + pr_global_struct->trace_surfaceflags = trace.surface?trace.surface->flags:0; + pr_global_struct->trace_endcontents = trace.contents; VectorCopy (trace.endpos, pr_global_struct->V_trace_endpos); VectorCopy (trace.plane.normal, pr_global_struct->V_trace_plane_normal); pr_global_struct->trace_plane_dist = trace.plane.dist; @@ -4183,7 +4203,7 @@ vector aim(entity, missilespeed) ============= */ //cvar_t sv_aim = {"sv_aim", "0.93"}; -cvar_t sv_aim = {"sv_aim", "2"}; +cvar_t sv_aim = SCVAR("sv_aim", "2"); void PF_aim (progfuncs_t *prinst, struct globalvars_s *pr_globals) { edict_t *ent, *check, *bestent; diff --git a/engine/server/progdefs.h b/engine/server/progdefs.h index 528869646..c235e620e 100644 --- a/engine/server/progdefs.h +++ b/engine/server/progdefs.h @@ -59,6 +59,8 @@ typedef struct nqglobalvars_s float *trace_allsolid; float *trace_startsolid; float *trace_fraction; + float *trace_surfaceflags; + float *trace_endcontents; vec3_t *V_trace_endpos; vec3_t *V_trace_plane_normal; float *trace_plane_dist; diff --git a/engine/server/sv_ccmds.c b/engine/server/sv_ccmds.c index e1bb82a76..dfe1ddd5e 100644 --- a/engine/server/sv_ccmds.c +++ b/engine/server/sv_ccmds.c @@ -32,7 +32,7 @@ qboolean sv_allow_cheats; int fp_messages=4, fp_persecond=4, fp_secondsdead=10; char fp_msg[255] = { 0 }; extern cvar_t cl_warncmd; -cvar_t sv_cheats = {"sv_cheats", "0", NULL, CVAR_LATCH}; +cvar_t sv_cheats = SCVARF("sv_cheats", "0", CVAR_LATCH); extern redirect_t sv_redirected; extern cvar_t sv_public; diff --git a/engine/server/sv_main.c b/engine/server/sv_main.c index 491e18e92..0b74d7dde 100644 --- a/engine/server/sv_main.c +++ b/engine/server/sv_main.c @@ -49,18 +49,18 @@ typedef struct { netadr_t adr; } sv_masterlist_t; sv_masterlist_t sv_masterlist[] = { - {false, {"sv_master1", ""}}, - {false, {"sv_master2", ""}}, - {false, {"sv_master3", ""}}, - {false, {"sv_master4", ""}}, - {false, {"sv_master5", ""}}, - {false, {"sv_master6", ""}}, - {false, {"sv_master7", ""}}, - {false, {"sv_master8", ""}}, + {false, SCVAR("sv_master1", "")}, + {false, SCVAR("sv_master2", "")}, + {false, SCVAR("sv_master3", "")}, + {false, SCVAR("sv_master4", "")}, + {false, SCVAR("sv_master5", "")}, + {false, SCVAR("sv_master6", "")}, + {false, SCVAR("sv_master7", "")}, + {false, SCVAR("sv_master8", "")}, - {true, {"sv_masterextra1", "ghdigital.com"}}, //69.59.212.88 - {true, {"sv_masterextra2", "dpmaster.deathmask.net"}}, //209.164.24.243 - {true, {"sv_masterextra3", "12.166.196.192"}}, //blaze.mindphukd.org (doesn't resolve currently but works as an ip) + {true, SCVAR("sv_masterextra1", "ghdigital.com")}, //69.59.212.88 + {true, SCVAR("sv_masterextra2", "dpmaster.deathmask.net")}, //209.164.24.243 + {true, SCVAR("sv_masterextra3", "12.166.196.192")}, //blaze.mindphukd.org (doesn't resolve currently but works as an ip) {false, {NULL}} }; @@ -68,103 +68,103 @@ client_t *host_client; // current client // bound the size of the physics time tic #ifdef SERVERONLY -cvar_t sv_mintic = {"sv_mintic","0.03"}; +cvar_t sv_mintic = SCVAR("sv_mintic","0.03"); #else -cvar_t sv_mintic = {"sv_mintic","0"}; //client builds can think as often as they want. +cvar_t sv_mintic = SCVAR("sv_mintic","0"); //client builds can think as often as they want. #endif -cvar_t sv_maxtic = {"sv_maxtic","0.1"}; -cvar_t sv_nailhack = {"sv_nailhack","0"}; +cvar_t sv_maxtic = SCVAR("sv_maxtic","0.1"); +cvar_t sv_nailhack = SCVAR("sv_nailhack","0"); -cvar_t timeout = {"timeout","65"}; // seconds without any message -cvar_t zombietime = {"zombietime", "2"}; // seconds to sink messages +cvar_t timeout = SCVAR("timeout","65"); // seconds without any message +cvar_t zombietime = SCVAR("zombietime", "2"); // seconds to sink messages // after disconnect #ifdef SERVERONLY -cvar_t developer = {"developer","0"}; // show extra messages +cvar_t developer = SCVAR("developer","0"); // show extra messages -cvar_t rcon_password = {"rcon_password", ""}; // password for remote server commands -cvar_t password = {"password", ""}; // password for entering the game +cvar_t rcon_password = SCVAR("rcon_password", ""); // password for remote server commands +cvar_t password = SCVAR("password", ""); // password for entering the game #else extern cvar_t developer; extern cvar_t rcon_password; extern cvar_t password; #endif -cvar_t spectator_password = {"spectator_password", ""}; // password for entering as a sepctator +cvar_t spectator_password = SCVAR("spectator_password", ""); // password for entering as a sepctator -cvar_t allow_download = {"allow_download", "1"}; -cvar_t allow_download_skins = {"allow_download_skins", "1"}; -cvar_t allow_download_models = {"allow_download_models", "1"}; -cvar_t allow_download_sounds = {"allow_download_sounds", "1"}; -cvar_t allow_download_demos = {"allow_download_demos", "1"}; -cvar_t allow_download_maps = {"allow_download_maps", "1"}; -cvar_t allow_download_anymap = {"allow_download_pakmaps", "0"}; -cvar_t allow_download_pakcontents = {"allow_download_pakcontents", "1"}; -cvar_t allow_download_root = {"allow_download_root", "0"}; -cvar_t allow_download_textures = {"allow_download_textures", "1"}; -cvar_t allow_download_pk3s = {"allow_download_pk3s", "1"}; -cvar_t allow_download_wads = {"allow_download_wads", "1"}; -cvar_t allow_download_configs = {"allow_download_configs", "0"}; +cvar_t allow_download = SCVAR("allow_download", "1"); +cvar_t allow_download_skins = SCVAR("allow_download_skins", "1"); +cvar_t allow_download_models = SCVAR("allow_download_models", "1"); +cvar_t allow_download_sounds = SCVAR("allow_download_sounds", "1"); +cvar_t allow_download_demos = SCVAR("allow_download_demos", "1"); +cvar_t allow_download_maps = SCVAR("allow_download_maps", "1"); +cvar_t allow_download_anymap = SCVAR("allow_download_pakmaps", "0"); +cvar_t allow_download_pakcontents = SCVAR("allow_download_pakcontents", "1"); +cvar_t allow_download_root = SCVAR("allow_download_root", "0"); +cvar_t allow_download_textures = SCVAR("allow_download_textures", "1"); +cvar_t allow_download_pk3s = SCVAR("allow_download_pk3s", "1"); +cvar_t allow_download_wads = SCVAR("allow_download_wads", "1"); +cvar_t allow_download_configs = SCVAR("allow_download_configs", "0"); -cvar_t sv_public = {"sv_public", "0"}; -cvar_t sv_listen = {"sv_listen", "1"}; -cvar_t sv_reportheartbeats = {"sv_reportheartbeats", "1"}; -cvar_t sv_highchars = {"sv_highchars", "1"}; -cvar_t sv_loadentfiles = {"sv_loadentfiles", "1"}; -cvar_t sv_maxrate = {"sv_maxrate", "10000"}; -cvar_t sv_maxdrate = {"sv_maxdrate", "10000"}; +cvar_t sv_public = SCVAR("sv_public", "0"); +cvar_t sv_listen = SCVAR("sv_listen", "1"); +cvar_t sv_reportheartbeats = SCVAR("sv_reportheartbeats", "1"); +cvar_t sv_highchars = SCVAR("sv_highchars", "1"); +cvar_t sv_loadentfiles = SCVAR("sv_loadentfiles", "1"); +cvar_t sv_maxrate = SCVAR("sv_maxrate", "10000"); +cvar_t sv_maxdrate = SCVAR("sv_maxdrate", "10000"); -cvar_t sv_bigcoords = {"sv_bigcoords", "", NULL, CVAR_SERVERINFO}; +cvar_t sv_bigcoords = SCVARF("sv_bigcoords", "", CVAR_SERVERINFO); -cvar_t sv_phs = {"sv_phs", "1"}; -cvar_t sv_resetparms = {"sv_resetparms", "0"}; +cvar_t sv_phs = SCVAR("sv_phs", "1"); +cvar_t sv_resetparms = SCVAR("sv_resetparms", "0"); -cvar_t sv_master = {"sv_master", "0"}; -cvar_t sv_masterport = {"sv_masterport", "0"}; +cvar_t sv_master = SCVAR("sv_master", "0"); +cvar_t sv_masterport = SCVAR("sv_masterport", "0"); -cvar_t sv_voicechat = {"sv_voicechat", "0"}; //still development. -cvar_t sv_gamespeed = {"sv_gamespeed", "1"}; -cvar_t sv_csqcdebug = {"sv_csqcdebug", "0"}; -cvar_t sv_tcpport = {"sv_tcpport", "0"}; +cvar_t sv_voicechat = SCVAR("sv_voicechat", "0"); //still development. +cvar_t sv_gamespeed = SCVAR("sv_gamespeed", "1"); +cvar_t sv_csqcdebug = SCVAR("sv_csqcdebug", "0"); +cvar_t sv_tcpport = SCVAR("sv_tcpport", "0"); -cvar_t pausable = {"pausable", "1"}; +cvar_t pausable = SCVAR("pausable", "1"); // // game rules mirrored in svs.info // -cvar_t fraglimit = {"fraglimit", "" , NULL, CVAR_SERVERINFO}; -cvar_t timelimit = {"timelimit", "" , NULL, CVAR_SERVERINFO}; -cvar_t teamplay = {"teamplay", "" , NULL, CVAR_SERVERINFO}; -cvar_t samelevel = {"samelevel", "" , NULL, CVAR_SERVERINFO}; -cvar_t maxclients = {"maxclients", "8", NULL, CVAR_SERVERINFO}; -cvar_t maxspectators = {"maxspectators", "8", NULL, CVAR_SERVERINFO}; +cvar_t fraglimit = SCVARF("fraglimit", "" , CVAR_SERVERINFO); +cvar_t timelimit = SCVARF("timelimit", "" , CVAR_SERVERINFO); +cvar_t teamplay = SCVARF("teamplay", "" , CVAR_SERVERINFO); +cvar_t samelevel = SCVARF("samelevel", "" , CVAR_SERVERINFO); +cvar_t maxclients = SCVARF("maxclients", "8", CVAR_SERVERINFO); +cvar_t maxspectators = SCVARF("maxspectators", "8", CVAR_SERVERINFO); #ifdef SERVERONLY -cvar_t deathmatch = {"deathmatch", "1", NULL, CVAR_SERVERINFO}; // 0, 1, or 2 +cvar_t deathmatch = SCVARF("deathmatch", "1", CVAR_SERVERINFO); // 0, 1, or 2 #else -cvar_t deathmatch = {"deathmatch", "0", NULL, CVAR_SERVERINFO}; // 0, 1, or 2 +cvar_t deathmatch = SCVARF("deathmatch", "0", CVAR_SERVERINFO); // 0, 1, or 2 #endif -cvar_t coop = {"coop", "" , NULL, CVAR_SERVERINFO}; -cvar_t skill = {"skill", "" , NULL, CVAR_SERVERINFO}; // 0, 1, 2 or 3 -cvar_t spawn = {"spawn", "" , NULL, CVAR_SERVERINFO}; -cvar_t watervis = {"watervis", "" , NULL, CVAR_SERVERINFO}; -cvar_t rearview = {"rearview", "" , NULL, CVAR_SERVERINFO}; -cvar_t allow_luma = {"allow_luma", "1", NULL, CVAR_SERVERINFO}; -cvar_t allow_bump = {"allow_bump", "1", NULL, CVAR_SERVERINFO}; -cvar_t allow_skybox = {"allow_skybox", "", NULL, CVAR_SERVERINFO}; -cvar_t sv_allow_splitscreen = {"allow_splitscreen", "",NULL,CVAR_SERVERINFO}; -cvar_t fbskins = {"fbskins", "1", NULL, CVAR_SERVERINFO}; //to get rid of lame fuhquake fbskins -cvar_t mirrors = {"mirrors", "" , NULL, CVAR_SERVERINFO}; +cvar_t coop = SCVARF("coop", "" , CVAR_SERVERINFO); +cvar_t skill = SCVARF("skill", "" , CVAR_SERVERINFO); // 0, 1, 2 or 3 +cvar_t spawn = SCVARF("spawn", "" , CVAR_SERVERINFO); +cvar_t watervis = SCVARF("watervis", "" , CVAR_SERVERINFO); +cvar_t rearview = SCVARF("rearview", "" , CVAR_SERVERINFO); +cvar_t allow_luma = SCVARF("allow_luma", "1", CVAR_SERVERINFO); +cvar_t allow_bump = SCVARF("allow_bump", "1", CVAR_SERVERINFO); +cvar_t allow_skybox = SCVARF("allow_skybox", "", CVAR_SERVERINFO); +cvar_t sv_allow_splitscreen = SCVARF("allow_splitscreen","",CVAR_SERVERINFO); +cvar_t fbskins = SCVARF("fbskins", "1", CVAR_SERVERINFO); //to get rid of lame fuhquake fbskins +cvar_t mirrors = SCVARF("mirrors", "" , CVAR_SERVERINFO); -cvar_t sv_motd[] ={ {"sv_motd1", ""}, - {"sv_motd2", ""}, - {"sv_motd3", ""}, - {"sv_motd4", ""} }; +cvar_t sv_motd[] ={ SCVAR("sv_motd1", ""), + SCVAR("sv_motd2", ""), + SCVAR("sv_motd3", ""), + SCVAR("sv_motd4", "") }; -cvar_t sv_compatablehulls = {"sv_compatablehulls", "1"}; +cvar_t sv_compatablehulls = SCVAR("sv_compatablehulls", "1"); -cvar_t hostname = {"hostname","unnamed", NULL, CVAR_SERVERINFO}; +cvar_t hostname = SCVARF("hostname","unnamed", CVAR_SERVERINFO); -cvar_t secure = {"secure", "", NULL, CVAR_SERVERINFO}; +cvar_t secure = SCVARF("secure", "", CVAR_SERVERINFO); extern cvar_t sv_nomsec; @@ -2374,7 +2374,7 @@ typedef struct ipfilter_t ipfilters[MAX_IPFILTERS]; int numipfilters; -cvar_t filterban = {"filterban", "1"}; +cvar_t filterban = SCVAR("filterban", "1"); /* ================= diff --git a/engine/server/sv_mvd.c b/engine/server/sv_mvd.c index 5eea9162a..e5e7273c3 100644 --- a/engine/server/sv_mvd.c +++ b/engine/server/sv_mvd.c @@ -385,22 +385,22 @@ dir_t Sys_listdir (char *path, char *ext, qboolean usesorting) demobuffer->maxsize - demobuffer->end) -cvar_t sv_demoUseCache = {"sv_demoUseCache", ""}; -cvar_t sv_demoCacheSize = {"sv_demoCacheSize", ""}; -cvar_t sv_demoMaxDirSize = {"sv_demoMaxDirSize", "102400"}; //so ktpro autorecords. -cvar_t sv_demoDir = {"sv_demoDir", "demos"}; -cvar_t sv_demofps = {"sv_demofps", ""}; -cvar_t sv_demoPings = {"sv_demoPings", ""}; -cvar_t sv_demoNoVis = {"sv_demoNoVis", ""}; -cvar_t sv_demoMaxSize = {"sv_demoMaxSize", ""}; -cvar_t sv_demoExtraNames = {"sv_demoExtraNames", ""}; +cvar_t sv_demoUseCache = SCVAR("sv_demoUseCache", ""); +cvar_t sv_demoCacheSize = SCVAR("sv_demoCacheSize", ""); +cvar_t sv_demoMaxDirSize = SCVAR("sv_demoMaxDirSize", "102400"); //so ktpro autorecords. +cvar_t sv_demoDir = SCVAR("sv_demoDir", "demos"); +cvar_t sv_demofps = SCVAR("sv_demofps", ""); +cvar_t sv_demoPings = SCVAR("sv_demoPings", ""); +cvar_t sv_demoNoVis = SCVAR("sv_demoNoVis", ""); +cvar_t sv_demoMaxSize = SCVAR("sv_demoMaxSize", ""); +cvar_t sv_demoExtraNames = SCVAR("sv_demoExtraNames", ""); -cvar_t mvd_streamport = {"mvd_streamport", "0"}; -cvar_t mvd_maxstreams = {"mvd_maxstreams", "1"}; +cvar_t mvd_streamport = SCVAR("mvd_streamport", "0"); +cvar_t mvd_maxstreams = SCVAR("mvd_maxstreams", "1"); -cvar_t sv_demoPrefix = {"sv_demoPrefix", ""}; -cvar_t sv_demoSuffix = {"sv_demoSuffix", ""}; -cvar_t sv_demotxt = {"sv_demotxt", "1"}; +cvar_t sv_demoPrefix = SCVAR("sv_demoPrefix", ""); +cvar_t sv_demoSuffix = SCVAR("sv_demoSuffix", ""); +cvar_t sv_demotxt = SCVAR("sv_demotxt", "1"); void SV_WriteMVDMessage (sizebuf_t *msg, int type, int to, float time); diff --git a/engine/server/sv_phys.c b/engine/server/sv_phys.c index 39ed60194..2d4c57a8f 100644 --- a/engine/server/sv_phys.c +++ b/engine/server/sv_phys.c @@ -41,24 +41,24 @@ solid_edge items only clip against bsp models. */ -cvar_t sv_maxvelocity = {"sv_maxvelocity","2000"}; +cvar_t sv_maxvelocity = SCVAR("sv_maxvelocity","2000"); -cvar_t sv_gravity = { "sv_gravity", "800"}; -cvar_t sv_stopspeed = { "sv_stopspeed", "100"}; -cvar_t sv_maxspeed = { "sv_maxspeed", "320"}; -cvar_t sv_spectatormaxspeed = { "sv_spectatormaxspeed", "500"}; -cvar_t sv_accelerate = { "sv_accelerate", "10"}; -cvar_t sv_airaccelerate = { "sv_airaccelerate", "0.7"}; -cvar_t sv_wateraccelerate = { "sv_wateraccelerate", "10"}; -cvar_t sv_friction = { "sv_friction", "4"}; -cvar_t sv_waterfriction = { "sv_waterfriction", "4"}; +cvar_t sv_gravity = SCVAR( "sv_gravity", "800"); +cvar_t sv_stopspeed = SCVAR( "sv_stopspeed", "100"); +cvar_t sv_maxspeed = SCVAR( "sv_maxspeed", "320"); +cvar_t sv_spectatormaxspeed = SCVAR( "sv_spectatormaxspeed", "500"); +cvar_t sv_accelerate = SCVAR( "sv_accelerate", "10"); +cvar_t sv_airaccelerate = SCVAR( "sv_airaccelerate", "0.7"); +cvar_t sv_wateraccelerate = SCVAR( "sv_wateraccelerate", "10"); +cvar_t sv_friction = SCVAR( "sv_friction", "4"); +cvar_t sv_waterfriction = SCVAR( "sv_waterfriction", "4"); -cvar_t pm_ktjump = {"pm_ktjump", "", NULL, CVAR_SERVERINFO}; -cvar_t pm_bunnyspeedcap = {"pm_bunnyspeedcap", "", NULL, CVAR_SERVERINFO}; -cvar_t pm_slidefix = {"pm_slidefix", "", NULL, CVAR_SERVERINFO}; -cvar_t pm_slidyslopes = {"pm_slidyslopes", "", NULL, CVAR_SERVERINFO}; -cvar_t pm_airstep = {"pm_airstep", "", NULL, CVAR_SERVERINFO}; -cvar_t pm_walljump = {"pm_walljump", "", NULL, CVAR_SERVERINFO}; +cvar_t pm_ktjump = SCVARF("pm_ktjump", "", CVAR_SERVERINFO); +cvar_t pm_bunnyspeedcap = SCVARF("pm_bunnyspeedcap", "", CVAR_SERVERINFO); +cvar_t pm_slidefix = SCVARF("pm_slidefix", "", CVAR_SERVERINFO); +cvar_t pm_slidyslopes = SCVARF("pm_slidyslopes", "", CVAR_SERVERINFO); +cvar_t pm_airstep = SCVARF("pm_airstep", "", CVAR_SERVERINFO); +cvar_t pm_walljump = SCVARF("pm_walljump", "", CVAR_SERVERINFO); extern cvar_t sv_nomsec; diff --git a/engine/server/sv_rankin.c b/engine/server/sv_rankin.c index 245f6404c..316e6dd06 100644 --- a/engine/server/sv_rankin.c +++ b/engine/server/sv_rankin.c @@ -23,9 +23,9 @@ typedef struct { rankfileheader_t rankfileheader; FILE *rankfile; -cvar_t rank_autoadd = {"rank_autoadd", "1"}; -cvar_t rank_needlogin = {"rank_needlogin", "0"}; -cvar_t rank_filename = {"rank_filename", ""}; +cvar_t rank_autoadd = SCVAR("rank_autoadd", "1"); +cvar_t rank_needlogin = SCVAR("rank_needlogin", "0"); +cvar_t rank_filename = SCVAR("rank_filename", ""); char rank_cvargroup[] = "server rankings"; #define RANKFILE_VERSION 0x00000000 diff --git a/engine/server/sv_user.c b/engine/server/sv_user.c index e5d3eeb4a..d343ecf35 100644 --- a/engine/server/sv_user.c +++ b/engine/server/sv_user.c @@ -33,37 +33,37 @@ edict_t *sv_player; usercmd_t cmd; #ifdef SERVERONLY -cvar_t cl_rollspeed = {"cl_rollspeed", "200"}; -cvar_t cl_rollangle = {"cl_rollangle", "2.0"}; +cvar_t cl_rollspeed = SCVAR("cl_rollspeed", "200"); +cvar_t cl_rollangle = SCVAR("cl_rollangle", "2.0"); #else extern cvar_t cl_rollspeed; extern cvar_t cl_rollangle; #endif -cvar_t sv_spectalk = {"sv_spectalk", "1"}; +cvar_t sv_spectalk = SCVAR("sv_spectalk", "1"); -cvar_t sv_mapcheck = {"sv_mapcheck", "1"}; +cvar_t sv_mapcheck = SCVAR("sv_mapcheck", "1"); -cvar_t sv_cheatpc = {"sv_cheatpc", "125"}; -cvar_t sv_cheatspeedchecktime = {"sv_cheatspeedchecktime", "30"}; -cvar_t sv_playermodelchecks = {"sv_playermodelchecks", "1"}; +cvar_t sv_cheatpc = SCVAR("sv_cheatpc", "125"); +cvar_t sv_cheatspeedchecktime = SCVAR("sv_cheatspeedchecktime", "30"); +cvar_t sv_playermodelchecks = SCVAR("sv_playermodelchecks", "1"); -cvar_t sv_cmdlikercon = {"sv_cmdlikercon", "0"}; //set to 1 to allow a password of username:password instead of the correct rcon password. -cvar_t cmd_allowaccess = {"cmd_allowaccess", "0"}; //set to 1 to allow cmd to execute console commands on the server. -cvar_t cmd_gamecodelevel = {"cmd_gamecodelevel", "50"}; //execution level which gamecode is told about (for unrecognised commands) +cvar_t sv_cmdlikercon = SCVAR("sv_cmdlikercon", "0"); //set to 1 to allow a password of username:password instead of the correct rcon password. +cvar_t cmd_allowaccess = SCVAR("cmd_allowaccess", "0"); //set to 1 to allow cmd to execute console commands on the server. +cvar_t cmd_gamecodelevel = SCVAR("cmd_gamecodelevel", "50"); //execution level which gamecode is told about (for unrecognised commands) -cvar_t sv_nomsec = {"sv_nomsec", "0"}; -cvar_t sv_edgefriction = {"sv_edgefriction", "2"}; +cvar_t sv_nomsec = SCVAR("sv_nomsec", "0"); +cvar_t sv_edgefriction = SCVAR("sv_edgefriction", "2"); -cvar_t sv_brokenmovetypes = {"sv_brokenmovetypes", "0"}; +cvar_t sv_brokenmovetypes = SCVAR("sv_brokenmovetypes", "0"); -cvar_t sv_chatfilter = {"sv_chatfilter", "0"}; +cvar_t sv_chatfilter = SCVAR("sv_chatfilter", "0"); -cvar_t votelevel = {"votelevel", "0"}; -cvar_t voteminimum = {"voteminimum", "4"}; -cvar_t votepercent = {"votepercent", "-1"}; -cvar_t votetime = {"votetime", "10"}; +cvar_t votelevel = SCVAR("votelevel", "0"); +cvar_t voteminimum = SCVAR("voteminimum", "4"); +cvar_t votepercent = SCVAR("votepercent", "-1"); +cvar_t votetime = SCVAR("votetime", "10"); -cvar_t pr_allowbutton1 = {"pr_allowbutton1", "1", NULL, CVAR_LATCH}; +cvar_t pr_allowbutton1 = SCVARF("pr_allowbutton1", "1", CVAR_LATCH); extern cvar_t pm_bunnyspeedcap; @@ -72,7 +72,7 @@ extern cvar_t pm_slidefix; extern cvar_t pm_slidyslopes; extern cvar_t pm_airstep; extern cvar_t pm_walljump; -cvar_t sv_pushplayers = {"sv_pushplayers", "0"}; +cvar_t sv_pushplayers = SCVAR("sv_pushplayers", "0"); char sv_votinggroup[] = "server voting"; @@ -1739,6 +1739,28 @@ void SV_BeginDownload_f(void) #ifdef PEXT_CHUNKEDDOWNLOADS if (host_client->fteprotocolextensions & PEXT_CHUNKEDDOWNLOADS) { + if (host_client->download->seekingisabadplan) + { //if seeking is a bad plan (for whatever reason - usually because of zip files) + //create a temp file instead + int i, len; + char buffer[8192]; + vfsfile_t *tmp; + tmp = FS_OpenTemp(); + + for (i = 0; ; i+=len) + { + len = sizeof(buffer); + if (len > host_client->downloadsize-i) + len = host_client->downloadsize-i; + if (len == 0) + break; + VFS_READ(host_client->download, buffer, len); + VFS_WRITE(tmp, buffer, len); + } + VFS_CLOSE(host_client->download); + host_client->download = tmp; + } + ClientReliableWrite_Begin (host_client, svc_download, 10+strlen(name)); ClientReliableWrite_Long (host_client, -1); ClientReliableWrite_Long (host_client, host_client->downloadsize);