mirror of
https://github.com/yquake2/rogue.git
synced 2024-11-22 04:11:25 +00:00
Merge pull request #68 from BjossiAlfreds/insta-powerups
Fix for some items playing wrong sound when instantly activated
This commit is contained in:
commit
e640c899c1
2 changed files with 38 additions and 43 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue