mirror of https://github.com/yquake2/xatrix.git
Fix for some items playing wrong sound when instantly activated
This commit is contained in:
parent
e8df28a84a
commit
527f3d9845
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue