-#if defined(CSQC)
-#elif defined(MENUQC)
-#elif defined(SVQC)
- #include "../dpdefs/progsdefs.qh"
- #include "../dpdefs/dpextensions.qh"
- #include "../warpzonelib/util_server.qh"
- #include "../common/util.qh"
- #include "../common/monsters/monsters.qh"
- #include "../common/triggers/subs.qh"
- #include "defs.qh"
- #include "../common/notifications.qh"
- #include "item_key.qh"
-#endif
+#include "item_key.qh"
+
+#include "../common/triggers/subs.qh"
+#include "../common/monsters/all.qh"
+#include "../common/notifications.qh"
+#include "../common/util.qh"
+#include "../lib/warpzone/util_server.qh"
/*
TODO:
}
string item_keys_keylist(float keylist) {
- float base, l;
- string n;
-
// no keys
if (!keylist)
return "";
// one key
- if ((keylist & (keylist-1)) != 0)
+ if ((keylist & (keylist-1)) == 0)
return strcat("the ", item_keys_names[lowestbit(keylist)]);
- n = "";
- base = 0;
+ string n = "";
+ int base = 0;
while (keylist) {
- l = lowestbit(keylist);
+ int l = lowestbit(keylist);
if (n)
n = strcat(n, ", the ", item_keys_names[base + l]);
else
/**
* Key touch handler.
*/
-void item_key_touch(void) {
+void item_key_touch()
+{SELFPARAM();
if (!IS_PLAYER(other))
return;
play2(other, self.noise);
centerprint(other, self.message);
+
+ string oldmsg = self.message;
+ self.message = "";
+ activator = other;
+ SUB_UseTargets();
+ self.message = oldmsg;
};
/**
* Spawn a key with given model, key code and color.
*/
-void spawn_item_key() {
+void spawn_item_key()
+{SELFPARAM();
precache_model(self.model);
if (self.spawnflags & 1) // FLOATING
self.mdl = self.model;
self.effects = EF_LOWPRECISION;
- setmodel(self, self.model);
+ _setmodel(self, self.model);
//setsize(self, '-16 -16 -24', '16 16 32');
setorigin(self, self.origin + '0 0 32');
setsize(self, '-16 -16 -56', '16 16 0');
itemkeys MUST always have exactly one bit set.
*/
-void spawnfunc_item_key() {
+spawnfunc(item_key)
+{
string _netname;
vector _colormod;
// find default netname and colormod
switch(self.itemkeys) {
- case 1:
+ case BIT(0):
_netname = "GOLD key";
_colormod = '1 .9 0';
break;
- case 2:
+ case BIT(1):
_netname = "SILVER key";
_colormod = '.9 .9 .9';
break;
- case 4:
+ case BIT(2):
_netname = "BRONZE key";
_colormod = '.6 .25 0';
break;
- case 8:
+ case BIT(3):
_netname = "RED keycard";
_colormod = '.9 0 0';
break;
- case 16:
+ case BIT(4):
_netname = "BLUE keycard";
_colormod = '0 0 .9';
break;
- case 32:
+ case BIT(5):
_netname = "GREEN keycard";
_colormod = '0 .9 0';
break;
self.message = strzone(strcat("You've picked up the ", self.netname, "!"));
if (self.noise == "")
- self.noise = "misc/itempickup.wav";
+ self.noise = strzone(SND(ITEMPICKUP));
// save the name for later
item_keys_names[lowestbit(self.itemkeys)] = self.netname;
---------NOTES----------
Don't use this entity on new maps! Use item_key instead.
*/
-void spawnfunc_item_key1(void) {
- self.classname = "item_key";
- self.itemkeys = ITEM_KEY_BIT(1);
- spawnfunc_item_key();
+spawnfunc(item_key1)
+{
+ this.classname = "item_key";
+ this.itemkeys = ITEM_KEY_BIT(1);
+ spawnfunc_item_key(this);
};
/*QUAKED item_key2 (0 .5 .8) (-16 -16 -24) (16 16 32) FLOATING
---------NOTES----------
Don't use this entity on new maps! Use item_key instead.
*/
-void spawnfunc_item_key2(void) {
- self.classname = "item_key";
- self.itemkeys = ITEM_KEY_BIT(0);
- spawnfunc_item_key();
+spawnfunc(item_key2)
+{
+ this.classname = "item_key";
+ this.itemkeys = ITEM_KEY_BIT(0);
+ spawnfunc_item_key(this);
};