Added the inventory system stuff. I'm not sure how well it works, but it seems to work for the most part. :p

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1756 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-01-02 02:48:58 +00:00
parent c7cdbaa17e
commit 23ae28f5e8
16 changed files with 691 additions and 986 deletions

View File

@ -64,10 +64,31 @@ void() SetChangeParms =
parm7 = self.ammo_cells; parm7 = self.ammo_cells;
parm8 = self.weapon; parm8 = self.weapon;
parm9 = self.armortype * 100; 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 = void() SetNewParms =
{ { //remember, don't use self!
parm1 = IT_SHOTGUN | IT_AXE; parm1 = IT_SHOTGUN | IT_AXE;
parm2 = 100; parm2 = 100;
parm3 = 0; parm3 = 0;
@ -77,6 +98,25 @@ void() SetNewParms =
parm7 = 0; parm7 = 0;
parm8 = 1; parm8 = 1;
parm9 = 0; 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 = void() DecodeLevelParms =
@ -96,6 +136,25 @@ void() DecodeLevelParms =
self.ammo_cells = parm7; self.ammo_cells = parm7;
self.weapon = parm8; self.weapon = parm8;
self.armortype = parm9 * 0.01; 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; return spot;
objerror ("FindIntermission: no spot"); objerror ("FindIntermission: no spot");
return world;
}; };
@ -410,63 +470,6 @@ entity() SelectSpawnPoint =
void() DecodeLevelParms; void() DecodeLevelParms;
void() PlayerDie; 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 PutClientInServer
@ -502,16 +505,10 @@ void() PutClientInServer =
DecodeLevelParms (); DecodeLevelParms ();
W_SetCurrentAmmo ();
self.attack_finished = time; self.attack_finished = time;
self.th_pain = player_pain; self.th_pain = player_pain;
self.th_die = PlayerDie; self.th_die = PlayerDie;
self.slot1 = 17;
self.armor = 2;
self.current_slot = 1;
WeaponAmmo(1);
WeaponAmmo(2);
self.deadflag = DEAD_NO; self.deadflag = DEAD_NO;
// paustime is set by teleporters to keep the player from moving a while // paustime is set by teleporters to keep the player from moving a while
self.pausetime = 0; self.pausetime = 0;
@ -620,7 +617,7 @@ void() PutClientInServer =
self.invincible_finished = time + 3; self.invincible_finished = time + 3;
} }
W_SetCurrentAmmo();
}; };
@ -1047,46 +1044,49 @@ void() ArmorCheck =
local float bit; local float bit;
local float value; local float value;
local float aid;
//Armor //Armor
if (self.armor == 1) aid = ToIID(self.islot3);
if (aid == IID_ARM_SHIRT)
type = 0.20; type = 0.20;
if (self.armor == 2) if (aid == IID_ARM_LEATHER)
type = 0.30; type = 0.30;
if (self.armor == 3) if (aid == IID_ARM_KEVLAR)
type = 0.35; type = 0.35;
if (self.armor == 4) if (aid == IID_ARM_METAL)
type = 0.35; type = 0.35;
if (self.armor == 5) if (aid == IID_ARM_COMBAT)
type = 0.40; type = 0.40;
if (self.armor == 6) if (aid == IID_ARM_BROTHERHOOD)
type = 0.45; type = 0.45;
if (self.armor == 7) if (aid == IID_ARM_FORCE)
type = 0.10; type = 0.10;
if (self.armor == 8) if (aid == IID_ARM_LPOWER)
type = 0.50; 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); 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); self.items = (self.items - (self.items & ((IT_ARMOR1 | IT_ARMOR2) | IT_ARMOR3)) + IT_ARMOR1);
else else
self.items = (self.items - (self.items & ((IT_ARMOR1 | IT_ARMOR2) | IT_ARMOR3)) + IT_ARMOR1); 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"; self.armornoise = "misc/thud.wav";
if (self.armor == 2) if (aid == 2)
self.armornoise = "misc/thud.wav"; self.armornoise = "misc/thud.wav";
if (self.armor == 3) if (aid == 3)
self.armornoise = "misc/thud.wav"; self.armornoise = "misc/thud.wav";
if (self.armor == 4) if (aid == 4)
self.armornoise = "weapons/ric1.wav"; self.armornoise = "weapons/ric1.wav";
if (self.armor == 5) if (aid == 5)
self.armornoise = "misc/thud.wav"; self.armornoise = "misc/thud.wav";
if (self.armor == 6) if (aid == 6)
self.armornoise = "misc/thud.wav"; self.armornoise = "misc/thud.wav";
if (self.armor == 7) if (aid == 7)
self.armornoise = "misc/laserdef.wav"; self.armornoise = "misc/laserdef.wav";
if (self.armor == 8) if (aid == 8)
self.armornoise = "weapons/ric1.wav"; self.armornoise = "weapons/ric1.wav";
self.armorvalue = type * 100; self.armorvalue = type * 100;
@ -1095,10 +1095,26 @@ void() ArmorCheck =
void () WeightControl = 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(); self.weight = wt;
GetWeaponWeight(self, 1);
GetWeaponWeight(self, 2);
if (self.class == 1) if (self.class == 1)
self.max_weight = 20; self.max_weight = 20;
@ -1521,7 +1537,6 @@ void() PlayerPostThink =
if (self.rtime > time) if (self.rtime > time)
self.weaponframe = 3; self.weaponframe = 3;
CheckPowerups (); CheckPowerups ();
W_WeaponFrame (); W_WeaponFrame ();
@ -1661,8 +1676,8 @@ void(entity targ, entity attacker) ClientObituary =
bprint (PRINT_MEDIUM, "& "); bprint (PRINT_MEDIUM, "& ");
if (attacker.velocity_z != 0) if (attacker.velocity_z != 0)
bprint (PRINT_MEDIUM, "@ "); bprint (PRINT_MEDIUM, "@ ");
if (attacker.current_slot == 1 && attacker.mag1 == 0) // if (attacker.current_slot == 1 && attacker.mag1 == 0)
bprint (PRINT_MEDIUM, "! "); // bprint (PRINT_MEDIUM, "! ");
bprint (PRINT_MEDIUM, "] "); bprint (PRINT_MEDIUM, "] ");
@ -1960,43 +1975,30 @@ void(entity targ, entity attacker) ClientObituary =
void() Identify = void() Identify =
{ {
local string c1, c2, c3, c5, c6, c7; local string c1, c2, c3, c5, c6, c7;
local float tmp;
makevectors (self.v_angle); makevectors (self.v_angle);
traceline (self.origin, (self.origin + (v_forward * 2000)), FALSE, self); 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.classname == "player" && self.currentmenu == "none" && self.team == trace_ent.team)
{ {
if (trace_ent.class == 2) if (trace_ent.class == 2)
c1 = "medic\n"; c1 = "\nmedic\n";
if (trace_ent.class == 3) if (trace_ent.class == 3)
c1 = "assassin\n"; c1 = "\nassassin\n";
if (trace_ent.class == 4) if (trace_ent.class == 4)
c1 = "soldier\n"; c1 = "\nsoldier\n";
if (trace_ent.class == 6) if (trace_ent.class == 6)
c1 = "scientist\n"; c1 = "\nscientist\n";
c2 = ftos (trace_ent.health); 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) if (trace_ent.islot3 == 0)
c5 = "\nno armor"; c5 = "no armor";
if (trace_ent.armor == 1) else
c5 = "\nlightly armored"; c5 = GetItemName(ToIID(trace_ent.islot3));
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";
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") if (trace_ent.classname == "robowolf" && self.currentmenu == "none")
{ {
@ -2008,12 +2010,12 @@ void() Identify =
else else
c5 = "\nhostile\n"; 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") if (trace_ent.classname == "station" && self.currentmenu == "none")
{ {
c1 = trace_ent.netname; c1 = trace_ent.netname;
if (self.armor == 0) if (self.armortype == 0)
c2 = "uncompleted"; c2 = "uncompleted";
else if (trace_ent.health >= trace_ent.max_health) else if (trace_ent.health >= trace_ent.max_health)
c2 = "online"; c2 = "online";
@ -2026,28 +2028,19 @@ void() Identify =
c3 = trace_ent.track.netname; 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") if (trace_ent.classname == "monster" && self.currentmenu == "none")
{ {
c1 = "hostile"; c1 = "hostile";
tmp = ToIID(trace_ent.islot3);
if (tmp == 0)
c2 = "natural armor"; c2 = "natural armor";
if (trace_ent.armor == 1) else if (tmp == IID_ARM_SHIRT)
c2 = "lightly armored"; c2 = "lightly armored";
if (trace_ent.armor == 2) else
c2 = "leather armor"; c2 = GetItemName(ToIID(trace_ent.islot3));
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";
if (trace_ent.weapon == 1) if (trace_ent.weapon == 1)
c3 = "rifle"; c3 = "rifle";
@ -2060,6 +2053,6 @@ void() Identify =
if (trace_ent.weapon >= 5) if (trace_ent.weapon >= 5)
c3 = "assault rifle"; 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);
} }
}; };

View File

@ -192,10 +192,12 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage =
if (save >= targ.armorvalue) if (save >= targ.armorvalue)
{ {
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)); targ.items = targ.items - (targ.items & (IT_ARMOR1 | IT_ARMOR2 | IT_ARMOR3));
*/
} }
take = ceil(damage-save); take = ceil(damage-save);
// add to the damage total for clients, which will be sent as a single // add to the damage total for clients, which will be sent as a single
@ -262,8 +264,38 @@ void(entity targ, entity inflictor, entity attacker, float damage) T_Damage =
(targ != attacker)&& inflictor.classname !="door") (targ != attacker)&& inflictor.classname !="door")
return; return;
// do the damage // 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; targ.health = targ.health - take;
if (targ.health <= 0) if (targ.health <= 0)

View File

@ -212,6 +212,14 @@ void end_sys_globals; // flag for structure dumping
void end_sys_fields; // 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 false = 0;
float TRUE = 1; float TRUE = 1;
float true = 1;
// edict.flags // edict.flags
float FL_FLY = 1; float FL_FLY = 1;
@ -467,8 +477,9 @@ float timelimit;
float fraglimit; float fraglimit;
float deathmatch; float deathmatch;
float coop; float coop;
float rj = 1; var float rj = 1;
float no_connect; float no_connect;
//================================================ //================================================
// //
@ -581,12 +592,6 @@ float red_armor;
.float attack; .float attack;
.float position; .float position;
.float recoil; .float recoil;
.float ammo1;
.float ammo2;
.float mag1;
.float mag2;
.float maxmag1;
.float maxmag2;
.float critical; .float critical;
.float helmet; .float helmet;
.float rtime; .float rtime;
@ -603,18 +608,15 @@ float red_armor;
.float grenade_hold; .float grenade_hold;
.float grab; .float grab;
.float vehicle; .float vehicle;
.float slot1_weight;
.float slot2_weight; .float weight;
.float armor_weight;
.float max_weight; .float max_weight;
.float sneak; .float sneak;
.float rescued; .float rescued;
.float scale; .float scale;
.float bandages; .float bandages;
.float scraps; .float scraps;
.float armor;
.float slot1;
.float slot2;
.float cycle1; .float cycle1;
.float cycle2; .float cycle2;
.float c4; .float c4;
@ -622,8 +624,6 @@ float red_armor;
.float protect; .float protect;
.float perk; .float perk;
.float equipment; .float equipment;
.float chem;
.float chemcount;
.float buildtype; .float buildtype;
.float ctimer; .float ctimer;
.float flash; .float flash;
@ -747,8 +747,8 @@ string(string s) precache_sound = #19;
string(string s) precache_model = #20; string(string s) precache_model = #20;
void(entity client, string s)stuffcmd = #21; void(entity client, string s)stuffcmd = #21;
entity(vector org, float rad) findradius = #22; entity(vector org, float rad) findradius = #22;
void(float level, string s) bprint = #23; void(float level, string s, ...) bprint = #23;
void(entity client, float level, string s) sprint = #24; void(entity client, float level, string s, ...) sprint = #24;
void(string s) dprint = #25; void(string s) dprint = #25;
string(float f) ftos = #26; string(float f) ftos = #26;
string(vector v) vtos = #27; string(vector v) vtos = #27;
@ -758,7 +758,7 @@ void() traceoff = #30;
void(entity e) eprint = #31; // prints an entire edict void(entity e) eprint = #31; // prints an entire edict
float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE float(float yaw, float dist) walkmove = #32; // returns TRUE or FALSE
// #33 was removed // #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; void(float style, string value) lightstyle = #35;
float(float v) rint = #36; // round to nearest int float(float v) rint = #36; // round to nearest int
float(float v) floor = #37; // largest integer <= v 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(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 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(vector pos, string samp, float vol, float atten) ambientsound = #74; 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; float(entity targ, entity inflictor) CanDamage;

View File

@ -6,6 +6,9 @@ SOLDIER / PLAYER
============================================================================== ==============================================================================
*/ */
#define mag1 currentammo
#define maxmag1 cnt
$cd id1/models/enforcer $cd id1/models/enforcer
$origin 0 -6 24 $origin 0 -6 24
$base base $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 src;
local vector dir; local vector dir;
local vector direction; local vector direction;
local entity en; local entity en;
local float var;
local float r; local float r;
local vector targ; local vector targ;
local vector org; local vector org;
@ -66,10 +68,9 @@ void (float var, float dam) enforcer_single =
local float ydif; local float ydif;
local float xdif; local float xdif;
local float true; local float true;
local float zdif;
if (self.enemy.sneak == 1) if (self.enemy.sneak == 1)
var = var * 2; tmp = tmp * 2;
if (self.mag1 == 0) if (self.mag1 == 0)
{ {
@ -93,7 +94,7 @@ void (float var, float dam) enforcer_single =
direction = dir; 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) if (trace_fraction == PLAT_LOW_TRIGGER)
return; return;
@ -374,7 +375,7 @@ void() monster_enforcer =
setsize (self, '-12 -12 -24', '12 12 32'); setsize (self, '-12 -12 -24', '12 12 32');
self.health = 100; self.health = 100;
self.armor = 5; self.islot3 = SlotVal(IID_ARM_COMBAT, 1);
self.armortype = 0.5; self.armortype = 0.5;
self.helmet = 1; self.helmet = 1;
self.th_stand = enf_stand1; self.th_stand = enf_stand1;
@ -392,3 +393,6 @@ void() monster_enforcer =
walkmonster_start(); walkmonster_start();
return; return;
}; };
#undef mag1
#undef maxmag1

View File

@ -288,7 +288,6 @@ float() ShamCheckAttack =
local vector spot1, spot2; local vector spot1, spot2;
local entity targ; local entity targ;
local float chance; local float chance;
local float enemy_yaw;
if (enemy_range == RANGE_MELEE) if (enemy_range == RANGE_MELEE)
{ {

View File

@ -176,7 +176,7 @@ void() misc_fireball =
self.nextthink = time + (random() * 5); self.nextthink = time + (random() * 5);
self.think = fire_fly; self.think = fire_fly;
if (!self.speed) if (!self.speed)
self.speed == 1000; self.speed = 1000;
}; };
void() fire_fly = void() fire_fly =
@ -335,8 +335,6 @@ void() Laser_Touch =
void(vector org, vector vec) LaunchLaser = void(vector org, vector vec) LaunchLaser =
{ {
local vector vec;
if (self.classname == "monster_enforcer") if (self.classname == "monster_enforcer")
sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM); sound (self, CHAN_WEAPON, "enforcer/enfire.wav", 1, ATTN_NORM);
@ -591,7 +589,7 @@ void() func_illusionary =
self.movetype = MOVETYPE_NONE; self.movetype = MOVETYPE_NONE;
self.solid = SOLID_NOT; self.solid = SOLID_NOT;
setmodel (self, self.model); setmodel (self, self.model);
makestatic (); makestatic (self);
}; };
/*QUAKED func_episodegate (0 .5 .8) ? E1 E2 E3 E4 /*QUAKED func_episodegate (0 .5 .8) ? E1 E2 E3 E4

View File

@ -76,6 +76,7 @@ void() BuyBandages =
void(float cost, float type) BuyChem = void(float cost, float type) BuyChem =
{ {
/*
local string x; local string x;
local float y; local float y;
@ -110,6 +111,7 @@ void(float cost, float type) BuyChem =
x = GetChemName(); x = GetChemName();
sprint (self, PRINT_HIGH, x); sprint (self, PRINT_HIGH, x);
sprint(self, PRINT_HIGH, " purchased.\n"); sprint(self, PRINT_HIGH, " purchased.\n");
*/
}; };
void(string type) ChangeAmmo = void(string type) ChangeAmmo =
@ -169,6 +171,7 @@ void() BuyScraps =
void (float wt, float cost, float item) BuyWeapon = void (float wt, float cost, float item) BuyWeapon =
{ {
/*
local float lbs; local float lbs;
local string qq; local string qq;
local float curr; local float curr;
@ -245,6 +248,7 @@ void (float wt, float cost, float item) BuyWeapon =
GetWeaponWeight (self, 2); GetWeaponWeight (self, 2);
GetWeaponModel (); GetWeaponModel ();
return; return;
*/
}; };
void (float cost, float item) BuyPerk = void (float cost, float item) BuyPerk =
@ -263,6 +267,7 @@ void (float cost, float item) BuyPerk =
void (float wt, float cost, float item) BuyArmor = void (float wt, float cost, float item) BuyArmor =
{ {
/*
local float curr; local float curr;
local float lbs; local float lbs;
local string x; local string x;
@ -280,7 +285,7 @@ void (float wt, float cost, float item) BuyArmor =
self.currentmenu = "none"; self.currentmenu = "none";
return; 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"); sprint (self, PRINT_HIGH, "you can't carry that much.\n");
self.currentmenu = "none"; 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); sound (self, CHAN_BODY, "misc/item2.wav", 1, ATTN_NORM);
self.ammo_shells = (self.ammo_shells - cost); self.ammo_shells = (self.ammo_shells - cost);
self.armor_weight = wt; // self.armor_weight = wt;
self.armor = item; self.armor = item;
x = GetArmorName(); x = GetArmorName();
sprint (self, PRINT_HIGH, x); sprint (self, PRINT_HIGH, x);
sprint (self, PRINT_HIGH, " purchased.\n"); sprint (self, PRINT_HIGH, " purchased.\n");
return; return;
*/
}; };
void (float cost, float item) BuyEquipment = void (float cost, float item) BuyEquipment =
@ -322,12 +328,14 @@ void (float cost, float item) BuyProtect =
{ {
local string x; local string x;
/*
if ((self.armor >= TE_LIGHTNING2)) if ((self.armor >= TE_LIGHTNING2))
{ {
sprint (self, PRINT_HIGH, "too many electronics in\nyour currently worn armor!"); sprint (self, PRINT_HIGH, "too many electronics in\nyour currently worn armor!");
self.currentmenu = "none"; self.currentmenu = "none";
return; return;
} }
*/
if ((cost > self.ammo_shells)) if ((cost > self.ammo_shells))
{ {
sprint (self, PRINT_HIGH, "not enough money.\n"); sprint (self, PRINT_HIGH, "not enough money.\n");
@ -347,20 +355,20 @@ void (float cost, float item) BuyProtect =
float (float input) overweight = float (float input) overweight =
{ {
local float var; local float tmp;
local float max; local float max;
var = ((((input) + self.armor_weight) + self.slot1_weight) + self.slot2_weight); tmp = input + self.weight;
max = self.max_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); return (FALSE);
} }
if ((var > max)) if (tmp > max)
{ {
return (TRUE); 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 = void () W_GetClass =
{ {
if ((self.currentmenu == "select_skill")) if ((self.currentmenu == "select_skill"))

View File

@ -169,6 +169,12 @@ void() BuyScraps =
void (float wt, float cost, float item) BuyWeapon = 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 float lbs;
local string qq; local string qq;
local float curr; local float curr;
@ -247,6 +253,7 @@ void (float wt, float cost, float item) BuyWeapon =
GetWeaponWeight (self, 2); GetWeaponWeight (self, 2);
GetWeaponModel (); GetWeaponModel ();
return; return;
*/
}; };
void (float cost, float item) BuyPerk = void (float cost, float item) BuyPerk =
@ -349,10 +356,10 @@ void (float cost, float item) BuyProtect =
float (float input) overweight = float (float input) overweight =
{ {
local float var; local float tmp;
local float max; 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; max = self.max_weight;
if ((self.class == TE_LIGHTNING2)) if ((self.class == TE_LIGHTNING2))
{ {
@ -362,7 +369,7 @@ float (float input) overweight =
{ {
return (FALSE); return (FALSE);
} }
if ((var > max)) if ((tmp > max))
{ {
return (TRUE); return (TRUE);
} }
@ -374,10 +381,10 @@ float (float input) overweight =
float () weightx = float () weightx =
{ {
local float var; local float tmp;
var = self.slot1_weight + self.slot2_weight + self.armor_weight; tmp = self.slot1_weight + self.slot2_weight + self.armor_weight;
return var; return tmp;
}; };
void () W_GetClass = void () W_GetClass =

View File

@ -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 = string () GetEquipmentName =

View File

@ -363,7 +363,7 @@ void () ogre_smash11 = [ 57, ogre_smash12 ]
void () ogre_smash12 = [ 58, ogre_smash13 ] void () ogre_smash12 = [ 58, ogre_smash13 ]
{ {
ai_charge (); ai_charge (0);
}; };
void () ogre_smash13 = [ 59, ogre_smash14 ] void () ogre_smash13 = [ 59, ogre_smash14 ]

View File

@ -57,28 +57,16 @@ void () Footstep =
float (entity guy) holding_melee = float (entity guy) holding_melee =
{ {
if ((guy.current_slot == WEAPON_SHOTGUN)) local float iid;
{ iid = ToIID(ItemInSlot(guy, guy.current_slot));
if ((guy.slot1 <= TE_WIZSPIKE))
{ if (iid == IID_NONE ||
return (TRUE); iid == IID_WP_KNIFE ||
} iid == IID_WP_AXE ||
if ((guy.slot1 >= WEAPON_BIG)) iid == IID_WP_VIBROBLADE ||
{ iid == IID_WP_POWERAXE)
return (FALSE); return true;
} return false;
}
if ((guy.current_slot == WEAPON_ROCKET))
{
if ((guy.slot2 <= TE_WIZSPIKE))
{
return (TRUE);
}
if ((guy.slot2 >= WEAPON_BIG))
{
return (FALSE);
}
}
}; };
void () player_crouch; void () player_crouch;
@ -208,7 +196,6 @@ void () player_reload1 = [ 123, player_reload2 ]
void () player_reload2 = [ 124, player_reload3 ] void () player_reload2 = [ 124, player_reload3 ]
{ {
}; };
void () player_reload3 = [ 125, player_reload4 ] void () player_reload3 = [ 125, player_reload4 ]
@ -601,6 +588,8 @@ void () player_pull11 = [ 155, player_run ]
void () player_throw1 = [ 155, player_throw2 ] void () player_throw1 = [ 155, player_throw2 ]
{ {
self.attack_finished = time + 1;
self.weaponframe = 12; self.weaponframe = 12;
if (((random () * WEAPON_BIG) <= WEAPON_SPIKES)) if (((random () * WEAPON_BIG) <= WEAPON_SPIKES))
sound (self, CHAN_VOICE, "radio/grenade.wav", 0.7, ATTN_NORM); 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 ] void () player_throw2 = [ 156, player_throw3 ]
{ {
self.weaponframe = TE_LIGHTNINGBLOOD; self.weaponframe = TE_LIGHTNINGBLOOD;
//FireHandGrenade (); FireHandGrenade ();
self.attack_finished = time + 1;
}; };
void () player_throw3 = [ 157, player_throw4 ] void () player_throw3 = [ 157, player_throw4 ]
{ {
self.weaponframe = IDLE2A; self.weaponframe = IDLE2A;
self.attack_finished = time + 1;
}; };
void () player_throw4 = [ 158, player_throw5 ] void () player_throw4 = [ 158, player_throw5 ]
{ {
self.weaponframe = IDLE3A; self.weaponframe = IDLE3A;
self.attack_finished = time + 1;
}; };
void () player_throw5 = [ 157, player_throw6 ] void () player_throw5 = [ 157, player_throw6 ]
{ {
self.weaponframe = EF_FLAG1; self.weaponframe = EF_FLAG1;
self.attack_finished = time + 1;
}; };
void () player_throw6 = [ 156, player_throw7 ] void () player_throw6 = [ 156, player_throw7 ]
{ {
self.weaponframe = IDLE5A; self.weaponframe = IDLE5A;
self.attack_finished = time + 1;
}; };
void () player_throw7 = [ 155, player_throw8 ] void () player_throw7 = [ 155, player_throw8 ]
{ {
self.weaponframe = IDLE6A; self.weaponframe = IDLE6A;
if (self.handgrenade <= 0) self.attack_finished = time + 1;
stuffcmd (self, "impulse 1\n");
else
stuffcmd (self, "impulse 3\n");
}; };
void () player_throw8 = [ 159, player_throw9 ] void () player_throw8 = [ 159, player_throw9 ]
{ {
self.weaponframe = IDLE7A; self.weaponframe = IDLE7A;
self.attack_finished = time + 1;
}; };
void () player_throw9 = [ 160, player_throw10 ] void () player_throw9 = [ 160, player_throw10 ]
{ {
self.weaponframe = IDLE8A; self.weaponframe = IDLE8A;
self.attack_finished = time + 1;
}; };
void () player_throw10 = [ 161, player_throw11 ] void () player_throw10 = [ 161, player_throw11 ]
{ {
self.weaponframe = IDLE9A; self.weaponframe = IDLE9A;
self.attack_finished = time + 1;
}; };
void () player_throw11 = [ 162, player_run ] void () player_throw11 = [ 162, player_run ]
{ {
self.weaponframe = IDLE10A; self.weaponframe = IDLE10A;
self.attack_finished = self.nextthink;
W_SetCurrentAmmo();
}; };
void () player_shotty1b = [ 183, player_shotty2b ] void () player_shotty1b = [ 183, player_shotty2b ]

View File

@ -1,6 +1,7 @@
../quake/turn/qwprogs.dat ../qwprogs.dat
defs.qc defs.qc
inventory.qc
subs.qc subs.qc
fight.qc fight.qc
@ -31,3 +32,4 @@ dog.qc
ogre.qc ogre.qc
misc.qc misc.qc
mod_buy.qc mod_buy.qc
cmds.qc

View File

@ -1,13 +1,16 @@
#define mag1 currentammo
#define maxmag1 cnt
void () army_load1; void () army_load1;
//PISTOL //PISTOL
void (float var, float dam) army_fire = void (float tmp, float dam) army_fire =
{ {
local vector src; local vector src;
local vector dir; local vector dir;
local vector direction; local vector direction;
local entity en; local entity en;
local float var;
local float r; local float r;
local vector targ; local vector targ;
local vector org; local vector org;
@ -16,10 +19,9 @@ void (float var, float dam) army_fire =
local float ydif; local float ydif;
local float xdif; local float xdif;
local float true; local float true;
local float zdif;
if (self.enemy.sneak == 1) if (self.enemy.sneak == 1)
var = var * 2; tmp = tmp * 2;
if (self.mag1 == 0) if (self.mag1 == 0)
{ {
@ -46,7 +48,7 @@ void (float var, float dam) army_fire =
direction = dir; 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) if (trace_fraction == PLAT_LOW_TRIGGER)
return; return;
@ -71,13 +73,12 @@ void (float var, float dam) army_fire =
//RIFLE //RIFLE
void (float var, float dam) army_fire1 = void (float tmp, float dam) army_fire1 =
{ {
local vector src; local vector src;
local vector dir; local vector dir;
local vector direction; local vector direction;
local entity en; local entity en;
local float var;
local float r; local float r;
local vector targ; local vector targ;
local vector org; local vector org;
@ -86,10 +87,9 @@ void (float var, float dam) army_fire1 =
local float ydif; local float ydif;
local float xdif; local float xdif;
local float true; local float true;
local float zdif;
if (self.enemy.sneak == 1) if (self.enemy.sneak == 1)
var = var * 2; tmp = tmp * 2;
if (self.mag1 == 0) if (self.mag1 == 0)
{ {
@ -140,13 +140,12 @@ void (float var, float dam) army_fire1 =
//SHOTGUN //SHOTGUN
void (float var, float dam) army_fire2 = void (float tmp, float dam) army_fire2 =
{ {
local vector src; local vector src;
local vector dir; local vector dir;
local vector direction; local vector direction;
local entity en; local entity en;
local float var;
local float r; local float r;
local vector targ; local vector targ;
local vector org; local vector org;
@ -156,7 +155,7 @@ void (float var, float dam) army_fire2 =
local float dif; local float dif;
if (self.enemy.sneak == 1) if (self.enemy.sneak == 1)
var = var * 2; tmp = tmp * 2;
if (self.mag1 == 0) if (self.mag1 == 0)
{ {
@ -240,13 +239,12 @@ void (float var, float dam) army_fire2 =
}; };
//SMG //SMG
void (float var, float dam) army_fire3 = void (float tmp, float dam) army_fire3 =
{ {
local vector src; local vector src;
local vector dir; local vector dir;
local vector direction; local vector direction;
local entity en; local entity en;
local float var;
local float r; local float r;
local vector targ; local vector targ;
local vector org; local vector org;
@ -255,7 +253,6 @@ void (float var, float dam) army_fire3 =
local float ydif; local float ydif;
local float xdif; local float xdif;
local float true; local float true;
local float zdif;
if (self.mag1 == 0) if (self.mag1 == 0)
{ {
@ -266,7 +263,7 @@ void (float var, float dam) army_fire3 =
} }
if (self.enemy.sneak == 1) if (self.enemy.sneak == 1)
var = var * 2; tmp = tmp * 2;
self.mag1 = self.mag1 - 1; self.mag1 = self.mag1 - 1;
@ -282,7 +279,7 @@ void (float var, float dam) army_fire3 =
direction = dir; 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) if (trace_fraction == PLAT_LOW_TRIGGER)
return; return;
@ -306,13 +303,12 @@ void (float var, float dam) army_fire3 =
}; };
//Assault Rifle //Assault Rifle
void (float var, float dam) army_fire4 = void (float tmp, float dam) army_fire4 =
{ {
local vector src; local vector src;
local vector dir; local vector dir;
local vector direction; local vector direction;
local entity en; local entity en;
local float var;
local float r; local float r;
local vector targ; local vector targ;
local vector org; local vector org;
@ -332,7 +328,7 @@ void (float var, float dam) army_fire4 =
} }
if (self.enemy.sneak == 1) if (self.enemy.sneak == 1)
var = var * 2; tmp = tmp * 2;
self.mag1 = self.mag1 - 1; self.mag1 = self.mag1 - 1;
@ -348,7 +344,7 @@ void (float var, float dam) army_fire4 =
direction = dir; 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) if (trace_fraction == PLAT_LOW_TRIGGER)
return; return;
@ -1332,7 +1328,7 @@ void () monster_army =
setsize (self, '-12 -12 -24', '12 12 32'); setsize (self, '-12 -12 -24', '12 12 32');
self.health = 120; self.health = 120;
self.armor = 5; self.islot3 = SlotVal(IID_ARM_COMBAT, 1);
self.armortype = 35; self.armortype = 35;
self.th_stand = enf_stand1; self.th_stand = enf_stand1;
self.th_walk = enf_walk1; self.th_walk = enf_walk1;
@ -1374,7 +1370,7 @@ void () monster_army =
setsize (self, '-16 -16 -24', '16 16 32'); setsize (self, '-16 -16 -24', '16 16 32');
self.health = 90; self.health = 90;
self.team = 3; self.team = 3;
self.armor = 2; self.islot3 = SlotVal(IID_ARM_LEATHER, 1);
self.armortype = 0.2; self.armortype = 0.2;
self.armornoise = "misc/thud.wav"; self.armornoise = "misc/thud.wav";
self.th_stand = army_stand1; self.th_stand = army_stand1;
@ -1408,3 +1404,5 @@ void () monster_army =
self.maxmag1 = self.mag1; self.maxmag1 = self.mag1;
}; };
#undef mag1
#undef maxmag1

View File

@ -15,7 +15,7 @@ void(float normal) SUB_AttackFinished =
QuakeEd only writes a single float for angles (bad idea), so up and down are QuakeEd only writes a single float for angles (bad idea), so up and down are
just constant angles. just constant angles.
*/ */
vector() SetMovedir = void() SetMovedir =
{ {
if (self.angles == '0 -1 0') if (self.angles == '0 -1 0')
self.movedir = '0 0 1'; self.movedir = '0 0 1';

File diff suppressed because it is too large Load Diff

View File

@ -157,16 +157,16 @@ void() main =
void () GameTimer = void () GameTimer =
{ {
local entity te, ze; local entity te, ze;
local float switch; local float switched;
local float c, z; local float c, z;
switch = 0; switched = 0;
te = findradius(self.origin, 25000); 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.active = 1;
te.processed = 1; te.processed = 1;
@ -174,7 +174,7 @@ void () GameTimer =
bprint(2, te.netname); bprint(2, te.netname);
bprint(2, "'s turn.\n"); bprint(2, "'s turn.\n");
te.maxspeed = 300; te.maxspeed = 300;
switch = 1; switched = 1;
ze = findradius(self.origin, 25000); ze = findradius(self.origin, 25000);
z = 0; z = 0;
@ -189,7 +189,7 @@ void () GameTimer =
ze = ze.chain; 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.active = 1;
te.processed = 1; te.processed = 1;
@ -197,7 +197,7 @@ void () GameTimer =
bprint(2, te.netname); bprint(2, te.netname);
bprint(2, "'s turn.\n"); bprint(2, "'s turn.\n");
te.maxspeed = 300; te.maxspeed = 300;
switch = 1; switched = 1;
ze = findradius(self.origin, 25000); ze = findradius(self.origin, 25000);
z = 0; z = 0;
@ -217,7 +217,7 @@ void () GameTimer =
} }
c = 0; 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"); bprint(2, "round is now over.\n");
@ -275,6 +275,8 @@ void() worldspawn =
InitBodyQue (); InitBodyQue ();
coop = 1; coop = 1;
SetupStats();
// custom map attributes // custom map attributes
if (self.model == "maps/e1m8.bsp") if (self.model == "maps/e1m8.bsp")