diff --git a/quakec/fallout2/buttons.qc b/quakec/fallout2/buttons.qc index 1df47c9a5..153b3be08 100644 --- a/quakec/fallout2/buttons.qc +++ b/quakec/fallout2/buttons.qc @@ -53,6 +53,9 @@ void() button_use = void() button_touch = { + if (!triggercantouch(self, other)) + return; + if (other.classname != "player") return; self.enemy = other; diff --git a/quakec/fallout2/client.qc b/quakec/fallout2/client.qc index 206d94b52..fc7b383ca 100644 --- a/quakec/fallout2/client.qc +++ b/quakec/fallout2/client.qc @@ -37,8 +37,13 @@ void() info_intermission = +void() DecodeLevelParms; + void() SetChangeParms = { + if (!self.current_slot) //changing without spawning? + DecodeLevelParms(); //make sure we have our inventory! + /* if (self.health <= 0) { @@ -91,29 +96,33 @@ void() SetChangeParms = void() SetNewParms = { //remember, don't use self! - parm1 = IID_WP_USP; - parm2 = IID_WP_KNIFE; - parm3 = IID_ARM_SHIRT; - parm4 = 0; - parm5 = 0; - parm6 = 0; - parm7 = 0; - parm8 = 8; +// parm1 = IID_WP_USP; +// parm2 = IID_WP_KNIFE; +// parm3 = IID_ARM_SHIRT; +// parm4 = 0; +// parm5 = 0; +// parm6 = 0; +// parm7 = 0; + parm8 = 8; //starting cash parm9 = 0; parm10 = 0; - parm11 = 0; - parm12 = 0; +// parm11 = 0; +// parm12 = 0; //parm13 = 0; parm14 = 0; - parm15 = 0; +// parm15 = 0; - parm16 = 1; - parm17 = SlotVal(IID_WP_USP, 12); +//16 is the current_slot +//17 to 32 are inventory slots. +//the assignments were moved into PutClientInServer +//on account of changing maps before spawning was resulting in no inventory. + parm16 = 0; + parm17 = 0; parm18 = 0; - parm19 = SlotVal(IID_ARM_SHIRT, 1); - parm20 = SlotVal(IID_CHEM_STIMPACK, 3); - parm21 = SlotVal(IID_AM_10MM, 24); + parm19 = 0; + parm20 = 0; + parm21 = 0; parm22 = 0; parm23 = 0; parm24 = 0; @@ -401,8 +410,8 @@ entity() SelectSpawnPoint = if (coop == 1) ent1 = "info_player_coop"; else - ent1 = "spawn3"; - + ent1 = "spawn3"; + if (ent1 == "spawn3") { if (self.team == 1) @@ -532,23 +541,49 @@ void() PutClientInServer = DecodeLevelParms (); - if (self.class == 1) +bprint(PRINT_HIGH, "current slot="); +bprint(PRINT_HIGH, ftos(self.current_slot)); +bprint(PRINT_HIGH, "\n"); + if (self.current_slot == 0) { - x = SlotOfItem(self, IID_CHEM_MEDICALBAG); - if (x == 0) - AddNonStackable(self, IID_CHEM_MEDICALBAG, 1); - } - if (self.class == 2) - { - x = SlotOfItem(self, IID_EQUIP_STEALTHBOY); - if (x == 0) - AddNonStackable(self, IID_EQUIP_STEALTHBOY, 1); - } - if (self.class == 4) - { - x = SlotOfItem(self, IID_WP_TOOLKIT); - if (x == 0) - AddNonStackable(self, IID_WP_TOOLKIT, 1); + self.current_slot = 1; + self.islot1 = SlotVal(IID_WP_USP, 12); + self.islot2 = 0; + self.islot3 = SlotVal(IID_ARM_SHIRT, 1); + self.islot4 = SlotVal(IID_CHEM_STIMPACK, 3); + self.islot5 = SlotVal(IID_AM_10MM, 24); + self.islot6 = 0; + self.islot7 = 0; + self.islot8 = 0; + self.islot9 = 0; + self.islot10 = 0; + self.islot11 = 0; + self.islot12 = 0; + self.islot13 = 0; + self.islot14 = 0; + self.islot15 = 0; + self.islot16 = 0; + +//now give them special items for thier class. +//you're fairly screwed if you change class. + if (self.class == 1) + { + x = SlotOfItem(self, IID_CHEM_MEDICALBAG); + if (x == 0) + AddNonStackable(self, IID_CHEM_MEDICALBAG, 1); + } + if (self.class == 2) + { + x = SlotOfItem(self, IID_EQUIP_STEALTHBOY); + if (x == 0) + AddNonStackable(self, IID_EQUIP_STEALTHBOY, 1); + } + if (self.class == 4) + { + x = SlotOfItem(self, IID_WP_TOOLKIT); + if (x == 0) + AddNonStackable(self, IID_WP_TOOLKIT, 1); + } } self.attack_finished = time; @@ -826,7 +861,7 @@ void () LocateSpectatorTarget = local entity ke; local entity de; - if (self.button1) + if (self.button0) { bprint(PRINT_MEDIUM, self.classname); bprint(PRINT_MEDIUM, " is dying...\n"); @@ -1081,19 +1116,6 @@ void() CheckWaterJump = } }; -void () SpeedControl = -{ - - self.maxspeed = 200; - - if (self.position == 1) - self.maxspeed = self.maxspeed * 0.50; - if (self.position == 2) - self.maxspeed = self.maxspeed * 0.25; - if (self.currentmenu != "none") - self.maxspeed = 0; -}; - void() ArmorCheck = { local float type; @@ -1171,13 +1193,13 @@ void () WeightControl = self.weight = wt; if (self.class == 1) - self.max_weight = 20; + self.max_weight = 50; if (self.class == 2) - self.max_weight = 20; + self.max_weight = 50; if (self.class == 3) - self.max_weight = 30; + self.max_weight = 60; if (self.class == 4) - self.max_weight = 15; + self.max_weight = 40; }; @@ -1199,12 +1221,19 @@ void () PositionControl = if (self.position == 2) setsize (self, '-16 -16 -24', '16 16 0'); + + if (self.currentmenu != "none") + { + self.maxspeed = 0; + return; + } + if (self.position == 0) - self.maxspeed = 300; + self.maxspeed = 200; else if (self.position == 1) - self.maxspeed = 150; + self.maxspeed = 100; else //if (self.position == 2) - self.maxspeed = 75; + self.maxspeed = 50; if (self.weight > self.max_weight) //this is the penalty for being overweight. { @@ -1212,6 +1241,14 @@ void () PositionControl = exp = (exp+2)*(exp+2)+(exp*exp*exp*8); //is this enough? self.maxspeed = self.maxspeed / exp; } + + if (self.equipment_slot) + { + if ((ToIID(ItemInSlot(self, self.equipment_slot))) == IID_EQUIP_SPRINTKIT) + self.maxspeed = self.maxspeed*2; + if ((ToIID(ItemInSlot(self, self.equipment_slot))) == IID_EQUIP_STEALTHBOY) + self.maxspeed = self.maxspeed/2; + } }; .float gravity; @@ -1254,7 +1291,6 @@ void() PlayerPreThink = Identify(); PositionControl(); - SpeedControl(); WeightControl(); ArmorCheck(); Crosshair(); @@ -1405,9 +1441,16 @@ void() PlayerPreThink = { self.gravity = 1; } + self.attack_finished = time + 0.1; + } + if ((ToIID(ItemInSlot(self, self.equipment_slot))) == IID_EQUIP_HOVERBOOTS && self.button2) + { + if (self.attack_finished < time) + { + self.velocity = self.velocity + v_up*800*0.4; + self.attack_finished = time + 0.4; + } } - else - dprint("Bad equipment item\n"); } }; @@ -1424,6 +1467,10 @@ void() CheckPowerups = return; // invisibility + if (self.equipment_slot) + if ((ToIID(ItemInSlot(self, self.equipment_slot))) == IID_EQUIP_STEALTHBOY) + goto beinvis; + if (self.invisible_finished) { // sound and screen flash when items starts to run out @@ -1453,16 +1500,19 @@ void() CheckPowerups = if (self.invisible_finished < time) { // just stopped - self.items = self.items - IT_INVISIBILITY; self.invisible_finished = 0; self.invisible_time = 0; } +:beinvis + self.items = self.items | IT_INVISIBILITY; // use the eyes self.frame = 0; self.modelindex = modelindex_eyes; } else + { + self.items = self.items - (self.items & IT_INVISIBILITY); if (self.position <= 1) self.modelindex = modelindex_player; if (self.position == 2) @@ -1475,6 +1525,7 @@ void() CheckPowerups = self.modelindex = modelindex_dead; if (self.ghost == 1 || self.class == 0 || self.team == 0) self.modelindex = modelindex_gone; + } // invincibility diff --git a/quakec/fallout2/cmds.qc b/quakec/fallout2/cmds.qc index 17da88404..1a2167d00 100644 --- a/quakec/fallout2/cmds.qc +++ b/quakec/fallout2/cmds.qc @@ -108,7 +108,9 @@ void(string arg1) Cmd_InvUse = iid == IID_BUILD_SHIELDGEN || iid == IID_BUILD_AUTODOC || iid == IID_BUILD_ROBOFANG || - iid == IID_BUILD_TESLA) + iid == IID_BUILD_TTURRET || + iid == IID_BUILD_RTURRET || + iid == IID_BUILD_GTURRET) { if (spawn_station(iid)) DecreaseDestroySlot(slotno); @@ -129,6 +131,48 @@ void(string arg1) Cmd_InvUse = } return; } + if (iid == IID_EQUIP_SPRINTKIT) + { + if (self.equipment_slot == slotno) + { + self.equipment_slot = 0; + sprint(self, PRINT_HIGH, "What a downer\n"); + } + else + { + self.equipment_slot = slotno; + sprint(self, PRINT_HIGH, "SUGAR RUSH!!!\n"); + } + return; + } + if (iid == IID_EQUIP_STEALTHBOY) + { + if (self.equipment_slot == slotno) + { + self.equipment_slot = 0; + sprint(self, PRINT_HIGH, "stealthboy deactivated\n"); + } + else + { + self.equipment_slot = slotno; + sprint(self, PRINT_HIGH, "stealthboy activated, fading into the shadows\n"); + } + return; + } + if (iid == IID_EQUIP_HOVERBOOTS) + { + if (self.equipment_slot == slotno) + { + self.equipment_slot = 0; + sprint(self, PRINT_HIGH, "Hoverboots deactivated\n"); + } + else + { + self.equipment_slot = slotno; + sprint(self, PRINT_HIGH, "Hoverboots activated\n"); + } + return; + } sprint(self, PRINT_HIGH, "Don't know how to 'use' item\n"); }; @@ -193,6 +237,12 @@ void(string arg1, string arg2) Cmd_InvSwap = if (slotno1 == self.current_slot || slotno2 == self.current_slot) W_SetCurrentAmmo(); +//swap the equipment_slot over too. + if (self.equipment_slot == slotno1) + self.equipment_slot = slotno2; + else if (self.equipment_slot == slotno2) + self.equipment_slot = slotno1; + self.rtime = time + 2; //we don't check this here though - cost to get into inventory. }; @@ -206,6 +256,12 @@ void(string arg1, float iid, float num) Cmd_InvGive = return; } + if (!FitsInSlot(slotno, iid)) + { + sprint(self, PRINT_MEDIUM, "Can't give that item in that slot\n"); + return; + } + if (num <= 0) num = 1; SetItemSlot(self, slotno, SlotVal(iid, num)); diff --git a/quakec/fallout2/defs.qc b/quakec/fallout2/defs.qc index b677a0986..9b268c142 100644 --- a/quakec/fallout2/defs.qc +++ b/quakec/fallout2/defs.qc @@ -213,7 +213,8 @@ void end_sys_fields; // flag for structure dumping //================================================ - +#define team team_no +.float team_no; float parm17, parm18, parm18, parm19, parm20, parm21, parm22, parm23, parm24, parm25, parm26, parm27, parm28, parm29, parm30, parm31, parm32; diff --git a/quakec/fallout2/doors.qc b/quakec/fallout2/doors.qc index a39adbb80..8b0332739 100644 --- a/quakec/fallout2/doors.qc +++ b/quakec/fallout2/doors.qc @@ -127,6 +127,9 @@ void () door_use = void () door_trigger_touch = { + if (!triggercantouch(self, other)) + return; + if ((other.health <= MULTICAST_ALL)) { return; @@ -205,6 +208,9 @@ void (entity portal, entity toucher) SpawnOpenDoor = void () door_touch = { + if (!triggercantouch(self, other)) + return; + if (other.classname != "player") return; @@ -264,6 +270,7 @@ entity (vector fmins, vector fmaxs) spawn_field = local vector t2; trigger = spawn (); + trigger.team = self.team; trigger.movetype = MOVETYPE_NONE; trigger.solid = SOLID_TRIGGER; trigger.owner = self; @@ -655,6 +662,8 @@ void () secret_blocked = void () secret_touch = { + if (!triggercantouch(self, other)) + return; if ((other.classname != "player")) { return; diff --git a/quakec/fallout2/inventory.qc b/quakec/fallout2/inventory.qc index 806717379..0c1ab8ef5 100644 --- a/quakec/fallout2/inventory.qc +++ b/quakec/fallout2/inventory.qc @@ -80,11 +80,15 @@ float IID_BUILD_MRAMMO = 350; float IID_BUILD_SHIELDGEN = 351; float IID_BUILD_AUTODOC = 352; float IID_BUILD_ROBOFANG = 353; -float IID_BUILD_TESLA = 354; -//float IID_BUILD_TELEPAD = 355; +float IID_BUILD_TTURRET = 354; +float IID_BUILD_TELEPAD = 355; +float IID_BUILD_RTURRET = 356; +float IID_BUILD_GTURRET = 357; float IID_EQUIP_CLIMBINGGEAR = 375; float IID_EQUIP_STEALTHBOY = 376; +float IID_EQUIP_SPRINTKIT = 377; +float IID_EQUIP_HOVERBOOTS = 378; #define IsShootable(iid) (IsMelee(iid) || IsRanged(iid) || IsGrenade(iid)) @@ -753,6 +757,12 @@ float(float iid) GetItemWeight = return 3; if (iid == IID_BUILD_ROBOFANG) return 2; + if (iid == IID_BUILD_TTURRET) + return 3; + if (iid == IID_BUILD_GTURRET) + return 3; + if (iid == IID_BUILD_RTURRET) + return 3; // bprint(PRINT_MEDIUM, ftos(iid), " without a weight!\n"); @@ -904,11 +914,21 @@ string(float iid) GetItemName = return "auto-doc"; if (iid == IID_BUILD_ROBOFANG) return "robofang"; + if (iid == IID_BUILD_TTURRET) + return "tesla turret"; + if (iid == IID_BUILD_RTURRET) + return "rocket turret"; + if (iid == IID_BUILD_GTURRET) + return "machine-gun turret"; if (iid == IID_EQUIP_CLIMBINGGEAR) return "climbing gear"; if (iid == IID_EQUIP_STEALTHBOY) return "stealthboy"; + if (iid == IID_EQUIP_SPRINTKIT) + return "lucozade sport!"; + if (iid == IID_EQUIP_HOVERBOOTS) + return "hover boots"; bprint(PRINT_MEDIUM, ftos(iid), " without a name!\n"); return strcat("unknown", ftos(iid)); @@ -1066,11 +1086,19 @@ string(float iid) GetItemImage = return "autodoc.jpg"; if (iid == IID_BUILD_ROBOFANG) return "robofang.jpg"; + if (iid == IID_BUILD_TTURRET) + return "tesla.jpg"; + if (iid == IID_BUILD_RTURRET) + return "rturret.jpg"; + if (iid == IID_BUILD_GTURRET) + return "gturret.jpg"; if (iid == IID_EQUIP_CLIMBINGGEAR) return "robofang.jpg"; if (iid == IID_EQUIP_STEALTHBOY) return "stealthboy.jpg"; + if (iid == IID_EQUIP_SPRINTKIT) + return "sprintkit.jpg"; bprint(PRINT_MEDIUM, ftos(iid), " without a name!\n"); return strcat("unknown.jpg", ftos(iid)); @@ -1198,6 +1226,12 @@ float(string itname) ItemIDOfName = if (itname == "stealthboy") return IID_EQUIP_STEALTHBOY; + if (itname == "sprintkit") + return IID_EQUIP_SPRINTKIT; + + if (itname == "tesla") + return IID_BUILD_TTURRET; + return 0; }; diff --git a/quakec/fallout2/items.qc b/quakec/fallout2/items.qc index d64a646f2..c8c319d2b 100644 --- a/quakec/fallout2/items.qc +++ b/quakec/fallout2/items.qc @@ -279,11 +279,12 @@ float (entity to, float iid, float quant) TryGiveStackable = if (slot > 2) { item = ItemInSlot(to, slot); - if (ToStatus(item) + quant > 100) //100 is our maxstack value here + if (ToStatus(item) + quant > 500) //500 is our maxstack value here { - quant = quant + ToStatus(item) - 100; - SetItemSlot(to, slot, SlotVal(iid, 100)); + quant = quant + ToStatus(item) - 500; + SetItemSlot(to, slot, SlotVal(iid, 500)); slot = 0; + return false; } else quant = quant + ToStatus(item); @@ -292,7 +293,7 @@ float (entity to, float iid, float quant) TryGiveStackable = return true; if (slot == 0) { - slot = SlotOfItem(to, 0); + slot = FindSuitableEmptySlot(to, iid); if (slot == 0) return false; } @@ -304,6 +305,9 @@ float (entity to, float iid, float quant) TryGiveStackable = void () health_touch = { + if (!triggercantouch(self, other)) + return; + if (other.classname != "player" || other.ghost != 0) return; @@ -373,6 +377,9 @@ void() armor_touch; void() armor_touch = { local float type, value, bit; + + if (!triggercantouch(self, other)) + return; if (other.health <= 0) return; @@ -564,6 +571,9 @@ void() weapon_touch = // For client weapon_switch local float w_switch; + if (!triggercantouch(self, other)) + return; + if (!(other.flags & FL_CLIENT)) return; @@ -861,6 +871,9 @@ void() ammo_touch = local string ammoname, ammocountftos; local float best, ammotype, ammocount; + if (!triggercantouch(self, other)) + return; + if (other.classname != "player") return; if (other.health <= 0) @@ -1170,6 +1183,9 @@ KEYS void() key_touch = { + if (!triggercantouch(self, other)) + return; + if (other.classname != "player") return; if (other.health <= 0) @@ -1300,6 +1316,9 @@ END OF LEVEL RUNES void() sigil_touch = { + if (!triggercantouch(self, other)) + return; + if (other.classname != "player") return; if (other.health <= 0) @@ -1370,6 +1389,9 @@ void() powerup_touch; void() powerup_touch = { + if (!triggercantouch(self, other)) + return; + if (other.classname != "player") return; if (other.health <= 0) diff --git a/quakec/fallout2/menus.qc b/quakec/fallout2/menus.qc index fe4fba413..0f9998670 100644 --- a/quakec/fallout2/menus.qc +++ b/quakec/fallout2/menus.qc @@ -36,47 +36,123 @@ weaponry\n\n string () ShopString = { - return ("--- S H O P -------\n\n1‘ traits \n2‘ perks \n3‘ body armour \n4‘ protection \n5‘ weapons \n6‘ equipment \n7‘ chems \n8‘ special \ne‘ leave \n"); + return ("--- S H O P -------\n" + "\n" + "1‘ traits \n" + "2‘ perks \n" + "3‘ body armour \n" + "4‘ protection \n" + "5‘ weapons \n" + "6‘ equipment \n" + "7‘ chems \n" + "8‘ special \n" + "e‘ leave \n"); }; string () WeaponString = { - return ("weaponry\n\n1‘ melee \n2‘ thrown \n3‘ pistols&smgs \n4‘ shotguns \n5‘ rifles \n6‘ heavy guns \ne‘ leave \n"); + return ("weaponry\n" + "\n" + "1‘ melee \n" + "2‘ thrown \n" + "3‘ pistols&smgs \n" + "4‘ shotguns \n" + "5‘ rifles \n" + "6‘ heavy guns \n" + "e‘ leave \n"); }; string () TraitString = { - return ("traits\n\n1‘ one handed \n2‘ small frame \n3‘ bruiser \n4‘ heavy handed \n5‘ bloody mess \n6‘ bad luck \ne‘ leave \n"); + return ("traits\n" + "\n" + "1‘ one handed \n" + "2‘ small frame \n" + "3‘ bruiser \n" + "4‘ heavy handed \n" + "5‘ bloody mess \n" + "6‘ bad luck \n" + "e‘ leave \n"); }; string () ThrownString = { - return ("grenades\n GRENADE | COST \n\n1‘ smoke grenade 3$\n2‘ frag grenade 4$\n3‘ emp grenade 5$\n4‘ flashbang 7$\ne‘ exit \n"); + return ("grenades\n" + " GRENADE | COST \n" + "\n" + "1‘ smoke grenade 3$\n" + "2‘ frag grenade 4$\n" + "3‘ emp grenade 5$\n" + "4‘ flashbang 7$\n" + "e‘ exit \n"); }; string () BuildString = { - return ("BUILD A STRUCTURE\n NAME | UPGRADE | SCRAPS\n\n1‘ Mr. Ammo 4\n2‘ Barricade 6\n3‘ AutoDoc(tm) 10\n4‘ Robo-Fang 11\ne‘ exit \n"); + return ("BUILD A STRUCTURE\n" + " NAME | UPGRADE | SCRAPS\n" + "\n" + "1‘ Mr. Ammo 4\n" + "2‘ Barricade 6\n" + "3‘ AutoDoc(tm) 10\n" + "4‘ Robo-Fang 11\n" + "e‘ exit \n"); }; string () HelmetString = { - return ("helmets\nprotect you from headshots so\nmake sure you use a decent one\n\n ABS% WT DEFLECT PRC\n1‘ combat helm -10% 01 5% 05\n2‘ combat helm 2 +0% 02 5% 20\n3‘ heavy-duty +20% 03 5% 20\n4‘ ceramic helm -20% ..."); + return ("helmets\n" + "protect you from headshots so\n" + "make sure you use a decent one\n" + "\n" + " ABS% WT DEFLECT PRC\n" + "1‘ combat helm -10% 01 5% 05\n" + "2‘ combat helm 2 +0% 02 5% 20\n" + "3‘ heavy-duty +20% 03 5% 20\n" + "4‘ ceramic helm -20% ..."); }; string () ArmorString = { - return ("body armour wt abs prc\n\n1‘ light kevlar 03 1/20% 03$\n2‘ leather armor 05 2/30% 08$\n3‘ kevlar armor 09 3/35% 10$\n4‘ metal armor 15 5/35% 12$\n5‘ combat armor 12 4/40% 25$\n6‘ brotherhood armor 17 5/45% 35$\n7‘ force armor 06 7/10% 45$\n8‘ metal armor mkii 20 8/50% 55$\n"); + return ("body armour wt abs prc\n" + "\n" + "1‘ light kevlar 03 1/20% 03$\n" + "2‘ leather armor 05 2/30% 08$\n" + "3‘ kevlar armor 09 3/35% 10$\n" + "4‘ metal armor 15 5/35% 12$\n" + "5‘ combat armor 12 4/40% 25$\n" + "6‘ brotherhood armor 17 5/45% 35$\n" + "7‘ force armor 06 7/10% 45$\n" + "8‘ metal armor mkii 20 8/50% 55$\n"); }; string () PerkString = { - return ("perks\n ABILITY | FRAGS NEEDED \n\n1‘ bonus movement 2\n2‘ strong back 2\n3‘ quick pockets 2\n4‘ awareness 2\n5‘ silent running 3\n6‘ better criticals 3\n7‘ bonus ranged damage 3\n8‘ divine favor 3\n9‘ slayer 3\n0‘ sharpshooter 4\n"); + return ("perks\n" + " ABILITY | FRAGS NEEDED \n" + "\n" + "1‘ bonus movement 2\n" + "2‘ strong back 2\n" + "3‘ quick pockets 2\n" + "4‘ awareness 2\n" + "5‘ silent running 3\n" + "6‘ better criticals 3\n" + "7‘ bonus ranged damage 3\n" + "8‘ divine favor 3\n" + "9‘ slayer 3\n" + "0‘ sharpshooter 4\n"); }; string () ProtectString = { - return ("++ high-tech protective devices ++ \n\n HARDWARE | SHIELDS VS | PRICE \n1‘ energy amulet |damage: 7% 15‘\n2‘ force field |front: 15% 20‘\n3‘ safety ring |absorb: 3 35‘\n4‘ smokescreen |obscures 40‘\n5‘ sentient cube |regenerate 45‘\n"); + return ("++ high-tech protective devices ++ \n" + "\n" + " HARDWARE | SHIELDS VS | PRICE \n" + "1‘ energy amulet |damage: 7% 15‘\n" + "2‘ force field |front: 15% 20‘\n" + "3‘ safety ring |absorb: 3 35‘\n" + "4‘ smokescreen |obscures 40‘\n" + "5‘ sentient cube |regenerate 45‘\n"); }; @@ -97,17 +173,24 @@ string () OtherString = "\n" "\n" "1‘ (25) bandages for medic 2$\n" - "2‘ (5) metal scraps 5$\n" - "3‘ (20) mr.ammo! 20$\n" - "4‘ (20) auto-doc! 20$\n" - "5‘ (20) shield-gen! 20$\n" + "3‘ (20) mr.ammo 20$\n" + "4‘ (20) auto-doc 20$\n" + "5‘ (20) shield-gen 20$\n" + "6‘ (20) tesla-turret 20$\n" ; }; string () MeleeString = { - return ("MELEE WEAPONS\nWEAPON | TYPE | WT | PRICE \n\n1‘ knife melee 01 01$\n2‘ hand axe melee 08 03$\n3‘ vibroblade melee 04 10$\n4‘ power axe melee 07 15$\ne‘ exit \n"); + return ("MELEE WEAPONS\n" + "WEAPON | TYPE | WT | PRICE \n" + "\n" + "1‘ knife melee 01 01$\n" + "2‘ hand axe melee 08 03$\n" + "3‘ vibroblade melee 04 10$\n" + "4‘ power axe melee 07 15$\n" + "e‘ exit \n"); }; /* @@ -123,12 +206,26 @@ string () MeleeString = string () PistolString = { - return ("Pistols and Submachineguns\n WEAPON | CAL | WEIGHT | PRICE \n\n1‘ mk23 socom .45 01 5$\n2‘ d. eagle .44 02 7$\n3‘ needler pistol 02 9$\n4‘ h&k mp7 4mm 03 14$\n5‘ grease gun 9mm 03 17$\n6‘ alien blaster 02 21$\n"); + return ("Pistols and Submachineguns\n" + " WEAPON | CAL | WEIGHT | PRICE \n" + "\n" + "1‘ mk23 socom .45 01 5$\n" + "2‘ d. eagle .44 02 7$\n" + "3‘ needler pistol 02 9$\n" + "4‘ h&k mp7 4mm 03 14$\n" + "5‘ grease gun 9mm 03 17$\n" + "6‘ alien blaster 02 21$\n"); }; string () ShotgunString = { - return ("shotguns\n WEAPON | TYPE | WEIGHT | PRICE \n\n1‘ pipe rifle .44 02 4$\n2‘ winchester 12g 03 8$\n3‘ mossberg 12g 04 14$\n4‘ citykiller 12g 05 35$\n"); + return ("shotguns\n" + " WEAPON | TYPE | WEIGHT | PRICE \n" + "\n" + "1‘ pipe rifle .44 02 4$\n" + "2‘ winchester 12g 03 8$\n" + "3‘ mossberg 12g 04 14$\n" + "4‘ citykiller 12g 05 35$\n"); }; /* @@ -141,18 +238,33 @@ string () ShotgunString = */ string () RifleString = { - return ("rifles\n RIFLE | TYPE | WEIGHT | PRICE \n\n1‘ rangemaster 7mm 03 11$\n2‘ ak-112 5mm 04 21$\n3‘ remington .308 05 24$\n4‘ ak-74 5mm 04 27$\n5‘ moonlight .223 05 36$\n6‘ sa-80 5mm 05 32$\n7‘ fn-fal .308 09 25$\n"); + return ("rifles\n" + " RIFLE | TYPE | WEIGHT | PRICE \n" + "\n" + "1‘ rangemaster 7mm 03 11$\n" + "2‘ ak-112 5mm 04 21$\n" + "3‘ remington .308 05 24$\n" + "4‘ ak-74 5mm 04 27$\n" + "5‘ moonlight .223 05 36$\n" + "6‘ sa-80 5mm 05 32$\n" + "7‘ fn-fal .308 09 25$\n"); }; string () HeavyString = { - return ("other weaponry\n WEAPON | TYPE | WEIGHT | PRICE \n\n1‘ rocket launcher 10 30$\n2‘ gauss rifle 07 32$\n3‘ laser carbine 12 45$\n"); + return ("other weaponry\n" + " WEAPON | TYPE | WEIGHT | PRICE \n" + "\n" + "1‘ rocket launcher 10 30$\n" + "2‘ gauss rifle 07 32$\n" + "3‘ laser carbine 12 45$\n"); }; string () ChemString = { return ("drugs\n DRUG | EFFECTS | PRICE\n" - "\n1‘ stimpack heals 05+20 3$\n" + "\n" + "1‘ stimpack heals 05+20 3$\n" "2‘ medkit+ heals 10+50 5$\n" "3‘ superstim* heals 20+60 12$\n" "4‘ adrenaline*+speed/jump 10$\n" @@ -166,7 +278,8 @@ string () ChemString = string () ChemString2 = { return ("chems\n DRUG | EFFECTS | PRICE\n" - "\n1‘ adrenaline +60 speed/jump 3$\n" + "\n" + "1‘ adrenaline +60 speed/jump 3$\n" "2‘ stimpack heals 40 5$\n" "3‘ psycho+ +60 hp/no pain 11$\n" "4‘ medkit* heals 20+50 12$\n" @@ -180,19 +293,44 @@ string () ChemString2 = string () EnergyWeaponsString = { - return ("high-tech weaponry\n WEAPON | TYPE | WEIGHT | PRICE \n\n1‘ [*] flash gun semi 03 21$\n2‘ [&] plasma rifle semi 08 34$\n3‘ [*] laser rifle semi 11 40$\n4‘ [*] laser carbine auto 06 57$\n5‘ [?] alien blaster semi 02 72$\n"); + return ("high-tech weaponry\n" + " WEAPON | TYPE | WEIGHT | PRICE \n" + "\n" + "1‘ [*] flash gun semi 03 21$\n" + "2‘ [&] plasma rifle semi 08 34$\n" + "3‘ [*] laser rifle semi 11 40$\n" + "4‘ [*] laser carbine auto 06 57$\n" + "5‘ [?] alien blaster semi 02 72$\n"); }; //6‘ bozar 14 81$\n7‘ firestorm 12 97$ string () HeavyGunsString = { - return ("heavy guns\n WEAPON | TYPE | WEIGHT | PRICE \n\n1‘ light support weapon 15 55$\n2‘ rocket launcher 11 75$\n3‘ 50oc flamethrower 16 35$\n4‘ steyr amr .50 flechette 17 72$\n5‘ m72 gauss rifle 2mm 12 81$\n6‘ bozar 14 81$\n7‘ firestorm 12 97$"); + return ("heavy guns\n" + " WEAPON | TYPE | WEIGHT | PRICE \n" + "\n" + "1‘ light support weapon 15 55$\n" + "2‘ rocket launcher 11 75$\n" + "3‘ 50oc flamethrower 16 35$\n" + "4‘ steyr amr .50 flechette 17 72$\n" + "5‘ m72 gauss rifle 2mm 12 81$\n" + "6‘ bozar 14 81$\n" + "7‘ firestorm 12 97$"); }; string () de_dust = { - return (" DE_DUST \n (BOMB/DEFUSE MAP) \n\nrangers have obtained two ufos\nthat have crash landed in the \ndesert. raiders must blow them\nup with c4 before its too late\n\n(activate electronic tools and\nc4 by pressing 4) ..."); + return (" DE_DUST \n" + " (BOMB/DEFUSE MAP) \n" + "\n" + "rangers have obtained two ufos\n" + "that have crash landed in the \n" + "desert. raiders must blow them\n" + "up with c4 before its too late\n" + "\n" + "(activate electronic tools and\n" + "c4 by pressing 4) ..."); }; /* @@ -209,5 +347,17 @@ string () de_dust = string () EquipmentString = { - return ("+ special equipment +\npress your c key to activate!\n\n1‘ medic's bag 15c‘\n2‘ security alarm 15c‘\n3‘ remote camera 15c‘\n4‘ belt pouch 15c‘\n5‘ backpack 15c‘\n6‘ toolkit mark ii 15c‘\n7‘ climbing gear 15c‘\n8‘ enhanced battery 15c‘\n9‘ stealth boy 45c‘\n\n"); + return ("+ special equipment +\n" + "press your c key to activate!\n" + "\n" + "1‘ medic's bag 15c‘\n" + "2‘ security alarm 15c‘\n" + "3‘ remote camera 15c‘\n" + "4‘ belt pouch 15c‘\n" + "5‘ backpack 15c‘\n" + "6‘ toolkit mark ii 15c‘\n" + "7‘ climbing gear 15c‘\n" + "8‘ enhanced battery 15c‘\n" + "9‘ stealth boy 45c‘\n" + "\n"); }; diff --git a/quakec/fallout2/mod_buy.qc b/quakec/fallout2/mod_buy.qc index 3dc8d3a0d..2f4ce1d5b 100644 --- a/quakec/fallout2/mod_buy.qc +++ b/quakec/fallout2/mod_buy.qc @@ -670,6 +670,8 @@ void() W_PlayerMenu = BuyStackable(20, IID_BUILD_AUTODOC); if (self.impulse == 5) BuyStackable(20, IID_BUILD_SHIELDGEN); + if (self.impulse == 6) + BuyStackable(20, IID_BUILD_TTURRET); return; } diff --git a/quakec/fallout2/plats.qc b/quakec/fallout2/plats.qc index ffcafa8a1..4a935b572 100644 --- a/quakec/fallout2/plats.qc +++ b/quakec/fallout2/plats.qc @@ -1,7 +1,7 @@ void() plat_center_touch; -void() plat_outside_touch; +//void() plat_outside_touch; void() plat_trigger_use; void() plat_go_up; void() plat_go_down; @@ -18,6 +18,7 @@ void() plat_spawn_inside_trigger = // trigger = spawn(); trigger.touch = plat_center_touch; + trigger.team = self.team; trigger.movetype = MOVETYPE_NONE; trigger.solid = SOLID_TRIGGER; trigger.enemy = self; @@ -72,6 +73,9 @@ void() plat_go_up = void() plat_center_touch = { + if (!triggercantouch(self, other)) + return; + if (other.classname != "player") return; @@ -84,9 +88,12 @@ void() plat_center_touch = else if (self.state == STATE_TOP) self.nextthink = self.ltime + 1; // delay going down }; - +/* void() plat_outside_touch = { + if (!triggercantouch(self, other)) + return; + if (other.classname != "player") return; @@ -98,7 +105,7 @@ void() plat_outside_touch = if (self.state == STATE_TOP) plat_go_down (); }; - +*/ void() plat_trigger_use = { if (self.think) diff --git a/quakec/fallout2/progs.src b/quakec/fallout2/progs.src index f31ae4d13..a1b29d710 100644 --- a/quakec/fallout2/progs.src +++ b/quakec/fallout2/progs.src @@ -5,7 +5,7 @@ inventory.qc subs.qc fight.qc -//tf.qc +tf.qc ai.qc combat.qc diff --git a/quakec/fallout2/triggers.qc b/quakec/fallout2/triggers.qc index 4fceafba1..42a6ec7b2 100644 --- a/quakec/fallout2/triggers.qc +++ b/quakec/fallout2/triggers.qc @@ -68,6 +68,9 @@ void() multi_trigger = void() multi_killed = { + if (!triggercantouch(self, other)) + return; + self.enemy = damage_attacker; multi_trigger(); }; @@ -80,6 +83,9 @@ void() multi_use = void() multi_touch = { + if (!triggercantouch(self, other)) + return; + if (other.classname != "player") return; @@ -376,6 +382,9 @@ void() teleport_touch = local entity t; local vector org; + if (!triggercantouch(self, other)) + return; + if (self.targetname) { if (self.nextthink < time) @@ -490,6 +499,9 @@ trigger_setskill void() trigger_skill_touch = { + if (!triggercantouch(self, other)) + return; + if (other.classname != "player") return; @@ -517,6 +529,8 @@ ONLY REGISTERED TRIGGERS void() trigger_onlyregistered_touch = { + if (!triggercantouch(self, other)) + return; if (other.classname != "player") return; if (self.attack_finished > time) @@ -559,6 +573,9 @@ void() hurt_on = void() hurt_touch = { + if (self.team && self.team != other.team) + return; + if (other.takedamage) { self.solid = SOLID_NOT; @@ -593,15 +610,17 @@ void() trigger_push_touch = other.velocity = self.speed * self.movedir * 10; else if (other.health > 0) { - other.velocity = self.speed * self.movedir * 10; if (other.classname == "player") { + if (!triggercantouch(self, other)) + return; if (other.fly_sound < time) { other.fly_sound = time + 1.5; sound (other, CHAN_AUTO, "ambience/windfly.wav", 1, ATTN_NORM); } } + other.velocity = self.speed * self.movedir * 10; } if (self.spawnflags & PUSH_ONCE) remove(self); diff --git a/quakec/fallout2/turrets.qc b/quakec/fallout2/turrets.qc index dd6c64c9a..617976d8d 100644 --- a/quakec/fallout2/turrets.qc +++ b/quakec/fallout2/turrets.qc @@ -77,6 +77,154 @@ void() tesla_think = self.frame = 0; }; +void (float tmp, float dam) turret_mg_fire = +{ + local vector src; + local vector dir; + local vector direction; + local entity en; + local vector org; + + makevectors (self.angles); + + sound (self, CHAN_WEAPON, "weapons/1911.wav", PLAT_LOW_TRIGGER, ATTN_NORM); + + src = self.origin + v_forward*10; + src_z = self.absmin_z + self.size_z * 0.7; + + en = self.enemy; + + dir = en.origin - en.velocity*0.2; + dir = normalize (dir - self.origin); + + direction = dir; + + traceline (src, src + direction*2048 + v_right*crandom()*tmp + v_up*crandom()*tmp, FALSE, self); + + if (trace_fraction == PLAT_LOW_TRIGGER) + return; + + if (trace_ent.takedamage) + { + dam = 1 + random()*dam + random()*dam; + dam = dam * (1 - (trace_fraction/2)); + SpawnBlood (org, PLAT_LOW_TRIGGER); + T_Damage (trace_ent, self, self, dam); + } + else + { + WriteByte (MSG_MULTICAST, SVC_TEMPENTITY); + WriteByte (MSG_MULTICAST, TE_SPIKE); + WriteCoord (MSG_MULTICAST, trace_endpos_x); + WriteCoord (MSG_MULTICAST, trace_endpos_y); + WriteCoord (MSG_MULTICAST, trace_endpos_z); + multicast (trace_endpos, MULTICAST_PVS); + } + + muzzleflash(); +}; + +void() GunTop_Think = +{ + local entity e; + local vector org; + local float delta; + + self.nextthink = time + 0.1; + + if (self.owner.health < 1) + { + remove(self); + return; + } + + setorigin(self, self.owner.origin); + + if (!self.owner.aflag) + { + if (self.attack_finished < time) + if (!self.enemy || self.enemy.health < 1) + { + e = findradius(self.origin, 800); + while (e != world) + { + if (e.health > 0) + { + if (e.team != self.owner.team) + { + if (e.solid) + { + if (e.takedamage) + { + traceline (self.origin+'0 0 16', e.origin, FALSE, self); + if (trace_ent == e) + { + break; + } + } + } + } + } + e = e.chain; + } + self.enemy = e; + if (e == world) + self.attack_finished = time + 0.3; + + } + if (self.enemy) + { + self.ideal_yaw = vectoyaw(self.enemy.origin - self.origin); + ChangeYaw(); + if (self.attack_finished < time) + { + delta = anglemod(self.angles_y - self.ideal_yaw); + if (delta > 10 && delta < 350) + return; + + traceline (self.owner.origin+'0 0 16', self.enemy.origin, FALSE, self.owner); + if (trace_ent != self.enemy) + { + self.enemy = world; + return; + } + + if (self.owner.buildtype == IID_BUILD_RTURRET) + { + sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM); + self.attack_finished = time + 0.7; + newmis = spawn (); + newmis.owner = self.owner; + newmis.movetype = MOVETYPE_FLYMISSILE; + newmis.solid = SOLID_BBOX; + +// set newmis speed + newmis.velocity = normalize(self.enemy.origin - self.origin)*1000; + newmis.angles = vectoangles(newmis.velocity); + + newmis.touch = T_MissileTouch; + newmis.voided = 0; + +// set newmis duration + newmis.nextthink = time + 5; + newmis.think = SUB_Remove; + newmis.classname = "rocket"; + + setmodel (newmis, "progs/missile.mdl"); + setsize (newmis, '0 0 0', '0 0 0'); + setorigin (newmis, self.origin + v_forward*8 + '0 0 16'); + } + if (self.owner.buildtype == IID_BUILD_GTURRET) + { + turret_mg_fire(0.4, 3+random()*4); + self.attack_finished = time + 0.05; + self.nextthink = time + 0.05; + } + } + } + } +}; + void() FinishTesla = { self.netname = "tesla turret"; @@ -85,3 +233,32 @@ void() FinishTesla = setsize (self, '-16 -16 -24', '16 16 32'); self.nextthink = time + 0.1; }; +void() FinishGunPost = +{ + local entity top; + + top = spawn(); + top.owner = self; + top.think = GunTop_Think; + top.nextthink = time + 0.1; + top.yaw_speed = 20; + if (self.buildtype == IID_BUILD_RTURRET) + { + setmodel(top, "progs/turrgun.mdl"); + setmodel(self, "progs/turrbase.mdl"); + } + else + { + setmodel(top, "progs/miniturr.mdl"); + setmodel(self, "progs/minibase.mdl"); + } + setorigin(top, self.origin); + top.angles = self.angles; +}; +void() FinishTurret = +{ + if (self.buildtype == IID_BUILD_TTURRET) + FinishTesla(); + else + FinishGunPost(); +}; \ No newline at end of file diff --git a/quakec/fallout2/weapons.qc b/quakec/fallout2/weapons.qc index ba7267322..7c124d395 100644 --- a/quakec/fallout2/weapons.qc +++ b/quakec/fallout2/weapons.qc @@ -31,6 +31,7 @@ void() autofire_s; float(float iid) UseBoostingChem; float(float iid) UseHealingChem; float(float slotno) DecreaseDestroySlot; +void () DropAmmo; #define weightx() (self.weight) @@ -403,8 +404,8 @@ W_FireRocket */ void() W_FireRocket = { - if (deathmatch != 4) - self.currentammo = self.ammo_rockets = self.ammo_rockets - 1; + DropAmmo (); + self.attack_finished = time + 0.7; sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM); @@ -2407,13 +2408,6 @@ void () WeaponTouch = if (other.ghost != 0) return; - if (other.current_slot == WEAPON_SPIKES) - { - return; - } - if (other.current_slot == AS_MELEE) - return; - if (ItemInSlot(other, other.current_slot) == 0 && FitsInSlot(other.current_slot, ToIID(self.islot1))) slotnum = other.current_slot; if (!slotnum) @@ -2424,6 +2418,10 @@ void () WeaponTouch = sound (other, CHAN_BODY, "misc/item1.wav", 1, ATTN_NORM); SetItemSlot(other, slotnum, self.islot1); + + sprint(other, PRINT_MEDIUM, "You pick up the "); + sprint(other, PRINT_MEDIUM, GetItemName(ToIID(self.islot1))); + sprint(other, PRINT_MEDIUM, "\n"); remove (self); self = other; @@ -2458,6 +2456,7 @@ void (float slotnum, float snd, float force) DropFromSlot = newmis.classname = "dropped_weapon"; newmis.movetype = MOVETYPE_TOSS; newmis.solid = SOLID_TRIGGER; + newmis.flags = FL_ITEM; //item makes it bigger to player touches. newmis.velocity = aim (self, 500); newmis.velocity = (newmis.velocity * 500); newmis.angles_y = (random () * 360); @@ -2484,6 +2483,10 @@ void (float slotnum, float snd, float force) DropFromSlot = if (self.current_slot == slotnum) SetWeaponModel (); + + if (self.equipment_slot == slotnum) + self.equipment_slot = 0; + }; void (float slot) WeaponAmmo = @@ -3239,7 +3242,7 @@ void (entity guy) spawn_dot = hologram.nextthink = (time + 0.01); }; -void() FinishTesla; +void() FinishTurret; float (float iid) spawn_station = { local entity oself; @@ -3386,9 +3389,9 @@ float (float iid) spawn_station = self.netname = "robofang"; setmodel (self, "progs/dog.mdl"); } - if (self.buildtype == IID_BUILD_TESLA) + if (self.buildtype == IID_BUILD_TTURRET || self.buildtype == IID_BUILD_RTURRET || self.buildtype == IID_BUILD_GTURRET) { - FinishTesla(); + FinishTurret(); } self = oself; diff --git a/quakec/fallout2/world.qc b/quakec/fallout2/world.qc index 269e178a9..0b98cda6b 100644 --- a/quakec/fallout2/world.qc +++ b/quakec/fallout2/world.qc @@ -350,7 +350,7 @@ void() worldspawn = { lastspawn = world; InitBodyQue (); - coop = 1; + coop = !cvar("deathmatch"); create_referees(); SetupStats(); @@ -664,7 +664,7 @@ void() StartFrame = timelimit = cvar("timelimit") * 60; fraglimit = cvar("fraglimit"); teamplay = cvar("teamplay"); - deathmatch = cvar("deathmatch"); + deathmatch = !coop; framecount = framecount + 1; };