diff --git a/MTF-versions.txt b/MTF-versions.txt new file mode 100644 index 0000000..2cb00aa --- /dev/null +++ b/MTF-versions.txt @@ -0,0 +1,31 @@ +*============================================================================* +* MegaTeamFortress 10.12.14 MTF-versions.txt * +*============================================================================* + +The original QuakeWorld MegaTeamFortress based on 08.22.06 + upgrades. No gameplay changes. FINALLY open-sourced. +Maintained by Up2nOgOod[ROCK] +https://github.com/quaketf +http://www.quakeworld.nu + + +Changelog: + +-------------------------------------------- +Version 10.12.14 10/12/2014 +-------------------------------------------- + +Changes: + - Added a 3 second prematch countdown written in console (Up2) + - Added how many minutes left in the game, every minute (Up2) + - Synced remaining time with ezQuake (Up2) + - Match results output from TF2.9 (Up2) + - Mod now displays "[auto]" after a player autoteams (Up2) + - Updated status bar code/formatting (Up2) + - Removed lots of unnecessary code (Up2) + +Bugs Fixed: + - Players respawn with the velocity of their last death (twincannon) + +Known Bugs: + - Times are off by 1-4 seconds. No idea why, this was in the original MTF and fixed in regTF2.95 + diff --git a/Quakefont.gif b/Quakefont.gif new file mode 100644 index 0000000..52f6a31 Binary files /dev/null and b/Quakefont.gif differ diff --git a/actions.pqc b/actions.pqc new file mode 100644 index 0000000..9d4feb8 --- /dev/null +++ b/actions.pqc @@ -0,0 +1,1056 @@ +.string oldweaponmodel; + +void() TeamFortress_NightVision = +{ + local entity te; + local entity tl; + sound(self, TF_FLARE_LIT, "items/nightvis.wav", 0.5, TF_FLARE_OFF); + te = find(world, classname, "player"); + while (te) + { + if (self != te) + { + if (te.team_no != TF_FLARE_LIT) + { + if (te.health > TF_FLARE_OFF) + { + if (visible(te)) + { + msg_entity = self; + tl = spawn(); + tl.owner = self; + tl.origin = te.origin; + tl.origin_z = tl.origin_z + 32; + WriteByte(TF_FLARE_OFF, 23); + WriteByte(TF_FLARE_OFF, 9); + WriteEntity(TF_FLARE_OFF, tl); + WriteCoord(TF_FLARE_OFF, tl.origin_x); + WriteCoord(TF_FLARE_OFF, tl.origin_y); + WriteCoord(TF_FLARE_OFF, tl.origin_z); + WriteCoord(TF_FLARE_OFF, te.origin_x); + WriteCoord(TF_FLARE_OFF, te.origin_y); + WriteCoord(TF_FLARE_OFF, te.origin_z + 5); + dremove(tl); + } + } + } + } + te = find(te, classname, "player"); + } + te = find(world, classname, "building_sentrygun"); + while (te) + { + if (self != te) + { + if (te.team_no != TF_FLARE_LIT) + { + if (te.health > TF_FLARE_OFF) + { + if (visible(te)) + { + msg_entity = self; + tl = spawn(); + tl.owner = self; + tl.origin = te.origin; + tl.origin_z = tl.origin_z + 32; + WriteByte(TF_FLARE_OFF, 23); + WriteByte(TF_FLARE_OFF, 9); + WriteEntity(TF_FLARE_OFF, tl); + WriteCoord(TF_FLARE_OFF, tl.origin_x); + WriteCoord(TF_FLARE_OFF, tl.origin_y); + WriteCoord(TF_FLARE_OFF, tl.origin_z); + WriteCoord(TF_FLARE_OFF, te.origin_x); + WriteCoord(TF_FLARE_OFF, te.origin_y); + WriteCoord(TF_FLARE_OFF, te.origin_z + 5); + dremove(tl); + } + } + } + } + te = find(te, classname, "building_sentrygun"); + } + te = find(world, classname, "bot"); + while (te) + { + if (self != te) + { + if (te.team_no != TF_FLARE_LIT) + { + if (te.health > TF_FLARE_OFF) + { + if (visible(te)) + { + msg_entity = self; + tl = spawn(); + tl.owner = self; + tl.origin = te.origin; + tl.origin_z = tl.origin_z + 32; + WriteByte(TF_FLARE_OFF, 23); + WriteByte(TF_FLARE_OFF, 9); + WriteEntity(TF_FLARE_OFF, tl); + WriteCoord(TF_FLARE_OFF, tl.origin_x); + WriteCoord(TF_FLARE_OFF, tl.origin_y); + WriteCoord(TF_FLARE_OFF, tl.origin_z); + WriteCoord(TF_FLARE_OFF, te.origin_x); + WriteCoord(TF_FLARE_OFF, te.origin_y); + WriteCoord(TF_FLARE_OFF, te.origin_z + 5); + dremove(tl); + } + } + } + } + te = find(te, classname, "bot"); + } +}; + +void() Drone = +{ + if (self.option3 < TF_FLARE_OFF) + { + sprint(self, 2, "You get 1 LaserDrone kit per life\n"); + return; + } + if (self.last_used > time) + { + sprint(self, 2, "Not finished building new drone yet... takes 3 minutes\n"); + return; + } + sprint(self, 2, "Laser Drone away!\n"); + self.option3 = self.option3 - TF_FLARE_OFF; + self.last_used = time + 180; + newmis = spawn(); + newmis.owner = self; + newmis.weapon = 41; + newmis.movetype = 9; + newmis.solid = 2; + newmis.classname = "bot"; + newmis.team_no = self.team_no; + makevectors(self.v_angle); + if (self.v_angle_x) + { + newmis.velocity = v_forward * 200; + } + else + { + newmis.velocity = aim(self, 10000); + newmis.velocity = newmis.velocity * 200; + } + newmis.option = TF_FLARE_OFF; + newmis.health = 30; + newmis.takedamage = 2; + newmis.th_die = DroneDie; + setsize(newmis, '-8 -8 -8', '12 12 12'); + setorigin(newmis, self.origin + v_forward * 8 + '0 0 20'); + newmis.angles_x = self.angles_x; + newmis.angles_y = self.angles_y; + newmis.angles_z = self.angles_z; + sound(newmis, TF_FLARE_LIT, "weapons/chngnu1a.wav", TF_FLARE_OFF, TF_FLARE_OFF); + newmis.nextthink = time + 0.8; + newmis.playerclass = TF_FLARE_LIT; + newmis.think = DroneJet; + newmis.touch = BalloonMIRVtouch; + newmis.skin = TF_FLARE_LIT; + setmodel(newmis, "progs/lsrdrone.mdl"); +}; + +void() Drone_Laser_Touch = +{ + local vector org; + if (other == self.owner) + { + return; + } + if (pointcontents(self.origin) == -6) + { + dremove(self); + return; + } + sound(self, TF_FLARE_OFF, "enforcer/enfstop.wav", TF_FLARE_OFF, 3); + org = self.origin - 8 * normalize(self.velocity); + if (other.health) + { + SpawnBlood(org, 15); + deathmsg = 41; + self.weapon = 41; + if (other.classname == "building_sentrygun") + { + T_RadiusDamage(self, self.owner.owner, 90, world); + } + else + { + T_Damage(other, self, self.owner.owner, 25); + } + } + dremove(self); +}; + +void(vector org, vector vec) DroneLaunchLaser = +{ + sound(self, TF_FLARE_OFF, "enforcer/enfire.wav", TF_FLARE_OFF, TF_FLARE_OFF); + vec = normalize(vec); + newmis = spawn(); + newmis.owner = self; + newmis.movetype = 5; + newmis.solid = 2; + newmis.effects = 8; + newmis.weapon = 41; + newmis.classname = "drone_laser"; + newmis.skin = self.owner.team_no - TF_FLARE_OFF; + setmodel(newmis, "progs/beam.mdl"); + setsize(newmis, '0 0 0', '0 0 0'); + setorigin(newmis, org); + newmis.velocity = vec * 2000; + newmis.angles = vectoangles(newmis.velocity); + newmis.nextthink = time + 4; + newmis.think = SUB_Remove; + newmis.touch = Drone_Laser_Touch; +}; + +void() DroneDoneTouch = +{ + if (self.velocity_z) + { + sound(self, TF_FLARE_OFF, "weapons/bounce.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } +}; + +void() DroneDie = +{ + ThrowGib("progs/tgib2.mdl", -70); + ThrowGib("progs/dgib2.mdl", -70); + ThrowGib("progs/dgib3.mdl", -70); + WriteByte(4, 23); + WriteByte(4, 3); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, TF_FLARE_OFF); + BecomeExplosion(); +}; + +void() DroneFall = +{ + sound(self, TF_FLARE_LIT, "weapons/chngnd1a.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.movetype = 10; + self.avelocity = '200 0 300'; + setsize(self, '-8 -8 -8', '8 8 8'); + self.takedamage = 2; + self.skin = TF_FLARE_OFF; + //self.team_no = 5; // <- pablo. guns shoot friendly drones cause of this. + self.th_die = DroneDie; + self.touch = DroneDoneTouch; + self.think = DroneDie; + // pablo. die abit faster since you'll be twice as annoying when we cant kill you. + //self.nextthink = time + 20; + self.nextthink = time + 15; + // <--- +}; + +void() DroneJet = +{ + local entity te; + //local entity tl; + self.playerclass = self.playerclass + TF_FLARE_OFF; + self.nextthink = time + 0.9; + sound(self, TF_FLARE_LIT, "weapons/drone.wav", TF_FLARE_OFF, TF_FLARE_OFF); + te = find(world, classname, "player"); + while (te) + { + if (self != te) + { + if (te.team_no != TF_FLARE_LIT && te.team_no != self.team_no) + { + if (te.health) + { + if (visible(te)) + { + if (te.is_undercover != TF_FLARE_OFF) + { + DroneLaunchLaser(self.origin, te.origin - self.origin); + } + } + } + } + } + te = find(te, classname, "player"); + } + te = find(world, classname, "building_sentrygun"); + while (te) + { + if (te.team_no != TF_FLARE_LIT && te.team_no != self.team_no) + { + if (te.health) + { + if (visible(te)) + { + DroneLaunchLaser(self.origin, te.origin + '0 0 24' - self.origin); + } + } + } + te = find(te, classname, "building_sentrygun"); + } + te = find(world, classname, "bot"); + while (te) + { + if (self != te) + { + if (te.team_no != TF_FLARE_LIT && te.team_no != self.team_no) + { + if (te.health) + { + if (visible(te)) + { + DroneLaunchLaser(self.origin, te.origin - self.origin); + } + } + } + } + te = find(te, classname, "bot"); + } + if (self.playerclass > 10) + { + self.think = DroneFall; + } +}; + +vector(vector ang) SUB_NormalizeAngles = +{ + while (ang_x > 360) + { + ang_x = ang_x - 360; + } + while (ang_x < TF_FLARE_LIT) + { + ang_x = ang_x + 360; + } + while (ang_y > 360) + { + ang_y = ang_y - 360; + } + while (ang_y < TF_FLARE_LIT) + { + ang_y = ang_y + 360; + } + while (ang_z > 360) + { + ang_z = ang_z - 360; + } + while (ang_z < TF_FLARE_LIT) + { + ang_z = ang_z + 360; + } + return ang; +}; + +void() Prox_Disarm = +{ + if (other.classname != "player") + { + return; + } + if (other.playerclass == TF_FLARE_OFF && other.team_no != self.team_no) + { + other.real_frags = other.real_frags + TF_FLARE_OFF; + dremove(self); + } + return; +}; + +void() ProxiDie = +{ + self.effects = 4; + make_explosion(); + self.takedamage = TF_FLARE_LIT; + deathmsg = 45; + T_RadiusDamage(self, self.owner, 200, world); + dremove(self); +}; + +void () FoundBastard = +{ + local float _l_11382; + + self.touch = Prox_Disarm; + sound (self, 3, "effects/beep.wav", 1, 1); + self.skin = (self.owner.team_no + 3); + _l_11382 = vlen ((self.enemy.origin - self.origin)); + if ((_l_11382 <= self.height)) + { + self.height = _l_11382; + self.nextthink = (time + ((_l_11382 / 1000) * 1.500000)); + self.think = FoundBastard; + } + else + { + self.effects = 4; + make_explosion (); + MushroomFlame (); + WriteByte (4, 23); + WriteByte (4, 3); + WriteCoord (4, self.origin_x); + WriteCoord (4, self.origin_y); + WriteCoord (4, self.origin_z); + multicast (self.origin, 1); + deathmsg = 45; + self.takedamage = 0; + T_RadiusDamage (self, self.owner, 200, world); + dremove (self); + } +}; + +void () ProxArmed = +{ + local entity _l_11392; + //local entity _l_11393; + local vector _l_11394; + + self.velocity = '0 0 0'; + self.nextthink = (time + 1); + self.think = ProxArmed; + sound (self, 3, "effects/beep.wav", 0.300000, 1); + self.playerclass = (self.playerclass + 1); + if ((self.skin == self.owner.team_no)) + { + self.skin = 0; + } + else + { + self.skin = self.owner.team_no; + } + _l_11392 = find (world, classname, "player"); + while (_l_11392) + { + if ((self.owner != _l_11392)) + { + if ((((_l_11392.team_no != 0) && (_l_11392.team_no != self.team_no)) && (_l_11392.bugger == 0))) + { + if ((_l_11392.health > 1)) + { + if (visible (_l_11392)) + { + if ((_l_11392.undercover_team != self.team_no)) + { + _l_11394 = _l_11392.origin - self.origin; + if ((vlen (_l_11394) < 200)) + { + self.height = vlen (_l_11394); + self.enemy = _l_11392; + self.nextthink = 0.200000; + self.think = FoundBastard; + } + } + } + } + } + } + _l_11392 = find (_l_11392, classname, "player"); + } + if (((self.playerclass > 300) || (self.owner.playerclass != 3))) + { + dremove (self); + } +}; + +void() ProxAttach = +{ + //self.touch = SUB_Null; + self.think = ProxArmed; + self.nextthink = time + 0.5; + sound(newmis, TF_FLARE_LIT, "buttons/switch02.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void (vector _p_11412, float _p_11415) BigAssBullet = +{ + local vector _l_11416; + local vector _l_11419; + + makevectors (self.v_angle); + _l_11419 = self.origin + (v_forward * 10); + _l_11419_z = self.absmin_z + (self.size_z * 0.700000); + ClearMultiDamage (); + traceline (_l_11419, (_l_11419 + (_p_11412 * 1500)), 0, self); + if ((trace_fraction != 1)) + { + TraceAttack (_p_11415, _p_11412); + } + if (trace_ent.takedamage) + { + _l_11416 = trace_endpos - (v_forward * 4); + SpawnBlood (_l_11416, 9); + } + else + { + _l_11416 = trace_endpos - (v_forward * 4); + WriteByte (4, 23); + WriteByte (4, 0); + WriteCoord (4, _l_11416_x); + WriteCoord (4, _l_11416_y); + WriteCoord (4, _l_11416_z); + multicast (self.origin, 1); + } + ApplyMultiDamage (); +}; + +void () W_FireBigAss = +{ + local vector _l_11430; + //local float _l_11436; + + if ((self.ammo_shells < 10)) + { + make_explosion (); +// sprint (self, 2, "Ammo chamber jammed!\n"); // I just don't like excess messages + sound (self, 1, "weapons/asscan4.wav", 1, 1); + stuffcmd (self, "bf\n"); + self.option4 = 0; + return; + } + self.nojumptime = (time + 0.750000); + + // My megatf uses the old megaTF assault cannon fire wav, but you can enable + // 11.11.04's by setting "localinfo newsounds 1" (or localinfo newsounds on) in the + // server console + if (infokey(world, "newsounds") == "1" || infokey(world, "newsounds") == "on") + { + sound (self, 1, "weapons/20mm.wav", 1, 1); + } + else + { + sound(self, TF_FLARE_OFF, "weapons/sgun1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + + KickPlayer (-5, self); + muzzleflash (); + stuffcmd (self, "bf\n"); +// self.ammo_shells = (self.ammo_shells - 10); +// self.currentammo = (self.ammo_shells - 10); + self.currentammo = self.ammo_shells = self.ammo_shells - 10; + makevectors (self.v_angle); + _l_11430 = v_forward; + deathmsg = 46; + BigAssBullet (_l_11430, 50); + EjectShell (); + self.velocity = (self.velocity - (v_forward * 200)); + if ((self.ammo_shells == 0)) + { + self.ammo_shells = 1; + } +}; + +void () BigAssCarry = +{ + makevectors (self.owner.v_angle); + setorigin (self, (((self.owner.origin + (v_forward * 12)) + '0 0 20') + (v_right * 5))); + self.angles = self.owner.angles; + self.think = BigAssCarry; + self.nextthink = (time + 0.02); +}; + +void () Prox = +{ + local vector _l_11458; + local vector _l_11461; + local entity _l_11464; + + _l_11464 = find (world, classname, "bot"); + while (_l_11464) + { + if ((_l_11464.owner == self)) + { + local float proxyDistance = vlen(_l_11464.origin - self.origin); + if (proxyDistance < 40) + { + dremove(_l_11464); + if (self.no_grenades_2 < 3) + { + self.no_grenades_2 = (self.no_grenades_2 + 2); + } + return; + } + else + { + sprint (self, 2, "1 proximity grenade at a time!\n"); + if ((self.weaponmodel == "progs/proxgren.mdl")) + { + self.current_weapon = W_BestWeapon (); + self.weaponmodel = "progs/v_rock2.mdl"; + self.currentammo = self.ammo_rockets; + Attack_Finished (0.700000); + self.impulse = 0; + self.StatusRefreshTime = (time + 0.100000); + } + return; + } + } + _l_11464 = find (_l_11464, classname, "bot"); + } + if ((self.no_grenades_2 < 2)) + { + sprint (self, 2, "Not enough type 2 grenades... get more\n"); + if ((self.weaponmodel == "progs/proxgren.mdl")) + { + self.weaponmodel = "progs/v_rock2.mdl"; + self.currentammo = self.ammo_rockets; + Attack_Finished (0.700000); + self.impulse = 0; + self.StatusRefreshTime = (time + 0.100000); + self.tfstate = (self.tfstate - (self.tfstate & 2)); + } + return; + } + if ((self.weaponmodel != "progs/proxgren.mdl")) + { + self.tfstate = (self.tfstate | 2); + self.oldweaponmodel = self.weaponmodel; + self.oldcurrentammo = self.currentammo; + self.currentammo = 1; + self.weaponmodel = "progs/proxgren.mdl"; + self.weaponframe = 0; + return; + } + makevectors (self.v_angle); + _l_11458 = self.origin + (v_forward * 10); + _l_11458_z = self.absmin_z + (self.size_z * 0.700000); + traceline (_l_11458, (_l_11458 + (v_forward * 70)), 0, self); + _l_11461 = trace_endpos - (v_forward * 8); + if ((trace_fraction != 1)) + { + sound (self, 3, "buttons/switch02.wav", 1, 1); + sprint (self, 2, "Proximity mine set!\n"); + self.no_grenades_2 = (self.no_grenades_2 - 2); + newmis = spawn (); + newmis.owner = self; + newmis.weapon = 41; + newmis.movetype = 0; + newmis.solid = 2; + newmis.classname = "bot"; + newmis.netname = "proxi"; + newmis.team_no = self.team_no; + newmis.health = 3; + newmis.takedamage = 2; + newmis.th_die = ProxiDie; + setsize (newmis, '-3 -3 -3', '3 3 3'); + newmis.angles = '0 0 0'; + newmis.nextthink = (time + 1); + newmis.playerclass = 0; + newmis.think = ProxAttach; + newmis.skin = 0; + newmis.frame = 1; + setmodel (newmis, "progs/proxgren.mdl"); + setorigin (newmis, _l_11461); + if ((self.oldweaponmodel != "")) + { + self.tfstate = (self.tfstate - (self.tfstate & 2)); + } + self.weaponmodel = self.oldweaponmodel; + self.currentammo = self.oldcurrentammo; + Attack_Finished (0.700000); + self.impulse = 0; + self.StatusRefreshTime = (time + 0.100000); + } +}; + +.float DropFlagDelay; + +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, 2, "You don't have the flag.\n"); + return; + } + + // Delay + if (self.DropFlagDelay > time) + { + sprint (self, 2, "Can't drop again for another "); + f = ceil(self.DropFlagDelay - time); + st = ftos(f); + sprint (self, 2, st); + sprint (self, 2, " 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); + multicast(self.origin, TF_FLARE_OFF); + // + + 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; +} +void () Det_Disp = +{ + local entity te; + if (self.playerclass != 9) + { + return; + } + if (self.has_dispenser) + { + te = find(world, classname, "building_dispenser"); + while (te) + { + if (te.real_owner == self) + { + deathmsg = 201; + T_RadiusDamage(te, te.real_owner, 140, world); + TF_T_Damage(te, world, world, 500, TF_FLARE_LIT, TF_FLARE_LIT); + sprint(self, 2, "Your dispenser was detonated.\n"); + } + te = find(te, classname, "building_dispenser"); + } + } + else + { + sprint(self, 2, "You don't have a dispenser to detonate.\n"); + } +} +void () Det_Sent = +{ + local entity te; + if (self.playerclass != 9) + { + return; + } + if (self.has_sentry) + { + te = find(world, classname, "building_sentrygun"); + while (te) + { + if (te.real_owner == self) + { + TF_T_Damage(te, world, world, 500, TF_FLARE_LIT, TF_FLARE_LIT); + } + te = find(te, classname, "building_sentrygun"); + } + } + else + { + sprint(self, 2, "You don't have a sentry to detonate.\n"); + } +} + +void () review_timeleft = { + + local string st; + local float minutes; + local float seconds; + local float remaining; + + self.no_grenades_1 = self.no_grenades_1 + 1; + self.nextthink = (time + 1); + + st = infokey (world,"timelimit"); + minutes = stof(st); + seconds = minutes * 60; + + if (minutes != self.health) // timelimit change detector + { + self.netname = ftos(self.health); + bprint(2,"Timelimit "); + if (minutes > self.health) + bprint(2,"increased from "); + else + bprint(2,"decreased from "); + bprint(2,self.netname); + bprint(2," to "); + bprint(2,st); + bprint(2," minutes\n"); + + } + + self.health = stof(st); + if (st == "0") + return; + + seconds = minutes * 60; + remaining = seconds - self.no_grenades_1; + if ((remaining == 4) & (seconds >= 4)) + bprint(2,"\[5\] seconds remaining\n"); + else if ((remaining == 29) & (seconds >= 29)) + bprint(2,"\[30\] seconds remaining\n"); + else if ((remaining == 59) & (seconds >= 59)) { + bprint(2,"\[1\] minute remaining\n"); + localcmd("serverinfo status \"1 min left\"\n"); + } + else if ((remaining == 119) & (seconds >= 119)) { + bprint(2,"\[2\] minutes remaining\n"); + localcmd("serverinfo status \"2 min left\"\n"); + } + else if ((remaining == 179) & (seconds >= 179)) { + bprint(2,"\[3\] minutes remaining\n"); + localcmd("serverinfo status \"3 min left\"\n"); + } + else if ((remaining == 239) & (seconds >= 239)) { + bprint(2,"\[4\] minutes remaining\n"); + localcmd("serverinfo status \"4 min left\"\n"); + } + else if ((remaining == 299) & (seconds >= 299)) { + bprint(2,"\[5\] minutes remaining\n"); + localcmd("serverinfo status \"5 min left\"\n"); + } + else if ((remaining == 359) & (seconds >= 359)) { + bprint(2,"\[6\] minutes remaining\n"); + localcmd("serverinfo status \"6 min left\"\n"); + } + else if ((remaining == 419) & (seconds >= 419)) { + bprint(2,"\[7\] minutes remaining\n"); + localcmd("serverinfo status \"7 min left\"\n"); + } + else if ((remaining == 479) & (seconds >= 479)) { + bprint(2,"\[8\] minutes remaining\n"); + localcmd("serverinfo status \"8 min left\"\n"); + } + else if ((remaining == 539) & (seconds >= 539)) { + bprint(2,"\[9\] minutes remaining\n"); + localcmd("serverinfo status \"9 min left\"\n"); + } + else if ((remaining == 599) & (seconds >= 599)) { + bprint(2,"\[10\] minutes remaining\n"); + localcmd("serverinfo status \"10 min left\"\n"); + } + else if ((remaining == 899) & (seconds >= 899)) { + bprint(2,"\[15\] minutes remaining\n"); + localcmd("serverinfo status \"15 min left\"\n"); + } + else if ((remaining == 1799) & (seconds >= 1799)) { + bprint(2,"\[30\] minutes remaining\n"); + localcmd("serverinfo status \"30 min left\"\n"); + } + + self.think = review_timeleft; + + +}; + +void (entity _p_11523, float _p_11524) sprint_duration = +{ + local float _l_11525; + local float _l_11526; + local float _l_11527; + local string _l_11528; + + if ((_p_11524 <= 0)) + { + sprint (_p_11523, 2, "none.\n"); + return; + } + _l_11525 = _p_11524; + _p_11524 = _p_11524 / 60; + _l_11526 = 0; + while ((_l_11526 < _p_11524)) + { + _l_11526 = _l_11526 + 1; + } + _l_11526 = _l_11526 - 1; + _l_11527 = _l_11526 * 60; + _l_11527 = _l_11525 - _l_11527; + if ((_l_11526 > 0)) + { + _l_11528 = ftos (_l_11526); + sprint (_p_11523, 2, _l_11528); + if ((_l_11528 == "1")) + { + sprint (_p_11523, 2, " minute"); + } + else + { + sprint (_p_11523, 2, " minutes"); + } + _l_11528 = ftos (_l_11527); + if ((_l_11528 != "60")) + { + sprint (_p_11523, 2, ", "); + sprint (_p_11523, 2, _l_11528); + if ((_l_11528 == "1")) + { + sprint (_p_11523, 2, " second"); + } + else + { + sprint (_p_11523, 2, " seconds"); + } + } + return; + } + else + { + _l_11528 = ftos (_l_11525); + sprint (_p_11523, 2, _l_11528); + sprint (_p_11523, 2, " seconds"); + } +}; + +void (entity _p_11534) TeamFortress_PrintPMTimeLeft = +{ + local float _l_11535; + local float _l_11536; + local float _l_11537; + local float _l_11538; + local string _l_11539; + local string _l_11540; + local string _l_11541; + + if (!prematch) + { + return; + } + if ((pointer_prematchtimer == world)) + { + dprint ("warning: prematch timer not found during prematch.\n"); + return; + } + else + { + _l_11538 = (timelimit - pointer_timeleft.no_grenades_1) - (timelimit - floor ((prematch * 60))); + _l_11538 = _l_11538 + 4; + _l_11535 = _l_11538; + _l_11538 = _l_11538 / 60; + _l_11536 = 0; +#ifdef clan_progs + if (clan_prematch == 0) + { + while ((_l_11536 < _l_11538)) + { + _l_11536 = _l_11536 + 1; + } + } +#else + while ((_l_11536 < _l_11538)) + { + _l_11536 = _l_11536 + 1; + } +#endif + _l_11536 = _l_11536 - 1; + _l_11537 = _l_11536 * 60; + _l_11537 = _l_11535 - _l_11537; + if ((_l_11536 > 0)) + { + _l_11539 = "Prematch ends in less than "; + _l_11540 = ftos ((_l_11536 + 1)); + if ((_l_11540 == "1")) + { + _l_11541 = " minute"; + } + else + { + _l_11541 = " minutes"; + } + } + else + { + if ((_l_11535 <= 10)) + { + centerprint (self, "Prematch is about to end!\n"); + return; + } + _l_11539 = "Prematch ends in "; + _l_11540 = ftos (_l_11535); + _l_11541 = " seconds!"; + } + } + centerprint (_p_11534, _l_11539, _l_11540, _l_11541, "\n"); +}; + +void () TeamFortress_Timeleft = +{ + local float _l_11549; + local string _l_11551; + + _l_11551 = infokey (world, "time"); + if (((_l_11551 == "off") && (pointer_timeleft == world))) + { + sprint (self, 2, "Timeleft has been disabled.\n"); + return; + } + else + { + if (((_l_11551 != "off") && (pointer_timeleft == world))) + { + sprint (self, 2, "Unknown.\n"); + return; + } + } + if (((timelimit != 0) && ((timelimit - pointer_timeleft.no_grenades_1) <= 0))) + { + sprint (self, 2, "Time is up.\n"); + return; + } + if (prematch) + { + sprint (self, 2, "Prematch: "); + if ((pointer_prematchtimer == world)) + { + sprint (self, 2, "\n"); + } + else + { +#ifdef clan_progs + if (clan_prematch > 0) + { + sprint(self,2, "infinite (all must select ready for prematch to end)\n"); + } + else if (clan_prematch == -1) + { + sprint(self,2, "4 seconds\n"); + } + else { +#endif + _l_11549 = (timelimit - pointer_timeleft.no_grenades_1) - (timelimit - floor ((prematch * 60))); + _l_11549 = _l_11549 + 4; + sprint_duration (self, _l_11549); + sprint (self, 2, "\n"); +#ifdef clan_progs + } +#endif + + } + sprint (self, 2, "Game : "); + } + else + { + sprint (self, 2, " "); + } + _l_11549 = timelimit - pointer_timeleft.no_grenades_1; + sprint_duration (self, _l_11549); + sprint (self, 2, "\n"); +}; \ No newline at end of file diff --git a/ai.pqc b/ai.pqc new file mode 100644 index 0000000..41c0e7b --- /dev/null +++ b/ai.pqc @@ -0,0 +1,653 @@ +// XTF2 +//entity (float rangeDist) buildTargetList; +//entity (entity targList) sortListFrom; // only in United :) +// XTF2_end +void(float normal) SUB_AttackFinished; +//float() WizardCheckAttack; +float() DogCheckAttack; +//float() SoldierCheckAttack; +//float() ShamCheckAttack; +//float() DemonCheckAttack; +//float() OgreCheckAttack; +float() CheckAttack; + +float current_yaw; +float enemy_vis, enemy_infront, enemy_range; +float enemy_yaw; + +entity sight_entity; +float sight_entity_time; + + +float(float v) anglemod = +{ + while (v >= 360) + { + v = v - 360; + } + while (v < TF_FLARE_LIT) + { + v = v + 360; + } + return v; +}; + +void() t_movetarget = +{ + local entity temp; + if (other.movetarget != self) + { + return; + } + if (other.enemy) + { + return; + } + temp = self; + self = other; + other = temp; + if (self.classname == "monster_ogre") + { + sound(self, 2, "ogre/ogdrag.wav", TF_FLARE_OFF, 2); + } + self.goalentity = self.movetarget = find(world, targetname, other.target); + self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin); + if (!(self.movetarget)) + { + self.pausetime = time + 999999; + self.th_stand(); + return; + } +}; + +void() movetarget_f = +{ + if (!(self.targetname)) + { + objerror("monster_movetarget: no targetname"); + } + self.solid = TF_FLARE_OFF; + self.touch = t_movetarget; + setsize(self, '-8 -8 -8', '8 8 8'); +}; + +void() path_corner = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + movetarget_f(); +}; + + + +float(entity targ) range = +{ + local vector spot1; + local vector spot2; + local float r; + spot1 = self.origin + self.view_ofs; + spot2 = targ.origin + targ.view_ofs; + r = vlen(spot1 - spot2); + if (r < 120) + { + return TF_FLARE_LIT; + } + if (r < 500) + { + return TF_FLARE_OFF; + } + if (r < 1000) + { + return 2; + } + return 3; +}; + +float(entity targ) infront = +{ + local vector vec; + local float dot; + makevectors(self.angles); + vec = normalize(targ.origin - self.origin); + dot = vec * v_forward; + if (dot > 0.3) + { + return TF_FLARE_OFF; + } + return TF_FLARE_LIT; +}; + +void() HuntTarget = +{ + self.goalentity = self.enemy; + self.think = self.th_run; + self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin); + self.nextthink = time + 0.1; + SUB_AttackFinished(TF_FLARE_OFF); +}; + +void() SightSound = +{ + local float rsnd; + if (self.classname == "monster_ogre") + { + sound(self, 2, "ogre/ogwake.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.classname == "monster_knight") + { + sound(self, 2, "knight/ksight.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.classname == "monster_shambler") + { + sound(self, 2, "shambler/ssight.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.classname == "monster_demon1") + { + sound(self, 2, "demon/sight2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.classname == "monster_wizard") + { + sound(self, 2, "wizard/wsight.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.classname == "monster_zombie") + { + sound(self, 2, "zombie/z_idle.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.classname == "monster_dog") + { + sound(self, 2, "dog/dsight.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.classname == "monster_hell_knight") + { + sound(self, 2, "hknight/sight1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.classname == "monster_tarbaby") + { + sound(self, 2, "blob/sight1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.classname == "monster_vomit") + { + sound(self, 2, "vomitus/v_sight1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.classname == "monster_enforcer") + { + rsnd = rint(random() * 3); + if (rsnd == TF_FLARE_OFF) + { + sound(self, 2, "enforcer/sight1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (rsnd == 2) + { + sound(self, 2, "enforcer/sight2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (rsnd == TF_FLARE_LIT) + { + sound(self, 2, "enforcer/sight3.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + sound(self, 2, "enforcer/sight4.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + } + } + } + else + { + if (self.classname == "monster_army") + { + sound(self, 2, "soldier/sight1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.classname == "monster_shalrath") + { + sound(self, 2, "shalrath/sight.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + } + } + } + } + } + } + } + } + } + } + } + } +}; + +void() FoundTarget = +{ + if (self.enemy.classname == "player" || self.enemy.classname == "bot" || self.enemy.classname == "monster_dog" || self.enemy.classname == "monster_fish") + { + sight_entity = self; + sight_entity_time = time; + } + self.show_hostile = time + TF_FLARE_OFF; + SightSound(); + HuntTarget(); +}; + +float () FindTarget = +{ + local entity _l_8271; + local float _l_8273; + + if (((sight_entity_time >= (time - 0.1)) && !(self.spawnflags & 3))) + { + _l_8271 = sight_entity; + if ((_l_8271.enemy == self.enemy)) + { + return (0); + } + } + else + { + _l_8271 = checkclient (); + if ((!_l_8271 && (_l_8271.classname != "bot"))) + { + return (0); + } + } + if ((_l_8271 == self.enemy)) + { + return (0); + } + if ((_l_8271.flags & 128)) + { + return (0); + } + if ((_l_8271.items & 524288)) + { + return (0); + } + if ((_l_8271.team_no == self.team_no)) + { + return (0); + } + if (((_l_8271.undercover_team == self.team_no) && (_l_8271.playerclass == 8))) + { + return (0); + } + _l_8273 = range (_l_8271); + if ((_l_8273 == 3)) + { + return (0); + } + if (!visible (_l_8271)) + { + return (0); + } + if ((_l_8273 == 1)) + { + if (((_l_8271.show_hostile < time) && !infront (_l_8271))) + { + return (0); + } + } + else + { + if ((_l_8273 == 2)) + { + if (!infront (_l_8271)) + { + return (0); + } + } + } + self.enemy = _l_8271; + if ((((self.enemy.classname != "player") && (self.enemy.classname != "bot")) && (self.enemy.classname != "monster_dog"))) + { + self.enemy = self.enemy.enemy; + if ((((self.enemy.classname != "player") && (self.enemy.classname != "bot")) && (self.enemy.classname != "monster_dog"))) + { + self.enemy = world; + return (0); + } + } + FoundTarget (); + return (1); +}; + +void(float dist) ai_forward = +{ + walkmove(self.angles_y, dist); +}; + +void(float dist) ai_back = +{ + walkmove(self.angles_y + 180, dist); +}; + +void(float dist) ai_pain = +{ + ai_back(dist); +}; + +void(float dist) ai_painforward = +{ + walkmove(self.ideal_yaw, dist); +}; + +void(float dist) ai_walk = +{ + movedist = dist; + if (self.classname == "monster_dragon") + { + movetogoal(dist); + return; + } + if (FindTarget()) + { + return; + } + movetogoal(dist); +}; + +void() ai_stand = +{ + if (FindTarget()) + { + return; + } + if (time > self.pausetime) + { + self.th_walk(); + return; + } +}; + +void() ai_turn = +{ + if (FindTarget()) + { + return; + } + ChangeYaw(); +}; + +void(vector dest3) ChooseTurn = +{ + local vector dir; + local vector newdir; + dir = self.origin - dest3; + newdir_x = trace_plane_normal_y; + newdir_y = TF_FLARE_LIT - trace_plane_normal_x; + newdir_z = TF_FLARE_LIT; + if (dir * newdir > TF_FLARE_LIT) + { + dir_x = TF_FLARE_LIT - trace_plane_normal_y; + dir_y = trace_plane_normal_x; + } + else + { + dir_x = trace_plane_normal_y; + dir_y = TF_FLARE_LIT - trace_plane_normal_x; + } + dir_z = TF_FLARE_LIT; + self.ideal_yaw = vectoyaw(dir); +}; + +float() FacingIdeal = +{ + local float delta; + delta = anglemod(self.angles_y - self.ideal_yaw); + if (delta > 45 && delta < 315) + { + return TF_FLARE_LIT; + } + return TF_FLARE_OFF; +}; + +float() CheckAnyAttack = +{ + if (!enemy_vis) + { + return 0; + } + if (self.classname == "monster_dog") + { + return DogCheckAttack(); + } + if (self.classname == "bot") + { + return DogCheckAttack(); + } + return CheckAttack(); +}; + +void() ai_run_melee = +{ + self.ideal_yaw = enemy_yaw; + ChangeYaw(); + if (FacingIdeal()) + { + self.th_melee(); + self.attack_state = TF_FLARE_OFF; + } +}; + +void() ai_run_missile = +{ + self.ideal_yaw = enemy_yaw; + ChangeYaw(); + if (FacingIdeal()) + { + self.th_missile(); + self.attack_state = TF_FLARE_OFF; + } +}; + +void() ai_run_slide = +{ + local float ofs; + self.ideal_yaw = enemy_yaw; + ChangeYaw(); + if (self.lefty) + { + ofs = 90; + } + else + { + ofs = -90; + } + if (walkmove(self.ideal_yaw + ofs, movedist)) + { + return; + } + self.lefty = TF_FLARE_OFF - self.lefty; + walkmove(self.ideal_yaw - ofs, movedist); +}; + +void(float dist) ai_run = +{ + movedist = dist; + if (self.enemy.health <= TF_FLARE_LIT || self.playerclass == self.enemy.team_no) + { + self.enemy = world; + if (self.oldenemy.health > TF_FLARE_LIT) + { + self.enemy = self.oldenemy; + HuntTarget(); + } + else + { + if (self.movetarget) + { + self.th_walk(); + } + else + { + self.th_stand(); + } + return; + } + } + self.show_hostile = time + TF_FLARE_OFF; + enemy_vis = visible(self.enemy); + if (enemy_vis) + { + self.search_time = time + 5; + } + if (coop && self.search_time < time) + { + if (FindTarget()) + { + return; + } + } + enemy_infront = infront(self.enemy); + enemy_range = range(self.enemy); + enemy_yaw = vectoyaw(self.enemy.origin - self.origin); + if (self.attack_state == 4) + { + ai_run_missile(); + return; + } + if (self.attack_state == 3) + { + ai_run_melee(); + return; + } + if (CheckAnyAttack()) + { + return; + } + if (self.attack_state == 2) + { + ai_run_slide(); + return; + } + movetogoal(dist); +}; + +/* This is NOT in this version of MegaTF (it's part of XTF which I used in MegaTF United) +// XTF AI_TARGET +float (float rangeDist, float typeFlag) AI_Target = +{ + local entity client; + local entity te; + local entity targetList; + local float r; + local float gotone; + + r = TF_FLARE_LIT; + gotone = TF_FLARE_LIT; + targetList = buildTargetList (rangeDist); + targetList = sortListFrom (targetList); + while (((targetList.classname != "listTerminator") && (targetList.classname != "worldspawn"))) + { + gotone = TF_FLARE_OFF; + if (!targetList) + { + gotone = TF_FLARE_LIT; + } + if (teamplay) + { + if (((targetList.team_no == self.team_no) && (self.team_no != TF_FLARE_LIT))) + { + gotone = TF_FLARE_LIT; + } + if (((targetList.undercover_team == self.team_no) && (self.team_no != TF_FLARE_LIT))) + { + gotone = TF_FLARE_LIT; + } + } + if (((targetList == self.real_owner) || (targetList == self.owner))) + { + gotone = TF_FLARE_LIT; + } + if (targetList.is_feigning) + { + gotone = TF_FLARE_LIT; + } + if ((targetList.flags & 128)) + { + gotone = TF_FLARE_LIT; + } + if ((targetList.items & 524288)) + { + gotone = TF_FLARE_LIT; + } + if ((targetList.deadflag != TF_FLARE_LIT)) + { + gotone = TF_FLARE_LIT; + } + r = vlen ((self.origin - targetList.origin)); + if ((r > rangeDist)) + { + gotone = TF_FLARE_LIT; + } + r = range (targetList); + if (((r == 3) && (rangeDist <= 1000))) + { + gotone = TF_FLARE_LIT; + } + if ((typeFlag == TF_FLARE_LIT)) + { + if (((r == TF_FLARE_OFF) && (rangeDist >= 120))) + { + if (((targetList.show_hostile < time) && !infront (targetList))) + { + gotone = TF_FLARE_LIT; + } + } + else + { + if (((r == 2) && (rangeDist >= 500))) + { + if (!infront (targetList)) + { + gotone = TF_FLARE_LIT; + } + } + } + } + if (!visible (targetList)) + { + gotone = TF_FLARE_LIT; + } + if (gotone) + { + self.enemy = targetList; + self.goalentity = targetList; + return (gotone); + } + targetList = targetList.chain; + if ((targetList.classname == "worldspawn")) + { + dprint ("Worldspawn terminator"); + } + } + return (gotone); +}; +// END XTF +*/ \ No newline at end of file diff --git a/boss.pqc b/boss.pqc new file mode 100644 index 0000000..30f470c --- /dev/null +++ b/boss.pqc @@ -0,0 +1,701 @@ +void(vector p) boss_missile; + +entity le1, le2; +float lightning_end; + +void() boss_face = +{ + if (self.enemy.health <= TF_FLARE_LIT || random() < 0.020000) + { + self.enemy = find(self.enemy, classname, "player"); + if (!(self.enemy)) + { + self.enemy = find(self.enemy, classname, "player"); + } + } + ai_face(); +}; + +void() boss_rise1 = [0, boss_rise2] +{ + sound(self, TF_FLARE_OFF, "boss1/out1.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void() boss_rise2 = [1, boss_rise3] +{ + sound(self, 2, "boss1/sight1.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void() boss_rise3 = [2, boss_rise4] +{ +}; + +void() boss_rise4 = [3, boss_rise5] +{ +}; + +void() boss_rise5 = [4, boss_rise6] +{ +}; + +void() boss_rise6 = [5, boss_rise7] +{ +}; + +void() boss_rise7 = [6, boss_rise8] +{ +}; + +void() boss_rise8 = [7, boss_rise9] +{ +}; + +void() boss_rise9 = [8, boss_rise10] +{ +}; + +void() boss_rise10 = [9, boss_rise11] +{ +}; + +void() boss_rise11 = [10, boss_rise12] +{ +}; + +void() boss_rise12 = [11, boss_rise13] +{ +}; + +void() boss_rise13 = [12, boss_rise14] +{ +}; + +void() boss_rise14 = [13, boss_rise15] +{ +}; + +void() boss_rise15 = [14, boss_rise16] +{ +}; + +void() boss_rise16 = [15, boss_rise17] +{ +}; + +void() boss_rise17 = [16, boss_missile1] +{ +}; + +void() boss_idle1 = [17, boss_idle2] +{ +}; + +void() boss_idle2 = [18, boss_idle3] +{ + boss_face(); +}; + +void() boss_idle3 = [19, boss_idle4] +{ + boss_face(); +}; + +void() boss_idle4 = [20, boss_idle5] +{ + boss_face(); +}; + +void() boss_idle5 = [21, boss_idle6] +{ + boss_face(); +}; + +void() boss_idle6 = [22, boss_idle7] +{ + boss_face(); +}; + +void() boss_idle7 = [23, boss_idle8] +{ + boss_face(); +}; + +void() boss_idle8 = [24, boss_idle9] +{ + boss_face(); +}; + +void() boss_idle9 = [25, boss_idle10] +{ + boss_face(); +}; + +void() boss_idle10 = [26, boss_idle11] +{ + boss_face(); +}; + +void() boss_idle11 = [27, boss_idle12] +{ + boss_face(); +}; + +void() boss_idle12 = [28, boss_idle13] +{ + boss_face(); +}; + +void() boss_idle13 = [29, boss_idle14] +{ + boss_face(); +}; + +void() boss_idle14 = [30, boss_idle15] +{ + boss_face(); +}; + +void() boss_idle15 = [31, boss_idle16] +{ + boss_face(); +}; + +void() boss_idle16 = [32, boss_idle17] +{ + boss_face(); +}; + +void() boss_idle17 = [33, boss_idle18] +{ + boss_face(); +}; + +void() boss_idle18 = [34, boss_idle19] +{ + boss_face(); +}; + +void() boss_idle19 = [35, boss_idle20] +{ + boss_face(); +}; + +void() boss_idle20 = [36, boss_idle21] +{ + boss_face(); +}; + +void() boss_idle21 = [37, boss_idle22] +{ + boss_face(); +}; + +void() boss_idle22 = [38, boss_idle23] +{ + boss_face(); +}; + +void() boss_idle23 = [39, boss_idle24] +{ + boss_face(); +}; + +void() boss_idle24 = [40, boss_idle25] +{ + boss_face(); +}; + +void() boss_idle25 = [41, boss_idle26] +{ + boss_face(); +}; + +void() boss_idle26 = [42, boss_idle27] +{ + boss_face(); +}; + +void() boss_idle27 = [43, boss_idle28] +{ + boss_face(); +}; + +void() boss_idle28 = [44, boss_idle29] +{ + boss_face(); +}; + +void() boss_idle29 = [45, boss_idle30] +{ + boss_face(); +}; + +void() boss_idle30 = [46, boss_idle31] +{ + boss_face(); +}; + +void() boss_idle31 = [47, boss_idle1] +{ + boss_face(); +}; + +void() boss_missile1 = [57, boss_missile2] +{ + boss_face(); +}; + +void() boss_missile2 = [58, boss_missile3] +{ + boss_face(); +}; + +void() boss_missile3 = [59, boss_missile4] +{ + boss_face(); +}; + +void() boss_missile4 = [60, boss_missile5] +{ + boss_face(); +}; + +void() boss_missile5 = [61, boss_missile6] +{ + boss_face(); +}; + +void() boss_missile6 = [62, boss_missile7] +{ + boss_face(); +}; + +void() boss_missile7 = [63, boss_missile8] +{ + boss_face(); +}; + +void() boss_missile8 = [64, boss_missile9] +{ + boss_face(); +}; + +void() boss_missile9 = [65, boss_missile10] +{ + boss_missile('100 100 200'); +}; + +void() boss_missile10 = [66, boss_missile11] +{ + boss_face(); +}; + +void() boss_missile11 = [67, boss_missile12] +{ + boss_face(); +}; + +void() boss_missile12 = [68, boss_missile13] +{ + boss_face(); +}; + +void() boss_missile13 = [69, boss_missile14] +{ + boss_face(); +}; + +void() boss_missile14 = [70, boss_missile15] +{ + boss_face(); +}; + +void() boss_missile15 = [71, boss_missile16] +{ + boss_face(); +}; + +void() boss_missile16 = [72, boss_missile17] +{ + boss_face(); +}; + +void() boss_missile17 = [73, boss_missile18] +{ + boss_face(); +}; + +void() boss_missile18 = [74, boss_missile19] +{ + boss_face(); +}; + +void() boss_missile19 = [75, boss_missile20] +{ + boss_face(); +}; + +void() boss_missile20 = [76, boss_missile21] +{ + boss_missile('100 -100 200'); +}; + +void() boss_missile21 = [77, boss_missile22] +{ + boss_face(); +}; + +void() boss_missile22 = [78, boss_missile23] +{ + boss_face(); +}; + +void() boss_missile23 = [79, boss_missile1] +{ + boss_face(); +}; + +void() boss_shocka1 = [80, boss_shocka2] +{ +}; + +void() boss_shocka2 = [81, boss_shocka3] +{ +}; + +void() boss_shocka3 = [82, boss_shocka4] +{ +}; + +void() boss_shocka4 = [83, boss_shocka5] +{ +}; + +void() boss_shocka5 = [84, boss_shocka6] +{ +}; + +void() boss_shocka6 = [85, boss_shocka7] +{ +}; + +void() boss_shocka7 = [86, boss_shocka8] +{ +}; + +void() boss_shocka8 = [87, boss_shocka9] +{ +}; + +void() boss_shocka9 = [88, boss_shocka10] +{ +}; + +void() boss_shocka10 = [89, boss_missile1] +{ +}; + +void() boss_shockb1 = [90, boss_shockb2] +{ +}; + +void() boss_shockb2 = [91, boss_shockb3] +{ +}; + +void() boss_shockb3 = [92, boss_shockb4] +{ +}; + +void() boss_shockb4 = [93, boss_shockb5] +{ +}; + +void() boss_shockb5 = [94, boss_shockb6] +{ +}; + +void() boss_shockb6 = [95, boss_shockb7] +{ +}; + +void() boss_shockb7 = [90, boss_shockb8] +{ +}; + +void() boss_shockb8 = [91, boss_shockb9] +{ +}; + +void() boss_shockb9 = [92, boss_shockb10] +{ +}; + +void() boss_shockb10 = [93, boss_missile1] +{ +}; + +void() boss_shockc1 = [96, boss_shockc2] +{ +}; + +void() boss_shockc2 = [97, boss_shockc3] +{ +}; + +void() boss_shockc3 = [98, boss_shockc4] +{ +}; + +void() boss_shockc4 = [99, boss_shockc5] +{ +}; + +void() boss_shockc5 = [100, boss_shockc6] +{ +}; + +void() boss_shockc6 = [101, boss_shockc7] +{ +}; + +void() boss_shockc7 = [102, boss_shockc8] +{ +}; + +void() boss_shockc8 = [103, boss_shockc9] +{ +}; + +void() boss_shockc9 = [104, boss_shockc10] +{ +}; + +void() boss_shockc10 = [105, boss_death1] +{ +}; + +void() boss_death1 = [48, boss_death2] +{ + sound(self, 2, "boss1/death.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void() boss_death2 = [49, boss_death3] +{ +}; + +void() boss_death3 = [50, boss_death4] +{ +}; + +void() boss_death4 = [51, boss_death5] +{ +}; + +void() boss_death5 = [52, boss_death6] +{ +}; + +void() boss_death6 = [53, boss_death7] +{ +}; + +void() boss_death7 = [54, boss_death8] +{ +}; + +void() boss_death8 = [55, boss_death9] +{ +}; + +void() boss_death9 = [56, boss_death10] +{ + sound(self, 4, "boss1/out1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + WriteByte(4, 23); + WriteByte(4, 10); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); +}; + +void() boss_death10 = [56, boss_death10] +{ + killed_monsters = killed_monsters + TF_FLARE_OFF; + WriteByte(2, 27); + SUB_UseTargets(); + remove(self); +}; + +void(vector p) boss_missile = +{ + local vector offang; + local vector org; + local vector vec; + local vector d; + local float t; + offang = vectoangles(self.enemy.origin - self.origin); + makevectors(offang); + org = self.origin + p_x * v_forward + p_y * v_right + p_z * '0 0 1'; + if (skill > TF_FLARE_OFF) + { + t = vlen(self.enemy.origin - org) / 300; + vec = self.enemy.velocity; + vec_z = TF_FLARE_LIT; + d = self.enemy.origin + t * vec; + } + else + { + d = self.enemy.origin; + } + vec = normalize(d - org); + launch_spike(org, vec); + setmodel(newmis, "progs/lavaball.mdl"); + newmis.avelocity = '200 100 300'; + setsize(newmis, '0 0 0', '0 0 0'); + newmis.velocity = vec * 300; + newmis.touch = T_MissileTouch; + sound(self, TF_FLARE_OFF, "boss1/throw.wav", TF_FLARE_OFF, TF_FLARE_OFF); + if (self.enemy.health <= TF_FLARE_LIT) + { + boss_idle1(); + } +}; + +void() boss_awake = +{ + self.solid = 3; + self.movetype = 4; + self.takedamage = TF_FLARE_LIT; + setmodel(self, "progs/boss.mdl"); + setsize(self, '-128 -128 -24', '128 128 256'); + if (skill == TF_FLARE_LIT) + { + self.health = TF_FLARE_OFF; + } + else + { + self.health = 3; + } + self.enemy = activator; + WriteByte(4, 23); + WriteByte(4, 10); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + self.yaw_speed = 20; + boss_rise1(); +}; + +void() monster_boss = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (deathmatch) + { + dremove(self); + return; + } + precache_model("progs/boss.mdl"); + precache_model("progs/lavaball.mdl"); + precache_sound("weapons/rocket1i.wav"); + precache_sound("boss1/out1.wav"); + precache_sound("boss1/sight1.wav"); + precache_sound("misc/power.wav"); + precache_sound("boss1/throw.wav"); + precache_sound("boss1/pain.wav"); + precache_sound("boss1/death.wav"); + total_monsters = total_monsters + TF_FLARE_OFF; + self.use = boss_awake; +}; + +void() lightning_fire = +{ + local vector p1; + local vector p2; + if (time >= lightning_end) + { + self = le1; + door_go_down(); + self = le2; + door_go_down(); + return; + } + p1 = (le1.mins + le1.maxs) * 0.5; + p1_z = le1.absmin_z - 16; + p2 = (le2.mins + le2.maxs) * 0.5; + p2_z = le2.absmin_z - 16; + p2 = p2 - normalize(p2 - p1) * 100; + self.nextthink = time + 0.1; + self.think = lightning_fire; + WriteByte(2, 23); + WriteByte(2, 9); + WriteEntity(2, world); + WriteCoord(2, p1_x); + WriteCoord(2, p1_y); + WriteCoord(2, p1_z); + WriteCoord(2, p2_x); + WriteCoord(2, p2_y); + WriteCoord(2, p2_z); +}; + +void() lightning_use = +{ + if (lightning_end >= time + TF_FLARE_OFF) + { + return; + } + le1 = find(world, target, "lightning"); + le2 = find(le1, target, "lightning"); + if (!le1 || !le2) + { + dprint("missing lightning targets\n"); + return; + } + if (le1.state != TF_FLARE_LIT && le1.state != TF_FLARE_OFF || (le2.state != TF_FLARE_LIT && le2.state != TF_FLARE_OFF) || le1.state != le2.state) + { + return; + } + le1.nextthink = -1; + le2.nextthink = -1; + lightning_end = time + TF_FLARE_OFF; + sound(self, 2, "misc/power.wav", TF_FLARE_OFF, TF_FLARE_OFF); + lightning_fire(); + self = find(world, classname, "monster_boss"); + if (!self) + { + return; + } + self.enemy = activator; + if (le1.state == TF_FLARE_LIT && self.health > TF_FLARE_LIT) + { + sound(self, 2, "boss1/pain.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.health = self.health - TF_FLARE_OFF; + if (self.health >= 2) + { + boss_shocka1(); + } + else + { + if (self.health == TF_FLARE_OFF) + { + boss_shockb1(); + } + else + { + if (self.health == TF_FLARE_LIT) + { + boss_shockc1(); + } + } + } + } +}; + +void() event_lightning = +{ + self.use = lightning_use; +}; + diff --git a/buttons.pqc b/buttons.pqc new file mode 100644 index 0000000..88692a8 --- /dev/null +++ b/buttons.pqc @@ -0,0 +1,159 @@ +void() button_wait; +void() button_return; + +void() button_wait = +{ + self.state = TF_FLARE_LIT; + self.nextthink = self.ltime + self.wait; + self.think = button_return; + activator = self.enemy; + SUB_UseTargets(); + self.frame = TF_FLARE_OFF; +}; + +void() button_done = +{ + self.state = TF_FLARE_OFF; +}; + +void() button_return = +{ + self.goal_state = 2; + self.state = 3; + SUB_CalcMove(self.pos1, self.speed, button_done); + self.frame = TF_FLARE_LIT; + if (self.health) + { + self.takedamage = TF_FLARE_OFF; + } +}; + +void() button_blocked = +{ +}; + +void() button_fire = +{ + if (self.state == 2 || self.state == TF_FLARE_LIT) + { + return; + } + sound(self, 2, self.noise, TF_FLARE_OFF, TF_FLARE_OFF); + self.state = 2; + SUB_CalcMove(self.pos2, self.speed, button_wait); +}; + +void() button_use = +{ + self.enemy = activator; + button_fire(); +}; + +void() button_touch = +{ + local entity te; + if (other.classname != "player") + { + return; + } + if (self.goal_activation & 8) + { + return; + } + if (!Activated(self, other)) + { + if (self.else_goal != TF_FLARE_LIT) + { + te = Findgoal(self.else_goal); + if (te) + { + DoResults(te, other, self.goal_result & 2); + } + } + return; + } + self.enemy = other; + button_fire(); +}; + +void() button_killed = +{ + if (self.goal_activation & 8) + { + return; + } + self.enemy = damage_attacker; + self.health = self.max_health; + self.takedamage = TF_FLARE_LIT; + button_fire(); +}; + +void() func_button = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (self.sounds == TF_FLARE_LIT) + { + precache_sound("buttons/airbut1.wav"); + self.noise = "buttons/airbut1.wav"; + } + if (self.sounds == TF_FLARE_OFF) + { + precache_sound("buttons/switch21.wav"); + self.noise = "buttons/switch21.wav"; + } + if (self.sounds == 2) + { + precache_sound("buttons/switch02.wav"); + self.noise = "buttons/switch02.wav"; + } + if (self.sounds == 3) + { + precache_sound("buttons/switch04.wav"); + self.noise = "buttons/switch04.wav"; + } + if (self.sounds == 4) + { + precache_sound("effects/rockfall.wav"); + self.noise = "effects/rockfall.wav"; + } + SetMovedir(); + self.movetype = 7; + self.solid = 4; + setmodel(self, self.model); + self.blocked = button_blocked; + self.use = button_use; + if (self.health) + { + self.max_health = self.health; + self.th_die = button_killed; + self.takedamage = TF_FLARE_OFF; + } + else + { + self.touch = button_touch; + } + if (!(self.speed)) + { + self.speed = 40; + } + if (!(self.wait)) + { + self.wait = TF_FLARE_OFF; + } + if (!(self.lip)) + { + self.lip = 4; + } + self.state = TF_FLARE_OFF; + self.pos1 = self.origin; + self.pos2 = self.pos1 + self.movedir * (fabs(self.movedir * self.size) - self.lip); + if (self.spawnflags & 32) + { + button_fire(); + } +}; + diff --git a/camera.pqc b/camera.pqc new file mode 100644 index 0000000..70b5545 --- /dev/null +++ b/camera.pqc @@ -0,0 +1,984 @@ +/*====================================================== + CAMERA.QC TeamFortress v2.5 + + (c) TeamFortress Software Pty Ltd 29/2/97 +======================================================== +Functions for the CAMERA behaviour +========================================================*/ +// Functions outside this file + +// Functions inside this file +void() CamLock; +void() CamDistLock; +void() CamVecLock; +void() CamAngleLock; +void() CamRevAngleLock; +void() CamProjectileLock; +void() CamProjectileZoom; +void() CamProjectileLockOn; +void() CamProjectileLockOff; +void() CamOffset; +void() CamDrop; +void() fadetoblack; +void() fadefromblack; +void() fadetowhite; +void() fadefromwhite; + +//====================================================== +void() CamLock = +{ + local entity te; + + // CameraMan special locks onto an entity + if (self.enemy == world) + { + // Find the entity which matches our netname + te = find(world, netname, self.netname); + while (te) + { + if (te != self) + { + sprint3(self, 2, "Locked onto ", te.netname, "\n"); + self.enemy = te; + self.heat = vlen(self.enemy.origin - self.origin); + } + + te = find(te, netname, self.netname); + } + + if (self.enemy == world) + sprint2(self, 2, te.netname, " not found.\n"); + } + else + { + sprint(self, 2, "Removed Lock\n"); + self.enemy = world; + } +}; + +//====================================================== +void() CamDistLock = +{ + if (self.tfstate & 4096) + { + sprint(self, 2, "Distance Lock OFF.\n"); + self.tfstate = self.tfstate - (self.tfstate & 4096); + } + else + { + sprint(self, 2, "Distance Lock ON.\n"); + self.tfstate = self.tfstate | 4096; + if (self.enemy) + self.camdist = vlen(self.enemy.origin - self.origin); + } +}; + +//====================================================== +void() CamVecLock = +{ + if (self.tfstate & 2048) + { + sprint(self, 2, "Vector Lock OFF.\n"); + self.tfstate = self.tfstate - (self.tfstate & 2048); + } + else + { + // Make sure Vector Lock isn't on + if (self.tfstate & 32768) + { + sprint(self, 2, "Angle Lock OFF.\n"); + self.tfstate = self.tfstate - (self.tfstate & 32768); + } + // Make sure Distance Lock is on + if (!(self.tfstate & 4096)) + { + sprint(self, 2, "Vector And Distance Lock ON.\n"); + self.tfstate = self.tfstate | 4096; + if (self.enemy) + self.camdist = vlen(self.enemy.origin - self.origin); + } + else + { + sprint(self, 2, "Vector Lock ON.\n"); + } + self.tfstate = self.tfstate | 2048; + if (self.enemy) + { + self.camangle = self.origin - self.enemy.origin; + self.camangle_z = 0 - self.camangle_z; + self.camangle = vectoangles(self.camangle); + } + } +}; + +//====================================================== +void() CamAngleLock = +{ + local vector enemyang; + + if (self.tfstate & 32768) + { + sprint(self, 2, "Angle Lock OFF.\n"); + self.tfstate = self.tfstate - (self.tfstate & 32768); + } + else + { + // Make sure Vector Lock isn't on + if (self.tfstate & 2048) + { + sprint(self, 2, "Vector Lock OFF.\n"); + self.tfstate = self.tfstate - (self.tfstate & 2048); + } + // Make sure Distance Lock is on + if (!(self.tfstate & 4096)) + { + sprint(self, 2, "Angle And Distance Lock ON.\n"); + self.tfstate = self.tfstate | 4096; + if (self.enemy) + self.camdist = vlen(self.enemy.origin - self.origin); + } + else + { + sprint(self, 2, "Angle Lock ON.\n"); + } + self.tfstate = self.tfstate | 32768; + if (self.enemy) + { + enemyang = self.enemy.angles; + enemyang_z = 0 - enemyang_z; + self.camangle = self.origin - self.enemy.origin; + self.camangle_z = 0 - self.camangle_z; + self.camangle = vectoangles(self.camangle); + self.camangle = self.camangle - enemyang; + } + } +}; + +//====================================================== +void() CamRevAngleLock = +{ + local vector enemyang; + + if (self.tfstate & 32) + { + sprint(self, 2, "Reverse Angle Lock OFF.\n"); + self.tfstate = self.tfstate - (self.tfstate & 32); + } + else + { + // Make sure Vector Lock isn't on + if (self.tfstate & 2048) + { + sprint(self, 2, "Vector Lock OFF.\n"); + self.tfstate = self.tfstate - (self.tfstate & 2048); + } + // Make sure Angle Lock isn't on + if (self.tfstate & 32768) + { + sprint(self, 2, "Angle Lock OFF.\n"); + self.tfstate = self.tfstate - (self.tfstate & 32768); + } + // Make sure Distance Lock is on + if (!(self.tfstate & 4096)) + { + sprint(self, 2, "Reverse Angle And Distance Lock ON.\n"); + self.tfstate = self.tfstate | 4096; + if (self.enemy) + self.camdist = vlen(self.enemy.origin - self.origin); + } + else + { + sprint(self, 2, "Reverse Angle Lock ON.\n"); + } + self.tfstate = self.tfstate | 32; + if (self.enemy) + { + enemyang = self.enemy.angles; + enemyang_z = 0 - enemyang_z; + self.camangle = self.origin - self.enemy.origin; + self.camangle_z = 0 - self.camangle_z; + self.camangle = vectoangles(self.camangle); + self.camangle = self.camangle - enemyang; + } + } +}; + +//====================================================== +void() CamProjectileLock = +{ + local entity te; + + if (self.tfstate & 512) + { + sprint(self, 2, "Projectile Lock OFF.\n"); + self.tfstate = self.tfstate - (self.tfstate & 512); + + live_camera = 0; + te = find(world, classname, "player"); + while ((te != world) && (live_camera == 0)) + { + if (te.playerclass == 0 && te.tfstate & 512) + live_camera = 1; + + te = find(te, classname, "player"); + } + } + else + { + sprint(self, 2, "Projectile Lock ON.\n"); + self.tfstate = self.tfstate | 512; + live_camera = 1; + } +}; + +//====================================================== +void() CamProjectileZoom = +{ + if (self.tfstate & 256) + { + sprint(self, 2, "Projectile Zoom OFF.\n"); + self.tfstate = self.tfstate - (self.tfstate & 256); + } + else + { + sprint(self, 2, "Projectile Zoom ON.\n"); + self.tfstate = self.tfstate | 256; + } +}; + +//====================================================== +void() CamProjectileLockOn = +{ + local entity te; + local float lockon; + local vector enemyang; + + lockon = 0; + te = find(world, classname, "player"); + while (te) + { + // Is it a camera wih projectile lock on? + if (te.playerclass == 0 && te.tfstate & 512) + { + if (te.enemy != world) + { + if (te.enemy == self) + lockon = 1; + } + else + { + // See if the camera is within sight + traceline(te.origin, self.origin, 0, te); + if (trace_ent == self) + lockon = 1; + } + + if (lockon) + { + // Turn off the camera's projectile lock + te.tfstate = te.tfstate - (te.tfstate & 512); + sprint(te, 2, "Projectile Locked!\n"); + te.enemy = newmis; + newmis.enemy = te; + + // If Projectile Zoom is on, get into position + if (te.tfstate & 256) + { + // Move the camera + enemyang = normalize(te.enemy.velocity) * 20; + enemyang_z = 0 - enemyang_z; + setorigin(te, te.enemy.origin - enemyang); + + // Turn on Distance Lock + te.tfstate = te.tfstate | 4096; + te.camdist = 20; + + // Angle + te.camangle = vectoangles(te.enemy.velocity); + te.camangle_z = 0 - te.camangle_z; + } + } + } + + te = find(te, classname, "player"); + } +}; + +//====================================================== +void() CamProjectileLockOff = +{ + sprint(self.enemy, 2, "Removed Lock\n"); + self.enemy.enemy = world; +}; + +//====================================================== +void() CamOffset = +{ + if (self.view_ofs == '0 0 22') + self.view_ofs = '0 0 18'; + else if (self.view_ofs == '0 0 18') + self.view_ofs = '0 0 13'; + else if (self.view_ofs == '0 0 13') + self.view_ofs = '0 0 7'; + else if (self.view_ofs == '0 0 7') + self.view_ofs = '0 0 1'; + else if (self.view_ofs == '0 0 1') + self.view_ofs = '0 0 -10'; + else if (self.view_ofs == '0 0 -10') + self.view_ofs = '0 0 -18'; + else + self.view_ofs = '0 0 22'; +}; + +//====================================================== +void() CamDrop = +{ + local entity te, prevte, cam; + local float tf; + local string st; + + cam = spawn(); + cam.classname = "camera"; + cam.origin = self.origin + self.view_ofs; + cam.angles = self.angles; + setmodel(cam,"progs/spike.mdl"); + + tf = 1; + prevte = self; + te = self.camera_list; + while (te != world) + { + tf = tf + 1; + prevte = te; + te = te.camera_list; + } + prevte.camera_list = cam; + + st = ftos(tf); + sprint3(self, 2, "Camera ", st, " dropped.\n"); +}; + +//====================================================== +// Fade functions from the brilliant +// Operation Bayshield movie, by the Undead Clan. +// Cameraman must be the server to use them. +void() fadetoblack = +{ + local float fade; + local string x; + + fade = 10; + while( fade <= 250 ) + { + x = ftos( fade ); + stuffcmd( self, "v_cshift 0 0 0 " ); + stuffcmd( self, x ); + stuffcmd( self, ";wait\n" ); + fade = fade + 10; + } + stuffcmd( self, "v_cshift 0 0 0 255\n" ); +}; + +void() fadefromblack = +{ + local float fade; + local string x; + + fade = 250; + while( fade >= 0 ) + { + x = ftos( fade ); + stuffcmd( self, "v_cshift 0 0 0 " ); + stuffcmd( self, x ); + stuffcmd( self, ";wait\n" ); + fade = fade - 10; + } + stuffcmd( self, "v_cshift 0 0 0 0\n" ); +}; + + +void() fadetowhite = +{ + local float fade; + local string x; + + fade = 10; + while( fade <= 250 ) + { + x = ftos( fade ); + stuffcmd( self, "v_cshift 255 255 255 " ); + stuffcmd( self, x ); + stuffcmd( self, ";wait\n" ); + fade = fade + 10; + } + stuffcmd( self, "v_cshift 255 255 255 255\n" ); +}; + +void() fadefromwhite = +{ + local float fade; + local string x; + + fade = 250; + while( fade >= 0 ) + { + x = ftos( fade ); + stuffcmd( self, "v_cshift 255 255 255 " ); + stuffcmd( self, x ); + stuffcmd( self, ";wait\n" ); + fade = fade - 10; + } + stuffcmd( self, "v_cshift 0 0 0 0\n" ); +}; + +// MTF .04 stuff + + + +void () prop_die = +{ + + self.owner.health = 0; + Killed (self.owner, self.enemy); + self = self.owner; + LookThroughCam (); +}; + +void () prop_think = +{ + + if ((self.origin != self.cam_origin)) + { + setorigin (self, self.cam_origin); + } + player_run (); +}; + +void (entity _p_1745, vector _p_1746, float _p_1749, float _p_1750, float _p_1751) Spawn_Prop = +{ + local entity _l_1752; + local vector _l_1753; + + _l_1752 = self; + _l_1753 = '0.200000 1 0.200000'; + newmis = spawn (); + self = newmis; + newmis.movetype = 6; + if ((_p_1750 == 1)) + { + newmis.solid = 2; + } + else + { + newmis.solid = 0; + } + newmis.mdl = "progs/player.mdl"; + setmodel (newmis, newmis.mdl); + setsize (newmis, '-16 -16 -24', '16 16 32'); + newmis.classname = "player_prop"; + setorigin (newmis, _p_1746); + newmis.cam_origin = _p_1746; + makevectors (_p_1745.v_angle); + v_forward_z = v_forward_z / 12; + newmis.angles = vectoangles (v_forward); + newmis.team_no = _p_1745.team_no; + newmis.undercover_team = _p_1745.undercover_team; + newmis.is_feigning = _p_1745.is_feigning; + newmis.owner = _p_1745; + newmis.skin = _p_1745.skin; + newmis.colormap = _p_1745.colormap; + newmis.bugger = _p_1751; + newmis.th_pain = player_pain; + newmis.th_die = prop_die; + newmis.think = prop_think; + if ((_p_1745.is_squating == 0)) + { + if ((newmis.is_feigning == 1)) + { + if (((_p_1745.frame >= 41) && (_p_1745.frame <= 49))) + { + spy_die_ax9 (); + } + else + { + if (((_p_1745.frame >= 50) && (_p_1745.frame <= 60))) + { + spy_diea11 (); + } + else + { + if (((_p_1745.frame >= 61) && (_p_1745.frame <= 69))) + { + spy_dieb9 (); + } + else + { + if (((_p_1745.frame >= 70) && (_p_1745.frame <= 84))) + { + spy_diec15 (); + } + else + { + if (((_p_1745.frame >= 85) && (_p_1745.frame <= 93))) + { + spy_died9 (); + } + else + { + if (((_p_1745.frame >= 94) && (_p_1745.frame <= 102))) + { + spy_diee9 (); + } + } + } + } + } + } + } + } + else + { + newmis.frame = 57; + newmis.is_squating = 1; + setsize (self, '-16 -16 -24', '16 16 8'); + } + newmis.nextthink = (time + 0.500000); + newmis.current_weapon = _p_1745.current_weapon; + if ((newmis.is_feigning == 0)) + { + newmis.frame = _p_1745.frame; + } + if ((_p_1750 == 1)) + { + newmis.takedamage = 2; + newmis.health = _p_1745.health; + } + else + { + newmis.takedamage = 0; + } + if ((_p_1749 & 2)) + { + newmis.ammo_shells = _p_1745.ammo_shells; + } + if ((_p_1749 & 4)) + { + newmis.ammo_nails = _p_1745.ammo_nails; + } + if ((_p_1749 & 8)) + { + newmis.ammo_rockets = _p_1745.ammo_rockets; + } + if ((_p_1749 & 16)) + { + newmis.ammo_cells = _p_1745.ammo_cells; + } + if ((_p_1749 & 32)) + { + newmis.armorvalue = _p_1745.armorvalue; + } + self = _l_1752; +}; + +vector (entity _p_1782, float _p_1783) Remove_Prop = +{ + local entity _l_1784; + local vector _l_1785; + + _l_1784 = find (world, classname, "player_prop"); + while (_l_1784) + { + if ((_l_1784.owner == _p_1782)) + { + if ((_l_1784.health != 0)) + { + _p_1782.health = _l_1784.health; + } + if ((_l_1784.ammo_shells != 0)) + { + _p_1782.ammo_shells = _l_1784.ammo_shells; + } + if ((_l_1784.ammo_nails != 0)) + { + _p_1782.ammo_nails = _l_1784.ammo_nails; + } + if ((_l_1784.ammo_rockets != 0)) + { + _p_1782.ammo_rockets = _l_1784.ammo_rockets; + } + if ((_l_1784.ammo_cells != 0)) + { + _p_1782.ammo_cells = _l_1784.ammo_cells; + } + if ((_l_1784.armorvalue != 0)) + { + _p_1782.armorvalue = _l_1784.armorvalue; + } + _l_1785 = _l_1784.origin; + dremove (_l_1784); + return (_l_1785); + } + _l_1784 = find (_l_1784, classname, "player_prop"); + } + return _l_1785; +}; + +void () CamAttach = +{ + + self.think = SUB_Null; + self.nextthink = (time - 1); + sound (newmis, 0, "buttons/switch02.wav", 1, 1); +}; +.float DropFlagDelay; + +void () Cam = +{ + local vector _l_1799; + local vector _l_1802; + local entity _l_1805; + local entity _l_1806; + local vector _l_1807; + + _l_1805 = find (world, classname, "camera"); + while (_l_1805) + { + if ((_l_1805.owner == self)) + { + LookThroughCam (); + return; + } + _l_1805 = find (_l_1805, classname, "camera"); + } + if ((self.is_feigning == 1)) + { + return; + } + if ((self.no_grenades_2 < 1)) + { + sprint (self, 2, "Not enough type 2 grenades... get more\n"); + self.impulse = 0; + if ((self.weaponmodel == "progs/spycamb.mdl")) + { + self.weaponmodel = "progs/v_shot.mdl"; + self.currentammo = self.ammo_nails; + Attack_Finished (0.700000); + self.impulse = 0; + self.StatusRefreshTime = (time + 0.100000); + self.tfstate = (self.tfstate - (self.tfstate & 2)); + } + return; + } + if ((self.weaponmodel != "progs/spycamb.mdl")) + { + self.tfstate = (self.tfstate | 2); + self.oldweaponmodel = self.weaponmodel; + self.oldcurrentammo = self.currentammo; + self.currentammo = 1; + self.weaponmodel = "progs/spycamb.mdl"; + self.weaponframe = 0; + return; + } + makevectors (self.v_angle); + _l_1799 = self.origin + (v_forward * 10); +// = self.absmin_z + (self.size_z * 0.700000); + traceline (_l_1799, (_l_1799 + (v_forward * 43)), 0, self); + _l_1802 = trace_endpos - (v_forward * 8); + if ((trace_fraction != 1)) + { + sprint (self, 2, "Camera set! Drop3 looks through it.\n"); + self.no_grenades_2 = (self.no_grenades_2 - 1); + _l_1807 = self.angles + '0 180 90'; + _l_1807_x = _l_1807_x * 12; + _l_1807_x = rint ((_l_1807_x / 90)) * 90; +// _l_1807_y = rint (( / 90)) * 90; +// _l_1807_y = rint (( / 90)) * 90; +// if ((((_l_1807_y - self.origin_z) <= -14) && ((_l_1807_y - self.origin_z) >= -18))) +// { +// _l_1807 = '-270 180 90'; +// } + newmis = spawn (); + newmis.classname = "camera"; + newmis.owner = self; + newmis.netname = "camera"; + newmis.weapon = 41; + newmis.movetype = 0; + newmis.solid = 2; + newmis.team_no = self.team_no; + newmis.health = 25; + newmis.takedamage = 0; + newmis.th_die = camera_die; + setsize (newmis, '-2 -2 -2', '2 2 2'); + newmis.angles = _l_1807; + newmis.nextthink = (time - 1); + newmis.playerclass = 0; + newmis.think = SUB_Null; + newmis.skin = 0; + newmis.frame = 0; + setmodel (newmis, "progs/spycamc.mdl"); + setorigin (newmis, _l_1802); + _l_1806 = newmis; + newmis = spawn (); + newmis.classname = "camera_base"; + newmis.owner = self; + newmis.netname = "camera_base"; + newmis.movetype = 0; + newmis.solid = 0; + newmis.team_no = self.team_no; + newmis.takedamage = 0; + setsize (newmis, '-2 -2 -2', '2 2 2'); + newmis.angles = _l_1807; + newmis.playerclass = 0; + newmis.frame = 1; + newmis.think = camera_expire; + newmis.nextthink = (time + 180); + setmodel (newmis, "progs/spycamb.mdl"); + setorigin (newmis, _l_1802); + if ((self.oldweaponmodel != "")) + { + self.tfstate = (self.tfstate - (self.tfstate & 2)); + } + self.weaponmodel = self.oldweaponmodel; + self.currentammo = self.oldcurrentammo; + Attack_Finished (0.700000); + self.impulse = 0; + self.StatusRefreshTime = (time + 0.100000); + } +}; + +void () camerathink = +{ + + if ((self.cnt != 1)) + { + self.think = SUB_Null; + return; + } + if ((self.owner.origin != self.owner.cam_origin)) + { + setorigin (self.owner, self.owner.cam_origin); + } + makevectors (self.owner.v_angle); + self.angles = vectoangles (v_forward); + self.nextthink = (time + 0.200000); +}; + +void () LookThroughCam = +{ + local entity _l_1853; + local entity _l_1854; + local entity _l_1855; + local vector _l_1856; + local float _l_1859; + local vector _l_1860; + local string _l_1863; + + _l_1863 = "camera"; + _l_1853 = find (world, netname, _l_1863); + while (_l_1853) + { + if ((_l_1853.classname == "camera")) + { + if ((_l_1853.owner == self)) + { + if ((self.tfstate & 1)) + { + TeamFortress_ThrowGrenade (); + self.nextthink = (time + 0.300000); + self.think = LookThroughCam; + return; + } + if ((self.tfstate & 16)) + { + sprint (self, 2, "You can't view your camera while infected\n"); + self.impulse = 0; + return; + } + if ((_l_1853.cnt == 1)) + { + _l_1853.cnt = 0; + _l_1853.skin = 0; + _l_1853.think = SUB_Null; + _l_1860 = Remove_Prop (self, 2); + if ((self.health > 0)) + { + self.solid = 3; + self.oldangle_x = (self.oldangle_x * -1); + makevectors (self.oldangle); + self.angles = vectoangles (v_forward); + self.fixangle = 1; + } + self.currentammo = self.ammo_shells; + self.bugger = 0; + self.gravity = 1; + stuffcmd (self, "r_drawviewmodel 1\n"); + self.modelindex = modelindex_player; + TeamFortress_SetSpeed (self); + setorigin (self, _l_1860); + self.impulse = 0; + return; + } + if ((_l_1853.cnt == 0)) + { + _l_1854 = findradius (_l_1853.origin, 32); + _l_1859 = 1; + while ((_l_1854 != world)) + { + if ((self == _l_1854)) + { + _l_1859 = 0; + } + _l_1854 = _l_1854.chain; + } + if ((_l_1859 == 1)) + { + if (!(self.flags & 512)) + { + sprint (self, 2, "You can't view your camera while in the air\n"); + self.impulse = 0; + return; + } + if (self.hook_out) + { + return; + } + _l_1855 = find (world, classname, "item_tfgoal"); + while (_l_1855) + { + if ((_l_1855.owner == self)) + { + self.DropFlagDelay = time; + DropFlag (); + _l_1855 = world; + } + _l_1855 = find (_l_1855, classname, "item_tfgoal"); + } + _l_1853.skin = 1; + _l_1853.think = camerathink; + _l_1853.nextthink = (time + 0.200000); + self.oldangle = self.v_angle; + Spawn_Prop (self, self.origin, 63, 1, 8); + self.modelindex = modelindex_null; + self.solid = 0; + self.gravity = 0; + stuffcmd (self, "cl_movespeedkey 1\n"); + self.maxspeed = 0; + self.maxfbspeed = 0; + self.maxstrafespeed = 0; +// if (1) +// { + stuffcmd (self, "m_forward 0\n"); + stuffcmd (self, "m_side 0\n"); +// } + self.velocity = '0 0 0'; + stuffcmd (self, "cl_backspeed 0\n"); + stuffcmd (self, "cl_forwardspeed 0\n"); + stuffcmd (self, "cl_sidespeed 0\n"); + makevectors (_l_1853.angles); + self.angles = vectoangles (v_forward); + self.fixangle = 1; + _l_1855 = find (world, classname, "camera_base"); + while (_l_1855) + { + if ((_l_1855.owner == self)) + { + makevectors (_l_1855.angles); + v_forward_z = v_forward_z * -1; + _l_1856 = '0 0 -24'; + if (((self.is_feigning == 1) && (_l_1855.angles_x == -270))) + { + _l_1856 = '0 0 -8'; + } + setorigin (self, ((_l_1853.origin + _l_1856) + (v_forward * 4))); + self.cam_origin = ((_l_1853.origin + _l_1856) + (v_forward * 4)); + } + _l_1855 = find (_l_1855, classname, "camera_base"); + } + _l_1853.cnt = 1; + self.bugger = 8; + self.impulse = 0; + stuffcmd (self, "r_drawviewmodel 0\n"); + self.health = _l_1853.health; + self.ammo_shells = 0; + self.ammo_nails = 0; + self.ammo_rockets = 0; + self.ammo_cells = 0; + self.armorvalue = 0; + self.currentammo = 0; + return; + } + else + { + sprint (self, 2, "You are too close to your camera to look through it.\n"); + self.impulse = 0; + return; + } + } + return; + } + } + _l_1853 = find (_l_1853, netname, _l_1863); + } + sprint (self, 2, "First drop a camera with drop3\n"); + self.impulse = 0; +}; + +void () camera_expire = +{ + local entity _l_1909; + + _l_1909 = find (world, classname, "camera"); + while (_l_1909) + { + if ((_l_1909.owner == self.owner)) + { + camera_die (_l_1909); + return; + } + _l_1909 = find (_l_1909, classname, "camera"); + } +}; + +void (entity _p_1912) camera_die = +{ + local entity _l_1913; + + self = _p_1912; + _p_1912.effects = 4; + _p_1912.takedamage = 0; + make_explosion (); + self = _p_1912.owner; + sprint (self, 2, "Your camera went bye-bye.\n"); + if ((_p_1912.cnt == 1)) + { + LookThroughCam (); + } + _l_1913 = find (world, classname, "camera"); + while (_l_1913) + { + if ((_l_1913.owner == self)) + { + dremove (_l_1913); + } + _l_1913 = find (_l_1913, classname, "camera"); + } + _l_1913 = find (world, classname, "camera_base"); + while (_l_1913) + { + if ((_l_1913.owner == self)) + { + dremove (_l_1913); + } + _l_1913 = find (_l_1913, classname, "camera_base"); + } +}; + +void () activatecam = +{ + if ((other.classname == "player")) + { + return; + } + self.cnt = 0; + self.touch = SUB_Null; +}; diff --git a/clan.pqc b/clan.pqc new file mode 100644 index 0000000..47900d7 --- /dev/null +++ b/clan.pqc @@ -0,0 +1,386 @@ +void () DumpClanScores = +{ + local float winners; + local float no_teams; + local float printed; + local float ti; + //local float teamfrags; + local string st; + local entity te; + local float t1_pl; local string players1; /*local float t1_unacc; local string t1frags; local string t1unaccfrags;*/ local string t1score; + local float t2_pl; local string players2; /*local float t2_unacc; local string t2frags; local string t2unaccfrags;*/ local string t2score; + local float t3_pl; local string players3; /*local float t3_unacc; local string t3frags; local string t3unaccfrags;*/ local string t3score; + local float t4_pl; local string players4; /*local float t4_unacc; local string t4frags; local string t4unaccfrags;*/ local string t4score; + local string space1; local string space2; local string space3; + + t1_pl = TeamFortress_TeamGetNoPlayers (1); + t2_pl = TeamFortress_TeamGetNoPlayers (2); + t3_pl = TeamFortress_TeamGetNoPlayers (3); + t4_pl = TeamFortress_TeamGetNoPlayers (4); + + printed = 0; + no_teams = 0; + + if (t1_pl) { + no_teams = no_teams + 1; + } + if (t2_pl) { + no_teams = no_teams + 1; + } + if (t3_pl) { + no_teams = no_teams + 1; + } + if (t4_pl) { + no_teams = no_teams + 1; + } + //if (no_teams < 2) { + //return; + //} + //t4_unacc = 0; + // t3_unacc = 0; + // t2_unacc = 0; + // t1_unacc = 0; + + ti = 0; + /* + te = find (world, classname, "player"); + while (te) { + if (te.team_no == 1) { + t1_unacc = t1_unacc + te.real_frags; + } else if (te.team_no == 2) { + t2_unacc = t2_unacc + te.real_frags; + } else if (te.team_no == 3) { + t3_unacc = t3_unacc + te.real_frags; + } else if (te.team_no == 4) { + t4_unacc = t4_unacc + te.real_frags; + } + te = find (te, classname, "player"); + } + t1_unacc = team1frags - t1_unacc; + t2_unacc = team2frags - t2_unacc; + t3_unacc = team3frags - t3_unacc; + t4_unacc = team4frags - t4_unacc; + */ + winners = TeamFortress_TeamGetWinner (); + + bprint (2, "\n\n=-------= \sMatch Results\s =-------="); //covers all four teams + + //Print team names + bprint (2, "\nTeam: "); + if (t1_pl > 0) { bprint (2, "blue"); } + else { bprint (2, " "); } + if (t2_pl > 0) { bprint (2, " red"); } + else { bprint (2, " "); } + if (t3_pl > 0) { bprint (2, " grn"); } + else { bprint (2, " "); } + if (t4_pl > 0) { bprint (2, " yell"); } + + //Print the number of PLAYERS per team, assume 99 max players (two digits) + bprint (2, "\nPlayers: "); + + players1 = " "; + players2 = " "; + players3 = " "; + space1 = ""; + space2 = ""; + space3 = ""; + + if (t1_pl > 0) { // players1 + space1 should add to "5" (4 chars for score, 1 for space) + players1 = ftos (TeamFortress_TeamGetNoPlayers (1)); + + if (strlen(players1) == 1) + space1 = " "; + else if (strlen(players1) == 2) + space1 = " "; + else if (strlen(players1) == 3) + space1 = " "; + else if (strlen(players1) > 3) { // it's 4 or more? + players1 = substring(players1, 0, 4); // just take first 4 chars of score + space1 = " "; + } + } + + if (t2_pl > 0) { + players2 = ftos (TeamFortress_TeamGetNoPlayers (2)); + + if (strlen(players2) == 1) + space2 = " "; + if (strlen(players2) == 2) + space2 = " "; + else if (strlen(players2) == 3) + space2 = " "; + else if (strlen(players2) > 3) { // it's 4 or more? + players2 = substring(players2, 0, 4); + space2 = " "; + } + } + + if (t3_pl > 0) { + players3 = ftos (TeamFortress_TeamGetNoPlayers (3)); + + if (strlen(players3) == 1) + space3 = " "; + if (strlen(players3) == 2) + space3 = " "; + else if (strlen(players3) == 3) + space3 = " "; + else if (strlen(players3) > 3) { // it's 4 or more? + players3 = substring(players3, 0, 4); + space3 = " "; + } + } + + if (t4_pl > 0) { + players4 = ftos (TeamFortress_TeamGetNoPlayers (4)); + players4 = substring(players4, 0, 4); //let's just make sure it's at most 4 characters + } + + bprint2 (2, players1, space1, players2, space2, players3, space3, players4); + +/* //Print the number of FRAGS per team, assuming 9999 max frags + bprint (2, "\nFrags: "); + + t1frags = " "; + t2frags = " "; + t3frags = " "; + space1 = ""; + space2 = ""; + space3 = ""; + + if (t1_pl > 0) { // t1frags + space1 should add to "5" (4 chars for score, 1 for space) + t1frags = ftos (team1frags); + + if (strlen(t1frags) == 1) + space1 = " "; + else if (strlen(t1frags) == 2) + space1 = " "; + else if (strlen(t1frags) == 3) + space1 = " "; + else if (strlen(t1frags) > 3) { // it's 4 or more? + t1frags = substring(t1frags, 0, 4); // just take first 4 chars of score + space1 = " "; + } + } + + if (t2_pl > 0) { + t2frags = ftos (team2frags); + + if (strlen(t2frags) == 1) + space2 = " "; + if (strlen(t2frags) == 2) + space2 = " "; + else if (strlen(t2frags) == 3) + space2 = " "; + else if (strlen(t2frags) > 3) { // it's 4 or more? + t2frags = substring(t2frags, 0, 4); + space2 = " "; + } + } + + if (t3_pl > 0) { + t3frags = ftos (team3frags); + + if (strlen(t3frags) == 1) + space3 = " "; + if (strlen(t3frags) == 2) + space3 = " "; + else if (strlen(t3frags) == 3) + space3 = " "; + else if (strlen(t3frags) > 3) { // it's 4 or more? + t3frags = substring(t3frags, 0, 4); + space3 = " "; + } + } + + if (t4_pl > 0) { + t4frags = ftos (team4frags); + t4frags = substring(t4frags, 0, 4); //let's just make sure it's at most 4 characters + } + + bprint2 (2, t1frags, space1, t2frags, space2, t3frags, space3, t4frags); + + + //Print UNACCOUNTED FRAGS per team, assuming 9999 max + bprint (2, "\nUnacc Frags: "); + + t1unaccfrags = " "; + t2unaccfrags = " "; + t3unaccfrags = " "; + space1 = ""; + space2 = ""; + space3 = ""; + + if (t1_pl > 0) { // t1unaccfrags + space1 should add to "5" (4 chars for score, 1 for space) + t1unaccfrags = ftos (t1_unacc); + + if (strlen(t1unaccfrags) == 1) + space1 = " "; + else if (strlen(t1unaccfrags) == 2) + space1 = " "; + else if (strlen(t1unaccfrags) == 3) + space1 = " "; + else if (strlen(t1unaccfrags) > 3) { // it's 4 or more? + t1unaccfrags = substring(t1unaccfrags, 0, 4); // just take first 4 chars of score + space1 = " "; + } + } + + if (t2_pl > 0) { + t2unaccfrags = ftos (t2_unacc); + + if (strlen(t2unaccfrags) == 1) + space2 = " "; + if (strlen(t2unaccfrags) == 2) + space2 = " "; + else if (strlen(t2unaccfrags) == 3) + space2 = " "; + else if (strlen(t2unaccfrags) > 3) { // it's 4 or more? + t2unaccfrags = substring(t2unaccfrags, 0, 4); + space2 = " "; + } + } + + if (t3_pl > 0) { + t3unaccfrags = ftos (t3_unacc); + + if (strlen(t3unaccfrags) == 1) + space3 = " "; + if (strlen(t3unaccfrags) == 2) + space3 = " "; + else if (strlen(t3unaccfrags) == 3) + space3 = " "; + else if (strlen(t3unaccfrags) > 3) { // it's 4 or more? + t3unaccfrags = substring(t3unaccfrags, 0, 4); + space3 = " "; + } + } + + if (t4_pl > 0) { + t4unaccfrags = ftos (t4_unacc); + t4unaccfrags = substring(t4unaccfrags, 0, 4); //let's just make sure it's at most 4 characters + } + + bprint2 (2, t1unaccfrags, space1, t2unaccfrags, space2, t3unaccfrags, space3, t4unaccfrags); +*/ + //Print TEAM SCORE, assuming 9999 max + bprint (2, "\nTeam Score: "); + + t1score = " "; + t2score = " "; + t3score = " "; + space1 = ""; + space2 = ""; + space3 = ""; + + if (t1_pl > 0) { // t1score + space1 should add to "5" (4 chars for score, 1 for space) + t1score = ftos (team1score); + + if (strlen(t1score) == 1) + space1 = " "; + else if (strlen(t1score) == 2) + space1 = " "; + else if (strlen(t1score) == 3) + space1 = " "; + else if (strlen(t1score) > 3) { // it's 4 or more? + t1score = substring(t1score, 0, 4); // just take first 4 chars of score + space1 = " "; + } + } + + if (t2_pl > 0) { + t2score = ftos (team2score); + + if (strlen(t2score) == 1) + space2 = " "; + if (strlen(t2score) == 2) + space2 = " "; + else if (strlen(t2score) == 3) + space2 = " "; + else if (strlen(t2score) > 3) { // it's 4 or more? + t2score = substring(t2score, 0, 4); + space2 = " "; + } + } + + if (t3_pl > 0) { + t3score = ftos (team3score); + + if (strlen(t3score) == 1) + space3 = " "; + if (strlen(t3score) == 2) + space3 = " "; + else if (strlen(t3score) == 3) + space3 = " "; + else if (strlen(t3score) > 3) { // it's 4 or more? + t3score = substring(t3score, 0, 4); + space3 = " "; + } + } + + if (t4_pl > 0) { + t4score = ftos (team4score); + t4score = substring(t4score, 0, 4); //let's just make sure it's at most 4 characters + } + + bprint2 (2, t1score, space1, t2score, space2, t3score, space3, t4score); + //End print Team Scores + + + bprint (2, "\n"); + + if ( (no_teams == 2) && (team1score == team2score) ) + bprint (2, "\sThe match is a DRAW.\s"); + else if ((no_teams == 3) && (((team1score == team2score) == team3score))) + bprint (2, "\sThe match is a DRAW.\s"); + else if ((no_teams == 4) && ((team1score == team2score) == team3score) == team4score) + bprint (2, "\sThe match is a DRAW.\s"); + else { + st = GetTeamName (winners); + bprint (2, st, " defeated "); + + if ((winners != 1) && (t1_pl != 0)) { + st = GetTeamName (1); + bprint (2, st); + printed = printed + 1; + } + if ((winners != 2) && (t2_pl != 0)) { + st = GetTeamName (2); + if (printed == no_teams) + bprint2 (2, " and ", st); + else if (printed) + bprint2 (2, ", ", st); + else + bprint (2, st); + printed = printed + 1; + } + if ((winners != 3) && (t3_pl != 0)) { + st = GetTeamName (3); + if (printed == no_teams) + bprint2 (2, " and ", st); + else if (printed) + bprint2 (2, ", ", st); + else + bprint (2, st); + printed = printed + 1; + } + if ((winners != 4) && (t4_pl != 0)) { + st = GetTeamName (4); + if (printed == no_teams) + bprint2 (2, " and ", st); + else if (printed) + bprint2 (2, ", ", st); + else + bprint (2, st); + } + } + bprint (2, "\n\n"); + + //End of match results output + te = find (world, classname, "player"); + while (te) { + st = infokey (te, "take_sshot"); + if (st != string_null) + stuffcmd (te, "screenshot\n"); + te = find (te, classname, "player"); + } +}; \ No newline at end of file diff --git a/client.pqc b/client.pqc new file mode 100644 index 0000000..efed3e2 --- /dev/null +++ b/client.pqc @@ -0,0 +1,3978 @@ +void() KickHead; +float already_cycled; +float footsteps, old_gl, exec_class; +float coloredlights; +.float dmgtime, gravity; +.float is_ingame; + +entity lastspawn_team1, lastspawn_team2, lastspawn_team3, lastspawn_team4; + +// pablo. prematch +void () SetUpPrematch; +// + +// 11.11.04 stuff +void (entity _p_11534) TeamFortress_PrintPMTimeLeft; +float footsteps; +float old_gl; +float exec_class; +float coloredlights; +float sr_gren1; +float sr_gren2; +float sr_airmirv; +void () DumpClanScores; + +// pablo. class restrictions. +float(float pc) IsRestrictedClass; +float cr_scout, cr_sniper, cr_soldier, cr_demoman, cr_medic, cr_hwguy, cr_pyro, cr_spy, cr_engineer; +// + +// more auth code +float clr_enabled; +// fin more auth + +void() set_suicide_frame; +void() player_touch; +void() TeamFortress_SetEquipment; +void() TeamFortress_SetHealth; +void(string halias, float himpulse1, float himpulse2) TeamFortress_Alias; +void() PlayerDie; +//'fer void(s) +void(entity attacker) fertimer; +void(entity te) ferdisplay; + +// prototypes +void () W_WeaponFrame; +void() W_SetCurrentAmmo; +void() player_pain; +void() player_stand1; +void (vector org) spawn_tfog; +void (vector org, entity death_owner) spawn_tdeath; +float modelindex_eyes, modelindex_player, modelindex_null; +float(float v) anglemod; + +// TeamFortress prototypes +void() TeamFortress_MOTD; +void() TeamFortress_CheckTeamCheats; +float(float tno) TeamFortress_TeamGetColor; +//void(entity Viewer, float pc, float rpc) TeamFortress_PrintClassName; +void(entity Viewer, float pc, float rpc, float xavior_Var) TeamFortress_PrintClassName; +void() TeamFortress_RemoveTimers; +void(float Suicided) TeamFortress_SetupRespawn; +void() TeamFortress_ShowTF; +float(float pc) IsLegalClass; +void() SetupTeamEqualiser; +void(entity p) SetTeamName; + +// Hook prototypes +void () Service_Grapple; + +// TeamFortressMap prototypes +void(entity AD) ParseTFDetect; +entity(float ino) Finditem; +void(entity Item, entity AP, entity Goal) tfgoalitem_GiveToPlayer; +void(entity Goal, entity AP, entity ActivatingGoal) AttemptToActivate; +void() CTF_FlagCheck; + +/* +============================================================================= + + LEVEL CHANGING / INTERMISSION + +============================================================================= +*/ + +string nextmap; + +float intermission_running; +float intermission_exittime; + + +void() info_intermission = +{ + if (CheckExistence() == 0) + { + dremove(self); + return; + } +}; + +void() SetChangeParms = +{ + if (self.health <= 0) + { + SetNewParms(); + return; + } + self.items = self.items - (self.items & (131072 | 262144 | 524288 | 1048576 | 2097152 | 4194304)); + if (self.health > 100) + { + self.health = 100; + } + if (self.health < 50) + { + self.health = 50; + } + parm1 = self.items; + parm2 = self.health; + parm3 = self.armorvalue; + if (self.ammo_shells < 25) + { + parm4 = 25; + } + else + { + parm4 = self.ammo_shells; + } + parm5 = self.ammo_nails; + parm6 = self.ammo_rockets; + parm7 = self.ammo_cells; + parm8 = self.current_weapon; + parm9 = self.armortype * 100; + parm10 = toggleflags; + parm11 = 0; + parm12 = 0; + parm13 = self.StatusBarRes; + parm14 = self.StatusBarSize; +}; + +void() SetNewParms = +{ + parm1 = 0; + parm2 = 100; + parm3 = 0; + parm4 = 25; + parm5 = 0; + parm6 = 0; + parm6 = 0; + parm8 = TF_FLARE_OFF; + parm9 = 0; + parm10 = 0; + parm11 = 0; + parm12 = 0; + parm13 = 0; + parm14 = 0; +}; + +void() autoteam_think = +{ + toggleflags = toggleflags | 64; + dremove(self); +}; + +void () DecodeLevelParms = +{ + local string mtfstring; + local entity mtfentity; + local float mtffloat; + + if (serverflags) + { + if ((world.model == "maps/start.bsp")) + { + SetNewParms (); + } + } + self.items = parm1; + self.health = parm2; + self.armorvalue = parm3; + self.ammo_shells = parm4; + self.ammo_nails = parm5; + self.ammo_rockets = parm6; + self.ammo_cells = parm7; + self.current_weapon = parm8; + self.armortype = (parm9 * 0.010000); +#ifdef tf29ents + if (!(toggleflags & TFLAG_FIRSTENTRY)) { + + toggleflags = parm10; + flagem_checked = 0; + allow_hook = 0; + invis_only = 0; + + if (coop || !deathmatch) + toggleflags = toggleflags | TFLAG_CLASS_PERSIST; + + nextmap = mapname; + allow_hook = 1; + + mtfentity = find (world, classname, "info_tfdetect"); + if (mtfentity != world) { + + if (teamplay == 0) + cvar_set ("teamplay", "21?TeamFortress"); + + ParseTFDetect (mtfentity); + + if ((number_of_teams <= 0) || (number_of_teams >= 5)) + number_of_teams = 4; + + } else { + + mtfentity = find (world, classname, "info_player_team1"); + if ((mtfentity != world) || (CTF_Map == 1)) { + + CTF_Map = 1; + if (teamplay == 0) + cvar_set ("teamplay", "21?TeamFortress"); + + mtfentity = spawn (); + mtfentity.nextthink = time + 30; + mtfentity.think = CTF_FlagCheck; + + number_of_teams = 2; + + } else + number_of_teams = 4; + + team1lives = -1; + team2lives = -1; + team3lives = -1; + team4lives = -1; + + illegalclasses1 = 0; + illegalclasses2 = 0; + illegalclasses3 = 0; + illegalclasses4 = 0; + + team1maxplayers = 100; + team2maxplayers = 100; + team3maxplayers = 100; + team4maxplayers = 100; + civilianteams = 0; + } + +#else + if ((toggleflags == 0)) + { + toggleflags = parm10; + allow_hook = 0; + invis_only = 0; + if ((coop || !deathmatch)) + { + toggleflags = toggleflags | 1; + } + nextmap = mapname; + allow_hook = 1; + mtfentity = find (world, classname, "info_tfdetect"); + if ((mtfentity != world)) + { + if ((teamplay == 0)) + { + cvar_set ("teamplay", "21?TeamFortress"); + } + ParseTFDetect (mtfentity); + if (((number_of_teams <= 0) || (number_of_teams >= 5))) + { + number_of_teams = 4; + } + } + else + { + mtfentity = find (world, classname, "info_player_team1"); + if (((mtfentity != world) || (CTF_Map == 1))) + { + CTF_Map = 1; + if ((teamplay == 0)) + { + cvar_set ("teamplay", "21?TeamFortress"); + } + mtfentity = spawn (); + mtfentity.nextthink = (time + 30); + mtfentity.think = CTF_FlagCheck; + number_of_teams = 2; + } + else + { + number_of_teams = 4; + } + cvar_set ("sv_aim", "1"); + team1lives = -1; + team2lives = -1; + team3lives = -1; + team4lives = -1; + illegalclasses1 = 0; + illegalclasses2 = 0; + illegalclasses3 = 0; + illegalclasses4 = 0; + team1maxplayers = 100; + team2maxplayers = 100; + team3maxplayers = 100; + team4maxplayers = 100; + civilianteams = 0; + } +#endif + bprint (2, "Mapname: "); + bprint (2, mapname); + bprint (2, "\n"); + SetupTeamEqualiser (); +// if (1) // if (toggleflags == 1) ?? +// { + toggleflags = toggleflags - (toggleflags & 128); +// } + toggleflags = toggleflags | 2; + mtfstring = infokey (world, "temp1"); + toggleflags = (toggleflags | 256) | stof (mtfstring); + mtffloat = 30; + mtfstring = infokey (world, "a"); + if ((mtfstring == string_null)) + { + mtfstring = infokey (world, "autoteam"); + } + if ((mtfstring == "on")) + { + toggleflags = toggleflags | 64; + } + else + { + if ((mtfstring == "off")) + { + toggleflags = toggleflags - (toggleflags & 64); + } + else + { + if ((stof (mtfstring) != 0)) + { + toggleflags = toggleflags | 64; + mtffloat = stof (mtfstring); + } + } + } + mtfstring = infokey (world, "t"); + if ((mtfstring == string_null)) + { + mtfstring = infokey (world, "teamfrags"); + } + if ((mtfstring == "on")) + { + toggleflags = toggleflags | 128; + } + else + { + if ((mtfstring == "off")) + { + toggleflags = toggleflags - (toggleflags & 128); + } + } + mtfstring = infokey (world, "g"); + if ((mtfstring == string_null)) + { + mtfstring = infokey (world, "grapple"); + } + if ((mtfstring == "off")) + { + allow_hook = 0; + } + if ((!(toggleflags & 1024) && (mtfstring != "on"))) + { + allow_hook = 0; + } + mtfstring = infokey (world, "spy"); + if ((mtfstring == "off")) + { + spy_off = 1; + } + mtfstring = infokey (world, "s"); + if ((mtfstring == string_null)) + { + mtfstring = infokey (world, "spyinvis"); + } + if (((mtfstring == "on") || (toggleflags & 512))) + { + invis_only = 1; + } + else + { + if ((mtfstring == "off")) + { + invis_only = 0; + } + } + mtfstring = infokey (world, "oldconc"); + if (((mtfstring == "on") || (mtfstring == "1"))) + { + oldconc = 1; + } + else + { + oldconc = 0; + } + mtfstring = infokey (world, "spyjumpoption"); + if (((mtfstring == "on") || (mtfstring == "1"))) + { + spyjumpoption = 1; + } + else + { + spyjumpoption = 0; + } + mtfstring = infokey (world, "spycam"); + if (((mtfstring == "on") || (mtfstring == "1"))) + { + spycam = 1; + } + else + { + spycam = 0; + } + spycam = 0; + mtfstring = infokey (world, "medicarmorheal"); + if (((mtfstring == "on") || (mtfstring == "1"))) + { + medicarmorheal = 1; + } + else + { + medicarmorheal = 0; + } + mtfstring = infokey (world, "quadscore"); + if ((mtfstring != "")) + { + if ((mtfstring == "on")) + { + quadscore = -666; + bprint (2, "Quad Round 1 in progress!\n"); + } + else + { + if ((mtfstring == "0")) + { + quadscore = 0; + } + else + { + bprint (2, quadscore); + bprint (2, "\n"); + quadscore = stof (mtfstring); + team2score = quadscore; + localcmd ("serverinfo quadscore 0\n"); + bprint (2, "Quad Round 2 in progress!\n"); + TeamFortress_TeamShowScores (2); + } + } + } + mtfstring = infokey (world, "dropgrens"); + if (((mtfstring == "on") || (mtfstring == "1"))) + { + sr_dropgrens = 1; + } + else + { + sr_dropgrens = 0; + } + mtfstring = infokey (world, "sr_gren1"); + sr_gren1 = stof (mtfstring); + mtfstring = infokey (world, "sr_gren2"); + sr_gren2 = stof (mtfstring); + if ((sr_gren1 <= 0)) + { + sr_gren1 = 10; + } + if ((sr_gren2 <= 0)) + { + sr_gren2 = 10; + } + + mtfstring = infokey(world, "sr_airmirv"); + sr_airmirv = stof (mtfstring); + if ((sr_airmirv <= 0)) + { + sr_airmirv = 10; + } + +#ifdef clan_progs + mtfstring = infokey (world, "clan_prematch"); + if (mtfstring == "on" || stof(mtfstring) > 0) + { + if (stof(mtfstring) > 1) + { + clan_prematch = stof(mtfstring); + } + else + { + clan_prematch = 1; + } + prematch = 666 * 666; // teh evil prematch :D + SetUpPrematch (); + } + else + { +#endif + mtfstring = infokey (world, "prematch"); + prematch = stof (mtfstring); + if ((prematch > 0)) + { + SetUpPrematch (); + } +#ifdef clan_progs + } +#endif + mtfstring = infokey (world, "cr_scout"); + cr_scout = stof (mtfstring); + mtfstring = infokey (world, "cr_sniper"); + cr_sniper = stof (mtfstring); + mtfstring = infokey (world, "cr_soldier"); + cr_soldier = stof (mtfstring); + mtfstring = infokey (world, "cr_demoman"); + cr_demoman = stof (mtfstring); + mtfstring = infokey (world, "cr_medic"); + cr_medic = stof (mtfstring); + mtfstring = infokey (world, "cr_hwguy"); + cr_hwguy = stof (mtfstring); + mtfstring = infokey (world, "cr_pyro"); + cr_pyro = stof (mtfstring); + mtfstring = infokey (world, "cr_spy"); + cr_spy = stof (mtfstring); + mtfstring = infokey (world, "cr_engineer"); + cr_engineer = stof (mtfstring); + if ((((((((((cr_scout != 0) && (cr_sniper != 0)) && (cr_soldier != 0)) && (cr_demoman != 0)) && (cr_medic != 0)) && (cr_hwguy != 0)) && (cr_pyro != 0)) && (cr_spy != 0)) && (cr_engineer != 0))) + { + cr_engineer = 0; + } + mtfstring = infokey (world, "clr_enabled"); + if ((mtfstring == "on")) + { + clr_enabled = 1; + } + else + { + if ((mtfstring == "1")) + { + clr_enabled = 1; + } + else + { + clr_enabled = 0; + } + } + mtfstring = infokey (world, "airscout"); + if ((mtfstring == "off")) + { + airscout = 0; + } + else + { + airscout = 1; + } + mtfstring = infokey (world, "headkick"); + if ((mtfstring == "off")) + { + headkick = 0; + } + else + { + headkick = 1; + } + mtfstring = infokey (world, "coloredlights"); + if ((mtfstring == "on")) + { + coloredlights = 1; + } + else + { + coloredlights = 0; + } + mtfstring = infokey (world, "drop3"); + if ((mtfstring == "off")) + { + drop3 = 0; + } + else + { + drop3 = 1; + } + mtfstring = infokey (world, "drop2"); + if ((mtfstring == "off")) + { + drop2 = 0; + } + else + { + drop2 = 1; + } + mtfstring = infokey (world, "drop1"); + if ((mtfstring == "off")) + { + drop1 = 0; + } + else + { + drop1 = 1; + } + mtfstring = infokey (world, "footsteps"); + if ((mtfstring == "off")) + { + footsteps = 0; + } + else + { + footsteps = 1; + } + mtfstring = infokey (world, "old_gl"); + if ((mtfstring == "off")) + { + old_gl = 0; + } + else + { + old_gl = 1; + } + mtfstring = infokey (world, "exec_class"); + if (mtfstring == string_null) + mtfstring = infokey (world, "ec"); + if ((mtfstring != "off")) + { + exec_class = 1; + } + else + { + exec_class = 0; + } + mtfstring = infokey (world, "rd"); + if ((mtfstring == string_null)) + { + mtfstring = infokey (world, "respawn_delay"); + } + respawn_delay_time = stof (mtfstring); + if (respawn_delay_time) + { + toggleflags = toggleflags | 4; + } + if (((toggleflags & 4) && (respawn_delay_time == 0))) + { + respawn_delay_time = 5; + } + if ((toggleflags & 64)) + { + toggleflags = toggleflags - (toggleflags & 64); + mtfentity = spawn (); + mtfentity.nextthink = (time + mtffloat); + mtfentity.think = autoteam_think; + } + } + if (parm11) + { + self.tfstate = parm11; + } + if ((self.playerclass == 0)) + { + self.playerclass = parm12; + } + if (parm13) + { + self.StatusBarRes = parm13; + } + if (parm14) + { + self.StatusBarSize = parm14; + } +}; + +// authcode 3 +float /*WARNING: could not determine return type*/ (entity _p_5763) IsLegalClient = +{ + local string _l_5764; + local string _l_5765; + local string _l_5766; + local string _l_5767; + + _l_5766 = infokey (_p_5763, "*client"); + if ((_l_5766 == "")) + { + _l_5766 = infokey (_p_5763, "*z_ver"); + if ((_l_5766 == "")) + { + _l_5766 = infokey (_p_5763, "*FuhQuake"); + if ((_l_5766 != "")) + { + _l_5764 = "*FuhQuake"; + } + } + else + { + _l_5764 = "*z_ver"; + } + } + else + { + _l_5764 = "*client"; + } + if ((_l_5764 == "")) + { + return (0); + } + _l_5765 = infokey (_p_5763, _l_5764); + _l_5766 = infokey (world, "clr_client1n"); + _l_5767 = infokey (world, "clr_client1v"); + if (((_l_5764 == _l_5766) && (_l_5765 == _l_5767))) + { + return (1); + } + _l_5766 = infokey (world, "clr_client2n"); + _l_5767 = infokey (world, "clr_client2v"); + if (((_l_5764 == _l_5766) && (_l_5765 == _l_5767))) + { + return (1); + } + _l_5766 = infokey (world, "clr_client3n"); + _l_5767 = infokey (world, "clr_client3v"); + if (((_l_5764 == _l_5766) && (_l_5765 == _l_5767))) + { + return (1); + } + _l_5766 = infokey (world, "clr_client4n"); + _l_5767 = infokey (world, "clr_client4v"); + if (((_l_5764 == _l_5766) && (_l_5765 == _l_5767))) + { + return (1); + } + _l_5766 = infokey (world, "clr_client5n"); + _l_5767 = infokey (world, "clr_client5v"); + if (((_l_5764 == _l_5766) && (_l_5765 == _l_5767))) + { + return (1); + } + _l_5766 = infokey (world, "clr_client6n"); + _l_5767 = infokey (world, "clr_client6v"); + if (((_l_5764 == _l_5766) && (_l_5765 == _l_5767))) + { + return (1); + } + _l_5766 = infokey (world, "clr_client7n"); + _l_5767 = infokey (world, "clr_client7v"); + if (((_l_5764 == _l_5766) && (_l_5765 == _l_5767))) + { + return (1); + } + _l_5766 = infokey (world, "clr_client8n"); + _l_5767 = infokey (world, "clr_client8v"); + if (((_l_5764 == _l_5766) && (_l_5765 == _l_5767))) + { + return (1); + } + _l_5766 = infokey (world, "clr_client9n"); + _l_5767 = infokey (world, "clr_client9v"); + if (((_l_5764 == _l_5766) && (_l_5765 == _l_5767))) + { + return (1); + } + _l_5766 = infokey (world, "clr_client10n"); + _l_5767 = infokey (world, "clr_client10v"); + if (((_l_5764 == _l_5766) && (_l_5765 == _l_5767))) + { + return (1); + } + return (0); +}; + +//end authcode3 + + +entity() FindIntermission = +{ + local entity spot; + local float cyc; + spot = find(world, classname, "info_intermission"); + if (spot) + { + cyc = random() * TF_FLARE_OFF; + return spot; + } + spot = find(world, classname, "info_player_start"); + if (spot) + { + return spot; + } + spot = find(world, classname, "info_player_deathmatch"); + if (spot) + { + cyc = random() * 6; + while (cyc > TF_FLARE_OFF) + { + spot = find(spot, classname, "info_player_deathmatch"); + if (!spot) + { + spot = find(spot, classname, "info_player_deathmatch"); + } + cyc = cyc - TF_FLARE_OFF; + } + return spot; + } + objerror("FindIntermission: no spot"); + return self; //dirty compiler warning fix, i know >.< +}; + +entity(entity start_point) FindNextIntermission = +{ + local entity spot; + if (deathmatch) + { + if (start_point.classname == "info_intermission" || start_point == world) + { + spot = find(start_point, classname, "info_intermission"); + if (spot) + { + return spot; + } + else + { + start_point = world; + } + } + if (start_point.classname == "info_player_deathmatch" || start_point == world) + { + spot = find(start_point, classname, "info_player_deathmatch"); + if (spot) + { + return spot; + } + } + spot = find(world, classname, "info_intermission"); + if (spot) + { + return spot; + } + spot = find(world, classname, "info_player_deathmatch"); + if (spot) + { + return spot; + } + } + else + { + spot = find(world, classname, "info_player_start"); + if (spot) + { + return spot; + } + } + return FindIntermission(); +}; + +void() TF_MovePlayer = +{ + local entity place; + place = FindNextIntermission(self.observer_list); + self.observer_list = place; + setorigin(self, place.origin + '0 0 1'); + self.angles = place.angles; + self.fixangle = TF_FLARE_OFF; +}; + +void() GotoNextMap = +{ + local float nextlevel; + local string sl; + + // ---> pablo. Reset autoscreenshot. +/* te = find(world, classname, "player"); + while (te) + { + if (te.screenshot == 1) + { + sprint(te, 2, "screenshot!\n"); + te.screenshot = 1; + } + te = find(te, classname, "player"); + }*/ + + // <--- + + if (nextmap != mapname) + { + changelevel(nextmap); + already_chosen_map = TF_FLARE_OFF; + } + if (!already_chosen_map) + { + sl = infokey(world, "n"); + nextlevel = stof(sl); + nextlevel = nextlevel + TF_FLARE_OFF; + sl = ftos(nextlevel); + localcmd("serverinfo n "); + localcmd(sl); + localcmd("\n"); + localcmd("exec qwmcycle/map"); + localcmd(sl); + localcmd(".cfg\n"); + already_chosen_map = TF_FLARE_OFF; + } + if (infokey(world, "n") == "0") + { + already_chosen_map = 0; + } + + // Pablo. Server-side map cfg + /*localcmd("exec "); + localcmd(nextmap); + localcmd(".cfg\n");*/ +}; + +void() ExitIntermission = +{ + dprint("Exiting intermission...\n"); + if (deathmatch) + { + dprint("Exit Intermission in Deathmatch.\n"); + GotoNextMap(); + return; + } + intermission_exittime = time + TF_FLARE_OFF; + intermission_running = intermission_running + TF_FLARE_OFF; + if (intermission_running == 2) + { + if (world.model == "maps/e2m6.bsp") + { + WriteByte(2, 31); + WriteString(2, "The Rune of Black Magic throbs evilly in\nyour hand and whispers dark thoughts\ninto your brain. You learn the inmost\nlore of the Hell-Mother; Shub-Niggurath!\nYou now know that she is behind all the\nterrible plotting which has led to so\nmuch death and horror. But she is not\ninviolate! Armed with this Rune, you\nrealize that once all four Runes are\ncombined, the gate to Shub-Niggurath's\nPit will open, and you can face the\nWitch-Goddess herself in her frightful\notherworld cathedral."); + return; + } + else + { + if (world.model == "maps/e3m6.bsp") + { + WriteByte(2, 31); + WriteString(2, "The charred viscera of diabolic horrors\nbubble viscously as you seize the Rune\nof Hell Magic. Its heat scorches your\nhand, and its terrible secrets blight\nyour mind. Gathering the shreds of your\ncourage, you shake the devil's shackles\nfrom your soul, and become ever more\nhard and determined to destroy the\nhideous creatures whose mere existence\nthreatens the souls and psyches of all\nthe population of Earth."); + return; + } + else + { + if (world.model == "maps/e4m7.bsp") + { + WriteByte(2, 31); + WriteString(2, "Despite the awful might of the Elder\nWorld, you have achieved the Rune of\nElder Magic, capstone of all types of\narcane wisdom. Beyond good and evil,\nbeyond life and death, the Rune\npulsates, heavy with import. Patient and\npotent, the Elder Being Shub-Niggurath\nweaves her dire plans to clear off all\nlife from the Earth, and bring her own\nfoul offspring to our world! For all the\ndwellers in these nightmare dimensions\nare her descendants! Once all Runes of\nmagic power are united, the energy\nbehind them will blast open the Gateway\nto Shub-Niggurath, and you can travel\nthere to foil the Hell-Mother's plots\nin person."); + return; + } + } + } + //} + GotoNextMap(); + } + if (intermission_running == 3) + { + if (!cvar("registered")) + { + WriteByte(2, 33); + return; + } + if ((serverflags & 15) == 15) + { + WriteByte(2, 31); + WriteString(2, "Now, you have all four Runes. You sense\ntremendous invisible forces moving to\nunseal ancient barriers. Shub-Niggurath\nhad hoped to use the Runes Herself to\nclear off the Earth, but now instead,\nyou will use them to enter her home and\nconfront her as an avatar of avenging\nEarth-life. If you defeat her, you will\nbe remembered forever as the savior of\nthe planet. If she conquers, it will be\nas if you had never been born."); + return; + } + } + dprint("Exit Intermission.\n"); + GotoNextMap(); +}; + +void() IntermissionThink = +{ + if (time < intermission_exittime) + { + return; + } + if (!(self.button0) && !(self.button1) && !(self.button2)) + { + return; + } + dprint("Intermission think.\n"); + GotoNextMap(); +}; + +void() execute_changelevel = +{ + local entity pos; + dprint("execute_changelevel()\n"); + intermission_running = TF_FLARE_OFF; + intermission_exittime = time + 5; + pos = FindIntermission(); + WriteByte(2, 30); + WriteCoord(2, pos.origin_x); + WriteCoord(2, pos.origin_y); + WriteCoord(2, pos.origin_z); + WriteAngle(2, pos.mangle_x); + WriteAngle(2, pos.mangle_y); + WriteAngle(2, pos.mangle_z); + if ((quadscore == -666)) + { + localcmd ("serverinfo quadscore "); + localcmd (ftos (team1score)); + localcmd ("\n"); + } + other = find(world, classname, "player"); + while (other != world) + { + if (other.stats_on) + { + stuffcmd (other, "set stats_execed -1; exec progs/stats.cfg\n"); + } + other.takedamage = 0; + other.solid = 0; + other.movetype = 0; + other.modelindex = 0; + other = find(other, classname, "player"); + } + DumpClanScores (); +}; + +void() changelevel_touch = +{ + if (other.classname != "player") + { + return; + } + if (cvar("samelevel") == 2 || (cvar("samelevel") == 3 && mapname != "start")) + { + return; + } + bprint(2, other.netname); + bprint(2, " exited the level\n"); + nextmap = self.map; + SUB_UseTargets(); + if (self.spawnflags & TF_FLARE_OFF && deathmatch == 0) + { + GotoNextMap(); + return; + } + self.touch = SUB_Null; + self.think = execute_changelevel; + self.nextthink = time + 0.1; +}; + +void() trigger_changelevel = +{ + if (CheckExistence() == 0) + { + dremove(self); + return; + } + if (!(self.map)) + { + objerror("changelevel trigger doesn't have map"); + } + InitTrigger(); + self.touch = changelevel_touch; +}; + +void() respawn = +{ + if (coop) + { + CopyToBodyQue(self); + setspawnparms(self); + PutClientInServer(); + } + else + { + if (deathmatch) + { + CopyToBodyQue(self); + SetNewParms(); + PutClientInServer(); + } + else + { + localcmd("restart\n"); + } + } +}; + +void() ClientKill = +{ + local entity te; + if (self.playerclass == 0) + { + return; + } +// Taken out by XavioR -- this was added because people would use it to lower team score. Took it out for PUG servers +// if (self.suicide_time > time) +// { +// sprint(self, 2, "30 sec delay to stop cheating!\n"); +// return; +// } + if (self.deadflag) + { + return; + } + /* Gold - Plast took cameras outta MegaTF in '04 + if ((self.bugger > 0) + { + sprint (self, 2, "Can't suicide while in camera!\n"); + return; + }*/ + if (self.tfstate & 16) + { + sprint(self, 2, "you wish life was that easy!\n"); + return; + } + if (self.hook_out) + { + sprint(self, 2, "You must retract hook first!\n"); + return; + } + self.suicide_time = time + 25 + random() * 5; + bprint(TF_FLARE_OFF, self.netname); + bprint(TF_FLARE_OFF, " suicides :)\n"); + set_suicide_frame(); + self.modelindex = modelindex_player; + if (self.tfstate & 16) + { + te = find(world, classname, "timer"); + while (te) + { + if (te.owner == self && te.think == BioInfection_Decay) + { + logfrag(te, self); + te.enemy.real_frags = te.enemy.real_frags + TF_FLARE_OFF; + if (!(toggleflags & 128)) + { + te.enemy.frags = te.enemy.real_frags; + } + } + te = find(te, classname, "timer"); + } + } + else + { + logfrag(self, self); + } + self.real_frags = self.real_frags - TF_FLARE_OFF; + if (!(toggleflags & 128)) + { + self.frags = self.real_frags; + } + TeamFortress_RemoveTimers(); + TeamFortress_SetupRespawn(TF_FLARE_OFF); + self.health = self.health - (self.health + TF_FLARE_OFF); + self.th_die(); + self.deadflag = 3; + self.tfstate = self.tfstate | 8192; +}; + +entity(float team_num) FindTeamSpawnPoint = +{ + local entity spot; + local entity at_spot; + local float spot_found; + local float attempts; + if (team_num == TF_FLARE_OFF) + { + spot = lastspawn_team1; + attempts = 0; + while (TF_FLARE_OFF) + { + attempts = attempts + TF_FLARE_OFF; + spot = find(spot, team_str_home, "ts1"); + if (spot == world) + { + spot = find(world, team_str_home, "ts1"); + } + if (spot == world) + { + return world; + } + at_spot = findradius(spot.origin, 40); + spot_found = TF_FLARE_OFF; + while (at_spot != world) + { + if (at_spot.classname == "player" && at_spot.deadflag == 0) + { + spot_found = 0; + } + at_spot = at_spot.chain; + } + if (!Activated(spot, self)) + { + spot_found = 0; + } + if (spot_found || attempts >= 30) + { + lastspawn_team1 = spot; + return spot; + } + } + } + else + { + if (team_num == 2) + { + spot = lastspawn_team2; + attempts = 0; + while (TF_FLARE_OFF) + { + attempts = attempts + TF_FLARE_OFF; + spot = find(spot, team_str_home, "ts2"); + if (spot == world) + { + spot = find(world, team_str_home, "ts2"); + } + if (spot == world) + { + return world; + } + at_spot = findradius(spot.origin, 40); + spot_found = TF_FLARE_OFF; + while (at_spot != world) + { + if (at_spot.classname == "player" && at_spot.deadflag == 0) + { + spot_found = 0; + } + at_spot = at_spot.chain; + } + if (!Activated(spot, self)) + { + spot_found = 0; + } + if (spot_found || attempts >= 30) + { + lastspawn_team2 = spot; + return spot; + } + } + } + else + { + if (team_num == 3) + { + spot = lastspawn_team3; + attempts = 0; + while (TF_FLARE_OFF) + { + attempts = attempts + TF_FLARE_OFF; + spot = find(spot, team_str_home, "ts3"); + if (spot == world) + { + spot = find(world, team_str_home, "ts3"); + } + if (spot == world) + { + return world; + } + at_spot = findradius(spot.origin, 40); + spot_found = TF_FLARE_OFF; + while (at_spot != world) + { + if (at_spot.classname == "player" && at_spot.deadflag == 0) + { + spot_found = 0; + } + at_spot = at_spot.chain; + } + if (!Activated(spot, self)) + { + spot_found = 0; + } + if (spot_found || attempts >= 30) + { + lastspawn_team3 = spot; + return spot; + } + } + } + else + { + if (team_num == 4) + { + spot = lastspawn_team4; + attempts = 0; + while (TF_FLARE_OFF) + { + attempts = attempts + TF_FLARE_OFF; + spot = find(spot, team_str_home, "ts4"); + if (spot == world) + { + spot = find(world, team_str_home, "ts4"); + } + if (spot == world) + { + return world; + } + at_spot = findradius(spot.origin, 40); + spot_found = TF_FLARE_OFF; + while (at_spot != world) + { + if (at_spot.classname == "player" && at_spot.deadflag == 0) + { + spot_found = 0; + } + at_spot = at_spot.chain; + } + if (!Activated(spot, self)) + { + spot_found = 0; + } + if (spot_found || attempts >= 30) + { + lastspawn_team4 = spot; + return spot; + } + } + } + } + } + } + return world; +}; + +void(entity e) ValidateUser = +{ +}; + +entity() SelectSpawnPoint = +{ + local entity spot; + local entity at_spot; + local float spot_found; + local float attempts; + if (self.team_no != 0) + { + spot = FindTeamSpawnPoint(self.team_no); + if (spot != world) + { + return spot; + } + } + if (coop) + { + lastspawn = find(lastspawn, classname, "info_player_coop"); + if (lastspawn == world) + { + lastspawn = find(world, classname, "info_player_coop"); + } + if (lastspawn != world) + { + return lastspawn; + } + } + else + { + if (deathmatch) + { + spot = find(lastspawn, classname, "info_player_deathmatch"); + if (spot == world) + { + spot = find(world, classname, "info_player_deathmatch"); + } + attempts = 0; + while (spot != world && attempts < 100) + { + attempts = attempts + TF_FLARE_OFF; + at_spot = findradius(spot.origin, 40); + spot_found = TF_FLARE_OFF; + while (at_spot) + { + if (at_spot.classname == "player" && at_spot.deadflag == 0) + { + spot_found = 0; + } + at_spot = at_spot.chain; + } + if (spot_found || attempts >= 10) + { + lastspawn = spot; + return spot; + } + spot = find(spot, classname, "info_player_deathmatch"); + if (spot == world) + { + spot = find(world, classname, "info_player_deathmatch"); + } + } + } + } + if (serverflags) + { + spot = find(world, classname, "info_player_start2"); + if (spot) + { + return spot; + } + } + spot = find(world, classname, "info_player_start"); + if (!spot) + { + error("PutClientInServer: no info_player_start on level\n"); + } + return spot; +}; + +void() PutClientInServer = +{ + local float tc; + local string st; + local float iszoom; + local float oldclass; + local entity spot; + local entity te; + self.touch = player_touch; + self.classname = "player"; + self.health = 100; + self.takedamage = 2; +#ifdef new_solid + if (self.playerclass < 1 && self.health == 1) + self.solid = 1; + else + self.solid = 3; +#else + self.solid = 3; +#endif + self.movetype = 3; + self.show_hostile = 0; + self.FlashTime = 0; + self.max_health = 100; + self.flags = 8; + self.air_finished = time + 12; + self.dmg = 2; + self.super_damage_finished = 0; + self.radsuit_finished = 0; + self.invisible_finished = 0; + self.invincible_finished = 0; + self.effects = 0; + self.invincible_time = 0; + self.reload_shotgun = 0; + self.reload_super_shotgun = 0; + self.reload_grenade_launcher = 0; + self.reload_rocket_launcher = 0; + self.immune_to_check = time + 5; + self.on_hook = 0; + self.active_grenades_1 = 0; + self.active_grenades_2 = 0; + self.active_airmirvs = 0; + self.hook_out = 0; + self.fire_held_down = 0; + stuffcmd(self, "play misc/null.wav\n"); + DecodeLevelParms(); +// begin client auth + stuffcmd (self, "alias aa_enabled impulse 240\nalias cl_accel impulse 240\nalias cl_speed impulse 240\nalias aa_lag impulse 240\nalias autofire impulse 240\nalias +autofire impulse 240\nalias autodet impulse 240\nalias +showradar impulse 240\nalias voteyes impulse 245\n"); + self.client = "unknown"; + st = infokey (self, "*client"); + if ((st == "mqwcl 0.96")) + { + self.client = "moreqw"; + self.clientv = "0.96"; + } + else + { + if ((st == "mqwcl 0.95")) + { + self.client = "moreqw"; + self.clientv = "0.95"; + } + else + { + if ((st == "mqwcl 0.93")) + { + self.client = "moreqw"; + self.clientv = "0.93"; + } + } + } +// AA ban + st = infokey (self, "*ip"); + if ((st != "")) + { + st = infokey (self, "*ver"); + bprint (st); + bprint ("\n"); + if ((st == "2.40-0858")) + { + stuffcmd (self, "aa_enabled"); + stuffcmd (self, "\n"); + } + } + st = infokey (self, "*z_ver"); + if ((st != "")) + { + self.client = "zquake"; + self.clientv = st; + } + st = infokey (self, "*FuhQuake"); + if ((st != "")) + { + self.client = "fuhquake"; + self.clientv = st; + } + if (self.client == "unknown") + { + st = infokey (self, "*ver"); + if ((st != "")) + { + self.client = st; + } + st = infokey (self, "*client"); + if ((st != "")) + { + self.client = st; + } + } + st = infokey (self, "tf_stats"); + if (((st == "on") || (st == "1"))) + { + if (((self.client != "fuhquake") && (self.client != "zquake"))) + { + sprint (self, 2, "Weapon statistics require fuhquake/zquake (www.fuhquake.net)\n"); + self.stats_on = 0; + stuffcmd (self, "setinfo tf_stats off\n"); + } + else + { + self.stats_on = 1; + } + } + else + { + self.stats_on = 0; + } + if (clr_enabled) + { + if (!IsLegalClient (self)) + { + stuffcmd (self, "disconnect\necho\necho illegal client, restrictions in effect\necho\n"); + bprint (1, self.netname); + bprint (1, " tried to join using an illegal client.\n"); + return; + } + } +// end client auth code + if (self.playerclass == 0) + { + if (TeamFortress_TeamIsCivilian(self.team_no)) + { + self.impulse = TF_FLARE_OFF; + TeamFortress_SetSpeed(self); + TeamFortress_ChangeClass(); + } + } + if (deathmatch == 3 && self.nextpc != 0) + { + tc = IsRestrictedClass(self.nextpc); + if ( tc == 0) + { + self.playerclass = self.nextpc; + if (self.nextpc == 10) + { + self.tfstate = self.tfstate | 8; + } + else + { + self.tfstate = self.tfstate - (self.tfstate & 8); + } + } + else + { + if (tc > 0) + { + sprint(self, 2, "That class is restricted to "); + st = ftos(tc); + sprint(self, 2, st); + sprint(self, 2, " per team.\n"); + } + else + { + sprint(self, 2, "That class is disabled.\n"); + } + self.nextpc = 0; + } + } + iszoom = 0; + if (self.tfstate & 4096) + { + iszoom = TF_FLARE_OFF; + } + if (self.tfstate & 8) + { + oldclass = TF_FLARE_OFF + floor(random() * (10 - TF_FLARE_OFF)); + while (!IsLegalClass(oldclass) || (IsRestrictedClass(oldclass) != 0) ) // pablo. removed this cause of problems if all but 1 class restricted. || (self.playerclass == oldclass) ) + { + oldclass = TF_FLARE_OFF + floor(random() * (10 - TF_FLARE_OFF)); + } + self.playerclass = oldclass; + self.tfstate = 8; + } + else + { + self.tfstate = 0; + } + if (iszoom == TF_FLARE_OFF) + { + self.tfstate = self.tfstate | 4096; + } + if (self.playerclass != 9) + { + te = find(world, classname, "building_dispenser"); + while (te) + { + if (te.real_owner == self) + { + TF_T_Damage(te, world, world, 500, 0, 0); + } + te = find(te, classname, "building_dispenser"); + } + te = find(world, classname, "building_sentrygun"); + while (te) + { + if (te.real_owner == self) + { + TF_T_Damage(te, world, world, 500, 0, 0); + } + te = find(te, classname, "building_sentrygun"); + } + } + TeamFortress_PrintClassName(self, self.playerclass, self.tfstate & 8, 0); + TeamFortress_SetEquipment(); + TeamFortress_SetHealth(); + TeamFortress_SetSpeed(self); + TeamFortress_SetSkin(self); + stuffcmd(self, "v_idlescale 0\n"); + stuffcmd(self, "v_cshift 0 0 0 0\n"); + SetTeamName(self); + W_SetCurrentAmmo(); + self.attack_finished = time + 0.3; + self.th_pain = player_pain; + self.th_die = PlayerDie; + if (self.height != 0) + { + self.height = 0; + TF_zoom(90); + } + self.deadflag = 0; + self.pausetime = 0; + spot = SelectSpawnPoint(); + if (self.playerclass != 0) + { + spawn_tdeath(spot.origin, self); + } + self.observer_list = spot; + self.origin = spot.origin + '0 0 1'; + self.angles = spot.angles; + self.fixangle = TF_FLARE_OFF; + if (spot.classname == "info_player_teamspawn") + { + if (spot.items != 0) + { + te = Finditem(spot.items); + if (te) + { + tfgoalitem_GiveToPlayer(te, self, self); + } + if (!(spot.goal_activation & TF_FLARE_OFF)) + { + spot.items = 0; + } + } + if (prematch) + { + TeamFortress_PrintPMTimeLeft (self); + } + else + { + if (spot.message) + { + CenterPrint (self, spot.message); + if (!(spot.goal_activation & 2)) + { + spot.message = string_null; + } + } + } + if (spot.activate_goal_no != 0) + { + te = Findgoal(spot.activate_goal_no); + if (te) + { + AttemptToActivate(te, self, spot); + } + } + if (spot.goal_effects == TF_FLARE_OFF) + { + spot.classname = "deadpoint"; + spot.team_str_home = string_null; + spot.nextthink = time + TF_FLARE_OFF; + spot.think = SUB_Remove; + } + } + setmodel(self, string_null); + modelindex_null = self.modelindex; + setmodel(self, "progs/eyes.mdl"); + modelindex_eyes = self.modelindex; + setmodel(self, "progs/player.mdl"); + modelindex_player = self.modelindex; + if (self.playerclass == 0) + { + self.modelindex = modelindex_null; + self.current_menu = TF_FLARE_OFF; + TeamFortress_Alias("id", 185, 0); + bprint (1, self.netname); + bprint (1, " is using "); + if ((self.client != "unknown")) + { + bprint (1, self.client); + bprint (1, " "); + bprint (1, self.clientv); + } + else + { + bprint (1, "an unknown client"); + } + bprint (1, "\n"); + if (self.stats_on) + { + stuffcmd (self, "set stats_execed 0\nexec progs/stats.cfg\n"); + } + } + setsize(self, '-16 -16 -24', '16 16 32'); + self.view_ofs = '0 0 22'; + self.velocity = '0 0 0'; + player_stand1(); + if (deathmatch || coop) + { + makevectors(self.angles); + if (self.playerclass != 0) + { + spawn_tfog(self.origin + v_forward * 20); + } + } + if (stof(infokey(world, "rj")) != 0) + { + rj = stof(infokey(world, "rj")); + } + else + { + rj = 2; + } + if (self.noise == "player/mdeath5.wav") + { + sound(self, 2, "player/malive5.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } +}; + +void() info_player_start = +{ + if (CheckExistence() == 0) + { + dremove(self); + return; + } +}; + +void() info_player_start2 = +{ + if (CheckExistence() == 0) + { + dremove(self); + return; + } +}; + +void() testplayerstart = +{ + if (CheckExistence() == 0) + { + dremove(self); + return; + } +}; + +void() info_player_deathmatch = +{ + if (CheckExistence() == 0) + { + dremove(self); + return; + } +}; + +void() info_player_coop = +{ + if (CheckExistence() == 0) + { + dremove(self); + return; + } +}; + +void(entity c) PrintClientScore = +{ + if (c.frags > -10 && c.frags < 0) + { + bprint(TF_FLARE_OFF, " "); + } + else + { + if (c.frags >= 0) + { + if (c.frags < 100) + { + bprint(TF_FLARE_OFF, " "); + } + if (c.frags < 10) + { + bprint(TF_FLARE_OFF, " "); + } + } + } + // pablo. + //bprint(?/00000004\?, ftos(c.frags)); + bprint(TF_FLARE_OFF, ftos(c.frags)); + bprint(TF_FLARE_OFF, " "); + bprint(TF_FLARE_OFF, c.netname); + bprint(TF_FLARE_OFF, "\n"); +}; + +void() DumpScore = +{ + local entity e; + local entity sort; + local entity walk; + if (world.chain) + { + error("DumpScore: world.chain is set"); + } + e = find(world, classname, "player"); + sort = world; + while (e) + { + if (!sort) + { + sort = e; + e.chain = world; + } + else + { + if (e.frags > sort.frags) + { + e.chain = sort; + sort = e; + } + else + { + walk = sort; + do + { + if (!(walk.chain)) + { + e.chain = world; + walk.chain = e; + } + else + { + if (walk.chain.frags < e.frags) + { + e.chain = walk.chain; + walk.chain = e; + } + else + { + walk = walk.chain; + } + } + } while (walk.chain != e); + } + } + e = find(e, classname, "player"); + } + bprint(TF_FLARE_OFF, "\n"); + while (sort) + { + PrintClientScore(sort); + sort = sort.chain; + } + bprint(TF_FLARE_OFF, "\n"); +}; + +void() NextLevel = +{ + local entity o; + if (already_cycled) + { + return; + } + already_cycled = TF_FLARE_OFF; + o = spawn(); + o.map = nextmap; + o.think = execute_changelevel; + o.nextthink = time + 0.1; +}; + +void() CheckRules = +{ + if (timelimit && time >= timelimit) + { + NextLevel(); + } + else + { + if (fraglimit && self.frags >= fraglimit) + { + NextLevel(); + } + } +}; + +void() PlayerDeathThink = +{ + local float forward; + if (self.flags & 512) + { + forward = vlen(self.velocity); + forward = forward - 20; + if (forward <= 0) + { + self.velocity = '0 0 0'; + } + else + { + self.velocity = forward * normalize(self.velocity); + } + } + if (self.deadflag == 2) + { + if (self.button2 || self.button1 || self.button0) + { + return; + } + self.deadflag = 3; + self.tfstate = self.tfstate - (self.tfstate & 8192); + return; + } + if (!(self.button2) && !(self.button1) && !(self.button0)) + { + if (self.tfstate & 8192) + { + if (self.respawn_time <= time) + { + self.button0 = 0; + self.button1 = 0; + self.button2 = 0; + respawn(); + } + } + return; + } + else + { + self.tfstate = self.tfstate | 8192; + if (self.respawn_time <= time) + { + self.button0 = 0; + self.button1 = 0; + self.button2 = 0; + respawn(); + } + return; + } +}; + +.float nojumptime; + +void () PlayerJump = +{ + + if ((self.nojumptime > time)) + { + if ((self.velocity_x > 70)) + { + self.velocity_x = 70; + } + else + { + if ((self.velocity_x < -70)) + { + self.velocity_x = -70; + } + } + if ((self.velocity_y > 70)) + { + self.velocity_y = 70; + } + else + { + if ((self.velocity_y < -70)) + { + self.velocity_y = -70; + } + } + } + if ((self.flags & 2048)) + { + return; + } + if ((self.waterlevel >= 2)) + { + if ((self.watertype == -3)) + { + self.velocity_z = 100; + } + else + { + if ((self.watertype == -4)) + { + self.velocity_z = 80; + } + else + { + self.velocity_z = 50; + } + } + if ((self.swim_flag < time)) + { + self.swim_flag = (time + 1); + if ((random () < 0.500000)) + { + sound (self, 4, "misc/water1.wav", 1, 1); + } + else + { + sound (self, 4, "misc/water2.wav", 1, 1); + } + } + return; + } + if (!(self.flags & 512)) + { + return; + } + if (!(self.flags & 4096)) + { + return; + } + self.flags = (self.flags - (self.flags & 4096)); + self.button2 = 0; + if ((self.playerclass == 8)) + { + if ((self.spy_regjump == 0)) + { + sound (self, 4, "hknight/slash1.wav", 0.700000, 1); + self.velocity_z = (self.velocity_z + 400); + } + else + { + sound (self, 4, "player/plyrjmp8.wav", 1, 1); + self.velocity_z = (self.velocity_z + 270); + } + //if( self.velocity_z < 0 ) self.velocity_z = 0; //prozac fix -- still needed for your equake, hughie? + } + else + { + sound (self, 4, "player/plyrjmp8.wav", 1, 1); + self.velocity_z = (self.velocity_z + 270); + //if( self.velocity_z < 0 ) self.velocity_z = 0; + } +}; + +void() WaterMove = +{ + if (self.movetype == 8) + { + return; + } + if (self.health < 0) + { + return; + } + if (self.waterlevel != 3) + { + if (self.air_finished < time) + { + sound(self, 2, "player/gasp2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.air_finished < time + 9) + { + sound(self, 2, "player/gasp1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + } + self.air_finished = time + 12; + self.dmg = 2; + } + else + { + if (self.air_finished < time) + { + if (self.pain_finished < time) + { + self.dmg = self.dmg + 2; + if (self.dmg > 15) + { + self.dmg = 10; + } + TF_T_Damage(self, world, world, self.dmg, TF_FLARE_OFF, 0); + self.pain_finished = time + TF_FLARE_OFF; + } + } + } + if (!(self.waterlevel)) + { + if (self.flags & 16) + { + sound(self, 4, "misc/outwater.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.flags = self.flags - 16; + } + return; + } + if (self.watertype == -5) + { + if (self.dmgtime < time) + { + if (self.radsuit_finished > time) + { + self.dmgtime = time + TF_FLARE_OFF; + } + else + { + self.dmgtime = time + 0.2; + } + TF_T_Damage(self, world, world, 10 * self.waterlevel, 0, 16); + } + } + else + { + if (self.watertype == -4) + { + if (self.dmgtime < time && self.radsuit_finished < time) + { + self.dmgtime = time + TF_FLARE_OFF; + T_Damage(self, world, world, 4 * self.waterlevel); + } + } + } + if (!(self.flags & 16)) + { + if (self.watertype == -5) + { + sound(self, 4, "player/inlava.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + if (self.watertype == -3) + { + sound(self, 4, "player/inh2o.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + if (self.watertype == -4) + { + sound(self, 4, "player/slimbrn2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + self.flags = self.flags + 16; + self.dmgtime = 0; + } +}; + +void() CheckWaterJump = +{ + local vector start; + local vector end; + makevectors(self.angles); + start = self.origin; + start_z = start_z + 8; + v_forward_z = 0; + normalize(v_forward); + end = start + v_forward * 24; + traceline(start, end, TF_FLARE_OFF, self); + if (trace_fraction < TF_FLARE_OFF) + { + start_z = start_z + self.maxs_z - 8; + end = start + v_forward * 24; + self.movedir = trace_plane_normal * -50; + traceline(start, end, TF_FLARE_OFF, self); + if (trace_fraction == TF_FLARE_OFF) + { + self.flags = self.flags | 2048; + self.velocity_z = 225; + self.flags = self.flags - (self.flags & 4096); + self.teleport_time = time + 2; + return; + } + } +}; + +void () PlayerPreThink = +{ + local vector src; + + if (self.autoid) + { + makevectors (self.v_angle); + src = self.origin + (v_forward * 10); + src_z = self.absmin_z + (self.size_z * 0.700000); + traceline (src, (src + (v_forward * 2048)), 0, self); + if (((trace_ent != world) && (trace_ent.origin != world.origin))) + { + if ((self.current_menu != 17)) + { + TeamFortress_ID (); + self.StatusRefreshTime = (time + 0.200000); + } + } + } + if ((self.is_feigning && (self.waterlevel == 1))) + { + self.watertype = -3; + self.waterlevel = 3; + } + if (intermission_running) + { + if ((intermission_running && (self.last_used != 999))) + { + if ((random () < 0.500000)) + { + stuffcmd (self, "play music/megamnu1.wav\n"); + } + else + { + stuffcmd (self, "play music/megamnu2.wav\n"); + } + self.last_used = 999; + } + IntermissionThink (); + return; + } + makevectors (self.v_angle); + if ((self.playerclass == 0)) + { + self.maxspeed = 0; + self.gravity = 0; + if (((self.button2 && (self.current_menu == 2)) && (self.team_no == 0))) + { + if (TeamFortress_TeamPutPlayerInTeam ()) + { + self.current_menu = 3; + self.menu_count = 25; + } + } + } + if ((self.view_ofs == '0 0 0')) + { + return; + } + CheckRules (); + if ((self.playerclass != 0)) + { + WaterMove (); + } + if ((self.deadflag >= 2)) + { + PlayerDeathThink (); + return; + } + if (((self.undercover_team || self.undercover_skin) || self.is_undercover)) + { + if ((self.effects & 12)) + { + sprint (self, 1, "The glowing removes your disguise.\n"); + Spy_RemoveDisguise (self); + } + } + if ((self.deadflag == 1)) + { + return; + } + if (!self.is_feigning) + { + if (self.button2) + { + PlayerJump (); + } + else + { + self.flags = (self.flags | 4096); + } + } + else + { + if (self.waterlevel) + { + self.velocity_z = -100; + } + } + if ((time < self.pausetime)) + { + self.velocity = '0 0 0'; + } + if ((((time > self.attack_finished) && (self.currentammo == 0)) && (self.weapon > 16))) + { + self.weapon = W_BestWeapon (); + W_SetCurrentAmmo (); + } + if (self.on_hook) + { + Service_Grapple (); + } +}; + + +void() CheckPowerups = +{ + local float lighton; + local entity te; + if (self.health <= 0) + { + return; + } + if (self.playerclass == 0) + { + self.modelindex = modelindex_null; + } + else + { + if (self.is_undercover == TF_FLARE_OFF && invis_only == TF_FLARE_OFF) + { + self.frame = 0; + self.modelindex = modelindex_eyes; + } + else + { + if (self.invisible_finished) + { + if (self.tfstate & 64) + { + if (self.invisible_finished < time + 10) + { + self.invisible_finished = time + 666; + } + } + if (self.invisible_sound < time) + { + sound(self, 0, "items/inv3.wav", 0.5, 2); + self.invisible_sound = time + (random() * 3 + TF_FLARE_OFF); + } + if (self.invisible_finished < time + 3) + { + if (self.invisible_time == TF_FLARE_OFF) + { + sprint(self, 2, "Invisability is fading\n"); + stuffcmd(self, "bf\n"); + sound(self, 0, "items/inv2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.invisible_time = time + TF_FLARE_OFF; + } + if (self.invisible_time < time) + { + self.invisible_time = time + TF_FLARE_OFF; + stuffcmd(self, "bf\n"); + } + } + if (self.invisible_finished < time) + { + self.items = self.items - 524288; + self.invisible_finished = 0; + self.invisible_time = 0; + } + self.frame = 0; + self.modelindex = modelindex_eyes; + } + else + { + self.modelindex = modelindex_player; + } + } + } + if (self.invincible_finished) + { + if (self.tfstate & 32) + { + if (self.invincible_finished < time + 10) + { + self.invincible_finished = time + 666; + } + } + if (self.invincible_finished < time + 3) + { + if (self.invincible_time == TF_FLARE_OFF) + { + sprint(self, 2, "Protection is almost gone\n"); + stuffcmd(self, "bf\n"); + sound(self, 0, "items/protect2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.invincible_time = time + TF_FLARE_OFF; + } + if (self.invincible_time < time) + { + self.invincible_time = time + TF_FLARE_OFF; + stuffcmd(self, "bf\n"); + } + } + if (self.invincible_finished < time) + { + self.items = self.items - 1048576; + self.invincible_time = 0; + self.invincible_finished = 0; + } + if (self.invincible_finished > time) + { + self.effects = self.effects | 8; + } + else + { + lighton = 0; + te = find(world, classname, "item_tfgoal"); + while (te) + { + if (te.owner == self) + { + if (te.goal_activation & TF_FLARE_OFF) + { + lighton = TF_FLARE_OFF; + } + } + te = find(te, classname, "item_tfgoal"); + } + if (!lighton) + { + self.effects = self.effects - (self.effects & 8); + } + } + } + if (self.super_damage_finished) + { + if (self.tfstate & 128) + { + if (self.super_damage_finished == time + 10) + { + self.super_damage_finished = time + 666; + } + } + if (self.super_damage_finished < time + 3) + { + if (self.super_time == TF_FLARE_OFF) + { + sprint(self, 2, "Quad Damage is wearing off\n"); + stuffcmd(self, "bf\n"); + sound(self, 0, "items/damage2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.super_time = time + TF_FLARE_OFF; + } + if (self.super_time < time) + { + self.super_time = time + TF_FLARE_OFF; + stuffcmd(self, "bf\n"); + } + } + if (self.super_damage_finished < time) + { + self.items = self.items - 4194304; + self.super_damage_finished = 0; + self.super_time = 0; + } + if (self.super_damage_finished > time) + { + self.effects = self.effects | 8; + } + else + { + lighton = 0; + te = find(world, classname, "item_tfgoal"); + while (te) + { + if (te.owner == self) + { + if (te.goal_activation & TF_FLARE_OFF) + { + lighton = TF_FLARE_OFF; + } + } + te = find(te, classname, "item_tfgoal"); + } + if (!lighton) + { + self.effects = self.effects - (self.effects & 8); + } + } + } + if (self.radsuit_finished) + { + self.air_finished = time + 12; + if (self.tfstate & 256) + { + if (self.radsuit_finished == time + 10) + { + self.radsuit_finished = time + 666; + } + } + if (self.radsuit_finished < time + 3) + { + if (self.rad_time == TF_FLARE_OFF) + { + sprint(self, 2, "Air supply has run out\n"); + stuffcmd(self, "bf\n"); + sound(self, 0, "items/suit2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.rad_time = time + TF_FLARE_OFF; + } + if (self.rad_time < time) + { + self.rad_time = time + TF_FLARE_OFF; + stuffcmd(self, "bf\n"); + } + } + if (self.radsuit_finished < time) + { + self.items = self.items - 2097152; + self.rad_time = 0; + self.radsuit_finished = 0; + } + } +}; + +void() PlayerPostThink = +{ +// if (!strcat) //moved up +// { +// setup_strcat (); +// } + +// local vector vtemp; +#ifdef clan_progs + if (clan_prematch > 0) + { + if (self.playerclass > 0 && self.team_no > 0) + self.current_menu = MENU_CLAN_PREMATCH; + } +#endif + if (self.view_ofs == '0 0 0') + { + return; + } + if (self.deadflag) + { + DeadImpulses(); + self.impulse = 0; + return; + } + if (self.jump_flag < -300 && (self.flags & 512) && self.health > 0) + { + if (self.watertype == -3) + { + sound(self, 4, "player/h2ojump.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (self.jump_flag < -650) + { + T_Damage(self, world, world, 5); + sound(self, 2, "player/land2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.deathtype = "falling"; + } + else + { + if (self.playerclass == 8) + { + sound(self, 2, "hknight/hit.wav", TF_FLARE_OFF, TF_FLARE_OFF); + if (infokey(world, "prozacserver") == "1") { if( self.velocity_z < 0 ) self.velocity_z = 0; } // Prozac + if (!self.is_feigning) { // Spy Bunnhyhop + //if( self.velocity_z < 0 ) self.velocity_z = 0; + } // fix + } + else + { + sound(self, 2, "player/land.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + } + } + } + self.jump_flag = self.velocity_z; + CheckPowerups(); + W_WeaponFrame(); + if (self.motd < 22) + { + TeamFortress_MOTD(); + } + else + { + if (self.cheat_check == 0) + { + self.cheat_check = time + 5; + } + else + { + if (time > self.StatusRefreshTime && self.StatusBarSize != 0) + { + RefreshStatusBar(self); + } + } + } + if (self.cheat_check <= time) + { + TeamFortress_CheckTeamCheats(); + self.cheat_check = time + 2; + } + // no jump! + // self.button2 = 0; +// if (self.nojumptime != 0) +// { +// //self.gravity = 200; + //self.movetype = 0; + //self.flags = self.flags | 512; + //self.health = -1; +// vtemp = self.origin; +// vtemp_z = vtemp_z + 10; +// setorigin(self, vtemp); +// self.nojumptime = 0; +// } +}; + +void() ClientConnect = +{ + num_players = num_players + 1; + globaluserid = globaluserid + 1; +// self.userid = globaluserid; + self.userid = stof(infokey (self, "*userid")); + if ((infokey (world, "prozacserver") == "1")) + { + self.userid = getuid(self); + } + self.vote_wait = (time + 30); + local string st; + + bprint(2, self.netname); + bprint(2, " joined!\n"); + + self.is_ingame = 1; +// if (0 == 0) +// { + self.tfstate = self.tfstate | 4096; +// } + self.motd = 0; + self.got_aliases = 0; +// BTF anti-cheat + local string msg; + if (infokey(world, "modelcheck") == "1" || infokey(world, "modelcheck") == "on") + { + st = infokey (self, "pmodel"); + if ((((((((((st != "13845") && (st != "20572")) && (st != "33168")) && (st != "39460")) && (st != "52964")) && (st != "63186")) && (st != "32907")) && (st != "58759")) && (st != "47373"))) + { + sprint (self, 0, "You were kicked for using invalid TF pmodel\n"); + sprint (self, 0, "Have a nice day! :)\n"); + stuffcmd (self, "disconnect\n"); + stuffcmd (self, "help\n"); + bprint (0, self.netname); + bprint (0, " has been kicked for hacked pmodel\n"); + return; + } + } + st = infokey (self, "in_speed_hack"); + if ((st != "")) + { + sprint (self, 0, "You were banned for using hacked qwcl.exe\n"); + sprint (self, 0, "Have a nice day! :)\n"); + stuffcmd (self, "disconnect\n"); + stuffcmd (self, "help\n"); + bprint (0, self.netname); + bprint (0, " has been banned for speed cheat\n"); + msg = infokey (self, "ip"); + localcmd ("addip "); + localcmd (msg); + localcmd ("\n"); + localcmd ("writeip "); + localcmd (msg); + localcmd ("\n"); + return; + } + st = infokey (self, "ser"); + if ((st != "")) + { + sprint (self, 0, "You were banned for using hacked qwcl.exe\n"); + sprint (self, 0, "Have a nice day! :)\n"); + stuffcmd (self, "disconnect\n"); + stuffcmd (self, "help\n"); + bprint (0, self.netname); + bprint (0, " has been banned for speed cheat\n"); + msg = infokey (self, "ip"); + localcmd ("addip "); + localcmd (msg); + localcmd ("\n"); + localcmd ("writeip "); + localcmd (msg); + localcmd ("\n"); + return; + } + st = infokey(self, "sbar_res"); + if (st == "768") + { + self.StatusBarRes = 8; + } + else + { + if (st == "600") + { + self.StatusBarRes = 7; + } + else + { + if (st == "480") + { + self.StatusBarRes = 6; + } + else + { + if (st == "400") + { + self.StatusBarRes = 5; + } + else + { + if (st == "384") + { + self.StatusBarRes = 4; + } + else + { + if (st == "350") + { + self.StatusBarRes = 3; + } + else + { + if (st == "300") + { + self.StatusBarRes = 2; + } + else + { + if (st == "240") + { + self.StatusBarRes = TF_FLARE_OFF; + } + else + { + self.StatusBarRes = 0; + } + } + } + } + } + } + } + } + st = infokey(self, "sbar_size"); + self.StatusBarSize = stof(st); + if (self.StatusBarSize > 2 || self.StatusBarSize < 0) + { + self.StatusBarSize = 0; + } + self.has_disconnected = 0; + if (intermission_running) + { + GotoNextMap(); + } +}; + +void () ClientDisconnect = +{ + num_players = num_players - 1; + if ((self.has_voted == 1)) + { + num_votes = num_votes - 1; + } +#ifdef clan_progs + if (self.is_ready == 1) + { + num_players_ready = num_players_ready - 1; + } +#endif + + self.userid = 0; + local entity _l_6062; + + sound (self, 4, "misc/eject.wav", 1, 0); + self.has_disconnected = 1; + TeamFortress_RemoveTimers (); + _l_6062 = find (world, classname, "player_prop"); + while (_l_6062) + { + if ((_l_6062.owner == self)) + { + dremove (_l_6062); + } + _l_6062 = find (_l_6062, classname, "player_prop"); + } + _l_6062 = find (world, classname, "camera"); + while (_l_6062) + { + if ((_l_6062.owner == self)) + { + dremove (_l_6062); + } + _l_6062 = find (_l_6062, classname, "camera"); + } + _l_6062 = find (world, classname, "camera_base"); + while (_l_6062) + { + if ((_l_6062.owner == self)) + { + dremove (_l_6062); + } + _l_6062 = find (_l_6062, classname, "camera_base"); + } + _l_6062 = find (world, classname, "building_dispenser"); + while (_l_6062) + { + if ((_l_6062.real_owner == self)) + { + TF_T_Damage (_l_6062, world, world, 500, 0, 0); + } + _l_6062 = find (_l_6062, classname, "building_dispenser"); + } + _l_6062 = find (world, classname, "building_sentrygun"); + while (_l_6062) + { + if ((_l_6062.real_owner == self)) + { + TF_T_Damage (_l_6062, world, world, 500, 0, 0); + } + _l_6062 = find (_l_6062, classname, "building_sentrygun"); + } + _l_6062 = find (world, classname, "detpack"); + while (_l_6062) + { + if ((_l_6062.owner == self)) + { + if ((_l_6062.weaponmode == 1)) + { + TeamFortress_SetSpeed (_l_6062.enemy); + dremove (_l_6062.oldenemy); + dremove (_l_6062.observer_list); + } + dremove (_l_6062); + _l_6062 = world; + } + _l_6062 = find (_l_6062, classname, "detpack"); + } + _l_6062 = find (world, classname, "drop1"); + while (_l_6062) + { + if ((_l_6062.owner == self)) + { + dremove (_l_6062); + _l_6062 = world; + } + _l_6062 = find (_l_6062, classname, "drop1"); + } + _l_6062 = find (world, classname, "bot"); + while (_l_6062) + { + if ((_l_6062.owner == self)) + { + dremove (_l_6062); + _l_6062 = world; + } + _l_6062 = find (_l_6062, classname, "bot"); + } + set_suicide_frame (); + self.netname = string_null; + self.team_no = 0; + self.solid = 0; + setsize (self, '0 0 0', '0 0 0'); +}; + +void(entity targ, entity attacker) ClientObituary = +{ + local float rnum; + local string deathstring; + local string deathstring2; + + if (prematch) + { + return; + } + +// 'fer code caller! + if (deathmsg > 0 && deathmsg < 199) + { + if (attacker) + { + attacker.num_kills = attacker.num_kills + 1; + if ((targ.off_hook > time)) + { + attacker.num_kills = attacker.num_kills - 1; + targ.off_hook = 0; + } + if (attacker.fertracker != 1) + { + attacker.fertracker = 1; + fertimer (attacker); + } + if (attacker == targ) + { + attacker.num_kills = attacker.num_kills - 1; + } + + if (targ.off_hook != 1) + { +//So disps, Drones, and heads dont count as fers + if (targ.classname == "building_dispenser") { + attacker.num_kills = attacker.num_kills - 1; } + if (targ.think == DroneJet) { + attacker.num_kills = attacker.num_kills - 1; } + if (targ.touch == KickHead) { + attacker.num_kills = attacker.num_kills - 1; } + } + } + } +// end 'fer caller + rnum = random(); + if (targ.classname == "player") + { + if (attacker.classname == "teledeath") + { + bprint(TF_FLARE_OFF, targ.netname); + bprint(TF_FLARE_OFF, " got in the way of "); + bprint(TF_FLARE_OFF, attacker.owner.netname); + bprint(TF_FLARE_OFF, "\n"); + if (attacker.owner.team_no != targ.team_no || attacker.owner.team_no < TF_FLARE_OFF) + { + attacker.owner.real_frags = attacker.owner.real_frags + TF_FLARE_OFF; + } + if (!(toggleflags & 128)) + { + attacker.owner.frags = attacker.owner.real_frags; + } + return; + } + if (attacker.classname == "teledeath2") + { + bprint(TF_FLARE_OFF, "Satan's power deflects "); + bprint(TF_FLARE_OFF, targ.netname); + bprint(TF_FLARE_OFF, "'s telefrag\n"); + targ.real_frags = targ.real_frags - TF_FLARE_OFF; + if (!(toggleflags & 128)) + { + targ.frags = targ.real_frags; + } + logfrag(targ, targ); + return; + } + if (attacker.classname == "info_tfgoal") + { + if (attacker.deathtype != "") + { + bprint(TF_FLARE_OFF, targ.netname); + bprint(TF_FLARE_OFF, attacker.deathtype); + } + logfrag(targ, targ); + return; + } + if (attacker.classname == "player" || attacker.classname == "bot") + { + if (targ == attacker) + { + attacker.real_frags = attacker.real_frags - TF_FLARE_OFF; + if (!(toggleflags & 128)) + { + attacker.frags = attacker.real_frags; + } + bprint(TF_FLARE_OFF, targ.netname); + if (deathmsg == 8) + { + if (targ.gender < 1) + { + deathstring = " grenades himself\n"; + } + else + { + deathstring = " grenades herself\n"; + } + } + else + { + if (deathmsg == 43) + { + if (targ.gender < 1) + { + deathstring = " has himself bombed\n"; + } + else + { + deathstring = " has herself bombed\n"; + } + } + else + { + if (deathmsg == 45) + { + if (targ.gender < 1) + { + deathstring = " hugs his proximity grenade\n"; + } + else + { + deathstring = " hugs her proximity grenade\n"; + } + } + else + { + if (deathmsg == 9) + { + if (targ.gender < 1) + { + deathstring = " nails himself\n"; + } + else + { + deathstring = " nails herself\n"; + } + } + else + { + if (deathmsg == 10) + { + deathstring = " is blown to bits\n"; + } + else + { + if (deathmsg == 11) + { + if (targ.gender < 1) + { + deathstring = " pipebombs himself...\nWhat a dumb-ass!\n"; + } + else + { + deathstring = " pipebombs herself...\nWhat a dumb-ass!\n"; + } + } + else + { + if (deathmsg == 24) + { + if (targ.gender < 1) + { + deathstring = " gags on his own gas... pew!\n"; + } + else + { + deathstring = " gags on her own gas... pew!\n"; + } + } + else + { + if (deathmsg == 30) + { + if (targ.gender < 1) + { + deathstring = " nukes his own ammo\n"; + } + else + { + deathstring = " nukes her own ammo\n"; + } + } + else + { + if (deathmsg == 35) + { + if (targ.gender < 1) + { + deathstring = " flash grenade himself to death\n"; + } + else + { + deathstring = " flash grenade herself to death\n"; + } + } + else + { + if (deathmsg == 31) + { + if (targ.gender < 1) + { + deathstring = " detonates an ammo box too close to him\n"; + } + else + { + deathstring = " detonates an ammo box too close to her\n"; + } + } + else + { + if (deathmsg == 12) + { + if (targ.gender < 1) + { + deathstring = " detpacks himself\n That was smart!\n"; + } + else + { + deathstring = " detpacks herself\n That was smart!\n"; + } + } + else + { + if (deathmsg == 13) + { + deathstring = " died impossibly!\n"; + } + else + { + if (deathmsg == 6) + { + if (rnum <= 0.5) + { + if (targ.gender < 1) + { + deathstring = " checks if his weapon is loaded\n"; + } + else + { + deathstring = " checks if her weapon is loaded\n"; + } + } + else + { + if (targ.gender < 1) + { + deathstring = " hates himself\n"; + } + else + { + deathstring = " hates herself\n"; + } + } + } + else + { + if (deathmsg == 41) + { + deathstring = "'s Laser Drone malfunctioned\n"; + } + else + { + if (deathmsg == 33) + { + if (targ.gender < 1) + { + deathstring = " chars himself with an incendiary rocket\n"; + } + else + { + deathstring = " chars herself with an incendiary rocket\n"; + } + } + else + { + if (deathmsg == 5) + { + deathstring = " tries to put the pin back in\n"; + } + else + { + if (deathmsg == 15) + { + if (attacker.playerclass == TF_FLARE_OFF) + { + deathstring = "'s JetPack malfunctions\n"; + } + else + { + if (targ.gender < 1) + { + deathstring = " bakes himself\n"; + } + else + { + deathstring = " bakes herself\n"; + } + } + } + else + { + if (deathmsg == 7 && targ.waterlevel > TF_FLARE_LIT) + { + if (targ.gender < 1) + { + bprint(TF_FLARE_OFF, " shocks himself to death.\n"); + } + else + { + bprint(TF_FLARE_OFF, " shocks herself to death.\n"); + } + return; + } + else + { + if (deathmsg == 40) + { + if (targ.gender < 1) + { + deathstring = " couldn't outrun his airspam\n"; + } + else + { + deathstring = " couldn't outrun her airspam\n"; + } + } + else + { + if (deathmsg == 201) + { + if (targ.gender < 1) + { + deathstring = " used his dispenser for all the wrong reasons\n"; + } + else + { + deathstring = " used her dispenser for all the wrong reasons\n"; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + bprint(TF_FLARE_OFF, deathstring); + return; + } + else + { + if (teamplay && attacker.team_no == targ.team_no && attacker.team_no > 0) + { + if (attacker.team_no > 0 && attacker.team_no == targ.team_no) + { + attacker.real_frags = attacker.real_frags - TF_FLARE_OFF; + } + else + { + attacker.real_frags = attacker.real_frags + TF_FLARE_OFF; + } + if (!(toggleflags & 128)) + { + attacker.frags = attacker.real_frags; + } + if (rnum < 0.25) + { + deathstring = " mows down a teammate\n"; + } + else + { + if (rnum < 0.5) + { + if (targ.gender < 1) + { + deathstring = " checks his glasses\n"; + } + else + { + deathstring = " checks her glasses\n"; + } + } + else + { + if (rnum < 0.75) + { + deathstring = " gets a frag for the other team\n"; + } + else + { + deathstring = " loses another friend\n"; + } + } + } + if (deathmsg == 23) + { + bprint(TF_FLARE_OFF, targ.netname); + bprint(TF_FLARE_OFF, " didn't survive the operation.\n"); + return; + } + bprint(TF_FLARE_OFF, attacker.netname); + bprint(TF_FLARE_OFF, deathstring); + return; + } + else + { + attacker.real_frags = attacker.real_frags + TF_FLARE_OFF; + logfrag(attacker, targ); + if (!(toggleflags & 128)) + { + attacker.frags = attacker.real_frags; + } + if (deathmsg == 43) + { + deathstring = " was bombed by "; + deathstring2 = "'s AirStrike call\n"; + } + if (deathmsg == 45) + { + deathstring = " gets too friendly with "; + deathstring2 = "'s Proxi grenade\n"; + } + if (deathmsg == 46) + { + deathstring = " gets shredded by "; + deathstring2 = "'s 20mm cannon\n"; + } + if (deathmsg == 8) + { + deathstring = " tries to hatch "; + deathstring2 = "'s grenade\n"; + } + else + { + if (deathmsg == 9) + { + deathstring = " gets perforated by "; + deathstring2 = "'s nail grenade\n"; + } + else + { + if (deathmsg == 10) + { + deathstring = " gets juiced by "; + deathstring2 = "'s Mirv grenade\n"; + } + else + { + if (deathmsg == 40) + { + deathstring = " is shreaded by "; + deathstring2 = "'s AirMirv\n"; + } + else + { + if (deathmsg == 11) + { + deathstring = " is shreaded by "; + deathstring2 = "'s pipebomb trap\n"; + } + else + { + if (deathmsg == 24) + { + deathstring = " sniffs to much of "; + deathstring2 = "'s glue\n"; + } + else + { + if (deathmsg == 30) + { + deathstring = "'s gets vaporized by "; + deathstring2 = "'s EMP grenade.\n"; + } + else + { + if (deathmsg == 35) + { + deathstring = "'s brain is fried by "; + deathstring2 = "'s flash grenade\n"; + } + else + { + if (deathmsg == 31) + { + deathstring = " stands near some ammo as "; + deathstring2 = "'s EMP nukes it\n"; + } + else + { + if (deathmsg == 12) + { + deathstring = " is nuked by "; + deathstring2 = "'s detpack\n"; + } + else + { + if (deathmsg == 16) + { + deathstring = " cut the red wire of "; + deathstring2 = "'s detpack\n"; + } + else + { + if (deathmsg == 13) + { + deathstring = " dies from "; + deathstring2 = "'s social disease\n"; + sound(targ, 0, "player/mpain6.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (deathmsg == 14) + { + deathstring = " escapes infection from "; + deathstring2 = " by dying first\n"; + } + else + { + if (deathmsg == 5) + { + deathstring = " swallows "; + deathstring2 = "'s grenade\n"; + if (targ.health < -40) + { + deathstring = " was split in half by "; + deathstring2 = "'s grenade\n"; + } + } + else + { + if (deathmsg == 6) + { + deathstring = " is reamed by "; + deathstring2 = "'s rocket\n"; + if (targ.health < -40) + { + deathstring = "'s bunghole was ripped by "; + deathstring2 = "'s rocket\n"; + } + } + else + { + if (deathmsg == 41) + { + deathstring = " was killed by "; + deathstring2 = "'s Laser Drone\n"; + if (targ.health < -40) + { + deathstring = " was vaporized by "; + deathstring2 = "'s Laser Drone\n"; + } + } + else + { + if (deathmsg == 42) + { + deathstring = " was torn up by an enemy Rottweiler"; + deathstring2 = "\n"; + } + else + { + if (deathmsg == 44) + { + deathstring = " was stopped by an enemy autoturret"; + deathstring2 = "\n"; + } + else + { + if (deathmsg == 15) + { + if (rnum < 0.2) + { + deathstring = " burns to death by "; + deathstring2 = "'s flame\n"; + } + else + { + if (rnum < 0.4) + { + deathstring = " is fried by "; + deathstring2 = "'s fire\n"; + } + else + { + if (rnum < 0.6) + { + deathstring = " is boiled alive by "; + deathstring2 = "'s heat\n"; + } + else + { + if (rnum < 0.8) + { + deathstring = " is cremated by "; + deathstring2 = "'s incinerator\n"; + } + else + { + deathstring = " is grilled by "; + deathstring2 = "'s BBQ\n"; + } + } + } + } + } + else + { + if (deathmsg == 17) + { + if (attacker.playerclass == 8) + { + deathstring = " was stabbed by "; + } + else + { + deathstring = " was slit open by "; + } + deathstring2 = "\n"; + } + else + { + if (deathmsg == 32) + { + deathstring = " was spanner-whacked by "; + deathstring2 = "\n"; + } + else + { + if (deathmsg == TF_FLARE_OFF) + { + deathstring = " was swiss-cheesed by "; + deathstring2 = "'s bird gun\n"; +// //shotgun_exp_gain (); + } + else + { + if (deathmsg == 2) + { + deathstring = "'s head is popped by "; + deathstring2 = "'s shotgun\n"; + } + else + { + if (deathmsg == 3) + { + deathstring = " was capped by "; + deathstring2 = "\n"; + } + else + { + if (deathmsg == 4) + { + deathstring = " was perforated by "; + deathstring2 = "'s nailgun\n"; + } + else + { + if (deathmsg == 7) + { + deathstring = " swims with "; + deathstring2 = "'s toaster\n"; + } + else + { + if (deathmsg == 21) + { + deathstring = " grappled with "; + deathstring2 = "\n"; + } + else + { + if (deathmsg == 18) + { + if (rnum <= 0.3) + { + deathstring = " gets a sucking chest wound from "; + deathstring2 = "\n"; + } + else + { + if (rnum <= 0.6) + { + deathstring = "'s liver is blown out by "; + deathstring2 = "\n"; + } + else + { + deathstring = "'s chest explodes from "; + deathstring2 = "'s sniper round\n"; + } + } + } + else + { + if (deathmsg == 29) + { + if (rnum <= 0.5) + { + deathstring = " is beheaded by "; + deathstring2 = "'s round\n"; + } + else + { + deathstring = "'s labotomized by "; + deathstring2 = "'s sniper round\n"; + } + } + else + { + if (deathmsg == 28) + { + deathstring = "'s legs explode open from "; + deathstring2 = "'s shot\n"; + } + else + { + if (deathmsg == 19) + { + deathstring = " enjoys "; + deathstring2 = "'s machinegun.\n"; + } + else + { + if (deathmsg == 20) + { + deathstring = " torso is removed by "; + deathstring2 = "\n"; + } + else + { + if (deathmsg == 22) + { + deathstring = " is ass-knifed by "; + deathstring2 = "\n"; + sound(targ, 0, "player/mpain6.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (deathmsg == 25) + { + deathstring = " is over-dosed by "; + deathstring2 = "'s ludes\n"; + } + else + { + if (deathmsg == 26) + { + deathstring = " spews juice thru holes from "; + deathstring2 = "'s railgun\n"; + } + else + { + if (deathmsg == 33) + { + deathstring = " gets cooked by "; + deathstring2 = "'s incendiary rocket\n"; + } + // pablo. spike trap death msg. + else + { + if (deathmsg == 200) + { + deathstring = "'s leg was amputated by "; + deathstring2 = "'s spike\n"; + } + // pablo. dispenser death msg. + else + { + if (deathmsg == 201) + { + deathstring = " thought "; + deathstring2 = "'s dispenser was a mechanical bull\n"; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + bprint(TF_FLARE_OFF, targ.netname); + bprint(TF_FLARE_OFF, deathstring); + bprint(TF_FLARE_OFF, attacker.netname); + bprint(TF_FLARE_OFF, deathstring2); + } + } + return; + } + else + { + if (attacker.classname == "building_sentrygun") + { + if (targ == attacker.real_owner) + { + if (deathmsg == 34) + { + if (targ.gender < 1) + { + deathstring = " gets wasted by his sentry gun\nDumb-ass!\n"; + } + else + { + deathstring = " gets wasted by her sentry gun\nDumb-ass!\n"; + } + } + else + { + if (deathmsg == 27) + { + if (targ.gender < 1) + { + deathstring = " crossed his sentry gun's line of fire\n"; + } + else + { + deathstring = " crossed her sentry gun's line of fire\n"; + } + } + } + bprint(TF_FLARE_OFF, targ.netname); + bprint(TF_FLARE_OFF, deathstring); + } + else + { + attacker.real_owner.real_frags = attacker.real_owner.real_frags + TF_FLARE_OFF; + logfrag(attacker.real_owner, targ); + if (!(toggleflags & 128)) + { + attacker.real_owner.frags = attacker.real_owner.real_frags; + } + if (deathmsg == 34) + { + deathstring = " is creamed by "; + deathstring2 = "'s sentry gun\n"; + } + else + { + if (deathmsg == 27) + { + deathstring = "'s spine is extracted by "; + deathstring2 = "'s sentry gun\n"; + } + } + bprint(TF_FLARE_OFF, targ.netname); + bprint(TF_FLARE_OFF, deathstring); + bprint(TF_FLARE_OFF, attacker.real_owner.netname); + bprint(TF_FLARE_OFF, deathstring2); + } + } + else + { + logfrag(targ, targ); + targ.real_frags = targ.real_frags - TF_FLARE_OFF; + if (!(toggleflags & 128)) + { + targ.frags = targ.real_frags; + } + rnum = targ.watertype; + bprint(2, targ.netname); + if (rnum == -3) + { + if (random() < 0.5) + { + deathstring = " can't swim worth a crap!\n"; + } + else + { + deathstring = " can't breathe water\n"; + } + } + else + { + if (rnum == -4) + { + if (random() < 0.5) + { + deathstring = " gulped a load of slime\n"; + } + else + { + deathstring = " can't exist on slime alone\n"; + } + } + else + { + if (rnum == -5) + { + if (targ.health < -15) + { + deathstring = " burst into flames\n"; + } + else + { + if (random() < 0.5) + { + deathstring = " turned into hot slag\n"; + } + else + { + deathstring = " visits the Hell fires\n"; + } + } + } + else + { + if (attacker.classname == "monster_dog") + { + deathstring = " was mauled by a Rottweiler\n"; + } + else + { + if (attacker.classname == "explo_box") + { + deathstring = " blew up\n"; + } + else + { + if (attacker.solid == 4 && attacker != world) + { + deathstring = " was crushed\n"; + } + else + { + if (targ.deathtype == "falling") + { + targ.deathtype = ""; + if (targ.gender < 1) + { + deathstring = " fell to his death\n"; + } + else + { + deathstring = " fell to her death\n"; + } + + } + else + { + if (attacker.classname == "trap_shooter" || attacker.classname == "trap_spikeshooter") + { + deathstring = " was shot\n"; + } + else + { + if (attacker.classname == "fireball") + { + deathstring = " ate a lavaball\n"; + } + else + { + if (attacker.classname == "trigger_changelevel") + { + deathstring = " tried to leave\n"; + } + else + { + deathstring = " died\n"; + } + } + } + } + } + } + } + } + } + } + bprint(TF_FLARE_OFF, deathstring); + } + } + } + else + { + if (targ.classname == "building_sentrygun") + { + if (attacker.classname == "teledeath") + { + bprint(TF_FLARE_OFF, targ.real_owner.netname); + bprint(TF_FLARE_OFF, "'s sentrygun was telefragged by "); + bprint(TF_FLARE_OFF, attacker.owner.netname); + bprint(TF_FLARE_OFF, "\n"); + return; + } + if (attacker.classname == "player") + { + if (attacker == targ.real_owner) + { + bprint(TF_FLARE_OFF, targ.real_owner.netname); + bprint(TF_FLARE_OFF, " selfdistructs his sentrygun\n"); + return; + } + bprint(TF_FLARE_OFF, targ.real_owner.netname); + bprint(TF_FLARE_OFF, "'s sentrygun was no match for "); + bprint(TF_FLARE_OFF, attacker.netname); + bprint(TF_FLARE_OFF, "\n"); + logfrag(attacker, targ.real_owner); + attacker.real_frags = attacker.real_frags + TF_FLARE_OFF; + // pablo. no frags when teamscores is on. + if (!(toggleflags & 128)) + { + attacker.frags = attacker.real_frags; + } + // + if (attacker.team_no > 0 && attacker.team_no != targ.real_owner.team_no) + { + attacker.real_frags = attacker.real_frags + TF_FLARE_OFF; + logfrag(attacker, targ.real_owner); + if (!(toggleflags & 128)) + { + attacker.frags = attacker.real_frags; + } + } + return; + } + } + } +}; + +void(entity attacker) fertimer = +{ + attacker.fertracker = 1; +// self.num_kills = 1; + newmis = spawn(); + newmis.enemy = attacker; + newmis.classname = "timer"; + newmis.nextthink = time + 3; + newmis.think = ferdisplay; +}; + +void(entity te) ferdisplay = +{ + local entity playernamefer; + playernamefer = self.enemy; + playernamefer.fertracker = 0; + + if (playernamefer.classname != "player") + { + dremove (self); + return; + } + if (playernamefer.num_kills > 1) + { + local entity head; + head = nextent(world); + while (head != world) + { + if (head.classname == "player") { stuffcmd(head, "play misc/secret.wav \n"); } + head = nextent(head); + } + local string fercount; + fercount = ftos(playernamefer.num_kills); + bprint (1, playernamefer.netname); + bprint (1, " got a "); + bprint (1, fercount); + bprint (1, "-fer!"); + bprint (1, "\n"); + playernamefer.num_kills = 0; + + } + playernamefer.num_kills = 0; + dremove (self); +}; diff --git a/combat.pqc b/combat.pqc new file mode 100644 index 0000000..e40ab08 --- /dev/null +++ b/combat.pqc @@ -0,0 +1,746 @@ +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; + +entity (float gno) Findgoal; + +/*entity (float gno) Findgoal = +{ + local entity tg; + local string st; + + tg = find (world, classname, "info_tfgoal"); + while (tg) + { + if ((tg.goal_no == gno)) + { + return (tg); + } + tg = find (tg, classname, "info_tfgoal"); + } + dprint ("Could not find a goal with a goal_no of "); + st = ftos (gno); + dprint (st); + dprint (".\n"); + }; +*/ + + void() monster_death_use = + { + if (self.flags & TF_FLARE_OFF) + { + self.flags = self.flags - TF_FLARE_OFF; + } + if (self.flags & 2) + { + self.flags = self.flags - 2; + } + if (!(self.target)) + { + return; + } + activator = self.enemy; + SUB_UseTargets(); + }; + + float(entity targ, entity inflictor) CanDamage = + { + if (targ.movetype == 7) + { + traceline(inflictor.origin, 0.5 * (targ.absmin + targ.absmax), TF_FLARE_OFF, self); + if (trace_fraction == TF_FLARE_OFF) + { + return TF_FLARE_OFF; + } + if (trace_ent == targ) + { + return TF_FLARE_OFF; + } + return TF_FLARE_LIT; + } + traceline(inflictor.origin, targ.origin, TF_FLARE_OFF, self); + if (trace_fraction == TF_FLARE_OFF) + { + return TF_FLARE_OFF; + } + traceline(inflictor.origin, targ.origin + '15 15 0', TF_FLARE_OFF, self); + if (trace_fraction == TF_FLARE_OFF) + { + return TF_FLARE_OFF; + } + traceline(inflictor.origin, targ.origin + '-15 -15 0', TF_FLARE_OFF, self); + if (trace_fraction == TF_FLARE_OFF) + { + return TF_FLARE_OFF; + } + traceline(inflictor.origin, targ.origin + '-15 15 0', TF_FLARE_OFF, self); + if (trace_fraction == TF_FLARE_OFF) + { + return TF_FLARE_OFF; + } + traceline(inflictor.origin, targ.origin + '15 -15 0', TF_FLARE_OFF, self); + if (trace_fraction == TF_FLARE_OFF) + { + return TF_FLARE_OFF; + } + return TF_FLARE_LIT; + }; + + void(entity targ, entity attacker) Killed = + { + local entity oself; + oself = self; + self = targ; + if (self.health < -99) + { + self.health = -99; + } + if (self.movetype == 7 || self.movetype == TF_FLARE_LIT) + { + self.th_die(); + self = oself; + return; + } + self.enemy = attacker; + if (self.flags & 32) + { + killed_monsters = killed_monsters + TF_FLARE_OFF; + WriteByte(2, 27); + } + ClientObituary(self, attacker); + self.takedamage = TF_FLARE_LIT; + self.touch = SUB_Null; + monster_death_use(); + self.th_die(); + self = oself; + }; + + void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = + { + local vector dir; + local entity oldself; + local entity te; + local float save; + local float take; + if (!(targ.takedamage)) + { + return; + } + if (attacker.classname == "player") + { + damage = damage * 0.9; + } + if (attacker.classname == "player") + { + if (targ.classname != "player" && targ.classname != "bot") + { + if (!Activated(targ, attacker)) + { + if (targ.else_goal != TF_FLARE_LIT) + { + te = Findgoal(targ.else_goal); + if (te) + { + DoResults(te, attacker, targ.goal_result & 2); + } + } + return; + } + } + } + + if (((((targ.classname == "player") || (targ.classname == "building_sentrygun")) || (targ.classname == "building_dispenser")) || (targ.classname == "bot"))) + { + if (((attacker.stats_on == 1) && (attacker.team_no != targ.team_no))) + { + oldself = self; + self = attacker; + if ((deathmsg == 28)) + { + Stats_Hit (33); + } + else + { + if ((deathmsg == 29)) + { + Stats_Hit (34); + } + } + self = oldself; + } + } + + damage_attacker = attacker; + if (attacker.super_damage_finished > time) + { + damage = damage * 4; + } + if (teamplay & (64 | 32)) + { + damage = TeamEqualiseDamage(targ, attacker, damage); + } + save = ceil(targ.armortype * damage); + if (save >= targ.armorvalue) + { + save = targ.armorvalue; + targ.armortype = TF_FLARE_LIT; + targ.armorclass = TF_FLARE_LIT; + targ.items = targ.items - (targ.items & (8192 | 16384 | 32768)); + } + targ.armorvalue = targ.armorvalue - save; + take = ceil(damage - save); + if (targ.flags & 8) + { + targ.dmg_take = targ.dmg_take + take; + targ.dmg_save = targ.dmg_save + save; + targ.dmg_inflictor = inflictor; + } + if (inflictor != world && targ.movetype == 3) + { + targ.immune_to_check = time + damage / 20; + dir = targ.origin - (inflictor.absmin + inflictor.absmax) * 0.5; + dir = normalize(dir); + if (targ.jet_time < time) + { +if ((((damage < 60) & ((attacker.classname == "player") & (targ.classname == "player"))) & (attacker.netname != targ.netname))) + { + targ.velocity = targ.velocity + dir * damage * 11; + } + else + { + targ.velocity = targ.velocity + dir * damage * 8; + } + if (rj > TF_FLARE_OFF && (attacker.classname == "player" && targ.classname == "player") && attacker.netname == targ.netname) + { + targ.velocity = targ.velocity + dir * damage * rj; + } + } + } + if (targ.flags & 64) + { + return; + } + if (targ.invincible_finished >= time) + { + if (self.invincible_sound < time) + { + sound(targ, 3, "items/protect3.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.invincible_sound = time + 2; + } + return; + } + if (attacker.classname == "player" && (targ.classname == "player" || targ.classname == "building_sentrygun")) + { + if (targ.team_no > TF_FLARE_LIT && targ.team_no == attacker.team_no && targ != attacker) + { + if (teamplay & 16) + { + return; + } + else + { + if (teamplay & 8) + { + take = take / 2; + } + } + } + } + if (take < TF_FLARE_OFF) + { + take = TF_FLARE_OFF; + } + targ.health = targ.health - take; + if (targ.armorvalue < TF_FLARE_OFF) + { + targ.armorclass = TF_FLARE_LIT; + targ.armorvalue = TF_FLARE_LIT; + } + if (targ.health <= TF_FLARE_LIT) + { + Killed(targ, attacker); + return; + } + oldself = self; + self = targ; + if (self.th_pain) + { + self.th_pain(attacker, take); + if (skill >= 3) + { + self.pain_finished = time + 5; + } + } + self = oldself; + }; + + void(entity targ, entity inflictor, entity attacker, float damage, float T_flags, float T_AttackType) TF_T_Damage = + { + local vector dir; + local entity oldself; + local entity te; + local float save; + local float take; + + if (!(targ.takedamage)) + { + return; + } + if (attacker.classname == "player") + { + damage = damage * 0.9; + } + if (attacker.classname == "player") + { + if (targ.classname != "player" && targ.classname != "bot" && targ.classname != "building_sentrygun" && targ.classname != "building_dispenser") + { + if (!Activated(targ, attacker)) + { + if (targ.else_goal != TF_FLARE_LIT) + { + te = Findgoal(targ.else_goal); + if (te) + { + DoResults(te, attacker, targ.goal_result & 2); + } + } + return; + } + } + } + + if (((((targ.classname == "player") || (targ.classname == "building_sentrygun")) || (targ.classname == "building_dispenser")) || (targ.classname == "bot"))) + { + if (((attacker.stats_on == 1) && (attacker.team_no != targ.team_no))) + { + oldself = self; + self = attacker; + if ((deathmsg == 1)) + { + Stats_Hit (128); + } + else + { + if ((deathmsg == 2)) + { + Stats_Hit (256); + } + else + { + if ((deathmsg == 3)) + { + Stats_Hit (512); + } + else + { + if ((deathmsg == 4)) + { + Stats_Hit (1024); + } + else + { + if ((deathmsg == 5)) + { + Stats_Hit (2048); + } + else + { + if ((deathmsg == 6)) + { + Stats_Hit (8192); + } + else + { + if ((deathmsg == 8)) + { + Stats_Hit (666); + } + else + { + if ((deathmsg == 11)) + { + Stats_Hit (2054); + } + else + { + if ((deathmsg == 17)) + { + Stats_Hit (8); + } + else + { + if ((deathmsg == 18)) + { + Stats_Hit (32); + } + else + { + if ((deathmsg == 19)) + { + Stats_Hit (64); + } + else + { + if ((deathmsg == 20)) + { + Stats_Hit (32768); + } + else + { + if ((deathmsg == 25)) + { + Stats_Hit (262144); + } + else + { + if ((deathmsg == 26)) + { + Stats_Hit (524288); + } + else + { + if ((deathmsg == 46)) + { + Stats_Hit (32768); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + self = oldself; + } + } + + damage_attacker = attacker; + if (attacker.super_damage_finished > time) + { + damage = damage * 4; + } + if (teamplay != 1 && teamplay != 2) + { + if (targ.team_no == attacker.team_no && targ != attacker) + { + damage = TF_FLARE_LIT; + } + } + if (teamplay & (64 | 32)) + { + damage = TeamEqualiseDamage(targ, attacker, damage); + } + if (targ.armorclass != TF_FLARE_LIT && T_AttackType != TF_FLARE_LIT) + { + if (targ.armorclass & TF_FLARE_OFF && T_AttackType == TF_FLARE_OFF) + { + damage = floor(damage * 0.5); + } + else + { + if (targ.armorclass & 2 && T_AttackType == 2) + { + damage = floor(damage * 0.5); + } + else + { + if (targ.armorclass & 4 && T_AttackType == 4) + { + damage = floor(damage * 0.5); + } + else + { + if (targ.armorclass & 8 && T_AttackType == 8) + { + damage = floor(damage * 0.5); + } + else + { + if (targ.armorclass & 16 && T_AttackType == 16) + { + damage = floor(damage * 0.5); + } + } + } + } + } + } + if (T_flags & TF_FLARE_OFF) + { + take = damage; + save = TF_FLARE_LIT; + } + else + { + save = ceil(targ.armortype * damage); + if (save >= targ.armorvalue) + { + save = targ.armorvalue; + targ.armortype = TF_FLARE_LIT; + targ.armorclass = TF_FLARE_LIT; + targ.items = targ.items - (targ.items & (8192 | 16384 | 32768)); + } + targ.armorvalue = targ.armorvalue - save; + take = ceil(damage - save); + } + if (targ.flags & 8) + { + targ.dmg_take = targ.dmg_take + take; + targ.dmg_save = targ.dmg_save + save; + targ.dmg_inflictor = inflictor; + } + if (inflictor != world && targ.movetype == 3) + { + if (deathmsg != 9) + { + if (targ.playerclass != 6 && targ.jet_time < time) + { + targ.immune_to_check = time + damage / 20; + dir = targ.origin - (inflictor.absmin + inflictor.absmax) * 0.5; + dir = normalize(dir); +if ((((damage < 60) & ((attacker.classname == "player") & (targ.classname == "player"))) & (attacker.netname != targ.netname))) + { + if (attacker.playerclass == 5) + { + targ.velocity = targ.velocity + dir * damage * 3; + } + else + { + targ.velocity = targ.velocity + dir * damage * 11; + } + } + else + { + targ.velocity = targ.velocity + dir * damage * 8; + } + if (rj > TF_FLARE_OFF && (attacker.classname == "player" && targ.classname == "player") && attacker.netname == targ.netname) + { + targ.velocity = targ.velocity + dir * damage * rj; + } + } + } + } + if (targ.flags & 64) + { + return; + } + if (targ.invincible_finished >= time) + { + if (self.invincible_sound < time) + { + sound(targ, 3, "items/protect3.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.invincible_sound = time + 2; + } + return; + } + if (attacker.classname == "player" && (targ.classname == "player" || targ.classname == "building_sentrygun")) + { + if (T_flags & 2) + { + if (targ.team_no > TF_FLARE_LIT && targ.team_no == attacker.team_no && targ != attacker) + { + if (teamplay & 4) + { + return; + } + else + { + if (teamplay & 2) + { + take = take / 2; + } + } + } + } + else + { + if (targ.team_no > TF_FLARE_LIT && targ.team_no == attacker.team_no && targ != attacker) + { + if (teamplay & 16) + { + return; + } + else + { + if (teamplay & 8) + { + take = take / 2; + } + } + } + } + } + if (T_flags & 4) + { + if (targ == attacker) + { + return; + } + } + if (take < TF_FLARE_OFF) + { + take = TF_FLARE_OFF; + } + targ.health = targ.health - take; + if (targ.armorvalue < TF_FLARE_OFF) + { + targ.armorclass = TF_FLARE_LIT; + targ.armorvalue = TF_FLARE_LIT; + } + + if ((((deathmsg == 34) && (targ.classname == "building_sentrygun")) && (targ.health <= 0))) + { + if (((targ.goalentity.classname == "bot") || (targ.goalentity.classname == "airmirv"))) + { + targ.goalentity = targ.goalentity.owner; + } + bprint (1, targ.real_owner.netname); + bprint (1, "'s sentrygun blew itself up thanks to "); + bprint (1, targ.goalentity.netname); + bprint (1, "\n"); + targ.goalentity.real_frags = (targ.goalentity.real_frags + 2); + logfrag (targ.goalentity, targ.real_owner); + if (!(toggleflags & 128)) + { + targ.goalentity.frags = targ.goalentity.real_frags; + } + } + + if (targ.health <= TF_FLARE_LIT) + { + if (inflictor.classname == "detpack" && inflictor.weaponmode == TF_FLARE_OFF && inflictor.enemy == targ) + { + deathmsg = 16; + } + Killed(targ, attacker); + return; + } + oldself = self; + self = targ; + if (self.th_pain) + { + self.th_pain(attacker, take); + if (skill >= 3) + { + self.pain_finished = time + 5; + } + } + self = oldself; + }; + + void(entity inflictor, entity attacker, float damage, entity ignore) T_RadiusDamage = + { + local float points; + local entity head; + local entity te; + local vector org; + head = findradius(inflictor.origin, damage + 40); + while (head) + { + if (head != ignore) + { + if (head.classname == "info_tfgoal") + { + if (inflictor.classname == "detpack") + { + if (head.goal_activation & 2 && head.search_time == TF_FLARE_LIT) + { + traceline(inflictor.origin, head.origin, TF_FLARE_OFF, inflictor); + if (trace_fraction == TF_FLARE_OFF) + { + if (Activated(head, attacker)) + { + DoResults(head, attacker, TF_FLARE_OFF); + } + else + { + if (head.else_goal != TF_FLARE_LIT) + { + te = Findgoal(head.else_goal); + if (te) + { + DoResults(te, attacker, head.goal_result & 2); + } + } + return; + } + } + } + } + } + else + { + if (head.takedamage) + { + org = head.origin + (head.mins + head.maxs) * 0.5; + points = 0.5 * vlen(inflictor.origin - org); + if (points < TF_FLARE_LIT) + { + points = TF_FLARE_LIT; + } + points = damage - points; + if (head == attacker) + { + points = points * 0.75; + } + if (points > TF_FLARE_LIT) + { + if (CanDamage(head, inflictor)) + { + if (head.classname == "monster_shambler") + { + T_Damage(head, inflictor, attacker, points * 0.5); + } + else + { + TF_T_Damage(head, inflictor, attacker, points, 2, 4); + } + } + } + } + } + } + head = head.chain; + } + }; + + void(entity attacker, float damage) T_BeamDamage = + { + local float points; + local entity head; + head = findradius(attacker.origin, damage + 40); + while (head) + { + if (head.takedamage) + { + points = 0.5 * vlen(attacker.origin - head.origin); + if (points < TF_FLARE_LIT) + { + points = TF_FLARE_LIT; + } + points = damage - points; + if (head == attacker) + { + points = points * 0.5; + } + if (points > TF_FLARE_LIT) + { + if (CanDamage(head, attacker)) + { + T_Damage(head, attacker, attacker, points); + } + } + } + head = head.chain; + } + }; diff --git a/coop.pqc b/coop.pqc new file mode 100644 index 0000000..ee40190 --- /dev/null +++ b/coop.pqc @@ -0,0 +1,168 @@ +void() DroppedKeyThink = +{ + self.think = SUB_Null; + self.touch = key_touch; + self.owner = world; +}; + +/*void() DropKey = +{ + if (self.items & 131072 || (self.items & 262144)) + { + newmis = spawn(); + if (self.items & 131072) + { + self.items = self.items - (self.items & 131072); + newmis.items = 131072; + if (world.worldtype == TF_FLARE_LIT) + { + setmodel(newmis, "progs/w_s_key.mdl"); + newmis.netname = "silver key"; + newmis.noise = "misc/medkey.wav"; + } + else + { + if (world.worldtype == TF_FLARE_OFF) + { + setmodel(newmis, "progs/m_s_key.mdl"); + newmis.netname = "silver runekey"; + newmis.noise = "misc/runekey.wav"; + } + else + { + if (world.worldtype == 2) + { + setmodel(newmis, "progs/b_s_key.mdl"); + newmis.netname = "silver keycard"; + newmis.noise = "misc/basekey.wav"; + } + } + } + } + else + { + if (self.items & 262144) + { + self.items = self.items - (self.items & 262144); + newmis.items = 262144; + if (world.worldtype == TF_FLARE_LIT) + { + setmodel(newmis, "progs/w_g_key.mdl"); + newmis.netname = "gold key"; + newmis.noise = "misc/medkey.wav"; + } + else + { + if (world.worldtype == TF_FLARE_OFF) + { + setmodel(newmis, "progs/m_g_key.mdl"); + newmis.netname = "gold runekey"; + newmis.noise = "misc/runekey.wav"; + } + else + { + if (world.worldtype == 2) + { + setmodel(newmis, "progs/b_g_key.mdl"); + newmis.netname = "gold keycard"; + newmis.noise = "misc/basekey.wav"; + } + } + } + } + } + newmis.owner = self; + newmis.touch = SUB_Null; + setorigin(newmis, self.origin + '0 0 16'); + makevectors(self.v_angle); + newmis.velocity = normalize(v_forward) * 300 + '0 0 200'; + newmis.movetype = 6; + newmis.solid = TF_FLARE_OFF; + newmis.deadflag = TF_FLARE_OFF; + setsize(newmis, '-16 -16 -24', '16 16 32'); + newmis.think = DroppedKeyThink; + newmis.nextthink = time + 1.5; + } + else + { + sprint(self, 2, "You don't have a key\n"); + } +};*/ + +float() DoorShouldOpen = +{ + local entity ptr; + local float plyrcount; + local entity plyr1; + local entity plyr2; + if (coop != 2) + { + return TF_FLARE_OFF; + } + plyrcount = TF_FLARE_LIT; + ptr = find(world, classname, "player"); + while (ptr != world) + { + if (!(ptr.tf_items & self.items) && ptr.playerclass != TF_FLARE_LIT && ptr.solid != TF_FLARE_LIT && ptr.model != string_null) + { + plyrcount = plyrcount + TF_FLARE_OFF; + if (plyrcount == TF_FLARE_OFF) + { + plyr1 = ptr; + } + else + { + if (plyrcount == 2) + { + plyr2 = ptr; + } + } + } + ptr = find(ptr, classname, "player"); + } + if (plyrcount != TF_FLARE_LIT) + { + if (plyrcount == TF_FLARE_OFF) + { + bprint(2, plyr1.netname); + bprint(2, " needs"); + } + else + { + if (plyrcount == 2) + { + bprint(2, plyr1.netname); + bprint(2, " and "); + bprint(2, plyr2.netname); + bprint(2, " need"); + } + else + { + bprint(2, "More players need"); + } + } + bprint(2, " to unlock the "); + if (self.items & 131072) + { + bprint(2, "silver"); + } + else + { + bprint(2, "gold"); + } + bprint(2, " door\n"); + return TF_FLARE_LIT; + } + bprint(2, "The "); + if (self.items & 131072) + { + bprint(2, "silver"); + } + else + { + bprint(2, "gold"); + } + bprint(2, " door has been unlocked\n"); + return TF_FLARE_OFF; +}; + diff --git a/ctf.pqc b/ctf.pqc new file mode 100644 index 0000000..1cf84d6 --- /dev/null +++ b/ctf.pqc @@ -0,0 +1,99 @@ +void () TeamFortress_CTF_FlagInfo = +{ + local entity _l_11235; + + _l_11235 = Finditem (1); + if ((_l_11235.goal_state == 1)) + { + if ((self == _l_11235.owner)) + { + sprint (self, 2, "You have the enemy flag. "); + } + else + { + sprint (self, 2, _l_11235.owner.netname); + sprint (self, 2, " has"); + if ((self.team_no == 1)) + { + sprint (self, 2, " your flag. "); + } + else + { + sprint (self, 2, " the enemy flag. "); + } + } + } + else + { + if ((_l_11235.origin != _l_11235.oldorigin)) + { + if ((self.team_no == 1)) + { + sprint (self, 2, "Your flag is lying about. "); + } + else + { + sprint (self, 2, "The enemy flag is lying about. "); + } + } + else + { + if ((self.team_no == 1)) + { + sprint (self, 2, "Your flag is in your base. "); + } + else + { + sprint (self, 2, "The enemy flag is in their base. "); + } + } + } + _l_11235 = Finditem (2); + if ((_l_11235.goal_state == 1)) + { + if ((self == _l_11235.owner)) + { + sprint (self, 2, "You have the enemy flag.\n"); + } + else + { + sprint (self, 2, _l_11235.owner.netname); + sprint (self, 2, " has"); + if ((self.team_no == 2)) + { + sprint (self, 2, " your flag.\n"); + } + else + { + sprint (self, 2, " the enemy flag.\n"); + } + } + } + else + { + if ((_l_11235.origin != _l_11235.oldorigin)) + { + if ((self.team_no == 2)) + { + sprint (self, 2, "Your flag is lying about.\n"); + } + else + { + sprint (self, 2, "The enemy flag is lying about.\n"); + } + } + else + { + if ((self.team_no == 2)) + { + sprint (self, 2, "Your flag is in your base.\n"); + } + else + { + sprint (self, 2, "The enemy flag is in their base.\n"); + } + } + } +}; + + diff --git a/debug.pqc b/debug.pqc new file mode 100644 index 0000000..c596c6f --- /dev/null +++ b/debug.pqc @@ -0,0 +1,25 @@ +void(entity te) dremove = +{ + if (te == world) + { + dprint("***BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG***\n"); + dprint("WORLD has nearly been removed. Don't worry\n"); + dprint("***BUG BUG BUG BUG BUG BUG BUG BUG BUG BUG***\n"); + return; + } + if (te.is_removed == TF_FLARE_OFF) + { + return; + } + te.is_removed = TF_FLARE_OFF; + remove(te); +}; + +void() display_location = +{ + local string st; + st = vtos(self.origin); + sprint(self, 2, st); + sprint(self, 2, "\n"); +}; + diff --git a/defs.pqc b/defs.pqc new file mode 100644 index 0000000..b95f092 --- /dev/null +++ b/defs.pqc @@ -0,0 +1,646 @@ +//clan stuff +#define clan_progs +#define fte_rankings // comment this out if not running fte server or dont want rankings enabled +#define new_solid // rocket hitting invisible wall fix (may be buggy, comment this out if it is..) + +#define WEAP_SNIPER_RIFLE_MAX_TIME 3 // PZ - Randomer's charge-up fix +#define WEAP_SNIPER_RIFLE_MIN_DAMG 50 // +#define WEAP_SNIPER_RIFLE_MAX_DAMG 400 // + +#define PC_SPY_MAXSPEED 320 + +#define TL_ANY_SOLID 0 +#define TL_BSP_ONLY 1 // will hit BSP only + +//menus +#define MENU_CLAN_PREMATCH 45 + + +/* +============================================================================== + + SOURCE FOR GLOBALVARS_T C STRUCTURE + +============================================================================== +*/ + +// +// system globals +// +entity self; +entity other; +entity world; +float time; +float frametime; + + +entity newmis; // if this is set, the entity that just + // run created a new missile that should + // be simulated immediately + + +float force_retouch; // force all entities to touch triggers + // next frame. this is needed because + // non-moving things don't normally scan + // for triggers, and when a trigger is + // created (like a teleport trigger), it + // needs to catch everything. + // decremented each frame, so set to 2 + // to guarantee everything is touched +string mapname; + + + + + + + +float serverflags; // propagated from level to level, used to + // keep track of completed episodes + +float total_secrets; +float total_monsters; + +float found_secrets; // number of secrets found +float killed_monsters; // number of monsters killed + + +// spawnparms are used to encode information about clients across server +// level changes +float parm1, parm2, parm3, parm4, parm5, parm6, parm7, parm8, parm9, parm10, parm11, parm12, parm13, parm14, parm15, parm16; + +// +// global variables set by built in functions +// +vector v_forward, v_up, v_right; // set by makevectors() + +// set by traceline / tracebox +float trace_allsolid; +float trace_startsolid; +float trace_fraction; +vector trace_endpos; +vector trace_plane_normal; +float trace_plane_dist; +entity trace_ent; +float trace_inopen; +float trace_inwater; + +entity msg_entity; // destination of single entity writes + +// +// required prog functions +// +void() main; // only for testing + +void() StartFrame; + +void() PlayerPreThink; +void() PlayerPostThink; + +void() ClientKill; +void() ClientConnect; +void() PutClientInServer; // call after setting the parm1... parms +void() ClientDisconnect; + +void() SetNewParms; // called when a client first connects to + // a server. sets parms so they can be + // saved off for restarts + +void() SetChangeParms; // call to set parms for self so they can + // be saved for a level transition + + +//================================================ +void end_sys_globals; // flag for structure dumping +//================================================ + +/* +============================================================================== + + SOURCE FOR ENTVARS_T C STRUCTURE + +============================================================================== +*/ + +// +// system fields (*** = do not set in prog code, maintained by C code) +// +.float modelindex; // *** model index in the precached list +.vector absmin, absmax; // *** origin + mins / maxs + +.float ltime; // local time for entity + +.float lastruntime; // *** to allow entities to run out of sequence + + +.float movetype; +.float solid; + +.vector origin; // *** +.vector oldorigin; // *** +.vector velocity; +.vector angles; +.vector avelocity; + + + + + +.string classname; // spawn function +.string model; +.float frame; +.float skin; +.float effects; + +.vector mins, maxs; // bounding box extents reletive to origin +.vector size; // maxs - mins + +.void() touch; +.void() use; +.void() think; +.void() blocked; // for doors or plats, called when can't push other + +.float nextthink; +.entity groundentity; + +// stats +.float health; +.float frags; +.float weapon; // one of the IT_SHOTGUN, etc flags +.string weaponmodel; +.float weaponframe; +.float currentammo; +.float ammo_shells, ammo_nails, ammo_rockets, ammo_cells; + +.float items; // bit flags + +.float takedamage; +.entity chain; +.float deadflag; + +.vector view_ofs; // add to origin to get eye point + + +.float button0; // fire +.float button1; // use +.float button2; // jump + +.float impulse; // weapon changes + +.float fixangle; +.vector v_angle; // view / targeting angle for players + + + + + +.string netname; + +.entity enemy; + +.float flags; + +.float colormap; +.float team; + +.float max_health; // players maximum health is stored here + +.float teleport_time; // don't back up + +.float armortype; // save this fraction of incoming damage +.float armorvalue; + +.float waterlevel; // 0 = not in, 1 = feet, 2 = wast, 3 = eyes +.float watertype; // a contents value + +.float ideal_yaw; +.float yaw_speed; + +.entity aiment; + +.entity goalentity; // a movetarget or an enemy + +.float spawnflags; + +.string target; +.string targetname; + +// damage is accumulated through a frame. and sent as one single +// message, so the super shotgun doesn't generate huge messages +.float dmg_take; +.float dmg_save; +.entity dmg_inflictor; + +.entity owner; // who launched a missile +.vector movedir; // mostly for doors, but also used for waterjump + +.string message; // trigger messages + +.float sounds; // either a cd track number or sound number + +.string noise, noise1, noise2, noise3; // contains names of wavs to play + +//================================================ +void end_sys_fields; // flag for structure dumping +//================================================ + +/* +============================================================================== + + VARS NOT REFERENCED BY C CODE + +============================================================================== +*/ + +float movedist /* = 0 */; +string string_null /* = "" */; +//float empty_float /* = 0 */; +entity activator; +entity damage_attacker; +float framecount /* = 0 */; +float skill /* = 0 */; +float teamplay /* = 0 */; +float timelimit /* = 0 */; +float fraglimit /* = 0 */; +float deathmatch /* = 0 */; +//.string wad; +.string map; +.float worldtype; +.string killtarget; +.float light_lev; +.float style; +.void() th_stand; +.void() th_walk; +.void() th_run; +.void() th_missile; +.void() th_melee; +.void(entity attacker, float damage) th_pain; +.void() th_die; +.entity oldenemy; +.float speed; +.float lefty; +.float search_time; +.float attack_state; +.float walkframe; +.float attack_finished; +.float pain_finished; +.float invincible_finished; +.float invisible_finished; +.float super_damage_finished; +.float radsuit_finished; +.float invincible_time; +.float invincible_sound; +.float invisible_time; +.float invisible_sound; +.float super_time; +.float super_sound; +.float rad_time; +.float fly_sound; +.float axhitme; +.float show_hostile; +.float jump_flag; +.float swim_flag; +.float air_finished; +.float bubble_count; +.string deathtype; +.string mdl; +.vector mangle; +.float t_length; +.float t_width; +.vector dest; +.vector dest1; +.vector dest2; +.float wait; +.float delay; +.entity trigger_field; +.string noise4; +.float pausetime; +.entity movetarget; +.float aflag; +.float dmg; +.float cnt; +.void() think1; +.vector finaldest; +.vector finalangle; +.float count; +.float lip; +.float state; +.vector pos1; +.vector pos2; +.float height; +.float waitmin; +.float waitmax; +.float distance; +.float volume; +void (vector ang) makevectors = #1; +void (entity e, vector o) setorigin = #2; +void (entity e, string m) setmodel = #3; +void (entity e, vector min, vector max) setsize = #4; +void () break = #6; +float () random = #7; +void (entity e, float chan, string samp, float vol, float atten) sound = #8; +vector (vector v) normalize = #9; +void (string e) error = #10; +void (string e) objerror = #11; +float (vector v) vlen = #12; +float (vector v) vectoyaw = #13; +entity () spawn = #14; +void (entity e) remove = #15; +void (vector v1, vector v2, float nomonsters, entity forent) traceline = #16; +entity () checkclient = #17; +entity (entity start, .string fld, string match) find = #18; +string (string s) precache_sound = #19; +string (string s) precache_model = #20; +void (entity client, string s) stuffcmd = #21; +entity (vector org, float rad) findradius = #22; +// pablo. +// ---> + +void(...) bprint = #23; +void(...) sprint = #24; + +void(...) bprint2 = #23; +void(...) sprint2 = #24; + +void(...) bprint3 = #23; +void(...) sprint3 = #24; + +void(...) bprint4 = #23; +void(...) sprint4 = #24; + +void(...) bprint5 = #23; +void(...) sprint5 = #24; + +void(...) bprint6 = #23; +void(...) sprint6 = #24; + +void(...) bprint7 = #23; +void(...) sprint7 = #24; + +void(...) bprint8 = #23; + +/* +void (string s) bprint = #23; +void (entity client, string s) sprint = #24; +void (string s) bprint2 = #23; +void (entity client, string s) sprint2 = #24; +void (string s) bprint3 = #23; +void (entity client, string s) sprint3 = #24; +void (string s) bprint4 = #23; +void (entity client, string s) sprint4 = #24; +void (string s) bprint5 = #23; +void (entity client, string s) sprint5 = #24; +void (string s) bprint6 = #23; +void (entity client, string s) sprint6 = #24; +void (string s) bprint7 = #23; +void (entity client, string s) sprint7 = #24; +void (string s) bprint8 = #23; +*/ +// <--- + +void (string s) dprint = #25; +string (float f) ftos = #26; +string (vector v) vtos = #27; +void () coredump = #28; +void () traceon = #29; +void () traceoff = #30; +void (entity e) eprint = #31; +float (float yaw, float dist) walkmove = #32; +// ---> pablo. this is wierd. :/ +//float (float yaw, float dist) droptofloor = #34; +float () droptofloor = #34; +// <--- +void (float style, string value) lightstyle = #35; +float (float v) rint = #36; +float (float v) floor = #37; +float (float v) ceil = #38; +float (entity e) checkbottom = #40; +float (vector v) pointcontents = #41; +float (float f) fabs = #43; +vector (entity e, float speed) aim = #44; +float (string s) cvar = #45; +void (string s) localcmd = #46; +entity (entity e) nextent = #47; +void (vector o, vector d, float color, float count) particle = #48; +void () ChangeYaw = #49; +vector (vector v) vectoangles = #51; +void (float to, float f) WriteByte = #52; +void (float to, float f) WriteChar = #53; +void (float to, float f) WriteShort = #54; +void (float to, float f) WriteLong = #55; +void (float to, float f) WriteCoord = #56; +void (float to, float f) WriteAngle = #57; +void (float to, string s) WriteString = #58; +void (float to, entity s) WriteEntity = #59; +void (float step) movetogoal = #67; +string (string s) precache_file = #68; +void (entity e) makestatic = #69; +void (string s) changelevel = #70; +void (string var, string val) cvar_set = #72; +// pablo. simple. +//void (entity client, string s, ...) CenterPrint = #73; +void(...) centerprint = #73; +// +void (vector pos, string samp, float vol, float atten) ambientsound = #74; +string (string s) precache_model2 = #75; +string (string s) precache_sound2 = #76; +string (string s) precache_file2 = #77; +void (entity e) setspawnparms = #78; +void(entity killer, entity killee) logfrag = #79; +string(entity e, string key) infokey = #80; +float(string s) stof = #81; +void (vector pos, float to) multicast = #82; + +.float autoid; +.float autodiscard; +.float discard_max; + + +/* old ideas - ignore pls :) +// exp vars (float is global, .float is self?) +.float shotgun_exp; +.float shotgun_level +void () shotgun_exp_gain; + +// VOTE SYSTEM HOPEFUL +void () megatf_votemap;*/ + +void () TeamFortress_Discard; +float medicarmorheal; + +void () lay; +void () unlay; + +void () lay = +{ + setsize (self, '-16 -16 -24', '16 16 8'); +}; + +void () unlay = +{ + setsize (self, '-16 -16 -24', '16 16 32'); +}; + +//votemap code +float num_players; +float num_votes; +float votestarted; +.float has_voted; +.float vote_wait; +void (string put) votemap_start; +void () voteyes; +string themap; +.float startedvote; +// Parems for prozac servers ONLY +float(string st) validatefile = #91; +float prozacmethod; +string prozacmap; +float(string mapstr) validatemap; +string pmap_backup; + +void(entity e, string s) clientcommand = #440; +float(string s) tokenize = #441; +string(float n) argv = #442; + +//fer stuff! +.float num_kills; +.float fertracker; +.float off_hook; + +float spycam; +.string oldweaponmodel; +void () Cam; +void () DetpackDisarm; +float drop1; +float drop2; + +void (entity _p_1912) camera_die; +void () camera_expire; +void () activatecam; +void () LookThroughCam; + +//Server Message Display +// serverinfo/localinfo svmsg1 - time amount between displaying message 1 +// serverinfo/localinfo svmsg2 - time amount between displaying message 2 +// serverinfo/localinfo message1 - what msg1 displays (IE serverinfo message1 "hi everybody!") +// serverinfo/localinfo message2 - what msg2 displays + +void () messagetimer; +void () pre_messagetimer2; +void () messagetimer2; +void () display_message; +void () display_message2; +float msg1time; +float msg2time; +float msg1first; +float msg2first; +#ifndef tf29ents +float haltloop1; +float haltloop2; +#endif +// the delay between displaying messages 1 and 2 - constrolled by serverinfo/localinfo svmsg_delay - +// just a little trick so you dont have to set msg1tiemr and msg2time to different intervals. +// This is optional however, and if the server doesn't find "svmsg_delay" it will continue messages as normal. +float msgdelay; + +// PM code! +.float userid; +float globaluserid; +.float cooldown; + +// scout disarm fix +float olddisarm; +void () DetpackDisarm; + +//Centerprint4.. wtf.. +void (entity client, string s, ...) CenterPrint4 = #73; + +//stats_dl +.float stats_on; +void (float _p_2445) Stats_Hit; +void (float _p_2420) Stats_Fired; + +// 11.11.04 defs +float spyjumpoption; +float quadscore; +float sr_dropgrens; +float sr_airmirv; +.float spy_regjump; +float engbat; + +//so players cant "discard" the server to death on certain maps +.float discard_next; + +//vector for original origin of objects +.vector orig_origin; + +//For FTE/EZQuake/Fuhquake servers +void () pm_list; +float true = 1; +float false = 0; +//float canusenew; +float(string pattern, float caseinsensitive, float quiet) search_begin = #444; +void(float handle) search_end = #445; +string(float handle, float num) search_getfilename = #447; +// Server Fix Function +string(string s1, string s2, ...) qsg_strcat = #82; +string(string s1, string s2, ...) cpqwsv_strcat = #84; +string(string s1, string s2, ...) mvdsv_strcat = #89; +string(string s1, string s2, ...) frik_strcat = #115; +float(string s) checkextension = #99; + +void () testfunct; + +// prozac Get UserID Function +float(entity client) getuid = #83; + +#ifdef clan_progs +// RANK FEATURES (FTE only) +float Ranks_Updated; // tells us if the global ranks have been updated already (once per map) +.string rank_name; // file name where stats are stored in -- thisw is assigned to the player's netname on join +.float global_rank; +.float global_frags; +.float global_fers; +.float global_dths; +.float global_caps; +void () Rank_UpdateStatsGlobal; + +// Rank stuff +void (entity rank_ent) Rank_FindStats; +void (entity rank_ent) Rank_UpdateStats; +void (entity rank_ent, float addscore) Rank_AddFrags; +void (entity rank_ent, float addscore) Rank_AddFers; +void (entity rank_ent, float addscore) Rank_AddDeaths; + +float num_players_ready; +float clan_prematch; +.float is_ready; +#endif +//moved from rankings.pqc: +string(string s) strzone = #118; +void(string s) strunzone = #119; + +float MSG_BROADCAST = 0; + +float oldconc; // toggle for using old (tf 2.9) style conc (localinfo/serverinfo oldconc 1 or on) + +#ifdef tf29ents +// TF 2.9 stuff +#define TFLAG_FIRSTENTRY 256 // Used to determine the first time toggleflags is set +#define TFLAG_CLASS_PERSIST 1 // Persistent Classes Bit +float flagem_checked; +#endif + +.float jet_time; // defines jetjump immune-to-pushback time (pushback from sentryguns) + +#define mtf_Ver "10.12.14" // insert MegaTF version here +#define mtf_Website "\shttps://github.com/quaketf\s" + +//strcat for combining two strings, strlen to getting the length of a string. +//substring Ex: substring("Abraham Lincoln", 1, 3) == "bra", stov = string to vector +//From FrikaC's file access tutorial +float(string s) strlen = #114; +string(string s1, string s2) strcat = #115; +string(string s, float start, float length) substring = #116; +vector(string s) stov = #117; + diff --git a/demoman.pqc b/demoman.pqc new file mode 100644 index 0000000..85acf32 --- /dev/null +++ b/demoman.pqc @@ -0,0 +1,498 @@ + +void () NormalGrenadeTouch; + +void () NormalGrenadeExplode; + +void () MirvGrenadeTouch; + +void () MirvGrenadeExplode; + +void (vector org, entity shooter) MirvGrenadeLaunch; + +void () TeamFortress_DetpackSet; + +void () TeamFortress_DetpackExplode; + +void () TeamFortress_DetpackTouch; + +void () TeamFortress_DetpackDisarm; + +void () TeamFortress_DetpackCountDown; + +void () TeamFortress_DetonatePipebombs = { + + local entity e; + + e = find (world,classname,"pipebomb"); + while (e != world) + { + if (e.owner == self) + { + e.nextthink = time; + } + e = find (e,classname,"pipebomb"); + } + +}; + +void () PipebombTouch = +{ + + sound (self, 1, "weapons/bounce.wav", 1, 1); + if ((self.velocity == '0 0 0')) + { + self.avelocity = '0 0 0'; + } +}; + +void () MirvGrenadeTouch = { + + sound (self,TF_FLARE_OFF,"weapons/bounce.wav",TF_FLARE_OFF,TF_FLARE_OFF); + if (self.velocity == '0 0 0') + { + self.avelocity = '0 0 0'; + } + +}; + +void () MirvGrenadeExplode = { + + local float i; + + deathmsg = 10; + T_RadiusDamage (self,self.owner,100,world); + WriteByte (4,23); + WriteByte (4,3); + WriteCoord (4,self.origin_x); + WriteCoord (4,self.origin_y); + WriteCoord (4,self.origin_z); + multicast (self.origin,TF_FLARE_OFF); + self.solid = TF_FLARE_LIT; + i = TF_FLARE_LIT; + while (i < 6) + { + MirvGrenadeLaunch ((self.origin + '0 0 -1'),self.owner); + i = (i + TF_FLARE_OFF); + } + BecomeExplosion (); + +}; + +void (vector org, entity shooter) MirvGrenadeLaunch = { + + local float xdir; + local float ydir; + local float zdir; + + xdir = ((150 * random ()) - 75); + ydir = ((150 * random ()) - 75); + zdir = (40 * random ()); + newmis = spawn (); + newmis.owner = shooter; + newmis.movetype = 10; + newmis.solid = 2; + newmis.classname = "grenade"; + newmis.weapon = 10; + newmis.touch = GrenadeTouch; + newmis.think = GrenadeExplode; + newmis.nextthink = ((time + 2) + random ()); + newmis.velocity_x = (xdir * 2); + newmis.velocity_y = (ydir * 2); + newmis.velocity_z = (zdir * 15); + newmis.avelocity = '250 300 400'; + setmodel (newmis,"progs/grenade2.mdl"); + setsize (newmis,'0 0 0','0 0 0'); + setorigin (newmis,org); + +}; +float(entity obj) DetpackCheckArea = +{ + //shitty wallarea check + //does not detect irregularly clipped/morphed walls + //although dets wont fall through against them + local vector src; + local float pos; + pos = pointcontents(obj.origin); + + if (pos == -2 || pos == -6) + { + return TF_FLARE_LIT; + } + + src_x = obj.origin_x + obj.maxs_x + 10; + src_y = obj.origin_y + obj.maxs_y + 10; + src_z = obj.origin_z + obj.maxs_z - 24; + pos = pointcontents(src); + if (pos == -2 || pos == -6) + { + return TF_FLARE_LIT; + } +/* junk + bprint (2,"second check\n"); + src_x = obj.origin_x + obj.maxs_x - 10; + src_y = obj.origin_y + obj.maxs_y - 10; + src_z = obj.origin_z + obj.maxs_z - 24; + pos = pointcontents(src); + st = ftos(pos); + bprint (2,st); + bprint(2,"\n"); + if (pos == -2 || pos == -6) + { + return TF_FLARE_LIT; + } +*/ + src_x = obj.origin_x + obj.mins_x - 10; + src_y = obj.origin_y + obj.mins_y + 0; + src_z = obj.origin_z + obj.mins_z + 24; + pos = pointcontents(src); + if (pos == -2 || pos == -6) + { + return TF_FLARE_LIT; + } + + src_x = obj.origin_x + obj.mins_x + 0; + src_y = obj.origin_y + obj.mins_y - 10; + src_z = obj.origin_z + obj.mins_z + 24; + pos = pointcontents(src); + if (pos == -2 || pos == -6) + { + return TF_FLARE_LIT; + } + + src_x = obj.origin_x + obj.mins_x + 10; + src_y = obj.origin_y + obj.mins_y - 10; + src_z = obj.origin_z + obj.mins_z + 24; + pos = pointcontents(src); + if (pos == -2 || pos == -6) + { + return TF_FLARE_LIT; + } + + src_x = obj.origin_x + obj.mins_x - 10; + src_y = obj.origin_y + obj.mins_y + 10; + src_z = obj.origin_z + obj.mins_z + 24; + pos = pointcontents(src); + + if (pos == -2 || pos == -6) + { + return TF_FLARE_LIT; + } + + return TF_FLARE_OFF; +}; + + +void (float _p_9515) TeamFortress_SetDetpack = +{ + local string _l_9516; + local entity _l_9517; + + self.impulse = 0; + self.last_impulse = 0; + if (!(self.weapons_carried & 131072)) + { + return; + } + if ((self.ammo_detpack <= 0)) + { + return; + } + if (!(self.flags & 512)) + { + sprint (self, 2, "You can't set detpacks in the air!\n"); + return; + } + if ((_p_9515 < 5)) + { + sprint (self, 2, "You can't set detpacks for less that 5 seconds.\n"); + return; + } + if ((DetpackCheckArea (self) == 0)) + { + sprint (self, 2, "You need more room to set a detpack.\n"); + return; + } + _l_9517 = find (world, classname, "detpack"); + while (_l_9517) + { + if ((_l_9517.owner == self)) + { + sprint (self, 2, "1 DetPack at a time!\n"); + return; + } + _l_9517 = find (_l_9517, classname, "detpack"); + } + TeamFortress_ThrowGrenade (); + self.is_detpacking = 1; + self.ammo_detpack = (self.ammo_detpack - 1); + self.immune_to_check = (time + 5); + self.tfstate = (self.tfstate | 65536); + self.weapon = self.current_weapon; + self.current_weapon = 0; + self.weaponmodel = ""; + self.weaponframe = 0; + TeamFortress_SetSpeed (self); + self.pausetime = (time + 4); + _l_9516 = ftos (_p_9515); + sprint (self, 2, "Setting detpack for "); + sprint (self, 2, _l_9516); + sprint (self, 2, " seconds...\n"); + sound (self, 2, "items/flare1.wav", 1, 1); + newmis = spawn (); + newmis.owner = self; + newmis.classname = "timer"; + newmis.netname = "detpack_timer"; + newmis.nextthink = (time + 4); + newmis.think = TeamFortress_DetpackSet; + newmis.health = _p_9515; +}; + +void () TeamFortress_DetpackStop = { + + local entity detpack_timer; + + detpack_timer = find (world,netname,"detpack_timer"); + while ((detpack_timer.owner != self) && (detpack_timer != world)) + { + detpack_timer = find (detpack_timer,netname,"detpack_timer"); + } + if (detpack_timer == world) + { + return ; + } + sprint (self,2,"Detpack retrieved.\n"); + self.ammo_detpack = (self.ammo_detpack + TF_FLARE_OFF); + dremove (detpack_timer); + self.tfstate = (self.tfstate - (self.tfstate & 65536)); + self.is_detpacking = TF_FLARE_LIT; + self.current_weapon = self.weapon; + W_SetCurrentAmmo (); + TeamFortress_SetSpeed (self); + self.pausetime = time; + +}; + +void () TeamFortress_DetpackSet = +{ + local entity _l_9532; + local entity _l_9533; + + self.is_detpacking = 0; + self.owner.tfstate = (self.owner.tfstate - (self.owner.tfstate & 65536)); + sound (self, 2, "weapons/throw.wav", 1, 1); + TeamFortress_SetSpeed (self.owner); + _l_9533 = self; + self = self.owner; + self.is_detpacking = 0; + self.current_weapon = self.weapon; + W_SetCurrentAmmo (); + self = _l_9533; + newmis = spawn (); + newmis.owner = self.owner; + newmis.origin = (self.owner.origin - '0 0 32'); + newmis.movetype = 10; + newmis.solid = 2; + newmis.classname = "detpack"; + newmis.flags = 256; + newmis.angles = '90 0 0'; + newmis.angles_y = self.owner.angles_y; + newmis.velocity = '0 0 0'; + newmis.avelocity = '0 30 0'; + newmis.weaponmode = 0; + newmis.touch = TeamFortress_DetpackTouch; + setmodel (newmis, "progs/detpack.mdl"); + setsize (newmis, '-16 -16 0', '16 16 4'); + setorigin (newmis, self.owner.origin); + _l_9532 = spawn (); + newmis.linked_list = _l_9532; + _l_9532.think = TeamFortress_DetpackCountDown; + _l_9532.health = (self.health - 1); + _l_9532.owner = self.owner; + _l_9532.classname = "countdown_timer"; + _l_9532.enemy = newmis; + newmis.oldenemy = _l_9532; + _l_9532.nextthink = (time + 1); + _l_9532.health = (self.health - 1); + newmis.nextthink = (time + self.health); + newmis.think = TeamFortress_DetpackExplode; + sprint (self.owner, 2, "Detpack set!\n"); + dremove (self); +}; + +void () TeamFortress_DetpackExplode = { + + local float pos; + + bprint (TF_FLARE_OFF,"FIRE IN THE HOLE!\n"); + sound (self,TF_FLARE_OFF,"weapons/detpack.wav",TF_FLARE_OFF,TF_FLARE_LIT); + pos = pointcontents (self.origin); + if ((pos != -2) && (pos != -6)) + { + deathmsg = 12; + T_RadiusDamage (self,self.owner,700,world); + WriteByte (4,23); + WriteByte (4,3); + WriteCoord (4,self.origin_x); + WriteCoord (4,self.origin_y); + WriteCoord (4,self.origin_z); + multicast (self.origin,TF_FLARE_OFF); + } + if (self.weaponmode == TF_FLARE_OFF) + { + TeamFortress_SetSpeed (self.enemy); + dremove (self.oldenemy); + dremove (self.observer_list); + } + BecomeExplosion (); + +}; + +void () TeamFortress_DetpackTouch = +{ + if (olddisarm != 1) { + if ((other.classname != "player")) + { + sound (self, 3, "zombie/z_hit.wav", 1, 1); + } + } + else { + local entity disarm; + + if (other.classname != "player") + { + sound (self,3,"zombie/z_hit.wav",TF_FLARE_OFF,TF_FLARE_OFF); + } + if (other.classname != "player") + { + return ; + } + if (other.playerclass != TF_FLARE_OFF) + { + return ; + } + if (self.weaponmode == TF_FLARE_OFF) + { + return ; + } + if ((other.team_no == self.owner.team_no) && (self.owner.team_no != TF_FLARE_LIT)) + { + return ; + } + other.immune_to_check = (time + 2); + other.tfstate = (other.tfstate | 65536); + sprint (other,2,"Disarming detpack...\n"); + TeamFortress_SetSpeed (other); + disarm = spawn (); + disarm.owner = other; + disarm.enemy = self; + disarm.classname = "timer"; + disarm.nextthink = (time + 3); + disarm.think = TeamFortress_DetpackDisarm; + self.weaponmode = TF_FLARE_OFF; + self.enemy = other; + self.observer_list = disarm; +} +}; +void () TeamFortress_DetpackDisarmTrigger = +{ + local entity _l_9571; + + if ((other.classname != "player")) + { + sound (self, 3, "zombie/z_hit.wav", 1, 1); + } + if ((other.classname != "player")) + { + return; + } + if ((other.playerclass != 1)) + { + return; + } + if ((self.weaponmode == 1)) + { + return; + } + if (((other.team_no == self.owner.team_no) && (self.owner.team_no != 0))) + { + return; + } + other.immune_to_check = (time + 2); + other.tfstate = (other.tfstate | 65536); + sprint (other, 2, "Disarming detpack...\n"); + TeamFortress_SetSpeed (other); + _l_9571 = spawn (); + _l_9571.owner = other; + _l_9571.enemy = self; + _l_9571.classname = "timer"; + _l_9571.nextthink = (time + 2); + _l_9571.think = TeamFortress_DetpackDisarm; + self.weaponmode = 1; + self.enemy = other; + self.observer_list = _l_9571; +}; + +void () TeamFortress_DetpackDisarm = +{ + + bprint (1, self.enemy.owner.netname); + bprint (1, "'s detpack was defused by "); + bprint (1, self.owner.netname); + bprint (1, "\n"); + self.owner.tfstate = (self.owner.tfstate - (self.owner.tfstate & 65536)); + TeamFortress_SetSpeed (self.owner); + logfrag (self.owner, self.enemy.owner); + self.owner.real_frags = (self.owner.real_frags + 1); + if (!(toggleflags & 128)) + { + self.owner.frags = self.owner.real_frags; + } + dremove (self.enemy.oldenemy); + dremove (self.enemy); + dremove (self); +}; + +void () TeamFortress_DetpackCountDown = +{ + local string _l_9580; + + if ((self.health < 10)) + { + _l_9580 = ftos (self.health); + if ((self.health > 0)) + { + sprint (self.owner, 2, _l_9580); + sprint (self.owner, 2, "...\n"); + } + if ((self.health <= 4)) + { + self.enemy.skin = 1; + sound (self, 0, "effects/beep.wav", 1, 1); + } + if ((self.health == 0)) + { + dremove (self); + } + } + self.nextthink = (time + 1); + self.health = (self.health - 1); + self.owner.StatusRefreshTime = (time + 0.200000); +}; + +void () DetpackDisarm = +{ + local entity _l_9597; + + _l_9597 = findradius (self.origin, 38); + while (_l_9597) + { + if ((_l_9597.classname == "detpack")) + { + other = self; + self = _l_9597; + TeamFortress_DetpackDisarmTrigger (); + self = other; + } + _l_9597 = _l_9597.chain; + } +}; diff --git a/dog.pqc b/dog.pqc new file mode 100644 index 0000000..0d7ace1 --- /dev/null +++ b/dog.pqc @@ -0,0 +1,658 @@ +void() dog_leap1; +void() dog_run1; +void() monster_dog_respawn; + +.vector oldangles; + +void() dog_bite = +{ + local vector delta; + local float ldmg; + ai_charge(10); + if (!CanDamage(self.enemy, self)) + { + return; + } + delta = self.enemy.origin - self.origin; + if (vlen(delta) > 100) + { + return; + } + if (self.enemy.team_no == self.team_no) + { + return; + } + if (random() < 0.2) + { + if (self.enemy.leg_damage < TF_FLARE_OFF && self.enemy.classname == "player") + { + self.enemy.leg_damage = TF_FLARE_OFF; + sprint(self.enemy, 2, "Your leg's been bitten!\n"); + TeamFortress_SetSpeed(self.enemy); + } + } + deathmsg = 42; + random(); + ldmg = (random() + random() + random()) * 16; + T_Damage(self.enemy, self, self, ldmg); +}; + +void() Dog_JumpTouch = +{ + local float ldmg; + if (self.health <= TF_FLARE_LIT) + { + return; + } + if (other.team_no == self.team_no) + { + return; + } + if (other.classname == "bot" && self.playerclass == other.playerclass) + { + return; + } + if (other.takedamage) + { + if (vlen(self.velocity) > 300) + { + sound(self, 2, "shambler/smack.wav", 0.7, TF_FLARE_OFF); + deathmsg = 42; + ldmg = (10 + 10 * random()) * 2; + T_Damage(other, self, self, ldmg); + } + } + if (!checkbottom(self)) + { + if (self.flags & 512) + { + self.touch = SUB_Null; + self.think = dog_leap1; + self.nextthink = time + 0.1; + } + return; + } + self.touch = SUB_Null; + self.think = dog_run1; + self.nextthink = time + 0.1; +}; + +void() dog_stand1 = [69, dog_stand2] +{ + ai_stand(); +}; + +void() dog_stand2 = [70, dog_stand3] +{ + ai_stand(); +}; + +void() dog_stand3 = [71, dog_stand4] +{ + ai_stand(); +}; + +void() dog_stand4 = [72, dog_stand5] +{ + ai_stand(); +}; + +void() dog_stand5 = [73, dog_stand6] +{ + ai_stand(); +}; + +void() dog_stand6 = [74, dog_stand7] +{ + ai_stand(); +}; + +void() dog_stand7 = [75, dog_stand8] +{ + ai_stand(); +}; + +void() dog_stand8 = [76, dog_stand9] +{ + ai_stand(); +}; + +void() dog_stand9 = [77, dog_stand1] +{ + ai_stand(); +}; + +void() dog_walk1 = [78, dog_walk2] +{ + if (random() < 0.2) + { + sound(self, 2, "dog/idle.wav", TF_FLARE_OFF, 2); + } + else + { + if (random() < 0.25) + { + sound(self, 2, "demon/idle1.wav", TF_FLARE_OFF, 2); + } + } + ai_walk(8); +}; + +void() dog_walk2 = [79, dog_walk3] +{ + ai_walk(8); +}; + +void() dog_walk3 = [80, dog_walk4] +{ + ai_walk(8); +}; + +void() dog_walk4 = [81, dog_walk5] +{ + ai_walk(8); +}; + +void() dog_walk5 = [82, dog_walk6] +{ + ai_walk(8); +}; + +void() dog_walk6 = [83, dog_walk7] +{ + ai_walk(8); +}; + +void() dog_walk7 = [84, dog_walk8] +{ + ai_walk(8); +}; + +void() dog_walk8 = [85, dog_walk1] +{ + ai_walk(8); +}; + +void() dog_run1 = [48, dog_run2] +{ + if (random() < 0.2) + { + sound(self, 2, "dog/idle.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (random() < 0.25) + { + sound(self, 2, "demon/idle1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (random() < 0.5) + { + sound(self, 2, "dog/dsight.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + } + } + ai_run(16); +}; + +void() dog_run2 = [49, dog_run3] +{ + ai_run(32); +}; + +void() dog_run3 = [50, dog_run4] +{ + ai_run(32); +}; + +void() dog_run4 = [51, dog_run5] +{ + ai_run(20); +}; + +void() dog_run5 = [52, dog_run6] +{ + ai_run(64); +}; + +void() dog_run6 = [53, dog_run7] +{ + ai_run(32); +}; + +void() dog_run7 = [54, dog_run8] +{ + ai_run(16); +}; + +void() dog_run8 = [55, dog_run9] +{ + ai_run(32); +}; + +void() dog_run9 = [56, dog_run10] +{ + ai_run(32); +}; + +void() dog_run10 = [57, dog_run11] +{ + ai_run(20); +}; + +void() dog_run11 = [58, dog_run12] +{ + ai_run(64); +}; + +void() dog_run12 = [59, dog_run1] +{ + ai_run(32); +}; + +void() dog_atta1 = [0, dog_atta2] +{ + ai_charge(10); +}; + +void() dog_atta2 = [1, dog_atta3] +{ + ai_charge(10); +}; + +void() dog_atta3 = [2, dog_atta4] +{ + ai_charge(10); +}; + +void() dog_atta4 = [3, dog_atta5] +{ + if (random() < 0.8) + { + sound(self, 2, "dog/dattack1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (random() < 0.25) + { + sound(self, 2, "demon/sight2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + } + dog_bite(); +}; + +void() dog_atta5 = [4, dog_atta6] +{ + ai_charge(10); +}; + +void() dog_atta6 = [5, dog_atta7] +{ + ai_charge(10); +}; + +void() dog_atta7 = [6, dog_atta8] +{ + ai_charge(10); +}; + +void() dog_atta8 = [7, dog_run1] +{ + ai_charge(10); +}; + +void() dog_leap1 = [60, dog_leap2] +{ + ai_face(); +}; + +void() dog_leap2 = [61, dog_leap3] +{ + ai_face(); + self.touch = Dog_JumpTouch; + makevectors(self.angles); + self.origin_z = self.origin_z + TF_FLARE_OFF; + self.velocity = v_forward * 300 + '0 0 200'; + if (self.flags & 512) + { + self.flags = self.flags - 512; + } +}; + +void() dog_leap3 = [62, dog_leap4] +{ +}; + +void() dog_leap4 = [63, dog_leap5] +{ +}; + +void() dog_leap5 = [64, dog_leap6] +{ +}; + +void() dog_leap6 = [65, dog_leap7] +{ +}; + +void() dog_leap7 = [66, dog_leap8] +{ +}; + +void() dog_leap8 = [67, dog_leap9] +{ +}; + +void() dog_leap9 = [68, dog_leap9] +{ +}; + +void() dog_pain1 = [26, dog_pain2] +{ +}; + +void() dog_pain2 = [27, dog_pain3] +{ +}; + +void() dog_pain3 = [28, dog_pain4] +{ +}; + +void() dog_pain4 = [29, dog_pain5] +{ +}; + +void() dog_pain5 = [30, dog_pain6] +{ +}; + +void() dog_pain6 = [31, dog_run1] +{ +}; + +void() dog_painb1 = [32, dog_painb2] +{ +}; + +void() dog_painb2 = [33, dog_painb3] +{ +}; + +void() dog_painb3 = [34, dog_painb4] +{ + ai_pain(4); +}; + +void() dog_painb4 = [35, dog_painb5] +{ + ai_pain(12); +}; + +void() dog_painb5 = [36, dog_painb6] +{ + ai_pain(12); +}; + +void() dog_painb6 = [37, dog_painb7] +{ + ai_pain(2); +}; + +void() dog_painb7 = [38, dog_painb8] +{ +}; + +void() dog_painb8 = [39, dog_painb9] +{ + ai_pain(4); +}; + +void() dog_painb9 = [40, dog_painb10] +{ +}; + +void() dog_painb10 = [41, dog_painb11] +{ + ai_pain(10); +}; + +void() dog_painb11 = [42, dog_painb12] +{ +}; + +void() dog_painb12 = [43, dog_painb13] +{ +}; + +void() dog_painb13 = [44, dog_painb14] +{ +}; + +void() dog_painb14 = [45, dog_painb15] +{ +}; + +void() dog_painb15 = [46, dog_painb16] +{ +}; + +void() dog_painb16 = [47, dog_run1] +{ +}; + +void() dog_pain = +{ + sound(self, 2, "dog/dpain1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + if (random() > 0.5) + { + dog_pain1(); + } + else + { + dog_painb1(); + } +}; + +void() dog_die1 = [8, dog_die2] +{ +}; + +void() dog_die2 = [9, dog_die3] +{ +}; + +void() dog_die3 = [10, dog_die4] +{ +}; + +void() dog_die4 = [11, dog_die5] +{ +}; + +void() dog_die5 = [12, dog_die6] +{ +}; + +void() dog_die6 = [13, dog_die7] +{ +}; + +void() dog_die7 = [14, dog_die8] +{ +}; + +void() dog_die8 = [15, dog_die9] +{ +}; + +void() dog_die9 = [16, dog_die9] +{ +}; + +void() dog_dieb1 = [17, dog_dieb2] +{ +}; + +void() dog_dieb2 = [18, dog_dieb3] +{ +}; + +void() dog_dieb3 = [19, dog_dieb4] +{ +}; + +void() dog_dieb4 = [20, dog_dieb5] +{ +}; + +void() dog_dieb5 = [21, dog_dieb6] +{ +}; + +void() dog_dieb6 = [22, dog_dieb7] +{ +}; + +void() dog_dieb7 = [23, dog_dieb8] +{ +}; + +void() dog_dieb8 = [24, dog_dieb9] +{ +}; + +void() dog_dieb9 = [25, dog_dieb9] +{ +}; + +void() dog_die = +{ + sound(self, 2, "dog/ddeath.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.solid = TF_FLARE_LIT; + if (random() > 0.5) + { + dog_die1(); + } + else + { + dog_dieb1(); + } + monster_dog_respawn(); +}; + +float() CheckDogMelee = +{ + if (enemy_range == TF_FLARE_LIT) + { + self.attack_state = 3; + return TF_FLARE_OFF; + } + return TF_FLARE_LIT; +}; + +float() CheckDogJump = +{ + local vector dist; + local float d; + if (self.origin_z + self.mins_z > self.enemy.origin_z + self.enemy.mins_z + 0.75 * self.enemy.size_z) + { + return TF_FLARE_LIT; + } + if (self.origin_z + self.maxs_z < self.enemy.origin_z + self.enemy.mins_z + 0.25 * self.enemy.size_z) + { + return TF_FLARE_LIT; + } + dist = self.enemy.origin - self.origin; + dist_z = TF_FLARE_LIT; + d = vlen(dist); + if (d < 80) + { + return TF_FLARE_LIT; + } + if (d > 150) + { + return TF_FLARE_LIT; + } + return TF_FLARE_OFF; +}; + +float() DogCheckAttack = +{ + if (CheckDogMelee()) + { + self.attack_state = 3; + return TF_FLARE_OFF; + } + if (CheckDogJump()) + { + self.attack_state = 4; + return TF_FLARE_OFF; + } + return TF_FLARE_LIT; +}; + +void() monster_dog = +{ + precache_model("progs/h_dog.mdl"); + precache_model("progs/dog.mdl"); + precache_sound("dog/dattack1.wav"); + precache_sound("dog/ddeath.wav"); + precache_sound("dog/dpain1.wav"); + precache_sound("dog/dsight.wav"); + precache_sound("dog/idle.wav"); + precache_sound("demon/sight2.wav"); + precache_sound("demon/idle1.wav"); + self.classname = "bot"; + self.solid = 3; + self.movetype = 6; + setmodel(self, "progs/dog.mdl"); + setsize(self, '-32 -32 -24', '32 32 10'); + self.health = 200; + self.oldorigin = self.origin; + self.oldangles = self.angles; + self.th_stand = dog_stand1; + self.th_walk = dog_walk1; + self.th_run = dog_run1; + self.th_pain = dog_pain; + self.th_die = dog_die; + self.th_melee = dog_atta1; + self.th_missile = dog_leap1; + self.think = walkmonster_start; + self.nextthink = time + 3; +}; + +void() respawn_dog = +{ + self = self.owner; + self.origin = self.oldorigin; + spawn_tfog(self.origin); + spawn_tdeath(self.origin, self); + setorigin(self, self.origin); + self.solid = 3; + self.movetype = 6; + self.takedamage = 2; + setmodel(self, "progs/dog.mdl"); + setsize(self, '-32 -32 -24', '32 32 10'); + self.health = 200; + self.oldorigin = self.origin; + self.angles = self.oldangles; + self.classname = "bot"; + self.target = string_null; + self.enemy = world; + HuntTarget(); + dremove(self.owner); + droptofloor(); +}; + +void() monster_dog_respawn = +{ + local entity resp; + resp = spawn(); + self.owner = resp; + resp.owner = self; + resp.think = respawn_dog; + resp.nextthink = time + 30 + random() * 20; +}; + diff --git a/doors.pqc b/doors.pqc new file mode 100644 index 0000000..57a9b60 --- /dev/null +++ b/doors.pqc @@ -0,0 +1,776 @@ +void() door_go_down; +void() door_go_up; +float() DoorShouldOpen; + +void() fd_secret_move1; +void() fd_secret_move2; +void() fd_secret_move3; +void() fd_secret_move4; +void() fd_secret_move5; +void() fd_secret_move6; +void() fd_secret_done; + +//.vector orig_origin; //in defs.pqc + +void() door_blocked = +{ + T_Damage(other, self, self, self.dmg); + if (self.wait >= TF_FLARE_LIT) + { + if (self.state == 3) + { + door_go_up(); + } + else + { + door_go_down(); + } + } +}; + +void() door_hit_top = +{ + sound(self, 2, self.noise1, TF_FLARE_OFF, TF_FLARE_OFF); + self.state = TF_FLARE_LIT; + if (self.spawnflags & 32) + { + return; + } + self.think = door_go_down; + self.nextthink = self.ltime + self.wait; +}; + +void() door_hit_bottom = +{ + self.goal_state = 2; + sound(self, 2, self.noise1, TF_FLARE_OFF, TF_FLARE_OFF); + self.state = TF_FLARE_OFF; +}; + +void() door_go_down = +{ + sound(self, 2, self.noise2, TF_FLARE_OFF, TF_FLARE_OFF); + if (self.max_health) + { + self.takedamage = TF_FLARE_OFF; + self.health = self.max_health; + } + self.state = 3; + SUB_CalcMove(self.pos1, self.speed, door_hit_bottom); +}; + +void() door_go_up = +{ + if (self.state == 2) + { + return; + } + if (self.state == TF_FLARE_LIT) + { + self.nextthink = self.ltime + self.wait; + return; + } + sound(self, 2, self.noise2, TF_FLARE_OFF, TF_FLARE_OFF); + self.state = 2; + SUB_CalcMove(self.pos2, self.speed, door_hit_top); + SUB_UseTargets(); +}; + +void() door_fire = +{ + local entity oself; + local entity starte; + if (self.owner != self) + { + objerror("door_fire: self.owner != self"); + } + if (self.items) + { + sound(self, 2, self.noise4, TF_FLARE_OFF, TF_FLARE_OFF); + } + self.message = string_null; + oself = self; + if (self.spawnflags & 32) + { + if (self.state == 2 || self.state == TF_FLARE_LIT) + { + starte = self; + do + { + door_go_down(); + self = self.enemy; + } while (self != starte && self != world); + self = oself; + return; + } + } + starte = self; + do + { + door_go_up(); + self = self.enemy; + } while (self != starte && self != world); + self = oself; +}; + +void() door_use = +{ + local entity oself; + self.message = ""; + self.owner.message = ""; + self.enemy.message = ""; + oself = self; + self = self.owner; + door_fire(); + self = oself; +}; + +void() door_trigger_touch = +{ + local entity te; + if (other.health <= TF_FLARE_LIT) + { + return; + } + if (!Activated(self, other)) + { + if (self.else_goal != TF_FLARE_LIT) + { + te = Findgoal(self.else_goal); + if (te) + { + DoResults(te, other, self.goal_result & 2); + } + } + return; + } + if (time < self.attack_finished) + { + return; + } + self.attack_finished = time + TF_FLARE_OFF; + activator = other; + self = self.owner; + door_use(); +}; + +void() door_killed = +{ + local entity oself; + oself = self; + self = self.owner; + self.health = self.max_health; + self.takedamage = TF_FLARE_LIT; + door_use(); + self = oself; +}; + +void() door_touch = +{ + local entity te; + if (other.classname != "player") + { + return; + } + if (self.owner.attack_finished > time) + { + return; + } + if (!Activated(self, other)) + { + if (self.else_goal != TF_FLARE_LIT) + { + te = Findgoal(self.else_goal); + if (te) + { + DoResults(te, other, self.goal_result & 2); + } + } + return; + } + self.owner.attack_finished = time + 2; + if (self.owner.message != "") + { + CenterPrint(other, self.owner.message); + sound(other, 2, "misc/talk.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + if (!(self.items)) + { + return; + } + if ((self.items & other.items) != self.items) + { + if (self.owner.items == 131072) + { + if (world.worldtype == 2) + { + CenterPrint(other, "You need the silver keycard"); + sound(self, 2, self.noise3, TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (world.worldtype == TF_FLARE_OFF) + { + CenterPrint(other, "You need the silver runekey"); + sound(self, 2, self.noise3, TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (world.worldtype == TF_FLARE_LIT) + { + CenterPrint(other, "You need the silver key"); + sound(self, 2, self.noise3, TF_FLARE_OFF, TF_FLARE_OFF); + } + } + } + } + else + { + if (world.worldtype == 2) + { + CenterPrint(other, "You need the gold keycard\n"); + sound(self, 2, self.noise3, TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (world.worldtype == TF_FLARE_OFF) + { + CenterPrint(other, "You need the gold runekey"); + sound(self, 2, self.noise3, TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (world.worldtype == TF_FLARE_LIT) + { + CenterPrint(other, "You need the gold key"); + sound(self, 2, self.noise3, TF_FLARE_OFF, TF_FLARE_OFF); + } + } + } + } + return; + } + other.items = other.items - self.items; + other.tf_items = other.tf_items | self.items; + if (DoorShouldOpen()) + { + self.touch = SUB_Null; + if (self.enemy) + { + self.enemy.touch = SUB_Null; + } + door_use(); + } +}; + +entity(vector fmins, vector fmaxs) spawn_field = +{ + local entity trigger; + local vector t1; + local vector t2; + trigger = spawn(); + trigger.movetype = TF_FLARE_LIT; + trigger.solid = TF_FLARE_OFF; + trigger.owner = self; + trigger.touch = door_trigger_touch; + trigger.team_no = self.team_no; + trigger.playerclass = self.playerclass; + trigger.items_allowed = self.items_allowed; + trigger.activate_goal_no = self.activate_goal_no; + trigger.inactivate_goal_no = self.inactivate_goal_no; + trigger.remove_goal_no = self.remove_goal_no; + trigger.restore_goal_no = self.restore_goal_no; + trigger.activate_group_no = self.activate_group_no; + trigger.inactivate_group_no = self.inactivate_group_no; + trigger.remove_group_no = self.remove_group_no; + trigger.restore_group_no = self.restore_group_no; + trigger.goal_activation = self.goal_activation; + trigger.goal_effects = self.goal_effects; + trigger.goal_result = self.goal_result; + trigger.goal_group = self.goal_group; + t1 = fmins; + t2 = fmaxs; + setsize(trigger, t1 - '60 60 8', t2 + '60 60 8'); + return trigger; +}; + +float(entity e1, entity e2) EntitiesTouching = +{ + if (e1.mins_x > e2.maxs_x) + { + return TF_FLARE_LIT; + } + if (e1.mins_y > e2.maxs_y) + { + return TF_FLARE_LIT; + } + if (e1.mins_z > e2.maxs_z) + { + return TF_FLARE_LIT; + } + if (e1.maxs_x < e2.mins_x) + { + return TF_FLARE_LIT; + } + if (e1.maxs_y < e2.mins_y) + { + return TF_FLARE_LIT; + } + if (e1.maxs_z < e2.mins_z) + { + return TF_FLARE_LIT; + } + return TF_FLARE_OFF; +}; + +void() LinkDoors = +{ + local entity t; + local entity starte; + local vector cmins; + local vector cmaxs; + if (self.enemy) + { + return; + } + if (self.spawnflags & 4) + { + self.enemy = self; + self.owner = self; + return; + } + cmins = self.mins; + cmaxs = self.maxs; + starte = self; + t = self; + do + { + self.owner = starte; + if (self.health) + { + starte.health = self.health; + } + if (self.targetname) + { + starte.targetname = self.targetname; + } + if (self.message != "") + { + starte.message = self.message; + } + t = find(t, classname, self.classname); + if (!t) + { + self.enemy = starte; + self = self.owner; + if (self.health) + { + return; + } + if (self.targetname) + { + return; + } + if (self.items) + { + return; + } + self.owner.trigger_field = spawn_field(cmins, cmaxs); + return; + } + if (EntitiesTouching(self, t)) + { + if (t.enemy) + { + objerror("cross connected doors"); + } + self.enemy = t; + self = t; + if (t.mins_x < cmins_x) + { + cmins_x = t.mins_x; + } + if (t.mins_y < cmins_y) + { + cmins_y = t.mins_y; + } + if (t.mins_z < cmins_z) + { + cmins_z = t.mins_z; + } + if (t.maxs_x > cmaxs_x) + { + cmaxs_x = t.maxs_x; + } + if (t.maxs_y > cmaxs_y) + { + cmaxs_y = t.maxs_y; + } + if (t.maxs_z > cmaxs_z) + { + cmaxs_z = t.maxs_z; + } + } + } while (TF_FLARE_OFF); +}; + +void() func_door = +{ + self.orig_origin = self.origin; + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (world.worldtype == TF_FLARE_LIT) + { + precache_sound("doors/medtry.wav"); + precache_sound("doors/meduse.wav"); + self.noise3 = "doors/medtry.wav"; + self.noise4 = "doors/meduse.wav"; + } + else + { + if (world.worldtype == TF_FLARE_OFF) + { + precache_sound("doors/runetry.wav"); + precache_sound("doors/runeuse.wav"); + self.noise3 = "doors/runetry.wav"; + self.noise4 = "doors/runeuse.wav"; + } + else + { + if (world.worldtype == 2) + { + precache_sound("doors/basetry.wav"); + precache_sound("doors/baseuse.wav"); + self.noise3 = "doors/basetry.wav"; + self.noise4 = "doors/baseuse.wav"; + } + else + { + dprint("no worldtype set!\n"); + } + } + } + if (self.sounds == TF_FLARE_LIT) + { + precache_sound("misc/null.wav"); + precache_sound("misc/null.wav"); + self.noise1 = "misc/null.wav"; + self.noise2 = "misc/null.wav"; + } + if (self.sounds == TF_FLARE_OFF) + { + precache_sound("doors/drclos4.wav"); + precache_sound("doors/doormv1.wav"); + self.noise1 = "doors/drclos4.wav"; + self.noise2 = "doors/doormv1.wav"; + } + if (self.sounds == 2) + { + precache_sound("doors/hydro1.wav"); + precache_sound("doors/hydro2.wav"); + self.noise2 = "doors/hydro1.wav"; + self.noise1 = "doors/hydro2.wav"; + } + if (self.sounds == 3) + { + precache_sound("doors/stndr1.wav"); + precache_sound("doors/stndr2.wav"); + self.noise2 = "doors/stndr1.wav"; + self.noise1 = "doors/stndr2.wav"; + } + if (self.sounds == 4) + { + precache_sound("doors/ddoor1.wav"); + precache_sound("doors/ddoor2.wav"); + self.noise1 = "doors/ddoor2.wav"; + self.noise2 = "doors/ddoor1.wav"; + } + if (self.armorclass == TF_FLARE_OFF) + { + precache_sound("doors/creekdr1.wav"); + precache_sound("doors/creekdr2.wav"); + self.noise2 = "doors/creekdr1.wav"; + self.noise1 = "doors/creekdr2.wav"; + } + if (self.armorclass == 2) + { + precache_sound("doors/metaldr1.wav"); + precache_sound("doors/metaldr2.wav"); + self.noise2 = "doors/metaldr1.wav"; + self.noise1 = "doors/metaldr2.wav"; + } + if (self.armorclass == 3) + { + precache_sound("doors/electdr1.wav"); + precache_sound("doors/electdr2.wav"); + self.noise2 = "doors/electdr1.wav"; + self.noise1 = "doors/electdr2.wav"; + } + if (self.armorclass == 4) + { + precache_sound("doors/track_st.wav"); + precache_sound("doors/track_e.wav"); + self.noise2 = "doors/track_st.wav"; + self.noise1 = "doors/track_e.wav"; + } + SetMovedir(); + self.max_health = self.health; + self.solid = 4; + self.movetype = 7; + setorigin(self, self.origin); + setmodel(self, self.model); + self.classname = "door"; + self.blocked = door_blocked; + self.use = door_use; + if (self.spawnflags & 16) + { + self.items = 131072; + } + if (self.spawnflags & 8) + { + self.items = 262144; + } + if (!(self.speed)) + { + self.speed = 100; + } + if (!(self.wait)) + { + self.wait = 3; + } + if (!(self.lip)) + { + self.lip = 8; + } + if (!(self.dmg)) + { + self.dmg = 2; + } + self.pos1 = self.origin; + self.pos2 = self.pos1 + self.movedir * (fabs(self.movedir * self.size) - self.lip); + if (self.spawnflags & TF_FLARE_OFF) + { + setorigin(self, self.pos2); + self.pos2 = self.pos1; + self.pos1 = self.origin; + } + self.state = TF_FLARE_OFF; + if (self.health) + { + self.takedamage = TF_FLARE_OFF; + self.th_die = door_killed; + } + if (self.items) + { + self.wait = -1; + } + self.touch = door_touch; + self.think = LinkDoors; + self.nextthink = self.ltime + 0.1; +}; + +void() fd_secret_use = +{ + local float temp; + self.health = 10000; + if (self.origin != self.oldorigin) + { + return; + } + if (self.spawnflags & 32) + { + return; + } + self.message = string_null; + SUB_UseTargets(); + if (!(self.spawnflags & 8)) + { + self.th_pain = SUB_Null; + self.takedamage = TF_FLARE_LIT; + } + self.velocity = '0 0 0'; + sound(self, 2, self.noise1, TF_FLARE_OFF, TF_FLARE_OFF); + self.nextthink = self.ltime + 0.1; + temp = TF_FLARE_OFF - (self.spawnflags & 2); + makevectors(self.mangle); + if (!(self.t_width)) + { + if (self.spawnflags & 4) + { + self.t_width = fabs(v_up * self.size); + } + else + { + self.t_width = fabs(v_right * self.size); + } + } + if (!(self.t_length)) + { + self.t_length = fabs(v_forward * self.size); + } + if (self.spawnflags & 4) + { + self.dest1 = self.origin - v_up * self.t_width; + } + else + { + self.dest1 = self.origin + v_right * (self.t_width * temp); + } + self.dest2 = self.dest1 + v_forward * self.t_length; + SUB_CalcMove(self.dest1, self.speed, fd_secret_move1); + sound(self, 2, self.noise2, TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void() fd_secret_move1 = +{ + self.nextthink = self.ltime + TF_FLARE_OFF; + self.think = fd_secret_move2; + sound(self, 2, self.noise3, TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void() fd_secret_move2 = +{ + sound(self, 2, self.noise2, TF_FLARE_OFF, TF_FLARE_OFF); + SUB_CalcMove(self.dest2, self.speed, fd_secret_move3); +}; + +void() fd_secret_move3 = +{ + sound(self, 2, self.noise3, TF_FLARE_OFF, TF_FLARE_OFF); + if (!(self.spawnflags & TF_FLARE_OFF)) + { + self.nextthink = self.ltime + self.wait; + self.think = fd_secret_move4; + } +}; + +void() fd_secret_move4 = +{ + sound(self, 2, self.noise2, TF_FLARE_OFF, TF_FLARE_OFF); + SUB_CalcMove(self.dest1, self.speed, fd_secret_move5); +}; + +void() fd_secret_move5 = +{ + self.nextthink = self.ltime + TF_FLARE_OFF; + self.think = fd_secret_move6; + sound(self, 2, self.noise3, TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void() fd_secret_move6 = +{ + sound(self, 2, self.noise2, TF_FLARE_OFF, TF_FLARE_OFF); + SUB_CalcMove(self.oldorigin, self.speed, fd_secret_done); +}; + +void() fd_secret_done = +{ + if (!(self.targetname) || (self.spawnflags & 16)) + { + self.health = 10000; + self.takedamage = TF_FLARE_OFF; + self.th_pain = fd_secret_use; + self.th_die = fd_secret_use; + } + sound(self, 2, self.noise3, TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void() secret_blocked = +{ + if (time < self.attack_finished) + { + return; + } + self.attack_finished = time + 0.5; + T_Damage(other, self, self, self.dmg); +}; + +void() secret_touch = +{ + if (other.classname != "player") + { + return; + } + if (self.attack_finished > time) + { + return; + } + if (self.spawnflags & 32) + { + return; + } + self.attack_finished = time + 2; + if (self.message) + { + CenterPrint(other, self.message); + sound(other, 4, "misc/talk.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } +}; + +void() func_door_secret = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (self.sounds == TF_FLARE_LIT) + { + self.sounds = 3; + } + if (self.sounds == TF_FLARE_OFF) + { + precache_sound("doors/latch2.wav"); + precache_sound("doors/winch2.wav"); + precache_sound("doors/drclos4.wav"); + self.noise1 = "doors/latch2.wav"; + self.noise2 = "doors/winch2.wav"; + self.noise3 = "doors/drclos4.wav"; + } + if (self.sounds == 2) + { + precache_sound("doors/airdoor1.wav"); + precache_sound("doors/airdoor2.wav"); + self.noise2 = "doors/airdoor1.wav"; + self.noise1 = "doors/airdoor2.wav"; + self.noise3 = "doors/airdoor2.wav"; + } + if (self.sounds == 3) + { + precache_sound("doors/basesec1.wav"); + precache_sound("doors/basesec2.wav"); + self.noise2 = "doors/basesec1.wav"; + self.noise1 = "doors/basesec2.wav"; + self.noise3 = "doors/basesec2.wav"; + } + if (!(self.dmg)) + { + self.dmg = 2; + } + self.mangle = self.angles; + self.angles = '0 0 0'; + self.solid = 4; + self.movetype = 7; + self.classname = "door"; + setmodel(self, self.model); + setorigin(self, self.origin); + self.touch = secret_touch; + self.blocked = secret_blocked; + self.speed = 50; + self.use = fd_secret_use; + if (!(self.targetname) || (self.spawnflags & 16)) + { + self.health = 10000; + self.takedamage = TF_FLARE_OFF; + self.th_pain = fd_secret_use; + } + self.oldorigin = self.origin; + if (!(self.wait)) + { + self.wait = 5; + } +}; + diff --git a/engineer.pqc b/engineer.pqc new file mode 100644 index 0000000..29ee766 --- /dev/null +++ b/engineer.pqc @@ -0,0 +1,832 @@ +void () LaserBolt_Touch; +void () EMPGrenadeTouch; +void () EMPGrenadeExplode; +void () TeamFortress_FinishedBuilding; +//void () T_Mortar; +void () Dispenser_Die; +void () CheckDistance; +float (entity obj, entity builder) CheckArea; +/*void () TeamFortress_SpawnDrone; +void () DroneDodge; +void () DroneTarget; +void () DroneFire; +void () DroneDie; +float (float aNum) roughRoot; +void () RailTimer;*/ + +void () LaserBolt_Think = +{ + + self.solid = 1; + self.movetype = 9; + self.velocity = self.oldorigin; + self.touch = LaserBolt_Touch; + self.avelocity = '0 0 500'; + setmodel (self, "progs/beam.mdl"); + self.effects = 8; + self.skin = (self.owner.team_no - 1); + self.nextthink = (time + 1); + self.think = SUB_Remove; +}; + +void () LaserBolt_Touch = +{ + local vector org; + + if ((other == self.owner)) + { + return; + } + if (((other == self.enemy) && (self.enemy != world))) + { + return; + } + if ((pointcontents (self.origin) == -6)) + { + dremove (self); + return; + } + org = self.origin - (8 * normalize (self.velocity)); + if (other.health) + { + SpawnBlood (org, 15); + deathmsg = 26; + TF_T_Damage (other, self, self.enemy, 30, 0, 8); + self.velocity = self.oldorigin; + self.owner = other; + setmodel (self, string_null); + self.touch = SUB_Null; + self.solid = 0; + self.movetype = 8; + self.nextthink = (time + 0.100000); + self.think = LaserBolt_Think; + return; + } + else + { + sound (self, 1, "enforcer/enfstop.wav", 1, 1); + WriteByte (4, 23); + WriteByte (4, 11); + WriteCoord (4, self.origin_x); + WriteCoord (4, self.origin_y); + WriteCoord (4, self.origin_z); + multicast (self.origin, 1); + } + dremove (self); +}; + +void () W_FireLaser = +{ + local vector vec; + local vector org; + + self.ammo_nails = (self.ammo_nails - 1); + self.currentammo = (self.ammo_nails - 1); + makevectors (self.v_angle); + org = self.origin + (v_forward * 8); + vec = aim (self, 10000); + vec = normalize (vec); + newmis = spawn (); + newmis.owner = self; + newmis.enemy = self; + newmis.team_no = self.team_no; + newmis.movetype = 9; + newmis.solid = 1; + newmis.avelocity = '0 0 500'; + setmodel (newmis, "progs/beam.mdl"); + if (infokey(world, "railcolors") == "on" || infokey(world, "railcolors") == "1" || infokey(world, "railcolors") == "" || (coloredlights)) + { + if ((newmis.team_no == 1)) + { + newmis.effects = 64; + } + else + { + if ((newmis.team_no == 2)) + { + newmis.effects = 128; + } + else + { + newmis.effects = 2; + } + } + } + else + { + newmis.effects = 2; + } + newmis.skin = (self.team_no - 1); + setsize (newmis, '0 0 0', '0 0 0'); + setorigin (newmis, (org + '0 0 16')); + newmis.velocity = (vec * 1500); + newmis.angles = vectoangles (newmis.velocity); + newmis.angles_y = (newmis.angles_y + 0.100000); + newmis.oldorigin = newmis.velocity; + newmis.nextthink = (time + 5); + newmis.think = SUB_Remove; + newmis.touch = LaserBolt_Touch; +}; + +void() EMPExplode = +{ + local float expsize; + expsize = 10; + if (self.touch == weapon_touch) + { + expsize = 60; + } + else + { + if (self.classname == "item_shells") + { + expsize = 50 + self.aflag; + } + else + { + if (self.classname == "item_spikes") + { + expsize = 40; + } + else + { + if (self.classname == "item_rockets") + { + expsize = 100 + self.aflag * 4; + } + else + { + if (self.classname == "item_cells") + { + expsize = 100 + self.aflag * 3; + } + else + { + if (self.classname == "item_weapon") + { + expsize = 60; + } + else + { + dprint("EMPExplode: Attempting to explode a "); + dprint(self.classname); + dprint("\n"); + return; + } + } + } + } + } + } + deathmsg = 31; + T_RadiusDamage(self, self.enemy, expsize, world); + WriteByte(4, 23); + WriteByte(4, 3); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, TF_FLARE_OFF); + Respawn_Item(self, self.enemy); +}; + +void() EMPGrenadeTouch = +{ + sound(self, TF_FLARE_OFF, "weapons/bounce.wav", TF_FLARE_OFF, TF_FLARE_OFF); + if (self.velocity == '0 0 0') + { + self.avelocity = '0 0 0'; + } +}; + +void() EMPGrenadeExplode = +{ + local float expsize; + local entity te; + local entity oldself; + WriteByte(4, 23); + WriteByte(4, 4); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, TF_FLARE_OFF); + te = findradius(self.origin, 240); + while (te) + { + if (te.touch == ammo_touch || te.touch == weapon_touch) + { + te.solid = TF_FLARE_LIT; + te.enemy = self.owner; + te.nextthink = time + TF_FLARE_OFF + random() * 2; + te.think = EMPExplode; + } + else + { + if (te.think == TeamFortress_DetpackExplode) + { + te.solid = TF_FLARE_LIT; + te.nextthink = time + TF_FLARE_OFF + random() * 2; + dremove(te.oldenemy); + } + else + { + if (te.classname == "pipebomb") + { + te.nextthink = time + 0.1 + random() * 2; + } + else + { + if (te.classname == "building_dispenser") + { + TF_T_Damage(te, self, self.owner, 200, TF_FLARE_LIT, 4); + } + else + { + if (te.classname == "ammobox") + { + expsize = TF_FLARE_LIT; + expsize = expsize + te.ammo_shells * 0.75; + expsize = expsize + te.ammo_rockets * 0.75 * 2; + expsize = expsize + te.ammo_cells * 0.75 * 2; + if (expsize > TF_FLARE_LIT) + { + te.solid = TF_FLARE_LIT; + deathmsg = 30; + T_RadiusDamage(te, self.owner, expsize, te); + te.think = SUB_Remove; + te.nextthink = time + 0.1; + WriteByte(4, 23); + WriteByte(4, 3); + WriteCoord(4, te.origin_x); + WriteCoord(4, te.origin_y); + WriteCoord(4, te.origin_z); + multicast(te.origin, TF_FLARE_OFF); + } + } + else + { + if (te.classname == "player" || te.touch == BackpackTouch) + { + expsize = TF_FLARE_LIT; + expsize = expsize + te.ammo_shells * 0.75; + expsize = expsize + te.ammo_rockets * 0.75 * 2; + if (te.playerclass != 9) + { + expsize = expsize + te.ammo_cells * 0.75; + } + if (expsize > TF_FLARE_LIT) + { + deathmsg = 30; + T_RadiusDamage(te, self.owner, expsize, te); + if (te.touch != BackpackTouch) + { + TF_T_Damage(te, self, self.owner, expsize, TF_FLARE_LIT, 4); + te.ammo_shells = ceil(te.ammo_shells * 0.25); + te.ammo_rockets = ceil(te.ammo_rockets * 0.25); + if (te.playerclass != 9) + { + te.ammo_cells = ceil(te.ammo_cells * 0.25); + } + oldself = self; + self = te; + W_SetCurrentAmmo(); + self = oldself; + } + else + { + te.think = SUB_Remove; + te.nextthink = time + 0.1; + } + WriteByte(4, 23); + WriteByte(4, 3); + WriteCoord(4, te.origin_x); + WriteCoord(4, te.origin_y); + WriteCoord(4, te.origin_z); + multicast(te.origin, TF_FLARE_OFF); + } + } + } + } + } + } + } + te = te.chain; + } + BecomeExplosion(); + self.owner.active_grenades_2 = (self.owner.active_grenades_2 - 1); + dremove(self); +}; + +void () TeamFortress_EngineerBuild = +{ + local entity te; + + if ((self.is_building == 0)) + { + if ((((self.ammo_cells < 100) && (self.has_dispenser == 0)) && (self.has_sentry == 0))) + { + CenterPrint (self, "You don't have enough metal to \nbuild anything.\n\n"); + return; + } + self.current_menu = 15; + self.menu_count = 25; + } + else + { + if ((self.is_building == 1)) + { + sprint (self, 2, "You stop building.\n"); + self.pausetime = 0; + self.tfstate = (self.tfstate - (self.tfstate & 65536)); + TeamFortress_SetSpeed (self); + te = find (world, netname, "build_timer"); + while (te) + { + if ((te.owner == self)) + { + dremove (te); + te = world; + } + else + { + te = find (te, netname, "build_timer"); + } + } + self.is_building = 0; + self.current_weapon = self.weapon; + W_SetCurrentAmmo (); + } + } +}; + +float(entity obj, entity builder) CheckArea = +{ + local vector src; + local vector end; + local float pos; + pos = pointcontents(obj.origin); + if (pos == -2 || pos == -6) + { + return TF_FLARE_LIT; + } + src_x = obj.origin_x + obj.maxs_x + 16; + src_y = obj.origin_y + obj.maxs_y + 16; + src_z = obj.origin_z + obj.maxs_z + 16; + pos = pointcontents(src); + if (pos == -2 || pos == -6) + { + return TF_FLARE_LIT; + } + end_x = obj.origin_x + obj.mins_x - 16; + end_y = obj.origin_y + obj.mins_y - 16; + end_z = obj.origin_z + obj.mins_z - 16; + traceline(src, end, TF_FLARE_OFF, obj); + if (trace_fraction != TF_FLARE_OFF) + { + return TF_FLARE_LIT; + } + pos = pointcontents(end); + if (pos == -2 || pos == -6) + { + return TF_FLARE_LIT; + } + src_x = obj.origin_x + obj.mins_x - 16; + src_y = obj.origin_y + obj.maxs_y + 16; + src_z = obj.origin_z + obj.maxs_z + 16; + pos = pointcontents(src); + if (pos == -2 || pos == -6) + { + return TF_FLARE_LIT; + } + end_x = obj.origin_x + obj.maxs_x + 16; + end_y = obj.origin_y + obj.mins_y - 16; + end_z = obj.origin_z + obj.mins_z - 16; + traceline(src, end, TF_FLARE_OFF, obj); + if (trace_fraction != TF_FLARE_OFF) + { + return TF_FLARE_LIT; + } + pos = pointcontents(end); + if (pos == -2 || pos == -6) + { + return TF_FLARE_LIT; + } + traceline(builder.origin, obj.origin, TF_FLARE_OFF, builder); + if (trace_fraction != TF_FLARE_OFF) + { + return TF_FLARE_LIT; + } + return TF_FLARE_OFF; +}; + +void(float objtobuild) TeamFortress_Build = +{ + local float btime; + local vector tmp1; + local vector tmp2; + newmis = spawn(); + makevectors(self.v_angle); + v_forward_z = TF_FLARE_LIT; + v_forward = normalize(v_forward) * 64; + newmis.origin = self.origin + v_forward; + if (objtobuild == TF_FLARE_OFF) + { + if (self.has_dispenser) + { + sprint(self, 2, "You can only have one dispenser.\nTry dismantling your old one.\n"); + return; + } + tmp1 = '-16 -16 0'; + tmp2 = '16 16 24'; + newmis.mdl = "progs/dispencr.mdl"; + newmis.netname = "dispenser"; + btime = time + 2; + } + else + { + if (objtobuild == 2) + { + if (self.has_sentry) + { + sprint(self, 2, "You can only have one sentry gun.\nTry dismantling your old one.\n"); + return; + } + tmp1 = '-16 -16 0'; + tmp2 = '16 16 48'; + newmis.mdl = "progs/turrbase.mdl"; + newmis.netname = "sentrygun"; + btime = time + 5; + } + } + if (CheckArea(newmis, self) == TF_FLARE_LIT) + { + sprint(self, 2, "Not enough room to build here\n"); + dremove(newmis); + return; + } +// Code for not being able to build near doors. Enable using "localinfo doorbuild 0" (if unspecified, +// you can still build by doors). + if (infokey(world, "doorbuild") == "0") { + local entity isneardoor; + isneardoor = findradius (newmis.origin, 200); + while (isneardoor) + { + if ((isneardoor.classname == "door")) + { + if (isneardoor.orig_origin_z <= newmis.origin_z) { + sprint (self, 2, "You cannot build here.\n"); + dremove(newmis); + return; + } } + isneardoor = isneardoor.chain; + } } + local entity isnearnobuild; + isnearnobuild = findradius (newmis.origin, 200); + while (isnearnobuild) + { +// sprint(self, 2, "entity ",isnearnobuild.classname," found\n"); + if ((isnearnobuild.classname == "func_nobuild")) + { + sprint (self, 2, "You cannot build here.\n"); + dremove(newmis); + return; + } + isnearnobuild = isnearnobuild.chain; + } + self.is_building = TF_FLARE_OFF; + self.immune_to_check = time + 10; + self.maxspeed = TF_FLARE_LIT; + self.tfstate = self.tfstate | 65536; + self.weapon = self.current_weapon; + self.current_weapon = TF_FLARE_LIT; + self.weaponmodel = ""; + self.weaponframe = TF_FLARE_LIT; + TeamFortress_SetSpeed(self); + newmis.owner = self; + newmis.classname = "timer"; + newmis.netname = "build_timer"; + newmis.nextthink = btime; + newmis.think = TeamFortress_FinishedBuilding; + newmis.colormap = self.colormap; + newmis.weapon = objtobuild; + newmis.angles_y = anglemod(self.angles_y + 180); + newmis.velocity = '0 0 8'; + newmis.movetype = 6; + newmis.solid = 2; + setmodel(newmis, newmis.mdl); + setsize(newmis, tmp1, tmp2); + setorigin(newmis, newmis.origin); + newmis.flags = newmis.flags - (newmis.flags & 512); +}; + +void(entity bld) CheckBelowBuilding = +{ + local vector below; + below = bld.origin; + if (bld.classname == "detpack") + { + below_z = below_z - 8; + } + else + { + below_z = below_z - 24; + } + traceline(bld.origin, below, TF_FLARE_OFF, bld); + if (trace_fraction == TF_FLARE_OFF) + { + bld.movetype = 6; + bld.flags = bld.flags - (bld.flags & 512); + } +}; + +void() DispenserThink = +{ + self.ammo_shells = self.ammo_shells + rint(400 / 20); + self.ammo_cells = self.ammo_cells + rint(400 / 20); + self.ammo_nails = self.ammo_nails + rint(600 / 20); + self.ammo_rockets = self.ammo_rockets + rint(300 / 20); + self.armorvalue = self.armorvalue + rint(500 / 20); + if (self.ammo_shells > 400) + { + self.ammo_shells = 400; + } + if (self.ammo_nails > 600) + { + self.ammo_nails = 600; + } + if (self.ammo_rockets > 300) + { + self.ammo_rockets = 300; + } + if (self.ammo_cells > 400) + { + self.ammo_cells = 400; + } + if (self.armorvalue > 500) + { + self.armorvalue = 500; + } + self.nextthink = time + 10; +}; + +void() TeamFortress_FinishedBuilding = +{ + local entity oldself; + if (self.owner.is_building != TF_FLARE_OFF) + { + return; + } + oldself = self; + self = self.owner; + oldself.owner = world; + oldself.real_owner = self; + self.is_building = TF_FLARE_LIT; + self.tfstate = self.tfstate - (self.tfstate & 65536); + self.current_weapon = self.weapon; + self.StatusRefreshTime = time + 0.1; + TeamFortress_SetSpeed(self); + if (oldself.weapon == TF_FLARE_OFF) + { + self.has_dispenser = TF_FLARE_OFF; + sprint(self, 2, "You finish building the dispenser.\n"); + teamsprint(self.team_no, self, self.netname); + teamsprint(self.team_no, self, " has built a Dispenser.\n"); + self.ammo_cells = self.ammo_cells - 100; + oldself.classname = "building_dispenser"; + oldself.netname = "dispenser"; + oldself.blocked = T_Dispenser; + oldself.touch = T_Dispenser; + oldself.max_health = 150; + oldself.health = 150; + oldself.think = DispenserThink; + oldself.nextthink = time + 5; + oldself.th_die = Dispenser_Die; + oldself.mdl = "progs/dispencr.mdl"; + oldself.team_no = self.team_no; + oldself.real_owner = self; + oldself.colormap = self.colormap; + oldself.takedamage = 2; + oldself.owner = world; + oldself.movetype = 6; + oldself.velocity = '0 0 8'; + oldself.flags = oldself.flags - (oldself.flags & 512); + oldself.ammo_shells = ceil(self.ammo_shells * 0.25); + oldself.ammo_nails = ceil(self.ammo_nails * 0.25); + oldself.ammo_rockets = ceil(self.ammo_rockets * 0.25); + oldself.ammo_cells = ceil(self.ammo_cells * 0.25); + oldself.armorvalue = ceil(self.armorvalue * 0.25); + self.ammo_shells = ceil(self.ammo_shells * 0.75); + self.ammo_nails = ceil(self.ammo_nails * 0.75); + self.ammo_rockets = ceil(self.ammo_rockets * 0.75); + self.ammo_cells = ceil(self.ammo_cells * 0.75); + self.armorvalue = ceil(self.armorvalue * 0.75); + oldself.solid = 2; + setmodel(oldself, oldself.mdl); + //setsize(oldself, '-8 -8 0', '8 8 24');gold. commented out.. plexi's idea :j + setorigin(oldself, oldself.origin); + } + else + { + if (oldself.weapon == 2) + { + self.has_sentry = TF_FLARE_OFF; + sprint(self, 2, "You finish building the sentry gun.\n"); + teamsprint(self.team_no, self, self.netname); + teamsprint(self.team_no, self, " has built a Sentry Gun.\n"); + oldself.classname = "building_sentrygun_base"; + oldself.netname = "sentry gun"; + oldself.takedamage = TF_FLARE_LIT; + oldself.th_die = Sentry_Die; + self.ammo_cells = self.ammo_cells - 130; + setsize(oldself, '-16 -16 0', '16 16 4'); + newmis = spawn(); + newmis.classname = "building_sentrygun"; + newmis.health = 150; + newmis.max_health = newmis.health; + newmis.weapon = TF_FLARE_OFF; + newmis.th_die = Sentry_Die; + newmis.th_pain = Sentry_Pain; + newmis.mdl = "progs/turrgun.mdl"; + sound(oldself, 3, "weapons/tnkatck4.wav", TF_FLARE_OFF, TF_FLARE_OFF); + newmis.solid = 2; + setmodel(newmis, newmis.mdl); + setsize(newmis, '-16 -16 0', '16 16 48'); + setorigin(newmis, oldself.origin + '0 0 8'); + newmis.real_owner = oldself.real_owner; + newmis.trigger_field = oldself; + oldself.oldenemy = newmis; + newmis.movetype = 4; + oldself.colormap = self.colormap; + newmis.colormap = self.colormap; + newmis.takedamage = 2; + newmis.velocity = '0 0 -8'; + newmis.flags = newmis.flags - (newmis.flags & 512); + oldself.flags = oldself.flags - (oldself.flags & 512); + newmis.team_no = self.team_no; + newmis.think = lvl1_sentry_stand; + newmis.nextthink = time + 0.5; + newmis.yaw_speed = 10; + newmis.heat = TF_FLARE_LIT; + newmis.angles_x = TF_FLARE_LIT; + newmis.angles_y = oldself.angles_y; + newmis.angles_z = TF_FLARE_LIT; + newmis.waitmin = anglemod(newmis.angles_y - 50); + newmis.waitmax = anglemod(newmis.angles_y + 50); + if (newmis.waitmin > newmis.waitmax) + { + newmis.waitmin = newmis.waitmax; + newmis.waitmax = anglemod(newmis.angles_y - 50); + } + newmis.ammo_shells = 25; + newmis.maxammo_shells = 100; + newmis.maxammo_rockets = 20; + } + } + W_SetCurrentAmmo(); +}; + +void() T_Dispenser = +{ + local entity dist_checker; + if (other.classname != "player") + { + return; + } + if (other.playerclass == 9 || other.playerclass == 5) + { + self.movetype = 6; + makevectors(other.v_angle); + self.velocity = v_forward * 100 + v_up * 80; + } + if (other.building == world && other.building_wait < time) + { + other.current_menu = 19; + other.menu_count = 25; + other.building = self; + dist_checker = spawn(); + dist_checker.classname = "timer"; + dist_checker.owner = other; + dist_checker.enemy = self; + dist_checker.think = CheckDistance; + dist_checker.nextthink = time + 0.3; + } +}; + +void() Dispenser_Die = +{ + self.real_owner.has_dispenser = TF_FLARE_LIT; + ThrowGib("progs/dgib1.mdl", -30); + ThrowGib("progs/dgib2.mdl", -50); + ThrowGib("progs/dgib3.mdl", -50); + WriteByte(4, 23); + WriteByte(4, 3); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, TF_FLARE_OFF); + BecomeExplosion(); +}; + +void(entity disp) Engineer_UseDispenser = +{ + local entity dist_checker; + local string st; + sprint(self, 2, "Dispenser has "); + st = ftos(disp.health); + sprint(self, 2, st); + sprint(self, 2, " health\n"); + st = ftos(disp.ammo_shells); + sprint(self, 2, st); + sprint(self, 2, " shells, "); + st = ftos(disp.ammo_nails); + sprint(self, 2, st); + sprint(self, 2, " nails,"); + st = ftos(disp.ammo_rockets); + sprint(self, 2, st); + sprint(self, 2, " rockets\n"); + st = ftos(disp.ammo_cells); + sprint(self, 2, st); + sprint(self, 2, " cells, and "); + st = ftos(disp.armorvalue); + sprint(self, 2, st); + sprint(self, 2, " armor\n"); + self.current_menu = 16; + self.menu_count = 25; + self.building = disp; + dist_checker = spawn(); + dist_checker.classname = "timer"; + dist_checker.owner = self; + dist_checker.enemy = disp; + dist_checker.think = CheckDistance; + dist_checker.nextthink = time + 0.3; +}; + +void (entity gun) Engineer_UseSentryGun = +{ + local entity dist_checker; + local string st; + + sprint (self, 2, "Level "); + st = ftos (gun.weapon); + sprint (self, 2, st); + sprint (self, 2, " Sentry Gun has "); + st = ftos (floor (gun.health)); + sprint (self, 2, st); + sprint (self, 2, " health, "); + st = ftos (floor (gun.ammo_shells)); + sprint (self, 2, st); + sprint (self, 2, " shells"); + if ((gun.weapon == 3)) + { + st = ftos (floor (gun.ammo_rockets)); + sprint (self, 2, ", "); + sprint (self, 2, st); + sprint (self, 2, " rockets"); + } + sprint (self, 2, "\n"); + self.current_menu = 17; + self.menu_count = 25; + self.building = gun; + dist_checker = spawn (); + dist_checker.classname = "timer"; + dist_checker.owner = self; + dist_checker.enemy = gun; + dist_checker.think = CheckDistance; + dist_checker.nextthink = (time + 0.300000); +}; + +void (entity gunhead) CheckSentry = +{ + local vector dist; + local entity gunbase; + + gunbase = gunhead.trigger_field; + dist = gunbase.origin - gunhead.origin; + if ((vlen (dist) > 15)) + { + bprint (1, self.real_owner.netname); + bprint (1, "'s sentry gun malfunctioned\n"); + Sentry_Die (); + } +}; + +void () CheckDistance = +{ + local vector dist; + + if ((self.owner.building != self.enemy)) + { + dremove (self); + return; + } + dist = self.enemy.origin - self.owner.origin; + if ((vlen (dist) > 64)) + { + CenterPrint (self.owner, "\n"); + self.owner.menu_count = 25; + self.owner.current_menu = 1; + self.owner.building = world; + dremove (self); + return; + } + self.nextthink = (time + 0.300000); +}; diff --git a/fight.pqc b/fight.pqc new file mode 100644 index 0000000..6b34c64 --- /dev/null +++ b/fight.pqc @@ -0,0 +1,165 @@ + + +float(float v) anglemod; + +//void() knight_atk1; +//void() knight_runatk1; +//void() ogre_smash1; +//void() ogre_swing1; + +//void() sham_smash1; +//void() sham_swingr1; +//void() sham_swingl1; + +//float() DemonCheckAttack; +//void(float side) Demon_Melee; + +void(vector dest) ChooseTurn; + +void() ai_face; + +float() CheckAttack = +{ + local vector spot1; + local vector spot2; + local entity targ; + local float chance; + targ = self.enemy; + spot1 = self.origin + self.view_ofs; + spot2 = targ.origin + targ.view_ofs; + traceline(spot1, spot2, TF_FLARE_LIT, self); + if (trace_ent != targ) + { + return TF_FLARE_LIT; + } + if (trace_inopen && trace_inwater) + { + return TF_FLARE_LIT; + } + if (enemy_range == TF_FLARE_LIT) + { + if (self.th_melee) + { + self.th_melee(); + return TF_FLARE_OFF; + } + } + if (!(self.th_missile)) + { + return TF_FLARE_LIT; + } + if (time < self.attack_finished) + { + return TF_FLARE_LIT; + } + if (enemy_range == 3) + { + return TF_FLARE_LIT; + } + if (enemy_range == TF_FLARE_LIT) + { + chance = 0.9; + self.attack_finished = TF_FLARE_LIT; + } + else + { + if (enemy_range == TF_FLARE_OFF) + { + if (self.th_melee) + { + chance = 0.2; + } + else + { + chance = 0.4; + } + } + else + { + if (enemy_range == 2) + { + if (self.th_melee) + { + chance = 0.05; + } + else + { + chance = 0.1; + } + } + else + { + chance = TF_FLARE_LIT; + } + } + } + if (random() < chance) + { + self.th_missile(); + SUB_AttackFinished(2 * random()); + return TF_FLARE_OFF; + } + return TF_FLARE_LIT; +}; + +void(float d) ai_charge = +{ + ai_face(); + movetogoal(d); +}; + +void() ai_charge_side = +{ + local vector dtemp; + local float heading; + self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin); + ChangeYaw(); + makevectors(self.angles); + dtemp = self.enemy.origin - 30 * v_right; + heading = vectoyaw(dtemp - self.origin); + walkmove(heading, 20); +}; + +void() ai_melee = +{ + local vector delta; + local float ldmg; + if (!(self.enemy)) + { + return; + } + delta = self.enemy.origin - self.origin; + if (vlen(delta) > 60) + { + return; + } + // pablo. + //random(); + ldmg = (random() + random() + random()) * 3; + T_Damage(self.enemy, self, self, ldmg); +}; + +void() ai_melee_side = +{ + local vector delta; + local float ldmg; + if (!(self.enemy)) + { + return; + } + ai_charge_side(); + delta = self.enemy.origin - self.origin; + if (vlen(delta) > 60) + { + return; + } + if (!CanDamage(self.enemy, self)) + { + return; + } + // pablo. + //random(); + ldmg = (random() + random() + random()) * 3; + T_Damage(self.enemy, self, self, ldmg); +}; + diff --git a/fish.pqc b/fish.pqc new file mode 100644 index 0000000..138f0f3 --- /dev/null +++ b/fish.pqc @@ -0,0 +1,497 @@ +void() f_stand1 = [39, f_stand2] +{ + ai_stand(); +}; + +void() f_stand2 = [40, f_stand3] +{ + ai_stand(); +}; + +void() f_stand3 = [41, f_stand4] +{ + ai_stand(); +}; + +void() f_stand4 = [42, f_stand5] +{ + ai_stand(); +}; + +void() f_stand5 = [43, f_stand6] +{ + ai_stand(); +}; + +void() f_stand6 = [44, f_stand7] +{ + ai_stand(); +}; + +void() f_stand7 = [45, f_stand8] +{ + ai_stand(); +}; + +void() f_stand8 = [46, f_stand9] +{ + ai_stand(); +}; + +void() f_stand9 = [47, f_stand10] +{ + ai_stand(); +}; + +void() f_stand10 = [48, f_stand11] +{ + ai_stand(); +}; + +void() f_stand11 = [49, f_stand12] +{ + ai_stand(); +}; + +void() f_stand12 = [50, f_stand13] +{ + ai_stand(); +}; + +void() f_stand13 = [51, f_stand14] +{ + ai_stand(); +}; + +void() f_stand14 = [52, f_stand15] +{ + ai_stand(); +}; + +void() f_stand15 = [53, f_stand16] +{ + ai_stand(); +}; + +void() f_stand16 = [54, f_stand17] +{ + ai_stand(); +}; + +void() f_stand17 = [55, f_stand18] +{ + ai_stand(); +}; + +void() f_stand18 = [56, f_stand1] +{ + ai_stand(); +}; + +void() f_walk1 = [39, f_walk2] +{ + ai_walk(8); +}; + +void() f_walk2 = [40, f_walk3] +{ + ai_walk(8); +}; + +void() f_walk3 = [41, f_walk4] +{ + ai_walk(8); +}; + +void() f_walk4 = [42, f_walk5] +{ + ai_walk(8); +}; + +void() f_walk5 = [43, f_walk6] +{ + ai_walk(8); +}; + +void() f_walk6 = [44, f_walk7] +{ + ai_walk(8); +}; + +void() f_walk7 = [45, f_walk8] +{ + ai_walk(8); +}; + +void() f_walk8 = [46, f_walk9] +{ + ai_walk(8); +}; + +void() f_walk9 = [47, f_walk10] +{ + ai_walk(8); +}; + +void() f_walk10 = [48, f_walk11] +{ + ai_walk(8); +}; + +void() f_walk11 = [49, f_walk12] +{ + ai_walk(8); +}; + +void() f_walk12 = [50, f_walk13] +{ + ai_walk(8); +}; + +void() f_walk13 = [51, f_walk14] +{ + ai_walk(8); +}; + +void() f_walk14 = [52, f_walk15] +{ + ai_walk(8); +}; + +void() f_walk15 = [53, f_walk16] +{ + ai_walk(8); +}; + +void() f_walk16 = [54, f_walk17] +{ + ai_walk(8); +}; + +void() f_walk17 = [55, f_walk18] +{ + ai_walk(8); +}; + +void() f_walk18 = [56, f_walk1] +{ + ai_walk(8); +}; + +void() f_run1 = [39, f_run2] +{ + ai_run(12); + if (random() < 0.3) + { + sound(self, 2, "misc/water1.wav", 0.6, 2); + } +}; + +void() f_run2 = [41, f_run3] +{ + ai_run(12); +}; + +void() f_run3 = [43, f_run4] +{ + ai_run(12); +}; + +void() f_run4 = [45, f_run5] +{ + ai_run(12); +}; + +void() f_run5 = [47, f_run6] +{ + ai_run(12); +}; + +void() f_run6 = [49, f_run7] +{ + ai_run(12); +}; + +void() f_run7 = [51, f_run8] +{ + ai_run(12); +}; + +void() f_run8 = [53, f_run9] +{ + ai_run(12); +}; + +void() f_run9 = [55, f_run1] +{ + ai_run(12); +}; + +void() fish_melee = +{ + local vector delta; + local float ldmg; + if (!(self.enemy)) + { + return; + } + delta = self.enemy.origin - self.origin; + if (vlen(delta) > 60) + { + return; + } + sound(self, 2, "fish/bite.wav", TF_FLARE_OFF, TF_FLARE_OFF); + random(); + ldmg = (random() + random()) * 3; + T_Damage(self.enemy, self, self, ldmg); +}; + +void() f_attack1 = [0, f_attack2] +{ + ai_charge(10); +}; + +void() f_attack2 = [1, f_attack3] +{ + ai_charge(10); +}; + +void() f_attack3 = [2, f_attack4] +{ + fish_melee(); +}; + +void() f_attack4 = [3, f_attack5] +{ + ai_charge(10); +}; + +void() f_attack5 = [4, f_attack6] +{ + ai_charge(10); +}; + +void() f_attack6 = [5, f_attack7] +{ + ai_charge(10); +}; + +void() f_attack7 = [6, f_attack8] +{ + ai_charge(10); +}; + +void() f_attack8 = [7, f_attack9] +{ + ai_charge(10); +}; + +void() f_attack9 = [8, f_attack10] +{ + fish_melee(); +}; + +void() f_attack10 = [9, f_attack11] +{ + ai_charge(10); +}; + +void() f_attack11 = [10, f_attack12] +{ + ai_charge(10); +}; + +void() f_attack12 = [11, f_attack13] +{ + ai_charge(10); +}; + +void() f_attack13 = [12, f_attack14] +{ + ai_charge(10); +}; + +void() f_attack14 = [13, f_attack15] +{ + ai_charge(10); +}; + +void() f_attack15 = [14, f_attack16] +{ + fish_melee(); +}; + +void() f_attack16 = [15, f_attack17] +{ + ai_charge(10); +}; + +void() f_attack17 = [16, f_attack18] +{ + ai_charge(10); +}; + +void() f_attack18 = [17, f_run1] +{ + ai_charge(10); +}; + +void() f_death1 = [18, f_death2] +{ + sound(self, 2, "fish/death.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void() f_death2 = [19, f_death3] +{ +}; + +void() f_death3 = [20, f_death4] +{ +}; + +void() f_death4 = [21, f_death5] +{ +}; + +void() f_death5 = [22, f_death6] +{ +}; + +void() f_death6 = [23, f_death7] +{ +}; + +void() f_death7 = [24, f_death8] +{ +}; + +void() f_death8 = [25, f_death9] +{ +}; + +void() f_death9 = [26, f_death10] +{ +}; + +void() f_death10 = [27, f_death11] +{ +}; + +void() f_death11 = [28, f_death12] +{ +}; + +void() f_death12 = [29, f_death13] +{ +}; + +void() f_death13 = [30, f_death14] +{ +}; + +void() f_death14 = [31, f_death15] +{ +}; + +void() f_death15 = [32, f_death16] +{ +}; + +void() f_death16 = [33, f_death17] +{ +}; + +void() f_death17 = [34, f_death18] +{ +}; + +void() f_death18 = [35, f_death19] +{ +}; + +void() f_death19 = [36, f_death20] +{ +}; + +void() f_death20 = [37, f_death21] +{ +}; + +void() f_death21 = [38, f_death21] +{ + self.solid = TF_FLARE_LIT; +}; + +void() f_pain1 = [57, f_pain2] +{ +}; + +void() f_pain2 = [58, f_pain3] +{ + ai_pain(6); +}; + +void() f_pain3 = [59, f_pain4] +{ + ai_pain(6); +}; + +void() f_pain4 = [60, f_pain5] +{ + ai_pain(6); +}; + +void() f_pain5 = [61, f_pain6] +{ + ai_pain(6); +}; + +void() f_pain6 = [62, f_pain7] +{ + ai_pain(6); +}; + +void() f_pain7 = [63, f_pain8] +{ + ai_pain(6); +}; + +void() f_pain8 = [64, f_pain9] +{ + ai_pain(6); +}; + +void() f_pain9 = [65, f_run1] +{ + ai_pain(6); +}; + +void(entity attacker, float damage) fish_pain = +{ + f_pain1(); +}; + +void() monster_fish = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model2("progs/fish.mdl"); + precache_sound2("fish/death.wav"); + precache_sound2("fish/bite.wav"); + self.solid = 3; + self.movetype = 4; + setmodel(self, "progs/fish.mdl"); + setsize(self, '-16 -16 -24', '16 16 24'); + self.health = 5000; + self.th_stand = f_stand1; + self.th_walk = f_walk1; + self.th_run = f_run1; + self.th_die = f_death1; + self.th_pain = fish_pain; + self.th_melee = f_attack1; + swimmonster_start(); +}; + diff --git a/flare.pqc b/flare.pqc new file mode 100644 index 0000000..f3dede9 --- /dev/null +++ b/flare.pqc @@ -0,0 +1,105 @@ +void() FlareGrenadeTouch = +{ + self.touch = SUB_Null; + self.velocity = '0 0 0'; + if (pointcontents(self.origin) == -6) + { + newmis = spawn(); + setmodel(newmis, "progs/flare.spr"); + setorigin(newmis, self.origin - '0 0 30'); + newmis.movetype = 8; + newmis.solid = TF_FLARE_OFF; + newmis.effects = 4; + newmis.effects = newmis.effects + TF_FLARE_OFF; + sound(newmis, 3, "items/flare1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + newmis.velocity_z = -30; + newmis.velocity_x = random() * 10; + newmis.velocity_y = random() * 10; + newmis.nextthink = time + 30; + newmis.think = SUB_Remove; + newmis.touch = SUB_Remove; + newmis.classname = "flare"; + dremove(self); + } + else + { + sound(self, TF_FLARE_OFF, "weapons/bounce.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.movetype = 6; + } +}; + +void () FlareGrenadeThink = +{ + local float _l_8723; + local float _l_8724; + + _l_8724 = self.health - time; + if ((_l_8724 > 37)) + { + _l_8723 = random (); + if ((_l_8723 < 0.500000)) + { + self.effects = 8; + } + else + { + self.effects = 0; + } + self.nextthink = ((time + 0.050000) + (random () * 0.100000)); + } + else + { + if ((_l_8724 > 34)) + { + _l_8723 = random (); + if ((_l_8723 < 0.500000)) + { + self.effects = 4; + } + else + { + self.effects = 8; + } + self.nextthink = ((time + 0.050000) + (random () * 0.100000)); + } + else + { + if ((_l_8724 > 15)) + { + self.effects = 4; + self.nextthink = (time + 10); + } + else + { + if ((_l_8724 < 1)) + { + self.owner.active_grenades_2 = (self.owner.active_grenades_2 - 1); + remove (self); + } + else + { + self.effects = 8; + self.nextthink = (time + _l_8724); + } + } + } + } +}; + +void() FlareGrenadeExplode = +{ + self.skin = TF_FLARE_OFF; + self.health = time + 40; + self.nextthink = time + 0.05 + random() * 0.1; + sound(self, 3, "items/flare1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.solid = TF_FLARE_LIT; + self.think = FlareGrenadeThink; +}; + +void () RemoveFlare = +{ + self.owner.effects = (self.owner.effects - (self.owner.effects & 4)); + self.owner.active_grenades_2 = (self.owner.active_grenades_2 - 1); + dremove (self); +}; + diff --git a/gmqcc b/gmqcc new file mode 100644 index 0000000..26612df Binary files /dev/null and b/gmqcc differ diff --git a/hiprot.pqc b/hiprot.pqc new file mode 100644 index 0000000..d47d9b9 --- /dev/null +++ b/hiprot.pqc @@ -0,0 +1,969 @@ +.float rotate_type; +.float endtime; +.float duration; +.vector neworigin; +.vector rotate; +.string path; +.string event; +.string group; + +float START_ON = 1; // flag. abe thinks right. +float TOGGLE = 1; // flag. abe thinks right. + +float ROTATION = 1; +float ANGLES = 2; // flag. from abe. +float STOP = 4; +float NO_ROTATE = 8; + +float VISIBLE = 1; +float DAMAGE = 2; +float TOUCH = 2; // this one too. +float SET_DAMAGE = 4; // i made this one up. + +float NONBLOCKING = 4; + +float STAYOPEN = 4; + +float OBJECT_MOVEWALL = 2; +float OBJECT_ROTATE = 3; +float STATE_SPEEDINGUP = 4; +float STATE_ACTIVE = 5; +float OBJECT_SETORIGIN = 6; +float STATE_WAIT = 7; +float STATE_SLOWINGDOWN = 8; +float STATE_INACTIVE = 9; +float STATE_OPENING = 10; +float STATE_CLOSING = 11; +float STATE_MOVE = 12; +float STATE_STOP = 13; +float STATE_NEXT = 14; +float STATE_FIND = 15; +float STATE_OPEN = 16; +float STATE_CLOSED = 17; + +void() rotate_train_find; +void() rotate_door_group_reversedirection; +void() rotate_train_next; + +void() info_rotate = +{ + self.nextthink = time + 2; + self.think = SUB_Remove; +}; + +void() RotateTargets = +{ + local entity ent; + local vector vx; + local vector vy; + local vector vz; + local vector org; + makevectors(self.angles); + ent = find(world, targetname, self.target); + while (ent) + { + if (ent.rotate_type == OBJECT_SETORIGIN) + { + org = ent.oldorigin; + vx = v_forward * org_x; + vy = v_right * org_y; + vy = vy * -1; + vz = v_up * org_z; + ent.neworigin = vx + vy + vz; + setorigin(ent, ent.neworigin + self.origin); + } + else + { + if (ent.rotate_type == OBJECT_ROTATE) + { + ent.angles = self.angles; + org = ent.oldorigin; + vx = v_forward * org_x; + vy = v_right * org_y; + vy = vy * -1; + vz = v_up * org_z; + ent.neworigin = vx + vy + vz; + setorigin(ent, ent.neworigin + self.origin); + } + else + { + org = ent.oldorigin; + vx = v_forward * org_x; + vy = v_right * org_y; + vy = vy * -1; + vz = v_up * org_z; + ent.neworigin = vx + vy + vz; + ent.neworigin = self.origin - self.oldorigin + (ent.neworigin - ent.oldorigin); + ent.velocity = (ent.neworigin - ent.origin) * 25; + } + } + ent = find(ent, targetname, self.target); + } +}; + +void() RotateTargetsFinal = +{ + local entity ent; + ent = find(world, targetname, self.target); + while (ent) + { + ent.velocity = '0 0 0'; + if (ent.rotate_type == OBJECT_ROTATE) + { + ent.angles = self.angles; + } + ent = find(ent, targetname, self.target); + } +}; + +void() SetTargetOrigin = +{ + local entity ent; + ent = find(world, targetname, self.target); + while (ent) + { + if (ent.rotate_type == OBJECT_MOVEWALL) + { + setorigin(ent, self.origin - self.oldorigin + (ent.neworigin - ent.oldorigin)); + } + else + { + setorigin(ent, ent.neworigin + self.origin); + } + ent = find(ent, targetname, self.target); + } +}; + +void() LinkRotateTargets = +{ + local entity ent; + local vector tempvec; + self.oldorigin = self.origin; + ent = find(world, targetname, self.target); + while (ent) + { + if (ent.classname == "rotate_object") + { + ent.rotate_type = OBJECT_ROTATE; + ent.oldorigin = ent.origin - self.oldorigin; + ent.neworigin = ent.origin - self.oldorigin; + ent.owner = self; + } + else + { + if (ent.classname == "func_movewall") + { + ent.rotate_type = OBJECT_MOVEWALL; + tempvec = (ent.absmin + ent.absmax) * 0.5; + ent.oldorigin = tempvec - self.oldorigin; + ent.neworigin = ent.oldorigin; + ent.owner = self; + } + else + { + ent.rotate_type = OBJECT_SETORIGIN; + ent.oldorigin = ent.origin - self.oldorigin; + ent.neworigin = ent.origin - self.oldorigin; + } + } + ent = find(ent, targetname, self.target); + } +}; + +void(float amount) SetDamageOnTargets = +{ + local entity ent; + ent = find(world, targetname, self.target); + while (ent) + { + if (ent.classname == "func_movewall") + { + ent.dmg = amount; + } + ent = find(ent, targetname, self.target); + } +}; + +void() rotate_entity_think = +{ + local float t; + t = time - self.ltime; + self.ltime = time; + if (self.state == STATE_SPEEDINGUP) + { + self.count = self.count + self.cnt * t; + if (self.count > TF_FLARE_OFF) + { + self.count = TF_FLARE_OFF; + } + t = t * self.count; + } + else + { + if (self.state == STATE_SLOWINGDOWN) + { + self.count = self.count - self.cnt * t; + if (self.count < TF_FLARE_LIT) + { + RotateTargetsFinal(); + self.state = STATE_INACTIVE; + self.think = SUB_Null; + return; + } + t = t * self.count; + } + } + self.angles = self.angles + self.rotate * t; + self.angles = SUB_NormalizeAngles(self.angles); + RotateTargets(); + self.nextthink = time + 0.020000; +}; + +void() rotate_entity_use = +{ + self.frame = TF_FLARE_OFF - self.frame; + if (self.state == STATE_ACTIVE) + { + if (self.spawnflags & TOGGLE) + { + if (self.speed) + { + self.count = TF_FLARE_OFF; + self.state = STATE_SLOWINGDOWN; + } + else + { + self.state = STATE_INACTIVE; + self.think = SUB_Null; + } + } + } + else + { + if (self.state == STATE_INACTIVE) + { + self.think = rotate_entity_think; + self.nextthink = time + 0.020000; + self.ltime = time; + if (self.speed) + { + self.count = TF_FLARE_LIT; + self.state = STATE_SPEEDINGUP; + } + else + { + self.state = STATE_ACTIVE; + } + } + else + { + if (self.state == STATE_SPEEDINGUP) + { + if (self.spawnflags & TOGGLE) + { + self.state = STATE_SLOWINGDOWN; + } + } + else + { + self.state = STATE_SPEEDINGUP; + } + } + } +}; + +void() rotate_entity_firstthink = +{ + LinkRotateTargets(); + if (self.spawnflags & START_ON) + { + self.state = STATE_ACTIVE; + self.think = rotate_entity_think; + self.nextthink = time + 0.020000; + self.ltime = time; + } + else + { + self.state = STATE_INACTIVE; + self.think = SUB_Null; + } + self.use = rotate_entity_use; +}; + +void() func_rotate_entity = +{ + self.solid = TF_FLARE_LIT; + self.movetype = TF_FLARE_LIT; + setmodel(self, self.model); + setsize(self, self.mins, self.maxs); + if (self.speed != TF_FLARE_LIT) + { + self.cnt = TF_FLARE_OFF / self.speed; + } + self.think = rotate_entity_firstthink; + self.nextthink = time + 0.1; + self.ltime = time; +}; + +void() path_rotate = +{ + if (self.noise) + { + precache_sound(self.noise); + } + if (self.noise1) + { + precache_sound(self.noise1); + } +}; + +void() rotate_train_think = +{ + local float t; + local float timeelapsed; + t = time - self.ltime; + self.ltime = time; + if (self.endtime && time >= self.endtime) + { + self.endtime = TF_FLARE_LIT; + if (self.state == STATE_MOVE) + { + setorigin(self, self.finaldest); + self.velocity = '0 0 0'; + } + if (self.think1) + { + self.think1(); + } + } + else + { + timeelapsed = (time - self.cnt) * self.duration; + if (timeelapsed > TF_FLARE_OFF) + { + timeelapsed = TF_FLARE_OFF; + } + setorigin(self, self.dest1 + self.dest2 * timeelapsed); + } + self.angles = self.angles + self.rotate * t; + self.angles = SUB_NormalizeAngles(self.angles); + RotateTargets(); + self.nextthink = time + 0.020000; +}; + +void() rotate_train_use = +{ + if (self.think1 != rotate_train_find) + { + if (self.velocity != '0 0 0') + { + return; + } + if (self.think1) + { + self.think1(); + } + } +}; + +void() rotate_train_wait = +{ + self.state = STATE_WAIT; + if (self.goalentity.noise) + { + if (self.goalentity.noise == "ambience/chopper.wav") + { + sound(self, 2, self.goalentity.noise, TF_FLARE_OFF, TF_FLARE_LIT); + } + else + { + sound(self, 2, self.goalentity.noise, TF_FLARE_OFF, TF_FLARE_OFF); + } + } + else + { + sound(self, 2, self.noise, TF_FLARE_OFF, TF_FLARE_OFF); + } + if (self.goalentity.spawnflags & ANGLES) + { + self.rotate = '0 0 0'; + self.angles = self.finalangle; + } + if (self.goalentity.spawnflags & NO_ROTATE) + { + self.rotate = '0 0 0'; + } + self.endtime = self.ltime + self.goalentity.wait; + self.think1 = rotate_train_next; +}; + +void() rotate_train_stop = +{ + self.state = STATE_STOP; + if (self.goalentity.noise) + { + if (self.goalentity.noise == "ambience/chopper.wav") + { + sound(self, 2, self.goalentity.noise, TF_FLARE_OFF, TF_FLARE_LIT); + } + else + { + sound(self, 2, self.goalentity.noise, TF_FLARE_OFF, TF_FLARE_OFF); + } + } + else + { + sound(self, 2, self.noise, TF_FLARE_OFF, TF_FLARE_OFF); + } + if (self.goalentity.spawnflags & ANGLES) + { + self.rotate = '0 0 0'; + self.angles = self.finalangle; + } + if (self.goalentity.spawnflags & NO_ROTATE) + { + self.rotate = '0 0 0'; + } + self.dmg = TF_FLARE_LIT; + self.think1 = rotate_train_next; +}; + +void() rotate_train_next = +{ + local entity targ; + local entity current; + local vector vdestdelta; + local float len; + local float traveltime; + local float div; + local string temp; + self.state = STATE_NEXT; + current = self.goalentity; + targ = find(world, targetname, self.path); + if (targ.classname != "path_rotate") + { + objerror("Next target is not path_rotate"); + } + if (self.goalentity.noise1) + { + self.noise1 = self.goalentity.noise1; + } + if (self.noise1 == "ambience/chopper.wav") + { + sound(self, 2, self.noise1, TF_FLARE_OFF, TF_FLARE_LIT); + } + else + { + sound(self, 2, self.noise1, TF_FLARE_OFF, TF_FLARE_OFF); + } + self.goalentity = targ; + self.path = targ.target; + if (!(self.path)) + { + objerror("rotate_train_next: no next target"); + } + if (targ.spawnflags & STOP) + { + self.think1 = rotate_train_stop; + } + else + { + if (targ.wait) + { + self.think1 = rotate_train_wait; + } + else + { + self.think1 = rotate_train_next; + } + } + if (current.event) + { + temp = self.target; + self.target = current.event; + self.message = current.message; + SUB_UseTargets(); + self.target = temp; + self.message = string_null; + } + if (current.spawnflags & ANGLES) + { + self.rotate = '0 0 0'; + self.angles = self.finalangle; + } + if (current.spawnflags & ROTATION) + { + self.rotate = current.rotate; + } + if (current.spawnflags & DAMAGE) + { + self.dmg = current.dmg; + } + if (current.spawnflags & SET_DAMAGE) + { + SetDamageOnTargets(current.dmg); + } + if (current.speed == -1) + { + setorigin(self, targ.origin); + self.endtime = self.ltime + 0.010000; + SetTargetOrigin(); + if (targ.spawnflags & ANGLES) + { + self.angles = targ.angles; + } + self.duration = TF_FLARE_OFF; + self.cnt = time; + self.dest2 = '0 0 0'; + self.dest1 = self.origin; + self.finaldest = self.origin; + } + else + { + self.state = STATE_MOVE; + self.finaldest = targ.origin; + if (self.finaldest == self.origin) + { + self.velocity = '0 0 0'; + self.endtime = self.ltime + 0.1; + self.duration = TF_FLARE_OFF; + self.cnt = time; + self.dest2 = '0 0 0'; + self.dest1 = self.origin; + self.finaldest = self.origin; + return; + } + vdestdelta = self.finaldest - self.origin; + len = vlen(vdestdelta); +// if (current.spawnflags & MOVETIME) +// { +// traveltime = current.speed; +// } +// else +// { + if (current.speed > TF_FLARE_LIT) + { + self.speed = current.speed; + } + if (!(self.speed)) + { + objerror("No speed is defined!"); + } + traveltime = len / self.speed; +// } + if (traveltime < 0.1) + { + self.velocity = '0 0 0'; + self.endtime = self.ltime + 0.1; + if (targ.spawnflags & ANGLES) + { + self.angles = targ.angles; + } + return; + } + div = TF_FLARE_OFF / traveltime; + if (targ.spawnflags & ANGLES) + { + self.finalangle = SUB_NormalizeAngles(targ.angles); + self.rotate = (targ.angles - self.angles) * div; + } + self.endtime = self.ltime + traveltime; + self.velocity = vdestdelta * div; + self.duration = div; + self.cnt = time; + self.dest2 = vdestdelta; + self.dest1 = self.origin; + } +}; + +void() rotate_train_find = +{ + local entity targ; + self.state = STATE_FIND; + LinkRotateTargets(); + targ = find(world, targetname, self.path); + if (targ.classname != "path_rotate") + { + objerror("Next target is not path_rotate"); + } + self.goalentity = targ; + if (targ.spawnflags & ANGLES) + { + self.angles = targ.angles; + self.finalangle = SUB_NormalizeAngles(targ.angles); + } + self.path = targ.target; + setorigin(self, targ.origin); + SetTargetOrigin(); + RotateTargetsFinal(); + self.think1 = rotate_train_next; + if (!(self.targetname)) + { + self.endtime = self.ltime + 0.1; + } + else + { + self.endtime = TF_FLARE_LIT; + } + self.duration = TF_FLARE_OFF; + self.cnt = time; + self.dest2 = '0 0 0'; + self.dest1 = self.origin; +}; + +void() func_rotate_train = +{ + if (!(self.speed)) + { + self.speed = 100; + } + if (!(self.target)) + { + objerror("rotate_train without a target"); + } + if (!(self.noise)) + { + if (self.sounds == TF_FLARE_LIT) + { + self.noise = "misc/null.wav"; + } + if (self.sounds == TF_FLARE_OFF) + { + self.noise = "plats/train2.wav"; + } + } + if (!(self.noise1)) + { + if (self.sounds == TF_FLARE_LIT) + { + self.noise1 = "misc/null.wav"; + } + if (self.sounds == TF_FLARE_OFF) + { + self.noise1 = "plats/train1.wav"; + } + } + precache_sound(self.noise); + precache_sound(self.noise1); + self.cnt = TF_FLARE_OFF; + self.solid = TF_FLARE_LIT; + self.movetype = 4; + self.use = rotate_train_use; + setmodel(self, self.model); + setsize(self, self.mins, self.maxs); + setorigin(self, self.origin); + self.ltime = time; + self.nextthink = self.ltime + 0.1; + self.endtime = self.ltime + 0.1; + self.think = rotate_train_think; + self.think1 = rotate_train_find; + self.state = STATE_FIND; + self.duration = TF_FLARE_OFF; + self.cnt = 0.1; + self.dest2 = '0 0 0'; + self.dest1 = self.origin; + self.flags = self.flags | 512; +}; + +void() movewall_touch = +{ + if (time < self.owner.attack_finished) + { + return; + } + if (self.dmg) + { + T_Damage(other, self, self.owner, self.dmg); + self.owner.attack_finished = time + 0.5; + } + else + { + if (self.owner.dmg) + { + T_Damage(other, self, self.owner, self.owner.dmg); + self.owner.attack_finished = time + 0.5; + } + } +}; + +void() movewall_blocked = +{ + local entity temp; + if (time < self.owner.attack_finished) + { + return; + } + self.owner.attack_finished = time + 0.5; + if (self.owner.classname == "func_rotate_door") + { + temp = self; + self = self.owner; + rotate_door_group_reversedirection(); + self = temp; + } + if (self.dmg) + { + T_Damage(other, self, self.owner, self.dmg); + self.owner.attack_finished = time + 0.5; + } + else + { + if (self.owner.dmg) + { + T_Damage(other, self, self.owner, self.owner.dmg); + self.owner.attack_finished = time + 0.5; + } + } +}; + +void() movewall_think = +{ + self.ltime = time; + self.nextthink = time + 0.020000; +}; + +void() func_movewall = +{ + self.angles = '0 0 0'; + self.movetype = 7; + if (self.spawnflags & NONBLOCKING) + { + self.solid = TF_FLARE_LIT; + } + else + { + self.solid = 4; + self.blocked = movewall_blocked; + } + if (self.spawnflags & TOUCH) + { + self.touch = movewall_touch; + } + setmodel(self, self.model); + if (!(self.spawnflags & VISIBLE)) + { + self.model = string_null; + } + self.think = movewall_think; + self.nextthink = time + 0.020000; + self.ltime = time; +}; + +void() rotate_object = +{ + self.classname = "rotate_object"; + self.solid = TF_FLARE_LIT; + self.movetype = TF_FLARE_LIT; + setmodel(self, self.model); + setsize(self, self.mins, self.maxs); + self.think = SUB_Null; +}; + +void() rotate_door_think2 = +{ + local float t; + t = time - self.ltime; + self.ltime = time; + self.frame = TF_FLARE_OFF - self.frame; + self.angles = self.dest; + if (self.state == STATE_OPENING) + { + self.state = STATE_OPEN; + } + else + { + if (self.spawnflags & STAYOPEN) + { + rotate_door_group_reversedirection(); + return; + } + self.state = STATE_CLOSED; + } + sound(self, 2, self.noise3, TF_FLARE_OFF, TF_FLARE_OFF); + self.think = SUB_Null; + RotateTargetsFinal(); +}; + +void() rotate_door_think = +{ + local float t; + t = time - self.ltime; + self.ltime = time; + if (time < self.endtime) + { + self.angles = self.angles + self.rotate * t;//self.angles = self.angles + self.rotate * t; + RotateTargets(); + } + else + { + self.angles = self.dest; + RotateTargets(); + self.think = rotate_door_think2; + } + self.nextthink = time + 0.010000; +}; + +void() rotate_door_reversedirection = +{ + local vector start; + self.frame = TF_FLARE_OFF - self.frame; + if (self.state == STATE_CLOSING) + { + start = self.dest1; + self.dest = self.dest2; + self.state = STATE_OPENING; + } + else + { + start = self.dest2; + self.dest = self.dest1; + self.state = STATE_CLOSING; + } + sound(self, 2, self.noise2, TF_FLARE_OFF, TF_FLARE_OFF); + self.rotate = (self.dest - start) * (TF_FLARE_OFF / self.speed); + self.think = rotate_door_think; + self.nextthink = time + 0.020000; + self.endtime = time + self.speed - (self.endtime - time); + self.ltime = time; +}; + +void() rotate_door_group_reversedirection = +{ + local string name; + if (self.group) + { + name = self.group; + self = find(world, group, name); + while (self) + { + rotate_door_reversedirection(); + self = find(self, group, name); + } + } + else + { + rotate_door_reversedirection(); + } +}; + +void() rotate_door_use = +{ + local vector start; + if (self.state != STATE_OPEN && self.state != STATE_CLOSED) + { + return; + } + if (!(self.cnt)) + { + self.cnt = TF_FLARE_OFF; + LinkRotateTargets(); + } + self.frame = TF_FLARE_OFF - self.frame; + if (self.state == STATE_CLOSED) + { + start = self.dest1; + self.dest = self.dest2; + self.state = STATE_OPENING; + } + else + { + start = self.dest2; + self.dest = self.dest1; + self.state = STATE_CLOSING; + } + sound(self, 2, self.noise2, TF_FLARE_OFF, TF_FLARE_OFF); + self.rotate = (self.dest - start) * (TF_FLARE_OFF / self.speed); + self.think = rotate_door_think; + self.nextthink = time + 0.010000; + self.endtime = time + self.speed; + self.ltime = time; +}; + +void() func_rotate_door = +{ + if (!(self.target)) + { + objerror("rotate_door without target."); + } + self.dest1 = '0 0 0'; + self.dest2 = self.angles; + self.angles = self.dest1; + if (!(self.speed)) + { + self.speed = 2; + } + self.cnt = TF_FLARE_LIT; + if (!(self.dmg)) + { + self.dmg = 2; + } + else + { + if (self.dmg < TF_FLARE_LIT) + { + self.dmg = TF_FLARE_LIT; + } + } + if (self.sounds == TF_FLARE_LIT) + { + precache_sound("misc/null.wav"); + if (self.noise1) + { + precache_sound(self.noise1); + } + else + { + self.noise1 = "misc/null.wav"; + } + if (self.noise2) + { + precache_sound(self.noise2); + } + else + { + self.noise2 = "misc/null.wav"; + } + if (self.noise3) + { + precache_sound(self.noise3); + } + else + { + self.noise3 = "misc/null.wav"; + } + } + if (self.sounds == TF_FLARE_OFF) + { + precache_sound("doors/latch2.wav"); + precache_sound("doors/winch2.wav"); + precache_sound("doors/drclos4.wav"); + self.noise1 = "doors/latch2.wav"; + self.noise2 = "doors/winch2.wav"; + self.noise3 = "doors/drclos4.wav"; + } + if (self.sounds == 2) + { + precache_sound("doors/airdoor1.wav"); + precache_sound("doors/airdoor2.wav"); + self.noise2 = "doors/airdoor1.wav"; + self.noise1 = "doors/airdoor2.wav"; + self.noise3 = "doors/airdoor2.wav"; + } + if (self.sounds == 3) + { + precache_sound("doors/basesec1.wav"); + precache_sound("doors/basesec2.wav"); + self.noise2 = "doors/basesec1.wav"; + self.noise1 = "doors/basesec2.wav"; + self.noise3 = "doors/basesec2.wav"; + } + self.solid = TF_FLARE_LIT; + self.movetype = TF_FLARE_LIT; + setmodel(self, self.model); + setorigin(self, self.origin); + setsize(self, self.mins, self.maxs); + self.state = STATE_CLOSED; + self.use = rotate_door_use; + self.think = SUB_Null; +}; + diff --git a/hook.pqc b/hook.pqc new file mode 100644 index 0000000..69e69cb --- /dev/null +++ b/hook.pqc @@ -0,0 +1,304 @@ +// ammo fix... fix :P +.float grappleupdatetime; +void(entity rhook) Reset_Grapple = +{ + sound(rhook.owner, TF_FLARE_OFF, "doors/ddoor2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + rhook.owner.on_hook = TF_FLARE_LIT; + rhook.owner.hook_out = TF_FLARE_LIT; + rhook.owner.fire_held_down = TF_FLARE_LIT; + rhook.owner.weaponframe = TF_FLARE_LIT; + rhook.think = SUB_Remove; + rhook.nextthink = time; +}; + +void() Reset_My_Grapple = +{ + sound(self.owner, TF_FLARE_OFF, "doors/ddoor2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.owner.on_hook = TF_FLARE_LIT; + self.owner.hook_out = TF_FLARE_LIT; + self.owner.fire_held_down = TF_FLARE_LIT; + self.owner.weaponframe = TF_FLARE_LIT; + self.owner.off_hook = time + 1; + self.think = SUB_Remove; + self.nextthink = time; +}; + +void() Grapple_Track = +{ + if (!(self.owner.on_hook) || self.owner.health <= TF_FLARE_LIT) + { + Reset_Grapple(self); + return; + } + if (self.enemy.classname != "player") + { + self.velocity = self.enemy.velocity; + } + self.nextthink = time + 0.1; +}; + +entity() MakeLink = +{ + newmis = spawn(); + newmis.movetype = 9; + newmis.solid = TF_FLARE_LIT; + newmis.owner = self; + setmodel(newmis, "progs/rope.mdl"); + setorigin(newmis, self.origin); + setsize(newmis, '0 0 0', '0 0 0'); + newmis.angles = vectoangles(newmis.velocity); + return newmis; +}; + +void() Remove_Chain = +{ + self.think = SUB_Remove; + self.nextthink = time; + if (self.goalentity) + { + self.goalentity.think = SUB_Remove; + self.goalentity.nextthink = time; + if (self.goalentity.goalentity) + { + self.goalentity.goalentity.think = SUB_Remove; + self.goalentity.goalentity.nextthink = time; + } + } +}; + +void() Update_Chain = +{ + local vector temp; + if (!(self.owner.hook_out)) + { + self.think = Remove_Chain; + self.nextthink = time; + return; + } + temp = self.owner.hook.origin - self.owner.origin; + setorigin(self, self.owner.origin + temp * 0.3); + setorigin(self.goalentity, self.owner.origin + temp * 0.6); + setorigin(self.goalentity.goalentity, self.owner.origin + temp * 0.9); + self.angles = vectoangles(temp); + self.goalentity.angles = vectoangles(temp); + self.goalentity.goalentity.angles = vectoangles(temp); + self.nextthink = time + 0.2; +}; + +void() Build_Chain = +{ + self.goalentity = MakeLink(); + self.goalentity.think = Update_Chain; + self.goalentity.nextthink = time + 0.1; + self.goalentity.owner = self.owner; + self.goalentity.goalentity = MakeLink(); + self.goalentity.goalentity.goalentity = MakeLink(); +}; + +// fixes the grappling hook for FTE servers so that it will lock on when the player is on the ground +void () FTE_FixGrapple = +{ + if (trace_startsolid) + trace_fraction = 1; +} + +float() Check_Overhead = +{ + local vector src; + local vector end; + makevectors(self.owner.angles); + src = self.owner.origin - '0 0 24'; + end = self.owner.origin - '0 0 24'; + traceline(src, end, TF_FLARE_LIT, self.owner); + FTE_FixGrapple(); + if (trace_fraction != TF_FLARE_OFF) + { + return TF_FLARE_LIT; + } + src = self.owner.origin - '0 0 24' - v_forward * 16; + end = self.owner.origin - '0 0 24' - v_forward * 16 + '0 0 58'; + traceline(src, end, TF_FLARE_LIT, self.owner); + FTE_FixGrapple(); + if (trace_fraction != TF_FLARE_OFF) + { + return TF_FLARE_LIT; + } + src = self.owner.origin - '0 0 24' + v_forward * 16; + end = self.owner.origin - '0 0 24' + v_forward * 16 + '0 0 58'; + traceline(src, end, TF_FLARE_LIT, self.owner); + FTE_FixGrapple(); + if (trace_fraction != TF_FLARE_OFF) + { + return TF_FLARE_LIT; + } + src = self.owner.origin - '0 0 24' - v_right * 16; + end = self.owner.origin - '0 0 24' - v_right * 16 + '0 0 58'; + traceline(src, end, TF_FLARE_LIT, self.owner); + FTE_FixGrapple(); + if (trace_fraction != TF_FLARE_OFF) + { + return TF_FLARE_LIT; + } + src = self.owner.origin - '0 0 24' + v_right * 16; + end = self.owner.origin - '0 0 24' + v_right * 16 + '0 0 58'; + traceline(src, end, TF_FLARE_LIT, self.owner); + FTE_FixGrapple(); + if (trace_fraction != TF_FLARE_OFF) + { + return TF_FLARE_LIT; + } + return TF_FLARE_OFF; +}; + +void() Anchor_Grapple = +{ + local float test; + if (other == self.owner) + { + return; + } + if (other.classname == "missile" || other.classname == "grenade" || other.classname == "spike" || other.classname == "hook") + { + return; + } + if (pointcontents(self.origin) == -6) + { + Reset_Grapple(self); + return; + } + self.health = TF_FLARE_OFF; + self.takedamage = 2; + self.classname = "bot"; + self.team_no = TF_FLARE_LIT; + self.th_die = Reset_My_Grapple; + if (other.takedamage) + { + sound(self, TF_FLARE_OFF, "shambler/smack.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + sound(self, TF_FLARE_OFF, "player/axhit2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + if (other.takedamage) + { + T_Damage(other, self, self.owner, 10); + } + self.velocity = '0 0 0'; + self.avelocity = '0 0 0'; + sound(self, TF_FLARE_OFF, "weapons/bounce.wav", TF_FLARE_OFF, TF_FLARE_OFF); + sound(self.owner, TF_FLARE_LIT, "weapons/retract.wav", 0.8, TF_FLARE_OFF); + local string newgrapple; + newgrapple = infokey (world, "newgrapple"); + if (newgrapple == "1") + { + self.owner.ammo_cells = self.owner.ammo_cells - 10; + } + else + { + self.owner.ammo_cells = 0; + } + if (!(self.owner.button0)) + { + Reset_Grapple(self); + return; + } + test = Check_Overhead(); + if (!test) + { + Reset_Grapple(self); + return; + } + self.owner.on_hook = TF_FLARE_OFF; + if (self.owner.flags & 512) + { + self.owner.flags = self.owner.flags - 512; + setorigin(self.owner, self.owner.origin + '0 0 1'); + } + self.owner.lefty = TF_FLARE_OFF; + self.enemy = other; + self.think = Grapple_Track; + self.nextthink = time; + self.touch = SUB_Null; +}; + +void() Throw_Grapple = +{ + if (self.hook_out) + { + return; + } + KickPlayer(-1, self); + newmis = spawn(); + newmis.movetype = 9; + newmis.solid = 2; + newmis.owner = self; + self.hook = newmis; + newmis.classname = "hook"; + makevectors(self.v_angle); + newmis.velocity = v_forward * 2000; + newmis.angles = vectoangles(newmis.velocity); + newmis.touch = Anchor_Grapple; + newmis.think = Build_Chain; + newmis.nextthink = time + 0.1; + setmodel(newmis, "progs/hook.mdl"); + setorigin(newmis, self.origin + v_forward * 16 + '0 0 16'); + setsize(newmis, '-1 -1 -1', '1 1 1'); + self.hook_out = TF_FLARE_OFF; + self.fire_held_down = TF_FLARE_OFF; +}; + +void() Service_Grapple = +{ + local vector hook_dir; + if (!(self.button0)) + { + self.fire_held_down = TF_FLARE_LIT; + if (self.current_weapon == TF_FLARE_OFF) + { + Reset_Grapple(self.hook); + } + } + if (self.hook.enemy.classname == "player" || self.hook.enemy.classname == "bot") + { + if (self.hook.enemy.health > TF_FLARE_OFF) + { + hook_dir = self.hook.enemy.origin - self.origin; + } + else + { + Reset_Grapple(self.hook); + } + } + else + { + if (self.hook.enemy.classname != "player") + { + hook_dir = self.hook.origin - self.origin; + } + } +#ifdef clan_progs + self.velocity = normalize(hook_dir) * PC_SPY_MAXSPEED * 2; +#else + self.velocity = normalize(hook_dir) * self.maxfbspeed * 2; +#endif + if (vlen(hook_dir) <= 100 && self.lefty) + { + if (self.hook.goalentity) + { + self.hook.goalentity.think = Remove_Chain; + self.hook.goalentity.nextthink = time; + } + self.lefty = TF_FLARE_LIT; + } +// Seems that when spy was on grapple this would cause a serious bug making spies not able to use gun weapons +// Thanks "the skip" for pointing this bug out + if (self.grappleupdatetime < time) + { + self.currentammo = self.ammo_cells; + self.grappleupdatetime = time + 1; + } + else + { + self.grappleupdatetime = time + 1; + } +}; diff --git a/items.pqc b/items.pqc new file mode 100644 index 0000000..440d298 --- /dev/null +++ b/items.pqc @@ -0,0 +1,1584 @@ +float(entity Retriever, float WeaponType) TeamFortress_CanGetWeapon; +float() W_BestWeapon; +void() ammo_touch; +void() item_megahealth_rot; +float(entity Retriever, float AmmoType) TeamFortress_GetMaxAmmo; +float() CheckExistence; +void() health_touch; +.float healamount, healtype; + +void() SUB_regen = +{ + self.model = self.mdl; + self.solid = TF_FLARE_OFF; + sound(self, 2, "items/itembk2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + setorigin(self, self.origin); +}; + +void() noclass = +{ + dprint("noclass spawned at"); + dprint(vtos(self.origin)); + dprint("\n"); + remove(self); +}; + +void() PlaceItem = +{ + local float oldz; + self.mdl = self.model; + self.flags = 256; + self.solid = TF_FLARE_OFF; + self.movetype = 6; + self.velocity = '0 0 0'; + self.origin_z = self.origin_z + 6; + oldz = self.origin_z; + if (!droptofloor()) + { + dprint("Bonus item fell out of level at "); + dprint(vtos(self.origin)); + dprint("\n"); + dremove(self); + return; + } +}; + +void() StartItem = +{ + self.nextthink = time + 0.2; + self.think = PlaceItem; +}; + +float(entity e, float healamount2, float ignore) T_Heal = +{ + if (e.health <= TF_FLARE_LIT) + { + return TF_FLARE_LIT; + } + if (!ignore && e.health >= e.max_health) + { + return TF_FLARE_LIT; + } + healamount2 = ceil(healamount2); + e.health = e.health + healamount2; + if (!ignore && e.health >= e.max_health) + { + e.health = e.max_health; + } + if (e.health > 250) + { + e.health = 250; + } + if (e.leg_damage) + { + if (e.health > 95) + { + e.leg_damage = TF_FLARE_LIT; + } + else + { + e.leg_damage = e.leg_damage - ceil(e.health / 20); + } + if (e.leg_damage < TF_FLARE_OFF) + { + e.leg_damage = TF_FLARE_LIT; + } + TeamFortress_SetSpeed(e); + } + return TF_FLARE_OFF; +}; + +void() item_health = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = health_touch; + if (self.spawnflags & TF_FLARE_OFF) + { + precache_model("maps/b_bh10.bsp"); + precache_sound("items/r_item1.wav"); + setmodel(self, "maps/b_bh10.bsp"); + self.noise = "items/r_item1.wav"; + self.healamount = 15; + self.healtype = TF_FLARE_LIT; + } + else + { + if (self.spawnflags & 2) + { + precache_model("maps/b_bh100.bsp"); + precache_sound("items/r_item2.wav"); + setmodel(self, "maps/b_bh100.bsp"); + self.noise = "items/r_item2.wav"; + self.healamount = 100; + self.healtype = 2; + } + else + { + precache_model("maps/b_bh25.bsp"); + precache_sound("items/health1.wav"); + setmodel(self, "maps/b_bh25.bsp"); + self.noise = "items/health1.wav"; + self.healamount = 25; + self.healtype = TF_FLARE_OFF; + } + } + setsize(self, '0 0 0', '32 32 56'); + StartItem(); +}; + +void() health_touch = +{ + local float medi; + local string s; + if (other.classname != "player") + { + return; + } + if (other.is_feigning) + { + return; + } + if (other.tfstate & 65536) + { + return; + } + medi = TF_FLARE_LIT; + if (self.healtype == 2) + { + if (!(other.tfstate & 16)) + { + if (other.health >= 250) + { + return; + } + if (!T_Heal(other, self.healamount, TF_FLARE_OFF)) + { + return; + } + } + } + else + { + if (!T_Heal(other, self.healamount, TF_FLARE_LIT)) + { + if (other.weapons_carried & 4) + { + if (other.ammo_medikit < other.maxammo_medikit) + { + other.ammo_medikit = other.ammo_medikit + self.healamount; + if (other.ammo_medikit > other.maxammo_medikit) + { + other.ammo_medikit = other.maxammo_medikit; + } + s = ftos(self.healamount); + sprint(other, TF_FLARE_LIT, "You gather "); + sprint(other, TF_FLARE_LIT, s); + sprint(other, TF_FLARE_LIT, " medikit ammo\n"); + sound(other, 3, self.noise, TF_FLARE_OFF, TF_FLARE_OFF); + stuffcmd(other, "bf\n"); + self.model = string_null; + self.solid = TF_FLARE_LIT; + if (deathmatch != 2) + { + if (deathmatch) + { + self.nextthink = time + 20; + } + self.think = SUB_regen; + } + activator = other; + SUB_UseTargets(); + } + } + return; + } + } + if (other.tfstate & 16 && self.healamount > 80) + { + sprint(other, TF_FLARE_OFF, "You have been healed of your infection!"); + other.tfstate = other.tfstate - (other.tfstate & 16); + } + else + { + s = ftos(self.healamount); + sprint(other, TF_FLARE_LIT, "You receive "); + sprint(other, TF_FLARE_LIT, s); + sprint(other, TF_FLARE_LIT, " health\n"); + } + sound(other, 3, self.noise, TF_FLARE_OFF, TF_FLARE_OFF); + stuffcmd(other, "bf\n"); + self.model = string_null; + self.solid = TF_FLARE_LIT; + if (self.healtype == 2) + { + other.items = other.items | 65536; + self.nextthink = time + 5; + self.think = item_megahealth_rot; + self.owner = other; + } + else + { + if (deathmatch != 2) + { + if (deathmatch) + { + self.nextthink = time + 20; + } + self.think = SUB_regen; + } + } + activator = other; + SUB_UseTargets(); +}; + +void() item_megahealth_rot = +{ + other = self.owner; + if (other.health > other.max_health) + { + other.health = other.health - TF_FLARE_OFF; + self.nextthink = time + TF_FLARE_OFF; + return; + } + other.items = other.items - (other.items & 65536); + if (self.classname == "medikit_rot") + { + dremove(self); + return; + } + if (deathmatch != 2) + { + self.nextthink = time + 20; + self.think = SUB_regen; + } +}; + +void() armor_touch = +{ + local float type; + local float value; + local float bit; + local float rnum; + local string s; + local entity oldself; + rnum = random(); + if (other.health <= TF_FLARE_LIT) + { + return; + } + if (other.classname != "player") + { + return; + } + if (other.is_feigning) + { + return; + } + if (other.tfstate & 65536) + { + return; + } + if (self.classname == "item_armor1") + { + type = 0.3; + value = 100; + bit = 8192; + } + else + { + if (self.classname == "item_armor2") + { + type = 0.6; + value = 150; + bit = 16384; + } + else + { + if (self.classname == "item_armorInv") + { + type = 0.8; + value = 200; + bit = 32768; + } + } + } + if (other.armortype * other.armorvalue >= type * value) + { + if (other.playerclass == 9) + { + if (other.ammo_cells >= other.maxammo_cells) + { + return; + } + } + else + { + return; + } + } + if (other.armor_allowed * other.maxarmor <= type * value) + { + if (other.armor_allowed == other.armortype) + { + if (other.maxarmor == other.armorvalue) + { + if (other.playerclass == 9) + { + if (other.ammo_cells >= other.maxammo_cells) + { + return; + } + } + else + { + return; + } + } + } + } + if (type > other.armor_allowed) + { + type = other.armor_allowed; + if (type == 0.3) + { + bit = 8192; + } + else + { + if (type == 0.6) + { + bit = 16384; + } + else + { + if (type == 0.8) + { + bit = 32768; + } + } + } + } + sprint(other, TF_FLARE_LIT, "You got armor\n"); + if (value > other.maxarmor) + { + if (other.playerclass == 9 && other.ammo_cells < other.maxammo_cells) + { + s = ftos(value - other.maxarmor); + sprint(other, TF_FLARE_LIT, s); + sprint(other, TF_FLARE_LIT, " metal\n"); + other.ammo_cells = other.ammo_cells + (value - other.maxarmor); + if (other.ammo_cells > other.maxammo_cells) + { + other.ammo_cells = other.maxammo_cells; + } + oldself = self; + self = other; + W_SetCurrentAmmo(); + self = oldself; + } + value = other.maxarmor; + } + if (other.armortype * other.armorvalue < type * value) + { + other.armortype = type; + other.armorvalue = value; + other.items = other.items - (other.items & (8192 | 16384 | 32768)) + bit; + } + self.solid = TF_FLARE_LIT; + self.model = string_null; + if (deathmatch != 2) + { + self.nextthink = time + 10; + } + if (coop) + { + self.nextthink = time + 20; + } + self.think = SUB_regen; + sound(other, 3, "items/armor1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + stuffcmd(other, "bf\n"); + activator = other; + SUB_UseTargets(); +}; + +void() item_armor1 = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = armor_touch; + precache_model("progs/armor.mdl"); + setmodel(self, "progs/armor.mdl"); + self.skin = TF_FLARE_LIT; + setsize(self, '-16 -16 0', '16 16 56'); + StartItem(); +}; + +void() item_armor2 = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = armor_touch; + precache_model("progs/armor.mdl"); + setmodel(self, "progs/armor.mdl"); + self.skin = TF_FLARE_OFF; + setsize(self, '-16 -16 0', '16 16 56'); + StartItem(); +}; + +void() item_armorInv = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = armor_touch; + precache_model("progs/armor.mdl"); + setmodel(self, "progs/armor.mdl"); + self.skin = 2; + setsize(self, '-16 -16 0', '16 16 56'); + StartItem(); +}; + +void(entity p) bound_other_ammo = +{ + if (p.ammo_shells > TeamFortress_GetMaxAmmo(p, 256)) + { + p.ammo_shells = TeamFortress_GetMaxAmmo(p, 256); + } + if (p.ammo_nails > TeamFortress_GetMaxAmmo(p, 512)) + { + p.ammo_nails = TeamFortress_GetMaxAmmo(p, 512); + } + if (p.ammo_rockets > TeamFortress_GetMaxAmmo(p, 1024)) + { + p.ammo_rockets = TeamFortress_GetMaxAmmo(p, 1024); + } + if (p.ammo_cells > TeamFortress_GetMaxAmmo(p, 2048)) + { + p.ammo_cells = TeamFortress_GetMaxAmmo(p, 2048); + } + if (p.ammo_medikit > p.maxammo_medikit) + { + p.ammo_medikit = p.maxammo_medikit; + } + if (p.armorvalue > p.maxarmor) + { + p.armorvalue = p.maxarmor; + } + if (p.no_grenades_1 > 4) + { + p.no_grenades_1 = 4; + } + if (p.no_grenades_2 > 4) + { + p.no_grenades_2 = 4; + } +}; + +float(float w) RankForWeapon = +{ + if (w == 65536) + { + return TF_FLARE_OFF; + } + if (w == 8192) + { + return 2; + } + if (w == 1024) + { + return 3; + } + if (w == 2048) + { + return 4; + } + if (w == 256) + { + return 5; + } + if (w == 512) + { + return 6; + } + return 7; +}; + +void(float old, float new) Deathmatch_Weapon = +{ +}; + +void(entity ritem, entity act) Respawn_Item = +{ + local entity oldself; + oldself = self; + self = ritem; + self.model = string_null; + self.solid = TF_FLARE_LIT; + if (deathmatch != 2) + { + self.nextthink = time + 30; + } + else + { + if (coop && ritem.touch == ammo_touch) + { + self.nextthink = time + 45; + } + } + self.think = SUB_regen; + activator = act; + SUB_UseTargets(); + self = oldself; +}; + +void() weapon_touch = +{ + local float hadammo; + local float best; + local float new; + local float old; + local entity stemp; + local float leave; + if (!(other.flags & 8)) + { + return; + } + if (other.is_feigning) + { + return; + } + if (other.tfstate & 65536) + { + return; + } + stemp = self; + self = other; + best = W_BestWeapon(); + self = stemp; + if (deathmatch == 2 || coop) + { + leave = TF_FLARE_OFF; + } + else + { + leave = TF_FLARE_LIT; + } + if (self.classname == "weapon_nailgun") + { + if (leave && (other.weapons_carried & 512)) + { + return; + } + if (!TeamFortress_CanGetWeapon(other, 512)) + { + return; + } + hadammo = other.ammo_nails; + new = 512; + other.ammo_nails = other.ammo_nails + 30; + } + else + { + if (self.classname == "weapon_supernailgun") + { + if (leave && (other.weapons_carried & 1024)) + { + return; + } + if (!TeamFortress_CanGetWeapon(other, 1024)) + { + return; + } + hadammo = other.ammo_rockets; + new = 1024; + other.ammo_nails = other.ammo_nails + 30; + } + else + { + if (self.classname == "weapon_supershotgun") + { + if (leave && (other.weapons_carried & 256)) + { + return; + } + if (!TeamFortress_CanGetWeapon(other, 256)) + { + return; + } + hadammo = other.ammo_rockets; + new = 256; + other.ammo_shells = other.ammo_shells + 5; + } + else + { + if (self.classname == "weapon_rocketlauncher") + { + if (leave && (other.weapons_carried & 8192)) + { + return; + } + if (!TeamFortress_CanGetWeapon(other, 8192)) + { + return; + } + hadammo = other.ammo_rockets; + new = 8192; + other.ammo_rockets = other.ammo_rockets + 5; + } + else + { + if (self.classname == "weapon_grenadelauncher") + { + if (leave && (other.weapons_carried & 2048)) + { + return; + } + if (!TeamFortress_CanGetWeapon(other, 2048)) + { + return; + } + hadammo = other.ammo_rockets; + new = 2048; + other.ammo_rockets = other.ammo_rockets + 5; + } + else + { + if (self.classname == "weapon_lightning") + { + if (leave && (other.weapons_carried & 65536)) + { + return; + } + if (!TeamFortress_CanGetWeapon(other, 65536)) + { + return; + } + hadammo = other.ammo_rockets; + new = 65536; + other.ammo_cells = other.ammo_cells + 15; + } + else + { + objerror("weapon_touch: unknown classname"); + } + } + } + } + } + } + sprint(other, TF_FLARE_LIT, "You got the "); + sprint(other, TF_FLARE_LIT, self.netname); + sprint(other, TF_FLARE_LIT, "\n"); + sound(other, 3, "weapons/pkup.wav", TF_FLARE_OFF, TF_FLARE_OFF); + stuffcmd(other, "bf\n"); + bound_other_ammo(other); + old = other.weapons_carried; + other.weapons_carried = other.weapons_carried | new; + stemp = self; + self = other; + Deathmatch_Weapon(old, new); + W_SetCurrentAmmo(); + self = stemp; + if (leave) + { + return; + } + Respawn_Item(self, other); +}; + +void() weapon_supershotgun = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/g_shot.mdl"); + setmodel(self, "progs/g_shot.mdl"); + self.weapon = 256; + self.netname = "Double-barrelled Shotgun"; + self.touch = weapon_touch; + setsize(self, '-16 -16 0', '16 16 56'); + StartItem(); +}; + +void() weapon_nailgun = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/g_nail.mdl"); + setmodel(self, "progs/g_nail.mdl"); + self.weapon = 512; + self.netname = "nailgun"; + self.touch = weapon_touch; + setsize(self, '-16 -16 0', '16 16 56'); + StartItem(); +}; + +void() weapon_supernailgun = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/g_nail2.mdl"); + setmodel(self, "progs/g_nail2.mdl"); + self.weapon = 1024; + self.netname = "Super Nailgun"; + self.touch = weapon_touch; + setsize(self, '-16 -16 0', '16 16 56'); + StartItem(); +}; + +void() weapon_grenadelauncher = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/g_rock.mdl"); + setmodel(self, "progs/g_rock.mdl"); + self.weapon = 3; + self.netname = "Grenade Launcher"; + self.touch = weapon_touch; + setsize(self, '-16 -16 0', '16 16 56'); + StartItem(); +}; + +void() weapon_rocketlauncher = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/g_rock2.mdl"); + setmodel(self, "progs/g_rock2.mdl"); + self.weapon = 3; + self.netname = "Rocket Launcher"; + self.touch = weapon_touch; + setsize(self, '-16 -16 0', '16 16 56'); + StartItem(); +}; + +void() weapon_lightning = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/g_light.mdl"); + setmodel(self, "progs/g_light.mdl"); + self.weapon = 3; + self.netname = "Thunderbolt"; + self.touch = weapon_touch; + setsize(self, '-16 -16 0', '16 16 56'); + StartItem(); +}; + +void(entity pl, float typ) PrintGrenadeType = +{ + local string st; + if (typ == TF_FLARE_OFF) + { + st = "Normal"; + } + else + { + if (typ == 2) + { + st = "Concussion"; + } + else + { + if (typ == 3) + { + st = "Nail"; + } + else + { + if (typ == 4) + { + st = "Mirv"; + } + else + { + if (typ == 5) + { + st = "Napalm"; + } + else + { + if (typ == 6) + { + st = "Flare"; + } + else + { + if (typ == 7) + { + st = "Gas"; + } + else + { + if (typ == 8) + { + st = "EMP"; + } + else + { + if (typ == 9) + { + st = "Flash"; + } + } + } + } + } + } + } + } + } + sprint(pl, 2, st); +}; + +float() GetGrenadePossibility = +{ + if (random() < 0.5) + { + return TF_FLARE_LIT; + } + if (random() < 0.5) + { + if (other.tp_grenades_1 != TF_FLARE_LIT && other.no_grenades_1 < 4) + { + other.no_grenades_1 = other.no_grenades_1 + TF_FLARE_OFF; + sprint(other, 2, "You found a "); + PrintGrenadeType(other, other.tp_grenades_1); + sprint(other, 2, " grenade\n"); + return TF_FLARE_OFF; + } + } + else + { + if (other.tp_grenades_2 != TF_FLARE_LIT && other.no_grenades_2 < 4) + { + other.no_grenades_2 = other.no_grenades_2 + TF_FLARE_OFF; + sprint(other, 2, "You found a "); + PrintGrenadeType(other, other.tp_grenades_2); + sprint(other, 2, " grenade\n"); + return TF_FLARE_OFF; + } + } + return TF_FLARE_LIT; +}; + +void() ammo_touch = +{ + local entity stemp; + local float best; + local float gotgren; + local float gotbox; + gotgren = TF_FLARE_LIT; + gotbox = TF_FLARE_LIT; + if (other.classname != "player") + { + return; + } + if (other.health <= TF_FLARE_LIT) + { + return; + } + if (other.is_feigning) + { + return; + } + if (other.tfstate & 65536) + { + return; + } + stemp = self; + self = other; + best = W_BestWeapon(); + self = stemp; + if (self.weapon == TF_FLARE_OFF) + { + if (other.ammo_shells >= TeamFortress_GetMaxAmmo(other, 256)) + { + return; + } + other.ammo_shells = other.ammo_shells + self.aflag; + gotbox = TF_FLARE_OFF; + } + if (self.weapon == 2) + { + if (other.ammo_nails >= TeamFortress_GetMaxAmmo(other, 512)) + { + return; + } + other.ammo_nails = other.ammo_nails + self.aflag; + gotbox = TF_FLARE_OFF; + } + else + { + if (self.weapon == 3) + { + gotgren = GetGrenadePossibility(); + if (other.ammo_rockets >= TeamFortress_GetMaxAmmo(other, 1024)) + { + gotbox = TF_FLARE_LIT; + } + else + { + gotbox = TF_FLARE_OFF; + other.ammo_rockets = other.ammo_rockets + self.aflag; + } + } + else + { + if (self.weapon == 4) + { + if (other.ammo_cells >= TeamFortress_GetMaxAmmo(other, 2048)) + { + return; + } + other.ammo_cells = other.ammo_cells + self.aflag; + gotbox = TF_FLARE_OFF; + } + } + } + if (!gotbox && !gotgren) + { + return; + } + sound(other, 3, "weapons/lock4.wav", TF_FLARE_OFF, TF_FLARE_OFF); + stuffcmd(other, "bf\n"); + if (gotbox) + { + bound_other_ammo(other); + sprint(other, TF_FLARE_LIT, "You got the "); + sprint(other, TF_FLARE_LIT, self.netname); + sprint(other, TF_FLARE_LIT, "\n"); + stemp = self; + self = other; + W_SetCurrentAmmo(); + self = stemp; + } + Respawn_Item(self, other); +}; + +void() item_shells = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = ammo_touch; + if (self.spawnflags & TF_FLARE_OFF) + { + precache_model("maps/b_shell1.bsp"); + setmodel(self, "maps/b_shell1.bsp"); + self.aflag = 40; + } + else + { + precache_model("maps/b_shell0.bsp"); + setmodel(self, "maps/b_shell0.bsp"); + self.aflag = 20; + } + self.weapon = TF_FLARE_OFF; + self.netname = "shells"; + setsize(self, '0 0 0', '32 32 56'); + StartItem(); +}; + +void() item_spikes = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = ammo_touch; + if (self.spawnflags & TF_FLARE_OFF) + { + precache_model("maps/b_nail1.bsp"); + setmodel(self, "maps/b_nail1.bsp"); + self.aflag = 50; + } + else + { + precache_model("maps/b_nail0.bsp"); + setmodel(self, "maps/b_nail0.bsp"); + self.aflag = 25; + } + self.weapon = 2; + self.netname = "nails"; + setsize(self, '0 0 0', '32 32 56'); + StartItem(); +}; + +void() item_rockets = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = ammo_touch; + if (self.spawnflags & TF_FLARE_OFF) + { + precache_model("maps/b_rock1.bsp"); + setmodel(self, "maps/b_rock1.bsp"); + self.aflag = 10; + } + else + { + precache_model("maps/b_rock0.bsp"); + setmodel(self, "maps/b_rock0.bsp"); + self.aflag = 5; + } + self.weapon = 3; + self.netname = "rockets"; + setsize(self, '0 0 0', '32 32 56'); + StartItem(); +}; + +void() item_cells = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = ammo_touch; + if (self.spawnflags & TF_FLARE_OFF) + { + precache_model("maps/b_batt1.bsp"); + setmodel(self, "maps/b_batt1.bsp"); + self.aflag = 12; + } + else + { + precache_model("maps/b_batt0.bsp"); + setmodel(self, "maps/b_batt0.bsp"); + self.aflag = 6; + } + self.weapon = 4; + self.netname = "cells"; + setsize(self, '0 0 0', '32 32 56'); + StartItem(); +}; + +void() item_weapon = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = ammo_touch; + if (self.spawnflags & TF_FLARE_OFF) + { + if (self.spawnflags & 8) + { + precache_model("maps/b_shell1.bsp"); + setmodel(self, "maps/b_shell1.bsp"); + self.aflag = 40; + } + else + { + precache_model("maps/b_shell0.bsp"); + setmodel(self, "maps/b_shell0.bsp"); + self.aflag = 20; + } + self.weapon = TF_FLARE_OFF; + self.netname = "shells"; + } + if (self.spawnflags & 4) + { + if (self.spawnflags & 8) + { + precache_model("maps/b_nail1.bsp"); + setmodel(self, "maps/b_nail1.bsp"); + self.aflag = 40; + } + else + { + precache_model("maps/b_nail0.bsp"); + setmodel(self, "maps/b_nail0.bsp"); + self.aflag = 20; + } + self.weapon = 2; + self.netname = "spikes"; + } + if (self.spawnflags & 2) + { + if (self.spawnflags & 8) + { + precache_model("maps/b_rock1.bsp"); + setmodel(self, "maps/b_rock1.bsp"); + self.aflag = 10; + } + else + { + precache_model("maps/b_rock0.bsp"); + setmodel(self, "maps/b_rock0.bsp"); + self.aflag = 5; + } + self.weapon = 3; + self.netname = "rockets"; + } + setsize(self, '0 0 0', '32 32 56'); + StartItem(); +}; + +void() key_touch = +{ + if (other.classname != "player") + { + return; + } + if (other.health <= TF_FLARE_LIT) + { + return; + } + if (other.items & self.items) + { + return; + } + sprint(other, TF_FLARE_LIT, "You got the "); + sprint(other, TF_FLARE_LIT, self.netname); + sprint(other, TF_FLARE_LIT, "\n"); + sound(other, 3, self.noise, TF_FLARE_OFF, TF_FLARE_OFF); + stuffcmd(other, "bf\n"); + other.items = other.items | self.items; + if (!coop) + { + self.solid = TF_FLARE_LIT; + self.model = string_null; + } + else + { + if (coop && self.deadflag) + { + dremove(self); + return; + } + } + activator = other; + SUB_UseTargets(); +}; + +void() key_setsounds = +{ + if (world.worldtype == TF_FLARE_LIT) + { + precache_sound("misc/medkey.wav"); + self.noise = "misc/medkey.wav"; + } + if (world.worldtype == TF_FLARE_OFF) + { + precache_sound("misc/runekey.wav"); + self.noise = "misc/runekey.wav"; + } + if (world.worldtype == 2) + { + precache_sound2("misc/basekey.wav"); + self.noise = "misc/basekey.wav"; + } +}; + +void() item_key1 = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (world.worldtype == TF_FLARE_LIT) + { + precache_model("progs/w_s_key.mdl"); + setmodel(self, "progs/w_s_key.mdl"); + self.netname = "silver key"; + } + else + { + if (world.worldtype == TF_FLARE_OFF) + { + precache_model("progs/m_s_key.mdl"); + setmodel(self, "progs/m_s_key.mdl"); + self.netname = "silver runekey"; + } + else + { + if (world.worldtype == 2) + { + precache_model2("progs/b_s_key.mdl"); + setmodel(self, "progs/b_s_key.mdl"); + self.netname = "silver keycard"; + } + } + } + key_setsounds(); + self.touch = key_touch; + self.items = 131072; + setsize(self, '-16 -16 -24', '16 16 32'); + StartItem(); +}; + +void() item_key2 = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (world.worldtype == TF_FLARE_LIT) + { + precache_model("progs/w_g_key.mdl"); + setmodel(self, "progs/w_g_key.mdl"); + self.netname = "gold key"; + } + if (world.worldtype == TF_FLARE_OFF) + { + precache_model("progs/m_g_key.mdl"); + setmodel(self, "progs/m_g_key.mdl"); + self.netname = "gold runekey"; + } + if (world.worldtype == 2) + { + precache_model2("progs/b_g_key.mdl"); + setmodel(self, "progs/b_g_key.mdl"); + self.netname = "gold keycard"; + } + key_setsounds(); + self.touch = key_touch; + self.items = 262144; + setsize(self, '-16 -16 -24', '16 16 32'); + StartItem(); +}; + +void() sigil_touch = +{ + if (other.classname != "player") + { + return; + } + if (other.health <= TF_FLARE_LIT) + { + return; + } + CenterPrint(other, "You got the rune!"); + sound(other, 3, self.noise, TF_FLARE_OFF, TF_FLARE_OFF); + stuffcmd(other, "bf\n"); + self.solid = TF_FLARE_LIT; + self.model = string_null; + serverflags = serverflags | (self.spawnflags & 15); + self.classname = ""; + activator = other; + SUB_UseTargets(); +}; + +void() item_sigil = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.spawnflags)) + { + objerror("no spawnflags"); + } + precache_sound("misc/runekey.wav"); + self.noise = "misc/runekey.wav"; + if (self.spawnflags & TF_FLARE_OFF) + { + precache_model("progs/end1.mdl"); + setmodel(self, "progs/end1.mdl"); + } + if (self.spawnflags & 2) + { + precache_model2("progs/end2.mdl"); + setmodel(self, "progs/end2.mdl"); + } + if (self.spawnflags & 4) + { + precache_model2("progs/end3.mdl"); + setmodel(self, "progs/end3.mdl"); + } + if (self.spawnflags & 8) + { + precache_model2("progs/end4.mdl"); + setmodel(self, "progs/end4.mdl"); + } + self.touch = sigil_touch; + setsize(self, '-16 -16 -24', '16 16 32'); + StartItem(); +}; + +void() powerup_touch = +{ + if (other.classname != "player") + { + return; + } + if (other.health <= TF_FLARE_LIT) + { + return; + } + sprint(other, TF_FLARE_LIT, "You got the "); + sprint(other, TF_FLARE_LIT, self.netname); + sprint(other, TF_FLARE_LIT, "\n"); + if (deathmatch) + { + self.mdl = self.model; + if (self.classname == "item_artifact_invulnerability" || self.classname == "item_artifact_invisibility") + { + self.nextthink = time + 60 * 5; + } + else + { + self.nextthink = time + 60; + } + self.think = SUB_regen; + } + else + { + if (coop) + { + self.mdl = self.model; + if (self.classname == "item_artifact_invulnerability" || self.classname == "item_artifact_invisibility") + { + self.nextthink = time + 120 * 5; + } + else + { + self.nextthink = time + 120; + } + self.think = SUB_regen; + } + } + sound(other, 2, self.noise, TF_FLARE_OFF, TF_FLARE_OFF); + stuffcmd(other, "bf\n"); + self.solid = TF_FLARE_LIT; + other.items = other.items | self.items; + self.model = string_null; + if (self.classname == "item_artifact_envirosuit") + { + other.rad_time = TF_FLARE_OFF; + other.radsuit_finished = time + 30; + } + if (self.classname == "item_artifact_invulnerability") + { + other.invincible_time = TF_FLARE_OFF; + other.invincible_finished = time + 30; + } + if (self.classname == "item_artifact_invisibility") + { + other.invisible_time = TF_FLARE_OFF; + other.invisible_finished = time + 30; + } + if (self.classname == "item_artifact_super_damage") + { + other.super_time = TF_FLARE_OFF; + other.super_damage_finished = time + 30; + } + activator = other; + SUB_UseTargets(); +}; + +void() item_artifact_invulnerability = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = powerup_touch; + precache_model("progs/invulner.mdl"); + precache_sound("items/protect.wav"); + precache_sound("items/protect2.wav"); + precache_sound("items/protect3.wav"); + self.noise = "items/protect.wav"; + setmodel(self, "progs/invulner.mdl"); + self.netname = "Pentagram of Protection"; + self.items = 1048576; + setsize(self, '-16 -16 -24', '16 16 32'); + StartItem(); +}; + +void() item_artifact_envirosuit = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = powerup_touch; + precache_model("progs/suit.mdl"); + precache_sound("items/suit.wav"); + precache_sound("items/suit2.wav"); + self.noise = "items/suit.wav"; + setmodel(self, "progs/suit.mdl"); + self.netname = "Biosuit"; + self.items = 2097152; + setsize(self, '-16 -16 -24', '16 16 32'); + StartItem(); +}; + +void() item_artifact_invisibility = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = powerup_touch; + precache_model("progs/invisibl.mdl"); + precache_sound("items/inv1.wav"); + precache_sound("items/inv2.wav"); + precache_sound("items/inv3.wav"); + self.noise = "items/inv1.wav"; + setmodel(self, "progs/invisibl.mdl"); + self.netname = "Ring of Shadows"; + self.items = 524288; + setsize(self, '-16 -16 -24', '16 16 32'); + StartItem(); +}; + +void() item_artifact_super_damage = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.touch = powerup_touch; + precache_model("progs/quaddama.mdl"); + precache_sound("items/damage.wav"); + precache_sound("items/damage2.wav"); + precache_sound("items/damage3.wav"); + self.noise = "items/damage.wav"; + setmodel(self, "progs/quaddama.mdl"); + self.netname = "Quad Damage"; + self.items = 4194304; + setsize(self, '-16 -16 -24', '16 16 32'); + StartItem(); +}; + +void () BackpackTouch = +{ + local string s; + + if ((other.classname != "player")) + { + return; + } + if ((other.health <= 0)) + { + return; + } + if (other.button0) + { + return; + } + other.ammo_shells = (other.ammo_shells + self.ammo_shells); + other.ammo_nails = (other.ammo_nails + self.ammo_nails); + other.ammo_rockets = (other.ammo_rockets + self.ammo_rockets); + other.ammo_cells = (other.ammo_cells + self.ammo_cells); + bound_other_ammo (other); + sprint (other, 0, "You get "); + if (self.ammo_shells) + { + s = ftos (self.ammo_shells); + sprint (other, 0, s); + sprint (other, 0, " shells "); + } + if (self.ammo_nails) + { + s = ftos (self.ammo_nails); + sprint (other, 0, s); + sprint (other, 0, " nails "); + } + if (self.ammo_rockets) + { + s = ftos (self.ammo_rockets); + sprint (other, 0, s); + sprint (other, 0, " rockets "); + } + if (self.ammo_cells) + { + s = ftos (self.ammo_cells); + sprint (other, 0, s); + sprint (other, 0, " cells "); + } + if (((self.armorvalue && (other.playerclass == 9)) && (other.ammo_cells < other.maxammo_cells))) + { + s = ftos (self.armorvalue); + sprint (other, 0, s); + sprint (other, 0, " metal "); + other.ammo_cells = (other.ammo_cells + self.armorvalue); + if ((other.ammo_cells > other.maxammo_cells)) + { + other.ammo_cells = other.maxammo_cells; + } + } + sprint (other, 0, "\n"); + if (other.autodiscard) + { + TeamFortress_Discard (); + } + sound (other, 3, "weapons/lock4.wav", 1, 1); + stuffcmd (other, "bf\n"); + dremove (self); + self = other; + W_SetCurrentAmmo (); +}; + +void() DropBackpack = +{ + if (!(self.ammo_shells + self.ammo_nails + self.ammo_rockets + self.ammo_cells)) + { + return; + } + newmis = spawn(); + newmis.origin = self.origin - '0 0 24'; + newmis.ammo_shells = self.ammo_shells; + newmis.ammo_nails = self.ammo_nails; + newmis.ammo_rockets = self.ammo_rockets; + newmis.ammo_cells = self.ammo_cells; + newmis.armorvalue = self.armorvalue; + newmis.velocity_z = 300; + newmis.velocity_x = -100 + random() * 200; + newmis.velocity_y = -100 + random() * 200; + newmis.flags = 256; + newmis.solid = TF_FLARE_OFF; + newmis.movetype = 6; + setmodel(newmis, "progs/backpack.mdl"); + setsize(newmis, '-16 -16 0', '16 16 56'); + newmis.touch = BackpackTouch; + newmis.nextthink = time + 120; + newmis.think = SUB_Remove; +}; + diff --git a/medic.pqc b/medic.pqc new file mode 100644 index 0000000..8a5edc4 --- /dev/null +++ b/medic.pqc @@ -0,0 +1,127 @@ + +// Medic's self heal function + +void () HealSelf = +{ + local entity te; + local float healed; + + // Only medic's can heal themselves + if (self.playerclass != 5) + return; + + // Costs 1 type 2 gren + if (self.no_grenades_2 < 1) + { + sprint(self, 2, "Not enough type 2 grenades... get more\n"); + return; + } + + healed = 0; + + // Leg shots + if ((self.leg_damage > 0)) + { + sprint (self, 2, "Your leg wound has been healed!\n"); + self.leg_damage = 0; + TeamFortress_SetSpeed (self); + healed = 1; + } + + // Concs + te = find (world, classname, "timer"); + while ((((te.owner != self) || (te.think != ConcussionGrenadeTimer)) && (te != world))) + { + te = find (te, classname, "timer"); + } + if ((te != world)) + { + stuffcmd (self, "v_idlescale 0\n"); + sprint (self, 2, "you have been healed of your concussion\n"); + dremove (te); + healed = 1; + } + + // Gas + if ((self.tfstate & 16384)) + { + te = find (world, classname, "timer"); + while ((((te.owner != self) || (te.think != HallucinationTimer)) && (te != world))) + { + te = find (te, classname, "timer"); + } + if ((te != world)) + { + stuffcmd (self, "v_idlescale 0\n"); + self.tfstate = (self.tfstate - (self.tfstate & 16384)); + sprint (self, 2, "you have been healed of your hallucinations\n"); + dremove (te); + healed = 1; + } + } + + // Tranq + if ((self.tfstate & 32768)) + { + te = find (world, classname, "timer"); + while ((((te.owner != self) || (te.think != TranquiliserTimer)) && (te != world))) + { + te = find (te, classname, "timer"); + } + if ((te != world)) + { + self.tfstate = (self.tfstate - (self.tfstate & 32768)); + TeamFortress_SetSpeed (self); + stuffcmd (self, "v_cshift 0 0 0 0\n"); + sprint (self, 2, "you have been healed of your tranquilisation\n"); + dremove (te); + healed = 1; + } + } + + // Flash + if ((self.FlashTime > 0)) + { + te = find (world, netname, "flashtimer"); + while ((((te.owner != self) || (te.classname != "timer")) && (te != world))) + { + te = find (te, netname, "flashtimer"); + } + if ((te != world)) + { + stuffcmd (self, "v_cshift 0 0 0 0\n"); + dremove (te); + } + self.FlashTime = 0; + healed = 1; + } + + // Flames + if ((self.numflames > 0)) + { + self.numflames = 0; + sprint (self, 2, "The flames have been doused!\n"); + healed = 1; + } + + if (healed == 0) + { + sprint(self, 2, "You have nothing to cure.\n"); + } + else + { + self.no_grenades_2 = self.no_grenades_2 - 1; + + WriteByte(4, 23); + WriteByte(4, 11); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, TF_FLARE_OFF); + + sound (self, 3, "items/r_item2.wav", 1, 1); + + //sound (self, 1, "items/r_item1.wav", 1, 1); + //SpawnBlood (self.origin, 20); + } +} \ No newline at end of file diff --git a/menu.pqc b/menu.pqc new file mode 100644 index 0000000..1048fe4 --- /dev/null +++ b/menu.pqc @@ -0,0 +1,2233 @@ +.float oldcurrentammo; +void () ConcussionGrenadeTimer; +void () HallucinationTimer; +void () TranquiliserTimer; +float (entity obj,entity builder) CheckArea; +float (float v) anglemod; +void (entity targ,entity inflictor,entity attacker,float damage,float T_flags,float T_AttackType) TF_T_Damage; +void () W_SetCurrentAmmo; +void (entity p) bound_other_ammo; +float (float tno, float autoteam) TeamFortress_TeamSet; +void (entity p) TeamFortress_SetSkin; +float (float tno) TeamFortress_TeamGetColor; +void () TeamFortress_ChangeClass; +void (float type) TeamFortress_DropAmmo; +void (entity p) TeamFortress_SetSpeed; +void (entity inflictor,entity attacker,float damage,entity ignore) T_RadiusDamage; +void (float inp) Menu_DropStuff_Input; +void (float inp) Menu_Taunt_Input; +float () TeamFortress_TeamPutPlayerInTeam; +float (float tno) TeamFortress_TeamIsCivilian; +void (float class) TeamFortress_SpyChangeSkin; +void (float teamno) TeamFortress_SpyChangeColor; +void (float objtobuild) TeamFortress_Build; +void (float _p_9330) TeamFortress_SpyFeignDeath; +void (entity spy) Spy_RemoveDisguise; +void () lvl1_sentry_stand; +void () lvl2_sentry_stand; +void () lvl3_sentry_stand; +float (float tno) TeamFortress_TeamGetNoPlayers; +void (float menu_no) DisplayMenu; +void () Menu_Team; +void () Menu_Class; +void () Menu_Drop; +void () Menu_Intro; +void () PlayerObserverMode; +void () Menu_ClassHelp; +void () Menu_ClassHelp2; +void () Menu_StuffClassHelp; +void (float inp) Menu_ClassHelp_Input; +void () Menu_DoBindings; +void () Menu_ShowBindings1; +void () Menu_ShowBindings2; +void () Menu_RepeatHelp; +void () Menu_Spy; +void () Menu_Spy_Skin; +void () Menu_Spy_Color; +void (float inp) Menu_Spy_Input; +void (float inp) Menu_Spy_Skin_Input; +void (float inp) Menu_Spy_Color_Input; +void () Menu_Engineer; +void () Menu_EngineerFix_Dispenser; +void () Menu_EngineerFix_SentryGun; +void (float inp) Menu_Engineer_Input; +void (float inp) Menu_EngineerFix_Dispenser_Input; +void (float inp) Menu_EngineerFix_SentryGun_Input; +//void () Menu_EngineerFix_Tesla; +//void (float inp) Menu_EngineerFix_Tesla_Input; +void () Menu_Dispenser; +void (float inp) Menu_Dispenser_Input; +void (entity pl,string s1) CenterPrint; +void (entity pl,string s1,string s2) CenterPrint2; +void () Menu_DropStuff; +void () Menu_Taunt; +void () Menu_Yell; +void (float inp) Menu_Yell_Input; +#ifdef clan_progs +void () Menu_Clan_Prematch; +void (float inp) Menu_Clan_Prematch_Input; +#endif + +void() ResetMenu = +{ + if (self.StatusBarSize == TF_FLARE_LIT) + { + CenterPrint(self, "\n"); + } + else + { + self.StatusRefreshTime = time + 0.1; + } + self.menu_count = 25; + self.current_menu = TF_FLARE_OFF; +}; + +void () Player_Menu = +{ + + if ((self.menu_count > 25)) + { + self.menu_count = 0; + } + else + { + self.menu_count = (self.menu_count + 1); + return; + } +#ifdef clan_progs + if (self.current_menu == MENU_CLAN_PREMATCH) + { + Menu_Clan_Prematch (); + self.current_menu = 1; + } + else + { +#endif + if ((self.current_menu == 5)) + { + Menu_Intro (); + self.current_menu = 1; + } + else + { + if ((self.current_menu == 6)) + { + Menu_ClassHelp (); + if ((self.menu_displaytime > 8)) + { + self.current_menu = 1; + } + else + { + self.menu_displaytime = (self.menu_displaytime + 1); + } + } + else + { + if ((self.current_menu == 7)) + { + Menu_ClassHelp2 (); + if ((self.menu_displaytime > 5)) + { + self.current_menu = 1; + } + else + { + self.menu_displaytime = (self.menu_displaytime + 1); + } + } + else + { + if (self.current_menu == 10) + { + Menu_ShowBindings1(); + if (self.menu_displaytime > 8) + { + self.current_menu = TF_FLARE_OFF; + } + else + { + self.menu_displaytime = self.menu_displaytime + TF_FLARE_OFF; + } + } + else + { + if (self.current_menu == 11) + { + Menu_ShowBindings2(); + if (self.menu_displaytime > 8) + { + self.current_menu = TF_FLARE_OFF; + } + else + { + self.menu_displaytime = self.menu_displaytime + TF_FLARE_OFF; + } + } + else + { + if (self.current_menu == 4) + { + Menu_Drop(); + } + else + { + if (self.current_menu == 20) + { + Menu_DropStuff(); + } + else + { + if (self.current_menu == 21) + { + Menu_Taunt(); + } + else + { + if (self.current_menu == 22) + { + Menu_Yell(); + } + else + { + if (self.current_menu == 12) + { + Menu_Spy(); + } + else + { + if (self.current_menu == 13) + { + Menu_Spy_Skin(); + } + else + { + if (self.current_menu == 14) + { + Menu_Spy_Color(); + } + else + { + if (self.current_menu == 15) + { + Menu_Engineer(); + } + else + { + if (self.current_menu == 16) + { + Menu_EngineerFix_Dispenser(); + } + else + { + if (self.current_menu == 17) + { + Menu_EngineerFix_SentryGun(); + } + else + { + if (self.current_menu == 19) + { + Menu_Dispenser(); + } + else + { + if (self.current_menu == 8) + { + Menu_RepeatHelp(); + self.current_menu = TF_FLARE_OFF; + } + else + { + if (self.current_menu == 9) + { + Menu_DoBindings(); + } + else + { + if (self.team_no == TF_FLARE_LIT && teamplay && self.lives != TF_FLARE_LIT) + { + self.current_menu = 2; + Menu_Team(); + } + else + { + if ( (self.playerclass == TF_FLARE_LIT && self.lives != TF_FLARE_LIT) || (self.current_menu == 3) ) + { + self.current_menu = 3; + Menu_Class(); + } + else + { + self.current_menu = TF_FLARE_LIT; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +#ifdef clan_progs + } +#endif +}; + +void(float menu_no) DisplayMenu = +{ + self.current_menu = menu_no; + if (menu_no == 2) + { + Menu_Team(); + } + else + { + if (menu_no == 3) + { + Menu_Class(); + } + } +}; + +void () Menu_Team = +{ + local string one; + local string two; + local string getversion; + + one = "ÍåçáÔÆ "; + two = "‘\n\n"; + getversion = infokey(world, "MegaTF"); + if (((toggleflags & 64) && teamplay)) + { + if (TeamFortress_TeamPutPlayerInTeam ()) + { + return; + } + } + if ((team_menu_string != string_null)) + { + CenterPrint4 (self, one, getversion, two, team_menu_string); + return; + } + if ((CTF_Map == 1)) + { + CenterPrint4 (self, one, getversion, two, "=== Choose your team ===\n\n“.. Blue Team \n”.. Red Team \n\n\n\n™.. Bind my keys for me!\n\nFor full details on this patch:\nhttp://www.telefragged.com/teamfortress/\n"); + } + else + { + if ((number_of_teams == 1)) + { + CenterPrint4 (self, one, getversion, two, "=== Choose your team ===\n\n“.. Team One \n"); + } + else + { + if ((number_of_teams == 2)) + { + CenterPrint4 (self, one, getversion, two, "=== Choose your team ===\n\n“.. Team One \n”.. Team Two \n \n \n—.. Auto team \n"); + } + else + { + if ((number_of_teams == 3)) + { + CenterPrint4 (self, one, getversion, two, "=== Choose your team ===\n\n“.. Team One \n”.. Team Two \n•.. Team Three\n \n—.. Auto team \n"); + } + else + { + CenterPrint4 (self, one, getversion, two, "=== Choose your team ===\n\n“.. Team One \n”.. Team Two \n•.. Team Three\n–.. Team Four \n—.. Auto team \n"); + } + } + } + } +}; + +void(float inp) Menu_Team_Input = +{ + if (inp == 5) + { + TeamFortress_TeamPutPlayerInTeam(); + } + else + { + if (inp <= number_of_teams && inp > TF_FLARE_LIT) + { + TeamFortress_TeamSet(inp, 0); + } + else + { + if (number_of_teams == TF_FLARE_LIT && inp <= 4) + { + TeamFortress_TeamSet(inp, 0); + } + else + { + if (inp == 7) + { + self.current_menu = 9; + } + else + { + if (inp == 8) + { + TeamFortress_TeamPutPlayerInTeam(); + } + } + } + } + } + ResetMenu(); + self.impulse = TF_FLARE_LIT; + + // autoexec [map].cfg + stuffcmd(self, "exec "); + stuffcmd(self, mapname); + stuffcmd(self, ".cfg\n"); +}; + +void() Menu_Class = +{ + local entity AD; + AD = find(world, classname, "info_tfdetect"); + if (AD) + { + if (self.team_no == TF_FLARE_OFF) + { + if (AD.noise1 != string_null) + { + CenterPrint(self, AD.noise1); + return; + } + } + else + { + if (self.team_no == 2) + { + if (AD.noise2 != string_null) + { + CenterPrint(self, AD.noise2); + return; + } + } + else + { + if (self.team_no == 3) + { + if (AD.noise3 != string_null) + { + CenterPrint(self, AD.noise3); + return; + } + } + else + { + if (self.team_no == 4) + { + if (AD.noise4 != string_null) + { + CenterPrint(self, AD.noise4); + return; + } + } + } + } + } + } + if (TeamFortress_TeamIsCivilian(self.team_no)) + { + CenterPrint(self, "Your team can only be Civilians.\n"); + } + else + { + if (spy_off == TF_FLARE_OFF) + { + CenterPrint(self, "=== Choose your class ===\n\n“.. Scout \n”.. Sniper \n•.. Soldier \n–.. Demoman \n—.. Medic \n˜.. Hwguy \n™.. Pyro \n›.. Engineer\n’.. Randompc\n"); + } + else + { + CenterPrint(self, "=== Choose your class ===\n\n“‘.. Scout \n”‘.. Sniper \n•‘.. Soldier \n–‘.. Demoman \n—‘.. Medic \n˜‘.. Hwguy \n™‘.. Pyro \nš‘.. Spy \n›‘.. Engineer\n’‘.. Randompc\n"); + } + } +}; + +void(float inp) Menu_Class_Input = +{ + if (inp > 10 || inp < TF_FLARE_OFF) + { + return; + } + self.impulse = inp + 100; + TeamFortress_ChangeClass(); + ResetMenu(); + //if (TF_FLARE_OFF) + if (self.oldcurrentammo != 1) + { + self.current_menu = 6; + } + //else + //{ + // self.current_menu = TF_FLARE_OFF; + //} + self.menu_displaytime = TF_FLARE_LIT; + self.impulse = TF_FLARE_LIT; +}; + +void() Menu_Drop = +{ + if ((self.playerclass == 9)) + { + if (sr_dropgrens) + { + CenterPrint (self, "Drop or Make: \n“.. Shells \n”.. Nails \n•.. Rockets \n–.. Cells \n—.. Type 1 Grenade \n˜.. Type 2 Grenade \n™.. Nothing \n\n"); + } + else + { + CenterPrint (self, "Drop or Make: \n“.. Shells \n”.. Nails \n•.. Rockets \n–.. Cells \n—.. Nothing \n\n"); + } + } + else + { + if (sr_dropgrens) + { + CenterPrint (self, "Drop: \n“.. Shells \n”.. Nails \n•.. Rockets \n–.. Cells \n—.. Type 1 Grenade \n˜.. Type 2 Grenade \n™.. Nothing \n\n"); + } + else + { + CenterPrint (self, "Drop: \n“.. Shells \n”.. Nails \n•.. Rockets \n–.. Cells \n—.. Nothing \n\n"); + } + } +}; + +void() Menu_RepeatHelp = +{ + local string tfhelp; + local string class_help; // if you have class help off you probably don't want intro menu + + class_help = infokey (self, "ch"); + if (class_help == string_null) + class_help = infokey (self, "classhelp"); + + tfhelp = infokey(self, "tf_help"); + + if ( (tfhelp != "off") && (class_help != "off")) + { + CenterPrint2(self, "Press š to see this help again\n", "New Command: 'mega' for Mega-TF Menu\n"); + } +}; + +void (float _p_815) Menu_Drop_Input = +{ + + if (sr_dropgrens) + { + if (((_p_815 > 0) && (_p_815 < 7))) + { + TeamFortress_DropAmmo (_p_815); + } + if (((_p_815 > 0) && (_p_815 < 8))) + { + ResetMenu (); + } + } + else + { + if (((_p_815 > 0) && (_p_815 < 5))) + { + TeamFortress_DropAmmo (_p_815); + } + if (((_p_815 > 0) && (_p_815 < 6))) + { + ResetMenu (); + } + } + self.impulse = 0; +}; + +void(float inp) Menu_DoBindings_Input = +{ + if (inp < 4) + { + self.impulse = TF_FLARE_LIT; + if (inp == TF_FLARE_OFF) + { + stuffcmd(self, "bind q \"impulse 23\"\n"); + stuffcmd(self, "bind e \"impulse 22\"\n"); + stuffcmd(self, "bind r \"+gren1\"\n"); + stuffcmd(self, "bind f \"+gren2\"\n"); + stuffcmd(self, "bind v \"detpipe\"\n"); + stuffcmd(self, "bind c \"dropammo\"\n"); + stuffcmd(self, "bind x \"scan50\"\n"); + stuffcmd(self, "bind g \"showclasses\"\n"); + stuffcmd(self, "bind z \"inv\"\n"); + self.menu_count = 25; + self.current_menu = 10; + self.menu_displaytime = TF_FLARE_LIT; + return; + } + else + { + if (inp == 2) + { + stuffcmd(self, "bind s \"impulse 23\"\n"); + stuffcmd(self, "bind x \"impulse 22\"\n"); + stuffcmd(self, "bind d \"+gren1\"\n"); + stuffcmd(self, "bind c \"+gren2\"\n"); + stuffcmd(self, "bind f \"detpipe\"\n"); + stuffcmd(self, "bind v \"dropammo\"\n"); + stuffcmd(self, "bind b \"scan50\"\n"); + stuffcmd(self, "bind g \"showclasses\"\n"); + stuffcmd(self, "bind n \"inv\"\n"); + self.menu_count = 25; + self.current_menu = 11; + self.menu_displaytime = TF_FLARE_LIT; + return; + } + } + ResetMenu(); + } +}; + +void(float inp) Menu_Input = +{ +#ifdef clan_progs + if (self.current_menu == MENU_CLAN_PREMATCH) + { + Menu_Clan_Prematch_Input(inp); + } + else + { +#endif + if (self.current_menu == 2) + { + Menu_Team_Input(inp); + } + else + { + if (self.current_menu == 3) + { + Menu_Class_Input(inp); + } + else + { + if (self.current_menu == 4) + { + Menu_Drop_Input(inp); + } + else + { + if (self.current_menu == 12) + { + Menu_Spy_Input(inp); + } + else + { + if (self.current_menu == 13) + { + Menu_Spy_Skin_Input(inp); + } + else + { + if (self.current_menu == 14) + { + Menu_Spy_Color_Input(inp); + } + else + { + if (self.current_menu == 15) + { + Menu_Engineer_Input(inp); + } + else + { + if (self.current_menu == 16) + { + Menu_EngineerFix_Dispenser_Input(inp); + } + else + { + if (self.current_menu == 17) + { + Menu_EngineerFix_SentryGun_Input(inp); + } + else + { + if (self.current_menu == 19) + { + Menu_Dispenser_Input(inp); + } + else + { + if (self.current_menu == 6) + { + Menu_ClassHelp_Input(inp); + } + else + { + if (self.current_menu == 20) + { + Menu_DropStuff_Input(inp); + } + else + { + if (self.current_menu == 21) + { + Menu_Taunt_Input(inp); + } + else + { + if (self.current_menu == 22) + { + Menu_Yell_Input(inp); + } + } + } + } + } + } + } + } + } + } + } + } + } + } +#ifdef clan_progs + } +#endif +}; + +void() Menu_DropStuff = +{ + CenterPrint(self, "€ Mega-TF Menu ‚\n\n€“‚ Drop #1 \n€”‚ Toaster \n€•‚ Drop #3 \n€–‚ Holograph \n€—‚ NightVision\n€˜‚ Lay Mode \n€™‚ Taunt Menu \n€š‚ Yell Menu \n€9‚ Nothing \n"); +}; + +void(float inp) Menu_DropStuff_Input = +{ + if (inp == TF_FLARE_OFF) + { + stuffcmd(self, "drop1\n"); + } + else + { + if (inp == 2) + { + stuffcmd(self, "drop2\n"); + } + else + { + if (inp == 3) + { + stuffcmd(self, "drop3\n"); + } + else + { + if (inp == 4) + { + stuffcmd(self, "holo\n"); + } + else + { + if (inp == 5) + { + stuffcmd(self, "ir\n"); + } + else + { + if (inp == 6) + { + stuffcmd(self, "lay\n"); + } + else + { + if (inp == 7) + { + ResetMenu(); + self.impulse = TF_FLARE_LIT; + stuffcmd(self, "taunt\n"); + } + else + { + if (inp == 8) + { + ResetMenu(); + self.impulse = TF_FLARE_LIT; + stuffcmd(self, "yell\n"); + } + else + { + if (inp > 8) + { + ResetMenu(); + } + } + } + } + } + } + } + } + } + ResetMenu(); + self.impulse = TF_FLARE_LIT; +}; + +void() Menu_Taunt = +{ + CenterPrint(self, "€ Taunt Menu ‚\n\n€“‚ R U Threat'n Me? \n€”‚ Come out w/ pants dwn\n€•‚ Hey! hehheh... \n €–‚ Do U want 2 C my bHole?\n€—‚ Call 911! \n€˜‚ Kick'm in the Nads! \n€™‚ I do the a$$ kik'n...\n€š‚ Pathetic Looser! \n€›‚ Nothing \n"); +}; + +void() Menu_Yell = +{ + CenterPrint(self, "€ Yell Menu ‚\n\n€“‚ Cover Me! \n€”‚ Over Here! \n€•‚ This Way! \n €–‚ Follow Me! \n€—‚ Incoming! \n€˜‚ Holdup! \n€™‚ Go Go Go! \n€š‚ Lookout! \n€›‚ Fire in the hole! \n"); +}; + +void(float inp) Menu_Taunt_Input = +{ + if (inp == TF_FLARE_OFF) + { + stuffcmd(self, "bic\n"); + } + else + { + if (inp == 2) + { + stuffcmd(self, "impulse 250\n"); + } + else + { + if (inp == 3) + { + stuffcmd(self, "hey\n"); + } + else + { + if (inp == 4) + { + stuffcmd(self, "bhole\n"); + } + else + { + if (inp == 5) + { + sound(self, TF_FLARE_OFF, "speech/call911.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp == 6) + { + sound(self, TF_FLARE_OFF, "speech/kicknads.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp == 7) + { + sound(self, TF_FLARE_OFF, "speech/idoasskk.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp == 8) + { + sound(self, TF_FLARE_OFF, "speech/pathetic.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp > 8) + { + ResetMenu(); + } + } + } + } + } + } + } + } + } + ResetMenu(); + self.impulse = TF_FLARE_LIT; +}; + +void(float inp) Menu_Yell_Input = +{ + WriteByte(4, 23); + WriteByte(4, 11); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, TF_FLARE_OFF); + + if (inp == TF_FLARE_OFF) + { + sound(self, TF_FLARE_OFF, "speech/yell/coverme.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp == 2) + { + sound(self, TF_FLARE_OFF, "speech/yell/overhere.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp == 3) + { + sound(self, TF_FLARE_OFF, "speech/yell/thisway.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp == 4) + { + sound(self, TF_FLARE_OFF, "speech/yell/followme.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp == 5) + { + sound(self, TF_FLARE_OFF, "speech/yell/incomng.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp == 6) + { + sound(self, TF_FLARE_OFF, "speech/yell/holdup.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp == 7) + { + sound(self, TF_FLARE_OFF, "speech/yell/gogogo.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp == 8) + { + sound(self, TF_FLARE_OFF, "speech/yell/lookout.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp == 9) + { + sound(self, TF_FLARE_OFF, "speech/yell/firehole.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + if (inp > 9) + { + ResetMenu(); + } + } + } + } + } + } + } + } + } + } + ResetMenu(); + self.impulse = TF_FLARE_LIT; +}; + +void() Menu_Intro = +{ +// we don't need it.. + /*local string mtf_ver; + local string mtf_website; + mtf_ver = #mtf_Ver; // #mtf_Ver defined in defs.pqc now.. + mtf_website = #mtf_Website; + + CenterPrint (self, "Welcome to MegaTeamFortress v", mtf_ver); +#ifdef clan_progs + CenterPrint (self, "CE"); +#endif + CenterPrint (self, "\n\nCreated by TeamFortress Software\nUpdated by Up2\n======================================\n", mtf_website); +*/ +}; + +void () Menu_ClassHelp = +{ + local string serverinfo_tfhelp; + local string class_help; + + class_help = infokey (self, "ch"); + if (class_help == string_null) + class_help = infokey (self, "classhelp"); + + serverinfo_tfhelp = infokey (self, "tf_help"); + + if ((serverinfo_tfhelp != "off") && (class_help != "off")) { + + if ((self.menu_displaytime < 20)) + { + if ((self.playerclass == 1)) + { + CenterPrint (self, "ÁÉÒÓÃÏÕÔ player details:\n ÷åáðïîóº                 \n “‘ axe \n ”‘ shotgun \n –‘ mac-10 \n çòåîáäåóº             \n +gren“º flash grenade \n +gren”º conc grenade \n äòïðóº \n drop“º flash mine \n drop•º disarm detpack \n ãïííáîäóº            \n specialº jetpack boost \n"); + } + else + { + if ((self.playerclass == 2)) + { + CenterPrint (self, "ÓÎÉÐÅÒ player details: \n ÷åáðïîóº                 \n “‘ axe \n ”‘ sniper rifle \n •‘ auto rifle \n çòåîáäåóº             \n +gren“º normal grenade \n +gren”º flare \n äòïðóº \n drop“º alarm \n drop•º call airstrike \n ãïííáîäóº            \n specialº autozoom \n"); + } + else + { + if ((self.playerclass == 3)) + { + CenterPrint (self, "ÓÏÌÄÉÅÒ player details:\n ÷åáðïîóº                 \n “‘ axe \n ”‘ shotgun \n •‘ super shotgun \n  ™‘ rocket launcher \n çòåîáäåóº             \n +gren“º normal grenade \n +gren”º nail grenade \n äòïðóº \n drop“º spike trap \n drop•º proximity grenade\n ãïííáîäóº            \n specialº reload \n"); + } + else + { + if ((self.playerclass == 4)) + { + CenterPrint (self, "ÄÅÍÏÍÁÎ player details: \n ÷åáðïîóº                 \n “‘ axe \n ”‘ shotgun \n —‘ long-range gren. \n ˜‘ grenade launcher \n ™‘ pipebomb launcher \n çòåîáäåóº             \n +gren“º normal grenade \n +gren”º MIRV grenade \n äòïðóº \n drop“º launch airMIRV \n ãïííáîäóº            \n specialº detonate pipes \n det—º  5 second detpack \n det”’º 20 second detpack\n det—’º 50 second detpack\n"); + } + else + { + if ((self.playerclass == 5)) + { + CenterPrint (self, "ÍÅÄÉà player details: \n ÷åáðïîóº                 \n “‘ bioaxe \n ”‘ shotgun \n •‘ super shotgun \n —‘ super nailgun \n çòåîáäåóº             \n +gren“º normal grenade \n +gren”º conc grenade \n äòïðóº \n drop“º infected syringe \n drop•º heal self \n"); + } + else + { + if ((self.playerclass == 6)) + { + CenterPrint (self, "È×ÇÕÙ player details: \n ÷åáðïîóº                 \n “‘ axe \n ”‘ shotgun \n •‘ super shotgun \n ™‘ assault cannon \n ™‘ 20mm cannon \n çòåîáäåóº             \n +gren“º normal grenade \n +gren”º MIRV grenade \n äòïðóº \n drop“º spike trap \n"); + } + else + { + if ((self.playerclass == 7)) + { + CenterPrint (self, "ÐÙÒÏ player details: \n ÷åáðïîóº                 \n “‘ axe \n ”‘ shotgun \n ˜‘ flame-thrower \n ™‘ incendiary cannon \n çòåîáäåóº             \n +gren“º normal grenade \n +gren”º napalm grenade \n äòïðóº \n drop“º lava pool \n"); + } + else + { + if ((self.playerclass == 8)) + { + if (spycam) + { + CenterPrint (self, "ÓÐÙ player details: \n ÷åáðïîóº                 \n “‘ blade \n ”‘ tranquilizer gun \n •‘ super shotgun \n –‘ mac-10 \n š‘ grappling hook \n çòåîáäåóº             \n +gren“º normal grenade \n +gren”º gas grenade \n äòïðóº \n drop“º ammo trap \n  drop•º spy camera \n ãïííáîäóº \n specialº disguise menu \n"); + } + else + { + CenterPrint (self, "ÓÐÙ player details: \n ÷åáðïîóº                 \n “‘ blade \n ”‘ tranquilizer gun \n •‘ super shotgun \n –‘ mac-10 \n š‘ grappling hook \n çòåîáäåóº             \n +gren“º normal grenade \n +gren”º gas grenade \n äòïðóº \n drop“º ammo trap \n ãïííáîäóº \n specialº disguise menu \n"); + } + } + else + { + if ((self.playerclass == 9)) + { + CenterPrint (self, "ÅÎÇÉÎÅÅÒ player details:\n ÷åáðïîóº                 \n “‘ wrench \n ”‘ laser gun \n •‘ super shotgun \n çòåîáäåóº             \n +gren“º normal grenade \n +gren”º EMP grenade \n äòïðóº \n drop“º magnet mine \n drop•º laser drone \n ãïííáîäóº \n specialº build menu \n dropammoº make ammo menu\n"); + } + } + } + } + } + } + } + } + } + } + else + { + if ((self.playerclass == 1)) + { + CenterPrint (self, "ÇÒÅÎÁÄÅÓ: \nFlash Grenade \nConcussion Grenade \n\nÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ: \nScanner: scan10,scan50,scan250\nJetJump: jetjump\ndrop1 : drop a Flash mine\n\n\nPress š for alias help\n"); + } + else + { + if ((self.playerclass == 2)) + { + CenterPrint (self, "ÇÒÅÎÁÄÅÓ: \nHand Grenade \nFlare \n\nÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ: \nautozoom : Toggle Rifle Autozooming\nSet an Alarm : drop1 \n Call AirStrike : airstrike\n SpotLight : +spot \n\nPress š for alias help\n"); + } + else + { + if ((self.playerclass == 3)) + { + CenterPrint (self, "ÇÒÅÎÁÄÅÓ: \nHand Grenade \nNail Grenade \n\nÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ: \nDrop a Spike Trap : Drop1\ndrop3 : Set a ProxiMine! \n\n\nPress š for alias help\n"); + } + else + { + if ((self.playerclass == 4)) + { + CenterPrint (self, "ÇÒÅÎÁÄÅÓ: \nHand Grenade \nMirv Grenade \n\nÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ: \nThe Detpack : det5,det20,det50\nDetonate Pipebombs : detpipe \nAir-MIRV : drop1 \n\nPress š for alias help\n"); + } + else + { + if ((self.playerclass == 5)) + { + CenterPrint (self, "ÇÒÅÎÁÄÅÓ: \nHand Grenade \nConcussion Grenade \n\nÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ: \nHeal Yourself : drop3 or heal\n\n\nPress š for alias help\n"); + } + else + { + if ((self.playerclass == 6)) + { + CenterPrint (self, "ÇÒÅÎÁÄÅÓ: \nHand Grenade \nMirv Grenade \n\nÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ: \nSet an Spike Trap : drop1 \n\n\nPress š for alias help\n"); + } + else + { + if ((self.playerclass == 7)) + { + CenterPrint (self, "ÇÒÅÎÁÄÅÓ: \nHand Grenade \nNapalm Grenade \n\nÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ: \nDrop a lava pool : drop1 \n\n\nPress š for alias help\n"); + } + else + { + if ((self.playerclass == 8)) + { + CenterPrint (self, "ÇÒÅÎÁÄÅÓ: \nHand Grenade \nHallucinogen Grenade\n\nÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ: \nGo Undercover : disguise\nSet an Ammo Trap : drop1 \n\nPress š for alias help\n"); + } + else + { + if ((self.playerclass == 9)) + { + CenterPrint (self, "ÇÒÅÎÁÄÅÓ: \nHand Grenade \nEMP Grenade \n\nÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ: \nStart Building : build \n Set a Mag Trap : drop1 \n\n\nPress š for alias help\n"); + } + } + } + } + } + } + } + } + } + } + } +}; + +void () Menu_StuffClassHelp = +{ + local string _l_902; + + _l_902 = infokey (self, "tf_help"); + if ((_l_902 != "off")) + { + if ((self.playerclass == 1)) + { + sprint (self, 2, "ÓÃÏÕÔ Details:\n×ÅÁÐÏÎÓ:\n 2.. Shotgun\n 4.. MAC-10 \n"); + sprint (self, 2, "ÇÒÅÎÁÄÅÓ:\n Concussion Grenade\n Flare\nÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ:\n"); + sprint (self, 2, "Scanner: scan10,scan30,scan100\nJetJump: jetjump\ndrop1 : drop a Flash mine\n\n\n"); + } + else + { + if ((self.playerclass == 2)) + { + sprint (self, 2, "ÓÎÉÐÅÒ Details:\n\n×ÅÁÐÏÎÓ:\n 2.. Sniper Rifle/Auto Rifle\n"); + sprint (self, 2, "4.. MAC-10 \nÇÒÅÎÁÄÅÓ:\n Hand Grenade\n\n\nÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ:\n"); + sprint (self, 2, " autozoom : Toggle Scope Autozooming\n drop1 : drop an alarm mine\nairstrike : call an AirStrike\n +spot : Toggle SpotLight \n\n"); + } + else + { + if ((self.playerclass == 3)) + { + sprint (self, 2, "ÓÏÌÄÉÅÒ Details:\n\n×ÅÁÐÏÎÓ:\n 2.. Shotgun\n 3.. Super Shotgun\n"); + sprint (self, 2, " 7.. Rocket Launcher\nÇÒÅÎÁÄÅÓ:\n Hand Grenade\n Nail Grenade\n"); + sprint (self, 2, "ÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ:\n drop1 : Drop a Spike Trap \n drop3 : Set a ProxiMine! \n\n\n"); + } + else + { + if ((self.playerclass == 4)) + { + sprint (self, 2, "ÄÅÍÏÌÉÔÉÏÎÓ ÍÁÎ Details:\n\n×ÅÁÐÏÎÓ:\n 2.. Shotgun\n 5.. Long-range Grenades \n6.. Grenade Launcher \n7..Pipebomb Launcher\n"); + sprint (self, 2, "ÇÒÅÎÁÄÅÓ:\n Hand Grenade\n Mirv Grenade\n"); + sprint (self, 2, "ÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ:\n The Detpack : det5,det20,det50\n Detonate Pipebombs : detpipe\n drop1 : release an AirMIRV \n\n"); + } + else + { + if ((self.playerclass == 5)) + { + sprint (self, 2, "ÍÅÄÉà Details:\n\n×ÅÁÐÏÎÓ:\n 1.. Medikit/BioWeapon\n 2.. Shotgun\n 3.. Super Shotgun\n"); + sprint (self, 2, " 5.. Super Nailgun\nÇÒÅÎÁÄÅÓ:\n Hand Grenade\n Concussion Grenade\n"); + sprint (self, 2, "ÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ:\n Drop1 : drop an infected syringe\n\n\n"); + } + else + { + if ((self.playerclass == 6)) + { + sprint (self, 2, "ÈÅÁÖÙ ×ÅÁÐÏÎÓ ÇÕÙ Details:\n\n×ÅÁÐÏÎÓ:\n 2.. Shotgun\n 3.. Super Shotgun\n"); + sprint (self, 2, " 7.. Assault Cannon\nÇÒÅÎÁÄÅÓ:\n Hand Grenade\n"); + sprint (self, 2, " Mirv Grenade\nÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ:\n drop1 : set a spike trap\n\n\n"); + } + else + { + if ((self.playerclass == 7)) + { + sprint (self, 2, "ÐÙÒÏ Details:\n\n×ÅÁÐÏÎÓ:\n 2.. Shotgun\n 6.. Flamethrower\n 7.. Incendiary Cannon\n"); + sprint (self, 2, "ÇÒÅÎÁÄÅÓ:\n Hand Grenade\n Napalm Grenade\n"); + sprint (self, 2, "ÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ:\n None\n\n\n"); + } + else + { + if ((self.playerclass == 8)) + { + sprint (self, 2, "ÓÐÙ Details:\n\n×ÅÁÐÏÎÓ:\n 2.. Tranquiliser Gun\n 3.. Super Shotgun\n 4.. MAC-10 \n 8.. Grapple Hook \n"); + sprint (self, 2, "ÇÒÅÎÁÄÅÓ:\n Hand Grenade\n Hallucinogenic Grenade\n"); + sprint (self, 2, "ÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ:\n Go Undercover : disguise\n drop1 : drop an Ammo Trap\n\n"); + } + else + { + if ((self.playerclass == 9)) + { + sprint (self, 2, "ÅÎÇÉÎÅÅÒ Details:\n\n×ÅÁÐÏÎÓ:\n 1.. Spanner\n 2.. RailGun\n 3.. Super Shotgun\n"); + sprint (self, 2, "ÇÒÅÎÁÄÅÓ:\n Hand Grenade\n EMP Grenade\n"); + sprint (self, 2, "ÓÐÅÃÉÁÌ ÃÏÍÍÁÎÄÓ:\n Start Building : build\n Set a Mag Trap : drop1 \n\n\n"); + } + } + } + } + } + } + } + } + } + } +}; + + +void () Menu_ClassHelp2 = +{ + CenterPrint (self, "ÃÏÍÍÁÎÄÓ  \n inv œ Show inventory \n +gren1 œ Throw grenade 1 \n +gren2 œ Throw Grenade 2 \n reload œ Force a reload \n sbar_on œ Turn on status bar\n autoid_onœ Turn on auto ID \n dropammo œ drop some ammo \n discard œ drop unneeded ammo\n lay œ start lay mode \n drop1 œ drop item 1 \n drop2 œ throw a toaster \n drop3 œ drop item 2 \n mega œ Mega-TF Menu! \n dropflag œ drop the flag \n"); +}; + +void(float inp) Menu_ClassHelp_Input = +{ + if (inp == 8) + { + Menu_ClassHelp2(); + self.menu_count = 25; + self.current_menu = 7; + self.menu_displaytime = TF_FLARE_LIT; + self.impulse = TF_FLARE_LIT; + } +}; + +void() Menu_DoBindings = +{ + CenterPrint(self, "“.. Use keys: E R F V C Q X G Z\n”.. Use keys: S X D C F V B G N\n•.. Don't make bindings \n"); +}; + +void() Menu_ShowBindings1 = +{ + CenterPrint(self, "Ñ.. Flaginfo \nÅ.. Hook \nÒ.. Throw Gren 1 \nÆ.. Throw Gren 2 \nÖ.. Det. Pipebombs\nÃ.. Drop ammo \nØ.. Use Scanner \nÇ.. Showclasses \nÚ.. inventory \n"); +}; + +void() Menu_ShowBindings2 = +{ + CenterPrint(self, "Ó.. Flaginfo \nØ.. Hook \nÄ.. Throw Gren 1 \nÃ.. Throw Gren 2 \nÆ.. Det. Pipebombs\nÖ.. Drop ammo \nÂ.. Use Scanner \nÇ.. Showclasses \nÎ.. inventory \n"); +}; + +void() Menu_Spy = +{ + if (spyjumpoption) + { + if (self.is_feigning) + { + if (((self.undercover_team != 0) && (self.undercover_skin != 0))) + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Stop Feigning \n–.. Reset Skin and Color \n—.. Change Jump Style \n˜.. Nothing \n\n"); + } + else + { + if ((self.undercover_team != 0)) + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Stop Feigning \n–.. Reset Color \n—.. Change Jump Style \n˜.. Nothing \n\n"); + } + else + { + if ((self.undercover_skin != 0)) + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Stop Feigning \n–.. Reset Skin \n—.. Change Jump Style \n˜.. Nothing \n\n"); + } + else + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Stop Feigning \n—.. Change Jump Style \n˜.. Nothing \n\n"); + } + } + } + } + else + { + if (((self.undercover_team != 0) && (self.undercover_skin != 0))) + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Start Feigning \n–.. Reset Skin and Color \n—.. Change Jump Style \n˜.. Nothing \n\n"); + } + else + { + if ((self.undercover_team != 0)) + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Start Feigning \n–.. Reset Color \n—.. Change Jump Style \n˜.. Nothing \n\n"); + } + else + { + if ((self.undercover_skin != 0)) + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Start Feigning \n–.. Reset Skin \n—.. Change Jump Style \n˜.. Nothing \n\n"); + } + else + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Start Feigning \n—.. Change Jump Style \n˜.. Nothing \n\n"); + } + } + } + } + } + else + { + if (self.is_feigning) + { + if (((self.undercover_team != 0) && (self.undercover_skin != 0))) + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Stop Feigning \n–.. Reset Skin and Color \n—.. Nothing \n\n"); + } + else + { + if ((self.undercover_team != 0)) + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Stop Feigning \n–.. Reset Color \n—.. Nothing \n\n"); + } + else + { + if ((self.undercover_skin != 0)) + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Stop Feigning \n–.. Reset Skin \n—.. Nothing \n\n"); + } + else + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Stop Feigning \n–.. Nothing \n\n"); + } + } + } + } + else + { + if (((self.undercover_team != 0) && (self.undercover_skin != 0))) + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Start Feigning \n–.. Reset Skin and Color \n—.. Nothing \n\n"); + } + else + { + if ((self.undercover_team != 0)) + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Start Feigning \n–.. Reset Color \n—.. Nothing \n\n"); + } + else + { + if ((self.undercover_skin != 0)) + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Start Feigning \n–.. Reset Skin \n—.. Nothing \n\n"); + } + else + { + CenterPrint (self, "Action: \n“.. Change Skin \n”.. Change Color \n•.. Start Feigning \n–.. Nothing \n\n"); + } + } + } + } + } +}; + +void (float _p_955) Menu_Spy_Input = +{ + + if (((_p_955 == 1) || (_p_955 == 2))) + { + if ((self.effects & 12)) + { + sprint (self, 2, "You can't go undercover while glowing.\n"); + ResetMenu (); + self.impulse = 0; + return; + } + if ((self.is_unabletospy == 1)) + { + sprint (self, 2, "You can't go undercover right now.\n"); + ResetMenu (); + self.impulse = 0; + return; + } + } + if ((_p_955 == 1)) + { + Menu_Spy_Skin (); + self.menu_count = 25; + self.current_menu = 13; + self.menu_displaytime = 0; + self.impulse = 0; + } + else + { + if ((_p_955 == 2)) + { + Menu_Spy_Color (); + self.menu_count = 25; + self.current_menu = 14; + self.menu_displaytime = 0; + self.impulse = 0; + } + else + { + if ((_p_955 == 3)) + { + TeamFortress_SpyFeignDeath (0); + ResetMenu (); + self.impulse = 0; + } + else + { + if ((_p_955 == 4)) + { + Spy_RemoveDisguise (self); + ResetMenu (); + self.impulse = 0; + } + else + { + if ((_p_955 == 5)) + { + if (spyjumpoption) + { + if ((self.spy_regjump == 1)) + { + self.spy_regjump = 0; + sprint (self, 2, "Jump style now high\n"); + } + else + { + self.spy_regjump = 1; + sprint (self, 2, "Jump style now disguised\n"); + } + ResetMenu (); + self.impulse = 0; + } + } + else + { + if ((((_p_955 == 5) && !spyjumpoption) && ((self.undercover_team != 0) || (self.undercover_skin != 0)))) + { + ResetMenu (); + self.impulse = 0; + } + else + { + if (((_p_955 == 6) && ((self.undercover_team != 0) || (self.undercover_skin != 0)))) + { + ResetMenu (); + self.impulse = 0; + } + } + } + } + } + } + } +}; + +void() Menu_Spy_Skin = +{ + CenterPrint(self, "Change Skin to:\n“.. Scout \n”.. Sniper \n•.. Soldier \n–.. Demoman \n—.. Medic \n˜.. Hwguy \n™.. Pyro \nš.. Spy \n›.. Engineer\n\n"); +}; + +void(float inp) Menu_Spy_Skin_Input = +{ + if (inp < 10 && inp > TF_FLARE_LIT) + { + TeamFortress_SpyChangeSkin(inp); + ResetMenu(); + self.impulse = TF_FLARE_LIT; + } +}; + +void() Menu_Spy_Color = +{ + if (number_of_teams == TF_FLARE_LIT) + { + sprint(self, 2, "No Color changing allowed in deathmatch.\n"); + ResetMenu(); + self.impulse = TF_FLARE_LIT; + return; + } + if (number_of_teams == TF_FLARE_OFF) + { + CenterPrint(self, "=== Change Color to the Same Color as ===\n\n“.. Team One \n\n"); + } + else + { + if (number_of_teams == 2) + { + CenterPrint(self, "=== Change Color to the Same Color as ===\n\n“.. Team One \n”.. Team Two \n\n"); + } + else + { + if (number_of_teams == 3) + { + CenterPrint(self, "=== Change Color to the Same Color as ===\n\n“.. Team One \n”.. Team Two \n•.. Team Three\n\n"); + } + else + { + CenterPrint(self, "=== Change Color to the Same Color as ===\n\n“.. Team One \n”.. Team Two \n•.. Team Three\n–.. Team Four \n\n"); + } + } + } +}; + +void(float inp) Menu_Spy_Color_Input = +{ + if (inp >= TF_FLARE_OFF && inp <= number_of_teams) + { + TeamFortress_SpyChangeColor(inp); + ResetMenu(); + self.impulse = TF_FLARE_LIT; + } +}; + +void() Menu_Engineer = +{ + if (self.has_dispenser == TF_FLARE_OFF && self.has_sentry == TF_FLARE_OFF) + { + CenterPrint(self, "Action: \n“.. Remotely Detonate Dispenser \n”.. Remotely Detonate Sentry Gun\n–.. Nothing \n\n"); + } + else + { + if (self.has_dispenser && self.ammo_cells >= 130) + { + CenterPrint(self, "Action: \n“.. Remotely Detonate Dispenser \n”.. Build Sentry Gun \n–.. Nothing \n\n"); + } + else + { + if (self.has_dispenser) + { + CenterPrint(self, "Action: \n“.. Remotely Detonate Dispenser \n–.. Nothing \n\n"); + } + else + { + if (self.has_sentry && self.ammo_cells >= 100) + { + CenterPrint(self, "Action: \n“.. Build Ammo&Armor Dispenser \n”.. Remotely Detonate Sentry Gun\n–.. Nothing \n\n"); + } + else + { + if (self.has_sentry) + { + CenterPrint(self, "Action: \n”.. Remotely Detonate Sentry Gun\n–.. Nothing \n\n"); + } + else + { + if (self.ammo_cells >= 130) + { + CenterPrint(self, "Action: \n“.. Build Ammo&Armor Dispenser \n”.. Build Sentry Gun \n–.. Nothing \n\n"); + } + else + { + if (self.ammo_cells >= 100) + { + CenterPrint(self, "Action: \n“.. Build Ammo&Armor Dispenser \n–.. Nothing \n\n"); + } + else + { + ResetMenu(); + } + } + } + } + } + } + } +}; + +void(float inp) Menu_Engineer_Input = +{ + local entity te; + if (inp == TF_FLARE_OFF && (self.ammo_cells >= 100 || self.has_dispenser == TF_FLARE_OFF)) + { + if (self.has_dispenser) + { + te = find(world, classname, "building_dispenser"); + while (te) + { + if (te.real_owner == self) + { + deathmsg = 201; + T_RadiusDamage(te, te.real_owner, 140, world); + TF_T_Damage(te, world, world, 500, TF_FLARE_LIT, TF_FLARE_LIT); + } + te = find(te, classname, "building_dispenser"); + } + } + else + { + sound(self, 3, "items/repair.wav", TF_FLARE_OFF, TF_FLARE_OFF); + TeamFortress_Build(TF_FLARE_OFF); + } + ResetMenu(); + self.impulse = TF_FLARE_LIT; + } + else + { + if (inp == 2 && (self.ammo_cells >= 130 || self.has_sentry == TF_FLARE_OFF)) + { + if (self.has_sentry) + { + te = find(world, classname, "building_sentrygun"); + while (te) + { + if (te.real_owner == self) + { + TF_T_Damage(te, world, world, 500, TF_FLARE_LIT, TF_FLARE_LIT); + } + te = find(te, classname, "building_sentrygun"); + } + } + else + { + sound(self, 3, "items/repair.wav", TF_FLARE_OFF, TF_FLARE_OFF); + TeamFortress_Build(2); + } + ResetMenu(); + self.impulse = TF_FLARE_LIT; + } + else + { + if (inp == 4) + { + ResetMenu(); + self.impulse = TF_FLARE_LIT; + } + } + } +}; + +void() Menu_EngineerFix_Dispenser = +{ + CenterPrint(self, "Action: \n“‘.. Put Ammo into Dispenser \n”‘.. Put Armor into Dispenser \n•‘.. Repair Dispenser \n–‘.. Dismantle Dispenser \n—‘.. Nothing \n\n"); +}; + +void(float inp) Menu_EngineerFix_Dispenser_Input = +{ + local float metalcost; + local float am; + if (self.classname != "player" || self.building == world) + { + return; + } + if (inp == TF_FLARE_OFF) + { + am = 20 * 2; + if (am > self.ammo_shells) + { + am = self.ammo_shells; + } + if (am > 400 - self.building.ammo_shells) + { + am = 400 - self.building.ammo_shells; + } + self.ammo_shells = self.ammo_shells - am; + self.building.ammo_shells = self.building.ammo_shells + am; + am = 20 * 2; + if (am > self.ammo_nails) + { + am = self.ammo_nails; + } + if (am > 600 - self.building.ammo_nails) + { + am = 600 - self.building.ammo_nails; + } + self.ammo_nails = self.ammo_nails - am; + self.building.ammo_nails = self.building.ammo_nails + am; + am = 10 * 2; + if (am > self.ammo_rockets) + { + am = self.ammo_rockets; + } + if (am > 300 - self.building.ammo_rockets) + { + am = 300 - self.building.ammo_rockets; + } + self.ammo_rockets = self.ammo_rockets - am; + self.building.ammo_rockets = self.building.ammo_rockets + am; + am = 10 * 2; + if (am > self.ammo_cells) + { + am = self.ammo_cells; + } + if (am > 400 - self.building.ammo_cells) + { + am = 400 - self.building.ammo_cells; + } + self.ammo_cells = self.ammo_cells - am; + self.building.ammo_cells = self.building.ammo_cells + am; + } + else + { + if (inp == 2) + { + am = 40 * 2; + if (am > self.armorvalue) + { + am = self.armorvalue; + } + if (am > 500 - self.building.armorvalue) + { + am = 500 - self.building.armorvalue; + } + self.armorvalue = self.armorvalue - am; + self.building.armorvalue = self.building.armorvalue + am; + } + else + { + if (inp == 3) + { + sound(self, 3, "items/repair.wav", TF_FLARE_OFF, TF_FLARE_OFF); + metalcost = (self.building.max_health - self.building.health) / 5; + if (metalcost > self.ammo_cells) + { + metalcost = self.ammo_cells; + } + self.ammo_cells = self.ammo_cells - metalcost; + self.building.health = self.building.health + metalcost * 5; + } + else + { + if (inp == 4) + { + sprint(self, 2, "You dismantle the Dispenser.\n"); + self.ammo_cells = self.ammo_cells + 100 / 2; + dremove(self.building); + self.building.real_owner.has_dispenser = TF_FLARE_LIT; + } + } + } + } + if (inp >= TF_FLARE_OFF && inp <= 5) + { + ResetMenu(); + self.impulse = TF_FLARE_LIT; + self.building = world; + bound_other_ammo(self); + if (self.armorvalue == TF_FLARE_LIT) + { + self.armortype = TF_FLARE_LIT; + self.armorclass = TF_FLARE_LIT; + self.items = self.items - (self.items & (8192 | 16384 | 32768)); + } + W_SetCurrentAmmo(); + } +}; + +void () Menu_EngineerFix_SentryGun = +{ + + if (((self.building.weapon < 3) && (self.ammo_cells >= 130))) + { + CenterPrint (self, "Action: \n“‘.. Put Ammo into Sentry Gun \n”‘.. Upgrade Sentry Gun \n•‘.. Repair Sentry Gun \n–‘.. Dismantle Sentry Gun \n—‘.. Nothing \n \n6‘.. Rotate Clockwise \n\n"); + } + else + { + if ((self.building.weapon == 3)) + { + CenterPrint (self, "Action: \n“‘.. Put Ammo into Sentry Gun \n\n•‘.. Repair Sentry Gun \n–‘.. Dismantle Sentry Gun \n—‘.. Nothing \n \n6‘.. Rotate Clockwise \n7‘.. Unload Rockets \n\n"); + } + else + { + CenterPrint (self, "Action: \n“‘.. Put Ammo into Sentry Gun \n\n•‘.. Repair Sentry Gun \n–‘.. Dismantle Sentry Gun \n—‘.. Nothing \n \n6‘.. Rotate Clockwise \n\n"); + } + } +}; + +void (float inp) Menu_EngineerFix_SentryGun_Input = +{ + local float am; + local float metalcost; + local string st; + + if (((self.classname != "player") || (self.building == world))) + { + return; + } + if ((inp == 1)) + { + am = 40; + if ((am > self.ammo_shells)) + { + am = self.ammo_shells; + } + if ((am > (self.building.maxammo_shells - self.building.ammo_shells))) + { + am = self.building.maxammo_shells - self.building.ammo_shells; + } + self.ammo_shells = (self.ammo_shells - am); + self.building.ammo_shells = (self.building.ammo_shells + am); + if ((self.building.weapon == 3)) + { + am = 20; + if ((am > self.ammo_rockets)) + { + am = self.ammo_rockets; + } + if ((am > (self.building.maxammo_rockets - self.building.ammo_rockets))) + { + am = self.building.maxammo_rockets - self.building.ammo_rockets; + } + self.ammo_rockets = (self.ammo_rockets - am); + self.building.ammo_rockets = (self.building.ammo_rockets + am); + } + } + else + { + if ((((self.building.weapon < 3) && (inp == 2)) && (self.ammo_cells >= 130))) + { + self.ammo_cells = (self.ammo_cells - 130); + self.building.weapon = (self.building.weapon + 1); + self.building.max_health = (self.building.max_health * 1.200000); + self.building.health = self.building.max_health; + self.building.maxammo_shells = (self.building.maxammo_shells * 1.200000); + if ((self.building.weapon == 2)) + { + sound (self.building, 3, "weapons/tnkatck4.wav", 1, 1); + self.building.think = lvl2_sentry_stand; + self.building.skin = 1; + } + else + { + sound (self.building, 3, "weapons/tnkatck4.wav", 1, 1); + self.building.think = lvl3_sentry_stand; + self.building.skin = 2; + } + sprint (self, 2, "You upgrade the Sentry Gun to level "); + st = ftos (self.building.weapon); + sprint (self, 2, st); + sprint (self, 2, "\n"); + if (((self.client == "fuhquake") || (self.client == "zquake"))) + { + stuffcmd (self, "set $sentryhealth "); + stuffcmd (self, ftos (rint (self.building.health))); + stuffcmd (self, "\n"); + } + } + else + { + if ((inp == 3)) + { + metalcost = (self.building.max_health - self.building.health) / 5; + if ((metalcost > self.ammo_cells)) + { + metalcost = self.ammo_cells; + } + sound (self, 3, "items/repair.wav", 1, 1); + self.ammo_cells = (self.ammo_cells - metalcost); + self.building.health = (self.building.health + (metalcost * 5)); + if (((self.client == "fuhquake") || (self.client == "zquake"))) + { + stuffcmd (self, "set $sentryhealth "); + stuffcmd (self, ftos (rint (self.building.health))); + stuffcmd (self, "\n"); + } + } + else + { + if ((inp == 4)) + { + local entity isneardoor; + local float candismantle; + isneardoor = findradius (self.origin, 200); + while (isneardoor) + { + if ((isneardoor.classname == "door")) + { + if (isneardoor.orig_origin_z <= self.building.origin_z) { + candismantle = 1; } + } + isneardoor = isneardoor.chain; + } +//anti dismantle + if ((self.building.real_owner.team_no == self.team_no && self.building.real_owner != self && candismantle != 1)) + { + sprint(self, 1, "You cannot dismantle a teammate's sentry gun.\n"); + ResetMenu (); + self.impulse = 0; + return; + } + sprint (self, 2, "You dismantle the Sentry Gun.\n"); + if ((self.building.real_owner != self)) + { + sprint (self.building.real_owner, 2, self.netname); + sprint (self.building.real_owner, 2, " has dismantled your sentry gun.\n"); + bprint (1, self.netname); + if ((self.building.real_owner.team_no == self.team_no)) + { + bprint (1, " dismantled teammate "); + } + else + { + bprint (1, " humiliated "); + } + bprint (1, self.building.real_owner.netname); + bprint (1, "'s sentry gun.\n"); + } + self.ammo_cells = (self.ammo_cells + 65); + dremove (self.building.trigger_field); + dremove (self.building); + self.building.real_owner.has_sentry = 0; + if (((self.client == "fuhquake") || (self.client == "zquake"))) + { + stuffcmd (self, "set $sentryhealth 0\n"); + } + } + else + { + if ((inp == 6)) + { + sprint (self, 2, "Rotating 45 degrees clockwise...\n"); + self.building.waitmin = anglemod ((self.building.waitmin - 45)); + self.building.waitmax = anglemod ((self.building.waitmax - 45)); + } + if ((inp == 7)) + { + self.ammo_rockets = (self.ammo_rockets + self.building.ammo_rockets); + if ((self.ammo_rockets > self.maxammo_rockets)) + { + self.ammo_rockets = self.maxammo_rockets; + } + self.building.ammo_rockets = 0; + sprint (self, 2, "You have unloaded your sentry's rocket cache.\n"); + } + } + } + } + } + if (((inp >= 1) && (inp <= 7))) + { + ResetMenu (); + self.impulse = 0; + bound_other_ammo (self); + if ((self.armorvalue == 0)) + { + self.armortype = 0; + self.armorclass = 0; + self.items = (self.items - (self.items & 57344)); + } + W_SetCurrentAmmo (); + } +}; + +void() Menu_Dispenser = +{ + CenterPrint(self, "Use Dispenser: \n“‘.. Withdraw some ammo \n”‘.. Withdraw some Armor \n•‘.. Health & Vaccine \n–‘.. BioSuit (AntiToaster) \n—‘.. Nothing \n\n"); +}; + +void (float _p_1052) Menu_Dispenser_Input = +{ + local float _l_1053; + local float _l_1054; + local entity _l_1055; + + _l_1054 = 0; + if ((_p_1052 == 1)) + { + if (((((self.building.ammo_shells == 0) && (self.building.ammo_nails == 0)) && (self.building.ammo_rockets == 0)) && (self.building.ammo_cells == 0))) + { + _l_1054 = 1; + } + else + { + _l_1053 = self.maxammo_shells - self.ammo_shells; + if ((_l_1053 > self.building.ammo_shells)) + { + _l_1053 = self.building.ammo_shells; + } + self.building.ammo_shells = (self.building.ammo_shells - _l_1053); + self.ammo_shells = (self.ammo_shells + _l_1053); + _l_1053 = self.maxammo_nails - self.ammo_nails; + if ((_l_1053 > self.building.ammo_nails)) + { + _l_1053 = self.building.ammo_nails; + } + self.building.ammo_nails = (self.building.ammo_nails - _l_1053); + self.ammo_nails = (self.ammo_nails + _l_1053); + _l_1053 = self.maxammo_rockets - self.ammo_rockets; + if ((_l_1053 > self.building.ammo_rockets)) + { + _l_1053 = self.building.ammo_rockets; + } + self.building.ammo_rockets = (self.building.ammo_rockets - _l_1053); + self.ammo_rockets = (self.ammo_rockets + _l_1053); + _l_1053 = self.maxammo_cells - self.ammo_cells; + if ((_l_1053 > self.building.ammo_cells)) + { + _l_1053 = self.building.ammo_cells; + } + self.building.ammo_cells = (self.building.ammo_cells - _l_1053); + self.ammo_cells = (self.ammo_cells + _l_1053); + sound (self, 3, "weapons/rocklr1a.wav", 1, 1); + if (self.autodiscard) + { + TeamFortress_Discard (); + } + } + } + else + { + if ((_p_1052 == 2)) + { + if ((self.building.armorvalue == 0)) + { + _l_1054 = 1; + } + else + { + _l_1053 = self.maxarmor - self.armorvalue; + if ((_l_1053 > self.building.armorvalue)) + { + _l_1053 = self.building.armorvalue; + } + if ((self.armortype == 0)) + { + self.armortype = 0.300000; + self.items = (self.items | 8192); + } + self.building.armorvalue = (self.building.armorvalue - _l_1053); + self.armorvalue = (self.armorvalue + _l_1053); + sound (self, 3, "weapons/tnkatck4.wav", 1, 1); + } + } + else + { + if ((_p_1052 == 3)) + { + if ((self.building.armorvalue == 0)) + { + _l_1054 = 1; + } + else + { + if ((self.building.skin == 1)) + { + if ((self.leg_damage > 1)) + { + sprint (self, 2, "Your leg wound has been healed!\n"); + } + TeamFortress_SetSpeed (self); + _l_1055 = find (world, classname, "timer"); + while ((((_l_1055.owner != self) || (_l_1055.think != ConcussionGrenadeTimer)) && (_l_1055 != world))) + { + _l_1055 = find (_l_1055, classname, "timer"); + } + if ((_l_1055 != world)) + { + stuffcmd (self, "v_idlescale 0\n"); + sprint (self, 2, "you have been healed of your concussion\n"); + dremove (_l_1055); + } + if ((self.tfstate & 16384)) + { + _l_1055 = find (world, classname, "timer"); + while ((((_l_1055.owner != self) || (_l_1055.think != HallucinationTimer)) && (_l_1055 != world))) + { + _l_1055 = find (_l_1055, classname, "timer"); + } + if ((_l_1055 != world)) + { + stuffcmd (self, "v_idlescale 0\n"); + self.tfstate = (self.tfstate - (self.tfstate & 16384)); + sprint (self, 2, "you have been healed of your hallucinations\n"); + dremove (_l_1055); + } + else + { + dprint ("Warning: Error in Hallucination Timer logic.\n"); + } + } + if ((self.tfstate & 32768)) + { + _l_1055 = find (world, classname, "timer"); + while ((((_l_1055.owner != self) || (_l_1055.think != TranquiliserTimer)) && (_l_1055 != world))) + { + _l_1055 = find (_l_1055, classname, "timer"); + } + if ((_l_1055 != world)) + { + self.tfstate = (self.tfstate - (self.tfstate & 32768)); + TeamFortress_SetSpeed (self); + stuffcmd (self, "v_cshift 0 0 0 0\n"); + sprint (self, 2, "you have been healed of your tranquilisation\n"); + dremove (_l_1055); + } + else + { + dprint ("Warning: Error in Tranquilisation Timer logic.\n"); + } + } + if ((self.FlashTime > 0)) + { + _l_1055 = find (world, netname, "flashtimer"); + while ((((_l_1055.owner != self) || (_l_1055.classname != "timer")) && (_l_1055 != world))) + { + _l_1055 = find (_l_1055, netname, "flashtimer"); + } + if ((_l_1055 != world)) + { + self.FlashTime = 0; + stuffcmd (self, "v_cshift 0 0 0 0\n"); + dremove (_l_1055); + } + else + { + dprint ("Warning: Error in Flash Timer logic.\n"); + self.FlashTime = 0; + } + } + if ((self.tfstate & 16)) + { + self.tfstate = (self.tfstate - (self.tfstate & 16)); + deathmsg = 23; + sprint (self, 2, "Your infection is cured!\n"); + return; + } + if ((self.numflames > 0)) + { + sound (self, 1, "items/r_item1.wav", 1, 1); + self.numflames = 0; + sprint (self, 2, "The flames have been doused!\n"); + return; + } + self.health = (self.health + 25); + self.tfstate = (self.tfstate - (self.tfstate & 16)); + } + else + { + sprint (self, 2, "No vaccine has been loaded by Medic\n"); + } + if ((self.health >= self.max_health)) + { + self.health = self.max_health; + } + sound (self, 3, "items/health1.wav", 1, 1); + } + } + else + { + if ((_p_1052 == 4)) + { + if ((self.building.skin == 1)) + { + self.items = (self.items | 2097152); + self.rad_time = 1; + self.radsuit_finished = (time + 30); + sprint (self, 2, "You have a BioSuit\n"); + } + else + { + sprint (self, 2, "No BioSuit has been loaded by Medic\n"); + } + } + } + } + } + if (((_p_1052 >= 1) && (_p_1052 <= 5))) + { + if (_l_1054) + { + sprint (self, 2, "The dispenser is empty.\n"); + } + ResetMenu (); + self.impulse = 0; + self.building = world; + self.building_wait = (time + 0.500000); + bound_other_ammo (self); + if ((self.armorvalue == 0)) + { + self.armortype = 0; + self.armorclass = 0; + self.items = (self.items - (self.items & 57344)); + } + W_SetCurrentAmmo (); + } +}; + +#ifdef clan_progs +void (entity client, string s, ...) CenterPrint5 = #73; +void () Menu_Clan_Prematch = +{ + local string num_ply, num_need; + num_ply = ftos(num_players); + + if (!num_players_ready) // equake glitches without this + num_need = "0"; + else + num_need = ftos(num_players_ready); + + if (clan_prematch > 1 && stof(num_ply) < clan_prematch) // when clan_prematch is set to a value over 1.. + num_ply = ftos(clan_prematch); + else + num_ply = ftos(num_players); // equake glitches without this + + if (self.is_ready == 0) + { + //CenterPrint (self, strcat(" ==== Clan Prematch ====\n\n“.. Ready [ ] \n”.. Not Ready [X] \n\n\n\n ", strcat(strcat(num_need, "/"), strcat(num_ply, " players are ready\n")))); + CenterPrint5 (self, " ==== Clan Prematch ====\n\n“.. Ready [ ] \n”.. Not Ready [X] \n\n\n\n ", num_need, "/", num_ply, " players are ready\n"); + } + else + { + //CenterPrint (self, " ==== Clan Prematch ====\n\n“.. Ready [X] \n”.. Not Ready [ ] \n\n\n\n"); + //CenterPrint (self, strcat(" ==== Clan Prematch ====\n\n“.. Ready [X] \n”.. Not Ready [ ] \n\n\n\n ", strcat(strcat(num_need, "/"), strcat(num_ply, " players are ready\n")))); + CenterPrint5 (self, " ==== Clan Prematch ====\n\n“.. Ready [X] \n”.. Not Ready [ ] \n\n\n\n ", num_need, "/", num_ply, " players are ready\n"); + } +}; +void () PrematchThink; +void () PrematchCountDown; +float prematch; +void (float inp) Menu_Clan_Prematch_Input = +{ + local float num_need; + num_need = num_players; + if (clan_prematch > 1 && num_need < clan_prematch) // clan prematch mode 2 needs atleast 4 ready players + num_need = 4; + + if (inp == 1) + { + if (self.is_ready == 0) + { + self.is_ready = 1; + num_players_ready = num_players_ready + 1; + if (num_players_ready == num_need) + { + clan_prematch = -1; + local entity te; + te = find(world,classname,"pmtimer"); + while (te) + { + if (te.think == PrematchThink) + { + //prematch = 0; + te.think = PrematchCountDown; + te.nextthink = time + 1; + te.health = 3; + } + te = find(te,classname,"player"); + } + } + } + } + else if (inp == 2) + { + if (self.is_ready == 1) + { + self.is_ready = 0; + num_players_ready = num_players_ready - 1; + } + } + if ((inp >= 1) && (inp <= 2)) + { + ResetMenu (); + self.impulse = 0; + } +}; +#endif diff --git a/misc.pqc b/misc.pqc new file mode 100644 index 0000000..568c942 --- /dev/null +++ b/misc.pqc @@ -0,0 +1,1936 @@ +void() fire_fly; +void() fire_touch; +void() make_bubbles; +void() bubble_remove; +void() bubble_bob; +void() make_burns; +void() fire_burst; +void() FlakeFloat; +void() Effect_Attack; +void() effect2_spawn; +void() make_burst; +void() effect3_spawn; +void() drop_rock; +void() rock_splash; +void() make_flashes1; +void() make_flashes2; +void() skeet_sound; +void() skeet_fly; + +.float color, option2; +.entity lastplayer; + +void() info_null = +{ + dremove(self); +}; + +void() info_notnull = +{ +}; + +void() light_use = +{ + if (self.spawnflags & TF_FLARE_OFF) + { + lightstyle(self.style, "m"); + self.spawnflags = self.spawnflags - TF_FLARE_OFF; + } + else + { + lightstyle(self.style, "a"); + self.spawnflags = self.spawnflags + TF_FLARE_OFF; + } +}; + +void() light = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.targetname)) + { + dremove(self); + return; + } + if (self.style >= 32) + { + self.use = light_use; + if (self.spawnflags & TF_FLARE_OFF) + { + lightstyle(self.style, "a"); + } + else + { + lightstyle(self.style, "m"); + } + } +}; + +void() light_fluoro = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (self.style >= 32) + { + self.use = light_use; + if (self.spawnflags & TF_FLARE_OFF) + { + lightstyle(self.style, "a"); + } + else + { + lightstyle(self.style, "m"); + } + } + precache_sound("ambience/fl_hum1.wav"); + ambientsound(self.origin, "ambience/fl_hum1.wav", 0.8, 3); +}; + +void() light_fluorospark = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.style)) + { + self.style = 10; + } + precache_sound("ambience/buzz1.wav"); + ambientsound(self.origin, "ambience/buzz1.wav", 0.8, 3); +}; + +void() light_globe = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/s_light.spr"); + setmodel(self, "progs/s_light.spr"); + makestatic(self); +}; + +void() FireAmbient = +{ + precache_sound("ambience/fire1.wav"); + ambientsound(self.origin, "ambience/fire1.wav", 0.3, 3); + if (self.light_lev > 0) + { + ambientsound(self.origin, "ambience/fire1.wav", 0.3, 4); + } +}; + +void() light_torch_small_walltorch = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/flame.mdl"); + setmodel(self, "progs/flame.mdl"); + FireAmbient(); + makestatic(self); +}; + +void() light_flame_large_yellow = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/flame2.mdl"); + setmodel(self, "progs/flame2.mdl"); + self.frame = TF_FLARE_OFF; + FireAmbient(); + makestatic(self); +}; + +void() light_flame_small_yellow = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/flame2.mdl"); + setmodel(self, "progs/flame2.mdl"); + FireAmbient(); + makestatic(self); +}; + +void() light_flame_small_white = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/flame2.mdl"); + setmodel(self, "progs/flame2.mdl"); + FireAmbient(); + makestatic(self); +}; + +void() misc_fireball = +{ + precache_model("progs/lavaball.mdl"); + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.classname = "fireball"; + self.nextthink = time + random() * 5; + self.think = fire_fly; + if (!(self.speed)) + { + // pablo. gg? :/ +// self.speed == 1000; + self.speed = 1000; + } +}; + +void() fire_fly = +{ + newmis = spawn(); + newmis.solid = TF_FLARE_OFF; + newmis.movetype = 6; + newmis.velocity = '0 0 1000'; + newmis.velocity_x = random() * 100 - 50; + newmis.velocity_y = random() * 100 - 50; + newmis.velocity_z = self.speed + random() * 200; + newmis.classname = "fireball"; + setmodel(newmis, "progs/lavaball.mdl"); + setsize(newmis, '0 0 0', '0 0 0'); + setorigin(newmis, self.origin); + newmis.nextthink = time + 5; + newmis.think = SUB_Remove; + newmis.touch = fire_touch; + self.nextthink = time + random() * 5 + 3; + self.think = fire_fly; +}; + +void() fire_touch = +{ + if (other.takedamage) + { + TF_T_Damage(other, self, self, 20, TF_FLARE_LIT, 16); + } + dremove(self); +}; + +void() barrel_explode = +{ + self.takedamage = TF_FLARE_LIT; + self.classname = "explo_box"; + T_RadiusDamage(self, self, 160, world); + WriteByte(4, 23); + WriteByte(4, 3); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z + 32); + multicast(self.origin, TF_FLARE_OFF); + remove(self); +}; + +void() misc_explobox = +{ + local float oldz; + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.solid = 2; + self.movetype = TF_FLARE_LIT; + precache_model("maps/b_explob.bsp"); + setmodel(self, "maps/b_explob.bsp"); + setsize(self, '0 0 0', '32 32 64'); + precache_sound("weapons/r_exp3.wav"); + self.health = 20; + self.th_die = barrel_explode; + self.takedamage = 2; + self.origin_z = self.origin_z + 2; + oldz = self.origin_z; + droptofloor(); + if (oldz - self.origin_z > 250) + { + dprint("item fell out of level at "); + dprint(vtos(self.origin)); + dprint("\n"); + dremove(self); + } +}; + +void() misc_explobox2 = +{ + local float oldz; + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.solid = 2; + self.movetype = TF_FLARE_LIT; + precache_model2("maps/b_exbox2.bsp"); + setmodel(self, "maps/b_exbox2.bsp"); + setsize(self, '0 0 0', '32 32 32'); + precache_sound("weapons/r_exp3.wav"); + self.health = 20; + self.th_die = barrel_explode; + self.takedamage = 2; + self.origin_z = self.origin_z + 2; + oldz = self.origin_z; + droptofloor(); + if (oldz - self.origin_z > 250) + { + dprint("item fell out of level at "); + dprint(vtos(self.origin)); + dprint("\n"); + dremove(self); + } +}; + +float(float min, float max) RandomRange = +{ + local float width; + local float offset; + local float result; + width = max - min; + offset = random() * width; + result = offset + min; + return result; +}; + +void() Laser_Touch = +{ + local vector org; + if (other == self.owner) + { + return; + } + if (pointcontents(self.origin) == -6) + { + dremove(self); + return; + } + sound(self, TF_FLARE_OFF, "enforcer/enfstop.wav", TF_FLARE_OFF, 3); + org = self.origin - 8 * normalize(self.velocity); + if (other.health) + { + SpawnBlood(org, 15); + TF_T_Damage(other, self, self.owner, 15, TF_FLARE_LIT, 8); + } + else + { + WriteByte(4, 23); + WriteByte(4, 2); + WriteByte(4, 5); + WriteCoord(4, org_x); + WriteCoord(4, org_y); + WriteCoord(4, org_z); + multicast(org, 2); + } + dremove(self); +}; + +void(vector org, vector vec) LaunchLaser = +{ + if (self.classname == "monster_enforcer") + { + sound(self, TF_FLARE_OFF, "enforcer/enfire.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + vec = normalize(vec); + newmis = spawn(); + newmis.owner = self; + newmis.movetype = 5; + newmis.solid = 2; + newmis.effects = 8; + if (self.spawnflags & 4) + { + setmodel(newmis, "progs/missile.mdl"); + newmis.touch = T_MissileTouch; + } + else + { + setmodel(newmis, "progs/laser.mdl"); + newmis.touch = Laser_Touch; + } + setsize(newmis, '0 0 0', '0 0 0'); + setorigin(newmis, org); + newmis.velocity = vec * 600; + newmis.angles = vectoangles(newmis.velocity); + newmis.nextthink = time + 5; + newmis.think = SUB_Remove; +}; + +void() spikeshooter_use = +{ + if (self.spawnflags & 2) + { + sound(self, 2, "enforcer/enfire.wav", TF_FLARE_OFF, TF_FLARE_OFF); + LaunchLaser(self.origin, self.movedir); + } + else + { + if (self.spawnflags & 4) + { + make_explosion(); + sound(self, 2, "weapons/sgun1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + LaunchLaser(self.origin, self.movedir); + } + else + { + sound(self, 2, "weapons/spike2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + launch_spike(self.origin, self.movedir); + newmis.velocity = self.movedir * 500; + if (self.spawnflags & TF_FLARE_OFF) + { + newmis.touch = superspike_touch; + } + } + } +}; + +void() shooter_think = +{ + spikeshooter_use(); + self.nextthink = time + self.wait; + newmis.velocity = self.movedir * 500; +}; + +void() trap_spikeshooter = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + SetMovedir(); + self.use = spikeshooter_use; + if (self.spawnflags & 2) + { + precache_model2("progs/laser.mdl"); + precache_sound2("enforcer/enfire.wav"); + precache_sound2("enforcer/enfstop.wav"); + } + else + { + if (self.spawnflags & 4) + { + precache_sound2("weapons/sgun1.wav"); + } + else + { + precache_sound("weapons/spike2.wav"); + } + } +}; + +void() trap_shooter = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + trap_spikeshooter(); + if (self.wait == TF_FLARE_LIT) + { + self.wait = TF_FLARE_OFF; + } + self.nextthink = self.nextthink + self.wait + self.ltime; + self.think = shooter_think; +}; + +void() air_bubbles = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_sound("ambience/bubbles.wav"); + ambientsound(self.origin, "ambience/bubbles.wav", TF_FLARE_OFF, 2); + precache_model("progs/s_bubble.spr"); + self.nextthink = time + TF_FLARE_OFF; + self.think = make_bubbles; +}; + +void() make_bubbles = +{ + newmis = spawn(); + setmodel(newmis, "progs/s_bubble.spr"); + setorigin(newmis, self.origin); + newmis.movetype = 8; + newmis.solid = TF_FLARE_LIT; + newmis.velocity = '0 0 15'; + newmis.nextthink = time + 0.5; + newmis.think = bubble_bob; + newmis.touch = bubble_remove; + newmis.classname = "bubble"; + newmis.frame = TF_FLARE_LIT; + newmis.cnt = TF_FLARE_LIT; + setsize(newmis, '-8 -8 -8', '8 8 8'); + self.nextthink = time + random() + 0.5; + self.think = make_bubbles; +}; + +void() bubble_split = +{ + newmis = spawn(); + setmodel(newmis, "progs/s_bubble.spr"); + setorigin(newmis, self.origin); + newmis.movetype = 8; + newmis.solid = TF_FLARE_LIT; + newmis.velocity = self.velocity; + newmis.nextthink = time + 0.5; + newmis.think = bubble_bob; + newmis.touch = bubble_remove; + newmis.classname = "bubble"; + newmis.frame = TF_FLARE_OFF; + newmis.cnt = 10; + setsize(newmis, '-8 -8 -8', '8 8 8'); + self.frame = TF_FLARE_OFF; + self.cnt = 10; + if (self.waterlevel != 3) + { + remove(self); + } +}; + +void() bubble_remove = +{ + if (other.classname == self.classname) + { + return; + } + dremove(self); +}; + +void() bubble_bob = +{ + local float rnd1; + local float rnd2; + local float rnd3; + self.cnt = self.cnt + TF_FLARE_OFF; + if (self.cnt == 4) + { + bubble_split(); + } + if (self.cnt == 20) + { + dremove(self); + } + rnd1 = self.velocity_x + (-10 + random() * 20); + rnd2 = self.velocity_y + (-10 + random() * 20); + rnd3 = self.velocity_z + 10 + random() * 10; + if (rnd1 > 10) + { + rnd1 = 5; + } + if (rnd1 < -10) + { + rnd1 = -5; + } + if (rnd2 > 10) + { + rnd2 = 5; + } + if (rnd2 < -10) + { + rnd2 = -5; + } + if (rnd3 < 10) + { + rnd3 = 15; + } + if (rnd3 > 30) + { + rnd3 = 25; + } + self.velocity_x = rnd1; + self.velocity_y = rnd2; + self.velocity_z = rnd3; + self.nextthink = time + 0.5; + self.think = bubble_bob; +}; + +void() func_wall_use = +{ + self.frame = TF_FLARE_OFF - self.frame; +}; + +void() func_wall = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.angles = '0 0 0'; + self.movetype = 7; + self.solid = 4; + self.use = func_wall_use; + setmodel(self, self.model); +}; + +void() func_illusionary = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.angles = '0 0 0'; + self.movetype = TF_FLARE_LIT; + self.solid = TF_FLARE_LIT; + setmodel(self, self.model); + makestatic(self); +}; + +void() func_episodegate = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(serverflags & self.spawnflags)) + { + return; + } + self.angles = '0 0 0'; + self.movetype = 7; + self.solid = 4; + self.use = func_wall_use; + setmodel(self, self.model); +}; + +void() func_bossgate = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if ((serverflags & 15) == 15) + { + return; + } + self.angles = '0 0 0'; + self.movetype = 7; + self.solid = 4; + self.use = func_wall_use; + setmodel(self, self.model); +}; + +void() ambient_brook = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/brook.wav"); + ambientsound(self.origin, "ambience/brook.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_jungle = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/jungle.wav"); + ambientsound(self.origin, "ambience/jungle.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_nightpond = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/nitepond.wav"); + ambientsound(self.origin, "ambience/nitepond.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_alert = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/redalert.wav"); + ambientsound(self.origin, "ambience/redalert.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_onboard = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = 0.6; + } + precache_sound("ambience/onboard.wav"); + if (!(self.height)) + { + ambientsound(self.origin, "ambience/onboard.wav", self.volume, TF_FLARE_LIT); + } + else + { + ambientsound(self.origin, "ambience/onboard.wav", self.volume, TF_FLARE_OFF); + } +}; + +void() ambient_unholy = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = 0.8; + } + precache_sound("ambience/unholy.wav"); + ambientsound(self.origin, "ambience/unholy.wav", self.volume, TF_FLARE_LIT); +}; + +void() ambient_rocket_engine = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/onboard.wav"); + ambientsound(self.origin, "ambience/onboard.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_high_wind = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/2windy.wav"); + ambientsound(self.origin, "ambience/2windy.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_peakwind = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/peakwind.wav"); + ambientsound(self.origin, "ambience/peakwind.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_chant = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/chant.wav"); + ambientsound(self.origin, "ambience/chant.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_meadow = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/meadow.wav"); + ambientsound(self.origin, "ambience/meadow.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_ocean = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/ocean.wav"); + ambientsound(self.origin, "ambience/ocean.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_ice_moving = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/icemove.wav"); + ambientsound(self.origin, "ambience/icemove.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_eerie = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/eerie.wav"); + ambientsound(self.origin, "ambience/eerie.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_flagflap = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/flagflap.wav"); + ambientsound(self.origin, "ambience/flagflap.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_diesel = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/diesel.wav"); + ambientsound(self.origin, "ambience/diesel.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_chopper = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/chopper.wav"); + ambientsound(self.origin, "ambience/chopper.wav", self.volume, TF_FLARE_OFF); +}; + +void() ambient_suck_wind = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_sound("ambience/suck1.wav"); + ambientsound(self.origin, "ambience/suck1.wav", TF_FLARE_OFF, 3); +}; + +void() ambient_drone = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/drone6.wav"); + ambientsound(self.origin, "ambience/drone6.wav", self.volume, 2); +}; + +void() ambient_flouro_buzz = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_sound("ambience/buzz1.wav"); + ambientsound(self.origin, "ambience/buzz1.wav", TF_FLARE_OFF, 3); +}; + +void() ambient_drip = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound("ambience/drip1.wav"); + ambientsound(self.origin, "ambience/drip1.wav", self.volume, 3); +}; + +void() ambient_comp_hum = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_sound("ambience/comp1.wav"); + ambientsound(self.origin, "ambience/comp1.wav", TF_FLARE_OFF, 3); +}; + +void() ambient_thunder = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_sound("ambience/thunder1.wav"); + ambientsound(self.origin, "ambience/thunder1.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void() ambient_light_buzz = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_sound("ambience/fl_hum1.wav"); + ambientsound(self.origin, "ambience/fl_hum1.wav", 0.8, 3); +}; + +void() ambient_swamp1 = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_sound("ambience/swamp1.wav"); + ambientsound(self.origin, "ambience/swamp1.wav", 0.8, 3); +}; + +void() ambient_swamp2 = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_sound("ambience/swamp2.wav"); + ambientsound(self.origin, "ambience/swamp2.wav", 0.6, 3); +}; + +void() ambient_weaponfire = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_sound("effects/explode1.wav"); + precache_sound("effects/explode2.wav"); + precache_sound("effects/m60.wav"); + precache_sound("effects/minigun.wav"); + precache_sound("effects/rocket.wav"); + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + self.classname = "timer"; + self.nextthink = time + random() * 5; + self.think = fire_burst; +}; + +void() fire_burst = +{ + local float rs; + rs = rint(random() * 4 + TF_FLARE_OFF); + if (rs == TF_FLARE_OFF) + { + self.noise = "effects/explode1.wav"; + } + if (rs == 2) + { + self.noise = "effects/explode2.wav"; + } + if (rs == 3) + { + self.noise = "effects/m60.wav"; + } + if (rs == 4) + { + self.noise = "effects/minigun.wav"; + } + if (rs == 5) + { + self.noise = "effects/rocket.wav"; + } + sound(self, 3, self.noise, self.volume, TF_FLARE_OFF); + self.nextthink = time + random() * 5 + TF_FLARE_OFF; + self.think = fire_burst; +}; + +void() effect_burner = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + FireAmbient(); + self.nextthink = time + 3; + self.think = make_burns; +}; + +void() make_burns = +{ + newmis = spawn(); + setmodel(newmis, "progs/s_expl.spr"); + setorigin(newmis, self.origin); + newmis.movetype = 8; + newmis.solid = TF_FLARE_LIT; + newmis.effects = 8; + sound(newmis, TF_FLARE_LIT, "weapons/flmfire2.wav", 0.7, TF_FLARE_OFF); + newmis.velocity_z = random() * 50; + newmis.nextthink = time + 0.2; + newmis.think = s2_explode1; + newmis.classname = "fireball"; + self.nextthink = time + random() + 0.2; + self.think = make_burns; +}; + +void() effect_airburst = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_sound("effects/explode1.wav"); + precache_sound("effects/explode2.wav"); + self.classname = "timer"; + self.nextthink = time + random() * 20; + self.think = make_burst; +}; + +void() make_burst = +{ + local float abx; + local float aby; + abx = rint(random() * 19 + TF_FLARE_OFF); + abx = abx - 10; + abx = abx * 30; + aby = rint(random() * 19 + TF_FLARE_OFF); + aby = aby - 10; + aby = aby * 30; + newmis = spawn(); + setmodel(newmis, "progs/s_expl.spr"); + setorigin(newmis, self.origin); + newmis.origin_x = newmis.origin_x + abx; + newmis.origin_y = newmis.origin_y + aby; + newmis.movetype = 8; + newmis.solid = TF_FLARE_LIT; + if (random() < 0.5) + { + sound(newmis, 3, "effects/explode1.wav", TF_FLARE_OFF, TF_FLARE_LIT); + } + else + { + sound(newmis, 3, "effects/explode2.wav", TF_FLARE_OFF, TF_FLARE_LIT); + } + newmis.effects = 4; + newmis.velocity = '0 0 30'; + newmis.think = s2_explode1; + newmis.nextthink = time + 0.4; + newmis.classname = "fireball"; + self.nextthink = time + random() * 20; + self.think = make_burst; +}; + +void() ambient_sound = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.noise)) + { + objerror("ambient_sound without noise"); + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound(self.noise); + if (self.spawnflags == 4) + { + ambientsound(self.origin, self.noise, self.volume, TF_FLARE_LIT); + } + else + { + ambientsound(self.origin, self.noise, self.volume, TF_FLARE_OFF); + } +}; + +void(vector DropOrg) MakeDrop = +{ + local entity Drop; + Drop = spawn(); + setmodel(Drop, "progs/s_bubble.spr"); + setorigin(Drop, DropOrg); + Drop.movetype = 8; + Drop.solid = TF_FLARE_LIT; + Drop.velocity = '0 0 -350'; + Drop.classname = "RainDrop"; + Drop.frame = TF_FLARE_OFF; + Drop.think = SUB_Remove; + Drop.nextthink = time + RandomRange(0.6, 1.2); + setsize(Drop, '-8 -8 -8', '8 8 8'); +}; + +void(vector FlakeOrg) MakeFlake = +{ + local entity Flake; + Flake = spawn(); + setmodel(Flake, "progs/s_bubble.spr"); + setorigin(Flake, FlakeOrg); + Flake.movetype = 8; + Flake.solid = TF_FLARE_LIT; + Flake.classname = "SnowFlake"; + Flake.frame = TF_FLARE_OFF; + Flake.velocity_z = -64; + Flake.think = FlakeFloat; + Flake.touch = SUB_Remove; + Flake.nextthink = time + 0.5; + Flake.cnt = TF_FLARE_LIT; + setsize(Flake, '-8 -8 -8', '8 8 8'); +}; + +void() effect_lightning = +{ + precache_sound("ambience/thunder1.wav"); + precache_model("progs/s_null.spr"); + self.classname = "effect_lightning"; + self.nextthink = time + RandomRange(5, 20); + self.think = Effect_Attack; +}; + +void() Effect_Attack = +{ + local vector org; + local vector targ; + local entity Flash; + local entity Flash2; + sound(self, 2, "ambience/thunder1.wav", TF_FLARE_OFF, TF_FLARE_LIT); + org = self.origin; + org_x = org_x + RandomRange(self.spawnflags - 2 * self.spawnflags, self.spawnflags); + org_y = org_y + RandomRange(self.spawnflags - 2 * self.spawnflags, self.spawnflags); + targ = self.origin - '0 0 350'; + targ_x = targ_x + RandomRange(self.spawnflags - 2 * self.spawnflags, self.spawnflags); + targ_y = targ_y + RandomRange(self.spawnflags - 2 * self.spawnflags, self.spawnflags); + self.nextthink = time + RandomRange(TF_FLARE_OFF, 20); + self.think = Effect_Attack; + LightningDamage(org, targ, self, 100); + Flash2 = spawn(); + setmodel(Flash2, "progs/s_null.spr"); + setorigin(Flash2, org); + Flash2.movetype = 8; + Flash2.solid = TF_FLARE_LIT; + Flash2.effects = 4; + Flash2.velocity = '0 0 -1500'; + Flash2.think = SUB_Remove; + Flash2.nextthink = time + 0.6; + setsize(Flash2, '-8 -8 -8', '8 8 8'); + Flash = spawn(); + setmodel(Flash, "progs/s_null.spr"); + setorigin(Flash, targ); + Flash.movetype = 8; + Flash.solid = TF_FLARE_LIT; + Flash.effects = 4; + Flash.velocity = '0 0 1000'; + Flash.think = SUB_Remove; + Flash.nextthink = time + TF_FLARE_OFF; + setsize(Flash, '-8 -8 -8', '8 8 8'); + WriteByte(4, 23); + if (random() <= 0.4) + { + WriteByte(4, 5); + } + else + { + WriteByte(4, 9); + } + WriteEntity(4, world); + WriteCoord(4, org_x); + WriteCoord(4, org_y); + WriteCoord(4, org_z); + WriteCoord(4, targ_x); + WriteCoord(4, targ_y); + WriteCoord(4, targ_z); + multicast(targ, 2); +}; + +void() effect_rain = +{ + self.classname = "effect_rain"; + self.nextthink = 0.1; + self.think = effect2_spawn; +}; + +void() effect2_spawn = +{ + local float n; + local vector rainorg; + n = TF_FLARE_LIT; + while (n < 20) + { + rainorg = self.origin; + rainorg_x = rainorg_x + RandomRange(self.spawnflags - 2 * self.spawnflags, self.spawnflags); + rainorg_y = rainorg_y + RandomRange(self.spawnflags - 2 * self.spawnflags, self.spawnflags); + rainorg_z = rainorg_z + RandomRange(TF_FLARE_LIT, 64); + MakeDrop(rainorg); + n = n + TF_FLARE_OFF; + } + self.nextthink = time + RandomRange(0.3, 0.4); + self.think = effect2_spawn; +}; + +void() effect_snow = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.classname = "effect_snow"; + self.nextthink = 0.1; + self.think = effect3_spawn; +}; + +void() effect3_spawn = +{ + local float n; + local vector snoworg; + n = TF_FLARE_LIT; + while (n < 7) + { + snoworg = self.origin; + snoworg_x = snoworg_x + RandomRange(self.spawnflags - 2 * self.spawnflags, self.spawnflags); + snoworg_y = snoworg_y + RandomRange(self.spawnflags - 2 * self.spawnflags, self.spawnflags); + snoworg_z = snoworg_z + RandomRange(TF_FLARE_LIT, 64); + MakeFlake(snoworg); + n = n + TF_FLARE_OFF; + } + self.nextthink = time + RandomRange(1.5, 2); + self.think = effect3_spawn; +}; + +void() FlakeFloat = +{ + local float rnd1; + local float rnd2; + self.cnt = self.cnt + TF_FLARE_OFF; + if (self.cnt == 30) + { + remove(self); + } + rnd1 = self.velocity_x + (-10 + random() * 20); + rnd2 = self.velocity_y + (-10 + random() * 20); + if (rnd1 > 10) + { + rnd1 = 5; + } + if (rnd1 < -10) + { + rnd1 = -5; + } + if (rnd2 > 10) + { + rnd2 = 5; + } + if (rnd2 < -10) + { + rnd2 = -5; + } + self.velocity_x = rnd1; + self.velocity_y = rnd2; + self.nextthink = time + 0.7; + self.think = FlakeFloat; +}; + +void() make_explosion = +{ + newmis = spawn(); + setmodel(newmis, "progs/s_expl.spr"); + setorigin(newmis, self.origin); + newmis.movetype = 8; + newmis.solid = TF_FLARE_LIT; + sound(newmis, TF_FLARE_LIT, "weapons/flmfire2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + newmis.effects = 8; + newmis.velocity_z = random() * 250; + newmis.nextthink = time + 0.05; + newmis.think = s2_explode1; + newmis.nextthink = time + 0.05; +}; + +void() effect_rockfall = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_sound("effects/rockfall.wav"); + if (self.height) + { + precache_sound("effects/rcksplsh.wav"); + } + self.solid = TF_FLARE_OFF; + self.movetype = TF_FLARE_LIT; + setsize(self, '-64 -64 0', '64 64 64'); + self.touch = drop_rock; +}; + +void() drop_rock = +{ + if (self.last_used > time) + { + return; + } + if (other.classname != "player") + { + return; + } + sound(self, 3, "effects/rockfall.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.last_used = time + 20; + if (self.height) + { + self.nextthink = time + self.height / 125; + self.think = rock_splash; + self.origin_z = self.origin_z - self.height; + } + else + { + return; + } + return; +}; + +void() rock_splash = +{ + sound(self, 3, "effects/rcksplsh.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.origin_z = self.origin_z + self.height; + return; +}; + +void() blocker_use = +{ + if (!(self.state)) + { + self.state = TF_FLARE_OFF; + setorigin(self, self.origin - '8000 8000 8000'); + sound(self, 2, self.noise1, TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + self.state = TF_FLARE_LIT; + setorigin(self, self.origin + '8000 8000 8000'); + sound(self, 2, self.noise, TF_FLARE_OFF, TF_FLARE_OFF); + } +}; + +void(entity attacker, float damage) glass_pain = +{ + if (self.spawnflags & 8) + { + self.health = self.max_health; + } +}; + +void() glass_die = +{ + local entity new; + local vector tmpvec; + while (self.color > TF_FLARE_LIT) + { + new = spawn(); + new.origin = self.origin; + if (random() < 0.5) + { + setmodel(new, "progs/glass2.mdl"); + } + else + { + setmodel(new, "progs/glass1.mdl"); + } + setsize(new, '0 0 0', '0 0 0'); + if (self.height != 100) + { + new.velocity_x = 70 * crandom(); + new.velocity_y = 70 * crandom(); + new.velocity_z = 140 + 70 * random(); + } + else + { + new.velocity_x = 400 * crandom(); + new.velocity_y = 400 * crandom(); + new.velocity_z = 140 + 70 * random(); + } + new.movetype = 10; + new.solid = 2; + new.avelocity_x = random() * 600; + new.avelocity_y = random() * 600; + new.avelocity_z = random() * 600; + new.nextthink = time + 2 + random() * 3; + new.think = SUB_Remove; + self.absmin = self.origin + self.mins; + self.absmax = self.origin + self.maxs; + tmpvec_x = self.absmin_x + random() * (self.absmax_x - self.absmin_x); + tmpvec_y = self.absmin_y + random() * (self.absmax_y - self.absmin_y); + tmpvec_z = self.absmin_z + random() * (self.absmax_z - self.absmin_z); + setorigin(new, tmpvec); + self.color = self.color - TF_FLARE_OFF; + } + if (self.noise2) + { + if (pointcontents(self.origin) == -3) + { + sound(self, 2, "effects/rcksplsh.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + sound(self, 2, self.noise2, TF_FLARE_OFF, TF_FLARE_OFF); + } + } + remove(self); +}; + +void() func_glass = +{ + local vector tmpvec; + self.movetype = 7; + self.solid = 4; + self.mdl = self.model; + setmodel(self, self.model); + setsize(self, self.mins, self.maxs); + setorigin(self, self.origin); + self.model = string_null; + precache_sound("misc/null.wav"); + if (self.health > TF_FLARE_LIT) + { + if (!(self.color)) + { + tmpvec = self.maxs - self.mins; + tmpvec = tmpvec * 0.031; + if (tmpvec_x < TF_FLARE_OFF) + { + tmpvec_x = TF_FLARE_OFF; + } + if (tmpvec_y < TF_FLARE_OFF) + { + tmpvec_y = TF_FLARE_OFF; + } + if (tmpvec_z < TF_FLARE_OFF) + { + tmpvec_z = TF_FLARE_OFF; + } + self.color = tmpvec_x * tmpvec_y * tmpvec_z; + } + else + { + if (self.color == -1) + { + self.color = TF_FLARE_LIT; + } + } + if (self.color > 16) + { + self.color = 16; + } + self.takedamage = TF_FLARE_OFF; + self.max_health = self.health; + self.th_die = glass_die; + self.th_pain = glass_pain; + precache_model("progs/glass1.mdl"); + precache_model("progs/glass2.mdl"); + } + if (self.target) + { + if (!(self.speed)) + { + self.speed = 100; + } + if (!(self.dmg)) + { + self.dmg = 2; + } + if (self.sounds == TF_FLARE_OFF) + { + if (!(self.noise)) + { + self.noise = "plats/train2.wav"; + } + if (!(self.noise1)) + { + self.noise1 = "plats/train1.wav"; + } + precache_sound(self.noise); + precache_sound(self.noise1); + } + self.cnt = TF_FLARE_OFF; + self.blocked = train_blocked; + self.use = train_use; + self.classname = "train"; + self.think = func_train_find; + self.nextthink = self.ltime + 0.6; + } + else + { + self.use = blocker_use; + if (self.spawnflags & 4) + { + self.state = TF_FLARE_LIT; + setorigin(self, self.origin + '8000 8000 8000'); + } + else + { + self.state = TF_FLARE_OFF; + if (self.noise1) + { + sound(self, 2, self.noise1, TF_FLARE_OFF, TF_FLARE_OFF); + } + } + } + if (!(self.noise)) + { + self.noise = "misc/null.wav"; + } + if (!(self.noise1)) + { + self.noise1 = "misc/null.wav"; + } + if (!(self.noise2)) + { + self.noise2 = "effects/shatter.wav"; + } + precache_sound(self.noise); + precache_sound(self.noise1); + precache_sound(self.noise2); +}; + +void() bobbingwater_think = +{ + local vector ang; + self.count = self.count + self.speed * (time - self.ltime); + if (self.count > 360) + { + self.count = self.count - 360; + } + ang_x = self.count; + ang_y = TF_FLARE_LIT; + ang_z = TF_FLARE_LIT; + makevectors(ang); + self.origin_z = v_forward_z * self.cnt; + setorigin(self, self.origin); + self.ltime = time; + self.nextthink = time + 0.020000; +}; + +void() func_bobbingwater = +{ + self.angles = '0 0 0'; + self.movetype = 4; + self.solid = TF_FLARE_LIT; + setmodel(self, self.model); + self.think = bobbingwater_think; + self.count = TF_FLARE_LIT; + self.cnt = self.size_z / 2; + if (!(self.speed)) + { + self.speed = 4; + } + self.speed = 360 / self.speed; + self.nextthink = time + 0.020000; + self.ltime = time; +}; + +void() effect_strobe = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.movetype = 6; + self.solid = 2; + setsize(self, '-2 -2 -2', '4 4 4'); + setmodel(self, "progs/dot1.spr"); + self.effects = TF_FLARE_LIT; + self.nextthink = time + 2; + self.think = make_flashes1; +}; + +void() make_flashes1 = +{ + self.effects = TF_FLARE_LIT; + self.nextthink = time + 0.9 + self.height; + self.think = make_flashes2; +}; + +void() make_flashes = +{ + setmodel(self, "progs/dot1.spr"); + self.effects = TF_FLARE_LIT; + self.nextthink = time + 0.9; + self.think = make_flashes2; +}; + +void() make_flashes2 = +{ + setmodel(self, "progs/dot3.spr"); + self.effects = 8; + self.nextthink = time + 0.1; + self.think = make_flashes; +}; + +void() BallTouch = +{ + if (other.classname == "player" && self.last_used <= time) + { + sound(self, 3, "zombie/z_fall.wav", 0.8, TF_FLARE_OFF); + self.last_used = time + 0.3; + } + if (other.classname != "player") + { + sound(self, TF_FLARE_OFF, "zombie/z_hit.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + if (other.classname == "player") + { + makevectors(other.v_angle); + self.velocity = other.velocity + v_forward * 100 + v_up * 200; + self.lastplayer = other; + } +}; + +void() BallCheck = +{ + self.movetype = 10; + self.nextthink = time + 15; + self.effects = TF_FLARE_LIT; +}; + +void() ballstart = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } +}; + +void() BallStart = +{ + local entity te; + sound(self, 3, "sandball/whistle.wav", TF_FLARE_OFF, TF_FLARE_LIT); + te = find(world, classname, "ballstart"); + while (te) + { + setorigin(self, te.origin); + te = find(te, classname, "ballstart"); + } + self.nextthink = time + 5; + self.think = BallCheck; + self.movetype = 10; + self.velocity_z = 40; +}; + +void() ball = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/s_light.spr"); + setmodel(self, "progs/s_light.spr"); + self.movetype = TF_FLARE_LIT; + setsize(self, '-16 -16 -14', '16 16 10'); + self.solid = TF_FLARE_OFF; + self.touch = BallTouch; + self.classname = "ball"; + self.think = BallCheck; + self.nextthink = time + 15; + self.oldorigin = self.origin; +}; + +void() GoalTouch = +{ + local entity te; + if (other.classname != "ball") + { + return; + } + if (self.last_used > time) + { + return; + } + sound(self, 3, "sandball/goal.wav", TF_FLARE_OFF, TF_FLARE_LIT); + self.last_used = time + 10; + te = find(world, classname, "player"); + while (te) + { + if (self.team_no == 2) + { + CenterPrint2(te, "Score for Reds by\n", other.lastplayer.netname); + } + else + { + CenterPrint2(te, "Score for Blues by\n", other.lastplayer.netname); + } + if (te.team_no == self.team_no && self.team_no != TF_FLARE_LIT) + { + te.real_frags = te.real_frags + self.frags; + te.frags = te.frags + self.frags; + te.health = te.max_health; + } + te = find(te, classname, "player"); + } + other.nextthink = time + 10; + other.think = BallStart; + other.movetype = 9; + other.velocity_z = 40; + other.effects = self.team_no * 64; +}; + +void() sandball_goal = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/null.mdl"); + precache_sound("sandball/goal.wav"); + precache_sound("sandball/whistle.wav"); + precache_sound("zombie/z_fall.wav"); + setmodel(self, "progs/null.mdl"); + self.movetype = TF_FLARE_LIT; + self.skin = self.team_no; + self.solid = TF_FLARE_OFF; + setsize(self, '-35 -35 -14', '35 35 50'); + self.effects = TF_FLARE_LIT; + self.touch = GoalTouch; +}; + +void() skeet_die = +{ + if (other == self.owner) + { + return; + } + if (pointcontents(self.origin) == -6) + { + self.velocity_z = -50; + self.origin_z = self.origin_z - 30; + return; + } + self.color = 5; + glass_die(); + dremove(self); +}; + +void() givepoint = +{ + make_explosion(); + self.enemy.real_frags = self.enemy.real_frags + 3; + self.enemy.frags = self.enemy.frags + 3; + self.color = 8; + self.height = 100; + glass_die(); + dremove(self); +}; + +void() skeet_shooter = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_model("progs/player.mdl"); + precache_model("progs/glass1.mdl"); + precache_model("progs/glass2.mdl"); + precache_sound("plats/plat2.wav"); + precache_sound("effects/shatter.wav"); + precache_sound("effects/rcksplsh.wav"); + self.nextthink = time + random() * 5; + self.think = skeet_sound; + if (!(self.speed)) + { +// self.speed == 1000; + self.speed = 1000; + } + precache_model2("maps/b_exbox2.bsp"); + setmodel(self, "maps/b_exbox2.bsp"); + self.movetype = TF_FLARE_LIT; + self.solid = TF_FLARE_LIT; + setsize(self, '0 0 0', '0 0 0'); + self.origin_z = self.origin_z + 2; + droptofloor(); +}; + +void() skeet_sound = +{ + sound(self, 3, "plats/plat2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.think = skeet_fly; + self.nextthink = time + 1.5; +}; + +void() skeet_fly = +{ + sound(self, 3, "plats/plat2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + newmis = spawn(); + newmis.solid = 2; + newmis.movetype = 6; + newmis.velocity = '0 0 1000'; + newmis.velocity_x = random() * 600 - 300; + newmis.velocity_y = random() * 600 - 300; + newmis.velocity_z = self.speed + random() * 200; + newmis.classname = "bot"; + newmis.owner = self; + setmodel(newmis, "progs/player.mdl"); + newmis.skin = TF_FLARE_OFF; + newmis.frame = 2; + newmis.avelocity = '0 200 0'; + setsize(newmis, '-8 -8 -4', '8 8 4'); + setorigin(newmis, self.origin + '0 0 10'); + newmis.nextthink = time + 5; + newmis.think = SUB_Remove; + newmis.touch = skeet_die; + newmis.health = TF_FLARE_OFF; + newmis.takedamage = 2; + newmis.th_die = givepoint; + newmis.noise2 = "effects/shatter.wav"; + self.nextthink = time + random() * 5 + 3; + self.think = skeet_fly; +}; + +void() Random_Play = +{ + if (self.spawnflags == 4) + { + sound(self, TF_FLARE_LIT, self.noise, TF_FLARE_OFF, TF_FLARE_LIT); + } + else + { + sound(self, TF_FLARE_LIT, self.noise, TF_FLARE_OFF, TF_FLARE_OFF); + } + self.nextthink = time + RandomRange(self.option, self.option2); +}; + +void() effect_random_sound = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.noise)) + { + objerror("random_sound without noise"); + } + if (!(self.volume)) + { + self.volume = TF_FLARE_OFF; + } + precache_sound(self.noise); + self.nextthink = time + RandomRange(self.option, self.option2); + self.think = Random_Play; +}; + diff --git a/missiles.pqc b/missiles.pqc new file mode 100644 index 0000000..6fe324e --- /dev/null +++ b/missiles.pqc @@ -0,0 +1,412 @@ +void() M_Laser_Touch; +void() M_Grenade_Explode; +void() M_Grenade_Touch; +void() M_Missile_Touch; +void() M_Spike_Touch; +void() M_Arrow_Point; +void() M_Arrow_Touch; + +entity(string mismodel, vector misorigin, vector misvelocity) launch_missile = +{ + local entity missile; + missile = spawn(); + missile.owner = self; + missile.solid = 2; + setmodel(missile, mismodel); + setsize(missile, '0 0 0', '0 0 0'); + setorigin(missile, misorigin); + missile.velocity = misvelocity; + missile.avelocity = '0 0 0'; + missile.angles = vectoangles(missile.velocity); + if (mismodel == "progs/laser.mdl") + { + missile.classname = "laser"; + missile.movetype = 5; + missile.effects = 8; + missile.nextthink = time + 5; + missile.attack_finished = missile.nextthink; + missile.think = SUB_Remove; + missile.touch = M_Laser_Touch; + missile.ammo_shells = 15; + missile.ammo_nails = TF_FLARE_LIT; + } + else + { + if (mismodel == "progs/grenade.mdl") + { + missile.classname = "grenade"; + missile.movetype = 10; + missile.avelocity = '300 300 300'; + missile.think = M_Grenade_Explode; + missile.touch = M_Grenade_Touch; + missile.ammo_shells = 100; + missile.ammo_nails = TF_FLARE_LIT; + missile.gravity = self.gravity; + missile.nextthink = time + 2 + TF_FLARE_OFF / missile.gravity; + if (missile.nextthink < time + TF_FLARE_OFF) + { + missile.nextthink = time + TF_FLARE_OFF; + } + if (missile.nextthink > time + 15) + { + missile.nextthink = time + 15; + } + missile.attack_finished = missile.nextthink; + } + else + { + if (mismodel == "progs/missile.mdl") + { + missile.classname = "missile"; + missile.movetype = 5; + missile.effects = 8; + missile.nextthink = time + 5; + missile.attack_finished = missile.nextthink; + missile.think = SUB_Remove; + missile.touch = M_Missile_Touch; + missile.ammo_shells = 100; + missile.ammo_nails = TF_FLARE_LIT; + } + else + { + if (mismodel == "progs/lavaball.mdl") + { + missile.classname = "lavaball"; + missile.solid = TF_FLARE_OFF; + missile.movetype = 6; + missile.avelocity = '300 300 300'; + missile.think = M_Grenade_Explode; + missile.touch = M_Grenade_Explode; + missile.ammo_shells = 100; + missile.ammo_nails = TF_FLARE_LIT; + missile.gravity = self.gravity; + missile.effects = 8; + missile.nextthink = time + 2 + TF_FLARE_OFF / missile.gravity; + if (missile.nextthink < time + TF_FLARE_OFF) + { + missile.nextthink = time + TF_FLARE_OFF; + } + if (missile.nextthink > time + 15) + { + missile.nextthink = time + 15; + } + missile.attack_finished = missile.nextthink; + } + else + { + if (mismodel == "progs/spike.mdl" || mismodel == "progs/s_spike.mdl") + { + missile.classname = "spike"; + missile.movetype = 5; + setsize(missile, '0 0 0', '0 0 0'); + missile.nextthink = time + 6; + missile.attack_finished = missile.nextthink; + missile.think = SUB_Remove; + missile.touch = M_Spike_Touch; + if (mismodel == "progs/s_spike.mdl") + { + missile.ammo_shells = 18; + } + else + { + missile.ammo_shells = 9; + } + missile.ammo_nails = TF_FLARE_LIT; + } + else + { + if (mismodel == "progs/k_spike.mdl" || mismodel == "progs/w_spike.mdl") + { + if (mismodel == "progs/w_spike.mdl") + { + missile.classname = "wizspike"; + } + else + { + missile.classname = "knightspike"; + } + missile.movetype = 5; + setsize(missile, '0 0 0', '0 0 0'); + missile.nextthink = time + 6; + missile.attack_finished = missile.nextthink; + missile.think = SUB_Remove; + missile.touch = M_Spike_Touch; + missile.ammo_shells = 9; + missile.ammo_nails = TF_FLARE_LIT; + } + else + { + if (mismodel == "progs/arrow.mdl") + { + missile.classname = "arrow"; + missile.movetype = 6; + setsize(missile, '0 0 0', '0 0 0'); + missile.nextthink = time + 0.05; + missile.attack_finished = time + 5; + missile.gravity = self.gravity; + missile.think = M_Arrow_Point; + missile.touch = M_Arrow_Touch; + missile.ammo_shells = 15; + missile.ammo_nails = 5; + } + } + } + } + } + } + } + return missile; +}; + +void(entity missile, float basedamage, float randdamage) setdmg_missile = +{ + missile.ammo_shells = basedamage; + missile.ammo_nails = randdamage; +}; +// pablo. f u decompiler! luckily it's never called :) +/* +//void(entity missile, float misnextthink, misthink, mistouch, float basedamage, float randdamage) setup_missile = +{ + missile.nextthink = time + misnextthink; + missile.think = misthink; + missile.touch = mistouch; + missile.ammo_shells = basedamage; + missile.ammo_nails = randdamage; +};*/ + +void(entity missile, vector mistarget, float targeting) target_missile = +{ + local vector misvelocity; + misvelocity = missile.velocity; + if (targeting == TF_FLARE_OFF) + { + missile.velocity = normalize(mistarget - missile.origin); + missile.velocity = missile.velocity * misvelocity_x; + } + else + { + if (targeting == 2) + { + missile.velocity = normalize(mistarget - self.origin); + missile.velocity = missile.velocity * misvelocity_x; + missile.velocity_z = misvelocity_z; + } + else + { + if (targeting == 3) + { + missile.velocity = normalize(mistarget + '0 0 16' - missile.origin); + missile.angles = vectoangles(missile.velocity); + makevectors(missile.angles); + missile.velocity = missile.velocity * misvelocity_x + v_up * misvelocity_z; + } + else + { + if (targeting == 4) + { + missile.velocity = normalize(mistarget - missile.origin); + missile.velocity = missile.velocity * vlen(misvelocity); + } + else + { + if (targeting == 5) + { + missile.velocity = mistarget - missile.origin; + missile.angles = vectoangles(missile.velocity); + makevectors(missile.angles); + missile.velocity = mistarget + v_right * misvelocity_y + v_up * misvelocity_z; + missile.velocity = normalize(missile.velocity - missile.origin); + missile.velocity = missile.velocity * misvelocity_x; + } + } + } + } + } + missile.angles = vectoangles(missile.velocity); +}; + +void() M_Grenade_Explode = +{ + local float totaldmg; + totaldmg = self.ammo_shells + random() * self.ammo_nails; + T_RadiusDamage(self, self.owner, totaldmg, world); + BecomeExplosion(); +}; + +void() M_Grenade_Touch = +{ + if (other == self.owner) + { + return; + } + if (other.takedamage == 2) + { + M_Grenade_Explode(); + return; + } + sound(self, TF_FLARE_OFF, "weapons/bounce.wav", TF_FLARE_OFF, TF_FLARE_OFF); + if (self.velocity == '0 0 0') + { + self.avelocity = '0 0 0'; + } +}; + +void() M_Laser_Touch = +{ + local float totaldmg; + local vector org; + if (other == self.owner) + { + return; + } + if (pointcontents(self.origin) == -6) + { + remove(self); + return; + } + totaldmg = self.ammo_shells + random() * self.ammo_nails; + if (self.ammo_shells + self.ammo_nails == TF_FLARE_LIT) + { + totaldmg = 15; + } + org = self.origin - 8 * normalize(self.velocity); + if (other.health) + { + T_Damage(other, self, self.owner, totaldmg); + } + else + { + sound(self, TF_FLARE_OFF, "enforcer/enfstop.wav", TF_FLARE_OFF, 3); + } + remove(self); +}; + +void() M_Missile_Touch = +{ + local float totaldmg; + if (other == self.owner) + { + return; + } + if (pointcontents(self.origin) == -6) + { + remove(self); + return; + } + totaldmg = self.ammo_shells + random() * self.ammo_nails; + if (other.health) + { + if (self.owner.classname == "monster_shalrath") + { + if (other.classname == "monster_zombie") + { + T_Damage(other, self, self, 110); + } + else + { + if (other.classname == "monster_axzombie") + { + T_Damage(other, self, self.owner, 200); + } + } + } + else + { + if (other.classname == "monster_shambler") + { + T_Damage(other, self, self.owner, totaldmg * 0.5 + 10); + } + else + { + T_Damage(other, self, self.owner, totaldmg + 20); + } + } + } + else + { + if (self.classname == "pulse") + { + sound(self, 2, "enforcer/enfstop.wav", TF_FLARE_OFF, 3); + remove(self); + return; + } + } + if (self.owner.classname == "monster_shalrath") + { + T_RadiusDamage(self, self.owner, totaldmg, world); + } + else + { + T_RadiusDamage(self, self.owner, totaldmg, other); + } + sound(self, TF_FLARE_OFF, "weapons/r_exp3.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.origin = self.origin - 8 * normalize(self.velocity); + sound(self, TF_FLARE_OFF, "weapons/r_exp3.wav", TF_FLARE_OFF, TF_FLARE_OFF); + BecomeExplosion(); +}; + +void() M_Spike_Touch = +{ + local float totaldmg; + if (other == self.owner) + { + return; + } + if (other.solid == TF_FLARE_OFF) + { + return; + } + if (pointcontents(self.origin) == -6) + { + remove(self); + return; + } + if (other.takedamage) + { + totaldmg = self.ammo_shells + random() * self.ammo_nails; + T_Damage(other, self, self.owner, totaldmg); + remove(self); + return; + } + if (self.classname == "dspike" && random() < 0.33) + { + remove(self); + return; + } + remove(self); +}; + +void() M_Arrow_Point = +{ + self.nextthink = time + 0.05; + self.angles = vectoangles(self.velocity); +}; + +void() M_Arrow_Touch = +{ + local float totaldmg; + if (other == self.owner) + { + return; + } + if (other.solid == TF_FLARE_OFF) + { + return; + } + if (pointcontents(self.origin) == -6) + { + remove(self); + return; + } + if (other.takedamage) + { + sound(other, 4, "weapons/arrowhit.wav", TF_FLARE_OFF, TF_FLARE_OFF); + totaldmg = self.ammo_shells + random() * self.ammo_nails; + T_Damage(other, self, self.owner, totaldmg); + remove(self); + return; + } + self.nextthink = time + TF_FLARE_OFF + random() * TF_FLARE_OFF; + self.think = SUB_Remove; +}; + diff --git a/monsters.pqc b/monsters.pqc new file mode 100644 index 0000000..0c50304 --- /dev/null +++ b/monsters.pqc @@ -0,0 +1,271 @@ +void() FoundTarget; + +float(entity targ) visible = +{ + local vector spot1; + local vector spot2; + spot1 = self.origin + self.view_ofs; + spot2 = targ.origin + targ.view_ofs; + traceline(spot1, spot2, TF_FLARE_OFF, self); + if (trace_inopen && trace_inwater) + { + return TF_FLARE_LIT; + } + if (trace_fraction == TF_FLARE_OFF) + { + return TF_FLARE_OFF; + } + return TF_FLARE_LIT; +}; + +void() monster_ogre = +{ + dremove(self); +}; + +void() monster_knight = +{ + dremove(self); +}; + +void() monster_shambler = +{ + dremove(self); +}; + +void() monster_demon1 = +{ + dremove(self); +}; + +void() monster_wizard = +{ + dremove(self); +}; + +void() monster_hell_knight = +{ + dremove(self); +}; + +void() monster_tarbaby = +{ + dremove(self); +}; + +void() monster_vomit = +{ + dremove(self); +}; + +void() monster_enforcer = +{ + dremove(self); +}; + +void() monster_shalrath = +{ + dremove(self); +}; + +void() monster_dragon = +{ + dremove(self); +}; + +void() monster_army = +{ + dremove(self); +}; + +void() monster_use = +{ + if (self.enemy) + { + return; + } + if (self.health <= TF_FLARE_LIT) + { + return; + } + if (activator.items & 524288) + { + return; + } + if (activator.flags & 128) + { + return; + } + if (activator.classname != "player" && activator.classname != "bot") + { + return; + } + if (activator.team_no == self.team_no) + { + self.enemy = world; + return; + } + self.enemy = activator; + self.nextthink = time + 0.1; + self.think = FoundTarget; +}; + +void() set_monster_health = +{ + skill = cvar("skill"); + if (skill > 2) + { + self.lives = (skill - 2) * 10 - TF_FLARE_OFF; + skill = 3; + } +}; + +void() walkmonster_start_go = +{ + self.movetype = 4; + self.origin_z = self.origin_z + TF_FLARE_OFF; + droptofloor(); + if (!walkmove(TF_FLARE_LIT, TF_FLARE_LIT)) + { + dprint("walkmonster in wall at: "); + dprint(vtos(self.origin)); + dprint("\n"); + } + self.takedamage = 2; + self.ideal_yaw = self.angles * '0 1 0'; + if (!(self.yaw_speed)) + { + self.yaw_speed = 20; + } + self.view_ofs = '0 0 16'; + self.use = monster_use; + self.flags = self.flags | 32; + if (self.target) + { + self.goalentity = self.movetarget = find(world, targetname, self.target); + self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin); + if (!(self.movetarget)) + { + dprint("Monster can't find target at "); + dprint(vtos(self.origin)); + dprint("\n"); + } + if (self.movetarget.classname == "path_corner") + { + self.th_walk(); + } + else + { + self.pausetime = 100000000; + } + self.th_stand(); + } + else + { + self.pausetime = 100000000; + self.th_stand(); + } + self.nextthink = self.nextthink + random() * 0.5; +}; + +void() walkmonster_start = +{ + self.nextthink = self.nextthink + random() * 0.5; + self.think = walkmonster_start_go; + total_monsters = total_monsters + TF_FLARE_OFF; + set_monster_health(); +}; + +void() flymonster_start_go = +{ + self.takedamage = 2; + self.ideal_yaw = self.angles * '0 1 0'; + if (!(self.yaw_speed)) + { + self.yaw_speed = 10; + } + self.view_ofs = '0 0 25'; + self.use = monster_use; + self.flags = self.flags | TF_FLARE_OFF; + self.flags = self.flags | 32; + if (!walkmove(TF_FLARE_LIT, TF_FLARE_LIT)) + { + dprint("flymonster in wall at: "); + dprint(vtos(self.origin)); + dprint("\n"); + } + if (self.target) + { + self.goalentity = self.movetarget = find(world, targetname, self.target); + if (!(self.movetarget)) + { + dprint("Monster can't find target at "); + dprint(vtos(self.origin)); + dprint("\n"); + } + if (self.movetarget.classname == "path_corner") + { + self.th_walk(); + } + else + { + self.pausetime = 100000000; + } + self.th_stand(); + } + else + { + self.pausetime = 100000000; + self.th_stand(); + } +}; + +void() flymonster_start = +{ + self.nextthink = self.nextthink + random() * 0.5; + self.think = flymonster_start_go; + total_monsters = total_monsters + TF_FLARE_OFF; + set_monster_health(); +}; + +void() swimmonster_start_go = +{ + self.takedamage = 2; + total_monsters = total_monsters + TF_FLARE_OFF; + self.ideal_yaw = self.angles * '0 1 0'; + if (!(self.yaw_speed)) + { + self.yaw_speed = 10; + } + self.view_ofs = '0 0 10'; + self.use = monster_use; + self.flags = self.flags | 2; + self.flags = self.flags | 32; + if (self.target) + { + self.goalentity = self.movetarget = find(world, targetname, self.target); + if (!(self.movetarget)) + { + dprint("Monster can't find target at "); + dprint(vtos(self.origin)); + dprint("\n"); + } + self.ideal_yaw = vectoyaw(self.goalentity.origin - self.origin); + self.th_walk(); + } + else + { + self.pausetime = 100000000; + self.th_stand(); + } + self.nextthink = self.nextthink + random() * 0.5; +}; + +void() swimmonster_start = +{ + self.nextthink = self.nextthink + random() * 0.5; + self.think = swimmonster_start_go; + total_monsters = total_monsters + TF_FLARE_OFF; + set_monster_health(); +}; + diff --git a/mturret.pqc b/mturret.pqc new file mode 100644 index 0000000..5739ba9 --- /dev/null +++ b/mturret.pqc @@ -0,0 +1,731 @@ +.float rotate_type; + +void() turret_ret2; +void() turret_active; + +void() beam_touch = +{ + local float totaldmg; + if (other == self.owner) + { + return; + } + if (other.solid == TF_FLARE_OFF) + { + return; + } + if (pointcontents(self.origin) == -6) + { + remove(self); + return; + } + if (other.takedamage) + { + totaldmg = self.currentammo * 1.25; + totaldmg = ceil(totaldmg); + if (other.health <= totaldmg) + { + T_Damage(other, self, self.owner, 99999); + if (other.health <= TF_FLARE_LIT) + { + remove(self); + return; + } + } + else + { + T_Damage(other, self, self.owner, totaldmg); + } + } + sound(self, 3, "enforcer/enfstop.wav", TF_FLARE_OFF, TF_FLARE_OFF); + BecomeExplosion(); +}; + +void() beam_generate = +{ + local entity beamseg; + beamseg = spawn(); + beamseg.owner = self.owner; + beamseg.solid = 2; + setmodel(beamseg, "progs/beam.mdl"); + beamseg.skin = self.owner.team_no - TF_FLARE_OFF; + setsize(beamseg, '0 0 0', '0 0 0'); + makevectors(self.owner.v_angle); + if (self.owner.flags & 8) + { + self.owner.attack_finished = time + 0.5; + setorigin(beamseg, self.owner.origin + v_forward * 12 + self.owner.dest2); + beamseg.velocity = aim(self.owner, 800) * 800; + } + else + { + if (self.owner.flags & 32) + { + setorigin(beamseg, self.owner.origin); + beamseg.velocity = normalize(self.owner.enemy.origin - self.owner.origin) * 800; + } + else + { + setorigin(beamseg, self.owner.origin); + beamseg.velocity = self.owner.movedir * 800; + } + } + beamseg.angles = vectoangles(beamseg.velocity); + beamseg.speed = 800; + beamseg.classname = "beam"; + beamseg.movetype = 9; + beamseg.currentammo = self.currentammo; + beamseg.touch = beam_touch; + beamseg.think = SUB_Remove; + beamseg.nextthink = time + 6; + sound(self.owner, TF_FLARE_OFF, "enforcer/enfire.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.currentammo = self.currentammo / 2; + if (self.owner.flags & 8 && self.deadflag == TF_FLARE_LIT) + { + self.owner.velocity = self.velocity - v_forward * self.currentammo * 2; + } + if (self.currentammo < TF_FLARE_OFF) + { + remove(self); + } + self.nextthink = time + 0.05; +}; + +float(float pitch) turret_frame = +{ + return floor(pitch / 5.625); +}; + +float(float pitch) turret_fireframe = +{ + return turret_frame(pitch) + 23; +}; + +float() CheckTurretAttack = +{ + local vector spot1; + local vector spot2; + local entity targ; + local float chance; + targ = self.enemy; + spot1 = self.origin + self.view_ofs; + spot2 = targ.origin + targ.view_ofs; + traceline(spot1, spot2, TF_FLARE_LIT, self); + if (trace_ent != targ) + { + return TF_FLARE_LIT; + } + if (trace_inopen && trace_inwater) + { + return TF_FLARE_LIT; + } + if (time < self.attack_finished) + { + return TF_FLARE_LIT; + } + if (enemy_range == TF_FLARE_LIT) + { + chance = 0.9; + } + else + { + if (enemy_range == TF_FLARE_OFF) + { + chance = 0.6; + } + else + { + if (enemy_range == 2) + { + chance = 0.3; + } + else + { + chance = 0.1; + } + } + } + if (random() < chance) + { + self.th_missile(); + if (self.spawnflags & 8) + { + SUB_AttackFinished(1.5 + 2 * random()); + } + if (self.spawnflags & 16) + { + SUB_AttackFinished(1.5 + 3 * random()); + } + if (self.spawnflags & 32) + { + SUB_AttackFinished(TF_FLARE_OFF + TF_FLARE_OFF * random()); + } + else + { + SUB_AttackFinished(TF_FLARE_OFF + 1.5 * random()); + } + return TF_FLARE_OFF; + } + return TF_FLARE_LIT; +}; + +void() turret_face = +{ + local vector tmpvec; + tmpvec = vectoangles(self.origin - (self.enemy.origin + self.enemy.view_ofs)); + if (tmpvec_x > self.rotate_type) + { + if (tmpvec_x > self.rotate_type + 6) + { + self.rotate_type = self.rotate_type + 6; + } + else + { + self.rotate_type = tmpvec_x; + } + } + else + { + if (tmpvec_x < self.rotate_type) + { + if (tmpvec_x < self.rotate_type - 6) + { + self.rotate_type = self.rotate_type - 6; + } + else + { + self.rotate_type = tmpvec_x; + } + } + } + self.frame = turret_frame(self.rotate_type); + self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin); + ChangeYaw(); +}; + +void() turret_still = [0, turret_still] +{ + self.frame = turret_frame(self.rotate_type); + FindTarget(); +}; + +void() turret_ret1 = [16, turret_ret1] +{ + if (self.frame >= 15) + { + turret_ret2(); + return; + } + self.frame = self.frame + TF_FLARE_OFF; + self.nextthink = time + 0.05; +}; + +void() turret_ret2 = [16, turret_ret3] +{ + self.nextthink = time + 0.2; + sound(self, 3, "weapons/gunidle1.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void() turret_ret3 = [17, turret_ret4] +{ + self.nextthink = time + 0.2; +}; + +void() turret_ret4 = [18, turret_ret5] +{ + self.nextthink = time + 0.2; +}; + +void() turret_ret5 = [19, turret_ret6] +{ + self.solid = TF_FLARE_LIT; + self.nextthink = time + 0.2; +}; + +void() turret_ret6 = [20, turret_ret7] +{ + self.nextthink = time + 0.2; +}; + +void() turret_ret7 = [21, turret_ret8] +{ + self.nextthink = time + 0.2; +}; + +void() turret_ret8 = [22, turret_retracted] +{ + if (!(self.currentammo)) + { + self.think = SUB_Null; + } + self.nextthink = time + 0.05; +}; + +void() turret_unret1 = [21, turret_unret2] +{ + self.nextthink = time + 0.05; + sound(self, 3, "weapons/gunidle1.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void() turret_unret2 = [20, turret_unret3] +{ + self.nextthink = time + 0.05; +}; + +void() turret_unret3 = [19, turret_unret4] +{ + self.nextthink = time + 0.05; +}; + +void() turret_unret4 = [18, turret_unret5] +{ + self.solid = 3; + setmodel(self, "progs/turret.mdl"); + self.nextthink = time + 0.05; +}; + +void() turret_unret5 = [17, turret_unret6] +{ + self.nextthink = time + 0.05; +}; + +void() turret_unret6 = [16, turret_unret7] +{ + self.nextthink = time + 0.05; +}; + +void() turret_unret7 = [0, turret_unret7] +{ + if (self.frame > turret_frame(self.rotate_type) + TF_FLARE_OFF) + { + self.frame = self.frame - 2; + } + else + { + self.frame = turret_frame(self.rotate_type); + turret_active(); + } +}; + +void() turret_retracted = [22, turret_retracted] +{ + if (FindTarget()) + { + turret_unret1(); + } +}; + +void() turret_active = [0, turret_active] +{ + enemy_infront = infront(self.enemy); + enemy_range = range(self.enemy); + enemy_yaw = vectoyaw(self.enemy.origin - self.origin); + self.frame = turret_frame(self.rotate_type); + enemy_vis = visible(self.enemy); + if (self.enemy.health <= TF_FLARE_LIT || self.enemy.deadflag != TF_FLARE_LIT || !enemy_vis) + { + self.enemy = world; + enemy_vis = visible(self.oldenemy); + if (enemy_vis && self.oldenemy.health > TF_FLARE_LIT) + { + self.enemy = self.oldenemy; + HuntTarget(); + } + else + { + self.th_stand(); + return; + } + } + self.show_hostile = time + TF_FLARE_OFF; + enemy_vis = visible(self.enemy); + if (enemy_vis) + { + self.search_time = time + 0.2; + } + if (self.search_time < time) + { + if (FindTarget()) + { + return; + } + } + if (self.attack_state == 4 || self.attack_state == 3) + { + ai_run_missile(); + return; + } + CheckTurretAttack(); +}; + +void() turret_bullet1 = [0, turret_bullet2] +{ + local vector dir; + turret_face(); + self.frame = turret_fireframe(self.rotate_type); + sound(self, TF_FLARE_OFF, "turret/plasbult.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.effects = self.effects | 2; + dir = self.enemy.origin - self.enemy.velocity * 0.3 * random(); + dir = normalize(dir - self.origin); + deathmsg = 44; + FireBullets(2, dir, '0 0 0'); +}; + +void() turret_bullet2 = [0, turret_bullet3] +{ + turret_face(); + self.nextthink = time + 0.05; +}; + +void() turret_bullet3 = [0, turret_bullet4] +{ + local vector dir; + turret_face(); + self.frame = turret_fireframe(self.rotate_type); + sound(self, TF_FLARE_OFF, "turret/plasbult.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.effects = self.effects | 2; + dir = self.enemy.origin - self.enemy.velocity * 0.3 * random(); + dir = normalize(dir - self.origin); + FireBullets(2, dir, '0 0 0'); +}; + +void() turret_bullet4 = [0, turret_bullet5] +{ + turret_face(); + self.nextthink = time + 0.05; +}; + +void() turret_bullet5 = [0, turret_active] +{ + local vector dir; + turret_face(); + self.frame = turret_fireframe(self.rotate_type); + sound(self, TF_FLARE_OFF, "turret/plasbult.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.effects = self.effects | 2; + dir = self.enemy.origin - self.enemy.velocity * 0.3 * random(); + dir = normalize(dir - self.origin); + FireBullets(2, dir, '0 0 0'); +}; + +void() turret_laser1 = [0, turret_laser2] +{ + turret_face(); + self.frame = turret_fireframe(self.rotate_type); + sound(self, TF_FLARE_OFF, "enforcer/enfire.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.effects = self.effects | 2; + deathmsg = 44; + newmis = launch_missile("progs/laser.mdl", self.origin, '600 0 0'); + target_missile(newmis, self.enemy.origin, TF_FLARE_OFF); +}; + +void() turret_laser2 = [0, turret_laser3] +{ + turret_face(); +}; + +void() turret_laser3 = [0, turret_laser4] +{ + turret_face(); +}; + +void() turret_laser4 = [0, turret_laser5] +{ + turret_face(); +}; + +void() turret_laser5 = [0, turret_active] +{ + turret_face(); + self.frame = turret_fireframe(self.rotate_type); + sound(self, TF_FLARE_OFF, "enforcer/enfire.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.effects = self.effects | 2; + deathmsg = 44; + newmis = launch_missile("progs/laser.mdl", self.origin, '600 0 0'); + target_missile(newmis, self.enemy.origin, TF_FLARE_OFF); +}; + +void() turret_rocket1 = [0, turret_active] +{ + turret_face(); + self.frame = turret_fireframe(self.rotate_type); + sound(self, TF_FLARE_OFF, "weapons/sgun1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.effects = self.effects | 2; + deathmsg = 44; + newmis = launch_missile("progs/missile.mdl", self.origin, '1000 0 0'); + target_missile(newmis, self.enemy.origin, TF_FLARE_OFF); + setdmg_missile(newmis, 15, 15); +}; + +void() turret_beam1 = [0, turret_beam2] +{ + deathmsg = 44; + turret_face(); + sound(self, TF_FLARE_OFF, "weapons/railgr1a.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.nextthink = time + 0.2; +}; + +void() turret_beam2 = [0, turret_beam3] +{ + deathmsg = 44; + sound(self, TF_FLARE_OFF, "weapons/railgr1a.wav", TF_FLARE_OFF, TF_FLARE_OFF); + turret_face(); + self.nextthink = time + 0.2; +}; + +void() turret_beam3 = [0, turret_beam4] +{ + deathmsg = 44; + sound(self, TF_FLARE_OFF, "weapons/railgr1a.wav", TF_FLARE_OFF, TF_FLARE_OFF); + turret_face(); + self.nextthink = time + 0.2; +}; + +void() turret_beam4 = [0, turret_beam5] +{ + deathmsg = 44; + turret_face(); + self.frame = turret_fireframe(self.rotate_type); + if (self.waterlevel > TF_FLARE_OFF) + { + return; + } + newmis = spawn(); + newmis.solid = TF_FLARE_LIT; + newmis.movetype = 5; + newmis.currentammo = 10; + setorigin(newmis, self.origin); + newmis.owner = self; + newmis.think = beam_generate; + newmis.nextthink = time + 0.05; +}; + +void() turret_beam5 = [0, turret_beam6] +{ + turret_face(); +}; + +void() turret_beam6 = [0, turret_beam7] +{ + turret_face(); +}; + +void() turret_beam7 = [0, turret_active] +{ + turret_face(); +}; + +void() turret_fire1 = [0, turret_fire2] +{ + turret_face(); + if (infront(self.enemy)) + { + self.think = turret_fire2; + } + self.nextthink = time + 0.05; +}; + +void() turret_fire2 = [0, turret_fire3] +{ + turret_face(); + self.nextthink = time + 0.05; +}; + +void() turret_fire3 = [0, turret_fire4] +{ + turret_face(); + self.nextthink = time + 0.05; +}; + +void() turret_fire4 = [0, turret_fire4] +{ + deathmsg = 44; + turret_face(); + if (self.spawnflags & 8) + { + turret_laser1(); + } + else + { + if (self.spawnflags & 16) + { + turret_rocket1(); + } + else + { + if (self.spawnflags & 32) + { + turret_beam1(); + } + else + { + turret_bullet1(); + } + } + } +}; + +void() turret_die = +{ + local entity dedtur; + self.use = SUB_Null; + self.effects = TF_FLARE_LIT; + dedtur = spawn(); + dedtur.solid = TF_FLARE_LIT; + dedtur.movetype = 10; + dedtur.angles = self.angles; + dedtur.avelocity = '300 300 200'; + setorigin(dedtur, self.origin); + setmodel(dedtur, "progs/dedturet.mdl"); + setsize(self, '-10 -10 -3', '10 10 12'); + dedtur.skin = self.skin; + dedtur.effects = TF_FLARE_LIT; + ThrowHead("progs/h_turret.mdl", self.health); +}; + +void(entity attacker, float damage) turret_pain = +{ + if (self.pain_finished > time) + { + return; + } + self.pain_finished = time + TF_FLARE_OFF; +}; + +void() turret_use = +{ + if (self.currentammo) + { + self.currentammo = TF_FLARE_LIT; + if (self.spawnflags & 2 || (self.spawnflags & 4)) + { + turret_ret1(); + } + else + { + self.think = SUB_Null; + } + } + else + { + self.currentammo = TF_FLARE_OFF; + if (self.spawnflags & 2 || (self.spawnflags & 4)) + { + turret_unret1(); + } + else + { + turret_still(); + } + } +}; + +void() turret_setup = +{ + local vector endorg; + traceline(self.origin, self.origin + '0 0 2000', TF_FLARE_OFF, self); + endorg = trace_endpos; + endorg_z = endorg_z - 12; + setorigin(self, endorg); + if (self.spawnflags & TF_FLARE_OFF) + { + if (self.spawnflags & 2 || (self.spawnflags & 4)) + { + self.frame = 22; + self.solid = TF_FLARE_LIT; + } + else + { + self.frame = turret_frame(self.rotate_type); + } + self.currentammo = TF_FLARE_LIT; + self.think = SUB_Null; + } + else + { + if (self.spawnflags & 2) + { + self.solid = TF_FLARE_LIT; + turret_retracted(); + } + else + { + turret_still(); + } + self.nextthink = self.nextthink + random() * 0.5; + } +}; + +void() monster_turret = +{ + precache_model("progs/turret.mdl"); + precache_model("progs/h_turret.mdl"); + precache_model("progs/dedturet.mdl"); + if (self.spawnflags & 8) + { + precache_model("progs/laser.mdl"); + precache_sound("enforcer/enfire.wav"); + precache_sound("enforcer/enfstop.wav"); + } + else + { + if (self.spawnflags & 16) + { + precache_model("progs/missile.mdl"); + precache_sound("weapons/sgun1.wav"); + } + else + { + if (self.spawnflags & 32) + { + precache_model("progs/beam.mdl"); + precache_sound("enforcer/enfire.wav"); + precache_sound("enforcer/enfstop.wav"); + } + else + { + precache_sound("turret/plasbult.wav"); + } + } + } + self.solid = 3; + self.movetype = 4; + setmodel(self, "progs/turret.mdl"); + setsize(self, '-12 -12 -8', '12 12 12'); + if (self.health < TF_FLARE_OFF) + { + self.health = 1500; + } + self.max_health = self.health; + if (self.rotate_type < TF_FLARE_LIT || self.rotate_type > 90) + { + self.rotate_type = TF_FLARE_LIT; + } + self.currentammo = TF_FLARE_OFF; + self.classname = "bot"; + if (self.spawnflags & 2) + { + self.th_stand = turret_ret1; + self.th_walk = turret_ret1; + } + else + { + self.th_stand = turret_still; + self.th_walk = turret_still; + } + self.th_run = turret_active; + self.th_pain = turret_pain; + self.th_die = turret_die; + self.th_missile = turret_fire1; + total_monsters = total_monsters + TF_FLARE_OFF; + self.takedamage = 2; + self.ideal_yaw = self.angles * '0 1 0'; + self.yaw_speed = 30; + self.view_ofs = '0 0 -0.1'; + self.use = turret_use; + self.flags = self.flags | TF_FLARE_OFF; + self.flags = self.flags | 32; + self.pausetime = 100000000; + self.nextthink = self.nextthink + random() * 0.5; + self.think = turret_setup; +}; + diff --git a/plats.pqc b/plats.pqc new file mode 100644 index 0000000..dd9bbe4 --- /dev/null +++ b/plats.pqc @@ -0,0 +1,486 @@ +void() train_next; +void() func_train_find; +void() plat_center_touch; +void() plat_outside_touch; +void() plat_trigger_use; +void() plat_go_up; +void() plat_go_down; +void() plat_crush; + +void() plat_spawn_inside_trigger = +{ + local entity trigger; + local vector tmin; + local vector tmax; + trigger = spawn(); + trigger.touch = plat_center_touch; + trigger.movetype = 0; + trigger.solid = 1; + trigger.enemy = self; + trigger.team_no = self.team_no; + trigger.playerclass = self.playerclass; + trigger.items_allowed = self.items_allowed; + trigger.activate_goal_no = self.activate_goal_no; + trigger.inactivate_goal_no = self.inactivate_goal_no; + trigger.remove_goal_no = self.remove_goal_no; + trigger.restore_goal_no = self.restore_goal_no; + trigger.activate_group_no = self.activate_group_no; + trigger.inactivate_group_no = self.inactivate_group_no; + trigger.remove_group_no = self.remove_group_no; + trigger.restore_group_no = self.restore_group_no; + trigger.goal_activation = self.goal_activation; + trigger.goal_effects = self.goal_effects; + trigger.goal_result = self.goal_result; + trigger.goal_group = self.goal_group; + tmin = self.mins + '25 25 0'; + tmax = self.maxs - '25 25 -8'; + tmin_z = tmax_z - (self.pos1_z - self.pos2_z + 8); + if (self.spawnflags & 1) + { + tmax_z = tmin_z + 8; + } + if (self.size_x <= 50) + { + tmin_x = (self.mins_x + self.maxs_x) / 2; + tmax_x = tmin_x + 1; + } + if (self.size_y <= 50) + { + tmin_y = (self.mins_y + self.maxs_y) / 2; + tmax_y = tmin_y + 1; + } + setsize(trigger, tmin, tmax); +}; + +void() plat_hit_top = +{ + sound(self, 2, self.noise1, 1, 1); + self.state = 0; + self.think = plat_go_down; + self.nextthink = self.ltime + 3; +}; + +void() plat_hit_bottom = +{ + sound(self, 2, self.noise1, 1, 1); + self.state = 1; +}; + +void() plat_go_down = +{ + sound(self, 2, self.noise, 1, 1); + self.state = 3; + SUB_CalcMove(self.pos2, self.speed, plat_hit_bottom); +}; + +void() plat_go_up = +{ + sound(self, 2, self.noise, 1, 1); + self.state = 2; + SUB_CalcMove(self.pos1, self.speed, plat_hit_top); +}; + +void() plat_center_touch = +{ + local entity te; + if (other.classname != "player") + { + return; + } + if (!Activated(self, other)) + { + if (self.else_goal != 0) + { + te = Findgoal(self.else_goal); + if (te) + { + DoResults(te, other, self.goal_result & 2); + } + } + return; + } + if (other.health <= 0) + { + return; + } + self = self.enemy; + if (self.state == 1) + { + plat_go_up(); + } + else + { + if (self.state == 0) + { + self.nextthink = self.ltime + 1; + } + } +}; + +void() plat_outside_touch = +{ + local entity te; + if (other.classname != "player") + { + return; + } + if (!Activated(self, other)) + { + if (self.else_goal != 0) + { + te = Findgoal(self.else_goal); + if (te) + { + DoResults(te, other, self.goal_result & 2); + } + } + return; + } + if (other.health <= 0) + { + return; + } + self = self.enemy; + if (self.state == 0) + { + plat_go_down(); + } +}; + +void() plat_trigger_use = +{ + if (self.think) + { + return; + } + plat_go_down(); +}; + +void() plat_crush = +{ + T_Damage(other, self, self, 1); + if (self.state == 2) + { + plat_go_down(); + } + else + { + if (self.state == 3) + { + plat_go_up(); + } + else + { + self.state = 3; + if (self.state == 3) + { + plat_go_up(); + } +// No idea what to do :\ Hopefully this will fix the town2 crash, but I'm not sure. +// objerror("plat_crush: bad self.state\n"); + } + } +}; + +void() plat_use = +{ + self.use = SUB_Null; + if (self.state != 2) + { + objerror("plat_use: not in up state"); + } + plat_go_down(); +}; + +void() func_plat = +{ + if (CheckExistence() == 0) + { + dremove(self); + return; + } + if (!(self.t_length)) + { + self.t_length = 80; + } + if (!(self.t_width)) + { + self.t_width = 10; + } + if (self.sounds == 0) + { + self.sounds = 2; + } + if (self.sounds == 1) + { + precache_sound("plats/plat1.wav"); + precache_sound("plats/plat2.wav"); + self.noise = "plats/plat1.wav"; + self.noise1 = "plats/plat2.wav"; + } + if (self.sounds == 2) + { + precache_sound("plats/medplat1.wav"); + precache_sound("plats/medplat2.wav"); + self.noise = "plats/medplat1.wav"; + self.noise1 = "plats/medplat2.wav"; + } + if (self.sounds == 4) + { + precache_sound("plats/track_st.wav"); + precache_sound("plats/track_e.wav"); + self.noise = "plats/track_st.wav"; + self.noise1 = "plats/track_e.wav"; + } + self.mangle = self.angles; + self.angles = '0 0 0'; + self.classname = "plat"; + self.solid = 4; + self.movetype = 7; + setorigin(self, self.origin); + setmodel(self, self.model); + setsize(self, self.mins, self.maxs); + self.blocked = plat_crush; + if (!(self.speed)) + { + self.speed = 150; + } + self.pos1 = self.origin; + self.pos2 = self.origin; + if (self.height) + { + self.pos2_z = self.origin_z - self.height; + } + else + { + self.pos2_z = self.origin_z - self.size_z + 8; + } + self.use = plat_trigger_use; + plat_spawn_inside_trigger(); + if (self.targetname) + { + self.state = 2; + self.use = plat_use; + } + else + { + setorigin(self, self.pos2); + self.state = 1; + } +}; + +void() train_blocked = +{ + if (time < self.attack_finished) + { + return; + } + self.attack_finished = time + 0.5; + T_Damage(other, self, self, self.dmg); +}; + +void() train_use = +{ + if (self.think != func_train_find) + { + return; + } + train_next(); +}; + +void() train_wait = +{ + if (self.wait) + { + self.nextthink = self.ltime + self.wait; + if (self.wait == -1) + { + self.think = func_train_find; + } + self.sounds = 4; +// if (4) +// { + sound(self, 2, self.noise, 1, 0); +// } +// else +// { +// sound(self, 2, self.noise, 1, 1); +// } + } + else + { + self.nextthink = self.ltime + 0.1; + } + self.think = train_next; +}; + +void() train_next = +{ + local entity targ; + targ = find(world, targetname, self.target); + self.target = targ.target; + if (!(self.target)) + { + objerror("train_next: no next target"); + } + if (targ.wait) + { + self.wait = targ.wait; + } + else + { + self.wait = 0; + } + self.sounds = 4; +// if (4) +// { +// sound(self, 2, self.noise1, 1, 0); +// } +// else +// { + sound(self, 2, self.noise1, 1, 1); +// } + SUB_CalcMove(targ.origin - self.mins, self.speed, train_wait); +}; + +void() func_train_find = +{ + local entity targ; + targ = find(world, targetname, self.target); + self.target = targ.target; + setorigin(self, targ.origin - self.mins); + if (!(self.targetname)) + { + self.nextthink = self.ltime + 0.1; + self.think = train_next; + } +}; + +void() followtrain = +{ + setorigin(self, self.owner.origin); + self.nextthink = time + 0.1; + self.think = followtrain; +}; + +void() func_train = +{ + if (CheckExistence() == 0) + { + dremove(self); + return; + } + if (!(self.speed)) + { + self.speed = 100; + } + if (!(self.target)) + { + objerror("func_train without a target"); + } + if (!(self.dmg)) + { + self.dmg = 2; + } + if (self.sounds == 0) + { + self.noise = "misc/null.wav"; + precache_sound("misc/null.wav"); + self.noise1 = "misc/null.wav"; + precache_sound("misc/null.wav"); + } + if (self.sounds == 1) + { + self.noise = "plats/train2.wav"; + precache_sound("plats/train2.wav"); + self.noise1 = "plats/train1.wav"; + precache_sound("plats/train1.wav"); + } + if (self.sounds == 4) + { + precache_sound("plats/track_st.wav"); + precache_sound("plats/track_e.wav"); + self.noise = "plats/track_e.wav"; + self.noise1 = "plats/track_st.wav"; + } + self.cnt = 1; + self.solid = 4; + self.movetype = 7; + self.blocked = train_blocked; + self.use = train_use; + self.classname = "train"; + setmodel(self, self.model); + setsize(self, self.mins, self.maxs); + setorigin(self, self.origin); + self.nextthink = self.ltime + 0.1; + self.think = func_train_find; +}; + +void() light_move = +{ + if (CheckExistence() == 0) + { + dremove(self); + return; + } + if (!(self.speed)) + { + self.speed = 100; + } + if (!(self.target)) + { + objerror("light_move without a target"); + } + self.noise = "misc/null.wav"; + precache_sound("misc/null.wav"); + self.noise1 = "misc/null.wav"; + precache_sound("misc/null.wav"); + self.cnt = 1; + if (!(self.effects)) + { + self.effects = 4; + } + self.solid = 4; + self.movetype = 7; + self.classname = "movelight"; + precache_model("progs/s_null.spr"); + setmodel(self, "progs/s_null.spr"); + setsize(self, '0 0 0', '0 0 0'); + setorigin(self, self.origin); + self.nextthink = self.ltime + 0.1; + self.think = func_train_find; +}; + +void() misc_teleporttrain = +{ + if (CheckExistence() == 0) + { + dremove(self); + return; + } + if (!(self.speed)) + { + self.speed = 100; + } + if (!(self.target)) + { + objerror("func_train without a target"); + } + self.cnt = 1; + self.solid = 0; + self.movetype = 7; + self.blocked = train_blocked; + self.use = train_use; + self.avelocity = '100 200 300'; + self.noise = "misc/null.wav"; + precache_sound("misc/null.wav"); + self.noise1 = "misc/null.wav"; + precache_sound("misc/null.wav"); + precache_model2("progs/teleport.mdl"); + setmodel(self, "progs/teleport.mdl"); + setsize(self, self.mins, self.maxs); + setorigin(self, self.origin); + self.nextthink = self.ltime + 0.1; + self.think = func_train_find; +}; + diff --git a/player.pqc b/player.pqc new file mode 100644 index 0000000..77fdb19 --- /dev/null +++ b/player.pqc @@ -0,0 +1,1665 @@ +void() bubble_bob; +void() W_FireAssaultCannon; +void() player_diea1; +void() player_dieb1; +void() player_diec1; +void() player_died1; +void() player_diee1; +void() player_die_ax1; + +void() Throw_Grapple; + +// TeamFortress Prototypes +void() BioInfection_Decay; +void() TeamFortress_RemoveTimers; +void() T_Dispenser; +//void() Headless_Think; + + +void() player_touch = +{ + if (invis_only == TF_FLARE_LIT && (self.playerclass == 8 || other.playerclass == 8)) + { + if (other.classname == "player") + { + if (self.undercover_team != TF_FLARE_LIT || self.undercover_skin != TF_FLARE_LIT) + { + if (other.playerclass == 8 || other.playerclass == 1 && other.team_no != self.team_no) + { + sprint(other, 2, "Wait a minute... he's a Spy!\n"); + sprint(self, 2, "The enemy sees through your disguise!\n"); + sound(self, 2, "speech/pekaboo.wav", 1, 1); + Spy_RemoveDisguise(self); + } + } + if (other.undercover_team != TF_FLARE_LIT || other.undercover_skin != TF_FLARE_LIT) + { + if (self.playerclass == 8 || self.playerclass == 1 && self.team_no != other.team_no) + { + sound(other, 2, "speech/pekaboo.wav", 1, 1); + sprint(self, 2, "Wait a minute... he's a Spy!\n"); + sprint(other, 2, "The enemy sees through your disguise!\n"); + Spy_RemoveDisguise(other); + } + } + } + } +}; + +void () player_stand1 = [ 17, player_stand1 ] +{ + + self.weaponframe = 0; + if ((self.velocity_x || self.velocity_y)) + { + self.walkframe = 0; + player_run (); + return; + } + if ((self.is_squating == 1)) + { + lay (); + } + if ((self.current_weapon <= 16)) + { + if ((self.walkframe >= 12)) + { + self.walkframe = 0; + } + if ((self.is_squating == 1)) + { + self.frame = 57; + } + else + { + self.frame = (17 + self.walkframe); + } + } + else + { + if ((self.walkframe >= 5)) + { + self.walkframe = 0; + } + if ((self.is_squating == 1)) + { + self.frame = 57; + if ((!self.current_menu && (self.classname != "player_prop"))) + { + if ((self.StatusBarSize == 0)) + { + CenterPrint (self, " ìáùéîç\n"); + } + } + } + else + { + self.frame = (12 + self.walkframe); + } + } + if (((self.walkframe == 1) && (self.vision == 1))) + { + TeamFortress_NightVision (); + } + self.walkframe = (self.walkframe + 1); +}; + +void() player_run = [6, player_run] +{ + local float rnum; + rnum = random(); + self.weaponframe = TF_FLARE_LIT; + if (!(self.velocity_x) && !(self.velocity_y)) + { + self.walkframe = TF_FLARE_LIT; + player_stand1(); + return; + } + if (self.is_squating == 1) + { + setsize(self, '-16 -16 -24', '16 16 32'); + } + if (self.current_weapon <= 16) + { + if (self.walkframe == 6) + { + self.walkframe = TF_FLARE_LIT; + } + self.frame = TF_FLARE_LIT + self.walkframe; + } + else + { + if (self.walkframe == 6) + { + self.walkframe = TF_FLARE_LIT; + } + self.frame = self.frame + self.walkframe; + } + if (footsteps == 1 && checkbottom(self) == 1 && self.playerclass != TF_FLARE_LIT) + { + if (self.velocity_x > 200 || self.velocity_y > 200 || (self.velocity_x < -200 || self.velocity_y < -200)) + { + if (self.playerclass == 8 && self.undercover_skin == TF_FLARE_LIT) + { + self.walkframe = self.walkframe + 1; + return; + } + if (self.walkframe == 1) + { + if (self.vision == 1) + { + TeamFortress_NightVision(); + } + if (self.waterlevel == TF_FLARE_LIT) + { + if (rnum < 0.6) + { + sound(self, 4, "player/step1l.wav", 0.8, 1); + } + else + { + sound(self, 2, "player/step2l.wav", 0.8, 1); + } + } + if (self.waterlevel == 1) + { + sound(self, 2, "player/h2ojump.wav", 0.8, 1); + } + if (self.waterlevel == 2) + { + sound(self, 2, "player/inh2o.wav", 0.8, 1); + } + } + if (self.walkframe == 4) + { + if (self.waterlevel == TF_FLARE_LIT) + { + if (rnum < 0.5) + { + sound(self, 2, "player/step1r.wav", 0.8, 1); + } + else + { + sound(self, 2, "player/step2r.wav", 0.8, 1); + } + } + if (self.waterlevel == 1) + { + sound(self, 2, "player/h2ojump.wav", 0.8, 1); + } + if (self.waterlevel == 2) + { + sound(self, 2, "player/inh2o.wav", 0.8, 1); + } + } + } + } + self.walkframe = self.walkframe + 1; +}; + +void() player_shot1 = [113, player_shot2] +{ + self.weaponframe = 1; + muzzleflash(); +}; + +void() player_shot2 = [114, player_shot3] +{ + self.weaponframe = 2; +}; + +void() player_shot3 = [115, player_shot4] +{ + self.weaponframe = 3; +}; + +void() player_shot4 = [116, player_shot5] +{ + self.weaponframe = 4; +}; + +void() player_shot5 = [117, player_shot6] +{ + self.weaponframe = 5; +}; + +void() player_shot6 = [118, player_run] +{ + self.weaponframe = 6; +}; + +void() player_autorifle1 = [113, player_autorifle2] +{ + self.weaponframe = 1; + muzzleflash(); +}; + +void() player_autorifle2 = [114, player_autorifle3] +{ + self.weaponframe = 2; +}; + +void() player_autorifle3 = [118, player_run] +{ + self.weaponframe = 6; +}; + +void() player_axe1 = [119, player_axe2] +{ + self.weaponframe = 1; +}; + +void() player_axe2 = [120, player_axe3] +{ + self.weaponframe = 2; +}; + +void() player_axe3 = [121, player_axe4] +{ + self.weaponframe = 3; + if (self.current_weapon == 16) + { + W_FireAxe(); + } + else + { + W_FireSpanner(); + } +}; + +void() player_axe4 = [122, player_run] +{ + self.weaponframe = 4; +}; + +void() player_axeb1 = [125, player_axeb2] +{ + self.weaponframe = 5; +}; + +void() player_axeb2 = [126, player_axeb3] +{ + self.weaponframe = 6; +}; + +void() player_axeb3 = [127, player_axeb4] +{ + self.weaponframe = 7; + if (self.current_weapon == 16) + { + W_FireAxe(); + } + else + { + W_FireSpanner(); + } +}; + +void() player_axeb4 = [128, player_run] +{ + self.weaponframe = 8; +}; + +void() player_axec1 = [131, player_axec2] +{ + self.weaponframe = 1; +}; + +void() player_axec2 = [132, player_axec3] +{ + self.weaponframe = 2; +}; + +void() player_axec3 = [133, player_axec4] +{ + self.weaponframe = 3; + if (self.current_weapon == 16) + { + W_FireAxe(); + } + else + { + W_FireSpanner(); + } +}; + +void() player_axec4 = [134, player_run] +{ + self.weaponframe = 4; +}; + +void() player_axed1 = [137, player_axed2] +{ + self.weaponframe = 5; +}; + +void() player_axed2 = [138, player_axed3] +{ + self.weaponframe = 6; +}; + +void() player_axed3 = [139, player_axed4] +{ + self.weaponframe = 7; + if (self.current_weapon == 16) + { + W_FireAxe(); + } + else + { + W_FireSpanner(); + } +}; + +void() player_axed4 = [140, player_run] +{ + self.weaponframe = 8; +}; + +void() player_chain1 = [137, player_chain1a] +{ + self.weaponframe = 1; + Throw_Grapple(); +}; + +void() player_chain1a = [137, player_chain2] +{ + self.weaponframe = 2; +}; + +void() player_chain2 = [138, player_chain2a] +{ + self.weaponframe = 3; +}; + +void() player_chain2a = [138, player_chain3] +{ + self.weaponframe = 4; +}; + +void() player_chain3 = [139, player_chain3] +{ + self.weaponframe = 6; + if (!(self.hook_out)) + { + player_chain5(); + return; + } + if (vlen(self.velocity) >= 750) + { + player_chain4(); + return; + } +}; + +void() player_chain4 = [73, player_chain4] +{ + self.weaponframe = 6; + if (!(self.hook_out)) + { + player_chain5(); + return; + } + if (vlen(self.velocity) < 750) + { + player_chain3(); + return; + } +}; + +void() player_chain5 = [140, player_run] +{ + self.weaponframe = TF_FLARE_LIT; +}; + +void() player_medikit1 = [119, player_medikit2] +{ + self.weaponframe = 1; +}; + +void() player_medikit2 = [120, player_medikit3] +{ + self.weaponframe = 2; +}; + +void() player_medikit3 = [121, player_medikit4] +{ + self.weaponframe = 3; + W_FireMedikit(); + W_FireBioweapon(); +}; + +void() player_medikit4 = [122, player_run] +{ + self.weaponframe = 4; +}; + +void() player_medikitb1 = [125, player_medikitb2] +{ + self.weaponframe = 5; +}; + +void() player_medikitb2 = [126, player_medikitb3] +{ + self.weaponframe = 6; +}; + +void() player_medikitb3 = [127, player_medikitb4] +{ + self.weaponframe = 7; + W_FireMedikit(); + W_FireBioweapon(); +}; + +void() player_medikitb4 = [128, player_run] +{ + self.weaponframe = 8; +}; + +void() player_medikitc1 = [131, player_medikitc2] +{ + self.weaponframe = 1; +}; + +void() player_medikitc2 = [132, player_medikitc3] +{ + self.weaponframe = 2; +}; + +void() player_medikitc3 = [133, player_medikitc4] +{ + self.weaponframe = 3; + W_FireMedikit(); + W_FireBioweapon(); +}; + +void() player_medikitc4 = [134, player_run] +{ + self.weaponframe = 4; +}; + +void() player_medikitd1 = [137, player_medikitd2] +{ + self.weaponframe = 5; +}; + +void() player_medikitd2 = [138, player_medikitd3] +{ + self.weaponframe = 6; +}; + +void() player_medikitd3 = [139, player_medikitd4] +{ + self.weaponframe = 7; + W_FireMedikit(); + W_FireBioweapon(); +}; + +void() player_medikitd4 = [140, player_run] +{ + self.weaponframe = 8; +}; + +void() player_bioweapon1 = [119, player_bioweapon2] +{ + self.weaponframe = 1; +}; + +void() player_bioweapon2 = [120, player_bioweapon3] +{ + self.weaponframe = 2; +}; + +void() player_bioweapon3 = [121, player_bioweapon4] +{ + self.weaponframe = 3; + W_FireBioweapon(); + W_FireMedikit(); +}; + +void() player_bioweapon4 = [122, player_run] +{ + self.weaponframe = 4; +}; + +void() player_bioweaponb1 = [125, player_bioweaponb2] +{ + self.weaponframe = 5; +}; + +void() player_bioweaponb2 = [126, player_bioweaponb3] +{ + self.weaponframe = 6; +}; + +void() player_bioweaponb3 = [127, player_bioweaponb4] +{ + self.weaponframe = 7; + W_FireBioweapon(); + W_FireMedikit(); +}; + +void() player_bioweaponb4 = [128, player_run] +{ + self.weaponframe = 8; +}; + +void() player_bioweaponc1 = [131, player_bioweaponc2] +{ + self.weaponframe = 1; +}; + +void() player_bioweaponc2 = [132, player_bioweaponc3] +{ + self.weaponframe = 2; +}; + +void() player_bioweaponc3 = [133, player_bioweaponc4] +{ + self.weaponframe = 3; + W_FireBioweapon(); + W_FireMedikit(); +}; + +void() player_bioweaponc4 = [134, player_run] +{ + self.weaponframe = 4; +}; + +void() player_bioweapond1 = [137, player_bioweapond2] +{ + self.weaponframe = 5; +}; + +void() player_bioweapond2 = [138, player_bioweapond3] +{ + self.weaponframe = 6; +}; + +void() player_bioweapond3 = [139, player_bioweapond4] +{ + self.weaponframe = 7; + W_FireBioweapon(); + W_FireMedikit(); +}; + +void() player_bioweapond4 = [140, player_run] +{ + self.weaponframe = 8; +}; + +void() player_nail1 = [103, player_nail2] +{ + muzzleflash(); + if (!(self.button0) || intermission_running) + { + player_run(); + return; + } + self.weaponframe = self.weaponframe + 1; + if (self.weaponframe == 9) + { + self.weaponframe = 1; + } + SuperDamageSound(); + W_FireSpikes(); + //Attack_Finished(0.2); +}; + +void() player_nail2 = [104, player_nail1] +{ + if (!(self.button0) || intermission_running) + { + player_run(); + return; + } + self.weaponframe = self.weaponframe + 1; + if (self.weaponframe == 9) + { + self.weaponframe = 1; + } + SuperDamageSound(); + W_FireSpikes(); + //Attack_Finished(0.2); +}; + +void() player_assaultcannonup1 = [103, player_assaultcannonup2] +{ + if (!(self.button0) || (self.ammo_shells < 1) || intermission_running) + { + self.tfstate = self.tfstate - (self.tfstate & 65536); + if (self.tfstate & 131072) + { + self.tfstate = self.tfstate - (self.tfstate & 131072); + } + TeamFortress_SetSpeed(self); + self.count = 1; + self.heat = TF_FLARE_LIT; + player_assaultcannondown1(); + return; + } + self.fire_held_down = 1; + + if (self.heat == 1) + { + sound(self, 1, "weapons/chngnu1a.wav", 1, 1); + } + SuperDamageSound(); + Attack_Finished(0.1); + if (self.heat != 2 && self.heat != 4) + { + if (self.weaponframe >= 3) + { + self.weaponframe = TF_FLARE_LIT; + } + else + { + self.weaponframe = self.weaponframe + 1; + } + } + self.heat = self.heat + 1; + if (self.heat >= 7) + { + self.heat = TF_FLARE_LIT; + player_assaultcannon1(); + } +}; + +void() player_assaultcannonup2 = [103, player_assaultcannonup1] +{ + if (!(self.button0) || (self.ammo_shells < 1) || intermission_running) + { + self.tfstate = self.tfstate - (self.tfstate & 65536); + + if (self.tfstate & 131072) + { + self.tfstate = self.tfstate - (self.tfstate & 131072); + } + TeamFortress_SetSpeed(self); + self.count = 1; + self.heat = TF_FLARE_LIT; + player_assaultcannondown1(); + return; + } + SuperDamageSound(); + Attack_Finished(0.1); + if (self.heat != 2 && self.heat != 4 && self.heat != 7) + { + if (self.weaponframe == 2 && self.heat >= 9) + { + self.weaponframe = TF_FLARE_LIT; + } + else + { + if (self.weaponframe >= 3) + { + self.weaponframe = TF_FLARE_LIT; + } + else + { + self.weaponframe = self.weaponframe + 1; + } + } + } + self.heat = self.heat + 1; + if (self.heat >= 13) + { + self.heat = TF_FLARE_LIT; + player_assaultcannon1(); + } +}; + +void() player_assaultcannon1 = [103, player_assaultcannon2] +{ + muzzleflash(); + sound(self, 1, "weapons/asscan2.wav", 1, 1); + if (!(self.button0) || (self.ammo_shells < 1) || intermission_running) + { + if (self.tfstate & 131072) + { + self.tfstate = self.tfstate - (self.tfstate & 131072); + } + + TeamFortress_SetSpeed(self); + self.weaponframe = TF_FLARE_LIT; + self.count = 1; + player_assaultcannondown1(); + return; + } + if (self.weaponframe == 2) + { + self.weaponframe = 4; + } + else + { + self.weaponframe = 2; + } + SuperDamageSound(); + W_FireAssaultCannon(); + Attack_Finished(0.1); +}; + +void() player_assaultcannon2 = [104, player_assaultcannon1] +{ + if (!(self.button0) || (self.ammo_shells < 1) || intermission_running) + { + if (self.tfstate & 131072) + { + self.tfstate = self.tfstate - (self.tfstate & 131072); + } + + TeamFortress_SetSpeed(self); + self.weaponframe = TF_FLARE_LIT; + self.count = 1; + player_assaultcannondown1(); + return; + } + if (self.weaponframe == 2) + { + self.weaponframe = 4; + } + else + { + self.weaponframe = 2; + } + SuperDamageSound(); + W_FireAssaultCannon(); + self.heat = self.heat + 0.1; + stuffcmd(self, "bf\n"); + Attack_Finished(0.1); +}; + +void() player_assaultcannondown1 = [103, player_assaultcannondown1] +{ + + if (self.count == 1) + { + sound(self, 1, "weapons/chngnd1a.wav", 1, 1); + } + if (self.count >= 15) + { + self.heat = TF_FLARE_LIT; + self.fire_held_down = TF_FLARE_LIT; + self.tfstate = self.tfstate - (self.tfstate & 65536); + TeamFortress_SetSpeed(self); + if (self.ammo_shells < 1 || self.ammo_cells < 6) + { + self.current_weapon = W_BestWeapon(); + W_SetCurrentAmmo(); + W_PrintWeaponMessage(); + return; + } + player_run(); + return; + } + if (self.count != 8 && self.count != 10 && self.count != 12 && self.count != 14) + { + if (self.weaponframe == 3) + { + self.weaponframe = TF_FLARE_LIT; + } + else + { + self.weaponframe = self.weaponframe + 1; + } + } + self.count = self.count + 1; + + Attack_Finished(0.1); +}; + +void() player_light1 = [105, player_light2] +{ + muzzleflash(); + if (!(self.button0) || intermission_running) + { + player_run(); + return; + } + self.weaponframe = self.weaponframe + 1; + if (self.weaponframe == 5) + { + self.weaponframe = 1; + } + SuperDamageSound(); + W_FireLightning(); + Attack_Finished(0.2); +}; + +void() player_light2 = [106, player_light1] +{ + if (!(self.button0) || intermission_running) + { + player_run(); + return; + } + self.weaponframe = self.weaponframe + 1; + if (self.weaponframe == 5) + { + self.weaponframe = 1; + } + SuperDamageSound(); + W_FireLightning(); + Attack_Finished(0.2); +}; + +void() player_rocket1 = [107, player_rocket2] +{ + self.weaponframe = 1; + muzzleflash(); +}; + +void() player_rocket2 = [108, player_rocket3] +{ + self.weaponframe = 2; +}; + +void() player_rocket3 = [109, player_rocket4] +{ + self.weaponframe = 3; +}; + +void() player_rocket4 = [110, player_rocket5] +{ + self.weaponframe = 4; +}; + +void() player_rocket5 = [111, player_rocket6] +{ + self.weaponframe = 5; +}; + +void() player_rocket6 = [112, player_run] +{ + self.weaponframe = 6; +}; + +void() PainSound = +{ + local float rs; + if (self.health < TF_FLARE_LIT) + { + return; + } + if (damage_attacker.classname == "teledeath") + { + sound(self, 2, "player/gib2.wav", 1, TF_FLARE_LIT); + return; + } + if (self.watertype == -3 && self.waterlevel == 3) + { + DeathBubbles(1); + if (random() > 0.5) + { + sound(self, 2, "player/drown1.wav", 1, 1); + } + else + { + sound(self, 2, "player/drown2.wav", 1, 1); + } + return; + } + if (self.watertype == -4) + { + if (random() > 0.5) + { + sound(self, 2, "player/lburn1.wav", 1, 1); + } + else + { + sound(self, 2, "player/lburn2.wav", 1, 1); + } + return; + } + if (self.watertype == -5) + { + if (random() > 0.5) + { + sound(self, 2, "player/lburn1.wav", 1, 1); + } + else + { + sound(self, 2, "player/lburn2.wav", 1, 1); + } + return; + } + if (self.pain_finished > time) + { + self.axhitme = TF_FLARE_LIT; + return; + } + self.pain_finished = time + 1; + if (self.axhitme == 1) + { + self.axhitme = TF_FLARE_LIT; + sound(self, 2, "player/axhit1.wav", 1, 1); + return; + } + rs = rint(random() * 5 + 1); + self.noise = ""; + if (rs == 1) + { + self.noise = "player/pain1.wav"; + } + else + { + if (rs == 2) + { + self.noise = "player/pain2.wav"; + } + else + { + if (rs == 3) + { + self.noise = "player/pain3.wav"; + } + else + { + if (rs == 4) + { + self.noise = "player/pain4.wav"; + } + else + { + if (rs == 5) + { + self.noise = "player/pain5.wav"; + } + else + { + self.noise = "player/mpain6.wav"; + } + } + } + } + } + sound(self, 2, self.noise, 1, 1); + return; +}; + +void() player_pain1 = [35, player_pain2] +{ + PainSound(); + self.weaponframe = TF_FLARE_LIT; +}; + +void() player_pain2 = [36, player_pain3] +{ +}; + +void() player_pain3 = [37, player_pain4] +{ +}; + +void() player_pain4 = [38, player_pain5] +{ +}; + +void() player_pain5 = [39, player_pain6] +{ +}; + +void() player_pain6 = [40, player_run] +{ +}; + +void() player_axpain1 = [29, player_axpain2] +{ + PainSound(); + self.weaponframe = TF_FLARE_LIT; +}; + +void() player_axpain2 = [30, player_axpain3] +{ +}; + +void() player_axpain3 = [31, player_axpain4] +{ +}; + +void() player_axpain4 = [32, player_axpain5] +{ +}; + +void() player_axpain5 = [33, player_axpain6] +{ +}; + +void() player_axpain6 = [34, player_run] +{ +}; + +void() player_pain = +{ + if (self.weaponframe) + { + return; + } + if (self.invisible_finished > time) + { + return; + } + if (self.is_feigning) + { + PainSound(); + return; + } + if (self.button0 && self.current_weapon == 32768) + { + return; + } + if (self.current_weapon <= 16) + { + player_axpain1(); + } + else + { + player_pain1(); + } +}; + +void() DeathBubblesSpawn = +{ + if (self.owner.waterlevel != 3) + { + return; + } + newmis = spawn(); + setmodel(newmis, "progs/s_bubble.spr"); + setorigin(newmis, self.owner.origin + '0 0 24'); + newmis.movetype = 8; + newmis.solid = TF_FLARE_LIT; + newmis.velocity = '0 0 15'; + newmis.nextthink = time + 0.5; + newmis.think = bubble_bob; + newmis.classname = "bubble"; + newmis.frame = TF_FLARE_LIT; + newmis.cnt = TF_FLARE_LIT; + setsize(newmis, '-8 -8 -8', '8 8 8'); + self.nextthink = time + 0.1; + self.think = DeathBubblesSpawn; + self.air_finished = self.air_finished + 1; + if (self.air_finished >= self.bubble_count) + { + dremove(self); + } +}; + +void(float num_bubbles) DeathBubbles = +{ + local entity bubble_spawner; + bubble_spawner = spawn(); + setorigin(bubble_spawner, self.origin); + bubble_spawner.movetype = TF_FLARE_LIT; + bubble_spawner.solid = TF_FLARE_LIT; + bubble_spawner.nextthink = time + 0.1; + bubble_spawner.think = DeathBubblesSpawn; + bubble_spawner.air_finished = TF_FLARE_LIT; + bubble_spawner.owner = self; + bubble_spawner.bubble_count = num_bubbles; + return; +}; + +void() DeathSound = +{ + local float rs; + if (self.waterlevel == 3) + { + if (self.is_feigning) + { + DeathBubbles(2); + } + else + { + DeathBubbles(10); + } + sound(self, 2, "player/h2odeath.wav", 1, TF_FLARE_LIT); + return; + } + rs = rint(random() * 4 + 1); + if (rs == 1) + { + self.noise = "player/death1.wav"; + } + if (rs == 2) + { + self.noise = "player/death2.wav"; + } + if (rs == 3) + { + self.noise = "player/death3.wav"; + } + if (rs == 4) + { + self.noise = "player/death4.wav"; + } + if (rs == 5) + { + self.noise = "player/mdeath5.wav"; + } + sound(self, 2, self.noise, 1, 1); + return; +}; + +void() PlayerDead = +{ + self.nextthink = -1; + self.deadflag = 2; +}; + +vector(float dm) VelocityForDamage = +{ + local vector v; + v_x = 100 * crandom(); + v_y = 100 * crandom(); + v_z = 200 + 100 * random(); + if (dm > -50) + { + v = v * 0.7; + } + else + { + if (dm > -200) + { + v = v * 2; + } + else + { + v = v * 10; + } + } + return v; +}; + +void(string gibname, float dm) ThrowGib = +{ + newmis = spawn(); + newmis.origin = self.origin; + setmodel(newmis, gibname); + setsize(newmis, '0 0 0', '0 0 0'); + newmis.velocity = VelocityForDamage(dm); + newmis.movetype = 10; + newmis.solid = 2; + newmis.avelocity_x = random() * 600; + newmis.avelocity_y = random() * 600; + newmis.avelocity_z = random() * 600; + newmis.think = SUB_Remove; + newmis.touch = SUB_Remove; + newmis.ltime = time; + newmis.nextthink = time + 3; + newmis.frame = TF_FLARE_LIT; + newmis.flags = TF_FLARE_LIT; +}; + +void() KickHead = +{ + makevectors (other.v_angle); + self.velocity = other.velocity * 1.5 + v_forward * 128 + '0 0 260' + '0 0 300'*random(); + self.avelocity = crandom() * '0 600 0'; + + sound(self,4,"zombie/z_miss.wav",0.5, 1); +/* + if (other.classname != "player") + { + sound(self, 4, "zombie/z_miss.wav", 0.5, 1); + return; + } + makevectors(other.v_angle); + self.velocity = v_forward * 300 + '0 0 300'; +*/ + return; +}; + +void(string gibname, float dm) ThrowHead = +{ + local string hk; + hk = infokey (world, "headkick"); + setmodel(self, gibname); + self.skin = TF_FLARE_LIT; + self.frame = TF_FLARE_LIT; + self.nextthink = -1; + self.movetype = 10; + self.takedamage = TF_FLARE_LIT; + self.effects = TF_FLARE_LIT; + if (self.classname != "player") + { + self.solid = TF_FLARE_LIT; + } + else + { + if (hk != "off") + { + self.solid = 1; //2 + self.touch = KickHead; + } + } + self.view_ofs = '0 0 8'; + setsize(self, '-16 -16 0', '16 16 56'); + self.velocity = VelocityForDamage(dm); + self.origin_z = self.origin_z - 24; + self.flags = self.flags - (self.flags & 512); + self.avelocity = crandom() * '100 600 50'; +}; + +void(string gibname) HeadShotThrowHead = +{ + setmodel(self, gibname); + self.frame = TF_FLARE_LIT; + self.nextthink = -1; + self.movetype = 10; + self.takedamage = TF_FLARE_LIT; + self.solid = 2; + self.touch = KickHead; + self.view_ofs = '0 0 8'; + setsize(self, '-16 -16 0', '16 16 56'); + self.velocity = normalize(self.head_shot_vector) * 600; + self.origin_z = self.origin_z + 24; + self.flags = self.flags - (self.flags & 512); + self.avelocity = '0 0 0'; +}; + +void() KillPlayer = +{ + self.owner.deadflag = 2; + dremove(self); +}; + +void() GibPlayer = +{ + ThrowHead("progs/h_player.mdl", self.health); + ThrowGib("progs/gib1.mdl", self.health); + ThrowGib("progs/gib2.mdl", self.health); + ThrowGib("progs/gib3.mdl", self.health); + if (deathmsg == 36) + { + newmis = spawn(); + newmis.owner = self; + newmis.think = KillPlayer; + newmis.nextthink = time + 1; + } + else + { + self.deadflag = 2; + } + TeamFortress_SetupRespawn(TF_FLARE_LIT); + if (damage_attacker.classname == "teledeath") + { + sound(self, 2, "player/gib2.wav", 1, TF_FLARE_LIT); + self.respawn_time = self.respawn_time + 2; + return; + } + if (damage_attacker.classname == "teledeath2") + { + sound(self, 2, "player/gib2.wav.wav", 1, TF_FLARE_LIT); + self.respawn_time = self.respawn_time + 2; + return; + } + if (random() <= 0.2) + { + sound(self, TF_FLARE_LIT, "player/gib3.wav", 1, 1); + } + else + { + sound(self, 2, "player/gib2.wav", 1, 1); + } +}; + +void() PlayerDie = +{ + local float i; + local entity te; + if (self.hook_out) + { + Reset_Grapple(self.hook); + Attack_Finished(0.75); + self.hook_out = 1; + } + self.items = self.items - (self.items & 524288); + self.invisible_finished = TF_FLARE_LIT; + self.invincible_finished = TF_FLARE_LIT; + self.super_damage_finished = TF_FLARE_LIT; + self.radsuit_finished = TF_FLARE_LIT; + self.modelindex = modelindex_player; + if (self.tfstate & 16 && self == self.enemy) + { + te = find(world, classname, "timer"); + while (te) + { + if (te.owner == self && te.think == BioInfection_Decay) + { + logfrag(te.enemy, self); + te.enemy.real_frags = te.enemy.real_frags + 1; + if (!(toggleflags & 128)) + { + te.enemy.frags = te.enemy.real_frags; + } + } + te = find(te, classname, "timer"); + } + } + TeamFortress_RemoveTimers(); + if ( (deathmatch || coop) && (!prematch) ) + { + DropBackpack(); + } + self.weaponmodel = ""; + self.view_ofs = '0 0 -8'; + self.deadflag = 1; + self.solid = TF_FLARE_LIT; + self.flags = self.flags - (self.flags & 512); + self.movetype = 6; + if (self.velocity_z < 10) + { + self.velocity_z = self.velocity_z + random() * 300; + } + if (self.health < -40 && !(deathmsg == 18)) + { + GibPlayer(); + return; + } + DeathSound(); + self.angles_x = TF_FLARE_LIT; + self.angles_z = TF_FLARE_LIT; + if (self.current_weapon <= 16) + { + player_die_ax1(); + TeamFortress_SetupRespawn(TF_FLARE_LIT); + return; + } + i = 1 + floor(random() * 6); + if (i == 1) + { + player_diea1(); + } + else + { + if (i == 2) + { + player_dieb1(); + } + else + { + if (i == 3) + { + player_diec1(); + } + else + { + if (i == 4) + { + player_died1(); + } + else + { + player_diee1(); + } + } + } + } + TeamFortress_SetupRespawn(TF_FLARE_LIT); +}; + +void() set_suicide_frame = +{ + if (self.model != "progs/player.mdl") + { + return; + } + setmodel(self, string_null); + setsize(self, '-16 -16 -24', '16 16 32'); +}; + +void() player_diea1 = [50, player_diea2] +{ +}; + +void() player_diea2 = [51, player_diea3] +{ +}; + +void() player_diea3 = [52, player_diea4] +{ +}; + +void() player_diea4 = [53, player_diea5] +{ +}; + +void() player_diea5 = [54, player_diea6] +{ +}; + +void() player_diea6 = [55, player_diea7] +{ +}; + +void() player_diea7 = [56, player_diea8] +{ +}; + +void() player_diea8 = [57, player_diea9] +{ +}; + +void() player_diea9 = [58, player_diea10] +{ +}; + +void() player_diea10 = [59, player_diea11] +{ +}; + +void() player_diea11 = [60, player_diea11] +{ + PlayerDead(); +}; + +void() player_dieb1 = [61, player_dieb2] +{ +}; + +void() player_dieb2 = [62, player_dieb3] +{ +}; + +void() player_dieb3 = [63, player_dieb4] +{ +}; + +void() player_dieb4 = [64, player_dieb5] +{ +}; + +void() player_dieb5 = [65, player_dieb6] +{ +}; + +void() player_dieb6 = [66, player_dieb7] +{ +}; + +void() player_dieb7 = [67, player_dieb8] +{ +}; + +void() player_dieb8 = [68, player_dieb9] +{ +}; + +void() player_dieb9 = [69, player_dieb9] +{ + PlayerDead(); +}; + +void() player_diec1 = [70, player_diec2] +{ +}; + +void() player_diec2 = [71, player_diec3] +{ +}; + +void() player_diec3 = [72, player_diec4] +{ +}; + +void() player_diec4 = [73, player_diec5] +{ +}; + +void() player_diec5 = [74, player_diec6] +{ +}; + +void() player_diec6 = [75, player_diec7] +{ +}; + +void() player_diec7 = [76, player_diec8] +{ +}; + +void() player_diec8 = [77, player_diec9] +{ +}; + +void() player_diec9 = [78, player_diec10] +{ +}; + +void() player_diec10 = [79, player_diec11] +{ +}; + +void() player_diec11 = [80, player_diec12] +{ +}; + +void() player_diec12 = [81, player_diec13] +{ +}; + +void() player_diec13 = [82, player_diec14] +{ +}; + +void() player_diec14 = [83, player_diec15] +{ +}; + +void() player_diec15 = [84, player_diec15] +{ + PlayerDead(); +}; + +void() player_died1 = [85, player_died2] +{ +}; + +void() player_died2 = [86, player_died3] +{ +}; + +void() player_died3 = [87, player_died4] +{ +}; + +void() player_died4 = [88, player_died5] +{ +}; + +void() player_died5 = [89, player_died6] +{ +}; + +void() player_died6 = [90, player_died7] +{ +}; + +void() player_died7 = [91, player_died8] +{ +}; + +void() player_died8 = [92, player_died9] +{ +}; + +void() player_died9 = [93, player_died9] +{ + PlayerDead(); +}; + +void() player_diee1 = [94, player_diee2] +{ +}; + +void() player_diee2 = [95, player_diee3] +{ +}; + +void() player_diee3 = [96, player_diee4] +{ +}; + +void() player_diee4 = [97, player_diee5] +{ +}; + +void() player_diee5 = [98, player_diee6] +{ +}; + +void() player_diee6 = [99, player_diee7] +{ +}; + +void() player_diee7 = [100, player_diee8] +{ +}; + +void() player_diee8 = [101, player_diee9] +{ +}; + +void() player_diee9 = [102, player_diee9] +{ + PlayerDead(); +}; + +void() player_die_ax1 = [41, player_die_ax2] +{ +}; + +void() player_die_ax2 = [42, player_die_ax3] +{ +}; + +void() player_die_ax3 = [43, player_die_ax4] +{ +}; + +void() player_die_ax4 = [44, player_die_ax5] +{ +}; + +void() player_die_ax5 = [45, player_die_ax6] +{ +}; + +void() player_die_ax6 = [46, player_die_ax7] +{ +}; + +void() player_die_ax7 = [47, player_die_ax8] +{ +}; + +void() player_die_ax8 = [48, player_die_ax9] +{ +}; + +void() player_die_ax9 = [49, player_die_ax9] +{ + PlayerDead(); +}; + diff --git a/prematch.pqc b/prematch.pqc new file mode 100644 index 0000000..6f62703 --- /dev/null +++ b/prematch.pqc @@ -0,0 +1,385 @@ + +// Prematch by PabloTheGreat +// +// rcon serverinfo prematch on +// Activates prematch next time the map cycles +// +// rcon serverinfo pm_time n +// Sets the length of prematch in minutes + +float teamfrags; +//entity prematch2; + +void () PrematchCountDown = +{ + local string st, stcenterpring; + local entity te, flag01, flag02, flag03, flag04, flag05, flag06, flag07, flag08, flag09, flag10, flag11, flag12, flag13, flag14, flag15, flag16, flag17, flag18, flag19; + + if (self.health == 0) // Prematch is over. + { + // Clear frags. Send a msg. Toggle TeamFrags properly. + +#ifdef clan_progs + if (clan_prematch == -1) + { + clan_prematch = 0; + timelimit = cvar ("timelimit") * 60; // resets game timelimit + pointer_timeleft.no_grenades_1 = 0; /// + } +#endif + te = find(world, classname, "player"); + while (te) + { + //bprint (2, "MATCH BEGINS NOW\n"); + CenterPrint2(te, st, "Attack!"); + stuffcmd(te, "bf\n"); + T_Damage (te, te, te, 500); + te.real_frags = 0; + te.frags = 0; + te = find(te, classname, "player"); + } + + if (teamfrags == 0) + { + toggleflags = toggleflags & (toggleflags - 128); + } + + // flags + flag01 = find (world, classname, "item_tfgoal"); + while (flag01) + { + flag01.touch = item_tfgoal_touch; + flag01 = find (flag01, classname, "item_tfgoal"); + } + flag02 = find (world, classname, "info_tfgoal"); + while (flag02) + { + flag02.goal_activation = flag02.DropFlagDelay; + flag02 = find (flag02, classname, "info_tfgoal"); + } + flag03 = find (world, classname, "item_armor1"); + while (flag03) + { + flag03.touch = armor_touch; + flag03 = find (flag03, classname, "item_armor1"); + } + flag04 = find (world, classname, "item_armor2"); + while (flag04) + { + flag04.touch = armor_touch; + flag04 = find (flag04, classname, "item_armor2"); + } + flag05 = find (world, classname, "item_armorInv"); + while (flag05) + { + flag05.touch = armor_touch; + flag05 = find (flag05, classname, "item_armorInv"); + } + flag06 = find (world, classname, "item_artifact_envirosuit"); + while (flag06) + { + flag06.touch = powerup_touch; + flag06 = find (flag06, classname, "item_artifact_envirosuit"); + } + flag07 = find (world, classname, "item_artifact_invisibility"); + while (flag07) + { + flag07.touch = powerup_touch; + flag07 = find (flag07, classname, "item_artifact_invisibility"); + } + flag08 = find (world, classname, "item_artifact_invulnerability"); + while (flag08) + { + flag08.touch = powerup_touch; + flag08 = find (flag08, classname, "item_artifact_invulnerability"); + } + flag09 = find (world, classname, "item_artifact_super_damage"); + while (flag09) + { + flag09.touch = powerup_touch; + flag09 = find (flag09, classname, "item_artifact_super_damage"); + } + flag10 = find (world, classname, "item_cells"); + while (flag10) + { + flag10.touch = ammo_touch; + flag10 = find (flag10, classname, "item_cells"); + } + flag11 = find (world, classname, "item_health"); + while (flag11) + { + flag11.touch = health_touch; + flag11 = find (flag11, classname, "item_health"); + } + flag12 = find (world, classname, "item_key1"); + while (flag12) + { + flag12.touch = key_touch; + flag12 = find (flag12, classname, "item_key1"); + } + flag13 = find (world, classname, "item_key2"); + while (flag13) + { + flag13.touch = key_touch; + flag13 = find (flag13, classname, "item_key2"); + } + flag14 = find (world, classname, "item_rockets"); + while (flag14) + { + flag14.touch = ammo_touch; + flag14 = find (flag14, classname, "item_rockets"); + } + flag15 = find (world, classname, "item_shells"); + while (flag15) + { + flag15.touch = ammo_touch; + flag15 = find (flag15, classname, "item_shells"); + } + flag16 = find (world, classname, "item_sigil"); //gold. still not sure what sigil is *shrug* + while (flag16) + { + flag16.touch = sigil_touch; + flag16 = find (flag16, classname, "item_sigil"); + } + flag17 = find (world, classname, "item_spikes"); + while (flag17) + { + flag17.touch = ammo_touch; + flag17 = find (flag17, classname, "item_spikes"); + } + flag18 = find (world, classname, "item_weapon"); + while (flag18) + { + flag18.touch = weapon_touch; + flag18 = find (flag18, classname, "item_weapon"); + } + flag19 = find (world, classname, "func_button"); + while (flag19) + { + flag19.touch = button_touch; + flag19 = find (flag19, classname, "func_button"); + } + +/* // blue flag/key + te = Finditem(2); + if (te != world) + { + te.touch = item_tfgoal_touch; + } + + // any other various flags + te = find(world, mdl, "progs/tf_flag.mdl"); + while (te) + { + te.touch = item_tfgoal_touch; + te = find(te, mdl, "progs/tf_flag.mdl"); + }*/ + + prematch = 0; + dremove(self); + return; + } + + + //MTF players like the centerprint as well. + // Todo: why can't I get the countdown to be longer than 3 seconds? + if (self.health == 3) { + stcenterpring = "\n3..."; + bprint (self, "3 seconds.\n"); + } + else if (self.health == 2) { + stcenterpring = "\n\n2..."; + bprint (self, "2 seconds.\n"); + } + else if (self.health == 1) { + stcenterpring = "\n\n\n1..."; + bprint (self, "1 second.\n"); + } + + te = find(world, classname, "player"); + while (te != world) + { + CenterPrint(te, stcenterpring); + stuffcmd(te, "bf\n"); + te = find(te, classname, "player"); + } + self.health = self.health - 1; + self.nextthink = (time + 1); +} + +void () PrematchThink = +{ + local entity te; + local string st; + + if (self.health <= 0) + { + self.health = 3; + self.think = PrematchCountDown; + self.nextthink = (time + 1); + return; + } + else + { + st = ftos(self.health); + + te = find(world, classname, "player"); + while (te) + { + if (self.health == 1) + { + CenterPrint2(te, st, "minute left!"); + } + else + { + CenterPrint2(te, st, "minutes left!"); + } + stuffcmd(te, "bf\n"); + te = find(te, classname, "player"); + } + self.nextthink = (time + 60); + } + + self.health = self.health - 1; +} + +void () SetUpPrematch = +{ + local entity flag01, flag02, flag03, flag04, flag05, flag06, flag07, flag08, flag09, flag10, flag11, flag12, flag13, flag14, flag15, flag16, flag17, flag18, flag19; + + // Turn on teamfrags and remember what to set it back to + if (toggleflags & 128) + { + teamfrags = 1; + } + else + { + teamfrags = 0; + toggleflags = toggleflags | 128; + } + + flag01 = find (world, classname, "item_tfgoal"); + while (flag01) + { + flag01.touch = SUB_Null; + flag01 = find (flag01, classname, "item_tfgoal"); + } + flag02 = find (world, classname, "info_tfgoal"); + while (flag02) + { + flag02.DropFlagDelay = flag02.goal_activation; + flag02.goal_activation = 0; + flag02 = find (flag02, classname, "info_tfgoal"); + } + flag03 = find (world, classname, "item_armor1"); + while (flag03) + { + flag03.touch = SUB_Null; + flag03 = find (flag03, classname, "item_armor1"); + } + flag04 = find (world, classname, "item_armor2"); + while (flag04) + { + flag04.touch = SUB_Null; + flag04 = find (flag04, classname, "item_armor2"); + } + flag05 = find (world, classname, "item_armorInv"); + while (flag05) + { + flag05.touch = SUB_Null; + flag05 = find (flag05, classname, "item_armorInv"); + } + flag06 = find (world, classname, "item_artifact_envirosuit"); + while (flag06) + { + flag06.touch = SUB_Null; + flag06 = find (flag06, classname, "item_artifact_invisibility"); + } + flag07 = find (world, classname, "item_armor2"); + while (flag07) + { + flag07.touch = SUB_Null; + flag07 = find (flag07, classname, "item_artifact_invisibility"); + } + flag08 = find (world, classname, "item_artifact_invulnerability"); + while (flag08) + { + flag08.touch = SUB_Null; + flag08 = find (flag08, classname, "item_artifact_invulnerability"); + } + flag09 = find (world, classname, "item_artifact_super_damage"); + while (flag09) + { + flag09.touch = SUB_Null; + flag09 = find (flag09, classname, "item_artifact_super_damage"); + } + flag10 = find (world, classname, "item_cells"); + while (flag10) + { + flag10.touch = SUB_Null; + flag10 = find (flag10, classname, "item_cells"); + } + flag11 = find (world, classname, "item_health"); + while (flag11) + { + flag11.touch = SUB_Null; + flag11 = find (flag11, classname, "item_health"); + } + flag12 = find (world, classname, "item_key1"); + while (flag12) + { + flag12.touch = SUB_Null; + flag12 = find (flag12, classname, "item_key1"); + } + flag13 = find (world, classname, "item_key2"); + while (flag13) + { + flag13.touch = SUB_Null; + flag13 = find (flag13, classname, "item_key2"); + } + flag14 = find (world, classname, "item_rockets"); + while (flag14) + { + flag14.touch = SUB_Null; + flag14 = find (flag14, classname, "item_rockets"); + } + flag15 = find (world, classname, "item_shells"); + while (flag15) + { + flag15.touch = SUB_Null; + flag15 = find (flag15, classname, "item_shells"); + } + flag16 = find (world, classname, "item_sigil"); //gold. still not sure what sigil is *shrug* + while (flag16) + { + flag16.touch = SUB_Null; + flag16 = find (flag16, classname, "item_sigil"); + } + flag17 = find (world, classname, "item_spikes"); + while (flag17) + { + flag17.touch = SUB_Null; + flag17 = find (flag17, classname, "item_spikes"); + } + flag18 = find (world, classname, "item_weapon"); + while (flag18) + { + flag18.touch = SUB_Null; + flag18 = find (flag18, classname, "item_weapon"); + } + flag19 = find (world, classname, "func_button"); + while (flag19) + { + flag19.touch = SUB_Null; + flag19 = find (flag19, classname, "func_button"); + } + + // "time" starts up from 3 and increases by 1 per second + newmis = spawn (); + newmis.classname = "pmtimer"; + newmis.nextthink = (time + ((prematch - floor (prematch)) * 60)); //wtf does this line do? it controls pm.. + newmis.think = PrematchThink; + newmis.health = floor (prematch); + pointer_prematchtimer = newmis; +} + diff --git a/progs.src b/progs.src new file mode 100644 index 0000000..ed3b7a4 --- /dev/null +++ b/progs.src @@ -0,0 +1,54 @@ +qwprogs.dat + +defs.pqc +qw.pqc +debug.pqc +menu.pqc +subs.pqc +combat.pqc +items.pqc +weapons.pqc +world.pqc +status.pqc +client.pqc +player.pqc +doors.pqc +buttons.pqc +triggers.pqc +tforttm.pqc +plats.pqc +misc.pqc +monsters.pqc +ai.pqc +fight.pqc +dog.pqc +//zombie.pqc +fish.pqc +flare.pqc +sentry.pqc +boss.pqc +pyro.pqc +spy.pqc +demoman.pqc +scout.pqc +engineer.pqc +tsoldier.pqc +sniper.pqc +medic.pqc +tfort.pqc +tforthlp.pqc +tfortmap.pqc +hook.pqc +ctf.pqc +coop.pqc +actions.pqc +hiprot.pqc +missiles.pqc +mturret.pqc +// pablo. i like cameras. +camera.pqc +prematch.pqc +rpg.pqc +xavior.pqc +rankings.pqc // Ranking system (taken from United) +clan.pqc // defines clan parameters \ No newline at end of file diff --git a/pyro.pqc b/pyro.pqc new file mode 100644 index 0000000..230969f --- /dev/null +++ b/pyro.pqc @@ -0,0 +1,718 @@ +void() NapalmGrenadeTouch; +//void (vector org, entity shooter) NapalmGrenadeLaunch ; +void() Napalm_touch; +float (string id_flame) RemoveFlameFromQueue; + + +entity(string type, entity p_owner) FlameSpawn = +{ + num_world_flames = num_world_flames + TF_FLARE_OFF; + while (num_world_flames > 45) + { + if (!RemoveFlameFromQueue(type)) + { + return world; + } + } + newmis = spawn(); + if (type == "1") + { + newmis.movetype = 9; + newmis.solid = 2; + newmis.effects = 8; + newmis.flame_id = "1"; + setmodel(newmis, "progs/flame2.mdl"); + setsize(newmis, '0 0 0', '0 0 0'); + } + else + { + if (type == "2") + { + newmis.movetype = 10; + newmis.solid = 2; + newmis.flame_id = "2"; + setmodel(newmis, "progs/flame2.mdl"); + newmis.frame = TF_FLARE_OFF; + setsize(newmis, '0 0 0', '0 0 0'); + } + else + { + if (type == "3") + { + newmis.movetype = 9; + newmis.solid = 2; + newmis.flame_id = "3"; + setmodel(newmis, "progs/flame2.mdl"); + setsize(newmis, '0 0 0', '0 0 0'); + } + else + { + if (type == "4") + { + newmis.movetype = 9; + newmis.solid = 2; + newmis.flame_id = "4"; + setmodel(newmis, "progs/flame2.mdl"); + newmis.frame = TF_FLARE_OFF; + setsize(newmis, '0 0 0', '0 0 0'); + } + } + } + } + newmis.owner = p_owner; + return newmis; +}; + +void(entity this) FlameDestroy = +{ + num_world_flames = num_world_flames - TF_FLARE_OFF; + remove(this); +}; + +float(string id_flame) RemoveFlameFromQueue = +{ + local entity tmp; + if (num_world_flames < 45) + { + dprint("ERROR in RemoveFlameFromQueue\n"); + return 0; + } + num_world_flames = num_world_flames - TF_FLARE_OFF; + tmp = find(world, flame_id, "4"); + if (!tmp) + { + if (id_flame == "4") + { + return TF_FLARE_LIT; + } + tmp = find(world, flame_id, "3"); + if (!tmp) + { + if (id_flame == "3") + { + return TF_FLARE_LIT; + } + tmp = find(world, flame_id, "2"); + if (!tmp) + { + if (id_flame == "2") + { + return TF_FLARE_LIT; + } + tmp = find(world, flame_id, "1"); + if (!tmp) + { + dprint("\n\nRemoveFlameFromQueue():BOOM!\n"); + dprint("!! please report this bug !!\n"); + return TF_FLARE_LIT; + } + } + } + } + remove(tmp); + return TF_FLARE_OFF; +}; + +void() Remove = +{ + FlameDestroy(self); +}; + +void() NapalmGrenadeTouch = +{ + sound(self, TF_FLARE_OFF, "weapons/bounce.wav", TF_FLARE_OFF, TF_FLARE_OFF); + if (self.velocity == '0 0 0') + { + self.avelocity = '0 0 0'; + } +}; + +void() T_IncendiaryTouch = +{ + local float damg; + local entity head; + local entity _l_9052; + if (other == self.owner) + { + return; + } + if (pointcontents(self.origin) == -6) + { + remove(self); + return; + } + self.effects = self.effects | 4; +// damg = 30 + random() * 20; + damg = 25 + random() * 20; + if (other.health) + { + deathmsg = 15; + TF_T_Damage(other, self, self.owner, damg, 2, 16); + } + head = findradius(self.origin, 130); + while (head) + { + if (head.takedamage) + { + deathmsg = 15; + TF_T_Damage(head, self, self.owner, 10, 2, 16); + other = head; + Napalm_touch(); + if (other.classname == "player") + { + + if (((self.owner.stats_on == 1) && (self.owner != head))) + { + _l_9052 = self; + self = self.owner; + Stats_Hit (16384); + self = _l_9052; + } + stuffcmd(other, "bf\nbf\n"); + } + } + head = head.chain; + } + self.origin = self.origin - 8 * normalize(self.velocity); + WriteByte(4, 23); + WriteByte(4, 3); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, TF_FLARE_OFF); + dremove(self); +}; + +void () NapalmGrenadeExplode = +{ + local entity _l_9070; + + traceline (self.origin, self.origin, 1, self); + if ((trace_inwater == 1)) + { + sound (self, 0, "misc/vapeur2.wav", 1, 1); + dremove (self); + return; + } + deathmsg = 15; + T_RadiusDamage (self, self.owner, 20, world); + self.playerclass = (self.playerclass + 1); + self.nextthink = (time + 0.750000); + self.effects = (self.effects | 4); + _l_9070 = findradius (self.origin, 130); + while (_l_9070) + { + if (_l_9070.takedamage) + { + deathmsg = 15; + TF_T_Damage (_l_9070, self, self.owner, 30, 2, 16); + other = _l_9070; + Napalm_touch (); + if ((other.classname == "player")) + { + stuffcmd (other, "bf\nbf\n"); + KickPlayer (-6, other); + } + } + _l_9070 = _l_9070.chain; + } + WriteByte (4, 23); + WriteByte (4, 3); + WriteCoord (4, self.origin_x); + WriteCoord (4, self.origin_y); + WriteCoord (4, self.origin_z); + multicast (self.origin, 1); + if ((self.playerclass > 8)) + { + self.owner.active_grenades_2 = (self.owner.active_grenades_2 - 1); + self.think = SUB_Remove; + } +}; + +void() FlameFollow = +{ + local vector dir; + local vector vtemp; + local vector boundsize; + local float damage; + vtemp = self.enemy.absmin; + boundsize = self.enemy.size; + self.solid = TF_FLARE_LIT; + self.movetype = TF_FLARE_LIT; + if (self.enemy.numflames == TF_FLARE_LIT) + { + FlameDestroy(self); + return; + } + if (self.enemy.health < TF_FLARE_OFF) + { + deathmsg = 15; + T_RadiusDamage(self, self, 10, self); + self.enemy.numflames = TF_FLARE_LIT; + FlameDestroy(self); + return; + } + if (self.enemy.armorclass & 16) + { + if (self.enemy.armorvalue > TF_FLARE_LIT) + { + self.health = TF_FLARE_LIT; + } + } + if (self.health < TF_FLARE_OFF) + { + if (self.effects != 8 || self.enemy.numflames <= TF_FLARE_OFF) + { + self.enemy.numflames = self.enemy.numflames - TF_FLARE_OFF; + self.enemy.numflames = TF_FLARE_LIT; + FlameDestroy(self); + return; + } + } + self.health = self.health - TF_FLARE_OFF; + if (vlen(self.enemy.velocity) < 50) + { + dir_x = random() * boundsize_x / 2 + boundsize_x / 4; + dir_y = random() * boundsize_y / 2 + boundsize_y / 4; + dir_z = random() * boundsize_z / 3 + boundsize_z / 2; + vtemp = vtemp + dir; + setorigin(self, vtemp); + if (self.model != "progs/flame2.mdl") + { + self.model = "progs/flame2.mdl"; + setmodel(self, self.model); + } + } + else + { + if (self.model == "progs/flame2.mdl") + { + self.model = string_null; + setmodel(self, self.model); + } + } + traceline(self.origin, self.origin, TF_FLARE_OFF, self); + if (trace_inwater == TF_FLARE_OFF) + { + sound(self, 2, "misc/vapeur2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.enemy.numflames = self.enemy.numflames - TF_FLARE_OFF; + FlameDestroy(self); + return; + } + self.nextthink = time + 0.1; + if (self.effects == 8 && self.heat >= 3) + { + damage = self.enemy.numflames * 0.3 * 3; + if (damage < TF_FLARE_OFF) + { + damage = TF_FLARE_OFF; + } + self.heat = TF_FLARE_OFF; + deathmsg = 15; + TF_T_Damage(self.enemy, self, self.owner, damage, 2, 16); + } + else + { + if (self.effects == 8) + { + self.heat = self.heat + TF_FLARE_OFF; + } + } +}; + +void() OnPlayerFlame_touch = +{ + local entity flame; + local vector vtemp; + if (other != world && other.health > TF_FLARE_LIT && other != self.enemy) + { + if (other.numflames >= 3) + { + return; + } + if (other.classname == "player") + { + if (teamplay & 16 && other.team_no > TF_FLARE_LIT && other.team_no == self.owner.team_no) + { + return; + } + CenterPrint(other, "You are on fire!\n"); + stuffcmd(other, "bf\n"); + } + if (other.numflames < TF_FLARE_OFF) + { + flame = FlameSpawn("1", other); + sound(flame, 2, "ambience/fire1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + flame = FlameSpawn("3", other); + if (flame == world) + { + return; + } + } + flame.classname = "fire"; + flame.health = 30; + other.numflames = other.numflames + TF_FLARE_OFF; + flame.velocity = other.velocity; + flame.enemy = other; + flame.touch = OnPlayerFlame_touch; + flame.owner = self.owner; + vtemp = self.origin; + setorigin(flame, vtemp); + flame.nextthink = time + 0.1; + flame.think = FlameFollow; + } +}; + +void() WorldFlame_touch = +{ + local entity flame; + local vector vtemp; + deathmsg = 15; + TF_T_Damage(other, self, self.enemy, 2, 2, 16); + if (other != world && other.solid != TF_FLARE_OFF && other.health > TF_FLARE_LIT) + { + if (other.numflames >= 3) + { + return; + } + if (other.classname == "player") + { + if (teamplay & 16 && other.team_no > TF_FLARE_LIT && other.team_no == self.owner.team_no) + { + return; + } + CenterPrint(other, "You are on fire!\n"); + stuffcmd(other, "bf\n"); + } + if (other.numflames < TF_FLARE_OFF) + { + flame = FlameSpawn("1", other); + sound(flame, 2, "ambience/fire1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + flame = FlameSpawn("3", other); + if (flame == world) + { + return; + } + } + flame.classname = "fire"; + flame.health = TF_FLARE_LIT; + other.numflames = other.numflames + TF_FLARE_OFF; + flame.velocity = other.velocity; + flame.enemy = other; + flame.touch = OnPlayerFlame_touch; + flame.owner = self.owner; + vtemp = self.origin + '0 0 10'; + setorigin(flame, vtemp); + flame.nextthink = time + 0.15; + flame.think = FlameFollow; + } +}; + +void() Flamer_stream_touch = +{ + local entity flame; + local vector vtemp; + local entity _l_9140; + + if (other.classname == "fire") + { + return; + } + if (other != world) + { + if (other.takedamage == 2 && other.health > TF_FLARE_LIT) + { + deathmsg = 15; + TF_T_Damage(other, self, self.owner, 10, 2, 16); + if (other.numflames >= 3) + { + return; + } + if (other.armorclass & 16) + { + if (other.armorvalue > TF_FLARE_LIT) + { + return; + } + } + if (other.classname == "player") + { + if (((self.owner.stats_on == 1) && (self.owner != other))) + { + _l_9140 = self; + self = self.owner; + Stats_Hit (4096); + self = _l_9140; + } + if (teamplay & 16 && other.team_no > TF_FLARE_LIT && other.team_no == self.owner.team_no) + { + return; + } + CenterPrint(other, "You are on fire!\n"); + stuffcmd(other, "bf\n"); + } + if (other.numflames < TF_FLARE_OFF) + { + flame = FlameSpawn("1", other); + sound(flame, 2, "ambience/fire1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + flame = FlameSpawn("3", other); + if (flame == world) + { + return; + } + } + flame.classname = "fire"; + flame.health = 30; + other.numflames = other.numflames + TF_FLARE_OFF; + flame.velocity = other.velocity; + flame.enemy = other; + flame.touch = OnPlayerFlame_touch; + flame.owner = self.owner; + vtemp = self.origin; + setorigin(flame, vtemp); + flame.nextthink = time + 0.1; + flame.think = FlameFollow; + } + } + else + { + if (random() < 0.4) + { + remove(self); + return; + } + flame = FlameSpawn("4", other); + if (flame != world) + { + flame.touch = WorldFlame_touch; + flame.classname = "fire"; + vtemp = self.origin + '0 0 10'; + setorigin(flame, vtemp); + flame.nextthink = time + 3; + flame.think = Remove; + flame.enemy = self.owner; + } + remove(self); + } +}; + +void() Napalm_touch = +{ + local entity flame; + local vector vtemp; + if (other.classname == "fire") + { + return; + } + if (other != world) + { + if (other.takedamage == 2 && other.health > TF_FLARE_LIT && other.waterlevel <= TF_FLARE_LIT) + { + deathmsg = 15; + TF_T_Damage(other, self, self.owner, 6, 2, 16); + if (other.numflames >= 3) + { + return; + } + if (other.armorclass & 16 && other.armorvalue > TF_FLARE_LIT) + { + return; + } + if (other.classname == "player" && other.waterlevel <= TF_FLARE_LIT) + { + if (teamplay & 16 && other.team_no > TF_FLARE_LIT && other.team_no == self.owner.team_no) + { + return; + } + CenterPrint(other, "You are on fire!\n"); + stuffcmd(other, "bf\n"); + } + if (other.numflames < TF_FLARE_OFF) + { + flame = FlameSpawn("1", other); + sound(flame, 2, "ambience/fire1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + flame = FlameSpawn("3", other); + if (flame == world) + { + return; + } + } + flame.classname = "fire"; + flame.health = 30; + other.numflames = other.numflames + TF_FLARE_OFF; + flame.velocity = other.velocity; + flame.enemy = other; + if (other.waterlevel > TF_FLARE_LIT) + { + flame.touch = OnPlayerFlame_touch; + } + flame.owner = self.owner; + vtemp = self.origin; + setorigin(flame, vtemp); + flame.nextthink = time + 0.1; + flame.think = FlameFollow; + } + } + else + { + flame = FlameSpawn("4", other); + if (flame != world) + { + flame.touch = WorldFlame_touch; + flame.classname = "fire"; + vtemp = self.origin + '0 0 10'; + setorigin(flame, vtemp); + flame.nextthink = time + 15; + flame.think = Remove; + flame.enemy = self.owner; + } + FlameDestroy(self); + } +}; + +void(float num_bubbles, vector bub_origin) NewBubbles = +{ + local entity bubble_spawner; + bubble_spawner = spawn(); + setorigin(bubble_spawner, bub_origin); + bubble_spawner.movetype = TF_FLARE_LIT; + bubble_spawner.solid = TF_FLARE_LIT; + bubble_spawner.nextthink = time + 0.1; + if (self.classname == "player") + { + bubble_spawner.owner = self; + } + else + { + bubble_spawner.owner = self.enemy; + } + bubble_spawner.think = DeathBubblesSpawn; + bubble_spawner.bubble_count = num_bubbles; + return; +}; + +void() W_FireFlame = +{ + local entity flame; + local float rn; + if (self.waterlevel > 2) + { + makevectors(self.v_angle); + NewBubbles(2, self.origin + v_forward * 64); + rn = random(); + if (rn < 0.5) + { + sound(self, TF_FLARE_OFF, "misc/water1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + sound(self, TF_FLARE_OFF, "misc/water2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + return; + } + if (self.playerclass == 7) + { + self.currentammo = self.ammo_cells = self.ammo_cells - 2; + sound(self, TF_FLARE_LIT, "weapons/flmfire2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + flame = spawn(); + flame.owner = self; + flame.movetype = 9; + makevectors(self.v_angle); + flame.velocity = aim(self, 10000); + if (self.playerclass != 6) + { + flame.solid = 2; + flame.velocity = flame.velocity * 600; + } + else + { + flame.velocity = flame.velocity * 100; + flame.solid = TF_FLARE_LIT; + } + flame.classname = "flamerflame"; + flame.effects = 8; + if (self.classname == "airstrike") + { + flame.velocity = '0 0 200'; + } + flame.touch = Flamer_stream_touch; + flame.think = s2_explode1; + flame.nextthink = time + 0.15; + setmodel(flame, "progs/s_expl.spr"); + setsize(flame, '0 0 0', '0 0 0'); + setorigin(flame, self.origin + v_forward * 16 + '0 0 16'); +}; + +void () W_FireIncendiaryCannon = +{ + + if ((self.ammo_rockets < 2)) + { + return; + } + self.ammo_rockets = (self.ammo_rockets - 2); + self.currentammo = (self.ammo_rockets - 2); + sound (self, 1, "doors/airdoor2.wav", 1, 1); + KickPlayer (-3, self); + newmis = spawn (); + newmis.owner = self; + newmis.movetype = 9; + newmis.solid = 2; + makevectors (self.v_angle); + newmis.velocity = aim (self, 1000); +// newmis.velocity = (newmis.velocity * 750); + newmis.velocity = (newmis.velocity * 1000); + newmis.angles = vectoangles (newmis.velocity); + newmis.playerclass = 0; + newmis.touch = T_IncendiaryTouch; + newmis.nextthink = (time + 5); + newmis.think = SUB_Remove; + newmis.weapon = 33; + setmodel (newmis, "progs/incenrkt.mdl"); + setsize (newmis, '0 0 0', '0 0 0'); + setorigin (newmis, ((self.origin + (v_forward * 8)) + '0 0 16')); +}; + +void () TeamFortress_IncendiaryCannon = +{ + if (!(self.weapons_carried & 16384)) + { + return; + } + if ((self.ammo_rockets < 2)) + { + sprint (self, 2, "not enough ammo.\n"); + return; + } + self.current_weapon = 16384; + W_SetCurrentAmmo (); +}; + +void() TeamFortress_FlameThrower = +{ + if (!(self.weapons_carried & 4096)) + { + return; + } + if (self.ammo_cells < TF_FLARE_OFF) + { + sprint(self, 2, "not enough ammo.\n"); + return; + } + self.current_weapon = 4096; + W_SetCurrentAmmo(); +}; + diff --git a/qw.pqc b/qw.pqc new file mode 100644 index 0000000..f1f09e2 --- /dev/null +++ b/qw.pqc @@ -0,0 +1,265 @@ +void () SUB_CalcMoveDone; +void () SUB_CalcAngleMoveDone; +void () SUB_Null; +void () SUB_UseTargets; +void () SUB_Remove; +void(float normal) SUB_AttackFinished; + +void (entity targ,entity inflictor,entity attacker,float damage) T_Damage; +float (entity e,float healamount,float ignore) T_Heal; +float (entity targ,entity inflictor) CanDamage; +.float playerclass; +.float nextpc; +.float last_impulse; +.float armorclass; +.float tf_items; +.float tf_items_flags; +.float no_grenades_1; +.float no_grenades_2; +.string client; +.string clientv; +.float stats_on; +.float autoid; +.float autodiscard; +.float discard_max; +.float bugger; +.vector oldangle; +.vector cam_origin; +.float active_grenades_1; +.float active_grenades_2; +.float tp_grenades_1; +.float tp_grenades_2; +.float got_aliases; +.float cheat_check; +.float is_removed; +.float is_undercover; +.float is_building; +.float is_detpacking; +.float is_feigning; +.float is_unabletospy; +.float has_disconnected; +.float has_dispenser; +.float has_sentry; +.float has_holo; +//.float shieldOn; +.float tfstate; +.entity linked_list; +.entity observer_list; +.float maxammo_shells; +.float maxammo_nails; +.float maxammo_cells; +.float maxammo_rockets; +.float items_allowed; +.float armor_allowed; +.float maxarmor; +.float maxspeed; +.float weaponmode; +.float motd; +.float current_menu; +.float menu_count; +.float menu_displaytime; +float toggleflags /* = 0 */; +float respawn_delay_time /* = 0 */; +float number_of_teams /* = 0 */; +float illegalclasses /* = 0 */; +float illegalclasses1 /* = 0 */; +float illegalclasses2 /* = 0 */; +float illegalclasses3 /* = 0 */; +float illegalclasses4 /* = 0 */; +float civilianteams /* = 0 */; +float team1col /* = 0 */; +float team2col /* = 0 */; +float team3col /* = 0 */; +float team4col /* = 0 */; +float team1score /* = 0 */; +float team2score /* = 0 */; +float team3score /* = 0 */; +float team4score /* = 0 */; +float team1lives /* = 0 */; +float team2lives /* = 0 */; +float team3lives /* = 0 */; +float team4lives /* = 0 */; +float team1maxplayers /* = 0 */; +float team2maxplayers /* = 0 */; +float team3maxplayers /* = 0 */; +float team4maxplayers /* = 0 */; +float team1advantage /* = 0 */; +float team2advantage /* = 0 */; +float team3advantage /* = 0 */; +float team4advantage /* = 0 */; +.float team_no; +.float lives; +.float infection_team_no; +float CTF_Map; +float coop /* = 0 */; +float rj /* = 0 */; +entity pointer_prematchtimer; +entity pointer_timeleft; +float TF_FLARE_LIT = 0; +float TF_FLARE_OFF = 1; +.entity building; +.float building_wait; +.entity real_owner; +.float real_frags; +.float respawn_time; +.float suicide_time; +.float weapons_carried; +.float current_weapon; +.float ammo_medikit; +.float maxammo_medikit; +.float ammo_detpack; +.float maxammo_detpack; +.float reload_shotgun; +.float reload_super_shotgun; +.float reload_grenade_launcher; +.float reload_rocket_launcher; +.float heat; +.float immune_to_check; +.float last_saveme_sound; +.float goal_no; +.float group_no; +.float goal_state; +.float owned_by; +.float goal_activation; +.float goal_effects; +.float goal_result; +.float goal_group; +.float else_goal; +.float if_goal_is_active; +.float if_goal_is_inactive; +.float if_goal_is_removed; +.float if_group_is_active; +.float if_group_is_inactive; +.float if_group_is_removed; +.float activate_goal_no; +.float inactivate_goal_no; +.float remove_goal_no; +.float restore_goal_no; +.float activate_group_no; +.float inactivate_group_no; +.float remove_group_no; +.float restore_group_no; +.float has_item_from_group; +.float remove_item_group; +.float return_item_no; +.float if_item_has_moved; +.float if_item_hasnt_moved; +.float remove_spawnpoint; +.float restore_spawnpoint; +.float remove_spawngroup; +.float restore_spawngroup; +.float display_item_status1; +.float display_item_status2; +.float display_item_status3; +.float display_item_status4; +.string team_str_home; +.string team_str_moved; +.string team_str_carried; +.string non_team_str_home; +.string non_team_str_moved; +.string non_team_str_carried; +.float ex_skill_min; +.float ex_skill_max; +.float increase_team1; +.float increase_team2; +.float increase_team3; +.float increase_team4; +.string broadcast; +.string team_broadcast; +.string non_team_broadcast; +.string owners_team_broadcast; +.string netname_broadcast; +.string netname_team_broadcast; +.string netname_non_team_broadcast; +.string netname_owners_team_broadcast; +.string team_drop; +.string non_team_drop; +.string netname_team_drop; +.string netname_non_team_drop; +string team_menu_string /* = "" */; +.float all_active; +.float item_list; +float item_list_bit /* = 0 */; +.float delay_time; +.float dont_do_triggerwork; +.float g_a; +.float g_e; +.string t_s_h; +.string t_s_m; +.string t_s_c; +.string n_s_h; +.string n_s_m; +.string n_s_c; +.string b_b; +.string b_t; +.string b_n; +.string b_o; +.string n_b; +.string n_t; +.string n_n; +.string n_o; +.string d_t; +.string d_n; +.string d_n_t; +.string d_n_n; +float num_world_flames /* = 0 */; +.float numflames; +.string flame_id; +float num_world_pipebombs /* = 0 */; +float num_team_pipebombs_1 /* = 0 */; +float num_team_pipebombs_2 /* = 0 */; +float num_team_pipebombs_3 /* = 0 */; +float num_team_pipebombs_4 /* = 0 */; +float num_world_ammoboxes /* = 0 */; +float num_team_ammoboxes_1 /* = 0 */; +float num_team_ammoboxes_2 /* = 0 */; +float num_team_ammoboxes_3 /* = 0 */; +float num_team_ammoboxes_4 /* = 0 */; +.float undercover_team; +.float undercover_skin; +.string undercover_name; +float spy_off /* = 0 */; +float invis_only /* = 0 */; +float allow_hook /* = 0 */; +.float hook_out; +float live_camera /* = 0 */; +.float camdist; +.vector camangle; +.entity camera_list; +float already_chosen_map /* = 0 */; +.entity hook; +.float on_hook; +.float fire_held_down; +.vector head_shot_vector; +.float leg_damage; +.float FlashTime; +.float StatusRefreshTime; +.float StatusBarSize; +.float StatusBarRes; +.float gender; +.float active_airmirvs; +float deathmsg /* = 0 */; + +void(float psize, entity p) KickPlayer = +{ + msg_entity = p; + if (psize > -3) + { + WriteByte(1, 34); + } + else + { + WriteByte(1, 35); + } +}; + +void() muzzleflash = +{ + WriteByte(4, 39); + WriteEntity(4, self); + multicast(self.origin, 2); +}; + + + + diff --git a/qwprogs.dat b/qwprogs.dat new file mode 100644 index 0000000..358c7f3 Binary files /dev/null and b/qwprogs.dat differ diff --git a/rankings.pqc b/rankings.pqc new file mode 100644 index 0000000..bf4b615 --- /dev/null +++ b/rankings.pqc @@ -0,0 +1,206 @@ +#ifdef fte_rankings +// Ranking systems +float(string filename, float mode) fopen = #110; +void(float handle) fclose = #111; +string(float handle) fgets = #112; +void(float handle, string s) fputs = #113; +float FILE_READ = 0; +float FILE_APPEND = 1; +float FILE_WRITE = 2; + +//// Player Ranks //// +// RANK_NUMBER = How many frags you need (maybe change this to a "points" system?) +#define RANK_ONE 100 +#define RANK_TWO 250 +#define RANK_THREE 500 +#define RANK_FOUR 1000 +#define RANK_FIVE 1500 +#define RANK_SIX 2150 + +// Called at player join -- this will create the rank file if there is not already one +void (entity rank_ent) Rank_FindStats = +{ + local string rank; + local string frgs; + local string fers; + local string dths; + local string caps; + + local float file; + local string lin; + local string h; + local string filename; + + if (!rank_ent.rank_name || rank_ent.rank_name == "") + return; + + filename = strcat(rank_ent.rank_name,".txt"); + filename = strzone(filename); + + file = fopen(filename, FILE_READ); + if (file == -1) // file not found -- lets make the player a new one! + { + fclose(file); + + rank_ent.global_rank = 0; + rank_ent.global_frags = 0; + rank_ent.global_fers = 0; + rank_ent.global_dths = 0; + rank_ent.global_caps = 0; + +// bprint(2,"gets this far\n"); + + file = fopen(filename, FILE_WRITE); + fputs(file, "Rankings for player"); + fputs(file, "\n"); + + h = ftos(0); + fputs(file, h); + fputs(file, "\n"); + h = ftos(0); + fputs(file, h); + fputs(file, "\n"); + h = ftos(0); + fputs(file, h); + fputs(file, "\n"); + h = ftos(0); + fputs(file, h); + fputs(file, "\n"); + h = ftos(0); + fputs(file, h); + fputs(file, "\n"); + fclose(file); + } + else + { + fclose(file); + file = fopen(filename, FILE_READ); + lin = fgets(file); // This is the comment, skip it + + lin = fgets(file); // this is the rank + lin = strzone(lin); + rank = lin; + rank = strzone(rank); + strunzone(lin); + + lin = fgets(file); // this is the frag count + lin = strzone(lin); + frgs = lin; + frgs = strzone(frgs); + strunzone(lin); + + lin = fgets(file); // this is the fer count + lin = strzone(lin); + fers = lin; + fers = strzone(fers); + strunzone(lin); + + lin = fgets(file); // this is the death count + lin = strzone(lin); + dths = lin; + dths = strzone(dths); + strunzone(lin); + + lin = fgets(file); // this is for flag caps + lin = strzone(lin); + caps = lin; + caps = strzone(caps); + strunzone(lin); + + fclose(file); + + rank_ent.global_rank = stof(rank); + rank_ent.global_frags = stof(frgs); + rank_ent.global_fers = stof(fers); + rank_ent.global_dths = stof(dths); + rank_ent.global_caps = stof(caps); + + strunzone(rank); + strunzone(frgs); + strunzone(fers); + strunzone(dths); + strunzone(caps); + } + strunzone(filename); +}; + +void (entity rank_ent) Rank_UpdateStats = +{ + +}; + +// The following updates the stats for all players on the map; This is only allowed once per map +// and is called at intermission or votemap win time -- if a vote fails with "map not found" this function is +// allowed to execute again. +void () Rank_UpdateStatsGlobal = +{ + if (Ranks_Updated == 1) + return; + Ranks_Updated = 1; + + local entity head; + head = nextent(world); + while (head != world) + { + if (head.classname == "player") { Rank_UpdateStats(head); } + head = nextent(head); + } +}; + +void (entity plyr) Rank_PrintStats = +{ + +} + +// called from impulse 69 +void () Rank_ShowStats = +{ + +}; + +void (entity rank_ent, float addscore) Rank_AddRank = +{ + +} + +void (entity rank_ent) Rank_CheckForIncrease = +{ + +}; + +void (entity rank_ent, float addscore) Rank_AddFrags = +{ + rank_ent.global_frags = rank_ent.global_frags + addscore; + Rank_CheckForIncrease(rank_ent); +} +void (entity rank_ent, float addscore) Rank_AddFers = +{ + rank_ent.global_fers = rank_ent.global_fers + addscore; +} +void (entity rank_ent, float addscore) Rank_AddDeaths = +{ + rank_ent.global_dths = rank_ent.global_dths + addscore; +} +void (entity rank_ent, float addscore) Rank_AddCaps = +{ + rank_ent.global_caps = rank_ent.global_caps + addscore; + Rank_CheckForIncrease(rank_ent); +} + +// This is a temporary function +void (entity plyr, float addfrags) Rank_FragIncrease = +{ + +}; + +void (entity plyr) Rank_PrintRank = +{ + if (plyr.classname != "player") + { + bprint(2, "Tried to print ranks of non-player -- FIXME\n"); + return; + } + sprint(self, 2, plyr.rank_name); + sprint(self, 2, " (rank: ",ftos(plyr.global_rank),")\n"); +}; +#endif \ No newline at end of file diff --git a/rpg.pqc b/rpg.pqc new file mode 100644 index 0000000..87bf508 --- /dev/null +++ b/rpg.pqc @@ -0,0 +1,568 @@ +void () RemoveVote; +void () MapNotFound; +void () RemoveVote2; +string() votesneededtostring; +float(string mapstr) validatemap; +float nomap; +#ifdef fte_rankings +float (string arg1, string arg2, string arg3, string arg4) MoreClientCommands; +void (entity plyr) Rank_PrintRank; +void (entity plyr) Rank_PrintStats; +#endif +#ifdef clan_progs +float (string arg1) ShowReadyPlayers; +#endif + +//TEMP +#define PRINT_HIGH 2 + +void() voteyes = +{ + local string checkallowvote; + checkallowvote = infokey (world, "allowvote"); + if ((checkallowvote != "1")) + { + sprint (self, 2, "Voting has not been enabled on this server.\n"); + return; + } + if (votestarted == 0) + { + sprint (self, 2, "There is no vote started. To start a vote, type [cmd votemap mapname] in console.\n"); + return; + } + if ((self.has_voted == 1)) + { + sprint (self, 2, "You've already voted!\n"); + return; + } + if ((self.vote_wait < 1)) + { + sprint (self, 2, "You must join the game in order to vote.\n"); + return; + } + else + { + self.has_voted = 1; + bprint (1, self.netname); + bprint (1, " has agreed on the map vote.\n"); + num_votes = num_votes + 1; + if (num_votes > (num_players * 0.5)) + { + self.has_voted = 0; + themap = infokey (world, "themap"); + if (infokey(world, "fteserver") == "1" || infokey(world, "fteserver") == "on") + themap = strzone(themap); + bprint (1, themap); + bprint (1, " it is!\n"); + if (prozacmethod == 1) + { + localcmd ("exec qwmcycle/"); + localcmd (themap); + localcmd (".cfg\n"); + changelevel (themap); + newmis = spawn(); + newmis.classname = "timer"; + newmis.nextthink = time + 2; + newmis.think = MapNotFound; + return; + } + localcmd ("exec qwmcycle/"); + localcmd (themap); + localcmd (".cfg\n"); +// changelevel (themap); //changed for map error compatability reasons + localcmd ("map "); + localcmd (themap); + localcmd ("\n"); + newmis = spawn(); + newmis.classname = "timer"; + newmis.nextthink = time + 2; + newmis.think = MapNotFound; + if (infokey(world, "fteserver") == "1" || infokey(world, "fteserver") == "on") + strunzone(themap); + return; + } + local string votesneeded; + votesneeded = votesneededtostring (); + if (votesneeded == "1") + { + bprint (1, votesneeded); + bprint (1, " more vote needed.\n"); + } + else + { + bprint (1, votesneeded); + bprint (1, " more votes needed"); + bprint (1, " "); + themap = infokey (world, "themap"); + bprint (1, themap); + bprint (1, "‘ \n"); + } + } +}; + +void(string put) votemap_start = +{ + local string checkallowvote; + + if ((self.is_ingame != 1)) + { + sprint (self, 2, "You must join the game in order to vote.\n"); + return; + } + if ((self.has_voted == 1)) + { + sprint (self, 2, "You've already voted!\n"); + return; + } + if ((self.startedvote == 1)) + { + sprint (self, 2, "You can only initiate one vote per game!\n"); + return; + } + if (votestarted == 1) + { + sprint (self, 2, "A vote is already in progress. Please use voteyes or wait until the vote ends.\n"); + return; + } + checkallowvote = infokey (world, "allowvote"); + if ((checkallowvote != "1")) + { + sprint (self, 2, "Voting has not been enabled on this server.\n"); + return; + } + if ((self.has_voted == 1)) + { + sprint (self, 2, "You've already voted!\n"); + return; + } + else + { + string mapdispfix; + votestarted = 1; + themap = put; + if (prozacmethod == 1) + { + themap = prozacmap; + } + localcmd ("localinfo themap "); + localcmd (put); + localcmd ("\n"); + bprint (1, self.netname); + bprint (1, " has voted for "); + bprint (1, put); + mapdispfix = put; + bprint (1, " - use voteyes to agree. If more than 50% is not agreed before one minute the vote will end.\n"); +// sound (world, 4, "misc/runekey.wav", 1, 0); +// Since the sound would not play for everyone in the game with the old sound code, I make it play the sound +// individually for all players + local entity head; + head = nextent(world); + while (head != world) + { + if (head.classname == "player") { stuffcmd(head, "play misc/runekey.wav \n"); } + head = nextent(head); + } + num_votes = num_votes + 1; + self.has_voted = 1; +// self.startedvote = 1; + self.vote_wait = (time + 90); + RemoveVote(); + if (num_votes > (num_players * 0.6)) + { + self.has_voted = 0; + localcmd ("exec qwmcycle/"); + localcmd (put); + localcmd (".cfg\n"); +// changelevel (put); // just wasnt working after map fails for some reason.. + localcmd ("map "); + localcmd (put); + localcmd ("\n"); + + newmis = spawn(); + newmis.classname = "timer"; + newmis.nextthink = time + 2; + newmis.think = MapNotFound; + return; + } + local string votesneeded; + votesneeded = votesneededtostring (); + if (votesneeded == "1") + { + bprint (1, votesneeded); + bprint (1, " more vote needed.\n"); + } + else + { + bprint (1, votesneeded); + bprint (1, " more votes needed"); + bprint (1, " "); + themap = infokey (world, "themap"); + bprint (1, mapdispfix); + bprint (1, "‘ \n"); + } + } +}; + +string() votesneededtostring = +{ + local float needed; + needed = ((num_players * 0.5) - num_votes); + + if (needed < 1) + { + return ("1‘"); + } + if (needed < 2) + { + return ("2‘"); + } + if (needed < 3) + { + return ("3‘"); + } + if (needed < 4) + { + return ("4‘"); + } + if (needed < 5) + { + return ("5‘"); + } + if (needed < 6) + { + return ("6‘"); + } + if (needed < 7) + { + return ("7‘"); + } + if (needed < 8) + { + return ("8‘"); + } + if (needed < 9) + { + return ("9‘"); + } + if (needed < 10) + { + return ("10‘"); + } + if (needed < 11) + { + return ("11‘"); + } + if (needed < 12) + { + return ("12‘"); + } + if (needed >= 13) + { + return ("over 12‘"); + } + return ("ERROR"); +}; + +void() MapNotFound = +{ + local entity finder_ent; + + localcmd("say -- Map Not Found --\n"); + nomap = 1; + finder_ent = find (world,classname,"VoteFailed"); + while (finder_ent) + { + if ((finder_ent.classname == "VoteFailed")) + { + dremove (finder_ent); + } + finder_ent = find (finder_ent, classname, "VoteFailed"); + } + RemoveVote2 (); + dremove (self); +} + +void() RemoveVote = +{ + newmis = spawn(); + newmis.classname = "VoteFailed"; +// newmis.classname = "timer"; // changed to "VoteFailed" + newmis.nextthink = time + 60; + newmis.think = RemoveVote2; + nomap = 0; + //dremove (self);// <- would have removed the player O.o +} + +void() RemoveVote2 = +{ + prozacmethod = 0; + local entity head; + localcmd("say -- VOTE HAS FAILED --"); + + votestarted = 0; + num_votes = 0; + self.startedvote = 0; + self.vote_wait = (time + 30); + + head = nextent(world); + while (head != world) + { + if (head.classname == "player") { head.has_voted = 0; } + head = nextent(head); + } + return; + dremove (self); +}; + +// PROZAC STUFF (Needs Often's Prozac Server.) +// Thank you Often for your wonderful help coding this. Credit for this vote system belongs to you, man! +float(string st1, string st2) strcasecmp = #87; + +float(float num_args, string arg1, string arg2, string arg3, string arg4, string arg5, string arg6, string arg7) ClientCommand = +{ + if (!strcasecmp("votemap",arg1)) + { + if ((self.vote_wait < 1)) + { + sprint (self, 2, "You must join the game in order to vote.\n"); + return 1; + } + local string thisiscnn; + thisiscnn = arg2; + if (!arg2) + { + sprint (self, 2, "Please use [cmd votemap mapname] in the console.\n"); + return 1; + } + if (validatemap(arg2)) + { + pmap_backup = thisiscnn; + prozacmethod = 1; + prozacmap = thisiscnn; + votemap_start(thisiscnn); + return 1; + } + else + { + sprint(self,2,"The server doesn't have the ¢"); + sprint(self,2,arg2); + sprint(self,2,"¢ map\n"); + return 1; + } + } +#ifdef clan_progs + else if (ShowReadyPlayers(arg1) == 1) + return 1; +#endif + return 0; +}; + +float(string mapstr) validatemap = +{ + mapstr = strcat("maps/",mapstr); + mapstr = strcat(mapstr,".bsp"); + + return validatefile(mapstr); +}; + +void (string d, string st) FTE_VoteMap = +{ + +}; + +//Basically this allows FTE/Fuh/EZQuake servers to use cmd. +//In the case of FTE, saying !map actually works (map check too) +void SV_ParseClientCommand (string st) +{ + local float args; +// local float h; // no refs yet (maybe for use in future release?) + local string c; + local string d; + local string f; + local string g; + local string i; + args = tokenize(st); + c = argv(0); + d = argv(1); + f = argv(2); + g = argv(3); + i = argv(4); + + if (c == "pm") + { + if (!d) + { + sprint (self, 2, "Please use [cmd pm userid \"message\"] in the console:\n"); + pm_list (); + return; + } + if (d) + { + if (!f) + { + sprint (self, 2, "Please use [cmd pm userid \"message\"] in the console:\n"); + pm_list (); + return; + } + if (g != "") + { + sprint (self, 2, "Use your message text inside \"quotes like this\"!\n"); + return; + } + else + { + local entity te; + local float gotthrough; + local float getid; + getid = stof(d); + te = find(world,classname,"player"); + while (te) + { + if (te.userid == getid) + { + gotthrough = 1; + stuffcmd(te, "play misc/talk.wav\n"); + sprint(te, 2, "ÐÍ ¨",self.netname,"©º ",f,"\n"); + sprint(self, 2, "PM to ",te.netname," sent\n"); + stuffcmd(self, "play misc/talk.wav\n"); + self.cooldown = (time + 4); + return; + } + te = find(te,classname,"player"); + } + sprint (self, 2, "User not found. Please choose a userid from this list:\n"); + pm_list (); + return; + } + } + return; + } + // edit this to do what you want with the received commands + else if (c == "votemap") + { + if (d) + { + FTE_VoteMap(d, st); + } + clientcommand(self, st); + sprint (self, 2, "Please use cmd votemap mapname\n"); + return; + } + else if (c == "say") + { + if (d == "!voteyes") + { + voteyes (); + return; + } + else if (d == "!map" || d == "!votemap") + { + FTE_VoteMap(f, st); + return; + } + clientcommand(self, st); + } +#ifdef fte_rankings + else if (MoreClientCommands(c, d, f, g) == 1) + return; +#endif +#ifdef clan_progs + else if (ShowReadyPlayers(c) == 1) + return; +#endif + else + { + clientcommand(self, st); + } + +}; + +#ifdef fte_rankings +float (string arg1, string arg2, string arg3, string arg4) MoreClientCommands = +{ + local entity te; + + if (arg1 == "showrank") + { + if (!arg2) + { + sprint(self, 2, "Please use as: CMD showrank userid, or CMD showrank all.\n"); + pm_list (); + return 1; + } + else if (arg2 == "all") + { + te = find(world,classname,"player"); + while (te) + { + if (te.has_disconnected == 0) + { + Rank_PrintRank(te); + } + te = find(te,classname,"player"); + } + return 1; + } + else + { + if (stof(arg2) == 0 || !stof(arg2)) + { + sprint (self, 2, "User not found. Please choose a userid from this list:\n"); + pm_list (); + return 1; + } + te = find(world,classname,"player"); + while (te) + { + if (te.userid == stof(arg2)) + { + //Rank_PrintRank(te); + sprint(self, 2, "Ranks for "); + sprint(self, 2, te.rank_name); + sprint(self, 2, ":\n"); + Rank_PrintStats(te); + return 1; + } + te = find(te,classname,"player"); + } + sprint (self, 2, "User not found. Please choose a userid from this list:\n"); + pm_list (); + return 1; + } + } + return 0; +}; +#endif + +#ifdef clan_progs +float (string arg1) ShowReadyPlayers = +{ + local entity te; + + if (arg1 == "showready") + { + if (clan_prematch < 1) + { + sprint(self, 2, "There is currently no Clan Prematch in progress.\n"); + return 1; + } + te = find(world,classname,"player"); + while (te) + { + if (te.userid > 0) + { + sprint(self, 2, te.netname); + sprint(self, 2, " ("); + if (te.is_ready == 1) + sprint(self, 2, "ready"); + else + sprint(self, 2, "not ready"); + sprint(self, 2, ")\n"); + } + te = find(te,classname,"player"); + } + return 1; + } + return 0; +}; +#endif \ No newline at end of file diff --git a/scout.pqc b/scout.pqc new file mode 100644 index 0000000..c11677b --- /dev/null +++ b/scout.pqc @@ -0,0 +1,560 @@ +// Functions inside this file +// Concussion Grenade Functions +void() ConcussionGrenadeTouch; +void() ConcussionGrenadeExplode; +void() ConcussionGrenadeTimer; +// Scanner Functions +void(float scanrange) TeamFortress_Scan; +//void(entity inflictor, entity attacker, float bounce, entity ignore) T_RadiusBounce; +void (entity _p_9676, entity _p_9677, float _p_9678, entity _p_9679, float _p_9680) T_RadiusBounce; +entity(entity scanner, float scanrange, float enemies, float friends) T_RadiusScan; + + +void() FlashGrenadeTouch = +{ + sound(self, TF_FLARE_OFF, "weapons/bounce.wav", TF_FLARE_OFF, TF_FLARE_OFF); + if (self.velocity == '0 0 0') + { + self.avelocity = '0 0 0'; + } +}; + +void () FlashTimer = +{ + local entity te; + local string st; + + te = self.owner; + te.FlashTime = (te.FlashTime - 0.100000); + if ((te.FlashTime < 0)) + { + te.FlashTime = 0; + stuffcmd (te, "v_cshift 0\n"); + remove (self); + return; + } + if ((te.FlashTime < 1.700000)) + { + st = ftos ((te.FlashTime * 150)); + stuffcmd (te, "v_cshift "); + stuffcmd (te, st); + stuffcmd (te, " "); + stuffcmd (te, st); + stuffcmd (te, " "); + stuffcmd (te, st); + stuffcmd (te, " "); + stuffcmd (te, st); + stuffcmd (te, "\n"); + } + if ((te.FlashTime >= 1.700000)) + { + stuffcmd (te, "v_cshift 255 255 255 255\n"); + } + if (((te.client != "zquake") && (te.client != "fuhquake"))) + { + stuffcmd (te, "gl_polyblend 1\n"); + } + if ((te.client == "moreqw")) + { + stuffcmd (te, "gl_cshiftpercent 100\n"); + } + self.nextthink = (time + 0.100000); +}; + +void() FlashGrenadeExplode = +{ + local entity te; + self.effects = self.effects | 4; + WriteByte(4, 23); + WriteByte(4, 4); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, TF_FLARE_OFF); + te = findradius(self.origin, 200); + while (te) + { + if (te.classname == "player" && te.team_no != self.owner.team_no) + { + deathmsg = 35; + TF_T_Damage(te, self, self.owner, 60, TF_FLARE_LIT, 16); + if (te.health > TF_FLARE_LIT) + { + if (te.FlashTime == TF_FLARE_LIT) + { + newmis = spawn (); + newmis.classname = "timer"; + newmis.netname = "flashtimer"; + newmis.team_no = self.owner.team_no; + newmis.owner = te; + newmis.think = FlashTimer; + newmis.nextthink = (time + 0.100000); + } +// te.FlashTime = 2.500000; //changed to 3 seconds + te.FlashTime = 3; + if (((te.client != "zquake") && (te.client != "fuhquake"))) + { + stuffcmd (te, "gl_polyblend 1\ngl_cshiftpercent 100\n"); + } + stuffcmd (te, "v_cshift 255 255 255 255\n"); + } + } + te = te.chain; + } + BecomeExplosion (); + self.owner.active_grenades_1 = (self.owner.active_grenades_1 - 1); + dremove (self); +}; + + +void() ConcussionGrenadeTouch = +{ + sound(self, TF_FLARE_OFF, "weapons/bounce.wav", TF_FLARE_OFF, TF_FLARE_OFF); + if (self.velocity == '0 0 0') + { + self.avelocity = '0 0 0'; + } +}; + +void () ConcussionGrenadeExplode = +{ + + T_RadiusBounce (self, self.owner, 240, world, 100); + WriteByte (4, 23); + WriteByte (4, 3); + WriteCoord (4, self.origin_x); + WriteCoord (4, self.origin_y); + WriteCoord (4, self.origin_z); + BecomeExplosion (); + multicast (self.origin, 1); + self.owner.active_grenades_2 = (self.owner.active_grenades_2 - 1); + dremove (self); +}; + +// new scout and medic conc timer code begin +void () ConcussionGrenadeTimer = +{ + if (!oldconc) + { + local string _l_9623; + local float _l_9624; + + self.cnt = (self.cnt + 0.200000); + if (((self.owner.client != "zquake") && (self.owner.client != "fuhquake"))) + { + _l_9623 = ftos (self.health); + stuffcmd (self.owner, "v_idlescale "); + stuffcmd (self.owner, _l_9623); + stuffcmd (self.owner, "\n"); + } + _l_9624 = rint ((self.cnt * 10)); + if (((((((((_l_9624 == 50) || (_l_9624 == 100)) || (_l_9624 == 150)) || (_l_9624 == 200)) || (_l_9624 == 250)) || (_l_9624 == 300)) || (_l_9624 == 350)) || (_l_9624 == 400))) + { + if ((self.owner.invincible_finished > time)) + { + stuffcmd (self.owner, "v_idlescale 0\n"); + dremove (self); + return; + } + newmis = spawn (); + setmodel (newmis, "progs/s_bubble.spr"); + setorigin (newmis, self.owner.origin); + newmis.movetype = 8; + newmis.solid = 0; + newmis.velocity = '0 0 15'; + newmis.nextthink = (time + 0.500000); + newmis.think = bubble_bob; + newmis.touch = bubble_remove; + newmis.classname = "bubble"; + newmis.frame = 0; + newmis.cnt = 0; + setsize (newmis, '-8 -8 -8', '8 8 8'); + self.health = (self.health - 20); + if ((self.owner.playerclass == 5)) + { + self.health = (self.health - 20); + } + if ((self.health < 0)) + { + self.health = 0; + } + self.nextthink = (time + 5); + _l_9623 = ftos (self.health); + stuffcmd (self.owner, "v_iroll_cycle 0.5\n"); + stuffcmd (self.owner, "v_ipitch_cycle 1\n"); + stuffcmd (self.owner, "v_iyaw_cycle 2\n"); + stuffcmd (self.owner, "v_iroll_level 0.1\n"); + stuffcmd (self.owner, "v_ipitch_level 0.3\n"); + stuffcmd (self.owner, "v_iyaw_level 0.3\n"); + stuffcmd (self.owner, "v_idlescale "); + stuffcmd (self.owner, _l_9623); + stuffcmd (self.owner, "\n"); + if ((self.health == 0)) + { + dremove (self); + } + } + self.nextthink = (time + 0.200000); + } + else + { + local vector src; + local float pos; + local float concadjust; + local float stumble; + + if (self.owner.invincible_finished > time) { + sprint (self.owner, 2, "Your head feels better now.\n"); + self.owner.fixangle = 0; + dremove (self); + return; + } + if ((self.health == 200) || (self.health == 400) || (self.health == 600) + || (self.health == 800) || (self.health == 1000)) { + newmis = spawn (); + setmodel (newmis, "progs/s_bubble.spr"); + setorigin (newmis, self.owner.origin); + newmis.movetype = 8; + newmis.solid = 0; + newmis.velocity = '0 0 15'; + newmis.nextthink = time + 0.5; + newmis.think = bubble_bob; + newmis.touch = bubble_remove; + newmis.classname = "bubble"; + newmis.frame = 0; + newmis.cnt = 0; + setsize (newmis, '-8 -8 -8', '8 8 8'); + } + self.health = self.health - 10; + if (self.owner.playerclass == 5) + self.health = self.health - 10; + + if (self.health < 0) + self.health = 0; + + concadjust = 1; + self.nextthink = time + 0.25 * concadjust; + + if (concadjust > 1) + self.health = self.health - concadjust; + + pos = pointcontents (self.owner.origin); + src_x = self.owner.origin_x + self.owner.maxs_x + 2; + src_y = self.owner.origin_y + self.owner.maxs_y + 2; + src_z = self.owner.origin_z; + pos = pointcontents (src); + + if ((self.owner.flags & 512) || (self.owner.flags & 16)) { + if (!((self.owner.tfstate & 65536) + && (self.owner.current_weapon == 32768))) { + if (self.owner.is_feigning == 0) { + makevectors (self.owner.v_angle); + stumble = crandom () * self.health; + if (!((pos == -2) && (self.owner.velocity == '0 0 0'))) { + if ((crandom () < 0)) { + self.owner.velocity_x = self.owner.velocity_y + stumble; + self.owner.velocity_y = self.owner.velocity_x + stumble; + } else { + self.owner.velocity_x = -1 * self.owner.velocity_y + stumble; + self.owner.velocity_y = -1 * self.owner.velocity_x + stumble; + } + } + } + } + } + if (self.health <= 0) { + sprint (self.owner, 2, "Your head feels better now.\n"); + dremove (self); + } + } +}; + +// new scout and medic conc timer code end + +void(float scanrange) TeamFortress_Scan = +{ + local entity list; + local float scen; + local float scfr; + local vector lightningvec; + local float enemy_detected; + local float any_detected; + self.impulse = TF_FLARE_LIT; + self.last_impulse = TF_FLARE_LIT; + if (self.classname == "player") + { + if (!(self.tf_items & TF_FLARE_OFF)) + { + return; + } + if (scanrange == 160) + { + if (self.tf_items_flags & TF_FLARE_OFF) + { + sprint(self, 2, "Enemy Scanning disabled.\n"); + self.tf_items_flags = self.tf_items_flags - TF_FLARE_OFF; + return; + } + sprint(self, 2, "Enemy Scanning enabled.\n"); + self.tf_items_flags = self.tf_items_flags | TF_FLARE_OFF; + return; + } + if (scanrange == 161) + { + if (self.tf_items_flags & 2) + { + sprint(self, 2, "Friendly Scanning disabled.\n"); + self.tf_items_flags = self.tf_items_flags - 2; + return; + } + sprint(self, 2, "Friendly Scanning enabled.\n"); + self.tf_items_flags = self.tf_items_flags | 2; + return; + } + scen = TF_FLARE_LIT; + scfr = TF_FLARE_LIT; + if (self.tf_items_flags & TF_FLARE_OFF) + { + scen = TF_FLARE_OFF; + } + if (self.tf_items_flags & 2) + { + scfr = TF_FLARE_OFF; + } + if (scen == TF_FLARE_LIT && scfr == TF_FLARE_LIT) + { + sprint(self, 2, "All scanner functions are disabled.\n"); + return; + } + scanrange = scanrange * 100; + list = T_RadiusScan(self, scanrange, scen, scfr); + } + scen = TF_FLARE_LIT; + scfr = TF_FLARE_LIT; + makevectors(self.v_angle); + while (list) + { + any_detected = TF_FLARE_OFF; + if (self.tf_items_flags & 4) + { + if (vlen(list.velocity) > 50) + { + if (list.team_no > TF_FLARE_LIT && self.team_no > TF_FLARE_LIT && list.team_no == self.team_no) + { + scfr = scfr + TF_FLARE_OFF; + enemy_detected = TF_FLARE_LIT; + } + else + { + scen = scen + TF_FLARE_OFF; + enemy_detected = TF_FLARE_OFF; + } + } + else + { + any_detected = TF_FLARE_LIT; + } + } + else + { + if (list.team_no > TF_FLARE_LIT && self.team_no > TF_FLARE_LIT && list.team_no == self.team_no) + { + scfr = scfr + TF_FLARE_OFF; + enemy_detected = TF_FLARE_LIT; + } + else + { + scen = scen + TF_FLARE_OFF; + enemy_detected = TF_FLARE_OFF; + } + } + if (any_detected) + { + lightningvec = normalize(list.origin - self.origin); + lightningvec = lightningvec * (vlen(list.origin - self.origin) / 5); + lightningvec = lightningvec + self.origin; + msg_entity = self; + WriteByte(TF_FLARE_OFF, 23); + WriteByte(TF_FLARE_OFF, 6); + WriteEntity(TF_FLARE_OFF, self); + WriteCoord(TF_FLARE_OFF, self.origin_x); + WriteCoord(TF_FLARE_OFF, self.origin_y); + WriteCoord(TF_FLARE_OFF, self.origin_z + 8); + WriteCoord(TF_FLARE_OFF, lightningvec_x); + WriteCoord(TF_FLARE_OFF, lightningvec_y); + WriteCoord(TF_FLARE_OFF, lightningvec_z + 8); + } + list = list.linked_list; + } + if (scen == TF_FLARE_LIT && scfr == TF_FLARE_LIT) + { + sprint(self, 2, "No blips.\n"); + return; + } + W_SetCurrentAmmo(); + return; +}; + +void (entity _p_9676, entity _p_9677, float _p_9678, entity _p_9679, float _p_9680) T_RadiusBounce = +{ + local float _l_9681; + local entity _l_9682; + local entity _l_9683; + local entity _l_9684; + local vector _l_9685; + + _l_9682 = findradius (_p_9676.origin, (_p_9678 + 40)); + while (_l_9682) + { + if ((_l_9682 != _p_9679)) + { + if (_l_9682.takedamage) + { + _l_9685 = _l_9682.origin + ((_l_9682.mins + _l_9682.maxs) * 0.500000); + _l_9681 = 0.500000 * vlen ((_l_9685 - _p_9676.origin)); + if ((_l_9681 < 0)) + { + _l_9681 = 0; + } + _l_9681 = _p_9678 - _l_9681; + if ((((_l_9682.classname != "building_sentrygun") && (_l_9682.classname != "building_sentrygun_base")) && (_l_9681 > 0))) + { + if (((_l_9682.classname == "player") && (_l_9682.bugger > 0))) + { + return; + } + if ((_l_9682.classname == "player_prop")) + { + _l_9684 = self; + self = _l_9682.owner; + LookThroughCam (); + self = _l_9684; + _l_9682 = _l_9682.owner; + } + _l_9682.velocity = (_l_9685 - _p_9676.origin); + _l_9682.velocity = (_l_9682.velocity * (_l_9681 / 20)); + if ((_l_9682.classname != "player")) + { + if ((_l_9682.flags & 512)) + { + _l_9682.flags = (_l_9682.flags - 512); + } + } + else + { + _l_9683 = find (world, classname, "timer"); + while ((((_l_9683.owner != _l_9682) || (_l_9683.think != ConcussionGrenadeTimer)) && (_l_9683 != world))) + { + _l_9683 = find (_l_9683, classname, "timer"); + } + if (((_l_9683 != world) && (_l_9683.playerclass != 6))) + { + stuffcmd (_l_9682, "v_iroll_cycle 0.5\n"); + stuffcmd (_l_9682, "v_ipitch_cycle 1\n"); + stuffcmd (_l_9682, "v_iyaw_cycle 2\n"); + stuffcmd (self.owner, "v_iroll_level 0.1\n"); + stuffcmd (self.owner, "v_ipitch_level 0.3\n"); + stuffcmd (self.owner, "v_iyaw_level 0.3\n"); + stuffcmd (_l_9682, "v_idlescale "); + stuffcmd (_l_9682, ftos (_p_9680)); + stuffcmd (_l_9682, "\n"); + _l_9683.health = _p_9680; + _l_9683.nextthink = (time + 0.200000); + } + else + { + if (((_l_9682.team_no != _p_9677.team_no) || (_l_9682 == _p_9677))) + { + if (oldconc) + { + local entity te; + te = spawn (); + te.nextthink = time + 0.25; + te.think = ConcussionGrenadeTimer; + te.team_no = _p_9677.team_no; + te.classname = "timer"; + te.owner = _l_9682; + te.health = 750; + } + else + { + stuffcmd (_l_9682, "v_iroll_cycle 0.5\n"); + stuffcmd (_l_9682, "v_ipitch_cycle 1\n"); + stuffcmd (_l_9682, "v_iyaw_cycle 2\n"); + stuffcmd (self.owner, "v_iroll_level 0.1\n"); + stuffcmd (self.owner, "v_ipitch_level 0.3\n"); + stuffcmd (self.owner, "v_iyaw_level 0.3\n"); + stuffcmd (_l_9682, "v_idlescale "); + stuffcmd (_l_9682, ftos (_p_9680)); + stuffcmd (_l_9682, "\n"); + stuffcmd (_l_9682, "bf\n"); + _l_9683 = spawn (); + _l_9683.nextthink = (time + 0.200000); + _l_9683.think = ConcussionGrenadeTimer; + _l_9683.team_no = _p_9677.team_no; + _l_9683.classname = "timer"; + _l_9683.owner = _l_9682; + _l_9683.health = _p_9680; + } + } + } + } + } + } + } + _l_9682 = _l_9682.chain; + } +}; + +entity(entity scanner, float scanrange, float enemies, float friends) T_RadiusScan = +{ + local entity head; + local entity list_head; + local entity list; + local float gotatarget; + head = findradius(scanner.origin, scanrange + 40); + while (head) + { + gotatarget = TF_FLARE_LIT; + if (head != scanner) + { + if (head.takedamage) + { + if (head.classname == "player" && (friends || enemies)) + { + if (teamplay) + { + if (friends && head.team_no > TF_FLARE_LIT && scanner.team_no > TF_FLARE_LIT && head.team_no == scanner.team_no) + { + gotatarget = TF_FLARE_OFF; + } + if (enemies && head.team_no > TF_FLARE_LIT && scanner.team_no > TF_FLARE_LIT && head.team_no != scanner.team_no) + { + gotatarget = TF_FLARE_OFF; + } + } + else + { + gotatarget = TF_FLARE_OFF; + } + } + } + } + if (gotatarget) + { + if (list) + { + list.linked_list = head; + list = list.linked_list; + } + else + { + list_head = head; + list = head; + } + } + head = head.chain; + } + return list_head; +}; + diff --git a/sentry.pqc b/sentry.pqc new file mode 100644 index 0000000..271d266 --- /dev/null +++ b/sentry.pqc @@ -0,0 +1,448 @@ +// This is a temporary hack... they'll be replaced with real bots when +// the bot code is in (should that be if? :) +// SentryGun AI Functions +void() Sentry_Rotate; +float() Sentry_FindTarget; +void() Sentry_FoundTarget; +void() Sentry_HuntTarget; +void() Sentry_Pain; +void() Sentry_Die; +float() Sentry_Fire; +void() lvl2_sentry_atk3; +void() lvl3_sentry_atk3; +void(entity gunhead) CheckSentry; +void(entity bld) CheckBelowBuilding; + +void() ai_face = +{ + self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin); + self.ideal_yaw = anglemod(self.ideal_yaw); + ChangeYaw(); +}; + +void() lvl1_sentry_stand = [0, lvl1_sentry_stand] +{ + Sentry_Rotate(); +}; + +void() lvl1_sentry_atk1 = [1, lvl1_sentry_atk3] +{ + ai_face(); + if (self.enemy == world || self.enemy.health <= 0 || !visible(self.enemy) || self.enemy.has_disconnected == 1 || self.enemy.team_no == 0) + { + lvl1_sentry_stand(); + } + else + { + if (self.ammo_shells <= 0) + { + lvl1_sentry_stand(); + } + else + { + if (Sentry_Fire() == 0) + { + lvl1_sentry_atk3(); + } + } + } +}; + +void() lvl1_sentry_atk2 = [2, lvl1_sentry_atk3] +{ + ai_face(); + Sentry_Fire(); +}; + +void() lvl1_sentry_atk3 = [0, lvl1_sentry_atk1] +{ + ai_face(); +}; + +void() lvl2_sentry_stand = [3, lvl2_sentry_stand] +{ + Sentry_Rotate(); +}; + +void() lvl2_sentry_atk1 = [4, lvl2_sentry_atk2] +{ + ai_face(); + if (self.enemy == world || self.enemy.health <= 0 || !visible(self.enemy) || self.enemy.has_disconnected == 1 || self.enemy.team_no == 0) + { + lvl2_sentry_stand(); + } + else + { + if (self.ammo_shells <= 0) + { + lvl2_sentry_stand(); + } + else + { + if (Sentry_Fire() == 0) + { + lvl2_sentry_atk3(); + } + } + } +}; + +void() lvl2_sentry_atk2 = [5, lvl2_sentry_atk3] +{ + ai_face(); + Sentry_Fire(); +}; + +void() lvl2_sentry_atk3 = [3, lvl2_sentry_atk1] +{ + ai_face(); + Sentry_Fire(); +}; + +void() lvl3_sentry_stand = [6, lvl3_sentry_stand] +{ + Sentry_Rotate(); +}; + +void() lvl3_sentry_atk1 = [7, lvl3_sentry_atk2] +{ + ai_face(); + if (self.enemy == world || self.enemy.health <= 0 || !visible(self.enemy) || self.enemy.has_disconnected == 1 || self.enemy.team_no == 0) + { + lvl3_sentry_stand(); + } + else + { + if (self.ammo_shells <= 0 && self.ammo_rockets <= 0) + { + lvl3_sentry_stand(); + } + else + { + if (Sentry_Fire() == 0) + { + lvl3_sentry_atk3(); + } + } + } +}; + +void() lvl3_sentry_atk2 = [8, lvl3_sentry_atk3] +{ + ai_face(); + Sentry_Fire(); +}; + +void() lvl3_sentry_atk3 = [6, lvl3_sentry_atk1] +{ + ai_face(); + Sentry_Fire(); +}; + +void() Sentry_Rotate = +{ + local float ay; + CheckSentry(self); + if (Sentry_FindTarget()) + { + return; + } + self.effects = 0; + if (self.heat == 0) + { + self.ideal_yaw = self.waitmin; + ChangeYaw(); + ay = anglemod(self.angles_y); + ay = rint(ay); + if (ay == rint(self.waitmin)) + { + CheckBelowBuilding(self.trigger_field); + self.heat = 1; + if (random() < 0.1) + { + sound(self, 3, "weapons/gunidle1.wav", 0.5, 1); + } + } + } + else + { + self.ideal_yaw = self.waitmax; + ChangeYaw(); + ay = anglemod(self.angles_y); + ay = rint(ay); + if (ay == rint(self.waitmax)) + { + CheckBelowBuilding(self.trigger_field); + self.heat = 0; + } + } +}; + +float() Sentry_FindTarget = +{ +// local entity client; //client is a global + local entity f_client; + local float r; + local float gotone; + local float loopc; + r = 0; + loopc = 0; + gotone = 0; + f_client = findradius(self.origin, 1000); + while (f_client != world && gotone != 1) + { + gotone = 1; + if (!f_client) + { + gotone = 0; + } + if (f_client == self) + { + gotone = 0; + } + if (f_client.has_disconnected == 1) + { + gotone = 0; + } + if (!(f_client.takedamage)) + { + gotone = 0; + } + if (teamplay) + { + if (f_client.team_no == self.team_no && self.team_no != 0) + { + gotone = 0; + } + if (f_client.undercover_team == self.team_no && self.team_no != 0) + { + gotone = 0; + } + } + if (f_client == self.real_owner) + { + gotone = 0; + } + if (f_client.is_feigning) + { + gotone = 0; + } + if (f_client.flags & 128) + { + gotone = 0; + } + if (f_client.items & 524288) + { + gotone = 0; + } + if (!visible(f_client)) + { + gotone = 0; + } + r = range(f_client); + if (r == 3) + { + gotone = 0; + } + else + { + if (r == 2 && !infront(f_client)) + { + gotone = 0; + } + } + if (!gotone) + { + f_client = f_client.chain; + } + } + if (!gotone) + { + return 0; + } + self.enemy = f_client; + Sentry_FoundTarget(); + return 1; +}; + +void() Sentry_FoundTarget = +{ + if (self.ammo_shells > 0 || (self.ammo_rockets > 0 && self.weapon == 3)) + { + sound(self, 2, "weapons/pain.wav", 1, 1); + self.last_saveme_sound = time + 5; + } + Sentry_HuntTarget(); + if (self.super_damage_finished < time) + { + self.super_damage_finished = time + 0.5; + } +}; + +void() Sentry_HuntTarget = +{ + self.goalentity = self.enemy; + if (self.weapon == 1) + { + self.think = lvl1_sentry_atk1; + } + else + { + if (self.weapon == 2) + { + self.think = lvl2_sentry_atk1; + } + else + { + self.think = lvl3_sentry_atk1; + } + } + self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin); + self.nextthink = time + 0.1; + if (engbat) + { + self.nextthink = (time + 0.200000); + } + SUB_AttackFinished(1); +}; + +void() Sentry_Pain = +{ + self.real_owner.StatusRefreshTime = time + 0.2; +}; + +void() Sentry_Die = +{ + sprint(self.real_owner, 2, "Your sentry gun was destroyed.\n"); + self.real_owner.has_sentry = 0; + ThrowGib("progs/tgib1.mdl", -70); + ThrowGib("progs/tgib2.mdl", -70); + ThrowGib("progs/tgib3.mdl", -70); + if (self.classname == "building_sentrygun_base") + { + if (self.oldenemy) + { + dremove(self.oldenemy); + } + } + else + { + dremove(self.trigger_field); + } + WriteByte(4, 23); + WriteByte(4, 3); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, 1); + BecomeExplosion(); +}; + +float() Sentry_Fire = +{ + local vector dir; + + dir = self.enemy.origin - self.origin; + if ((self.enemy.classname == "bot")) + { + if ((self.enemy.netname == "airmirv")) + { + dir = dir - (0.150000 * self.enemy.velocity); + } + else + { + dir = (self.enemy.origin + '0 0 -35') - self.origin; + } + } + if ((((self.ideal_yaw - anglemod (self.angles_y)) < -10) || ((self.ideal_yaw - anglemod (self.angles_y)) > 10))) + { + return (0); + } + sound (self, 1, "weapons/plaser.wav", 1, 1); + self.ammo_shells = (self.ammo_shells - 1); + if ((self.ammo_shells < 0)) + { + self.ammo_shells = 0; + } +#ifdef clan_progs + //CH this further checks while firing + traceline (self.origin + '0 0 20', self.enemy.origin, TL_BSP_ONLY, self); + if (trace_fraction != 1 || trace_endpos != self.enemy.origin) + { + return 0; + } + // dont fire if you cant hit enemy + traceline (self.origin + '0 0 20', self.enemy.origin, TL_ANY_SOLID, self); + if (trace_fraction != 1.0 && trace_ent.takedamage && self.ammo_shells > 0) +#else + if ((self.ammo_shells > 0)) +#endif + { + deathmsg = 27; + if (coloredlights) + { + if ((self.real_owner.team_no == 1)) + { + self.effects = (self.effects | 64); + } + else + { + if ((self.real_owner.team_no == 2)) + { + self.effects = (self.effects | 128); + } + else + { + self.effects = (self.effects | 2); + } + } + } + else + { + self.effects = (self.effects | 2); + } + + + FireBullets (1, dir, '0.100000 0.100000 0'); + } + if ((((self.weapon == 3) && (self.ammo_rockets > 0)) && (self.super_damage_finished < time))) + { + sound (self, 1, "weapons/rocklr1a.wav", 1, 1); + newmis = spawn (); + newmis.owner = self; + newmis.movetype = 9; + newmis.solid = 2; + newmis.velocity = (normalize (dir) * 800); + newmis.angles = vectoangles (newmis.velocity); + newmis.weapon = 34; + newmis.touch = T_MissileTouch; + newmis.nextthink = (time + 5); + newmis.think = SUB_Remove; + setmodel (newmis, "progs/missile.mdl"); + setsize (newmis, '0 0 0', '0 0 0'); + setorigin (newmis, ((self.origin + (v_forward * 8)) + '0 0 16')); + self.super_damage_finished = (time + 3); + self.ammo_rockets = (self.ammo_rockets - 1); + if ((self.ammo_rockets == 10)) + { + sprint (self.real_owner, 2, "Sentry Gun is low on rockets.\n"); + } + } + if (((self.ammo_shells == 0) && (random () < 0.100000))) + { + sprint (self.real_owner, 2, "Sentry Gun is out of shells.\n"); + } + else + { + if ((self.ammo_shells == 20)) + { + sprint (self.real_owner, 2, "Sentry Gun is low on shells.\n"); + } + } + if ((((self.ammo_rockets == 0) && (self.weapon == 3)) && (random () < 0.100000))) + { + sprint (self.real_owner, 2, "Sentry Gun is out of rockets.\n"); + } + return (1); +}; + diff --git a/sniper.pqc b/sniper.pqc new file mode 100644 index 0000000..3df5871 --- /dev/null +++ b/sniper.pqc @@ -0,0 +1,244 @@ +void() AirStrike_Explode; + +void() MushroomFlame = +{ + local entity flame; + flame = spawn(); + flame.owner = self; + flame.movetype = 9; + flame.solid = TF_FLARE_LIT; + flame.classname = "flamerflame"; + flame.effects = 4; + if (self.classname == "airstrike") + { + flame.velocity_x = random() * 1000; + } + flame.velocity_y = random() * 1000; + flame.velocity_z = 200; + flame.think = s_explode1; + flame.nextthink = time + 0.3; + setmodel(flame, "progs/s_explod.spr"); + setsize(flame, '0 0 0', '0 0 0'); + setorigin(flame, self.origin + '0 0 16'); +}; + +void() AirStrike = +{ + sound(self, TF_FLARE_LIT, "weapons/airstrik.wav", TF_FLARE_OFF, TF_FLARE_LIT); + self.think = AirStrike_Explode; + self.nextthink = time + 1.7; +}; + +void() AirStrike_FlyBy = +{ + bprint(TF_FLARE_OFF, "INCOMING AIRSTRIKE!\n"); + sound(self, TF_FLARE_LIT, "weapons/fighter.wav", TF_FLARE_OFF, TF_FLARE_LIT); + self.think = AirStrike; + self.nextthink = time + 5; +}; + +void() AirStrike_Explode = +{ + WriteByte(4, 23); + WriteByte(4, 3); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, TF_FLARE_OFF); + self.classname = "airstrike"; + MushroomFlame(); + MushroomFlame(); + MushroomFlame(); + MushroomFlame(); + WriteByte(4, 23); + WriteByte(4, 10); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, TF_FLARE_OFF); + deathmsg = 43; + T_RadiusDamage(self, self.owner, 300, world); + dremove(self); +}; + +void(vector org) AirStrike_Target = +{ + newmis = spawn(); + newmis.movetype = TF_FLARE_LIT; + newmis.solid = TF_FLARE_LIT; + newmis.team_no = self.owner.team_no; + newmis.owner = self.owner; + setsize(newmis, '0 0 0', '0 0 1'); + setmodel(newmis, "progs/dot3.spr"); + newmis.effects = 8; + setorigin(newmis, org + '0 0 5'); + newmis.nextthink = time + 10 + random() * 10; + newmis.think = AirStrike_FlyBy; +}; + +void() TeamFortress_SniperWeapon = +{ + self.impulse = TF_FLARE_LIT; + if (self.tfstate & 2) + { + return; + } + if (!(self.weapons_carried & 32 && (self.weapons_carried & 64))) + { + return; + } + if (self.ammo_shells < TF_FLARE_OFF) + { + sprint(self, 2, "not enough ammo.\n"); + return; + } + if (self.current_weapon == 32) + { + self.current_weapon = 64; + } + else + { + self.current_weapon = 32; + } + W_SetCurrentAmmo(); +}; + +void(float zoom_level) TF_zoom = +{ + local string zl; + if (self.tfstate & 4096) + { + return; + } + zl = ftos(zoom_level); + stuffcmd(self, "fov "); + stuffcmd(self, zl); + stuffcmd(self, "\n"); +}; + +void () SniperSight_Update = +{ + local vector org; + + self.frame = 0; + if ((!(self.owner.tfstate & 2048) || (self.owner.current_weapon != 32))) + { + self.owner.tfstate = (self.owner.tfstate - (self.owner.tfstate & 2048)); + TeamFortress_SetSpeed (self.owner); + self.owner.heat = 0; + dremove (self); + return; + } + makevectors (self.owner.v_angle); + org = self.owner.origin + (v_forward * 10); + org_z = self.owner.absmin_z + (self.owner.size_z * 0.700000); + traceline (org, (org + (v_forward * 9192)), 0, self); + if ((trace_fraction == 1)) + { + setorigin (self, self.owner.origin); + return; + } + self.angles = vectoangles (v_forward); + setorigin (self, trace_endpos); + if ((self.owner.option == 9)) + { + traceline(self.origin + '0 0 5', self.origin + '0 0 2048', TF_FLARE_LIT, self); + if ((pointcontents (trace_endpos) == -6)) + { + if ((self.owner.last_used > time)) + { + sprint (self.owner, 2, "Reinforcements not in attack position yet... wait 2 minutes\n"); + self.owner.option = 0; + } + else + { + sound (self.owner, 0, "weapons/radioair.wav", 1, 1); + self.owner.last_used = (time + 120); + self.owner.option = 0; + AirStrike_Target(self.origin + '0 0 5'); + } + } + else + { + sprint (self.owner, 2, "Target NOT visible from air!\n"); + if ((self.owner.last_saveme_sound < time)) + { + sound (self.owner, 0, "weapons/notarget.wav", 1, 1); + self.owner.last_saveme_sound = (time + 3); + } + self.owner.option = 0; + } + } + if ((self.owner.option2 == 1)) + { + self.effects = 8; + } + else + { + self.effects = 0; + } + self.nextthink = (time + 0.100000); +}; + +void () SniperSight_Create = +{ + local entity sight; + + self.tfstate = (self.tfstate | 2048); + sight = spawn (); + sight.owner = self; + sight.movetype = 8; + sight.solid = 0; + if ((self.option2 == 1)) + { + sight.effects = 8; + } + if ((self.option4 != 1)) + { + if ((self.team_no == 1)) + { + setmodel (sight, "progs/dot1.spr"); + } + else + { + if ((self.team_no == 3)) + { + setmodel (sight, "progs/dot3.spr"); + } + else + { + if ((self.team_no == 4)) + { + setmodel (sight, "progs/dot4.spr"); + } + else + { + setmodel (sight, "progs/dot2.spr"); + } + } + } + } + sight.classname = "timer"; + setorigin (sight, self.origin); + sight.think = SniperSight_Update; + if ((self.option > 1)) + { + self.option = 1; + } + sight.nextthink = (time + 0.050000); +}; + +void() TeamFortress_AutoZoomToggle = +{ + if (self.tfstate & 4096) + { + self.tfstate = self.tfstate - 4096; + sprint(self, 2, "autozoom ON\n"); + } + else + { + self.tfstate = self.tfstate | 4096; + sprint(self, 2, "autozoom OFF\n"); + } +}; + diff --git a/spy.pqc b/spy.pqc new file mode 100644 index 0000000..07e5dbb --- /dev/null +++ b/spy.pqc @@ -0,0 +1,1274 @@ +// I changed the spy messages to spam less and look more colorful. +// Also fixed is the spy disguise-cancel bug which would allow players +// to keep undercover while shooting. + +void() TeamFortress_SpyGoUndercover; +void (float _p_9330) TeamFortress_SpyFeignDeath; +void(entity spy) TeamFortress_SpyCalcName; +void() TeamFortress_SpyUndercoverThink; +void(float class) TeamFortress_SpyChangeSkin; +void(float teamno) TeamFortress_SpyChangeColor; +void() GasGrenadeMakeGas; +void() HallucinationTimer; +void() W_FireTranq; +void() T_TranqDartTouch; +void() TranquiliserTimer; +void(entity spy) Spy_RemoveDisguise; + +void(entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer; + +void() spy_diea1 = [50, spy_diea2] +{ +}; + +void() spy_diea2 = [51, spy_diea3] +{ +}; + +void() spy_diea3 = [52, spy_diea4] +{ +}; + +void() spy_diea4 = [53, spy_diea5] +{ +}; + +void() spy_diea5 = [54, spy_diea6] +{ +}; + +void() spy_diea6 = [55, spy_diea7] +{ +}; + +void() spy_diea7 = [56, spy_diea8] +{ +}; + +void() spy_diea8 = [57, spy_diea9] +{ +}; + +void() spy_diea9 = [58, spy_diea10] +{ +}; + +void() spy_diea10 = [59, spy_diea11] +{ +}; + +void() spy_diea11 = [60, spy_diea11] +{ +}; + +void() spy_dieb1 = [61, spy_dieb2] +{ +}; + +void() spy_dieb2 = [62, spy_dieb3] +{ +}; + +void() spy_dieb3 = [63, spy_dieb4] +{ +}; + +void() spy_dieb4 = [64, spy_dieb5] +{ +}; + +void() spy_dieb5 = [65, spy_dieb6] +{ +}; + +void() spy_dieb6 = [66, spy_dieb7] +{ +}; + +void() spy_dieb7 = [67, spy_dieb8] +{ +}; + +void() spy_dieb8 = [68, spy_dieb9] +{ +}; + +void() spy_dieb9 = [69, spy_dieb9] +{ +}; + +void() spy_diec1 = [70, spy_diec2] +{ +}; + +void() spy_diec2 = [71, spy_diec3] +{ +}; + +void() spy_diec3 = [72, spy_diec4] +{ +}; + +void() spy_diec4 = [73, spy_diec5] +{ +}; + +void() spy_diec5 = [74, spy_diec6] +{ +}; + +void() spy_diec6 = [75, spy_diec7] +{ +}; + +void() spy_diec7 = [76, spy_diec8] +{ +}; + +void() spy_diec8 = [77, spy_diec9] +{ +}; + +void() spy_diec9 = [78, spy_diec10] +{ +}; + +void() spy_diec10 = [79, spy_diec11] +{ +}; + +void() spy_diec11 = [80, spy_diec12] +{ +}; + +void() spy_diec12 = [81, spy_diec13] +{ +}; + +void() spy_diec13 = [82, spy_diec14] +{ +}; + +void() spy_diec14 = [83, spy_diec15] +{ +}; + +void() spy_diec15 = [84, spy_diec15] +{ +}; + +void() spy_died1 = [85, spy_died2] +{ +}; + +void() spy_died2 = [86, spy_died3] +{ +}; + +void() spy_died3 = [87, spy_died4] +{ +}; + +void() spy_died4 = [88, spy_died5] +{ +}; + +void() spy_died5 = [89, spy_died6] +{ +}; + +void() spy_died6 = [90, spy_died7] +{ +}; + +void() spy_died7 = [91, spy_died8] +{ +}; + +void() spy_died8 = [92, spy_died9] +{ +}; + +void() spy_died9 = [93, spy_died9] +{ +}; + +void() spy_diee1 = [94, spy_diee2] +{ +}; + +void() spy_diee2 = [95, spy_diee3] +{ +}; + +void() spy_diee3 = [96, spy_diee4] +{ +}; + +void() spy_diee4 = [97, spy_diee5] +{ +}; + +void() spy_diee5 = [98, spy_diee6] +{ +}; + +void() spy_diee6 = [99, spy_diee7] +{ +}; + +void() spy_diee7 = [100, spy_diee8] +{ +}; + +void() spy_diee8 = [101, spy_diee9] +{ +}; + +void() spy_diee9 = [102, spy_diee9] +{ +}; + +void() spy_die_ax1 = [41, spy_die_ax2] +{ +}; + +void() spy_die_ax2 = [42, spy_die_ax3] +{ +}; + +void() spy_die_ax3 = [43, spy_die_ax4] +{ +}; + +void() spy_die_ax4 = [44, spy_die_ax5] +{ +}; + +void() spy_die_ax5 = [45, spy_die_ax6] +{ +}; + +void() spy_die_ax6 = [46, spy_die_ax7] +{ +}; + +void() spy_die_ax7 = [47, spy_die_ax8] +{ +}; + +void() spy_die_ax8 = [48, spy_die_ax9] +{ +}; + +void() spy_die_ax9 = [49, spy_die_ax9] +{ +}; + +void() spy_upb1 = [69, spy_upb2] +{ +}; + +void() spy_upb2 = [68, spy_upb3] +{ +}; + +void() spy_upb3 = [67, spy_upb4] +{ +}; + +void() spy_upb4 = [66, spy_upb5] +{ +}; + +void() spy_upb5 = [65, spy_upb6] +{ +}; + +void() spy_upb6 = [64, spy_upb7] +{ +}; + +void() spy_upb7 = [63, spy_upb8] +{ +}; + +void() spy_upb8 = [62, spy_upb9] +{ +}; + +void() spy_upb9 = [61, spy_upb9] +{ + player_stand1(); +}; + +void() spy_upc1 = [84, spy_upc2] +{ +}; + +void() spy_upc2 = [83, spy_upc3] +{ +}; + +void() spy_upc3 = [82, spy_upc4] +{ +}; + +void() spy_upc4 = [81, spy_upc5] +{ +}; + +void() spy_upc5 = [80, spy_upc6] +{ +}; + +void() spy_upc6 = [79, spy_upc7] +{ +}; + +void() spy_upc7 = [78, spy_upc8] +{ +}; + +void() spy_upc8 = [77, spy_upc9] +{ +}; + +void() spy_upc9 = [76, spy_upc10] +{ +}; + +void() spy_upc10 = [75, spy_upc11] +{ +}; + +void() spy_upc11 = [74, spy_upc12] +{ +}; + +void() spy_upc12 = [73, spy_upc13] +{ +}; + +void() spy_upc13 = [72, spy_upc14] +{ +}; + +void() spy_upc14 = [71, spy_upc15] +{ +}; + +void() spy_upc15 = [70, spy_upc15] +{ + player_stand1(); +}; + +void() spy_upd1 = [93, spy_upd2] +{ +}; + +void() spy_upd2 = [92, spy_upd3] +{ +}; + +void() spy_upd3 = [91, spy_upd4] +{ +}; + +void() spy_upd4 = [90, spy_upd5] +{ +}; + +void() spy_upd5 = [89, spy_upd6] +{ +}; + +void() spy_upd6 = [88, spy_upd7] +{ +}; + +void() spy_upd7 = [87, spy_upd8] +{ +}; + +void() spy_upd8 = [86, spy_upd9] +{ +}; + +void() spy_upd9 = [85, spy_upd9] +{ + player_stand1(); +}; + +void() spy_upe1 = [94, spy_upe9] +{ +}; + +void() spy_upe2 = [95, spy_upe8] +{ +}; + +void() spy_upe3 = [96, spy_upe7] +{ +}; + +void() spy_upe4 = [97, spy_upe6] +{ +}; + +void() spy_upe5 = [98, spy_upe5] +{ +}; + +void() spy_upe6 = [99, spy_upe4] +{ +}; + +void() spy_upe7 = [100, spy_upe3] +{ +}; + +void() spy_upe8 = [101, spy_upe2] +{ +}; + +void() spy_upe9 = [102, spy_upe1] +{ + player_stand1(); +}; + +void() spy_upaxe1 = [49, spy_upaxe2] +{ +}; + +void() spy_upaxe2 = [48, spy_upaxe3] +{ +}; + +void() spy_upaxe3 = [47, spy_upaxe4] +{ +}; + +void() spy_upaxe4 = [46, spy_upaxe5] +{ +}; + +void() spy_upaxe5 = [45, spy_upaxe6] +{ +}; + +void() spy_upaxe6 = [44, spy_upaxe7] +{ +}; + +void() spy_upaxe7 = [43, spy_upaxe8] +{ +}; + +void() spy_upaxe8 = [42, spy_upaxe9] +{ +}; + +void() spy_upaxe9 = [41, spy_upaxe9] +{ + player_stand1(); +}; + +// begin new spy code + +void (float _p_9330) TeamFortress_SpyFeignDeath = +{ + local float _l_9331; + local entity _l_9332; + local entity te; + + if ((self.bugger == 8)) + { + return; + } + if (self.hook_out) + { + return; + } + if (self.is_feigning) + { + _l_9332 = findradius (self.origin, 48); + _l_9331 = 1; + while ((_l_9332 != world)) + { + if ((((_l_9332.classname == "player") && (_l_9332.deadflag == 0)) && (self != _l_9332))) + { + _l_9331 = 0; + } + _l_9332 = _l_9332.chain; + } + if ((_l_9331 == 1)) + { + _l_9331 = 1 + floor ((random () * 5)); + self.velocity = '0 0 0'; + unlay (); + self.view_ofs = '0 0 22'; + self.movetype = 3; + self.is_feigning = 0; + self.current_weapon = self.weapon; + W_SetCurrentAmmo (); + self.tfstate = (self.tfstate - (self.tfstate & 65536)); + TeamFortress_SetSpeed (self); + if ((self.weapon <= 16)) + { + spy_upaxe1 (); + return; + } + if ((_l_9331 == 1)) + { + spy_upb1 (); + } + else + { + if ((_l_9331 == 2)) + { + spy_upc1 (); + } + else + { + if ((_l_9331 == 3)) + { + spy_upd1 (); + } + else + { + spy_upe1 (); + } + } + } + } + else + { + sprint (self, 2, "You can't get up while someone is standing on you.\n"); + } + } + else + { + if ((!(self.flags & 512) && (self.waterlevel == 0))) + { + sprint (self, 2, "You can't feign in the air.\n"); + return; + } + _l_9332 = findradius (self.origin, 64); + while ((_l_9332 != world)) + { + if ((((_l_9332.classname == "player") && (self != _l_9332)) && (_l_9332.is_feigning == 1))) + { + sprint (self, 2, "You can't feign on top of another spy!\n"); + return; + } + _l_9332 = _l_9332.chain; + } + self.immune_to_check = (time + 5); + self.tfstate = (self.tfstate | 65536); + self.velocity = (self.velocity * 0.650000); + self.is_feigning = 1; + Attack_Finished (0.800000); + if (self.hook_out) + { + Reset_Grapple (self.hook); + Attack_Finished (0.750000); + self.hook_out = 1; + } + if (((self.undercover_team == 0) && (self.undercover_skin == 0))) + { + self.items = (self.items - (self.items & 524288)); + } + TeamFortress_ThrowGrenade (); + self.invisible_finished = 0; + self.modelindex = modelindex_player; + self.weapon = self.current_weapon; + self.current_weapon = 0; + self.weaponmodel = ""; + self.weaponframe = 0; + self.maxspeed = 0; + self.movetype = 6; + setsize (self, '-16 -16 -24', '16 16 4'); + self.view_ofs = '0 0 -8'; + if ((_p_9330 == 0)) + { + DeathSound (); + } + self.angles_x = 0; + self.angles_z = 0; + if ((self.weapon <= 16)) + { + spy_die_ax1 (); + return; + } + te = find (world, classname, "item_tfgoal"); + while (te) { + if (te.owner == self) { + if (!(te.goal_activation & 256) || (self.has_disconnected == 1)) { + tfgoalitem_RemoveFromPlayer (te, self, 0); + } + if (CTF_Map == 1) { + if (te.goal_no == 1) + bprint (2, self.netname, " ÌÏÓÔ the ÂÌÕÅ flag!\n"); + else if (te.goal_no == 2) + bprint (2, self.netname, " ÌÏÓÔ the ÒÅÄ flag!\n"); + } + } + te = find (te, classname, "item_tfgoal"); + } + _l_9331 = 1 + floor ((random () * 6)); + if ((_l_9331 == 1)) + { + spy_diea1 (); + } + else + { + if ((_l_9331 == 2)) + { + spy_dieb1 (); + } + else + { + if ((_l_9331 == 3)) + { + spy_diec1 (); + } + else + { + if ((_l_9331 == 4)) + { + spy_died1 (); + } + else + { + spy_diee1 (); + } + } + } + } + } +}; + + +// end new spy code + +void() TeamFortress_SpyGoUndercover = +{ + local entity te; + if (self.effects & (8 | 4)) + { + sprint(self, 1, "You cannot disguise while glowing.\n"); + return; + } + if (invis_only == 1) + { + if (self.is_undercover == 1) + { + self.is_undercover = 0; + self.modelindex = modelindex_player; + self.items = self.items - (self.items & 524288); + } + else + { + if (self.is_undercover == 2) + { +// There's no need for this function; MegaTF undercover is instant. +// sprint(self, 2, "You stop going undercover.\n"); +// self.is_undercover = 0; + return; + } + else + { + if (self.ammo_cells > 1) + { +// No need for this message either. +// sprint(self, 2, "Going undercover...\n"); + self.is_undercover = 2; + te = spawn(); + te.classname = "timer"; + te.owner = self; + te.think = TeamFortress_SpyUndercoverThink; + te.nextthink = time + 0; + } + } + } + self.StatusRefreshTime = time + 0.1; + } + else + { + if (self.is_undercover != 2) + { + self.current_menu = 12; + self.menu_count = 25; + } + else + { +// There's no need for this function; MegaTF undercover is instant. +// sprint(self, 2, "You stop going undercover.\n"); +// self.is_undercover = 0; + return; + } + } +}; + +void(entity spy) TeamFortress_SpyCalcName = +{ + local entity te; + spy.undercover_name = string_null; + if (spy.undercover_team != 0) + { + te = find(world, classname, "player"); + while (te) + { + if (te.team_no == spy.undercover_team && te.skin == spy.undercover_skin) + { + spy.undercover_name = te.netname; + te = world; + } + else + { + te = find(te, classname, "player"); + } + } + if (spy.undercover_name == string_null) + { + te = find(world, classname, "player"); + while (te) + { + if (te.team_no == spy.undercover_team) + { + spy.undercover_name = te.netname; + te = world; + } + else + { + te = find(te, classname, "player"); + } + } + } + } +}; + +void() TeamFortress_SpyUndercoverThink = +{ + local float tc; + local string st; + if (self.owner.playerclass != 8) + { + return; + } + if (self.owner.is_undercover == 2) + { +// sprint(self.owner, 2, "You Are Disguised\n"); + if (infokey(world, "spymsgs") == "1") + { + sprint(self.owner, 2, "Ùïõ áòå äéóçõéóåä\n"); + } + if (invis_only == 1) + { + self.owner.items = self.owner.items | 524288; + self.owner.frame = 0; + self.owner.modelindex = modelindex_eyes; + self.owner.is_undercover = 1; + } + else + { + self.owner.immune_to_check = time + 20; + if (self.skin != 0) + { +// sprint(self.owner, 2, "Skin set to "); + sprint(self.owner, 2, "Óëéî óåô ôï "); + TeamFortress_PrintClassName(self.owner, self.skin, 0, 2); + self.owner.undercover_skin = self.skin; + TeamFortress_SetSkin(self.owner); + } + if (self.team != 0) + { + self.owner.immune_to_check = time + 10; +// sprint(self.owner, 2, "Colors set to Team "); + sprint(self.owner, 2, "Ãïìïòó óåô ôï Ôåáí "); + st = ftos(self.team); + sprint(self.owner, 2, st); + sprint(self.owner, 2, "‘\n"); + self.owner.undercover_team = self.team; + stuffcmd(self.owner, "color "); + tc = TeamFortress_TeamGetColor(self.team) - 1; + st = ftos(tc); + stuffcmd(self.owner, st); + stuffcmd(self.owner, "\n"); + } + TeamFortress_SpyCalcName(self.owner); + if (self.owner.StatusBarSize == 0) + { + CenterPrint(self.owner, "You are now disguised.\n"); + } + self.owner.is_undercover = 1; + } + } + self.owner.StatusRefreshTime = time + 0.1; + dremove(self); +}; + +void(float class) TeamFortress_SpyChangeSkin = +{ + local entity te; + if (class == 8) + { +// sprint(self, 2, "Skin reset.\n"); + sprint(self, 2, "Óëéî òåóåô®\n"); + self.undercover_skin = 0; + TeamFortress_SetSkin(self); + if (self.undercover_team == 0) + { + self.items = self.items - (self.items & 524288); + self.is_undercover = 0; + } + return; + } +// No need for this message +// sprint(self, 2, "Going undercover...\n"); + self.is_undercover = 2; + te = spawn(); + te.classname = "timer"; + te.owner = self; + te.think = TeamFortress_SpyUndercoverThink; + te.nextthink = time + 0; + te.skin = class; + TeamFortress_SetSkin(self); +}; + +void(float teamno) TeamFortress_SpyChangeColor = +{ + local entity te; + local string st; + local float tc; + + // pablo. spy bug fix. + if (self.is_undercover && (self.undercover_team == teamno) ) + return; + // + + if (teamno == self.team_no) + { +// sprint(self, 2, "Colors reset.\n"); + sprint(self, 2, "Ãïìïòó òåóåô®\n"); + self.immune_to_check = time + 15; + self.undercover_team = 0; + stuffcmd(self, "color "); + tc = TeamFortress_TeamGetColor(self.team_no) - 1; + st = ftos(tc); + stuffcmd(self, st); + stuffcmd(self, "\n"); + if (self.undercover_skin == 0) + { + self.items = self.items - (self.items & 524288); + self.is_undercover = 0; + } + return; + } +// No need for this message +// sprint(self, 2, "Going undercover...\n"); + self.is_undercover = 2; + te = spawn(); + te.classname = "timer"; + te.owner = self; + te.think = TeamFortress_SpyUndercoverThink; + te.nextthink = time + 0; + te.team = teamno; +}; + +void() GasGrenadeTouch = +{ + sound(self, 1, "weapons/bounce.wav", 1, 1); + if (self.velocity == '0 0 0') + { + self.avelocity = '0 0 0'; + } +}; + +void() GasGrenadeExplode = +{ + local entity te; + local float pos; + pos = pointcontents(self.origin); + if (pos == -1) + { + te = spawn(); + te.think = GasGrenadeMakeGas; + te.nextthink = time + 0.1; + te.heat = 0; + te.origin = self.origin; + te.owner = self.owner; + te.team_no = self.owner.team_no; + te.weapon = 0; + } + else + { + pos = 0; + while (pos < 10) + { + newmis = spawn(); + setmodel(newmis, "progs/s_bubble.spr"); + setorigin(newmis, self.origin); + newmis.movetype = 8; + newmis.solid = 0; + newmis.velocity = '0 0 15'; + newmis.velocity_z = 10 + random() * 20; + newmis.nextthink = time + 0.5; + newmis.think = bubble_bob; + newmis.classname = "bubble"; + newmis.frame = 0; + newmis.cnt = 0; + setsize(newmis, '-8 -8 -8', '8 8 8'); + pos = pos + 1; + } + } + BecomeExplosion(); + dremove(self); +}; + +void () GasGrenadeMakeGas = +{ + local entity _l_9407; + local entity _l_9408; + local entity _l_9409; + + self.nextthink = (time + 0.750000); + _l_9407 = findradius (self.origin, 200); + while ((_l_9407 != world)) + { + if ((((_l_9407.team_no == self.owner.team_no) && (_l_9407.last_used < time)) && (_l_9407.classname == "player"))) + { + sound (_l_9407, 4, "player/gas_mask.wav", 1, 1); + _l_9407.last_used = (time + 2); + } + if (!(_l_9407.items & 2097152)) + { + if (((((_l_9407.classname == "player") && (_l_9407.deadflag == 0)) && (_l_9407.team_no != self.owner.team_no)) && (_l_9407.bugger == 0))) + { + deathmsg = 24; + TF_T_Damage (_l_9407, world, self.owner, 10, 2, 0); + if ((_l_9407.tfstate & 16384)) + { + _l_9409 = find (world, classname, "timer"); + while ((((_l_9409.owner != _l_9407) || (_l_9409.think != HallucinationTimer)) && (_l_9409 != world))) + { + _l_9409 = find (_l_9409, classname, "timer"); + } + if ((_l_9409 != world)) + { + _l_9409.health = (_l_9409.health + 25); + if ((_l_9409.health < 100)) + { + _l_9409.health = 100; + } + _l_9409.nextthink = (time + 0.500000); + } + } + else + { + sprint (_l_9407, 2, "Far out man!\n"); + _l_9408 = find (world, classname, "timer"); + while ((((_l_9408.owner != _l_9407) || (_l_9408.think != ConcussionGrenadeTimer)) && (_l_9408 != world))) + { + _l_9408 = find (_l_9408, classname, "timer"); + } + if ((_l_9408 == world)) + { + stuffcmd (_l_9407, "v_idlescale 10\n"); + } + _l_9407.tfstate = (_l_9407.tfstate | 16384); + _l_9409 = spawn (); + _l_9409.nextthink = (time + 0.500000); + _l_9409.think = HallucinationTimer; + _l_9409.classname = "timer"; + _l_9409.owner = _l_9407; + _l_9409.health = 100; + _l_9409.team_no = self.team_no; + } + } + } + _l_9407 = _l_9407.chain; + } + self.heat = (self.heat + 1); + if ((self.heat == 1)) + { + WriteByte (4, 23); + WriteByte (4, 4); + WriteCoord (4, self.origin_x); + WriteCoord (4, self.origin_y); + WriteCoord (4, self.origin_z); + multicast (self.origin, 2); + return; + } + if ((self.heat <= 20)) + { + self.weapon = (self.weapon + 1); + if ((self.weapon == 1)) + { + WriteByte (4, 23); + WriteByte (4, 10); + WriteCoord (4, self.origin_x); + WriteCoord (4, self.origin_y); + WriteCoord (4, (self.origin_z - 24)); + multicast (self.origin, 2); + sound (self, 0, "misc/vapeur2.wav", 1, 1); + } + else + { + if ((self.weapon == 2)) + { + self.weapon = 0; + } + } + return; + } + self.owner.active_grenades_2 = (self.owner.active_grenades_2 - 1); + dremove (self); +}; + +void () HallucinationTimer = +{ + local entity _l_9418; + local entity _l_9419; + local float _l_9420; + local float _l_9421; + local float _l_9422; + + self.health = (self.health - 2.500000); + if ((self.owner.playerclass == 5)) + { + self.health = (self.health - 2.500000); + } + if ((self.health <= 0)) + { + self.owner.tfstate = (self.owner.tfstate - (self.owner.tfstate & 16384)); + } + if (!(self.owner.tfstate & 16384)) + { + sprint (self.owner, 2, "You're sobering up now.\n"); + stuffcmd (self.owner, "v_idlescale 0\n"); + dremove (self); + return; + } + _l_9419 = find (world, classname, "timer"); + while ((((_l_9419.owner != self.owner) || (_l_9419.think != ConcussionGrenadeTimer)) && (_l_9419 != world))) + { + _l_9419 = find (_l_9419, classname, "timer"); + } + if ((_l_9419 == world)) + { + stuffcmd (self.owner, "v_idlescale 10\n"); + } + self.nextthink = (time + 0.500000); + if ((random () < 0.500000)) + { + KickPlayer (-10, self.owner); + } + _l_9420 = (random () * 800) - 400; + _l_9421 = (random () * 800) - 400; + _l_9422 = random (); + msg_entity = self.owner; + if ((_l_9422 < 0.400000)) + { + WriteByte (1, 23); + if ((_l_9422 < 0.500000)) + { + WriteByte (1, 3); + } + else + { + if ((_l_9422 < 0.550000)) + { + WriteByte (1, 4); + } + else + { + WriteByte (1, 10); + } + } + WriteCoord (1, (msg_entity.origin_x + _l_9420)); + WriteCoord (1, (msg_entity.origin_y + _l_9421)); + WriteCoord (1, msg_entity.origin_z); + } + else + { + if ((_l_9422 < 0.700000)) + { + WriteByte (1, 23); + WriteByte (1, 11); + WriteCoord (1, (msg_entity.origin_x + _l_9420)); + WriteCoord (1, (msg_entity.origin_y + _l_9421)); + WriteCoord (1, msg_entity.origin_z); + } + else + { + _l_9418 = spawn (); + _l_9418.origin_x = (msg_entity.origin_x + _l_9420); + _l_9418.origin_y = (msg_entity.origin_y + _l_9421); + _l_9418.origin_z = msg_entity.origin_z; + WriteByte (1, 23); + WriteByte (1, 6); + WriteEntity (1, _l_9418); + WriteCoord (1, _l_9418.origin_x); + WriteCoord (1, _l_9418.origin_y); + WriteCoord (1, _l_9418.origin_z); + _l_9420 = (random () * 800) - 400; + _l_9421 = (random () * 800) - 400; + WriteCoord (1, (msg_entity.origin_x + _l_9420)); + WriteCoord (1, (msg_entity.origin_y + _l_9421)); + WriteCoord (1, msg_entity.origin_z); + dremove (_l_9418); + } + } +}; + +void() W_FireTranq = +{ + local vector dir; + self.currentammo = self.ammo_shells = self.ammo_shells - 1; + KickPlayer(-1, self); + dir = aim(self, 1000); + newmis = spawn(); + newmis.owner = self; + newmis.movetype = 9; + newmis.solid = 2; + newmis.angles = vectoangles(dir); + newmis.touch = T_TranqDartTouch; + newmis.classname = "spike"; + newmis.think = SUB_Remove; + newmis.nextthink = time + 3; + setmodel(newmis, "progs/spike.mdl"); + setsize(newmis, '0 0 0', '0 0 0'); + setorigin(newmis, self.origin + '0 0 16'); + newmis.velocity = dir * 2000; +}; + +void() T_TranqDartTouch = +{ + local entity timer; + if (other.solid == 1) + { + return; + } + if (pointcontents(self.origin) == -6) + { + dremove(self); + return; + } + if (other.takedamage) + { + spawn_touchblood(9); + deathmsg = 25; + TF_T_Damage(other, self, self.owner, 20, 2, 2); + if (other.classname == "player" && other.team_no != self.owner.team_no) + { + if (other.tfstate & 32768) + { + timer = find(world, classname, "timer"); + while (timer.owner != other || timer.think != TranquiliserTimer && timer != world) + { + timer = find(timer, classname, "timer"); + } + if (timer != world) + { + timer.nextthink = time + 15; + } + } + else + { + sprint(other, 2, "You're getting sleepy...\n"); + stuffcmd(other, "v_cshift 125 0 255 100\n"); + other.tfstate = other.tfstate | 32768; + timer = spawn(); + timer.nextthink = time + 15; + timer.think = TranquiliserTimer; + timer.classname = "timer"; + timer.owner = other; + timer.team_no = self.owner.team_no; + TeamFortress_SetSpeed(other); + } + } + } + else + { + WriteByte(4, 23); + if (self.classname == "wizspike") + { + WriteByte(4, 7); + } + else + { + if (self.classname == "knightspike") + { + WriteByte(4, 8); + } + else + { + WriteByte(4, 0); + } + } + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, 2); + } + dremove(self); +}; + +void() TranquiliserTimer = +{ + self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & 32768); + TeamFortress_SetSpeed(self.owner); + stuffcmd(self.owner, "v_cshift 0 0 0 0\n"); + sprint(self.owner, 2, "You feel more alert now\n"); + dremove(self); +}; + +void(entity spy) Spy_RemoveDisguise = +{ + local string st; + local float tc; + if (invis_only != 1) + { + if (spy.playerclass == 8) + { + if (spy.undercover_skin != 0) + { + spy.items = spy.items - (spy.items & 524288); + spy.immune_to_check = time + 10; + spy.undercover_skin = 0; + spy.skin = 0; + TeamFortress_SetSkin(spy); + } + if (spy.undercover_team != 0) + { + spy.items = spy.items - (spy.items & 524288); + spy.immune_to_check = time + 10; + spy.undercover_team = 0; + stuffcmd(spy, "color "); + tc = TeamFortress_TeamGetColor(spy.team_no) - 1; + st = ftos(tc); + stuffcmd(spy, st); + stuffcmd(spy, "\n"); + } + spy.is_undercover = 0; + self.StatusRefreshTime = time + 0.1; + TeamFortress_SpyCalcName(spy); + } + } + else + { + if (spy.is_undercover) + { + spy.is_undercover = 0; + spy.modelindex = modelindex_player; + if (spy.items & 524288) + { + spy.items = spy.items - 524288; + } + self.StatusRefreshTime = time + 0.1; + } + } +}; + diff --git a/status.pqc b/status.pqc new file mode 100644 index 0000000..64a7c2d --- /dev/null +++ b/status.pqc @@ -0,0 +1,2130 @@ +float(float tno) TeamFortress_TeamGetScore; +float() TeamFortress_TeamGetWinner; +float() TeamFortress_TeamGetSecond; + +string (entity pl) GetStatusSize; +string (entity pl) DetpackTimeToString; +string (entity pl) ClipSize; +string (entity pl) DisguiseString; +string (entity pl) SentryDetails; +string (entity pl) SentryHealth; + +void (entity pl, string s1) CenterPrint = +{ + centerprint (pl, s1); + pl.StatusRefreshTime = time + 1.5; +}; + +void (entity _p_3723, string _p_3724, string _p_3725) CenterPrint2 = +{ + + centerprint (_p_3723, _p_3724, "\n", _p_3725); + _p_3723.StatusRefreshTime = (time + 1.5); +}; + +void (entity _p_3729, float _p_3730, string _p_3731) StatusPrint = +{ + + centerprint (_p_3729, _p_3731); + _p_3729.StatusRefreshTime = (time + _p_3730); +}; + +void (entity pl) RefreshStatusBar = +{ + local string status_size, misc, clip_print; + local entity playerent; + local float t1_pl, t2_pl, t3_pl, t4_pl, no_teams; + local string t1name, t2name, t3name, t4name; + local string t1score, t2score, t3score, t4score; + local string t1full, t2full, t3full, t4full, t12full, t34full; + local string st, print_scores, gren1, gren2, gren_print; + local string spacer, dpacktime; + + if (pl.StatusBarSize == 0) { + pl.StatusRefreshTime = time + 60; + return; + } + pl.StatusRefreshTime = time + 1.5; + + if (pl.playerclass == 0) //PC_UNDEFINED doesn't exist in mega + return; + + no_teams = 0; + t1_pl = TeamFortress_TeamGetNoPlayers (1); + t2_pl = TeamFortress_TeamGetNoPlayers (2); + t3_pl = TeamFortress_TeamGetNoPlayers (3); + t4_pl = TeamFortress_TeamGetNoPlayers (4); + + if (t1_pl > 0) { + no_teams = no_teams + 1; + t1name = "\sBlue\s: "; + st = ftos(team1score); + t1score = substring(st, 0, 4); + } + if (t2_pl > 0) { + no_teams = no_teams + 1; + t2name = "\sRed\s: "; + if (t1_pl > 0) + t2name = " \sRed\s: "; + st = ftos(team2score); + t2score = substring(st, 0, 4); + } + if (t3_pl > 0) { + no_teams = no_teams + 1; + t3name = "\sYell\s: "; + if ( (t1_pl > 0) || (t2_pl > 0) ) + t3name = " \sYell\s: "; + st = ftos(team3score); + t3score = substring(st, 0, 4); + } + if (t4_pl > 0) { + no_teams = no_teams + 1; + t4name = "\sGrn\s: "; + if ( (t1_pl > 0) || (t2_pl > 0) || (t3_pl > 0) ) + t4name = " \sGrn\s: "; + st = ftos(team4score); + t4score = substring(st, 0, 4); + } + + t1full = strcat(t1name,t1score); + t2full = strcat(t2name,t2score); + t3full = strcat(t3name,t3score); + t4full = strcat(t4name,t4score); + + t12full = strcat(t1full,t2full); + t34full = strcat(t3full,t4full); + print_scores = strcat(t12full,t34full); + + + gren1 = strcat(" \sG\s: ", ftos (self.no_grenades_1)); + gren2 = strcat("/", ftos (self.no_grenades_2)); + gren_print = strcat(gren1, gren2); + + status_size = GetStatusSize (pl); + clip_print = ClipSize (pl); + misc = "\n"; + + if (pl.playerclass == 8) { + local string disguise_state; + disguise_state = DisguiseString (pl); + + centerprint (pl, status_size, disguise_state, print_scores, clip_print, gren_print); + return; + } + else if (pl.playerclass == 9) { + if (self.has_sentry) { + local string sentry_health, sentry_details; + sentry_health = SentryHealth (pl); + sentry_details = SentryDetails (pl); + + centerprint (pl, status_size, sentry_health, sentry_details, print_scores, clip_print, gren_print); + return; + } + else if (self.is_building) { + misc = "\nBuilding..\n"; + } + } + else if ((pl.playerclass == 4)) { + if (self.is_detpacking) + dpacktime = " setting ÄÅÔÐÁÃË \n"; + else { + playerent = find (world, classname, "countdown_timer"); + while (playerent) + { + if ((playerent.owner == pl)) { + dpacktime = DetpackTimeToString (playerent); + spacer = " "; + centerprint (pl, status_size, spacer, dpacktime, print_scores, clip_print, gren_print); + return; + } + playerent = find (playerent, classname, "countdown_timer"); + } + } + } + + centerprint (pl, status_size, misc, print_scores, clip_print, gren_print); +}; + +string (entity pl) GetStatusSize = +{ + if (pl.StatusBarSize == 1) { + if (pl.StatusBarRes > 7) // 768 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 7) // 600 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 6) // 480 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 5) // 400 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 4) // 384 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 3) // 350 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 2) // 300 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 1) // 240 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + + return ("\n\n\n\n\n\n\n\n\n\n\n"); // 200 + } + else /* if (pl.StatusBarSize == 2) */ { + if (pl.StatusBarRes > 7) // 768 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 7) // 600 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 6) // 480 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 5) // 400 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 4) // 384 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 3) // 350 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 2) // 300 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + else if (pl.StatusBarRes == 1) // 240 + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); + return ("\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); // 200 + } +}; + +void (float res) StatusRes = +{ + self.StatusBarRes = res; + if (res > 7) + sprint (self, 2, "Status Bar Res set to 1024x768.\n"); + else if (res == 7) + sprint (self, 2, "Status Bar Res set to 800x600.\n"); + else if (res == 6) + sprint (self, 2, "Status Bar Res set to 640x480.\n"); + else if (res == 5) + sprint (self, 2, "Status Bar Res set to 640x400.\n"); + else if (res == 4) + sprint (self, 2, "Status Bar Res set to 512x384.\n"); + else if (res == 3) + sprint (self, 2, "Status Bar Res set to 320x350.\n"); + else if (res == 2) + sprint (self, 2, "Status Bar Res set to 400x300.\n"); + else if (res == 1) + sprint (self, 2, "Status Bar Res set to 320x240.\n"); + else + sprint (self, 2, "Status Bar Res set to 320x200.\n"); +}; + +string (entity pl) ClipSize = +{ + local float clip; + local string clip_print; + + if (pl.current_weapon == 128) { + if ((8 - pl.reload_shotgun) > pl.ammo_shells) + pl.reload_shotgun = 8 - pl.ammo_shells; + clip = 8 - pl.reload_shotgun; + clip_print = strcat (" \sClip\s: ", ftos(clip)); + } + else if (pl.current_weapon == 256) { + if ((16 - pl.reload_super_shotgun) > pl.ammo_shells) + pl.reload_super_shotgun = 16 - pl.ammo_shells; + clip = (16 - pl.reload_super_shotgun); + clip_print = strcat (" \sClip\s: ", ftos(clip)); + } + else if (pl.current_weapon == 2048) { + if ((6 - pl.reload_grenade_launcher) > pl.ammo_rockets) + pl.reload_grenade_launcher = (6 - pl.ammo_rockets); + clip = (6 - pl.reload_grenade_launcher); + clip_print = strcat (" \sClip\s: ", ftos(clip)); + } + else if (pl.current_weapon == 8192) { + if ((4 - pl.reload_rocket_launcher) > pl.ammo_rockets) + pl.reload_rocket_launcher = (4 - pl.ammo_rockets); + clip = (4 - pl.reload_rocket_launcher); + clip_print = strcat (" \sClip\s: ", ftos(clip)); + } + + return (clip_print); +}; + +string (entity pl) DisguiseString = +{ + local string under_team, under_class, disguise_print; + + if (pl.undercover_team == 1) + under_team = "Blue"; + if (pl.undercover_team == 2) + under_team = "Red"; + if (pl.undercover_team == 3) + under_team = "Yell"; + if (pl.undercover_team == 4) + under_team = "Grn"; + + if (!pl.undercover_skin) { + under_class = ("\n"); + } else if (pl.undercover_skin == 1) { + under_class = (" Scout\n"); + } else if (pl.undercover_skin == 2) { + under_class = (" Sniper\n"); + } else if (pl.undercover_skin == 3) { + under_class = (" Soldier\n"); + } else if (pl.undercover_skin == 4) { + under_class = (" Demoman\n"); + } else if (pl.undercover_skin == 5) { + under_class = (" Medic\n"); + } else if (pl.undercover_skin == 6) { + under_class = (" Hvy Wpns\n"); + } else if (pl.undercover_skin == 7) { + under_class = (" Pyro\n"); + } else if (pl.undercover_skin == 8) { + under_class = (" Spy\n"); + } else + under_class = (" Engineer\n"); + + if (pl.is_undercover == 0) + under_class = ("Not undercover\n"); + if (pl.is_undercover == 2) { + under_class = (" Going undercover..\n"); + } + if (invis_only) + under_class = ("Undercover\n"); + + disguise_print = strcat(under_team, under_class); + return (disguise_print); +}; + +string (entity pl) SentryDetails = +{ + local entity te; + + te = find (world, classname, "building_sentrygun"); + while (te) { + if (te.real_owner == self) { + if (te.ammo_shells == 0) { + if ((te.ammo_rockets == 0) && (te.weapon == 3)) + return (" no ammo\n"); + else + return (" no shells\n"); + } + else if ((te.ammo_rockets == 0) && (te.weapon == 3)) + return (" no rockets\n"); + else + return ("\n"); + } + te = find (te, classname, "building_sentrygun"); + } + return ("\n"); +}; + +string (entity pl) SentryHealth = +{ + local entity te; + local string sg_print; + local float st; + + te = find (world, classname, "building_sentrygun"); + while (te) { + if (te.real_owner == self) { + st = rint (te.health); + sg_print = strcat("SENTRY: ", ftos(st)); + return(sg_print); + } + te = find (te, classname, "building_sentrygun"); + } + return ("SENTRY: 0 health"); // Why is this needed? +}; + +string (entity pl) DetpackTimeToString = +{ + local float _l_5357; + + _l_5357 = pl.health + 1; + if ((_l_5357 == 0)) + { + return ("ÄÅÔÐÁÃË: 0 \n"); + } + else + { + if ((_l_5357 == 1)) + { + return ("ÄÅÔÐÁÃË: 1s \n"); + } + else + { + if ((_l_5357 == 2)) + { + return ("ÄÅÔÐÁÃË: 2s \n"); + } + else + { + if ((_l_5357 == 3)) + { + return ("ÄÅÔÐÁÃË: 3s \n"); + } + else + { + if ((_l_5357 == 4)) + { + return ("ÄÅÔÐÁÃË: 4s \n"); + } + else + { + if ((_l_5357 == 5)) + { + return ("ÄÅÔÐÁÃË: 5s \n"); + } + else + { + if ((_l_5357 == 6)) + { + return ("ÄÅÔÐÁÃË: 6s \n"); + } + else + { + if ((_l_5357 == 7)) + { + return ("ÄÅÔÐÁÃË: 7s \n"); + } + else + { + if ((_l_5357 == 8)) + { + return ("ÄÅÔÐÁÃË: 8s \n"); + } + else + { + if ((_l_5357 == 9)) + { + return ("ÄÅÔÐÁÃË: 9s \n"); + } + else + { + if ((_l_5357 == 10)) + { + return ("ÄÅÔÐÁÃË: 10s \n"); + } + else + { + if ((_l_5357 == 11)) + { + return ("ÄÅÔÐÁÃË: 11s \n"); + } + else + { + if ((_l_5357 == 12)) + { + return ("ÄÅÔÐÁÃË: 12s \n"); + } + else + { + if ((_l_5357 == 13)) + { + return ("ÄÅÔÐÁÃË: 13s \n"); + } + else + { + if ((_l_5357 == 14)) + { + return ("ÄÅÔÐÁÃË: 14s \n"); + } + else + { + if ((_l_5357 == 15)) + { + return ("ÄÅÔÐÁÃË: 15s \n"); + } + else + { + if ((_l_5357 == 16)) + { + return ("ÄÅÔÐÁÃË: 16s \n"); + } + else + { + if ((_l_5357 == 17)) + { + return ("ÄÅÔÐÁÃË: 17s \n"); + } + else + { + if ((_l_5357 == 18)) + { + return ("ÄÅÔÐÁÃË: 18s \n"); + } + else + { + if ((_l_5357 == 19)) + { + return ("ÄÅÔÐÁÃË: 19s \n"); + } + else + { + if ((_l_5357 == 20)) + { + return ("ÄÅÔÐÁÃË: 20s \n"); + } + else + { + if ((_l_5357 == 21)) + { + return ("ÄÅÔÐÁÃË: 21s \n"); + } + else + { + if ((_l_5357 == 22)) + { + return ("ÄÅÔÐÁÃË: 22s \n"); + } + else + { + if ((_l_5357 == 23)) + { + return ("ÄÅÔÐÁÃË: 23s \n"); + } + else + { + if ((_l_5357 == 24)) + { + return ("ÄÅÔÐÁÃË: 24s \n"); + } + else + { + if ((_l_5357 == 25)) + { + return ("ÄÅÔÐÁÃË: 25s \n"); + } + else + { + if ((_l_5357 == 26)) + { + return ("ÄÅÔÐÁÃË: 26s \n"); + } + else + { + if ((_l_5357 == 27)) + { + return ("ÄÅÔÐÁÃË: 27s \n"); + } + else + { + if ((_l_5357 == 28)) + { + return ("ÄÅÔÐÁÃË: 28s \n"); + } + else + { + if ((_l_5357 == 29)) + { + return ("ÄÅÔÐÁÃË: 29s \n"); + } + else + { + if ((_l_5357 == 30)) + { + return ("ÄÅÔÐÁÃË: 30s \n"); + } + else + { + if ((_l_5357 == 31)) + { + return ("ÄÅÔÐÁÃË: 31s \n"); + } + else + { + if ((_l_5357 == 32)) + { + return ("ÄÅÔÐÁÃË: 32s \n"); + } + else + { + if ((_l_5357 == 33)) + { + return ("ÄÅÔÐÁÃË: 33s \n"); + } + else + { + if ((_l_5357 == 34)) + { + return ("ÄÅÔÐÁÃË: 34s \n"); + } + else + { + if ((_l_5357 == 35)) + { + return ("ÄÅÔÐÁÃË: 35s \n"); + } + else + { + if ((_l_5357 == 36)) + { + return ("ÄÅÔÐÁÃË: 36s \n"); + } + else + { + if ((_l_5357 == 37)) + { + return ("ÄÅÔÐÁÃË: 37s \n"); + } + else + { + if ((_l_5357 == 38)) + { + return ("ÄÅÔÐÁÃË: 38s \n"); + } + else + { + if ((_l_5357 == 39)) + { + return ("ÄÅÔÐÁÃË: 39s \n"); + } + else + { + if ((_l_5357 == 40)) + { + return ("ÄÅÔÐÁÃË: 40s \n"); + } + else + { + if ((_l_5357 == 41)) + { + return ("ÄÅÔÐÁÃË: 41s \n"); + } + else + { + if ((_l_5357 == 42)) + { + return ("ÄÅÔÐÁÃË: 42s \n"); + } + else + { + if ((_l_5357 == 43)) + { + return ("ÄÅÔÐÁÃË: 43s \n"); + } + else + { + if ((_l_5357 == 44)) + { + return ("ÄÅÔÐÁÃË: 44s \n"); + } + else + { + if ((_l_5357 == 45)) + { + return ("ÄÅÔÐÁÃË: 45s \n"); + } + else + { + if ((_l_5357 == 46)) + { + return ("ÄÅÔÐÁÃË: 46s \n"); + } + else + { + if ((_l_5357 == 47)) + { + return ("ÄÅÔÐÁÃË: 47s \n"); + } + else + { + if ((_l_5357 == 48)) + { + return ("ÄÅÔÐÁÃË: 48s \n"); + } + else + { + if ((_l_5357 == 49)) + { + return ("ÄÅÔÐÁÃË: 49s \n"); + } + else + { + if ((_l_5357 == 50)) + { + return ("ÄÅÔÐÁÃË: 50s \n"); + } + else + { + if ((_l_5357 == 51)) + { + return ("ÄÅÔÐÁÃË: 51s \n"); + } + else + { + if ((_l_5357 == 52)) + { + return ("ÄÅÔÐÁÃË: 52s \n"); + } + else + { + if ((_l_5357 == 53)) + { + return ("ÄÅÔÐÁÃË: 53s \n"); + } + else + { + if ((_l_5357 == 54)) + { + return ("ÄÅÔÐÁÃË: 54s \n"); + } + else + { + if ((_l_5357 == 55)) + { + return ("ÄÅÔÐÁÃË: 55s \n"); + } + else + { + if ((_l_5357 == 56)) + { + return ("ÄÅÔÐÁÃË: 56s \n"); + } + else + { + if ((_l_5357 == 57)) + { + return ("ÄÅÔÐÁÃË: 57s \n"); + } + else + { + if ((_l_5357 == 58)) + { + return ("ÄÅÔÐÁÃË: 58s \n"); + } + else + { + if ((_l_5357 == 59)) + { + return ("ÄÅÔÐÁÃË: 59s \n"); + } + else + { + if ((_l_5357 == 60)) + { + return ("ÄÅÔÐÁÃË: 60s \n"); + } + else + { + if ((_l_5357 == 61)) + { + return ("ÄÅÔÐÁÃË: 61s \n"); + } + else + { + if ((_l_5357 == 62)) + { + return ("ÄÅÔÐÁÃË: 62s \n"); + } + else + { + if ((_l_5357 == 63)) + { + return ("ÄÅÔÐÁÃË: 63s \n"); + } + else + { + if ((_l_5357 == 64)) + { + return ("ÄÅÔÐÁÃË: 64s \n"); + } + else + { + if ((_l_5357 == 65)) + { + return ("ÄÅÔÐÁÃË: 65s \n"); + } + else + { + if ((_l_5357 == 66)) + { + return ("ÄÅÔÐÁÃË: 66s \n"); + } + else + { + if ((_l_5357 == 67)) + { + return ("ÄÅÔÐÁÃË: 67s \n"); + } + else + { + if ((_l_5357 == 68)) + { + return ("ÄÅÔÐÁÃË: 68s \n"); + } + else + { + if ((_l_5357 == 69)) + { + return ("ÄÅÔÐÁÃË: 69s \n"); + } + else + { + if ((_l_5357 == 70)) + { + return ("ÄÅÔÐÁÃË: 70s \n"); + } + else + { + if ((_l_5357 == 71)) + { + return ("ÄÅÔÐÁÃË: 71s \n"); + } + else + { + if ((_l_5357 == 72)) + { + return ("ÄÅÔÐÁÃË: 72s \n"); + } + else + { + if ((_l_5357 == 73)) + { + return ("ÄÅÔÐÁÃË: 73s \n"); + } + else + { + if ((_l_5357 == 74)) + { + return ("ÄÅÔÐÁÃË: 74s \n"); + } + else + { + if ((_l_5357 == 75)) + { + return ("ÄÅÔÐÁÃË: 75s \n"); + } + else + { + if ((_l_5357 == 76)) + { + return ("ÄÅÔÐÁÃË: 76s \n"); + } + else + { + if ((_l_5357 == 77)) + { + return ("ÄÅÔÐÁÃË: 77s \n"); + } + else + { + if ((_l_5357 == 78)) + { + return ("ÄÅÔÐÁÃË: 78s \n"); + } + else + { + if ((_l_5357 == 79)) + { + return ("ÄÅÔÐÁÃË: 79s \n"); + } + else + { + if ((_l_5357 == 80)) + { + return ("ÄÅÔÐÁÃË: 80s \n"); + } + else + { + if ((_l_5357 == 81)) + { + return ("ÄÅÔÐÁÃË: 81s \n"); + } + else + { + if ((_l_5357 == 82)) + { + return ("ÄÅÔÐÁÃË: 82s \n"); + } + else + { + if ((_l_5357 == 83)) + { + return ("ÄÅÔÐÁÃË: 83s \n"); + } + else + { + if ((_l_5357 == 84)) + { + return ("ÄÅÔÐÁÃË: 84s \n"); + } + else + { + if ((_l_5357 == 85)) + { + return ("ÄÅÔÐÁÃË: 85s \n"); + } + else + { + if ((_l_5357 == 86)) + { + return ("ÄÅÔÐÁÃË: 86s \n"); + } + else + { + if ((_l_5357 == 87)) + { + return ("ÄÅÔÐÁÃË: 87s \n"); + } + else + { + if ((_l_5357 == 88)) + { + return ("ÄÅÔÐÁÃË: 88s \n"); + } + else + { + if ((_l_5357 == 89)) + { + return ("ÄÅÔÐÁÃË: 89s \n"); + } + else + { + if ((_l_5357 == 90)) + { + return ("ÄÅÔÐÁÃË: 90s \n"); + } + else + { + if ((_l_5357 == 91)) + { + return ("ÄÅÔÐÁÃË: 91s \n"); + } + else + { + if ((_l_5357 == 92)) + { + return ("ÄÅÔÐÁÃË: 92s \n"); + } + else + { + if ((_l_5357 == 93)) + { + return ("ÄÅÔÐÁÃË: 93s \n"); + } + else + { + if ((_l_5357 == 94)) + { + return ("ÄÅÔÐÁÃË: 94s \n"); + } + else + { + if ((_l_5357 == 95)) + { + return ("ÄÅÔÐÁÃË: 95s \n"); + } + else + { + if ((_l_5357 == 96)) + { + return ("ÄÅÔÐÁÃË: 96s \n"); + } + else + { + if ((_l_5357 == 97)) + { + return ("ÄÅÔÐÁÃË: 97s \n"); + } + else + { + if ((_l_5357 == 98)) + { + return ("ÄÅÔÐÁÃË: 98s \n"); + } + else + { + if ((_l_5357 == 99)) + { + return ("ÄÅÔÐÁÃË: 99s \n"); + } + else + { + if ((_l_5357 == 100)) + { + return ("ÄÅÔÐÁÃË: 100s\n"); + } + else + { + if ((_l_5357 == 101)) + { + return ("ÄÅÔÐÁÃË: 101s\n"); + } + else + { + if ((_l_5357 == 102)) + { + return ("ÄÅÔÐÁÃË: 102s\n"); + } + else + { + if ((_l_5357 == 103)) + { + return ("ÄÅÔÐÁÃË: 103s\n"); + } + else + { + if ((_l_5357 == 104)) + { + return ("ÄÅÔÐÁÃË: 104s\n"); + } + else + { + if ((_l_5357 == 105)) + { + return ("ÄÅÔÐÁÃË: 105s\n"); + } + else + { + if ((_l_5357 == 106)) + { + return ("ÄÅÔÐÁÃË: 106s\n"); + } + else + { + if ((_l_5357 == 107)) + { + return ("ÄÅÔÐÁÃË: 107s\n"); + } + else + { + if ((_l_5357 == 108)) + { + return ("ÄÅÔÐÁÃË: 108s\n"); + } + else + { + if ((_l_5357 == 109)) + { + return ("ÄÅÔÐÁÃË: 109s\n"); + } + else + { + if ((_l_5357 == 110)) + { + return ("ÄÅÔÐÁÃË: 110s\n"); + } + else + { + if ((_l_5357 == 111)) + { + return ("ÄÅÔÐÁÃË: 111s\n"); + } + else + { + if ((_l_5357 == 112)) + { + return ("ÄÅÔÐÁÃË: 112s\n"); + } + else + { + if ((_l_5357 == 113)) + { + return ("ÄÅÔÐÁÃË: 113s\n"); + } + else + { + if ((_l_5357 == 114)) + { + return ("ÄÅÔÐÁÃË: 114s\n"); + } + else + { + if ((_l_5357 == 115)) + { + return ("ÄÅÔÐÁÃË: 115s\n"); + } + else + { + if ((_l_5357 == 116)) + { + return ("ÄÅÔÐÁÃË: 116s\n"); + } + else + { + if ((_l_5357 == 117)) + { + return ("ÄÅÔÐÁÃË: 117s\n"); + } + else + { + if ((_l_5357 == 118)) + { + return ("ÄÅÔÐÁÃË: 118s\n"); + } + else + { + if ((_l_5357 == 119)) + { + return ("ÄÅÔÐÁÃË: 119s\n"); + } + else + { + if ((_l_5357 == 120)) + { + return ("ÄÅÔÐÁÃË: 120s\n"); + } + else + { + if ((_l_5357 == 121)) + { + return ("ÄÅÔÐÁÃË: 121s\n"); + } + else + { + if ((_l_5357 == 122)) + { + return ("ÄÅÔÐÁÃË: 122s\n"); + } + else + { + if ((_l_5357 == 123)) + { + return ("ÄÅÔÐÁÃË: 123s\n"); + } + else + { + if ((_l_5357 == 124)) + { + return ("ÄÅÔÐÁÃË: 124s\n"); + } + else + { + if ((_l_5357 == 125)) + { + return ("ÄÅÔÐÁÃË: 125s\n"); + } + else + { + if ((_l_5357 == 126)) + { + return ("ÄÅÔÐÁÃË: 126s\n"); + } + else + { + if ((_l_5357 == 127)) + { + return ("ÄÅÔÐÁÃË: 127s\n"); + } + else + { + if ((_l_5357 == 128)) + { + return ("ÄÅÔÐÁÃË: 128s\n"); + } + else + { + if ((_l_5357 == 129)) + { + return ("ÄÅÔÐÁÃË: 129s\n"); + } + else + { + if ((_l_5357 == 130)) + { + return ("ÄÅÔÐÁÃË: 130s\n"); + } + else + { + if ((_l_5357 == 131)) + { + return ("ÄÅÔÐÁÃË: 131s\n"); + } + else + { + if ((_l_5357 == 132)) + { + return ("ÄÅÔÐÁÃË: 132s\n"); + } + else + { + if ((_l_5357 == 133)) + { + return ("ÄÅÔÐÁÃË: 133s\n"); + } + else + { + if ((_l_5357 == 134)) + { + return ("ÄÅÔÐÁÃË: 134s\n"); + } + else + { + if ((_l_5357 == 135)) + { + return ("ÄÅÔÐÁÃË: 135s\n"); + } + else + { + if ((_l_5357 == 136)) + { + return ("ÄÅÔÐÁÃË: 136s\n"); + } + else + { + if ((_l_5357 == 137)) + { + return ("ÄÅÔÐÁÃË: 137s\n"); + } + else + { + if ((_l_5357 == 138)) + { + return ("ÄÅÔÐÁÃË: 138s\n"); + } + else + { + if ((_l_5357 == 139)) + { + return ("ÄÅÔÐÁÃË: 139s\n"); + } + else + { + if ((_l_5357 == 140)) + { + return ("ÄÅÔÐÁÃË: 140s\n"); + } + else + { + if ((_l_5357 == 141)) + { + return ("ÄÅÔÐÁÃË: 141s\n"); + } + else + { + if ((_l_5357 == 142)) + { + return ("ÄÅÔÐÁÃË: 142s\n"); + } + else + { + if ((_l_5357 == 143)) + { + return ("ÄÅÔÐÁÃË: 143s\n"); + } + else + { + if ((_l_5357 == 144)) + { + return ("ÄÅÔÐÁÃË: 144s\n"); + } + else + { + if ((_l_5357 == 145)) + { + return ("ÄÅÔÐÁÃË: 145s\n"); + } + else + { + if ((_l_5357 == 146)) + { + return ("ÄÅÔÐÁÃË: 146s\n"); + } + else + { + if ((_l_5357 == 147)) + { + return ("ÄÅÔÐÁÃË: 147s\n"); + } + else + { + if ((_l_5357 == 148)) + { + return ("ÄÅÔÐÁÃË: 148s\n"); + } + else + { + if ((_l_5357 == 149)) + { + return ("ÄÅÔÐÁÃË: 149s\n"); + } + else + { + if ((_l_5357 == 150)) + { + return ("ÄÅÔÐÁÃË: 150s\n"); + } + else + { + if ((_l_5357 == 151)) + { + return ("ÄÅÔÐÁÃË: 151s\n"); + } + else + { + if ((_l_5357 == 152)) + { + return ("ÄÅÔÐÁÃË: 152s\n"); + } + else + { + if ((_l_5357 == 153)) + { + return ("ÄÅÔÐÁÃË: 153s\n"); + } + else + { + if ((_l_5357 == 154)) + { + return ("ÄÅÔÐÁÃË: 154s\n"); + } + else + { + if ((_l_5357 == 155)) + { + return ("ÄÅÔÐÁÃË: 155s\n"); + } + else + { + if ((_l_5357 == 156)) + { + return ("ÄÅÔÐÁÃË: 156s\n"); + } + else + { + if ((_l_5357 == 157)) + { + return ("ÄÅÔÐÁÃË: 157s\n"); + } + else + { + if ((_l_5357 == 158)) + { + return ("ÄÅÔÐÁÃË: 158s\n"); + } + else + { + if ((_l_5357 == 159)) + { + return ("ÄÅÔÐÁÃË: 159s\n"); + } + else + { + if ((_l_5357 == 160)) + { + return ("ÄÅÔÐÁÃË: 160s\n"); + } + else + { + if ((_l_5357 == 161)) + { + return ("ÄÅÔÐÁÃË: 161s\n"); + } + else + { + if ((_l_5357 == 162)) + { + return ("ÄÅÔÐÁÃË: 162s\n"); + } + else + { + if ((_l_5357 == 163)) + { + return ("ÄÅÔÐÁÃË: 163s\n"); + } + else + { + if ((_l_5357 == 164)) + { + return ("ÄÅÔÐÁÃË: 164s\n"); + } + else + { + if ((_l_5357 == 165)) + { + return ("ÄÅÔÐÁÃË: 165s\n"); + } + else + { + if ((_l_5357 == 166)) + { + return ("ÄÅÔÐÁÃË: 166s\n"); + } + else + { + if ((_l_5357 == 167)) + { + return ("ÄÅÔÐÁÃË: 167s\n"); + } + else + { + if ((_l_5357 == 168)) + { + return ("ÄÅÔÐÁÃË: 168s\n"); + } + else + { + if ((_l_5357 == 169)) + { + return ("ÄÅÔÐÁÃË: 169s\n"); + } + else + { + if ((_l_5357 == 170)) + { + return ("ÄÅÔÐÁÃË: 170s\n"); + } + else + { + if ((_l_5357 == 171)) + { + return ("ÄÅÔÐÁÃË: 171s\n"); + } + else + { + if ((_l_5357 == 172)) + { + return ("ÄÅÔÐÁÃË: 172s\n"); + } + else + { + if ((_l_5357 == 173)) + { + return ("ÄÅÔÐÁÃË: 173s\n"); + } + else + { + if ((_l_5357 == 174)) + { + return ("ÄÅÔÐÁÃË: 174s\n"); + } + else + { + if ((_l_5357 == 175)) + { + return ("ÄÅÔÐÁÃË: 175s\n"); + } + else + { + if ((_l_5357 == 176)) + { + return ("ÄÅÔÐÁÃË: 176s\n"); + } + else + { + if ((_l_5357 == 177)) + { + return ("ÄÅÔÐÁÃË: 177s\n"); + } + else + { + if ((_l_5357 == 178)) + { + return ("ÄÅÔÐÁÃË: 178s\n"); + } + else + { + if ((_l_5357 == 179)) + { + return ("ÄÅÔÐÁÃË: 179s\n"); + } + else + { + if ((_l_5357 == 180)) + { + return ("ÄÅÔÐÁÃË: 180s\n"); + } + else + { + if ((_l_5357 == 181)) + { + return ("ÄÅÔÐÁÃË: 181s\n"); + } + else + { + if ((_l_5357 == 182)) + { + return ("ÄÅÔÐÁÃË: 182s\n"); + } + else + { + if ((_l_5357 == 183)) + { + return ("ÄÅÔÐÁÃË: 183s\n"); + } + else + { + if ((_l_5357 == 184)) + { + return ("ÄÅÔÐÁÃË: 184s\n"); + } + else + { + if ((_l_5357 == 185)) + { + return ("ÄÅÔÐÁÃË: 185s\n"); + } + else + { + if ((_l_5357 == 186)) + { + return ("ÄÅÔÐÁÃË: 186s\n"); + } + else + { + if ((_l_5357 == 187)) + { + return ("ÄÅÔÐÁÃË: 187s\n"); + } + else + { + if ((_l_5357 == 188)) + { + return ("ÄÅÔÐÁÃË: 188s\n"); + } + else + { + if ((_l_5357 == 189)) + { + return ("ÄÅÔÐÁÃË: 189s\n"); + } + else + { + if ((_l_5357 == 190)) + { + return ("ÄÅÔÐÁÃË: 190s\n"); + } + else + { + if ((_l_5357 == 191)) + { + return ("ÄÅÔÐÁÃË: 191s\n"); + } + else + { + if ((_l_5357 == 192)) + { + return ("ÄÅÔÐÁÃË: 192s\n"); + } + else + { + if ((_l_5357 == 193)) + { + return ("ÄÅÔÐÁÃË: 193s\n"); + } + else + { + if ((_l_5357 == 194)) + { + return ("ÄÅÔÐÁÃË: 194s\n"); + } + else + { + if ((_l_5357 == 195)) + { + return ("ÄÅÔÐÁÃË: 195s\n"); + } + else + { + if ((_l_5357 == 196)) + { + return ("ÄÅÔÐÁÃË: 196s\n"); + } + else + { + if ((_l_5357 == 197)) + { + return ("ÄÅÔÐÁÃË: 197s\n"); + } + else + { + if ((_l_5357 == 198)) + { + return ("ÄÅÔÐÁÃË: 198s\n"); + } + else + { + if ((_l_5357 == 199)) + { + return ("ÄÅÔÐÁÃË: 199s\n"); + } + else + { + if ((_l_5357 == 200)) + { + return ("ÄÅÔÐÁÃË: 200s\n"); + } + else + { + if ((_l_5357 == 201)) + { + return ("ÄÅÔÐÁÃË: 201s\n"); + } + else + { + if ((_l_5357 == 202)) + { + return ("ÄÅÔÐÁÃË: 202s\n"); + } + else + { + if ((_l_5357 == 203)) + { + return ("ÄÅÔÐÁÃË: 203s\n"); + } + else + { + if ((_l_5357 == 204)) + { + return ("ÄÅÔÐÁÃË: 204s\n"); + } + else + { + if ((_l_5357 == 205)) + { + return ("ÄÅÔÐÁÃË: 205s\n"); + } + else + { + if ((_l_5357 == 206)) + { + return ("ÄÅÔÐÁÃË: 206s\n"); + } + else + { + if ((_l_5357 == 207)) + { + return ("ÄÅÔÐÁÃË: 207s\n"); + } + else + { + if ((_l_5357 == 208)) + { + return ("ÄÅÔÐÁÃË: 208s\n"); + } + else + { + if ((_l_5357 == 209)) + { + return ("ÄÅÔÐÁÃË: 209s\n"); + } + else + { + if ((_l_5357 == 210)) + { + return ("ÄÅÔÐÁÃË: 210s\n"); + } + else + { + if ((_l_5357 == 211)) + { + return ("ÄÅÔÐÁÃË: 211s\n"); + } + else + { + if ((_l_5357 == 212)) + { + return ("ÄÅÔÐÁÃË: 212s\n"); + } + else + { + if ((_l_5357 == 213)) + { + return ("ÄÅÔÐÁÃË: 213s\n"); + } + else + { + if ((_l_5357 == 214)) + { + return ("ÄÅÔÐÁÃË: 214s\n"); + } + else + { + if ((_l_5357 == 215)) + { + return ("ÄÅÔÐÁÃË: 215s\n"); + } + else + { + if ((_l_5357 == 216)) + { + return ("ÄÅÔÐÁÃË: 216s\n"); + } + else + { + if ((_l_5357 == 217)) + { + return ("ÄÅÔÐÁÃË: 217s\n"); + } + else + { + if ((_l_5357 == 218)) + { + return ("ÄÅÔÐÁÃË: 218s\n"); + } + else + { + if ((_l_5357 == 219)) + { + return ("ÄÅÔÐÁÃË: 219s\n"); + } + else + { + if ((_l_5357 == 220)) + { + return ("ÄÅÔÐÁÃË: 220s\n"); + } + else + { + if ((_l_5357 == 221)) + { + return ("ÄÅÔÐÁÃË: 221s\n"); + } + else + { + if ((_l_5357 == 222)) + { + return ("ÄÅÔÐÁÃË: 222s\n"); + } + else + { + if ((_l_5357 == 223)) + { + return ("ÄÅÔÐÁÃË: 223s\n"); + } + else + { + if ((_l_5357 == 224)) + { + return ("ÄÅÔÐÁÃË: 224s\n"); + } + else + { + if ((_l_5357 == 225)) + { + return ("ÄÅÔÐÁÃË: 225s\n"); + } + else + { + if ((_l_5357 == 226)) + { + return ("ÄÅÔÐÁÃË: 226s\n"); + } + else + { + if ((_l_5357 == 227)) + { + return ("ÄÅÔÐÁÃË: 227s\n"); + } + else + { + if ((_l_5357 == 228)) + { + return ("ÄÅÔÐÁÃË: 228s\n"); + } + else + { + if ((_l_5357 == 229)) + { + return ("ÄÅÔÐÁÃË: 229s\n"); + } + else + { + if ((_l_5357 == 230)) + { + return ("ÄÅÔÐÁÃË: 230s\n"); + } + else + { + if ((_l_5357 == 231)) + { + return ("ÄÅÔÐÁÃË: 231s\n"); + } + else + { + if ((_l_5357 == 232)) + { + return ("ÄÅÔÐÁÃË: 232s\n"); + } + else + { + if ((_l_5357 == 233)) + { + return ("ÄÅÔÐÁÃË: 233s\n"); + } + else + { + if ((_l_5357 == 234)) + { + return ("ÄÅÔÐÁÃË: 234s\n"); + } + else + { + if ((_l_5357 == 235)) + { + return ("ÄÅÔÐÁÃË: 235s\n"); + } + else + { + if ((_l_5357 == 236)) + { + return ("ÄÅÔÐÁÃË: 236s\n"); + } + else + { + if ((_l_5357 == 237)) + { + return ("ÄÅÔÐÁÃË: 237s\n"); + } + else + { + if ((_l_5357 == 238)) + { + return ("ÄÅÔÐÁÃË: 238s\n"); + } + else + { + if ((_l_5357 == 239)) + { + return ("ÄÅÔÐÁÃË: 239s\n"); + } + else + { + if ((_l_5357 == 240)) + { + return ("ÄÅÔÐÁÃË: 240s\n"); + } + else + { + if ((_l_5357 == 241)) + { + return ("ÄÅÔÐÁÃË: 241s\n"); + } + else + { + if ((_l_5357 == 242)) + { + return ("ÄÅÔÐÁÃË: 242s\n"); + } + else + { + if ((_l_5357 == 243)) + { + return ("ÄÅÔÐÁÃË: 243s\n"); + } + else + { + if ((_l_5357 == 244)) + { + return ("ÄÅÔÐÁÃË: 244s\n"); + } + else + { + if ((_l_5357 == 245)) + { + return ("ÄÅÔÐÁÃË: 245s\n"); + } + else + { + if ((_l_5357 == 246)) + { + return ("ÄÅÔÐÁÃË: 246s\n"); + } + else + { + if ((_l_5357 == 247)) + { + return ("ÄÅÔÐÁÃË: 247s\n"); + } + else + { + if ((_l_5357 == 248)) + { + return ("ÄÅÔÐÁÃË: 248s\n"); + } + else + { + if ((_l_5357 == 249)) + { + return ("ÄÅÔÐÁÃË: 249s\n"); + } + else + { + if ((_l_5357 == 250)) + { + return ("ÄÅÔÐÁÃË: 250s\n"); + } + else + { + if ((_l_5357 == 251)) + { + return ("ÄÅÔÐÁÃË: 251s\n"); + } + else + { + if ((_l_5357 == 252)) + { + return ("ÄÅÔÐÁÃË: 252s\n"); + } + else + { + if ((_l_5357 == 253)) + { + return ("ÄÅÔÐÁÃË: 253s\n"); + } + else + { + if ((_l_5357 == 254)) + { + return ("ÄÅÔÐÁÃË: 254s\n"); + } + else + { + if ((_l_5357 >= 254)) + { + return ("ÄÅÔÐÁÃË: 255s\n"); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + + } + } + return "0"; +}; \ No newline at end of file diff --git a/subs.pqc b/subs.pqc new file mode 100644 index 0000000..6fc22af --- /dev/null +++ b/subs.pqc @@ -0,0 +1,251 @@ +void (entity Goal,entity AP) DoGoalWork; +void (entity Goal,entity AP) DoGroupWork; + +void() SUB_Null = +{ +}; + +void() SUB_Remove = +{ + dremove(self); +}; + +void() SetMovedir = +{ + if (self.angles == '0 -1 0') + { + self.movedir = '0 0 1'; + } + else + { + if (self.angles == '0 -2 0') + { + self.movedir = '0 0 -1'; + } + else + { + makevectors(self.angles); + self.movedir = v_forward; + } + } + self.angles = '0 0 0'; +}; + +void() SUB_CalcMoveDone = +{ + setorigin(self, self.finaldest); + self.velocity = '0 0 0'; + self.nextthink = -1; + if (self.think1) + { + self.think1(); + } +}; + +void() InitTrigger = +{ + if (self.angles != '0 0 0') + { + SetMovedir(); + } + self.solid = TF_FLARE_OFF; + setmodel(self, self.model); + self.movetype = TF_FLARE_LIT; + self.modelindex = TF_FLARE_LIT; + self.model = ""; +}; + +void(vector tdest, float tspeed, void() func) SUB_CalcMove = +{ + local vector vdestdelta; + local float len; + local float traveltime; + if (!tspeed) + { + objerror("No speed is defined!"); + } + self.think1 = func; + self.finaldest = tdest; + self.think = SUB_CalcMoveDone; + if (tdest == self.origin) + { + self.velocity = '0 0 0'; + self.nextthink = self.ltime + 0.1; + return; + } + vdestdelta = tdest - self.origin; + len = vlen(vdestdelta); + traveltime = len / tspeed; + if (traveltime < 0.030000) + { + traveltime = 0.030000; + } + self.nextthink = self.ltime + traveltime; + self.velocity = vdestdelta * (TF_FLARE_OFF / traveltime); +}; + +void(entity ent, vector tdest, float tspeed, void() func) SUB_CalcMoveEnt = +{ + local entity stemp; + stemp = self; + self = ent; + SUB_CalcMove(tdest, tspeed, func); + self = stemp; +}; + + + + +void(vector destangle, float tspeed, void() func) SUB_CalcAngleMove = +{ + local vector destdelta; + local float len; + local float traveltime; + if (!tspeed) + { + objerror("No speed is defined!"); + } + destdelta = destangle - self.angles; + len = vlen(destdelta); + traveltime = len / tspeed; + self.nextthink = self.ltime + traveltime; + self.avelocity = destdelta * (TF_FLARE_OFF / traveltime); + self.think1 = func; + self.finalangle = destangle; + self.think = SUB_CalcAngleMoveDone; +}; + +void(entity ent, vector destangle, float tspeed, void() func) SUB_CalcAngleMoveEnt = +{ + local entity stemp; + stemp = self; + self = ent; + SUB_CalcAngleMove(destangle, tspeed, func); + self = stemp; +}; + +void() SUB_CalcAngleMoveDone = +{ + self.angles = self.finalangle; + self.avelocity = '0 0 0'; + self.nextthink = -1; + if (self.think1) + { + self.think1(); + } +}; + +void() DelayThink = +{ + activator = self.enemy; + SUB_UseTargets(); + dremove(self); +}; + +void() SUB_UseTargets = +{ + local entity t; + local entity stemp; + local entity otemp; + local entity act; + if (self.dont_do_triggerwork) + { + self.dont_do_triggerwork = TF_FLARE_LIT; + return; + } + if (self.delay) + { + t = spawn(); + t.classname = "DelayedUse"; + t.nextthink = time + self.delay; + t.think = DelayThink; + t.enemy = activator; + t.message = self.message; + t.killtarget = self.killtarget; + t.target = self.target; + return; + } + if (activator.classname == "player" && self.message != "") + { + CenterPrint(activator, self.message); + if (!(self.noise)) + { + sound(activator, 2, "misc/talk.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + } + if (activator.classname == "player") + { + DoGroupWork(self, activator); + DoGoalWork(self, activator); + } + if (self.killtarget) + { + t = world; + do + { + t = find(t, targetname, self.killtarget); + if (!t) + { + return; + } + remove(t); + } while (TF_FLARE_OFF); + } + if (self.target) + { + act = activator; + t = world; + do + { + t = find(t, targetname, self.target); + if (!t) + { + return; + } + stemp = self; + otemp = other; + self = t; + other = stemp; + if (self.use != SUB_Null) + { + if (self.use) + { + self.use(); + } + } + self = stemp; + other = otemp; + activator = act; + } while (TF_FLARE_OFF); + } +}; + +void(float normal) SUB_AttackFinished = +{ + self.cnt = TF_FLARE_LIT; + if (skill < 3) + { + self.attack_finished = time + normal; + } +}; +float (entity targ) visible; + +void (void() thinkst) SUB_CheckRefire = +{ + if (skill < 3) + { + return; + } + if (self.cnt == TF_FLARE_OFF) + { + return; + } + if (!visible(self.enemy)) + { + return; + } + self.cnt = TF_FLARE_OFF; + self.think = thinkst; +}; + + diff --git a/tf29ents.pqc b/tf29ents.pqc new file mode 100644 index 0000000..7cd4252 --- /dev/null +++ b/tf29ents.pqc @@ -0,0 +1,2 @@ +// defines compiler to compile with t 2.9 entities +#define tf29ents \ No newline at end of file diff --git a/tfort.pqc b/tfort.pqc new file mode 100644 index 0000000..30aaede --- /dev/null +++ b/tfort.pqc @@ -0,0 +1,4152 @@ +.float option3; +.float maxstrafespeed; // Maximum side speed + +void() TeamFortress_GrenadePrimed; +//11.11.04 +void (entity _p_11069, entity _p_11070, entity _p_11071) DisplayItemStatus; +void (entity _p_11027, entity _p_11028, float _p_11029) tfgoalitem_RemoveFromPlayer; +void () tfgoalitem_remove; +void() tfgoalitem_dropthink; + +// Function Prototypes +void() RemoveFlare; +void() GrenadeExplode; +void() spike_touch; +void(entity p) bound_other_ammo; +void(entity Goal, entity Player, entity Item) DisplayItemStatus; + +// Re-check localinfo class restrict function +// added by XavioR +void() ReCheckRestrictions; + +// Map Function Prototypes +void(entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer; + +// Help Functions +void() TeamFortress_MOTD; + +// Team Functions +float(float tno) TeamFortress_TeamGetColor; +void(float tno) TeamFortress_TeamSetColor; +float() TeamFortress_TeamPutPlayerInTeam; +float(float tno) TeamFortress_TeamGetScore; +float(float tno) TeamFortress_TeamGetIllegalClasses; + +// Impulse Functions +void() TeamFortress_ToggleGenderMessage; +void() TeamFortress_ChangeClass; +void() TeamFortress_DisplayLegalClasses; +void() TeamFortress_Inventory; +void() TeamFortress_ShowTF; +void() TeamFortress_PrimeGrenade; +void() TeamFortress_ThrowGrenade; +void() TeamFortress_DisplayDetectionItems; + +// Player Class Handling Functions +float(float pc) IsLegalClass; +void() TeamFortress_SetHealth; +void() TeamFortress_SetEquipment; +void(entity p) TeamFortress_SetSpeed; +void(entity p) TeamFortress_SetSkin; +void(entity Viewer, float pc, float rpc, float xavior_Var) TeamFortress_PrintClassName; +void() TeamFortress_RemoveTimers; +void(float Suicided) TeamFortress_SetupRespawn; +void() TeamFortress_CheckClassStats; +float(entity Retriever, float AmmoType) TeamFortress_GetMaxAmmo; +float(entity Retriever, float WeaponType) TeamFortress_CanGetWeapon; +float(entity Retriever, entity Items) TeamFortress_AddBackpackItems; +void(entity Player, float Armorclass) TeamFortress_DescribeArmor; + + +// AmmoBox Handling Functions +void () TeamFortress_AmmoboxTouch; +float (float tno) num_team_ammoboxes; +void(float tno) RemoveOldAmmobox; +void(float tno) increment_team_ammoboxes; +void(float tno) decrement_team_ammoboxes; + +// Weapon Handling Functions +void() TeamFortress_ExplodePerson; +void() NormalGrenadeTouch; +void() NormalGrenadeExplode; +void() PlayerObserverMode; + +// Utility Functions +void(string halias, float himpulse1, float himpulse2) TeamFortress_Alias; + +// Cyclic Event Functions +void() TeamFortress_Regenerate; +//void() TeamFortress_CheckforCheats; +void() TeamFortress_RegenerateCells; + +// + + + +void() TeamFortress_Spotlight = +{ + if (self.playerclass != 2) + { + return; + } + if (self.option2 == 0) + { + self.option2 = 1; + } + else + { + self.option2 = 0; + } + self.impulse = 0; +}; + +void() UseSpecialSkill = +{ + local vector src; + self.impulse = 0; + if (self.playerclass == 1) + { + self.impulse = 155; + } + else + { + if (self.playerclass == 2) + { + self.impulse = 174; + } + else + { + if (self.playerclass == 3) + { + self.impulse = 173; + } + else + { + if (self.playerclass == 4) + { + self.impulse = 170; + } + else + { + if (self.playerclass == 5) + { + self.impulse = 190; + } + else + { + if (self.playerclass == 6) + { + self.impulse = 3; + } + else + { + if (self.playerclass == 7) + { + self.impulse = 6; + } + else + { + if (self.playerclass == 8) + { + self.impulse = 177; + } + else + { + if (self.playerclass == 9) + { + self.impulse = 179; + } + else + { + if (self.playerclass == 0) + { + if (self.enemy == world) + { + src = self.origin + v_forward * 10; + src_z = self.absmin_z + self.size_z * 0.7; + traceline(src, src + v_forward * 2048, 0, self); + if (trace_ent != world && trace_ent.origin != world.origin) + { + sprint3(self, 2, "Locked onto ", trace_ent.classname, "\n"); + self.enemy = trace_ent; + self.camdist = vlen(self.enemy.origin - self.origin); + self.camangle = self.origin - self.enemy.origin; + self.camangle_z = 0 - self.camangle_z; + self.camangle = vectoangles(self.camangle); + } + } + else + { + sprint(self, 2, "Removed Lock\n"); + self.enemy = world; + } + } + } + } + } + } + } + } + } + } + } +}; +void() TeamFortress_ToggleGenderMessage = +{ + if (self.gender < 1) + { + self.gender = 1.0; + sprint (self, 2, "Gender set to Female.\n"); + } + else + { + self.gender = 0.0; + sprint (self, 2, "Gender set to Male.\n"); + } +}; + +void() TeamFortress_ChangeClass = +{ + local entity spot; + local entity te; + local float tc; + local string st; + + if (self.playerclass != 0) + { + if (deathmatch != 3) + { + return; + } + if (TeamFortress_TeamIsCivilian(self.team_no)) + { + sprint(self, 2, "You cannot change class.\n"); + return; + } + if (!IsLegalClass(self.impulse - 100)) + { + sprint(self, 2, "Your team cannot play that class.\n"); + TeamFortress_DisplayLegalClasses(); + return; + } + tc = IsRestrictedClass(self.impulse - 100); + if (tc != 0) + { + if (tc > 0) + { + sprint(self, 2, "That class is restricted to "); + st = ftos(tc); + sprint(self, 2, st); + sprint(self, 2, " per team.\n"); + } + else + { + sprint(self, 2, "That class is disabled.\n"); + } + return; + } + if (spy_off == 1 && self.impulse - 100 == 8) + { + sprint(self, 2, "The spy class has been disabled on the server by the administrator.\n"); + return; + } + self.nextpc = self.impulse - 100; + sprint(self, 2, "After dying, you will return as a "); + TeamFortress_PrintClassName(self, self.nextpc, self.tfstate & 8, 0); + self.immune_to_check = time + 10; + return; + } + TeamFortress_Alias("jetjump", 155, 0); + TeamFortress_Alias("bic", 157, 0); + TeamFortress_Alias("bhole", 58, 0); + TeamFortress_Alias("hey", 156, 0); + TeamFortress_Alias("pants", 250, 0); + TeamFortress_Alias("ir", 50, 0); + TeamFortress_Alias("holo", 200, 0); + TeamFortress_Alias("airstrike", 55, 0); + TeamFortress_Alias("drop1", 190, 0); + TeamFortress_Alias("drop2", 201, 0); + TeamFortress_Alias("drop3", 55, 0); + TeamFortress_Alias("lay", 158, 0); + TeamFortress_Alias("mega", 57, 0); + TeamFortress_Alias("taunt", 53, 0); + TeamFortress_Alias("airscout", 154, 0); + TeamFortress_Alias("dot", 61, 0); + TeamFortress_Alias("yell", 56, 0); +// avirox's vote menu + TeamFortress_Alias("votemenu", 251, 0); + TeamFortress_Alias("voteyes", 245, 0); +// medic self healing. + TeamFortress_Alias("heal", 189, 0); + +// dropflag no longer retired. + TeamFortress_Alias("dropflag", 203, 0); + TeamFortress_Alias("dropitems", 204, 0); +// dispenser detonation command + TeamFortress_Alias("detdispenser", 188, 0); +// sentry detonation command + TeamFortress_Alias("detsentry", 205, 0); +// timeleft command + TeamFortress_Alias("timeleft", 120, 0); + TeamFortress_Alias("togglegendermessage", 211, 0); + if (teamplay && self.team_no == 0) + { + if (toggleflags & 64) + { + if (TeamFortress_TeamPutPlayerInTeam() == 0) + { + return; + } + } + else + { + sprint(self, 2, "You must join a team first. \n"); + sprint(self, 2, "use imin1, imin2, imin3, or imin4\n"); + return; + } + } + if (self.lives == 0) + { + sprint(self, 2, "You have no lives left.\n"); + return; + } + if (!IsLegalClass(self.impulse - 100) && self.impulse != 1) + { + sprint(self, 2, "You cannot play that playerclass on this map. \n"); + TeamFortress_DisplayLegalClasses(); + return; + } + + tc = IsRestrictedClass(self.impulse - 100); + if (tc != 0) + { + if (tc > 0) + { + sprint(self, 2, "That class is restricted to "); + st = ftos(tc); + sprint(self, 2, st); + sprint(self, 2, " per team.\n"); + } + else + { + sprint(self, 2, "That class is disabled.\n"); + } + return; + } + if (spy_off == 1 && self.impulse - 100 == 8) + { + sprint(self, 2, "The spy class has been disabled on the server by the administrator.\n"); + return; + } + if (self.impulse != 1) + { + self.playerclass = self.impulse - 100; + } + else + { + self.playerclass = 11; + } + self.nextpc = 0; + self.takedamage = 2; + self.movetype = 3; + self.flags = 8 | 512; + self.waterlevel = 0; + self.air_finished = time + 12; + self.solid = 3; + self.pausetime = 0; + spot = SelectSpawnPoint(); + self.origin = spot.origin + '0 0 1'; + self.angles = spot.angles; + self.fixangle = 1; + setmodel(self, string_null); + modelindex_null = self.modelindex; + setmodel(self, "progs/eyes.mdl"); + modelindex_eyes = self.modelindex; + setmodel(self, "progs/player.mdl"); + modelindex_player = self.modelindex; + setsize(self, '-16 -16 -24', '16 16 32'); +// if (self.playerclass == 1) +// { +// setsize(self, '-8 -8 -24', '8 8 32'); +// } + self.view_ofs = '0 0 22'; + player_stand1(); + if (deathmatch || coop) + { + makevectors(self.angles); + spawn_tfog(self.origin + v_forward * 20); + } + if (self.playerclass == 10) + { + sprint(self, 2, "Random Playerclass.\n"); + self.tfstate = self.tfstate | 8; + tc = 1 + floor(random() * (10 - 1)); + while (IsRestrictedClass(tc) != 0) + { + tc = 1 + floor(random() * (10 - 1)); + } + self.playerclass = tc; + } + if (spot.classname == "info_player_teamspawn") + { + if (spot.items != 0) + { + te = Finditem(spot.items); + if (te) + { + tfgoalitem_GiveToPlayer(te, self, self); + } + if (!(spot.goal_activation & 1)) + { + spot.items = 0; + } + } + + if (prematch) + { + TeamFortress_PrintPMTimeLeft (self); + } + else + { + if (spot.message) + { + CenterPrint (self, spot.message); + if (!(spot.goal_activation & 2)) + { + spot.message = string_null; + } + } + } + if (spot.goal_effects == 1) + { + spot.classname = "deadpoint"; + spot.team_str_home = string_null; + spot.nextthink = time + 1; + spot.think = SUB_Remove; + } + } + spot = find(world, classname, "player"); + while (spot) + { + if (spot.team_no == self.team_no && spot != self) + { + sprint(spot, 2, self.netname); + sprint(spot, 2, " is playing as a "); + TeamFortress_PrintClassName(spot, self.playerclass, self.tfstate & 8, 0); + } + spot = find(spot, classname, "player"); + } + TeamFortress_PrintClassName(self, self.playerclass, self.tfstate & 8, 0); + TeamFortress_SetEquipment(); + TeamFortress_SetHealth(); + TeamFortress_SetSpeed(self); + TeamFortress_SetSkin(self); +//The following was causing a slight delay in the spawn so i put it in client.pqc +// stuffcmd (self, "alias aa_enabled impulse 240\nalias cl_accel impulse 240\nalias cl_speed impulse 240\nalias aa_lag impulse 240\nalias autofire impulse 240\nalias +autofire impulse 240\nalias autodet impulse 240\nalias +showradar impulse 240\n"); + stuffcmd (self, "cl_sidespeed 500\ncl_backspeed 500\ncl_forwardspeed 500\n"); + if ((quadscore > 0)) + { + if ((self.team_no == 2)) + { + self.frags = quadscore; + self.real_frags = quadscore; + } + } +}; + +void() TeamFortress_DisplayLegalClasses = +{ + local float gotone; + local float ill; + sprint(self, 2, "Legal Classes for your team are:\n"); + gotone = 0; + ill = TeamFortress_TeamGetIllegalClasses(self.team_no); + if (!(illegalclasses & 1) && !(ill & 1)) + { + if (gotone) + { + sprint(self, 2, ", "); + } + gotone = 1; + sprint(self, 2, "Scout"); + } + if (!(illegalclasses & 2) && !(ill & 2)) + { + if (gotone) + { + sprint(self, 2, ", "); + } + gotone = 1; + sprint(self, 2, "Sniper"); + } + if (!(illegalclasses & 4) && !(ill & 4)) + { + if (gotone) + { + sprint(self, 2, ", "); + } + gotone = 1; + sprint(self, 2, "Soldier"); + } + if (!(illegalclasses & 8) && !(ill & 8)) + { + if (gotone) + { + sprint(self, 2, ", "); + } + gotone = 1; + sprint(self, 2, "Demolitions Man"); + } + if (!(illegalclasses & 16) && !(ill & 16)) + { + if (gotone) + { + sprint(self, 2, ", "); + } + gotone = 1; + sprint(self, 2, "Combat Medic"); + } + if (!(illegalclasses & 32) && !(ill & 32)) + { + if (gotone) + { + sprint(self, 2, ", "); + } + gotone = 1; + sprint(self, 2, "Heavy Weapons Guy"); + } + if (!(illegalclasses & 64) && !(ill & 64)) + { + if (gotone) + { + sprint(self, 2, ", "); + } + gotone = 1; + sprint(self, 2, "Pyro"); + } + if (!(illegalclasses & 256) && !(ill & 256)) + { + if (gotone) + { + sprint(self, 2, ", "); + } + gotone = 1; + sprint(self, 2, "Spy"); + } + if (!(illegalclasses & 512) && !(ill & 512)) + { + if (gotone) + { + sprint(self, 2, ", "); + } + gotone = 1; + sprint(self, 2, "Engineer"); + } + if (!(illegalclasses & 128) && !(ill & 128)) + { + if (gotone) + { + sprint(self, 2, ", "); + } + gotone = 1; + sprint(self, 2, "RandomPC"); + } + sprint(self, 2, "\n"); +}; + +void (float _p_10136) TeamFortress_ItemStatus = +{ + local entity _l_10137; + local entity _l_10138; + local float _l_10139; + + _l_10139 = 0; + if ((_p_10136 >= 10)) + { + _l_10139 = 1; + _p_10136 = _p_10136 - 10; + } + if ((_p_10136 == 0)) + { + _p_10136 = self.team_no; + } + else + { + if ((self.team_no == 1)) + { + _p_10136 = 2; + } + else + { + _p_10136 = 1; + } + } + _l_10137 = find (world, classname, "item_tfgoal"); + while (_l_10137) + { + if ((_l_10137.owned_by == _p_10136)) + { + _l_10138 = _l_10137; + } + _l_10137 = find (_l_10137, classname, "item_tfgoal"); + } + if ((((((_l_10138 != world) && (_l_10138.owner == world)) && (_l_10138.think == tfgoalitem_remove)) && ((_l_10138.nextthink - time) > 0)) && (_l_10138.origin != _l_10138.oldorigin))) + { + if (_l_10139) + { + stuffcmd (self, "say_team "); + stuffcmd (self, _l_10138.netname); + stuffcmd (self, " returns in "); + stuffcmd (self, ftos (rint ((_l_10138.nextthink - time)))); + stuffcmd (self, " seconds.\n"); + } + else + { + sprint (self, 2, _l_10138.netname); + sprint (self, 2, " returns in "); + ftos (rint ((_l_10138.nextthink - time))); + sprint (self, 2, ftos (rint ((_l_10138.nextthink - time)))); + sprint (self, 2, " seconds.\n"); + } + return; + } + if ((((((_l_10138 != world) && (_l_10138.owner == world)) && (_l_10138.think == tfgoalitem_dropthink)) && ((_l_10138.nextthink - time) > 0)) && (_l_10138.origin != _l_10138.oldorigin))) + { + if (_l_10139) + { + stuffcmd (self, "say_team "); + stuffcmd (self, _l_10138.netname); + stuffcmd (self, " has been dropped.\n"); + } + else + { + sprint (self, 2, _l_10138.netname); + sprint (self, 2, " has been dropped.\n"); + } + return; + } + if (((_l_10138.origin == _l_10138.oldorigin) && (_l_10138.owner == world))) + { + if (_l_10139) + { + stuffcmd (self, "say_team "); + stuffcmd (self, _l_10138.netname); + stuffcmd (self, " is on its post.\n"); + } + else + { + sprint (self, 2, _l_10138.netname); + sprint (self, 2, " is on its post.\n"); + } + return; + } + if ((_l_10138.owner != world)) + { + if (_l_10139) + { + stuffcmd (self, "say_team "); + stuffcmd (self, _l_10138.netname); + stuffcmd (self, " is being carried.\n"); + } + else + { + sprint (self, 2, _l_10138.netname); + sprint (self, 2, " is being carried.\n"); + } + return; + } +}; + +void () TeamFortress_Inventory = +{ + local entity _l_10154; + local float _l_10155; + local entity _l_10156; + local string _l_10157; + local string _l_10159; + + sprint (self, 2, "You're on the "); + _l_10157 = ftos (self.team_no); + if ((_l_10157 == "1")) + { + sprint (self, 2, "ÂÌÕÅ"); + } + if ((_l_10157 == "2")) + { + sprint (self, 2, "ÒÅÄ"); + } + if ((_l_10157 == "3")) + { + sprint (self, 2, "ÙÅÌÌÏ×"); + } + if ((_l_10157 == "4")) + { + sprint (self, 2, "ÇÒÅÅÎ"); + } + sprint (self, 2, " team.\n"); + if ((self.lives != -1)) + { + _l_10157 = ftos (self.lives); + sprint (self, 2, "You've got "); + sprint (self, 2, _l_10157); + if ((self.lives == 1)) + { + sprint (self, 2, " life.\n"); + } + else + { + sprint (self, 2, " lives.\n"); + } + } + if ((self.no_grenades_1 > 0)) + { + sprint (self, 2, " Û"); + _l_10157 = ftos (self.no_grenades_1); + sprint (self, 2, _l_10157); + sprint (self, 2, "Ý "); + if ((self.tp_grenades_1 == 1)) + { + sprint (self, 2, "normal grenade"); + } + else + { + if ((self.tp_grenades_1 == 2)) + { + sprint (self, 2, "concussion grenade"); + } + else + { + if ((self.tp_grenades_1 == 3)) + { + sprint (self, 2, "nail grenade"); + } + else + { + if ((self.tp_grenades_1 == 4)) + { + sprint (self, 2, "MIRV grenade"); + } + else + { + if ((self.tp_grenades_1 == 5)) + { + sprint (self, 2, "napalm grenade"); + } + else + { + if ((self.tp_grenades_1 == 6)) + { + sprint (self, 2, "flare"); + } + else + { + if ((self.tp_grenades_1 == 7)) + { + sprint (self, 2, "hallucinogenic grenade"); + } + else + { + if ((self.tp_grenades_1 == 8)) + { + sprint (self, 2, "EMP grenade"); + } + else + { + if ((self.tp_grenades_1 == 9)) + { + sprint (self, 2, "flash grenade"); + } + else + { + sprint (self, 2, "BUG("); + } + } + } + } + } + } + } + } + } + if ((_l_10157 != "1")) + { + sprint (self, 2, "s"); + } + sprint (self, 2, "\n"); + } + if ((self.no_grenades_2 > 0)) + { + sprint (self, 2, " Û"); + _l_10157 = ftos (self.no_grenades_2); + sprint (self, 2, _l_10157); + sprint (self, 2, "Ý "); + if ((self.tp_grenades_2 == 1)) + { + sprint (self, 2, "normal grenade"); + } + else + { + if ((self.tp_grenades_2 == 2)) + { + sprint (self, 2, "concussion grenade"); + } + else + { + if ((self.tp_grenades_2 == 3)) + { + sprint (self, 2, "nail grenade"); + } + else + { + if ((self.tp_grenades_2 == 4)) + { + sprint (self, 2, "MIRV grenade"); + } + else + { + if ((self.tp_grenades_2 == 5)) + { + sprint (self, 2, "napalm grenade"); + } + else + { + if ((self.tp_grenades_2 == 6)) + { + sprint (self, 2, "flare"); + } + else + { + if ((self.tp_grenades_2 == 7)) + { + sprint (self, 2, "hallucinogenic grenade"); + } + else + { + if ((self.tp_grenades_2 == 8)) + { + sprint (self, 2, "EMP grenade"); + } + else + { + if ((self.tp_grenades_2 == 9)) + { + sprint (self, 2, "flash grenade"); + } + else + { + sprint (self, 2, "BUG("); + } + } + } + } + } + } + } + } + } + if ((_l_10157 != "1")) + { + sprint (self, 2, "s"); + } + sprint (self, 2, "\n"); + } + _l_10154 = find (world, classname, "drop1"); + while (_l_10154) + { + if ((_l_10154.owner == self)) + { + _l_10155 = _l_10155 + 1; + } + _l_10154 = find (_l_10154, classname, "drop1"); + } + if ((self.playerclass == 1)) + { + _l_10155 = 1 - _l_10155; + if ((_l_10155 <= 0)) + { + _l_10159 = ""; + } + else + { + _l_10159 = "Flash Mine"; + } + } + if ((self.playerclass == 2)) + { + _l_10159 = "used alarm"; + } + else + { + if (((self.playerclass == 3) || (self.playerclass == 6))) + { + _l_10155 = 2 - _l_10155; + _l_10159 = "Spike Trap"; + } + else + { + if ((self.playerclass == 5)) + { + _l_10155 = 1 - _l_10155; + _l_10159 = "Syringe"; + } + else + { + if ((self.playerclass == 7)) + { + _l_10155 = 1 - _l_10155; + _l_10159 = "Lava Pool"; + } + else + { + if ((self.playerclass == 8)) + { + _l_10155 = 1 - _l_10155; + _l_10159 = "Ammo Trap"; + } + else + { + if ((self.playerclass == 9)) + { + _l_10155 = 1 - _l_10155; + _l_10159 = "MagMine"; + } + } + } + } + } + } + if (_l_10155) + { + if ((_l_10155 <= 0)) + { + return; + } + if (!((self.playerclass == 7) && (self.has_syringe == 0))) + { + _l_10157 = ftos (_l_10155); + sprint (self, 2, _l_10157); + sprint (self, 2, " ", _l_10159); + if ((_l_10155 > 1)) + { + sprint (self, 2, "s. "); + } + else + { + sprint (self, 2, ". "); + } + } + } + if ((self.playerclass == 9)) + { + if ((self.option3 > 0)) + { + if ((self.last_used <= time)) + { + sprint (self, 2, "1 LaserDrone. "); + } + } + } + if ((self.tf_items & 1)) + { + sprint (self, 2, "Scanner. "); + } + if ((self.weapons_carried & 131072)) + { + if ((self.ammo_detpack > 0)) + { + _l_10157 = ftos (self.ammo_detpack); + sprint (self, 2, _l_10157); + sprint (self, 2, " Detpack"); + if ((self.ammo_detpack > 1)) + { + sprint (self, 2, "s"); + } + sprint (self, 2, ". "); + } + } + _l_10156 = find (world, classname, "item_tfgoal"); + while (_l_10156) + { + if ((_l_10156.owner == self)) + { + sprint (self, 2, _l_10156.netname); + sprint (self, 2, ". "); + } + _l_10156 = find (_l_10156, classname, "item_tfgoal"); + } + if ((self.armorvalue > 0)) + { + TeamFortress_DescribeArmor (self, self.armorclass); + } + if (!invis_only) + { + if (((self.playerclass == 8) && (invis_only == 0))) + { + sprint (self, 2, "Skin : "); + if ((self.undercover_skin != 0)) + { + TeamFortress_PrintClassName (self, self.undercover_skin, 0, 0); + } + else + { + sprint (self, 2, "Spy\n"); + } + sprint (self, 2, "Colors : Team "); + if ((self.undercover_team != 0)) + { + _l_10157 = ftos (self.undercover_team); + } + else + { + _l_10157 = ftos (self.team_no); + } + sprint (self, 2, _l_10157); + } + } + sprint (self, 2, "\n"); +}; + +float (string st, float ft) ShowTF_PrintCR = +{ + local string _l_10200; + + if ((ft == 0)) + { + return (0); + } + else + { + if ((ft == -1)) + { + sprint (self, 2, st, "disabled\n"); + } + else + { + _l_10200 = ftos (ft); + sprint (self, 2, st, _l_10200, "\n"); + } + } + return (1); +}; + + +void () TeamFortress_ShowTF = +{ + local string _l_10203; + local float _l_10205; + + sprint (self, 2, "ÔåáíÆïòôòåóó Óåôôéîçóº\n\n"); + if ((toggleflags & 1)) + { + sprint (self, 2, " Class Persistence On.\n"); + } + else + { + sprint (self, 2, " Class Persistence Off.\n"); + } + if ((toggleflags & 64)) + { + sprint (self, 2, " AutoTeam On.\n"); + } + else + { + sprint (self, 2, " AutoTeam Off.\n"); + } + sprint (self, 2, " "); + if ((toggleflags & 4)) + { + _l_10203 = ftos (respawn_delay_time); + } + else + { + _l_10203 = "No"; + } + sprint (self, 2, _l_10203); + if ((_l_10203 != "No")) + { + sprint (self, 2, " second"); + } + sprint (self, 2, " Respawn Delay.\n"); + if ((toggleflags & 128)) + { + sprint (self, 2, " TeamFrags On.\n"); + } + else + { + sprint (self, 2, " TeamFrags Off.\n"); + } + if (allow_hook) + { + sprint (self, 2, " Grapple On.\n"); + } + else + { + sprint (self, 2, " Grapple Off.\n"); + } + ReCheckRestrictions (); + sprint (self, 2, "\n\n\nÃìáóó Òåóôòéãôéïîóº\n\n"); + _l_10205 = 0; + _l_10205 = _l_10205 + ShowTF_PrintCR (" Scout : ", cr_scout); + _l_10205 = _l_10205 + ShowTF_PrintCR (" Sniper : ", cr_sniper); + _l_10205 = _l_10205 + ShowTF_PrintCR (" Soldier : ", cr_soldier); + _l_10205 = _l_10205 + ShowTF_PrintCR (" Demoman : ", cr_demoman); + _l_10205 = _l_10205 + ShowTF_PrintCR (" Medic : ", cr_medic); + _l_10205 = _l_10205 + ShowTF_PrintCR (" HWGuy : ", cr_hwguy); + _l_10205 = _l_10205 + ShowTF_PrintCR (" Pyro : ", cr_pyro); + _l_10205 = _l_10205 + ShowTF_PrintCR (" Spy : ", cr_spy); + _l_10205 = _l_10205 + ShowTF_PrintCR (" Engineer: ", cr_engineer); + if (!_l_10205) + { + sprint (self, 2, " none set\n"); + } +}; + +void () TeamFortress_PrimeGrenade = +{ + local float _l_10231; + local string _l_10232; + local string _l_10233; + local entity _l_10234; + + if ((self.bugger == 8)) + { + return; + } + if (((self.tfstate & 1) || (self.tfstate & 1024))) + { + return; + } + if ((self.impulse == 150)) + { + _l_10231 = self.tp_grenades_1; + if ((self.tp_grenades_1 == 2)) + { + _l_10232 = "Concussion grenade"; + } + else + { + if ((self.tp_grenades_1 == 3)) + { + _l_10232 = "Nail grenade"; + } + else + { + if ((self.tp_grenades_1 == 4)) + { + _l_10232 = "Mirv grenade"; + } + else + { + if ((self.tp_grenades_1 == 5)) + { + _l_10232 = "Napalm grenade"; + } + else + { + if ((self.tp_grenades_1 == 6)) + { + _l_10232 = "Flare"; + } + else + { + if ((self.tp_grenades_1 == 7)) + { + _l_10232 = "Gas grenade"; + } + else + { + if ((self.tp_grenades_1 == 8)) + { + _l_10232 = "EMP grenade"; + } + else + { + if ((self.tp_grenades_1 == 9)) + { + _l_10232 = "Flash grenade"; + } + else + { + _l_10232 = "Grenade"; + } + } + } + } + } + } + } + } + if ((self.active_grenades_1 < 0)) + { + self.active_grenades_1 = 0; + } + if ((self.no_grenades_1 > 0)) + { + if ((self.active_grenades_1 < sr_gren1)) + { + sound (self, 1, "weapons/prime.wav", 1, 1); + _l_10233 = ftos (3); + sprint (self, 2, _l_10232); + sprint (self, 2, " primed, "); + sprint (self, 2, _l_10233); + sprint (self, 2, " seconds...\n"); + self.no_grenades_1 = (self.no_grenades_1 - 1); + self.active_grenades_1 = (self.active_grenades_1 + 1); + if ((self.tp_grenades_1 == 1)) + { + Stats_Fired (666); + } + self.StatusRefreshTime = (time + 0.200000); + } + else + { + sound (self, 1, "player/pain2.wav", 1, 1); + sprint (self, 2, "Your arthritic priming hand is taking a break.\n"); + return; + } + } + else + { + sprint (self, 2, "No "); + sprint (self, 2, _l_10232); + sprint (self, 2, "s left.\n"); + return; + } + } + if ((self.impulse == 151)) + { + _l_10231 = self.tp_grenades_2; + if ((self.tp_grenades_2 == 2)) + { + _l_10232 = "Concussion grenade"; + } + else + { + if ((self.tp_grenades_2 == 3)) + { + _l_10232 = "Nail grenade"; + } + else + { + if ((self.tp_grenades_2 == 4)) + { + _l_10232 = "Mirv grenade"; + } + else + { + if ((self.tp_grenades_2 == 5)) + { + _l_10232 = "Napalm grenade"; + } + else + { + if ((self.tp_grenades_2 == 6)) + { + _l_10232 = "Flare"; + } + else + { + if ((self.tp_grenades_2 == 7)) + { + _l_10232 = "Gas grenade"; + } + else + { + if ((self.tp_grenades_2 == 8)) + { + _l_10232 = "EMP grenade"; + } + else + { + if ((self.tp_grenades_2 == 9)) + { + _l_10232 = "Flash grenade"; + } + else + { + _l_10232 = "Grenade"; + } + } + } + } + } + } + } + } + if ((self.no_grenades_2 > 0)) + { + if ((self.active_grenades_2 < 0)) + { + self.active_grenades_2 = 0; + } + if ((rint (self.active_grenades_2) < sr_gren2)) + { + sound (self, 1, "weapons/prime.wav", 1, 1); + _l_10233 = ftos (3); + sprint (self, 2, _l_10232); + sprint (self, 2, " primed, "); + sprint (self, 2, _l_10233); + sprint (self, 2, " seconds...\n"); + self.no_grenades_2 = (self.no_grenades_2 - 1); + self.active_grenades_2 = (self.active_grenades_2 + 1); + self.StatusRefreshTime = (time + 0.200000); + } + else + { + sound (self, 1, "player/pain2.wav", 1, 1); + sprint (self, 2, "Your arthritic priming hand is taking a break.\n"); + return; + } + } + else + { + sprint (self, 2, "No "); + sprint (self, 2, _l_10232); + sprint (self, 2, "s left.\n"); + return; + } + } + self.tfstate = (self.tfstate | 1); + _l_10234 = spawn (); + _l_10234.owner = self; + _l_10234.weapon = _l_10231; + _l_10234.nextthink = (time + 0.800000); + _l_10234.heat = (time + 3.800000); + _l_10234.classname = "aprimedgrenade"; + _l_10234.think = TeamFortress_GrenadePrimed; +}; + + +void () TeamFortress_GrenadePrimed = +{ + local entity _l_10249; + local entity _l_10250; + local entity _l_10251; + local float _l_10252; + + _l_10249 = self.owner; + if ((!(_l_10249.tfstate & 1024) && !_l_10249.deadflag)) + { + self.nextthink = (time + 0.100000); + if (!self.think) + { + dremove (self); + } + if ((time > self.heat)) + { + TeamFortress_ExplodePerson (); + } + return; + } + if (!(_l_10249.tfstate & 1)) + { + dprint ("GrenadePrimed logic error\n"); + } + _l_10249.tfstate = (_l_10249.tfstate - (_l_10249.tfstate & 1)); + _l_10249.tfstate = (_l_10249.tfstate - (_l_10249.tfstate & 1024)); + KickPlayer (-1, _l_10249); + newmis = spawn (); + newmis.owner = _l_10249; + newmis.movetype = 10; + newmis.solid = 2; + newmis.classname = "grenade"; + makevectors (_l_10249.v_angle); + if (_l_10249.deadflag) + { + newmis.velocity = '0 0 200'; + } + else + { + if (_l_10249.v_angle_x) + { + newmis.velocity = ((((v_forward * 600) + (v_up * 200)) + ((crandom () * v_right) * 10)) + ((crandom () * v_up) * 10)); + } + else + { + newmis.velocity = aim (_l_10249, 10000); + newmis.velocity = (newmis.velocity * 600); + newmis.velocity_z = 200; + } + } + newmis.angles = vectoangles (newmis.velocity); + newmis.think = SUB_Null; + newmis.nextthink = self.heat; + if ((self.weapon == 1)) + { + newmis.touch = NormalGrenadeTouch; + newmis.think = NormalGrenadeExplode; + newmis.skin = 0; + newmis.avelocity = '300 500 300'; + setmodel (newmis, "progs/hgren2.mdl"); + } + else + { + if ((self.weapon == 2)) + { + newmis.touch = ConcussionGrenadeTouch; + newmis.think = ConcussionGrenadeExplode; + newmis.skin = 1; + newmis.avelocity = '300 300 300'; + newmis.skin = 2; + setmodel (newmis, "progs/hgren2.mdl"); + } + else + { + if ((self.weapon == 3)) + { + newmis.touch = NailGrenadeTouch; + newmis.think = NailGrenadeExplode; + newmis.skin = 1; + newmis.avelocity = '0 300 0'; + setmodel (newmis, "progs/biggren.mdl"); + } + else + { + if ((self.weapon == 4)) + { + newmis.touch = MirvGrenadeTouch; + newmis.think = MirvGrenadeExplode; + newmis.skin = 0; + newmis.avelocity = '0 300 0'; + setmodel (newmis, "progs/biggren.mdl"); + } + else + { + if ((self.weapon == 5)) + { + newmis.touch = NapalmGrenadeTouch; + newmis.think = NapalmGrenadeExplode; + newmis.skin = 2; + newmis.playerclass = 0; + newmis.avelocity = '0 300 0'; + setmodel (newmis, "progs/biggren.mdl"); + } + else + { + if ((self.weapon == 6)) + { + newmis.classname = "flare"; + _l_10252 = 0; + _l_10250 = find (world, classname, "flare"); + while (_l_10250) + { + _l_10252 = _l_10252 + 1; + _l_10250 = find (_l_10250, classname, "flare"); + } + if ((_l_10252 > 9)) + { + dremove (newmis); + } + newmis.movetype = 5; + newmis.velocity_z = 0; + newmis.velocity = aim (self, 10000); + newmis.velocity = (newmis.velocity * 1300); + newmis.touch = FlareGrenadeTouch; + newmis.think = FlareGrenadeExplode; + newmis.skin = 1; + newmis.avelocity = '0 0 0'; + setmodel (newmis, "progs/flare.mdl"); + newmis.solid = 1; + } + else + { + if ((self.weapon == 7)) + { + newmis.touch = GasGrenadeTouch; + newmis.think = GasGrenadeExplode; + newmis.skin = 3; + newmis.avelocity = '300 300 300'; + setmodel (newmis, "progs/grenade2.mdl"); + } + else + { + if ((self.weapon == 8)) + { + newmis.touch = EMPGrenadeTouch; + newmis.think = EMPGrenadeExplode; + newmis.skin = 4; + newmis.avelocity = '300 300 300'; + setmodel (newmis, "progs/grenade2.mdl"); + } + else + { + if ((self.weapon == 9)) + { + newmis.touch = FlashGrenadeTouch; + newmis.think = FlashGrenadeExplode; + newmis.skin = 2; + newmis.avelocity = '300 300 300'; + setmodel (newmis, "progs/hgren2.mdl"); + } + } + } + } + } + } + } + } + } + setsize (newmis, '0 0 0', '1 1 1'); + setorigin (newmis, _l_10249.origin); + _l_10251 = self; + self = self.owner; + self = _l_10251; + dremove (self); +}; + + +void() TeamFortress_ThrowGrenade = +{ + if (!(self.tfstate & 1)) + { + return; + } + sound(self, 3, "weapons/throw.wav", 1, 1); + self.tfstate = self.tfstate | 1024; +}; + +float(float pc) IsLegalClass = +{ + local float bit; + if (spy_off == 1 && pc == 8) + { + return 0; + } + if (pc == 1) + { + bit = 1; + } + else + { + if (pc == 2) + { + bit = 2; + } + else + { + if (pc == 3) + { + bit = 4; + } + else + { + if (pc == 4) + { + bit = 8; + } + else + { + if (pc == 5) + { + bit = 16; + } + else + { + if (pc == 6) + { + bit = 32; + } + else + { + if (pc == 7) + { + bit = 64; + } + else + { + if (pc == 8) + { + bit = 256; + } + else + { + if (pc == 9) + { + bit = 512; + } + else + { + if (pc == 10) + { + bit = 128; + } + } + } + } + } + } + } + } + } + } + if (illegalclasses & bit || (TeamFortress_TeamGetIllegalClasses(self.team_no) & bit)) + { + return 0; + } + return 1; +}; + +void(entity p) TeamFortress_SetSpeed = +{ + local string sp; + local float tf; + local entity te; + stuffcmd(p, "cl_movespeedkey 1\n"); + if (p.playerclass == 1) + { + p.maxspeed = 400; + p.maxfbspeed = 400; + p.maxstrafespeed = 400; + } + else + { + if (p.playerclass == 2) + { + p.maxspeed = 300; + p.maxfbspeed = 300; + p.maxstrafespeed = 300; + } + else + { + if (p.playerclass == 3) + { + p.maxspeed = 250; + p.maxfbspeed = 250; + p.maxstrafespeed = 250; + } + else + { + if (p.playerclass == 4) + { + p.maxspeed = 280; + p.maxfbspeed = 280; + p.maxstrafespeed = 280; + } + else + { + if (p.playerclass == 5) + { + p.maxspeed = 320; + p.maxfbspeed = 320; + p.maxstrafespeed = 320; + } + else + { + if (p.playerclass == 6) + { + p.maxfbspeed = 230; + p.maxspeed = 230; + p.maxstrafespeed = 230; + } + else + { + if (p.playerclass == 7) + { + p.maxspeed = 300; + p.maxfbspeed = 300; + p.maxstrafespeed = 300; + } + else + { + if (p.playerclass == 11) + { + p.maxspeed = 500; + p.maxfbspeed = 500; + p.maxstrafespeed = 500; + } + else + { + if (p.playerclass == 8) + { + p.maxspeed = 300; + p.maxfbspeed = 300; + p.maxstrafespeed = 300; + } + else + { + if (p.playerclass == 9) + { + p.maxspeed = 300; + p.maxfbspeed = 300; + p.maxstrafespeed = 300; + } + else + { + if (p.playerclass == 0) + { + p.gravity = 0; + p.maxspeed = 500; + p.maxfbspeed = 500; + p.maxstrafespeed = 500; + return; + } + } + } + } + } + } + } + } + } + } + } + if (p.tfstate & 65536 || p.playerclass == 0) + { + p.maxspeed = 0; + p.maxfbspeed = 0; + p.maxstrafespeed = 0; +// if (1 == 1) +// { + stuffcmd(p, "m_forward 0\n"); + stuffcmd(p, "m_side 0\n"); +// } + p.velocity = '0 0 0'; + stuffcmd(p, "cl_backspeed 0\n"); + stuffcmd(p, "cl_forwardspeed 0\n"); + stuffcmd(p, "cl_sidespeed 0\n"); + return; + } + else + { +// if (1 == 1) +// { + stuffcmd(p, "m_forward 1\n"); + stuffcmd(p, "m_side 0.8\n"); +// } + } + tf = 0; + te = find(world, classname, "item_tfgoal"); + while (te != world && tf == 0) + { + if (te.owner == p) + { + if (te.goal_activation & 2) + { + tf = 1; + p.maxfbspeed = p.maxfbspeed / 2; + p.maxstrafespeed = p.maxstrafespeed / 2; + p.maxspeed = p.maxfbspeed; + } + } + te = find(te, classname, "item_tfgoal"); + } + if (p.tfstate & 32768) + { + p.maxfbspeed = p.maxfbspeed / 5 * 2; + p.maxstrafespeed = p.maxstrafespeed / 5 * 2; + p.maxspeed = p.maxfbspeed; + } + if (p.leg_damage) + { + if (p.leg_damage > 4) + { + p.leg_damage = 4; + } + p.maxfbspeed = p.maxfbspeed * ((10 - p.leg_damage) / 20); + p.maxstrafespeed = p.maxstrafespeed * (10 - p.leg_damage) / 20; + p.maxspeed = p.maxfbspeed; + } + if (p.tfstate & 2048) + { + if (p.maxfbspeed > 60) + { + p.maxfbspeed = 60; + p.maxspeed = p.maxfbspeed; + } + if (p.maxstrafespeed > 60) + { + p.maxstrafespeed = 60; + } + } + + // hwguy firing ac state by pablo. + if (p.tfstate & 131072) + { + if (p.maxspeed > 80) + { + p.maxspeed = 80; + } + } + + sp = ftos(p.maxfbspeed); + stuffcmd(p, "cl_backspeed "); + stuffcmd(p, sp); + stuffcmd(p, "\n"); + stuffcmd(p, "cl_forwardspeed "); + stuffcmd(p, sp); + stuffcmd(p, "\n"); + sp = ftos(p.maxstrafespeed); + stuffcmd(p, "cl_sidespeed "); + stuffcmd(p, sp); + stuffcmd(p, "\n"); +}; + +void() TeamFortress_SetHealth = +{ + if (self.playerclass == 1) + { + self.max_health = 100; + } + else + { + if (self.playerclass == 2) + { + self.max_health = 90; + } + else + { + if (self.playerclass == 3) + { + self.max_health = 100; + } + else + { + if (self.playerclass == 4) + { + self.max_health = 90; + } + else + { + if (self.playerclass == 5) + { + self.max_health = 90; + } + else + { + if (self.playerclass == 6) + { + self.max_health = 100; + } + else + { + if (self.playerclass == 7) + { + self.max_health = 100; + } + else + { + if (self.playerclass == 11) + { + self.max_health = 50; + } + else + { + if (self.playerclass == 8) + { + self.max_health = 90; + } + else + { + if (self.playerclass == 9) + { + self.max_health = 80; + } + else + { + if (self.playerclass == 0) + { + self.max_health = 1; + self.takedamage = 0; + } + } + } + } + } + } + } + } + } + } + } + self.health = self.max_health; +}; + +void(entity p) TeamFortress_SetSkin = +{ + self.immune_to_check = time + 20; + if (p.playerclass == 8 && p.undercover_skin != 0) + { + p.skin = p.undercover_skin; + } + else + { + p.skin = p.playerclass; + } + if (p.skin != 0) + { + stuffcmd(p, "skin "); + if (p.team_no == 4) + { + if (p.skin == 1) + { + stuffcmd(p, "airscout\n"); + } + else + { + if (p.skin == 2) + { + stuffcmd(p, "tf_snipe\n"); + } + else + { + if (p.skin == 3) + { + stuffcmd(p, "tf_sold\n"); + } + else + { + if (p.skin == 4) + { + stuffcmd(p, "tf_demo\n"); + } + else + { + if (p.skin == 5) + { + stuffcmd(p, "tf_medic\n"); + } + else + { + if (p.skin == 6) + { + stuffcmd(p, "tf_hwguy\n"); + } + else + { + if (p.skin == 7) + { + stuffcmd(p, "tf_pyro\n"); + } + else + { + if (p.skin == 8) + { + stuffcmd(p, "tf_spy\n"); + } + else + { + if (p.skin == 9) + { + stuffcmd(p, "tf_eng\n"); + } + } + } + } + } + } + } + } + } + } + else + { + if (p.team_no == 3) + { + if (p.skin == 1) + { + stuffcmd(p, "airscout\n"); + } + else + { + if (p.skin == 2) + { + stuffcmd(p, "tf_snipe\n"); + } + else + { + if (p.skin == 3) + { + stuffcmd(p, "tf_sold\n"); + } + else + { + if (p.skin == 4) + { + stuffcmd(p, "tf_demo\n"); + } + else + { + if (p.skin == 5) + { + stuffcmd(p, "tf_medic\n"); + } + else + { + if (p.skin == 6) + { + stuffcmd(p, "tf_hwguy\n"); + } + else + { + if (p.skin == 7) + { + stuffcmd(p, "tf_pyro\n"); + } + else + { + if (p.skin == 8) + { + stuffcmd(p, "tf_spy\n"); + } + else + { + if (p.skin == 9) + { + stuffcmd(p, "tf_eng\n"); + } + } + } + } + } + } + } + } + } + } + else + { + if (p.team_no == 2) + { + if (p.skin == 1) + { + stuffcmd(p, "airscout\n"); + } + else + { + if (p.skin == 2) + { + stuffcmd(p, "tf_snipe\n"); + } + else + { + if (p.skin == 3) + { + stuffcmd(p, "tf_sold\n"); + } + else + { + if (p.skin == 4) + { + stuffcmd(p, "tf_demo\n"); + } + else + { + if (p.skin == 5) + { + stuffcmd(p, "tf_medic\n"); + } + else + { + if (p.skin == 6) + { + stuffcmd(p, "tf_hwguy\n"); + } + else + { + if (p.skin == 7) + { + stuffcmd(p, "tf_pyro\n"); + } + else + { + if (p.skin == 8) + { + stuffcmd(p, "tf_spy\n"); + } + else + { + if (p.skin == 9) + { + stuffcmd(p, "tf_eng\n"); + } + } + } + } + } + } + } + } + } + } + else + { + if (p.skin == 1) + { + stuffcmd(p, "airscout\n"); + } + else + { + if (p.skin == 2) + { + stuffcmd(p, "tf_snipe\n"); + } + else + { + if (p.skin == 3) + { + stuffcmd(p, "tf_sold\n"); + } + else + { + if (p.skin == 4) + { + stuffcmd(p, "tf_demo\n"); + } + else + { + if (p.skin == 5) + { + stuffcmd(p, "tf_medic\n"); + } + else + { + if (p.skin == 6) + { + stuffcmd(p, "tf_hwguy\n"); + } + else + { + if (p.skin == 7) + { + stuffcmd(p, "tf_pyro\n"); + } + else + { + if (p.skin == 8) + { + stuffcmd(p, "tf_spy\n"); + } + else + { + if (p.skin == 9) + { + stuffcmd(p, "tf_eng\n"); + } + } + } + } + } + } + } + } + } + } + } + } + if (p.skin == 11) + { + stuffcmd(p, "base\n"); + } + } + else + { + stuffcmd(p, "skin base\n"); + } +}; + +void() TeamFortress_SetEquipment = +{ + local entity te; + local string st; + local float kept_items; + local entity grenfinder; + if (self.classname != "player") + { + return; + } + kept_items = self.tf_items & (131072 | 262144); + self.items = 0; + self.current_weapon = 0; + self.weapons_carried = 0; + self.tf_items = 0; + self.tf_items_flags = 0; + self.armorclass = 0; + self.impulse = 0; + self.undercover_skin = 0; + stuffcmd(self, "fov 90\n"); + if (self.undercover_team != 0) + { + self.immune_to_check = time + 5; + self.undercover_team = 0; + stuffcmd(self, "color "); + st = ftos(TeamFortress_TeamGetColor(self.team_no) - 1); + stuffcmd(self, st); + stuffcmd(self, "\n"); + } + self.is_building = 0; + self.is_detpacking = 0; + self.is_undercover = 0; + self.is_feigning = 0; + self.is_unabletospy = 0; + self.ammo_medikit = 0; + self.maxammo_medikit = 0; + self.ammo_detpack = 0; + self.maxammo_detpack = 0; + self.items_allowed = 0; + self.armor_allowed = 0; + self.maxarmor = 0; + self.weaponmode = 0; + self.respawn_time = 0; + self.heat = 0; + self.tfstate = self.tfstate - (self.tfstate & 2); +//this finds a primed grenade and removes it. + grenfinder = find (world,classname,"aprimedgrenade"); + while (grenfinder) + { + if ((grenfinder.owner == self)) + { + dremove (grenfinder); + } + grenfinder = find (grenfinder, classname, "aprimedgrenade"); + } + if (self.team_no == 0) + { + self.lives = -1; + } + self.items = self.items | kept_items; +// if (toggleflags & 2) +// { +// te = spawn(); +// te.nextthink = time + 4; +// te.think = TeamFortress_CheckforCheats; +// te.owner = self; +// te.classname = "timer"; // class specifics +// } + if (self.playerclass == 1) + { + self.weapons_carried = (self.weapons_carried | 656); + self.ammo_rockets = 0; + self.ammo_nails = 100; + self.ammo_shells = 25; + self.ammo_cells = 50; + self.maxammo_rockets = 25; + self.maxammo_nails = 200; + self.maxammo_shells = 50; + self.maxammo_cells = 100; + self.no_grenades_1 = 2; + self.no_grenades_2 = 3; + self.tp_grenades_1 = 9; + self.tp_grenades_2 = 2; + self.tf_items = 1; + self.tf_items_flags = (self.tf_items_flags | 1); + self.armorclass = (self.armorclass | 0); + self.armortype = 0.300000; + self.armorvalue = 25; + self.armor_allowed = 0.300000; + self.maxarmor = 50; + self.current_weapon = 512; + self.items_allowed = 656; + self.items = (self.items | 5); + } + else + { + if (self.playerclass == 2) + { + self.weapons_carried = (self.weapons_carried | 624); + self.ammo_rockets = 0; + self.ammo_nails = 50; + self.ammo_shells = 60; + self.ammo_cells = 25; + self.maxammo_rockets = 25; + self.maxammo_nails = 100; + self.maxammo_shells = 75; + self.maxammo_cells = 50; + self.no_grenades_1 = 2; + self.no_grenades_2 = 3; + self.tp_grenades_1 = 1; + self.tp_grenades_2 = 6; + self.tf_items = 0; + self.armorclass = (self.armorclass | 0); + self.armortype = 0.300000; + self.armorvalue = 0; + self.armor_allowed = 0.300000; + self.maxarmor = 50; + self.current_weapon = 32; + self.items_allowed = 624; + self.items = (self.items | 7); + } + else + { + if (self.playerclass == 3) + { + self.weapons_carried = (self.weapons_carried | 8592); + self.ammo_rockets = 25; + self.ammo_nails = 0; + self.ammo_shells = 50; + self.ammo_cells = 0; + self.maxammo_rockets = 50; + self.maxammo_nails = 100; + self.maxammo_shells = 100; + self.maxammo_cells = 50; + self.no_grenades_1 = 4; + self.no_grenades_2 = 1; + self.tp_grenades_1 = 1; + self.tp_grenades_2 = 3; + self.tf_items = 0; + self.armorclass = (self.armorclass | 0); + self.armortype = 0.800000; + self.armorvalue = 100; + self.armor_allowed = 0.800000; + self.maxarmor = 200; + self.current_weapon = 8192; + self.items_allowed = 8592; + self.items = (self.items | 35); + } + else + { + if (self.playerclass == 4) + { + self.weapons_carried = (self.weapons_carried | 133264); + self.ammo_rockets = 25; + self.ammo_nails = 0; + self.ammo_shells = 30; + self.ammo_cells = 0; + self.maxammo_rockets = 50; + self.maxammo_nails = 50; + self.maxammo_shells = 75; + self.maxammo_cells = 50; + self.no_grenades_1 = 4; + self.no_grenades_2 = 2; + self.tp_grenades_1 = 1; + self.tp_grenades_2 = 4; + self.tf_items = 0; + self.ammo_detpack = 1; + self.maxammo_detpack = 1; + self.armorclass = (self.armorclass | 4); + self.armortype = 0.600000; + self.armorvalue = 50; + self.armor_allowed = 0.600000; + self.maxarmor = 100; + self.current_weapon = 2048; + self.items_allowed = 133264; + self.items = (self.items | 17); + } + else + { + if (self.playerclass == 5) + { + self.weapons_carried = (self.weapons_carried | 1414); + self.ammo_rockets = 0; + self.ammo_nails = 150; + self.ammo_shells = 50; + self.ammo_cells = 0; + self.maxammo_rockets = 25; + self.maxammo_nails = 250; + self.maxammo_shells = 75; + self.maxammo_cells = 60; + self.no_grenades_1 = 3; + self.no_grenades_2 = 2; + self.tp_grenades_1 = 1; + self.tp_grenades_2 = 2; + self.tf_items = 0; + self.armorclass = (self.armorclass | 0); + self.armortype = 0.300000; + self.armorvalue = 50; + self.armor_allowed = 0.600000; + self.maxarmor = 100; + self.current_weapon = 1024; + self.ammo_medikit = 200; + self.maxammo_medikit = 200; + te = spawn(); + te.nextthink = time + 2; + te.think = TeamFortress_Regenerate; + te.owner = self; + te.classname = "timer"; + self.items_allowed = 2 | 4 | 128 | 256 | 1024; + self.items = self.items | 1 | 2 | 8; + } + else + { + if (self.playerclass == 6) + { + self.weapons_carried = (self.weapons_carried | 33680); + self.ammo_rockets = 0; + self.ammo_nails = 100; + self.ammo_shells = 200; + self.ammo_cells = 24; + self.maxammo_rockets = 10; + self.maxammo_nails = 250; + self.maxammo_shells = 250; + self.maxammo_cells = 50; + self.no_grenades_1 = 4; + self.no_grenades_2 = 1; + self.tp_grenades_1 = 1; + self.tp_grenades_2 = 4; + self.tf_items = 0; + self.armorclass = (self.armorclass | 0); + self.armortype = 0.800000; + self.armorvalue = 150; + self.armor_allowed = 0.800000; + self.maxarmor = 300; + self.current_weapon = 32768; + self.items_allowed = 33680; + self.items = (self.items | 39); + } + else + { + if (self.playerclass == 7) + { + self.weapons_carried = (self.weapons_carried | 20624); + self.ammo_rockets = 20; + self.ammo_nails = 0; + self.ammo_shells = 20; + self.ammo_cells = 150; + self.maxammo_rockets = 40; + self.maxammo_nails = 50; + self.maxammo_shells = 40; + self.maxammo_cells = 250; + self.no_grenades_1 = 1; + self.no_grenades_2 = 4; + self.tp_grenades_1 = 1; + self.tp_grenades_2 = 5; + self.tf_items = 0; + self.armorclass = (self.armorclass | 16); + self.armortype = 0.500000; + self.armorvalue = 70; + self.armor_allowed = 0.800000; + self.maxarmor = 150; + self.current_weapon = 4096; + self.items_allowed = 20624; + self.items = (self.items | 49); + } + else + { + if (self.playerclass == 11) + { + self.weapons_carried = (self.weapons_carried | 16); + self.ammo_rockets = 0; + self.ammo_nails = 0; + self.ammo_shells = 0; + self.ammo_cells = 0; + self.maxammo_rockets = 0; + self.maxammo_nails = 0; + self.maxammo_shells = 0; + self.maxammo_cells = 0; + self.no_grenades_1 = 0; + self.no_grenades_2 = 0; + self.tp_grenades_1 = 0; + self.tp_grenades_2 = 0; + self.tf_items = 0; + self.armorclass = (self.armorclass | 0); + self.armortype = 0; + self.armorvalue = 0; + self.armor_allowed = 0; + self.maxarmor = 0; + self.current_weapon = 16; + self.items_allowed = 16; + self.items = 0; + } + else + { + if (self.playerclass == 8) + { + self.weapons_carried = (self.weapons_carried | 262928); + self.ammo_rockets = 0; + self.ammo_nails = 25; + self.ammo_shells = 40; + self.ammo_cells = 30; + self.maxammo_rockets = 15; + self.maxammo_nails = 50; + self.maxammo_shells = 40; + self.maxammo_cells = 30; + self.no_grenades_1 = 2; + self.no_grenades_2 = 2; + self.tp_grenades_1 = 1; + self.tp_grenades_2 = 7; + self.tf_items = 0; + self.armorclass = (self.armorclass | 0); + self.armortype = 0.300000; + self.armorvalue = 25; + self.armor_allowed = 0.300000; + self.maxarmor = 100; + self.current_weapon = 262144; + self.items_allowed = 262928; + self.items = (self.items | 71); + if ((invis_only == 1)) + { + te = spawn(); + te.nextthink = time + 5; + te.think = TeamFortress_RegenerateCells; + te.owner = self; + te.classname = "timer"; + } + } + else + { + if (self.playerclass == 9) + { + self.weapons_carried = (self.weapons_carried | 524552); + self.ammo_rockets = 0; + self.ammo_nails = 25; + self.ammo_shells = 20; + self.ammo_cells = 100; + self.maxammo_rockets = 30; + self.maxammo_nails = 50; + self.maxammo_shells = 50; + self.maxammo_cells = 200; + self.no_grenades_1 = 2; + self.no_grenades_2 = 2; + self.tp_grenades_1 = 1; + self.tp_grenades_2 = 8; + self.tf_items = 0; + self.armorclass = (self.armorclass | 0); + self.armortype = 0.300000; + self.armorvalue = 25; + self.armor_allowed = 0.600000; + self.maxarmor = 50; + self.current_weapon = 524288; + self.items_allowed = 524552; + self.items = (self.items | 3); + self.weaponmode = 1; + } + else + { + if (self.playerclass == 0) + { + self.items = 0; + self.ammo_rockets = 0; + self.ammo_nails = 0; + self.ammo_shells = 0; + self.ammo_cells = 0; + self.no_grenades_1 = 0; + self.no_grenades_2 = 0; + self.tp_grenades_1 = 0; + self.tp_grenades_2 = 0; + self.armorclass = 0; + self.armortype = 0; + self.armorvalue = 0; + self.weapon = 0; + self.current_weapon = 0; + self.weapons_carried = 0; + self.flags = 8 | 128; + self.waterlevel = 3; + self.takedamage = 0; + self.solid = 0; + self.movetype = 8; + self.model = string_null; + self.mdl = string_null; + self.modelindex = 0; + self.weaponmodel = string_null; + modelindex_player = 0; + self.tfstate = self.tfstate | 2; + setmodel(self, string_null); + } + } + } + } + } + } + } + } + } + } + } + if (self.playerclass != 0) + { + self.has_syringe = 1; + self.has_holo = 1; + self.option = 0; + self.option4 = 0; + self.option3 = 1; + self.gravity = 1; + if (exec_class) + { + if (self.playerclass == 1) + { + stuffcmd(self, "exec scout.cfg\n"); + } + else + { + if (self.playerclass == 2) + { + stuffcmd(self, "exec sniper.cfg\n"); + } + else + { + if (self.playerclass == 3) + { + stuffcmd(self, "exec soldier.cfg\n"); + } + else + { + if (self.playerclass == 4) + { + stuffcmd(self, "exec demoman.cfg\n"); + } + else + { + if (self.playerclass == 5) + { + stuffcmd(self, "exec medic.cfg\n"); + } + else + { + if (self.playerclass == 6) + { + stuffcmd(self, "exec hwguy.cfg\n"); + } + else + { + if (self.playerclass == 7) + { + stuffcmd(self, "exec pyro.cfg\n"); + } + else + { + if (self.playerclass == 8) + { + stuffcmd(self, "exec spy.cfg\n"); + } + else + { + if (self.playerclass == 9) + { + stuffcmd(self, "exec engineer.cfg\n"); + } + else + { + if (self.playerclass == 11) + { + stuffcmd(self, "exec civilian.cfg\n"); + } + } + } + } + } + } + } + } + } + } + } + if ((self.stats_on == 1)) + { + stuffcmd (self, "exec progs/stats.cfg\n"); + } + } + else + { + self.has_syringe = 0; + } + self.vision = 0; + self.gravity = 1; + if (self.armortype >= 0.8) + { + self.items = self.items | 32768; + } + else + { + if (self.armortype >= 0.6) + { + self.items = self.items | 16384; + } + else + { + if (self.armortype >= 0.3) + { + self.items = self.items | 8192; + } + } + } + if (self.playerclass == 8) + { + self.weapons_carried = self.weapons_carried | 1; + allow_hook = 1; + st = infokey(world, "sg"); + if (st == string_null) + { + st = infokey(world, "spygrapple"); + } + if (st == "off") + { + allow_hook = 0; + } + } + if (self.playerclass != 0) + { + self.weapons_carried = self.weapons_carried | 16; + } + W_SetCurrentAmmo(); +}; + +float(entity Retriever, float AmmoType) TeamFortress_GetMaxAmmo = +{ + if (AmmoType == 256) + { + return Retriever.maxammo_shells; + } + else + { + if (AmmoType == 512) + { + return Retriever.maxammo_nails; + } + else + { + if (AmmoType == 2048) + { + return Retriever.maxammo_cells; + } + else + { + if (AmmoType == 1024) + { + return Retriever.maxammo_rockets; + } + else + { + if (AmmoType == 4) + { + return Retriever.maxammo_medikit; + } + else + { + if (AmmoType == 131072) + { + return Retriever.maxammo_detpack; + } + } + } + } + } + } + dprint("Error in TeamFortress_GetMaxAmmo()\n"); + dprint("Invalid ammo type passed.\n"); + return 0; +}; + +float(entity Retriever, float WeaponType) TeamFortress_CanGetWeapon = +{ + if (Retriever.items_allowed & WeaponType) + { + return 1; + } + return 0; +}; + +void(entity Player, float Armorclass) TeamFortress_DescribeArmor = +{ + if (Armorclass == 0) + { + return; + } + if (Armorclass & 16) + { + sprint(Player, 2, "Asbestos "); + } + if (Armorclass & 2) + { + sprint(Player, 2, "Wooden "); + } + if (Armorclass & 4) + { + sprint(Player, 2, "Blast "); + } + if (Armorclass & 8) + { + sprint(Player, 2, "Shockproof "); + } + if (Armorclass & 1) + { + sprint(Player, 2, "Kevlar "); + } + sprint(Player, 2, "armor\n"); +}; + +// pablo. never called? +float(entity Retriever, entity Items) TeamFortress_AddBackpackItems = +{ + return 0; +}; + +string(float pc) TeamFortress_GetClassName = +{ + if (pc == 1) + { + return "Scout"; + } + else + { + if (pc == 2) + { + return "Sniper"; + } + else + { + if (pc == 3) + { + return "Soldier"; + } + else + { + if (pc == 4) + { + return "Demolitions Man"; + } + else + { + if (pc == 5) + { + return "Combat Medic"; + } + else + { + if (pc == 6) + { + return "Heavy Weapons Guy"; + } + else + { + if (pc == 7) + { + return "Pyro"; + } + else + { + if (pc == 8) + { + return "Spy"; + } + else + { + if (pc == 9) + { + return "Engineer"; + } + else + { + if (pc == 11) + { + return "Civilian"; + } + else + { + if (pc == 0) + { + return "Observer"; + } + else + { + if (pc == 10) + { + return "Random Playerclass"; + } + } + } + } + } + } + } + } + } + } + } + } + return "Invalid Class"; +}; + +void(entity Viewer, float pc, float rpc, float xavior_Var) TeamFortress_PrintClassName = +{ + local string st; + st = TeamFortress_GetClassName(pc); + sprint(Viewer, 2, st); + if (rpc != 0) + { + sprint(Viewer, 2, " (Random)"); + } + if (xavior_Var == 2) + { + sprint(Viewer, 2, "‘\n"); + } + else + { + sprint(Viewer, 2, "\n"); + } +}; + +void() TeamFortress_RemoveTimers = +{ + local entity te; + self.leg_damage = 0; + self.is_undercover = 0; + self.is_building = 0; + self.building = world; + if (self.tfstate & 2048) + { + self.tfstate = self.tfstate - 2048; + TeamFortress_SetSpeed(self); + self.heat = 0; + } + te = find(world, classname, "timer"); + while (te != world) + { + if (te.owner == self) + { + dremove(te); + te = find(world, classname, "timer"); + } + else + { + te = find(te, classname, "timer"); + } + } + te = find(world, classname, "item_tfgoal"); + while (te) + { + if (te.owner == self) + { + if (!(te.goal_activation & 256)) + { + tfgoalitem_RemoveFromPlayer(te, self, 0); + } + if (CTF_Map == 1 && te.goal_no == 1) + { + bprint(2, self.netname); + bprint(2, " ÌÏÓÔ the ÂÌÕÅ flag!\n"); + } + else + { + if (CTF_Map == 1 && te.goal_no == 2) + { + bprint(2, self.netname); + bprint(2, " ÌÏÓÔ the ÒÅÄ flag!\n"); + } + } + } + te = find(te, classname, "item_tfgoal"); + } + te = find(world, classname, "detpack"); + while (te) + { + if (te.weaponmode == 1 && te.enemy == self) + { + te.weaponmode = 0; + } + te = find(te, classname, "detpack"); + } +// TeamFortress_DetonatePipebombs(); gold. this is the old code for removing pipebombs on quitting. new one written by pablo is below. + te = find(world, classname, "pipebomb"); + while (te != world) + { + if(te.owner == self) + { + decrement_team_pipebombs(self.team_no); + deathmsg = te.weapon; + te.weapon = 10; + T_RadiusDamage(te, self, 120, world); + WriteByte(4, 23); + WriteByte(4, 3); + WriteCoord(4, te.origin_x); + WriteCoord(4, te.origin_y); + WriteCoord(4, te.origin_z); + multicast(te.origin, TF_FLARE_OFF); + dremove(te); + } + te = find(te, classname, "pipebomb"); + } + stuffcmd(self, "v_idlescale 0\n"); + stuffcmd(self, "v_cshift 0 0 0 0\n"); + self.item_list = 0; + self.FlashTime = 0; + CenterPrint(self, "\n"); + self.menu_count = 25; + self.current_menu = 1; + self.impulse = 0; +}; + +void(float Suicided) TeamFortress_SetupRespawn = +{ + local float restime; + local string db; + if (self.respawn_time > time) + { + return; + } + if (toggleflags & 4) + { + restime = respawn_delay_time; + } + else + { + restime = 0; + } + if (Suicided) + { + if (self.lives > 0) + { + self.lives = self.lives - 1; + } + restime = restime + 5; + } + if (self.lives > 0) + { + self.lives = self.lives - 1; + } + if (self.lives != -1) + { + if (self.lives == 0) + { + sprint(self, 2, "NO lives left, returning to Observer mode.\n"); + self.playerclass = 0; + self.tfstate = self.tfstate - (self.tfstate & 8); + self.movetype = 8; + self.solid = 0; + self.model = ""; + self.mdl = ""; + self.velocity = '0 0 0'; + self.avelocity = '0 0 0'; + self.enemy = world; + setmodel(self, ""); + return; + } + if (self.lives == 1) + { + sprint(self, 2, "LAST life.\n"); + } + else + { + db = ftos(self.lives); + sprint(self, 2, db); + sprint(self, 2, " lives left.\n"); + } + } + self.respawn_time = time + restime; + if (restime > 3) + { + db = ftos(restime); + sprint(self, 2, db); + sprint(self, 2, " seconds till respawn.\n"); + } +}; + +void() TeamFortress_CheckClassStats = +{ + if (self.armortype > self.armor_allowed) + { + self.armortype = self.armor_allowed; + } + if (self.armorvalue > self.maxarmor) + { + self.armorvalue = self.maxarmor; + } + if (self.armortype < 0) + { + self.armortype = 0; + } + if (self.armorvalue < 0) + { + self.armorvalue = 0; + } + if (self.ammo_shells > TeamFortress_GetMaxAmmo(self, 256)) + { + self.ammo_shells = TeamFortress_GetMaxAmmo(self, 256); + } + if (self.ammo_shells < 0) + { + self.ammo_shells = 0; + } + if (self.ammo_nails > TeamFortress_GetMaxAmmo(self, 512)) + { + self.ammo_nails = TeamFortress_GetMaxAmmo(self, 512); + } + if (self.ammo_nails < 0) + { + self.ammo_nails = 0; + } + if (self.ammo_rockets > TeamFortress_GetMaxAmmo(self, 1024)) + { + self.ammo_rockets = TeamFortress_GetMaxAmmo(self, 1024); + } + if (self.ammo_rockets < 0) + { + self.ammo_rockets = 0; + } + if (self.ammo_cells > TeamFortress_GetMaxAmmo(self, 2048)) + { + self.ammo_cells = TeamFortress_GetMaxAmmo(self, 2048); + } + if (self.ammo_cells < 0) + { + self.ammo_cells = 0; + } + if (self.ammo_medikit > TeamFortress_GetMaxAmmo(self, 4)) + { + self.ammo_medikit = TeamFortress_GetMaxAmmo(self, 4); + } + if (self.ammo_medikit < 0) + { + self.ammo_medikit = 0; + } + if (self.ammo_detpack > TeamFortress_GetMaxAmmo(self, 131072)) + { + self.ammo_detpack = TeamFortress_GetMaxAmmo(self, 131072); + } + if (self.ammo_detpack < 0) + { + self.ammo_detpack = 0; + } + if (self.no_grenades_1 < 0) + { + self.no_grenades_1 = 0; + } + if (self.no_grenades_2 < 0) + { + self.no_grenades_2 = 0; + } + if (self.health > self.max_health && !(self.items & 65536)) + { + TF_T_Damage(self, world, world, self.max_health - self.health, 0, 256); + } + if (self.health < 0) + { + T_Heal(self, self.health - self.health, 0); + } + self.items = self.items - (self.items & (8192 | 16384 | 32768)); + if (self.armortype >= 0.8) + { + self.items = self.items | 32768; + } + else + { + if (self.armortype >= 0.6) + { + self.items = self.items | 16384; + } + else + { + if (self.armortype >= 0.3) + { + self.items = self.items | 8192; + } + } + } +}; + +void (float _p_10461) TeamFortress_DropAmmo = +{ + local float _l_10462; + + if ((_p_10461 == 1)) + { + _l_10462 = 20; + if ((self.ammo_shells < _l_10462)) + { + if ((self.playerclass == 9)) + { + if (((self.ammo_cells / 3) > (_l_10462 - self.ammo_shells))) + { + sprint (self, 2, "you make some shells.\n"); + self.ammo_cells = (self.ammo_cells - ((_l_10462 - self.ammo_shells) * 3)); + self.ammo_shells = _l_10462; + } + } + if ((self.ammo_shells < _l_10462)) + { + return; + } + } + self.ammo_shells = (self.ammo_shells - _l_10462); + } + else + { + if ((_p_10461 == 2)) + { + _l_10462 = 20; + if ((self.ammo_nails < _l_10462)) + { + if ((self.playerclass == 9)) + { + if (((self.ammo_cells / 2) > (_l_10462 - self.ammo_nails))) + { + sprint (self, 2, "you make some nails.\n"); + self.ammo_cells = (self.ammo_cells - ((_l_10462 - self.ammo_nails) * 2)); + self.ammo_nails = _l_10462; + } + } + if ((self.ammo_nails < _l_10462)) + { + return; + } + } + self.ammo_nails = (self.ammo_nails - _l_10462); + } + else + { + if ((_p_10461 == 3)) + { + _l_10462 = 10; + if ((self.ammo_rockets < _l_10462)) + { + if ((self.playerclass == 9)) + { + if (((self.ammo_cells / 5) > (_l_10462 - self.ammo_rockets))) + { + sprint (self, 2, "you make some rockets.\n"); + self.ammo_cells = (self.ammo_cells - ((_l_10462 - self.ammo_rockets) * 5)); + self.ammo_rockets = _l_10462; + } + } + if ((self.ammo_rockets < _l_10462)) + { + return; + } + } + self.ammo_rockets = (self.ammo_rockets - _l_10462); + } + else + { + if ((_p_10461 == 4)) + { + _l_10462 = 10; + if ((self.ammo_cells < _l_10462)) + { + if ((self.playerclass == 9)) + { + if (((self.ammo_cells / 5) > (_l_10462 - self.ammo_cells))) + { + sprint (self, 2, "you make some cells.\n"); + self.ammo_cells = (self.ammo_cells - ((_l_10462 - self.ammo_cells) * 5)); + self.ammo_cells = _l_10462; + } + } + if ((self.ammo_cells < _l_10462)) + { + return; + } + } + self.ammo_cells = (self.ammo_cells - _l_10462); + } + } + } + } + if ((_p_10461 == 5)) + { + if ((self.no_grenades_1 < 1)) + { + return; + } + self.no_grenades_1 = (self.no_grenades_1 - 1); + } + if ((_p_10461 == 6)) + { + if ((self.no_grenades_2 < 1)) + { + return; + } + self.no_grenades_2 = (self.no_grenades_2 - 1); + } + W_SetCurrentAmmo (); + if ((self.team_no != 0)) + { + increment_team_ammoboxes (self.team_no); + if ((num_team_ammoboxes (self.team_no) > (20 / number_of_teams))) + { + RemoveOldAmmobox (self.team_no); + } + } + else + { + num_world_ammoboxes = num_world_ammoboxes + 1; + if ((num_world_ammoboxes > 20)) + { + RemoveOldAmmobox (0); + } + } + newmis = spawn (); + newmis.aflag = _l_10462; + newmis.weapon = _p_10461; + if ((newmis.weapon == 1)) + { + newmis.ammo_shells = _l_10462; + } + else + { + if ((newmis.weapon == 2)) + { + newmis.ammo_nails = _l_10462; + } + else + { + if ((newmis.weapon == 3)) + { + newmis.ammo_rockets = _l_10462; + } + else + { + if ((newmis.weapon == 4)) + { + newmis.ammo_cells = _l_10462; + } + } + } + } + if ((newmis.weapon == 5)) + { + newmis.no_grenades_1 = 1; + } + if ((newmis.weapon == 6)) + { + newmis.no_grenades_2 = 1; + } + newmis.enemy = self; + newmis.health = time; + newmis.movetype = 6; + newmis.solid = 1; + newmis.classname = "ammobox"; + newmis.team_no = self.team_no; + makevectors (self.v_angle); + if (self.v_angle_x) + { + newmis.velocity = ((v_forward * 400) + (v_up * 200)); + } + else + { + newmis.velocity = aim (self, 10000); + newmis.velocity = (newmis.velocity * 400); + newmis.velocity_z = 200; + } + newmis.avelocity = '0 300 0'; + setsize (newmis, '0 0 0', '0 0 0'); + setorigin (newmis, self.origin); + newmis.nextthink = (time + 30); + newmis.think = SUB_Remove; + newmis.touch = TeamFortress_AmmoboxTouch; + newmis.skin = (_p_10461 - 1); + sound (newmis, 3, "knight/sword2.wav", 1, 1); + if ((sr_dropgrens == 1)) + { + setmodel (newmis, "progs/ammobox2.mdl"); + } + else + { + setmodel (newmis, "progs/ammobox.mdl"); + } +}; + +void() TeamFortress_AmmoboxTouch = +{ + local float took; + local string quantity; + local entity _l_10486; + took = 0; + if (other == self.enemy && time < self.health + 2) + { + return; + } + if (other.classname != "player") + { + return; + } + if (other.health <= 0) + { + return; + } + num_world_ammoboxes = num_world_ammoboxes - 1; + decrement_team_ammoboxes(self.team_no); + if (self.weapon == 0) + { + sprint(other, 0, "You got "); + if (self.ammo_shells > 0) + { + other.ammo_shells = other.ammo_shells + self.ammo_shells; + quantity = ftos(self.ammo_shells); + sprint2(other, 0, quantity, " shells "); + } + if (self.ammo_nails > 0) + { + other.ammo_nails = other.ammo_nails + self.ammo_nails; + quantity = ftos(self.ammo_nails); + sprint2(other, 0, quantity, " nails "); + } + if (self.ammo_rockets > 0) + { + other.ammo_rockets = other.ammo_rockets + self.ammo_rockets; + quantity = ftos(self.ammo_rockets); + sprint2(other, 0, quantity, " rockets "); + } + if (self.ammo_cells > 0) + { + other.ammo_cells = other.ammo_cells + self.ammo_cells; + quantity = ftos(self.ammo_cells); + sprint2(other, 0, quantity, " cells "); + } + sprint(other, 0, "\n"); + } + else + { + if (self.weapon == 1) + { + if (other.ammo_shells >= TeamFortress_GetMaxAmmo(other, 256)) + { + return; + } + other.ammo_shells = other.ammo_shells + self.aflag; + self.netname = "shells"; + } + else + { + if (self.weapon == 2) + { + if (other.ammo_nails >= TeamFortress_GetMaxAmmo(other, 512)) + { + return; + } + other.ammo_nails = other.ammo_nails + self.aflag; + self.netname = "nails"; + } + else + { + if (self.weapon == 3) + { + if (other.ammo_rockets >= TeamFortress_GetMaxAmmo(other, 1024)) + { + return; + } + other.ammo_rockets = other.ammo_rockets + self.aflag; + self.netname = "rockets"; + } + else + { + if (self.weapon == 4) + { + if (other.ammo_cells >= TeamFortress_GetMaxAmmo(other, 2048)) + { + return; + } + other.ammo_cells = other.ammo_cells + self.aflag; + self.netname = "cells"; + } + } + } + } + } + bound_other_ammo(other); + if (self.weapon > 0) + { + quantity = ftos(self.aflag); + sprint5(other, 0, "You picked up ", quantity, " ", self.netname, "\n"); + } + sound(other, 3, "weapons/lock4.wav", 1, 1); + stuffcmd(other, "bf\n"); + if (other.autodiscard) + { + _l_10486 = self; + self = other; + TeamFortress_Discard (); + self = _l_10486; + } + dremove(self); + self = other; + W_SetCurrentAmmo(); +}; + +float(float tno) num_team_ammoboxes = +{ + if (tno == 1) + { + return num_team_ammoboxes_1; + } + else + { + if (tno == 2) + { + return num_team_ammoboxes_2; + } + else + { + if (tno == 3) + { + return num_team_ammoboxes_3; + } + else + { + if (tno == 4) + { + return num_team_ammoboxes_4; + } + } + } + } + return 0; +}; + +void(float tno) RemoveOldAmmobox = +{ + local float index; + if (tno != 0) + { + index = num_team_ammoboxes(tno); + index = index - 20 / number_of_teams; + } + else + { + index = num_world_ammoboxes - 20; + } + old = find(world, classname, "ammobox"); + while (index > 0) + { + if (old == world) + { + dprint("***\n"); + return; + } + if (old.team_no == tno || tno == 0) + { + old.think = SUB_Remove; + old.nextthink = time + 0.1; + index = index - 1; + num_world_ammoboxes = num_world_ammoboxes - 1; + decrement_team_ammoboxes(old.team_no); + } + old = find(old, classname, "ammobox"); + } +}; + +void(float tno) increment_team_ammoboxes = +{ + if (tno == 1) + { + num_team_ammoboxes_1 = num_team_ammoboxes_1 + 1; + } + else + { + if (tno == 2) + { + num_team_ammoboxes_2 = num_team_ammoboxes_2 + 1; + } + else + { + if (tno == 3) + { + num_team_ammoboxes_3 = num_team_ammoboxes_3 + 1; + } + else + { + if (tno == 4) + { + num_team_ammoboxes_4 = num_team_ammoboxes_4 + 1; + } + } + } + } +}; + +void(float tno) decrement_team_ammoboxes = +{ + if (tno == 1) + { + num_team_ammoboxes_1 = num_team_ammoboxes_1 - 1; + } + else + { + if (tno == 2) + { + num_team_ammoboxes_2 = num_team_ammoboxes_2 - 1; + } + else + { + if (tno == 3) + { + num_team_ammoboxes_3 = num_team_ammoboxes_3 - 1; + } + else + { + if (tno == 4) + { + num_team_ammoboxes_4 = num_team_ammoboxes_4 - 1; + } + } + } + } +}; + +/*void() TeamFortress_AssaultWeapon = +{ + local float it; + self.impulse = 0; + if (self.tfstate & 2) + { + return; + } + if (!(self.weapons_carried & 32768)) + { + return; + } + if (self.heat > 0) + { + sprint(self, 2, "the assault cannon is still overheated.\n"); + return; + } + if (self.ammo_shells < 1) + { + sprint(self, 2, "not enough ammo.\n"); + return; + } + if (self.ammo_cells < 6) + { + sprint(self, 2, "not enough cells to power the assault cannon.\n"); + return; + } + self.current_weapon = 32768; + W_SetCurrentAmmo(); +};*/ + +void() TeamFortress_ExplodePerson = +{ + local entity te; + self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & 1); + KickPlayer(-2, self.owner); + newmis = spawn(); + newmis.movetype = 10; + newmis.solid = 2; + newmis.classname = "grenade"; + newmis.team_no = self.owner.team_no; + newmis.owner = self.owner; + newmis.velocity = '0 0 0'; + newmis.angles = vectoangles(newmis.velocity); + newmis.think = SUB_Null; + newmis.nextthink = time + 0.1; + if (self.weapon == 1) + { + newmis.touch = NormalGrenadeTouch; + newmis.think = NormalGrenadeExplode; + newmis.skin = 0; + newmis.avelocity = '300 300 300'; + setmodel(newmis, "progs/hgren2.mdl"); + } + else + { + if (self.weapon == 2) + { + newmis.touch = ConcussionGrenadeTouch; + newmis.think = ConcussionGrenadeExplode; + newmis.skin = 1; + newmis.avelocity = '300 300 300'; + setmodel(newmis, "progs/hgren2.mdl"); + } + else + { + if (self.weapon == 3) + { + newmis.touch = NailGrenadeTouch; + newmis.think = NailGrenadeExplode; + newmis.skin = 1; + newmis.avelocity = '0 300 0'; + setmodel(newmis, "progs/biggren.mdl"); + } + else + { + if (self.weapon == 4) + { + newmis.touch = MirvGrenadeTouch; + newmis.think = MirvGrenadeExplode; + newmis.skin = 0; + newmis.avelocity = '0 300 0'; + setmodel(newmis, "progs/biggren.mdl"); + } + else + { + if (self.weapon == 5) + { + newmis.touch = NapalmGrenadeTouch; + newmis.think = NapalmGrenadeExplode; + newmis.skin = 2; + newmis.avelocity = '0 300 0'; + setmodel(newmis, "progs/biggren.mdl"); + } + else + { + if (self.weapon == 6) + { + sprint(self.owner, 2, "Flare lit.\n"); + te = spawn(); + te.touch = SUB_Null; + te.think = RemoveFlare; + te.nextthink = time + 25; + te.owner = self.owner; + te.solid = 0; + self.owner.effects = self.owner.effects | 4; + dremove(self); + dremove(newmis); + return; + } + else + { + if (self.weapon == 7) + { + newmis.touch = GasGrenadeTouch; + newmis.think = GasGrenadeExplode; + newmis.skin = 2; + newmis.avelocity = '300 300 300'; + setmodel(newmis, "progs/grenade2.mdl"); + } + else + { + if (self.weapon == 8) + { + newmis.touch = EMPGrenadeTouch; + newmis.think = EMPGrenadeExplode; + newmis.skin = 4; + newmis.avelocity = '300 300 300'; + setmodel(newmis, "progs/grenade2.mdl"); + } + else + { + if (self.weapon == 9) + { + newmis.touch = FlashGrenadeTouch; + newmis.think = FlashGrenadeExplode; + newmis.skin = 1; + newmis.avelocity = '300 300 300'; + setmodel(newmis, "progs/grenade2.mdl"); + } + } + } + } + } + } + } + } + } + setsize(newmis, '0 0 0', '0 0 0'); + setorigin(newmis, self.owner.origin); + bprint(1, "No "); + bprint(1, self.owner.netname); + bprint(1, ", throw the grenade, not the pin!\n"); + dremove(self); +}; + +void() NormalGrenadeTouch = +{ + if (other == self.owner) + { + return; + } + sound(self, 1, "weapons/bounce.wav", 1, 1); + if (self.velocity == '0 0 0') + { + self.avelocity = '0 0 0'; + } +}; + +void () NormalGrenadeExplode = +{ + + deathmsg = 8; + T_RadiusDamage (self, self.owner, 180, world); + WriteByte (4, 23); + WriteByte (4, 3); + WriteCoord (4, self.origin_x); + WriteCoord (4, self.origin_y); + WriteCoord (4, self.origin_z); + multicast (self.origin, 1); + BecomeExplosion (); + self.owner.active_grenades_1 = (self.owner.active_grenades_1 - 1); + dremove (self); +}; + +void() TeamFortress_DisplayDetectionItems = +{ + local entity Goal; + local entity te; + Goal = find(world, classname, "info_tfdetect"); + if (!Goal) + { + return; + } + if (Goal.team_str_home == string_null) + { + return; + } + if (Goal.display_item_status1 != 0) + { + te = Finditem(Goal.display_item_status1); + if (te) + { + DisplayItemStatus(Goal, self, te); + } + else + { + sprint(self, 2, "Item is missing.\n"); + } + } + else + { + return; + } + if (Goal.display_item_status2 != 0) + { + te = Finditem(Goal.display_item_status2); + if (te) + { + DisplayItemStatus(Goal, self, te); + } + else + { + sprint(self, 2, "Item is missing.\n"); + } + } + else + { + return; + } + if (Goal.display_item_status3 != 0) + { + te = Finditem(Goal.display_item_status3); + if (te) + { + DisplayItemStatus(Goal, self, te); + } + else + { + sprint(self, 2, "Item is missing.\n"); + } + } + else + { + return; + } + if (Goal.display_item_status4 != 0) + { + te = Finditem(Goal.display_item_status4); + if (te) + { + DisplayItemStatus(Goal, self, te); + } + else + { + sprint(self, 2, "Item is missing.\n"); + } + } +}; + +void() BioInfection_Decay = +{ + if (teamplay & 16 && self.owner.team_no == self.enemy.team_no && self.owner.team_no != 0) + { + self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & 16); + dremove(self); + return; + } + if (self.invincible_finished > time) + { + self.owner.tfstate = self.owner.tfstate - (self.owner.tfstate & 16); + dremove(self); + return; + } + self.nextthink = time + 2; + deathmsg = 13; + TF_T_Damage(self.owner, self, self.enemy, 5, 1, 0); + SpawnBlood(self.owner.origin, 30); + if (!(self.owner.tfstate & 16)) + { + dremove(self); + } +}; + +void() BioInfection_MonsterDecay = +{ + self.nextthink = time + 2; + T_Damage(self.enemy, self, self.owner, 5); + SpawnBlood(self.enemy.origin, 20); + if (self.enemy.health < 1) + { + dremove(self); + } +}; + +void(string halias, float himpulse1, float himpulse2) TeamFortress_Alias = +{ + local string imp; + stuffcmd(self, "alias "); + stuffcmd(self, halias); + stuffcmd(self, " \"impulse "); + imp = ftos(himpulse1); + stuffcmd(self, imp); + if (himpulse2 != 0) + { + stuffcmd(self, ";wait; impulse "); + imp = ftos(himpulse2); + stuffcmd(self, imp); + } + stuffcmd(self, "\"\n"); +}; + +void() TeamFortress_Regenerate = +{ + if (self.owner.playerclass == 5) + { + self.nextthink = time + 2; + if (self.owner.health >= self.owner.max_health - 2) + { + return; + } + if (self.owner.ammo_medikit == 0) + { + return; + } + if (self.owner.ammo_medikit < 2) + { + self.owner.health = self.owner.health + self.owner.ammo_medikit; + //self.owner.ammo_medikit = 0; + } + else + { + self.owner.health = self.owner.health + 2; + //self.owner.ammo_medikit = self.owner.ammo_medikit - 2; + } + if (self.owner.health > self.owner.max_health) + { + self.owner.health = self.owner.max_health; + } + } +}; + +void() TeamFortress_RegenerateCells = +{ + if (self.owner.playerclass == 8) + { + self.nextthink = time + 5; + if (self.owner.is_undercover == 1) + { + if (self.owner.ammo_cells == 0) + { + self.owner.is_undercover = 0; + self.owner.modelindex = modelindex_player; + self.owner.items = self.owner.items - (self.owner.items & 524288); + } + else + { + self.owner.ammo_cells = self.owner.ammo_cells - 3; + if (self.owner.ammo_cells < 0) + { + self.owner.ammo_cells = 0; + } + } + } + else + { + if (self.owner.ammo_cells >= self.owner.maxammo_cells) + { + return; + } + self.owner.ammo_cells = self.owner.ammo_cells + 1; + if (self.owner.ammo_cells > self.owner.maxammo_cells) + { + self.owner.ammo_cells = self.owner.maxammo_cells; + } + } + return; + } +}; + +void() PlayerObserverMode = +{ + self.current_menu = 1; + self.impulse = 0; + self.playerclass = 0; + self.lives = 0; + self.team_no = -1; + self.flags = 8 | 128 | 512; + self.waterlevel = 3; + self.takedamage = 0; + self.solid = 0; + self.movetype = 0; + self.immune_to_check = time + 2; + self.tfstate = self.tfstate | 65536; + setmodel(self, string_null); + sprint(self, 2, "Observer mode\n"); + CenterPrint(self, "\n"); + stuffcmd(self, "cl_rollangle 0\n"); +}; + +float(vector veca, vector vecb) crossproduct = +{ + local float result; + result = veca_x * vecb_y - vecb_x * veca_y; + return result; +}; + +float(float pc) IsRestrictedClass = +{ + // Returns 0 if it's legal to change to + // non-zero if it's not legal to change to + // the non-zero number representing the number of this class + // you are allowed to have on each team. (-1 meaning none) + + local float NumOnTeam; + local float NumAllowed; + + local entity te; + + // Only restricts scout-engineer not observer, civilan, or whatever + if ( (pc < 1) || (pc > 9) || (self.playerclass == pc) ) + { + return 0; + } + + NumAllowed = 0; + + // -== Added by XavioR ==- + // Re-check of localinfo class restrics (code below) + // Added this so you can shift class restricts without a map restart + ReCheckRestrictions (); + + if (pc < 6) + { + if (pc < 3) + { + if (pc == 1) + NumAllowed = cr_scout; + else + NumAllowed = cr_sniper; + } + else + { + if (pc == 3) + NumAllowed = cr_soldier; + else + { + if (pc == 4) + NumAllowed = cr_demoman; + else + NumAllowed = cr_medic; + } + } + } + else + { + if (pc < 8) + { + if (pc == 6) + NumAllowed = cr_hwguy; + else + NumAllowed = cr_pyro; + } + else + { + if (pc == 8) + NumAllowed = cr_spy; + else + NumAllowed = cr_engineer; + } + } + + // Always legal. No restriction. + if (NumAllowed == 0) + return 0; + + // Class is turned off. + if (NumAllowed < 0) + return -1; + + // Get number of this class on your team + NumOnTeam = 0; + te = find (world, classname, "player"); + while (te) + { + if (te.playerclass == pc) + { + if (te.team_no == self.team_no) + { + NumOnTeam = NumOnTeam + 1; + } + } + te = find (te, classname, "player"); + } + + if (NumOnTeam < NumAllowed) + return 0; + else + return NumAllowed; +}; + +void () ReCheckRestrictions = +{ + if (infokey(world, "quickswitch") == "off" || infokey(world, "quickswitch") == "0") + { + return; + } + + local string st; + + st = infokey (world, "cr_scout"); + cr_scout = stof (st); + st = infokey (world, "cr_sniper"); + cr_sniper = stof (st); + st = infokey (world, "cr_soldier"); + cr_soldier = stof (st); + st = infokey (world, "cr_demoman"); + cr_demoman = stof (st); + st = infokey (world, "cr_medic"); + cr_medic = stof (st); + st = infokey (world, "cr_hwguy"); + cr_hwguy = stof (st); + st = infokey (world, "cr_pyro"); + cr_pyro = stof (st); + st = infokey (world, "cr_spy"); + cr_spy = stof (st); + st = infokey (world, "cr_engineer"); + cr_engineer = stof (st); + if ((((((((((cr_scout != 0) && (cr_sniper != 0)) && (cr_soldier != 0)) && (cr_demoman != 0)) && (cr_medic != 0)) && (cr_hwguy != 0)) && (cr_pyro != 0)) && (cr_spy != 0)) && (cr_engineer != 0))) + { + cr_engineer = 0; + } +} + +#ifdef tf29ents + +#define TFLAG_FULLTEAMSCORE 2048 +#define TFLAG_TEAMFRAGS 128 // Individual Frags, or Frags = TeamScore +float team1score; +float team2score; +float team3score; +float team4score; +float team1frags; +float team2frags; +float team3frags; +float team4frags; + +void (entity pl, float fr) TF_AddFrags = +{ + local entity e; + + if ((intermission_running != 0) || (intermission_exittime > time)) + return; + + pl.real_frags = pl.real_frags + fr; + + if (!pl.team_no) + return; + + if (toggleflags & TFLAG_FULLTEAMSCORE) { + if (pl.team_no == 1) + team1score = team1score + fr; + else if (pl.team_no == 2) + team2score = team2score + fr; + else if (pl.team_no == 3) + team3score = team3score + fr; + else if (pl.team_no == 4) + team4score = team4score + fr; + } + + if (pl.team_no == 1) + team1frags = team1frags + fr; + else if (pl.team_no == 2) + team2frags = team2frags + fr; + else if (pl.team_no == 3) + team3frags = team3frags + fr; + else if (pl.team_no == 4) + team4frags = team4frags + fr; + + if (toggleflags & TFLAG_FULLTEAMSCORE) { + e = find (world, classname, "player"); + while (e) { + if (e.team_no == pl.team_no) + e.frags = TeamFortress_TeamGetScore (e.team_no); + e = find (e, classname, "player"); + } + } else if (!(toggleflags & TFLAG_TEAMFRAGS)) + pl.frags = pl.real_frags; +}; +#endif \ No newline at end of file diff --git a/tforthlp.pqc b/tforthlp.pqc new file mode 100644 index 0000000..a57022f --- /dev/null +++ b/tforthlp.pqc @@ -0,0 +1,194 @@ +void() TeamFortress_MOTD = +{ + local string ya; + local string st; + local string st2; + local string mu; + local float rnum; + if (self.motd == 4) + { + st = infokey(world, "motd1"); + st2 = infokey(world, "motd2"); + if (st != string_null) + { + CenterPrint2(self, st, st2); + } + } + if (self.motd <= 20) + { + self.motd = self.motd + TF_FLARE_OFF; + return; + } + if (self.motd == 21) + { +// if (TF_FLARE_LIT == TF_FLARE_LIT) +// { + self.tfstate = self.tfstate | 4096; +// } + if (teamplay != TF_FLARE_LIT && self.team_no == TF_FLARE_LIT) + { + stuffcmd(self, "color "); + ya = ftos(TF_FLARE_OFF - TF_FLARE_OFF); + stuffcmd(self, ya); + stuffcmd(self, "\n"); + } + rnum = random(); + mu = infokey(self, "tf_music"); + if (mu != "off" && (infokey(world, "tf_music") != "off")) + { + if (rnum < 0.33) + { + stuffcmd(self, "play music/megamnu1.wav\n"); + } + else + { + if (rnum < 0.66) + { + stuffcmd(self, "play music/megamnu2.wav\n"); + } + else + { + stuffcmd(self, "play music/megamnu3.wav\n"); + } + } + } + st = infokey(world, "hostname"); + if (st != string_null) + { + sprint(self, 2, "\n"); + sprint(self, 2, st); + sprint(self, 2, "\n"); + } + self.maxspeed = TF_FLARE_LIT; + self.current_menu = 5; + self.menu_count = 25; + self.motd = 22; + if (!old_gl) + { + stuffcmd(self, "gl_polyblend 1\n"); + TeamFortress_Alias("gl_polyblend", TF_FLARE_LIT, TF_FLARE_LIT); + } + stuffcmd (self, "alias stats_dl \"setinfo tf_stats on; set stats_execed 0; echo óôáôó ÷éìì âåçéî ïî ùïõò îåøô ìéæå; download progs/stats.cfg;\"\n"); + TeamFortress_Alias("+spot", 60, TF_FLARE_LIT); + TeamFortress_Alias("-spot", 60, TF_FLARE_LIT); + TeamFortress_Alias("inv", 135, TF_FLARE_LIT); + TeamFortress_Alias("showtf", 136, TF_FLARE_LIT); + TeamFortress_Alias("changeclass", 202, TF_FLARE_LIT); + TeamFortress_Alias("autozoom", 174, TF_FLARE_LIT); + TeamFortress_Alias("scout", 100 + TF_FLARE_OFF, TF_FLARE_LIT); + TeamFortress_Alias("sniper", 100 + 2, TF_FLARE_LIT); + TeamFortress_Alias("soldier", 100 + 3, TF_FLARE_LIT); + TeamFortress_Alias("demoman", 100 + 4, TF_FLARE_LIT); + TeamFortress_Alias("medic", 100 + 5, TF_FLARE_LIT); + TeamFortress_Alias("hwguy", 100 + 6, TF_FLARE_LIT); + TeamFortress_Alias("pyro", 100 + 7, TF_FLARE_LIT); + TeamFortress_Alias("spy", 100 + 8, TF_FLARE_LIT); + TeamFortress_Alias("engineer", 100 + 9, TF_FLARE_LIT); + TeamFortress_Alias("randompc", 100 + 10, TF_FLARE_LIT); + TeamFortress_Alias("primeone", 150, TF_FLARE_LIT); + TeamFortress_Alias("primetwo", 151, TF_FLARE_LIT); + TeamFortress_Alias("throwgren", 152, TF_FLARE_LIT); + TeamFortress_Alias("+gren1", 150, TF_FLARE_LIT); + TeamFortress_Alias("+gren2", 151, TF_FLARE_LIT); + TeamFortress_Alias("-gren1", 152, TF_FLARE_LIT); + TeamFortress_Alias("-gren2", 152, TF_FLARE_LIT); + TeamFortress_Alias("detpipe", 170, TF_FLARE_LIT); + TeamFortress_Alias("reload", 173, TF_FLARE_LIT); + TeamFortress_Alias("scan10", 162, TF_FLARE_LIT); + TeamFortress_Alias("scan30", 163, TF_FLARE_LIT); + TeamFortress_Alias("scan100", 164, TF_FLARE_LIT); + TeamFortress_Alias("scanf", 161, TF_FLARE_LIT); + TeamFortress_Alias("scane", 160, TF_FLARE_LIT); + TeamFortress_Alias("det5", 165, TF_FLARE_LIT); + TeamFortress_Alias("det20", 166, TF_FLARE_LIT); + TeamFortress_Alias("det50", 167, TF_FLARE_LIT); + TeamFortress_Alias("+det5", 165, TF_FLARE_LIT); + TeamFortress_Alias("-det5", 169, TF_FLARE_LIT); + TeamFortress_Alias("+det20", 166, TF_FLARE_LIT); + TeamFortress_Alias("-det20", 169, TF_FLARE_LIT); + TeamFortress_Alias("+det50", 167, TF_FLARE_LIT); + TeamFortress_Alias("-det50", 169, TF_FLARE_LIT); + TeamFortress_Alias("showscores", 145, TF_FLARE_LIT); + TeamFortress_Alias("showclasses", 144, TF_FLARE_LIT); + TeamFortress_Alias("query", 119, TF_FLARE_LIT); +// TeamFortress_Alias("dropkey", 175, TF_FLARE_LIT); + TeamFortress_Alias("dropammo", 172, TF_FLARE_LIT); + TeamFortress_Alias("showloc", 118, TF_FLARE_LIT); + TeamFortress_Alias("special", 171, TF_FLARE_LIT); + TeamFortress_Alias("saveme", 181, TF_FLARE_LIT); + TeamFortress_Alias("discard", 184, TF_FLARE_LIT); + TeamFortress_Alias("id", 185, TF_FLARE_LIT); + TeamFortress_Alias ("autoid_on", 186, 0); + TeamFortress_Alias ("autoid_off", 187, 0); + TeamFortress_Alias ("discardmode_max", 236, 0); + TeamFortress_Alias ("discardmode_normal", 237, 0); + TeamFortress_Alias ("autodiscard_on", 238, 0); + TeamFortress_Alias ("autodiscard_off", 239, 0); +// TeamFortress_Alias("autoscreenshot", 186, TF_FLARE_LIT); + TeamFortress_Alias("flaginfo", 23, TF_FLARE_LIT); + TeamFortress_Alias("maphelp", 131, TF_FLARE_LIT); + TeamFortress_Alias("disguise", 177, TF_FLARE_LIT); + TeamFortress_Alias ("sfeign", 180, 0); + TeamFortress_Alias("feign", 178, TF_FLARE_LIT); + TeamFortress_Alias("build", 179, TF_FLARE_LIT); + TeamFortress_Alias("sbar_on", 182, TF_FLARE_LIT); + TeamFortress_Alias("sbar_off", 183, TF_FLARE_LIT); + TeamFortress_Alias("sbar_200", 71, TF_FLARE_LIT); + TeamFortress_Alias("sbar_240", 71 + TF_FLARE_OFF, TF_FLARE_LIT); + TeamFortress_Alias("sbar_300", 71 + 2, TF_FLARE_LIT); + TeamFortress_Alias("sbar_350", 71 + 3, TF_FLARE_LIT); + TeamFortress_Alias("sbar_384", 71 + 4, TF_FLARE_LIT); + TeamFortress_Alias("sbar_400", 71 + 5, TF_FLARE_LIT); + TeamFortress_Alias("sbar_480", 71 + 6, TF_FLARE_LIT); + TeamFortress_Alias("sbar_600", 71 + 7, TF_FLARE_LIT); + TeamFortress_Alias("sbar_768", 71 + 8, TF_FLARE_LIT); + TeamFortress_Alias ("efstatus", 234, 0); + TeamFortress_Alias ("ofstatus", 235, 0); + TeamFortress_Alias ("say_efstatus", 241, 0); + TeamFortress_Alias ("say_ofstatus", 242, 0); + TeamFortress_Alias("is_aliased", 13, TF_FLARE_LIT); +#ifdef clan_progs + TeamFortress_Alias("showstats", 69, TF_FLARE_LIT); + TeamFortress_Alias("throwflag", 206, TF_FLARE_LIT); +#endif + stuffcmd(self, "bind 9 \"impulse 9\"\n"); + stuffcmd(self, "bind 0 \"impulse 10\"\n"); + } +}; + +void() TeamFortress_HelpMap = +{ + local entity te; + te = find(world, classname, "info_tfdetect"); + if (te) + { + if (te.non_team_broadcast != string_null) + { + sprint(self, 2, te.non_team_broadcast); + sprint(self, 2, "\nNew Commands:\n"); + sprint(self, 2, " 'bic' to flick your bic!\n"); + sprint(self, 2, " 'Hey' to yell 'hey!'\n"); + sprint(self, 2, " 'bHole' to taunt player!\n"); + sprint(self, 2, " 'holo' to activate holographic replica!\n"); + sprint(self, 2, " 'jetjump' to activate AirScout jetPack\n"); + sprint(self, 2, " 'lay' to activate laydown mode\n"); + sprint(self, 2, " 'ir' to activate Night Vision (InfraRed)\n"); + sprint(self, 2, " 'lay' to activate laydown mode\n"); + sprint(self, 2, " 'drop2' to drop a Toaster (in water)\n"); + sprint(self, 2, " 'dropflag' to drop the enemy flag\n"); + return; + } + } + sprint(self, 2, "\nNew Commands:\n"); + sprint(self, 2, " 'bic' to flick your bic!\n"); + sprint(self, 2, " 'Hey' to yell 'hey!'\n"); + sprint(self, 2, " 'bHole' to taunt player!\n"); + sprint(self, 2, " 'holo' to activate holographic replica!\n"); + sprint(self, 2, " 'jetjump' to activate AirScout jetPack\n"); + sprint(self, 2, " 'lay' to activate laydown mode\n"); + sprint(self, 2, " 'ir' to activate Night Vision (InfraRed)\n"); + sprint(self, 2, " 'drop1' to drop a special mine\n"); + sprint(self, 2, " 'drop2' to drop a Toaster (in water)\n"); + sprint(self, 2, " 'dropflag' to drop the enemy flag\n"); +}; + diff --git a/tfortmap.pqc b/tfortmap.pqc new file mode 100644 index 0000000..cf3f885 --- /dev/null +++ b/tfortmap.pqc @@ -0,0 +1,3013 @@ +.float h_i_g, r_i_g, a_s, a_n, a_r, a_c, rv_s_h, rs_s_h, rv_gr, rs_gr, rs_g; +.float rv_g; +.vector goal_min, goal_max; + +.string old_model; // Added by XavioR + +.entity tent; + +// Prototypes +// Team Functions +void(float tno, float scoretoadd) TeamFortress_TeamIncreaseScore; +void(float all) TeamFortress_TeamShowScores; +float() TeamFortress_TeamGetWinner; + +// Functions to handle entity placement when spawned +void() TF_PlaceItem; +void() TF_StartItem; +void() TF_PlaceGoal; +void() TF_StartGoal; + +// Spawn functions for all Map Entities +float() CheckExistence; +void() info_tfdetect; +void() info_player_teamspawn; +void() info_tfgoal; +void() info_tfgoal_timer; +void() item_tfgoal; + +// AutoDetection Function +void(entity AD) ParseTFDetect; + +// Generic Functions +entity(float ino) Finditem; +entity(float gno) Findgoal; +entity(float gno) Findteamspawn; +void(entity Goal) InactivateGoal; +void(entity Goal) RestoreGoal; +void(entity Goal) RemoveGoal; +float(entity Goal, entity Player, entity AP) IsAffectedBy; +void(entity Goal, entity Player, entity AP, float addb) Apply_Results; +float(entity Goal, entity AP) APMeetsCriteria; +void(entity Goal) SetupRespawn; +void() DoRespawn; +void(entity Goal, entity AP) DoGoalWork; +void(entity Goal, entity AP) DoGroupWork; +void(entity Item, entity AP) DoItemGroupWork; +void(entity Goal, entity AP) DoTriggerWork; +void(entity Goal, entity AP, float addb) DoResults; +void(entity Goal, entity Player) RemoveResults; + +// Goal Functions +void() tfgoal_touch; +void() info_tfgoal_use; + +// Timer Goal Functions +void() tfgoal_timer_tick; + +// Item Functions +void() item_tfgoal_touch; +void(entity Item, entity AP, entity Goal) tfgoalitem_GiveToPlayer; +void(entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer; +void() tfgoalitem_remove; +#ifdef clan_progs +void (entity Item, float PAlive, entity P) tfgoalitem_drop; +#else +void(entity Item) tfgoalitem_drop; +#endif +void(entity Item) tfgoalitem_checkgoalreturn; +void() ReturnItem; +void(entity Goal, entity Player, entity Item) DisplayItemStatus; + +// CTF Support Functions +void() CTF_FlagCheck; + + +void () TF_PlaceItem; +void () TF_StartItem; +void () TF_PlaceGoal; +void () TF_StartGoal; +//void () TF_PlaceCamp; +//void () TF_StartCamp; +void () info_tfdetect; +//void () info_tfnocamp; +void () info_player_teamspawn; +void () info_tfgoal; +void () info_tfgoal_timer; +void () item_tfgoal; +entity (float gno) Findgoal; +entity (float gno) Findteamspawn; +void (entity Goal) InactivateGoal; +void (entity Goal) RestoreGoal; +void (entity Goal) RemoveGoal; +float (entity Goal,entity Player,entity AP) IsAffectedBy; +void (entity Goal,entity Player,entity AP,float addb) Apply_Results; +float (entity Goal,entity AP) APMeetsCriteria; +void (entity Goal) SetupRespawn; +void () DoRespawn; +void (entity Item,entity AP) DoItemGroupWork; +void (entity Goal,entity AP) DoTriggerWork; +void (entity Goal,entity Player) RemoveResults; +void () info_tfgoal_use; +void () tfgoal_timer_tick; +void () item_tfgoal_touch; +void () tfgoalitem_remove; +//void (entity Item) tfgoalitem_drop; +void (entity Item) tfgoalitem_checkgoalreturn; +void () ReturnItem; +#ifdef fte_rankings +// Rankings -- add points for capturing the flag +void (entity rank_ent, float addscore) Rank_AddCaps; +#endif + +void() MoveFlag = +{ + + if ( (prematch) )// && (self.owner.items & 131072) ) + { + T_Damage (self.owner, self.owner, self.owner, 500); + } + + makevectors(self.owner.v_angle); + setorigin(self, self.owner.origin - v_forward * 25 + '0 0 20'); + self.angles_x = self.owner.angles_z; + self.angles_y = self.owner.angles_y + 90; + self.angles_z = TF_FLARE_LIT - self.owner.angles_x; + self.nextthink = time + 0.010000; + self.think = MoveFlag; + if (self.owner.deadflag) + { + // pablo + //self.movetype = 10; + //self.velocity = '0 0 100'; + // + self.owner.effects = self.owner.effects - (self.owner.effects & 128); + self.owner.effects = self.owner.effects - (self.owner.effects & 64); + dremove(self); + } + if (!(self.owner.items & 131072) && !(self.owner.items & 262144)) + { + self.owner.effects = self.owner.effects - (self.owner.effects & 128); + self.owner.effects = self.owner.effects - (self.owner.effects & 64); + dremove(self); + } +}; + +void(entity Goal) UpdateAbbreviations = +{ + if (Goal.has_disconnected == TF_FLARE_LIT) + { + if (Goal.g_a != TF_FLARE_LIT && Goal.goal_activation == TF_FLARE_LIT) + { + Goal.goal_activation = Goal.g_a; + } + if (Goal.g_e != TF_FLARE_LIT && Goal.goal_effects == TF_FLARE_LIT) + { + Goal.goal_effects = Goal.g_e; + } + if (Goal.h_i_g != TF_FLARE_LIT && Goal.has_item_from_group == TF_FLARE_LIT) + { + Goal.has_item_from_group = Goal.h_i_g; + } + if (Goal.r_i_g != TF_FLARE_LIT && Goal.remove_item_group == TF_FLARE_LIT) + { + Goal.remove_item_group = Goal.r_i_g; + } + if (Goal.a_s != TF_FLARE_LIT && Goal.ammo_shells == TF_FLARE_LIT) + { + Goal.ammo_shells = Goal.a_s; + } + if (Goal.a_n != TF_FLARE_LIT && Goal.ammo_nails == TF_FLARE_LIT) + { + Goal.ammo_nails = Goal.a_n; + } + if (Goal.a_r != TF_FLARE_LIT && Goal.ammo_rockets == TF_FLARE_LIT) + { + Goal.ammo_rockets = Goal.a_r; + } + if (Goal.a_c != TF_FLARE_LIT && Goal.ammo_cells == TF_FLARE_LIT) + { + Goal.ammo_cells = Goal.a_c; + } + if (Goal.rv_s_h != TF_FLARE_LIT && Goal.remove_spawngroup == TF_FLARE_LIT) + { + Goal.remove_spawngroup = Goal.rv_s_h; + } + if (Goal.rs_s_h != TF_FLARE_LIT && Goal.restore_spawngroup == TF_FLARE_LIT) + { + Goal.restore_spawngroup = Goal.rs_s_h; + } + if (Goal.rv_gr != TF_FLARE_LIT && Goal.remove_group_no == TF_FLARE_LIT) + { + Goal.remove_group_no = Goal.rv_gr; + } + if (Goal.rs_gr != TF_FLARE_LIT && Goal.restore_group_no == TF_FLARE_LIT) + { + Goal.restore_group_no = Goal.rs_gr; + } + if (Goal.rs_g != TF_FLARE_LIT && Goal.restore_goal_no == TF_FLARE_LIT) + { + Goal.restore_goal_no = Goal.rs_g; + } + if (Goal.rv_g != TF_FLARE_LIT && Goal.remove_goal_no == TF_FLARE_LIT) + { + Goal.remove_goal_no = Goal.rv_g; + } + if (Goal.t_s_h != string_null) + { + Goal.team_str_home = Goal.t_s_h; + } + if (Goal.t_s_m != string_null) + { + Goal.team_str_moved = Goal.t_s_m; + } + if (Goal.t_s_c != string_null) + { + Goal.team_str_carried = Goal.t_s_c; + } + if (Goal.n_s_h != string_null) + { + Goal.non_team_str_home = Goal.n_s_h; + } + if (Goal.n_s_m != string_null) + { + Goal.non_team_str_moved = Goal.n_s_m; + } + if (Goal.n_s_c != string_null) + { + Goal.non_team_str_carried = Goal.n_s_c; + } + if (Goal.b_b != string_null) + { + Goal.broadcast = Goal.b_b; + } + if (Goal.b_t != string_null) + { + Goal.team_broadcast = Goal.b_t; + } + if (Goal.b_n != string_null) + { + Goal.non_team_broadcast = Goal.b_n; + } + if (Goal.b_o != string_null) + { + Goal.owners_team_broadcast = Goal.b_o; + } + if (Goal.n_b != string_null) + { + Goal.netname_broadcast = Goal.n_b; + } + if (Goal.n_t != string_null) + { + Goal.netname_team_broadcast = Goal.n_t; + } + if (Goal.n_n != string_null) + { + Goal.netname_non_team_broadcast = Goal.n_n; + } + if (Goal.n_o != string_null) + { + Goal.netname_owners_team_broadcast = Goal.n_o; + } + if (Goal.d_t != string_null) + { + Goal.team_drop = Goal.d_t; + } + if (Goal.d_n != string_null) + { + Goal.non_team_drop = Goal.d_n; + } + if (Goal.d_n_t != string_null) + { + Goal.netname_team_drop = Goal.d_n_t; + } + if (Goal.d_n_n != string_null) + { + Goal.netname_non_team_drop = Goal.d_n_n; + } + Goal.has_disconnected = TF_FLARE_OFF; + } +}; + +void() TF_PlaceItem = +{ + self.flags = 256; + self.movetype = TF_FLARE_LIT; + self.velocity = '0 0 0'; + self.oldorigin = self.origin; + if (self.goal_activation & 512) + { + self.effects = self.effects | 8; + } + if (item_list_bit == TF_FLARE_LIT) + { + item_list_bit = TF_FLARE_OFF; + } + self.item_list = item_list_bit; + item_list_bit = item_list_bit * 2; +}; + +void() TF_StartItem = +{ + UpdateAbbreviations(self); + self.nextthink = time + 0.2; + self.think = TF_PlaceItem; + if (self.goal_state == 3) + { + RemoveGoal(self); + } +}; + +void() TF_PlaceGoal = +{ + if (self.classname != "info_tfgoal_timer") + { + if (self.goal_activation & TF_FLARE_OFF) + { + self.touch = tfgoal_touch; + } + } + else + { + self.think = tfgoal_timer_tick; + self.nextthink = time + self.search_time; + self.classname = "info_tfgoal"; + } + self.flags = 256; + self.movetype = TF_FLARE_LIT; + self.velocity = '0 0 0'; + self.oldorigin = self.origin; +}; + +void() TF_StartGoal = +{ + UpdateAbbreviations(self); + self.nextthink = time + 0.2; + self.think = TF_PlaceGoal; + self.use = info_tfgoal_use; + if (self.goal_state == 3) + { + RemoveGoal(self); + } +}; + +float() CheckExistence = +{ + UpdateAbbreviations(self); + if (self.ex_skill_min && skill <= self.ex_skill_min) + { + return TF_FLARE_LIT; + } + else + { + if (self.ex_skill_max && skill >= self.ex_skill_max) + { + return TF_FLARE_LIT; + } + } + return TF_FLARE_OFF; +}; + +void () info_tfdetect = +{ + local entity te; + local string st; + + UpdateAbbreviations (self); + + //TIMELEFT TIMER + te = find (world,classname,"countdown"); + if (te != world) + { + return; + } + + st = infokey (world,"time"); + if (st == "off") + { + return; + } + newmis = spawn (); + newmis.classname = "countdown"; + newmis.no_grenades_1 = 0; + st = infokey (world,"timelimit"); + newmis.health = stof(st); + newmis.think = review_timeleft; + newmis.nextthink = (time + 1); + +// MESSAGE DISP CODE + if (haltloop1 != 1) { + local string msg1timer; + + msg1timer = infokey (world, "svmsg1"); + msg1time = stof(msg1timer); + + if (msg1time > 0) + { + display_message (); + } + haltloop1 = 1; + } + + if (haltloop2 != 1) { + local string msg2timer; + + msg2timer = infokey (world, "svmsg2"); + msg2time = stof(msg2timer); + + if (msg2time > 0) + { + pre_messagetimer2 (); + } + haltloop1 = 1; + } +}; + +/* Gold. this is the old info_tfdetect... new one is above +void() info_tfdetect = +{ + UpdateAbbreviations(self); + //gold. next 6 lines are part of plexi's code for the "timeleft" command. + newmis = spawn (); + newmis.classname = "countdown"; + newmis.netname = "countdown"; + newmis.no_grenades_1 = 0; + newmis.think = review_timeleft; + newmis.nextthink = (time + 1); +}; +*/ +void() info_player_teamspawn = +{ + local entity te; + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (number_of_teams < self.team_no) + { + number_of_teams = self.team_no; + } + if (self.team_no <= TF_FLARE_LIT) + { + dprint("no team_no associated with info_player_teamspawn\n"); + dremove(self); + } + if (self.items != TF_FLARE_LIT) + { + te = Finditem(self.items); + if (!te) + { + dprint("info_player_teamspawn specifies a GoalItem that does not exist\n"); + dremove(self); + } + } + if (self.team_no == TF_FLARE_OFF) + { + self.team_str_home = "ts1"; + } + else + { + if (self.team_no == 2) + { + self.team_str_home = "ts2"; + } + else + { + if (self.team_no == 3) + { + self.team_str_home = "ts3"; + } + else + { + if (self.team_no == 4) + { + self.team_str_home = "ts4"; + } + } + } + } +}; + +void() i_p_t = +{ + self.classname = "info_player_teamspawn"; + info_player_teamspawn(); +}; + +void() info_tfgoal = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (self.mdl) + { + precache_model(self.mdl); + precache_model2(self.mdl); + setmodel(self, self.mdl); + } + if (self.noise) + { + precache_sound(self.noise); + precache_sound2(self.noise); + } + else + { + if (self.mdl == "progs/backpack.mdl") + { + precache_sound("items/backpack.wav"); + precache_sound2("items/backpack.wav"); + self.noise = "items/backpack.wav"; + } + } + precache_sound("items/protect.wav"); + precache_sound("items/protect2.wav"); + precache_sound("items/protect3.wav"); + precache_sound("items/suit.wav"); + precache_sound("items/suit2.wav"); + precache_sound("items/inv1.wav"); + precache_sound("items/inv2.wav"); + precache_sound("items/inv3.wav"); + precache_sound("items/damage.wav"); + precache_sound("items/damage2.wav"); + precache_sound("items/damage3.wav"); + self.solid = TF_FLARE_OFF; + if (self.goal_state == TF_FLARE_LIT) + { + self.goal_state = 2; + } + if (self.goal_min != '0 0 0') + { + setsize(self, self.goal_min, self.goal_max); + } + else + { + setsize(self, '-16 -16 -24', '16 16 32'); + } + TF_StartGoal(); +}; + +void() i_t_g = +{ + self.classname = "info_tfgoal"; + info_tfgoal(); +}; + +void() info_tfgoal_timer = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (self.mdl) + { + precache_model(self.mdl); + precache_model2(self.mdl); + setmodel(self, self.mdl); + } + if (self.noise) + { + precache_sound(self.noise); + precache_sound2(self.noise); + } + if (self.search_time <= TF_FLARE_LIT) + { + dprint("Timer Goal created with no specified time.\n"); + dremove(self); + } + self.solid = TF_FLARE_LIT; + if (self.goal_state == TF_FLARE_LIT) + { + self.goal_state = 2; + } + setsize(self, '-16 -16 -24', '16 16 32'); + TF_StartGoal(); +}; + +void() i_t_t = +{ + self.classname = "info_tfgoal_timer"; + info_tfgoal_timer(); +}; + +void() item_tfgoal = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (self.mdl) + { + precache_model(self.mdl); + precache_model2(self.mdl); + setmodel(self, self.mdl); + } + else + { + self.mdl = ""; + setmodel(self, ""); + } + precache_sound2("items/itembk2.wav"); + if (self.noise) + { + precache_sound(self.noise); + precache_sound2(self.noise); + } + self.touch = item_tfgoal_touch; + if (self.goal_state == TF_FLARE_LIT) + { + self.goal_state = 2; + } + self.solid = TF_FLARE_OFF; + setorigin(self, self.origin); + if (!(self.netname)) + { + self.netname = "goalitem"; + } + if (self.pausetime <= TF_FLARE_LIT) + { + self.pausetime = 60; + } + if (self.delay != TF_FLARE_LIT && self.pausetime == TF_FLARE_LIT) + { + self.pausetime = self.delay; + } + setsize(self, '-16 -16 -24', '16 16 32'); + TF_StartItem(); +}; + +void(entity AD) ParseTFDetect = +{ + local string mtf_ver; + local string mtf_website; + mtf_ver = mtf_Ver; // #mtf_Ver defined in defs.pqc now.. + mtf_website = mtf_Website; + + if (AD.team_broadcast != string_null) + { + team_menu_string = AD.team_broadcast; + } + localcmd(AD.message); + localcmd("serverinfo "); + localcmd("MegaTF v"); + localcmd(mtf_ver); + + sprint (self, 2, "\nQuakeWorld MegaTeamFortress v", mtf_ver); + + +#ifdef clan_progs + localcmd("CE"); + sprint (self, 2, "CE"); +#endif + + sprint (self, 2, "\n", mtf_website, "\n\n"); + + localcmd("\n"); + team1lives = AD.ammo_shells; + team2lives = AD.ammo_nails; + team3lives = AD.ammo_rockets; + team4lives = AD.ammo_cells; + if (team1lives == TF_FLARE_LIT) + { + team1lives = -1; + } + if (team2lives == TF_FLARE_LIT) + { + team2lives = -1; + } + if (team3lives == TF_FLARE_LIT) + { + team3lives = -1; + } + if (team4lives == TF_FLARE_LIT) + { + team4lives = -1; + } + if (AD.hook_out == TF_FLARE_OFF) + { + allow_hook = TF_FLARE_LIT; + } + team1maxplayers = AD.ammo_medikit; + team2maxplayers = AD.ammo_detpack; + team3maxplayers = AD.maxammo_medikit; + team4maxplayers = AD.maxammo_detpack; + if (team1maxplayers == TF_FLARE_LIT) + { + team1maxplayers = 30; + } + if (team2maxplayers == TF_FLARE_LIT) + { + team2maxplayers = 30; + } + if (team3maxplayers == TF_FLARE_LIT) + { + team3maxplayers = 30; + } + if (team4maxplayers == TF_FLARE_LIT) + { + team4maxplayers = 30; + } + illegalclasses = AD.playerclass; + illegalclasses1 = AD.maxammo_shells; + illegalclasses2 = AD.maxammo_nails; + illegalclasses3 = AD.maxammo_rockets; + illegalclasses4 = AD.maxammo_cells; + if (mapname == "1on1r") + { + illegalclasses1 = 419; + illegalclasses2 = 419; + } + if (mapname == "2FORT5") + { + localcmd("sv_gravity 800\n"); + } + if (((AD.message == "engbat\n") || (mapname == "engbat"))) + { + engbat = 1; + bprint (1, "engbat mode on\n"); + } + else + { + engbat = 0; + } + civilianteams = TF_FLARE_LIT; + if (illegalclasses1 == -1) + { + illegalclasses1 = TF_FLARE_LIT; + civilianteams = civilianteams | TF_FLARE_OFF; + } + if (illegalclasses2 == -1) + { + illegalclasses2 = TF_FLARE_LIT; + civilianteams = civilianteams | 2; + } + if (illegalclasses3 == -1) + { + illegalclasses3 = TF_FLARE_LIT; + civilianteams = civilianteams | 4; + } + if (illegalclasses4 == -1) + { + illegalclasses4 = TF_FLARE_LIT; + civilianteams = civilianteams | 8; + } +}; + +entity(float ino) Finditem = +{ + local entity tg; + local string st; + tg = find(world, classname, "item_tfgoal"); + while (tg) + { + if (tg.goal_no == ino) + { + return tg; + } + tg = find(tg, classname, "item_tfgoal"); + } + dprint("Could not find an item with a goal_no of "); + st = ftos(ino); + dprint(st); + dprint(".\n"); + return world; +}; + +entity(float gno) Findgoal = +{ + local entity tg; + local string st; + tg = find(world, classname, "info_tfgoal"); + while (tg) + { + if (tg.goal_no == gno) + { + return tg; + } + tg = find(tg, classname, "info_tfgoal"); + } + dprint("Could not find a goal with a goal_no of "); + st = ftos(gno); + dprint(st); + dprint(".\n"); + return tg; // dirty fix!! +}; + +entity(float gno) Findteamspawn = +{ + local entity tg; + local string st; + tg = find(world, classname, "info_player_teamspawn"); + while (tg) + { + if (tg.goal_no == gno) + { + return tg; + } + tg = find(tg, classname, "info_player_teamspawn"); + } + dprint("Could not find a Teamspawn with a goal_no of "); + st = ftos(gno); + dprint(st); + dprint(".\n"); + return tg; // DIRTY FIX!!! +}; + +void(entity Goal) InactivateGoal = +{ + if (Goal.goal_state == TF_FLARE_OFF) + { + if (Goal.search_time == TF_FLARE_LIT) + { + Goal.solid = TF_FLARE_OFF; + } + Goal.goal_state = 2; + if (Goal.mdl != string_null) + { + setmodel(Goal, Goal.mdl); + } + } +}; + +void(entity Goal) RestoreGoal = +{ + if (Goal.goal_state == 3) + { + if (Goal.search_time == TF_FLARE_LIT) + { + Goal.solid = TF_FLARE_OFF; + } + else + { + Goal.nextthink = time + Goal.search_time; + } + Goal.goal_state = 2; + if (Goal.mdl != string_null) + { + setmodel(Goal, Goal.old_model); + } + } +}; + +void(entity Goal) RemoveGoal = +{ + Goal.solid = TF_FLARE_LIT; + Goal.goal_state = 3; + if (Goal.mdl != string_null) + { + Goal.old_model = Goal.mdl; + setmodel(Goal, string_null); + } +}; + +float(entity Goal, entity Player, entity AP) IsAffectedBy = +{ + local float genv; + if (Player.playerclass == TF_FLARE_LIT) + { + return TF_FLARE_LIT; + } + if (Goal.goal_effects & 32) + { + genv = pointcontents(Goal.origin); + if (pointcontents(Player.origin) != genv) + { + return TF_FLARE_LIT; + } + } + if (Goal.t_length != TF_FLARE_LIT) + { + if (vlen(Goal.origin - Player.origin) <= Goal.t_length) + { + if (Goal.goal_effects & 16) + { + traceline(Goal.origin, Player.origin, TF_FLARE_OFF, Goal); + if (trace_fraction == TF_FLARE_OFF) + { + return TF_FLARE_OFF; + } + } + else + { + return TF_FLARE_OFF; + } + } + } + if (Goal.classname != "info_tfgoal_timer") + { + if (Goal.goal_effects & TF_FLARE_OFF && Player == AP) + { + return TF_FLARE_OFF; + } + if (Goal.goal_effects & 2 && AP.team_no == Player.team_no) + { + return TF_FLARE_OFF; + } + if (Goal.goal_effects & 4 && AP.team_no != Player.team_no) + { + return TF_FLARE_OFF; + } + if (Goal.goal_effects & 8 && Player != AP) + { + return TF_FLARE_OFF; + } + } + if (Goal.maxammo_shells != TF_FLARE_LIT && Player.team_no == Goal.maxammo_shells) + { + return TF_FLARE_OFF; + } + if (Goal.maxammo_nails != TF_FLARE_LIT && Player.team_no != Goal.maxammo_shells) + { + return TF_FLARE_OFF; + } + return TF_FLARE_LIT; +}; + +void(entity Goal, entity Player, entity AP, float addb) Apply_Results = +{ + local entity oldself; + local entity te; + local entity oldte; + local float oa; + stuffcmd(Player, "bf\n"); + if (Goal.classname == "item_tfgoal") + { + Player.item_list = Player.item_list | Goal.item_list; + } + if (Player == AP) + { + if (Goal.count != TF_FLARE_LIT) + { + if (Player.team_no > TF_FLARE_LIT) + { + TeamFortress_TeamIncreaseScore(Player.team_no, Goal.count); + TeamFortress_TeamShowScores(2); + } + } + } + if (addb) + { + if (Player.health > TF_FLARE_LIT) + { + if (Goal.health > TF_FLARE_LIT) + { + T_Heal(Player, Goal.health, TF_FLARE_LIT); + } + if (Goal.health < TF_FLARE_LIT) + { + if (TF_FLARE_LIT - Player.health > Goal.health) + { + Player.armorvalue = TF_FLARE_LIT; + T_Damage(Player, Goal, Goal, Player.health + TF_FLARE_OFF); + } + else + { + oa = Player.armorvalue; + Player.armorvalue = TF_FLARE_LIT; + T_Damage(Player, Goal, Goal, TF_FLARE_LIT - Goal.health); + Player.armorvalue = oa; + } + } + } + if (Player.health > TF_FLARE_LIT) + { + if (Goal.armortype) + { + Player.armortype = Goal.armortype; + } + Player.armorvalue = Player.armorvalue + Goal.armorvalue; + if (Goal.armorclass) + { + Player.armorclass = Goal.armorclass; + } + if (Goal.gravity > TF_FLARE_LIT) + { + Player.gravity = Goal.gravity; + } + Player.ammo_shells = Player.ammo_shells + Goal.ammo_shells; + Player.ammo_nails = Player.ammo_nails + Goal.ammo_nails; + Player.ammo_rockets = Player.ammo_rockets + Goal.ammo_rockets; + Player.ammo_cells = Player.ammo_cells + Goal.ammo_cells; + Player.ammo_medikit = Player.ammo_medikit + Goal.ammo_medikit; + Player.ammo_detpack = Player.ammo_detpack + Goal.ammo_detpack; + Player.no_grenades_1 = Player.no_grenades_1 + Goal.no_grenades_1; + Player.no_grenades_2 = Player.no_grenades_2 + Goal.no_grenades_2; + if (Player.no_grenades_1 > 4) + { + Player.no_grenades_1 = 4; + } + if (Player.no_grenades_2 > 4) + { + Player.no_grenades_2 = 4; + } + if (Player.ammo_detpack > Player.maxammo_detpack) + { + Player.ammo_detpack = Player.maxammo_detpack; + } + if (Goal.invincible_finished > TF_FLARE_LIT) + { + Player.items = Player.items | 1048576; + Player.invincible_time = TF_FLARE_OFF; + Player.invincible_finished = time + Goal.invincible_finished; + if (Goal.classname == "item_tfgoal") + { + Player.tfstate = Player.tfstate | 32; + Player.invincible_finished = time + 666; + } + } + if (Goal.invisible_finished > TF_FLARE_LIT) + { + Player.items = Player.items | 524288; + Player.invisible_time = TF_FLARE_OFF; + Player.invisible_finished = time + Goal.invisible_finished; + if (Goal.classname == "item_tfgoal") + { + Player.tfstate = Player.tfstate | 64; + Player.invisible_finished = time + 666; + } + } + if (Goal.super_damage_finished > TF_FLARE_LIT) + { + Player.items = Player.items | 4194304; + Player.super_time = TF_FLARE_OFF; + Player.super_damage_finished = time + Goal.super_damage_finished; + if (Goal.classname == "item_tfgoal") + { + Player.tfstate = Player.tfstate | 128; + Player.super_damage_finished = time + 666; + } + } + if (Goal.radsuit_finished > TF_FLARE_LIT) + { + Player.items = Player.items | 2097152; + Player.rad_time = TF_FLARE_OFF; + Player.radsuit_finished = time + Goal.radsuit_finished; + if (Goal.classname == "item_tfgoal") + { + Player.tfstate = Player.tfstate | 256; + Player.radsuit_finished = time + 666; + } + } + } + Player.lives = Player.lives + Goal.lives; + Player.real_frags = Player.real_frags + Goal.frags; + if (!(toggleflags & 128)) + { + Player.frags = Player.real_frags; + } + + oldself = self; + self = Player; + TeamFortress_CheckClassStats(); + W_SetCurrentAmmo(); + self = oldself; + } + if (Player.playerclass == 8 && (Goal.goal_result & 16)) + { + self.immune_to_check = time + 4; + Spy_RemoveDisguise(Player); + } + if (Goal.items != TF_FLARE_LIT && Goal.classname != "item_tfgoal") + { + te = Finditem(Goal.items); + if (te) + { + tfgoalitem_GiveToPlayer(te, Player, Goal); + } + } + if (Goal.axhitme != TF_FLARE_LIT) + { + te = Finditem(Goal.axhitme); + if (te.owner == Player) + { + tfgoalitem_RemoveFromPlayer(te, Player, TF_FLARE_OFF); + } + } + if (Goal.remove_item_group != TF_FLARE_LIT) + { + te = find(world, classname, "item_tfgoal"); + while (te) + { + if (te.group_no == Goal.remove_item_group && te.owner == AP) + { + oldte = te; + te = find(te, classname, "item_tfgoal"); + tfgoalitem_RemoveFromPlayer(oldte, Player, TF_FLARE_OFF); + } + else + { + te = find(te, classname, "item_tfgoal"); + } + } + } + if (Goal.display_item_status1 != TF_FLARE_LIT) + { + te = Finditem(Goal.display_item_status1); + if (te) + { + DisplayItemStatus(Goal, Player, te); + } + else + { + sprint(Player, 2, "Item is missing.\n"); + } + } + if (Goal.display_item_status2 != TF_FLARE_LIT) + { + te = Finditem(Goal.display_item_status2); + if (te) + { + DisplayItemStatus(Goal, Player, te); + } + else + { + sprint(Player, 2, "Item is missing.\n"); + } + } + if (Goal.display_item_status3 != TF_FLARE_LIT) + { + te = Finditem(Goal.display_item_status3); + if (te) + { + DisplayItemStatus(Goal, Player, te); + } + else + { + sprint(Player, 2, "Item is missing.\n"); + } + } + if (Goal.display_item_status4 != TF_FLARE_LIT) + { + te = Finditem(Goal.display_item_status4); + if (te) + { + DisplayItemStatus(Goal, Player, te); + } + else + { + sprint(Player, 2, "Item is missing.\n"); + } + } + if (Player.autodiscard) + { + oldself = self; + self = Player; + TeamFortress_Discard (); + self = oldself; + } +}; + +void(entity Goal, entity Player) RemoveResults = +{ + local entity oldself; + local entity te; + local float puinvin; + local float puinvis; + local float puquad; + local float purad; + if (Goal.classname == "item_tfgoal") + { + if (!(Player.item_list & Goal.item_list)) + { + return; + } + if (Goal.goal_activation & 1024) + { + return; + } + Player.item_list = Player.item_list - (Player.item_list & Goal.item_list); + } + if (Goal.health > TF_FLARE_LIT) + { + TF_T_Damage(Player, Goal, Goal, Goal.health, TF_FLARE_OFF, TF_FLARE_LIT); + } + if (Goal.health < TF_FLARE_LIT) + { + T_Heal(Player, TF_FLARE_LIT - Goal.health, TF_FLARE_LIT); + } + Player.lives = Player.lives - Goal.lives; + Player.armortype = Player.armortype - Goal.armortype; + Player.armorvalue = Player.armorvalue - Goal.armorvalue; + Player.armorclass = Player.armorclass - (Player.armorclass & Goal.armorclass); + Player.real_frags = Player.real_frags - Goal.frags; + if (!(toggleflags & 128)) + { + Player.frags = Player.real_frags; + } + Player.ammo_shells = Player.ammo_shells - Goal.ammo_shells; + Player.ammo_nails = Player.ammo_nails - Goal.ammo_nails; + Player.ammo_rockets = Player.ammo_rockets - Goal.ammo_rockets; + Player.ammo_cells = Player.ammo_cells - Goal.ammo_cells; + Player.ammo_medikit = Player.ammo_medikit - Goal.ammo_medikit; + Player.ammo_detpack = Player.ammo_detpack - Goal.ammo_detpack; + Player.no_grenades_1 = Player.no_grenades_1 - Goal.no_grenades_1; + Player.no_grenades_2 = Player.no_grenades_2 - Goal.no_grenades_2; + puinvin = TF_FLARE_LIT; + puinvis = TF_FLARE_LIT; + puquad = TF_FLARE_LIT; + purad = TF_FLARE_LIT; + te = find(world, classname, "item_tfgoal"); + while (te) + { + if (te.owner == Player && te != Goal) + { + if (te.invincible_finished > TF_FLARE_LIT) + { + puinvin = TF_FLARE_OFF; + } + if (te.invisible_finished > TF_FLARE_LIT) + { + puinvis = TF_FLARE_OFF; + } + if (te.super_damage_finished > TF_FLARE_LIT) + { + puquad = TF_FLARE_OFF; + } + if (te.radsuit_finished > TF_FLARE_LIT) + { + purad = TF_FLARE_OFF; + } + } + te = find(te, classname, "item_tfgoal"); + } + if (Goal.invincible_finished > TF_FLARE_LIT && !puinvin) + { + Player.tfstate = Player.tfstate - (Player.tfstate & 32); + Player.items = Player.items | 1048576; + Player.invincible_time = TF_FLARE_OFF; + Player.invincible_finished = time + Goal.invincible_finished; + } + if (Goal.invisible_finished > TF_FLARE_LIT && !puinvis) + { + Player.tfstate = Player.tfstate - (Player.tfstate & 64); + Player.items = Player.items | 524288; + Player.invisible_time = TF_FLARE_OFF; + Player.invisible_finished = time + Goal.invisible_finished; + } + if (Goal.super_damage_finished > TF_FLARE_LIT && !puquad) + { + Player.tfstate = Player.tfstate - (Player.tfstate & 128); + Player.items = Player.items | 4194304; + Player.super_time = TF_FLARE_OFF; + Player.super_damage_finished = time + Goal.super_damage_finished; + } + if (Goal.radsuit_finished > TF_FLARE_LIT && !purad) + { + Player.tfstate = Player.tfstate - (Player.tfstate & 256); + Player.items = Player.items | 2097152; + Player.rad_time = TF_FLARE_OFF; + Player.radsuit_finished = time + Goal.radsuit_finished; + } + oldself = self; + self = Player; + TeamFortress_CheckClassStats(); + W_SetCurrentAmmo(); + self = oldself; +}; + +float(entity Goal, entity AP) APMeetsCriteria = +{ + local float gotone; + local entity te; + if (AP != world) + { + if (Goal.team_no) + { + if (Goal.team_no != AP.team_no) + { + return TF_FLARE_LIT; + } + } + if (Goal.playerclass) + { + if (Goal.playerclass != AP.playerclass) + { + return TF_FLARE_LIT; + } + } + if (Goal.items_allowed) + { + te = Finditem(Goal.items_allowed); + if (te.owner != AP) + { + return TF_FLARE_LIT; + } + } + } + if (Goal.if_goal_is_active) + { + te = Findgoal(Goal.if_goal_is_active); + if (te.goal_state != TF_FLARE_OFF) + { + return TF_FLARE_LIT; + } + } + if (Goal.if_goal_is_inactive) + { + te = Findgoal(Goal.if_goal_is_inactive); + if (te.goal_state != 2) + { + return TF_FLARE_LIT; + } + } + if (Goal.if_goal_is_removed) + { + te = Findgoal(Goal.if_goal_is_removed); + if (te.goal_state != 3) + { + return TF_FLARE_LIT; + } + } + if (Goal.if_group_is_active) + { + te = find(world, classname, "info_tfgoal"); + while (te) + { + if (te.group_no == Goal.if_group_is_active) + { + if (te.goal_state != TF_FLARE_OFF) + { + return TF_FLARE_LIT; + } + } + te = find(te, classname, "info_tfgoal"); + } + } + if (Goal.if_group_is_inactive) + { + te = find(world, classname, "info_tfgoal"); + while (te) + { + if (te.group_no == Goal.if_group_is_inactive) + { + if (te.goal_state != 2) + { + return TF_FLARE_LIT; + } + } + te = find(te, classname, "info_tfgoal"); + } + } + if (Goal.if_group_is_removed) + { + te = find(world, classname, "info_tfgoal"); + while (te) + { + if (te.group_no == Goal.if_group_is_removed) + { + if (te.goal_state != 3) + { + return TF_FLARE_LIT; + } + } + te = find(te, classname, "info_tfgoal"); + } + } + if (Goal.if_item_has_moved) + { + te = Finditem(Goal.if_item_has_moved); + if (te) + { + if (te.goal_state != TF_FLARE_OFF && te.origin == te.oldorigin) + { + return TF_FLARE_LIT; + } + } + } + if (Goal.if_item_hasnt_moved) + { + te = Finditem(Goal.if_item_hasnt_moved); + if (te) + { + if (te.goal_state == TF_FLARE_OFF || te.origin != te.oldorigin) + { + return TF_FLARE_LIT; + } + } + } + if (AP != world) + { + gotone = TF_FLARE_LIT; + if (Goal.has_item_from_group) + { + te = find(world, classname, "item_tfgoal"); + while (te != world && !gotone) + { + if (te.group_no == Goal.has_item_from_group && te.owner == AP) + { + gotone = TF_FLARE_OFF; + } + te = find(te, classname, "item_tfgoal"); + } + if (!gotone) + { + return TF_FLARE_LIT; + } + } + } + return TF_FLARE_OFF; +}; + +void(entity Goal) SetupRespawn = +{ + if (Goal.search_time != TF_FLARE_LIT) + { + InactivateGoal(Goal); + Goal.think = tfgoal_timer_tick; + Goal.nextthink = time + Goal.search_time; + return; + } + if (Goal.goal_result & TF_FLARE_OFF) + { + RemoveGoal(Goal); + return; + } + if (Goal.wait > TF_FLARE_LIT) + { + Goal.nextthink = time + Goal.wait; + Goal.think = DoRespawn; + return; + } + else + { + if (Goal.wait == -1) + { + return; + } + } + InactivateGoal(Goal); +}; + +void() DoRespawn = +{ + RestoreGoal(self); + InactivateGoal(self); +}; + +float(entity Goal, entity AP) Activated = +{ + local float APMet; + local float RevAct; + local float Act; + if (Goal.goal_state == TF_FLARE_OFF) + { + return TF_FLARE_LIT; + } + if (Goal.goal_state == 3) + { + return TF_FLARE_LIT; + } + if (Goal.goal_state == 4) + { + return TF_FLARE_LIT; + } + APMet = APMeetsCriteria(Goal, AP); + if (Goal.classname == "item_tfgoal") + { + RevAct = Goal.goal_activation & 64; + } + else + { + RevAct = Goal.goal_activation & 4; + } + Act = TF_FLARE_LIT; + if (APMet) + { + if (!RevAct) + { + Act = TF_FLARE_OFF; + } + } + else + { + if (RevAct) + { + Act = TF_FLARE_OFF; + } + } + return Act; +}; + +void(entity Goal, entity AP, entity ActivatingGoal) AttemptToActivate = +{ + local entity te; + if (Activated(Goal, AP)) + { + if (ActivatingGoal == Goal) + { + DoResults(Goal, AP, TF_FLARE_OFF); + } + else + { + if (ActivatingGoal != world) + { + DoResults(Goal, AP, ActivatingGoal.goal_result & 2); + } + else + { + DoResults(Goal, AP, TF_FLARE_LIT); + } + } + } + else + { + if (Goal.else_goal != TF_FLARE_LIT) + { + te = Findgoal(Goal.else_goal); + if (te) + { + AttemptToActivate(te, AP, ActivatingGoal); + } + } + } +}; + +void(entity Goal, entity AP) DoGoalWork = +{ + local entity te; + local entity RI; + if (Goal.activate_goal_no != TF_FLARE_LIT) + { + te = Findgoal(Goal.activate_goal_no); + if (te) + { + AttemptToActivate(te, AP, Goal); + } + } + if (Goal.inactivate_goal_no != TF_FLARE_LIT) + { + te = Findgoal(Goal.inactivate_goal_no); + if (te) + { + InactivateGoal(te); + } + } + if (Goal.restore_goal_no != TF_FLARE_LIT) + { + te = Findgoal(Goal.restore_goal_no); + if (te) + { + RestoreGoal(te); + } + } + if (Goal.remove_goal_no != TF_FLARE_LIT) + { + te = Findgoal(Goal.remove_goal_no); + if (te) + { + RemoveGoal(te); + } + } + if (Goal.return_item_no != TF_FLARE_LIT) + { + te = Finditem(Goal.return_item_no); + if (te) + { + if (te.goal_state == TF_FLARE_OFF) + { + tfgoalitem_RemoveFromPlayer(te, te.owner, TF_FLARE_OFF); + } + RI = spawn(); + RI.enemy = te; + RI.think = ReturnItem; + RI.nextthink = time + 0.1; + te.solid = TF_FLARE_LIT; + } + } + if (Goal.remove_spawnpoint != TF_FLARE_LIT) + { + te = Findteamspawn(Goal.remove_spawnpoint); + if (te) + { + te.goal_state = 3; + te.team_str_home = string_null; + } + } + if (Goal.restore_spawnpoint != TF_FLARE_LIT) + { + te = Findteamspawn(Goal.restore_spawnpoint); + if (te) + { + if (te.goal_state == 3) + { + te.goal_state = 2; + if (te.team_no == TF_FLARE_OFF) + { + te.team_str_home = "ts1"; + } + else + { + if (te.team_no == 2) + { + te.team_str_home = "ts2"; + } + else + { + if (te.team_no == 3) + { + te.team_str_home = "ts3"; + } + else + { + if (te.team_no == 4) + { + te.team_str_home = "ts4"; + } + } + } + } + } + } + } +}; + +void(entity Goal, entity AP) DoGroupWork = +{ + local string st; + local entity tg; + local float allset; + if (Goal.all_active != TF_FLARE_LIT) + { + if (Goal.last_impulse == TF_FLARE_LIT) + { + dprint("Goal "); + st = ftos(Goal.goal_no); + dprint(st); + dprint(" has a .all_active specified, but no .last_impulse\n"); + } + else + { + allset = TF_FLARE_OFF; + tg = find(world, classname, "info_tfgoal"); + while (tg) + { + if (tg.group_no == Goal.all_active) + { + if (tg.goal_state != TF_FLARE_OFF) + { + allset = TF_FLARE_LIT; + } + } + tg = find(tg, classname, "info_tfgoal"); + } + if (allset) + { + tg = Findgoal(Goal.last_impulse); + if (tg) + { + DoResults(tg, AP, Goal.goal_result & 2); + } + } + } + } + if (Goal.activate_group_no != TF_FLARE_LIT) + { + tg = find(world, classname, "info_tfgoal"); + while (tg) + { + if (tg.group_no == Goal.activate_group_no) + { + DoResults(tg, AP, TF_FLARE_LIT); + } + tg = find(tg, classname, "info_tfgoal"); + } + } + if (Goal.inactivate_group_no != TF_FLARE_LIT) + { + tg = find(world, classname, "info_tfgoal"); + while (tg) + { + if (tg.group_no == Goal.inactivate_group_no) + { + InactivateGoal(tg); + } + tg = find(tg, classname, "info_tfgoal"); + } + } + if (Goal.remove_group_no != TF_FLARE_LIT) + { + tg = find(world, classname, "info_tfgoal"); + while (tg) + { + if (tg.group_no == Goal.remove_group_no) + { + RemoveGoal(tg); + } + tg = find(tg, classname, "info_tfgoal"); + } + } + if (Goal.restore_group_no != TF_FLARE_LIT) + { + tg = find(world, classname, "info_tfgoal"); + while (tg) + { + if (tg.group_no == Goal.restore_group_no) + { + RestoreGoal(tg); + } + tg = find(tg, classname, "info_tfgoal"); + } + } + if (Goal.remove_spawngroup != TF_FLARE_LIT) + { + tg = find(world, classname, "info_player_teamspawn"); + while (tg) + { + if (tg.group_no == Goal.remove_spawngroup) + { + tg.goal_state = 3; + tg.team_str_home = string_null; + } + tg = find(tg, classname, "info_player_teamspawn"); + } + } + if (Goal.restore_spawngroup != TF_FLARE_LIT) + { + tg = find(world, classname, "info_player_teamspawn"); + while (tg) + { + if (tg.group_no == Goal.restore_spawngroup) + { + tg.goal_state = 2; + if (tg.team_no == TF_FLARE_OFF) + { + tg.team_str_home = "ts1"; + } + else + { + if (tg.team_no == 2) + { + tg.team_str_home = "ts2"; + } + else + { + if (tg.team_no == 3) + { + tg.team_str_home = "ts3"; + } + else + { + if (tg.team_no == 4) + { + tg.team_str_home = "ts4"; + } + } + } + } + } + tg = find(tg, classname, "info_player_teamspawn"); + } + } +}; + +void(entity Item, entity AP) DoItemGroupWork = +{ + local entity tg; + local entity carrier; + local float allcarried; + local string st; + allcarried = TF_FLARE_OFF; + if (Item.distance != TF_FLARE_LIT) + { + if (Item.pain_finished == TF_FLARE_LIT) + { + dprint("GoalItem "); + st = ftos(Item.goal_no); + dprint(st); + dprint(" has a .distance specified, but no .pain_finished\n"); + } + tg = find(world, classname, "item_tfgoal"); + while (tg) + { + if (tg.group_no == Item.distance) + { + if (tg.goal_state != TF_FLARE_OFF) + { + allcarried = TF_FLARE_LIT; + } + } + tg = find(tg, classname, "item_tfgoal"); + } + if (allcarried == TF_FLARE_OFF) + { + tg = Findgoal(Item.pain_finished); + if (tg) + { + DoResults(tg, AP, Item.goal_result & 2); + } + } + } + allcarried = TF_FLARE_OFF; + if (Item.speed != TF_FLARE_LIT) + { + if (Item.attack_finished == TF_FLARE_LIT) + { + dprint("GoalItem "); + st = ftos(Item.goal_no); + dprint(st); + dprint(" has a .speed specified, but no .attack_finished\n"); + } + carrier = world; + tg = find(world, classname, "item_tfgoal"); + while (tg) + { + if (tg.group_no == Item.speed) + { + if (tg.goal_state != TF_FLARE_OFF) + { + allcarried = TF_FLARE_LIT; + } + else + { + if (carrier == world) + { + carrier = tg.owner; + } + else + { + if (carrier != tg.owner) + { + allcarried = TF_FLARE_LIT; + } + } + } + } + tg = find(tg, classname, "item_tfgoal"); + } + if (allcarried == TF_FLARE_OFF) + { + tg = Findgoal(Item.attack_finished); + if (tg) + { + DoResults(tg, AP, Item.goal_result & 2); + } + } + } +}; + +void(entity Goal, entity AP) DoTriggerWork = +{ + local entity t; + if (Goal.killtarget) + { + t = world; + do + { + t = find(t, targetname, Goal.killtarget); + if (t != world) + { + remove(t); + } + } while (t != world); + } + if (Goal.target) + { + t = world; + activator = AP; + do + { + t = find(t, targetname, Goal.target); + if (t == world) + { + return; + } + stemp = self; + otemp = other; + self = t; + other = stemp; + if (self.use != SUB_Null) + { + if (self.use) + { + self.use(); + } + } + self = stemp; + other = otemp; + activator = AP; + } while (t != world); + } +}; + +void() DelayedResult = +{ + if (self.enemy.goal_state == 4) + { + DoResults(self.enemy, self.owner, self.weapon); + } + dremove(self); +}; + +void(entity Goal, entity AP, float addb) DoResults = +{ + local entity te; + local float winners; + + if (Goal.goal_state == TF_FLARE_OFF) + { + return; + } + if (Goal.delay_time > TF_FLARE_LIT && Goal.goal_state != 4) + { + Goal.goal_state = 4; + te = spawn(); + te.think = DelayedResult; + te.nextthink = time + Goal.delay_time; + te.owner = AP; + te.enemy = Goal; + te.weapon = addb; + return; + } + UpdateAbbreviations(Goal); + Goal.goal_state = 2; + if (Goal.noise) + { + if (Goal.volume == TF_FLARE_OFF) + { + sound(other, 3, Goal.noise, TF_FLARE_OFF, TF_FLARE_LIT); + } + else + { + sound(other, 3, Goal.noise, TF_FLARE_OFF, TF_FLARE_OFF); + } + } + winners = TF_FLARE_LIT; + if (Goal.increase_team1 != TF_FLARE_LIT) + { + TeamFortress_TeamIncreaseScore(TF_FLARE_OFF, Goal.increase_team1); + winners = TF_FLARE_OFF; + } + if (Goal.increase_team2 != TF_FLARE_LIT) + { + TeamFortress_TeamIncreaseScore(2, Goal.increase_team2); + winners = TF_FLARE_OFF; + } + if (Goal.increase_team3 != TF_FLARE_LIT) + { + TeamFortress_TeamIncreaseScore(3, Goal.increase_team3); + winners = TF_FLARE_OFF; + } + if (Goal.increase_team4 != TF_FLARE_LIT) + { + TeamFortress_TeamIncreaseScore(4, Goal.increase_team4); + winners = TF_FLARE_OFF; + } + if (winners == TF_FLARE_OFF) + { + TeamFortress_TeamShowScores(2); + } + te = find(world, classname, "player"); + while (te != world) + { + if (Goal.broadcast != string_null && CTF_Map == TF_FLARE_LIT) + { + CenterPrint2(te, "\n\n\n", Goal.broadcast); + } + if (Goal.netname_broadcast != string_null && CTF_Map == TF_FLARE_LIT) + { + sprint(te, 2, AP.netname); + sprint(te, 2, Goal.netname_broadcast); + } + if (AP == te) + { + if (Goal.message != string_null) + { + CenterPrint2(te, Goal.message, AP.netname); + } + } + else + { + if (AP.team_no == te.team_no) + { + if (Goal.owners_team_broadcast != string_null && te.team_no == Goal.owned_by) + { + CenterPrint2(te, Goal.owners_team_broadcast, AP.netname); + } + else + { + if (Goal.team_broadcast != string_null) + { + CenterPrint2(te, Goal.team_broadcast, AP.netname); + } + } + if (Goal.netname_owners_team_broadcast != string_null && te.team_no == Goal.owned_by) + { + sprint(te, 2, AP.netname); + sprint(te, 2, Goal.netname_owners_team_broadcast); + } + else + { + if (Goal.netname_team_broadcast != string_null) + { + sprint(te, 2, AP.netname); + sprint(te, 2, Goal.netname_team_broadcast); + } + } + } + else + { + if (Goal.owners_team_broadcast != string_null && te.team_no == Goal.owned_by) + { + CenterPrint2(te, Goal.owners_team_broadcast, AP.netname); + } + else + { + if (Goal.non_team_broadcast != string_null) + { + CenterPrint2(te, Goal.non_team_broadcast, AP.netname); + } + } + if (Goal.netname_owners_team_broadcast != string_null && te.team_no == Goal.owned_by) + { + sprint(te, 2, AP.netname); + sprint(te, 2, Goal.netname_owners_team_broadcast); + } + else + { + if (Goal.netname_non_team_broadcast != string_null) + { + sprint(te, 2, AP.netname); + sprint(te, 2, Goal.netname_non_team_broadcast); + } + } + } + } + if (IsAffectedBy(Goal, te, AP)) + { + if (Goal.search_time != TF_FLARE_LIT && (Goal.goal_effects & 64)) + { + if (APMeetsCriteria(Goal, te)) + { + Apply_Results(Goal, te, AP, addb); + } + } + else + { + Apply_Results(Goal, te, AP, addb); + } + } + te = find(te, classname, "player"); + } + if (Goal.classname != "item_tfgoal") + { + Goal.goal_state = TF_FLARE_OFF; + } + if (Goal.goal_result & 4) + { + TeamFortress_TeamShowScores(TF_FLARE_OFF); + winners = TeamFortress_TeamGetWinner(); + te = find(world, classname, "player"); + while (te) + { + te.takedamage = TF_FLARE_LIT; + te.movetype = TF_FLARE_LIT; + te.velocity = '0 0 0'; + te.avelocity = '0 0 0'; + te = find(te, classname, "player"); + } + te = spawn(); + te.nextthink = time + 5; + te.think = execute_changelevel; + dremove(Goal); + return; + } + + DoGroupWork(Goal, AP); + DoGoalWork(Goal, AP); + DoTriggerWork(Goal, AP); + if (Goal.classname == "info_tfgoal") + { + SetupRespawn(Goal); + } +}; + +void() tfgoal_touch = +{ + if (!(self.goal_activation & TF_FLARE_OFF)) + { + return; + } + if (other.classname != "player") + { + return; + } + if (self.goal_state == TF_FLARE_OFF) + { + return; + } + AttemptToActivate(self, other, self); +}; + +void() info_tfgoal_use = +{ + AttemptToActivate(self, activator, self); +}; + +void() tfgoal_timer_tick = +{ + if (self.goal_state != 3) + { + if (APMeetsCriteria(self, world)) + { + DoResults(self, world, TF_FLARE_OFF); + } + else + { + InactivateGoal(self); + self.think = tfgoal_timer_tick; + self.nextthink = time + self.search_time; + } + } +}; + +void() item_tfgoal_touch = +{ + local entity te; + if (other.classname != "player") + { + return; + } + if (other.health <= TF_FLARE_LIT) + { + return; + } + if (other.is_feigning) // TF 2.9'd! + return; + // for flag dropping + if ( (self.tent == other) && (time < self.option5) ) + { + return; + } + if (Activated(self, other)) + { + tfgoalitem_GiveToPlayer(self, other, self); + self.goal_state = TF_FLARE_OFF; + } + else + { + if (self.else_goal != TF_FLARE_LIT) + { + te = Findgoal(self.else_goal); + if (te) + { + AttemptToActivate(te, other, self); + } + } + } +}; + +void(entity Item, entity AP, entity Goal) tfgoalitem_GiveToPlayer = +{ + Item.owner = AP; + if (Item.mdl != string_null) + { + setmodel(Item, string_null); + } + Item.solid = TF_FLARE_LIT; + if (Item.goal_activation & TF_FLARE_OFF) + { + AP.effects = AP.effects | 8; + } + if (Item.goal_activation & 2) + { + TeamFortress_SetSpeed(AP); + } + if (Item.goal_activation & 512) + { + Item.effects = Item.effects - (Item.effects | 8); + } + if (Item.items & 131072) + { + AP.items = AP.items | 131072; + AP.effects = AP.effects | 64; + newmis = spawn(); + newmis.owner = AP; + newmis.movetype = 4; + newmis.solid = TF_FLARE_LIT; + setsize(newmis, '0 0 0', '0 0 0'); + newmis.angles = AP.angles; + newmis.nextthink = time + 0.5; + newmis.think = MoveFlag; + newmis.skin = TF_FLARE_OFF; + setmodel(newmis, "progs/tf_flag.mdl"); + setorigin(newmis, AP.origin); + } + if (Item.items & 262144) + { + AP.items = AP.items | 262144; + AP.effects = AP.effects | 128; + newmis = spawn(); + newmis.owner = AP; + newmis.movetype = 4; + newmis.solid = TF_FLARE_LIT; + setsize(newmis, '0 0 0', '0 0 0'); + newmis.angles = AP.angles; + newmis.nextthink = time + 0.5; + newmis.think = MoveFlag; + newmis.skin = 2; + setmodel(newmis, "progs/tf_flag.mdl"); + setorigin(newmis, AP.origin); + } + if (Goal != Item) + { + if (Goal.goal_result & 8) + { + Item.goal_state = TF_FLARE_OFF; + return; + } + } + if (AP.playerclass == 8 && (Item.goal_result & 16)) + { + AP.is_unabletospy = TF_FLARE_OFF; + } + DoResults(Item, AP, TF_FLARE_OFF); + DoItemGroupWork(Item, AP); +}; + +void() ReturnItem = +{ + self.enemy.goal_state = 2; + self.enemy.solid = TF_FLARE_OFF; + self.enemy.movetype = TF_FLARE_LIT; + self.enemy.touch = item_tfgoal_touch; + self.enemy.origin = self.enemy.oldorigin; + if (self.enemy.mdl != string_null) + { + setmodel(self.enemy, self.enemy.mdl); + } + setorigin(self.enemy, self.enemy.origin); + sound(self.enemy, 2, "items/itembk2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + tfgoalitem_checkgoalreturn(self.enemy); + dremove(self); +}; + +#ifdef clan_progs +void (entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer = +{ + local entity te; + local float lighton; + local float slowon; + local float key1on; + local float key2on; + local float spyoff; + local entity DelayReturn; + + if (Item == world) { + objerror ("error: tfgoalitem_RemoveFromPlayer(): Item == world"); + return; + } + lighton = 0; + slowon = 0; + key1on = 0; + key2on = 0; + spyoff = 0; + + te = find (world, classname, "item_tfgoal"); + while (te) { + if ((te.owner == AP) && (te != Item)) { + if (te.goal_activation & 1) + lighton = 1; + + if (te.goal_activation & 2) + slowon = 1; + + if (te.items & 131072) + key1on = 1; + + if (te.items & 262144) + key2on = 1; + + if (te.goal_result & 16) + spyoff = 1; + } + te = find (te, classname, "item_tfgoal"); + } + if (!lighton) { + if (AP.invincible_finished > (time + 3)) { + lighton = 1; + } else if (AP.super_damage_finished > (time + 3)) { + lighton = 1; + } + } + if (!lighton) { + AP.effects = AP.effects - (AP.effects & 8); + AP.effects = AP.effects - (AP.effects & 64); + AP.effects = AP.effects - (AP.effects & 128); + } + if (Item.goal_activation & 512) + Item.effects = Item.effects | 8; + + if (!spyoff) + AP.is_unabletospy = 0; + + if (!key1on) + AP.items = AP.items - (AP.items & 131072); + + if (!key2on) + AP.items = AP.items - (AP.items & 262144); + + te = find (world, classname, "player"); + while (te != world) { + if (IsAffectedBy (Item, te, AP)) + RemoveResults (Item, te); + te = find (te, classname, "player"); + } + if ((method == 0) || (method == 2)) { + te = find (world, classname, "player"); + while (te != world) { + if (te.team_no == Item.owned_by) { + if (Item.team_drop != string_null) + CenterPrint2 (te, "\n\n\n", Item.team_drop); + + if (Item.netname_team_drop != string_null) { + sprint (te, 2, AP.netname, Item.netname_team_drop); + } + } else { + if (Item.non_team_drop != string_null) + CenterPrint2 (te, "\n\n\n", Item.non_team_drop); + + if (Item.netname_non_team_drop != string_null) { + sprint (te, 2, AP.netname, Item.netname_non_team_drop); + } + } + te = find (te, classname, "player"); + } + if (Item.goal_activation & 8) { + DelayReturn = spawn (); + DelayReturn.enemy = Item; + if (method == 0) { + DelayReturn.weapon = 0; + } else { + DelayReturn.weapon = 1; + } + DelayReturn.think = ReturnItem; + DelayReturn.nextthink = time + 0.5; + } else { + if (Item.goal_activation & 4) { + if ((method == 2) /*&& (Item.goal_activation & 4096)*/) { + tfgoalitem_drop (Item, 1, AP); + } else { + tfgoalitem_drop (Item, 0, AP); + } + } else { + Item.owner = world; + dremove (Item); + TeamFortress_SetSpeed (AP); + return; + } + } + Item.owner = world; + Item.flags = Item.flags - (Item.flags & 512); +// setsize (Item, Item.goal_min, Item.goal_max); + setsize(Item, '-16 -16 0', '16 16 56'); // mtf size + TeamFortress_SetSpeed (AP); + return; + } else { + if (method == 1) { + if (Item.goal_activation & 16) { + DelayReturn = spawn (); + DelayReturn.enemy = Item; + DelayReturn.weapon = 2; + DelayReturn.think = ReturnItem; + DelayReturn.nextthink = time + 0.5; + Item.owner = world; + TeamFortress_SetSpeed (AP); + return; + } + Item.solid = 0; + Item.owner = world; + TeamFortress_SetSpeed (AP); + return; + } + } + objerror ("Invalid method passed into tfgoalitem_RemoveFromPlayer\n"); +}; +#else +void(entity Item, entity AP, float method) tfgoalitem_RemoveFromPlayer = +{ + local entity te; + local float lighton; + local float slowon; + local float key1on; + local float key2on; + local float spyoff; + local entity DelayReturn; + if (Item == world) + { + dprint("error: tfgoalitem_RemoveFromPlayer(): Item == world"); + return; + } + lighton = TF_FLARE_LIT; + slowon = TF_FLARE_LIT; + key1on = TF_FLARE_LIT; + key2on = TF_FLARE_LIT; + spyoff = TF_FLARE_LIT; + te = find(world, classname, "item_tfgoal"); + while (te) + { + if (te.owner == AP && te != Item) + { + if (te.goal_activation & TF_FLARE_OFF) + { + lighton = TF_FLARE_OFF; + } + if (te.goal_activation & 2) + { + slowon = TF_FLARE_OFF; + } + if (te.items & 131072) + { + key1on = TF_FLARE_OFF; + } + if (te.items & 262144) + { + key2on = TF_FLARE_OFF; + } + if (te.goal_result & 16) + { + spyoff = TF_FLARE_OFF; + } + } + te = find(te, classname, "item_tfgoal"); + } + if (!lighton) + { + if (AP.invincible_finished > time + 3) + { + lighton = TF_FLARE_OFF; + } + } + if (!lighton) + { + AP.effects = AP.effects - (AP.effects & 8); + } + if (Item.goal_activation & 512) + { + Item.effects = Item.effects | 8; + } + if (!spyoff) + { + AP.is_unabletospy = TF_FLARE_LIT; + } + if (!key1on) + { + AP.items = AP.items - (AP.items & 131072); + } + if (!key2on) + { + AP.items = AP.items - (AP.items & 262144); + } + te = find(world, classname, "player"); + while (te != world) + { + if (IsAffectedBy(Item, te, AP)) + { + RemoveResults(Item, te); + } + te = find(te, classname, "player"); + } + if ((method == TF_FLARE_LIT) || (method == 2)) + { + te = find(world, classname, "player"); + while (te != world) + { + if (te.team_no == Item.owned_by) + { + if (Item.team_drop != string_null) + { + CenterPrint2(te, "\n\n\n", Item.team_drop); + } + if (Item.netname_team_drop != string_null) + { + sprint(te, 2, AP.netname); + sprint(te, 2, Item.netname_team_drop); + } + } + else + { + if (Item.non_team_drop != string_null) + { + CenterPrint2(te, "\n\n\n", Item.non_team_drop); + } + if (Item.netname_non_team_drop != string_null) + { + sprint(te, 2, AP.netname); + sprint(te, 2, Item.netname_non_team_drop); + } + } + te = find(te, classname, "player"); + } + if (Item.goal_activation & 8) + { + DelayReturn = spawn(); + DelayReturn.enemy = Item; + DelayReturn.think = ReturnItem; + DelayReturn.nextthink = time + 0.5; + } + else + { + if (Item.goal_activation & 4) + { + if (method == 0) + tfgoalitem_drop(Item); + } + else + { + Item.owner = world; + dremove(Item); + TeamFortress_SetSpeed(AP); + return; + } + } + Item.owner = world; + TeamFortress_SetSpeed(AP); + return; + } + if (method == TF_FLARE_OFF) + { + if (Item.goal_activation & 16) + { + DelayReturn = spawn(); + DelayReturn.enemy = Item; + DelayReturn.think = ReturnItem; + DelayReturn.nextthink = time + 0.5; + Item.owner = world; + TeamFortress_SetSpeed(AP); + return; + } + Item.solid = TF_FLARE_LIT; + Item.owner = world; + TeamFortress_SetSpeed(AP); + return; + } + + dprint("Invalid method passed into tfgoalitem_RemoveFromPlayer\n"); +}; +#endif + +void() tfgoalitem_dropthink = +{ + local float pos; + if (self.userid == 1) + self.movetype = 6; + else + self.movetype = 10; //6; + + if (self.pausetime != TF_FLARE_LIT) + { + pos = pointcontents(self.origin); + if (pos == -4) + { + self.nextthink = time + self.pausetime / 4; + } + else + { + if (pos == -5) + { + self.nextthink = time + 5; + } + else + { + if (pos == -2 || pos == -6) + { + self.nextthink = time + 2; + } + else + { + self.nextthink = time + self.pausetime; + } + } + } + self.think = tfgoalitem_remove; + } +}; + +#ifdef clan_progs +void () tfgoalitem_droptouch = +{ + self.touch = item_tfgoal_touch; +// self.nextthink = time + 4.25; + self.nextthink = time + .25; + self.think = tfgoalitem_dropthink; +}; +/* +void (entity Item, float PAlive, entity P) tfgoalitem_drop = +{ + Item.origin = Item.owner.origin; + setorigin (Item, Item.origin); + Item.camangle = Item.owner.origin - '0 0 8'; + Item.camdist = 0; + Item.velocity_z = 400; + Item.velocity_x = -50 + (random () * 100); + Item.velocity_y = -50 + (random () * 100); + Item.goal_state = 2; + Item.movetype = 6; + if (Item.goal_activation & 8192) { + Item.solid = 2; + } else { + Item.solid = 1; + } + if (Item.mdl != string_null) { + setmodel (Item, Item.mdl); + } + setsize (Item, Item.goal_min, Item.goal_max); + Item.owner = P; + if (PAlive == 1) { + makevectors (P.v_angle); + if (P.v_angle_x) { + Item.velocity = (v_forward * 400) + (v_up * 200); + } else { + Item.velocity = aim (P, 10000); + Item.velocity = Item.velocity * 400; + Item.velocity_z = 200; + } + Item.touch = SUB_Null; + Item.nextthink = time + 0.75; + Item.think = tfgoalitem_droptouch; + } else { + Item.touch = item_tfgoal_touch; + Item.nextthink = time + 5; + Item.think = tfgoalitem_dropthink; + } +}; +*/ + +void (entity Item, float PAlive, entity P) tfgoalitem_drop = +{ + Item.origin = Item.owner.origin; + setorigin (Item, Item.origin); + Item.camangle = Item.owner.origin - '0 0 8'; + Item.camdist = 0; + Item.velocity_z = 50; + Item.velocity_x = -50 + (random () * 100); + Item.velocity_y = -50 + (random () * 100); + Item.goal_state = 2; + Item.movetype = 6; + if (Item.goal_activation & 8192) { + Item.solid = 2; + } else { + Item.solid = 1; + } + if (Item.mdl != string_null) { + setmodel (Item, Item.mdl); + } + //setsize (Item, Item.goal_min, Item.goal_max); + setsize(Item, '-16 -16 0', '16 16 56'); // MTF size + Item.owner = P; + if (PAlive == 1) + { + setsize(Item, '-16 -16 0', '16 16 56'); + makevectors (P.v_angle); + if (P.v_angle_x) + { + Item.velocity = (v_forward * 400) + (v_up * 200); + } + else + { + Item.velocity = aim (P, 10000); + Item.velocity = Item.velocity * 400; + Item.velocity_z = 200; + } + Item.userid = 1; + Item.touch = SUB_Null; + Item.nextthink = time + 0.25; + Item.think = tfgoalitem_droptouch; + } + else + { + Item.touch = item_tfgoal_touch; + Item.nextthink = time + 5; + Item.think = tfgoalitem_dropthink; + } +}; +#else +void(entity Item) tfgoalitem_drop = +{ + Item.origin = Item.owner.origin - '0 0 8'; + //Item.velocity_z = 400; + //Item.velocity_x = -50 + random() * 100; + //Item.velocity_y = -50 + random() * 100; + Item.velocity_z = 1; + Item.velocity_x = 0; + Item.velocity_y = 0; + Item.goal_state = 2; + Item.movetype = 6; + Item.solid = TF_FLARE_OFF; + Item.touch = item_tfgoal_touch; + setorigin(Item, Item.origin - '0 0 16'); + setsize(Item, '-16 -16 0', '16 16 56'); + if (Item.mdl != string_null) + { + setmodel(Item, Item.mdl); + } + Item.nextthink = time + 5; + Item.think = tfgoalitem_dropthink; +}; +#endif + +void() tfgoalitem_remove = +{ + local entity te; + if (self.goal_state == TF_FLARE_OFF) + { + return; + } + if (self.goal_activation & 32) + { + self.solid = TF_FLARE_OFF; + self.touch = item_tfgoal_touch; + self.origin = self.oldorigin; + if (self.mdl != string_null) + { + setmodel(self, self.mdl); + } + setorigin(self, self.origin); + sound(self, 2, "items/itembk2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + tfgoalitem_checkgoalreturn(self); + if (self.noise3 != string_null || self.noise4 != string_null) + { + te = find(world, classname, "player"); + while (te) + { + if (te.team_no == self.owned_by) + { + CenterPrint2(te, "\n\n\n", self.noise3); + } + else + { + CenterPrint2(te, "\n\n\n", self.noise4); + } + te = find(te, classname, "player"); + } + } + return; + } + dremove(self); +}; + +void(entity Item) tfgoalitem_checkgoalreturn = +{ + local entity te; + if (Item.impulse != TF_FLARE_LIT) + { + te = Findgoal(Item.impulse); + if (te) + { + te = Findgoal(Item.impulse); + if (te) + { + AttemptToActivate(te, world, Item); + } + } + } +}; + +void(entity Goal, entity Player, entity Item) DisplayItemStatus = +{ + if (Item.goal_state == TF_FLARE_OFF) + { + if (Player.team_no == Item.owned_by) + { + sprint(Player, 2, Goal.team_str_carried); + } + else + { + sprint(Player, 2, Goal.non_team_str_carried); + } + sprint(Player, 2, " "); + if (Player == Item.owner) + { + sprint(Player, 2, " You"); + } + else + { + sprint(Player, 2, Item.owner.netname); + } + sprint(Player, 2, "."); + } + else + { + if (Item.origin != Item.oldorigin) + { + if (Player.team_no == Item.owned_by) + { + sprint(Player, 2, Goal.team_str_moved); + } + else + { + sprint(Player, 2, Goal.non_team_str_moved); + } + } + else + { + if (Player.team_no == Item.owned_by) + { + sprint(Player, 2, Goal.team_str_home); + } + else + { + sprint(Player, 2, Goal.non_team_str_home); + } + } + } + sprint(Player, 2, "\n"); +}; + +void() info_player_team1 = +{ + CTF_Map = TF_FLARE_OFF; + self.classname = "info_player_teamspawn"; + self.team_no = 2; + self.goal_effects = TF_FLARE_OFF; + self.team_str_home = "ts2"; +}; + +void() info_player_team2 = +{ + CTF_Map = TF_FLARE_OFF; + self.classname = "info_player_teamspawn"; + self.team_no = TF_FLARE_OFF; + self.goal_effects = TF_FLARE_OFF; + self.team_str_home = "ts1"; +}; + +void() item_flag_team2 = +{ + local entity dp; + CTF_Map = TF_FLARE_OFF; + precache_model("progs/w_s_key.mdl"); + precache_sound("ogre/ogwake.wav"); + precache_sound("boss2/pop2.wav"); + self.classname = "item_tfgoal"; + self.netname = "Team 1 Flag"; + self.broadcast = " ÇÏÔ the enemy team's flag!\n"; + self.deathtype = "You've got the enemy flag!\n"; + self.noise = "ogre/ogwake.wav"; + self.mdl = "progs/tf_flag.mdl"; + self.skin = TF_FLARE_LIT; + setmodel(self, self.mdl); + self.goal_no = TF_FLARE_OFF; + self.goal_activation = TF_FLARE_OFF | 4 | 128 | 32 | 16 | 512; + self.goal_effects = TF_FLARE_OFF; + self.pausetime = 128; + setsize(self, '-16 -16 -24', '16 16 32'); + self.touch = item_tfgoal_touch; + self.goal_state = 2; + self.solid = TF_FLARE_OFF; + setorigin(self, self.origin); + self.nextthink = time + 0.2; + self.think = TF_PlaceItem; + dp = spawn(); + dp.origin = self.origin; + dp.classname = "info_tfgoal"; + dp.goal_activation = TF_FLARE_OFF; + dp.team_no = TF_FLARE_OFF; + dp.items_allowed = 2; + dp.goal_no = 3; + dp.goal_effects = 3; + dp.broadcast = " ÃÁÐÔÕÒÅÄ the enemy flag!\n"; + dp.message = "You ÃÁÐÔÕÒÅÄ the enemy flag!\n"; + dp.noise = "boss2/pop2.wav"; + dp.goal_result = 2; + dp.activate_goal_no = 5; + dp.axhitme = 2; + dp.count = 10; + dp.frags = 10; + dp.solid = TF_FLARE_OFF; + dp.goal_state = 2; + setsize(dp, '-16 -16 -24', '16 16 32'); + dp.nextthink = time + 0.2; + dp.think = TF_PlaceGoal; + dp = spawn(); + dp.origin = dp.origin; + dp.classname = "info_tfgoal"; + dp.goal_effects = TF_FLARE_OFF; + dp.frags = 5; + dp.goal_activation = TF_FLARE_LIT; + dp.goal_no = 5; + dp.solid = TF_FLARE_LIT; + dp.goal_state = 2; + setsize(dp, '-16 -16 -24', '16 16 32'); + dp.nextthink = time + 0.2; + dp.think = TF_PlaceGoal; +}; + +void() item_flag_team1 = +{ + local entity dp; + CTF_Map = TF_FLARE_OFF; + precache_model("progs/tf_flag.mdl"); + precache_sound("ogre/ogwake.wav"); + precache_sound("boss2/pop2.wav"); + self.classname = "item_tfgoal"; + self.netname = "Team 2 Flag"; + self.broadcast = " ÇÏÔ the enemy team's flag!\n"; + self.deathtype = "You've got the enemy flag!\n"; + self.noise = "ogre/ogwake.wav"; + self.mdl = "progs/tf_flag.mdl"; + setmodel(self, self.mdl); + self.skin = TF_FLARE_OFF; + self.goal_no = 2; + self.goal_activation = TF_FLARE_OFF | 4 | 128 | 32 | 16 | 512; + self.goal_effects = TF_FLARE_OFF; + self.pausetime = 128; + setsize(self, '-16 -16 -24', '16 16 32'); + self.touch = item_tfgoal_touch; + self.goal_state = 2; + self.solid = TF_FLARE_OFF; + setorigin(self, self.origin); + self.nextthink = time + 0.2; + self.think = TF_PlaceItem; + dp = spawn(); + dp.origin = self.origin; + dp.classname = "info_tfgoal"; + dp.goal_activation = TF_FLARE_OFF; + dp.team_no = 2; + dp.items_allowed = TF_FLARE_OFF; + dp.goal_no = 4; + dp.goal_effects = 3; + dp.broadcast = " ÃÁÐÔÕÒÅÄ the enemy flag!\n"; + dp.message = "You ÃÁÐÔÕÒÅÄ the enemy flag!\n"; + dp.noise = "boss2/pop2.wav"; + dp.goal_result = 2; + dp.activate_goal_no = 6; + dp.axhitme = TF_FLARE_OFF; + dp.count = 10; + dp.frags = 10; + dp.solid = TF_FLARE_OFF; + dp.goal_state = 2; + setsize(dp, '-16 -16 -24', '16 16 32'); + dp.nextthink = time + 0.2; + dp.think = TF_PlaceGoal; + dp = spawn(); + dp.origin = dp.origin; + dp.classname = "info_tfgoal"; + dp.goal_effects = TF_FLARE_OFF; + dp.frags = 5; + dp.goal_activation = TF_FLARE_LIT; + dp.goal_no = 6; + dp.solid = TF_FLARE_LIT; + dp.goal_state = 2; + setsize(dp, '-16 -16 -24', '16 16 32'); + dp.nextthink = time + 0.2; + dp.think = TF_PlaceGoal; +}; + +void() CTF_FlagCheck = +{ + local entity te; + local float flagcount; + local float pos; + flagcount = TF_FLARE_LIT; + te = find(world, classname, "item_tfgoal"); + while (te != world) + { + if (te.goal_no == TF_FLARE_OFF) + { + pos = pointcontents(te.origin); + if (pos == -2 || pos == -6) + { + dprint("*****BUG*****\nFlag(s) outside world.\nPlease report this.\n"); + te.nextthink = time + 0.2; + te.think = tfgoalitem_remove; + } + flagcount = flagcount + TF_FLARE_OFF; + } + else + { + if (te.goal_no == 2) + { + pos = pointcontents(te.origin); + if (pos == -2 || pos == -6) + { + dprint("*****BUG*****\nFlag(s) outside world.\nPlease report this.\n"); + te.nextthink = time + 0.2; + te.think = tfgoalitem_remove; + } + flagcount = flagcount + TF_FLARE_OFF; + } + } + te = find(te, classname, "item_tfgoal"); + } + if (flagcount != 2) + { + dprint("*****BUG*****\nFlag(s) missing.\nPlease report this.\n"); + } + self.nextthink = time + 30; +}; + +#ifdef clan_progs +// tf 2.9 drop flag (throws) +void () DropGoalItems = +{ + local entity te; + + newmis = spawn (); + makevectors (self.v_angle); + v_forward = normalize (v_forward) * 64; + newmis.origin = self.origin + v_forward; + te = find (world, classname, "item_tfgoal"); + while (te) { + if (te.owner == self) + if (te.goal_activation & 4096 || te.owner == self) + tfgoalitem_RemoveFromPlayer (te, self, 2); + + te = find (te, classname, "item_tfgoal"); + } + dremove (newmis); +}; +#endif diff --git a/tforttm.pqc b/tforttm.pqc new file mode 100644 index 0000000..d655468 --- /dev/null +++ b/tforttm.pqc @@ -0,0 +1,1242 @@ +void (float tno) TeamFortress_TeamSetColor; +void (float tno,float scoretoadd) TeamFortress_TeamIncreaseScore; +float (float tno) TeamFortress_TeamGetLives; +float (float tno) TeamFortress_TeamGetMaxPlayers; +string (float tno) TeamFortress_TeamGetColorString; +float (float tno) TeamFortress_TeamGetIllegalClasses; +float quadscore; + +// pablo. get score. +float (float tno) TeamFortress_GetRealScore = +{ + local entity te; + local float total; + + te = find (world, classname, "player"); + while (te) + { + if (te.team_no == tno) + { + total = total + te.real_frags; + } + te = find (te, classname, "player"); + } + return total; +} +// + +float() TeamFortress_TeamPutPlayerInTeam = +{ + local float i; + local float j; + local float score1; + local float score2; + + local float lowest; + local float likely_team; + + i = 1; + likely_team = random() * number_of_teams; + likely_team = ceil(likely_team); + if (likely_team == 0) + { + likely_team = number_of_teams; + } + + lowest = 33; + while (i < number_of_teams + 1) + { + j = TeamFortress_TeamGetNoPlayers(i); + + if (j < lowest) + { + if (TeamFortress_TeamGetMaxPlayers(i) > j) + { + lowest = j; + likely_team = i; + } + } + // pablo. fancier autoteam for even teams. + else if (j == lowest) + { + + if (TeamFortress_TeamGetMaxPlayers(i) > j) + { + score1 = TeamFortress_GetRealScore(i); + score2 = TeamFortress_GetRealScore(likely_team); + + if ( score1 < score2 ) + { + likely_team = i; + } + else if (score1 == score2) + { + if (random() > 0.5) + { + likely_team = i; + } + } + } + } + // + i = i + 1; + } + return TeamFortress_TeamSet(likely_team, 1); +}; + +float(float tno) TeamFortress_TeamGetColor = +{ + if (tno == TF_FLARE_OFF) + { + return 14; + } + if (tno == 2) + { + return 5; + } + if (tno == 3) + { + return 13; + } + if (tno == 4) + { + return 12; + } + return 0; +}; + +void(float tno) TeamFortress_TeamSetColor = +{ + if (tno == TF_FLARE_OFF) + { + team1col = 14; + return; + } + if (tno == 2) + { + team2col = 5; + return; + } + if (tno == 3) + { + team3col = 13; + return; + } + if (tno == 4) + { + team4col = 12; + return; + } +}; + +string(float tno) GetTeamName = +{ + local string st; + if (tno == TF_FLARE_OFF) + { + st = infokey(world, "team1"); + if (st == string_null) + { + st = infokey(world, "t1"); + } + if (st == string_null || st == "") + { + return "blue"; + } + } + else + { + if (tno == 2) + { + st = infokey(world, "team2"); + if (st == string_null) + { + st = infokey(world, "t2"); + } + if (st == string_null || st == "") + { + return "red"; + } + } + else + { + if (tno == 3) + { + st = infokey(world, "team3"); + if (st == string_null) + { + st = infokey(world, "t3"); + } + if (st == string_null || st == "") + { + return "yell"; + } + } + else + { + if (tno == 4) + { + st = infokey(world, "team4"); + if (st == string_null) + { + st = infokey(world, "t4"); + } + if (st == string_null || st == "") + { + return "gren"; + } + } + else + { + st = "\"\""; + } + } + } + } + return st; +}; + +void(entity p) SetTeamName = +{ + local string st; + stuffcmd(p, "team "); + st = GetTeamName(p.team_no); + stuffcmd(p, st); + stuffcmd(p, "\n"); +}; + +float (float tno, float autoteam) TeamFortress_TeamSet = +{ + local string st; + local float tc; + if (teamplay < TF_FLARE_OFF) + { + sprint(self, 2, "Teamplay is not On, so FortressTeams are inactive.\n"); + return 0; + } + if (tno > number_of_teams && number_of_teams != 0) + { + sprint(self, 2, "There can be only "); + st = ftos(number_of_teams); + sprint(self, 2, st); + sprint(self, 2, " teams on this map.\nTry again\n"); + return 0; + } + if (self.team_no > 0) + { + sprint(self, 2, "You're already in Team No "); + st = ftos(self.team_no); + sprint(self, 2, st); + sprint(self, 2, ".\n"); + return 0; + } + tc = TeamFortress_TeamGetNoPlayers(tno); + if (tc >= TeamFortress_TeamGetMaxPlayers(tno)) + { + sprint(self, 2, "That team is full. Pick another.\n"); + return 0; + } + if (TeamFortress_TeamGetColor(tno) == 0) + { + TeamFortress_TeamSetColor(tno); + if (TeamFortress_TeamGetColor(tno) == 0) + { + sprint(self, 2, "You can't start a new team with your color, since another "); + sprint(self, 2, "already using that color. Change your pants color, then try again.\n"); + return 0; + } + bprint(2, self.netname); + bprint(2, " has started Team No "); + st = ftos(tno); + bprint(2, st); + bprint(2, ".\n"); + self.immune_to_check = time + 10; + stuffcmd(self, "color "); + tc = TeamFortress_TeamGetColor(tno) - TF_FLARE_OFF; + st = ftos(tc); + stuffcmd(self, st); + stuffcmd(self, "\n"); + self.team_no = tno; + self.lives = TeamFortress_TeamGetLives(tno); + SetTeamName(self); + if (self.playerclass == 0) + { + if (TeamFortress_TeamIsCivilian(self.team_no)) + { + self.impulse = TF_FLARE_OFF; + TeamFortress_ChangeClass(); + } + } + return TF_FLARE_OFF; + } + + bprint (2, self.netname, " has joined Team No "); + st = ftos (tno); + if (autoteam == 1) + bprint (2, st, ". \s[auto]\s\n"); // brown auto with gold brackets [] + else + bprint (2, st, ".\n"); + + stuffcmd(self, "color "); + tc = TeamFortress_TeamGetColor(tno) - TF_FLARE_OFF; + st = ftos(tc); + stuffcmd(self, st); + stuffcmd(self, "\n"); + self.team_no = tno; + self.immune_to_check = time + 10; + self.lives = TeamFortress_TeamGetLives(tno); + TeamFortress_TeamShowMemberClasses(self); + SetTeamName(self); + if (self.playerclass == 0) + { + if (TeamFortress_TeamIsCivilian(self.team_no)) + { + self.impulse = TF_FLARE_OFF; + TeamFortress_ChangeClass(); + } + } + return TF_FLARE_OFF; +}; + +void() TeamFortress_CheckTeamCheats = +{ + local string st; + local string sk; + local float tc; + if (self.immune_to_check > time) + { + return; + } + if (self.deadflag) + { + return; + } + if (self.team_no > 0 && teamplay > 0) + { + st = infokey(self, "bottomcolor"); + tc = stof(st); + if (self.playerclass == 8 && self.undercover_team != 0) + { + if (TeamFortress_TeamGetColor(self.undercover_team) - TF_FLARE_OFF != tc) + { + stuffcmd(self, "color "); + tc = TeamFortress_TeamGetColor(self.undercover_team) - TF_FLARE_OFF; + st = ftos(tc); + stuffcmd(self, st); + stuffcmd(self, "\n"); + bprint2(TF_FLARE_OFF, self.netname, " has been kicked for changing color.\n"); + sprint(self, 2, "You have been kicked for changing your pants color. Don't do it.\n"); + stuffcmd(self, "disconnect\n"); + stuffcmd(self, "quit\n"); + return; + } + } + else + { + if (tc != TeamFortress_TeamGetColor(self.team_no) - TF_FLARE_OFF) + { + stuffcmd(self, "color "); + tc = TeamFortress_TeamGetColor(self.team_no) - TF_FLARE_OFF; + st = ftos(tc); + stuffcmd(self, st); + stuffcmd(self, "\n"); + bprint2(TF_FLARE_OFF, self.netname, " has been kicked for changing color.\n"); + sprint(self, 2, "You have been kicked for changing your pants color. Don't do it.\n"); + stuffcmd(self, "disconnect\n"); + stuffcmd(self, "quit\n"); + return; + } + } + if (self.playerclass != 0) + { + st = infokey(self, "skin"); + tc = 0; + if (self.playerclass == 8 && self.undercover_skin != 0) + { + tc = 8; + self.playerclass = self.undercover_skin; + } + if (self.playerclass == TF_FLARE_OFF) + { + sk = "airscout"; + } + else + { + if (self.playerclass == 2) + { + sk = "tf_snipe"; + } + else + { + if (self.playerclass == 3) + { + sk = "tf_sold"; + } + else + { + if (self.playerclass == 4) + { + sk = "tf_demo"; + } + else + { + if (self.playerclass == 5) + { + sk = "tf_medic"; + } + else + { + if (self.playerclass == 6) + { + sk = "tf_hwguy"; + } + else + { + if (self.playerclass == 7) + { + sk = "tf_pyro"; + } + else + { + if (self.playerclass == 8) + { + sk = "tf_spy"; + } + else + { + if (self.playerclass == 9) + { + sk = "tf_eng"; + } + else + { + if (tc == 8) + { + self.playerclass = 8; + } + return; + } + } + } + } + } + } + } + } + } + if (st != sk) + { + TeamFortress_SetSkin(self); + bprint2(TF_FLARE_OFF, self.netname, " has been kicked for changing skin.\n"); + sprint(self, 2, "You have been kicked for changing your skin. Don't do it.\n"); + stuffcmd(self, "disconnect\n"); + stuffcmd(self, "quit\n"); + return; + } + if (tc == 8) + { + self.playerclass = 8; + } + } + st = GetTeamName(self.team_no); + if (st != infokey(self, "team")) + { + SetTeamName(self); + bprint2(TF_FLARE_OFF, self.netname, " has been kicked for changing team.\n"); + sprint(self, 2, "You have been kicked for changing your team. Don't do it.\n"); + stuffcmd(self, "disconnect\n"); + stuffcmd(self, "quit\n"); + return; + } + } +}; + +void(float tno, float scoretoadd) TeamFortress_TeamIncreaseScore = +{ + local entity e; + if (tno == 0 || scoretoadd == 0) + { + return; + } + if (scoretoadd > 100) + { + scoretoadd = scoretoadd - 100; + scoretoadd = scoretoadd * -1; + } + if (tno == TF_FLARE_OFF) + { + team1score = team1score + scoretoadd; + } + if (tno == 2) + { + team2score = team2score + scoretoadd; + } + if (tno == 3) + { + team3score = team3score + scoretoadd; + } + if (tno == 4) + { + team4score = team4score + scoretoadd; + } + if (toggleflags & 128) + { + e = find(world, classname, "player"); + while (e) + { + if (e.team_no == tno) + { + e.frags = TeamFortress_TeamGetScore(tno); + } + e = find(e, classname, "player"); + } + } +}; + +float(float tno) TeamFortress_TeamGetScore = +{ + if (tno == TF_FLARE_OFF) + { + return team1score; + } + if (tno == 2) + { + return team2score; + } + if (tno == 3) + { + return team3score; + } + if (tno == 4) + { + return team4score; + } + return 0; +}; + +float(float tno) TeamFortress_TeamGetLives = +{ + if (tno == TF_FLARE_OFF) + { + return team1lives; + } + if (tno == 2) + { + return team2lives; + } + if (tno == 3) + { + return team3lives; + } + if (tno == 4) + { + return team4lives; + } + return 0; +}; + +float(float tno) TeamFortress_TeamGetNoPlayers = +{ + local float size_team; + local entity search; + search = find(world, classname, "player"); + while (search != world) + { + if (search.team_no == tno) + { + size_team = size_team + TF_FLARE_OFF; + } + search = find(search, classname, "player"); + } + return size_team; +}; + +float(float tno) TeamFortress_TeamGetMaxPlayers = +{ + if (tno == TF_FLARE_OFF) + { + return team1maxplayers; + } + if (tno == 2) + { + return team2maxplayers; + } + if (tno == 3) + { + return team3maxplayers; + } + if (tno == 4) + { + return team4maxplayers; + } + return 0; +}; + +float() TeamFortress_TeamGetWinner = +{ + local float i; + local float j; + local float highest; + local float highestteam; + i = TF_FLARE_OFF; + highest = -100; + highestteam = 0; + while (i < number_of_teams + TF_FLARE_OFF) + { + j = TeamFortress_TeamGetScore(i); + if (j > highest) + { + highest = j; + highestteam = i; + } + i = i + TF_FLARE_OFF; + } + return highestteam; +}; + +float() TeamFortress_TeamGetSecond = +{ + local float i; + local float j; + local float highest; + local float highestteam; + local float secondteam; + local float second; + i = TF_FLARE_OFF; + highestteam = TeamFortress_TeamGetWinner(); + highest = TeamFortress_TeamGetScore(highestteam); + secondteam = 0; + second = -100; + while (i < number_of_teams + TF_FLARE_OFF) + { + if (i != highestteam) + { + j = TeamFortress_TeamGetScore(i); + if (j <= highest && j > second) + { + second = j; + secondteam = i; + } + } + i = i + TF_FLARE_OFF; + } + return secondteam; +}; + +void (float all) TeamFortress_TeamShowScores = +{ + local string st; + local float i; + local float j; + local float _l_7158; + local float _l_7159; + + i = 1; + _l_7158 = 0; + _l_7159 = 0; + if ((all == 2)) + { + while ((i <= number_of_teams)) + { + if ((TeamFortress_TeamGetColor (i) > 0)) + { + j = TeamFortress_TeamGetScore (i); + st = TeamFortress_TeamGetColorString (i); + bprint (2, st); + bprint (2, ": "); + st = ftos (j); + bprint (2, st); + bprint (2, " "); + if ((j >= TeamFortress_TeamGetScore (_l_7158))) + { + _l_7159 = _l_7158; + _l_7158 = i; + } + else + { + if ((j >= TeamFortress_TeamGetScore (_l_7159))) + { + _l_7159 = i; + } + } + } + i = i + 1; + } + bprint (2, "\n"); + sound (world, 4, "misc/update.wav", 1, 0); + if ((quadscore > 0)) + { + if ((team1score > team2score)) + { + bprint (2, ""); + bprint (2, TeamFortress_TeamGetColorString (1)); + bprint (2, "‘ èáó ÷ïî ôèå íáôãè¡\n"); + execute_changelevel (); + return; + } + } +// Here begins that damn code which I couldn't figure out + if ((TeamFortress_TeamGetScore (_l_7158) != TeamFortress_TeamGetScore (_l_7159))) + { + local float fix1; + local float fix2; + local float totalf; + local string totals; + fix1 = ((TeamFortress_TeamGetScore (_l_7158))); + fix2 = ((TeamFortress_TeamGetScore (_l_7159))); + totalf = (fix1 - fix2); + totals = ftos (totalf); + if (totalf != 0) { + bprint (2, ""); + bprint (2, TeamFortress_TeamGetColorString (_l_7158)); + bprint (2, "‘ éó ìåáäéîç âù "); + bprint (2, totals); +// bprint (2, ftos ((TeamFortress_TeamGetScore (_l_7158) - TeamFortress_TeamGetScore (_l_7159)))); + bprint (2, "‘\n"); } + else + { + bprint (2, "Ôèå çáíå éó tied‘\n"); + } + } + else + { + bprint (2, "Ôèå çáíå éó tied‘\n"); + } + return; + } + while ((i <= number_of_teams)) + { + if ((TeamFortress_TeamGetColor (i) > 0)) + { + if (all) + { + bprint (2, "Team "); + } + else + { + sprint (self, 2, "Team "); + } + st = ftos (i); + if (all) + { + bprint (2, st); + } + else + { + sprint (self, 2, st); + } + if (all) + { + bprint (2, " ("); + } + else + { + sprint (self, 2, " ("); + } + st = TeamFortress_TeamGetColorString (i); + if (all) + { + bprint (2, st); + } + else + { + sprint (self, 2, st); + } + if (all) + { + bprint (2, ") : "); + } + else + { + sprint (self, 2, ") : "); + } + j = TeamFortress_TeamGetScore (i); + st = ftos (j); + if (all) + { + bprint (2, st); + } + else + { + sprint (self, 2, st); + } + if (all) + { + bprint (2, "\n"); + } + else + { + sprint (self, 2, "\n"); + } + } + i = i + 1; + } +}; + +string(float tno) TeamFortress_TeamGetColorString = +{ + local float col; + col = TeamFortress_TeamGetColor(tno); + if (col == TF_FLARE_OFF) + { + return "White"; + } + if (col == 2) + { + return "Brown"; + } + if (col == 3) + { + return "Blue"; + } + if (col == 4) + { + return "Green"; + } + if (col == 5) + { + return "Red"; + } + if (col == 6) + { + return "Tan"; + } + if (col == 7) + { + return "Pink"; + } + if (col == 8) + { + return "Orange"; + } + if (col == 9) + { + return "Purple"; + } + if (col == 10) + { + return "DarkPurple"; + } + if (col == 11) + { + return "Grey"; + } + if (col == 12) + { + return "DarkGreen"; + } + if (col == 13) + { + return "Yellow"; + } + return "DarkBlue"; +}; + +void(entity Player) TeamFortress_TeamShowMemberClasses = +{ + local entity e; + local float found; + found = 0; + e = find(world, classname, "player"); + while (e) + { + if (e.team_no == Player.team_no || e.team_no == 0 && e != Player) + { + if (e.model != string_null) + { + if (!found) + { + found = TF_FLARE_OFF; + sprint(self, 2, "The other members of your team are:\n"); + } + sprint(Player, 2, e.netname); + sprint(Player, 2, " : "); + TeamFortress_PrintClassName(Player, e.playerclass, e.tfstate & 8, 0); + } + } + e = find(e, classname, "player"); + } + if (!found) + { + sprint(Player, 2, "There are no other players on your team.\n"); + } +}; + +void() CalculateTeamEqualiser = +{ + local float t1; + local float t2; + local float t3; + local float t4; + local float t_ave; + local float calc; + team1advantage = TF_FLARE_OFF; + team2advantage = TF_FLARE_OFF; + team3advantage = TF_FLARE_OFF; + team4advantage = TF_FLARE_OFF; + if (number_of_teams < 2) + { + self.nextthink = time + 60; + return; + } + if (teamplay & 32) + { + t1 = TeamFortress_TeamGetNoPlayers(TF_FLARE_OFF); + t2 = TeamFortress_TeamGetNoPlayers(2); + t3 = TeamFortress_TeamGetNoPlayers(3); + t4 = TeamFortress_TeamGetNoPlayers(4); + if (t1 + t2 + t3 + t4 < TF_FLARE_OFF) + { + self.nextthink = time + 30; + return; + } + t_ave = (t1 + t2 + t3 + t4) / number_of_teams; + if (t1 > 0) + { + calc = t_ave / t1 - TF_FLARE_OFF; + if (calc != 0) + { + calc = calc / 3 + TF_FLARE_OFF; + } + else + { + calc = calc + TF_FLARE_OFF; + } + team1advantage = calc; + } + if (t2 > 0 && number_of_teams >= 2) + { + calc = t_ave / t2 - TF_FLARE_OFF; + if (calc != 0) + { + calc = calc / 3 + TF_FLARE_OFF; + } + else + { + calc = calc + TF_FLARE_OFF; + } + team2advantage = calc; + } + if (t3 > 0 && number_of_teams >= 3) + { + calc = t_ave / t3 - TF_FLARE_OFF; + if (calc != 0) + { + calc = calc / 3 + TF_FLARE_OFF; + } + else + { + calc = calc + TF_FLARE_OFF; + } + team3advantage = calc; + } + if (t4 > 0 && number_of_teams >= 4) + { + calc = t_ave / t4 - TF_FLARE_OFF; + if (calc != 0) + { + calc = calc / 3 + TF_FLARE_OFF; + } + else + { + calc = calc + TF_FLARE_OFF; + } + team4advantage = calc; + } + } + if (teamplay & 64) + { + t1 = team1score + 60; + if (number_of_teams >= 2) + { + t2 = team2score + 60; + } + else + { + t2 = 0; + } + if (number_of_teams >= 3) + { + t3 = team3score + 60; + } + else + { + t3 = 0; + } + if (number_of_teams >= 4) + { + t4 = team4score + 60; + } + else + { + t4 = 0; + } + t_ave = (t2 + t3 + t4) / (number_of_teams - TF_FLARE_OFF); + calc = t_ave / t1 - TF_FLARE_OFF; + if (calc != 0) + { + calc = calc / 3 + TF_FLARE_OFF; + } + else + { + calc = calc + TF_FLARE_OFF; + } + team1advantage = calc * team1advantage; + if (number_of_teams >= 2) + { + t_ave = (t1 + t3 + t4) / (number_of_teams - TF_FLARE_OFF); + calc = t_ave / t2 - TF_FLARE_OFF; + if (calc != 0) + { + calc = calc / 3 + TF_FLARE_OFF; + } + else + { + calc = calc + TF_FLARE_OFF; + } + team2advantage = calc * team2advantage; + } + if (number_of_teams >= 3) + { + t_ave = (t2 + t1 + t4) / (number_of_teams - TF_FLARE_OFF); + calc = t_ave / t3 - TF_FLARE_OFF; + if (calc != 0) + { + calc = calc / 3 + TF_FLARE_OFF; + } + else + { + calc = calc + TF_FLARE_OFF; + } + team3advantage = calc * team3advantage; + } + if (number_of_teams >= 4) + { + t_ave = (t2 + t3 + t1) / (number_of_teams - TF_FLARE_OFF); + calc = t_ave / t4 - TF_FLARE_OFF; + if (calc != 0) + { + calc = calc / 3 + TF_FLARE_OFF; + } + else + { + calc = calc + TF_FLARE_OFF; + } + team4advantage = calc * team4advantage; + } + } + self.nextthink = time + 10; +}; + +void() SetupTeamEqualiser = +{ + local entity TE; + team1advantage = TF_FLARE_OFF; + team2advantage = TF_FLARE_OFF; + team3advantage = TF_FLARE_OFF; + team4advantage = TF_FLARE_OFF; + if (!(teamplay & (32 | 64))) + { + return; + } + TE = spawn(); + TE.classname = "Team Equaliser"; + TE.think = CalculateTeamEqualiser; + TE.nextthink = time + 30; +}; + +float(entity targ, entity attacker, float damage) TeamEqualiseDamage = +{ + local float adv; + local float newdam; + if (targ.classname != "player" || attacker.classname != "player") + { + return damage; + } + if (targ.team_no == 0 || attacker.team_no == 0 || attacker.team_no == targ.team_no) + { + return damage; + } + if (attacker.team_no == TF_FLARE_OFF) + { + adv = team1advantage; + } + else + { + if (attacker.team_no == 2) + { + adv = team2advantage; + } + else + { + if (attacker.team_no == 3) + { + adv = team3advantage; + } + else + { + if (attacker.team_no == 4) + { + adv = team4advantage; + } + } + } + } + if (adv == 0) + { + dprint("There is a team with an advantage of 0\n"); + adv = 0.1; + } + newdam = damage * adv; + if (targ.team_no == TF_FLARE_OFF) + { + adv = team1advantage; + } + else + { + if (targ.team_no == 2) + { + adv = team2advantage; + } + else + { + if (targ.team_no == 3) + { + adv = team3advantage; + } + else + { + if (targ.team_no == 4) + { + adv = team4advantage; + } + } + } + } + if (adv == 0) + { + dprint("There is a team with an advantage of 0\n"); + adv = 0.1; + } + newdam = newdam * (TF_FLARE_OFF / adv); + return newdam; +}; + +void() TeamFortress_StatusQuery = +{ + local float ft; + local string st; + sprint(self, 2, "players per team: "); + ft = TeamFortress_TeamGetNoPlayers(TF_FLARE_OFF); + st = ftos(ft); + sprint(self, 2, st); + sprint(self, 2, " "); + ft = TeamFortress_TeamGetNoPlayers(2); + st = ftos(ft); + sprint(self, 2, st); + sprint(self, 2, " "); + ft = TeamFortress_TeamGetNoPlayers(3); + st = ftos(ft); + sprint(self, 2, st); + sprint(self, 2, " "); + ft = TeamFortress_TeamGetNoPlayers(4); + st = ftos(ft); + sprint(self, 2, st); + sprint(self, 2, "\n"); + sprint(self, 2, " equalisation: "); + st = ftos(team1advantage); + sprint(self, 2, st); + sprint(self, 2, " "); + st = ftos(team2advantage); + sprint(self, 2, st); + sprint(self, 2, " "); + st = ftos(team3advantage); + sprint(self, 2, st); + sprint(self, 2, " "); + st = ftos(team4advantage); + sprint(self, 2, st); + sprint(self, 2, "\n"); + st = ftos(teamplay); + sprint(self, 2, "Teamplay is "); + sprint(self, 2, st); + sprint(self, 2, "\n"); +}; + +float(float tno) TeamFortress_TeamGetIllegalClasses = +{ + if (tno == TF_FLARE_OFF) + { + return illegalclasses1; + } + if (tno == 2) + { + return illegalclasses2; + } + if (tno == 3) + { + return illegalclasses3; + } + if (tno == 4) + { + return illegalclasses4; + } + return 0; +}; + +float(float tno) TeamFortress_TeamIsCivilian = +{ + if (tno == TF_FLARE_OFF) + { + if (civilianteams & TF_FLARE_OFF) + { + return TF_FLARE_OFF; + } + } + else + { + if (tno == 2) + { + if (civilianteams & 2) + { + return TF_FLARE_OFF; + } + } + else + { + if (tno == 3) + { + if (civilianteams & 4) + { + return TF_FLARE_OFF; + } + } + else + { + if (civilianteams & 8) + { + return TF_FLARE_OFF; + } + } + } + } + return 0; +}; + +void(float tno, entity ignore, string st) teamsprint = +{ + local entity te; + if (tno == 0) + { + return; + } + te = find(world, classname, "player"); + while (te) + { + if (te.team_no == tno && te != ignore) + { + sprint(te, 2, st); + } + te = find(te, classname, "player"); + } +}; + diff --git a/triggers.pqc b/triggers.pqc new file mode 100644 index 0000000..0ddddee --- /dev/null +++ b/triggers.pqc @@ -0,0 +1,774 @@ +entity stemp, otemp, s, old; + +void() trigger_reactivate = +{ + self.solid = TF_FLARE_OFF; +}; + +void() multi_wait = +{ + if (self.max_health) + { + self.health = self.max_health; + self.takedamage = TF_FLARE_OFF; + self.solid = 2; + } +}; + +void() multi_trigger = +{ + if (self.nextthink > time) + { + return; + } + if (self.classname == "trigger_secret") + { + if (self.enemy.classname != "player") + { + return; + } + found_secrets = found_secrets + TF_FLARE_OFF; + WriteByte(2, 28); + } + if (self.noise) + { + sound(self, 2, self.noise, TF_FLARE_OFF, TF_FLARE_OFF); + } + self.takedamage = TF_FLARE_LIT; + activator = self.enemy; + SUB_UseTargets(); + if (self.wait > TF_FLARE_LIT) + { + self.think = multi_wait; + self.nextthink = time + self.wait; + } + else + { + self.touch = SUB_Null; + self.nextthink = time + 0.1; + self.think = SUB_Remove; + } +}; + +void() multi_killed = +{ + self.enemy = damage_attacker; + multi_trigger(); +}; + +void() multi_use = +{ + self.enemy = activator; + multi_trigger(); +}; + +void() multi_touch = +{ + local entity te; + if (other.classname != "player") + { + return; + } + if (!Activated(self, other)) + { + if (self.else_goal != TF_FLARE_LIT) + { + te = Findgoal(self.else_goal); + if (te) + { + DoResults(te, other, self.goal_result & 2); + } + } + return; + } + if (self.movedir != '0 0 0') + { + makevectors(other.angles); + if (v_forward * self.movedir < TF_FLARE_LIT) + { + return; + } + } + self.enemy = other; + multi_trigger(); +}; + +void() trigger_multiple = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (self.sounds == TF_FLARE_OFF) + { + precache_sound("misc/secret.wav"); + self.noise = "misc/secret.wav"; + } + else + { + if (self.sounds == 2) + { + precache_sound("misc/talk.wav"); + self.noise = "misc/talk.wav"; + } + else + { + if (self.sounds == 3) + { + precache_sound("misc/trigger1.wav"); + self.noise = "misc/trigger1.wav"; + } + } + } + if (!(self.wait)) + { + self.wait = 0.2; + } + self.use = multi_use; + InitTrigger(); + if (self.health) + { + if (self.spawnflags & TF_FLARE_OFF) + { + objerror("health and notouch don't make sense\n"); + } + self.max_health = self.health; + self.th_die = multi_killed; + self.takedamage = TF_FLARE_OFF; + self.solid = 2; + setorigin(self, self.origin); + } + else + { + if (!(self.spawnflags & TF_FLARE_OFF)) + { + self.touch = multi_touch; + } + } +}; + +void() trigger_once = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.wait = -1; + trigger_multiple(); +}; + +void() trigger_relay = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.use = SUB_UseTargets; +}; + +void() trigger_secret = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + total_secrets = total_secrets + TF_FLARE_OFF; + self.wait = -1; + if (!(self.message)) + { + self.message = "You found a secret area!"; + } + if (!(self.sounds)) + { + self.sounds = TF_FLARE_OFF; + } + if (self.sounds == TF_FLARE_OFF) + { + precache_sound("misc/secret.wav"); + self.noise = "misc/secret.wav"; + } + else + { + if (self.sounds == 2) + { + precache_sound("misc/talk.wav"); + self.noise = "misc/talk.wav"; + } + } + trigger_multiple(); +}; + +void() counter_use = +{ + self.count = self.count - TF_FLARE_OFF; + if (self.count < TF_FLARE_LIT) + { + return; + } + if (self.count != TF_FLARE_LIT) + { + if (activator.classname == "player" && (self.spawnflags & TF_FLARE_OFF) == TF_FLARE_LIT) + { + if (self.count >= 4) + { + CenterPrint(activator, "There are more to go..."); + } + else + { + if (self.count == 3) + { + CenterPrint(activator, "Only 3 more to go..."); + } + else + { + if (self.count == 2) + { + CenterPrint(activator, "Only 2 more to go..."); + } + else + { + CenterPrint(activator, "Only 1 more to go..."); + } + } + } + } + return; + } + if (activator.classname == "player" && (self.spawnflags & TF_FLARE_OFF) == TF_FLARE_LIT) + { + CenterPrint(activator, "Sequence completed!"); + } + self.enemy = activator; + multi_trigger(); +}; + +void() trigger_counter = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.wait = -1; + if (!(self.count)) + { + self.count = 2; + } + self.use = counter_use; +}; + +void() play_teleport = +{ + local float v; + local string tmpstr; + v = random() * 5; + if (v < TF_FLARE_OFF) + { + tmpstr = "misc/r_tele1.wav"; + } + else + { + if (v < 2) + { + tmpstr = "misc/r_tele2.wav"; + } + else + { + if (v < 3) + { + tmpstr = "misc/r_tele3.wav"; + } + else + { + if (v < 4) + { + tmpstr = "misc/r_tele4.wav"; + } + else + { + tmpstr = "misc/r_tele5.wav"; + } + } + } + } + sound(self, 2, tmpstr, TF_FLARE_OFF, TF_FLARE_OFF); + remove(self); +}; + +void(vector org) spawn_tfog = +{ + s = spawn(); + s.origin = org; + s.nextthink = time + 0.2; + s.think = play_teleport; + WriteByte(4, 23); + WriteByte(4, 11); + WriteCoord(4, org_x); + WriteCoord(4, org_y); + WriteCoord(4, org_z); + multicast(org, TF_FLARE_OFF); +}; + +void() tdeath_touch = +{ + if (other == self.owner) + { + return; + } + if (other.classname == "player") + { + if (other.invincible_finished > time) + { + self.classname = "teledeath2"; + } + if (self.owner.classname != "player") + { + T_Damage(self.owner, self, self, 5000); + return; + } + } + if (other.health) + { + T_Damage(other, self, self, 5000); + } +}; + +void(vector org, entity death_owner) spawn_tdeath = +{ + local entity death; + death = spawn(); + death.classname = "teledeath"; + death.movetype = TF_FLARE_LIT; + death.solid = TF_FLARE_OFF; + death.angles = '0 0 0'; + setsize(death, death_owner.mins - '1 1 1', death_owner.maxs + '1 1 1'); + setorigin(death, org); + death.touch = tdeath_touch; + death.nextthink = time + 0.2; + death.think = SUB_Remove; + death.owner = death_owner; + force_retouch = 2; +}; + +void() teleport_touch = +{ + local entity t; + local entity te; + local vector org; + if (self.targetname) + { + if (self.nextthink < time) + { + return; + } + } + if (self.spawnflags & TF_FLARE_OFF) + { + if (other.classname != "player") + { + return; + } + } + if (!Activated(self, other)) + { + if (self.else_goal != TF_FLARE_LIT) + { + te = Findgoal(self.else_goal); + if (te) + { + DoResults(te, other, self.goal_result & 2); + } + } + return; + } + if (other.health <= TF_FLARE_LIT || other.solid != 3) + { + return; + } + SUB_UseTargets(); + spawn_tfog(other.origin); + t = find(world, targetname, self.target); + if (!t) + { + objerror("couldn't find target"); + } + makevectors(t.mangle); + org = t.origin + 32 * v_forward; + spawn_tfog(org); + spawn_tdeath(t.origin, other); + if (!(other.health)) + { + other.origin = t.origin; + other.velocity = v_forward * other.velocity_x + v_forward * other.velocity_y; + return; + } + setorigin(other, t.origin); + other.angles = t.mangle; + if (other.classname == "player") + { + if (other.weapon == TF_FLARE_OFF && other.hook_out) + { + sound(other, TF_FLARE_OFF, "weapons/bounce2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + other.on_hook = TF_FLARE_LIT; + other.hook_out = TF_FLARE_LIT; + other.fire_held_down = TF_FLARE_LIT; + other.weaponframe = TF_FLARE_LIT; + other.attack_finished = time + 0.75; + } + other.fixangle = TF_FLARE_OFF; + other.teleport_time = time + 0.7; + if (other.flags & 512) + { + other.flags = other.flags - 512; + } + other.velocity = v_forward * 300; + } + other.flags = other.flags - (other.flags & 512); +}; + +void() info_teleport_destination = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + self.mangle = self.angles; + self.angles = '0 0 0'; + self.model = ""; + self.origin = self.origin + '0 0 27'; + if (!(self.targetname)) + { + objerror("no targetname"); + } +}; + +void() teleport_use = +{ + self.nextthink = time + 0.2; + force_retouch = 2; + self.think = SUB_Null; +}; + +void() trigger_teleport = +{ + local vector o; + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + InitTrigger(); + self.touch = teleport_touch; + if (!(self.target)) + { + objerror("no target"); + } + self.use = teleport_use; + if (!(self.spawnflags & 2)) + { + precache_sound("ambience/hum1.wav"); + o = (self.mins + self.maxs) * 0.5; + ambientsound(o, "ambience/hum1.wav", 0.5, 3); + } +}; + +void() trigger_skill_touch = +{ + local entity te; + if (other.classname != "player") + { + return; + } + if (!Activated(self, other)) + { + if (self.else_goal != TF_FLARE_LIT) + { + te = Findgoal(self.else_goal); + if (te) + { + DoResults(te, other, self.goal_result & 2); + } + } + return; + } + cvar_set("skill", self.message); +}; + +void() trigger_setskill = +{ + dremove(self); + return; +}; + +void() trigger_onlyregistered_touch = +{ + local entity te; + if (other.classname != "player") + { + return; + } + if (!Activated(self, other)) + { + if (self.else_goal != TF_FLARE_LIT) + { + te = Findgoal(self.else_goal); + if (te) + { + DoResults(te, other, self.goal_result & 2); + } + } + return; + } + if (self.attack_finished > time) + { + return; + } + self.attack_finished = time + 2; + if (cvar("registered")) + { + self.message = ""; + SUB_UseTargets(); + remove(self); + } + else + { + if (self.message != "") + { + CenterPrint(other, self.message); + sound(other, 4, "misc/talk.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + } +}; + +void() trigger_onlyregistered = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + precache_sound("misc/talk.wav"); + InitTrigger(); + self.touch = trigger_onlyregistered_touch; +}; + +void() hurt_on = +{ + self.solid = TF_FLARE_OFF; + self.nextthink = -1; +}; + +void() hurt_touch = +{ + local entity te; + if (other.takedamage) + { + if (!Activated(self, other)) + { + if (self.else_goal != TF_FLARE_LIT) + { + te = Findgoal(self.else_goal); + if (te) + { + DoResults(te, other, self.goal_result & 2); + } + } + return; + } + self.solid = TF_FLARE_LIT; + deathmsg = 36; + TF_T_Damage(other, self, self, self.dmg, TF_FLARE_OFF, TF_FLARE_LIT); + self.think = hurt_on; + self.nextthink = time + TF_FLARE_OFF; + } +}; + +void() trigger_hurt = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + InitTrigger(); + self.touch = hurt_touch; + if (!(self.dmg)) + { + self.dmg = 5; + } +}; + +void() trigger_push_touch = +{ + local entity te; + if (!Activated(self, other)) + { + if (self.else_goal != TF_FLARE_LIT) + { + te = Findgoal(self.else_goal); + if (te) + { + DoResults(te, other, self.goal_result & 2); + } + } + return; + } + if (other.classname == "grenade" || other.classname != "player") + { + if (other.last_used < time) + { + sound(other, TF_FLARE_LIT, "weapons/launch.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + other.last_used = time + 3; + other.velocity = self.speed * self.movedir * 10; + other.avelocity = '0 0 0'; + other.angles = self.movedir; + } + else + { + if (other.health > TF_FLARE_LIT && !(self.armorclass)) + { + other.velocity = self.speed * self.movedir * 10; + if (other.classname == "player") + { + if (other.fly_sound < time) + { + other.fly_sound = time + 1.5; + if (!(self.spawnflags & 2)) + { + sound(other, TF_FLARE_LIT, "ambience/windfly.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + } + } + } + } + if (self.spawnflags & TF_FLARE_OFF) + { + dremove(self); + } +}; + +void() trigger_push = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + InitTrigger(); + precache_sound("ambience/windfly.wav"); + self.touch = trigger_push_touch; + if (!(self.speed)) + { + self.speed = 1000; + } +}; + +// Jumper code + +void () trigger_jumper_touch = +{ + local entity _l_7024; + + if (!Activated (self, other)) + { + if ((self.else_goal != 0)) + { + _l_7024 = Findgoal (self.else_goal); + if (_l_7024) + { + DoResults (_l_7024, other, (self.goal_result & 2)); + } + } + return; + } + if (((other.classname == "grenade") || (other.classname != "player"))) + { + return; + } + else + { + if (((other.health > 0) && !self.armorclass)) + { + other.velocity_z = (self.speed * 7); + if ((other.classname == "player")) + { + if ((other.fly_sound < time)) + { + other.fly_sound = (time + 1.500000); + if (!(self.spawnflags & 2)) + { + sound (other, 0, "misc/boing.wav", 1, 1); + } + } + } + } + } + if ((self.spawnflags & 1)) + { + dremove (self); + } +}; + +void () trigger_jumper = +{ + if ((CheckExistence () == 0)) + { + dremove (self); + return; + } + InitTrigger (); + precache_sound ("misc/boing.wav"); + self.touch = trigger_jumper_touch; + if (!self.speed) + { + self.speed = 1000; + } +}; + +// End jumper code + +void() trigger_monsterjump_touch = +{ + if ((other.flags & (32 | TF_FLARE_OFF | 2)) != 32) + { + return; + } + other.velocity_x = self.movedir_x * self.speed; + other.velocity_y = self.movedir_y * self.speed; + if (!(other.flags & 512)) + { + return; + } + other.flags = other.flags - 512; + other.velocity_z = self.height; +}; + +void() trigger_monsterjump = +{ + if (CheckExistence() == TF_FLARE_LIT) + { + dremove(self); + return; + } + if (!(self.speed)) + { + self.speed = 200; + } + if (!(self.height)) + { + self.height = 200; + } + if (self.angles == '0 0 0') + { + self.angles = '0 360 0'; + } + InitTrigger(); + self.touch = trigger_monsterjump_touch; +}; + diff --git a/tsoldier.pqc b/tsoldier.pqc new file mode 100644 index 0000000..00d9758 --- /dev/null +++ b/tsoldier.pqc @@ -0,0 +1,68 @@ +// Functions outside this file + +// Functions inside this file +// Nail Grenade Functions +void() NailGrenadeTouch; +void() NailGrenadeExplode; +void() NailGrenadeNailEm; +void() NailGrenadeLaunchNail; + + +void() NailGrenadeTouch = +{ + if (other == self.owner) + { + return; + } + sound(self, TF_FLARE_OFF, "weapons/bounce.wav", TF_FLARE_OFF, TF_FLARE_OFF); + if (self.velocity == '0 0 0') + { + self.avelocity = '0 0 0'; + } +}; + +void() NailGrenadeExplode = +{ + self.movetype = 5; + setorigin(self, self.origin + '0 0 32'); + self.avelocity = '0 500 0'; + self.nextthink = time + 0.7; + self.think = NailGrenadeNailEm; +}; + +void() NailGrenadeNailEm = +{ + self.velocity = '0 0 0'; + self.nextthink = time + 0.1; + self.think = NailGrenadeLaunchNail; + self.playerclass = TF_FLARE_LIT; +}; + +void() NailGrenadeLaunchNail = +{ + local float i; + local float j; + i = TF_FLARE_LIT; + while (i < TF_FLARE_OFF) + { + j = (random() + 2) * 5; + current_yaw = anglemod(self.angles_y + j); + self.angles_y = current_yaw; + self.angles_x = TF_FLARE_LIT; + self.angles_z = TF_FLARE_LIT; + makevectors(self.angles); + deathmsg = 9; + launch_spike(self.origin, v_forward); + newmis.touch = superspike_touch; + newmis.weapon = 9; + i = i + TF_FLARE_OFF; + } + self.playerclass = self.playerclass + TF_FLARE_OFF; + self.nextthink = time + 0.1; + if (self.playerclass > 40) + { + self.weapon = 9; + self.think = GrenadeExplode; + } +}; + diff --git a/weapons.pqc b/weapons.pqc new file mode 100644 index 0000000..0b2743b --- /dev/null +++ b/weapons.pqc @@ -0,0 +1,6833 @@ +.float has_syringe, option, option5, is_squating; +.float last_used, tools, option4, vision, maxfbspeed; + +// auto screenshot +//.float screenshot; +// + +#ifdef clan_progs +void () DropGoalItems; +#endif + +#ifdef tf29ents +void () DropGoalItems; +#endif + +/* Used in MegaTF United. +// XTF stuff +float (float rangeDist, float typeFlag) AI_Target; +// +*/ + +// medic's self healing +void () HealSelf; +// + +//votemap_start +void (string put) votemap_start; + +// HW spam lessener +.float hw_message_resttime; + +float airscout, drop3, drop2, drop1; +void (float _p_10136) TeamFortress_ItemStatus; + +float prematch; + +void () lay; +void () unlay; + +void () DropFlag; +void () Det_Disp; +void () Det_Sent; + +void () review_timeleft; +void () TeamFortress_Timeleft; + +void () TeamFortress_NightVision; +void () Prox_Disarm; +void () ProxiDie; +//entity (float head) MakeLink; +void() BallCheck; +void() TeamFortress_AmmoboxTouch; +void () TeamFortress_Spotlight; +// pablo. wra. frikqcc you pos. take that. +// +void() MushroomFlame; +void() DroneJet; +void(float tno) RemoveOldAmmobox; +float(float tno) num_team_ammoboxes; +void () W_FireBigAss; +void() BallTouch; +void() make_explosion; +void () DroneDie; +string(float pc) TeamFortress_GetClassName; +void(float tno) increment_team_ammoboxes; +void (vector org) spawn_tfog; +void () Drone; +void () Prox; +//void () endFlash; +void() button_fire; +void() ConcussionGrenadeTimer; +void() PipebombTouch; +//float (entity hwguy) hwguy_deflect; + +void (entity targ, entity inflictor, entity attacker, float damage) T_Damage; +void (entity targ, entity inflictor, entity attacker, float damage, float T_flags, float T_AttackType) TF_T_Damage; +void () player_run; +void(entity bomb, entity attacker, float rad, entity ignore) T_RadiusDamage; +void() TeamFortress_DisplayDetectionItems; +float(vector veca, vector vecb) crossproduct; +void(vector org, float damage) SpawnBlood; +void(entity rhook) Reset_Grapple; +void() SuperDamageSound; +float() W_BestWeapon; +void() ConcussionGrenadeTimer; +void() W_PrintWeaponMessage; +void() button_touch; +void() button_fire; + +// TeamFortress Impulse Commands +void() TeamFortress_ToggleGenderMessage; +void() TeamFortress_ChangeClass; +void() TeamFortress_DisplayLegalClasses; +void() TeamFortress_Inventory; +void() TeamFortress_SaveMe; +void() TeamFortress_ID; +void() TeamFortress_ShowTF; +void() TeamFortress_SniperWeapon; +void() TeamFortress_IncendiaryCannon; +void() TeamFortress_FlameThrower; +void() TeamFortress_PrimeGrenade; +void() TeamFortress_ThrowGrenade; +void() TeamFortress_Discard; +void(entity p) TeamFortress_SetSpeed; +void() TeamFortress_DetonatePipebombs; +void() PipebombTouch; +void() TeamFortress_DetpackStop; +void() SniperSight_Create; +void(float zoom_level) TF_zoom; +void() TeamFortress_ReloadCurrentWeapon; +void() TeamFortress_AutoZoomToggle; +void() TeamFortress_StatusQuery; +void() TeamFortress_SpyGoUndercover; +void (float _p_9330) TeamFortress_SpyFeignDeath; +void() TeamFortress_EngineerBuild; +//void() DropKey; +void() UseSpecialSkill; + +// TeamFortress Pre-Impulse Commands +void(float scanrange) TeamFortress_Scan; +void(float timer) TeamFortress_SetDetpack; + +// Team Functions +float (float tno, float autoteam) TeamFortress_TeamSet; +void(float tno) TeamFortress_TeamShowScores; +void(entity Player) TeamFortress_TeamShowMemberClasses; + +// Camera Functions +void() CamLock; +void() CamDistLock; +void() CamVecLock; +void() CamAngleLock; +void() CamRevAngleLock; +void() CamProjectileLock; +void() CamProjectileZoom; +void() CamProjectileLockOn; +void() CamProjectileLockOff; +void() CamOffset; +void() CamDrop; +void() fadetoblack; +void() fadefromblack; +void() fadetowhite; +void() fadefromwhite; + +// Engineer Functions +void(entity disp) Engineer_UseDispenser; +void(entity gun) Engineer_UseSentryGun; +//void(entity mortar) Engineer_UseMortar; + +void(entity spy) Spy_RemoveDisguise; + +// Help functions +void() TeamFortress_MOTD; +void() TeamFortress_HelpMap; +void(float res) StatusRes; + +// BioInfection functions +void() BioInfection_Decay; +void() BioInfection_MonsterDecay; + +// Attacking functions +void() W_FireFlame; +void() W_FireIncendiaryCannon; +void() W_FireTranq; +void () W_FireLaser; + +// Timer Functions +void() HallucinationTimer; +void() TranquiliserTimer; + +// CTF Support functions +void() TeamFortress_CTF_FlagInfo; + +// #PC_UNDEFINED viewing functions +void() TF_MovePlayer; + +void(vector org, float damage) SpawnBlood; + +void() W_Precache = +{ + precache_sound("speech/yell/coverme.wav"); + precache_sound("speech/yell/overhere.wav"); + precache_sound("speech/yell/thisway.wav"); + precache_sound("speech/yell/followme.wav"); + precache_sound("speech/yell/incomng.wav"); + precache_sound("speech/yell/firehole.wav"); + precache_sound("speech/yell/gogogo.wav"); + precache_sound("speech/yell/lookout.wav"); + precache_sound("speech/yell/holdup.wav"); + precache_sound("speech/needlite.wav"); + precache_sound("effects/bodyhit1.wav"); + precache_sound("effects/bodyhit2.wav"); + precache_sound("zombie/z_miss.wav"); + precache_sound("weapons/drone.wav"); + precache_sound("weapons/knifedrw.wav"); + precache_sound("ambient/100hzhum.wav"); + precache_sound("weapons/jetjump.wav"); + precache_sound("enforcer/enfire.wav"); + precache_sound("shambler/smack.wav"); + precache_sound("weapons/r_exp3.wav"); + precache_sound("shambler/sboom.wav"); + precache_sound("weapons/sniper.wav"); + precache_sound("doors/ddoor2.wav"); + precache_sound("doors/airdoor2.wav"); + precache_sound("weapons/sgun1.wav"); + precache_sound("weapons/unreel.wav"); + precache_sound("weapons/retract.wav"); + precache_sound("weapons/rocklr1a.wav"); + precache_sound("weapons/railgr1a.wav"); + precache_sound("weapons/shotgr1a.wav"); + precache_sound("weapons/guncock.wav"); + precache_sound("weapons/ric1.wav"); + precache_sound("weapons/ric2.wav"); + precache_sound("weapons/ric3.wav"); + precache_sound("weapons/spike2.wav"); + precache_sound("weapons/tink1.wav"); + precache_sound("weapons/tink2.wav"); + precache_sound("weapons/shell2.wav"); + precache_sound("weapons/launch.wav"); + precache_sound("effects/mortar.wav"); + precache_sound("weapons/bounce.wav"); + precache_sound("weapons/shotgn2.wav"); + precache_sound("items/r_item1.wav"); + precache_sound("items/r_item2.wav"); + precache_sound("items/flare1.wav"); + precache_model("progs/s_expl.spr"); + precache_model("progs/beam.mdl"); + precache_model("progs/beam2.mdl"); + precache_model("progs/spikebal.mdl"); + precache_model("progs/flare.spr"); + precache_model("progs/lsrdrone.mdl"); + precache_model("progs/shell2.mdl"); + precache_model("progs/20mmcase.mdl"); + precache_model("progs/air-mirv.mdl"); + precache_model("progs/flame2.mdl"); + precache_model ("progs/syringe.mdl"); + precache_sound("ambience/fire1.wav"); + precache_model2("progs/v_spike.mdl"); + precache_sound("hknight/hit.wav"); + precache_sound("hknight/slash1.wav"); + precache_sound("doors/meduse.wav"); + precache_sound("weapons/tnkatck4.wav"); + precache_sound("weapons/pain.wav"); + precache_sound("weapons/gunidle1.wav"); + precache_sound("speech/excelent.wav"); + precache_sound("weapons/rifle.wav"); + precache_sound("weapons/plaser.wav"); + precache_sound("weapons/flmfire2.wav"); + precache_sound("misc/vapeur2.wav"); + precache_sound("weapons/chngnu1a.wav"); + precache_sound("weapons/asscan2.wav"); + precache_sound("weapons/chngnd1a.wav"); + precache_sound("weapons/dartgun.wav"); + precache_sound("weapons/lavapool.wav"); + precache_sound("misc/null.wav"); + precache_sound ("misc/secret.wav"); +// XTF MDL +// precache_model ("progs/xrail.mdl"); +// END XTF MDL +// XTF SOUND +// precache_sound ("weapons/railgun.wav"); +// END XTF SOUND + precache_sound ("misc/runekey.wav"); +// 04 spycam and dropgrens + if ((infokey (world, "dropgrens") == "on")) + { + precache_model2 ("progs/ammobox2.mdl"); + } + if ((infokey (world, "spycam") == "on")) + { + precache_model2 ("progs/spycamb.mdl"); + precache_model2 ("progs/spycamc.mdl"); + } +// 11.11.04 sounds + precache_sound ("misc/update.wav"); +}; + +float() crandom = +{ + return 2 * (random() - 0.5); +}; + +void(float att_delay) Attack_Finished = +{ + if (self.tfstate & 32768) + { + self.attack_finished = time + att_delay * 3; + } + else + { + self.attack_finished = time + att_delay; + } +}; + +void() ShellHit = +{ + if (self.skin == TF_FLARE_OFF) + { + sound(self, 3, "weapons/shell2.wav", 0.5, TF_FLARE_OFF); + } + else + { + if (random() < 0.5) + { + sound(self, 3, "weapons/tink1.wav", 0.5, TF_FLARE_OFF); + } + else + { + sound(self, 3, "weapons/tink2.wav", 0.6, TF_FLARE_OFF); + } + } + return; +}; + +void () EjectShell = +{ + + newmis = spawn (); + newmis.movetype = 10; + newmis.solid = 1; + newmis.team_no = self.team_no; + makevectors (self.v_angle); + if (self.v_angle_x) + { + if ((self.current_weapon == 32)) + { + newmis.velocity = (((v_forward * 70) + (v_up * 90)) + ((random () * v_right) * -150)); + } + else + { + newmis.velocity = (((v_forward * 70) + (v_up * 90)) + ((random () * v_right) * 150)); + } + } + else + { + newmis.velocity = aim (self, 10000); + if ((self.current_weapon == 32)) + { + newmis.velocity = ((newmis.velocity * 70) + ((random () * v_right) * -150)); + } + else + { + newmis.velocity = ((newmis.velocity * 70) + ((random () * v_right) * 150)); + } + newmis.velocity_z = (random () * 90); + } + if ((random () < 0.300000)) + { + newmis.avelocity = '2000 3000 4000'; + } + else + { + if ((random () < 0.600000)) + { + newmis.avelocity = '4000 2000 3000'; + } + else + { + newmis.avelocity = '7000 5000 1000'; + } + } + setsize (newmis, '0 0 0', '0 0 0'); + setorigin (newmis, ((self.origin + (v_forward * 10)) + '0 0 20')); + if ((self.playerclass == 6)) + { + newmis.nextthink = (time + 1.500000); + setmodel (newmis, "progs/20mmcase.mdl"); + } + else + { + newmis.nextthink = (time + 3); + setmodel (newmis, "progs/shell2.mdl"); + } + newmis.think = SUB_Remove; + newmis.touch = ShellHit; + if (((self.current_weapon == 128) || (self.current_weapon == 256))) + { + newmis.skin = 0; + } + else + { + newmis.skin = 1; + } +}; + +void() StingerTouch = +{ + if (other.takedamage) + { +// ---> pablo. gg? :/ +// self.velocity == '0 0 0'; +// <--- + sound(self, 3, "shambler/smack.wav", 0.8, TF_FLARE_OFF); + return; + } + sound(self, TF_FLARE_OFF, "weapons/bounce.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void() StingerElec = +{ + local entity te; + self.effects = 4; + sound(self, TF_FLARE_OFF, "weapons/lhit.wav", TF_FLARE_OFF, TF_FLARE_OFF); +// ---> pablo. gg? :/ +// self.team_no == self.owner.team_no; +// <--- + if (self.waterlevel > TF_FLARE_LIT) + { + te = findradius(self.origin, 950); + while (te) + { + if (te.classname == "player" && te.waterlevel > TF_FLARE_LIT) + { + if (!(te.radsuit_finished > time)) + { + deathmsg = 7; + TF_T_Damage(te, self, self.owner, 250, 2, TF_FLARE_LIT); + } + } + te = te.chain; + } + remove(self); + return; + } + else + { + remove(self); + return; + } +}; + +void () W_LaunchStinger = +{ + local entity _l_2155; + + if ((self.no_grenades_2 < 2)) + { + sprint (self, 2, "Not enough type 2 grenades... get more\n"); + return; + } + if (infokey(world, "drop2") == "off" || infokey(world, "drop2") == "0") + { + sprint (self, 2, "Toasters have been disabled by the admin!\n"); + return; + } + self.no_grenades_2 = (self.no_grenades_2 - 2); + sound (self, 1, "misc/power.wav", 1, 1); + _l_2155 = spawn (); + _l_2155.owner = self; + _l_2155.movetype = 10; + _l_2155.solid = 2; + _l_2155.classname = "grenade"; + _l_2155.effects = 8; + makevectors (self.v_angle); + if (self.v_angle_x) + { + _l_2155.velocity = ((((v_forward * 600) + (v_up * 200)) + ((crandom () * v_right) * 10)) + ((crandom () * v_up) * 10)); + } + else + { + _l_2155.velocity = aim (self, 10000); + _l_2155.velocity = (_l_2155.velocity * 600); + _l_2155.velocity_z = 200; + } + _l_2155.avelocity = '300 300 300'; + _l_2155.angles = vectoangles (_l_2155.velocity); + _l_2155.touch = StingerTouch; + _l_2155.nextthink = (time + 3); + _l_2155.think = StingerElec; + setmodel (_l_2155, "progs/v_spike.mdl"); + setsize (_l_2155, '0 0 0', '0 0 0'); + setorigin (_l_2155, self.origin); +}; + +void() SpyPackRemove = +{ + sprint(self.owner, 2, "Your Ammo Trap failed...\n"); + dremove(self); +}; + +void () SpyPackTouch = +{ + + if ((self.pausetime > time)) + { + return; + } + if ((other.classname != "player")) + { + return; + } + if ((other.health <= 0)) + { + return; + } + if ((other.team_no == self.team_no)) + { + return; + } + if ((other.bugger > 0)) + { + return; + } + if ((other.classname == "player")) + { + other.ammo_shells = 0; + other.ammo_nails = 0; + other.ammo_rockets = 0; + other.ammo_cells = 0; + other.currentammo = 0; + other.no_grenades_1 = 0; + other.no_grenades_2 = 0; + sprint (other, 2, "Your ammo has been robbed!\n"); + sound (self, 3, "weapons/lock4.wav", 1, 1); + sprint (self.owner, 2, "Your ammo trap worked!\n"); + dremove (self); + } +}; + +void() SpyPack = +{ + local entity te; + te = find(world, classname, "drop1"); + while (te) + { + if (te.owner == self) + { + sprint(self, 2, "1 ammo trap at a time!\n"); + return; + } + te = find(te, classname, "drop1"); + } + sprint(self, 2, "You set an Ammo Trap!\n"); + sound(self, 3, "weapons/lock4.wav", TF_FLARE_OFF, TF_FLARE_OFF); + newmis = spawn(); + newmis.owner = self; + newmis.enemy = self; + newmis.health = time; + newmis.weapon = TF_FLARE_LIT; + newmis.movetype = 6; + newmis.solid = TF_FLARE_OFF; + newmis.team_no = self.team_no; + makevectors(self.v_angle); + if (self.v_angle_x) + { + newmis.velocity = v_forward * 100 + v_up * 200; + } + else + { + newmis.velocity = aim(self, 10000); + newmis.velocity = newmis.velocity * 100; + newmis.velocity_z = 200; + } + newmis.avelocity = '0 300 0'; + setsize(newmis, '0 0 0', '0 0 0'); + setorigin(newmis, self.origin); + newmis.nextthink = time + 180; + newmis.think = SpyPackRemove; + newmis.touch = SpyPackTouch; + newmis.classname = "drop1"; + setmodel(newmis, "progs/backpack.mdl"); +}; + +void() RemoveLavaPool = +{ + sprint(self.owner, 2, "Your Lava has cooled...\n"); + sound(self, 4, "misc/null.wav", TF_FLARE_LIT, TF_FLARE_OFF); + self.owner.has_syringe = TF_FLARE_OFF; + dremove(self); +}; + +void() LavaTouch = +{ + if (other.classname != "player" && other.classname != "bot") + { + return; + } + if (other.health <= TF_FLARE_LIT) + { + return; + } + if (other.team_no < TF_FLARE_OFF) + { + return; + } + if (other.takedamage) + { + deathmsg = 15; + TF_T_Damage(other, self.owner, self.owner, 2, TF_FLARE_LIT, 16); + if (random() < 0.1) + { + sound(other, TF_FLARE_LIT, "misc/vapeur2.wav", 0.4, TF_FLARE_OFF); + } + else + { + if (random() > 0.6) + { + sound(other, TF_FLARE_LIT, "player/inh2o.wav", 0.8, TF_FLARE_OFF); + } + } + if (other.classname != "bot") + { + stuffcmd(other, "bf\n"); + } + if (other.team_no == self.owner.team_no) + { + return; + } + other.origin_x = self.origin_x; + other.origin_y = self.origin_y; + } +}; + +void() LavaBallTouch = +{ + if (other == self.owner) + { + return; + } + sound(self, TF_FLARE_OFF, "zombie/z_miss.wav", TF_FLARE_OFF, TF_FLARE_OFF); + if (other.takedamage) + { + if (other.classname != "player") + { + return; + } + if (other.health <= TF_FLARE_LIT) + { + return; + } + if (other.team_no < TF_FLARE_OFF) + { + return; + } + if (other.team_no == self.owner.team_no) + { + return; + } + deathmsg = 15; + TF_T_Damage(other, self, self.owner, 20, TF_FLARE_LIT, 16); + } +}; + +void() LavaBecome = +{ + if (self.waterlevel > TF_FLARE_OFF) + { + dremove(self); + } + setmodel(self, "progs/lavapool.mdl"); + self.avelocity = '0 0 0'; + self.effects = 8; + deathmsg = 15; + self.classname = "timer"; + sound(self, 4, "weapons/lavapool.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.angles_y = TF_FLARE_LIT; + self.angles_x = TF_FLARE_LIT; + self.angles_z = TF_FLARE_LIT; + setsize(self, '-12 -12 0', '12 12 2'); + self.nextthink = time + 30; + self.think = RemoveLavaPool; + self.touch = LavaTouch; +}; + +void() LavaPool = +{ + if (self.has_syringe != TF_FLARE_OFF) + { + sprint(self, 2, "You get 1 Lava Pool at a time!\n"); + return; + } + self.has_syringe = TF_FLARE_LIT; + + sound(self, 3, "weapons/throw.wav", TF_FLARE_OFF, TF_FLARE_OFF); + newmis = spawn(); + newmis.classname = "timer"; + newmis.owner = self; + newmis.team_no = self.team_no; + newmis.health = time; + newmis.weapon = TF_FLARE_LIT; + newmis.movetype = 6; + newmis.solid = TF_FLARE_OFF; + newmis.team_no = self.team_no; + makevectors(self.v_angle); + if (self.v_angle_x) + { + newmis.velocity = v_forward * 400 + v_up * 200; + } + else + { + newmis.velocity = aim(self, 10000); + newmis.velocity = newmis.velocity * 400; + newmis.velocity_z = 200; + } + newmis.avelocity = '300 300 300'; + setsize(newmis, '0 0 0', '0 0 0'); + setorigin(newmis, self.origin); + newmis.nextthink = time + 2; + newmis.think = LavaBecome; + newmis.touch = LavaBallTouch; + setmodel(newmis, "progs/lavaball.mdl"); +}; + +void() s_explode1 = [0, s_explode2] +{ +}; + +void() s_explode2 = [1, s_explode3] +{ +}; + +void() s_explode3 = [2, s_explode4] +{ +}; + +void() s_explode4 = [3, s_explode5] +{ +}; + +void() s_explode5 = [4, s_explode6] +{ +}; + +void() s_explode6 = [5, SUB_Remove] +{ +}; + +void() s2_explode1 = [0, s2_explode2] +{ +}; + +void() s2_explode2 = [1, s2_explode3] +{ +}; + +void() s2_explode3 = [2, s2_explode4] +{ +}; + +void() s2_explode4 = [3, s2_explode5] +{ +}; + +void() s2_explode5 = [4, s2_explode6] +{ +}; + +void() s2_explode6 = [5, s2_explode7] +{ +}; + +void() s2_explode7 = [6, s2_explode8] +{ +}; + +void() s2_explode8 = [7, SUB_Remove] +{ +}; + +void() BecomeExplosion = +{ + dremove(self); +}; + +float(float tno) num_team_pipebombs = +{ + if (tno == TF_FLARE_OFF) + { + return num_team_pipebombs_1; + } + else + { + if (tno == 2) + { + return num_team_pipebombs_2; + } + else + { + if (tno == 3) + { + return num_team_pipebombs_3; + } + else + { + if (tno == 4) + { + return num_team_pipebombs_4; + } + } + } + } + return TF_FLARE_LIT; +}; + +void(float tno) ExplodeOldPipebomb = +{ + local entity old; + local float index; + if (tno != TF_FLARE_LIT) + { + index = num_team_pipebombs(tno); + index = index - 30 / number_of_teams; + } + else + { + index = num_world_pipebombs - 30; + } + old = find(world, classname, "pipebomb"); + while (index > TF_FLARE_LIT) + { + if (old == world) + { + dprint("*** ERROR: ExplodeOldPipebomb. ***\n"); + dprint("*** Please report this. ***\n"); + num_world_pipebombs = TF_FLARE_LIT; + num_team_pipebombs_1 = TF_FLARE_LIT; + num_team_pipebombs_2 = TF_FLARE_LIT; + num_team_pipebombs_3 = TF_FLARE_LIT; + num_team_pipebombs_4 = TF_FLARE_LIT; + return; + } + if (old.owner.team_no == tno || tno == TF_FLARE_LIT) + { + old.nextthink = time + 0.5; + index = index - TF_FLARE_OFF; + } + old = find(old, classname, "pipebomb"); + } +}; + +void(float tno) increment_team_pipebombs = +{ + if (tno == TF_FLARE_OFF) + { + num_team_pipebombs_1 = num_team_pipebombs_1 + TF_FLARE_OFF; + } + else + { + if (tno == 2) + { + num_team_pipebombs_2 = num_team_pipebombs_2 + TF_FLARE_OFF; + } + else + { + if (tno == 3) + { + num_team_pipebombs_3 = num_team_pipebombs_3 + TF_FLARE_OFF; + } + else + { + if (tno == 4) + { + num_team_pipebombs_4 = num_team_pipebombs_4 + TF_FLARE_OFF; + } + } + } + } +}; + +void(float tno) decrement_team_pipebombs = +{ + if (tno == TF_FLARE_OFF) + { + num_team_pipebombs_1 = num_team_pipebombs_1 - TF_FLARE_OFF; + } + else + { + if (tno == 2) + { + num_team_pipebombs_2 = num_team_pipebombs_2 - TF_FLARE_OFF; + } + else + { + if (tno == 3) + { + num_team_pipebombs_3 = num_team_pipebombs_3 - TF_FLARE_OFF; + } + else + { + if (tno == 4) + { + num_team_pipebombs_4 = num_team_pipebombs_4 - TF_FLARE_OFF; + } + } + } + } +}; + +void() GrenadeExplode = +{ + if (self.classname == "pipebomb") + { + num_world_pipebombs = num_world_pipebombs - TF_FLARE_OFF; + decrement_team_pipebombs(self.owner.team_no); + } + deathmsg = self.weapon; + if ((self.weapon == 9)) + { + self.owner.active_grenades_2 = (self.owner.active_grenades_2 - 1); + } + if ((self.weapon == 10)) + { +// This is added from 11.11.04 - used to be (self.owner.active_grenades_2 - 0.166667); +// but I dunno how the hell that can make sense - I figure it's a decompiler error, so +// I changed it to 1. + self.owner.active_grenades_2 = (self.owner.active_grenades_2 - 1); + if ((ftos (self.owner.active_grenades_2) == " -0.0")) + { + self.owner.active_grenades_2 = 0; + } + } + self.weapon = 40; + self.weapon = 10; +// if (40 || 10) +// { + T_RadiusDamage(self, self.owner, 120, world); +// } +// else +// { +// T_RadiusDamage(self, self.owner, 80, world); +// } + WriteByte(4, 23); + WriteByte(4, 3); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, TF_FLARE_OFF); + BecomeExplosion(); + dremove(self); +}; + +void() GrenadeTouch = +{ + if (other == self.owner) + { + return; + } + if (other.takedamage == 2) + { + GrenadeExplode(); + return; + } + sound(self, TF_FLARE_OFF, "weapons/bounce.wav", TF_FLARE_OFF, TF_FLARE_OFF); + if (self.velocity == '0 0 0') + { + self.avelocity = '0 0 0'; + } +}; + +void() W_FireGrenade = +{ + if (self.option == TF_FLARE_OFF) + { + self.currentammo = self.ammo_rockets = self.ammo_rockets - 2; + } + else + { + if (self.option4 == 1) + { + self.currentammo = self.ammo_rockets = self.ammo_rockets - 2; + } + else + { + self.currentammo = self.ammo_rockets = self.ammo_rockets - TF_FLARE_OFF; + } + } + sound(self, TF_FLARE_OFF, "weapons/launch.wav", TF_FLARE_OFF, TF_FLARE_OFF); + KickPlayer(-2, self); + newmis = spawn(); + newmis.owner = self; + newmis.movetype = 10; + newmis.solid = 2; + if (self.weaponmode == TF_FLARE_LIT) + { + newmis.weapon = 5; + newmis.classname = "grenade"; + newmis.skin = TF_FLARE_OFF; + newmis.touch = GrenadeTouch; + newmis.nextthink = time + 2.5; + } + else + { + if (self.team_no != TF_FLARE_LIT) + { + increment_team_pipebombs(self.team_no); + if (num_team_pipebombs(self.team_no) > 30 / number_of_teams) + { + ExplodeOldPipebomb(self.team_no); + } + } + else + { + num_world_pipebombs = num_world_pipebombs + TF_FLARE_OFF; + if (num_world_pipebombs > 30) + { + ExplodeOldPipebomb(TF_FLARE_LIT); + } + } + newmis.classname = "pipebomb"; + newmis.skin = 2; + newmis.touch = PipebombTouch; + newmis.nextthink = time + 120; + newmis.weapon = 11; + } + makevectors(self.v_angle); + if (self.v_angle_x) + { + if (self.option == TF_FLARE_OFF) + { + newmis.velocity = v_forward * 1200 + v_up * 200 + crandom() * v_right * 10 + crandom() * v_up * 10; + } + else + { + newmis.velocity = v_forward * 600 + v_up * 200 + crandom() * v_right * 10 + crandom() * v_up * 10; + } + } + else + { + newmis.velocity = aim(self, 10000); + if (self.option == TF_FLARE_OFF) + { + newmis.velocity = newmis.velocity * 1200; + } + else + { + newmis.velocity = newmis.velocity * 600; + } + newmis.velocity_z = 200; + } + newmis.avelocity = '300 300 300'; + newmis.angles = vectoangles(newmis.velocity); + newmis.think = GrenadeExplode; + setmodel(newmis, "progs/grenade2.mdl"); + setsize(newmis, '0 0 0', '0 0 0'); + setorigin(newmis, self.origin); +}; + +void() HoloHumm = +{ + self.playerclass = self.playerclass + TF_FLARE_OFF; + self.nextthink = time + TF_FLARE_OFF; + sound(self, TF_FLARE_LIT, "ambient/100hzhum.wav", TF_FLARE_OFF, TF_FLARE_OFF); + if (self.playerclass > 4) + { + WriteByte(4, 23); + WriteByte(4, 11); + WriteCoord(4, self.origin_x); + WriteCoord(4, self.origin_y); + WriteCoord(4, self.origin_z); + multicast(self.origin, TF_FLARE_OFF); + if (self.playerclass > 4) + { + self.owner.has_holo = TF_FLARE_OFF; + self.think = SUB_Remove; + } + } +}; + +void() HoloDood = +{ + local entity holo; + sound(self, TF_FLARE_OFF, "weapons/railgr1a.wav", 0.6, TF_FLARE_OFF); + holo = spawn(); + holo.owner = self; + holo.origin = self.origin + '0 0 24'; + holo.angles_y = self.angles_y; + holo.angles_x = self.angles_x; + holo.skin = self.skin; + holo.frame = self.frame; + holo.colormap = self.colormap; + holo.flags = 256; + holo.solid = TF_FLARE_OFF; + holo.effects = 8; + holo.movetype = 6; + setmodel(holo, "progs/player.mdl"); + setsize(holo, '-16 -16 -24', '16 16 32'); + holo.classname = "holo"; + holo.playerclass = TF_FLARE_LIT; + holo.nextthink = time + TF_FLARE_OFF; + holo.think = HoloHumm; + WriteByte(4, 23); + WriteByte(4, 11); + WriteCoord(4, holo.origin_x); + WriteCoord(4, holo.origin_y); + WriteCoord(4, holo.origin_z); + multicast(self.origin, TF_FLARE_OFF); +}; + +void() SuperLeap = +{ + + if (!airscout) + { + sprint(self, 2, "JetPack disabled by Admin!\n"); + return; + } + if (self.ammo_cells < 24) + { + sprint(self, 2, "Insufficient power... get more cells\n"); + return; + } + if (self.tfstate & 65536) + { + return; + } + self.jet_time = time + 3; + sound(self, TF_FLARE_OFF, "weapons/jetjump.wav", TF_FLARE_OFF, TF_FLARE_OFF); + W_FireFlame(); + muzzleflash(); + self.velocity = v_forward * 900 + '0 0 250' + v_up * 100; + stuffcmd(self, "bf\n"); + self.ammo_cells = self.ammo_cells - 23; + self.impulse = TF_FLARE_LIT; +}; + +void () MagTimer = +{ + local entity _l_2374; + local string _l_2375; + + _l_2374 = self.owner; + _l_2374.option5 = (_l_2374.option5 - 0.500000); + _l_2375 = ftos (_l_2374.option5); + sound (_l_2374, 0, "ambient/100hzhum.wav", 1, 1); + _l_2374.origin = self.origin; + CenterPrint2 (_l_2374, "You are stuck on a mag mine!\n", _l_2375); + if ((_l_2374.option5 < 2)) + { + _l_2374.option5 = 0; + sprint (_l_2374.enemy, 2, "Your Mag Mine died...\n"); + _l_2374.enemy.has_syringe = 1; + remove (self); + return; + } + self.nextthink = (time + 0.500000); +}; + +void () MagMineActivate = +{ + + if ((other.option == 0)) + { + self.owner.has_syringe = 1; + newmis = spawn (); + newmis.classname = "timer"; + newmis.netname = " FlashTimer"; + newmis.team_no = self.owner.team_no; + newmis.owner = other; + other.enemy = self.owner; + newmis.think = MagTimer; + newmis.nextthink = (time + 1); + newmis.origin = other.origin; + other.is_squating = 0; + } + other.option5 = (floor ((other.armorvalue * 0.250000)) + 3); + if ((other.option5 > 15)) + { + other.option5 = 15; + } +}; + +void () FlashTimer2 = +{ + local entity _l_2398; + local string _l_2399; + + _l_2398 = self.owner; + _l_2398.FlashTime = (_l_2398.FlashTime - 0.100000); + if ((_l_2398.FlashTime < 0)) + { + _l_2398.FlashTime = 0; + stuffcmd (_l_2398, "v_cshift 0\n"); + remove (self); + return; + } + if ((_l_2398.FlashTime < 1.700000)) + { + _l_2399 = ftos ((_l_2398.FlashTime * 150)); + stuffcmd (_l_2398, "v_cshift "); + stuffcmd (_l_2398, _l_2399); + stuffcmd (_l_2398, " "); + stuffcmd (_l_2398, _l_2399); + stuffcmd (_l_2398, " "); + stuffcmd (_l_2398, _l_2399); + stuffcmd (_l_2398, " "); + stuffcmd (_l_2398, _l_2399); + stuffcmd (_l_2398, "\n"); + } + if ((_l_2398.FlashTime >= 1.700000)) + { + stuffcmd (_l_2398, "v_cshift 255 255 255 255\n"); + } + if (((_l_2398.client != "zquake") && (_l_2398.client != "fuhquake"))) + { + stuffcmd (_l_2398, "gl_polyblend 1\n"); + } + if ((_l_2398.client == "moreqw")) + { + stuffcmd (_l_2398, "gl_cshiftpercent 100\n"); + } + self.nextthink = (time + 0.100000); +}; + +void () FlashGrenadeExplode2 = +{ + + self.owner.has_syringe = 1; + self.effects = (self.effects | 4); + WriteByte (4, 23); + WriteByte (4, 4); + WriteCoord (4, self.origin_x); + WriteCoord (4, self.origin_y); + WriteCoord (4, self.origin_z); + multicast (self.origin, 1); + if ((other.FlashTime == 0)) + { + newmis = spawn (); + newmis.classname = "timer"; + newmis.netname = "FlashTimer2"; + newmis.team_no = self.owner.team_no; + newmis.owner = other; + newmis.think = FlashTimer2; + newmis.nextthink = (time + 0.100000); + } +// other.FlashTime = 2.500000; //changed by request of Misery + other.FlashTime = 3; + stuffcmd (other, "v_cshift 255 255 255 255\n"); +}; + +void () W_FireAxe = +{ + local vector source; + local vector org; + local vector def; + + makevectors (self.v_angle); + source = (self.origin + '0 0 16'); + traceline (source, (source + (v_forward * 64)), 0, self); + if ((trace_fraction == 1)) + { + return; + } + org = (trace_endpos - (v_forward * 4)); + if (trace_ent.takedamage) + { + trace_ent.axhitme = 1; + SpawnBlood (org, 20); + if (((self.playerclass != 8) || (trace_ent.classname != "player"))) + { + deathmsg = 17; + TF_T_Damage (trace_ent, self, self, 20, 2, 0); + } + else + { + self.weaponmode = 1; + self.weaponmodel = "progs/v_knife2.mdl"; + makevectors (trace_ent.v_angle); + def = v_right; + makevectors (self.v_angle); + if ((crossproduct (def, v_forward) > 0)) + { + deathmsg = 22; + TF_T_Damage (trace_ent, self, self, 120, 2, 0); + } + else + { + deathmsg = 17; + TF_T_Damage (trace_ent, self, self, 40, 2, 0); + } + } + } + else + { + sound (self, 1, "player/axhit2.wav", 1, 1); + WriteByte (4, 23); + WriteByte (4, 2); + WriteByte (4, 3); + WriteCoord (4, org_x); + WriteCoord (4, org_y); + WriteCoord (4, org_z); + multicast (org, 2); + } +}; + +void () W_FireSpanner = +{ + local vector source; + local vector org; + local float healam; + local entity te; + + makevectors (self.v_angle); + source = (self.origin + '0 0 16'); + traceline (source, (source + (v_forward * 64)), 0, self); + if ((trace_fraction == 1)) + { + return; + } + org = (trace_endpos - (v_forward * 4)); + if ((trace_ent.goal_activation & 8)) + { + if (Activated (trace_ent, self)) + { + DoResults (trace_ent, self, 1); + if ((trace_ent.classname == "func_button")) + { + trace_ent.enemy = self; + other = self; + self = trace_ent; + self.dont_do_triggerwork = 1; + button_fire (); + self = other; + } + } + else + { + if ((trace_ent.else_goal != 0)) + { + te = Findgoal (trace_ent.else_goal); + if (te) + { + DoResults (te, self, (trace_ent.goal_result & 2)); + } + } + else + { + sound (self, 1, "player/axhit2.wav", 1, 1); + WriteByte (4, 23); + WriteByte (4, 2); + WriteByte (4, 3); + WriteCoord (4, org_x); + WriteCoord (4, org_y); + WriteCoord (4, org_z); + multicast (org, 2); + } + } + return; + } + if (trace_ent.takedamage) + { + if ((trace_ent.classname == "building_dispenser")) + { + Engineer_UseDispenser (trace_ent); + return; + } + else + { + if ((trace_ent.classname == "building_sentrygun")) + { + Engineer_UseSentryGun (trace_ent); + return; + } + else + { + if ((trace_ent.classname == "building_sentrygun_base")) + { + if (trace_ent.oldenemy) + { + Engineer_UseSentryGun (trace_ent.oldenemy); + } + return; + } + else + { + if ((trace_ent.classname == "player")) + { + if (((((trace_ent.team_no == self.team_no) && (self.team_no != 0)) && teamplay) || coop)) + { + healam = 10; + if ((self.ammo_cells < healam)) + { + healam = self.ammo_cells; + } + if ((trace_ent.armortype == 0)) + { + return; + } + if (((trace_ent.maxarmor - trace_ent.armorvalue) < (healam * 4))) + { + healam = ceil (((trace_ent.maxarmor - trace_ent.armorvalue) / 4)); + } + if ((healam > 0)) + { + trace_ent.armorvalue = (trace_ent.armorvalue + (healam * 4)); + if ((trace_ent.armorvalue > trace_ent.maxarmor)) + { + trace_ent.armorvalue = trace_ent.maxarmor; + } + self.ammo_cells = (self.ammo_cells - healam); + sound (trace_ent, 1, "items/repair.wav", 1, 1); + WriteByte (4, 23); + WriteByte (4, 2); + WriteByte (4, 3); + WriteCoord (4, org_x); + WriteCoord (4, org_y); + WriteCoord (4, org_z); + multicast (org, 2); + W_SetCurrentAmmo (); + } + return; + } + } + trace_ent.axhitme = 1; + SpawnBlood (org, 20); + deathmsg = 32; + TF_T_Damage (trace_ent, self, self, 20, 2, 0); + } + } +// } + } + } + else + { + sound (self, 1, "player/axhit2.wav", 1, 1); + WriteByte (4, 23); + WriteByte (4, 2); + WriteByte (4, 3); + WriteCoord (4, org_x); + WriteCoord (4, org_y); + WriteCoord (4, org_z); + multicast (org, 2); + } +}; + +void () W_FireMedikit = +{ + local vector _l_2511; + local vector _l_2514; + local float _l_2517; + local entity _l_2518; + + _l_2511 = self.origin + '0 0 16'; + traceline (_l_2511, (_l_2511 + (v_forward * 64)), 0, self); + if ((trace_fraction == 1)) + { + return; + } + _l_2514 = trace_endpos - (v_forward * 4); + if (trace_ent.takedamage) + { + if ((trace_ent.classname == "building_dispenser")) + { + trace_ent.skin = 1; + return; + } + if (((trace_ent.classname == "player") && (trace_ent.bugger == 0))) + { + if ((((trace_ent.team_no == self.team_no) && (self.team_no != 0)) || coop)) + { + _l_2517 = 200; + if ((trace_ent.leg_damage > 1)) + { + sprint (trace_ent, 2, "Your leg wound has been healed!\n"); + } + TeamFortress_SetSpeed (trace_ent); + _l_2518 = find (world, classname, "timer"); + while ((((_l_2518.owner != trace_ent) || (_l_2518.think != ConcussionGrenadeTimer)) && (_l_2518 != world))) + { + _l_2518 = find (_l_2518, classname, "timer"); + } + if ((_l_2518 != world)) + { + stuffcmd (trace_ent, "v_idlescale 0\n"); + SpawnBlood (_l_2514, 20); + sprint (trace_ent, 2, "you have been healed of your concussion\n"); + if ((_l_2518.team_no != self.team_no)) + { + self.real_frags = (self.real_frags + 1); + if (!(toggleflags & 128)) + { + self.frags = self.real_frags; + } + } + dremove (_l_2518); + } + if ((trace_ent.tfstate & 16384)) + { + _l_2518 = find (world, classname, "timer"); + while ((((_l_2518.owner != trace_ent) || (_l_2518.think != HallucinationTimer)) && (_l_2518 != world))) + { + _l_2518 = find (_l_2518, classname, "timer"); + } + if ((_l_2518 != world)) + { + stuffcmd (trace_ent, "v_idlescale 0\n"); + trace_ent.tfstate = (trace_ent.tfstate - (trace_ent.tfstate & 16384)); + SpawnBlood (_l_2514, 20); + sprint (trace_ent, 2, "you have been healed of your hallucinations\n"); + if ((_l_2518.team_no != self.team_no)) + { + self.real_frags = (self.real_frags + 1); + if (!(toggleflags & 128)) + { + self.frags = self.real_frags; + } + } + dremove (_l_2518); + } + else + { + dprint ("Warning: Error in Hallucination Timer logic.\n"); + } + } + if ((trace_ent.tfstate & 32768)) + { + _l_2518 = find (world, classname, "timer"); + while ((((_l_2518.owner != trace_ent) || (_l_2518.think != TranquiliserTimer)) && (_l_2518 != world))) + { + _l_2518 = find (_l_2518, classname, "timer"); + } + if ((_l_2518 != world)) + { + trace_ent.tfstate = (trace_ent.tfstate - (trace_ent.tfstate & 32768)); + TeamFortress_SetSpeed (trace_ent); + SpawnBlood (_l_2514, 20); + stuffcmd (trace_ent, "v_cshift 0 0 0 0\n"); + sprint (trace_ent, 2, "you have been healed of your tranquilisation\n"); + if ((_l_2518.team_no != self.team_no)) + { + self.real_frags = (self.real_frags + 1); + if (!(toggleflags & 128)) + { + self.frags = self.real_frags; + } + } + dremove (_l_2518); + } + else + { + dprint ("Warning: Error in Tranquilisation Timer logic.\n"); + } + } + if ((trace_ent.FlashTime > 0)) + { + _l_2518 = find (world, netname, "flashtimer"); + while ((((_l_2518.owner != trace_ent) || (_l_2518.classname != "timer")) && (_l_2518 != world))) + { + _l_2518 = find (_l_2518, netname, "flashtimer"); + } + if ((_l_2518 != world)) + { + trace_ent.FlashTime = 0; + SpawnBlood (_l_2514, 20); + stuffcmd (trace_ent, "v_cshift 0 0 0 0\n"); + if ((_l_2518.team_no != self.team_no)) + { + self.real_frags = (self.real_frags + 1); + if (!(toggleflags & 128)) + { + self.frags = self.real_frags; + } + } + dremove (_l_2518); + } + else + { + dprint ("Warning: Error in Flash Timer logic.\n"); + trace_ent.FlashTime = 0; + } + } + if ((trace_ent.tfstate & 16)) + { + _l_2517 = rint ((trace_ent.health / 2)); + trace_ent.tfstate = (trace_ent.tfstate - (trace_ent.tfstate & 16)); + deathmsg = 23; + T_Damage (trace_ent, self, self, _l_2517); + SpawnBlood (_l_2514, 30); + sprint (trace_ent, 2, "Your infection is cured!\n"); + bprint (1, trace_ent.netname); + bprint (1, "'s infection was cured by "); + bprint (1, self.netname); + bprint (1, "\n"); + if ((self.classname == "player")) + { + sprint (self, 2, "You have healed "); + sprint (self, 2, trace_ent.netname); + sprint (self, 2, " of the infection.\n"); + if ((trace_ent.infection_team_no != self.team_no)) + { + self.real_frags = (self.real_frags + 1); + if (!(toggleflags & 128)) + { + self.frags = self.real_frags; + } + } + } + return; + } + if ((trace_ent.numflames > 0)) + { + sound (trace_ent, 1, "items/r_item1.wav", 1, 1); + trace_ent.numflames = 0; + sprint (trace_ent, 2, "The flames have been doused!\n"); + if ((self.classname == "player")) + { + sprint (self, 1, "You have put out "); + sprint (self, 1, trace_ent.netname); + sprint (self, 1, "'s fire.\n"); + } + return; + } + if (((_l_2517 > 0) && (trace_ent.health < trace_ent.max_health))) + { + sound (trace_ent, 1, "items/r_item1.wav", 1, 1); + trace_ent.axhitme = 1; + SpawnBlood (_l_2514, 20); + T_Heal (trace_ent, _l_2517, 0); + if (medicarmorheal) + { + trace_ent.armorvalue = (trace_ent.armorvalue + (trace_ent.maxarmor / 5)); + if ((trace_ent.armortype == 0)) + { + trace_ent.armortype = 0.300000; + trace_ent.items = (self.items | 8192); + } + if ((trace_ent.armorvalue > trace_ent.maxarmor)) + { + trace_ent.armorvalue = trace_ent.maxarmor; + } + } + } + else + { + if (((trace_ent.health >= trace_ent.max_health) && (trace_ent.health < (trace_ent.max_health + 51)))) + { + _l_2517 = 5; + if ((_l_2517 > (self.ammo_medikit * 5))) + { + _l_2517 = self.ammo_medikit * 5; + } + if ((_l_2517 > 0)) + { + sound (trace_ent, 3, "items/r_item2.wav", 1, 1); + T_Heal (trace_ent, _l_2517, 1); + self.ammo_medikit = (self.ammo_medikit - rint ((_l_2517 / 5))); + if (medicarmorheal) + { + if (((self.ammo_cells >= 15) && (trace_ent.armorvalue < trace_ent.maxarmor))) + { + trace_ent.armorvalue = (trace_ent.armorvalue + (trace_ent.maxarmor / 5)); + if ((trace_ent.armortype == 0)) + { + trace_ent.armortype = 0.300000; + trace_ent.items = (self.items | 8192); + } + if ((trace_ent.armorvalue > trace_ent.maxarmor)) + { + trace_ent.armorvalue = trace_ent.maxarmor; + } + self.ammo_cells = (self.ammo_cells - 15); + } + } + if (!(trace_ent.items & 65536)) + { + trace_ent.items = (trace_ent.items | 65536); + newmis = spawn (); + newmis.nextthink = (time + 5); + newmis.think = item_megahealth_rot; + newmis.owner = trace_ent; + } + } + } + } + } + } + } + else + { + sound (self, 1, "player/axhit2.wav", 1, 1); + WriteByte (4, 23); + WriteByte (4, 2); + WriteByte (4, 3); + WriteCoord (4, _l_2514_x); + WriteCoord (4, _l_2514_y); + WriteCoord (4, _l_2514_z); + multicast (_l_2514, 2); + } +}; + + +void () W_FireBioweapon = +{ + local vector _l_2533; + local vector _l_2536; + local entity _l_2540; + + _l_2533 = self.origin + '0 0 16'; + traceline (_l_2533, (_l_2533 + (v_forward * 64)), 0, self); + if ((trace_fraction == 1)) + { + return; + } + _l_2536 = trace_endpos - (v_forward * 4); + if (trace_ent.takedamage) + { + if ((trace_ent.classname == "building_dispenser")) + { + trace_ent.skin = 1; + return; + } + if (((trace_ent.classname == "player") && (trace_ent.bugger == 0))) + { + if (((((trace_ent.team_no != self.team_no) && (self.team_no != 0)) && teamplay) || (teamplay == 0))) + { + trace_ent.axhitme = 1; + SpawnBlood (_l_2536, 20); + deathmsg = 14; + T_Damage (trace_ent, self, self, 10); + if ((trace_ent.playerclass == 5)) + { + return; + } + trace_ent.tfstate = (trace_ent.tfstate | 16); + _l_2540 = spawn (); + _l_2540.classname = "timer"; + _l_2540.owner = trace_ent; + _l_2540.nextthink = (time + 2); + _l_2540.think = BioInfection_Decay; + _l_2540.enemy = self; + trace_ent.infection_team_no = self.team_no; + sprint (self, 2, "Your BioAxe has Infected an enemy!\n"); + } + } + else + { + if ((trace_ent.flags & 32)) + { + if ((trace_ent.classname == "monster_zombie")) + { + T_Damage (trace_ent, self, self, 200); + } + trace_ent.axhitme = 1; + SpawnBlood (_l_2536, 20); + T_Damage (trace_ent, self, self, 10); + _l_2540 = spawn (); + _l_2540.classname = "timer"; + _l_2540.nextthink = (time + 2); + _l_2540.think = BioInfection_MonsterDecay; + _l_2540.owner = self; + _l_2540.enemy = trace_ent; + } + else + { + trace_ent.axhitme = 1; + SpawnBlood (_l_2536, 30); + T_Damage (trace_ent, self, self, 40); + } + } + } + else + { + sound (self, 1, "player/axhit2.wav", 1, 1); + WriteByte (4, 23); + WriteByte (4, 2); + WriteByte (4, 3); + WriteCoord (4, _l_2536_x); + WriteCoord (4, _l_2536_y); + WriteCoord (4, _l_2536_z); + multicast (_l_2536, 2); + } +}; + + +vector () wall_velocity = +{ + local vector vel; + + vel = normalize (self.velocity); + vel = normalize (((vel + (v_up * (random () - 0.5))) + (v_right * (random () - 0.5)))); + vel = (vel + (2 * trace_plane_normal)); + vel = (vel * 200); + return (vel); +}; + +void (vector org,vector vel) SpawnMeatSpray = +{ + local entity missile; + + missile = spawn (); + missile.owner = self; + missile.movetype = 10; + missile.solid = 0; + makevectors (self.angles); + missile.velocity = vel; + missile.velocity_z = ((missile.velocity_z + 250) + (50 * random ())); + missile.avelocity = '3000 1000 2000'; + missile.nextthink = (time + 1); + missile.think = SUB_Remove; + setmodel (missile, "progs/zom_gib.mdl"); + setsize (missile, '0 0 0', '0 0 0'); + setorigin (missile, org); +}; + +void (vector org,float damage) SpawnBlood = +{ + WriteByte (4, 23); + WriteByte (4, 12); + WriteByte (4, 1); + WriteCoord (4, org_x); + WriteCoord (4, org_y); + WriteCoord (4, org_z); + multicast (org, 2); +}; + +void (float damage) spawn_touchblood = +{ + local vector vel; + + vel = (wall_velocity () * 0.2); + SpawnBlood ((self.origin + (vel * 0.01)), damage); +}; + +void (vector org,vector vel) SpawnChunk = +{ + particle (org, (vel * 0.02), 0, 10); +}; +entity multi_ent; +float multi_damage /* = 0 */; +vector blood_org /* = '0 0 0' */; +float blood_count /* = 0 */; +vector puff_org /* = '0 0 0' */; +float puff_count /* = 0 */; + +void () ClearMultiDamage = +{ + multi_ent = world; + multi_damage = 0; + blood_count = 0; + puff_count = 0; +}; + +void () ApplyMultiDamage = +{ + if (!multi_ent) + { + return; + } + TF_T_Damage (multi_ent, self, self, multi_damage, 2, 1); +}; + +void (entity hit,float damage) AddMultiDamage = +{ + if (!hit) + { + return; + } + if ((hit != multi_ent)) + { + ApplyMultiDamage (); + multi_damage = damage; + multi_ent = hit; + } + else + { + multi_damage = (multi_damage + damage); + } +}; + +void () Multi_Finish = +{ + if (puff_count) + { + WriteByte (4, 23); + WriteByte (4, 2); + WriteByte (4, puff_count); + WriteCoord (4, puff_org_x); + WriteCoord (4, puff_org_y); + WriteCoord (4, puff_org_z); + multicast (puff_org, 2); + } + if (blood_count) + { + WriteByte (4, 23); + WriteByte (4, 12); + WriteByte (4, blood_count); + WriteCoord (4, blood_org_x); + WriteCoord (4, blood_org_y); + WriteCoord (4, blood_org_z); + multicast (puff_org, 2); + } +}; + +void (float damage,vector dir) TraceAttack = +{ + local vector vel; + local vector org; + + vel = normalize (((dir + (v_up * crandom ())) + (v_right * crandom ()))); + vel = (vel + (2 * trace_plane_normal)); + vel = (vel * 200); + org = (trace_endpos - (dir * 4)); + + if (trace_ent.takedamage) + { + blood_count = (blood_count + 1); + blood_org = org; + AddMultiDamage (trace_ent, damage); + } + else + { + puff_count = (puff_count + 1); + } +}; + +void (float shotcount,vector dir,vector spread) FireBullets = +{ + local vector direction; + local vector src; + + makevectors (self.v_angle); + src = (self.origin + (v_forward * 10)); + src_z = (self.absmin_z + (self.size_z * 0.7)); + ClearMultiDamage (); + traceline (src, (src + (dir * 2048)), 0, self); + puff_org = (trace_endpos - (dir * 4)); + while ((shotcount > 0)) + { + direction = ((dir + ((crandom () * spread_x) * v_right)) + ((crandom () * spread_y) * v_up)); + traceline (src, (src + (direction * 2048)), 0, self); + if ((trace_fraction != 1)) + { + if (((self.weapon == 3) && engbat)) + { + TraceAttack (2, direction); + } + else + { + if ((self.weapon != 32768)) + { + TraceAttack (4, direction); + } + else + { + TraceAttack (9, direction); + } + } + } + shotcount = (shotcount - 1); + } + ApplyMultiDamage (); + Multi_Finish (); +}; + +void () W_FireShotgun = +{ + local vector dir; + + sound (self, 1, "weapons/guncock.wav", 1, 1); + KickPlayer (-2, self); + self.ammo_shells = (self.ammo_shells - 1); + self.currentammo = (self.ammo_shells); + EjectShell (); + dir = aim (self, 100000); + deathmsg = 1; + FireBullets (6, dir, '0.04 0.04 0'); +}; + +void () W_FireSuperShotgun = +{ + local vector dir; + + if ((self.currentammo == 1)) + { + W_FireShotgun (); + return; + } + EjectShell (); + EjectShell (); + sound (self, 1, "weapons/shotgn2.wav", 1, 1); + KickPlayer (-4, self); + self.ammo_shells = (self.ammo_shells - 2); + self.currentammo = (self.ammo_shells); + dir = aim (self, 100000); + deathmsg = 2; + FireBullets (14, dir, '0.14 0.08 0'); +}; + +void (vector _p_2685, float _p_2688) FireSniperBullet = +{ + local vector _l_2689; + local vector _l_2692; + + makevectors (self.v_angle); + _l_2692 = self.origin + (v_forward * 10); + _l_2692_z = self.absmin_z + (self.size_z * 0.700000); + ClearMultiDamage (); + traceline (_l_2692, (_l_2692 + (_p_2685 * 4096)), 0, self); + if ((trace_fraction != 1)) + { + TraceAttack (_p_2688, _p_2685); + } + if (trace_ent.takedamage) + { + _l_2689 = trace_endpos - (v_forward * 4); + SpawnBlood (_l_2689, 9); + } + else + { + _l_2689 = trace_endpos - (v_forward * 4); + WriteByte (4, 23); + WriteByte (4, 0); + WriteCoord (4, _l_2689_x); + WriteCoord (4, _l_2689_y); + WriteCoord (4, _l_2689_z); + multicast (self.origin, 1); + } + ApplyMultiDamage (); +}; + +void () W_FireSniperRifle = +{ + local vector dir; + local vector _l_2708; + local vector src; + local float dam_mult; + local float zdif; + local float use_this; + local float x; + local vector f; + local vector g; + local vector h; +#ifdef clan_progs + local float damg; //PZ - damg is for Randomer's charge-up fix +#endif + + sound (self, 1, "weapons/rifle.wav", 1, 1); + self.ammo_shells = (self.ammo_shells - 1); + KickPlayer (-2, self); + self.currentammo = (self.ammo_shells - 1); + EjectShell (); + makevectors (self.v_angle); + src = (self.origin + (v_forward * 10)); + src_z = (self.absmin_z + (self.size_z * 0.7)); + use_this = 0; + traceline (src, (src + (dir * 8092)), 0, self); + if ((trace_fraction != 1)) + { + if ((trace_ent.classname == "player")) + { + use_this = 1; + } + } + KickPlayer (-4, self); + if (!use_this) + { + dir = aim (self, 10000); + traceline (src, (src + (dir * 3072)), 0, self); + } + deathmsg = 18; + dam_mult = 1; +#ifdef clan_progs + // PZ - code added for randomer's charge-up fix + damg = (time - self.heat) / WEAP_SNIPER_RIFLE_MAX_TIME; + if (damg < 0) + damg = 0; + if (damg > 1) + damg = 1; + damg = damg * (WEAP_SNIPER_RIFLE_MAX_DAMG - WEAP_SNIPER_RIFLE_MIN_DAMG) + WEAP_SNIPER_RIFLE_MIN_DAMG; // Powerup * damage range + minimum damage. +#endif + if (trace_ent) + { + if ((trace_ent.classname == "player")) + { + f = (trace_endpos - src); + g_x = trace_endpos_x; + g_y = trace_endpos_y; + g_z = 0; + h_x = trace_ent.origin_x; + h_y = trace_ent.origin_y; + h_z = 0; + x = vlen ((g - h)); + f = ((normalize (f) * x) + trace_endpos); + zdif = (f_z - trace_ent.origin_z); + deathmsg = 18; + trace_ent.head_shot_vector = '0 0 0'; + if (((zdif < 0) && (trace_ent.is_squating == 0))) + { + dam_mult = 0.5; + if ((trace_ent.team_no != self.team_no)) + { + trace_ent.leg_damage = (trace_ent.leg_damage + 1); + TeamFortress_SetSpeed (trace_ent); + deathmsg = 28; +#ifdef clan_progs + T_Damage (trace_ent, self, self, (damg * dam_mult)); +#else + T_Damage (trace_ent, self, self, (self.heat * dam_mult)); +#endif + } + if ((trace_ent.health > 0)) + { + if ((trace_ent.team_no == self.team_no)) + { + sprint (self, 1, "Stop shooting team mates!!!\n"); + } + else + { + sprint (trace_ent, 1, "Leg injury!\n"); + sprint (self, 1, "Leg shot - that'll slow him down!\n"); + } + } + return; + } + else + { + if (((zdif > 20) || (trace_ent.is_squating == 1))) + { + dam_mult = 3; + stuffcmd (trace_ent, "bf\n"); + deathmsg = 29; + if ((trace_ent.health > 0)) + { + if ((trace_ent.team_no == self.team_no)) + { + sprint (self, 1, "Stop shooting team mates!!!\n"); + } + else + { + trace_ent.head_shot_vector = (trace_ent.origin - self.origin); + deathmsg = 29; +#ifdef clan_progs + T_Damage (trace_ent, self, self, (damg * dam_mult)); +#else + T_Damage (trace_ent, self, self, (self.heat * dam_mult)); +#endif + sound (self, 0, "speech/excelent.wav", 1, 0); + } + return; + } + else + { + deathmsg = 18; + } + } + } + } + ClearMultiDamage (); + if ((trace_fraction != 1)) + { +#ifdef clan_progs + TraceAttack ((damg * dam_mult), dir); +#else + TraceAttack ((self.heat * dam_mult), dir); +#endif + } + ApplyMultiDamage (); + } + else + { + _l_2708 = trace_endpos - (v_forward * 4); + WriteByte (4, 23); + WriteByte (4, 0); + WriteCoord (4, _l_2708_x); + WriteCoord (4, _l_2708_y); + WriteCoord (4, _l_2708_z); + multicast (self.origin, 1); + } +}; + +void () W_FireAutoRifle = +{ + local vector dir; + + sound (self, 1, "weapons/rifle.wav", 1, 1); + KickPlayer (-1, self); + self.ammo_shells = (self.ammo_shells - 1); + self.currentammo = (self.ammo_shells); + makevectors (self.v_angle); + dir = v_forward; + deathmsg = 19; + FireSniperBullet (dir, 10); +}; + +void () W_FireAssaultCannon = +{ + local vector dir; + + KickPlayer (-4, self); + self.ammo_shells = (self.ammo_shells - 1); + self.currentammo = (self.ammo_shells); + dir = aim (self, 100000); + deathmsg = 20; + FireBullets (6, dir, '0.04 0.04 0'); + Stats_Fired (self.current_weapon); +}; + +void () T_MissileTouch = +{ + local float damg; + + if ((pointcontents (self.origin) == -6)) + { + dremove (self); + return; + } +/* if (((other.playerclass == 7) && (other.team_no != self.team_no))) + { + deflect = hwguy_deflect (other); + if (deflect) + { + return; + } + }*/ + damg = (92 + (random () * 20)); + deathmsg = self.weapon; + if (other.health) + { + TF_T_Damage (other, self, self.owner, damg, 0, 4); + } + T_RadiusDamage (self, self.owner, 92, other); + self.origin = (self.origin - (8 * normalize (self.velocity))); + WriteByte (4, 23); + WriteByte (4, 3); + WriteCoord (4, self.origin_x); + WriteCoord (4, self.origin_y); + WriteCoord (4, self.origin_z); + multicast (self.origin, 1); + BecomeExplosion (); + dremove (self); +}; + +void () RemoveAlarmMine = +{ + sprint (self.owner, 2, "Your batteries died in an alarm.. :(\n"); + dremove (self); + return; +}; + +void () RemoveAIDSMine = +{ + sprint (self.owner, 2, "Your syringe is sterile...\n"); + self.owner.has_syringe = TF_FLARE_OFF; + dremove (self); + return; +}; + +void () RemoveFlashMine = +{ + sprint (self.owner, 2, "Your Flash mine fizzled...\n"); + self.owner.has_syringe = TF_FLARE_OFF; + dremove (self); + return; +}; + +void () RemoveSpikeTrap = +{ + sprint (self.owner, 2, "Your Spike Trap is gone...\n"); + self.owner.has_syringe = TF_FLARE_OFF; + dremove (self); + return; +}; + +void () RemoveMagnetMine = +{ + sprint (self.owner, 2, "Your Mag Mine is gone...\n"); + self.owner.has_syringe = TF_FLARE_OFF; + dremove (self); + return; +}; + +void () AlarmMineTouch = +{ + + if ((self.pausetime > time)) + { + return; + } + if ((other.classname != "player")) + { + return; + } + if ((other.health <= 0)) + { + return; + } + if ((other.bugger > 0)) + { + return; + } + if ((other.team_no == self.owner.team_no)) + { + if ((((other.velocity_x < 5) && (other.velocity_y < 5)) && (other.is_squating == 1))) + { + self.think = RemoveAlarmMine; + self.nextthink = (time + 0.200000); + } + else + { + return; + } + } + else + { + other.effects = (other.effects | 4); + sound (self, 3, "misc/enemy.wav", 1, 1); + sprint (other, 2, "You have tripped an ALARM!\n"); + sprint (self.owner, 2, "Your ALARM was tripped!\n"); + sprint (self.owner, 2, " Your ALARM was tripped!\n"); + self.pausetime = (time + 5); + } + self.nextthink = (time + 10); + if ((other.effects & 4)) + { + other.effects = (other.effects - (other.effects & 8)); + } +}; + +void () AIDSMineTouch = +{ + local entity BioInfection; + + if ((self.pausetime > time)) + { + return; + } + if ((other.classname != "player")) + { + return; + } + if ((other.health <= TF_FLARE_LIT)) + { + return; + } + if ((other.team_no == self.owner.team_no)) + { + return; + } + if ((other.playerclass == 5)) + { + RemoveAIDSMine (); + sprint (other, 2, "You removed an enemy syringe! :)\n"); + sprint (self.owner, 2, " Syringe removed by enemy medic!\n"); + return; + } + if ((other.classname == "player")) + { + deathmsg = 14; + if ((other.playerclass == 5)) + { + return; + } + other.tfstate = (other.tfstate | 16); + BioInfection = spawn (); + BioInfection.classname = "timer"; + BioInfection.owner = other; + BioInfection.nextthink = (time + 2); + BioInfection.think = BioInfection_Decay; + BioInfection.enemy = self.owner; + other.infection_team_no = self.team_no; + } + sound (self, 3, "player/mpain6.wav", TF_FLARE_OFF, TF_FLARE_OFF); + sprint (other, 2, "You're infected by a syringe! :(\n"); + sprint (self.owner, 2, "Your syringe has Infected an enemy!\n"); + bprint (1, other.netname); + bprint (1, " was infected by "); + bprint (1, self.owner.netname); + bprint (1, "'s syringe\n"); + self.pausetime = (time + 5); + self.nextthink = (time + 10); + RemoveAIDSMine (); +}; + +void () FlashMineTouch = +{ + if ((self.pausetime > time)) + { + return; + } + if ((other.classname != "player")) + { + return; + } + if ((other.health <= TF_FLARE_LIT)) + { + return; + } + if ((other.team_no == self.owner.team_no)) + { + return; + } + if ((other.classname == "player")) + { + + FlashGrenadeExplode2 (); + sprint (self.owner, 2, "Your Flash mine was tripped!\n"); + //self.pausetime = (time + 5); + } + //self.nextthink = (time+ 1); + self.nextthink = time; + dremove (self); +}; + +void () SpikeTrapTouch = +{ + + if ((self.pausetime > time)) + { + return; + } + if ((other.classname != "player")) + { + return; + } + if ((other.health <= 0)) + { + return; + } + if ((other.invincible_finished >= time)) + { + if ((other.invincible_sound < time)) + { + sound (other, 3, "items/protect3.wav", 1, 1); + other.invincible_sound = (time + 2); + } + return; + } + if ((other.bugger > 0)) + { + return; + } + if ((other.team_no == self.owner.team_no)) + { + return; + } + if ((other.playerclass == 6)) + { + RemoveSpikeTrap (); + sprint (other, 2, "You removed an enemy trap!\n"); + sprint (self.owner, 2, "Spike Trap removed by enemy!\n"); + sound (self, 3, "weapons/tink2.wav", 1, 1); + return; + } + sound (self, 3, "shambler/smack.wav", 1, 1); + sprint (other, 2, "You stepped on a Spike Trap!\n"); + sprint (self.owner, 2, "Your Trap worked!\n"); + self.pausetime = (time + 5); + self.nextthink = (time + 5); + deathmsg = 200; + TF_T_Damage (other, self.owner, self.owner, 1, 2, 0); + if ((other.health <= 0)) + { + return; + } + other.leg_damage = (other.leg_damage + 1); + TeamFortress_SetSpeed (other); +}; + +void () MagnetMineTouch = +{ + if ((self.pausetime > time)) + { + return; + } + if ((other.classname != "player")) + { + return; + } + if ((other.health <= TF_FLARE_LIT)) + { + return; + } + if ((other.is_undercover == TF_FLARE_OFF)) + { + return; + } + if ((other.team_no == self.owner.team_no)) + { + return; + } + if ((other.classname == "player")) + { + MagMineActivate (); + sprint (other, 2, "You stepped on a Magnetic Mine! :(\n"); + sprint (self.owner, 2, "Your Magnet Mine worked!\n"); + self.pausetime = (time + 5); + } + self.nextthink = (time + 5); + dremove (self); +}; +void () Tranq_spike_touch; +void () spike_touch; +void () superspike_touch; + +void (vector org,vector dir) launch_spike = +{ + + newmis = spawn (); + newmis.owner = self; + newmis.movetype = 9; + newmis.solid = 2; + newmis.angles = vectoangles (dir); + newmis.touch = spike_touch; + newmis.weapon = 3; + newmis.classname = "spike"; + newmis.think = SUB_Remove; + newmis.nextthink = (time + 3); + if ((deathmsg != 9)) + { + setmodel (newmis, "progs/spike.mdl"); + } + setsize (newmis, '0 0 0', '0 0 0'); + setorigin (newmis, org); + newmis.velocity = (dir * 2000); +}; + +void (vector org,vector dir) Tranq_launch_spike = +{ + + newmis = spawn (); + newmis.owner = self; + newmis.movetype = 9; + newmis.solid = 2; + newmis.angles = vectoangles (dir); + newmis.touch = Tranq_spike_touch; + newmis.weapon = 3; + newmis.classname = "spike"; + newmis.think = SUB_Remove; + newmis.nextthink = (time + 3); + if ((deathmsg != 25)) + { + setmodel (newmis, "progs/spike.mdl"); + } + setsize (newmis, '0 0 0', '0 0 0'); + setorigin (newmis, org); + newmis.velocity = (dir * 2000); +}; + +void (float type) ThrowMine = +{ + local entity item; + + item = spawn (); + item.team_no = self.team_no; + item.owner = self; + item.classname = "drop1"; + item.origin = (self.origin - '0 0 10'); + if ((type == 1)) + { + item.angles_x = 270; + } + if ((type == 2)) + { + item.angles_x = 0; + item.health = 5; + item.th_die = RemoveAIDSMine; + } + if ((type == 4)) + { + item.angles_x = 90; + item.health = 5; + item.th_die = RemoveSpikeTrap; + } + item.angles_y = 45; + item.flags = 256; + item.solid = 2; + item.movetype = 6; + item.velocity = '0 0 1'; + setsize (item, '-1 -1 0', '1 1 6'); + if ((type == 4)) + { + setmodel (item, "progs/spikebal.mdl"); + } + else + { + if ((type == 5)) + { + setmodel (item, "progs/tgib1.mdl"); + item.skin = 1; + } + else + { + setmodel (item, "progs/syringe.mdl"); + } + } + if ((type == 1)) + { + item.touch = AlarmMineTouch; + } + if ((type == 2)) + { + item.touch = AIDSMineTouch; + } + if ((type == 3)) + { + item.health = 1; + item.th_die = RemoveFlashMine; + item.touch = FlashMineTouch; + setmodel (item, "progs/s_bubble.spr"); + } + if ((type == 4)) + { + item.touch = SpikeTrapTouch; + } + if ((type == 5)) + { + item.touch = MagnetMineTouch; + setmodel (item, "progs/tgib1.mdl"); + } + item.nextthink = (time + 180); + if ((type == 1)) + { + item.think = RemoveAlarmMine; + } + if ((type == 2)) + { + item.think = RemoveAIDSMine; + } + if ((type == 3)) + { + item.think = RemoveFlashMine; + } + if ((type == 4)) + { + item.think = RemoveSpikeTrap; + } + if ((type == 5)) + { + item.think = RemoveMagnetMine; + } +}; + +void () A_Mine = +{ + if (((self.ammo_cells < 50) && (self.playerclass == 2))) + { + sprint (self, 2, "Not enough cells...\n"); + return; + } +// if (((self.ammo_cells < 200) && (self.playerclass == 9))) +// { +// sprint (self, 2, "Not enough cells...\n"); +// return; +// } + self.ammo_cells = TF_FLARE_LIT; + ThrowMine (1); + sprint (self, 2, "You set an alarm!\n"); + sound (self, 2, "effects/beep.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void () B_Mine = +{ + local entity te; + + if ((self.has_syringe != 1)) + { + sprint (self, 2, "1 syringe at a time!\n"); + return; + } + te = find (world, classname, "drop1"); + while (te) + { + if ((te.owner == self)) + { + sprint (self, 2, "1 syringe at a time!\n"); + return; + } + te = find (te, classname, "drop1"); + } + + ThrowMine (2); + sprint (self, 2, "You dropped a syringe!\n"); + sound (self, 2, "weapons/tink1.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void () C_Mine = +{ + local entity te; + + if ((self.has_syringe != 1)) + { + sprint (self, 2, "1 flash mine at a time!\n"); + return; + } + if ((self.last_used >= time)) + { + sprint (self, 2, "not ready yet...\n"); + return; + } + te = find (world, classname, "drop1"); + while (te) + { + if ((te.owner == self)) + { + sprint (self, 2, "1 flash mine at a time!\n"); + return; + } + te = find (te, classname, "drop1"); + } + + ThrowMine (3); + sprint (self, 2, "You set a Flash mine!\n"); + sound (self, 2, "weapons/bounce.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void () S_Mine = +{ + local entity te; + local float spikecount; + + te = find (world, classname, "drop1"); + while (te) + { + if ((te.owner == self)) + { + spikecount = (spikecount + TF_FLARE_OFF); + } + te = find (te, classname, "drop1"); + } + if ((spikecount >= 2)) + { + sprint (self, 2, "2 spike traps at a time!\n"); + return; + } + ThrowMine (4); + sprint (self, 2, "You set a Spike Trap!\n"); + sound (self, 2, "doors/meduse.wav", TF_FLARE_OFF, TF_FLARE_OFF); +}; + +void () M_Mine = +{ + local entity te; + + if ((self.has_syringe != 1)) + { + sprint (self, 2, "You get 1 Mag Mine at a time!\n"); + return; + } + te = find (world, classname, "drop1"); + while (te) + { + if ((te.owner == self)) + { + sprint (self, 2, "You get 1 Mag Mine at a time!\n"); + return; + } + te = find (te, classname, "drop1"); + } + ThrowMine (5); + sprint (self, 2, "You set a Mag Mine!\n"); + sound (self, 2, "weapons/bounce.wav", 1, 1); +}; + +void () MakeHolo = +{ + local string he; + he = infokey(self, "tf_help"); + + if ((self.playerclass == TF_FLARE_LIT)) + { + return; + } + if ((self.has_holo != 1)) + { + if (he != "off") + { + sprint (self, 2, "holograph already running!\n"); + return; + } + else + { + return; + } + } + self.has_holo = 0; + HoloDood (); + if (he != "off") + { + sprint (self, 2, "Holographic replica active!\n"); + } +}; + +void () W_FireRocket = +{ + self.ammo_rockets = (self.ammo_rockets - 1); + self.currentammo = (self.ammo_rockets); + sound (self, 1, "weapons/sgun1.wav", 1, 1); + KickPlayer (-2, self); + newmis = spawn (); + newmis.owner = self; + newmis.team_no = self.team_no; + newmis.movetype = 9; + newmis.solid = 2; + makevectors (self.v_angle); + newmis.velocity = v_forward; + newmis.velocity = (newmis.velocity * 1350); // pablo. rocket speed. mtf 1350. reg 900. + newmis.angles = vectoangles (newmis.velocity); + newmis.touch = T_MissileTouch; + newmis.nextthink = (time + 5); + newmis.think = SUB_Remove; + newmis.weapon = 6; + setmodel (newmis, "progs/missile.mdl"); + setsize (newmis, '0 0 0', '0 0 0'); + setorigin (newmis, ((self.origin + (v_forward * 8)) + '0 0 16')); //setorigin (newmis, ((self.origin + (v_forward * 8)) + '0 0 16')); +}; + +void () BalloonMIRVtouch = +{ + if ((pointcontents (self.origin) == -6)) + { + self.velocity_z = TF_FLARE_LIT; + } + if ((pointcontents (self.origin) == -2)) + { + self.velocity = '0 0 0'; + } +}; + +void (vector org,entity shooter) BalloonMirvGrenadeLaunch = +{ + local float xdir; + local float ydir; + local float zdir; + + xdir = ((150 * random ()) - 75); + ydir = ((150 * random ()) - 75); + zdir = (40 * random ()); + newmis = spawn (); + newmis.owner = shooter; + newmis.movetype = 10; + newmis.solid = 2; + newmis.classname = "grenade"; + newmis.weapon = 40; + newmis.touch = GrenadeTouch; + newmis.think = GrenadeExplode; + newmis.nextthink = ((time + 2) + (random () * 2)); + newmis.velocity_x = (xdir * 2); + newmis.velocity_y = (ydir * 2); + newmis.velocity_z = (zdir * 10); + newmis.avelocity = '0 0 0'; + setmodel (newmis, "progs/hgren2.mdl"); + setsize (newmis, '0 0 0', '0 0 0'); + setorigin (newmis, org); +}; + +void () BalloonMIRVpop = +{ + local float i; + + sound (self, 3, "shambler/sboom.wav", TF_FLARE_OFF, TF_FLARE_OFF); + deathmsg = 40; + i = TF_FLARE_LIT; + while ((i < 6)) + { + BalloonMirvGrenadeLaunch ((self.origin + '0 0 -1'), self.owner); + i = (i + TF_FLARE_OFF); + } + self.owner.active_airmirvs = (self.owner.active_airmirvs - 1); + BecomeExplosion (); +}; + +void () BalloonMIRVnoise = +{ + self.playerclass = (self.playerclass + TF_FLARE_OFF); + self.nextthink = (time + 0.3); + if (((self.velocity_x < 3) && (self.velocity_y < 3))) + { + sound (self, 0, "player/axhit2.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + else + { + sound (self, 0, "weapons/throw.wav", TF_FLARE_OFF, TF_FLARE_OFF); + } + if ((self.playerclass >= 20)) + { + self.think = BalloonMIRVpop; + } +}; + +void () BalloonMIRV = +{ + if ((self.no_grenades_2 < TF_FLARE_OFF)) + { + sprint (self, 2, "You need type 2 grens for an AirMIRV\n"); + return; + } + if ((self.last_saveme_sound > time)) + { + return; + } + if ((self.active_airmirvs >= sr_airmirv)) + { + sprint (self, 2, "Maximum number of airmirvs already active.\n"); + return; + } + else + { + self.last_saveme_sound = (time + 2); + self.no_grenades_2 = (self.no_grenades_2 - TF_FLARE_OFF); + self.active_airmirvs = (self.active_airmirvs + 1); + sprint (self, 2, "AirMIRV released!\n"); + sound (self, 3, "weapons/chngnu1a.wav", TF_FLARE_OFF, TF_FLARE_OFF); + newmis = spawn (); + newmis.health = 180; + newmis.takedamage = 2; + newmis.th_die = BalloonMIRVpop; + newmis.owner = self; + newmis.weapon = 40; + newmis.movetype = 5; + newmis.solid = 2;//TF_FLARE_OFF; + newmis.classname = "bot";//"grenade"; + // pablo. netname so i can fudge gun's aim. + newmis.netname = "airmirv"; + // + newmis.playerclass = TF_FLARE_LIT; + newmis.team_no = self.team_no; // can't shotgun your own airmirvs anyway. + makevectors (self.v_angle); + if (self.v_angle_x) + { + newmis.velocity = ((v_forward * 100) + (v_up * 200)); + } + else + { + newmis.velocity = aim (self, 10000); + newmis.velocity = (newmis.velocity * 100); + newmis.velocity_z = 200; + } + newmis.avelocity = '0 0 0'; + setsize (newmis, '-8 -8 -8', '8 8 8'); + setorigin (newmis, self.origin); + newmis.nextthink = (time + TF_FLARE_OFF); + newmis.think = BalloonMIRVnoise; + newmis.touch = BalloonMIRVtouch; + setmodel (newmis, "progs/air-mirv.mdl"); + deathmsg = 40; + } +}; + +void (entity from,float damage) LightningHit = +{ + WriteByte (4, 23); + WriteByte (4, 13); + WriteCoord (4, trace_endpos_x); + WriteCoord (4, trace_endpos_y); + WriteCoord (4, trace_endpos_z); + multicast (trace_endpos, 2); + TF_T_Damage (trace_ent, from, from, damage, 2, 8); +}; + +void (vector p1,vector p2,entity from,float damage) LightningDamage = +{ + local entity e1; + local entity e2; + local vector f; + + f = (p2 - p1); + normalize (f); + f_x = (0 - f_y); + f_y = f_x; + f_z = 0; + f = (f * 16); + e2 = world; + e1 = world; + traceline (p1, p2, 0, self); + if (trace_ent.takedamage) + { + LightningHit (from, damage); + if ((self.classname == "player")) + { + if ((other.classname == "player")) + { + trace_ent.velocity_z = (trace_ent.velocity_z + 400); + } + } + } + e1 = trace_ent; + traceline ((p1 + f), (p2 + f), 0, self); + if (((trace_ent != e1) && trace_ent.takedamage)) + { + LightningHit (from, damage); + } + e2 = trace_ent; + traceline ((p1 - f), (p2 - f), 0, self); + if ((((trace_ent != e1) && (trace_ent != e2)) && trace_ent.takedamage)) + { + LightningHit (from, damage); + } +}; + +void () W_FireLightning = +{ + local vector org; + local float cells; + + if ((self.ammo_cells < 1)) + { + self.current_weapon = W_BestWeapon (); + W_SetCurrentAmmo (); + W_PrintWeaponMessage (); + return; + } + if ((self.waterlevel > 1)) + { + cells = self.ammo_cells; + self.ammo_cells = 0; + W_SetCurrentAmmo (); + deathmsg = 7; + T_RadiusDamage (self, self, (35 * cells), world); + return; + } + if ((self.t_width < time)) + { + sound (self, 1, "weapons/lhit.wav", 1, 1); + self.t_width = (time + 0.6); + } + KickPlayer (-2, self); + self.ammo_cells = (self.ammo_cells - 1); + self.currentammo = (self.ammo_cells); + org = (self.origin + '0 0 16'); + traceline (org, (org + (v_forward * 600)), 1, self); + WriteByte (4, 23); + WriteByte (4, 6); + WriteEntity (4, self); + WriteCoord (4, org_x); + WriteCoord (4, org_y); + WriteCoord (4, org_z); + WriteCoord (4, trace_endpos_x); + WriteCoord (4, trace_endpos_y); + WriteCoord (4, trace_endpos_z); + multicast (org, 1); + LightningDamage (self.origin, (trace_endpos + (v_forward * 4)), self, 30); +}; + +void () W_FireSpikes = +{ + local vector dir; + + makevectors (self.v_angle); + Stats_Fired (self.current_weapon); + //if (((self.ammo_nails >= 2) && (self.current_weapon == 1024))) + if (((self.ammo_nails >= 1) && (self.current_weapon == 1024))) + { + sound (self, 1, "effects/mortar.wav", 1, 1); + deathmsg = 4; + Attack_Finished (0.3); + self.ammo_nails = (self.ammo_nails - 2); + self.currentammo = (self.ammo_nails - 1); + dir = aim (self, 1000); + FireSniperBullet (dir, 10); + KickPlayer (-4, self); + return; + } + if ((self.ammo_nails < 1)) + { + self.current_weapon = W_BestWeapon (); + W_SetCurrentAmmo (); + W_PrintWeaponMessage (); + return; + } + sound (self, 3, "weapons/sniper.wav", 1, 1); + Attack_Finished (0.1); + self.ammo_nails = (self.ammo_nails - 1); + self.currentammo = (self.ammo_nails - 1); + dir = aim (self, 1000); + deathmsg = 3; + FireSniperBullet (dir, 4); +}; +//.float hit_z; + +void () spike_touch = +{ + + if ((other.solid == 1)) + { + return; + } + if ((pointcontents (self.origin) == -6)) + { + dremove (self); + return; + } + if (other.takedamage) + { + spawn_touchblood (9); + deathmsg = self.weapon; + if ((self.owner.classname == "grenade")) + { + TF_T_Damage (other, self, self.owner.owner, 9, 2, 2); + } + else + { + TF_T_Damage (other, self, self.owner, 9, 2, 2); + } + } + else + { + WriteByte (4, 23); + if ((self.classname == "wizspike")) + { + WriteByte (4, 7); + } + else + { + if ((self.classname == "knightspike")) + { + WriteByte (4, 8); + } + else + { + WriteByte (4, 0); + } + } + WriteCoord (4, self.origin_x); + WriteCoord (4, self.origin_y); + WriteCoord (4, self.origin_z); + multicast (self.origin, 1); + } + dremove (self); +}; + +void () Tranq_spike_touch = +{ + if ((other.solid == 1)) + { + return; + } + if ((pointcontents (self.origin) == -6)) + { + dremove (self); + return; + } + if (other.takedamage) + { + spawn_touchblood (9); + deathmsg = 25; + if ((self.owner.classname == "Tgrenade")) + { + TF_T_Damage (other, self, self.owner.owner, 9, 2, 2); + } + else + { + TF_T_Damage (other, self, self.owner, 9, 2, 2); + } + } + else + { + WriteByte (4, 23); + if ((self.classname == "wizspike")) + { + WriteByte (4, 7); + } + else + { + if ((self.classname == "knightspike")) + { + WriteByte (4, 8); + } + else + { + WriteByte (4, 0); + } + } + WriteCoord (4, self.origin_x); + WriteCoord (4, self.origin_y); + WriteCoord (4, self.origin_z); + multicast (self.origin, 1); + } + dremove (self); +}; + +void () superspike_touch = +{ + local float ndmg; + + if ((other == self.owner)) + { + return; + } + if ((other.solid == 1)) + { + return; + } + if ((pointcontents (self.origin) == -6)) + { + dremove (self); + return; + } + if (other.takedamage) + { + spawn_touchblood (18); + deathmsg = self.weapon; + if ((deathmsg == 9)) + { + ndmg = 40; + } + else + { + ndmg = 13; + } + if ((self.owner.classname == "grenade")) + { + TF_T_Damage (other, self, self.owner.owner, ndmg, 2, 2); + } + else + { + TF_T_Damage (other, self, self.owner, ndmg, 2, 2); + } + } + else + { + WriteByte (4, 23); + WriteByte (4, 1); + WriteCoord (4, self.origin_x); + WriteCoord (4, self.origin_y); + WriteCoord (4, self.origin_z); + multicast (self.origin, 1); + } + dremove (self); +}; + +// xavior's fix for reload after proxy is selected +void (entity reloaded_player, float type_rl) W_ReloadSetCurrentAmmo = +{ + if (type_rl == 0) + { + reloaded_player.items = (reloaded_player.items - (reloaded_player.items & (((256 | 512) | 1024) | 2048))); + reloaded_player.currentammo = 0; + } + else if (type_rl == 1) + { + reloaded_player.currentammo = reloaded_player.ammo_shells; + reloaded_player.items = (reloaded_player.items | 2048); + } + else + { + reloaded_player.currentammo = reloaded_player.ammo_rockets; + reloaded_player.items = (reloaded_player.items | 1024); + } +} + +void () W_SetCurrentAmmo = +{ + + if (((self.health <= 0) || (self.current_weapon == 0))) + { + return; + } + if ((self.weaponmodel == "progs/proxgren.mdl")) + { + self.currentammo = self.currentammo; + return; + } +// player_run (); + self.items = (self.items - (self.items & (((256 | 512) | 1024) | 2048))); + self.weapon = 0; // pablo. fix to assualt cannon jamming when on backpacks. + if ((self.tools == (self.tools | 32))) + { + return; + } + if ((self.current_weapon == 16)) + { + self.currentammo = 0; + if ((self.weaponmode == 0)) + { + self.weaponmodel = "progs/v_knife.mdl";//v_axe.mdl"; + } + else + { + self.weaponmodel = "progs/v_knife2.mdl";//self.weaponmodel = "progs/v_axe.mdl"; + } + self.weaponframe = 0; + } + else + { + if ((self.current_weapon == 1)) + { + if ((self.owner.ammo_cells > 0)) + { + self.ammo_cells = self.owner.ammo_cells; + } + self.currentammo = self.ammo_cells; + self.weaponmodel = "progs/v_grap.mdl"; + self.weaponframe = 0; + } + else + { + if ((self.current_weapon == 8)) + { + self.currentammo = self.ammo_cells; + self.weaponmodel = "progs/v_span.mdl"; + self.weaponframe = 0; + } + else + { + if ((self.current_weapon == 128)) + { + self.currentammo = self.ammo_shells; + self.items = (self.items | 2048); + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_shot.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 256); + self.weapon = 1; + } + else + { + if ((self.current_weapon == 256)) + { + self.currentammo = self.ammo_shells; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_shot2.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 256); + self.weapon = 2; + } + else + { + if ((self.current_weapon == 512)) + { + self.currentammo = self.ammo_nails; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_mac10.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 512); + self.weapon = 4; + } + else + { + if ((self.current_weapon == 1024)) + { + self.currentammo = self.ammo_nails; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_nail2.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 512); + self.weapon = 8; + } + else + { + if ((self.current_weapon == 2048)) + { + self.currentammo = self.ammo_rockets; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_rock.mdl"; + self.weaponframe = 0; + } + self.weapon = 16; + self.items = (self.items | 1024); + } + else + { + if ((self.current_weapon == 8192)) + { + self.currentammo = self.ammo_rockets; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_rock2.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 1024); + self.weapon = 32; + } + else + { + if ((self.current_weapon == 65536)) + { + self.currentammo = self.ammo_cells; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_light.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 2048); + self.weapon = 64; + } + else + { + if ((self.current_weapon == 32)) + { + self.currentammo = self.ammo_shells; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_srifle.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 256); + self.weapon = 1; + } + else + { + if ((self.current_weapon == 64)) + { + self.currentammo = self.ammo_shells; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_srifle.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 256); + self.weapon = 2; + } + else + { + if ((self.current_weapon == 32768)) + { + self.currentammo = self.ammo_shells; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_asscan.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 256); + self.weapon = 32; + } + else + { + if ((self.current_weapon == 4096)) + { + self.currentammo = self.ammo_cells; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_rock.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 2048); + self.weapon = 16; + } + else + { + if ((self.current_weapon == 16384)) + { + self.currentammo = self.ammo_rockets; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_rock2.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 1024); + self.weapon = 32; + } + else + { + if ((self.current_weapon == 4)) + { + self.currentammo = 0; + self.weaponmodel = "progs/v_medi.mdl"; + self.weaponframe = 0; + } + else + { + if ((self.current_weapon == 2)) + { + self.currentammo = 0; + self.weaponmodel = "progs/v_bio.mdl"; + self.weaponframe = 0; + } + else + { + if ((self.current_weapon == 262144)) + { + self.currentammo = self.ammo_shells; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_shot.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 256); + self.weapon = 1; + } + else + { + if ((self.current_weapon == 524288)) + { + self.currentammo = self.ammo_nails; + if (!(self.tfstate & 2)) + { + self.weaponmodel = "progs/v_rail.mdl"; + self.weaponframe = 0; + } + self.items = (self.items | 512); + self.weapon = 1; + } + else + { + self.currentammo = 0; + self.weaponmodel = ""; + self.weaponframe = 0; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +}; + +float () W_BestWeapon = +{ + local float it; + + it = self.weapons_carried; + if ((((self.ammo_cells >= 1) && (it & 65536)) && (self.waterlevel <= 1))) + { + return (65536); + } + else + { + if ((((self.ammo_cells >= 6) && (self.ammo_shells >= 1)) && (it & 32768))) + { + return (32768); + } + else + { + if (((self.ammo_cells >= 1) && (it & 4096))) + { + return (4096); + } + else + { + if (((self.ammo_nails >= 2) && (it & 1024))) + { + return (1024); + } + else + { + if (((self.ammo_shells >= 2) && (it & 256))) + { + return (256); + } + else + { + if (((self.ammo_nails >= 1) && (it & 524288))) + { + return (524288); + } + else + { + if (((self.ammo_nails >= 1) && (it & 512))) + { + return (512); + } + else + { + if (((self.ammo_shells >= 1) && (it & 128))) + { + return (128); + } + else + { + if (((self.ammo_shells >= 1) && (it & 262144))) + { + return (262144); + } + else + { + if ((it & 4)) + { + return (4); + } + else + { + if ((it & 8)) + { + return (8); + } + else + { + if ((it & 16)) + { + return (16); + } + } + } + } + } + } + } + } + } + } + } + } + return (0); +}; + +float () W_CheckNoAmmo = +{ + if ((self.current_weapon == 4)) + { + return (1); + } + else + { + if ((self.current_weapon == 2)) + { + return (1); + } + else + { + if ((((self.current_weapon == 16) || (self.current_weapon == 1)) || (self.current_weapon == 8))) + { + return (1); + } + else + { + if (((self.current_weapon == 1) && (self.ammo_cells < 10))) + { + return (1); + } + else + { + if ((self.current_weapon == 16384)) + { + if ((self.currentammo >= 3)) + { + return (1); + } + } + else + { + if ((self.currentammo > 0)) + { + return (1); + } + } + } + } + } + } + self.current_weapon = W_BestWeapon (); + W_SetCurrentAmmo (); + W_PrintWeaponMessage (); + return (0); +}; + +void () W_Reload_shotgun = +{ + self.owner.tfstate = (self.owner.tfstate - (self.owner.tfstate & 2)); + self.owner.weaponmodel = "progs/v_shot.mdl"; + sound (self.owner, 1, "weapons/pkup.wav", 1, 1); + sprint (self.owner, 0, "finished reloading\n"); + W_ReloadSetCurrentAmmo (self.owner, 1); + dremove (self); + self.owner.StatusRefreshTime = (time + 0.1); +}; + +void () W_Reload_super_shotgun = +{ + self.owner.tfstate = (self.owner.tfstate - (self.owner.tfstate & 2)); + self.owner.weaponmodel = "progs/v_shot2.mdl"; + sound (self.owner, 1, "weapons/pkup.wav", 1, 1); + sprint (self.owner, 0, "finished reloading\n"); + W_ReloadSetCurrentAmmo (self.owner, 1); + dremove (self); + self.owner.StatusRefreshTime = (time + 0.1); +}; + +void () W_Reload_grenade_launcher = +{ + self.owner.tfstate = (self.owner.tfstate - (self.owner.tfstate & 2)); + self.owner.weaponmodel = "progs/v_rock.mdl"; + sound (self.owner, 1, "weapons/rocklr1a.wav", 1, 1); + sprint (self.owner, 0, "finished reloading\n"); + dremove (self); + self.owner.StatusRefreshTime = (time + 0.1); +}; + +void () W_Reload_rocket_launcher = +{ + self.owner.tfstate = (self.owner.tfstate - (self.owner.tfstate & 2)); +// This is my fix for the "proxy reload" bug. Still dunno if I'm gonna keep it in tho. +// - XavioR +// if (self.owner.weaponmodel != "progs/proxgren.mdl") +// { + self.owner.weaponmodel = "progs/v_rock2.mdl"; + sound (self.owner, 1, "weapons/rocklr1a.wav", 1, 1); +// } +// else +// { +// self.owner.oldweaponmodel = "progs/v_rock2.mdl"; +// } + sprint (self.owner, 0, "finished reloading\n"); + W_ReloadSetCurrentAmmo (self.owner, 2); // fixes ammo count after reload while holding + dremove (self); // a proxy. - XavioR + self.owner.StatusRefreshTime = (time + 0.1); +}; + +float () CheckForReload = +{ + local entity tWeapon; + +// if ((((self.attack_finished > time) || self.button0) || (self.tools == (self.tools | 32)))) +// { +// return; +// } + if ((self.current_weapon == 128)) + { + if (((self.reload_shotgun >= 8) && (self.ammo_shells > 0))) + { + self.reload_shotgun = 0; + if ((self.ammo_shells < 8)) + { + self.reload_shotgun = (8 - self.ammo_shells); + } + sprint (self, 2, "reloading...\n"); + self.tfstate = (self.tfstate | 2); + tWeapon = spawn (); + tWeapon.owner = self; + tWeapon.classname = "timer"; + tWeapon.nextthink = (time + 2); + tWeapon.think = W_Reload_shotgun; + self.weaponmodel = ""; + self.weaponframe = 0; + return (1); + } + } + else + { + if ((self.current_weapon == 256)) + { + if ((self.reload_super_shotgun > 16)) + { + self.reload_super_shotgun = 16; + } + if (((self.reload_super_shotgun >= 16) && (self.ammo_shells > 0))) + { + self.reload_super_shotgun = 0; + if ((self.ammo_shells < 16)) + { + self.reload_super_shotgun = (16 - self.ammo_shells); + } + sprint (self, 2, "reloading...\n"); + self.tfstate = (self.tfstate | 2); + tWeapon = spawn (); + tWeapon.owner = self; + tWeapon.classname = "timer"; + tWeapon.nextthink = (time + 3); + tWeapon.think = W_Reload_super_shotgun; + self.weaponmodel = ""; + self.weaponframe = 0; + return (1); + } + } + else + { + if ((self.current_weapon == 2048)) + { + if (((self.reload_grenade_launcher >= 6) && (self.ammo_rockets > 0))) + { + self.reload_grenade_launcher = 0; + if ((self.ammo_rockets < 6)) + { + self.reload_grenade_launcher = (6 - self.ammo_rockets); + } + sprint (self, 2, "reloading...\n"); + self.tfstate = (self.tfstate | 2); + tWeapon = spawn (); + tWeapon.owner = self; + tWeapon.classname = "timer"; + tWeapon.nextthink = (time + 4); + tWeapon.think = W_Reload_grenade_launcher; + self.weaponmodel = ""; + self.weaponframe = 0; + return (1); + } + } + else + { + if ((self.current_weapon == 8192)) + { + if (((self.reload_rocket_launcher >= 4) && (self.ammo_rockets > 0))) + { + self.reload_rocket_launcher = 0; + if ((self.ammo_rockets < 4)) + { + self.reload_rocket_launcher = (4 - self.ammo_rockets); + } + sprint (self, 2, "reloading...\n"); + self.tfstate = (self.tfstate | 2); + tWeapon = spawn (); + tWeapon.owner = self; + tWeapon.classname = "timer"; + tWeapon.nextthink = (time + 5); + tWeapon.think = W_Reload_rocket_launcher; + self.weaponmodel = ""; + self.weaponframe = 0; + return (1); + } + } + } + } + } + return (0); +}; +void () player_axe1; +void () player_axeb1; +void () player_axec1; +void () player_axed1; +void () player_shot1; +void () player_nail1; +void () player_light1; +void () player_rocket1; +//void () player_tax1; +void () player_autorifle1; +void () player_assaultcannon1; +void () player_assaultcannonup1; +void () player_assaultcannondown1; +void () player_medikit1; +void () player_medikitb1; +void () player_medikitc1; +void () player_medikitd1; +void () player_bioweapon1; +void () player_bioweaponb1; +void () player_bioweaponc1; +void () player_bioweapond1; +void () player_chain1; +void () player_chain2; +void () player_chain3; +void () player_chain4; +void () player_chain5; +//void () W_ThrowAxe; +//void () W_FireTorpedo; + +void () W_Attack = +{ + local float r; + + if (((self.playerclass == 0) || (self.team_no <= 0))) + { + return; + } +// pablo. no torpedos in mtf. gg +// if ((self.tools == (self.tools | 32))) +// { +// if ((self.tube_wing > 1)) +// { +// return; +// } +// else +// { +// self.attack_finished = (time + 0.5); +// W_FireTorpedo (); +// return; +// } +// } + if ((self.weaponmodel == "progs/proxgren.mdl")) + { + Prox (); + Attack_Finished (0.2);//nanenanu + self.impulse = 0; + return; + } + if (!W_CheckNoAmmo ()) + { + sound (self, 1, "buttons/switch02.wav", 0.8, 1); + Attack_Finished (0.05); + return; + } + if ((self.tfstate & 2)) + { + sound (self, 1, "weapons/no_ammo.wav", 0.8, 1); + Attack_Finished (0.2); + return; + } + if ((time < self.attack_finished)) + { + return; + } + if (self.is_undercover) + { + Spy_RemoveDisguise (self); + } + if ((self.is_squating == 1)) + { + setsize (self, '-16 -16 -24', '16 16 32'); + } + Stats_Fired (self.current_weapon); + makevectors (self.v_angle); + self.show_hostile = (time + 1); +// pablo. +// if (((self.num_axes == 0) && (self.current_weapon == 16))) + if (self.current_weapon == 16) +// + { + Attack_Finished (0.5); + sound (self, 1, "weapons/ax1.wav", 1, 1); + r = random (); + if ((r < 0.25)) + { + player_axe1 (); + } + else + { + if ((r < 0.5)) + { + player_axeb1 (); + } + else + { + if ((r < 0.75)) + { + player_axec1 (); + } + else + { + player_axed1 (); + } + } + } + } + else + { +// pablo. no throwing axes in mtf. +// if (((self.num_axes >= 1) && (self.current_weapon == 16))) +// { +// player_tax1 (); +// self.attack_finished = (time + 1); +// } +// else +// { + if ((self.current_weapon == 8)) + { + Attack_Finished (0.5); + sound (self, 1, "weapons/ax1.wav", 1, 1); + player_axe1 (); + } + else + { + if ((self.current_weapon == 1)) + { + if (((!self.hook_out && (self.ammo_cells > 24)) && (self.is_feigning == 0))) + { + self.immune_to_check = (time + 4); + player_chain1 (); + sound (self, 1, "weapons/sniper.wav", 1, 1); + sound (self, 3, "weapons/unreel.wav", 1, 1); + Attack_Finished (0.1); + } + else + { + sprint (self, 2, "Not enough power cells...\n"); + Attack_Finished (1); + } + } + else + { + if ((self.current_weapon == 128)) + { + if ((CheckForReload () == 1)) + { + return; + } + player_shot1 (); + W_FireShotgun (); + self.reload_shotgun = (self.reload_shotgun + 1); + self.StatusRefreshTime = (time + 0.1); + CheckForReload (); + Attack_Finished (0.5); + } + else + { + if ((self.current_weapon == 256)) + { + if ((CheckForReload () == 1)) + { + return; + } + player_shot1 (); + W_FireSuperShotgun (); + self.reload_super_shotgun = (self.reload_super_shotgun + 2); + self.StatusRefreshTime = (time + 0.1); + CheckForReload (); + Attack_Finished (0.7); + } + else + { + if ((self.current_weapon == 512)) + { + player_nail1 (); + } + else + { + if ((self.current_weapon == 1024)) + { + player_nail1 (); + } + else + { + if ((self.current_weapon == 2048)) + { + if ((CheckForReload () == 1)) + { + return; + } + player_rocket1 (); + W_FireGrenade (); + self.reload_grenade_launcher = (self.reload_grenade_launcher + 1); + if ((self.option == 1)) + { + self.reload_grenade_launcher = (self.reload_grenade_launcher + 1); + } + self.StatusRefreshTime = (time + 0.1); + CheckForReload (); + Attack_Finished (0.6); + } + else + { + if ((self.current_weapon == 8192)) + { + if ((CheckForReload () == 1)) + { + return; + } + player_rocket1 (); + W_FireRocket (); + self.reload_rocket_launcher = (self.reload_rocket_launcher + 1); + self.StatusRefreshTime = (time + 0.1); + CheckForReload (); + Attack_Finished (0.8); + } + else + { + if ((self.current_weapon == 65536)) + { + player_light1 (); + Attack_Finished (0.1); + sound (self, 0, "weapons/lstart.wav", 1, 1); + } + } + } + } + } + } + } + } +// } + } + if ((self.current_weapon == 32)) + { + if (((self.flags & 512) || self.hook_out)) + { + player_shot1 (); + W_FireSniperRifle (); + Attack_Finished (1.5); + } + } + else + { + if ((self.current_weapon == 64)) + { + player_autorifle1 (); + W_FireAutoRifle (); + Attack_Finished (0.1); + } + else + { + if ((self.current_weapon == 32768)) + { + if (((self.playerclass == 6) && (self.option4 == 1))) + { + W_FireBigAss (); + Attack_Finished (0.2); + self.impulse = 0; + return; + } + if ((self.ammo_cells < 4)) + { + sprint (self, 1, "Insufficient cells to power up the Assault Cannon.\n"); + } + else + { + self.ammo_cells = (self.ammo_cells - 4); + self.heat = 1; + self.immune_to_check = (time + 2); + self.maxspeed = 80; + self.tfstate = self.tfstate | 131072; + TeamFortress_SetSpeed(self); + player_assaultcannonup1 (); + } + } + else + { + if ((self.current_weapon == 4096)) + { + player_shot1 (); + W_FireFlame (); + if ((self.waterlevel > 2)) + { + Attack_Finished (1); + } + else + { + Attack_Finished (0.15); + } + } + else + { + if ((self.current_weapon == 16384)) + { + player_rocket1 (); + W_FireIncendiaryCannon (); + Attack_Finished (1.2); + } + else + { + if ((self.current_weapon == 4)) + { + sound (self, 1, "weapons/ax1.wav", 1, 1); + r = random (); + if ((r < 0.25)) + { + player_medikit1 (); + } + else + { + if ((r < 0.5)) + { + player_medikitb1 (); + } + else + { + if ((r < 0.75)) + { + player_medikitc1 (); + } + else + { + player_medikitd1 (); + } + } + } + Attack_Finished (0.5); + } + else + { + if ((self.current_weapon == 2)) + { + sound (self, 1, "weapons/ax1.wav", 1, 1); + r = random (); + if ((r < 0.25)) + { + player_bioweapon1 (); + } + else + { + if ((r < 0.5)) + { + player_bioweaponb1 (); + } + else + { + if ((r < 0.75)) + { + player_bioweaponc1 (); + } + else + { + player_bioweapond1 (); + } + } + } + Attack_Finished (0.5); + } + else + { + if ((self.current_weapon == 262144)) + { + sound (self, 1, "weapons/dartgun.wav", 1, 1); + player_shot1 (); + W_FireTranq (); + Attack_Finished (1.5); + } + else + { + if ((self.current_weapon == 524288)) + { + if ((self.option5 != 1)) + { + sound (self, 1, "enforcer/enfire.wav", 1, 1); + player_shot1 (); + W_FireLaser (); + Attack_Finished (0.4); + }/* MegaTF United Super Rail code -- not in MegaTF! + else + { + sound (self, TF_FLARE_OFF, "weapons/railgun.wav", TF_FLARE_OFF, TF_FLARE_OFF); + player_shot1 (); + W_FireLaser (self.heat); + Attack_Finished (1.5); + }*/ + } + } + } + } + } + } + } + } + } + } +}; + +void () W_PrintWeaponMessage = +{ + if (((self.current_weapon == 16) && allow_hook)) + { + if ((self.playerclass != 8)) + { + sprint (self, 1, "Knife selected\n"); + self.weaponmode = 3; + } + } + else + { + if ((self.current_weapon == 1)) + { + sprint (self, 1, "grappling hook selected\n"); + } + else + { + if ((self.current_weapon == 2048)) + { + if (((self.weaponmode == 0) && (self.option != 1))) + { + sprint (self, 1, "Normal grenade mode\n"); + } + else + { + if (((self.weaponmode == 0) && (self.option == 1))) + { + sprint (self, 1, "Long-range grenade mode\n"); + } + else + { + if (self.weaponmode == 1) + { + if (self.option == 0) + { + sprint (self, 1, "Pipebomb mode\n"); + } + else + { + sprint (self, 1, "Long-range pipebomb mode\n"); + } + } + } + } + } + else + { + if ((self.current_weapon == 32)) + { + sprint (self, 1, "Sniper rifle ready\n"); + } + else + { + if ((self.current_weapon == 64)) + { + sprint (self, 1, "rifle on fully auto\n"); + } + else + { + if ((self.current_weapon == 262144)) + { + sprint (self, 1, "Tranquiliser gun selected\n"); + } + else + { + if ((self.current_weapon == 2)) + { + sprint (self, 1, "BioWeapon readied\n"); + } + else + { + if ((self.current_weapon == 4)) + { + sprint (self, 1, "Medikit readied\n"); + } + } + } + } + } + } + } + } +}; + +void () W_ChangeWeapon = +{ + local float it; + local float am; + local float fl; + local float have_weapon; + local float usable; + + if ((self.tfstate & 2)) + { + return; + } + if ((self.tools == (self.tools | 32))) + { + return; + } + it = self.weapons_carried; + fl = self.current_weapon; + am = 0; + usable = 0; + have_weapon = 1; + if ((self.playerclass != 8)) + { + it = it - (it & 1); + } + if ((self.impulse == 1)) + { + if ((fl == 8)) + { + return; + } + if ((((self.playerclass == 5) && (fl == 2)) || (fl == 4))) + { + fl = 2; + return; + } + if ((fl != 16)) + { + if ((self.playerclass != 8)) + { + sound (self, 1, "weapons/knifedrw.wav", 1, 1); + } + } + while ((!usable && have_weapon)) + { + if ((fl == 8)) + { + fl = 2; + if ((it & 2)) + { + usable = 1; + } + } + else + { + if ((fl == 2)) + { + fl = 4; + if ((it & 4)) + { + usable = 1; + } + } + else + { + if ((fl == 4)) + { + fl = 16; + usable = 1; + } + else + { + if ((fl == 1)) + { + fl = 16; + usable = 1; + } + else + { + fl = 8; + if ((it & 8)) + { + usable = 1; + } + } + } + } + } + } + } + else + { + if (((allow_hook && (self.impulse == 22)) || (self.impulse == 39))) + { + if ((self.playerclass == 8)) + { + fl = 1; + } + else + { + usable = 0; + } + } + else + { + if ((self.impulse == 40)) + { + if (!(it & 30)) + { + have_weapon = 0; + } + while ((!usable && have_weapon)) + { + if ((fl == 8)) + { + fl = 2; + if ((it & 2)) + { + usable = 1; + } + } + else + { + if ((fl == 2)) + { + fl = 16; + if ((it & 16)) + { + usable = 1; + } + } + else + { + fl = 8; + if ((it & 8)) + { + usable = 1; + } + } + } + } + } + else + { + if ((self.impulse == 2)) + { + if ((it & 32)) + { + fl = 32; + if ((self.ammo_shells < 1)) + { + am = 1; + } + else + { + sound (self, 1, "weapons/shotgr1a.wav", 0.800000, 1); + } + } + else + { + if ((it & 128)) + { + fl = 128; + if ((self.ammo_shells < 1)) + { + am = 1; + } + else + { + if ((self.playerclass != 8)) + { + sound (self, 1, "weapons/shotgr1a.wav", 0.800000, 1); + } + } + } + else + { + if ((it & 262144)) + { + fl = 262144; + if ((self.ammo_shells < 1)) + { + am = 1; + } + else + { + if ((self.playerclass != 8)) + { + sound (self, 1, "weapons/shotgr1a.wav", 0.800000, 1); + } + } + } + else + { + if ((it & 524288)) + { + fl = 524288; + if ((self.ammo_nails < 1)) + { + am = 1; + } + else + { + sound (self, 1, "weapons/railgr1a.wav", 0.800000, 1); + } + } + else + { + have_weapon = 0; + } + } + } + } + } + else + { + if ((self.impulse == 3)) + { + if ((it & 64)) + { + fl = 64; + if ((self.ammo_shells < 1)) + { + am = 1; + } + else + { + if ((self.playerclass != 8)) + { + sound (self, 1, "weapons/shotgr1a.wav", 0.800000, 1); + } + } + } + else + { + fl = 256; + if ((self.ammo_shells < 2)) + { + am = 1; + } + else + { + sound (self, 1, "weapons/shotgr1a.wav", 0.800000, 1); + } + } + } + else + { + if ((self.impulse == 4)) + { + // Long Range Pipe-Bombs + if ((it & 2048)) + { + fl = 2048; + if ((self.ammo_rockets < 3)) + { + am = 3; + } + else + { + sound (self, 1, "weapons/rocklr1a.wav", 0.800000, 1); + } + self.weaponmode = 1; + self.option = 1; + } + else + { + fl = 512; + if ((self.ammo_nails < 1)) + { + am = 1; + } + else + { + if ((self.playerclass != 8)) + { + sound (self, 1, "weapons/shotgr1a.wav", 0.800000, 1); + } + } + } + } + else + { + if ((self.impulse == 5)) + { + if ((it & 1024)) + { + fl = 1024; + if ((self.ammo_nails < 2)) + { + am = 1; + } + else + { + sound (self, 1, "weapons/shotgr1a.wav", 0.800000, 1); + } + } + else + { + if ((it & 2048)) + { + fl = 2048; + if ((self.ammo_rockets < 2)) + { + am = 2; + } + else + { + sound (self, 1, "weapons/rocklr1a.wav", 0.800000, 1); + } + self.weaponmode = 0; + self.option = 1; + } + else + { + have_weapon = 0; + } + } + } + else + { + if ((self.impulse == 6)) + { + if ((it & 4096)) + { + fl = 4096; + if ((self.ammo_cells < 1)) + { + am = 1; + } + else + { + sound (self, 1, "weapons/rocklr1a.wav", 0.800000, 1); + } + } + else + { + if ((it & 2048)) + { + fl = 2048; + if ((self.ammo_rockets < 1)) + { + am = 1; + } + else + { + sound (self, 1, "weapons/rocklr1a.wav", 0.800000, 1); + } + self.weaponmode = 0; + self.option = 0; + } + else + { + have_weapon = 0; + } + } + } + else + { + if ((self.impulse == 7)) + { + if ((it & 16384)) + { + fl = 16384; + if ((self.ammo_rockets < 3)) + { + am = 1; + } + else + { + sound (self, 1, "weapons/rocklr1a.wav", 0.800000, 1); + } + } + else + { + if ((it & 8192)) + { + fl = 8192; + if ((self.ammo_rockets < 1)) + { + am = 1; + } + else + { + sound (self, 1, "weapons/rocklr1a.wav", 0.800000, 1); + } + } + else + { + if ((it & 32768)) + { + if (self.option4) + { + self.option4 = 0; + sprint (self, 2, "Assault cannon selected\n"); + if ((self.ammo_cells < 4)) + { + am = 2; + } + } + else + { + self.option4 = 1; + sprint (self, 2, "20mm cannon selected\n"); + } + fl = 32768; + if ((self.ammo_shells < 1)) + { + am = 1; + } + else + { + sound (self, 1, "weapons/shotgr1a.wav", 0.800000, 1); + } + } + else + { + if ((it & 2048)) + { + fl = 2048; + self.weaponmode = 1; + self.option = 0; + if ((self.ammo_rockets < 1)) + { + am = 1; + } + else + { + sound (self, 1, "weapons/rocklr1a.wav", 0.800000, 1); + } + } + else + { + have_weapon = 0; + } + } + } + } + } + else + { + self.impulse = 8; + if ((/*8 && */(self.playerclass == 8))) + { + fl = 1; + if (!allow_hook) + { + am = 1; + } + } + else + { + self.impulse = 176; + if (self.impulse == 176) + { + fl = 4; + if ((it & 4)) + { + usable = 1; + } + } + } + } + } + } + } + } + } + } + } + } + self.impulse = 0; + if ((!have_weapon || !(it & fl))) + { + sprint (self, 2, "no weapon.\n"); + return; + } + if ((am == 1)) + { + sprint (self, 2, "not enough ammo.\n"); + return; + } + if ((am == 2)) + { + sprint (self, 2, "not enough cells to power assault cannon.\n"); + return; + } + self.current_weapon = fl; + W_SetCurrentAmmo (); + W_PrintWeaponMessage (); + self.StatusRefreshTime = (time + 0.100000); +}; + +void () CycleWeaponCommand = +{ + local float it; + local float am; + local float cont; + local float loopcount; + + if (((self.weaponmodel == string_null) || (self.current_weapon == 0))) + { + return; + } + if ((self.tfstate & 2)) + { + return; + } + if ((self.tools == (self.tools | 32))) + { + return; + } + it = self.weapons_carried; + self.impulse = 0; + loopcount = 0; + while (1) + { + am = 0; + cont = 0; + if ((self.current_weapon == 16)) + { + self.current_weapon = 8; + } + else + { + if ((self.current_weapon == 8)) + { + self.current_weapon = 128; + if ((self.ammo_shells < 1)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 128)) + { + self.current_weapon = 524288; + if ((self.ammo_nails < 1)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 524288)) + { + self.current_weapon = 262144; + if ((self.ammo_shells < 1)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 262144)) + { + self.current_weapon = 32; + if ((self.ammo_shells < 1)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 32)) + { + self.current_weapon = 64; + if ((self.ammo_shells < 1)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 64)) + { + self.current_weapon = 256; + if ((self.ammo_shells < 2)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 256)) + { + self.current_weapon = 512; + if ((self.ammo_nails < 1)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 512)) + { + self.current_weapon = 1024; + if ((self.ammo_nails < 2)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 1024)) + { + self.current_weapon = 2048; + self.weaponmode = 0; + if ((self.ammo_rockets < 1)) + { + am = 1; + } + } + else + { + if (((self.current_weapon == 2048) && (self.weaponmode == 0))) + { + self.current_weapon = 2048; + self.weaponmode = 1; + if ((self.ammo_rockets < 1)) + { + am = 1; + } + } + else + { + if (((self.current_weapon == 2048) && (self.weaponmode == 0))) + { + self.current_weapon = 2048; + self.weaponmode = 0; + self.option = 1; + if ((self.ammo_rockets < 1)) + { + am = 1; + } + } + else + { + if (((self.current_weapon == 2048) && (self.weaponmode == 1))) + { + self.current_weapon = 8192; + if ((self.ammo_rockets < 1)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 8192)) + { + self.current_weapon = 65536; + if ((self.ammo_cells < 1)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 65536)) + { + self.current_weapon = 4096; + if ((self.ammo_cells < 1)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 4096)) + { + self.current_weapon = 16384; + if ((self.ammo_rockets < 3)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 16384)) + { + self.current_weapon = 32768; + if ((self.ammo_cells < 6)) + { + am = 1; + } + if ((self.ammo_shells < 1)) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 32768)) + { + self.current_weapon = 1; + if (!allow_hook) + { + am = 1; + } + } + else + { + if ((self.current_weapon == 1)) + { + self.current_weapon = 2; + } + else + { + if ((self.current_weapon == 2)) + { + self.current_weapon = 4; + } + else + { + if ((self.current_weapon == 4)) + { + self.current_weapon = 16; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + if ((loopcount > 30)) + { + return; + } + loopcount = (loopcount + 1); + if (((self.weapons_carried & self.current_weapon) && (am == 0))) + { + if ((self.current_weapon != 2048)) + { + self.weaponmode = 0; + } + W_SetCurrentAmmo (); + W_PrintWeaponMessage (); + self.StatusRefreshTime = (time + 0.1); + return; + } + } +}; +void () DeadImpulses; +//void () FireUtil; + +void () ImpulseCommands = +{ + local string _l_3204; + + _l_3204 = infokey (self, "tf_help"); + if (prematch) + { + if (((((((self.impulse == 120) || (self.impulse == 136)) || (self.impulse == 119)) || (self.impulse == 186)) || (self.impulse == 187)) || ((self.impulse >= 236) && (self.impulse <= 239)))) + { + DeadImpulses (); + } + if ((!(((self.impulse >= 1) && (self.impulse < 9)) || (self.impulse == 176)) && !((self.impulse >= 100) && (self.impulse <= 110)))) + { + self.impulse = 0; + return; + } + } + if ((self.tools == (self.tools | 32))) + { + return; + } + if ((self.impulse == 211)) + { + TeamFortress_ToggleGenderMessage(); + } + if (((self.last_impulse == 168) && self.impulse)) + { + TeamFortress_SetDetpack (self.impulse); + } + else + { + if (((self.last_impulse == 159) && self.impulse)) + { + TeamFortress_Scan (self.impulse); + } + } + if ((((self.impulse == 8) && (self.current_menu != 6)) && (self.playerclass != 8))) + { + self.current_menu = 6; + self.menu_count = 25; + self.menu_displaytime = 0; + } + if ((self.impulse == 171)) + { + UseSpecialSkill (); + } + if ((self.impulse == 240)) + { + bprint2 (1, self.netname, " tried to cheat.\n"); + sprint (self, 2, "You have been kicked for attempting to cheat. Don't do it.\n"); + stuffcmd (self, "disconnect\n"); + stuffcmd (self, "quit\n"); + } + if (spycam) + { + if (((self.impulse == 55) && (self.bugger > 0))) + { + Cam (); + } + if ((((self.impulse == 55) && (self.is_feigning == 1)) && (self.bugger == 0))) + { + Cam (); + } + } + if ((((!self.is_building && !self.is_detpacking) && !self.is_feigning) && (self.bugger == 0))) + { + if ((((self.impulse >= 1) && (self.impulse < 9)) || (self.impulse == 176))) + { + if ((self.weaponmodel == "progs/proxgren.mdl")) + { + if ((self.oldweaponmodel != "")) + { + self.tfstate = (self.tfstate - (self.tfstate & 2)); + } + self.weaponmodel = self.oldweaponmodel; + self.currentammo = self.oldcurrentammo; + self.StatusRefreshTime = (time + 0.100000); + } + if ((self.weaponmodel == "progs/spycamb.mdl")) + { + if ((self.oldweaponmodel != "")) + { + self.tfstate = (self.tfstate - (self.tfstate & 2)); + } + self.weaponmodel = self.oldweaponmodel; + self.currentammo = self.oldcurrentammo; + self.StatusRefreshTime = (time + 0.100000); + } + W_ChangeWeapon (); + } + else + { + if ((self.impulse == 40)) + { + W_ChangeWeapon (); + } + else + { + if ((allow_hook && ((self.impulse == 22) || (self.impulse == 39)))) + { + W_ChangeWeapon (); + } + else + { + if (((self.impulse == 10) || (self.impulse == 12))) + { + CycleWeaponCommand (); + } + else + { + if ((self.impulse == 150)) + { + TeamFortress_PrimeGrenade (); + } + else + { + if ((self.impulse == 151)) + { + TeamFortress_PrimeGrenade (); + } + else + { + if ((self.impulse == 173)) + { + TeamFortress_ReloadCurrentWeapon (); + } + else + { + if ((self.impulse == 162)) + { + TeamFortress_Scan (10); + } + else + { + if ((self.impulse == 163)) + { + TeamFortress_Scan (30); + } + else + { + if ((self.impulse == 164)) + { + TeamFortress_Scan (100); + } + else + { + if ((self.impulse == 157)) + { + if ((self.last_saveme_sound <= time)) + { + self.last_saveme_sound = (time + 5); + muzzleflash (); + sound (self, 0, "speech/threat.wav", 0.700000, 0); + self.impulse = 0; + } + } + else + { + if ((self.impulse == 156)) + { + if ((self.last_saveme_sound <= time)) + { + self.last_saveme_sound = (time + 5); + muzzleflash (); + sound (self, 0, "speech/hey.wav", 0.700000, 0); + self.impulse = 0; + } + } + else + { + if ((self.impulse == 58)) + { + if ((self.last_saveme_sound <= time)) + { + self.last_saveme_sound = (time + 10); + muzzleflash (); + sound (self, 0, "speech/cmyhole.wav", 0.700000, 0); + self.impulse = 0; + } + } + else + { + if ((self.impulse == 158)) + { + if ((self.is_squating == 1)) + { + self.is_squating = 0; + self.frame = 0; + unlay (); + sprint (self, 2, "Standing mode, (normal)\n"); + } + else + { + self.is_squating = 1; + lay (); + sprint (self, 2, "Laying mode, (stop walking to lay)\n"); + } + } + else + { + if ((self.impulse == 155)) + { + if ((self.playerclass == 1)) + { + SuperLeap (); + } + //self.movetype = 5; //yeah this caused flying on FTE/ZQuake servers + //since apparently movetype 5 is fly for them :\ + self.movetype = 3; + } + else + { + if ((self.impulse == 154)) + { + sprint (self, 2, "--- Airscout Info ---\n"); + sprint (self, 2, "Def: A Scout that can jump very high\n"); + sprint (self, 2, "Cmd: 'jetjump' or Impulse 155.\n"); + sprint (self, 2, " Uses 25 battery cells per jump.\n"); + sprint (self, 2, " Aim higher than you want to go.\n"); + sprint (self, 2, "Use: Must be a scout,\n"); + self.impulse = 0; + } + else + { + if (((self.impulse == 190) && (self.flags & 512))) + { + if (!drop1) + { + sprint (self, 2, "Type 1 weapons disabled by Admin!\n"); + self.impulse = 0; + return; + } + if ((self.playerclass == 2)) + { + A_Mine (); + self.impulse = 0; + } + else + { + if ((self.playerclass == 5)) + { + B_Mine (); + self.impulse = 0; + } + else + { + if ((self.playerclass == 9)) + { + M_Mine (); + self.impulse = 0; + } + else + { + if ((self.playerclass == 1)) + { + C_Mine (); + self.impulse = 0; + } + else + { + if ((self.playerclass == 3)) + { + S_Mine (); + self.impulse = 0; + } + else + { + if ((self.playerclass == 6)) + { + S_Mine (); + self.impulse = 0; + } + else + { + if ((self.playerclass == 8)) + { + SpyPack (); + self.impulse = 0; + } + else + { + if ((self.playerclass == 4)) + { + BalloonMIRV (); + self.impulse = 0; + } + else + { + if ((self.playerclass == 7)) + { + LavaPool (); + self.impulse = 0; + } + } + } + } + } + } + } + } + } + } + else + { + if ((self.impulse == 201)) + { + W_LaunchStinger (); + self.impulse = 0; + } + else + { + if ((self.impulse == 55)) + { + if (!drop3) + { + sprint (self, 2, "Type 3 weapons disabled by Admin!\n"); + self.impulse = 0; + return; + } + if ((self.playerclass == 9)) + { + Drone (); + } + if ((self.playerclass == 5)) + { + HealSelf (); + } + if ((self.playerclass == 8)) + { + if (spycam) + { + Cam (); + } + } + if ((self.playerclass == 3)) + { + Prox (); + } + if ((self.playerclass == 1)) + { + DetpackDisarm (); + } + if (((self.playerclass == 2) && (self.has_syringe == 1))) + { + self.option = 9; + } + self.impulse = 0; + } + else + { + if ((self.impulse == 200)) + { + MakeHolo (); + self.impulse = 0; + } + else + { + if ((self.impulse == 249)) + { + W_LaunchStinger (); + } + else + { + if ((self.impulse == 250)) + { + if ((self.last_saveme_sound <= time)) + { + + local string version_finder; + version_finder = infokey(world, "MegaTF"); + + self.last_saveme_sound = (time + 5); + muzzleflash (); + sound (self, 1, "speech/pantsdwn.wav", 1, 1); + sprint (self, 1, "MegaTF ",version_finder,"\n"); + self.impulse = 0; + } + } + else + { + if ((self.impulse == 165)) + { + TeamFortress_SetDetpack (5); + } + else + { + if ((self.impulse == 166)) + { + TeamFortress_SetDetpack (20); + } + else + { + if ((self.impulse == 167)) + { + TeamFortress_SetDetpack (50); + } + else + { + if ((self.impulse == 172)) + { + self.current_menu = 4; + self.menu_count = 20; + } + else + { + if ((self.impulse == 184)) + { + TeamFortress_Discard (); + } + else + { + if ((self.impulse == 57)) + { + if ((self.playerclass == 0)) + { + return; + } + self.current_menu = 20; + self.menu_count = 20; + } + else + { + if ((self.impulse == 53)) + { + if ((self.playerclass == 0)) + { + return; + } + self.current_menu = 21; + self.menu_count = 20; + } + else + { + if ((self.impulse == 56)) + { + if ((self.playerclass == 0)) + { + return; + } + self.current_menu = 22; + self.menu_count = 20; + } + else + { + if ((self.impulse == 251)) + { + self.current_menu = 23; + self.menu_count = 20; + } + else + { + if ((self.impulse == 245)) + { + voteyes (); } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + if ((self.impulse == 135)) + { + TeamFortress_Inventory (); + } + else + { + if ((self.impulse == 181)) + { + TeamFortress_SaveMe (); + } + else + { + if (((self.impulse == 50) || (self.impulse == 50))) + { + if ((self.vision != 1)) + { + self.vision = 1; + stuffcmd (self, "v_cshift 0 100 0 100\n"); + } + else + { + self.vision = 0; + stuffcmd (self, "v_cshift 0 0 0 0\n"); + } + } + else + { + if ((self.impulse == 60)) + { + TeamFortress_Spotlight(); + self.impulse = 0; + } + else + { + if (((self.impulse == 61) && (self.playerclass == 2))) + { + if ((self.option4 == 1)) + { + sprint (self, 2, "Laser Sight On\n"); + self.option4 = 0; + } + else + { + sprint (self, 2, "Laser Sight Off\n"); + self.option4 = 1; + } + } + else + { +// if ((self.impulse == 51)) +// { +// self.impulse = 0; +// self.has_syringe = 1; +// if (((self.playerclass == 2) && 1)) +// { +// self.option = 9; +// } +// } +// else +// { + if ((self.impulse == 152)) + { + TeamFortress_ThrowGrenade (); + } + else + { + if (self.impulse == 185) + { + TeamFortress_ID (); + } + else + { + if ((self.impulse == 170)) + { + TeamFortress_DetonatePipebombs (); + } + else + { + if ((self.impulse == 169)) + { + TeamFortress_DetpackStop (); + } + else + { + if (((self.impulse == 177) && (self.playerclass == 8))) + { + TeamFortress_SpyGoUndercover (); + } + else + { + if ((((self.impulse == 178) && (self.playerclass == 8)) && !self.hook_out)) + { + TeamFortress_SpyFeignDeath (0); + } + else + { + if ((((self.impulse == 180) && (self.playerclass == 8)) && !self.hook_out)) + { + if ((self.weaponmodel != "progs/spycamb.mdl")) + { + TeamFortress_SpyFeignDeath (1); + } + } + else + { + if (((self.impulse == 179) && (self.playerclass == 9))) + { + TeamFortress_EngineerBuild (); + } + else + { + if ((self.impulse == 23)) + { + if ((CTF_Map == 1)) + { + TeamFortress_CTF_FlagInfo (); + } + else + { + TeamFortress_DisplayDetectionItems (); + } + } + else + { + if ((self.impulse == 118)) + { + display_location (); + } + else + { + //if ((self.impulse == 191)) + //{ +// // FireUtil (); + //} + //else + //{ + if (self.impulse != 245) { DeadImpulses (); } + //} + } + } + } + } + } + } + } + } + } + } +// } + } + } + } + } } +/* gold. moved to dead impulses + if ((self.impulse == 202)) + { + self.current_menu = 3; + self.menu_displaytime = 25; + self.menu_count = 25; + self.oldcurrentammo = 1; + } +*/ + if (self.impulse == 189) + { + HealSelf(); + } + if (self.impulse == 203) + { +#ifdef tf29ents + DropGoalItems (); +#else + DropFlag(); +#endif + } +#ifdef clan_progs + if (self.impulse == 206) + { + DropGoalItems(); + } +#endif + if(self.impulse == 188) + { + Det_Disp(); + } + if(self.impulse == 205) + { + Det_Sent(); + } + if ((self.impulse == 234)) + { + TeamFortress_ItemStatus (1); + } + if ((self.impulse == 235)) + { + TeamFortress_ItemStatus (0); + } + if ((self.impulse == 241)) + { + TeamFortress_ItemStatus (11); + } + if ((self.impulse == 242)) + { + TeamFortress_ItemStatus (10); + } +/* gold. moved to deadimpulses + if(self.impulse == 120) + { + TeamFortress_Timeleft(); + } +*/ + if(self.impulse == 204) + { +#ifdef tf29ents + DropGoalItems (); +#else + DropFlag(); +#endif + } + if ((self.impulse == 168)) + { + self.last_impulse = self.impulse; + } + if ((self.impulse == 159)) + { + self.last_impulse = self.impulse; + } + self.impulse = 0; +}; + +#ifdef clan_progs +void () Rank_ShowStats; +#endif +void () DeadImpulses = +{ +#ifdef clan_progs + if ((self.impulse == 69)) + { + Rank_ShowStats(); + } +#else + if ((self.impulse == 69)) + { + testfunct (); + } +#endif + if ((self.impulse == 202)) + { + self.current_menu = 3; + self.menu_displaytime = 25; + self.menu_count = 25; + self.oldcurrentammo = 1; + } +// so you can vote when dead + if ((self.impulse == 245)) + { + voteyes(); + } + if ((self.impulse == 120)) + { + TeamFortress_Timeleft(); + } + if ((self.impulse == 136)) + { + TeamFortress_ShowTF (); + } + else + { + if ((self.impulse == 174)) + { + TeamFortress_AutoZoomToggle (); + } + else + { + if ((self.impulse == 137)) + { + TeamFortress_DisplayLegalClasses (); + } + else + { + if (((self.impulse >= 100) && (self.impulse <= (100 + 10)))) + { + TeamFortress_ChangeClass (); + } + else + { + if ((self.impulse == 131)) + { + TeamFortress_HelpMap (); + } + else + { + if ((self.impulse == 119)) + { + TeamFortress_StatusQuery (); + } + else + { + if ((self.impulse == 140)) + { + TeamFortress_TeamSet (1,0); + } + else + { + if ((self.impulse == 141)) + { + TeamFortress_TeamSet (2,0); + } + else + { + if ((self.impulse == 142)) + { + TeamFortress_TeamSet (3,0); + } + else + { + if ((self.impulse == 143)) + { + TeamFortress_TeamSet (4,0); + } + else + { + if ((self.impulse == 145)) + { + TeamFortress_TeamShowScores (0); + } + else + { + if ((self.impulse == 144)) + { + TeamFortress_TeamShowMemberClasses (self); + } + else + { + if ((self.impulse == 182)) + { + self.StatusRefreshTime = (time + 0.2); + self.StatusBarSize = (self.StatusBarSize + 1); + if ((self.StatusBarSize > 2)) + { + self.StatusBarSize = 1; + } + } + else + { + if ((self.impulse == 183)) + { + self.StatusRefreshTime = (time + 60); + self.StatusBarSize = 0; + } + else + { + if (((self.impulse >= 71) && (self.impulse <= 81))) + { + StatusRes ((self.impulse - 71)); + } + else + { + if ((self.impulse == 13)) + { + sprint (self, 2, "Aliases checked.\n"); + self.got_aliases = 1; + self.impulse = 0; + } + else + { + if ((self.impulse == 186)) + { + if ((self.autoid != 1)) + { + sprint (self, 2, "Auto Identify On\n"); + } + self.autoid = 1; + self.impulse = 0; + } + else + { + if ((self.impulse == 187)) + { + if ((self.autoid != 0)) + { + sprint (self, 2, "Auto Identify Off\n"); + } + self.autoid = 0; + self.impulse = 0; + } + else + { + if ((self.impulse == 236)) + { + if ((self.discard_max != 1)) + { + sprint (self, 2, "Discarding set to Max\n"); + } + self.discard_max = 1; + self.impulse = 0; + } + else + { + if ((self.impulse == 237)) + { + if ((self.discard_max != 0)) + { + sprint (self, 2, "Discarding set to Normal\n"); + } + self.discard_max = 0; + self.impulse = 0; + } + else + { + if ((self.impulse == 238)) + { + if ((self.autodiscard != 1)) + { + sprint (self, 2, "Auto Discard On\n"); + } + self.autodiscard = 1; + self.impulse = 0; + } + else + { + if ((self.impulse == 239)) + { + if ((self.autodiscard != 0)) + { + sprint (self, 2, "Auto Discard Off\n"); + } + self.autodiscard = 0; + self.impulse = 0; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +}; + +void () W_WeaponFrame = +{ + local vector tv; + local string he; + + he = infokey (self, "tf_help"); + if (!(self.tfstate & 2048)) + { + if (((self.height > 29) && (self.height < 90))) + { + self.height = (self.height + 8); + if ((self.height > 90)) + { + self.height = 90; + } + TF_zoom (self.height); + } + } + if ((self.current_menu > 0)) + { + Player_Menu (); + if (((self.impulse > 0) && (self.impulse < 11))) + { + Menu_Input (self.impulse); + if ((self.impulse != 0)) + { + if ((((self.team_no == 0) && teamplay) && (self.lives != 0))) + { + Menu_Team_Input (self.impulse); + } + else + { + if (((self.playerclass == 0) && (self.lives != 0))) + { + Menu_Class_Input (self.impulse); + } + } + } + } + } +#ifdef clan_progs +//grenade throw lag fix (sticky grenades) + if (self.tfstate & 32768) // if player is tranq'd, do not do this anti-sticky function + { + if ((time < self.attack_finished)) + { + return; + } + if ((self.impulse != 0)) + { + ImpulseCommands (); + } + } + else + { + if ((time < self.attack_finished)) + { + if (self.impulse == 152 || self.impulse == 151 || self.impulse == 150 || self.impulse == 191) + { + ImpulseCommands (); + } + else + { + return; + } + } + } +#else + if ((time < self.attack_finished)) + { + return; + } +#endif + if ((self.impulse != 0)) + { + ImpulseCommands (); + } + if ((((self.is_building != 0) || (self.is_detpacking != 0)) || (self.is_feigning != 0))) + { + return; + } + if (((!self.button0 && self.fire_held_down) && (self.current_weapon == 32768))) + { + if ((self.tfstate & 131072)) + { + self.tfstate = (self.tfstate - 131072); + } + self.fire_held_down = 0; + TeamFortress_SetSpeed (self); + player_run (); + } + if ((self.button0 && !self.fire_held_down)) + { + if (((self.current_menu == 6) || (self.current_menu == 7))) + { + self.current_menu = 8; + self.menu_count = 25; + Attack_Finished (0.200000); + } + else + { + if ((self.current_weapon == 32)) + { + if ((self.tfstate & 2048)) + { +#ifndef clan_progs + if ((self.heat < 400)) + { + self.heat = (self.heat + 3); + } +#endif + if ((self.height > 30)) + { + self.height = (self.height - 5); + TF_zoom (self.height); + } + } + else + { + tv = self.velocity; + tv_z = 0; + if ((vlen (tv) <= 50)) + { + SniperSight_Create (); +#ifdef clan_progs + self.heat = time; // damage done // PZ - 50 -> time (Randomer's charge-up fix) +#else + self.heat = 50; +#endif + self.height = 90; + self.tfstate = (self.tfstate | 2048); + TeamFortress_SetSpeed (self); + } + } + } + else + { + if ((self.current_weapon == 32768)) + { + if ((self.flags & 512)) + { + SuperDamageSound (); + W_Attack (); + } + else + { + if ((he != "off")) + { + if (self.hw_message_resttime < time) + { + sprint (self, 1, "You cannot fire the assault cannon without\nyour feet on the ground...\n"); + self.hw_message_resttime = time + 0.5; + } + } + } + } + else + { + SuperDamageSound (); + W_Attack (); + } + } + } + } + else + { + if ((self.playerclass == 0)) + { + self.weaponmode = 0; + } + else + { + if ((self.tfstate & 2048)) + { + W_Attack (); + self.tfstate = (self.tfstate - 2048); + TeamFortress_SetSpeed (self); + self.heat = 0; + } + } + } +}; + +void () SuperDamageSound = +{ + if ((self.super_damage_finished > time)) + { + if ((self.super_sound < time)) + { + self.super_sound = (time + 1); + sound (self, 4, "items/damage3.wav", 1, 1); + } + } + return; +}; +//void (vector where) make_bub; +void (float num_bubbles) DeathBubbles; + +//#warning "Could not determine return type" +//float () AxeTouch; +void (string gibname,float dm) ThrowGib; + +void () SUB_Gib = +{ + local vector x; + local vector y; + local vector v; + local float r_num; + + if ((other.team_no == self.team_no)) + { + return; + } + r_num = random (); + if ((r_num < 0.6)) + { + x = '1 0 0'; + y = '0 1 0'; + v = ((x * (50 - (random () * 100))) + (y * (50 - (random () * 100)))); + r_num = random (); + SpawnMeatSpray (self.origin, v); + } + else + { + if ((r_num >= 0.6)) + { + ThrowGib ("progs/gib1.mdl", self.health); + } + else + { + ThrowGib ("progs/gib3.mdl", self.health); + } + } +}; + +void () TeamFortress_Discard = +{ + if (self.discard_next > time) + { +//fixes discard server bug + return; + } + newmis = spawn (); + if ((self.playerclass == 1)) + { + newmis.ammo_rockets = self.ammo_rockets; + self.ammo_rockets = 0; + if (self.discard_max) + { + if ((self.ammo_shells > 10)) + { + newmis.ammo_shells = (self.ammo_shells - 10); + self.ammo_shells = 10; + } + } + } + else + { + if ((self.playerclass == 2)) + { + newmis.ammo_rockets = self.ammo_rockets; + self.ammo_rockets = 0; + if (self.discard_max) + { + if ((self.ammo_shells > 40)) + { + newmis.ammo_shells = (self.ammo_shells - 40); + self.ammo_shells = 40; + } + } + } + else + { + if ((self.playerclass == 3)) + { + newmis.ammo_cells = self.ammo_cells; + newmis.ammo_nails = self.ammo_nails; + self.ammo_cells = 0; + self.ammo_nails = 0; + if (self.discard_max) + { + if ((self.ammo_shells > 40)) + { + newmis.ammo_shells = (self.ammo_shells - 40); + self.ammo_shells = 40; + } + } + } + else + { + if ((self.playerclass == 4)) + { + newmis.ammo_cells = self.ammo_cells; + newmis.ammo_nails = self.ammo_nails; + self.ammo_cells = 0; + self.ammo_nails = 0; + if (self.discard_max) + { + if ((self.ammo_shells > 40)) + { + newmis.ammo_shells = (self.ammo_shells - 40); + self.ammo_shells = 40; + } + } + } + else + { + if ((self.playerclass == 5)) + { + newmis.ammo_rockets = self.ammo_rockets; + self.ammo_rockets = 0; + if (!medicarmorheal) + { + newmis.ammo_cells = self.ammo_cells; + self.ammo_cells = 0; + } + if (self.discard_max) + { + if ((self.ammo_shells > 40)) + { + newmis.ammo_shells = (self.ammo_shells - 40); + self.ammo_shells = 40; + } + } + } + else + { + if ((self.playerclass == 6)) + { + newmis.ammo_rockets = self.ammo_rockets; + self.ammo_rockets = 0; + if (self.discard_max) + { + if ((self.ammo_cells > 10)) + { + newmis.ammo_cells = (self.ammo_cells - 10); + self.ammo_cells = 10; + } + } + } + else + { + if ((self.playerclass == 7)) + { + newmis.ammo_nails = self.ammo_nails; + self.ammo_nails = 0; + if (self.discard_max) + { + if ((self.ammo_shells > 20)) + { + newmis.ammo_shells = (self.ammo_shells - 20); + self.ammo_shells = 20; + } + } + } + else + { + if ((self.playerclass == 8)) + { + newmis.ammo_rockets = self.ammo_rockets; + self.ammo_rockets = 0; + } + else + { + if ((self.playerclass == 9)) + { + newmis.ammo_rockets = self.ammo_rockets; + self.ammo_rockets = 0; + } + } + } + } + } + } + } + } + } + if (!(((newmis.ammo_shells + newmis.ammo_nails) + newmis.ammo_rockets) + newmis.ammo_cells)) + { + dremove (newmis); + return; + } + W_SetCurrentAmmo (); + sound (self, 3, "weapons/lock4.wav", 1, 1); + if ((self.team_no != 0)) + { + increment_team_ammoboxes (self.team_no); + if ((num_team_ammoboxes (self.team_no) > (20 / number_of_teams))) + { + RemoveOldAmmobox (self.team_no); + } + } + else + { + num_world_ammoboxes = num_world_ammoboxes + 1; + if ((num_world_ammoboxes > 20)) + { + RemoveOldAmmobox (0); + } + } + newmis.enemy = self; + newmis.health = time; + newmis.weapon = 0; + newmis.movetype = 6; + newmis.solid = 1; + newmis.classname = "ammobox"; + newmis.team_no = self.team_no; + makevectors (self.v_angle); + if (self.v_angle_x) + { + newmis.velocity = ((v_forward * 400) + (v_up * 200)); + } + else + { + newmis.velocity = aim (self, 10000); + newmis.velocity = (newmis.velocity * 400); + newmis.velocity_z = 200; + } + newmis.avelocity = '0 300 0'; + setsize (newmis, '0 0 0', '0 0 0'); + setorigin (newmis, self.origin); + newmis.nextthink = (time + 30); + newmis.think = SUB_Remove; + newmis.touch = TeamFortress_AmmoboxTouch; + setmodel (newmis, "progs/backpack.mdl"); + self.discard_next = time + 0.25; +}; + +void () TeamFortress_SaveMe = +{ + local entity te; + local entity tl; + + if ((self.last_saveme_sound < time)) + { + sound (self, TF_FLARE_OFF, "speech/saveme1.wav", TF_FLARE_OFF, TF_FLARE_OFF); + self.last_saveme_sound = (time + 4); + } + te = find (world, classname, "player"); + while (te) + { + if (((((self == te) || (te.playerclass == 5)) || (te.playerclass == 9)) || (te.playerclass == 8))) + { + if ((((te.team_no == self.team_no) && (self.team_no != TF_FLARE_LIT)) || (te.playerclass == 8))) + { + if (visible (te)) + { + msg_entity = te; + tl = spawn (); + tl.origin = self.origin; + tl.origin_z = (tl.origin_z + 32); + WriteByte (TF_FLARE_OFF, 23); + WriteByte (TF_FLARE_OFF, 9); + WriteEntity (TF_FLARE_OFF, tl); + WriteCoord (TF_FLARE_OFF, tl.origin_x); + WriteCoord (TF_FLARE_OFF, tl.origin_y); + WriteCoord (TF_FLARE_OFF, (tl.origin_z + 24)); + WriteCoord (TF_FLARE_OFF, self.origin_x); + WriteCoord (TF_FLARE_OFF, self.origin_y); + WriteCoord (TF_FLARE_OFF, self.origin_z); + dremove (tl); + } + } + } + te = find (te, classname, "player"); + } +}; + +void () TeamFortress_ID = +{ + local vector src; + local string st; + local string _l_3386; + local string cls; + + src = self.origin + (v_forward * 10); + src_z = self.absmin_z + (self.size_z * 0.700000); + traceline (src, (src + (v_forward * 2048)), 0, self); + if (((trace_ent != world) && (trace_ent.origin != world.origin))) + { + if (((trace_ent.classname == "player") && (trace_ent.health > 0))) + { + if ((trace_ent.bugger > 0)) + { + return; + } + self.StatusRefreshTime = (time + 1.500000); + if (((self.team_no != 0) && (self.team_no == trace_ent.team_no))) + { + cls = TeamFortress_GetClassName (trace_ent.playerclass); + if ((self.playerclass == 5)) + { + if (medicarmorheal == 1) + { + st = ftos (trace_ent.health); + _l_3386 = ftos (trace_ent.armorvalue); + st = ftos (rint ((((trace_ent.health / trace_ent.max_health) + (trace_ent.armorvalue / trace_ent.maxarmor)) * 50))); + centerprint (self, "\n\n\n\n\n\n", trace_ent.netname, "\nFriendly ", cls, "\n", st, "% strength\n"); + return; + } + else + { + st = ftos (trace_ent.health); + centerprint (self, "\n\n\n", trace_ent.netname, "\nFriendly ", cls, "\n", st, " health\n"); + return; + } + } + else + { + if ((self.playerclass == 9)) + { + st = ftos (trace_ent.armorvalue); + centerprint (self, "\n\n\n\n\n\n", trace_ent.netname, "\nFriendly ", cls, "\n", st, " armor\n"); + return; + } + } + centerprint (self, "\n\n\n\n\n\n", trace_ent.netname, "\nFriendly ", cls); + return; + } + if ((trace_ent.playerclass == 8)) + { + cls = TeamFortress_GetClassName (trace_ent.undercover_skin); + if (((self.team_no != 0) && (self.team_no == trace_ent.undercover_team))) + { + if ((self.playerclass == 5)) + { + if (medicarmorheal) + { + st = ftos (trace_ent.health); + _l_3386 = ftos (trace_ent.armorvalue); + st = ftos (rint ((((trace_ent.health / trace_ent.max_health) + (trace_ent.armorvalue / trace_ent.maxarmor)) * 50))); + if ((trace_ent.undercover_skin != 0)) + { + centerprint (self, "\n\n\n\n\n\n", trace_ent.undercover_name, "\nFriendly ", cls, "\n", st, "% strength\n"); + } + else + { + centerprint (self, "\n\n\n\n\n\n\n", trace_ent.undercover_name, "\nFriendly Spy\n", st, "% strength\n"); + } + return; + } + else + { + st = ftos (trace_ent.health); + if ((trace_ent.undercover_skin != 0)) + { + centerprint (self, "\n\n\n\n", trace_ent.undercover_name, "\nFriendly ", cls, "\n", st, " health\n"); + } + else + { + centerprint (self, "\n\n\n\n", trace_ent.undercover_name, "\nFriendly Spy\n", st, " health\n"); + } + return; + } + } + else + { + if ((self.playerclass == 9)) + { + st = ftos (trace_ent.armorvalue); + if ((trace_ent.undercover_skin != 0)) + { + centerprint (self, "\n\n\n\n\n\n\n", trace_ent.undercover_name, "\nFriendly ", cls, "\n", st, " armor\n"); + } + else + { + centerprint (self, "\n\n\n\n\n\n\n", trace_ent.undercover_name, "\nFriendly Spy\n", st, " armor\n"); + } + return; + } + else + { + st = ftos (trace_ent.armorvalue); + if ((trace_ent.undercover_skin != 0)) + { + centerprint (self, "\n\n\n\n\n\n\n", trace_ent.undercover_name, "\nFriendly ", cls); + } + else + { + centerprint (self, "\n\n\n\n\n\n\n", trace_ent.undercover_name, "\nFriendly Spy\n"); + } + return; + } + } + } + if ((trace_ent.undercover_name != string_null)) + { + if ((trace_ent.undercover_skin != 0)) + { + centerprint (self, "\n\n\n\n\n\n\n", trace_ent.undercover_name, "\nEnemy ", cls); + } + else + { + centerprint (self, "\n\n\n\n\n\n\n", trace_ent.undercover_name, "\nEnemy Spy"); + } + } + else + { + if ((trace_ent.undercover_skin != 0)) + { + centerprint (self, "\n\n\n\n\n\n\n", trace_ent.netname, "\nEnemy ", cls); + } + else + { + centerprint (self, "\n\n\n\n\n\n\n", trace_ent.netname, "\nEnemy Spy"); + } + } + } + else + { + cls = TeamFortress_GetClassName (trace_ent.playerclass); + centerprint (self, "\n\n\n\n\n\n\n", trace_ent.netname, "\nEnemy ", cls); + } + } + else + { + if ((trace_ent.classname == "building_dispenser")) + { + self.StatusRefreshTime = (time + 1.500000); + if ((self == trace_ent.real_owner)) + { + centerprint (self, "\n\n\n\n\n\n\nYour Dispenser"); + } + else + { + centerprint (self, "\n\n\n\n\n\n\nDispenser made by ", trace_ent.real_owner.netname); + } + } + else + { + if (((trace_ent.classname == "building_sentrygun") || (trace_ent.classname == "building_sentrygun_base"))) + { + self.StatusRefreshTime = (time + 1.500000); + if ((self == trace_ent.real_owner)) + { + centerprint (self, "\n\n\n\n\n\n\nYour SentryGun"); + } + else + { + if (!teamplay) + { + centerprint (self, "\n\n\n\n\n\n\nSentrygun made by\n", trace_ent.real_owner.netname); + } + else + { + if (((self.team_no != 0) && (self.team_no == trace_ent.team_no))) + { + centerprint (self, "\n\n\n\n\n\n\nFriendly Sentrygun made by\n", trace_ent.real_owner.netname); + } + else + { + centerprint (self, "\n\n\n\n\n\n\nEnemy Sentrygun made by\n", trace_ent.real_owner.netname); + } + } + } + } + else + { + if ((trace_ent.classname == "building_tesla")) + { + self.StatusRefreshTime = (time + 1.500000); + if ((self == trace_ent.real_owner)) + { + centerprint (self, "\n\n\n\n\n\n\nYour Tesla Coil"); + } + else + { + if (!teamplay) + { + centerprint (self, "\n\n\n\n\n\n\nTesla Coil made by\n", trace_ent.real_owner.netname); + } + else + { + if (((self.team_no != 0) && (self.team_no == trace_ent.team_no))) + { + centerprint (self, "\n\n\n\n\n\n\nFriendly Tesla made by\n", trace_ent.real_owner.netname); + } + else + { + centerprint (self, "\n\n\n\n\n\n\nEnemy Tesla made by\n", trace_ent.real_owner.netname); + } + } + } + } + } + } + } + } +}; + +void () TeamFortress_ReloadCurrentWeapon = +{ + local float rt; + local entity tWeapon; + + if ((self.current_weapon == 128)) + { + if ((self.reload_shotgun == TF_FLARE_LIT)) + { + sprint (self, 2, "clip full.\n"); + return; + } + if ((self.reload_shotgun < self.ammo_shells)) + { + Attack_Finished (0.4); + rt = ((8 - self.reload_shotgun) / 8); + rt = (2 - (2 * rt)); + self.reload_shotgun = TF_FLARE_LIT; + if ((self.ammo_shells < 8)) + { + self.reload_shotgun = (8 - self.ammo_shells); + } + sprint (self, 2, "reloading...\n"); + self.tfstate = (self.tfstate | 2); + tWeapon = spawn (); + tWeapon.owner = self; + tWeapon.classname = "timer"; + tWeapon.nextthink = (time + rt); + tWeapon.think = W_Reload_shotgun; + self.weaponmodel = ""; + self.weaponframe = TF_FLARE_LIT; + } + else + { + sprint (self, 2, "not enough ammo to reload\n"); + } + } + else + { + if ((self.current_weapon == 256)) + { + if ((self.reload_super_shotgun == TF_FLARE_LIT)) + { + sprint (self, 2, "clip full.\n"); + return; + } + if ((self.reload_super_shotgun < self.ammo_shells)) + { + Attack_Finished (0.7); + rt = ((16 - self.reload_super_shotgun) / 16); + rt = (3 - (3 * rt)); + self.reload_super_shotgun = TF_FLARE_LIT; + if ((self.ammo_shells < 16)) + { + self.reload_super_shotgun = (16 - self.ammo_shells); + } + sprint (self, 2, "reloading...\n"); + self.tfstate = (self.tfstate | 2); + tWeapon = spawn (); + tWeapon.owner = self; + tWeapon.classname = "timer"; + tWeapon.nextthink = (time + rt); + tWeapon.think = W_Reload_super_shotgun; + self.weaponmodel = ""; + self.weaponframe = TF_FLARE_LIT; + } + else + { + sprint (self, 2, "not enough ammo to reload\n"); + } + } + else + { + if ((self.current_weapon == 2048)) + { + if ((self.reload_grenade_launcher == TF_FLARE_LIT)) + { + sprint (self, 2, "clip full.\n"); + return; + } + if ((self.reload_grenade_launcher < self.ammo_rockets)) + { + Attack_Finished (0.6); + rt = ((6 - self.reload_grenade_launcher) / 6); + rt = (4 - (4 * rt)); + self.reload_grenade_launcher = TF_FLARE_LIT; + if ((self.ammo_rockets < 6)) + { + self.reload_grenade_launcher = (6 - self.ammo_rockets); + } + sprint (self, 2, "reloading...\n"); + self.tfstate = (self.tfstate | 2); + tWeapon = spawn (); + tWeapon.owner = self; + tWeapon.classname = "timer"; + tWeapon.nextthink = (time + rt); + tWeapon.think = W_Reload_grenade_launcher; + self.weaponmodel = ""; + self.weaponframe = TF_FLARE_LIT; + } + else + { + sprint (self, 2, "not enough ammo to reload\n"); + } + } + else + { + if ((self.current_weapon == 8192)) + { + if ((self.reload_rocket_launcher == TF_FLARE_LIT)) + { + sprint (self, 2, "clip full.\n"); + return; + } + if ((self.reload_rocket_launcher < self.ammo_rockets)) + { + Attack_Finished (0.8); + rt = ((4 - self.reload_rocket_launcher) / 4); + rt = (5 - (5 * rt)); + self.reload_rocket_launcher = TF_FLARE_LIT; + if ((self.ammo_rockets < 4)) + { + self.reload_rocket_launcher = (4 - self.ammo_rockets); + } + sprint (self, 2, "reloading...\n"); + self.tfstate = (self.tfstate | 2); + tWeapon = spawn (); + tWeapon.owner = self; + tWeapon.classname = "timer"; + tWeapon.nextthink = (time + rt); + tWeapon.think = W_Reload_rocket_launcher; + self.weaponmodel = ""; + self.weaponframe = TF_FLARE_LIT; + } + } + } + } + } +}; + +void () CanisterTouch = +{ + sound (self, 1, "weapons/tink1.wav", 1, 1); + if ((self.velocity == '0 0 0')) + { + self.avelocity = '0 0 0'; + } +}; diff --git a/world.pqc b/world.pqc new file mode 100644 index 0000000..5a0af0f --- /dev/null +++ b/world.pqc @@ -0,0 +1,436 @@ +float headkick; + +void () InitBodyQue; + +void () main = +{ + dprint ("main function\n"); + precache_file ("main function\n"); + precache_file ("progs.dat"); + precache_file ("gfx.wad"); + precache_file ("quake.rc"); + precache_file ("default.cfg"); + precache_file ("end1.bin"); + precache_file2 ("end2.bin"); + precache_file ("demo1.dem"); + precache_file ("demo2.dem"); + precache_file ("demo3.dem"); + precache_file ("gfx/palette.lmp"); + precache_file ("gfx/colormap.lmp"); + precache_file2 ("gfx/pop.lmp"); + precache_file ("gfx/complete.lmp"); + precache_file ("gfx/inter.lmp"); + precache_file ("gfx/ranking.lmp"); + precache_file ("gfx/vidmodes.lmp"); + precache_file ("gfx/finale.lmp"); + precache_file ("gfx/conback.lmp"); + precache_file ("gfx/qplaque.lmp"); + precache_file ("gfx/menudot1.lmp"); + precache_file ("gfx/menudot2.lmp"); + precache_file ("gfx/menudot3.lmp"); + precache_file ("gfx/menudot4.lmp"); + precache_file ("gfx/menudot5.lmp"); + precache_file ("gfx/menudot6.lmp"); + precache_file ("gfx/menuplyr.lmp"); + precache_file ("gfx/bigbox.lmp"); + precache_file ("gfx/dim_modm.lmp"); + precache_file ("gfx/dim_drct.lmp"); + precache_file ("gfx/dim_ipx.lmp"); + precache_file ("gfx/dim_tcp.lmp"); + precache_file ("gfx/dim_mult.lmp"); + precache_file ("gfx/mainmenu.lmp"); + precache_file ("gfx/box_tl.lmp"); + precache_file ("gfx/box_tm.lmp"); + precache_file ("gfx/box_tr.lmp"); + precache_file ("gfx/box_ml.lmp"); + precache_file ("gfx/box_mm.lmp"); + precache_file ("gfx/box_mm2.lmp"); + precache_file ("gfx/box_mr.lmp"); + precache_file ("gfx/box_bl.lmp"); + precache_file ("gfx/box_bm.lmp"); + precache_file ("gfx/box_br.lmp"); + precache_file ("gfx/sp_menu.lmp"); + precache_file ("gfx/ttl_sgl.lmp"); + precache_file ("gfx/ttl_main.lmp"); + precache_file ("gfx/ttl_cstm.lmp"); + precache_file ("gfx/mp_menu.lmp"); + precache_file ("gfx/netmen1.lmp"); + precache_file ("gfx/netmen2.lmp"); + precache_file ("gfx/netmen3.lmp"); + precache_file ("gfx/netmen4.lmp"); + precache_file ("gfx/netmen5.lmp"); + precache_file ("gfx/sell.lmp"); + precache_file ("gfx/help0.lmp"); + precache_file ("gfx/help1.lmp"); + precache_file ("gfx/help2.lmp"); + precache_file ("gfx/help3.lmp"); + precache_file ("gfx/help4.lmp"); + precache_file ("gfx/help5.lmp"); + precache_file ("gfx/pause.lmp"); + precache_file ("gfx/loading.lmp"); + precache_file ("gfx/p_option.lmp"); + precache_file ("gfx/p_load.lmp"); + precache_file ("gfx/p_save.lmp"); + precache_file ("gfx/p_multi.lmp"); + precache_sound ("misc/menu1.wav"); + precache_sound ("misc/menu2.wav"); + precache_sound ("misc/menu3.wav"); + precache_sound ("ambience/water1.wav"); + precache_sound ("ambience/wind2.wav"); + precache_file ("maps/start.bsp"); + precache_file ("maps/e1m1.bsp"); + precache_file ("maps/e1m2.bsp"); + precache_file ("maps/e1m3.bsp"); + precache_file ("maps/e1m4.bsp"); + precache_file ("maps/e1m5.bsp"); + precache_file ("maps/e1m6.bsp"); + precache_file ("maps/e1m7.bsp"); + precache_file ("maps/e1m8.bsp"); + precache_file2 ("gfx/pop.lmp"); + precache_file2 ("maps/e2m1.bsp"); + precache_file2 ("maps/e2m2.bsp"); + precache_file2 ("maps/e2m3.bsp"); + precache_file2 ("maps/e2m4.bsp"); + precache_file2 ("maps/e2m5.bsp"); + precache_file2 ("maps/e2m6.bsp"); + precache_file2 ("maps/e2m7.bsp"); + precache_file2 ("maps/e3m1.bsp"); + precache_file2 ("maps/e3m2.bsp"); + precache_file2 ("maps/e3m3.bsp"); + precache_file2 ("maps/e3m4.bsp"); + precache_file2 ("maps/e3m5.bsp"); + precache_file2 ("maps/e3m6.bsp"); + precache_file2 ("maps/e3m7.bsp"); + precache_file2 ("maps/e4m1.bsp"); + precache_file2 ("maps/e4m2.bsp"); + precache_file2 ("maps/e4m3.bsp"); + precache_file2 ("maps/e4m4.bsp"); + precache_file2 ("maps/e4m5.bsp"); + precache_file2 ("maps/e4m6.bsp"); + precache_file2 ("maps/e4m7.bsp"); + precache_file2 ("maps/e4m8.bsp"); + precache_file2 ("maps/end.bsp"); + precache_file2 ("maps/dm1.bsp"); + precache_file2 ("maps/dm2.bsp"); + precache_file2 ("maps/dm3.bsp"); + precache_file2 ("maps/dm4.bsp"); + precache_file2 ("maps/dm5.bsp"); + precache_file2 ("maps/dm6.bsp"); +}; +entity lastspawn; + +void () worldspawn = +{ + lastspawn = world; + InitBodyQue (); + if ((infokey (world, "*gamedir") != "fortress")) + { + objerror ("QW TF must be run with a gamedir of \"fortress\".\n"); + } + W_Precache (); + precache_sound ("demon/dland2.wav"); + precache_sound ("misc/h2ohit1.wav"); + precache_sound ("items/itembk2.wav"); + precache_sound ("player/plyrjmp8.wav"); + precache_sound ("player/land.wav"); + precache_sound ("player/land2.wav"); + precache_sound ("player/drown1.wav"); + precache_sound ("player/drown2.wav"); + precache_sound ("player/gasp1.wav"); + precache_sound ("player/gasp2.wav"); + precache_sound ("player/h2odeath.wav"); + precache_sound ("misc/talk.wav"); + precache_sound ("player/teledth1.wav"); + precache_sound ("misc/r_tele1.wav"); + precache_sound ("misc/r_tele2.wav"); + precache_sound ("misc/r_tele3.wav"); + precache_sound ("misc/r_tele4.wav"); + precache_sound ("misc/r_tele5.wav"); + precache_sound ("weapons/lock4.wav"); + precache_sound ("weapons/pkup.wav"); + precache_sound ("items/armor1.wav"); + precache_sound ("weapons/lhit.wav"); + precache_sound ("weapons/lstart.wav"); + precache_sound ("weapons/asscan4.wav"); // 11.11.04 20mm cannon wav + precache_sound ("items/damage3.wav"); + precache_sound ("misc/power.wav"); + precache_sound ("player/gib.wav"); + precache_sound ("player/udeath.wav"); + precache_sound ("player/tornoff2.wav"); + precache_sound ("player/pain1.wav"); + precache_sound ("player/pain2.wav"); + precache_sound ("player/pain3.wav"); + precache_sound ("player/pain4.wav"); + precache_sound ("player/pain5.wav"); + precache_sound ("player/pain6.wav"); + precache_sound ("player/death1.wav"); + precache_sound ("player/death2.wav"); + precache_sound ("player/death3.wav"); + precache_sound ("player/death4.wav"); + precache_sound ("player/death5.wav"); + precache_sound ("player/malive5.wav"); + precache_sound ("weapons/ax1.wav"); + precache_sound ("player/axhit1.wav"); + precache_sound ("player/axhit2.wav"); + precache_sound ("player/h2ojump.wav"); + precache_sound ("player/slimbrn2.wav"); + precache_sound ("player/inh2o.wav"); + precache_sound ("player/inlava.wav"); + precache_sound ("misc/outwater.wav"); + precache_sound ("player/lburn1.wav"); + precache_sound ("player/lburn2.wav"); + precache_sound ("misc/water1.wav"); + precache_sound ("misc/water2.wav"); + precache_model ("progs/player.mdl"); + precache_model ("progs/eyes.mdl"); + precache_model ("progs/h_player.mdl"); + precache_model ("progs/gib1.mdl"); + precache_model ("progs/gib2.mdl"); + precache_model ("progs/gib3.mdl"); + precache_model ("progs/gib4.mdl"); + precache_model ("progs/s_null.spr"); +// precache_model ("progs/chute.mdl"); + precache_model ("progs/s_bubble.spr"); + precache_model ("progs/s_explod.spr"); +// precache_model ("progs/throwaxe.mdl"); + precache_model ("progs/v_axe.mdl"); + precache_model ("progs/v_shot.mdl"); +// precache_model ("progs/v_moss.mdl"); + precache_model ("progs/v_nail2.mdl"); + precache_model ("progs/v_rock.mdl"); + precache_model ("progs/v_shot2.mdl"); +// precache_model ("progs/w_uzi.mdl"); + precache_model ("progs/v_rock2.mdl"); + precache_model ("progs/grenade.mdl"); +// precache_model ("progs/bolt.mdl"); +// precache_model ("progs/bolt2.mdl"); +// precache_model ("progs/bolt3.mdl"); + precache_model ("progs/lavaball.mdl"); + precache_model ("progs/missile.mdl"); + precache_model ("progs/spike.mdl"); +// precache_model ("progs/s_spike.mdl"); + precache_model ("progs/backpack.mdl"); + precache_model ("progs/zom_gib.mdl"); +// precache_model ("progs/v_light.mdl"); + precache_model2 ("progs/laser.mdl"); + precache_sound2 ("enforcer/enfire.wav"); + precache_sound2 ("enforcer/enfstop.wav"); + precache_sound2 ("hknight/attack1.wav"); + precache_sound2 ("knight/sword2.wav"); +// precache_model2 ("progs/cross1.mdl"); + precache_model2 ("progs/v_medi.mdl"); + precache_model2 ("progs/v_bio.mdl"); + precache_model2 ("progs/hgren2.mdl"); + precache_model2 ("progs/biggren.mdl"); + precache_model2 ("progs/flare.mdl"); + precache_model2 ("progs/v_srifle.mdl"); +// precache_model2 ("progs/v_gatgun.mdl"); + precache_model2 ("progs/detpack.mdl"); + precache_model2 ("progs/ammobox.mdl"); + precache_model2 ("progs/v_knife.mdl"); + precache_model2 ("progs/v_knife2.mdl"); + precache_model2 ("progs/v_span.mdl"); +// precache_model2 ("progs/e_spike1.mdl"); +// precache_model2 ("progs/e_spike2.mdl"); + precache_model2 ("progs/v_rail.mdl"); + precache_model2 ("progs/turrgun.mdl"); + precache_model2 ("progs/turrbase.mdl"); + precache_model2 ("progs/tgib1.mdl"); + precache_model2 ("progs/tgib2.mdl"); + precache_model2 ("progs/tgib3.mdl"); + precache_model2 ("progs/disp.mdl"); + precache_model2 ("progs/dgib1.mdl"); + precache_model2 ("progs/dgib2.mdl"); + precache_model2 ("progs/dgib3.mdl"); + precache_model2 ("progs/grenade2.mdl"); + precache_model2 ("progs/v_grap.mdl"); + precache_model2 ("progs/hook.mdl"); +// precache_model2 ("progs/caltrop.mdl"); + precache_sound2 ("speech/saveme1.wav"); + precache_sound2 ("speech/saveme2.wav"); +// precache_sound ("ambience/subaqua.wav"); + precache_sound ("weapons/rifle.wav"); + precache_sound ("buttons/switch21.wav"); + precache_sound ("buttons/airbut1.wav"); +// precache_sound ("weapons/fith.wav"); + precache_sound ("weapons/detpack.wav"); + precache_sound ("weapons/radioair.wav"); + precache_sound ("weapons/notarget.wav"); + precache_sound ("weapons/airstrik.wav"); + precache_sound ("weapons/fighter.wav"); + precache_sound ("weapons/throw.wav"); + precache_sound ("weapons/prime.wav"); + precache_sound ("weapons/20mm.wav"); + precache_sound ("player/step1l.wav"); + precache_sound ("player/step2l.wav"); + precache_sound ("player/step1r.wav"); + precache_sound ("player/step2r.wav"); + precache_sound ("items/repair.wav"); + precache_sound ("misc/medkey.wav"); + precache_sound ("speech/pekaboo.wav"); + precache_sound ("speech/idoasskk.wav"); + precache_sound ("speech/pathetic.wav"); + precache_sound ("speech/call911.wav"); + precache_sound ("speech/kicknads.wav"); + precache_sound ("speech/radio/taken.wav"); + precache_sound ("speech/radio/capped.wav"); + precache_sound ("player/gas_mask.wav"); + precache_sound ("items/nightvis.wav"); + precache_sound ("speech/threat.wav"); + precache_sound ("speech/hey.wav"); + precache_sound ("speech/cmyhole.wav"); + precache_sound ("speech/pantsdwn.wav"); + precache_sound ("misc/eject.wav"); + precache_sound ("misc/startup.wav"); + precache_sound ("misc/enemy.wav"); +// precache_sound ("artifact/charging.wav"); + precache_sound ("zombie/z_hit.wav"); + precache_sound ("items/itembk2.wav"); + precache_sound ("items/health1.wav"); + precache_sound ("player/udeath.wav"); + precache_sound ("player/mpain6.wav"); + precache_sound ("player/death1.wav"); + precache_sound ("player/death2.wav"); + precache_sound ("player/death3.wav"); +// precache_sound ("player/mdeath4.wav"); + precache_sound ("player/mdeath5.wav"); + precache_sound2 ("enforcer/enfstop.wav"); + precache_sound2 ("enforcer/enfire.wav"); + precache_sound2 ("hknight/attack1.wav"); + precache_model ("progs/incenrkt.mdl"); +// precache_model ("progs/v_m162.mdl"); + precache_model ("progs/lavapool.mdl"); + precache_model ("progs/zom_gib.mdl"); +// precache_model ("progs/v_light.mdl"); + precache_model2 ("progs/v_bio.mdl"); + precache_model2 ("progs/hgren2.mdl"); + precache_model2 ("progs/biggren.mdl"); + precache_model2 ("progs/flare.mdl"); + // pablo's precaching. + // models + precache_model ("progs/proxgren.mdl"); + precache_model ("progs/v_asscan.mdl"); + precache_model ("progs/v_mac10.mdl"); + precache_model ("progs/dot1.spr"); + precache_model ("progs/dot2.spr"); + precache_model ("progs/dot3.spr"); + precache_model ("progs/dot4.spr"); + precache_model ("progs/rope.mdl"); + precache_model ("progs/dispencr.mdl"); + precache_model ("progs/tf_flag.mdl"); + + // sounds + precache_sound ("effects/beep.wav"); + precache_sound ("buttons/switch02.wav"); + precache_sound ("player/gib3.wav"); + precache_sound ("player/gib2.wav"); + precache_sound ("weapons/no_ammo.wav"); + precache_sound ("weapons/pkup.wav"); + // + + lightstyle (0, "m"); + lightstyle (1, "mmnmmommommnonmmonqnmmo"); + lightstyle (2, "abcdefghijklmnopqrstuvwxyzyxwvutsrqponmlkjihgfedcba"); + lightstyle (3, "mmmmmaaaaammmmmaaaaaabcdefgabcdefg"); + lightstyle (4, "mamamamamama"); + lightstyle (5, "jklmnopqrstuvwxyzyxwvutsrqponmlkj"); + lightstyle (6, "nmonqnmomnmomomno"); + lightstyle (7, "mmmaaaabcdefgmmmmaaaammmaamm"); + lightstyle (8, "mmmaaammmaaammmabcdefaaaammmmabcdefmmmaaaa"); + lightstyle (9, "aaaaaaaazzzzzzzz"); + lightstyle (10, "mmamammmmammamamaaamammma"); + lightstyle (11, "abcdefghijklmnopqrrqponmlkjihgfedcba"); + lightstyle (63, "a"); +}; +/*OLD +void () StartFrame = +{ + teamplay = cvar ("teamplay"); + timelimit = (cvar ("timelimit") * 60); + fraglimit = cvar ("fraglimit"); + deathmatch = cvar ("deathmatch"); + framecount = (framecount + 1); +}; +*/ +void () StartFrame = +{ + local string _l_3667; + + teamplay = cvar ("teamplay"); + timelimit = cvar ("timelimit") * 60; + fraglimit = cvar ("fraglimit"); + deathmatch = cvar ("deathmatch"); + framecount = framecount + 1; + if ((pointer_timeleft != world)) + { + return; + } + _l_3667 = infokey (world, "time"); + if (((_l_3667 == "off") || (_l_3667 == "0"))) + { + return; + } + newmis = spawn (); + newmis.classname = "countdown"; + newmis.no_grenades_1 = 0; + _l_3667 = infokey (world, "timelimit"); + newmis.health = stof (_l_3667); + newmis.think = review_timeleft; + newmis.nextthink = (time + 1); + pointer_timeleft = newmis; +}; + +entity bodyque_head; + +void () bodyque = +{ +}; + +void () InitBodyQue = +{ + bodyque_head = spawn (); + bodyque_head.classname = "bodyque"; + bodyque_head.owner = spawn (); + bodyque_head.owner.classname = "bodyque"; + bodyque_head.owner.owner = spawn (); + bodyque_head.owner.owner.classname = "bodyque"; + bodyque_head.owner.owner.owner = spawn (); + bodyque_head.owner.owner.owner.classname = "bodyque"; + bodyque_head.owner.owner.owner.owner = bodyque_head; +}; + +void () GibHead = +{ + ThrowGib ("progs/gib4.mdl", self.health); + ThrowGib ("progs/gib4.mdl", self.health); + ThrowGib ("progs/gib4.mdl", self.health); + ThrowGib ("progs/gib4.mdl", self.health); + ThrowGib ("progs/gib4.mdl", self.health); + ThrowGib ("progs/gib4.mdl", self.health); + setmodel (self, string_null); + self.solid = 0; +}; + +void (entity ent) CopyToBodyQue = +{ + bodyque_head.angles = ent.angles; + bodyque_head.model = ent.model; + bodyque_head.skin = ent.skin; + bodyque_head.modelindex = ent.modelindex; + bodyque_head.frame = ent.frame; + bodyque_head.colormap = ent.colormap; + bodyque_head.movetype = ent.movetype; + if (headkick) + { + bodyque_head.solid = ent.solid; + bodyque_head.touch = ent.touch; + bodyque_head.takedamage = 2; + bodyque_head.health = 1; + bodyque_head.th_die = GibHead; + } + bodyque_head.velocity = ent.velocity; + bodyque_head.flags = 0; + setorigin (bodyque_head, ent.origin); + setsize (bodyque_head, ent.mins, ent.maxs); + bodyque_head = bodyque_head.owner; +}; \ No newline at end of file diff --git a/xavior.pqc b/xavior.pqc new file mode 100644 index 0000000..41b62ef --- /dev/null +++ b/xavior.pqc @@ -0,0 +1,450 @@ +////////////////////////////// +// Some random crap I added // +// (Note: this is not the // +// vote code, I put that in // +// rpg.pqc). // +////////////////////////////// + +// Periodic server messages +// For those servers that dont have this function built-in + +void() messagetimer = +{ + if (infokey (world, "message1")) + { + newmis = spawn(); + newmis.classname = "timer"; + newmis.nextthink = time + msg1time; + newmis.think = display_message; + } +}; + +void() display_message = +{ + if (msg1first == 0) + { + msg1first = 1; + newmis = spawn(); + newmis.classname = "timer"; + newmis.nextthink = time + 5; + newmis.think = display_message; + return; + } + local string messageONE; + messageONE = (infokey (world, "message1")); + if (num_players > 0) + { + localcmd ("say "); + localcmd (messageONE); + localcmd ("\n"); + } + messagetimer (); + dremove (self); +}; + +void() messagetimer2 = +{ + if (infokey (world, "message2")) + { + newmis = spawn(); + newmis.classname = "timer"; + newmis.nextthink = time + msg2time; + newmis.think = display_message2; + } +}; + +void() display_message2 = +{ + if (msg2first == 0) + { + msg2first = 1; + newmis = spawn(); + newmis.classname = "timer"; + newmis.nextthink = time + 5; + newmis.think = display_message2; + return; + } + local string message2; + message2 = (infokey (world, "message2")); + if (num_players > 0) + { + localcmd ("say "); + localcmd (message2); + localcmd ("\n"); + } + messagetimer2 (); + dremove (self); +}; + +void() pre_messagetimer2 = +{ + local string msgd; + msgd = infokey (world, "svmsg_delay"); + msgdelay = stof(msgd); + if (msgdelay > 0) + { + newmis = spawn(); + newmis.classname = "timer"; + newmis.nextthink = time + msgdelay; + newmis.think = display_message2; + return; + } + else + { + messagetimer2 (); + } +}; + +// 11.11.04 code for the stats_dl function. +void (float _p_2420) Stats_Fired = +{ + + if ((self.stats_on == 1)) + { + stuffcmd (self, "inc "); + if ((_p_2420 == 8)) + { + stuffcmd (self, "stats_axe_f"); + } + else + { + if ((_p_2420 == 16)) + { + stuffcmd (self, "stats_axe_f"); + } + else + { + if ((_p_2420 == 1)) + { + stuffcmd (self, "stats_grap_f"); + } + else + { + if ((_p_2420 == 128)) + { + stuffcmd (self, "stats_sg_f"); + } + else + { + if ((_p_2420 == 256)) + { + stuffcmd (self, "stats_ssg_f"); + } + else + { + if ((_p_2420 == 512)) + { + stuffcmd (self, "stats_ng_f"); + } + else + { + if ((_p_2420 == 1024)) + { + stuffcmd (self, "stats_sng_f"); + } + else + { + if (((_p_2420 == 2048) && (self.weaponmode == 1))) + { + stuffcmd (self, "stats_pb_f"); + } + else + { + if ((_p_2420 == 2048)) + { + stuffcmd (self, "stats_gl_f"); + } + else + { + if ((_p_2420 == 8192)) + { + stuffcmd (self, "stats_rl_f"); + } + else + { + if ((_p_2420 == 32)) + { + stuffcmd (self, "stats_sr_f"); + } + else + { + if ((_p_2420 == 64)) + { + stuffcmd (self, "stats_mg_f"); + } + else + { + if (((_p_2420 == 32768) && (self.option4 == 1))) + { + stuffcmd (self, "stats_20mm_f"); + } + else + { + if ((_p_2420 == 32768)) + { + stuffcmd (self, "stats_ac_f"); + } + else + { + if ((_p_2420 == 4096)) + { + stuffcmd (self, "stats_ft_f"); + } + else + { + if ((_p_2420 == 16384)) + { + stuffcmd (self, "stats_incend_f"); + } + else + { + if ((_p_2420 == 4)) + { + stuffcmd (self, "stats_ba_f"); + } + else + { + if ((_p_2420 == 2)) + { + stuffcmd (self, "stats_ba_f"); + } + else + { + if ((_p_2420 == 262144)) + { + stuffcmd (self, "stats_tranq_f"); + } + else + { + if ((_p_2420 == 524288)) + { + stuffcmd (self, "stats_rg_f"); + } + else + { + if ((_p_2420 == 666)) + { + stuffcmd (self, "stats_g1_f"); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + stuffcmd (self, " 1\n"); + } +}; + +void (float _p_2445) Stats_Hit = +{ + + if ((self.stats_on == 1)) + { + stuffcmd (self, "inc "); + if ((_p_2445 == 8)) + { + stuffcmd (self, "stats_axe_h"); + } + else + { + if ((_p_2445 == 16)) + { + stuffcmd (self, "stats_axe_h"); + } + else + { + if ((_p_2445 == 1)) + { + stuffcmd (self, "stats_grap_h"); + } + else + { + if ((_p_2445 == 128)) + { + stuffcmd (self, "stats_sg_h"); + } + else + { + if ((_p_2445 == 256)) + { + stuffcmd (self, "stats_ssg_h"); + } + else + { + if ((_p_2445 == 512)) + { + stuffcmd (self, "stats_ng_h"); + } + else + { + if ((_p_2445 == 1024)) + { + stuffcmd (self, "stats_sng_h"); + } + else + { + if ((_p_2445 == 2054)) + { + stuffcmd (self, "stats_pb_h"); + } + else + { + if ((_p_2445 == 2048)) + { + stuffcmd (self, "stats_gl_h"); + } + else + { + if ((_p_2445 == 8192)) + { + stuffcmd (self, "stats_rl_h"); + } + else + { + if ((_p_2445 == 34)) + { + stuffcmd (self, "stats_sr_h 1\n inc "); + stuffcmd (self, "stats_sr_hs"); + } + else + { + if ((_p_2445 == 33)) + { + stuffcmd (self, "stats_sr_h 1\n inc "); + stuffcmd (self, "stats_sr_ls"); + } + else + { + if ((_p_2445 == 32)) + { + stuffcmd (self, "stats_sr_h 1\n inc "); + stuffcmd (self, "stats_sr_cs"); + } + else + { + if ((_p_2445 == 64)) + { + stuffcmd (self, "stats_mg_h"); + } + else + { + if (((_p_2445 == 32768) && (self.option4 == 1))) + { + stuffcmd (self, "stats_20mm_h"); + } + else + { + if ((_p_2445 == 32768)) + { + stuffcmd (self, "stats_ac_h"); + } + else + { + if ((_p_2445 == 4096)) + { + stuffcmd (self, "stats_ft_h"); + } + else + { + if ((_p_2445 == 16384)) + { + stuffcmd (self, "stats_incend_h"); + } + else + { + if ((_p_2445 == 4)) + { + stuffcmd (self, "stats_ba_h"); + } + else + { + if ((_p_2445 == 2)) + { + stuffcmd (self, "stats_ba_h"); + } + else + { + if ((_p_2445 == 262144)) + { + stuffcmd (self, "stats_tranq_h"); + } + else + { + if ((_p_2445 == 524288)) + { + stuffcmd (self, "stats_rg_h"); + } + else + { + if ((_p_2445 == 666)) + { + stuffcmd (self, "stats_g1_h"); + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + stuffcmd (self, " 1\n"); + } +}; + +// PM User-ID listings +//Shows the list of users and userids. Note that this is only the same as the built-in "users" function +//when you are running a server that supports getuserid() (so basically only prozac and hughie's modded eq). +//If you are running a server that supports that function, be sure to have "localinfo prozacserver" set to 1. +void() pm_list = +{ + local entity entar; + local string str; + + entar = find(world, classname, "player"); + while(entar) + { + if (entar.userid != 0) + { + str = ftos(entar.userid); + sprint (self, 2, str); + sprint (self, 2, " "); + sprint (self, 2, entar.netname); + sprint (self, 2, "\n"); + } + entar = find(entar, classname, "player"); + } +}; + +void () testfunct = +{ +} \ No newline at end of file