item fixes

ammo_type implementation (for rogue, hopefully)


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1105 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
TimeServ 2005-06-20 09:14:01 +00:00
parent 5d59ff92d1
commit dc3a037985
5 changed files with 306 additions and 191 deletions

View file

@ -15,8 +15,13 @@ te_explode sprite
NQ/QW cross compatibility
Track oldbutton presses/weaponstate
Generic projectile spawning
Usage of ammo_shells, etc as display
In progress -
Item fixing for SP
Todo -
Fix ammo_shells, etc for monsters/backpacks
Samelevel 4 (exit acts as a spawnpoint teleporter)
Effects/decal system
Fix weird deathmatch modes, cvar checking

View file

@ -1,7 +1,7 @@
// prototypes
void () W_WeaponFrame;
void() W_SetCurrentAmmo;
void (float weap) W_WeaponSwitch;
void() player_pain;
void() player_stand1;
void (vector org) spawn_tfog;
@ -50,13 +50,13 @@ void() SetChangeParms =
parm1 = self.items;
parm2 = self.health;
parm3 = self.armorvalue;
if (self.ammo_shells < 25)
if (self.ammo_shells_real < 25)
parm4 = 25;
else
parm4 = self.ammo_shells;
parm5 = self.ammo_nails;
parm6 = self.ammo_rockets;
parm7 = self.ammo_cells;
parm4 = self.ammo_shells_real;
parm5 = self.ammo_nails_real;
parm6 = self.ammo_rockets_real;
parm7 = self.ammo_cells_real;
parm8 = self.weapon;
parm9 = self.armortype;
};
@ -70,7 +70,7 @@ void() SetNewParms =
parm5 = 0;
parm6 = 0;
parm7 = 0;
parm8 = 1;
parm8 = IT_SHOTGUN;
parm9 = 0;
};
@ -85,10 +85,10 @@ void() DecodeLevelParms =
self.items = parm1;
self.health = parm2;
self.armorvalue = parm3;
self.ammo_shells = parm4;
self.ammo_nails = parm5;
self.ammo_rockets = parm6;
self.ammo_cells = parm7;
self.ammo_shells_real = parm4;
self.ammo_nails_real = parm5;
self.ammo_rockets_real = parm6;
self.ammo_cells_real = parm7;
self.weapon = parm8;
self.armortype = parm9;
};
@ -544,6 +544,7 @@ called each time a player enters a new level
void() PutClientInServer =
{
local entity spot;
local float wtemp;
self.classname = "player";
self.health = 100;
@ -566,7 +567,60 @@ void() PutClientInServer =
DecodeLevelParms ();
W_SetCurrentAmmo ();
// dumb hack until I get the real weapon system in
wtemp = self.weapon;
if (deathmatch == 4)
{
self.ammo_shells_real = 0;
if (numberserverinfokey("axe") == 0)
{
self.ammo_nails_real = 255;
self.ammo_shells_real = 255;
self.ammo_rockets_real = 255;
self.ammo_cells_real = 255;
self.items |= IT_NAILGUN
| IT_SUPER_NAILGUN
| IT_SUPER_SHOTGUN
| IT_ROCKET_LAUNCHER
| IT_LIGHTNING;
}
else
wtemp = IT_AXE;
self.items |= IT_ARMOR3 | IT_INVULNERABILITY;
self.items = self.items - (self.items & (IT_ARMOR1 | IT_ARMOR2));
self.armorvalue = 200;
self.armortype = 0.8;
self.health = 250;
self.invincible_time = 1;
self.invincible_finished = time + 3;
}
if (deathmatch == 5)
{
self.ammo_nails_real = 80;
self.ammo_shells_real = 30;
self.ammo_rockets_real = 10;
self.ammo_cells_real = 30;
self.items |= IT_NAILGUN
| IT_SUPER_NAILGUN
| IT_SUPER_SHOTGUN
| IT_ROCKET_LAUNCHER
| IT_GRENADE_LAUNCHER
| IT_LIGHTNING
| IT_ARMOR3
| IT_INVULNERABILITY;
self.items = self.items - (self.items & (IT_ARMOR1 | IT_ARMOR2));
self.armorvalue = 200;
self.armortype = 0.8;
self.health = 200;
self.invincible_time = 1;
self.invincible_finished = time + 3;
}
self.weapon = 0;
W_WeaponSwitch (wtemp);
self.attack_finished = time;
self.th_pain = player_pain;
@ -605,53 +659,6 @@ void() PutClientInServer =
// Set Rocket Jump Modifiers
rj = numberserverinfokey("rj");
if (deathmatch == 4)
{
self.ammo_shells = 0;
if (numberserverinfokey("axe") == 0)
{
self.ammo_nails = 255;
self.ammo_shells = 255;
self.ammo_rockets = 255;
self.ammo_cells = 255;
self.items |= IT_NAILGUN
| IT_SUPER_NAILGUN
| IT_SUPER_SHOTGUN
| IT_ROCKET_LAUNCHER
| IT_LIGHTNING;
}
self.items |= IT_ARMOR3 | IT_INVULNERABILITY;
self.items = self.items - (self.items & (IT_ARMOR1 | IT_ARMOR2));
self.armorvalue = 200;
self.armortype = 0.8;
self.health = 250;
self.invincible_time = 1;
self.invincible_finished = time + 3;
}
if (deathmatch == 5)
{
self.ammo_nails = 80;
self.ammo_shells = 30;
self.ammo_rockets = 10;
self.ammo_cells = 30;
self.items |= IT_NAILGUN
| IT_SUPER_NAILGUN
| IT_SUPER_SHOTGUN
| IT_ROCKET_LAUNCHER
| IT_GRENADE_LAUNCHER
| IT_LIGHTNING
| IT_ARMOR3
| IT_INVULNERABILITY;
self.items = self.items - (self.items & (IT_ARMOR1 | IT_ARMOR2));
self.armorvalue = 200;
self.armortype = 0.8;
self.health = 200;
self.invincible_time = 1;
self.invincible_finished = time + 3;
}
};
@ -1008,8 +1015,7 @@ void() PlayerPreThink =
if(time > self.attack_finished && self.currentammo == 0 && self.weapon != IT_AXE)
{
self.weapon = W_BestWeapon ();
W_SetCurrentAmmo ();
W_WeaponSwitch (W_BestWeapon ());
}
};
@ -1131,7 +1137,8 @@ void() CheckPowerups =
self.items = self.items - IT_QUAD;
if (deathmatch == 4)
{
self.ammo_cells = 255;
self.ammo_cells_real = 255;
W_UpdateAmmoCounts(self);
self.armorvalue = 1;
self.armortype = 0.8;
self.health = 100;

View file

@ -552,6 +552,15 @@ enum {
WS_FIRING2 // used with nailgun
};
// ammo type defines
enum {
AT_NONE,
AT_SHELLS,
AT_NAILS,
AT_ROCKETS,
AT_CELLS
};
// unions
// DO NOT MIX UNION TYPES LIKE I AM DOING
.union {
@ -603,6 +612,11 @@ enum {
float waterdmg; // damage water will deal when drowning
float walkframe; // used with walking animation
float jump_flag; // last z velocity used for falling damage
INTEGER ammo_shells_real; // real shells count
INTEGER ammo_nails_real; // real nails count
INTEGER ammo_rockets_real; // real rockets count
INTEGER ammo_cells_real; // real cells count
INTEGER ammo_type; // ammo type in use
};
struct { // fields used with bubbles spawned from drowning
INTEGER bubble_count; // keeps track of the number of bubbles

View file

@ -1,7 +1,8 @@
void() W_SetCurrentAmmo;
/* ALL LIGHTS SHOULD BE 0 1 0 IN COLOR ALL OTHER ITEMS SHOULD
BE .8 .3 .4 IN COLOR */
void (float weap) W_WeaponSwitch;
void (entity ent) W_UpdateAmmoCounts;
void() SUB_regen =
{
@ -72,7 +73,8 @@ void() q_touch =
{
other.armortype = 0;
other.armorvalue = 0;
other.ammo_cells = 0;
other.ammo_cells_real = 0;
W_UpdateAmmoCounts(other);
}
// do the apropriate action
@ -325,13 +327,16 @@ void() health_touch =
self.solid = SOLID_NOT;
// Megahealth = rot down the player's super health
if (deathmatch == 1) // deathmatch 2 is the silly old rules
if (deathmatch) // TODO: are these rules right?
{
if (self.healtype == 2)
self.nextthink = time + 45;
else
self.nextthink = time + 20;
self.think = SUB_regen;
if (deathmatch != 2) // deathmatch 2 is the silly old rules
{
if (self.healtype == H_MEGA)
self.nextthink = time + 45; // should I account for health healed instead?
else
self.nextthink = time + 20;
self.think = SUB_regen;
}
}
activator = other;
@ -390,9 +395,11 @@ void() armor_touch =
self.solid = SOLID_NOT;
self.model = string_null;
if (deathmatch != 2)
if (deathmatch && deathmatch != 2)
{
self.nextthink = time + 20;
self.think = SUB_regen;
self.think = SUB_regen;
}
sprint1(other, PRINT_LOW, "You got armor\n");
// armor touch sound
@ -453,14 +460,14 @@ WEAPONS
void() bound_other_ammo =
{
if (other.ammo_shells > 100)
other.ammo_shells = 100;
if (other.ammo_nails > 200)
other.ammo_nails = 200;
if (other.ammo_rockets > 100)
other.ammo_rockets = 100;
if (other.ammo_cells > 100)
other.ammo_cells = 100;
if (other.ammo_shells_real > 100)
other.ammo_shells_real = 100;
if (other.ammo_nails_real > 200)
other.ammo_nails_real = 200;
if (other.ammo_rockets_real > 100)
other.ammo_rockets_real = 100;
if (other.ammo_cells_real > 100)
other.ammo_cells_real = 100;
};
@ -519,7 +526,7 @@ void(float old, float new) Deathmatch_Weapon =
return;
if ( nr < or )
self.weapon = new;
W_WeaponSwitch (new);
};
/*
@ -559,18 +566,18 @@ void() weapon_touch =
switch (new)
{
case IT_SUPER_SHOTGUN:
other.ammo_shells = other.ammo_shells + 5;
other.ammo_shells_real += 5;
break;
case IT_NAILGUN:
case IT_SUPER_NAILGUN:
other.ammo_nails = other.ammo_nails + 30;
other.ammo_nails_real += 30;
break;
case IT_GRENADE_LAUNCHER:
case IT_ROCKET_LAUNCHER:
other.ammo_rockets = other.ammo_rockets + 5;
other.ammo_rockets_real += 5;
break;
case IT_LIGHTNING:
other.ammo_cells = other.ammo_cells + 15;
other.ammo_cells_real += 15;
break;
}
@ -580,6 +587,7 @@ void() weapon_touch =
stuffcmd (other, "bf\n");
bound_other_ammo ();
W_UpdateAmmoCounts(other);
// change to the weapon
old = other.items;
@ -603,21 +611,21 @@ void() weapon_touch =
}
}
W_SetCurrentAmmo();
self = stemp;
if (leave)
return;
if (deathmatch!=3 || deathmatch !=5)
if (deathmatch != 3 || deathmatch != 5)
{
// remove it in single player, or setup for respawning in deathmatch
self.model = string_null;
self.solid = SOLID_NOT;
if (deathmatch != 2)
if (deathmatch && deathmatch != 2)
{
self.nextthink = time + 30;
self.think = SUB_regen;
self.think = SUB_regen;
}
}
activator = other;
SUB_UseTargets(); // fire all targets / killtargets
@ -762,24 +770,24 @@ local float best;
switch (self.weapon)
{
case 1: // shotgun
if (other.ammo_shells >= 100)
if (other.ammo_shells_real >= 100)
return;
other.ammo_shells = other.ammo_shells + self.ammo_count;
other.ammo_shells_real = other.ammo_shells_real + self.ammo_count;
break;
case 2: // spikes
if (other.ammo_nails >= 200)
if (other.ammo_nails_real >= 200)
return;
other.ammo_nails = other.ammo_nails + self.ammo_count;
other.ammo_nails_real = other.ammo_nails_real + self.ammo_count;
break;
case 3: // rockets
if (other.ammo_rockets >= 100)
if (other.ammo_rockets_real >= 100)
return;
other.ammo_rockets = other.ammo_rockets + self.ammo_count;
other.ammo_rockets_real = other.ammo_rockets_real + self.ammo_count;
break;
case 4: // cells
if (other.ammo_cells >= 100)
if (other.ammo_cells_real >= 100)
return;
other.ammo_cells = other.ammo_cells + self.ammo_count;
other.ammo_cells_real = other.ammo_cells_real + self.ammo_count;
break;
}
@ -796,24 +804,26 @@ local float best;
self = other;
if ( self.weapon == best )
self.weapon = W_BestWeapon();
W_WeaponSwitch (W_BestWeapon ());
else
W_UpdateAmmoCounts (self);
// if changed current ammo, update it
W_SetCurrentAmmo();
self = stemp;
// remove it in single player, or setup for respawning in deathmatch
self.model = string_null;
self.solid = SOLID_NOT;
if (deathmatch != 2)
self.nextthink = time + 30;
if (deathmatch)
{
if (deathmatch != 2)
self.nextthink = time + 30;
// Xian -- If playing in DM 3.0 mode, halve the time ammo respawns
// Xian -- If playing in DM 3.0 mode, halve the time ammo respawns
if (deathmatch == 3 || deathmatch == 5)
self.nextthink = time + 15;
if (deathmatch == 3 || deathmatch == 5)
self.nextthink = time + 15;
self.think = SUB_regen;
self.think = SUB_regen;
}
activator = other;
SUB_UseTargets(); // fire all targets / killtargets
@ -1225,14 +1235,16 @@ void() powerup_touch =
sprint3 (other, PRINT_LOW, "You got the ", self.netname, "\n");
self.mdl = self.model;
if (deathmatch)
{
if (self.items & (IT_INVULNERABILITY | IT_INVISIBLITY))
self.nextthink = time + 60*5;
else
self.nextthink = time + 60;
if ((self.classname == "item_artifact_invulnerability") ||
(self.classname == "item_artifact_invisibility"))
self.nextthink = time + 60*5;
else
self.nextthink = time + 60;
self.think = SUB_regen;
self.think = SUB_regen;
}
sound (other, CHAN_VOICE, self.noise, 1, ATTN_NORM);
stuffcmd (other, "bf\n");
@ -1260,7 +1272,8 @@ void() powerup_touch =
{
other.armortype = 0;
other.armorvalue = 0;
other.ammo_cells = 0;
other.ammo_cells_real = 0;
W_UpdateAmmoCounts(other);
}
other.super_time = 1;
other.super_damage_finished = time + 30;
@ -1410,8 +1423,8 @@ void() BackpackTouch =
other.super_damage_finished = time + 30;
other.items = other.items | IT_QUAD;
other.ammo_cells = 0;
other.ammo_cells_real = 0;
W_UpdateAmmoCounts(other);
sound (other, CHAN_VOICE, "boss1/sight1.wav", 1, ATTN_NORM);
stuffcmd (other, "bf\n");
@ -1437,10 +1450,10 @@ void() BackpackTouch =
self = stemp;
// change weapons
other.ammo_shells = other.ammo_shells + self.ammo_shells;
other.ammo_nails = other.ammo_nails + self.ammo_nails;
other.ammo_rockets = other.ammo_rockets + self.ammo_rockets;
other.ammo_cells = other.ammo_cells + self.ammo_cells;
other.ammo_shells_real = other.ammo_shells_real + self.ammo_shells;
other.ammo_nails_real = other.ammo_nails_real + self.ammo_nails;
other.ammo_rockets_real = other.ammo_rockets_real + self.ammo_rockets;
other.ammo_cells_real = other.ammo_cells_real + self.ammo_cells;
new = self.items;
if (!new)
@ -1487,20 +1500,21 @@ void() BackpackTouch =
acount = 1;
}
if ( (deathmatch==3 || deathmatch == 5) & ( (WeaponCode(new)==6) || (WeaponCode(new)==7) ) & (other.ammo_rockets < 5) )
other.ammo_rockets = 5;
if ( (deathmatch==3 || deathmatch == 5) & ( (WeaponCode(new)==6) || (WeaponCode(new)==7) ) & (other.ammo_rockets_real < 5) )
other.ammo_rockets_real = 5;
sprint1 (other, PRINT_LOW, "\n");
// backpack touch sound
sound (other, CHAN_ITEM, "weapons/lock4.wav", 1, ATTN_NORM);
stuffcmd (other, "bf\n");
W_UpdateAmmoCounts(other);
remove(self);
self = other;
// change to the weapon
if ( WeaponCode(new) <= b_switch )
{
if (self.flags & FL_INWATER)
@ -1515,8 +1529,6 @@ void() BackpackTouch =
Deathmatch_Weapon (old, new);
}
}
W_SetCurrentAmmo ();
};
/*
@ -1528,7 +1540,8 @@ void() DropBackpack =
{
local entity item;
if (!(self.ammo_shells + self.ammo_nails + self.ammo_rockets + self.ammo_cells))
// FIX THIS FOR MONSTERS
if (!(self.ammo_shells_real + self.ammo_nails_real + self.ammo_rockets_real + self.ammo_cells_real))
return; // nothing in it
item = spawn();
@ -1536,10 +1549,10 @@ void() DropBackpack =
item.items = self.weapon;
item.ammo_shells = self.ammo_shells;
item.ammo_nails = self.ammo_nails;
item.ammo_rockets = self.ammo_rockets;
item.ammo_cells = self.ammo_cells;
item.ammo_shells = self.ammo_shells_real;
item.ammo_nails = self.ammo_nails_real;
item.ammo_rockets = self.ammo_rockets_real;
item.ammo_cells = self.ammo_cells_real;
item.velocity_z = 300;
item.velocity_x = -100 + (random() * 200);

View file

@ -29,6 +29,37 @@ float() crandom =
return 2*(random() - 0.5);
};
/*
Ammo update functions
*/
void(entity ent) W_UpdateAmmoCounts =
{
// update current ammo
switch (ent.ammo_type)
{
case AT_SHELLS:
ent.currentammo = ent.ammo_shells_real;
break;
case AT_NAILS:
ent.currentammo = ent.ammo_nails_real;
break;
case AT_ROCKETS:
ent.currentammo = ent.ammo_rockets_real;
break;
case AT_CELLS:
ent.currentammo = ent.ammo_cells_real;
break;
default:
ent.currentammo = 0;
}
// update ammo display (FTE progs converts to floats here)
ent.ammo_shells = ent.ammo_shells_real;
ent.ammo_nails = ent.ammo_nails_real;
ent.ammo_rockets = ent.ammo_rockets_real;
ent.ammo_cells = ent.ammo_cells_real;
};
/*
================
W_FireAxe
@ -238,8 +269,11 @@ void() W_FireShotgun =
VK_smallkick(self);
if (deathmatch != 4 )
self.currentammo = self.ammo_shells = self.ammo_shells - 1;
if (deathmatch != 4)
{
self.ammo_shells_real -= 1;
W_UpdateAmmoCounts(self);
}
dir = aim (self, 100000);
FireBullets (6, dir, '0.04 0.04 0', MOD_SHOTGUN);
@ -266,7 +300,11 @@ void() W_FireSuperShotgun =
VK_bigkick(self);
if (deathmatch != 4)
self.currentammo = self.ammo_shells = self.ammo_shells - 2;
{
self.ammo_shells_real -= 2;
W_UpdateAmmoCounts(self);
}
dir = aim (self, 100000);
FireBullets (14, dir, '0.14 0.08 0', MOD_SUPERSHOTGUN);
};
@ -288,7 +326,10 @@ W_FireRocket
void() W_FireRocket =
{
if (deathmatch != 4)
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
{
self.ammo_rockets_real -= 1;
W_UpdateAmmoCounts(self);
}
sound (self, CHAN_WEAPON, "weapons/sgun1.wav", 1, ATTN_NORM);
@ -361,8 +402,7 @@ void() W_FireLightning =
if (self.ammo_cells < 1)
{
self.weapon = W_BestWeapon ();
W_SetCurrentAmmo ();
W_WeaponSwitch (W_BestWeapon ());
return;
}
@ -378,9 +418,9 @@ void() W_FireLightning =
}
}
cells = self.ammo_cells;
self.ammo_cells = 0;
W_SetCurrentAmmo ();
cells = self.ammo_cells_real;
self.ammo_cells_real = 0;
W_WeaponSwitch (W_BestWeapon ());
expmod = MOD_SHAFTWATER;
if (self.watertype == CONTENT_SLIME)
expmod = MOD_SHAFTSLIME;
@ -398,7 +438,10 @@ void() W_FireLightning =
VK_smallkick(self);
if (deathmatch != 4)
self.currentammo = self.ammo_cells = self.ammo_cells - 1;
{
self.ammo_cells_real -= 1;
W_UpdateAmmoCounts(self);
}
org = self.origin + '0 0 16';
@ -419,7 +462,10 @@ void() W_FireGrenade =
local vector vel;
if (deathmatch != 4)
self.currentammo = self.ammo_rockets = self.ammo_rockets - 1;
{
self.ammo_rockets_real -= 1;
W_UpdateAmmoCounts(self);
}
sound (self, CHAN_WEAPON, "weapons/grenade.wav", 1, ATTN_NORM);
@ -447,16 +493,18 @@ void() W_FireGrenade =
//=============================================================================
void(float ox) W_FireSpikes =
{
if (self.ammo_nails < 1)
if (self.ammo_nails_real < 1)
{
self.weapon = W_BestWeapon ();
W_SetCurrentAmmo ();
W_WeaponSwitch (W_BestWeapon ());
return;
}
sound (self, CHAN_WEAPON, "weapons/rocket1i.wav", 1, ATTN_NORM);
if (deathmatch != 4)
self.currentammo = self.ammo_nails = self.ammo_nails - 1;
{
self.ammo_nails_real -= 1;
W_UpdateAmmoCounts(self);
}
VK_smallkick(self);
PRJ_FireProjectile(self,
@ -471,15 +519,18 @@ void(float ox) W_FireSpikes =
void() W_FireSuperSpikes =
{
if (self.ammo_nails < 2)
if (self.ammo_nails_real < 2)
{
W_FireSpikes(0);
return;
}
sound (self, CHAN_WEAPON, "weapons/spike2.wav", 1, ATTN_NORM);
if (deathmatch != 4)
self.currentammo = self.ammo_nails = self.ammo_nails - 2;
if (deathmatch != 4)
{
self.ammo_nails_real -= 2;
W_UpdateAmmoCounts(self);
}
VK_smallkick(self);
PRJ_FireProjectile(self,
@ -505,24 +556,24 @@ float(float wep) W_HasAmmo =
switch (wep)
{
case IT_SHOTGUN:
return self.ammo_shells >= 1;
return self.ammo_shells_real >= 1;
case IT_SUPER_SHOTGUN:
return self.ammo_shells >= 2;
return self.ammo_shells_real >= 2;
case IT_NAILGUN:
return self.ammo_nails >= 1;
return self.ammo_nails_real >= 1;
case IT_SUPER_NAILGUN:
return self.ammo_nails >= 2;
return self.ammo_nails_real >= 2;
case IT_GRENADE_LAUNCHER:
case IT_ROCKET_LAUNCHER:
return self.ammo_rockets >= 1;
return self.ammo_rockets_real >= 1;
case IT_LIGHTNING:
return self.ammo_cells >= 1;
return self.ammo_cells_real >= 1;
}
return TRUE;
};
void() W_SetCurrentAmmo =
void() W_UpdateWeapon =
{
player_run (); // get out of any weapon firing states
@ -531,57 +582,62 @@ void() W_SetCurrentAmmo =
switch (self.weapon)
{
case IT_AXE:
self.currentammo = 0;
self.weaponmodel = "progs/v_axe.mdl";
self.weaponframe = 0;
self.ammo_type = AT_NONE;
break;
case IT_SHOTGUN:
self.currentammo = self.ammo_shells;
self.weaponmodel = "progs/v_shot.mdl";
self.weaponframe = 0;
self.items = self.items | IT_SHELLS;
self.ammo_type = AT_SHELLS;
break;
case IT_SUPER_SHOTGUN:
self.currentammo = self.ammo_shells;
self.weaponmodel = "progs/v_shot2.mdl";
self.weaponframe = 0;
self.items = self.items | IT_SHELLS;
self.ammo_type = AT_SHELLS;
break;
case IT_NAILGUN:
self.currentammo = self.ammo_nails;
self.weaponmodel = "progs/v_nail.mdl";
self.weaponframe = 0;
self.items = self.items | IT_NAILS;
self.ammo_type = AT_NAILS;
break;
case IT_SUPER_NAILGUN:
self.currentammo = self.ammo_nails;
self.weaponmodel = "progs/v_nail2.mdl";
self.weaponframe = 0;
self.items = self.items | IT_NAILS;
self.ammo_type = AT_NAILS;
break;
case IT_GRENADE_LAUNCHER:
self.currentammo = self.ammo_rockets;
self.weaponmodel = "progs/v_rock.mdl";
self.weaponframe = 0;
self.items = self.items | IT_ROCKETS;
self.ammo_type = AT_ROCKETS;
break;
case IT_ROCKET_LAUNCHER:
self.currentammo = self.ammo_rockets;
self.weaponmodel = "progs/v_rock2.mdl";
self.weaponframe = 0;
self.items = self.items | IT_ROCKETS;
self.ammo_type = AT_ROCKETS;
break;
case IT_LIGHTNING:
self.currentammo = self.ammo_cells;
self.weaponmodel = "progs/v_light.mdl";
self.weaponframe = 0;
self.items = self.items | IT_CELLS;
self.ammo_type = AT_CELLS;
break;
default:
self.currentammo = 0;
self.weaponmodel = "";
self.weaponframe = 0;
}
self.weaponframe = 0;
};
void(float weap) W_WeaponSwitch =
{
// skip weapon model/ammo_type update if this isn't a new weapon
if (self.weapon != weap)
{
self.weapon = weap;
W_UpdateWeapon();
}
// always update ammo count
W_UpdateAmmoCounts(self);
};
float() W_BestWeapon =
@ -628,9 +684,7 @@ float() W_CheckNoAmmo =
if (self.weapon == IT_AXE)
return TRUE;
self.weapon = W_BestWeapon ();
W_SetCurrentAmmo ();
W_WeaponSwitch (W_BestWeapon ());
// drop the weapon down
return FALSE;
@ -842,8 +896,7 @@ void() W_ChangeWeapon =
//
// set weapon, set ammo
//
self.weapon = fl;
W_SetCurrentAmmo ();
W_WeaponSwitch (fl);
};
/*
@ -856,10 +909,10 @@ void() CheatCommand =
if (deathmatch || coop)
return;
self.ammo_rockets = 100;
self.ammo_nails = 200;
self.ammo_shells = 100;
self.ammo_cells = 100;
self.ammo_rockets_real = 100;
self.ammo_nails_real = 200;
self.ammo_shells_real = 100;
self.ammo_cells_real = 100;
self.items |= IT_AXE |
IT_SHOTGUN |
IT_SUPER_SHOTGUN |
@ -870,8 +923,7 @@ void() CheatCommand =
IT_LIGHTNING |
IT_KEY1 | IT_KEY2;
self.weapon = IT_ROCKET_LAUNCHER;
W_SetCurrentAmmo ();
W_WeaponSwitch (IT_ROCKET_LAUNCHER);
};
/*
@ -918,8 +970,7 @@ void() CycleWeaponCommand =
if ( (self.items & w) && W_HasAmmo(w) )
{
self.weapon = w;
W_SetCurrentAmmo ();
W_WeaponSwitch (w);
return;
}
}
@ -971,8 +1022,7 @@ void() CycleWeaponReverseCommand =
if ( (self.items & w) && W_HasAmmo(w) )
{
self.weapon = w;
W_SetCurrentAmmo ();
W_WeaponSwitch (w);
return;
}
}
@ -1095,7 +1145,7 @@ Called every frame so impulse events can be handled as well as possible
*/
void() W_WeaponFrame =
{
local float scount;
local INTEGER scount;
W_HandlePlayerFrame();
@ -1149,3 +1199,29 @@ void() SuperDamageSound =
return;
};
/*
void() testfunction =
{
local vector v;
local float a, b, c;
a = 2;
b = 4;
c = 6;
a *= 2;
b *= 2;
c *= 2;
v = '2 4 6';
v *= 2;
if (!a && !b && !c)
return;
if (!v)
return;
v_x = 23;
if (self.health && self.ammo_shells && self.ammo_cells)
return;
};
*/