working weapons buy menu
and mr.ammo is now buyable.
a few bugs squished, I hope.


git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@1796 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2006-01-06 01:52:52 +00:00
parent 541d49b6bd
commit eb02cb9efa
7 changed files with 210 additions and 60 deletions

View file

@ -667,6 +667,7 @@ Only used on start map for the return point from an episode.
*/
void() info_player_start2 =
{
/*
local entity start;
local float x;
@ -690,6 +691,7 @@ void() info_player_start2 =
x = x - 1;
}
*/
};
@ -1147,6 +1149,8 @@ void () WeightControl =
void () PositionControl =
{
local float exp;
if (self.position == 0)
self.view_ofs = '0 0 22';
if (self.position == 1)
@ -1163,10 +1167,17 @@ void () PositionControl =
if (self.position == 0)
self.maxspeed = 300;
if (self.position == 1)
else if (self.position == 1)
self.maxspeed = 150;
if (self.position == 2)
else //if (self.position == 2)
self.maxspeed = 75;
if (self.weight > self.max_weight) //this is the penalty for being overweight.
{
exp = (self.weight/self.max_weight);
exp = (exp+2)*(exp+2)+(exp*exp*exp*8); //is this enough?
self.maxspeed = self.maxspeed / exp;
}
};
/*
@ -1582,12 +1593,14 @@ void() ClientConnect =
stuffcmd(self, "alias info impulse 56\n");
stuffcmd(self, "alias equip impulse 57\n");
stuffcmd(self, "alias stimpack \"cmd invuse stimpack\"\n");
stuffcmd(self, "bind c equip\n");
stuffcmd(self, "bind g drop\n");
stuffcmd(self, "bind e exit\n");
stuffcmd(self, "bind z special\n");
stuffcmd(self, "bind r reload\n");
stuffcmd(self, "bind x chem\n");
stuffcmd(self, "bind x stimpack\n");
stuffcmd(self, "bind b buy\n");
stuffcmd(self, "bind q info\n");
stuffcmd(self, "bind shift prone\n");

View file

@ -9,8 +9,17 @@ float(string desc) itemtoslot =
if (slot >= 1 && slot <= MAXSLOTS)
return slot;
sprint(self, PRINT_HIGH, "Not an item\n");
return 0;
slot = ItemIDOfName(desc);
if (!slot)
{
sprint(self, PRINT_HIGH, "Not an item name\n");
return 0;
}
else
{
sprint(self, PRINT_HIGH, "You don't have one of those\n");
return 0;
}
};
float(float slotno) DecreaseDestroySlot =

View file

@ -599,8 +599,6 @@ float red_armor;
.float rage;
.float ragetime;
.float action_points;
.float handgrenade;
.float grenadetype;
.float pcamera;
.float pcamera2;
.float equipment_state;

View file

@ -883,6 +883,152 @@ string(float iid) GetItemName =
};
float(string itname) ItemIDOfName =
{
if (itname == "nothing")
return IID_NONE;
if (itname == "toolkit")
return IID_WP_TOOLKIT;
if (itname == "knife")
return IID_WP_KNIFE;
if (itname == "axe")
return IID_WP_AXE;
if (itname == "ripper")
return IID_WP_VIBROBLADE;
if (itname == "poweraxe")
return IID_WP_POWERAXE;
if (itname == "1911")
return IID_WP_USP;
if (itname == "desert eagle")
return IID_WP_DEAGLE;
if (itname == "needler")
return IID_WP_NEEDLER;
if (itname == "alien blaster")
return IID_WP_ALIENBLASTER;
if (itname == "pipe rifle")
return IID_WP_PIPERIFLE;
if (itname == "winchester")
return IID_WP_WINCHESTER;
if (itname == "mossberg")
return IID_WP_MOSSBERG;
if (itname == "jackhammer")
return IID_WP_JACKHAMMER;
if (itname == "mp9")
return IID_WP_MP9;
if (itname == "grease gun")
return IID_WP_MP7;
if (itname == "rangemaster")
return IID_WP_RANGERMASTER;
if (itname == "ak-112")
return IID_WP_AK112;
if (itname == "ak-74")
return IID_WP_AK74;
if (itname == "dks-1")
return IID_WP_DKS1;
if (itname == "moonlight")
return IID_WP_MOONLIGHT;
if (itname == "sa-80")
return IID_WP_SA80;
if (itname == "gauss rifle")
return IID_WP_GAUSERIFLE;
if (itname == "laser carbine")
return IID_WP_PULSERIFLE;
if (itname == "ammo for 1911")
return IID_AM_USP;
if (itname == "ammo for desert eagle")
return IID_AM_DEAGLE;
if (itname == "ammo for needler")
return IID_AM_NEEDLER;
if (itname == "ammo for alienblaster")
return IID_AM_ALIENBLASTER;
if (itname == "ammo for piperifle")
return IID_AM_PIPERIFLE;
if (itname == "ammo for winchester")
return IID_AM_WINCHESTER;
if (itname == "ammo for mossberg")
return IID_AM_MOSSBERG;
if (itname == "ammo for jackhammer")
return IID_AM_JACKHAMMER;
if (itname == "ammo for mp9")
return IID_AM_MP9;
if (itname == "ammo for grease gun")
return IID_AM_MP7;
if (itname == "ammo for rangemaster")
return IID_AM_RANGERMASTER;
if (itname == "ammo for ak-112")
return IID_AM_AK112;
if (itname == "ammo for ak-74")
return IID_AM_AK74;
if (itname == "ammo for dks-1")
return IID_AM_DKS1;
if (itname == "ammo for moonlight")
return IID_AM_MOONLIGHT;
if (itname == "ammo for sa-80")
return IID_AM_SA80;
if (itname == "ammo for gauss rifle")
return IID_AM_GAUSERIFLE;
if (itname == "ammo for laser carbine")
return IID_AM_PULSERIFLE;
if (itname == "frag grenade")
return IID_GREN_FRAG;
if (itname == "emp grenade")
return IID_GREN_EMP;
if (itname == "smoke grenade")
return IID_GREN_SMOKE;
if (itname == "flashbang")
return IID_GREN_FLASH;
if (itname == "bulletproof shirt")
return IID_ARM_SHIRT;
if (itname == "leather armor")
return IID_ARM_LEATHER;
if (itname == "kevlar armor")
return IID_ARM_KEVLAR;
if (itname == "metal armor")
return IID_ARM_METAL;
if (itname == "combat armor")
return IID_ARM_COMBAT;
if (itname == "brotherhood armor")
return IID_ARM_BROTHERHOOD;
if (itname == "force armor")
return IID_ARM_FORCE;
if (itname == "light power armor")
return IID_ARM_LPOWER;
if (itname == "stimpacks")
return IID_CHEM_STIMPACK;
if (itname == "stimpack")
return IID_CHEM_STIMPACK;
if (itname == "medical bag")
return IID_CHEM_MEDICALBAG;
if (itname == "bandages")
return IID_CHEM_MEDICALBAG;
if (itname == "superstims")
return IID_CHEM_SUPERSTIM;
if (itname == "adrenaline")
return IID_CHEM_ADRENALINE;
if (itname == "psycho")
return IID_CHEM_PSYCHO;
if (itname == "beserk")
return IID_CHEM_BESERK;
if (itname == "mr.ammo")
return IID_BUILD_MRAMMO;
if (itname == "mrammo")
return IID_BUILD_MRAMMO;
if (itname == "shield-gen")
return IID_BUILD_SHIELDGEN;
if (itname == "shieldgen")
return IID_BUILD_SHIELDGEN;
if (itname == "auto-doc")
return IID_BUILD_AUTODOC;
if (itname == "autodoc")
return IID_BUILD_AUTODOC;
if (itname == "robofang")
return IID_BUILD_ROBOFANG;
if (itname == "doggie")
return IID_BUILD_ROBOFANG;
return 0;
};
float(float slotno, float iid) FitsInSlot =
{

View file

@ -91,7 +91,17 @@ string () ProtectString =
string () OtherString =
{
return ("++ miscellaneous items ++\n ITEM | CLASS | PRICE \n\n\n<EFBFBD>1 (25) bandages for medic 2$\n<EFBFBD>2 (5) metal scraps 5$\n");
return
"++ miscellaneous items ++\n"
" ITEM | CLASS | PRICE \n"
"\n"
"\n"
"<EFBFBD>1 (25) bandages for medic 2$\n"
"<EFBFBD>2 (5) metal scraps 5$\n"
"<EFBFBD>3 (20) mr.ammo! 20$\n"
"<EFBFBD>4 (20) auto-doc! 20$\n"
"<EFBFBD>5 (20) shield-gen! 20$\n"
;
};

View file

@ -10,7 +10,7 @@ void(entity to, float iid, float count) AddStackable =
SetItemSlot(to, slot, SlotVal(iid, count + ToStatus(ItemInSlot(to, slot))));
}
void(float cost, float type) BuyGrenade =
void(float cost, float iid) BuyStackable =
{
local string z;
local float x, y;
@ -27,21 +27,14 @@ void(float cost, float type) BuyGrenade =
sprint(self, PRINT_HIGH, "you bought a ");
if (type == 1)
y = IID_GREN_SMOKE;
if (type == 2)
y = IID_GREN_FRAG;
if (type == 3)
y = IID_GREN_EMP;
z = GetItemName(y);
z = GetItemName(iid);
sprint(self, PRINT_HIGH, z);
sprint(self, PRINT_HIGH, "\n");
//put grenade in inventory
//finds existing grenades, otherwise, empty slot
AddStackable(self, y, 1);
AddStackable(self, iid, 1);
};
void() BuyBandages =
@ -574,13 +567,13 @@ void() W_PlayerMenu =
if (self.currentmenu == "shop_thrown")
{
if (self.impulse == 1)
BuyGrenade(3, 1); //weight, cost, item
BuyStackable(3, IID_GREN_SMOKE); //weight, cost, item
if (self.impulse == 2)
BuyGrenade(4, 2); //weight, cost, item
BuyStackable(4, IID_GREN_FRAG); //weight, cost, item
if (self.impulse == 3)
BuyGrenade(5, 3); //weight, cost, item
BuyStackable(5, IID_GREN_EMP); //weight, cost, item
if (self.impulse == 4)
BuyGrenade(6, 4); //weight, cost, item
BuyStackable(6, IID_GREN_FLASH); //weight, cost, item
return;
}
@ -676,10 +669,19 @@ void() W_PlayerMenu =
BuyChem(18, IID_CHEM_PSYCHO); //cost, item
if (self.impulse == 6)
BuyChem(21, IID_CHEM_BESERK); //cost, item
return;
}
if (self.currentmenu == "shop_other")
{
if (self.impulse == 3)
BuyStackable(20, IID_BUILD_MRAMMO);
if (self.impulse == 4)
BuyStackable(20, IID_BUILD_AUTODOC);
if (self.impulse == 5)
BuyStackable(20, IID_BUILD_SHIELDGEN);
return;
}
if (self.currentmenu == "select_team")

View file

@ -867,8 +867,6 @@ void() W_SetCurrentAmmo =
self.currentammo = ToStatus(self.islot1);
else if (self.current_slot == 2)
self.currentammo = ToStatus(self.islot2);
else if (self.current_slot == 3 && self.handgrenade > 0)
self.currentammo = self.handgrenade;
else if (self.current_slot == 4)
{
if (self.team == 1)
@ -1151,17 +1149,6 @@ void() W_ChangeWeapon =
fl = IT_SUPER_NAILGUN;
self.current_slot = 2;
}
if (self.impulse == 3)
{
if (self.handgrenade == 0)
{
sprint (self, PRINT_HIGH, "no grenade.\n");
sound (self, CHAN_AUTO, "misc/noweapon.wav", 1, ATTN_STATIC);
return;
}
else
self.current_slot = 3;
}
self.weapon = fl;
W_SetCurrentAmmo ();
@ -2382,6 +2369,7 @@ void (float input) Explosion =
void () WeaponTouch =
{
local float slotnum;
if (other.classname != "player")
return;
@ -2395,37 +2383,21 @@ void () WeaponTouch =
if (other.current_slot == AS_MELEE)
return;
if (self.handgrenade == 1)
{
if (other.handgrenade > 0)
{
sprint(other, 2, "already have a grenade.\n");
return;
}
sound (other, CHAN_BODY, "misc/item1.wav", 1, ATTN_NORM);
other.handgrenade = self.handgrenade;
other.grenadetype = self.grenadetype;
sprint(other, 2, "picked up a grenade.\n");
remove(self);
return;
}
if (ItemInSlot(other, other.current_slot) != 0)
return;
if (ItemInSlot(other, other.current_slot) == 0 && FitsInSlot(other.current_slot, ToIID(self.islot1)))
slotnum = other.current_slot;
if (!slotnum)
slotnum = FindSuitableEmptySlot(other, ToIID(self.islot1));
if (!slotnum)
return; //can't get it.
sound (other, CHAN_BODY, "misc/item1.wav", 1, ATTN_NORM);
SetItemSlot(other, other.current_slot, self.islot1);
SetItemSlot(other, slotnum, self.islot1);
remove (self);
self = other;
SetWeaponModel ();
if ((other.current_slot == 1))
stuffcmd (self, "impulse 1\n");
if ((other.current_slot == 2))
stuffcmd (self, "impulse 2\n");
if (self.current_slot == slotnum)
W_SetCurrentAmmo ();
};
void (float slotnum, float snd, float force) DropFromSlot =