diff --git a/quakec/fallout2/client.qc b/quakec/fallout2/client.qc index 124a0a485..4f8daa819 100644 --- a/quakec/fallout2/client.qc +++ b/quakec/fallout2/client.qc @@ -64,10 +64,31 @@ void() SetChangeParms = parm7 = self.ammo_cells; parm8 = self.weapon; parm9 = self.armortype * 100; + + + + + parm16 = self.current_slot; + parm17 = self.islot1; + parm18 = self.islot2; + parm19 = self.islot3; + parm20 = self.islot4; + parm21 = self.islot5; + parm22 = self.islot6; + parm23 = self.islot7; + parm24 = self.islot8; + parm25 = self.islot9; + parm26 = self.islot10; + parm27 = self.islot11; + parm28 = self.islot12; + parm29 = self.islot13; + parm30 = self.islot14; + parm31 = self.islot15; + parm32 = self.islot16; }; void() SetNewParms = -{ +{ //remember, don't use self! parm1 = IT_SHOTGUN | IT_AXE; parm2 = 100; parm3 = 0; @@ -77,6 +98,25 @@ void() SetNewParms = parm7 = 0; parm8 = 1; parm9 = 0; + + + parm16 = 1; + parm17 = SlotVal(IID_WP_AK74, 30); + parm18 = SlotVal(IID_GREN_SMOKE, 500); + parm19 = SlotVal(IID_ARM_LEATHER, 1); + parm20 = SlotVal(IID_AM_AK74, 120); + parm21 = SlotVal(IID_AM_MOONLIGHT, 120); + parm22 = 0; + parm23 = SlotVal(IID_WP_TOOLKIT, 1); + parm24 = SlotVal(IID_WP_MOONLIGHT, 30); + parm25 = 0; + parm26 = SlotVal(IID_CHEM_STIMPACK, 3); + parm27 = SlotVal(IID_BUILD_MRAMMO, 3); + parm28 = SlotVal(IID_BUILD_AUTODOC, 3); + parm29 = 0; + parm30 = 0; + parm31 = 0; + parm32 = 0; }; void() DecodeLevelParms = @@ -96,6 +136,25 @@ void() DecodeLevelParms = self.ammo_cells = parm7; self.weapon = parm8; self.armortype = parm9 * 0.01; + + + self.current_slot = parm16; + self.islot1 = parm17; + self.islot2 = parm18; + self.islot3 = parm19; + self.islot4 = parm20; + self.islot5 = parm21; + self.islot6 = parm22; + self.islot7 = parm23; + self.islot8 = parm24; + self.islot9 = parm25; + self.islot10= parm26; + self.islot11= parm27; + self.islot12 = parm28; + self.islot13 = parm29; + self.islot14 = parm30; + self.islot15 = parm31; + self.islot16 = parm32; }; /* @@ -131,6 +190,7 @@ entity() FindIntermission = return spot; objerror ("FindIntermission: no spot"); + return world; }; @@ -410,63 +470,6 @@ entity() SelectSpawnPoint = void() DecodeLevelParms; void() PlayerDie; -/* -=========== -ValidateUser - - -============ -*/ -float(entity e) ValidateUser = -{ -/* - local string s; - local string userclan; - local float rank, rankmin, rankmax; - -// -// if the server has set "clan1" and "clan2", then it -// is a clan match that will allow only those two clans in -// - s = serverinfo("clan1"); - if (s) - { - userclan = masterinfo(e,"clan"); - if (s == userclan) - return true; - s = serverinfo("clan2"); - if (s == userclan) - return true; - return false; - } - -// -// if the server has set "rankmin" and/or "rankmax" then -// the users rank must be between those two values -// - s = masterinfo (e, "rank"); - rank = stof (s); - - s = serverinfo("rankmin"); - if (s) - { - rankmin = stof (s); - if (rank < rankmin) - return false; - } - s = serverinfo("rankmax"); - if (s) - { - rankmax = stof (s); - if (rankmax < rank) - return false; - } - - return true; -*/ -}; - - /* =========== PutClientInServer @@ -501,17 +504,11 @@ void() PutClientInServer = self.materialize = 200; DecodeLevelParms (); - - W_SetCurrentAmmo (); self.attack_finished = time; self.th_pain = player_pain; self.th_die = PlayerDie; - self.slot1 = 17; - self.armor = 2; - self.current_slot = 1; - WeaponAmmo(1); - WeaponAmmo(2); + self.deadflag = DEAD_NO; // paustime is set by teleporters to keep the player from moving a while self.pausetime = 0; @@ -620,7 +617,7 @@ void() PutClientInServer = self.invincible_finished = time + 3; } - + W_SetCurrentAmmo(); }; @@ -1047,46 +1044,49 @@ void() ArmorCheck = local float bit; local float value; + local float aid; + //Armor - if (self.armor == 1) + aid = ToIID(self.islot3); + if (aid == IID_ARM_SHIRT) type = 0.20; - if (self.armor == 2) + if (aid == IID_ARM_LEATHER) type = 0.30; - if (self.armor == 3) + if (aid == IID_ARM_KEVLAR) type = 0.35; - if (self.armor == 4) + if (aid == IID_ARM_METAL) type = 0.35; - if (self.armor == 5) + if (aid == IID_ARM_COMBAT) type = 0.40; - if (self.armor == 6) + if (aid == IID_ARM_BROTHERHOOD) type = 0.45; - if (self.armor == 7) + if (aid == IID_ARM_FORCE) type = 0.10; - if (self.armor == 8) + if (aid == IID_ARM_LPOWER) type = 0.50; - if (self.armor <= 3) + if (aid <= IID_ARM_KEVLAR) self.items = (self.items - (self.items & ((IT_ARMOR1 | IT_ARMOR2) | IT_ARMOR3)) + IT_ARMOR1); - else if (self.armor <= 6) + else if (aid <= IID_ARM_BROTHERHOOD) self.items = (self.items - (self.items & ((IT_ARMOR1 | IT_ARMOR2) | IT_ARMOR3)) + IT_ARMOR1); else self.items = (self.items - (self.items & ((IT_ARMOR1 | IT_ARMOR2) | IT_ARMOR3)) + IT_ARMOR1); - if (self.armor == 1) + if (aid == 1) self.armornoise = "misc/thud.wav"; - if (self.armor == 2) + if (aid == 2) self.armornoise = "misc/thud.wav"; - if (self.armor == 3) + if (aid == 3) self.armornoise = "misc/thud.wav"; - if (self.armor == 4) + if (aid == 4) self.armornoise = "weapons/ric1.wav"; - if (self.armor == 5) + if (aid == 5) self.armornoise = "misc/thud.wav"; - if (self.armor == 6) + if (aid == 6) self.armornoise = "misc/thud.wav"; - if (self.armor == 7) + if (aid == 7) self.armornoise = "misc/laserdef.wav"; - if (self.armor == 8) + if (aid == 8) self.armornoise = "weapons/ric1.wav"; self.armorvalue = type * 100; @@ -1095,10 +1095,26 @@ void() ArmorCheck = void () WeightControl = { + //for each inventory item, add up it's weight. + local float wt; + wt = wt + GetItemsWeight(self.islot1); + wt = wt + GetItemsWeight(self.islot2); + wt = wt + GetItemsWeight(self.islot3); + wt = wt + GetItemsWeight(self.islot4); + wt = wt + GetItemsWeight(self.islot5); + wt = wt + GetItemsWeight(self.islot6); + wt = wt + GetItemsWeight(self.islot7); + wt = wt + GetItemsWeight(self.islot8); + wt = wt + GetItemsWeight(self.islot9); + wt = wt + GetItemsWeight(self.islot10); + wt = wt + GetItemsWeight(self.islot11); + wt = wt + GetItemsWeight(self.islot12); + wt = wt + GetItemsWeight(self.islot13); + wt = wt + GetItemsWeight(self.islot14); + wt = wt + GetItemsWeight(self.islot15); + wt = wt + GetItemsWeight(self.islot16); - GetArmorWeight(); - GetWeaponWeight(self, 1); - GetWeaponWeight(self, 2); + self.weight = wt; if (self.class == 1) self.max_weight = 20; @@ -1520,7 +1536,6 @@ void() PlayerPostThink = if (self.rtime > time) self.weaponframe = 3; - CheckPowerups (); @@ -1661,8 +1676,8 @@ void(entity targ, entity attacker) ClientObituary = bprint (PRINT_MEDIUM, "& "); if (attacker.velocity_z != 0) bprint (PRINT_MEDIUM, "@ "); - if (attacker.current_slot == 1 && attacker.mag1 == 0) - bprint (PRINT_MEDIUM, "! "); +// if (attacker.current_slot == 1 && attacker.mag1 == 0) +// bprint (PRINT_MEDIUM, "! "); bprint (PRINT_MEDIUM, "] "); @@ -1960,43 +1975,30 @@ void(entity targ, entity attacker) ClientObituary = void() Identify = { local string c1, c2, c3, c5, c6, c7; + local float tmp; makevectors (self.v_angle); traceline (self.origin, (self.origin + (v_forward * 2000)), FALSE, self); if (trace_ent.classname == "player" && self.currentmenu == "none" && self.team == trace_ent.team) { if (trace_ent.class == 2) - c1 = "medic\n"; + c1 = "\nmedic\n"; if (trace_ent.class == 3) - c1 = "assassin\n"; + c1 = "\nassassin\n"; if (trace_ent.class == 4) - c1 = "soldier\n"; + c1 = "\nsoldier\n"; if (trace_ent.class == 6) - c1 = "scientist\n"; + c1 = "\nscientist\n"; c2 = ftos (trace_ent.health); - c3 = GetWeaponName (trace_ent, trace_ent.current_slot); + c3 = GetItemName (ToIID(ItemInSlot(trace_ent, trace_ent.current_slot))); - if (trace_ent.armor == 0) - c5 = "\nno armor"; - if (trace_ent.armor == 1) - c5 = "\nlightly armored"; - if (trace_ent.armor == 2) - c5 = "\nleather armor"; - if (trace_ent.armor == 3) - c5 = "\nkevlar armor"; - if (trace_ent.armor == 4) - c5 = "\nmetal armor"; - if (trace_ent.armor == 5) - c5 = "\ncombat armor"; - if (trace_ent.armor == 6) - c5 = "\nbrotherhood armor"; - if (trace_ent.armor == 7) - c5 = "\nforce armor"; - if (trace_ent.armor == 8) - c5 = "\nmetal armor mkii"; + if (trace_ent.islot3 == 0) + c5 = "no armor"; + else + c5 = GetItemName(ToIID(trace_ent.islot3)); - centerprint7 (self, trace_ent.netname, "\n", c1, c2, "\n", c3, c5); + centerprint (self, trace_ent.netname, c1, c2, "\n", c3, "\n", c5); } if (trace_ent.classname == "robowolf" && self.currentmenu == "none") { @@ -2008,12 +2010,12 @@ void() Identify = else c5 = "\nhostile\n"; - centerprint7 (self, trace_ent.netname, c1, c2, c3, c5, "", ""); + centerprint (self, trace_ent.netname, c1, c2, c3, c5, "", ""); } if (trace_ent.classname == "station" && self.currentmenu == "none") { c1 = trace_ent.netname; - if (self.armor == 0) + if (self.armortype == 0) c2 = "uncompleted"; else if (trace_ent.health >= trace_ent.max_health) c2 = "online"; @@ -2026,28 +2028,19 @@ void() Identify = c3 = trace_ent.track.netname; - centerprint7 (self, c1, "\nstationary bot", "\n", c2, "\n", "owned by ", c3); + centerprint (self, c1, "\nstationary bot", "\n", c2, "\n", "owned by ", c3); } if (trace_ent.classname == "monster" && self.currentmenu == "none") { c1 = "hostile"; - c2 = "natural armor"; - if (trace_ent.armor == 1) + + tmp = ToIID(trace_ent.islot3); + if (tmp == 0) + c2 = "natural armor"; + else if (tmp == IID_ARM_SHIRT) c2 = "lightly armored"; - if (trace_ent.armor == 2) - c2 = "leather armor"; - if (trace_ent.armor == 3) - c2 = "kevlar armor"; - if (trace_ent.armor == 4) - c2 = "metal armor"; - if (trace_ent.armor == 5) - c2 = "combat armor"; - if (trace_ent.armor == 6) - c2 = "brotherhood armor"; - if (trace_ent.armor == 7) - c2 = "force armor"; - if (trace_ent.armor == 8) - c2 = "metal armor mkii"; + else + c2 = GetItemName(ToIID(trace_ent.islot3)); if (trace_ent.weapon == 1) c3 = "rifle"; @@ -2060,6 +2053,6 @@ void() Identify = if (trace_ent.weapon >= 5) c3 = "assault rifle"; - centerprint7 (self, trace_ent.netname, "\n", c1, "\n", c2, "\n", c3); + centerprint (self, trace_ent.netname, "\n", c1, "\n", c2, "\n", c3); } }; diff --git a/quakec/fallout2/combat.qc b/quakec/fallout2/combat.qc index 07b07e986..fac27c582 100644 --- a/quakec/fallout2/combat.qc +++ b/quakec/fallout2/combat.qc @@ -192,9 +192,11 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = if (save >= targ.armorvalue) { save = targ.armorvalue; - targ.armortype = 0; // lost all armor +/* targ.armortype = 0; // lost all armor targ.items = targ.items - (targ.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3)); +*/ } + take = ceil(damage-save); @@ -262,8 +264,38 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage = (targ != attacker)&& inflictor.classname !="door") return; + // do the damage - take = take - targ.armor; + //different sorts of armour simply subtract different ammounts + switch(ToIID(targ.islot3)) + { + case IID_ARM_SHIRT: + take -= 1; + break; + case IID_ARM_LEATHER: + take -= 2; + break; + case IID_ARM_KEVLAR: + take -= 3; + break; + case IID_ARM_METAL: + take -= 4; + break; + case IID_ARM_COMBAT: + take -= 5; + break; + case IID_ARM_BROTHERHOOD: + take -= 6; + break; + case IID_ARM_FORCE: + take -= 7; + break; + case IID_ARM_LPOWER: + take -= 8; + break; + default: + break; + } targ.health = targ.health - take; if (targ.health <= 0) diff --git a/quakec/fallout2/defs.qc b/quakec/fallout2/defs.qc index 536cea971..3aa497267 100644 --- a/quakec/fallout2/defs.qc +++ b/quakec/fallout2/defs.qc @@ -212,6 +212,14 @@ void end_sys_globals; // flag for structure dumping void end_sys_fields; // flag for structure dumping //================================================ + + + + +float parm17, parm18, parm18, parm19, parm20, parm21, parm22, parm23, parm24, parm25, parm26, parm27, parm28, parm29, parm30, parm31, parm32; + + + /* ============================================================================== @@ -226,7 +234,9 @@ void end_sys_fields; // flag for structure dumping // float FALSE = 0; +float false = 0; float TRUE = 1; +float true = 1; // edict.flags float FL_FLY = 1; @@ -467,8 +477,9 @@ float timelimit; float fraglimit; float deathmatch; float coop; -float rj = 1; +var float rj = 1; float no_connect; + //================================================ // @@ -581,12 +592,6 @@ float red_armor; .float attack; .float position; .float recoil; -.float ammo1; -.float ammo2; -.float mag1; -.float mag2; -.float maxmag1; -.float maxmag2; .float critical; .float helmet; .float rtime; @@ -603,18 +608,15 @@ float red_armor; .float grenade_hold; .float grab; .float vehicle; -.float slot1_weight; -.float slot2_weight; -.float armor_weight; + +.float weight; .float max_weight; + .float sneak; .float rescued; .float scale; .float bandages; .float scraps; -.float armor; -.float slot1; -.float slot2; .float cycle1; .float cycle2; .float c4; @@ -622,8 +624,6 @@ float red_armor; .float protect; .float perk; .float equipment; -.float chem; -.float chemcount; .float buildtype; .float ctimer; .float flash; @@ -747,8 +747,8 @@ 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; -void(float level, string s) bprint = #23; -void(entity client, float level, string s) sprint = #24; +void(float level, string s, ...) bprint = #23; +void(entity client, float level, string s, ...) sprint = #24; void(string s) dprint = #25; string(float f) ftos = #26; string(vector v) vtos = #27; @@ -758,7 +758,7 @@ void() traceoff = #30; void(entity e) eprint = #31; // prints an entire edict float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE // #33 was removed -float(float yaw, float dist) droptofloor= #34; // TRUE if landed on floor +float() droptofloor= #34; // TRUE if landed on floor void(float style, string value) lightstyle = #35; float(float v) rint = #36; // round to nearest int float(float v) floor = #37; // largest integer <= v @@ -802,8 +802,7 @@ void(string s) changelevel = #70; void(string var, string val) cvar_set = #72; // sets cvar.value -void(entity client, string s) centerprint = #73; // sprint, but in middle -void (entity client, string x1, string x2, string x3, string x4, string x5, string x6, string x7) centerprint7 = #73; +void(entity client, string s, ...) centerprint = #73; // sprint, but in middle void(vector pos, string samp, float vol, float atten) ambientsound = #74; @@ -846,3 +845,6 @@ float (entity e, float healamount, float ignore) T_Heal; // health function float(entity targ, entity inflictor) CanDamage; + + + diff --git a/quakec/fallout2/enforcer.qc b/quakec/fallout2/enforcer.qc index df64f062d..20cdda239 100644 --- a/quakec/fallout2/enforcer.qc +++ b/quakec/fallout2/enforcer.qc @@ -6,6 +6,9 @@ SOLDIER / PLAYER ============================================================================== */ +#define mag1 currentammo +#define maxmag1 cnt + $cd id1/models/enforcer $origin 0 -6 24 $base base @@ -51,13 +54,12 @@ void() enforcer_fire = }; -void (float var, float dam) enforcer_single = +void (float tmp, float dam) enforcer_single = { local vector src; local vector dir; local vector direction; local entity en; - local float var; local float r; local vector targ; local vector org; @@ -66,10 +68,9 @@ void (float var, float dam) enforcer_single = local float ydif; local float xdif; local float true; - local float zdif; if (self.enemy.sneak == 1) - var = var * 2; + tmp = tmp * 2; if (self.mag1 == 0) { @@ -93,7 +94,7 @@ void (float var, float dam) enforcer_single = direction = dir; - traceline (src, src + direction*4000 + v_right*crandom()*var + v_up*crandom()*var, FALSE, self); + traceline (src, src + direction*4000 + v_right*crandom()*tmp + v_up*crandom()*tmp, FALSE, self); if (trace_fraction == PLAT_LOW_TRIGGER) return; @@ -374,7 +375,7 @@ void() monster_enforcer = setsize (self, '-12 -12 -24', '12 12 32'); self.health = 100; - self.armor = 5; + self.islot3 = SlotVal(IID_ARM_COMBAT, 1); self.armortype = 0.5; self.helmet = 1; self.th_stand = enf_stand1; @@ -392,3 +393,6 @@ void() monster_enforcer = walkmonster_start(); return; }; + +#undef mag1 +#undef maxmag1 diff --git a/quakec/fallout2/fight.qc b/quakec/fallout2/fight.qc index 23466f89b..7db4be9b2 100644 --- a/quakec/fallout2/fight.qc +++ b/quakec/fallout2/fight.qc @@ -288,7 +288,6 @@ float() ShamCheckAttack = local vector spot1, spot2; local entity targ; local float chance; - local float enemy_yaw; if (enemy_range == RANGE_MELEE) { diff --git a/quakec/fallout2/misc.qc b/quakec/fallout2/misc.qc index 6ba82b57d..fd26a959d 100644 --- a/quakec/fallout2/misc.qc +++ b/quakec/fallout2/misc.qc @@ -176,7 +176,7 @@ void() misc_fireball = self.nextthink = time + (random() * 5); self.think = fire_fly; if (!self.speed) - self.speed == 1000; + self.speed = 1000; }; void() fire_fly = @@ -335,8 +335,6 @@ void() Laser_Touch = void(vector org, vector vec) LaunchLaser = { - local vector vec; - if (self.classname == "monster_enforcer") sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM); @@ -591,7 +589,7 @@ void() func_illusionary = self.movetype = MOVETYPE_NONE; self.solid = SOLID_NOT; setmodel (self, self.model); - makestatic (); + makestatic (self); }; /*QUAKED func_episodegate (0 .5 .8) ? E1 E2 E3 E4 diff --git a/quakec/fallout2/mod_buy.qc b/quakec/fallout2/mod_buy.qc index 77707a5f1..de15b735f 100644 --- a/quakec/fallout2/mod_buy.qc +++ b/quakec/fallout2/mod_buy.qc @@ -76,6 +76,7 @@ void() BuyBandages = void(float cost, float type) BuyChem = { +/* local string x; local float y; @@ -110,6 +111,7 @@ void(float cost, float type) BuyChem = x = GetChemName(); sprint (self, PRINT_HIGH, x); sprint(self, PRINT_HIGH, " purchased.\n"); +*/ }; void(string type) ChangeAmmo = @@ -169,6 +171,7 @@ void() BuyScraps = void (float wt, float cost, float item) BuyWeapon = { +/* local float lbs; local string qq; local float curr; @@ -245,6 +248,7 @@ void (float wt, float cost, float item) BuyWeapon = GetWeaponWeight (self, 2); GetWeaponModel (); return; +*/ }; void (float cost, float item) BuyPerk = @@ -263,6 +267,7 @@ void (float cost, float item) BuyPerk = void (float wt, float cost, float item) BuyArmor = { +/* local float curr; local float lbs; local string x; @@ -280,7 +285,7 @@ void (float wt, float cost, float item) BuyArmor = self.currentmenu = "none"; return; } - if ((((lbs + wt) - self.armor_weight) > self.max_weight)) + if ((((lbs + wt) - GetItemsWeight(self.islot3)) > self.max_weight)) { sprint (self, PRINT_HIGH, "you can't carry that much.\n"); self.currentmenu = "none"; @@ -288,13 +293,14 @@ void (float wt, float cost, float item) BuyArmor = } sound (self, CHAN_BODY, "misc/item2.wav", 1, ATTN_NORM); self.ammo_shells = (self.ammo_shells - cost); - self.armor_weight = wt; +// self.armor_weight = wt; self.armor = item; x = GetArmorName(); sprint (self, PRINT_HIGH, x); sprint (self, PRINT_HIGH, " purchased.\n"); return; +*/ }; void (float cost, float item) BuyEquipment = @@ -322,12 +328,14 @@ void (float cost, float item) BuyProtect = { local string x; +/* if ((self.armor >= TE_LIGHTNING2)) { sprint (self, PRINT_HIGH, "too many electronics in\nyour currently worn armor!"); self.currentmenu = "none"; return; } +*/ if ((cost > self.ammo_shells)) { sprint (self, PRINT_HIGH, "not enough money.\n"); @@ -347,20 +355,20 @@ void (float cost, float item) BuyProtect = float (float input) overweight = { - local float var; + local float tmp; local float max; - var = ((((input) + self.armor_weight) + self.slot1_weight) + self.slot2_weight); + tmp = input + self.weight; max = self.max_weight; - if ((self.class == TE_LIGHTNING2)) + if (self.class == TE_LIGHTNING2) { - max = (max + SPAWNFLAG_LASER); + max = max + SPAWNFLAG_LASER; } - if ((self.perk == TE_LAVASPLASH)) + if (self.perk == TE_LAVASPLASH) { return (FALSE); } - if ((var > max)) + if (tmp > max) { return (TRUE); } @@ -370,14 +378,6 @@ float (float input) overweight = } }; -float () weightx = -{ - local float var; - - var = self.slot1_weight + self.slot2_weight + self.armor_weight; - return var; -}; - void () W_GetClass = { if ((self.currentmenu == "select_skill")) diff --git a/quakec/fallout2/modbuy.qc b/quakec/fallout2/modbuy.qc index 5f1b9ab9f..d91c07d49 100644 --- a/quakec/fallout2/modbuy.qc +++ b/quakec/fallout2/modbuy.qc @@ -169,6 +169,12 @@ void() BuyScraps = void (float wt, float cost, float item) BuyWeapon = { + sprint (self, PRINT_HIGH, "The shop is not open today.\n"); + self.currentmenu = "none"; + SetWeaponModel (); + return; + +/* local float lbs; local string qq; local float curr; @@ -247,6 +253,7 @@ void (float wt, float cost, float item) BuyWeapon = GetWeaponWeight (self, 2); GetWeaponModel (); return; +*/ }; void (float cost, float item) BuyPerk = @@ -349,10 +356,10 @@ void (float cost, float item) BuyProtect = float (float input) overweight = { - local float var; + local float tmp; local float max; - var = ((((input) + self.armor_weight) + self.slot1_weight) + self.slot2_weight); + tmp = ((((input) + self.armor_weight) + self.slot1_weight) + self.slot2_weight); max = self.max_weight; if ((self.class == TE_LIGHTNING2)) { @@ -362,7 +369,7 @@ float (float input) overweight = { return (FALSE); } - if ((var > max)) + if ((tmp > max)) { return (TRUE); } @@ -374,10 +381,10 @@ float (float input) overweight = float () weightx = { - local float var; + local float tmp; - var = self.slot1_weight + self.slot2_weight + self.armor_weight; - return var; + tmp = self.slot1_weight + self.slot2_weight + self.armor_weight; + return tmp; }; void () W_GetClass = diff --git a/quakec/fallout2/name.qc b/quakec/fallout2/name.qc index 4ca0ea2f9..ccc15d2f8 100644 --- a/quakec/fallout2/name.qc +++ b/quakec/fallout2/name.qc @@ -1,85 +1,5 @@ -string (entity guy, float slot) GetWeaponName = -{ - local string name; - if (slot == 0) - name = "bare hands"; - if (slot == 1) - name = "knife"; - else if (slot == 2) - name = "axe"; - else if (slot == 3) - name = "ripper"; - else if (slot == 4) - name = "power axe"; - else if (slot == 5) - name = "1911"; - else if (slot == 6) - name = "desert eagle"; - else if (slot == 7) - name = "needler"; - else if (slot == 8) - name = "alien blaster"; - else if (slot == 9) - name = "pipe rifle"; - else if (slot == 10) - name = "winchester"; - else if (slot == 11) - name = "mossberg"; - else if (slot == 12) - name = "citykiller"; - else if (slot == 13) - name = "mp9"; - else if (slot == 14) - name = "grease gun"; - else if (slot == 15) - name = "rangemaster"; - else if (slot == 16) - name = "ak-112"; - else if (slot == 17) - name = "ak-74"; - else if (slot == 18) - name = "dks-1"; - else if (slot == 19) - name = "moonlight"; - else if (slot == 20) - name = "sa-80"; - else if (slot == 21) - name = "gauss rifle"; - else if (slot == 22) - name = "laser carbine"; - return name; -}; - -string () GetArmorName = -{ - local string name; - local float slot; - - slot = self.armor; - - if (slot == 0) - name = "none"; - else if (slot == 1) - name = "bulletproof shirt"; - else if (slot == 2) - name = "leather armor"; - else if (slot == 3) - name = "kevlar armor"; - else if (slot == 4) - name = "metal armor"; - else if (slot == 5) - name = "combat armor"; - else if (slot == 6) - name = "brotherhood armor"; - else if (slot == 7) - name = "force armor"; - else if (slot == 8) - name = "light power armor"; - - return name; -}; string () GetEquipmentName = diff --git a/quakec/fallout2/ogre.qc b/quakec/fallout2/ogre.qc index 54c7f798d..6ce4b7a5e 100644 --- a/quakec/fallout2/ogre.qc +++ b/quakec/fallout2/ogre.qc @@ -363,7 +363,7 @@ void () ogre_smash11 = [ 57, ogre_smash12 ] void () ogre_smash12 = [ 58, ogre_smash13 ] { - ai_charge (); + ai_charge (0); }; void () ogre_smash13 = [ 59, ogre_smash14 ] diff --git a/quakec/fallout2/player.qc b/quakec/fallout2/player.qc index f99fe282a..e8c40c171 100644 --- a/quakec/fallout2/player.qc +++ b/quakec/fallout2/player.qc @@ -57,28 +57,16 @@ void () Footstep = float (entity guy) holding_melee = { - if ((guy.current_slot == WEAPON_SHOTGUN)) - { - if ((guy.slot1 <= TE_WIZSPIKE)) - { - return (TRUE); - } - if ((guy.slot1 >= WEAPON_BIG)) - { - return (FALSE); - } - } - if ((guy.current_slot == WEAPON_ROCKET)) - { - if ((guy.slot2 <= TE_WIZSPIKE)) - { - return (TRUE); - } - if ((guy.slot2 >= WEAPON_BIG)) - { - return (FALSE); - } - } + local float iid; + iid = ToIID(ItemInSlot(guy, guy.current_slot)); + + if (iid == IID_NONE || + iid == IID_WP_KNIFE || + iid == IID_WP_AXE || + iid == IID_WP_VIBROBLADE || + iid == IID_WP_POWERAXE) + return true; + return false; }; void () player_crouch; @@ -208,7 +196,6 @@ void () player_reload1 = [ 123, player_reload2 ] void () player_reload2 = [ 124, player_reload3 ] { - }; void () player_reload3 = [ 125, player_reload4 ] @@ -601,6 +588,8 @@ void () player_pull11 = [ 155, player_run ] void () player_throw1 = [ 155, player_throw2 ] { + self.attack_finished = time + 1; + self.weaponframe = 12; if (((random () * WEAPON_BIG) <= WEAPON_SPIKES)) sound (self, CHAN_VOICE, "radio/grenade.wav", 0.7, ATTN_NORM); @@ -611,57 +600,63 @@ void () player_throw1 = [ 155, player_throw2 ] void () player_throw2 = [ 156, player_throw3 ] { self.weaponframe = TE_LIGHTNINGBLOOD; - //FireHandGrenade (); + FireHandGrenade (); + self.attack_finished = time + 1; }; void () player_throw3 = [ 157, player_throw4 ] { self.weaponframe = IDLE2A; + self.attack_finished = time + 1; }; void () player_throw4 = [ 158, player_throw5 ] { self.weaponframe = IDLE3A; + self.attack_finished = time + 1; }; void () player_throw5 = [ 157, player_throw6 ] { self.weaponframe = EF_FLAG1; + self.attack_finished = time + 1; }; void () player_throw6 = [ 156, player_throw7 ] { self.weaponframe = IDLE5A; + self.attack_finished = time + 1; }; void () player_throw7 = [ 155, player_throw8 ] { self.weaponframe = IDLE6A; - if (self.handgrenade <= 0) - stuffcmd (self, "impulse 1\n"); - else - stuffcmd (self, "impulse 3\n"); - + self.attack_finished = time + 1; }; void () player_throw8 = [ 159, player_throw9 ] { self.weaponframe = IDLE7A; + self.attack_finished = time + 1; }; void () player_throw9 = [ 160, player_throw10 ] { self.weaponframe = IDLE8A; + self.attack_finished = time + 1; }; void () player_throw10 = [ 161, player_throw11 ] { self.weaponframe = IDLE9A; + self.attack_finished = time + 1; }; void () player_throw11 = [ 162, player_run ] { self.weaponframe = IDLE10A; + self.attack_finished = self.nextthink; + W_SetCurrentAmmo(); }; void () player_shotty1b = [ 183, player_shotty2b ] diff --git a/quakec/fallout2/progs.src b/quakec/fallout2/progs.src index 97ef30287..29b829e9a 100644 --- a/quakec/fallout2/progs.src +++ b/quakec/fallout2/progs.src @@ -1,6 +1,7 @@ -../quake/turn/qwprogs.dat +../qwprogs.dat defs.qc +inventory.qc subs.qc fight.qc @@ -31,3 +32,4 @@ dog.qc ogre.qc misc.qc mod_buy.qc +cmds.qc \ No newline at end of file diff --git a/quakec/fallout2/soldier.qc b/quakec/fallout2/soldier.qc index b0114474d..ac0d7fe82 100644 --- a/quakec/fallout2/soldier.qc +++ b/quakec/fallout2/soldier.qc @@ -1,13 +1,16 @@ +#define mag1 currentammo +#define maxmag1 cnt + + void () army_load1; //PISTOL -void (float var, float dam) army_fire = +void (float tmp, float dam) army_fire = { local vector src; local vector dir; local vector direction; local entity en; - local float var; local float r; local vector targ; local vector org; @@ -16,10 +19,9 @@ void (float var, float dam) army_fire = local float ydif; local float xdif; local float true; - local float zdif; if (self.enemy.sneak == 1) - var = var * 2; + tmp = tmp * 2; if (self.mag1 == 0) { @@ -46,7 +48,7 @@ void (float var, float dam) army_fire = direction = dir; - traceline (src, src + direction*2048 + v_right*crandom()*var + v_up*crandom()*var, FALSE, self); + traceline (src, src + direction*2048 + v_right*crandom()*tmp + v_up*crandom()*tmp, FALSE, self); if (trace_fraction == PLAT_LOW_TRIGGER) return; @@ -71,13 +73,12 @@ void (float var, float dam) army_fire = //RIFLE -void (float var, float dam) army_fire1 = +void (float tmp, float dam) army_fire1 = { local vector src; local vector dir; local vector direction; local entity en; - local float var; local float r; local vector targ; local vector org; @@ -86,10 +87,9 @@ void (float var, float dam) army_fire1 = local float ydif; local float xdif; local float true; - local float zdif; if (self.enemy.sneak == 1) - var = var * 2; + tmp = tmp * 2; if (self.mag1 == 0) { @@ -140,13 +140,12 @@ void (float var, float dam) army_fire1 = //SHOTGUN -void (float var, float dam) army_fire2 = +void (float tmp, float dam) army_fire2 = { local vector src; local vector dir; local vector direction; local entity en; - local float var; local float r; local vector targ; local vector org; @@ -156,7 +155,7 @@ void (float var, float dam) army_fire2 = local float dif; if (self.enemy.sneak == 1) - var = var * 2; + tmp = tmp * 2; if (self.mag1 == 0) { @@ -240,13 +239,12 @@ void (float var, float dam) army_fire2 = }; //SMG -void (float var, float dam) army_fire3 = +void (float tmp, float dam) army_fire3 = { local vector src; local vector dir; local vector direction; local entity en; - local float var; local float r; local vector targ; local vector org; @@ -255,7 +253,6 @@ void (float var, float dam) army_fire3 = local float ydif; local float xdif; local float true; - local float zdif; if (self.mag1 == 0) { @@ -266,7 +263,7 @@ void (float var, float dam) army_fire3 = } if (self.enemy.sneak == 1) - var = var * 2; + tmp = tmp * 2; self.mag1 = self.mag1 - 1; @@ -282,7 +279,7 @@ void (float var, float dam) army_fire3 = direction = dir; - traceline (src, src + direction*1024 + v_right*crandom()*var + v_up*crandom()*var, FALSE, self); + traceline (src, src + direction*1024 + v_right*crandom()*tmp + v_up*crandom()*tmp, FALSE, self); if (trace_fraction == PLAT_LOW_TRIGGER) return; @@ -306,13 +303,12 @@ void (float var, float dam) army_fire3 = }; //Assault Rifle -void (float var, float dam) army_fire4 = +void (float tmp, float dam) army_fire4 = { local vector src; local vector dir; local vector direction; local entity en; - local float var; local float r; local vector targ; local vector org; @@ -332,7 +328,7 @@ void (float var, float dam) army_fire4 = } if (self.enemy.sneak == 1) - var = var * 2; + tmp = tmp * 2; self.mag1 = self.mag1 - 1; @@ -348,7 +344,7 @@ void (float var, float dam) army_fire4 = direction = dir; - traceline (src, src + direction*2048 + v_right*crandom()*var + v_up*crandom()*var, FALSE, self); + traceline (src, src + direction*2048 + v_right*crandom()*tmp + v_up*crandom()*tmp, FALSE, self); if (trace_fraction == PLAT_LOW_TRIGGER) return; @@ -1332,7 +1328,7 @@ void () monster_army = setsize (self, '-12 -12 -24', '12 12 32'); self.health = 120; - self.armor = 5; + self.islot3 = SlotVal(IID_ARM_COMBAT, 1); self.armortype = 35; self.th_stand = enf_stand1; self.th_walk = enf_walk1; @@ -1374,7 +1370,7 @@ void () monster_army = setsize (self, '-16 -16 -24', '16 16 32'); self.health = 90; self.team = 3; - self.armor = 2; + self.islot3 = SlotVal(IID_ARM_LEATHER, 1); self.armortype = 0.2; self.armornoise = "misc/thud.wav"; self.th_stand = army_stand1; @@ -1408,3 +1404,5 @@ void () monster_army = self.maxmag1 = self.mag1; }; +#undef mag1 +#undef maxmag1 diff --git a/quakec/fallout2/subs.qc b/quakec/fallout2/subs.qc index 3346c0dc4..0f0fd3a72 100644 --- a/quakec/fallout2/subs.qc +++ b/quakec/fallout2/subs.qc @@ -15,7 +15,7 @@ void(float normal) SUB_AttackFinished = QuakeEd only writes a single float for angles (bad idea), so up and down are just constant angles. */ -vector() SetMovedir = +void() SetMovedir = { if (self.angles == '0 -1 0') self.movedir = '0 0 1'; diff --git a/quakec/fallout2/weapons.qc b/quakec/fallout2/weapons.qc index 879ae7650..210a782e7 100644 --- a/quakec/fallout2/weapons.qc +++ b/quakec/fallout2/weapons.qc @@ -16,16 +16,16 @@ void () BuyMenu; void() Sneak; void() Bandage; void() Shield; +void () player_throw1; void() player_knife1; void() player_knifea; void() ExitScreen; void() CharacterSheet; void() UseEquipment; -void (float weap, float snd, float drop) DropWeapon; +void (float slot, float snd, float drop) DropFromSlot; void() PositionControl; -float () weightx; -void (entity guy, float slot) GetWeaponWeight; +#define weightx() (self.weight) // called by worldspawn @@ -45,6 +45,8 @@ void() W_Precache = precache_sound ("weapons/grenade.wav"); // grenade launcher precache_sound ("weapons/bounce.wav"); // grenade bounce precache_sound ("weapons/shotgn2.wav"); // super shotgun + + precache_model ("progs/v_handgren.mdl"); }; float() crandom = @@ -113,7 +115,6 @@ SpawnMeatSpray void(vector org, vector vel) SpawnMeatSpray = { local entity missile; - local vector org; missile = spawn (); missile.owner = self; @@ -811,8 +812,11 @@ PLAYER WEAPON USE =============================================================================== */ -void(float temp_weapon) GetWeaponModel = +void() SetWeaponModel = { + self.weaponmodel = GetItemVModel(ToIID(ItemInSlot(self, self.current_slot))); + +/* if (temp_weapon == 0) self.weaponmodel = "progs/v_fist.mdl"; else if (temp_weapon == 1) @@ -855,6 +859,7 @@ void(float temp_weapon) GetWeaponModel = self.weaponmodel = "progs/v_night.mdl"; else if (temp_weapon == 99) self.weaponmodel = "progs/v_handgren.mdl"; +*/ }; void() W_SetCurrentAmmo = @@ -867,10 +872,11 @@ void() W_SetCurrentAmmo = self.items = self.items - ( self.items & (IT_SHELLS | IT_NAILS | IT_ROCKETS | IT_CELLS) ); +/*SPIKEREMOVED if (self.current_slot == 1) - self.currentammo = self.mag1; + self.currentammo = ToStatus(self.islot1); else if (self.current_slot == 2) - self.currentammo = self.mag2; + self.currentammo = ToStatus(self.islot2); else if (self.current_slot == 3 && self.handgrenade > 0) self.currentammo = self.handgrenade; else if (self.current_slot == 4) @@ -885,32 +891,27 @@ void() W_SetCurrentAmmo = else sound (self, CHAN_WEAPON, "misc/menu3.wav", 1, ATTN_NORM); } - else +*/ +// else sound (self, CHAN_WEAPON, "misc/menu3.wav", 1, ATTN_NORM); if (self.current_slot == 1) - x = GetWeaponName(self, self.slot1); + x = GetItemName(ToIID(self.islot1)); if (self.current_slot == 2) - x = GetWeaponName(self, self.slot2); + x = GetItemName(ToIID(self.islot2)); +/*SPIKEREMOVED if (self.current_slot == 3) x = "grenade"; if (self.current_slot == 4) x = "tools"; +*/ sprint(self, 2, x); sprint (self, PRINT_HIGH, " selected.\n"); sound (self, CHAN_WEAPON, "misc/weapon.wav", 1, ATTN_NORM); - if (self.current_slot == 1) - GetWeaponModel(self.slot1); - if (self.current_slot == 2) - GetWeaponModel(self.slot2); - if (self.current_slot == 3) - GetWeaponModel(99); + SetWeaponModel(); - if (self.current_slot == 1) - self.currentammo = self.mag1; - if (self.current_slot == 2) - self.currentammo = self.mag2; + self.currentammo = ToStatus(ItemInSlot(self, self.current_slot)); }; float() W_BestWeapon = @@ -941,116 +942,102 @@ float() W_BestWeapon = return IT_AXE; }; -void () ReloadWeapon = +void (float slotno) ReloadWeapon = { + local float at; + local float as; + local float asv; + local float ac; local float x; + local float wid; - if (self.current_slot != 1 && self.current_slot != 2) + local .float wslot; + + if (self.rtime > time || self.attack_finished > time) return; - if (self.rtime > time) - return; + wslot = SlotField(slotno); - if (self.current_slot == 1) + if (self.wslot == 0) + return; //already empty.. + + wid = ToIID(self.wslot); + at = WeaponAmmoType(wid); + as = SlotOfItem(self, at); + if (as == 0) { - if (self.ammo1 <= 0) - return; - if (self.maxmag1 == self.mag1) - return; - if (self.slot1 <= 4) - return; - - if (self.slot1 >= 9 && self.slot1 <= 11) - { - sound (self, CHAN_WEAPON, "weapons/shell.wav", TRUE, ATTN_NORM); - self.mag1 = self.mag1 + 1; - self.ammo1 = self.ammo1 - 1; - self.currentammo = self.mag1; - self.rtime = time + 0.5; - player_run(); - return; - } - sound (self, CHAN_WEAPON, "weapons/reload.wav", TRUE, ATTN_NORM); - sprint(self, 2, "reloading...\n"); - - x = (self.maxmag1 - self.mag1); - self.mag1 = self.mag1 + x; - self.ammo1 = self.ammo1 - x; - self.currentammo = self.mag1; - self.rtime = time + 2; - player_run(); + sprint(self, 2, "no suitable ammo\n"); return; } - if (self.current_slot == 2) - { - if (self.ammo2 <= 0) - return; - if (self.maxmag2 == self.mag2) - return; - if (self.slot2 <= 4) - return; + asv = ItemInSlot(self, as); + ac = ToStatus(asv); - if (self.slot2 >= 9 && self.slot2 <= 11) - { - sound (self, CHAN_WEAPON, "weapons/shell.wav", TRUE, ATTN_NORM); - self.mag2 = self.mag2 + 1; - self.ammo2 = self.ammo2 - 1; - self.currentammo = self.mag2; - self.rtime = time + 0.5; - player_run(); - return; - } + x = WeaponMagQuant(wid); //get the max ammo capacity + x = x - ToStatus(self.wslot); //take away the ammo currently in the weapon + if (x > ac) //make sure there's enough ammo + x = ac; + ac -= x; + + if (ac) + asv = SlotVal(at, ac); + else + asv = 0; //totally used up. + + SetItemSlot(self, as, asv); + + self.wslot = SlotVal(wid, x + ToStatus(self.wslot)); + + if (wid == IID_WP_PIPERIFLE || wid == IID_WP_WINCHESTER || wid == IID_WP_MOSSBERG) + sound (self, CHAN_WEAPON, "weapons/shell.wav", TRUE, ATTN_NORM); + else sound (self, CHAN_WEAPON, "weapons/reload.wav", TRUE, ATTN_NORM); - sprint(self, 2, "reloading...\n"); + sprint(self, 2, "reloading...\n"); - x = (self.maxmag2 - self.mag2); - self.mag2 = self.mag2 + x; - self.ammo2 = self.ammo2 - x; - self.currentammo = self.mag2; - self.rtime = time + 2; - player_run(); - return; + if (self.perk == 3) + { + self.attack_finished = time + 1; + self.rtime = time + 1; } + else + { + self.attack_finished = time + 2; + self.rtime = time + 2; + } + + if (self.current_slot == slotno) + self.currentammo = ToStatus(ItemInSlot(self, slotno)); + + player_run(); }; float() W_CheckNoAmmo = { - if (self.current_slot == 1) + local float at; + local .float slotfield; + slotfield = SlotField(self.current_slot); + + if (ToIID(self.slotfield) == IID_NONE) + return FALSE; + + if (ToStatus(self.slotfield) < 1) { - if (self.slot1 <= 4) + at = WeaponAmmoType(ToIID(self.slotfield)); + if (at == 0) return FALSE; - if (self.mag1 < 1 && self.ammo1 < 1) + at = SlotOfItem(self, at); + if (at == 0) { self.attack_finished = (time + 0.2); stuffcmd (self, "-attack\n"); sound (self, CHAN_WEAPON, "weapons/click.wav", TRUE, ATTN_NORM); return TRUE; } - if (self.mag1 <= 0) + else { stuffcmd (self, "-attack\n"); - ReloadWeapon (); - return TRUE; - } - } - if (self.current_slot == 2) - { - if (self.slot2 <= 4) - return FALSE; - - if (self.mag2 < 2 && self.ammo2 < 2) - { - self.attack_finished = (time + 0.2); - stuffcmd (self, "-attack\n"); - sound (self, CHAN_WEAPON, "weapons/click.wav", TRUE, ATTN_NORM); - return TRUE; - } - if (self.mag2 <= 0) - { - stuffcmd (self, "-attack\n"); - ReloadWeapon (); + ReloadWeapon (self.current_slot); return TRUE; } } @@ -1073,52 +1060,68 @@ void() W_Attack = makevectors (self.v_angle); // calculate forward angle for velocity self.show_hostile = time + 1; // wake monsters up - if (self.current_slot == 1) - weap = self.slot1; - if (self.current_slot == 2) - weap = self.slot2; - - if (W_CheckNoAmmo()) - return; - if (self.rtime > time) return; - if (weap >= 0 && weap <= 4) + if (W_CheckNoAmmo()) + return; + weap = ToIID(self.(SlotField(self.current_slot))); + + + if (weap == IID_NONE || + weap == IID_WP_KNIFE || + weap == IID_WP_AXE || + weap == IID_WP_VIBROBLADE || + weap == IID_WP_POWERAXE) { self.attack_finished = time + 0.25; player_knife1 (); } - else if (weap == 5) + else if (weap == IID_WP_USP) FirePistol(10, 2, "weapons/1911.wav", 2000, 0.25); - else if (weap == 6) + else if (weap == IID_WP_DEAGLE) FirePistol(10, 2, "weapons/deagle.wav", 2000, 0.25); - else if (weap == 7) + else if (weap == IID_WP_NEEDLER) FirePistol(10, 2, "weapons/needler.wav", 2000, 0.25); - //if (weap == 8) + //if (weap == IID_WP_ALIENBLASTER) // FireAlienBlaster(); - else if (weap == 9) + else if (weap == IID_WP_PIPERIFLE) FireAssaultRifle(18, 2, "weapons/rangem.wav", 3000, 0.1); - else if (weap == 10) + else if (weap == IID_WP_WINCHESTER) W_FireShotgun (1, 5, 6, 160, 3000, 0); - else if (weap == 11) + else if (weap == IID_WP_MOSSBERG) W_FireShotgun (1, 5, 6, 160, 3000, 0); - else if (weap == 12) + else if (weap == IID_WP_JACKHAMMER) W_FireShotgun (1, 5, 6, 160, 3000, 1); - else if (weap == 13) + else if (weap == IID_WP_MP9) FireSMG(12, 2, "weapons/mp9.wav", 2000, 0.1); - else if (weap == 14) + else if (weap == IID_WP_MP7) FireSMG(12, 2, "weapons/mp7.wav", 2000, 0.1); - else if (weap == 15) + else if (weap == IID_WP_RANGERMASTER) FireAssaultRifle(14, 2, "weapons/rangem.wav", 4000, 0.5); - else if (weap == 16) + else if (weap == IID_WP_AK112) FireAssaultRifle(14, 2, "weapons/rangem.wav", 4000, 0.1); - else if (weap == 17) + else if (weap == IID_WP_AK74) FireAssaultRifle(18, 2, "weapons/ak47.wav", 6000, 0.1); - else if (weap == 18) + else if (weap == IID_WP_DKS1) FireAssaultRifle(30, 2, "weapons/dks-1.wav", 8000, 0.5); - else if (weap == 19) + else if (weap == IID_WP_MOONLIGHT) FireAssaultRifle(16, 2, "weapons/m4a1.wav", 4000, 0.1); + + else if (weap == IID_GREN_FRAG) + player_throw1(); + else if (weap == IID_GREN_EMP) + player_throw1(); + else if (weap == IID_GREN_SMOKE) + player_throw1(); + else if (weap == IID_GREN_FLASH) + player_throw1(); + +//float IID_WP_SA80 = 420; +//float IID_WP_GAUSERIFLE = 421; +//float IID_WP_PULSERIFLE = 422; + else + centerprint(self, "Not implemented (", ftos(weap), ")"); }; /* @@ -1167,28 +1170,7 @@ CheatCommand */ void() CheatCommand = { -// if (deathmatch || coop) - return; - self.ammo_rockets = 100; - self.ammo_nails = 200; - self.ammo_shells = 100; - self.items = self.items | - IT_AXE | - IT_SHOTGUN | - IT_SUPER_SHOTGUN | - IT_NAILGUN | - IT_SUPER_NAILGUN | - IT_GRENADE_LAUNCHER | - IT_ROCKET_LAUNCHER | - IT_KEY1 | IT_KEY2; - - self.ammo_cells = 200; - self.items = self.items | IT_LIGHTNING; - - self.weapon = IT_ROCKET_LAUNCHER; - self.impulse = 0; - W_SetCurrentAmmo (); }; /* @@ -1437,9 +1419,9 @@ void() ImpulseCommands = ProneOn (); if (self.impulse == 50) - ReloadWeapon (); - if (self.impulse == 51) - UseChem (); + ReloadWeapon (self.current_slot); +// if (self.impulse == 51) +// UseChem (); if (self.impulse == 52) BuyMenu (); if (self.impulse == 53) @@ -1447,12 +1429,7 @@ void() ImpulseCommands = if (self.impulse == 54) ExitScreen (); if (self.impulse == 55) - { - if (self.current_slot == 1) - DropWeapon (self.slot1, 1, 0); - else - DropWeapon (self.slot2, 1, 0); - } + DropFromSlot (self.current_slot, 1, 0); if (self.impulse == 56) CharacterSheet (); if (self.impulse == 57) @@ -1506,21 +1483,14 @@ void() SuperDamageSound = void () DropAmmo = { - if (self.current_slot == 1) - { - self.currentammo = (self.mag1 - 1); - self.mag1 = (self.mag1 - 1); - self.ammo_nails = self.ammo1; - } - if (self.current_slot == 2) - { - self.currentammo = (self.mag2 - 1); - self.mag2 = (self.mag2 - 1); - self.ammo_nails = self.ammo2; - } + local .float wslot; + wslot = SlotField(self.current_slot); + + self.wslot = SlotVal(ToIID(self.wslot), ToStatus(self.wslot)-1); + self.currentammo = ToStatus(self.wslot); }; -void()muzzleflash = +void() muzzleflash = { WriteByte (MSG_MULTICAST, SVC_MUZZLEFLASH); WriteEntity (MSG_MULTICAST, self); @@ -1536,9 +1506,9 @@ void () autofire = if (self.weaponframe == 1) - self.weaponframe == 2; + self.weaponframe = 2; else if (self.weaponframe == 2) - self.weaponframe == 1; + self.weaponframe = 1; muzzleflash (); }; @@ -1551,9 +1521,9 @@ void () autofire_s = self.frame = 88; if (self.weaponframe == 1) - self.weaponframe == 2; + self.weaponframe = 2; else if (self.weaponframe == 2) - self.weaponframe == 1; + self.weaponframe = 1; muzzleflash (); }; @@ -1621,7 +1591,6 @@ void (vector test, float length, float dam) penetrate = local float zdif; local float ydif; local float xdif; - local float true; local float go; local float tl; @@ -1846,6 +1815,7 @@ void () FlashExplode = remove (self); }; +/* void () HandGrenExplode = { if ((self.cnt == 0)) @@ -1882,6 +1852,7 @@ void () HandGrenExplode = } } }; +*/ void () HandGrenBounce = { @@ -1911,17 +1882,23 @@ void () HandGrenBounce = void () FireHandGrenade = { - local float type; + local float item, iid; + local float count; - if (self.handgrenade <= 0) + item = ItemInSlot(self, self.current_slot); + iid = ToIID(item); + count = ToStatus(item); + if (iid == 0) return; - - type = self.grenadetype; + + self.currentammo = count-1; + if (count <= 1) + SetItemSlot(self, self.current_slot, 0); + else + SetItemSlot(self, self.current_slot, SlotVal(iid, self.currentammo)); + - self.handgrenade = self.handgrenade - 1; - self.grenadetype = 0; - self.currentammo = 0; msg_entity = self; WriteByte (MSG_ONE, SVC_SMALLKICK); @@ -1943,13 +1920,13 @@ void () FireHandGrenade = newmis.touch = HandGrenBounce; newmis.nextthink = (time + 2.5); - if (type == 1) + if (iid == IID_GREN_FRAG) newmis.think = FragExplode; - if (type == 2) + else if (iid == IID_GREN_EMP) newmis.think = EMPExplode; - if (type == 3) + else if (iid == IID_GREN_SMOKE) newmis.think = SmokeThink; - if (type == 4) + else //if (iid == IID_GREN_FLASH) newmis.think = FlashExplode; newmis.frame = 1; @@ -1962,24 +1939,31 @@ void () FireHandGrenade = void(float slot, float magazine) GiveAmmo = { - if (slot == 1) - { - self.maxmag1 = magazine; - self.ammo1 = magazine * 4; - self.mag1 = magazine; - } - if (slot == 2) - { - self.maxmag2 = magazine; - self.ammo2 = magazine * 4; - self.mag2 = magazine; - } + local float wi; + local float wt; + local float at; + local float as; + + //give ammo to the weapon in a slot + wi = ItemInSlot(self, slot); + wt = ToIID(wi); + SetItemSlot(self, slot, SlotVal(wt, magazine)); + + at = WeaponAmmoType(wt); + //make sure we have enough ammo + as = SlotOfItem(self, at); + if (as == 0) + as = SlotOfItem(self, IID_NONE); + if (as == 0) + return; //no free slots, so we can't give them ammo + if (ToStatus(ItemInSlot(self, as)) < magazine*4) + SetItemSlot(self, as, SlotVal(at, magazine*4)); }; void (float dam, float rec, string snd, float rng, float rate) FirePistol = { - local float var, var1, var2, zdif, xdif, ydif, true; + local float tmp, var1, var2, zdif, xdif, ydif, tru; local vector dir, source, targ, org, org2, adjust; local string x; @@ -2026,25 +2010,25 @@ void (float dam, float rec, string snd, float rng, float rate) FirePistol = player_single1 (); } - var = 50; + tmp = 50; if (self.velocity != '0 0 0') - var = 400; + tmp = 400; - var = var + (40 * self.recoil); + tmp = tmp + (40 * self.recoil); if (self.attack <= 3 && self.position == 1 && self.velocity_z == 0) - var = (var * 0.75); + tmp = (tmp * 0.75); if (self.attack <= 3 && self.position == 2 && self.velocity_z == 0) - var = (var * 0.5); + tmp = (tmp * 0.5); self.attack = self.attack + 1; self.recoil = self.recoil + 4; source = self.origin + '0 0 22'; - targ = self.origin + '0 0 22' + v_right*crandom()* var + v_up*crandom()*var; + targ = self.origin + '0 0 22' + v_right*crandom()* tmp + v_up*crandom()*tmp; traceline (source+adjust, targ+adjust+v_forward*4000, FALSE, self); if (trace_fraction == 1) @@ -2058,13 +2042,13 @@ void (float dam, float rec, string snd, float rng, float rate) FirePistol = zdif = org_z - trace_ent.origin_z; ydif = org2_y - trace_ent.origin_y; xdif = org2_x - trace_ent.origin_x; - true = 0; + tru = 0; if (((ydif >= CONTENT_SKY) && (ydif <= TE_LIGHTNING2))) - true = 1; + tru = 1; if (((xdif >= CONTENT_SKY) && (xdif <= TE_LIGHTNING2))) - true = 1; - if (self.attack <= 5 && true == 1 && zdif >= (trace_ent.size_z / 2 * 0.8)) + tru = 1; + if (self.attack <= 5 && tru == 1 && zdif >= (trace_ent.size_z / 2 * 0.8)) self.critical = 3; dam = (dam * (1 - trace_fraction)); @@ -2090,7 +2074,7 @@ void (float dam, float rec, string snd, float rng, float rate) FirePistol = void (float dam, float rec, string snd, float rng, float rate) FireSMG = { - local float var, var1, var2, zdif, xdif, ydif, true; + local float tmp, var1, var2, zdif, xdif, ydif, tru; local vector dir, source, targ, org, org2, adjust; local string x; @@ -2136,25 +2120,25 @@ void (float dam, float rec, string snd, float rng, float rate) FireSMG = player_single1 (); } - var = 200; + tmp = 200; if (self.velocity != '0 0 0') - var = 200; + tmp = 200; - var = var + (40 * self.recoil); + tmp = tmp + (40 * self.recoil); if (self.attack <= 3 && self.position == 1 && self.velocity_z == 0) - var = (var * 0.75); + tmp = (tmp * 0.75); if (self.attack <= 3 && self.position == 2 && self.velocity_z == 0) - var = (var * 0.5); + tmp = (tmp * 0.5); self.attack = self.attack + 1; self.recoil = self.recoil + 3; source = self.origin + '0 0 22'; - targ = self.origin + '0 0 22' + v_right*crandom()* var + v_up*crandom()*var; + targ = self.origin + '0 0 22' + v_right*crandom()* tmp + v_up*crandom()*tmp; traceline (source+adjust, targ+adjust+v_forward*4000, FALSE, self); if (trace_fraction == 1) @@ -2168,12 +2152,12 @@ void (float dam, float rec, string snd, float rng, float rate) FireSMG = zdif = org_z - trace_ent.origin_z; ydif = org2_y - trace_ent.origin_y; xdif = org2_x - trace_ent.origin_x; - true = 0; + tru = 0; if (((ydif >= CONTENT_SKY) && (ydif <= TE_LIGHTNING2))) - true = 1; + tru = 1; if (((xdif >= CONTENT_SKY) && (xdif <= TE_LIGHTNING2))) - true = 1; - if (self.attack <= 5 && true == 1 && zdif >= (trace_ent.size_z / 2 * 0.8)) + tru = 1; + if (self.attack <= 5 && tru == 1 && zdif >= (trace_ent.size_z / 2 * 0.8)) self.critical = 3; dam = (dam * (1 - trace_fraction)); @@ -2199,7 +2183,8 @@ void (float dam, float rec, string snd, float rng, float rate) FireSMG = void (float dam, float rec, string snd, float rng, float rate) FireAssaultRifle = { - local float var, var1, var2, zdif, xdif, ydif, true, z; + local float tmp, var1, var2, zdif, xdif, ydif, tru, z; + local vector dir, source, targ, org, org2, adjust; local string x; @@ -2247,7 +2232,7 @@ void (float dam, float rec, string snd, float rng, float rate) FireAssaultRifle player_single1 (); } - var = 50; + tmp = 50; if (self.velocity_y < 0) z = z + (self.velocity_y*-1); @@ -2259,21 +2244,21 @@ void (float dam, float rec, string snd, float rng, float rate) FireAssaultRifle else if (self.velocity_x > 0) z = z + (self.velocity_x); - var = var + z; - var = var + (40 * self.recoil); + tmp = tmp + z; + tmp = tmp + (40 * self.recoil); if (self.attack <= 3 && self.position == 1 && self.velocity_z == 0) - var = (var * 0.75); + tmp = (tmp * 0.75); if (self.attack <= 3 && self.position == 2 && self.velocity_z == 0) - var = (var * 0.5); + tmp = (tmp * 0.5); self.attack = self.attack + 1; self.recoil = self.recoil + 5; source = self.origin + '0 0 22'; - targ = self.origin + '0 0 22' + v_right*crandom()* var + v_up*crandom()*var; + targ = self.origin + '0 0 22' + v_right*crandom()* tmp + v_up*crandom()*tmp; traceline (source+adjust, targ+adjust+v_forward*4000, FALSE, self); if (trace_fraction == 1) @@ -2287,12 +2272,13 @@ void (float dam, float rec, string snd, float rng, float rate) FireAssaultRifle zdif = org_z - trace_ent.origin_z; ydif = org2_y - trace_ent.origin_y; xdif = org2_x - trace_ent.origin_x; - true = 0; + + tru = 0; if (ydif >= -6 && ydif <= 6) - true = 1; + tru = 1; if (xdif >= -6 && xdif <= 6) - true = 1; - if (self.attack <= 5 && true == 1 && zdif >= (trace_ent.size_z / 2 * 0.8)) + tru = 1; + if (self.attack <= 5 && tru == 1 && zdif >= (trace_ent.size_z / 2 * 0.8)) self.critical = 3; dam = (dam * (1 - trace_fraction)); @@ -2420,54 +2406,35 @@ void () WeaponTouch = return; } - if (((other.current_slot == 1) && (other.slot1 != 0))) + if (ItemInSlot(other, other.current_slot) != 0) return; - if (((other.current_slot == 2) && (other.slot2 != 0))) - return; + sound (other, CHAN_BODY, "misc/item1.wav", 1, ATTN_NORM); - sound (other, CHAN_BODY, "misc/item1.wav", 1, ATTN_NORM); + SetItemSlot(other, other.current_slot, self.islot1); + remove (self); + + self = other; + SetWeaponModel (); if ((other.current_slot == 1)) - { - GetWeaponWeight (other, self.cnt); - other.slot1 = self.cnt; - stuffcmd (other, "impulse 1\n"); - other.ammo1 = self.slot1; - other.maxmag1 = self.slot2; - other.mag1 = self.class; - GetWeaponModel (self.slot1); - remove (self); - } + stuffcmd (self, "impulse 1\n"); if ((other.current_slot == 2)) - { - GetWeaponWeight (other, self.cnt); - other.slot2 = self.cnt; - stuffcmd (other, "impulse 2\n"); - other.ammo2 = self.slot1; - other.maxmag2 = self.slot2; - other.mag2 = self.class; - GetWeaponModel (self.slot2); - remove (self); - } + stuffcmd (self, "impulse 2\n"); }; -void (float weap, float snd, float drop) DropWeapon = +void (float slotnum, float snd, float force) DropFromSlot = { + local float weap; local string mdel; - if (self.attack_finished > time && drop == 0) + if (self.attack_finished > time && !force) return; - if (self.current_slot == 3 && self.handgrenade == 0) - return; - - if (self.current_slot == 4 && self.c4 == 0) - return; - - if (weap == 0) + if (slotnum == 0) return; + weap = ItemInSlot(self, slotnum); if (snd == 1) sound (self, CHAN_WEAPON, "weapons/lock4.wav", 1, ATTN_NORM); @@ -2534,9 +2501,6 @@ void (float weap, float snd, float drop) DropWeapon = if (self.current_slot == 3) mdel = "progs/grenade2.mdl"; - if (self.current_slot == 4 && self.c4 == 1) - mdel = "progs/c4.mdl"; - setmodel (newmis, mdel); setsize (newmis, '-2 -2 0', '2 2 1'); makevectors (self.v_angle); @@ -2547,180 +2511,26 @@ void (float weap, float snd, float drop) DropWeapon = newmis.nextthink = (time + 180); newmis.think = SUB_Remove; newmis.touch = WeaponTouch; - newmis.cnt = weap; - if (self.current_slot == 1) - { - self.attack_finished = time; - self.slot1_weight = 0; - self.slot1 = 0; - newmis.slot1 = self.ammo1; - newmis.slot2 = self.maxmag1; - newmis.class = self.mag1; - self.mag1 = 0; - self.maxmag1 = 0; - GetWeaponModel (); - stuffcmd(self, "impulse 1\n"); - } - if (self.current_slot == 2) - { - self.attack_finished = time; - self.slot2_weight = 0; - self.slot2 = 0; - newmis.slot1 = self.ammo2; - newmis.slot2 = self.maxmag2; - newmis.class = self.mag2; - self.mag2 = 0; - self.maxmag2 = 0; - GetWeaponModel (); - stuffcmd(self, "impulse 2\n"); - } - if (self.current_slot == 3) - { - self.attack_finished = time; - newmis.handgrenade = self.handgrenade; - newmis.grenadetype = self.grenadetype; - stuffcmd(self, "impulse 1\n"); - } + newmis.islot1 = weap; + + SetItemSlot(self, slotnum, 0); + + if (self.attack_finished < time+0.6) + self.attack_finished = time+0.6; + + if (self.current_slot == slotnum) + SetWeaponModel (); }; -void () GetArmorWeight = -{ - local float wt; - - if (self.armor == 0) - wt = 0; - if (self.armor == 1) - wt = 3; - if (self.armor == 2) - wt = 5; - if (self.armor == 3) - wt = 9; - if (self.armor == 4) - wt = 15; - if (self.armor == 5) - wt = 12; - if (self.armor == 6) - wt = 17; - if (self.armor == 7) - wt = 6; - if (self.armor == 8) - wt = 20; - - self.armor_weight = wt; -}; - -void (entity guy, float slot) GetWeaponWeight = -{ - local float wt; - - if (slot == 1) - wt = 1; - else if (slot == 2) - wt = 2; - else if (slot == 3) - wt = 8; - else if (slot == 4) - wt = 6; - else if (slot == 5) - wt = 1; - else if (slot == 6) - wt = 2; - else if (slot == 7) - wt = 2; - else if (slot == 8) - wt = 2; - else if (slot == 9) - wt = 3; - else if (slot == 10) - wt = 4; - else if (slot == 11) - wt = 5; - else if (slot == 12) - wt = 6; - else if (slot == 13) - wt = 3; - else if (slot == 14) - wt = 3; - else if (slot == 15) - wt = 5; - else if (slot == 16) - wt = 5; - else if (slot == 17) - wt = 5; - else if (slot == 18) - wt = 7; - else if (slot == 19) - wt = 5; - else if (slot == 20) - wt = 5; - else if (slot == 21) - wt = 9; - else if (slot == 22) - wt = 10; - else if (slot == 23) - wt = 1; - - if (self.current_slot == 1) - self.slot1_weight = wt; - if (self.current_slot == 2) - self.slot2_weight = wt; -}; - - - void (float slot) WeaponAmmo = { local float weap, amount; - if (slot == 1) - weap = self.slot1; - if (slot == 2) - weap = self.slot2; + weap = ToIID(ItemInSlot(self, slot)); - if (weap <= 4) - amount = 0; - else if (weap == 5) - amount = 12; - else if (weap == 6) - amount = 7; - else if (weap == 7) - amount = 15; - else if (weap == 8) - amount = 6; - else if (weap == 9) - amount = 1; - else if (weap == 10) - amount = 2; - else if (weap == 11) - amount = 6; - else if (weap == 12) - amount = 10; - else if (weap == 13) - amount = 30; - else if (weap == 14) - amount = 30; - else if (weap == 15) - amount = 10; - else if (weap == 16) - amount = 24; - else if (weap == 17) - amount = 30; - else if (weap == 18) - amount = 8; - else if (weap == 19) - amount = 30; - else if (weap == 20) - amount = 30; - else if (weap == 21) - amount = 10; - else if (weap == 22) - amount = 40; - - if (slot == 1) - GiveAmmo (1, amount); - if (slot == 2) - GiveAmmo (2, amount); + amount = WeaponMagQuant(weap); + GiveAmmo (slot, amount); }; void() Crosshair = @@ -2748,23 +2558,6 @@ void() Crosshair = stuffcmd(self, "\n"); }; - -string () GetChemName = -{ - if (self.chem == 1) - return "stimpack"; - if (self.chem == 2) - return "medical bag"; - if (self.chem == 3) - return "superstim"; - if (self.chem == 4) - return "adrenaline"; - if (self.chem == 5) - return "psycho"; - if (self.chem == 6) - return "berserk"; -}; - void (entity healer, entity saved) RevivePlayer = { local entity oself; @@ -2790,121 +2583,123 @@ void (entity healer, entity saved) RevivePlayer = saved.view2 = world; }; -void(float type) UseBoostingChem = +float(float iid) UseBoostingChem = { local vector source; local vector org; local string x; - - x = GetChemName(); + local float duration; if (self.attack_finished > time) - return; + return false; + + x = GetItemName (iid); + if (iid == IID_CHEM_ADRENALINE) + duration = 30+random()*30; + else if (iid == IID_CHEM_PSYCHO) + duration = 30+random()*30; + else if (iid == IID_CHEM_BESERK) + duration = 30+random()*30; + else + { + sprint (self, PRINT_HIGH, "Not a boosting chem\n"); + return false; + } self.attack_finished = time + 1; makevectors (self.v_angle); source = self.origin + '0 0 0'; traceline (source, source + v_forward*64, FALSE, self); - if (trace_fraction == 1.0) - { - if (self.health < self.max_health && self.rage == 0) - { - sound (self, CHAN_BODY, "player/berserk.wav", 1, ATTN_NORM); - self.rage = type; - self.ragetime = (20+type)+random()*30; - return; - } - } if (trace_ent.classname == "player" && trace_ent.team == self.team) { if (trace_ent.health <= 0) - return; + return false; if (trace_ent.rage >= 1) { sprint (self, 2, trace_ent.netname); sprint (self, PRINT_HIGH, " is already affected.\n"); - return; + return false; } sprint (trace_ent, 2, self.netname); sprint (trace_ent, PRINT_HIGH, " used a "); sprint (trace_ent, PRINT_HIGH, x); sprint (trace_ent, PRINT_HIGH, " on you.\n"); sound (trace_ent, CHAN_BODY, "player/berserk.wav", 1, ATTN_NORM); - trace_ent.rage = type; - trace_ent.ragetime = (20+type)+random()*30; + trace_ent.rage = iid; + trace_ent.ragetime = duration; + return true; } + if (trace_fraction == 1.0) + { + if (self.health < self.max_health && self.rage == 0) + { + sound (self, CHAN_BODY, "player/berserk.wav", 1, ATTN_NORM); + self.rage = iid; + self.ragetime = duration; + return true; + } + } + return false; }; -void(float type) UseHealingChem = +float(float iid) UseHealingChem = { local vector source; local vector org; local float heal; local string x; - x = GetChemName(); - if (type == 1) - x = "bandage"; if (self.attack_finished > time) - return; + return false; - heal = type*5; + x = GetItemName (iid); + if (iid == IID_CHEM_STIMPACK) + heal = 2*5; + else if (iid == IID_CHEM_MEDICALBAG) + { + heal = 3*5; + x = "bandage"; + } + else if (iid == IID_CHEM_SUPERSTIM) + heal = 4*5; + else + { + sprint (self, PRINT_HIGH, "Not a healing chem\n"); + return false; + } + self.attack_finished = time + 1; makevectors (self.v_angle); source = self.origin + '0 0 0'; traceline (source, source + v_forward*64, FALSE, self); - if (trace_fraction == 1.0) - { - if (self.health >= self.max_health) - { - sprint(self, 2, "you aren't injured.\n"); - return; - } - if (self.regen >= 1) - { - sprint (self, PRINT_HIGH, "you are already healing.\n"); - return; - } - if (self.health < self.max_health && self.regen == 0) - { - sound (self, CHAN_BODY, "items/r_item2.wav", 1, ATTN_NORM); - self.health = self.health + heal; - self.regen = heal; - sprint (self, PRINT_HIGH, "used a "); - sprint (self, PRINT_HIGH, x); - sprint (self, PRINT_HIGH, " to heal yourself.\n"); - self.chemcount = self.chemcount - 1; - return; - } - } if (trace_ent.classname == "player" && trace_ent.team == self.team) { if (trace_ent.health <= 0 && coop == 1) { RevivePlayer(self, trace_ent); - return; + return false; } if (trace_ent.health <= 0 && coop == 0) - return; + return false; if (trace_ent.regen >= 1) { - sprint (self, 2, trace_ent.netname); + sprint (self, PRINT_HIGH, trace_ent.netname); sprint (self, PRINT_HIGH, " is already healing.\n"); - return; + return false; } if (trace_ent.health >= trace_ent.max_health) { - sprint(self, 2, trace_ent.netname); - sprint(self, 2, " isn't injured.\n"); - return; + sprint(self, PRINT_HIGH, trace_ent.netname); + sprint(self, PRINT_HIGH, " isn't injured.\n"); + return false; } - sprint (trace_ent, 2, self.netname); + sprint (trace_ent, PRINT_HIGH, self.netname); sprint (trace_ent, PRINT_HIGH, " used a "); sprint (trace_ent, PRINT_HIGH, x); sprint (trace_ent, PRINT_HIGH, " to heal you.\n"); @@ -2913,57 +2708,19 @@ void(float type) UseHealingChem = trace_ent.health = trace_ent.health + heal; stuffcmd (trace_ent, "v_cshift 0 0 0 0\n"); sound (self, CHAN_BODY, "items/r_item2.wav", 1, ATTN_NORM); - self.chemcount = self.chemcount - 1; + return true; } -}; - -void() UseChem = -{ - if (self.chemcount <= 0 || self.chem == 0) + if (trace_fraction == 1.0) { - self.chem = 0; - self.chemcount = 0; - sound (self, CHAN_BODY, "misc/menu3.wav", 1, ATTN_IDLE); - sprint(self, 2, "you are out of chems!\n"); - return; + if (self.health < self.max_health && self.regen == 0) + { + sound (self, CHAN_BODY, "items/r_item2.wav", 1, ATTN_NORM); + self.health = self.health + heal; + self.regen = heal; + return true; + } } - - if (self.chem == 1)//stimpack - UseHealingChem(2); - if (self.chem == 2)//medical bag - UseHealingChem(3); - if (self.chem == 3)//super-stim - UseHealingChem(4); - if (self.chem == 4)//adrenaline - UseBoostingChem(1); - if (self.chem == 5)//jet - UseBoostingChem(2); - if (self.chem == 6)//psycho - UseBoostingChem(3); - if (self.chem == 7)//mentats - UseBoostingChem(3); - - if (self.chemcount == 0) - self.chem = 0; - - self.rtime = time + 1; -}; - -void() Bandage = -{ - if (self.bandages <= 0) - { - self.bandages = 0; - sound (self, CHAN_BODY, "misc/menu3.wav", 1, ATTN_IDLE); - sprint(self, 2, "you are out of bandages!\n"); - return; - } - - UseHealingChem(1); - - self.chemcount = self.chemcount - 1; - if (self.chemcount == 0) - self.chem = 0; + return false; }; void () DisplayMenu = @@ -3096,17 +2853,35 @@ void () DisplayMenu = void () Special = { +#if 0 +<<<< <<< weapons.qc +/* +==== === if (self.class == 1) Bandage (); +>>>> >>> 1.2 if (self.class == 2) +<<< <<<< weapons.qc + Cmd_InvUse(GetItemName(IID_CHEM_MEDICALBAG)); + if (self.class == 3) + Cmd_InvUse("sneak-boy"); + if (self.class == 4) + Cmd_InvUse(GetItemName(IID_GREN_FRAG)); + if (self.class == 6) + Cmd_InvUse("shield"); +*/ + +===== == Sneak (); if (self.class == 4) self.currentmenu = "menu_build"; +>>>> >>> 1.2 +#endif }; void () hos_run1; void () hos_stand1; -void (vector org, entity guy, float input, float cost) spawn_station; +float (float iid) spawn_station; void () ExitScreen = { @@ -3241,7 +3016,7 @@ void () Shield = void () station_die = { - if ((self.buildtype == 1)) + if ((self.buildtype == IID_BUILD_MRAMMO)) { if ((self.team == 1)) { @@ -3255,7 +3030,7 @@ void () station_die = } } } - if ((self.buildtype == 2)) + if ((self.buildtype == IID_BUILD_SHIELDGEN)) { if ((self.team == 1)) { @@ -3269,7 +3044,7 @@ void () station_die = } } } - if ((self.buildtype == AS_MELEE)) + if ((self.buildtype == IID_BUILD_AUTODOC)) { if ((self.team == 1)) { @@ -3288,6 +3063,7 @@ void () station_die = void () station_think = { +#define chemcount attack_finished local entity dog; local entity te; local string qq; @@ -3308,7 +3084,7 @@ void () station_think = return; } - if (self.buildtype == 1)//barricade + if (self.buildtype == IID_BUILD_SHIELDGEN)//barricade { sound (self, CHAN_BODY, "items/protect2.wav", 1, ATTN_NORM); @@ -3333,7 +3109,7 @@ void () station_think = te = te.chain; } } - if (self.buildtype == 2)//autodoc + if (self.buildtype == IID_BUILD_AUTODOC)//autodoc { te = findradius (self.origin, 70); while (te) @@ -3360,7 +3136,7 @@ void () station_think = } } - if (self.buildtype == 0)//mr. ammo + if (self.buildtype == IID_BUILD_MRAMMO)//mr. ammo { te = findradius (self.origin, 60); while (te) @@ -3374,9 +3150,11 @@ void () station_think = return; } + sprint (te, 2, "mr.ammo incorporated would like to appologise for any inconvienience caused by this unit being offline.\nOur engineers have diagnosed the fault and will remove the stub whenever they can be arsed.\n"); +/* x = 300; - if (te.current_slot == 1 && te.ammo2 < (x)) + if (te.current_slot == 1 && te.ammo2 < x) { sound (self, CHAN_BODY, "misc/item1.wav", TRUE, ATTN_NORM); zz = (te.maxmag1 / 2); @@ -3384,13 +3162,13 @@ void () station_think = qq = ftos (zz); sprint (te, 2, qq); sprint (te, 2, " ammo was received from the mr.ammo.\n"); - te.ammo1 = (te.ammo1 + zz); + te.ammo1 = te.ammo1 + zz; te.ammo1 = ceil (te.ammo1); self.chemcount = self.chemcount - 1; } else { - if (te.current_slot == 2 && te.ammo2 < (x)) + if (te.current_slot == 2 && te.ammo2 < x) { sound (self, CHAN_BODY, "misc/item1.wav", TRUE, ATTN_NORM); zz = (te.maxmag2 / 2); @@ -3398,11 +3176,12 @@ void () station_think = qq = ftos (zz); sprint (te, 2, qq); sprint (te, 2, " ammo was received from the mr.ammo.\n"); - te.ammo2 = (te.ammo2 + zz); + te.ammo2 = te.ammo2 + zz; te.ammo2 = ceil (te.ammo2); self.chemcount = self.chemcount - 1; } } +*/ } te = te.chain; } @@ -3411,7 +3190,6 @@ void () station_think = void () Bar_Think = { - local float var; local float dot1; if ((self.owner.health < WEAPON_SHOTGUN)) @@ -3466,59 +3244,38 @@ void (entity guy) spawn_dot = }; -void (vector org, entity guy, float input, float cost) spawn_station = +float (float iid) spawn_station = { - local entity dog; + local entity oself; local entity te; + local vector org; - if (input == 3) + if (iid == IID_BUILD_ROBOFANG) { te = find (world, classname, "robofang"); while (te) { - if (te.track == self && te.buildtype == 3) + if (te.track == self && te.buildtype == IID_BUILD_ROBOFANG) { makevectors (self.v_angle); setorigin(te, self.origin + v_forward*32); - return; + return false; } te = find (te, classname, "robofang"); } } - if (self.scraps < cost) - { - sprint (self, 2, "not enough metal.\n"); - return; - } - - if (input == 4) - { - if (self.handgrenade == 0) - { - sprint (self, 2, "need a grenade.\n"); - return; - } - if (self.handgrenade == 1) - { - self.grenadetype = 0; - self.handgrenade = 0; - } - - } - - self = guy; te = find (world, classname, "station"); while (te) { - if (te.track == self && te.buildtype == input) + if (te.track == self && te.buildtype == iid) { sprint (self, 2, "already have one.\n"); - return; + return false; } te = find (te, classname, "station"); } - if (input == 3) + if (iid == IID_BUILD_ROBOFANG) { te = findradius (self.origin, 128); while (te) @@ -3526,43 +3283,43 @@ void (vector org, entity guy, float input, float cost) spawn_station = if (te != self && te.classname == "player" && te.health > 0) { sprint(self, PRINT_HIGH, "not with other players nearby.\n"); - return; + return false; } te = te.chain; } } makevectors (self.v_angle); - org = ((org + (v_forward * IT_LIGHTNING)) + (v_up * EF_FLAG2)); + org = ((self.origin + (v_forward * IT_LIGHTNING)) + (v_up * EF_FLAG2)); if ((pointcontents ((org + '0 20 0')) != CONTENT_EMPTY)) { sprint (self, 2, "can't build there.\n"); - return; + return false; } if ((pointcontents ((org + '0 -20 0')) != CONTENT_EMPTY)) { sprint (self, 2, "can't build there.\n"); - return; + return false; } if ((pointcontents ((org + '20 0 0')) != CONTENT_EMPTY)) { sprint (self, 2, "can't build there.\n"); - return; + return false; } if ((pointcontents ((org + '-20 0 0')) != CONTENT_EMPTY)) { sprint (self, 2, "can't build there.\n"); - return; + return false; } if ((pointcontents ((org + '0 0 50')) != CONTENT_EMPTY)) { sprint (self, 2, "can't build there.\n"); - return; + return false; } if ((pointcontents ((org + '0 0 -10')) != CONTENT_EMPTY)) { sprint (self, 2, "can't build there.\n"); - return; + return false; } self.impulse = 0; te = findradius (org, 40); @@ -3571,68 +3328,67 @@ void (vector org, entity guy, float input, float cost) spawn_station = if (te.classname == "spawn1") { sprint (self, 2, "can't build at spawn.\n"); - return; + return false; } if (te.classname == "spawn2") { sprint (self, 2, "can't build at spawn.\n"); - return; + return false; } if (te.classname == "ghoul") { sprint (self, 2, "somethings in the way.\n"); - return; + return false; } if (((te.classname == "player") && (te.health > 0))) { sprint (self, 2, "can't build on players.\n"); - return; + return false; } if (((te.classname == "station") && (te.health > 0))) { sprint (self, 2, "can't build on other stations.\n"); - return; + return false; } te = te.chain; } - self.scraps = (self.scraps - cost); - dog = spawn (); - dog.team = self.team; - dog.track = self; - self = dog; - spawn_dot (dog); + + oself = self; + self = spawn (); + self.team = oself.team; + self.track = oself; + + spawn_dot (self); self.origin = org; self.takedamage = DAMAGE_YES; self.solid = SOLID_SLIDEBOX; self.movetype = MOVETYPE_TOSS; setsize (self, '-16 -16 0', '16 16 40'); - self.health = SVC_INTERMISSION; - self.max_health = (300 + (input * 50)); + self.health = 30; + self.max_health = 300; self.th_die = station_die; setmodel (self, "progs/station.mdl"); self.classname = "station"; self.think = station_think; self.helmet = 2; - self.buildtype = input; - if (self.buildtype == 0) + self.buildtype = iid; + if (self.buildtype == IID_BUILD_MRAMMO) self.netname = "mr. ammo"; - if (self.buildtype == 1) + if (self.buildtype == IID_BUILD_SHIELDGEN) self.netname = "shield generator"; - if (self.buildtype == 2) + if (self.buildtype == IID_BUILD_AUTODOC) self.netname = "autodoc"; - if (self.buildtype == 3) + if (self.buildtype == IID_BUILD_ROBOFANG) { setsize(self, '-24 -24 -24', '24 24 24'); self.netname = "robofang"; setmodel (self, "progs/dog.mdl"); } - if (self.buildtype == 4) - { - setsize(self, '-4 -4 -4', '4 4 4'); - self.netname = "grenade"; - setmodel (self, "progs/grenade2.mdl"); - } self.frame = 4; + + self = oself; + + return true; }; void () BuyMenu = @@ -3709,9 +3465,7 @@ void () CharacterSheet = local float ratio; local float r1; local float r2; - local float var; - var = weightx (); stuffcmd (self, "toggleconsole\n"); sprint (self, PRINT_HIGH, "\n\n\n\n ** INFO ** \n"); sprint (self, PRINT_HIGH, "Class ‘ "); @@ -3770,7 +3524,7 @@ void () CharacterSheet = sprint (self, 2, x); sprint (self, PRINT_HIGH, "\n"); } - +/* sprint (self, PRINT_HIGH, "\nArmor ‘ "); x = GetArmorName(); sprint (self, 2, x); @@ -3778,11 +3532,12 @@ void () CharacterSheet = x = ftos (self.armor_weight); sprint (self, 2, x); sprint (self, 2, ")\n"); - +*/ sprint (self, PRINT_HIGH, "Protective‘ "); x = GetProtectName(); sprint (self, 2, x); sprint (self, 2, "\n"); +/* sprint (self, PRINT_HIGH, "Chem ‘ "); x = GetChemName(); sprint (self, 2, x); @@ -3791,6 +3546,7 @@ void () CharacterSheet = sprint (self, 2, x); sprint (self, 2, "]"); sprint (self, 2, "\n"); +*/ sprint (self, PRINT_HIGH, "Gadget ‘ "); x = GetEquipmentName(); @@ -3804,6 +3560,7 @@ void () CharacterSheet = x = GetTraitName(); sprint (self, 2, x); sprint (self, 2, "\n"); +/* sprint (self, PRINT_HIGH, "Weapon 1 ‘ "); x = GetWeaponName (self, self.slot1); sprint (self, 2, x); @@ -3823,6 +3580,7 @@ void () CharacterSheet = sprint (self, 2, ") ("); sprint (self, 2, self.ammotype2); sprint (self, 2, ")\n\n"); +*/ qq = weightx (); sprint (self, PRINT_HIGH, "Weight ‘ "); x = ftos (qq); @@ -3893,7 +3651,7 @@ void () UseEquipment = }; -void (vector s_aim, float dam, float var, float ran) W_FireBuckshotSpread1 = +void (vector s_aim, float dam, float tmp, float ran) W_FireBuckshotSpread1 = { local vector source; local vector targ; @@ -3905,9 +3663,10 @@ void (vector s_aim, float dam, float var, float ran) W_FireBuckshotSpread1 = local vector pos; local float ydif; local float xdif; - local float true; + local float tru; makevectors (self.v_angle); + if (self.position == 0) source = (self.origin + '0 0 20'); if (self.position == 1) @@ -3915,7 +3674,8 @@ void (vector s_aim, float dam, float var, float ran) W_FireBuckshotSpread1 = if (self.position == 2) source = (self.origin + '0 0 -12'); - targ = ((((((s_aim + ((v_right * random ()) * var)) - ((v_right * random ()) * var)) + ((v_up * random ()) * var)) - ((v_up * random ()) * var)) + (((v_up * random ()) * var) * 0.5)) + (v_forward * ran)); + targ = ((((((s_aim + ((v_right * random ()) * tmp)) - ((v_right * random ()) * tmp)) + ((v_up * random ()) * tmp)) - ((v_up * random ()) * tmp)) + (((v_up * random ()) * tmp) * 0.5)) + (v_forward * ran)); + traceline (source, targ, FALSE, self); if ((trace_fraction == 1)) { @@ -3935,16 +3695,16 @@ void (vector s_aim, float dam, float var, float ran) W_FireBuckshotSpread1 = zdif = (org_z - trace_ent.origin_z); ydif = (org_y - trace_ent.origin_y); xdif = (org_x - trace_ent.origin_x); - true = 0; + tru = 0; if (((ydif >= CONTENT_SLIME) && (ydif <= WEAPON_SPIKES))) { - true = 1; + tru = 1; } if (((xdif >= CONTENT_SLIME) && (xdif <= WEAPON_SPIKES))) { - true = 1; + tru = 1; } - if (((true == 1) && (zdif >= ((trace_ent.size_z / 2) * 0.8)))) + if (((tru == 1) && (zdif >= ((trace_ent.size_z / 2) * 0.8)))) { if (self.attack > 2) dam = (dam * 0.4); @@ -3959,7 +3719,7 @@ void (vector s_aim, float dam, float var, float ran) W_FireBuckshotSpread1 = } }; -void (float rec, float number, float dam, float var, float ran, float auto) W_FireShotgun = +void (float rec, float number, float dam, float spread, float ran, float auto) W_FireShotgun = { local vector dir; local vector p_aim; @@ -3967,14 +3727,8 @@ void (float rec, float number, float dam, float var, float ran, float auto) W_Fi local float var2; local float var3; local float var4; - local float weap; local vector adjust; - if (self.current_slot == 1) - weap = self.slot1; - else - weap = self.slot2; - if (self.velocity != '0 0 0') { var1 = ((random () * 48) * (6 + self.recoil * 1.5)); @@ -4037,23 +3791,22 @@ void (float rec, float number, float dam, float var, float ran, float auto) W_Fi self.attack_finished = (time + 0.2); dir = aim (self, 10000); - var = SVC_INTERMISSION; + spread = 30; if ((number == MULTICAST_PVS_R)) { - W_FireBuckshotSpread1 (p_aim, dam, var, ran); - W_FireBuckshotSpread1 ((p_aim + (v_right * 80)), dam, var, ran); - W_FireBuckshotSpread1 ((p_aim - (v_right * 80)), dam, var, ran); - W_FireBuckshotSpread1 ((p_aim + (v_up * 80)), dam, var, ran); - W_FireBuckshotSpread1 ((p_aim - (v_up * 80)), dam, var, ran); + W_FireBuckshotSpread1 (p_aim, dam, spread, ran); + W_FireBuckshotSpread1 ((p_aim + (v_right * 80)), dam, spread, ran); + W_FireBuckshotSpread1 ((p_aim - (v_right * 80)), dam, spread, ran); + W_FireBuckshotSpread1 ((p_aim + (v_up * 80)), dam, spread, ran); + W_FireBuckshotSpread1 ((p_aim - (v_up * 80)), dam, spread, ran); } else { if ((number == AS_MELEE)) { - var = 80; - W_FireBuckshotSpread1 (p_aim, dam, var, ran); - W_FireBuckshotSpread1 (p_aim, dam, var, ran); - W_FireBuckshotSpread1 (p_aim, dam, var, ran); + W_FireBuckshotSpread1 (p_aim, dam, spread, ran); + W_FireBuckshotSpread1 (p_aim, dam, spread, ran); + W_FireBuckshotSpread1 (p_aim, dam, spread, ran); } } }; diff --git a/quakec/fallout2/world.qc b/quakec/fallout2/world.qc index edfa8d396..0b41d9783 100644 --- a/quakec/fallout2/world.qc +++ b/quakec/fallout2/world.qc @@ -157,16 +157,16 @@ void() main = void () GameTimer = { local entity te, ze; - local float switch; + local float switched; local float c, z; - switch = 0; + switched = 0; te = findradius(self.origin, 25000); - while (c < 300 && switch == 0) + while (c < 300 && switched == 0) { - if (te.classname == "raider" && te.enemy != world && te.processed == 0 && te.active == 0 && switch == 0) + if (te.classname == "raider" && te.enemy != world && te.processed == 0 && te.active == 0 && switched == 0) { te.active = 1; te.processed = 1; @@ -174,7 +174,7 @@ void () GameTimer = bprint(2, te.netname); bprint(2, "'s turn.\n"); te.maxspeed = 300; - switch = 1; + switched = 1; ze = findradius(self.origin, 25000); z = 0; @@ -189,7 +189,7 @@ void () GameTimer = ze = ze.chain; } } - if (te.classname == "player" && te.processed == 0 && te.active == 0 && switch == 0) + if (te.classname == "player" && te.processed == 0 && te.active == 0 && switched == 0) { te.active = 1; te.processed = 1; @@ -197,7 +197,7 @@ void () GameTimer = bprint(2, te.netname); bprint(2, "'s turn.\n"); te.maxspeed = 300; - switch = 1; + switched = 1; ze = findradius(self.origin, 25000); z = 0; @@ -217,7 +217,7 @@ void () GameTimer = } c = 0; - if (switch == 0) // no entities left, turn is over + if (switched == 0) // no entities left, turn is over { bprint(2, "round is now over.\n"); @@ -275,6 +275,8 @@ void() worldspawn = InitBodyQue (); coop = 1; + SetupStats(); + // custom map attributes if (self.model == "maps/e1m8.bsp")