From 272abade38abde25b87a2dd28f966c5aeb29e445 Mon Sep 17 00:00:00 2001 From: Jeff Teunissen Date: Sun, 13 May 2001 05:10:02 +0000 Subject: [PATCH] Backport Cvar callbacks to newtree. Software gamma still doesn't work in GL, and I still don't know exactly why. --- include/cvar.h | 26 ++++------- source/cl_cam.c | 8 ++-- source/cl_ents.c | 2 +- source/cl_input.c | 2 +- source/cl_main.c | 102 ++++++++++++++++++++-------------------- source/cl_pred.c | 6 +-- source/cl_sys_sdl.c | 2 +- source/cl_sys_unix.c | 2 +- source/cl_sys_win.c | 2 +- source/com.c | 2 +- source/console.c | 2 +- source/context_x11.c | 4 +- source/cvar.c | 32 +++++++++---- source/d_init.c | 6 +-- source/draw.c | 2 +- source/gl_draw.c | 16 +++---- source/gl_rmain.c | 45 ------------------ source/gl_rmisc.c | 60 ++++++++++++------------ source/gl_screen.c | 28 +++++------ source/gl_view.c | 1 - source/in_ggi.c | 4 +- source/in_sdl.c | 4 +- source/in_win.c | 2 +- source/in_x11.c | 8 ++-- source/joy_linux.c | 8 ++-- source/joy_null.c | 6 +-- source/joy_win.c | 46 +++++++++--------- source/keys.c | 2 +- source/model.c | 2 +- source/net_chan.c | 6 +-- source/net_packetlog.c | 4 +- source/pmove.c | 2 +- source/pr_edict.c | 2 +- source/quakefs.c | 10 ++-- source/r_main.c | 48 +++++++++---------- source/r_view.c | 70 +++++++++++++++++---------- source/screen.c | 26 +++++------ source/skin.c | 10 ++-- source/snd_dma.c | 26 +++++------ source/snd_null.c | 6 +-- source/sv_ccmds.c | 2 +- source/sv_main.c | 104 ++++++++++++++++++++--------------------- source/sv_progs.c | 4 +- source/sv_sys_unix.c | 6 +-- source/sv_sys_win.c | 4 +- source/sv_user.c | 8 ++-- source/teamplay.c | 8 ++-- source/vid.c | 11 ++--- source/vid_common_gl.c | 27 +++++------ source/vid_fbdev.c | 6 +-- source/vid_glx.c | 1 - source/vid_mgl.c | 24 +++++----- source/vid_sdl.c | 2 +- source/vid_sgl.c | 2 +- source/vid_svgalib.c | 6 +-- source/vid_wgl.c | 4 +- source/vid_x11.c | 6 +-- 57 files changed, 420 insertions(+), 447 deletions(-) diff --git a/include/cvar.h b/include/cvar.h index ceac5b4..56cee09 100644 --- a/include/cvar.h +++ b/include/cvar.h @@ -26,17 +26,17 @@ $Id$ */ -#ifndef _CVAR_H -#define _CVAR_H +#ifndef __cvar_h_ +#define __cvar_h_ #include "qtypes.h" #include "quakeio.h" -typedef struct cvar_s -{ +typedef struct cvar_s { char *name; char *string; int flags; + void (*callback)(struct cvar_s *var); char *description; // for "help" command float value; int int_val; @@ -44,8 +44,7 @@ typedef struct cvar_s struct cvar_s *next; } cvar_t; -typedef struct cvar_alias_s -{ +typedef struct cvar_alias_s { char *name; cvar_t *cvar; struct cvar_alias_s *next; @@ -57,19 +56,11 @@ typedef struct cvar_alias_s // specific configurations #define CVAR_USERINFO 2 // sent to server on connect or change #define CVAR_SERVERINFO 4 // sent in response to front end requests -#define CVAR_SYSTEMINFO 8 // these cvars will be duplicated on all clients -#define CVAR_INIT 16 // don't allow change from console at all, - // but can be set from the command line #define CVAR_NOTIFY 32 // Will notify players when changed. #define CVAR_ROM 64 // display only, cannot be set by user at all #define CVAR_USER_CREATED 128 // created by a set command -#define CVAR_HEAP 256 // allocated off the heap, safe to free -#define CVAR_CHEAT 512 // can not be changed if cheats are disabled -#define CVAR_NORESTART 1024 // do not clear when a cvar_restart is issued #define CVAR_LATCH 2048 // will only change when C code next does // a Cvar_Get(), so it can't be changed -#define CVAR_TEMP 4096 // can be set even when cheats are - // disabled, but is not archived // Zoid| A good CVAR_ROM example is userpath. The code should read "cvar_t // *fs_userpath = CvarGet("fs_userpath", ".", CVAR_ROM); The user can @@ -81,7 +72,8 @@ typedef struct cvar_alias_s // Returns the Cvar if found, creates it with value if not. Description and // flags are always updated. -cvar_t *Cvar_Get (char *name, char *value, int cvarflags, char *description); +cvar_t *Cvar_Get (char *name, char *value, int cvarflags, + void (*callback)(cvar_t*), char *description); cvar_t *Cvar_FindAlias (char *alias_name); @@ -120,9 +112,9 @@ void Cvar_WriteVariables (QFile *f); cvar_t *Cvar_FindVar (char *var_name); void Cvar_Init_Hash (void); -void Cvar_Init(); +void Cvar_Init (void); -void Cvar_Shutdown(); +void Cvar_Shutdown (void); extern cvar_t *cvar_vars; diff --git a/source/cl_cam.c b/source/cl_cam.c index 5c1c2fd..11fdb90 100644 --- a/source/cl_cam.c +++ b/source/cl_cam.c @@ -603,9 +603,9 @@ Cam_Reset (void) void CL_Cam_Init_Cvars (void) { - cl_hightrack = Cvar_Get ("cl_hightrack", "0", CVAR_NONE, "view the player with the highest frags while in spectator mode."); - cl_chasecam = Cvar_Get ("cl_chasecam", "0", CVAR_NONE, "get first person view of the person you are tracking in spectator mode"); + cl_hightrack = Cvar_Get ("cl_hightrack", "0", CVAR_NONE, NULL, "view the player with the highest frags while in spectator mode."); + cl_chasecam = Cvar_Get ("cl_chasecam", "0", CVAR_NONE, NULL, "get first person view of the person you are tracking in spectator mode"); cl_camera_maxpitch = - Cvar_Get ("cl_camera_maxpitch", "10", CVAR_NONE, "highest camera pitch in spectator mode"); - cl_camera_maxyaw = Cvar_Get ("cl_camera_maxyaw", "30", CVAR_NONE, "highest camera yaw in spectator mode"); + Cvar_Get ("cl_camera_maxpitch", "10", CVAR_NONE, NULL, "highest camera pitch in spectator mode"); + cl_camera_maxyaw = Cvar_Get ("cl_camera_maxyaw", "30", CVAR_NONE, NULL, "highest camera yaw in spectator mode"); } diff --git a/source/cl_ents.c b/source/cl_ents.c index a3c5a2b..35b46dc 100644 --- a/source/cl_ents.c +++ b/source/cl_ents.c @@ -1110,6 +1110,6 @@ CL_EmitEntities (void) void CL_Ents_Init (void) { - r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.4 0", CVAR_ARCHIVE, + r_firecolor = Cvar_Get ("r_firecolor", "0.9 0.4 0", CVAR_ARCHIVE, NULL, "color of rocket and lava ball fires"); } diff --git a/source/cl_input.c b/source/cl_input.c index 1f0bee7..8f37e53 100644 --- a/source/cl_input.c +++ b/source/cl_input.c @@ -731,7 +731,7 @@ CL_Input_Init (void) void CL_Input_Init_Cvars (void) { - cl_nodelta = Cvar_Get ("cl_nodelta", "0", CVAR_NONE, "disable player delta compression." + cl_nodelta = Cvar_Get ("cl_nodelta", "0", CVAR_NONE, NULL, "disable player delta compression." "set to 1 if you have a poor ISP and get a lot of U_REMOVE warnings."); } diff --git a/source/cl_main.c b/source/cl_main.c index dc69dcf..a62d726 100644 --- a/source/cl_main.c +++ b/source/cl_main.c @@ -1216,105 +1216,105 @@ CL_Init_Cvars (void) { // LordHavoc: some people like it asking on quit, others don't... confirm_quit = - Cvar_Get ("confirm_quit", "1", CVAR_ARCHIVE, "confirm quit command"); - cl_allow_cmd_pkt = Cvar_Get ("cl_allow_cmd_pkt", "1", CVAR_NONE, + Cvar_Get ("confirm_quit", "1", CVAR_ARCHIVE, NULL, "confirm quit command"); + cl_allow_cmd_pkt = Cvar_Get ("cl_allow_cmd_pkt", "1", CVAR_NONE, NULL, "enables packets from the likes of gamespy"); - show_fps = Cvar_Get ("show_fps", "0", CVAR_NONE, + show_fps = Cvar_Get ("show_fps", "0", CVAR_NONE, NULL, "display realtime frames per second"); // Misty: I like to be able to see the time when I play - show_time = Cvar_Get ("show_time", "0", CVAR_NONE, + show_time = Cvar_Get ("show_time", "0", CVAR_NONE, NULL, "display the current time"); - host_speeds = Cvar_Get ("host_speeds", "0", CVAR_NONE, + host_speeds = Cvar_Get ("host_speeds", "0", CVAR_NONE, NULL, "display host processing times"); - developer = Cvar_Get ("developer", "0", CVAR_NONE, + developer = Cvar_Get ("developer", "0", CVAR_NONE, NULL, "show info interesting to developers"); - cl_demospeed = Cvar_Get ("cl_demospeed", "1.0", CVAR_NONE, + cl_demospeed = Cvar_Get ("cl_demospeed", "1.0", CVAR_NONE, NULL, "adjust demo playback speed. 1.0 = normal, < 1 slow-mo, > 1 timelaps"); // Misty: Turn on or off screen filling colors for powerups among other things. - cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE, + cl_cshift_bonus = Cvar_Get ("cl_cshift_bonus", "1", CVAR_ARCHIVE, NULL, "Show bonus flash on item pickup"); - cl_cshift_contents = Cvar_Get ("cl_cshift_content", "1", CVAR_ARCHIVE, + cl_cshift_contents = Cvar_Get ("cl_cshift_content", "1", CVAR_ARCHIVE, NULL, "Shift view colors for contents (water, slime, etc)"); - cl_cshift_damage = Cvar_Get ("cl_cshift_damage", "1", CVAR_ARCHIVE, + cl_cshift_damage = Cvar_Get ("cl_cshift_damage", "1", CVAR_ARCHIVE, NULL, "Shift view colors on damage"); - cl_cshift_powerup = Cvar_Get ("cl_cshift_powerup", "1", CVAR_ARCHIVE, + cl_cshift_powerup = Cvar_Get ("cl_cshift_powerup", "1", CVAR_ARCHIVE, NULL, "Shift view colors for powerups"); - cl_autoexec = Cvar_Get ("cl_autoexec", "0", CVAR_ROM, + cl_autoexec = Cvar_Get ("cl_autoexec", "0", CVAR_ROM, NULL, "exec autoexec.cfg on gamedir change"); - cl_warncmd = Cvar_Get ("cl_warncmd", "0", CVAR_NONE, + cl_warncmd = Cvar_Get ("cl_warncmd", "0", CVAR_NONE, NULL, "inform when execing a command"); - cl_upspeed = Cvar_Get ("cl_upspeed", "200", CVAR_NONE, + cl_upspeed = Cvar_Get ("cl_upspeed", "200", CVAR_NONE, NULL, "swim/fly up/down speed"); - cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE, + cl_forwardspeed = Cvar_Get ("cl_forwardspeed", "200", CVAR_ARCHIVE, NULL, "forward speed"); - cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, + cl_backspeed = Cvar_Get ("cl_backspeed", "200", CVAR_ARCHIVE, NULL, "backward speed"); - cl_sidespeed = Cvar_Get ("cl_sidespeed", "350", CVAR_NONE, "strafe speed"); - cl_movespeedkey = Cvar_Get ("cl_movespeedkey", "2.0", CVAR_NONE, + cl_sidespeed = Cvar_Get ("cl_sidespeed", "350", CVAR_NONE, NULL, "strafe speed"); + cl_movespeedkey = Cvar_Get ("cl_movespeedkey", "2.0", CVAR_NONE, NULL, "move `run' speed multiplier"); - cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, "turning speed"); - cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "150", CVAR_NONE, + cl_yawspeed = Cvar_Get ("cl_yawspeed", "140", CVAR_NONE, NULL, "turning speed"); + cl_pitchspeed = Cvar_Get ("cl_pitchspeed", "150", CVAR_NONE, NULL, "look up/down speed"); - cl_anglespeedkey = Cvar_Get ("cl_anglespeedkey", "1.5", CVAR_NONE, + cl_anglespeedkey = Cvar_Get ("cl_anglespeedkey", "1.5", CVAR_NONE, NULL, "turn `run' speed multiplier"); - cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_NONE, + cl_shownet = Cvar_Get ("cl_shownet", "0", CVAR_NONE, NULL, "show network packets. 0=off, 1=basic, 2=verbose"); - cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, "status bar mode"); - cl_sbar_separator = Cvar_Get ("cl_sbar_separator", "0", CVAR_ARCHIVE, + cl_sbar = Cvar_Get ("cl_sbar", "0", CVAR_ARCHIVE, NULL, "status bar mode"); + cl_sbar_separator = Cvar_Get ("cl_sbar_separator", "0", CVAR_ARCHIVE, NULL, "turns on status bar separator"); - cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, + cl_hudswap = Cvar_Get ("cl_hudswap", "0", CVAR_ARCHIVE, NULL, "new HUD on left side?"); - cl_maxfps = Cvar_Get ("cl_maxfps", "0", CVAR_ARCHIVE, + cl_maxfps = Cvar_Get ("cl_maxfps", "0", CVAR_ARCHIVE, NULL, "maximum frames rendered in one second. 0 == 32"); - cl_timeout = Cvar_Get ("cl_timeout", "60", CVAR_ARCHIVE, + cl_timeout = Cvar_Get ("cl_timeout", "60", CVAR_ARCHIVE, NULL, "server connection timeout (since last packet received)"); - lookspring = Cvar_Get ("lookspring", "0", CVAR_ARCHIVE, + lookspring = Cvar_Get ("lookspring", "0", CVAR_ARCHIVE, NULL, "Snap view to center when moving and no mlook/klook"); - lookstrafe = Cvar_Get ("lookstrafe", "0", CVAR_ARCHIVE, + lookstrafe = Cvar_Get ("lookstrafe", "0", CVAR_ARCHIVE, NULL, "when mlook/klook on player will strafe"); - sensitivity = Cvar_Get ("sensitivity", "3", CVAR_ARCHIVE, + sensitivity = Cvar_Get ("sensitivity", "3", CVAR_ARCHIVE, NULL, "mouse sensitivity multiplier"); - cl_freelook = Cvar_Get ("freelook", "0", CVAR_ARCHIVE, "force +mlook"); + cl_freelook = Cvar_Get ("freelook", "0", CVAR_ARCHIVE, NULL, "force +mlook"); - m_pitch = Cvar_Get ("m_pitch", "0.022", CVAR_ARCHIVE, + m_pitch = Cvar_Get ("m_pitch", "0.022", CVAR_ARCHIVE, NULL, "mouse pitch (up/down) multipier"); - m_yaw = Cvar_Get ("m_yaw", "0.022", CVAR_NONE, + m_yaw = Cvar_Get ("m_yaw", "0.022", CVAR_NONE, NULL, "mouse yaw (left/right) multiplier"); - m_forward = Cvar_Get ("m_forward", "1", CVAR_NONE, + m_forward = Cvar_Get ("m_forward", "1", CVAR_NONE, NULL, "mouse forward/back speed"); - m_side = Cvar_Get ("m_side", "0.8", CVAR_NONE, "mouse strafe speed"); + m_side = Cvar_Get ("m_side", "0.8", CVAR_NONE, NULL, "mouse strafe speed"); - rcon_password = Cvar_Get ("rcon_password", "", CVAR_NONE, + rcon_password = Cvar_Get ("rcon_password", "", CVAR_NONE, NULL, "remote control password"); - rcon_address = Cvar_Get ("rcon_address", "", CVAR_NONE, + rcon_address = Cvar_Get ("rcon_address", "", CVAR_NONE, NULL, "server IP address when client not connected - for sending rcon commands"); - cl_writecfg = Cvar_Get ("cl_writecfg", "1", CVAR_NONE, "write config files?"); + cl_writecfg = Cvar_Get ("cl_writecfg", "1", CVAR_NONE, NULL, "write config files?"); - cl_predict_players2 = Cvar_Get ("cl_predict_players2", "1", CVAR_NONE, + cl_predict_players2 = Cvar_Get ("cl_predict_players2", "1", CVAR_NONE, NULL, "If this and cl_predict_players is 0, no player prediction is done"); - cl_predict_players = Cvar_Get ("cl_predict_players", "1", CVAR_NONE, + cl_predict_players = Cvar_Get ("cl_predict_players", "1", CVAR_NONE, NULL, "If this and cl_predict_players2 is 0, no player prediction is done"); - cl_solid_players = Cvar_Get ("cl_solid_players", "1", CVAR_NONE, + cl_solid_players = Cvar_Get ("cl_solid_players", "1", CVAR_NONE, NULL, "Are players solid? If off, you can walk through them with difficulty"); - localid = Cvar_Get ("localid", "", CVAR_NONE, + localid = Cvar_Get ("localid", "", CVAR_NONE, NULL, "FIXME: This has something to do with client authentication. No Description"); // // info mirrors // - name = Cvar_Get ("name", "unnamed", CVAR_ARCHIVE | CVAR_USERINFO, + name = Cvar_Get ("name", "unnamed", CVAR_ARCHIVE | CVAR_USERINFO, NULL, "Player name"); - password = Cvar_Get ("password", "", CVAR_USERINFO, "Server password"); - spectator = Cvar_Get ("spectator", "", CVAR_USERINFO, + password = Cvar_Get ("password", "", CVAR_USERINFO, NULL, "Server password"); + spectator = Cvar_Get ("spectator", "", CVAR_USERINFO, NULL, "Set to 1 before connecting to become a spectator"); - team = Cvar_Get ("team", "", CVAR_ARCHIVE | CVAR_USERINFO, + team = Cvar_Get ("team", "", CVAR_ARCHIVE | CVAR_USERINFO, NULL, "Team player is on."); - rate = Cvar_Get ("rate", "2500", CVAR_ARCHIVE | CVAR_USERINFO, + rate = Cvar_Get ("rate", "2500", CVAR_ARCHIVE | CVAR_USERINFO, NULL, "Amount of bytes per second server will send/download to you"); - msg = Cvar_Get ("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO, "Determines the type of messages reported 0 is maximum, 4 is none"); - noaim = Cvar_Get ("noaim", "0", CVAR_ARCHIVE | CVAR_USERINFO, + msg = Cvar_Get ("msg", "1", CVAR_ARCHIVE | CVAR_USERINFO, NULL, "Determines the type of messages reported 0 is maximum, 4 is none"); + noaim = Cvar_Get ("noaim", "0", CVAR_ARCHIVE | CVAR_USERINFO, NULL, "Auto aim off switch. Set to 1 to turn off."); } @@ -1580,7 +1580,7 @@ Host_Init (void) // only reads from within the quake file system, and changing that is // probably Not A Good Thing (tm). fs_globalcfg = Cvar_Get ("fs_globalcfg", FS_GLOBALCFG, - CVAR_ROM, "global configuration file"); + CVAR_ROM, NULL, "global configuration file"); Cmd_Exec_File (fs_globalcfg->string); Cbuf_Execute_Sets (); @@ -1589,7 +1589,7 @@ Host_Init (void) Cbuf_Execute_Sets (); fs_usercfg = Cvar_Get ("fs_usercfg", FS_USERCFG, - CVAR_ROM, "user configuration file"); + CVAR_ROM, NULL, "user configuration file"); Cmd_Exec_File (fs_usercfg->string); Cbuf_Execute_Sets (); diff --git a/source/cl_pred.c b/source/cl_pred.c index 6616f9a..a56176b 100644 --- a/source/cl_pred.c +++ b/source/cl_pred.c @@ -223,7 +223,7 @@ void CL_Prediction_Init_Cvars (void) { /* I'm not totally sure what cl_pushlatency is for. Or if it is SUPPOSED TO BE SETTABLE. */ - cl_pushlatency = Cvar_Get ("pushlatency", "-999", CVAR_NONE, "How much prediction should the client make"); - cl_nopred = Cvar_Get ("cl_nopred", "0", CVAR_NONE, "Set to turn off client prediction"); - cl_nostatpred = Cvar_Get ("cl_nostatpred", "0", CVAR_NONE, "Set to turn off static player prediction"); + cl_pushlatency = Cvar_Get ("pushlatency", "-999", CVAR_NONE, NULL, "How much prediction should the client make"); + cl_nopred = Cvar_Get ("cl_nopred", "0", CVAR_NONE, NULL, "Set to turn off client prediction"); + cl_nostatpred = Cvar_Get ("cl_nostatpred", "0", CVAR_NONE, NULL, "Set to turn off static player prediction"); } diff --git a/source/cl_sys_sdl.c b/source/cl_sys_sdl.c index 80424a8..428a96a 100644 --- a/source/cl_sys_sdl.c +++ b/source/cl_sys_sdl.c @@ -230,7 +230,7 @@ Sys_Sleep (void) void Sys_Init_Cvars (void) { - sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, "Set to disable std out"); + sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, NULL, "Set to disable std out"); if (COM_CheckParm ("-nostdout")) Cvar_Set (sys_nostdout, "1"); } diff --git a/source/cl_sys_unix.c b/source/cl_sys_unix.c index 42043cd..94e0878 100644 --- a/source/cl_sys_unix.c +++ b/source/cl_sys_unix.c @@ -77,7 +77,7 @@ Sys_Quit (void) void Sys_Init_Cvars (void) { - sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, "set to disable std out"); + sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, NULL, "set to disable std out"); if (COM_CheckParm ("-nostdout")) Cvar_Set (sys_nostdout, "1"); } diff --git a/source/cl_sys_win.c b/source/cl_sys_win.c index 7aa2110..14d8b2f 100644 --- a/source/cl_sys_win.c +++ b/source/cl_sys_win.c @@ -163,7 +163,7 @@ Sys_MakeCodeWriteable (unsigned long startaddr, unsigned long length) void Sys_Init_Cvars (void) { - sys_nostdout = Cvar_Get ("sys_nostdout", "1", CVAR_NONE, "unset to enable std out - windows does NOT support this"); + sys_nostdout = Cvar_Get ("sys_nostdout", "1", CVAR_NONE, NULL, "unset to enable std out - windows does NOT support this"); } void diff --git a/source/com.c b/source/com.c index f6a02b0..74cbb68 100644 --- a/source/com.c +++ b/source/com.c @@ -113,5 +113,5 @@ COM_Init (void) void COM_Init_Cvars (void) { - registered = Cvar_Get ("registered", "0", CVAR_NONE, "Is the game the registered version. 1 yes 0 no"); + registered = Cvar_Get ("registered", "0", CVAR_NONE, NULL, "Is the game the registered version. 1 yes 0 no"); } diff --git a/source/console.c b/source/console.c index d0d8ee1..1f9ae08 100644 --- a/source/console.c +++ b/source/console.c @@ -266,7 +266,7 @@ Con_Init (void) void Con_Init_Cvars (void) { - con_notifytime = Cvar_Get ("con_notifytime", "3", CVAR_NONE, "How long in seconds messages are displayed on screen"); + con_notifytime = Cvar_Get ("con_notifytime", "3", CVAR_NONE, NULL, "How long in seconds messages are displayed on screen"); } diff --git a/source/context_x11.c b/source/context_x11.c index ccf1c3e..d74a84d 100644 --- a/source/context_x11.c +++ b/source/context_x11.c @@ -321,9 +321,9 @@ X11_SetVidMode (int width, int height) void X11_Init_Cvars (void) { - vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ROM, + vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ROM, NULL, "Toggles fullscreen game mode"); - vid_system_gamma = Cvar_Get ("vid_system_gamma", "1", CVAR_ARCHIVE, + vid_system_gamma = Cvar_Get ("vid_system_gamma", "1", CVAR_ARCHIVE, NULL, "Use system gamma control if available"); } diff --git a/source/cvar.c b/source/cvar.c index 2dc54e1..cae6c6d 100644 --- a/source/cvar.c +++ b/source/cvar.c @@ -4,7 +4,6 @@ dynamic variable tracking Copyright (C) 1996-1997 Id Software, Inc. - Copyright (C) 1999,2000 Nelson Rush. Copyright (C) 1999,2000 contributors of the QuakeForge project Please see the file "AUTHORS" for a list of contributors @@ -184,6 +183,8 @@ void Cvar_Info (cvar_t *var); void Cvar_Set (cvar_t *var, char *value) { + int changed; + if (!var) return; @@ -192,6 +193,7 @@ Cvar_Set (cvar_t *var, char *value) return; } + changed = !strequal (var->string, value); free (var->string); // free the old value string var->string = strdup (value); @@ -200,6 +202,9 @@ Cvar_Set (cvar_t *var, char *value) sscanf (var->string, "%f %f %f", &var->vec[0], &var->vec[1], &var->vec[2]); Cvar_Info (var); + + if (changed && var->callback) + var->callback (var); } @@ -211,9 +216,12 @@ Cvar_Set (cvar_t *var, char *value) void Cvar_SetROM (cvar_t *var, char *value) { + int changed; + if (!var) return; + changed = !strequal (var->string, value); free (var->string); // free the old value string var->string = strdup (value); @@ -222,6 +230,9 @@ Cvar_SetROM (cvar_t *var, char *value) sscanf (var->string, "%f %f %f", &var->vec[0], &var->vec[1], &var->vec[2]); Cvar_Info (var); + + if (changed && var->callback) + var->callback (var); } /* @@ -310,7 +321,7 @@ Cvar_Set_f (void) Cvar_Set (var, value); } } else { - var = Cvar_Get (var_name, value, CVAR_USER_CREATED, + var = Cvar_Get (var_name, value, CVAR_USER_CREATED, NULL, "User-created cvar"); } } @@ -341,7 +352,7 @@ Cvar_Setrom_f (void) Cvar_SetFlags (var, var->flags | CVAR_ROM); } } else { - var = Cvar_Get (var_name, value, CVAR_USER_CREATED | CVAR_ROM, + var = Cvar_Get (var_name, value, CVAR_USER_CREATED | CVAR_ROM, NULL, "User-created READ-ONLY Cvar"); } } @@ -454,7 +465,8 @@ Cvar_Init_Hash (void) void Cvar_Init (void) { - developer = Cvar_Get ("developer", "0", 0, "set to enable extra debugging information"); + developer = Cvar_Get ("developer", "0", CVAR_NONE, NULL, + "set to enable extra debugging information"); Cmd_AddCommand ("set", Cvar_Set_f, "Set the selected variable, useful on the command line (+set variablename setting)"); Cmd_AddCommand ("setrom", Cvar_Setrom_f, "Set the selected variable and make it read only, useful on the command line.\n" @@ -491,17 +503,16 @@ Cvar_Shutdown (void) cvar_t * -Cvar_Get (char *name, char *string, int cvarflags, char *description) +Cvar_Get (char *name, char *string, int cvarflags, void (*callback)(cvar_t*), char *description) { - cvar_t *var; if (Cmd_Exists (name)) { Con_Printf ("Cvar_Get: %s is a command\n", name); return NULL; } - var = Cvar_FindVar (name); - if (!var) { + + if (!(var = Cvar_FindVar (name))) { cvar_t **v; var = (cvar_t *) calloc (1, sizeof (cvar_t)); @@ -509,6 +520,7 @@ Cvar_Get (char *name, char *string, int cvarflags, char *description) var->name = strdup (name); var->string = strdup (string); var->flags = cvarflags; + var->callback = callback; var->description = description; var->value = atof (var->string); var->int_val = atoi (var->string); @@ -525,10 +537,14 @@ Cvar_Get (char *name, char *string, int cvarflags, char *description) // Cvar does exist, so we update the flags and return. var->flags &= ~CVAR_USER_CREATED; var->flags |= cvarflags; + var->callback = callback; var->description = description; } Cvar_Info (var); + if (var->callback) + var->callback (var); + return var; } diff --git a/source/d_init.c b/source/d_init.c index c277893..23780c3 100644 --- a/source/d_init.c +++ b/source/d_init.c @@ -69,9 +69,9 @@ D_Init (void) void D_Init_Cvars (void) { - d_subdiv16 = Cvar_Get ("d_subdiv16", "1", CVAR_NONE, "Set to enable extreme perspective correction"); - d_mipcap = Cvar_Get ("d_mipcap", "0", CVAR_NONE, "Detail level. 0 is highest, 3 is lowest."); - d_mipscale = Cvar_Get ("d_mipscale", "1", CVAR_NONE, "Detail level of objects. 0 is highest, 3 is lowest."); + d_subdiv16 = Cvar_Get ("d_subdiv16", "1", CVAR_NONE, NULL, "Set to enable extreme perspective correction"); + d_mipcap = Cvar_Get ("d_mipcap", "0", CVAR_NONE, NULL, "Detail level. 0 is highest, 3 is lowest."); + d_mipscale = Cvar_Get ("d_mipscale", "1", CVAR_NONE, NULL, "Detail level of objects. 0 is highest, 3 is lowest."); } /* diff --git a/source/draw.c b/source/draw.c index 8fee3c1..cbfdefb 100644 --- a/source/draw.c +++ b/source/draw.c @@ -198,7 +198,7 @@ Draw_Init (void) r_rectdesc.rowbytes = draw_backtile->width; cl_verstring = - Cvar_Get ("cl_verstring", PROGRAM " " VERSION, CVAR_NONE, "Client version string"); + Cvar_Get ("cl_verstring", PROGRAM " " VERSION, CVAR_NONE, NULL, "Client version string"); } void diff --git a/source/gl_draw.c b/source/gl_draw.c index 4949a20..eb2e4b2 100644 --- a/source/gl_draw.c +++ b/source/gl_draw.c @@ -393,24 +393,24 @@ Draw_Init (void) void Draw_Init_Cvars (void) { - gl_lightmode = Cvar_Get ("gl_lightmode", "1", CVAR_ARCHIVE, + gl_lightmode = Cvar_Get ("gl_lightmode", "1", CVAR_ARCHIVE, NULL, "Lighting mode (0 = GLQuake style, 1 = new style)"); - gl_max_size = Cvar_Get ("gl_max_size", "1024", CVAR_NONE, "Texture dimension"); + gl_max_size = Cvar_Get ("gl_max_size", "1024", CVAR_NONE, NULL, "Texture dimension"); - gl_picmip = Cvar_Get ("gl_picmip", "0", CVAR_NONE, "Dimensions of displayed textures. 0 is normal, 1 is half, 2 is 1/4"); + gl_picmip = Cvar_Get ("gl_picmip", "0", CVAR_NONE, NULL, "Dimensions of displayed textures. 0 is normal, 1 is half, 2 is 1/4"); - gl_colorlights = Cvar_Get ("gl_colorlights", "1", CVAR_ROM, + gl_colorlights = Cvar_Get ("gl_colorlights", "1", CVAR_ROM, NULL, "Whether to use RGB lightmaps or not"); - gl_constretch = Cvar_Get ("gl_constretch", "0", CVAR_ARCHIVE, + gl_constretch = Cvar_Get ("gl_constretch", "0", CVAR_ARCHIVE, NULL, "whether slide the console or stretch it"); - gl_conalpha = Cvar_Get ("gl_conalpha", "0.6", CVAR_ARCHIVE, + gl_conalpha = Cvar_Get ("gl_conalpha", "0.6", CVAR_ARCHIVE, NULL, "alpha value for the console background"); - gl_conspin = Cvar_Get ("gl_conspin", "0", CVAR_ARCHIVE, + gl_conspin = Cvar_Get ("gl_conspin", "0", CVAR_ARCHIVE, NULL, "speed at which the console spins"); - cl_verstring = Cvar_Get ("cl_verstring", PROGRAM " " VERSION, CVAR_NONE, + cl_verstring = Cvar_Get ("cl_verstring", PROGRAM " " VERSION, CVAR_NONE, NULL, "Client version string"); } diff --git a/source/gl_rmain.c b/source/gl_rmain.c index ff072cd..4a37970 100644 --- a/source/gl_rmain.c +++ b/source/gl_rmain.c @@ -134,7 +134,6 @@ cvar_t *brighten; extern cvar_t *scr_fov; -extern byte gammatable[256]; extern qboolean lighthalf; // LordHavoc: place for gl_rmain setup code @@ -143,50 +142,6 @@ glrmain_init (void) { } -/* - GL_CheckBrightness - - This is something like the brightness cvar, except it hacks the palette - directly instead of brightening the screen afterward. -*/ -void -GL_CheckBrightness (unsigned char *pal) -{ - int i, inf; - float brightness; - - brighten = Cvar_Get ("brighten", "1", CVAR_NONE, - "Palette hack equivalent to brightness"); - - if ((i = COM_CheckParm ("-brighten"))) { - brightness = atof (com_argv[i + 1]); - } else { - brightness = brighten->value; - } - brightness = bound (1, brightness, 5); - - Cvar_SetValue (brighten, brightness); - Cvar_SetFlags (brighten, brighten->flags | CVAR_ROM); - - // Build gamma table - if (brightness == 1.0) { // screw the math - for (i = 0; i < 256; i++) { - gammatable[i] = i; - } - } else { - for (i = 0; i < 256; i++) { // brighten up the palette - inf = (i * brightness); - inf = bound (0, inf, 255); - gammatable[i] = inf; - } - } - - // correct the palette - for (i = 0; i < 768; i++) { - pal[i] = gammatable[pal[i]]; - } -} - /* R_CullBox diff --git a/source/gl_rmisc.c b/source/gl_rmisc.c index 1ae2ee9..45e9f20 100644 --- a/source/gl_rmisc.c +++ b/source/gl_rmisc.c @@ -203,38 +203,38 @@ R_Init (void) void R_Init_Cvars (void) { - r_norefresh = Cvar_Get ("r_norefresh", "0", CVAR_NONE, "Set to 1 to disable display refresh"); - r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, "Toggles drawing of entities (almost everything but the world)"); - r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, "Toggles drawing of view models (your weapons)"); - r_shadows = Cvar_Get ("r_shadows", "0", CVAR_ARCHIVE, "Set to 1 to enable shadows for entities"); - r_wateralpha = Cvar_Get ("r_wateralpha", "1", CVAR_NONE, "Determine opacity of liquids. 1 = solid, 0 = transparent, otherwise translucent."); + r_norefresh = Cvar_Get ("r_norefresh", "0", CVAR_NONE, NULL, "Set to 1 to disable display refresh"); + r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, NULL, "Toggles drawing of entities (almost everything but the world)"); + r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, NULL, "Toggles drawing of view models (your weapons)"); + r_shadows = Cvar_Get ("r_shadows", "0", CVAR_ARCHIVE, NULL, "Set to 1 to enable shadows for entities"); + r_wateralpha = Cvar_Get ("r_wateralpha", "1", CVAR_NONE, NULL, "Determine opacity of liquids. 1 = solid, 0 = transparent, otherwise translucent."); /* FIXME what does r_waterripple use for units? */ - r_waterripple = Cvar_Get ("r_waterripple", "0", CVAR_NONE, "Set to make liquids ripple, a good setting is 5"); - r_dynamic = Cvar_Get ("r_dynamic", "1", CVAR_NONE, "Set to 0 to disable lightmap changes"); - r_novis = Cvar_Get ("r_novis", "0", CVAR_NONE, "Set to 1 to enable runtime visibility checking (SLOW)"); - r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, "Display drawing time and statistics of what is being viewed"); - r_netgraph = Cvar_Get ("r_netgraph", "0", CVAR_ARCHIVE, "Graph network stats"); - r_netgraph_alpha = Cvar_Get ("r_netgraph_alpha", "0.5", CVAR_ARCHIVE, "Net graph translucency"); - r_netgraph_box = Cvar_Get ("r_netgraph_box", "1", CVAR_ARCHIVE, "Draw box around net graph"); - r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, "whether or not to draw particles"); - r_skyname = Cvar_Get ("r_skyname", "none", CVAR_NONE, "name of the current skybox"); + r_waterripple = Cvar_Get ("r_waterripple", "0", CVAR_NONE, NULL, "Set to make liquids ripple, a good setting is 5"); + r_dynamic = Cvar_Get ("r_dynamic", "1", CVAR_NONE, NULL, "Set to 0 to disable lightmap changes"); + r_novis = Cvar_Get ("r_novis", "0", CVAR_NONE, NULL, "Set to 1 to enable runtime visibility checking (SLOW)"); + r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, NULL, "Display drawing time and statistics of what is being viewed"); + r_netgraph = Cvar_Get ("r_netgraph", "0", CVAR_ARCHIVE, NULL, "Graph network stats"); + r_netgraph_alpha = Cvar_Get ("r_netgraph_alpha", "0.5", CVAR_ARCHIVE, NULL, "Net graph translucency"); + r_netgraph_box = Cvar_Get ("r_netgraph_box", "1", CVAR_ARCHIVE, NULL, "Draw box around net graph"); + r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, NULL, "whether or not to draw particles"); + r_skyname = Cvar_Get ("r_skyname", "none", CVAR_NONE, NULL, "name of the current skybox"); - gl_affinemodels = Cvar_Get ("gl_affinemodels", "0", CVAR_ARCHIVE, "Makes texture rendering quality better if set to 1"); - gl_clear = Cvar_Get ("gl_clear", "0", CVAR_NONE, "Set to 1 to make background black. Useful for removing HOM effect"); - gl_dlight_lightmap = Cvar_Get ("gl_dlight_lightmap", "1", CVAR_ARCHIVE, "Set to 1 for high quality dynamic lighting."); - gl_dlight_polyblend = Cvar_Get ("gl_dlight_polyblend", "0", CVAR_ARCHIVE, "Set to 1 to use a dynamic light effect faster on GL"); - gl_dlight_smooth = Cvar_Get ("gl_dlight_smooth", "1", CVAR_ARCHIVE, "Smooth dynamic vertex lighting"); - gl_fb_bmodels = Cvar_Get ("gl_fb_bmodels", "1", CVAR_ARCHIVE, "Toggles fullbright color support for bmodels"); - gl_fb_models = Cvar_Get ("gl_fb_models", "1", CVAR_ARCHIVE, "Toggles fullbright color support for models"); - gl_fires = Cvar_Get ("gl_fires", "0", CVAR_ARCHIVE, "Toggles lavaball and rocket fireballs"); - gl_keeptjunctions = Cvar_Get ("gl_keeptjunctions", "1", CVAR_ARCHIVE, "Set to 0 to turn off colinear vertexes upon level load"); - gl_lerp_anim = Cvar_Get ("gl_lerp_anim", "1", CVAR_ARCHIVE, "Toggles model animation interpolation"); - gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, "Use multitexture when available"); - gl_nocolors = Cvar_Get ("gl_nocolors", "0", CVAR_NONE, "Set to 1, turns off all player colors"); - gl_playermip = Cvar_Get ("gl_playermip", "0", CVAR_NONE, "Detail of player skins. 0 best, 4 worst."); - gl_sky_clip = Cvar_Get ("gl_sky_clip", "0", CVAR_ARCHIVE, "controls whether sky is drawn first (0) or later (1)"); - gl_sky_divide = Cvar_Get ("gl_sky_divide", "1", CVAR_ARCHIVE, "subdivide sky polys"); - gl_skymultipass = Cvar_Get ("gl_skymultipass", "1", CVAR_ARCHIVE, "controls whether the skydome is single or double pass"); + gl_affinemodels = Cvar_Get ("gl_affinemodels", "0", CVAR_ARCHIVE, NULL, "Makes texture rendering quality better if set to 1"); + gl_clear = Cvar_Get ("gl_clear", "0", CVAR_NONE, NULL, "Set to 1 to make background black. Useful for removing HOM effect"); + gl_dlight_lightmap = Cvar_Get ("gl_dlight_lightmap", "1", CVAR_ARCHIVE, NULL, "Set to 1 for high quality dynamic lighting."); + gl_dlight_polyblend = Cvar_Get ("gl_dlight_polyblend", "0", CVAR_ARCHIVE, NULL, "Set to 1 to use a dynamic light effect faster on GL"); + gl_dlight_smooth = Cvar_Get ("gl_dlight_smooth", "1", CVAR_ARCHIVE, NULL, "Smooth dynamic vertex lighting"); + gl_fb_bmodels = Cvar_Get ("gl_fb_bmodels", "1", CVAR_ARCHIVE, NULL, "Toggles fullbright color support for bmodels"); + gl_fb_models = Cvar_Get ("gl_fb_models", "1", CVAR_ARCHIVE, NULL, "Toggles fullbright color support for models"); + gl_fires = Cvar_Get ("gl_fires", "0", CVAR_ARCHIVE, NULL, "Toggles lavaball and rocket fireballs"); + gl_keeptjunctions = Cvar_Get ("gl_keeptjunctions", "1", CVAR_ARCHIVE, NULL, "Set to 0 to turn off colinear vertexes upon level load"); + gl_lerp_anim = Cvar_Get ("gl_lerp_anim", "1", CVAR_ARCHIVE, NULL, "Toggles model animation interpolation"); + gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, NULL, "Use multitexture when available"); + gl_nocolors = Cvar_Get ("gl_nocolors", "0", CVAR_NONE, NULL, "Set to 1, turns off all player colors"); + gl_playermip = Cvar_Get ("gl_playermip", "0", CVAR_NONE, NULL, "Detail of player skins. 0 best, 4 worst."); + gl_sky_clip = Cvar_Get ("gl_sky_clip", "0", CVAR_ARCHIVE, NULL, "controls whether sky is drawn first (0) or later (1)"); + gl_sky_divide = Cvar_Get ("gl_sky_divide", "1", CVAR_ARCHIVE, NULL, "subdivide sky polys"); + gl_skymultipass = Cvar_Get ("gl_skymultipass", "1", CVAR_ARCHIVE, NULL, "controls whether the skydome is single or double pass"); } /* diff --git a/source/gl_screen.c b/source/gl_screen.c index 3655ad0..45a90f6 100644 --- a/source/gl_screen.c +++ b/source/gl_screen.c @@ -384,21 +384,21 @@ SCR_SizeDown_f (void) void SCR_Init_Cvars (void) { - scr_fov = Cvar_Get ("fov", "90", CVAR_NONE, "Your point of view in degrees. Smaller than 90 zooms in."); - scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE, "Set the screen size 30 minimum, 120 maximum"); - scr_conspeed = Cvar_Get ("scr_conspeed", "300", CVAR_NONE, "How quickly console scrolls up or down"); - scr_consize = Cvar_Get ("scr_consize", "0.5", CVAR_ARCHIVE, "fraction of the screen the console covers when down"); - scr_showram = Cvar_Get ("showram", "1", CVAR_NONE, "Show RAM icon if game is running low on memory"); - scr_showturtle = Cvar_Get ("showturtle", "0", CVAR_NONE, "Show a turtle icon if your fps is slower than 10"); - scr_showpause = Cvar_Get ("showpause", "1", CVAR_NONE, "Toggles display of pause graphic"); - scr_centertime = Cvar_Get ("scr_centertime", "2", CVAR_NONE, "How long in seconds screen hints are displayed"); - scr_printspeed = Cvar_Get ("scr_printspeed", "8", CVAR_NONE, "How fast the text is displayed at the end of the single player episodes"); - gl_triplebuffer = Cvar_Get ("gl_triplebuffer", "1", CVAR_ARCHIVE, "Set to 1 by default. Fixes status bar flicker on some hardware"); + scr_fov = Cvar_Get ("fov", "90", CVAR_NONE, NULL, "Your point of view in degrees. Smaller than 90 zooms in."); + scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE, NULL, "Set the screen size 30 minimum, 120 maximum"); + scr_conspeed = Cvar_Get ("scr_conspeed", "300", CVAR_NONE, NULL, "How quickly console scrolls up or down"); + scr_consize = Cvar_Get ("scr_consize", "0.5", CVAR_ARCHIVE, NULL, "fraction of the screen the console covers when down"); + scr_showram = Cvar_Get ("showram", "1", CVAR_NONE, NULL, "Show RAM icon if game is running low on memory"); + scr_showturtle = Cvar_Get ("showturtle", "0", CVAR_NONE, NULL, "Show a turtle icon if your fps is slower than 10"); + scr_showpause = Cvar_Get ("showpause", "1", CVAR_NONE, NULL, "Toggles display of pause graphic"); + scr_centertime = Cvar_Get ("scr_centertime", "2", CVAR_NONE, NULL, "How long in seconds screen hints are displayed"); + scr_printspeed = Cvar_Get ("scr_printspeed", "8", CVAR_NONE, NULL, "How fast the text is displayed at the end of the single player episodes"); + gl_triplebuffer = Cvar_Get ("gl_triplebuffer", "1", CVAR_ARCHIVE, NULL, "Set to 1 by default. Fixes status bar flicker on some hardware"); - crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE, "Color of the new crosshair"); - crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE, "Crosshair type. 0 off, 1 old without color, 2 new with colors"); - cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, "Sets the position of the crosshair on the X-axis."); - cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, "Sets the position of the crosshair on the Y-axis."); + crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE, NULL, "Color of the new crosshair"); + crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE, NULL, "Crosshair type. 0 off, 1 old without color, 2 new with colors"); + cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, NULL, "Sets the position of the crosshair on the X-axis."); + cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, NULL, "Sets the position of the crosshair on the Y-axis."); } void diff --git a/source/gl_view.c b/source/gl_view.c index 74522b0..c045a95 100644 --- a/source/gl_view.c +++ b/source/gl_view.c @@ -46,7 +46,6 @@ extern byte *host_basepal; extern double host_frametime; extern int onground; -extern byte gammatable[256]; extern cvar_t *cl_cshift_powerup; extern cvar_t *contrast; diff --git a/source/in_ggi.c b/source/in_ggi.c index e6f04a5..a9face7 100644 --- a/source/in_ggi.c +++ b/source/in_ggi.c @@ -413,8 +413,8 @@ IN_Init_Cvars (void) { JOY_Init_Cvars (); - _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "Have Quake grab the mouse from X when you play"); - m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, "Mouse input filtering"); + _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL, "Have Quake grab the mouse from X when you play"); + m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL, "Mouse input filtering"); } diff --git a/source/in_sdl.c b/source/in_sdl.c index 66f14a3..4395be9 100644 --- a/source/in_sdl.c +++ b/source/in_sdl.c @@ -362,8 +362,8 @@ IN_Init_Cvars (void) { JOY_Init_Cvars (); - _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "If set to 1, quake will grab the mouse in X"); - // m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, "Toggle mouse input filtering"); + _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL, "If set to 1, quake will grab the mouse in X"); + // m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL, "Toggle mouse input filtering"); } void diff --git a/source/in_win.c b/source/in_win.c index c27e28b..55f2349 100644 --- a/source/in_win.c +++ b/source/in_win.c @@ -424,7 +424,7 @@ void IN_Init_Cvars (void) { // mouse variables - m_filter = Cvar_Get ("m_filter", "0", CVAR_NONE, "Toggle mouse input filtering."); + m_filter = Cvar_Get ("m_filter", "0", CVAR_NONE, NULL, "Toggle mouse input filtering."); JOY_Init_Cvars(); } diff --git a/source/in_x11.c b/source/in_x11.c index d5429d7..921d9c5 100644 --- a/source/in_x11.c +++ b/source/in_x11.c @@ -549,9 +549,9 @@ void IN_Init_Cvars (void) { JOY_Init_Cvars (); - _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "With this set to 1, quake will grab the mouse from X"); - m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, "Toggle mouse input filtering."); - in_dga = Cvar_Get ("in_dga", "1", CVAR_ARCHIVE, "DGA Input support"); - in_dga_mouseaccel = Cvar_Get ("in_dga_mouseaccel", "1", CVAR_ARCHIVE, + _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL, "With this set to 1, quake will grab the mouse from X"); + m_filter = Cvar_Get ("m_filter", "0", CVAR_ARCHIVE, NULL, "Toggle mouse input filtering."); + in_dga = Cvar_Get ("in_dga", "1", CVAR_ARCHIVE, NULL, "DGA Input support"); + in_dga_mouseaccel = Cvar_Get ("in_dga_mouseaccel", "1", CVAR_ARCHIVE, NULL, "DGA Mouse accelleration multiplier"); } diff --git a/source/joy_linux.c b/source/joy_linux.c index 300c528..d6b5b9d 100644 --- a/source/joy_linux.c +++ b/source/joy_linux.c @@ -198,19 +198,19 @@ JOY_Init_Cvars (void) int i; joy_device = - Cvar_Get ("joy_device", "/dev/js0", CVAR_NONE | CVAR_ROM, + Cvar_Get ("joy_device", "/dev/js0", CVAR_NONE | CVAR_ROM, NULL, "Joystick device"); joy_enable = - Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, + Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, NULL, "Joystick enable flag"); joy_sensitivity = - Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, + Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, NULL, "Joystick sensitivity"); for (i = 0; i < JOY_MAX_AXES; i++) { joy_axes[i].axis = Cvar_Get (joy_axes[i].var.name, joy_axes[i].var.string, - CVAR_ARCHIVE, "Set joystick axes"); + CVAR_ARCHIVE, NULL, "Set joystick axes"); } } diff --git a/source/joy_null.c b/source/joy_null.c index 94efbcf..eaa30b5 100644 --- a/source/joy_null.c +++ b/source/joy_null.c @@ -63,13 +63,13 @@ void JOY_Init_Cvars (void) { joy_device = - Cvar_Get ("joy_device", "none", CVAR_NONE | CVAR_ROM, + Cvar_Get ("joy_device", "none", CVAR_NONE | CVAR_ROM, NULL, "Joystick device"); joy_enable = - Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, + Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, NULL, "Joystick enable flag"); joy_sensitivity = - Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, + Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, NULL, "Joystick sensitivity"); } diff --git a/source/joy_win.c b/source/joy_win.c index 454c009..d350ae3 100644 --- a/source/joy_win.c +++ b/source/joy_win.c @@ -554,54 +554,54 @@ void JOY_Init_Cvars(void) { joy_device = - Cvar_Get ("joy_device", "none", CVAR_NONE | CVAR_ROM, + Cvar_Get ("joy_device", "none", CVAR_NONE | CVAR_ROM, NULL, "Joystick device"); joy_enable = - Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, + Cvar_Get ("joy_enable", "1", CVAR_NONE | CVAR_ARCHIVE, NULL, "Joystick enable flag"); joy_sensitivity = - Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, + Cvar_Get ("joy_sensitivity", "1", CVAR_NONE | CVAR_ARCHIVE, NULL, "Joystick sensitivity"); // joystick variables in_joystick = - Cvar_Get ("joystick", "0", CVAR_ARCHIVE, "FIXME: No Description"); + Cvar_Get ("joystick", "0", CVAR_ARCHIVE, NULL, "FIXME: No Description"); joy_name = - Cvar_Get ("joyname", "joystick", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joyname", "joystick", CVAR_NONE, NULL, "FIXME: No Description"); joy_advanced = - Cvar_Get ("joyadvanced", "0", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joyadvanced", "0", CVAR_NONE, NULL, "FIXME: No Description"); joy_advaxisx = - Cvar_Get ("joyadvaxisx", "0", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joyadvaxisx", "0", CVAR_NONE, NULL, "FIXME: No Description"); joy_advaxisy = - Cvar_Get ("joyadvaxisy", "0", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joyadvaxisy", "0", CVAR_NONE, NULL, "FIXME: No Description"); joy_advaxisz = - Cvar_Get ("joyadvaxisz", "0", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joyadvaxisz", "0", CVAR_NONE, NULL, "FIXME: No Description"); joy_advaxisr = - Cvar_Get ("joyadvaxisr", "0", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joyadvaxisr", "0", CVAR_NONE, NULL, "FIXME: No Description"); joy_advaxisu = - Cvar_Get ("joyadvaxisu", "0", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joyadvaxisu", "0", CVAR_NONE, NULL, "FIXME: No Description"); joy_advaxisv = - Cvar_Get ("joyadvaxisv", "0", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joyadvaxisv", "0", CVAR_NONE, NULL, "FIXME: No Description"); joy_forwardthreshold = - Cvar_Get ("joyforwardthreshold", "0.15", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joyforwardthreshold", "0.15", CVAR_NONE, NULL, "FIXME: No Description"); joy_sidethreshold = - Cvar_Get ("joysidethreshold", "0.15", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joysidethreshold", "0.15", CVAR_NONE, NULL, "FIXME: No Description"); joy_pitchthreshold = - Cvar_Get ("joypitchthreshold", "0.15", CVAR_NONE, "FIXME: No Description"); - joy_yawthreshold = Cvar_Get ("joyyawthreshold", "0.15", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joypitchthreshold", "0.15", CVAR_NONE, NULL, "FIXME: No Description"); + joy_yawthreshold = Cvar_Get ("joyyawthreshold", "0.15", CVAR_NONE, NULL, "FIXME: No Description"); joy_forwardsensitivity = - Cvar_Get ("joyforwardsensitivity", "-1.0", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joyforwardsensitivity", "-1.0", CVAR_NONE, NULL, "FIXME: No Description"); joy_sidesensitivity = - Cvar_Get ("joysidesensitivity", "-1.0", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joysidesensitivity", "-1.0", CVAR_NONE, NULL, "FIXME: No Description"); joy_pitchsensitivity = - Cvar_Get ("joypitchsensitivity", "1.0", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joypitchsensitivity", "1.0", CVAR_NONE, NULL, "FIXME: No Description"); joy_yawsensitivity = - Cvar_Get ("joyyawsensitivity", "-1.0", CVAR_NONE, "FIXME: No Description"); - joy_wwhack1 = Cvar_Get ("joywwhack1", "0.0", CVAR_NONE, "FIXME: No Description"); - joy_wwhack2 = Cvar_Get ("joywwhack2", "0.0", CVAR_NONE, "FIXME: No Description"); + Cvar_Get ("joyyawsensitivity", "-1.0", CVAR_NONE, NULL, "FIXME: No Description"); + joy_wwhack1 = Cvar_Get ("joywwhack1", "0.0", CVAR_NONE, NULL, "FIXME: No Description"); + joy_wwhack2 = Cvar_Get ("joywwhack2", "0.0", CVAR_NONE, NULL, "FIXME: No Description"); - joy_debug = Cvar_Get ("joy_debug", "0.0", CVAR_NONE, "FIXME: No Description"); + joy_debug = Cvar_Get ("joy_debug", "0.0", CVAR_NONE, NULL, "FIXME: No Description"); return; } diff --git a/source/keys.c b/source/keys.c index 314746b..a4e6627 100644 --- a/source/keys.c +++ b/source/keys.c @@ -747,7 +747,7 @@ Key_Init (void) void Key_Init_Cvars (void) { - cl_chatmode = Cvar_Get ("cl_chatmode", "2", 0, + cl_chatmode = Cvar_Get ("cl_chatmode", "2", CVAR_NONE, NULL, "Controls when console text will be treated as a chat message: 0 - never, 1 - always, 2 - smart"); } diff --git a/source/model.c b/source/model.c index 2a7abe3..4b6aa54 100644 --- a/source/model.c +++ b/source/model.c @@ -75,7 +75,7 @@ void Mod_Init_Cvars (void) { gl_subdivide_size = - Cvar_Get ("gl_subdivide_size", "128", CVAR_ARCHIVE, "Sets the division value for the sky brushes."); + Cvar_Get ("gl_subdivide_size", "128", CVAR_ARCHIVE, NULL, "Sets the division value for the sky brushes."); } /* diff --git a/source/net_chan.c b/source/net_chan.c index dc6230f..246a2c8 100644 --- a/source/net_chan.c +++ b/source/net_chan.c @@ -129,9 +129,9 @@ Netchan_Init (void) void Netchan_Init_Cvars (void) { - showpackets = Cvar_Get ("showpackets", "0", CVAR_NONE, "Show all network packets"); - showdrop = Cvar_Get ("showdrop", "0", CVAR_NONE, "Toggle the display of how many packets you are dropping"); - qport = Cvar_Get ("qport", "0", CVAR_NONE, "The internal port number for the game networking code." + showpackets = Cvar_Get ("showpackets", "0", CVAR_NONE, NULL, "Show all network packets"); + showdrop = Cvar_Get ("showdrop", "0", CVAR_NONE, NULL, "Toggle the display of how many packets you are dropping"); + qport = Cvar_Get ("qport", "0", CVAR_NONE, NULL, "The internal port number for the game networking code." "Useful for clients who use multiple connections through one IP address (NAT/IP-MASQ) because default port is random."); } diff --git a/source/net_packetlog.c b/source/net_packetlog.c index bcbb1ec..d91e9b4 100644 --- a/source/net_packetlog.c +++ b/source/net_packetlog.c @@ -961,7 +961,7 @@ int Net_Log_Init (void) { netlogger = - Cvar_Get ("net_logger", "1", CVAR_NONE, "Packet logging/parsing"); + Cvar_Get ("net_logger", "1", CVAR_NONE, NULL, "Packet logging/parsing"); // 0 = no logging // 1 = hex dump only @@ -970,7 +970,7 @@ Net_Log_Init (void) // 4 = parse/hexdump, skip movement/empty messages netloglevel = - Cvar_Get ("net_loglevel", "2", CVAR_NONE, "Packet logging/parsing"); + Cvar_Get ("net_loglevel", "2", CVAR_NONE, NULL, "Packet logging/parsing"); Net_LogStart ("qfpacket.log"); return 0; diff --git a/source/pmove.c b/source/pmove.c index c7ed3fa..d19c72f 100644 --- a/source/pmove.c +++ b/source/pmove.c @@ -66,7 +66,7 @@ Pmove_Init (void) void Pmove_Init_Cvars (void) { - no_pogo_stick = Cvar_Get ("no_pogo_stick", "0", CVAR_SERVERINFO, + no_pogo_stick = Cvar_Get ("no_pogo_stick", "0", CVAR_SERVERINFO, NULL, "disable the ability to pogo stick"); } diff --git a/source/pr_edict.c b/source/pr_edict.c index adb5b16..3ff33dd 100644 --- a/source/pr_edict.c +++ b/source/pr_edict.c @@ -1114,7 +1114,7 @@ void PR_Init_Cvars (void) { pr_boundscheck = - Cvar_Get ("pr_boundscheck", "1", CVAR_NONE, + Cvar_Get ("pr_boundscheck", "1", CVAR_NONE, NULL, "Server progs bounds checking"); } diff --git a/source/quakefs.c b/source/quakefs.c index 6bcfd08..7b3f6c6 100644 --- a/source/quakefs.c +++ b/source/quakefs.c @@ -1078,17 +1078,17 @@ COM_Filesystem_Init (void) void COM_Filesystem_Init_Cvars (void) { - fs_sharepath = Cvar_Get ("fs_sharepath", FS_SHAREPATH, CVAR_ROM, + fs_sharepath = Cvar_Get ("fs_sharepath", FS_SHAREPATH, CVAR_ROM, NULL, "location of shared (read only) game directories"); - fs_userpath = Cvar_Get ("fs_userpath", FS_USERPATH, CVAR_ROM, + fs_userpath = Cvar_Get ("fs_userpath", FS_USERPATH, CVAR_ROM, NULL, "location of your game directories"); - fs_basegame = Cvar_Get ("fs_basegame", BASEGAME, CVAR_ROM, + fs_basegame = Cvar_Get ("fs_basegame", BASEGAME, CVAR_ROM, NULL, "game to use by default"); #ifdef NEWSTYLE - fs_skinbase= Cvar_Get ("fs_skinbase", fs_basegame->string, CVAR_ROM, + fs_skinbase= Cvar_Get ("fs_skinbase", fs_basegame->string, CVAR_ROM, NULL, "location of skins dir for downloads"); #else - fs_skinbase= Cvar_Get ("fs_skinbase", SKINBASE, CVAR_ROM, + fs_skinbase= Cvar_Get ("fs_skinbase", SKINBASE, CVAR_ROM, NULL, "location of skins dir for downloads"); #endif } diff --git a/source/r_main.c b/source/r_main.c index b04450a..5a6a2b4 100644 --- a/source/r_main.c +++ b/source/r_main.c @@ -267,31 +267,31 @@ R_Init_Cvars (void) { D_Init_Cvars (); - r_draworder = Cvar_Get ("r_draworder", "0", CVAR_NONE, "Toggles drawing order"); - r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, "Toggles the displaying of drawing time and" + r_draworder = Cvar_Get ("r_draworder", "0", CVAR_NONE, NULL, "Toggles drawing order"); + r_speeds = Cvar_Get ("r_speeds", "0", CVAR_NONE, NULL, "Toggles the displaying of drawing time and" "statistics of what is currently being viewed"); - r_timegraph = Cvar_Get ("r_timegraph", "0", CVAR_NONE, "Toggle the display of a performance graph"); - r_netgraph = Cvar_Get ("r_netgraph", "0", CVAR_NONE, "Toggle the display of a graph showing network performance"); - r_zgraph = Cvar_Get ("r_zgraph", "0", CVAR_NONE, "Toggle the graph that reports the changes of z-axis position"); - r_graphheight = Cvar_Get ("r_graphheight", "15", CVAR_NONE, "Set the number of lines displayed in the various graphs"); - r_drawflat = Cvar_Get ("r_drawflat", "0", CVAR_NONE, "Toggles the drawing of textures"); - r_ambient = Cvar_Get ("r_ambient", "0", CVAR_NONE, "Determines the ambient lighting for a level"); - r_clearcolor = Cvar_Get ("r_clearcolor", "2", CVAR_NONE, "This sets the color for areas outside of the current map"); - r_waterwarp = Cvar_Get ("r_waterwarp", "1", CVAR_NONE, "Toggles whether surfaces are warped in a liquid."); - r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, "Toggles the drawing of entities."); - r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, "Toggles the drawing of your weapon"); - r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, "Toggles drawing of particles."); - r_aliasstats = Cvar_Get ("r_polymodelstats", "0", CVAR_NONE, "Toggles the displays of number of polygon models current being viewed"); - r_dspeeds = Cvar_Get ("r_dspeeds", "0", CVAR_NONE, "Toggles the display of drawing speed information"); - r_reportsurfout = Cvar_Get ("r_reportsurfout", "0", CVAR_NONE, "Toggle the display of how many surfaces where not displayed"); - r_maxsurfs = Cvar_Get ("r_maxsurfs", "0", CVAR_NONE, "Sets the maximum number of surfaces"); - r_numsurfs = Cvar_Get ("r_numsurfs", "0", CVAR_NONE, "Toggles the displaying of number of surfaces currently being viewed"); - r_reportedgeout = Cvar_Get ("r_reportedgeout", "0", CVAR_NONE, "Toggle the display of how many edges where not displayed"); - r_maxedges = Cvar_Get ("r_maxedges", "0", CVAR_NONE, "Sets the maximum number of surfaces"); - r_numedges = Cvar_Get ("r_numedges", "0", CVAR_NONE, "Toggles the displaying of number of edges currently being viewed"); - r_aliastransbase = Cvar_Get ("r_aliastransbase", "200", CVAR_NONE, "Determines how much of an alias model is clipped away and how much is viewable"); - r_aliastransadj = Cvar_Get ("r_aliastransadj", "100", CVAR_NONE, "Determines how much of an alias model is clipped away and how much is viewable."); - gl_sky_divide = Cvar_Get ("gl_sky_divide", "1", CVAR_ARCHIVE, + r_timegraph = Cvar_Get ("r_timegraph", "0", CVAR_NONE, NULL, "Toggle the display of a performance graph"); + r_netgraph = Cvar_Get ("r_netgraph", "0", CVAR_NONE, NULL, "Toggle the display of a graph showing network performance"); + r_zgraph = Cvar_Get ("r_zgraph", "0", CVAR_NONE, NULL, "Toggle the graph that reports the changes of z-axis position"); + r_graphheight = Cvar_Get ("r_graphheight", "15", CVAR_NONE, NULL, "Set the number of lines displayed in the various graphs"); + r_drawflat = Cvar_Get ("r_drawflat", "0", CVAR_NONE, NULL, "Toggles the drawing of textures"); + r_ambient = Cvar_Get ("r_ambient", "0", CVAR_NONE, NULL, "Determines the ambient lighting for a level"); + r_clearcolor = Cvar_Get ("r_clearcolor", "2", CVAR_NONE, NULL, "This sets the color for areas outside of the current map"); + r_waterwarp = Cvar_Get ("r_waterwarp", "1", CVAR_NONE, NULL, "Toggles whether surfaces are warped in a liquid."); + r_drawentities = Cvar_Get ("r_drawentities", "1", CVAR_NONE, NULL, "Toggles the drawing of entities."); + r_drawviewmodel = Cvar_Get ("r_drawviewmodel", "1", CVAR_ARCHIVE, NULL, "Toggles the drawing of your weapon"); + r_particles = Cvar_Get ("r_particles", "1", CVAR_ARCHIVE, NULL, "Toggles drawing of particles."); + r_aliasstats = Cvar_Get ("r_polymodelstats", "0", CVAR_NONE, NULL, "Toggles the displays of number of polygon models current being viewed"); + r_dspeeds = Cvar_Get ("r_dspeeds", "0", CVAR_NONE, NULL, "Toggles the display of drawing speed information"); + r_reportsurfout = Cvar_Get ("r_reportsurfout", "0", CVAR_NONE, NULL, "Toggle the display of how many surfaces where not displayed"); + r_maxsurfs = Cvar_Get ("r_maxsurfs", "0", CVAR_NONE, NULL, "Sets the maximum number of surfaces"); + r_numsurfs = Cvar_Get ("r_numsurfs", "0", CVAR_NONE, NULL, "Toggles the displaying of number of surfaces currently being viewed"); + r_reportedgeout = Cvar_Get ("r_reportedgeout", "0", CVAR_NONE, NULL, "Toggle the display of how many edges where not displayed"); + r_maxedges = Cvar_Get ("r_maxedges", "0", CVAR_NONE, NULL, "Sets the maximum number of surfaces"); + r_numedges = Cvar_Get ("r_numedges", "0", CVAR_NONE, NULL, "Toggles the displaying of number of edges currently being viewed"); + r_aliastransbase = Cvar_Get ("r_aliastransbase", "200", CVAR_NONE, NULL, "Determines how much of an alias model is clipped away and how much is viewable"); + r_aliastransadj = Cvar_Get ("r_aliastransadj", "100", CVAR_NONE, NULL, "Determines how much of an alias model is clipped away and how much is viewable."); + gl_sky_divide = Cvar_Get ("gl_sky_divide", "1", CVAR_ARCHIVE, NULL, "subdivide sky polys"); } diff --git a/source/r_view.c b/source/r_view.c index fe25d72..7dcd381 100644 --- a/source/r_view.c +++ b/source/r_view.c @@ -80,6 +80,8 @@ extern int in_forward, in_forward2, in_back; frame_t *view_frame; player_state_t *view_message; +void BuildGammaTable (float, float); + /* V_CalcRoll */ @@ -258,10 +260,8 @@ cshift_t cshift_water = { {130, 80, 50}, 128 }; cshift_t cshift_slime = { {0, 25, 5}, 150 }; cshift_t cshift_lava = { {255, 80, 0}, 150 }; -cvar_t *brightness; -cvar_t *contrast; - -byte gammatable[256]; // palette is sent through this +extern byte gammatable[256]; // palette is sent through this +extern cvar_t *vid_gamma; /* V_CheckGamma @@ -271,10 +271,13 @@ V_CheckGamma (void) { static float oldgamma; - if (oldgamma == vid_gamma->value) - return false; - oldgamma = vid_gamma->value; - VID_UpdateGamma (vid_gamma); + if (vid_gamma) { // might get called before vid_gamma gets set + if (oldgamma == vid_gamma->value) + return false; + + oldgamma = vid_gamma->value; + } + vid.recalc_refdef = 1; // force a surface cache flush return true; @@ -735,26 +738,43 @@ V_Init (void) void V_Init_Cvars (void) { - v_centermove = Cvar_Get ("v_centermove", "0.15", CVAR_NONE, "How far the player must move forward before the view re-centers"); - v_centerspeed = Cvar_Get ("v_centerspeed", "500", CVAR_NONE, "How quickly you return to a center view after a lookup or lookdown"); + v_centermove = Cvar_Get ("v_centermove", "0.15", CVAR_NONE, NULL, + "How far the player must move forward before the view re-centers"); + v_centerspeed = Cvar_Get ("v_centerspeed", "500", CVAR_NONE, NULL, + "How quickly you return to a center view after a lookup or lookdown"); - v_iyaw_cycle = Cvar_Get ("v_iyaw_cycle", "2", CVAR_NONE, "How far you tilt right and left when v_idlescale is enabled"); - v_iroll_cycle = Cvar_Get ("v_iroll_cycle", "0.5", CVAR_NONE, "How quickly you tilt right and left when v_idlescale is enabled"); - v_ipitch_cycle = Cvar_Get ("v_ipitch_cycle", "1", CVAR_NONE, "How quickly you lean forwards and backwards when v_idlescale is enabled"); - v_iyaw_level = Cvar_Get ("v_iyaw_level", "0.3", CVAR_NONE, "How far you tilt right and left when v_idlescale is enabled"); - v_iroll_level = Cvar_Get ("v_iroll_level", "0.1", CVAR_NONE, "How far you tilt right and left when v_idlescale is enabled"); - v_ipitch_level = Cvar_Get ("v_ipitch_level", "0.3", CVAR_NONE, "How far you lean forwards and backwards when v_idlescale is enabled"); + v_iyaw_cycle = Cvar_Get ("v_iyaw_cycle", "2", CVAR_NONE, NULL, + "How far you tilt right and left when v_idlescale is enabled"); + v_iroll_cycle = Cvar_Get ("v_iroll_cycle", "0.5", CVAR_NONE, NULL, + "How quickly you tilt right and left when v_idlescale is enabled"); + v_ipitch_cycle = Cvar_Get ("v_ipitch_cycle", "1", CVAR_NONE, NULL, + "How quickly you lean forwards and backwards when v_idlescale is enabled"); + v_iyaw_level = Cvar_Get ("v_iyaw_level", "0.3", CVAR_NONE, NULL, + "How far you tilt right and left when v_idlescale is enabled"); + v_iroll_level = Cvar_Get ("v_iroll_level", "0.1", CVAR_NONE, NULL, + "How far you tilt right and left when v_idlescale is enabled"); + v_ipitch_level = Cvar_Get ("v_ipitch_level", "0.3", CVAR_NONE, NULL, + "How far you lean forwards and backwards when v_idlescale is enabled"); - v_idlescale = Cvar_Get ("v_idlescale", "0", CVAR_NONE, "Toggles whether the view remains idle"); + v_idlescale = Cvar_Get ("v_idlescale", "0", CVAR_NONE, NULL, + "Toggles whether the view remains idle"); - cl_rollspeed = Cvar_Get ("cl_rollspeed", "200", CVAR_NONE, "How quickly you straighten out after strafing"); - cl_rollangle = Cvar_Get ("cl_rollangle", "2.0", CVAR_NONE, "How much your screen tilts when strafing"); + cl_rollspeed = Cvar_Get ("cl_rollspeed", "200", CVAR_NONE, NULL, + "How quickly you straighten out after strafing"); + cl_rollangle = Cvar_Get ("cl_rollangle", "2.0", CVAR_NONE, NULL, + "How much your screen tilts when strafing"); - cl_bob = Cvar_Get ("cl_bob", "0.02", CVAR_NONE, "How much your weapon moves up and down when walking"); - cl_bobcycle = Cvar_Get ("cl_bobcycle", "0.6", CVAR_NONE, "How quickly your weapon moves up and down when walking"); - cl_bobup = Cvar_Get ("cl_bobup", "0.5", CVAR_NONE, "How long your weapon stays up before cycling when walking"); + cl_bob = Cvar_Get ("cl_bob", "0.02", CVAR_NONE, NULL, + "How much your weapon moves up and down when walking"); + cl_bobcycle = Cvar_Get ("cl_bobcycle", "0.6", CVAR_NONE, NULL, + "How quickly your weapon moves up and down when walking"); + cl_bobup = Cvar_Get ("cl_bobup", "0.5", CVAR_NONE, NULL, + "How long your weapon stays up before cycling when walking"); - v_kicktime = Cvar_Get ("v_kicktime", "0.5", CVAR_NONE, "How long the kick from an attack lasts"); - v_kickroll = Cvar_Get ("v_kickroll", "0.6", CVAR_NONE, "How much you lean when hit"); - v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, "How much you look up when hit"); + v_kicktime = Cvar_Get ("v_kicktime", "0.5", CVAR_NONE, NULL, + "How long the kick from an attack lasts"); + v_kickroll = Cvar_Get ("v_kickroll", "0.6", CVAR_NONE, NULL, + "How much you lean when hit"); + v_kickpitch = Cvar_Get ("v_kickpitch", "0.6", CVAR_NONE, NULL, + "How much you look up when hit"); } diff --git a/source/screen.c b/source/screen.c index f33bbc8..f4acafc 100644 --- a/source/screen.c +++ b/source/screen.c @@ -402,20 +402,20 @@ SCR_SizeDown_f (void) void SCR_Init_Cvars (void) { - scr_fov = Cvar_Get ("fov", "90", CVAR_NONE, "field of view. 90 is normal, smaller numbers zoom"); - scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE, "Set the screen size 30 minimum, 120 maximum"); - scr_consize = Cvar_Get ("scr_consize", "0.5", CVAR_ARCHIVE, "fraction of the screen the console covers when down"); - scr_conspeed = Cvar_Get ("scr_conspeed", "300", CVAR_NONE, "How quickly in the console screen scrolls up and down"); - scr_showram = Cvar_Get ("showram", "1", CVAR_NONE, "Show ram icon when low on ram in game"); - scr_showturtle = Cvar_Get ("showturtle", "0", CVAR_NONE, "Show turtle icon when fps is lower than 10"); - scr_showpause = Cvar_Get ("showpause", "1", CVAR_NONE, "Show paused graphic when paused"); - scr_centertime = Cvar_Get ("scr_centertime", "2", CVAR_NONE, "How long in seconds the screen hints are displayed on the screen"); - scr_printspeed = Cvar_Get ("scr_printspeed", "8", CVAR_NONE, "How fast the text is displayed at the end of the single player episodes"); + scr_fov = Cvar_Get ("fov", "90", CVAR_NONE, NULL, "field of view. 90 is normal, smaller numbers zoom"); + scr_viewsize = Cvar_Get ("viewsize", "100", CVAR_ARCHIVE, NULL, "Set the screen size 30 minimum, 120 maximum"); + scr_consize = Cvar_Get ("scr_consize", "0.5", CVAR_ARCHIVE, NULL, "fraction of the screen the console covers when down"); + scr_conspeed = Cvar_Get ("scr_conspeed", "300", CVAR_NONE, NULL, "How quickly in the console screen scrolls up and down"); + scr_showram = Cvar_Get ("showram", "1", CVAR_NONE, NULL, "Show ram icon when low on ram in game"); + scr_showturtle = Cvar_Get ("showturtle", "0", CVAR_NONE, NULL, "Show turtle icon when fps is lower than 10"); + scr_showpause = Cvar_Get ("showpause", "1", CVAR_NONE, NULL, "Show paused graphic when paused"); + scr_centertime = Cvar_Get ("scr_centertime", "2", CVAR_NONE, NULL, "How long in seconds the screen hints are displayed on the screen"); + scr_printspeed = Cvar_Get ("scr_printspeed", "8", CVAR_NONE, NULL, "How fast the text is displayed at the end of the single player episodes"); - crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE, "Crosshair 2's color"); - crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE, "Crosshair type. 0 off, 1 old, 2 new with color"); - cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, "Sets the position of the crosshair on the X-axis"); - cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, "Sets the position of the crosshair on the Y-axis"); + crosshaircolor = Cvar_Get ("crosshaircolor", "79", CVAR_ARCHIVE, NULL, "Crosshair 2's color"); + crosshair = Cvar_Get ("crosshair", "0", CVAR_ARCHIVE, NULL, "Crosshair type. 0 off, 1 old, 2 new with color"); + cl_crossx = Cvar_Get ("cl_crossx", "0", CVAR_ARCHIVE, NULL, "Sets the position of the crosshair on the X-axis"); + cl_crossy = Cvar_Get ("cl_crossy", "0", CVAR_ARCHIVE, NULL, "Sets the position of the crosshair on the Y-axis"); } void diff --git a/source/skin.c b/source/skin.c index b79726a..e7c897b 100644 --- a/source/skin.c +++ b/source/skin.c @@ -311,14 +311,14 @@ Skin_Init (void) void Skin_Init_Cvars (void) { - baseskin = Cvar_Get ("baseskin", "base", CVAR_NONE, + baseskin = Cvar_Get ("baseskin", "base", CVAR_NONE, NULL, "default base skin name"); - noskins = Cvar_Get ("noskins", "0", CVAR_NONE, + noskins = Cvar_Get ("noskins", "0", CVAR_NONE, NULL, "set to 1 to not download new skins"); - skin = Cvar_Get ("skin", "", CVAR_ARCHIVE | CVAR_USERINFO, "Players skin"); - topcolor = Cvar_Get ("topcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO, + skin = Cvar_Get ("skin", "", CVAR_ARCHIVE | CVAR_USERINFO, NULL, "Players skin"); + topcolor = Cvar_Get ("topcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO, NULL, "Players color on top"); - bottomcolor = Cvar_Get ("bottomcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO, + bottomcolor = Cvar_Get ("bottomcolor", "0", CVAR_ARCHIVE | CVAR_USERINFO, NULL, "Players color on bottom"); } diff --git a/source/snd_dma.c b/source/snd_dma.c index ba4464a..82678bc 100644 --- a/source/snd_dma.c +++ b/source/snd_dma.c @@ -261,22 +261,22 @@ S_Init (void) void S_Init_Cvars (void) { - nosound = Cvar_Get ("nosound", "0", CVAR_NONE, "Set to turn sound off"); - volume = Cvar_Get ("volume", "0.7", CVAR_ARCHIVE, "Set the volume for sound playback"); - precache = Cvar_Get ("precache", "1", CVAR_NONE, "Toggle the use of a precache"); - loadas8bit = Cvar_Get ("loadas8bit", "0", CVAR_NONE, "Toggles if sounds are loaded as 8-bit samples"); - bgmvolume = Cvar_Get ("bgmvolume", "1", CVAR_ARCHIVE, "Volume of CD music"); - ambient_level = Cvar_Get ("ambient_level", "0.3", CVAR_NONE, "Ambient sounds' volume"); - ambient_fade = Cvar_Get ("ambient_fade", "100", CVAR_NONE, "How quickly ambient sounds fade in or out"); - snd_noextraupdate = Cvar_Get ("snd_noextraupdate", "0", CVAR_NONE, + nosound = Cvar_Get ("nosound", "0", CVAR_NONE, NULL, "Set to turn sound off"); + volume = Cvar_Get ("volume", "0.7", CVAR_ARCHIVE, NULL, "Set the volume for sound playback"); + precache = Cvar_Get ("precache", "1", CVAR_NONE, NULL, "Toggle the use of a precache"); + loadas8bit = Cvar_Get ("loadas8bit", "0", CVAR_NONE, NULL, "Toggles if sounds are loaded as 8-bit samples"); + bgmvolume = Cvar_Get ("bgmvolume", "1", CVAR_ARCHIVE, NULL, "Volume of CD music"); + ambient_level = Cvar_Get ("ambient_level", "0.3", CVAR_NONE, NULL, "Ambient sounds' volume"); + ambient_fade = Cvar_Get ("ambient_fade", "100", CVAR_NONE, NULL, "How quickly ambient sounds fade in or out"); + snd_noextraupdate = Cvar_Get ("snd_noextraupdate", "0", CVAR_NONE, NULL, "Toggles the correct value display in host_speeds. Usually messes up sound playback when in effect"); - snd_show = Cvar_Get ("snd_show", "0", CVAR_NONE, "Toggles the display of sounds currently being played"); + snd_show = Cvar_Get ("snd_show", "0", CVAR_NONE, NULL, "Toggles the display of sounds currently being played"); snd_interp = - Cvar_Get ("snd_interp", "1", CVAR_ARCHIVE, + Cvar_Get ("snd_interp", "1", CVAR_ARCHIVE, NULL, "control sample interpolation"); - snd_phasesep = Cvar_Get ("snd_phasesep", "0.0", CVAR_ARCHIVE, "max stereo phase separation in ms. 0.6 is for 20cm head"); - snd_volumesep = Cvar_Get("snd_volumesep", "1.0", CVAR_ARCHIVE, "max stereo volume separation in ms. 1.0 is max"); - _snd_mixahead = Cvar_Get ("_snd_mixahead", "0.1", CVAR_ARCHIVE, "Delay time for sounds"); + snd_phasesep = Cvar_Get ("snd_phasesep", "0.0", CVAR_ARCHIVE, NULL, "max stereo phase separation in ms. 0.6 is for 20cm head"); + snd_volumesep = Cvar_Get("snd_volumesep", "1.0", CVAR_ARCHIVE, NULL, "max stereo volume separation in ms. 1.0 is max"); + _snd_mixahead = Cvar_Get ("_snd_mixahead", "0.1", CVAR_ARCHIVE, NULL, "Delay time for sounds"); } diff --git a/source/snd_null.c b/source/snd_null.c index 79d1998..a00a484 100644 --- a/source/snd_null.c +++ b/source/snd_null.c @@ -56,9 +56,9 @@ S_Init (void) void S_Init_Cvars (void) { - volume = Cvar_Get ("volume", "0.7", CVAR_ARCHIVE, "Volume level of sounds"); - loadas8bit = Cvar_Get ("loadas8bit", "0", CVAR_NONE, "Load samples as 8-bit"); - bgmvolume = Cvar_Get ("bgmvolume", "1", CVAR_ARCHIVE, "CD music volume"); + volume = Cvar_Get ("volume", "0.7", CVAR_ARCHIVE, NULL, "Volume level of sounds"); + loadas8bit = Cvar_Get ("loadas8bit", "0", CVAR_NONE, NULL, "Load samples as 8-bit"); + bgmvolume = Cvar_Get ("bgmvolume", "1", CVAR_ARCHIVE, NULL, "CD music volume"); } void diff --git a/source/sv_ccmds.c b/source/sv_ccmds.c index 8682978..97d4264 100644 --- a/source/sv_ccmds.c +++ b/source/sv_ccmds.c @@ -875,7 +875,7 @@ SV_InitOperatorCommands (void) Cmd_AddCommand ("maplist", COM_Maplist_f, "List all maps on the server"); cl_warncmd = - Cvar_Get ("cl_warncmd", "1", CVAR_NONE, "Toggles the display of error messages for unknown commands"); + Cvar_Get ("cl_warncmd", "1", CVAR_NONE, NULL, "Toggles the display of error messages for unknown commands"); // poor // description } diff --git a/source/sv_main.c b/source/sv_main.c index 0dd3729..005deae 100644 --- a/source/sv_main.c +++ b/source/sv_main.c @@ -1482,108 +1482,108 @@ SV_InitLocal (void) SV_UserInit (); - rcon_password = Cvar_Get ("rcon_password", "", CVAR_NONE, "Set the password for rcon commands"); - password = Cvar_Get ("password", "", CVAR_NONE, "Set the server password for players"); - spectator_password = Cvar_Get ("spectator_password", "", CVAR_NONE, "Set the spectator password"); + rcon_password = Cvar_Get ("rcon_password", "", CVAR_NONE, NULL, "Set the password for rcon commands"); + password = Cvar_Get ("password", "", CVAR_NONE, NULL, "Set the server password for players"); + spectator_password = Cvar_Get ("spectator_password", "", CVAR_NONE, NULL, "Set the spectator password"); - sv_mintic = Cvar_Get ("sv_mintic", "0.03", CVAR_NONE, + sv_mintic = Cvar_Get ("sv_mintic", "0.03", CVAR_NONE, NULL, "The minimum amount of time the server will wait before sending packets to a client. Set to .5 to make modem users happy"); - sv_maxtic = Cvar_Get ("sv_maxtic", "0.1", CVAR_NONE, + sv_maxtic = Cvar_Get ("sv_maxtic", "0.1", CVAR_NONE, NULL, "The maximum amount of time in seconds before a client a receives an update from the server"); - fraglimit = Cvar_Get ("fraglimit", "0", CVAR_SERVERINFO, "Amount of frags a player must attain in order to exit the level"); - timelimit = Cvar_Get ("timelimit", "0", CVAR_SERVERINFO, + fraglimit = Cvar_Get ("fraglimit", "0", CVAR_SERVERINFO, NULL, "Amount of frags a player must attain in order to exit the level"); + timelimit = Cvar_Get ("timelimit", "0", CVAR_SERVERINFO, NULL, "Sets the amount of time in minutes that is needed before advancing to the next level"); - teamplay = Cvar_Get ("teamplay", "0", CVAR_SERVERINFO, + teamplay = Cvar_Get ("teamplay", "0", CVAR_SERVERINFO, NULL, "Determines teamplay rules. 0 off, 1 You cannot hurt yourself nor your teammates, " "2 You can hurt yourself, your teammates, and you will lose one frag for killing a teammate" "3 You can hurt yourself but you cannot hurt your teammates"); - samelevel = Cvar_Get ("samelevel", "0", CVAR_SERVERINFO, + samelevel = Cvar_Get ("samelevel", "0", CVAR_SERVERINFO, NULL, "Determines the rules for level changing and exiting. 0 Allows advancing to the next level," "1 The same level will be played until someone exits," "2 The same level will be played and the exit will kill anybody that tries to exit," "3 The same level will be played and the exit will kill anybody that tries to exit, except on the Start map."); - maxclients = Cvar_Get ("maxclients", "8", CVAR_SERVERINFO, + maxclients = Cvar_Get ("maxclients", "8", CVAR_SERVERINFO, NULL, "Sets how many clients can connect to your server, this includes spectators and players"); - maxspectators = Cvar_Get ("maxspectators", "8", CVAR_SERVERINFO, + maxspectators = Cvar_Get ("maxspectators", "8", CVAR_SERVERINFO, NULL, "Sets how many spectators can connect to your server. The maxclients value takes precidence over this value so this" " value should always be equal-to or less-then the maxclients value"); - hostname = Cvar_Get ("hostname", "unnamed", CVAR_SERVERINFO, "Report or sets the server name"); - deathmatch = Cvar_Get ("deathmatch", "1", CVAR_SERVERINFO, + hostname = Cvar_Get ("hostname", "unnamed", CVAR_SERVERINFO, NULL, "Report or sets the server name"); + deathmatch = Cvar_Get ("deathmatch", "1", CVAR_SERVERINFO, NULL, "Sets the rules for weapon and item respawning. " "1 Does not leave weapons on the map. You can pickup weapons and items and they will respawn," "2 Leaves weapons on the map. You can only pick up a weapon once. Picked up items will not respawn," "3 Leaves weapons on the map. You can only pick up a weapon once. Picked up items will respawn."); - spawn = Cvar_Get ("spawn", "0", CVAR_SERVERINFO, "Spawn the player entity"); - watervis = Cvar_Get ("watervis", "0", CVAR_SERVERINFO, "Toggle the use of r_watervis by OpenGL clients"); + spawn = Cvar_Get ("spawn", "0", CVAR_SERVERINFO, NULL, "Spawn the player entity"); + watervis = Cvar_Get ("watervis", "0", CVAR_SERVERINFO, NULL, "Toggle the use of r_watervis by OpenGL clients"); - developer = Cvar_Get ("developer", "0", CVAR_NONE, + developer = Cvar_Get ("developer", "0", CVAR_NONE, NULL, "Toggle verbose output of server information. Useful for diagnosing problems and learning more about the server"); - timeout = Cvar_Get ("timeout", "65", CVAR_NONE, + timeout = Cvar_Get ("timeout", "65", CVAR_NONE, NULL, "Sets the amount of time in seconds before a client is considered disconnected if the server does not receive a packet"); - zombietime = Cvar_Get ("zombietime", "2", CVAR_NONE, + zombietime = Cvar_Get ("zombietime", "2", CVAR_NONE, NULL, "The number of seconds that the server will keep the character of a player on the map who seems to have disconnected"); - sv_aim = Cvar_Get ("sv_aim", "2", CVAR_NONE, "Sets the value for auto-aiming leniency"); + sv_aim = Cvar_Get ("sv_aim", "2", CVAR_NONE, NULL, "Sets the value for auto-aiming leniency"); - sv_accelerate = Cvar_Get ("sv_accelerate", "10", CVAR_NONE, "Sets the acceleration value for the players"); - sv_airaccelerate = Cvar_Get ("sv_airaccelerate", "0.7", CVAR_NONE, "Sets how quickly the players accelerate in air"); - sv_wateraccelerate = Cvar_Get ("sv_wateraccelerate", "10", CVAR_NONE, "Sets the water acceleration value"); + sv_accelerate = Cvar_Get ("sv_accelerate", "10", CVAR_NONE, NULL, "Sets the acceleration value for the players"); + sv_airaccelerate = Cvar_Get ("sv_airaccelerate", "0.7", CVAR_NONE, NULL, "Sets how quickly the players accelerate in air"); + sv_wateraccelerate = Cvar_Get ("sv_wateraccelerate", "10", CVAR_NONE, NULL, "Sets the water acceleration value"); - sv_allow_log = Cvar_Get ("sv_allow_log", "1", CVAR_NONE, "Allow remote logging"); - sv_allow_ping = Cvar_Get ("sv_allow_pings", "1", CVAR_NONE, "Allow remote pings (qstat etc)"); - sv_allow_status = Cvar_Get ("sv_allow_status", "1", CVAR_NONE, "Allow remote status queries (qstat etc)"); + sv_allow_log = Cvar_Get ("sv_allow_log", "1", CVAR_NONE, NULL, "Allow remote logging"); + sv_allow_ping = Cvar_Get ("sv_allow_pings", "1", CVAR_NONE, NULL, "Allow remote pings (qstat etc)"); + sv_allow_status = Cvar_Get ("sv_allow_status", "1", CVAR_NONE, NULL, "Allow remote status queries (qstat etc)"); - sv_extensions = Cvar_Get ("sv_extensions", "1", CVAR_NONE, "Use protocol extensions for QuakeForge clients"); - sv_friction = Cvar_Get ("sv_friction", "4", CVAR_NONE, "Sets the friction value for the players"); - sv_gravity = Cvar_Get ("sv_gravity", "800", CVAR_NONE, "Sets the global value for the amount of gravity"); + sv_extensions = Cvar_Get ("sv_extensions", "1", CVAR_NONE, NULL, "Use protocol extensions for QuakeForge clients"); + sv_friction = Cvar_Get ("sv_friction", "4", CVAR_NONE, NULL, "Sets the friction value for the players"); + sv_gravity = Cvar_Get ("sv_gravity", "800", CVAR_NONE, NULL, "Sets the global value for the amount of gravity"); - sv_maxrate = Cvar_Get ("sv_maxrate", "0", CVAR_SERVERINFO, "Maximum allowable rate"); - sv_maxspeed = Cvar_Get ("sv_maxspeed", "320", CVAR_NONE, "Sets the maximum speed a player can move"); - sv_maxvelocity = Cvar_Get ("sv_maxvelocity", "2000", CVAR_NONE, "Sets the maximum velocity an object can travel"); + sv_maxrate = Cvar_Get ("sv_maxrate", "0", CVAR_SERVERINFO, NULL, "Maximum allowable rate"); + sv_maxspeed = Cvar_Get ("sv_maxspeed", "320", CVAR_NONE, NULL, "Sets the maximum speed a player can move"); + sv_maxvelocity = Cvar_Get ("sv_maxvelocity", "2000", CVAR_NONE, NULL, "Sets the maximum velocity an object can travel"); - sv_minqfversion = Cvar_Get ("sv_minqfversion", "0", CVAR_SERVERINFO, "Minimum QF version on client"); - sv_spectatormaxspeed = Cvar_Get ("sv_spectatormaxspeed", "500", CVAR_NONE, "Sets the maximum speed a spectator can move"); - sv_stopspeed = Cvar_Get ("sv_stopspeed", "100", CVAR_NONE, "Sets the value that determines how fast the player should come to a complete stop"); + sv_minqfversion = Cvar_Get ("sv_minqfversion", "0", CVAR_SERVERINFO, NULL, "Minimum QF version on client"); + sv_spectatormaxspeed = Cvar_Get ("sv_spectatormaxspeed", "500", CVAR_NONE, NULL, "Sets the maximum speed a spectator can move"); + sv_stopspeed = Cvar_Get ("sv_stopspeed", "100", CVAR_NONE, NULL, "Sets the value that determines how fast the player should come to a complete stop"); - sv_timekick = Cvar_Get ("sv_timekick", "3", CVAR_SERVERINFO, "Time cheat protection"); - sv_timekick_fuzz = Cvar_Get ("sv_timekick_fuzz", "15", CVAR_NONE, "Time cheat \"fuzz factor\""); - sv_timekick_interval = Cvar_Get ("sv_timekick_interval", "30", CVAR_NONE, "Time cheat check interval"); + sv_timekick = Cvar_Get ("sv_timekick", "3", CVAR_SERVERINFO, NULL, "Time cheat protection"); + sv_timekick_fuzz = Cvar_Get ("sv_timekick_fuzz", "15", CVAR_NONE, NULL, "Time cheat \"fuzz factor\""); + sv_timekick_interval = Cvar_Get ("sv_timekick_interval", "30", CVAR_NONE, NULL, "Time cheat check interval"); - sv_waterfriction = Cvar_Get ("sv_waterfriction", "4", CVAR_NONE, "Sets the water friction value"); + sv_waterfriction = Cvar_Get ("sv_waterfriction", "4", CVAR_NONE, NULL, "Sets the water friction value"); sv_netdosprotect = - Cvar_Get ("sv_netdosprotect", "0", CVAR_NONE, + Cvar_Get ("sv_netdosprotect", "0", CVAR_NONE, NULL, "DoS flood attack protection"); sv_timestamps = - Cvar_Get ("sv_timestamps", "0", CVAR_NONE, + Cvar_Get ("sv_timestamps", "0", CVAR_NONE, NULL, "Time/date stamps in log entries"); sv_timefmt = - Cvar_Get ("sv_timefmt", "[%b %e %X] ", CVAR_NONE, + Cvar_Get ("sv_timefmt", "[%b %e %X] ", CVAR_NONE, NULL, "Time/date format to use"); - filterban = Cvar_Get ("filterban", "1", CVAR_NONE, + filterban = Cvar_Get ("filterban", "1", CVAR_NONE, NULL, "Determines the rules for the IP list " "0 Only IP addresses on the Ban list will be allowed onto the server, " "1 Only IP addresses NOT on the Ban list will be allowed onto the server"); - allow_download = Cvar_Get ("allow_download", "1", CVAR_NONE, "Toggle if clients can download game data from the server"); + allow_download = Cvar_Get ("allow_download", "1", CVAR_NONE, NULL, "Toggle if clients can download game data from the server"); allow_download_skins = - Cvar_Get ("allow_download_skins", "1", CVAR_NONE, "Toggle if clients can download skins from the server"); + Cvar_Get ("allow_download_skins", "1", CVAR_NONE, NULL, "Toggle if clients can download skins from the server"); allow_download_models = - Cvar_Get ("allow_download_models", "1", CVAR_NONE, "Toggle if clients can download models from the server"); + Cvar_Get ("allow_download_models", "1", CVAR_NONE, NULL, "Toggle if clients can download models from the server"); allow_download_sounds = - Cvar_Get ("allow_download_sounds", "1", CVAR_NONE, "Toggle if clients can download sounds from the server"); + Cvar_Get ("allow_download_sounds", "1", CVAR_NONE, NULL, "Toggle if clients can download sounds from the server"); allow_download_maps = - Cvar_Get ("allow_download_maps", "1", CVAR_NONE, "Toggle if clients can download maps from the server"); + Cvar_Get ("allow_download_maps", "1", CVAR_NONE, NULL, "Toggle if clients can download maps from the server"); - sv_highchars = Cvar_Get ("sv_highchars", "1", CVAR_NONE, "Toggle the use of high character color names for players"); + sv_highchars = Cvar_Get ("sv_highchars", "1", CVAR_NONE, NULL, "Toggle the use of high character color names for players"); - sv_phs = Cvar_Get ("sv_phs", "1", CVAR_NONE, + sv_phs = Cvar_Get ("sv_phs", "1", CVAR_NONE, NULL, "Possibly Hearable Set. If set to zero, the server calculates sound hearability in realtime"); - pausable = Cvar_Get ("pausable", "1", CVAR_NONE, "Toggle if server can be paused 1 is on, 0 is off"); + pausable = Cvar_Get ("pausable", "1", CVAR_NONE, NULL, "Toggle if server can be paused 1 is on, 0 is off"); // DoS protection Cmd_AddCommand ("netdosexpire", SV_netDoSexpire_f, "FIXME: part of DoS protection obviously, but I don't know what it does. No Description"); @@ -1875,7 +1875,7 @@ SV_Init (void) // only reads from within the quake file system, and changing that is // probably Not A Good Thing (tm). fs_globalcfg = Cvar_Get ("fs_globalcfg", FS_GLOBALCFG, - CVAR_ROM, "global configuration file"); + CVAR_ROM, NULL, "global configuration file"); Cmd_Exec_File (fs_globalcfg->string); Cbuf_Execute_Sets (); @@ -1884,7 +1884,7 @@ SV_Init (void) Cbuf_Execute_Sets (); fs_usercfg = Cvar_Get ("fs_usercfg", FS_USERCFG, - CVAR_ROM, "user configuration file"); + CVAR_ROM, NULL, "user configuration file"); Cmd_Exec_File (fs_usercfg->string); Cbuf_Execute_Sets (); diff --git a/source/sv_progs.c b/source/sv_progs.c index e71a997..6abbb90 100644 --- a/source/sv_progs.c +++ b/source/sv_progs.c @@ -160,8 +160,8 @@ void SV_Progs_Init_Cvars (void) { r_skyname = - Cvar_Get ("r_skyname", "", CVAR_SERVERINFO, "name of skybox"); - sv_progs = Cvar_Get ("sv_progs", "qwprogs.dat", CVAR_ROM, + Cvar_Get ("r_skyname", "", CVAR_SERVERINFO, NULL, "name of skybox"); + sv_progs = Cvar_Get ("sv_progs", "qwprogs.dat", CVAR_ROM, NULL, "Allows selectable game progs if you have several " "of them in the gamedir"); } diff --git a/source/sv_sys_unix.c b/source/sv_sys_unix.c index 94f48a7..0e9ba4f 100644 --- a/source/sv_sys_unix.c +++ b/source/sv_sys_unix.c @@ -139,10 +139,10 @@ Sys_ConsoleInput (void) void Sys_Init_Cvars (void) { - sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, "Toggles console screen output"); - sys_extrasleep = Cvar_Get ("sys_extrasleep", "0", CVAR_NONE, + sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, NULL, "Toggles console screen output"); + sys_extrasleep = Cvar_Get ("sys_extrasleep", "0", CVAR_NONE, NULL, "Set to cause whatever amount delay in microseconds you want. Mostly useful to generate simulated bad connections."); - sys_dead_sleep = Cvar_Get ("sys_dead_sleep", "1", CVAR_NONE, + sys_dead_sleep = Cvar_Get ("sys_dead_sleep", "1", CVAR_NONE, NULL, "When set, the server gets NO cpu if no clients are connected" "and there's no other activity. *MIGHT* cause problems with" "some mods."); diff --git a/source/sv_sys_win.c b/source/sv_sys_win.c index ec7571d..1b1a56b 100644 --- a/source/sv_sys_win.c +++ b/source/sv_sys_win.c @@ -148,8 +148,8 @@ Sys_Quit (void) void Sys_Init_Cvars (void) { - sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, "Toggle console output"); - sys_sleep = Cvar_Get ("sys_sleep", "8", CVAR_NONE, + sys_nostdout = Cvar_Get ("sys_nostdout", "0", CVAR_NONE, NULL, "Toggle console output"); + sys_sleep = Cvar_Get ("sys_sleep", "8", CVAR_NONE, NULL, "Sleep how long in seconds between checking for connections. minimum is 0, maximum is 13"); } diff --git a/source/sv_user.c b/source/sv_user.c index c49dfb1..2c57f77 100644 --- a/source/sv_user.c +++ b/source/sv_user.c @@ -1782,9 +1782,9 @@ SV_UserInit (void) { qsort (ucmds, sizeof (ucmds) / sizeof (ucmds[0]), sizeof (ucmds[0]), ucmds_compare); - cl_rollspeed = Cvar_Get ("cl_rollspeed", "200", CVAR_NONE, "How quickly a player straightens out after strafing"); - cl_rollangle = Cvar_Get ("cl_rollangle", "2", CVAR_NONE, "How much a player's screen tilts when strafing"); - sv_spectalk = Cvar_Get ("sv_spectalk", "1", CVAR_NONE, "Toggles the ability of spectators to talk to players"); - sv_mapcheck = Cvar_Get ("sv_mapcheck", "1", CVAR_NONE, + cl_rollspeed = Cvar_Get ("cl_rollspeed", "200", CVAR_NONE, NULL, "How quickly a player straightens out after strafing"); + cl_rollangle = Cvar_Get ("cl_rollangle", "2", CVAR_NONE, NULL, "How much a player's screen tilts when strafing"); + sv_spectalk = Cvar_Get ("sv_spectalk", "1", CVAR_NONE, NULL, "Toggles the ability of spectators to talk to players"); + sv_mapcheck = Cvar_Get ("sv_mapcheck", "1", CVAR_NONE, NULL, "Toggle the use of map checksumming to check for players who edit maps to cheat"); } diff --git a/source/teamplay.c b/source/teamplay.c index d8d618d..eeef724 100644 --- a/source/teamplay.c +++ b/source/teamplay.c @@ -332,11 +332,11 @@ void Team_Init_Cvars (void) { cl_deadbodyfilter = - Cvar_Get ("cl_deadbodyfilter", "0", CVAR_NONE, + Cvar_Get ("cl_deadbodyfilter", "0", CVAR_NONE, NULL, "Hide dead player models"); - cl_gibfilter = Cvar_Get ("cl_gibfilter", "0", CVAR_NONE, "Hide gibs"); - cl_parsesay = Cvar_Get ("cl_parsesay", "0", CVAR_NONE, "Use .loc files to find your present location when you put %l in messages"); - cl_nofake = Cvar_Get ("cl_nofake", "0", CVAR_NONE, "Unhide fake messages"); + cl_gibfilter = Cvar_Get ("cl_gibfilter", "0", CVAR_NONE, NULL, "Hide gibs"); + cl_parsesay = Cvar_Get ("cl_parsesay", "0", CVAR_NONE, NULL, "Use .loc files to find your present location when you put %l in messages"); + cl_nofake = Cvar_Get ("cl_nofake", "0", CVAR_NONE, NULL, "Unhide fake messages"); } /* diff --git a/source/vid.c b/source/vid.c index bc52628..2286941 100644 --- a/source/vid.c +++ b/source/vid.c @@ -62,8 +62,8 @@ VID_GetWindowSize (int def_w, int def_h) { int pnum; - vid_width = Cvar_Get ("vid_width", va ("%d", def_w), CVAR_NONE, "screen width"); - vid_height = Cvar_Get ("vid_height", va ("%d", def_h), CVAR_NONE, "screen height"); + vid_width = Cvar_Get ("vid_width", va ("%d", def_w), CVAR_NONE, NULL, "screen width"); + vid_height = Cvar_Get ("vid_height", va ("%d", def_h), CVAR_NONE, NULL, "screen height"); if ((pnum = COM_CheckParm ("-width"))) { if (pnum >= com_argc - 1) @@ -137,9 +137,6 @@ void VID_UpdateGamma (cvar_t *vid_gamma) { double gamma = bound (0.1, vid_gamma->value, 9.9); - - if (vid_gamma->flags & CVAR_ROM) // System gamma unavailable - return; if (vid_gamma_avail && vid_system_gamma->int_val) { // Have system, use it Con_DPrintf ("Setting hardware gamma to %g\n", gamma); @@ -169,7 +166,7 @@ VID_InitGamma (unsigned char *pal) gamma = bound (0.1, gamma, 9.9); vid_gamma = Cvar_Get ("vid_gamma", va ("%f", gamma), CVAR_ARCHIVE, - "Gamma correction"); + VID_UpdateGamma, "Gamma correction"); - VID_UpdateGamma (vid_gamma); + VID_BuildGammaTable (vid_gamma->value); } diff --git a/source/vid_common_gl.c b/source/vid_common_gl.c index 52e4e3a..5963615 100644 --- a/source/vid_common_gl.c +++ b/source/vid_common_gl.c @@ -89,10 +89,10 @@ extern int gl_filter_min, gl_filter_max; void GL_Common_Init_Cvars (void) { - vid_use8bit = Cvar_Get ("vid_use8bit", "0", CVAR_ROM, "Use 8-bit shared palettes."); - brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, "Brightness level"); - contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, "Contrast level"); - gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, "Use multitexture when available"); + vid_use8bit = Cvar_Get ("vid_use8bit", "0", CVAR_ROM, NULL, "Use 8-bit shared palettes."); + brightness = Cvar_Get ("brightness", "1", CVAR_ARCHIVE, NULL, "Brightness level"); + contrast = Cvar_Get ("contrast", "1", CVAR_ARCHIVE, NULL, "Contrast level"); + gl_multitexture = Cvar_Get ("gl_multitexture", "0", CVAR_ARCHIVE, NULL, "Use multitexture when available"); } /* @@ -139,12 +139,10 @@ LHFindColor(unsigned char *palette, int first, int last, int r, int g, int b) color[1] = g; color[2] = b; palette += first * 3; - for (i = first;i < last;i++) - { + for (i = first; i < last; i++) { // LordHavoc: distance in color cube from desired color distance = VectorDistance_fast(palette, color); - if (distance < bestdistance) - { + if (distance < bestdistance) { bestdistance = distance; bestcolor = i; } @@ -182,22 +180,22 @@ VID_SetPalette (unsigned char *palette) COM_FOpenFile ("glquake/15to8.pal", &f); if (f) { - Qread (f, d_15to8table, 32768); + Qread (f, d_15to8table, 1 << 15); Qclose (f); } else { // LordHavoc: cleaned this up - Con_Printf("Building 15bit to 8bit color conversion table\n"); - for (i = 0; i < 32768; i++) { + Con_DPrintf("Building 15bit to 8bit color conversion table\n"); + for (i = 0; i < (1 << 15); i++) { int r, g, b; // split out to 8bit components r = ((i & 0x001F) >> 0) << 3; g = ((i & 0x03E0) >> 5) << 3; b = ((i & 0x7C00) >> 10) << 3; - d_15to8table[i] = LHFindColor(palette, 0, 256, r, g, b); + d_15to8table[i] = LHFindColor (palette, 0, 256, r, g, b); } snprintf (s, sizeof (s), "%s/glquake/15to8.pal", com_gamedir); COM_CreatePath (s); - if ((f = Qopen (s, "wb")) != NULL) { + if ((f = Qopen (s, "wb"))) { Qwrite (f, d_15to8table, 32768); Qclose (f); } @@ -347,9 +345,6 @@ Shared_Init8bitPalette (void) void VID_Init8bitPalette (void) { - vid_use8bit = - Cvar_Get ("vid_use8bit", "0", CVAR_ROM, "Use 8-bit shared palettes."); - Con_Printf ("Checking for 8-bit extension: "); if (vid_use8bit->int_val) { #ifdef GL_SHARED_TEXTURE_PALETTE_EXT diff --git a/source/vid_fbdev.c b/source/vid_fbdev.c index 3c41a56..664c860 100644 --- a/source/vid_fbdev.c +++ b/source/vid_fbdev.c @@ -625,10 +625,10 @@ VID_Init (unsigned char *palette) void VID_Init_Cvars () { - vid_mode = Cvar_Get ("vid_mode", "0", CVAR_NONE, "Sets the video mode"); - vid_redrawfull = Cvar_Get ("vid_redrawfull", "0", CVAR_NONE, + vid_mode = Cvar_Get ("vid_mode", "0", CVAR_NONE, NULL, "Sets the video mode"); + vid_redrawfull = Cvar_Get ("vid_redrawfull", "0", CVAR_NONE, NULL, "Redraw entire screen each frame instead of just dirty areas"); - vid_waitforrefresh = Cvar_Get ("vid_waitforrefresh", "0", CVAR_ARCHIVE, + vid_waitforrefresh = Cvar_Get ("vid_waitforrefresh", "0", CVAR_ARCHIVE, NULL, "Wait for vertical retrace before drawing next frame"); } diff --git a/source/vid_glx.c b/source/vid_glx.c index d3b1134..9f19f35 100644 --- a/source/vid_glx.c +++ b/source/vid_glx.c @@ -203,7 +203,6 @@ VID_Init (unsigned char *palette) GL_Init (); -// GL_CheckBrightness (palette); VID_InitGamma (palette); VID_SetPalette (palette); diff --git a/source/vid_mgl.c b/source/vid_mgl.c index 73b5acf..62c5ac3 100644 --- a/source/vid_mgl.c +++ b/source/vid_mgl.c @@ -2074,21 +2074,21 @@ VID_Init (unsigned char *palette) void VID_Init_Cvars () { - vid_mode = Cvar_Get ("vid_mode", "0", CVAR_NONE, "Set the video mode"); - vid_nopageflip = Cvar_Get ("vid_nopageflip", "0", CVAR_ARCHIVE, "Toggles the use of page flipping"); + vid_mode = Cvar_Get ("vid_mode", "0", CVAR_NONE, NULL, "Set the video mode"); + vid_nopageflip = Cvar_Get ("vid_nopageflip", "0", CVAR_ARCHIVE, NULL, "Toggles the use of page flipping"); _vid_default_mode_win = - Cvar_Get ("_vid_default_mode_win", "3", CVAR_ARCHIVE, "Default windowed video mode"); - vid_config_x = Cvar_Get ("vid_config_x", "800", CVAR_ARCHIVE, "Maximum x-axis screen size"); - vid_config_y = Cvar_Get ("vid_config_y", "600", CVAR_ARCHIVE, "Maximum y-axis screen size"); - vid_stretch_by_2 = Cvar_Get ("vid_stretch_by_2", "1", CVAR_ARCHIVE, "Stretch the pixles by a two fold to acheive proper view"); - _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "Have quake grab the mouse from X when you play"); + Cvar_Get ("_vid_default_mode_win", "3", CVAR_ARCHIVE, NULL, "Default windowed video mode"); + vid_config_x = Cvar_Get ("vid_config_x", "800", CVAR_ARCHIVE, NULL, "Maximum x-axis screen size"); + vid_config_y = Cvar_Get ("vid_config_y", "600", CVAR_ARCHIVE, NULL, "Maximum y-axis screen size"); + vid_stretch_by_2 = Cvar_Get ("vid_stretch_by_2", "1", CVAR_ARCHIVE, NULL, "Stretch the pixles by a two fold to acheive proper view"); + _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL, "Have quake grab the mouse from X when you play"); vid_fullscreen_mode = - Cvar_Get ("vid_fullscreen_mode", "3", CVAR_ARCHIVE, "Set the full screen video mode."); + Cvar_Get ("vid_fullscreen_mode", "3", CVAR_ARCHIVE, NULL, "Set the full screen video mode."); vid_windowed_mode = - Cvar_Get ("vid_windowed_mode", "0", CVAR_ARCHIVE, "Set the windowed video mode"); - block_switch = Cvar_Get ("block_switch", "0", CVAR_ARCHIVE, "If set, won't allow you to task switch while playing"); - vid_window_x = Cvar_Get ("vid_window_x", "0", CVAR_ARCHIVE, "The x-axis location of the window, if windowed"); - vid_window_y = Cvar_Get ("vid_window_y", "0", CVAR_ARCHIVE, "The y-axis location of the window, if windowed"); + Cvar_Get ("vid_windowed_mode", "0", CVAR_ARCHIVE, NULL, "Set the windowed video mode"); + block_switch = Cvar_Get ("block_switch", "0", CVAR_ARCHIVE, NULL, "If set, won't allow you to task switch while playing"); + vid_window_x = Cvar_Get ("vid_window_x", "0", CVAR_ARCHIVE, NULL, "The x-axis location of the window, if windowed"); + vid_window_y = Cvar_Get ("vid_window_y", "0", CVAR_ARCHIVE, NULL, "The y-axis location of the window, if windowed"); } diff --git a/source/vid_sdl.c b/source/vid_sdl.c index 89daf14..9395ecb 100644 --- a/source/vid_sdl.c +++ b/source/vid_sdl.c @@ -195,7 +195,7 @@ void VID_Init_Cvars () { vid_fullscreen = - Cvar_Get ("vid_fullscreen", "0", CVAR_ROM, + Cvar_Get ("vid_fullscreen", "0", CVAR_ROM, NULL, "Toggles fullscreen game mode"); } diff --git a/source/vid_sgl.c b/source/vid_sgl.c index 86e1272..ce5ddee 100644 --- a/source/vid_sgl.c +++ b/source/vid_sgl.c @@ -226,7 +226,7 @@ VID_Init (unsigned char *palette) void VID_Init_Cvars () { - vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ROM, "Toggles fullscreen mode"); + vid_fullscreen = Cvar_Get ("vid_fullscreen", "0", CVAR_ROM, NULL, "Toggles fullscreen mode"); } void diff --git a/source/vid_svgalib.c b/source/vid_svgalib.c index aad94d3..f0722a7 100644 --- a/source/vid_svgalib.c +++ b/source/vid_svgalib.c @@ -610,10 +610,10 @@ VID_Init (unsigned char *palette) void VID_Init_Cvars () { - vid_mode = Cvar_Get ("vid_mode", "5", CVAR_NONE, "Sets the video mode"); - vid_redrawfull = Cvar_Get ("vid_redrawfull", "0", CVAR_NONE, "Redraw entire screen each frame instead of just dirty areas"); + vid_mode = Cvar_Get ("vid_mode", "5", CVAR_NONE, NULL, "Sets the video mode"); + vid_redrawfull = Cvar_Get ("vid_redrawfull", "0", CVAR_NONE, NULL, "Redraw entire screen each frame instead of just dirty areas"); vid_waitforrefresh = Cvar_Get ("vid_waitforrefresh", "0", - CVAR_ARCHIVE, "Wait for vertical retrace before drawing next frame"); + CVAR_ARCHIVE, NULL, "Wait for vertical retrace before drawing next frame"); } diff --git a/source/vid_wgl.c b/source/vid_wgl.c index 4a1ab8e..c036db2 100644 --- a/source/vid_wgl.c +++ b/source/vid_wgl.c @@ -1384,7 +1384,7 @@ VID_Init8bitPalette (void) GLubyte *oldPalette, *newPalette; vid_use8bit = - Cvar_Get ("vid_use8bit", "0", CVAR_ROM, "Use 8-bit shared palettes."); + Cvar_Get ("vid_use8bit", "0", CVAR_ROM, NULL, "Use 8-bit shared palettes."); if (!vid_use8bit->int_val) return; @@ -1656,7 +1656,7 @@ VID_Init (unsigned char *palette) void VID_Init_Cvars () { - _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, "Grab the mouse from X while playing quake"); + _windowed_mouse = Cvar_Get ("_windowed_mouse", "0", CVAR_ARCHIVE, NULL, "Grab the mouse from X while playing quake"); } diff --git a/source/vid_x11.c b/source/vid_x11.c index 4e1f0bc..679f14b 100644 --- a/source/vid_x11.c +++ b/source/vid_x11.c @@ -645,9 +645,9 @@ VID_SetPalette (unsigned char *palette) for (i = 0; i < 256; i++) { colors[i].pixel = i; colors[i].flags = DoRed | DoGreen | DoBlue; - colors[i].red = gammatable[palette[i * 3]] * 256; - colors[i].green = gammatable[palette[i * 3 + 1]] * 256; - colors[i].blue = gammatable[palette[i * 3 + 2]] * 256; + colors[i].red = palette[(i * 3)] * 256; + colors[i].green = palette[(i * 3) + 1] * 256; + colors[i].blue = palette[(i * 3) + 2] * 256; } XStoreColors (x_disp, x_cmap, colors, 256); }