From f79be2fe0131820da15bd45434df982edeb4ae50 Mon Sep 17 00:00:00 2001 From: avirox Date: Wed, 11 Jan 2006 15:31:47 +0000 Subject: [PATCH] - Spring cleaning! Cleaned up a lot of FTE warnings regarding unused locals - Added DropFlag function - Alias "dropflag" or "impulse 203" to access DropFlag function in-game. git-svn-id: svn://svn.icculus.org/nexuiz/trunk@809 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- TeamNexuiz/game/gamec/GameC.dsp | 4 ++ TeamNexuiz/game/gamec/cl_client.c | 2 +- TeamNexuiz/game/gamec/cl_impulse.c | 6 ++ TeamNexuiz/game/gamec/ctf.c | 4 +- TeamNexuiz/game/gamec/engineer.c | 8 +-- TeamNexuiz/game/gamec/g_triggers.c | 4 +- TeamNexuiz/game/gamec/tfcombat.c | 9 +-- TeamNexuiz/game/gamec/tfdefs.c | 9 ++- TeamNexuiz/game/gamec/tffunctions.c | 93 ++++++++++++++++++++++++----- TeamNexuiz/game/gamec/tfgrenades.c | 10 +--- TeamNexuiz/game/gamec/tfmapitems.c | 2 - TeamNexuiz/game/gamec/tfmenus.c | 1 - TeamNexuiz/game/gamec/tfplats.c | 3 - TeamNexuiz/game/gamec/w_common.c | 2 - TeamNexuiz/game/gamec/w_healgun.c | 1 - 15 files changed, 106 insertions(+), 52 deletions(-) diff --git a/TeamNexuiz/game/gamec/GameC.dsp b/TeamNexuiz/game/gamec/GameC.dsp index d5fcddee8..8648ffe1b 100644 --- a/TeamNexuiz/game/gamec/GameC.dsp +++ b/TeamNexuiz/game/gamec/GameC.dsp @@ -451,6 +451,10 @@ SOURCE=.\tfdefs.c SOURCE=.\tffunctions.c # End Source File +# Begin Source File + +SOURCE=.\tfmenus.c +# End Source File # End Group # Begin Group "TF Client" diff --git a/TeamNexuiz/game/gamec/cl_client.c b/TeamNexuiz/game/gamec/cl_client.c index 1badb65c0..24547a55f 100644 --- a/TeamNexuiz/game/gamec/cl_client.c +++ b/TeamNexuiz/game/gamec/cl_client.c @@ -1193,7 +1193,7 @@ void PlayerPostThink (void) void SV_ParseClientCommand (string s) { local float args; - local float h; +// local float h; local string c; local string d; local string f; diff --git a/TeamNexuiz/game/gamec/cl_impulse.c b/TeamNexuiz/game/gamec/cl_impulse.c index 030e528fe..efc176295 100644 --- a/TeamNexuiz/game/gamec/cl_impulse.c +++ b/TeamNexuiz/game/gamec/cl_impulse.c @@ -1,4 +1,5 @@ void CopyBody(float keepvelocity); +void () DropFlag; // changes by LordHavoc on 03/30/04 // cleaned up dummy code @@ -39,6 +40,11 @@ void ImpulseCommands (void) self.impulse_wait = time + .5; return; } + if (self.impulse == DROP_FLAG_IMPULSE) + { + DropFlag(); + } + if (self.impulse == 71) { local string whee; diff --git a/TeamNexuiz/game/gamec/ctf.c b/TeamNexuiz/game/gamec/ctf.c index 1e3a8f4b4..9ef05c86c 100644 --- a/TeamNexuiz/game/gamec/ctf.c +++ b/TeamNexuiz/game/gamec/ctf.c @@ -59,7 +59,7 @@ void(entity e) ReturnFlag = RegenFlag(e); }; -void(entity e) DropFlag = +/*void(entity e) DropFlag = // Gold - using TF function for this one :x { local entity p; @@ -91,7 +91,7 @@ void(entity e) DropFlag = e.cnt = FLAG_DROPPED; e.velocity = '0 0 300'; e.pain_finished = time + 30; -}; +};*/ void() FlagThink = { diff --git a/TeamNexuiz/game/gamec/engineer.c b/TeamNexuiz/game/gamec/engineer.c index ac25ca93f..7177c75dd 100644 --- a/TeamNexuiz/game/gamec/engineer.c +++ b/TeamNexuiz/game/gamec/engineer.c @@ -1,4 +1,4 @@ -.float option, opton5; +.float option; .float has_mine; void () MagnetMineTouch; void () MagTimer; @@ -9,7 +9,7 @@ void () Tesla_Pain; void () Tesla_Idle; void () Tesla_Touch; -void () SUB_NULL; +void() SUB_NULL = {}; //temp void (entity bld) CheckBelowBuilding; @@ -166,7 +166,6 @@ void(float objtobuild) TeamFortress_Build = } local float btime; - local entity te; local vector tmp1; local vector tmp2; newmis = spawn(); @@ -298,7 +297,6 @@ void () Tesla_Animate; void() TeamFortress_FinishedBuilding = { local entity oldself; - local vector source; if (self.owner.is_building != 1) { @@ -872,8 +870,6 @@ void () Use_Function = local vector source; local vector org; - local vector def; - local float healam; local entity te; makevectors (self.v_angle); diff --git a/TeamNexuiz/game/gamec/g_triggers.c b/TeamNexuiz/game/gamec/g_triggers.c index 833bd1f96..88d9b556a 100644 --- a/TeamNexuiz/game/gamec/g_triggers.c +++ b/TeamNexuiz/game/gamec/g_triggers.c @@ -390,8 +390,8 @@ void() trigger_counter = self.use = counter_use; }; -.float triggerhurttime; -/*void() hurt_touch = +/*.float triggerhurttime; +void() hurt_touch = { if (other.takedamage) if (other.triggerhurttime < time) diff --git a/TeamNexuiz/game/gamec/tfcombat.c b/TeamNexuiz/game/gamec/tfcombat.c index e23f27e5c..8dcb0ed4d 100644 --- a/TeamNexuiz/game/gamec/tfcombat.c +++ b/TeamNexuiz/game/gamec/tfcombat.c @@ -1,9 +1,8 @@ -void () T_MissileTouch; void () info_player_start; void (entity targ, entity attacker) ClientObituary; void (entity Goal, entity AP, float addb) DoResults; float (entity Goal, entity AP) Activated; -float (entity targ, entity attacker, float damage) TeamEqualiseDamage; +float (entity targ, entity attacker, float damage) TeamEqualiseDamage; // TBA Add function for this // Death MSG Caller float deathmsg; // Gonna have to make this work with NexTF's @@ -33,10 +32,6 @@ float is_ally (entity targ, entity attacker) { // COMBAT void () monster_death_use = { - local entity ent; - local entity otemp; - local entity stemp; - if ((self.flags & 1)) { self.flags = (self.flags - 1); @@ -99,7 +94,6 @@ float (entity targ, entity inflictor) CanDamage = void (entity targ, entity attacker) Killed = { local entity oself; - local string db; oself = self; self = targ; @@ -635,7 +629,6 @@ void (entity inflictor, entity attacker, float damage, entity ignore) T_RadiusDa { local float points; local entity head; - local entity te; local vector org; //// head = findradius (inflictor.origin, (damage + 40)); diff --git a/TeamNexuiz/game/gamec/tfdefs.c b/TeamNexuiz/game/gamec/tfdefs.c index 7e8fd18a9..cbd0f9e37 100644 --- a/TeamNexuiz/game/gamec/tfdefs.c +++ b/TeamNexuiz/game/gamec/tfdefs.c @@ -178,6 +178,7 @@ void (float classnum) SetMaxAmmoFor; /******************* Moved from:**************************/ //tffunctions .float nextpc; // for qued next player class -- we gonna use this? +.float DropFlagDelay; // next time player can drop a flag void (string halias, float himpulse1, float himpulse2) TeamFortress_Alias; string () ChooseRandomClass; @@ -212,6 +213,7 @@ void (entity inflictor, entity attacker, float damage, entity ignore) T_RadiusDa .float has_item_from_group; .float remove_item_group; .float return_item_no; +.entity tent; // player who touches flag (touch ent?) // tfplats .float height; @@ -291,4 +293,9 @@ void (float tno, entity ignore, string st) teamsprint; .float lives; // Amount of lives float toggleflags; .float is_unabletospy; // picking up tfgoal makes the spy unable to go undercover -.float owned_by; // Item is owned by team # \ No newline at end of file +.float owned_by; // Item is owned by team # + +/***************** Impulse Defs **********************/ +/////////////////////////////////////////////////////// +/*****************************************************/ +float DROP_FLAG_IMPULSE = 203; \ No newline at end of file diff --git a/TeamNexuiz/game/gamec/tffunctions.c b/TeamNexuiz/game/gamec/tffunctions.c index 8ebd5929f..269dfb718 100644 --- a/TeamNexuiz/game/gamec/tffunctions.c +++ b/TeamNexuiz/game/gamec/tffunctions.c @@ -16,7 +16,7 @@ entity newmis; // This is what tf uses for spawning entities .float has_disconnected; //has the player disconnected? .float no_grenades_1; .float no_grenades_2; -.float no_grenades_3; +//.float no_grenades_3; //player has no gren3? Thought we should use this for the impulse 30/31 class specials .float pausetime; // not sure float team1lives; float team2lives; @@ -26,10 +26,10 @@ float team1maxplayers; float team2maxplayers; float team3maxplayers; float team4maxplayers; -float team1advantage; -float team2advantage; +/*float team1advantage; // might implement this later -- this is used in the function that +float team2advantage; //// displays messages like: "Team blah has an advantage of X players" float team3advantage; -float team4advantage; +float team4advantage;*/ // stuff that still needs a function float number_of_teams; // Number of teams == IMPORTANT @@ -81,6 +81,7 @@ void () DoTFAliases = TeamFortress_Alias("+gren2", 151, TF_FLARE_LIT); TeamFortress_Alias("-gren1", 152, TF_FLARE_LIT); TeamFortress_Alias("-gren2", 152, TF_FLARE_LIT); + TeamFortress_Alias("dropflag", DROP_FLAG_IMPULSE, TF_FLARE_LIT); }; void (entity tempent) dremove = @@ -124,7 +125,6 @@ entity (float gno) Findgoal = void(entity Goal, entity AP, entity ActivatingGoal) AttemptToActivate = { local entity te; - local string st; if (Activated(Goal, AP)) { if (ActivatingGoal == Goal) @@ -646,8 +646,6 @@ string (float tno) TeamFortress_TeamGetColorString = // Is civilian? float (float tno) TeamFortress_TeamIsCivilian = { - local entity te; - if ((tno == 1)) { if ((civilianteams & 1)) @@ -1746,10 +1744,8 @@ void () TeamFortress_DisplayLegalClasses = // TF class change/select function void() TeamFortress_ChangeClass = { - local entity spot; - local entity te; - local float tc; - local string st; +// local float tc; +// local string st; self.impulse += 100; //temp @@ -1771,8 +1767,8 @@ void() TeamFortress_ChangeClass = return; } /* tc = IsRestrictedClass(self.impulse - 100); // TBA ADD THIS FUNCTION - if (tc != 0) - { + if (tc != 0) // it's actually a megatf fucntion + { // -- gonna need cvars for it if (tc > 0) { sprint(self, "That class is restricted to "); @@ -2099,8 +2095,6 @@ void () superspike_touch = void () spike_touch = { - local float flt; - if (other.solid == 1) { return; @@ -2275,4 +2269,71 @@ void(entity p) bound_other_ammo = { p.no_grenades_2 = 4; } -}; \ No newline at end of file +}; + +// TF Drop Flag Function +void () tfgoalitem_dropthink; +void () item_tfgoal_touch; +void () DropFlag = +{ + local entity Item; + local entity te; + local float f; + local string st; + + te = find (world, classname, "item_tfgoal"); + while (te) + { + if (te.owner == self) + { + Item = te; + } + te = find (te, classname, "item_tfgoal"); + } + + if (Item == world) + { + sprint (self, "You don't have the flag.\n"); + return; + } + + // Delay + if (self.DropFlagDelay > time) + { + sprint (self, "Can't drop again for another "); + f = ceil(self.DropFlagDelay - time); + st = ftos(f); + sprint (self, st); + sprint (self, " seconds.\n"); + return; + } + self.DropFlagDelay = time + 10; + // + + // Flash of particles + WriteByte(4, 23); + WriteByte(4, 11); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + + tfgoalitem_RemoveFromPlayer(Item, self, 2); + + setorigin (Item, self.origin - '0 0 -24'); // - vf*(16));// - '0 0 15'); //Item.origin = self.origin + v_forward*56 + '0 0 8'; + Item.velocity = '0 0 1'; //((vf * 150) + '0 0 150'; + //gold. i didn't even have to change the origin, just the velocity. used to be '0 0 150' + Item.goal_state = 2; + Item.movetype = 6; + Item.solid = TF_FLARE_OFF; + setsize(Item, '-16 -16 0', '16 16 56'); + if (Item.mdl != string_null) + { + setmodel(Item, Item.mdl); + } + Item.option5 = time + 2; + Item.tent = self; + + Item.nextthink = time + 5; + Item.think = tfgoalitem_dropthink; + Item.touch = item_tfgoal_touch; +} \ No newline at end of file diff --git a/TeamNexuiz/game/gamec/tfgrenades.c b/TeamNexuiz/game/gamec/tfgrenades.c index e1a2f572d..b0ae976fa 100644 --- a/TeamNexuiz/game/gamec/tfgrenades.c +++ b/TeamNexuiz/game/gamec/tfgrenades.c @@ -9,8 +9,6 @@ void () CP_Timer; ======================*/ void () GrenadeExplode = { - local entity te; - /* if (self.voided) { return; @@ -30,7 +28,8 @@ void () GrenadeExplode = deathmsg = self.weapon; T_RadiusDamage (self, self.owner, 120, world); } -/* if ((self.no_active_nail_grens != 0)) +/* local entity te; + if ((self.no_active_nail_grens != 0)) { self.no_active_nail_grens = 0; self.owner.no_active_nail_grens = (self.owner.no_active_nail_grens - 1); @@ -140,10 +139,7 @@ void () FlashTimer = void () FlashGrenadeExplode = { - local float expsize; local entity te; - local entity oldself; - local string st; self.effects = (self.effects | 4); WriteByte (0, 23); @@ -259,7 +255,7 @@ void() NailGrenadeLaunchNail = void() TeamFortress_ExplodePerson = { - local entity te; +// local entity te; self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & 1); KickPlayer(-2, self.owner); // Doesnt wanna work right newmis = spawn(); diff --git a/TeamNexuiz/game/gamec/tfmapitems.c b/TeamNexuiz/game/gamec/tfmapitems.c index d79913b0e..1a19cf9de 100644 --- a/TeamNexuiz/game/gamec/tfmapitems.c +++ b/TeamNexuiz/game/gamec/tfmapitems.c @@ -81,8 +81,6 @@ float prematch; .float rv_g; .vector goal_min, goal_max; -.entity tent; - // Prototypes // Team Functions void(float tno, float scoretoadd) TeamFortress_TeamIncreaseScore; diff --git a/TeamNexuiz/game/gamec/tfmenus.c b/TeamNexuiz/game/gamec/tfmenus.c index 87cb91425..e98faa0df 100644 --- a/TeamNexuiz/game/gamec/tfmenus.c +++ b/TeamNexuiz/game/gamec/tfmenus.c @@ -85,7 +85,6 @@ void () Menu_EngineerFix_Tesla = // Tesla Menu Input void (float inp) Menu_EngineerFix_Tesla_Input = { - local string temp; local float cost; local float maxcells; diff --git a/TeamNexuiz/game/gamec/tfplats.c b/TeamNexuiz/game/gamec/tfplats.c index 1b6674429..85b21f578 100644 --- a/TeamNexuiz/game/gamec/tfplats.c +++ b/TeamNexuiz/game/gamec/tfplats.c @@ -193,8 +193,6 @@ void() plat_use = void() func_plat = { - local entity t; - // Q3F/ETF support if (self.allowteams == "red") { @@ -376,7 +374,6 @@ void() followtrain = void() func_train = { - local entity bob; if (CheckExistence() == 0) { dremove(self); diff --git a/TeamNexuiz/game/gamec/w_common.c b/TeamNexuiz/game/gamec/w_common.c index 1c828f6b6..fd53f7ed9 100644 --- a/TeamNexuiz/game/gamec/w_common.c +++ b/TeamNexuiz/game/gamec/w_common.c @@ -447,8 +447,6 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float deathtype local float dam_mult; local float zdif; - local float use_this; - local float tracline; local float x; local vector f; local vector g; diff --git a/TeamNexuiz/game/gamec/w_healgun.c b/TeamNexuiz/game/gamec/w_healgun.c index bbbb9931e..0cad4d4f2 100644 --- a/TeamNexuiz/game/gamec/w_healgun.c +++ b/TeamNexuiz/game/gamec/w_healgun.c @@ -30,7 +30,6 @@ void(float req) w_healgun = weapon_hasammo = healgun_check(); }; -.float healgun_bulletcounter; void W_Healgun_Attack (void) { local vector org; -- 2.39.2