diff --git a/src/g_items.c b/src/g_items.c index f922026..7b677e6 100644 --- a/src/g_items.c +++ b/src/g_items.c @@ -205,33 +205,6 @@ Pickup_Powerup(edict_t *ent, edict_t *other) { SetRespawn(ent, ent->item->quantity); } - - if (((int)dmflags->value & DF_INSTANT_ITEMS) || - ((ent->item->use == Use_Quad) && - (ent->spawnflags & DROPPED_PLAYER_ITEM))) - { - if ((ent->item->use == Use_Quad) && - (ent->spawnflags & DROPPED_PLAYER_ITEM)) - { - quad_drop_timeout_hack = - (ent->nextthink - level.time) / FRAMETIME; - } - - ent->item->use(other, ent->item); - } - else if (((int)dmflags->value & DF_INSTANT_ITEMS) || - ((ent->item->use == Use_QuadFire) && - (ent->spawnflags & DROPPED_PLAYER_ITEM))) - { - if ((ent->item->use == Use_QuadFire) && - (ent->spawnflags & DROPPED_PLAYER_ITEM)) - { - quad_fire_drop_timeout_hack = - (ent->nextthink - level.time) / FRAMETIME; - } - - ent->item->use(other, ent->item); - } } return true; @@ -1292,6 +1265,46 @@ Touch_Item(edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf) gi.sound(other, CHAN_ITEM, gi.soundindex( ent->item->pickup_sound), 1, ATTN_NORM, 0); } + + /* activate item instantly if appropriate */ + /* moved down here so activation sounds override the pickup sound */ + if (deathmatch->value) + { + if ((((int)dmflags->value & DF_INSTANT_ITEMS) && + (ent->item->flags & IT_INSTANT_USE)) || + ((ent->item->use == Use_Quad) && + (ent->spawnflags & DROPPED_PLAYER_ITEM))) + { + if ((ent->item->use == Use_Quad) && + (ent->spawnflags & DROPPED_PLAYER_ITEM)) + { + quad_drop_timeout_hack = + (ent->nextthink - level.time) / FRAMETIME; + } + + if (ent->item->use) + { + ent->item->use(other, ent->item); + } + } + else if ((((int)dmflags->value & DF_INSTANT_ITEMS) && + (ent->item->flags & IT_INSTANT_USE)) || + ((ent->item->use == Use_QuadFire) && + (ent->spawnflags & DROPPED_PLAYER_ITEM))) + { + if ((ent->item->use == Use_QuadFire) && + (ent->spawnflags & DROPPED_PLAYER_ITEM)) + { + quad_fire_drop_timeout_hack = + (ent->nextthink - level.time) / FRAMETIME; + } + + if (ent->item->use) + { + ent->item->use(other, ent->item); + } + } + } } if (!(ent->spawnflags & ITEM_TARGETS_USED)) @@ -2393,7 +2406,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_POWERUP, + IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -2418,7 +2431,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_POWERUP, + IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -2442,7 +2455,7 @@ gitem_t itemlist[] = { 2, 300, NULL, - IT_POWERUP, + IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -2466,7 +2479,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_POWERUP, + IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -2490,7 +2503,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_STAY_COOP | IT_POWERUP, + IT_STAY_COOP | IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -2514,7 +2527,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_STAY_COOP | IT_POWERUP, + IT_STAY_COOP | IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, diff --git a/src/header/local.h b/src/header/local.h index 6fa73b4..fb7955a 100644 --- a/src/header/local.h +++ b/src/header/local.h @@ -202,6 +202,7 @@ typedef struct #define IT_STAY_COOP 8 #define IT_KEY 16 #define IT_POWERUP 32 +#define IT_INSTANT_USE 64 /* item is insta-used on pickup if dmflag is set */ /* gitem_t->weapmodel for weapons indicates model index */ #define WEAP_BLASTER 1