Half-Life: Convert item_battery and item_healthkit to use sound shader

definitions instead of using sound() directly.
This commit is contained in:
Marco Cawthorne 2020-04-22 12:45:45 +02:00
parent 7793d52d3f
commit 0d3f271b21
6 changed files with 29 additions and 9 deletions

3
.gitignore vendored
View File

@ -9,6 +9,9 @@ src/shared/cstrike.new
src/client/hl2 src/client/hl2
src/server/hl2 src/server/hl2
src/shared/hl2 src/shared/hl2
src/client/wastes
src/server/wastes
src/shared/wastes
*.lno *.lno
*.pk3 *.pk3
*.dat *.dat

View File

@ -50,7 +50,7 @@ void item_battery::touch(void)
} }
Logging_Pickup(other, this, __NULL__); Logging_Pickup(other, this, __NULL__);
sound(other, CHAN_ITEM, "items/gunpickup2.wav", 1, ATTN_NORM); Sound_Play(other, CHAN_ITEM, "item.battery");
if (cvar("sv_playerslots") == 1) { if (cvar("sv_playerslots") == 1) {
remove(self); remove(self);
@ -72,12 +72,14 @@ void item_battery::Respawn(void)
think = __NULL__; think = __NULL__;
nextthink = -1; nextthink = -1;
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM, 150); Sound_Play(this, CHAN_ITEM, "item.respawn");
droptofloor(); droptofloor();
} }
void item_battery::item_battery(void) void item_battery::item_battery(void)
{ {
Sound_Precache("item.battery");
Sound_Precache("item.respawn");
model = "models/w_battery.mdl"; model = "models/w_battery.mdl";
CBaseEntity::CBaseEntity(); CBaseEntity::CBaseEntity();
item_healthkit::Respawn(); item_healthkit::Respawn();

View File

@ -39,7 +39,7 @@ void item_healthkit::touch(void)
return; return;
} }
Damage_Apply(other, this, -20, 0, DMG_GENERIC); Damage_Apply(other, this, -20, 0, DMG_GENERIC);
sound(this, CHAN_ITEM, "items/smallmedkit1.wav", 1, ATTN_NORM); Sound_Play(this, CHAN_ITEM, "item.healthkit");
Logging_Pickup(other, this, __NULL__); Logging_Pickup(other, this, __NULL__);
if (cvar("sv_playerslots") == 1) { if (cvar("sv_playerslots") == 1) {
@ -63,14 +63,14 @@ void item_healthkit::Respawn(void)
think = __NULL__; think = __NULL__;
nextthink = -1; nextthink = -1;
sound(this, CHAN_ITEM, "items/suitchargeok1.wav", 1, ATTN_NORM, 150); Sound_Play(this, CHAN_ITEM, "item.respawn");
droptofloor(); droptofloor();
} }
void item_healthkit::item_healthkit(void) void item_healthkit::item_healthkit(void)
{ {
precache_sound("items/smallmedkit1.wav"); Sound_Precache("item.healthkit");
precache_sound("items/suitchargeok1.wav"); Sound_Precache("item.respawn");
model = "models/w_medkit.mdl"; model = "models/w_medkit.mdl";
CBaseEntity::CBaseEntity(); CBaseEntity::CBaseEntity();
item_healthkit::Respawn(); item_healthkit::Respawn();

View File

@ -98,7 +98,7 @@ w_bradnailer_shootnail(void)
Damage_Apply(other, self.owner, 15, WEAPON_BRADNAILER, DMG_GENERIC); Damage_Apply(other, self.owner, 15, WEAPON_BRADNAILER, DMG_GENERIC);
Sound_Play(self, CHAN_WEAPON, "weapon_bradnailer.hitbody"); Sound_Play(self, CHAN_WEAPON, "weapon_bradnailer.hitbody");
} else { } else {
Weapons_PlaySound(self, CHAN_WEAPON, "weapons/xbow_hit1.wav", 1, ATTN_NORM); Sound_Play(self, CHAN_WEAPON, "weapon_crossbow.hit");
} }
remove(self); remove(self);
} }

View File

@ -7,3 +7,18 @@ ammo.respawn
{ {
sample items/suitchargeok1.wav sample items/suitchargeok1.wav
} }
item.battery
{
sample items/gunpickup2.wav
}
item.healthkit
{
sample items/smallmedkit1.wav
}
item.respawn
{
sample items/suitchargeok1.wav
}