From: Jakob MG Date: Tue, 22 Nov 2011 09:21:24 +0000 (+0100) Subject: Make alarm sound/s stop right away when exiting a vehicle X-Git-Tag: xonotic-v0.6.0~35^2~39 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=64be7601cf4447dff16de6d99bc8d084f7812cdb;p=xonotic%2Fxonotic-data.pk3dir.git Make alarm sound/s stop right away when exiting a vehicle --- diff --git a/qcsrc/client/vehicles/vehicles.qc b/qcsrc/client/vehicles/vehicles.qc index 8041bcb3e..e687ce49a 100644 --- a/qcsrc/client/vehicles/vehicles.qc +++ b/qcsrc/client/vehicles/vehicles.qc @@ -84,7 +84,19 @@ void Net_VehicleSetup() { float hud_id, i; - hud_id = bound(HUD_SPIDERBOT, ReadByte(), HUD_RAPTOR); + + hud_id = ReadByte(); + + // hud_id == 0 means we exited a vehicle, so stop alarm sound/s + if(hud_id == 0) + { + sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE); + sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE); + + return; + } + + hud_id = bound(HUD_SPIDERBOT, hud_id, HUD_RAPTOR); // Init auxiliary crosshairs entity axh; @@ -217,7 +229,7 @@ void CSQC_SPIDER_HUD() if(alarm1time < time) { alarm1time = time + 2; - sound(world, CH_PAIN, "vehicles/alarm.wav", VOL_BASEVOICE, ATTN_NONE); + sound(self, CH_PAIN_SINGLE, "vehicles/alarm.wav", VOL_BASEVOICE, ATTN_NONE); } drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL); } @@ -226,7 +238,7 @@ void CSQC_SPIDER_HUD() drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); if(alarm1time) { - sound(world, CH_PAIN, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE); + sound(self, CH_PAIN_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE); alarm1time = 0; } } @@ -244,7 +256,7 @@ void CSQC_SPIDER_HUD() if(alarm2time < time) { alarm2time = time + 1; - sound(world, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTN_NONE); + sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTN_NONE); } drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL); } @@ -253,7 +265,7 @@ void CSQC_SPIDER_HUD() drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); if(alarm2time) { - sound(world, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE); + sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE); alarm2time = 0; } } @@ -402,7 +414,7 @@ void CSQC_RAPTOR_HUD() if(alarm2time < time) { alarm2time = time + 1; - sound(world, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTN_NONE); + sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTN_NONE); } drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL); } @@ -411,7 +423,7 @@ void CSQC_RAPTOR_HUD() drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); if(alarm2time) { - sound(world, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE); + sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE); alarm2time = 0; } } @@ -591,7 +603,7 @@ void CSQC_WAKIZASHI_HUD() if(alarm2time < time) { alarm2time = time + 1; - sound(world, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTN_NONE); + sound(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav", VOL_BASEVOICE, ATTN_NONE); } drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL); } @@ -600,7 +612,7 @@ void CSQC_WAKIZASHI_HUD() drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); if(alarm2time) { - sound(world, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE); + sound(self, CH_TRIGGER_SINGLE, "misc/null.wav", VOL_BASEVOICE, ATTN_NONE); alarm2time = 0; } } diff --git a/qcsrc/server/vehicles/vehicles.qc b/qcsrc/server/vehicles/vehicles.qc index c56715e9b..47c0803e1 100644 --- a/qcsrc/server/vehicles/vehicles.qc +++ b/qcsrc/server/vehicles/vehicles.qc @@ -628,6 +628,8 @@ void vehicles_exit(float eject) self.owner.hud = HUD_NORMAL; self.owner.switchweapon = self.switchweapon; //self.owner.BUTTON_USE = 0; + + CSQCVehicleSetup(self.owner, HUD_NORMAL); } if(self.deadflag == DEAD_NO)