From: Jakob MG Date: Wed, 1 Jun 2011 14:29:12 +0000 (+0200) Subject: Sounds for vehicles, thanks nifrek X-Git-Tag: xonotic-v0.5.0~199^2~11^2~43 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=c0cf8ad9cbf5b19ede642920d1cb63df61fe0461;p=xonotic%2Fxonotic-data.pk3dir.git Sounds for vehicles, thanks nifrek --- diff --git a/qcsrc/client/vehicles/vehicles.qc b/qcsrc/client/vehicles/vehicles.qc index 00f0db2f6..5419a4a12 100644 --- a/qcsrc/client/vehicles/vehicles.qc +++ b/qcsrc/client/vehicles/vehicles.qc @@ -14,7 +14,7 @@ entity dropmark; float autocvar_cl_vehicles_hudscale; float autocvar_cl_vehicles_hudalpha; -float flashtime; + void CSQC_WAKIZASHI_HUD(); void CSQC_SPIDER_HUD(); @@ -97,7 +97,7 @@ void Net_VehicleSetup() axh = spawn(); axh.draw2d = Draw_Not; axh.drawmask = MASK_NORMAL; - axh.axh_drawflag = DRAWFLAG_ADDITIVE; + axh.axh_drawflag = DRAWFLAG_NORMAL; axh.axh_fadetime = 0.1; axh.axh_image = "gfx/vehicles/axh-ring.tga"; axh.axh_scale = 1; @@ -127,12 +127,12 @@ void Net_VehicleSetup() case HUD_RAPTOR: AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-cross.tga"; AuxiliaryXhair[0].axh_scale = 0.5; - AuxiliaryXhair[0].alpha = 0.25; + //AuxiliaryXhair[0].alpha = 0.5; AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-bracket.tga"; AuxiliaryXhair[1].axh_scale = 0.25; - AuxiliaryXhair[1].alpha = 0.75; - AuxiliaryXhair[1].axh_drawflag = DRAWFLAG_NORMAL; + //AuxiliaryXhair[1].alpha = 0.75; + //AuxiliaryXhair[1].axh_drawflag = DRAWFLAG_NORMAL; break; case HUD_BUMBLEBEE: @@ -146,7 +146,7 @@ void Net_VehicleSetup() } } #define HUD_GETSTATS \ - float health = getstati(STAT_VEHICLESTAT_HEALTH); \ + float vh_health = getstati(STAT_VEHICLESTAT_HEALTH); \ float shield = getstati(STAT_VEHICLESTAT_SHIELD); \ float energy = getstati(STAT_VEHICLESTAT_ENERGY); \ float ammo1 = getstati(STAT_VEHICLESTAT_AMMO1); \ @@ -156,65 +156,6 @@ void Net_VehicleSetup() void CSQC_BUMBLE_HUD() { - /* - vector picsize, hudloc; - - // Fetch health & ammo stats - HUD_GETSTATS - - hudloc_y = 4; - hudloc_x = 4; - - picsize = drawgetimagesize(spider_h) * 0.5; - drawpic(hudloc, spider_h, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - - picsize = drawgetimagesize(spider_a2) * 0.5; - drawpic(hudloc + '120 96 0', spider_a2, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - - drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL); - drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL); - drawstring(hudloc + '136 102 0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL); - - picsize = drawgetimagesize(spider_a1) * 0.85; - if(ammo2 == 9) - { - drawpic(hudloc + '132 54 0', spider_a1, picsize, '-1 -1 -1', 1, DRAWFLAG_NORMAL); - drawstring(hudloc + '179 69 0', strcat(ftos(reload2), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL); - } - else - { - drawpic(hudloc + '132 54 0', spider_a1, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - drawstring(hudloc + '179 69 0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL); - } - - picsize = drawgetimagesize(spider_b) * 0.5; - hudloc_y = 10.5; - hudloc_x = 10.5; - - ammo1 /= 100; - shield /= 100; - health /= 100; - reload2 /= 100; - - drawpic(hudloc, spider_s, picsize, '1 1 1', shield, DRAWFLAG_NORMAL); - drawpic(hudloc, spider_b, picsize, '0 1 0' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL); - drawpic(hudloc, spider_r, picsize, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL); - drawpic(hudloc, spider_g, picsize, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL); - - - if (scoreboard_showscores) - { - HUD_DrawScoreboard(); - HUD_DrawCenterPrint(); - } - else - { - picsize = drawgetimagesize(SPIDER_CROSS); - picsize_x *= autocvar_cl_vehicle_spiderbot_cross_size; - picsize_y *= autocvar_cl_vehicle_spiderbot_cross_size; - - drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), SPIDER_CROSS, picsize, '1 1 1', autocvar_cl_vehicle_spiderbot_cross_alpha, DRAWFLAG_ADDITIVE); - */ } @@ -222,6 +163,9 @@ void CSQC_BUMBLE_HUD() #define spider_rkt "gfx/vehicles/sbot_rpods.tga" #define spider_mgun "gfx/vehicles/sbot_mguns.tga" #define spider_xhair "gfx/vehicles/axh-special1.tga" +float alarm1time; +float alarm2time; + void CSQC_SPIDER_HUD() { if(autocvar_r_letterbox) @@ -239,19 +183,19 @@ void CSQC_SPIDER_HUD() drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL); - //drawstring(hudloc + '145 19 0', strcat(ftos(health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL); + //drawstring(hudloc + '145 19 0', strcat(ftos(vh_health), "%"),'15 15 0','0 1 0', 1, DRAWFLAG_NORMAL); //drawstring(hudloc + '175 34 0', strcat(ftos(shield), "%"),'15 15 0','0 0 1', 1, DRAWFLAG_NORMAL); //drawstring(hudloc + '136 102 0', strcat(ftos(ammo1), "%"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL); //drawstring(hudloc + '179 69 0', strcat(ftos(9 - ammo2), " / 8"),'14 14 0','1 1 0', 1, DRAWFLAG_NORMAL); ammo1 *= 0.01; shield *= 0.01; - health *= 0.01; + vh_health *= 0.01; reload2 *= 0.01; pic2size = drawgetimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8); picloc = picsize * 0.5 - pic2size * 0.5; - drawpic(hudloc + picloc, spider_ico, pic2size, '1 1 1' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL); + drawpic(hudloc + picloc, spider_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL); drawpic(hudloc + picloc, spider_rkt, pic2size, '1 1 1' * reload2 + '1 0 0' * (1 - reload2), 1, DRAWFLAG_NORMAL); drawpic(hudloc + picloc, spider_mgun, pic2size, '1 1 1' * ammo1 + '1 0 0' * (1 - ammo1), 1, DRAWFLAG_NORMAL); drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL); @@ -259,17 +203,30 @@ void CSQC_SPIDER_HUD() // Health bar picsize = drawgetimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - health)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon picsize = drawgetimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale; picloc = '37 65 0' * autocvar_cl_vehicles_hudscale; - if(health < 0.25) + if(vh_health < 0.25) + { + if(alarm1time < time) + { + alarm1time = time + 2; + sound(world, CHAN_PAIN, strcat("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); + } else + { drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - + if(alarm1time) + { + sound(world, CHAN_PAIN, strcat("misc/null.wav"), VOL_BASEVOICE, ATTN_NONE); + alarm1time = 0; + } + } // Shield bar picsize = drawgetimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 140 0' * autocvar_cl_vehicles_hudscale; @@ -280,9 +237,24 @@ void CSQC_SPIDER_HUD() picloc = '40 136 0' * autocvar_cl_vehicles_hudscale; picsize = drawgetimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale; if(shield < 0.25) + { + if(alarm2time < time) + { + alarm2time = time + 1; + sound(world, CHAN_TRIGGER, strcat("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); + } else + { drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); + if(alarm2time) + { + sound(world, CHAN_TRIGGER, strcat("misc/null.wav"), VOL_BASEVOICE, ATTN_NONE); + alarm2time = 0; + } + } + // Minigun bar picsize = drawgetimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale; @@ -372,14 +344,14 @@ void CSQC_RAPTOR_HUD() ammo1 *= 0.01; ammo2 *= 0.01; shield *= 0.01; - health *= 0.01; + vh_health *= 0.01; energy *= 0.01; reload1 = reload2 * 0.01; //reload2 *= 0.01; pic2size = drawgetimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8); picloc = picsize * 0.5 - pic2size * 0.5; - drawpic(hudloc + picloc, raptor_ico, pic2size, '1 1 1' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL); + drawpic(hudloc + picloc, raptor_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL); drawpic(hudloc + picloc, raptor_bomb, pic2size, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL); drawpic(hudloc + picloc, raptor_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL); drawpic(hudloc + picloc, hud_sh, pic2size, '1 1 1', shield, DRAWFLAG_NORMAL); @@ -387,16 +359,32 @@ void CSQC_RAPTOR_HUD() // Health bar picsize = drawgetimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - health)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon picsize = drawgetimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale; picloc = '37 65 0' * autocvar_cl_vehicles_hudscale; - if(health < 0.25) + if(vh_health < 0.25) + { + if(self.lip < time) + { + self.lip = time + 2; + sound(self, CHAN_PAIN, strcat("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); + } else + { drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); + if(self.lip) + { + sound(self, CHAN_PAIN, strcat("misc/null.wav"), VOL_BASEVOICE, ATTN_NONE); + self.lip = 0; + } + + } // Shield bar picsize = drawgetimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale; @@ -408,10 +396,24 @@ void CSQC_RAPTOR_HUD() picloc = '40 136 0' * autocvar_cl_vehicles_hudscale; picsize = drawgetimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale; if(shield < 0.25) + { + if(alarm2time < time) + { + alarm2time = time + 1; + sound(world, CHAN_TRIGGER, strcat("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); + } else + { drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - + if(alarm2time) + { + sound(world, CHAN_TRIGGER, strcat("misc/null.wav"), VOL_BASEVOICE, ATTN_NONE); + alarm2time = 0; + } + } + // Gun bar picsize = drawgetimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale; picloc = '450 69 0' * autocvar_cl_vehicles_hudscale; @@ -530,13 +532,13 @@ void CSQC_WAKIZASHI_HUD() drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL); shield *= 0.01; - health *= 0.01; + vh_health *= 0.01; energy *= 0.01; reload1 *= 0.01; pic2size = drawgetimagesize(spider_ico) * (autocvar_cl_vehicles_hudscale * 0.8); picloc = picsize * 0.5 - pic2size * 0.5; - drawpic(hudloc + picloc, waki_ico, pic2size, '1 1 1' * health + '1 0 0' * (1 - health), 1, DRAWFLAG_NORMAL); + drawpic(hudloc + picloc, waki_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL); drawpic(hudloc + picloc, waki_eng, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL); drawpic(hudloc + picloc, waki_gun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL); drawpic(hudloc + picloc, waki_rkt, pic2size, '1 1 1' * reload1 + '1 0 0' * (1 - reload1), 1, DRAWFLAG_NORMAL); @@ -545,16 +547,33 @@ void CSQC_WAKIZASHI_HUD() // Health bar picsize = drawgetimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale; picloc = '69 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - health)), 0, vid_conwidth, vid_conheight); + drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - vh_health)), 0, vid_conwidth, vid_conheight); drawpic(hudloc + picloc, hud_hp_bar, picsize, '1 1 1', 1 , DRAWFLAG_NORMAL); drawresetcliparea(); // .. and icon picsize = drawgetimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale; picloc = '37 65 0' * autocvar_cl_vehicles_hudscale; - if(health < 0.25) + if(vh_health < 0.25) + { + if(self.lip < time) + { + self.lip = time + 2; + sound(self, CHAN_PAIN, strcat("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); + } else + { drawpic(hudloc + picloc, hud_hp_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); + if(self.lip) + { + sound(self, CHAN_PAIN, strcat("misc/null.wav"), VOL_BASEVOICE, ATTN_NONE); + self.lip = 0; + } + + } + // Shield bar picsize = drawgetimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale; @@ -566,10 +585,24 @@ void CSQC_WAKIZASHI_HUD() picloc = '40 136 0' * autocvar_cl_vehicles_hudscale; picsize = drawgetimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale; if(shield < 0.25) + { + if(alarm2time < time) + { + alarm2time = time + 1; + sound(world, CHAN_TRIGGER, strcat("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); + } else + { drawpic(hudloc + picloc, hud_sh_ico, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - + if(alarm2time) + { + sound(world, CHAN_TRIGGER, strcat("misc/null.wav"), VOL_BASEVOICE, ATTN_NONE); + alarm2time = 0; + } + } + // Gun bar picsize = drawgetimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale; picloc = '450 69 0' * autocvar_cl_vehicles_hudscale; @@ -628,6 +661,9 @@ void Vehicles_Precache() precache_model("models/vehicles/clusterbomb_fragment.md3"); precache_model("models/vehicles/rocket01.md3"); precache_model("models/vehicles/rocket02.md3"); + + precache_sound ("vehicles/alarm.wav"); + precache_sound ("vehicles/alarm_shield.wav"); } void RaptorCBShellfragDraw() diff --git a/qcsrc/server/vehicles/racer.qc b/qcsrc/server/vehicles/racer.qc index 8ea2ca7bc..05390ff87 100644 --- a/qcsrc/server/vehicles/racer.qc +++ b/qcsrc/server/vehicles/racer.qc @@ -1,5 +1,6 @@ #define RACER_MIN '-120 -120 -40' #define RACER_MAX '120 120 40' +#define RACER_ENGINE "sound/vehicles/racer.wav" #ifdef SVQC void racer_exit(float eject); @@ -261,7 +262,7 @@ float racer_frame() player.BUTTON_ZOOM = player.BUTTON_CROUCH = 0; self = racer; - + #ifdef VEHICLES_CSQC racer.SendFlags |= VSF_MOVEMENT; @@ -364,16 +365,46 @@ float racer_frame() else if(player.movement_y > 0) df += v_right * autocvar_g_vehicle_racer_speed_strafe; } - + + if(vlen(player.movement) != 0) + { + if(self.sound_nexttime < time || self.sounds != 1) + { + self.sounds = 1; + self.sound_nexttime = time + soundlength("vehicles/racer_move.wav"); + sound (self, CHAN_VOICE, "vehicles/racer_move.wav", VOL_BASE, ATTN_NORM); + } + } + else + { + if(self.sound_nexttime < time || self.sounds != 0) + { + self.sounds = 0; + self.sound_nexttime = time + soundlength("vehicles/racer_idle.wav"); + sound (self, CHAN_VOICE, "vehicles/racer_idle.wav", VOL_BASE, ATTN_NORM); + } + } + // Afterburn - if (player.BUTTON_JUMP) - if(racer.vehicle_energy >= (autocvar_g_vehicle_racer_afterburn_cost * frametime)) + if (player.BUTTON_JUMP && racer.vehicle_energy >= (autocvar_g_vehicle_racer_afterburn_cost * frametime)) { racer.wait = time; racer.vehicle_energy -= autocvar_g_vehicle_racer_afterburn_cost * frametime; df += (v_forward * autocvar_g_vehicle_racer_speed_afterburn); - //self.owner.vehicle_energy = racer.vehicle_energy / autocvar_g_vehicle_racer_energy; + + if(self.strength_finished < time) + { + //self.sounds = 2; + self.strength_finished = time + soundlength("vehicles/racer_boost.wav"); + sound (self, CHAN_PLAYER, "vehicles/racer_boost.wav", VOL_BASE, ATTN_NORM); + } + } + else + { + self.strength_finished = 0; + sound (self, CHAN_PLAYER, "misc/null.wav", VOL_BASE, ATTN_NORM); } + racer.velocity += df * frametime; @@ -670,6 +701,10 @@ void spawnfunc_vehicle_racer() precache_sound ("weapons/lasergun_fire.wav"); precache_sound ("weapons/rocket_fire.wav"); precache_sound ("weapons/rocket_impact.wav"); + + precache_sound ("vehicles/racer_idle.wav"); + precache_sound ("vehicles/racer_move.wav"); + precache_sound ("vehicles/racer_boost.wav"); precache_model ("models/vhshield.md3"); precache_model ("models/vehicles/wakizashi.dpm"); diff --git a/qcsrc/server/vehicles/raptor.qc b/qcsrc/server/vehicles/raptor.qc index f1cce3c8b..2541acbe3 100644 --- a/qcsrc/server/vehicles/raptor.qc +++ b/qcsrc/server/vehicles/raptor.qc @@ -1,7 +1,7 @@ #ifdef SVQC #define RAPTOR_MIN '-80 -80 0' #define RAPTOR_MAX '80 80 70' - +//#define RAPTOR_ENGINE "sound/vehicles/raptor.wav" float autocvar_g_vehicle_raptor_respawntime; float autocvar_g_vehicle_raptor_movestyle; @@ -263,10 +263,16 @@ void raptor_exit(float eject) float raptor_takeoff() { entity player, raptor; - + player = self; raptor = self.vehicle; self = raptor; + + if(self.sound_nexttime < time) + { + self.sound_nexttime = time + soundlength("vehicles/raptor_fly.wav"); + sound (self, CHAN_VOICE, "vehicles/raptor_fly.wav", VOL_BASE, ATTN_NORM); + } // Takeoff sequense if(raptor.frame < 25) @@ -314,7 +320,21 @@ float raptor_frame() player = self; raptor = self.vehicle; self = raptor; - + + ftmp = vlen(self.velocity); + if(ftmp > autocvar_g_vehicle_raptor_speed_forward) + ftmp = 1; + else + ftmp = ftmp / autocvar_g_vehicle_raptor_speed_forward; + + if(fabs(ftmp - self.wait) > 0.2 || self.sound_nexttime < time) + { + self.sound_nexttime = time + soundlength("vehicles/raptor_fly.wav"); + sound (self, CHAN_VOICE, "vehicles/raptor_fly.wav", 1 - ftmp, ATTN_NORM ); + sound (self, CHAN_PLAYER, "vehicles/raptor_speed.wav", ftmp, ATTN_NORM); + self.wait = ftmp; + } + if(player.BUTTON_USE && raptor.deadflag == DEAD_NO) { self = raptor; @@ -329,7 +349,6 @@ float raptor_frame() player.BUTTON_ATCK = player.BUTTON_ATCK2 = 0; return 1; } - crosshair_trace(player); #if VEHICLES_VIEWROTATE_CROSSHAIR @@ -729,6 +748,8 @@ void raptor_dinit() void spawnfunc_vehicle_raptor() { vehicles_configcheck("vehicle_raptor.cfg", autocvar_g_vehicle_raptor_health); + + if(autocvar_g_vehicle_raptor_shield) self.vehicle_flags |= VHF_HASSHIELD; @@ -749,7 +770,9 @@ void spawnfunc_vehicle_raptor() precache_model ("models/vehicles/clusterbomb.md3"); precache_model ("models/vehicles/clusterbomb_folded.md3"); precache_model ("models/vehicles/raptor_body.dpm"); - + precache_sound ("vehicles/raptor_fly.wav"); + precache_sound ("vehicles/raptor_speed.wav"); + self.think = raptor_dinit; self.nextthink = time + 1; } diff --git a/qcsrc/server/vehicles/spiderbot.qc b/qcsrc/server/vehicles/spiderbot.qc index cc1283aa9..922596986 100644 --- a/qcsrc/server/vehicles/spiderbot.qc +++ b/qcsrc/server/vehicles/spiderbot.qc @@ -259,8 +259,17 @@ float spiderbot_frame() if(spider.flags & FL_ONGROUND) { - if(player.BUTTON_JUMP && self.tur_head.wait < time) + if(spider.frame == 4 && self.tur_head.wait != 0) { + sound (self, CHAN_VOICE, "vehicles/spiderbot_land.wav", VOL_BASE, ATTN_NORM); + spider.frame = 5; + } + + if(player.BUTTON_JUMP && self.tur_head.wait < time) + { + sound (self, CHAN_VOICE, "vehicles/spiderbot_jump.wav", VOL_BASE, ATTN_NORM); + self.delay = 0; + self.tur_head.wait = time + 2; player.BUTTON_JUMP = 0; spider.velocity = v_forward * 700 + v_up * 600; @@ -270,6 +279,12 @@ float spiderbot_frame() { if(vlen(player.movement) == 0) { + if(self.sound_nexttime < time || self.delay != 3) + { + self.delay = 3; + self.sound_nexttime = time + soundlength("vehicles/spiderbot_idle.wav"); + sound (self, CHAN_VOICE, "vehicles/spiderbot_idle.wav", VOL_BASE, ATTN_NORM); + } movelib_beak_simple(autocvar_g_vehicle_spiderbot_speed_stop); spider.frame = 5; } @@ -292,6 +307,14 @@ float spiderbot_frame() } player.movement_y = 0; movelib_move_simple(normalize(v_forward * player.movement_x),autocvar_g_vehicle_spiderbot_speed_walk,autocvar_g_vehicle_spiderbot_movement_inertia); + + if(self.sound_nexttime < time || self.delay != 1) + { + self.delay = 1; + self.sound_nexttime = time + soundlength("vehicles/spiderbot_walk.wav"); + sound (self, CHAN_VOICE, "vehicles/spiderbot_walk.wav", VOL_BASE, ATTN_NORM); + } + } else if(player.movement_y != 0) { @@ -306,6 +329,12 @@ float spiderbot_frame() spider.frame = 3; } movelib_move_simple(normalize(v_right * player.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia); + if(self.sound_nexttime < time || self.delay != 2) + { + self.delay = 2; + self.sound_nexttime = time + soundlength("vehicles/spiderbot_strafe.wav"); + sound (self, CHAN_VOICE, "vehicles/spiderbot_strafe.wav", VOL_BASE, ATTN_NORM); + } } } } @@ -559,7 +588,8 @@ void spiderbot_blowup() void spiderbot_die() { - sound (self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM); + sound (self, CHAN_VOICE, "vehicles/spiderbot_die.wav", VOL_BASE, ATTN_NORM); + //sound (self, CHAN_PROJECTILE, "weapons/rocket_impact.wav", VOL_BASE, ATTN_NORM); pointparticles(particleeffectnum("rocket_explode"), self.origin + '0 0 100', '0 0 0', 1); self.health = 0; @@ -622,7 +652,14 @@ void spawnfunc_vehicle_spiderbot() precache_sound ( "weapons/rocket_impact.wav" ); precache_sound ( "weapons/uzi_fire.wav" ); - precache_sound ( "weapons/rocket_impact.wav" ); + precache_sound ( "weapons/rocket_impact.wav"); + + precache_sound ( "vehicles/spiderbot_die.wav"); + precache_sound ( "vehicles/spiderbot_idle.wav"); + precache_sound ( "vehicles/spiderbot_jump.wav"); + precache_sound ( "vehicles/spiderbot_strafe.wav"); + precache_sound ( "vehicles/spiderbot_walk.wav"); + precache_sound ( "vehicles/spiderbot_land.wav"); vehicles_configcheck("vehicle_spiderbot.cfg", autocvar_g_vehicle_spiderbot_health); if(autocvar_g_vehicle_spiderbot_shield) diff --git a/qcsrc/server/vehicles/vehicles.qc b/qcsrc/server/vehicles/vehicles.qc index 4ba25be5b..fc82e8058 100644 --- a/qcsrc/server/vehicles/vehicles.qc +++ b/qcsrc/server/vehicles/vehicles.qc @@ -105,6 +105,7 @@ void CSQCVehicleSetup(entity own, float vehicle_id) .entity lock_target; .float lock_strength; .float lock_time; +.float lock_soundtime; void vehicles_locktarget(float incr, float decr, float _lock_time) { if(self.lock_target && self.lock_target.deadflag != DEAD_NO) @@ -115,7 +116,17 @@ void vehicles_locktarget(float incr, float decr, float _lock_time) } if(self.lock_time > time) + { + if(self.lock_target) + if(self.lock_soundtime < time) + { + self.lock_soundtime = time + 0.5; + play2(self.owner, "vehicles/locked.wav"); + } + return; + } + if(trace_ent != world) { @@ -131,7 +142,22 @@ void vehicles_locktarget(float incr, float decr, float _lock_time) if(self.lock_target == world && trace_ent != world) self.lock_target = trace_ent; - + + if(self.lock_target && trace_ent == self.lock_target) + { + if(self.lock_strength != 1 && self.lock_strength + incr >= 1) + { + play2(self.owner, "vehicles/lock.wav"); + self.lock_soundtime = time + 0.8; + } + else if (self.lock_strength != 1 && self.lock_soundtime < time) + { + play2(self.owner, "vehicles/locking.wav"); + self.lock_soundtime = time + 0.3; + } + + } + // Have a locking target // Trace hit current target if(trace_ent == self.lock_target && trace_ent != world) diff --git a/qcsrc/server/vehicles/vehicles_def.qh b/qcsrc/server/vehicles/vehicles_def.qh index 3ecdd8b63..67c889cff 100644 --- a/qcsrc/server/vehicles/vehicles_def.qh +++ b/qcsrc/server/vehicles/vehicles_def.qh @@ -35,6 +35,8 @@ float VHF_MOVE_FLY = 512; /// Vehicle is airborn .entity vehicle_viewport; .entity vehicle_hudmodel; +.float sound_nexttime; + .float hud; .float dmg_time; .float vehicle_respawntime; diff --git a/sound/vehicles/alarm.wav b/sound/vehicles/alarm.wav new file mode 100644 index 000000000..95b4f5566 Binary files /dev/null and b/sound/vehicles/alarm.wav differ diff --git a/sound/vehicles/alarm_shield.wav b/sound/vehicles/alarm_shield.wav new file mode 100644 index 000000000..8e46d62ac Binary files /dev/null and b/sound/vehicles/alarm_shield.wav differ diff --git a/sound/vehicles/lock.wav b/sound/vehicles/lock.wav new file mode 100644 index 000000000..54a0a0d5f Binary files /dev/null and b/sound/vehicles/lock.wav differ diff --git a/sound/vehicles/locked.wav b/sound/vehicles/locked.wav new file mode 100644 index 000000000..e846776cf Binary files /dev/null and b/sound/vehicles/locked.wav differ diff --git a/sound/vehicles/locking.wav b/sound/vehicles/locking.wav new file mode 100644 index 000000000..210d88ec5 Binary files /dev/null and b/sound/vehicles/locking.wav differ diff --git a/sound/vehicles/racer_boost.wav b/sound/vehicles/racer_boost.wav new file mode 100644 index 000000000..93149e4b4 Binary files /dev/null and b/sound/vehicles/racer_boost.wav differ diff --git a/sound/vehicles/racer_idle.wav b/sound/vehicles/racer_idle.wav new file mode 100644 index 000000000..025332ab0 Binary files /dev/null and b/sound/vehicles/racer_idle.wav differ diff --git a/sound/vehicles/racer_move.wav b/sound/vehicles/racer_move.wav new file mode 100644 index 000000000..193a5e2cf Binary files /dev/null and b/sound/vehicles/racer_move.wav differ diff --git a/sound/vehicles/raptor_fly.wav b/sound/vehicles/raptor_fly.wav new file mode 100644 index 000000000..3799f7493 Binary files /dev/null and b/sound/vehicles/raptor_fly.wav differ diff --git a/sound/vehicles/raptor_speed.wav b/sound/vehicles/raptor_speed.wav new file mode 100644 index 000000000..acc178460 Binary files /dev/null and b/sound/vehicles/raptor_speed.wav differ diff --git a/sound/vehicles/spiderbot_die.wav b/sound/vehicles/spiderbot_die.wav new file mode 100644 index 000000000..dd04e5d80 Binary files /dev/null and b/sound/vehicles/spiderbot_die.wav differ diff --git a/sound/vehicles/spiderbot_idle.wav b/sound/vehicles/spiderbot_idle.wav new file mode 100644 index 000000000..036647866 Binary files /dev/null and b/sound/vehicles/spiderbot_idle.wav differ diff --git a/sound/vehicles/spiderbot_jump.wav b/sound/vehicles/spiderbot_jump.wav new file mode 100644 index 000000000..3abda3f32 Binary files /dev/null and b/sound/vehicles/spiderbot_jump.wav differ diff --git a/sound/vehicles/spiderbot_land.wav b/sound/vehicles/spiderbot_land.wav new file mode 100644 index 000000000..d797e1fb6 Binary files /dev/null and b/sound/vehicles/spiderbot_land.wav differ diff --git a/sound/vehicles/spiderbot_strafe.wav b/sound/vehicles/spiderbot_strafe.wav new file mode 100644 index 000000000..2feae87bf Binary files /dev/null and b/sound/vehicles/spiderbot_strafe.wav differ diff --git a/sound/vehicles/spiderbot_walk.wav b/sound/vehicles/spiderbot_walk.wav new file mode 100644 index 000000000..b17cf868b Binary files /dev/null and b/sound/vehicles/spiderbot_walk.wav differ