From: Rudolf Polzer Date: Sat, 4 Dec 2010 11:36:37 +0000 (+0100) Subject: merge some changes from my autocvarizer branch that change nothing but make code... X-Git-Tag: xonotic-v0.1.0preview~65^2~18 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=162a91bc68d7b8e58c92cb0af873871129e386a9;p=xonotic%2Fxonotic-data.pk3dir.git merge some changes from my autocvarizer branch that change nothing but make code a bit more consistent; also removes some debug stuff and renames a campingrifle cvar to be autocvarizable --- diff --git a/balance25.cfg b/balance25.cfg index d316ce823..32ec280e0 100644 --- a/balance25.cfg +++ b/balance25.cfg @@ -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 diff --git a/balanceLeeStricklin.cfg b/balanceLeeStricklin.cfg index 064b72c76..4e213f2ca 100644 --- a/balanceLeeStricklin.cfg +++ b/balanceLeeStricklin.cfg @@ -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 diff --git a/balanceSamual.cfg b/balanceSamual.cfg index c39a9c646..65a728c05 100644 --- a/balanceSamual.cfg +++ b/balanceSamual.cfg @@ -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 diff --git a/balanceXonotic.cfg b/balanceXonotic.cfg index 1edf010f3..94bd62672 100644 --- a/balanceXonotic.cfg +++ b/balanceXonotic.cfg @@ -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 diff --git a/balancetZork.cfg b/balancetZork.cfg index 2da45b691..8efcb202f 100644 --- a/balancetZork.cfg +++ b/balancetZork.cfg @@ -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 diff --git a/qcsrc/server/campaign.qc b/qcsrc/server/campaign.qc index 1a8db10af..816f71bf9 100644 --- a/qcsrc/server/campaign.qc +++ b/qcsrc/server/campaign.qc @@ -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; diff --git a/qcsrc/server/cheats.qh b/qcsrc/server/cheats.qh index cb365a3ba..8c276919c 100644 --- a/qcsrc/server/cheats.qh +++ b/qcsrc/server/cheats.qh @@ -1,3 +1,5 @@ +float autocvar_sv_cheats; // must... declare... global + float cheatcount_total; .float cheatcount; void CheatInit(); diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index a1a8c4f90..0183f2dbd 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -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) diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index fd5b445eb..52f756ea7 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -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; } diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index 9a3c3614a..27d7a69c7 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -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); diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index cb74c8d3a..a5b33acf7 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -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; diff --git a/qcsrc/server/monsters/ai.qc b/qcsrc/server/monsters/ai.qc index 23330cdfc..022fde201 100644 --- a/qcsrc/server/monsters/ai.qc +++ b/qcsrc/server/monsters/ai.qc @@ -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 }; diff --git a/qcsrc/server/monsters/defs.qc b/qcsrc/server/monsters/defs.qc index 1a43fc78e..19821429c 100644 --- a/qcsrc/server/monsters/defs.qc +++ b/qcsrc/server/monsters/defs.qc @@ -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; diff --git a/qcsrc/server/monsters/mode_management.qc b/qcsrc/server/monsters/mode_management.qc index 9f3770ff2..5b7d80fac 100644 --- a/qcsrc/server/monsters/mode_management.qc +++ b/qcsrc/server/monsters/mode_management.qc @@ -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); } diff --git a/qcsrc/server/mutators/gamemode_keyhunt.qc b/qcsrc/server/mutators/gamemode_keyhunt.qc index ca2865a21..54be69cb1 100644 --- a/qcsrc/server/mutators/gamemode_keyhunt.qc +++ b/qcsrc/server/mutators/gamemode_keyhunt.qc @@ -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 diff --git a/qcsrc/server/teamplay.qc b/qcsrc/server/teamplay.qc index 7df082c87..262b5e98b 100644 --- a/qcsrc/server/teamplay.qc +++ b/qcsrc/server/teamplay.qc @@ -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; diff --git a/qcsrc/server/vote.qc b/qcsrc/server/vote.qc index 1fbdecad9..adc037c83 100644 --- a/qcsrc/server/vote.qc +++ b/qcsrc/server/vote.qc @@ -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")); } diff --git a/qcsrc/server/w_campingrifle.qc b/qcsrc/server/w_campingrifle.qc index 309717305..1347fc88c 100644 --- a/qcsrc/server/w_campingrifle.qc +++ b/qcsrc/server/w_campingrifle.qc @@ -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; } diff --git a/qcsrc/server/w_rocketlauncher.qc b/qcsrc/server/w_rocketlauncher.qc index b42a44828..cbc458f5b 100644 --- a/qcsrc/server/w_rocketlauncher.qc +++ b/qcsrc/server/w_rocketlauncher.qc @@ -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;