merge some changes from my autocvarizer branch that change nothing but make code...
authorRudolf Polzer <divverent@alientrap.org>
Sat, 4 Dec 2010 11:36:37 +0000 (12:36 +0100)
committerRudolf Polzer <divverent@alientrap.org>
Sat, 4 Dec 2010 11:36:37 +0000 (12:36 +0100)
19 files changed:
balance25.cfg
balanceLeeStricklin.cfg
balanceSamual.cfg
balanceXonotic.cfg
balancetZork.cfg
qcsrc/server/campaign.qc
qcsrc/server/cheats.qh
qcsrc/server/cl_client.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_world.qc
qcsrc/server/miscfunctions.qc
qcsrc/server/monsters/ai.qc
qcsrc/server/monsters/defs.qc
qcsrc/server/monsters/mode_management.qc
qcsrc/server/mutators/gamemode_keyhunt.qc
qcsrc/server/teamplay.qc
qcsrc/server/vote.qc
qcsrc/server/w_campingrifle.qc
qcsrc/server/w_rocketlauncher.qc

index d316ce8..32ec280 100644 (file)
@@ -603,7 +603,7 @@ set g_balance_hlac_secondary_shots 6
 // {{{ campingrifle
 set g_balance_campingrifle_magazinecapacity 8
 set g_balance_campingrifle_reloadtime 2 // matches reload anim
-set g_balance_campingrifle_auto_reload_after_changing_weapons 0
+set g_balance_campingrifle_auto_reload_on_switch 0
 set g_balance_campingrifle_bursttime 0
 set g_balance_campingrifle_primary_tracer 0
 set g_balance_campingrifle_primary_damage 60
index 064b72c..4e213f2 100644 (file)
@@ -603,7 +603,7 @@ set g_balance_hlac_secondary_shots 6
 // {{{ campingrifle
 set g_balance_campingrifle_magazinecapacity 8
 set g_balance_campingrifle_reloadtime 2 // matches reload anim
-set g_balance_campingrifle_auto_reload_after_changing_weapons 0
+set g_balance_campingrifle_auto_reload_on_switch 0
 set g_balance_campingrifle_bursttime 0.85 // 0.35 - 0.1 + 0.35 - 0.1 + 0.35 = three secondaries
 set g_balance_campingrifle_primary_tracer 0
 set g_balance_campingrifle_primary_damage 75
index c39a9c6..65a728c 100644 (file)
@@ -603,7 +603,7 @@ set g_balance_hlac_secondary_shots 6
 // {{{ campingrifle
 set g_balance_campingrifle_magazinecapacity 8 // make it pretty much useless in close combat
 set g_balance_campingrifle_reloadtime 2 // matches reload anim
-set g_balance_campingrifle_auto_reload_after_changing_weapons 0
+set g_balance_campingrifle_auto_reload_on_switch 0
 set g_balance_campingrifle_bursttime 0
 set g_balance_campingrifle_primary_tracer 1
 set g_balance_campingrifle_primary_damage 65
index 1edf010..94bd626 100644 (file)
@@ -607,7 +607,7 @@ set g_balance_hlac_secondary_shots 6
 // {{{ campingrifle
 set g_balance_campingrifle_magazinecapacity 8 // make it pretty much useless in close combat
 set g_balance_campingrifle_reloadtime 2 // matches reload anim
-set g_balance_campingrifle_auto_reload_after_changing_weapons 0
+set g_balance_campingrifle_auto_reload_on_switch 0
 set g_balance_campingrifle_bursttime 0
 set g_balance_campingrifle_primary_tracer 1
 set g_balance_campingrifle_primary_damage 70
index 2da45b6..8efcb20 100644 (file)
@@ -623,7 +623,7 @@ set g_balance_hlac_secondary_shots 6
 // {{{ campingrifle
 set g_balance_campingrifle_magazinecapacity 8 // make it pretty much useless in close combat
 set g_balance_campingrifle_reloadtime 2 // matches reload anim
-set g_balance_campingrifle_auto_reload_after_changing_weapons 0
+set g_balance_campingrifle_auto_reload_on_switch 0
 set g_balance_campingrifle_bursttime 0
 set g_balance_campingrifle_primary_tracer 1
 set g_balance_campingrifle_primary_damage 40
index 1a8db10..816f71b 100644 (file)
@@ -64,7 +64,7 @@ void CampaignPreInit()
 {
        float baseskill;
        string title;
-       if(cvar("sv_cheats"))
+       if(autocvar_sv_cheats)
        {
                CampaignBailout("JOLLY CHEATS AHAHAHAHAHAHAH))");
                return;
@@ -101,7 +101,7 @@ void CampaignPreInit()
 
        // copy sv_gravity cvar, as the engine needs it too (sorry, this will mess
        // with the menu a little still...)
-       cvar_set_normal("sv_gravity", cvar_string("sv_gravity"));
+       cvar_set_normal("sv_gravity", ftos(cvar("sv_gravity")));
 
        if(Campaign_Invalid())
                return;
index cb365a3..8c27691 100644 (file)
@@ -1,3 +1,5 @@
+float autocvar_sv_cheats; // must... declare... global
+
 float cheatcount_total;
 .float cheatcount;
 void CheatInit();
index a1a8c4f..0183f2d 100644 (file)
@@ -802,8 +802,8 @@ void FixPlayermodel()
 
        if(!teams_matter)
                if(strlen(cvar_string("sv_defaultplayercolors")))
-                       if(self.clientcolors != cvar("sv_defaultplayercolors"))
-                               setcolor(self, cvar("sv_defaultplayercolors"));
+                       if(self.clientcolors != stof(cvar_string("sv_defaultplayercolors")))
+                               setcolor(self, stof(cvar_string("sv_defaultplayercolors")));
 }
 
 void PlayerTouchExplode(entity p1, entity p2)
index fd5b445..52f756e 100644 (file)
@@ -877,14 +877,7 @@ float RadiusDamage (entity inflictor, entity attacker, float coredamage, float e
 
        if(RadiusDamage_running)
        {
-               string save;
-               print("RadiusDamage called recursively!\n");
-               print("Expect stuff to go HORRIBLY wrong.\n");
-               print("Causing a stack trace...\n");
-               save = cvar_string("prvm_backtraceforwarnings");
-               cvar_set("prvm_backtraceforwarnings", "1");
-               fclose(-1); // calls VM_Warning
-               cvar_set("prvm_backtraceforwarnings", save);
+               backtrace("RadiusDamage called recursively! Expect stuff to go HORRIBLY wrong.");
                return 0;
        }
 
index 9a3c361..27d7a69 100644 (file)
@@ -614,15 +614,6 @@ void spawnfunc_worldspawn (void)
 
        TemporaryDB = db_create();
 
-       /*
-       TODO sound pack system
-       // initialize sound pack system
-       soundpack = cvar_string("g_soundpack");
-       if(soundpack != "")
-               soundpack = strcat(soundpack, "/");
-       soundpack = strzone(soundpack);
-       */
-
        // 0 normal
        lightstyle(0, "m");
 
@@ -696,7 +687,7 @@ void spawnfunc_worldspawn (void)
        GameLogInit(); // prepare everything
        if(cvar("sv_eventlog"))
        {
-               s = strcat(cvar_string("sv_eventlog_files_counter"), ".");
+               s = strcat(ftos(cvar("sv_eventlog_files_counter")), ".");
                s = strcat(s, ftos(random()));
                matchid = strzone(s);
 
index cb74c8d..a5b33ac 100644 (file)
@@ -794,6 +794,8 @@ vector randompos(vector m1, vector m2)
     return  v;
 };
 
+//#NO AUTOCVARS START
+
 float g_pickup_shells;
 float g_pickup_shells_max;
 float g_pickup_nails;
@@ -1313,25 +1315,7 @@ void readlevelcvars(void)
        readplayerstartcvars();
 }
 
-/*
-// TODO sound pack system
-string soundpack;
-
-string precache_sound_builtin (string s) = #19;
-void(entity e, float chan, string samp, float vol, float atten) sound_builtin = #8;
-string precache_sound(string s)
-{
-       return precache_sound_builtin(strcat(soundpack, s));
-}
-void play2(entity e, string filename)
-{
-       stuffcmd(e, strcat("play2 ", soundpack, filename, "\n"));
-}
-void sound(entity e, float chan, string samp, float vol, float atten)
-{
-       sound_builtin(e, chan, strcat(soundpack, samp), vol, atten);
-}
-*/
+//#NO AUTOCVARS END
 
 // Sound functions
 string precache_sound (string s) = #19;
index 23330cd..022fde2 100644 (file)
@@ -188,6 +188,7 @@ void() monster_spawnwanderpath =
 
 void() monster_checkbossflag =
 {
+//#NO AUTOCVARS START
 #if 0
        local float healthboost;
        local float r;
@@ -222,6 +223,7 @@ void() monster_checkbossflag =
                while (self.colormod_x > 0.6 && self.colormod_y > 0.6 && self.colormod_z > 0.6);
        }
 #endif
+//#NO AUTOCVARS END
 };
 
 
index 1a43fc7..1982142 100644 (file)
@@ -40,12 +40,14 @@ float   AS_MISSILE              = 4;
 float SKILL4_MINALPHA         = 0.4;
 
 float monsterwander;
+//#NO AUTOCVARS START
 /*
         monsterwander = cvar("monsterwander");
         // monsterwander is always on in skill 5
         if (skill >= 5)
                 monsterwander = TRUE;
 */
+//#NO AUTOCVARS END
 
 .float candrown;
 
index 9f3770f..5b7d80f 100644 (file)
@@ -164,14 +164,14 @@ string dmmessage;
 void(string m) setdm =
 {
        dmmessage = m;
-       if (cvar_string("deathmatch") != m)
+       if (cvar("deathmatch") != stof(m))
                cvar_set("deathmatch", m);
 }
 
 void(string m) setteamplay =
 {
        dmmessage = m;
-       if (cvar_string("teamplay") != m)
+       if (cvar("teamplay") != stof(m))
                cvar_set("teamplay", m);
 }
 
index ca2865a..54be69c 100644 (file)
@@ -2,7 +2,6 @@
 
 // #define KH_PLAYER_USE_ATTACHMENT
 // #define KH_PLAYER_USE_CARRIEDMODEL
-// #define KH_KEY_ATTACHMENT_DEBUG
 
 #ifdef KH_PLAYER_USE_ATTACHMENT
 vector KH_PLAYER_ATTACHMENT_DIST_ROTATED = '0 -4 0';
@@ -648,17 +647,6 @@ void kh_Key_Think()  // runs all the time
        if(intermission_running)
                return;
 
-#ifdef KH_KEY_ATTACHMENT_DEBUG
-       if(self.kh_prev == self.owner)
-       {
-               if(cvar_string("_angles") != "")
-               {
-                       self.angles = stov(cvar_string("_angles"));
-                       setorigin(self, stov(cvar_string("_origin")));
-               }
-       }
-#endif
-
        if(self.owner)
        {
 #ifndef KH_PLAYER_USE_ATTACHMENT
index 7df082c..262b5e9 100644 (file)
@@ -115,6 +115,7 @@ void ReadGameCvars()
        prev = cvar("gamecfg");
        for(i = 0; i < 2; ++i)
        {
+//#NO AUTOCVARS START
                found += (g_dm = (!found && (prev != GAME_DEATHMATCH) && cvar("g_dm")));
                found += (g_tdm = (!found && (prev != GAME_TEAM_DEATHMATCH) && cvar("g_tdm")));
                found += (g_domination = (!found && (prev != GAME_DOMINATION) && cvar("g_domination")));
@@ -131,6 +132,7 @@ void ReadGameCvars()
                found += (g_cts = (!found && (prev != GAME_CTS) && cvar("g_cts")));
                found += (g_freezetag = (!found && (prev != GAME_FREEZETAG) && cvar("g_freezetag")));
                found += (g_keepaway = (!found && (prev != GAME_KEEPAWAY) && cvar("g_keepaway")));
+//#NO AUTOCVARS END
 
                if(found)
                        break;
@@ -431,7 +433,7 @@ void InitGameplayMode()
                        race_timelimit = cvar("timelimit");
                        cvar_set("fraglimit", "0");
                        cvar_set("leadlimit", "0");
-                       cvar_set("timelimit", cvar_string("g_race_qualifying_timelimit"));
+                       cvar_set("timelimit", ftos(cvar("g_race_qualifying_timelimit")));
                }
                else
                        g_race_qualifying = 0;
index 1fbdeca..adc037c 100644 (file)
@@ -55,7 +55,7 @@ entity GetKickVoteVictim(string vote, string cmd, entity caller)
                GetKickVoteVictim_newcommand = strcat(argv(0), " # ", ftos(num_for_edict(e)));
                if(argv(0) == "kickban")
                {
-                       GetKickVoteVictim_newcommand = strcat(GetKickVoteVictim_newcommand, " ", cvar_string("g_ban_default_bantime"), " ", cvar_string("g_ban_default_masksize"), " ", reason);
+                       GetKickVoteVictim_newcommand = strcat(GetKickVoteVictim_newcommand, " ", ftos(cvar("g_ban_default_bantime")), " ", ftos(cvar("g_ban_default_masksize")), " ", reason);
                }
                else if(argv(0) == "kick")
                {
@@ -367,7 +367,7 @@ void VoteHelp(entity e) {
        print_to(e, "^7\"^2yes^7\", \"^2no^7\", \"^2abstain^7\" and \"^2dontcare^7\" to make your vote.");
        print_to(e, "^7If enough of the players vote yes the vote is accepted.");
        print_to(e, "^7If enough of the players vote no the vote is rejected.");
-       print_to(e, strcat("^7If neither the vote will timeout after ", cvar_string("sv_vote_timeout"), "^7 seconds."));
+       print_to(e, strcat("^7If neither the vote will timeout after ", ftos(cvar("sv_vote_timeout")), "^7 seconds."));
        print_to(e, "^7You can call a vote for or execute these commands:");
        print_to(e, strcat("^3", cvar_string("sv_vote_commands"), "^7 and maybe further ^3arguments^7"));
 }
index 3097173..1347fc8 100644 (file)
@@ -250,7 +250,7 @@ float w_campingrifle(float req)
                weapon_setup(WEP_CAMPINGRIFLE);
 
                full = W_CampingRifle_CheckMaxBullets(TRUE);
-               if(cvar("g_balance_campingrifle_auto_reload_after_changing_weapons"))
+               if(cvar("g_balance_campingrifle_auto_reload_on_switch"))
                        if(!full)
                                self.campingrifle_bulletcounter = -1;
        }
index b42a448..cbc458f 100644 (file)
@@ -196,17 +196,6 @@ void W_Rocket_Think (void)
                        desiredorigin = WarpZone_RefSys_TransformOrigin(self.owner, self, self.owner.origin + self.owner.view_ofs);
                        olddir = normalize(self.velocity);
 
-#if 0
-                       // disabled this code because it doesn't do what I want it to do :P
-                       cosminang = cos(cvar("g_balance_rocketlauncher_guidefadeangle") * DEG2RAD);
-                       cosmaxang = cos(cvar("g_balance_rocketlauncher_guidemaxangle") * DEG2RAD);
-                       cosang = desireddir * normalize(self.origin - desiredorigin);
-                       if(cosminang == cosmaxang)
-                               f *= (cosang >= cosminang);
-                       else
-                               f *= bound(0, (cosang - cosmaxang) / (cosminang - cosmaxang), 1);
-#endif
-
                        // now it gets tricky... we want to move like some curve to approximate the target direction
                        // but we are limiting the rate at which we can turn!
                        goal = desiredorigin + ((self.origin - desiredorigin) * desireddir + cvar("g_balance_rocketlauncher_guidegoal")) * desireddir;