diff --git a/BUGS b/BUGS index b4a1514..983caf3 100644 --- a/BUGS +++ b/BUGS @@ -3,3 +3,4 @@ - the curse color is rejected by the color changing code - the map cycler (including if you set nmap) just sit there if it doesn't change map. instead, it should have failsafe behavior - "has_sentry" should be a counter, not a flag (allows a second build if you hack and it gets roasted) +- there appears to be a window between when a teamkill curse respawn is disabled and when they're killed. it should be removed. diff --git a/admin.qc b/admin.qc index 1dc66e8..503f8ef 100644 --- a/admin.qc +++ b/admin.qc @@ -304,7 +304,7 @@ void() Admin_Cmd = } else if (st == "team1" || st == "team2" || st == "team3" || st == "team4") { - local float targetteam, tc; + local float targetteam, tc, tc2; local string st2; if (st == "team1") @@ -371,16 +371,10 @@ void() Admin_Cmd = DetonateAllGuns(); self = oself; - // Set the player's color - stuffcmd(self.admin_kick, "color "); - tc = TeamGetColor(targetteam) - 1; - st2 = ftos(tc); - - //- OfN - Nice colors - if (nicecolors==1) st2 =TeamGetNiceColor(targetteam); - - stuffcmd(self.admin_kick, st2); - stuffcmd(self.admin_kick, "\n"); + // Set the player's color + tc = TeamGetColor (targetteam) - 1; + tc2 = TeamGetNiceColor (targetteam); + SetPlayerColor (self, tc, tc2); self.admin_kick.team_no = targetteam; makeImmune(self.admin_kick,time+15); diff --git a/army.qc b/army.qc index b99f042..d8d12f3 100644 --- a/army.qc +++ b/army.qc @@ -22,10 +22,12 @@ $frame stand10 stand11 stand12 stand13 void() JobArmy = { if (self.current_menu == MENU_ARMY && self.job & JOB_DEMON_OUT) - { - if (self.demon_one.is_haxxxoring == 0) self.demon_one.is_haxxxoring = 1; - else self.demon_one.is_haxxxoring = 0; - } + { + if (self.demon_one.is_haxxxoring == 0) + self.demon_one.is_haxxxoring = 1; + else + self.demon_one.is_haxxxoring = 0; + } self.current_menu = MENU_ARMY; self.menu_count = MENU_REFRESH_RATE; @@ -293,6 +295,7 @@ void(float inp) Menu_Army_Input2 = { ResetMenu(); self.impulse = 0; + self.demon_one.is_haxxxoring = 0; // go back to first menu return; } diff --git a/custom.qc b/custom.qc index 46e9ad7..424e632 100644 --- a/custom.qc +++ b/custom.qc @@ -63,7 +63,7 @@ void(entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer; //- OfN void(entity mine_owner) DetonateMines; //external, job.qc -string (float tno) TeamGetNiceColor; +float (float tno) TeamGetNiceColor; void() SetArmyTimer; void() RemoveArmyTimer; entity() SelectSpawnPoint; @@ -1213,6 +1213,7 @@ void() BastardTimer = { local entity te; local string st; + local float tc, tc2; te = self.owner; //makeImmune(te,time+5); @@ -1224,15 +1225,10 @@ void() BastardTimer = //stuffcmd(te, te.old_netname); //stuffcmd(te, "\"\n"); - //Reset their color - stuffcmd(te, "color "); - st = ftos(TeamGetColor(te.team_no) - 1); - - //- OfN - Nice colors - if (nicecolors==1) st =TeamGetNiceColor(te.team_no); - - stuffcmd(te, st); - stuffcmd(te, "\n"); + // Reset their color + tc = TeamGetColor (te.team_no) - 1; + tc2 = TeamGetNiceColor (te.team_no); + SetPlayerColor (te, tc, tc2); bprint (PRINT_MEDIUM, te.netname); bprint (PRINT_MEDIUM, " has his teamkill curse removed\n"); @@ -1247,10 +1243,16 @@ void() BastardTimer = return; } - if (random() > 0.5) - stuffcmd(te, "cl_yawspeed 500;-left;+right;color 8 8\n"); + if (random() > 0.5) + { + stuffcmd(te, "cl_yawspeed 500;-left;+right\n"); + SetPlayerColor (te, 8, 8); + } else - stuffcmd(te, "cl_yawspeed 500;-right;+left;color 9 9\n"); + { + stuffcmd(te, "cl_yawspeed 500;-right;+left\n"); + SetPlayerColor (te, 9, 9); + } //te.immune_to_check = time + 5; te.ammo_rockets = 0; te.ammo_cells = 0; @@ -1258,8 +1260,8 @@ void() BastardTimer = te.ammo_shells = 0; te.ammo_detpack = 0; te.ammo_c4det = 0; - te.no_grenades_1 = 0; - te.no_grenades_2 = 0; + te.no_grenades_1 = 0; + te.no_grenades_2 = 0; if (te.health > 50) te.health = 50; if (te.armorvalue > 10) te.armorvalue = 10; diff --git a/defs.qc b/defs.qc index 99bcf4b..2cdc77c 100644 --- a/defs.qc +++ b/defs.qc @@ -652,6 +652,11 @@ float (entity e, float healamount, float ignore) T_Heal; // health function float(entity targ, entity inflictor) CanDamage; +// +// tforttm.qc +// +void (entity pl, float topcolor, float bottomcolor) SetPlayerColor; + //=========================================================================== // TEAMFORTRESS Defs diff --git a/often.qc b/often.qc index 81f5217..3d5ceea 100644 --- a/often.qc +++ b/often.qc @@ -300,7 +300,7 @@ float (string skin_str) Is_TF_Skin = // Return the new "NICE" color for the team corresponding to the no passed in // //============================================================================// -string (float tno) TeamGetNiceColor = +/*string (float tno) TeamGetNiceColor = { if (tno == 1) return "2 13"; @@ -313,6 +313,33 @@ string (float tno) TeamGetNiceColor = return ""; }; +*/ +float (float tno) TeamGetNiceColor = +{ + if (nicecolors == 1) + { + if (tno == 1) + return 2; + if (tno == 2) + return 9; + if (tno == 3) + return 5; + if (tno == 4) + return 3; + } + else + { + if (tno == 1) + return 13; + if (tno == 2) + return 4; + if (tno == 3) + return 12; + if (tno == 4) + return 11; + } + return 0; +}; float (float tno, float theColor ) IsValidTopColor = { diff --git a/spy.qc b/spy.qc index 10d8a70..7085dcc 100644 --- a/spy.qc +++ b/spy.qc @@ -510,7 +510,7 @@ void(entity spy) TeamFortress_SpyCalcName = // Make the spy who owns this timer undercover, and then remove itself void() TeamFortress_SpyUndercoverThink = { - local float tc; + local float tc, tc2; local string st; if (!(self.owner.cutf_items & CUTF_SPY_KIT)) //WK @@ -549,16 +549,10 @@ void() TeamFortress_SpyUndercoverThink = sprint(self.owner, PRINT_HIGH, "\n"); self.owner.undercover_team = self.team; - // Set their color - stuffcmd(self.owner, "color "); - tc = TeamGetColor(self.team) - 1; - - st = ftos(tc); - //- OfN - Nice colors //? team_no - if (nicecolors==1) st =TeamGetNiceColor(self.team); - - stuffcmd(self.owner, st); - stuffcmd(self.owner, "\n"); + // Set their color + tc = TeamGetColor (self.team) - 1; + tc2 = TeamGetNiceColor (self.team); + SetPlayerColor (self.owner, tc, tc2); } TeamFortress_SpyCalcName(self.owner); @@ -618,7 +612,7 @@ void(float teamno) TeamFortress_SpyChangeColor = { local entity te; local string st; - local float tc; + local float tc, tc2; // If they're returning their color to their own team, just reset it if (teamno == self.team_no) @@ -628,15 +622,9 @@ void(float teamno) TeamFortress_SpyChangeColor = makeImmune(self,time + 4); //self.immune_to_check = time + 4; self.undercover_team = 0; - stuffcmd(self, "color "); - tc = TeamGetColor(self.team_no) - 1; - st = ftos(tc); - - //- OfN - Nice colors - if (nicecolors==1) st =TeamGetNiceColor(self.team_no); - - stuffcmd(self, st); - stuffcmd(self, "\n"); + tc = TeamGetColor (self.team_no) - 1; + tc2 = TeamGetNiceColor (self.team_no); + SetPlayerColor (self, tc, tc2); if (self.undercover_skin == 0) { @@ -1072,7 +1060,7 @@ void() TranquiliserTimer2 = void(entity spy) Spy_RemoveDisguise = { local string st; - local float tc; + local float tc, tc2; local float reset; if (invis_only != TRUE) @@ -1098,16 +1086,9 @@ void(entity spy) Spy_RemoveDisguise = //spy.immune_to_check = time + 4; spy.undercover_team = 0; - stuffcmd(spy, "color "); - tc = TeamGetColor(spy.team_no) - 1; - - st = ftos(tc); - - //- OfN - Nice colors - if (nicecolors==1) st =TeamGetNiceColor(spy.team_no); - - stuffcmd(spy, st); - stuffcmd(spy, "\n"); + tc = TeamGetColor (spy.team_no) - 1; + tc2 = TeamGetNiceColor (spy.team_no); + SetPlayerColor (spy, tc, tc2); } spy.is_undercover = 0; diff --git a/tfort.qc b/tfort.qc index 7f66b6c..374bc39 100644 --- a/tfort.qc +++ b/tfort.qc @@ -1852,6 +1852,7 @@ void() TeamFortress_SetEquipment = local entity automan; local string st; local float kept_items; + local float tc, tc2; if (self.classname != "player") return; @@ -1920,13 +1921,9 @@ void() TeamFortress_SetEquipment = self.undercover_team = 0; // Set their color - stuffcmd(self, "color "); - st = ftos(TeamGetColor(self.team_no) - 1); - //- OfN - Nice colors - if (nicecolors==1) st =TeamGetNiceColor(self.team_no); - - stuffcmd(self, st); - stuffcmd(self, "\n"); + tc = TeamGetColor (self.team_no) - 1; + tc2 = TeamGetNiceColor (self.team_no); + SetPlayerColor (self, tc, tc); } self.is_building = 0; @@ -3966,7 +3963,8 @@ void() PlayerObserverMode = sprint (self, PRINT_HIGH, "Observer mode\n"); CenterPrint(self, "\n"); - stuffcmd(self, "color 0; wait; cl_rollangle 0\n"); + SetPlayerColor (self, 0, 0); + stuffcmd(self, "cl_rollangle 0\n"); // FIXME: does this need a wait? }; //============================================================================ diff --git a/tforthlp.qc b/tforthlp.qc index 6c759f5..98c47f0 100644 --- a/tforthlp.qc +++ b/tforthlp.qc @@ -67,12 +67,7 @@ void() TeamFortress_MOTD = // Set their color to white, so they stand out from teams if ((teamplay != 0) && (self.team_no == 0)) - { - stuffcmd(self, "color "); - ya = ftos(WHITE - 1); - stuffcmd(self, ya); - stuffcmd(self, "\n"); - } + SetPlayerColor (self, WHITE - 1, WHITE - 1); /* if (self.got_aliases == FALSE) sprint(self, PRINT_HIGH, "\n\n\n");*/ diff --git a/tforttm.qc b/tforttm.qc index d969162..43df74f 100644 --- a/tforttm.qc +++ b/tforttm.qc @@ -221,7 +221,7 @@ void(entity p) SetTeamName = float(float tno) TeamFortress_TeamSet = { local string st; - local float tc; + local float tc, tc2; if (teamplay < 1) { @@ -297,22 +297,9 @@ float(float tno) TeamFortress_TeamSet = // color command works. makeImmune(self,time+10); //self.immune_to_check = time + 10; -// FOO - tc = TeamGetColor(tno) - 1; - st = ftos(tc); - setinfokey(self, "color", st); -/* - // Set the player's color - stuffcmd(self, "color "); - tc = TeamGetColor(tno) - 1; - st = ftos(tc); - - //- OfN - Nice colors - if (nicecolors==1) st =TeamGetNiceColor(tno); - - stuffcmd(self, st); - stuffcmd(self, "\n"); -*/ + tc = TeamGetColor (tno) - 1; + tc2 = TeamGetNiceColor (tno); + SetPlayerColor (self, tc, tc2); self.team_no = tno; self.lives = TeamFortress_TeamGetLives(tno); @@ -340,22 +327,9 @@ float(float tno) TeamFortress_TeamSet = bprint(PRINT_HIGH, st); bprint(PRINT_HIGH, ".\n"); -//FOO - tc = TeamGetColor(tno) - 1; - st = ftos(tc); - setinfokey(self, "topcolor", st); - setinfokey(self, "bottomcolor", st); - - // Set the player's color - stuffcmd(self, "color "); - tc = TeamGetColor(tno) - 1; - st = ftos(tc); - - //- OfN - Nice colors - if (nicecolors==1) st =TeamGetNiceColor(tno); - - stuffcmd(self, st); - stuffcmd(self, "\n"); + tc = TeamGetColor (tno) - 1; + tc2 = TeamGetNiceColor (tno); + SetPlayerColor (self, tc, tc2); self.team_no = tno; // Prevent the cheatchecking mechanism from nabbing them b4 the @@ -402,7 +376,7 @@ float(float tno) TeamFortress_TeamSet = void() TeamFortress_CheckTeamCheats = { local string st, sk; - local float tc; + local float tc, tc2; local float rate; if (self.immune_to_chec > time) @@ -448,19 +422,10 @@ void() TeamFortress_CheckTeamCheats = //if ((TeamGetColor(self.undercover_team) != self.team) || !IsValidTopColor(self.undercover_team,tTopColor)) // || !IsValidTopColor(self.undercover_team,tTopColor) { - // Set their color - stuffcmd(self, "color "); - tc = TeamGetColor(self.undercover_team) - 1; - - st = ftos(tc); - - //- OfN - Nice colors - if (nicecolors==1) st =TeamGetNiceColor(self.undercover_team); - - stuffcmd(self, st); - stuffcmd(self, "\n"); - setinfokey(self, "topcolor", st); - setinfokey(self, "bottomcolor", st); + // Set their color + tc = TeamGetColor (self.undercover_team) - 1; + tc2 = TeamGetNiceColor (self.undercover_team); + SetPlayerColor (self, tc, tc2); // bprint2(PRINT_MEDIUM, self.netname, " has been kicked for changing color.\n"); // sprint(self, PRINT_HIGH, "You have been kicked for changing your color. Don't do it.\n"); @@ -470,18 +435,9 @@ void() TeamFortress_CheckTeamCheats = } else if (TeamGetColor(self.team_no) != self.team) { - // Set their color - stuffcmd(self, "color "); - tc = TeamGetColor(self.team_no) - 1; - st = ftos(tc); - - //- OfN - Nice colors - if (nicecolors==1) st =TeamGetNiceColor(self.team_no); - - stuffcmd(self, st); - stuffcmd(self, "\n"); - setinfokey(self, "topcolor", st); - setinfokey(self, "bottomcolor", st); + tc = TeamGetColor (self.team_no) - 1; + tc2 = TeamGetNiceColor (self.team_no); + SetPlayerColor (self, tc, tc2); // bprint2(PRINT_MEDIUM, self.netname, " has been kicked for changing color.\n"); // sprint(self, PRINT_HIGH, "You have been kicked for changing your color. Don't do it.\n"); @@ -502,18 +458,9 @@ void() TeamFortress_CheckTeamCheats = RPrint(" had his colors reset.\n"); #endif - // Set the player's color - stuffcmd(self, "color "); - tc = TeamGetColor(self.undercover_team) - 1; - st = ftos(tc); - - //- OfN - Nice colors - if (nicecolors==1) st =TeamGetNiceColor(self.undercover_team); - - stuffcmd(self, st); - stuffcmd(self, "\n"); - setinfokey(self, "topcolor", st); - setinfokey(self, "bottomcolor", st); + tc = TeamGetColor (self.undercover_team) - 1; + tc2 = TeamGetNiceColor (self.undercover_team); + SetPlayerColor (self, tc, tc2); // bprint2(PRINT_MEDIUM, self.netname, " has been kicked for changing color.\n"); // sprint(self, PRINT_HIGH, "You have been kicked for changing your color. Don't do it.\n"); @@ -528,18 +475,9 @@ void() TeamFortress_CheckTeamCheats = RPrint(" had his colors reset.\n"); #endif - // Set the player's color - stuffcmd(self, "color "); - tc = TeamGetColor(self.team_no) - 1; - st = ftos(tc); - - //- OfN - Nice colors - if (nicecolors==1) st =TeamGetNiceColor(self.team_no); - - stuffcmd(self, st); - stuffcmd(self, "\n"); - setinfokey(self, "topcolor", st); - setinfokey(self, "bottomcolor", st); + tc = TeamGetColor (self.team_no) - 1; + tc2 = TeamGetNiceColor (self.team_no); + SetPlayerColor (self, tc, tc2); // bprint2(PRINT_MEDIUM, self.netname, " has been kicked for changing color.\n"); // sprint(self, PRINT_HIGH, "You have been kicked for changing your color. Don't do it.\n"); @@ -648,6 +586,22 @@ void() TeamFortress_CheckTeamCheats = } }; +void (entity pl, float topcolor, float bottomcolor) SetPlayerColor = +{ + local string top; + local string bottom; + + top = ftos (topcolor); + bottom = ftos (bottomcolor); + + setinfokey (pl, "topcolor", top); + setinfokey (pl, "bottomcolor", bottom); + + stuffcmd (pl, "topcolor " + top + "\n"); + stuffcmd (pl, "bottomcolor " + bottom + "\n"); +// stuffcmd (pl, "color " + top + " " + bottom + "\n"); +}; + float(string key, string value) UserInfoCallback = { local string oldval; @@ -656,21 +610,25 @@ float(string key, string value) UserInfoCallback = if(value == oldval) // generic reject { - //bprint(PRINT_MEDIUM, - // "[oldval (" + key + ")(" + value + ")(" + oldval + ")]\n"); +// dprint ("[oldval [" + self.netname + "](" + key + ")(" + value + ")(" + oldval + ")]\n"); return 0; // rejected! } - if (key == "topcolor" || key == "bottomcolor") + if (key == "topcolor") { // no changing colors allowed - st = infokey(self, "bottomcolor"); // make sure top is same as bottom + st = infokey(self, "topcolor"); setinfokey(self, "topcolor", st); - stuffcmd(self, "color "); - stuffcmd(self, st); - stuffcmd(self, "\n"); - //bprint(PRINT_MEDIUM, - // "[color (" + key + ")(" + value + ")(" + oldval + ")]\n"); + stuffcmd(self, "color " + st + "\n"); +// dprint ("[topcolor [" + self.netname + "](" + key + ")(" + value + ")(" + oldval + ")]\n"); + return 0; + } + if (key == "bottomcolor") + { + st = infokey (self, "bottomcolor"); + setinfokey (self, "bottomcolor", st); + stuffcmd (self, "bottomcolor " + st + "\n"); +// dprint ("[bottomcolor [" + self.netname + "](" + key + ")(" + value + ")(" + oldval + ")]\n"); return 0; } else if (key == "skin") @@ -678,14 +636,12 @@ float(string key, string value) UserInfoCallback = stuffcmd(self, "skin "); stuffcmd(self, oldval); stuffcmd(self, "\n"); - //bprint(PRINT_MEDIUM, - // "[skin (" + key + ")(" + value + ")(" + oldval + ")]\n"); +// dprint ("[skin [" + self.netname + "](" + key + ")(" + value + ")(" + oldval + ")]\n"); return 0; } else { - //bprint(PRINT_MEDIUM, - // "[default (" + key + ")(" + value + ")(" + oldval + ")]\n"); +// dprint ("[default [" + self.netname + "](" + key + ")(" + value + ")(" + oldval + ")]\n"); return 1; // accept everything else } };