Fixed mega health always sound being played on pickup for health items with custom count in both default Lazarus and missionpack DLLs.

This commit is contained in:
Knightmare66 2020-12-03 03:38:07 -05:00
parent 93a2e256eb
commit c7334dfab0
2 changed files with 24 additions and 19 deletions

View file

@ -64,6 +64,8 @@ int hml_index;
#define HEALTH_IGNORE_MAX 1
#define HEALTH_TIMED 2
#define HEALTH_SMALL 4
#define HEALTH_LARGE 8
#define NO_STUPID_SPINNING 4
#define NO_DROPTOFLOOR 8
@ -1151,14 +1153,14 @@ void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf
if (ent->item->pickup == Pickup_Health)
{
if (ent->count == sk_health_bonus_value->value)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0);
else if (ent->count == 10)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0);
else if (ent->count == 25)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/l_health.wav"), 1, ATTN_NORM, 0);
else // (ent->count == 100)
if (ent->style == (HEALTH_IGNORE_MAX|HEALTH_TIMED)) // if (ent->count == 100)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0);
else if (ent->style & HEALTH_SMALL) // if (ent->count == sk_health_bonus_value->value)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0);
else if (ent->style & HEALTH_LARGE) // if (ent->count == 25)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/l_health.wav"), 1, ATTN_NORM, 0);
else // if (ent->count == 10)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0);
}
else if (ent->item->pickup_sound)
{
@ -2848,7 +2850,7 @@ tank commander's head
0,
0,
NULL,
HEALTH_IGNORE_MAX,
HEALTH_IGNORE_MAX|HEALTH_SMALL,
"items/s_health.wav"
},
@ -2890,7 +2892,7 @@ tank commander's head
0,
0,
NULL,
0,
HEALTH_LARGE,
"items/l_health.wav"
},
@ -3187,7 +3189,7 @@ void SP_item_health_small (edict_t *self)
self->count = sk_health_bonus_value->value;
// SpawnItem (self, FindItem ("Health"));
SpawnItem (self, FindItemByClassname ("item_health_small"));
self->style = HEALTH_IGNORE_MAX;
self->style = HEALTH_IGNORE_MAX|HEALTH_SMALL;
gi.soundindex ("items/s_health.wav");
}
@ -3208,6 +3210,7 @@ void SP_item_health_large (edict_t *self)
self->count = 25;
// SpawnItem (self, FindItem ("Health"));
SpawnItem (self, FindItemByClassname ("item_health_large"));
self->style = HEALTH_LARGE;
gi.soundindex ("items/l_health.wav");
}

View file

@ -96,6 +96,8 @@ int key_q1_base_gold_index;
#define HEALTH_IGNORE_MAX 1
#define HEALTH_TIMED 2
#define HEALTH_FOODCUBE 4
#define HEALTH_SMALL 8
#define HEALTH_LARGE 16
void Use_Quad (edict_t *ent, gitem_t *item);
@ -1790,15 +1792,14 @@ void Touch_Item (edict_t *ent, edict_t *other, cplane_t *plane, csurface_t *surf
{
if (ent->style & HEALTH_FOODCUBE)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0);
// if (ent->count == sk_health_bonus_value->value) // Knightmare
else if (ent->count < 10) // Knightmare
gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0);
else if (ent->count == 10)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0);
else if (ent->count == 25)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/l_health.wav"), 1, ATTN_NORM, 0);
else // (ent->count == 100)
else if (ent->style == (HEALTH_IGNORE_MAX|HEALTH_TIMED)) // if (ent->count == 100)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/m_health.wav"), 1, ATTN_NORM, 0);
else if (ent->style & HEALTH_SMALL) // if (ent->count < 10) // Knightmare
gi.sound(other, CHAN_ITEM, gi.soundindex("items/s_health.wav"), 1, ATTN_NORM, 0);
else if (ent->style & HEALTH_LARGE) // if (ent->count == 25)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/l_health.wav"), 1, ATTN_NORM, 0);
else // if (ent->count == 10)
gi.sound(other, CHAN_ITEM, gi.soundindex("items/n_health.wav"), 1, ATTN_NORM, 0);
}
else if (ent->item->pickup_sound) // PGM - paranoia
{
@ -5030,7 +5031,7 @@ void SP_item_health_small (edict_t *self)
if (!self->count) // Knightmare- allow mapper-spcified count
self->count = sk_health_bonus_value->value; // Knightmare- made this cvar
SpawnItem (self, FindItem ("Health"));
self->style = HEALTH_IGNORE_MAX;
self->style = HEALTH_IGNORE_MAX|HEALTH_SMALL;
gi.soundindex ("items/s_health.wav");
}
@ -5050,6 +5051,7 @@ void SP_item_health_large (edict_t *self)
if (!self->count) // Knightmare- allow mapper-spcified count
self->count = 25;
SpawnItem (self, FindItem ("Health"));
self->style = HEALTH_LARGE;
gi.soundindex ("items/l_health.wav");
}