From: Mario Date: Tue, 24 Dec 2019 12:39:27 +0000 (+1000) Subject: Rename teamnumber to teamnum in some function parameters, so that it may be used... X-Git-Tag: xonotic-v0.8.5~1199 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=commitdiff_plain;h=178a9d14d5c5a141cb1947bc5df599090357ebda Rename teamnumber to teamnum in some function parameters, so that it may be used elsewhere later --- diff --git a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc index 8ce4d6f31..aa05ea337 100644 --- a/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc +++ b/qcsrc/common/gamemodes/gamemode/ctf/sv_ctf.qc @@ -1235,7 +1235,7 @@ void ctf_DelayedFlagSetup(entity this) // called after a flag is placed on a map .bool pushable; -void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag entity on the map as a spawnfunc +void ctf_FlagSetup(int teamnum, entity flag) // called when spawning a flag entity on the map as a spawnfunc { // main setup flag.ctf_worldflagnext = ctf_worldflaglist; // link flag into ctf_worldflaglist @@ -1243,8 +1243,8 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e setattachment(flag, NULL, ""); - flag.netname = strzone(sprintf("%s%s^7 flag", Team_ColorCode(teamnumber), Team_ColorName_Upper(teamnumber))); - flag.team = teamnumber; + flag.netname = strzone(sprintf("%s%s^7 flag", Team_ColorCode(teamnum), Team_ColorName_Upper(teamnum))); + flag.team = teamnum; flag.classname = "item_flag_team"; flag.target = "###item###"; // for finding the nearest item using findnearest flag.flags = FL_ITEM | FL_NOTARGET; @@ -1274,24 +1274,24 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e if(autocvar_g_ctf_score_ignore_fields) flag.cnt = flag.score_assist = flag.score_team_capture = flag.score_capture = flag.score_drop = flag.score_pickup = flag.score_return = 0; - string teamname = Static_Team_ColorName_Lower(teamnumber); + string teamname = Static_Team_ColorName_Lower(teamnum); // appearence if(!flag.scale) { flag.scale = FLAG_SCALE; } if(flag.skin == 0) { flag.skin = cvar(sprintf("g_ctf_flag_%s_skin", teamname)); } if(flag.model == "") { flag.model = cvar_string(sprintf("g_ctf_flag_%s_model", teamname)); } - if (flag.toucheffect == "") { flag.toucheffect = EFFECT_FLAG_TOUCH(teamnumber).eent_eff_name; } - if (flag.passeffect == "") { flag.passeffect = EFFECT_PASS(teamnumber).eent_eff_name; } - if (flag.capeffect == "") { flag.capeffect = EFFECT_CAP(teamnumber).eent_eff_name; } + if (flag.toucheffect == "") { flag.toucheffect = EFFECT_FLAG_TOUCH(teamnum).eent_eff_name; } + if (flag.passeffect == "") { flag.passeffect = EFFECT_PASS(teamnum).eent_eff_name; } + if (flag.capeffect == "") { flag.capeffect = EFFECT_CAP(teamnum).eent_eff_name; } // sounds #define X(s,b) \ if(flag.s == "") flag.s = b; \ precache_sound(flag.s); - X(snd_flag_taken, strzone(SND(CTF_TAKEN(teamnumber)))) - X(snd_flag_returned, strzone(SND(CTF_RETURNED(teamnumber)))) - X(snd_flag_capture, strzone(SND(CTF_CAPTURE(teamnumber)))) - X(snd_flag_dropped, strzone(SND(CTF_DROPPED(teamnumber)))) + X(snd_flag_taken, strzone(SND(CTF_TAKEN(teamnum)))) + X(snd_flag_returned, strzone(SND(CTF_RETURNED(teamnum)))) + X(snd_flag_capture, strzone(SND(CTF_CAPTURE(teamnum)))) + X(snd_flag_dropped, strzone(SND(CTF_DROPPED(teamnum)))) X(snd_flag_respawn, strzone(SND(CTF_RESPAWN))) X(snd_flag_touch, strzone(SND(CTF_TOUCH))) X(snd_flag_pass, strzone(SND(CTF_PASS))) @@ -1309,7 +1309,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e if(autocvar_g_ctf_flag_glowtrails) { - switch(teamnumber) + switch(teamnum) { case NUM_TEAM_1: flag.glow_color = 251; break; case NUM_TEAM_2: flag.glow_color = 210; break; @@ -1325,7 +1325,7 @@ void ctf_FlagSetup(int teamnumber, entity flag) // called when spawning a flag e if(autocvar_g_ctf_fullbrightflags) { flag.effects |= EF_FULLBRIGHT; } if(autocvar_g_ctf_dynamiclights) { - switch(teamnumber) + switch(teamnum) { case NUM_TEAM_1: flag.effects |= EF_RED; break; case NUM_TEAM_2: flag.effects |= EF_BLUE; break; diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc index 6f12f3cc0..9675634ec 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qc @@ -313,15 +313,15 @@ void ons_DelayedLinkSetup(entity this) // Main Control Point Functions // ============================= -int ons_ControlPoint_CanBeLinked(entity cp, int teamnumber) +int ons_ControlPoint_CanBeLinked(entity cp, int teamnum) { - if(cp.aregensneighbor & BIT(teamnumber)) return 2; - if(cp.arecpsneighbor & BIT(teamnumber)) return 1; + if(cp.aregensneighbor & BIT(teamnum)) return 2; + if(cp.arecpsneighbor & BIT(teamnum)) return 1; return 0; } -int ons_ControlPoint_Attackable(entity cp, int teamnumber) +int ons_ControlPoint_Attackable(entity cp, int teamnum) // -2: SAME TEAM, attackable by enemy! // -1: SAME TEAM! // 0: off limits @@ -339,16 +339,16 @@ int ons_ControlPoint_Attackable(entity cp, int teamnumber) else if(cp.goalentity) { // if there's already an icon built, nothing happens - if(cp.team == teamnumber) + if(cp.team == teamnum) { - a = ons_ControlPoint_CanBeLinked(cp, teamnumber); + a = ons_ControlPoint_CanBeLinked(cp, teamnum); if(a) // attackable by enemy? return -2; // EMERGENCY! return -1; } // we know it can be linked, so no need to check // but... - a = ons_ControlPoint_CanBeLinked(cp, teamnumber); + a = ons_ControlPoint_CanBeLinked(cp, teamnum); if(a == 2) // near our generator? return 3; // EMERGENCY! return 1; @@ -356,9 +356,9 @@ int ons_ControlPoint_Attackable(entity cp, int teamnumber) else { // free point - if(ons_ControlPoint_CanBeLinked(cp, teamnumber)) + if(ons_ControlPoint_CanBeLinked(cp, teamnum)) { - a = ons_ControlPoint_CanBeLinked(cp, teamnumber); // why was this here NUM_TEAM_1 + NUM_TEAM_2 - t + a = ons_ControlPoint_CanBeLinked(cp, teamnum); // why was this here NUM_TEAM_1 + NUM_TEAM_2 - t if(a == 2) return 4; // GET THIS ONE NOW! else @@ -1063,16 +1063,16 @@ void onslaught_generator_touch(entity this, entity toucher) void ons_GeneratorSetup(entity gen) // called when spawning a generator entity on the map as a spawnfunc { // declarations - int teamnumber = gen.team; + int teamnum = gen.team; // main setup gen.ons_worldgeneratornext = ons_worldgeneratorlist; // link generator into ons_worldgeneratorlist ons_worldgeneratorlist = gen; - gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnumber)); + gen.netname = sprintf("%s generator", Team_ColoredFullName(teamnum)); gen.classname = "onslaught_generator"; gen.solid = SOLID_BBOX; - gen.team_saved = teamnumber; + gen.team_saved = teamnum; IL_PUSH(g_saved_team, gen); set_movetype(gen, MOVETYPE_NONE); gen.lasthealth = gen.max_health = autocvar_g_onslaught_gen_health; @@ -1094,7 +1094,7 @@ void ons_GeneratorSetup(entity gen) // called when spawning a generator entity o // model handled by CSQC setsize(gen, GENERATOR_MIN, GENERATOR_MAX); setorigin(gen, (gen.origin + CPGEN_SPAWN_OFFSET)); - gen.colormap = 1024 + (teamnumber - 1) * 17; + gen.colormap = 1024 + (teamnum - 1) * 17; // generator placement droptofloor(gen); diff --git a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh index 7a9b192a5..0800ae10f 100644 --- a/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh +++ b/qcsrc/common/gamemodes/gamemode/onslaught/sv_onslaught.qh @@ -67,7 +67,7 @@ float ons_notification_time[17]; // declarations for functions used outside gamemode_onslaught.qc void ons_Generator_UpdateSprite(entity e); void ons_ControlPoint_UpdateSprite(entity e); -bool ons_ControlPoint_Attackable(entity cp, int teamnumber); +bool ons_ControlPoint_Attackable(entity cp, int teamnum); // CaptureShield: Prevent capturing or destroying control point/generator if it is not available yet float ons_captureshield_force; // push force of the shield