From 03e8a58d5ad64f7eb59e5194c5a6f52511def053 Mon Sep 17 00:00:00 2001 From: Magnus Date: Fri, 13 Nov 2009 05:05:32 +0000 Subject: [PATCH] git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@3442 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- quakec/fallout2/client.qc | 62 ++--------- quakec/fallout2/combat.qc | 27 ++--- quakec/fallout2/csqc/invent.qc | 45 ++++---- quakec/fallout2/defs.qc | 4 +- quakec/fallout2/inventory.qc | 10 +- quakec/fallout2/weapons.qc | 197 ++++++++++++++------------------- quakec/fallout2/world.qc | 9 +- 7 files changed, 149 insertions(+), 205 deletions(-) diff --git a/quakec/fallout2/client.qc b/quakec/fallout2/client.qc index 2824ce8ce..dd35f0b22 100644 --- a/quakec/fallout2/client.qc +++ b/quakec/fallout2/client.qc @@ -1292,10 +1292,6 @@ void() SneakLevel = if (self.position > 0) sn = sn + 1; - //light step perk gives a 1% bonus to stealth - if (getperk(6)) - sn = sn + 1; - //walking in front of a monster at close range is very bad //at longer ranges it isn't so bad to do so //thus even healer and barbarian types can sneak if they do so smartly @@ -1475,14 +1471,10 @@ void () PositionControl = self.maxspeed = 225; else if (self.position == 1) self.maxspeed = 100; - else if (self.position == 2 && getperk(3))//stunt man - self.maxspeed = 100; else self.maxspeed = 50; - if (getperk(2)) - self.maxspeed = self.maxspeed*1.10; if (self.rage == IID_CHEM_ADRENALINE) self.maxspeed = self.maxspeed*1.20; @@ -1560,6 +1552,14 @@ void() PlayerPreThink = } } + + //perk1timer and perk2timer are "cooldowns" for each perk + if (self.perk1timer > 0) + self.perk1timer = self.perk1timer - 1; + + if (self.perk2timer > 0) + self.perk2timer = self.perk2timer - 1; + if (self.cycle1 < time) { if (self.currentmenu != "none") @@ -1578,14 +1578,6 @@ void() PlayerPreThink = local float lgrip, rgrip; - //nintendo gamer: player sometimes goes into 'the zone' - if ((self.recoil >= 5) && (getperk(9)) && (random()<=0.10)) - { - sprint(self, 2, "THE ZONE!\n"); - self.rage = 255; - self.ragetime = 15; - } - if (self.health > self.max_health) self.health = self.max_health; @@ -1686,38 +1678,6 @@ void() PlayerPreThink = self.ammo_cells = 0; } - if (getperk(100))//SPIRIT LINK - { - te = findradius(self.origin, 500); - - while (te) - { - if (te.classname == "player" && te != self && (te.health < self.health)) - { - if (self.health > 5 && te.health > 0) - { - - sound (te, CHAN_BODY, "items/r_item1.wav", 1, ATTN_IDLE); - sound (self, CHAN_BODY, "items/r_item1.wav", 1, ATTN_IDLE); - - sprint(self, 2, "!SPIRIT LINK\n"); - sprint(te, 2, "!SPIRIT LINK\n"); - - if ((self.health - te.health) > 10) - { - self.health -= 5; - te.health += 5; - } - else - { - self.health -= 1; - te.health += 1; - } - } - } - te = te.chain; - } - } if (self.regen > 0 && !self.deadflag) //don't come back to life. { @@ -2135,9 +2095,10 @@ void() ClientConnect = stuffcmd(self, "alias special impulse 53\n"); stuffcmd(self, "alias exit impulse 100\n"); stuffcmd(self, "alias drop impulse 55\n"); - stuffcmd(self, "alias info impulse 56\n"); stuffcmd(self, "alias zoom impulse 60\n"); stuffcmd(self, "alias hostage impulse 65\n"); + stuffcmd(self, "alias perk1 impulse 61\n"); + stuffcmd(self, "alias perk2 impulse 62\n"); stuffcmd(self, "alias stimpack impulse 225\n"); stuffcmd(self, "alias equip \"cmd invuse 4\"\n"); @@ -2181,7 +2142,8 @@ void() ClientConnect = stuffcmd(self, "bind h hostage\n"); stuffcmd(self, "bind x stimpack\n"); stuffcmd(self, "bind b buy\n"); - stuffcmd(self, "bind q info\n"); + stuffcmd(self, "bind q perk1\n"); + stuffcmd(self, "bind a perk2\n"); stuffcmd(self, "bind shift prone\n"); stuffcmd(self, "bind ctrl duck\n"); diff --git a/quakec/fallout2/combat.qc b/quakec/fallout2/combat.qc index 849ad1b9a..7b9861b02 100644 --- a/quakec/fallout2/combat.qc +++ b/quakec/fallout2/combat.qc @@ -219,7 +219,7 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = //paranoia: if taking cover, 25% miss chance (others get 10% bonus) if (targ.rage == 777) { - if (targ.perk1 == 10 || targ.perk2 == 10) + if (targ.perk1 == 2 || targ.perk2 == 2) { if (random()<0.20) { @@ -240,27 +240,28 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = //master blaster: the more you burst, the higher the damage bonus if (attacker.perk1 == 18 || attacker.perk2 == 18) { - if (self.recoil > 10) + if (attacker.recoil > 10) { - sprint(self, 2, "!MASTER BLASTER\n"); - damage = damage * (1 + (self.recoil * 0.01)); + sprint(attacker, 2, "!MASTER BLASTER\n"); + damage = damage * (1 + (attacker.recoil * 0.01)); } } + + //hit the deck + if (targ.perk1 == 4 || targ.perk2 == 4) + { + if (targ.position == 2) + damage = damage * 0.90; + } + //sneak attack: if you attack a creature who isn't fighting you, bonus damage - if (attacker.perk1 == 7 || attacker.perk2 == 7) + if (attacker.skill_sneak > 0) { if (targ.enemy != attacker) { sprint(attacker, 2, "!SNEAK ATTACK\n"); - if (damage <= 10) - damage = damage * 3; - else if (damage <= 20) - damage = damage * 2; - else if (damage <= 30) - damage = damage * 1.5; - else - damage = damage * 1.25; + damage = damage * (1 + (self.skill_sneak/100)); } } diff --git a/quakec/fallout2/csqc/invent.qc b/quakec/fallout2/csqc/invent.qc index 108bfbbc5..c423f4557 100644 --- a/quakec/fallout2/csqc/invent.qc +++ b/quakec/fallout2/csqc/invent.qc @@ -832,13 +832,13 @@ void() Invent_Draw = check = getstati(97); if (check > 0) - SlotImage('11 12 0'*IMGSIZEK, 23); + SlotImageSmall('11 12 0'*IMGSIZEK, 23); check = getstati(98); if (check > 0) - SlotImage('13 12 0'*IMGSIZEK, 24); + SlotImageSmall('13 12 0'*IMGSIZEK, 24); if (showcontextmenu && show_inventory) @@ -883,11 +883,11 @@ void() Invent_Draw = - if (mousepos_x >= 11*IMGSIZEK && mousepos_x <= 12*IMGSIZEK) - if (mousepos_y >= 12*IMGSIZEK && mousepos_y <= 13*IMGSIZEK) + if (mousepos_x >= 10.75*IMGSIZEK && mousepos_x <= 12.25*IMGSIZEK) + if (mousepos_y >= 11.75*IMGSIZEK && mousepos_y <= 13.25*IMGSIZEK) slotnum = 23; - if (mousepos_x >= 13*IMGSIZEK && mousepos_x <= 14*IMGSIZEK) - if (mousepos_y >= 12*IMGSIZEK && mousepos_y <= 13*IMGSIZEK) + if (mousepos_x >= 12.75*IMGSIZEK && mousepos_x <= 14.25*IMGSIZEK) + if (mousepos_y >= 11.75*IMGSIZEK && mousepos_y <= 13.25*IMGSIZEK) slotnum = 24; } else @@ -976,7 +976,7 @@ else if (slotnum == 99) it = getstati(98); } itname = GetItemImage(ToIID(it)); - drawpic(mousepos, strcat("gui/", itname), '48 48 0', '1 1 1', 1); + drawpic(mousepos - '16 16 0', strcat("gui/", itname), '48 48 0', '1 1 1', 1); } }; @@ -1086,21 +1086,8 @@ float(float eventtype, float param1, float param2) CSQC_InputEvent = else if (downslotnum == slotnum) //mouse didn't move away { - if (slotnum >= 1 && slotnum <= 26 && show_inventory) - { - //if there's actually an item there - if ((show_inventory) && (getstati(32+slotnum-1) != 0)) - { - showcontextmenu = true; //show the context menu - contextpos = mousepos; - } - else if ((show_trader) && (getstati(70+slotnum) != 0)) - { - showcontextmenu = true; //show the context menu - contextpos = mousepos; - } - } - else if (show_gainperk) + + if (show_gainperk) { if (which_perk == getstati(60)) return; @@ -1234,6 +1221,20 @@ float(float eventtype, float param1, float param2) CSQC_InputEvent = perkslot = 2; } } + else if (slotnum >= 1 && slotnum <= 26) + { + //if there's actually an item there + if ((show_inventory) && (getstati(32+slotnum-1) != 0)) + { + showcontextmenu = true; //show the context menu + contextpos = mousepos; + } + else if ((show_trader) && (getstati(70+slotnum) != 0)) + { + showcontextmenu = true; //show the context menu + contextpos = mousepos; + } + } else { show_inventory = false; //they clicked outside, fools! diff --git a/quakec/fallout2/defs.qc b/quakec/fallout2/defs.qc index 5e6e42c16..67f42fdbb 100644 --- a/quakec/fallout2/defs.qc +++ b/quakec/fallout2/defs.qc @@ -734,11 +734,13 @@ float intermission_running; .string ammotype2; .string currentmenu; .entity wielded; -.float walk; +.float walk; .float steadyaim; .float lastman; .float popup; .float flare; +.float perk1timer; +.float perk2timer; .entity friend; .entity tumbler1; diff --git a/quakec/fallout2/inventory.qc b/quakec/fallout2/inventory.qc index 03b96b306..3fb2228c8 100644 --- a/quakec/fallout2/inventory.qc +++ b/quakec/fallout2/inventory.qc @@ -2589,7 +2589,8 @@ string (float slot, float int) PerkName = return "Schizophrenia"; if (int == 9) return "Sleep Tight"; - + if (int == 10) + return "Economic Moves"; }; string (float slot, float int) PerkNameCentered = @@ -2612,7 +2613,8 @@ string (float slot, float int) PerkNameCentered = return "Schizophrenia"; if (int == 9) return " Sleep Tight"; - + if (int == 10) + return "Economic Moves"; }; @@ -2636,6 +2638,8 @@ string(float int) GetPerkImage = return "gui/perks/Schizophrenia.jpg"; else if (int == 9) return "gui/perks/Sleep Tight.jpg"; + else if (int == 10) + return "gui/perks/Economic Moves.jpg"; else return "gui/perks/none.jpg"; @@ -2662,6 +2666,8 @@ string(float int) GetPerkDesc = return "You sometimes gain additional skills from another place"; else if (int == 9) return "Automatically kill anything with knife in sneak mode"; + else if (int == 10) + return "Suffer less time-related penalties for all actions"; else return ""; diff --git a/quakec/fallout2/weapons.qc b/quakec/fallout2/weapons.qc index 37fc089c8..b54f3f783 100644 --- a/quakec/fallout2/weapons.qc +++ b/quakec/fallout2/weapons.qc @@ -96,6 +96,55 @@ float() crandom = return 2*(random() - 0.5); }; + + +void(float slotno) UsePerk = +{ + local float x; + local string y, timeleft; + local entity te; + + if (slotno == 1 && self.perk1timer > 0) + { + timeleft = ftos(self.perk1timer); + sprint(self, 2, "ability is not ready yet. ["); + sprint(self, 2, timeleft); + sprint(self, 2, "]\n"); + sound (self, CHAN_BODY, "misc/beep1.wav", 1, ATTN_NORM); + return; + } + + if (slotno == 2 && self.perk2timer > 0) + { + timeleft = ftos(self.perk2timer); + sprint(self, 2, "ability is not ready yet. ["); + sprint(self, 2, timeleft); + sprint(self, 2, "]\n"); + sound (self, CHAN_BODY, "misc/beep1.wav", 1, ATTN_NORM); + return; + } + + if (self.perk1 == 7 || self.perk2 == 7) + { + if (slotno == 1) + self.perk1timer = 2000; + if (slotno == 2) + self.perk2timer = 2000; + + sound (self, CHAN_BODY, "misc/r_tele4.wav", 1, ATTN_NORM); + + te = findradius (self.origin, 6000); + while (te) + { + if (te.classname == "monster") + te.hold = 100; + + te = te.chain; + } + } +}; + + void() muzzleflash = { WriteByte (MSG_MULTICAST, SVC_MUZZLEFLASH); @@ -158,31 +207,16 @@ void(float damage, float dist, float rate) FireMelee = local float weap, dot, tdam; local string sdam; - if (getperk(16))//power shot adds a small bonus to the first shot fired + if (getperk(5))//living anatomy { if (self.steadyaim == 0) - { - sprint(self, 2, "!POWER SHOT\n"); - damage = damage * 1.20; - } + damage = damage + self.skill_doctor; } self.recoil = self.recoil + 5; weap = ToIID(self.(SlotField(self.current_slot))); - //large and in charge! adds a small burst of adrenalnie - if ((getperk(8)) && ((weap == IID_WP_SPEAR || weap == IID_WP_SLEDGE || weap == IID_WP_WRENCH))) - { - if (self.ragetime <= 0) - { - sprint(self, 2, "!LARGE AND IN CHARGE\n"); - sound (self, CHAN_VOICE, "player/berserk.wav", 1, ATTN_NORM); - self.rage = IID_CHEM_ADRENALINE; - self.ragetime = 3; - } - } - makevectors (self.v_angle); source = self.origin + '0 0 16'; traceline (source, source + v_forward*dist, FALSE, self); @@ -199,10 +233,10 @@ void(float damage, float dist, float rate) FireMelee = if (dot < 0.5 && trace_ent.takedamage) { - tdam = 25 + (30*self.skill_sneak); + tdam = 20 + (20*self.skill_sneak); - if (getperk(7)) - tdam = tdam * 2; + if (getperk(9)) + tdam = 900; if (self.steadyaim == 0) tdam = tdam + 10; @@ -275,13 +309,6 @@ void(float damage, float dist, float rate) FireMelee = if (weap == IID_WP_SLEDGE || weap == IID_WP_SPEAR || weap == IID_WP_KNIFE) SpawnBlood (org, 1); - if ((getperk(8)) && (weap == IID_WP_SLEDGE || weap == IID_WP_SPEAR || weap == IID_WP_WRENCH)) - { - sprint(self, 2, "!LARGE AND IN CHARGE\n"); - dir = normalize(trace_ent.origin - self.origin); - trace_ent.velocity = dir * 600; - trace_ent.velocity_z = 100+random()*200; - } trace_ent.axhitme = 1; if (trace_ent.classname != "car") @@ -1413,8 +1440,6 @@ void (float slotno) ReloadWeapon = else if (self.position == 1) player_creload1(); - if (getperk(5)) - r = r * 0.5; self.attack_finished = time + r; @@ -1721,7 +1746,7 @@ void() W_ChangeWeapon = if (self.impulse == 1 && self.current_slot != 1) { - if (!getperk(5)) + if (!getperk(10)) { self.weaponframe = 4; self.attack_finished = time + 1; @@ -1734,7 +1759,7 @@ void() W_ChangeWeapon = } else if (self.impulse == 2 && self.current_slot != 2) { - if (!getperk(5)) + if (!getperk(10)) { self.weaponframe = 4; self.attack_finished = time + 1; @@ -1865,7 +1890,7 @@ void () ProneOff = } sprint (self, 2, "position: stand.\n"); - if (getperk(3)) + if (getperk(10)) { self.attack_finished = time + 0.5; self.rtime = time + 0.5; @@ -1891,7 +1916,7 @@ void () ProneOn = return; } - if (!getperk(3) && self.velocity_z != 0) + if (!getperk(10) && self.velocity_z != 0) return; if (self.position == 2) @@ -1906,7 +1931,7 @@ void () ProneOn = self.position = 2; self.view_ofs = '0 0 -10'; sprint (self, 2, "position: prone.\n"); - if (getperk(3)) + if (getperk(10)) { self.attack_finished = time + 0.5; self.rtime = time + 0.5; @@ -1932,7 +1957,7 @@ void () DuckOff = return; } sprint (self, 2, "position: stand.\n"); - if (!getperk(3)) + if (!getperk(10)) { self.attack_finished = time + 0.2; self.rtime = time + 0.2; @@ -1948,7 +1973,7 @@ void () DuckOn = { if (self.waterlevel > 0) { - if (!getperk(3)) + if (!getperk(10)) { self.attack_finished = time + 0.5; self.rtime = time + 0.5; @@ -1971,7 +1996,7 @@ void () DuckOn = return; } - if (!getperk(3)) + if (!getperk(10)) { self.attack_finished = time + 0.5; self.rtime = time + 0.5; @@ -2032,19 +2057,8 @@ void() ImpulseCommands = if (self.impulse == 4 && self.currentmenu == "none") Cmd_InvUse("6"); - if (self.impulse >= 1 && self.currentmenu == "shop_perk1") - { - W_PlayerMenu (); - self.impulse = 0; - return; - } - else if (self.impulse >= 1 && self.currentmenu == "shop_perk2") - { - W_PlayerMenu (); - self.impulse = 0; - return; - } - else if (self.impulse >= 1 && self.impulse <= 10 && self.currentmenu != "none") + + if (self.impulse >= 1 && self.impulse <= 10 && self.currentmenu != "none") { W_PlayerMenu (); self.impulse = 0; @@ -2081,9 +2095,13 @@ void() ImpulseCommands = UseEquipment (); if (self.impulse == 60) ZoomIn (); + if (self.impulse == 61) + UsePerk (1); + if (self.impulse == 62) + UsePerk (2); + if (self.impulse == 65) HostageReport (); - if (self.impulse == 66) WalkOn (); if (self.impulse == 67) @@ -2815,13 +2833,10 @@ void (float dam, float ap, string snd, float rng, float rate) FirePistol = stuffcmd(self, "-attack\n"); self.attack_finished = (time + rate); - if (getperk(16))//power shot adds a small bonus to the first shot fired + if (getperk(5)) { if (self.steadyaim == 0) - { - sprint(self, 2, "!POWER SHOT\n"); - dam = dam * 1.20; - } + dam = dam + self.skill_doctor/2; } if (self.extender == weap && self.silencer != weap) @@ -2965,13 +2980,10 @@ void (float dam, float ap, string snd, float rng, float rate) FireSMG = weap = ToIID(self.(SlotField(self.current_slot))); - if (getperk(16))//power shot adds a small bonus to the first shot fired + if (getperk(5)) { if (self.steadyaim == 0) - { - sprint(self, 2, "!POWER SHOT\n"); - dam = dam * 1.20; - } + dam = dam + self.skill_doctor/2; } sound (self, CHAN_WEAPON, snd, 1, ATTN_NORM); @@ -3290,13 +3302,10 @@ void (float dam, float accuracy, string snd, float rng, float rate) FireAssaultR weap = ToIID(self.(SlotField(self.current_slot))); - if (getperk(16))//power shot adds a small bonus to the first shot fired + if (getperk(5)) { if (self.steadyaim == 0) - { - sprint(self, 2, "!POWER SHOT\n"); - dam = dam * 1.20; - } + dam = dam + self.skill_doctor/2; } if (weap == IID_WP_MOONLIGHT) @@ -3569,13 +3578,10 @@ void (float dam, float xrecoil, string snd, float rng, float rate) FireMinigun = self.weaponframe = 9; } - if (getperk(16))//power shot adds a small bonus to the first shot fired + if (getperk(5)) { if (self.steadyaim == 0) - { - sprint(self, 2, "!POWER SHOT\n"); - dam = dam * 1.20; - } + dam = dam + self.skill_doctor/3; } loud_noise(50); @@ -4003,9 +4009,8 @@ float(float iid) UseBoostingChem = return false; } - //chem addict: any self-used chem functions better - if (getperk(15)) - duration = duration * 2; + + duration = duration * (1 + (self.skill_doctor / 10)); self.attack_finished = time + 1; @@ -4110,20 +4115,6 @@ float(float iid) UseHealingChem = return false; } - if (self.perk1 == 13 || self.perk2 == 13) - { - sprint(self, 2, "MEDICINE MAN\n"); - heal = heal * 1.25; - } - if (self.perk1 == 17 || self.perk2 == 17) - { - if (random()<0.05) - { - sprint(self, 2, "ONE IN A MILLION\n"); - heal = heal * 5; - } - } - sprint (trace_ent, PRINT_HIGH, self.netname); sprint (trace_ent, PRINT_HIGH, " used a "); sprint (trace_ent, PRINT_HIGH, x); @@ -4141,20 +4132,6 @@ float(float iid) UseHealingChem = sprint (self, PRINT_HIGH, x); sprint (self, PRINT_HIGH, ".\n"); - if (self.perk1 == 13 || self.perk2 == 13) - { - sprint(self, 2, "MEDICINE MAN\n"); - heal = heal * 1.25; - } - if (self.perk1 == 17 || self.perk2 == 17) - { - if (random()<0.05) - { - sprint(self, 2, "ONE IN A MILLION\n"); - heal = heal * 5; - } - } - sound (self, CHAN_BODY, "items/r_item2.wav", 1, ATTN_NORM); self.health = self.health + heal; self.regen = heal; @@ -4833,12 +4810,6 @@ void () ExitScreen = } if (trace_ent.classname == "body" && self.pickup == 0) { - if ((self.perk1 == 12 || self.perk2 == 12) && (ToIID(self.islot3) != IID_ARM_DESERT)) - { - sprint(self, 2, "you loot the raider's desert armor\n"); - SetItemSlot(self, 3, SlotVal(IID_ARM_DESERT, 1)); - return; - } trace_ent.movetype = MOVETYPE_BOUNCE; dir = normalize(trace_ent.origin - self.origin); @@ -5123,6 +5094,9 @@ void () disappear = //this allows an assassin to vanish, making monsters aggro //those who are visible + if (!getperk(3)) + return; + te = findradius(self.origin, 500); while (te) { @@ -6025,13 +5999,10 @@ void (float rec, float number, float dam, float spread, float ran, float auto, s local float var4; local float weap; - if (getperk(16))//power shot adds a small bonus to the first shot fired + if (getperk(5)) { if (self.steadyaim == 0) - { - sprint(self, 2, "!POWER SHOT\n"); - dam = dam * 1.20; - } + dam = dam + self.skill_doctor/5; } weap = ToIID(self.(SlotField(self.current_slot))); diff --git a/quakec/fallout2/world.qc b/quakec/fallout2/world.qc index ea32f2f38..1294234ef 100644 --- a/quakec/fallout2/world.qc +++ b/quakec/fallout2/world.qc @@ -1700,7 +1700,7 @@ void () RecoilControl = te.lastman = te.lastman - 0.01; - //steady aim: for power shot, and aimed shots by standing still + //steady aim: for living anatomy, and aimed shots by standing still if (te.recoil != 0) te.steadyaim = 6; else if (te.recoil == 0 && te.steadyaim > 0) @@ -1772,9 +1772,9 @@ void () RecoilControl = if (te.drifty > 250) te.drifty = 250; - //nintendo gamer: going into the zone gives a -5 recoil bonus - if (te.rage == 255) - te.recoil = te.recoil - 0.05; + //support fire: going prone gives a -10 recoil bonus with this perk during heavy fire + if (getperk(1) && self.position == 2 && te.recoil > 5) + te.recoil = te.recoil - 0.10; //prone: going prone gives a -5 recoil bonus @@ -2091,6 +2091,7 @@ void() worldspawn = precache_sound ("misc/hosdown.wav"); precache_sound ("misc/rescued.wav"); precache_sound ("misc/beep1.wav"); + precache_sound ("misc/r_tele4.wav"); precache_sound ("buttons/switch02.wav"); precache_sound ("buttons/switch04.wav"); precache_sound ("misc/secret.wav");