diff --git a/src/g_items.c b/src/g_items.c index ea78237..641fce4 100644 --- a/src/g_items.c +++ b/src/g_items.c @@ -219,27 +219,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; - } - - if (ent->item->use) - { - ent->item->use(other, ent->item); - } - else - { - gi.dprintf("Powerup has no use function!\n"); - } - } } return true; @@ -788,18 +767,6 @@ Pickup_Sphere(edict_t *ent, edict_t *other) { SetRespawn(ent, ent->item->quantity); } - - if (((int)dmflags->value & DF_INSTANT_ITEMS)) - { - if (ent->item->use) - { - ent->item->use(other, ent->item); - } - else - { - gi.dprintf("Powerup has no use function!\n"); - } - } } return true; @@ -1591,6 +1558,33 @@ Touch_Item(edict_t *ent, edict_t *other, cplane_t *plane /* unused */, csurface_ { 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 + { + gi.dprintf("Powerup has no use function!\n"); + } + } + } } if (!(ent->spawnflags & ITEM_TARGETS_USED)) @@ -2859,7 +2853,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_POWERUP, + IT_POWERUP|IT_INSTANT_USE, 0, NULL, 0, @@ -2881,7 +2875,7 @@ gitem_t itemlist[] = { 2, 300, NULL, - IT_POWERUP, + IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -2903,7 +2897,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_POWERUP, + IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -2925,7 +2919,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_STAY_COOP | IT_POWERUP, + IT_STAY_COOP | IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -2947,7 +2941,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_STAY_COOP | IT_POWERUP, + IT_STAY_COOP | IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -3059,7 +3053,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_POWERUP, + IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -3081,7 +3075,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_POWERUP, + IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -3124,7 +3118,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_POWERUP, + IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -3146,7 +3140,7 @@ gitem_t itemlist[] = { 2, 120, NULL, - IT_POWERUP, + IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, @@ -3168,7 +3162,7 @@ gitem_t itemlist[] = { 2, 60, NULL, - IT_POWERUP, + IT_POWERUP | IT_INSTANT_USE, 0, NULL, 0, diff --git a/src/header/local.h b/src/header/local.h index 2075e38..bc1eca3 100644 --- a/src/header/local.h +++ b/src/header/local.h @@ -232,6 +232,7 @@ typedef struct #define IT_POWERUP 0x00000020 #define IT_MELEE 0x00000040 #define IT_NOT_GIVEABLE 0x00000080 /* item can not be given */ +#define IT_INSTANT_USE 0x000000100 /* item is insta-used on pickup if dmflag is set */ /* gitem_t->weapmodel for weapons indicates model index */ #define WEAP_BLASTER 1