X-Git-Url: http://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fvehicles%2Funit%2Fbumblebee.qc;h=cc52716c79f4761c91fc83b3a00d768a4108f3a1;hp=ef02d6b839b51abe3503f83856a1de111bc01242;hb=ae2c1407ec9a05e4f501a6604a7cce8e1030df9f;hpb=60c1084d25fd08252a6f7b552d4c383b65700302 diff --git a/qcsrc/common/vehicles/unit/bumblebee.qc b/qcsrc/common/vehicles/unit/bumblebee.qc index ef02d6b83..cc52716c7 100644 --- a/qcsrc/common/vehicles/unit/bumblebee.qc +++ b/qcsrc/common/vehicles/unit/bumblebee.qc @@ -51,7 +51,7 @@ float autocvar_g_vehicle_bumblebee_cannon_ammo; float autocvar_g_vehicle_bumblebee_cannon_ammo_regen; float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause; -var float autocvar_g_vehicle_bumblebee_cannon_lock = 0; +float autocvar_g_vehicle_bumblebee_cannon_lock = 0; float autocvar_g_vehicle_bumblebee_cannon_turnspeed; float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down; @@ -84,9 +84,9 @@ float autocvar_g_vehicle_bumblebee_blowup_radius; float autocvar_g_vehicle_bumblebee_blowup_coredamage; float autocvar_g_vehicle_bumblebee_blowup_edgedamage; float autocvar_g_vehicle_bumblebee_blowup_forceintensity; -var vector autocvar_g_vehicle_bumblebee_bouncepain; +vector autocvar_g_vehicle_bumblebee_bouncepain; -var float autocvar_g_vehicle_bumblebee = 0; +bool autocvar_g_vehicle_bumblebee = 0; float bumble_raygun_send(entity to, int sf); @@ -275,9 +275,10 @@ void bumblebee_gunner_exit(int _exitflag) if(player == vehic.gunner2) { vehic.gunner2 = world; v_right *= -1; } vector spot = real_origin(gunner); - spot += v_up * 128 + v_forward * 300 + v_right * 150; - spot = vehicles_findgoodexit(spot); - //setorigin(player, spot); + spot = spot + v_up * 128 + v_forward * 300 + v_right * 150; + spot = bumblebee_gunner_findgoodexit(spot, gunner, player); + + // TODO: figure a way to move player out of the gunner player.velocity = 0.75 * vehic.velocity + normalize(spot - vehic.origin) * 200; player.velocity_z += 10; @@ -285,11 +286,7 @@ void bumblebee_gunner_exit(int _exitflag) gunner.phase = time + 5; gunner.vehicle_hudmodel.viewmodelforclient = gunner; - vh_player = player; - vh_vehicle = gunner; - MUTATOR_CALLHOOK(VehicleExit); - player = vh_player; - gunner = vh_vehicle; + MUTATOR_CALLHOOK(VehicleExit, player, gunner); player.vehicle = world; } @@ -356,11 +353,7 @@ bool bumblebee_gunner_enter() CSQCVehicleSetup(player, player.hud); - vh_player = player; - vh_vehicle = gunner; - MUTATOR_CALLHOOK(VehicleEnter); - player = vh_player; - gunner = vh_vehicle; + MUTATOR_CALLHOOK(VehicleEnter, player, gunner); return true; } @@ -596,7 +589,7 @@ float bumblebee_pilot_frame() trace_ent.health = min(trace_ent.health + autocvar_g_vehicle_bumblebee_healgun_hps * frametime, autocvar_g_vehicle_bumblebee_healgun_hmax); } - else if(trace_ent.turrcaps_flags & TFL_TURRCAPS_ISTURRET) + else if(IS_TURRET(trace_ent)) { if(trace_ent.health <= trace_ent.max_health && autocvar_g_vehicle_bumblebee_healgun_hps) trace_ent.health = min(trace_ent.health + autocvar_g_vehicle_bumblebee_healgun_hps * frametime, trace_ent.max_health); @@ -713,7 +706,7 @@ void bumblebee_blowup() DEATH_VH_BUMB_DEATH, world); sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); - pointparticles(particleeffectnum("explosion_big"), (self.origin + '0 0 100') + (randomvec() * 80), '0 0 0', 1); + Send_Effect("explosion_big", (self.origin + '0 0 100') + (randomvec() * 80), '0 0 0', 1); if(self.owner.deadflag == DEAD_DYING) self.owner.deadflag = DEAD_DEAD; @@ -729,7 +722,7 @@ void bumblebee_diethink() if(random() < 0.1) { sound(self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM); - pointparticles(particleeffectnum("explosion_small"), randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); + Send_Effect("explosion_small", randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); } self.nextthink = time + 0.1; @@ -872,8 +865,8 @@ float v_bumblebee(float req) _body.enemy = self.enemy; _body.scale = 1.5; _body.angles = self.angles; - - pointparticles(particleeffectnum("explosion_medium"), findbetterlocation(self.origin, 16), '0 0 0', 1); + + Send_Effect("explosion_medium", findbetterlocation(self.origin, 16), '0 0 0', 1); self.health = 0; self.event_damage = func_null; @@ -1013,130 +1006,12 @@ float v_bumblebee(float req) #endif // SVQC #ifdef CSQC -#define bumb_ico "gfx/vehicles/bumb.tga" -#define bumb_lgun "gfx/vehicles/bumb_lgun.tga" -#define bumb_rgun "gfx/vehicles/bumb_rgun.tga" - -#define bumb_gun_ico "gfx/vehicles/bumb_side.tga" -#define bumb_gun_gun "gfx/vehicles/bumb_side_gun.tga" - void CSQC_BUMBLE_GUN_HUD() { - if(autocvar_r_letterbox) - return; - - vector picsize, hudloc = '0 0 0', pic2size, picloc; - - // Fetch health & ammo stats - HUD_GETVEHICLESTATS - - picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale; - hudloc_y = vid_conheight - picsize_y; - hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5; - - drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL); - - shield *= 0.01; - vh_health *= 0.01; - energy *= 0.01; - reload1 *= 0.01; - - pic2size = draw_getimagesize(bumb_gun_ico) * (autocvar_cl_vehicles_hudscale * 0.8); - picloc = picsize * 0.5 - pic2size * 0.5; - - if(vh_health < 0.25) - drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL); - else - drawpic(hudloc + picloc, bumb_gun_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL); - - drawpic(hudloc + picloc, bumb_gun_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); - -// Health bar - picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale; - picloc = '69 69 0' * autocvar_cl_vehicles_hudscale; - 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 = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale; - picloc = '37 65 0' * autocvar_cl_vehicles_hudscale; - if(vh_health < 0.25) - { - if(alarm1time < time) - { - alarm1time = time + 2; - vehicle_alarm(self, CH_PAIN_SINGLE, "vehicles/alarm.wav"); - } - - 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) - { - vehicle_alarm(self, CH_PAIN_SINGLE, "misc/null.wav"); - alarm1time = 0; - } - } - -// Shield bar - picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale; - picloc = '69 140 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight); - drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - drawresetcliparea(); -// .. and icon - picloc = '40 136 0' * autocvar_cl_vehicles_hudscale; - picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale; - if(shield < 0.25) - { - if(alarm2time < time) - { - alarm2time = time + 1; - vehicle_alarm(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav"); - } - 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) - { - vehicle_alarm(self, CH_TRIGGER_SINGLE, "misc/null.wav"); - alarm2time = 0; - } - } - -// Gun bar - picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale; - picloc = '450 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * energy, vid_conheight); - drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - drawresetcliparea(); - -// .. and icon - picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale; - picloc = '664 60 0' * autocvar_cl_vehicles_hudscale; - if(energy < 0.2) - drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL); - else - drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - - if (scoreboard_showscores) - HUD_DrawScoreboard(); - /* - else - { - picsize = draw_getimagesize(waki_xhair); - picsize_x *= 0.5; - picsize_y *= 0.5; - - - drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - } - */ + Vehicles_drawHUD("vehicle_gunner", "vehicle_gunner_weapon1", string_null, + "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color, + string_null, '0 0 0', + string_null); } void bumble_raygun_draw() @@ -1177,7 +1052,7 @@ void bumble_raygun_draw() } } -void bumble_raygun_read(float bIsNew) +void bumble_raygun_read(bool bIsNew) { int sf = ReadByte(); @@ -1221,166 +1096,17 @@ float v_bumblebee(float req) { case VR_HUD: { - if(autocvar_r_letterbox) - return true; - - vector picsize, hudloc = '0 0 0', pic2size, picloc; - - // Fetch health & ammo stats - HUD_GETVEHICLESTATS - - picsize = draw_getimagesize(hud_bg) * autocvar_cl_vehicles_hudscale; - hudloc_y = vid_conheight - picsize_y; - hudloc_x = vid_conwidth * 0.5 - picsize_x * 0.5; - - drawpic(hudloc, hud_bg, picsize, '1 1 1', autocvar_cl_vehicles_hudalpha, DRAWFLAG_NORMAL); - - shield *= 0.01; - vh_health *= 0.01; - energy *= 0.01; - reload1 *= 0.01; - - pic2size = draw_getimagesize(bumb_ico) * (autocvar_cl_vehicles_hudscale * 0.8); - picloc = picsize * 0.5 - pic2size * 0.5; - - if(vh_health < 0.25) - drawpic(hudloc + picloc, bumb_ico, pic2size, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL); - else - drawpic(hudloc + picloc, bumb_ico, pic2size, '1 1 1' * vh_health + '1 0 0' * (1 - vh_health), 1, DRAWFLAG_NORMAL); - - drawpic(hudloc + picloc, bumb_lgun, pic2size, '1 1 1' * energy + '1 0 0' * (1 - energy), 1, DRAWFLAG_NORMAL); - drawpic(hudloc + picloc, bumb_lgun, 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); - - // Health bar - picsize = draw_getimagesize(hud_hp_bar) * autocvar_cl_vehicles_hudscale; - picloc = '69 69 0' * autocvar_cl_vehicles_hudscale; - 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 = draw_getimagesize(hud_hp_ico) * autocvar_cl_vehicles_hudscale; - picloc = '37 65 0' * autocvar_cl_vehicles_hudscale; - if(vh_health < 0.25) - { - if(alarm1time < time) - { - alarm1time = time + 2; - vehicle_alarm(self, CH_PAIN_SINGLE, "vehicles/alarm.wav"); - } - - 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) - { - vehicle_alarm(self, CH_PAIN_SINGLE, "misc/null.wav"); - alarm1time = 0; - } - } - - // Shield bar - picsize = draw_getimagesize(hud_sh_bar) * autocvar_cl_vehicles_hudscale; - picloc = '69 140 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x + (picsize_x * (1 - shield)), 0, vid_conwidth, vid_conheight); - drawpic(hudloc + picloc, hud_sh_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - drawresetcliparea(); - // .. and icon - picloc = '40 136 0' * autocvar_cl_vehicles_hudscale; - picsize = draw_getimagesize(hud_sh_ico) * autocvar_cl_vehicles_hudscale; - if(shield < 0.25) - { - if(alarm2time < time) - { - alarm2time = time + 1; - vehicle_alarm(self, CH_TRIGGER_SINGLE, "vehicles/alarm_shield.wav"); - } - 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) - { - vehicle_alarm(self, CH_TRIGGER_SINGLE, "misc/null.wav"); - alarm2time = 0; - } - } - - ammo1 *= 0.01; - ammo2 *= 0.01; - - // Gunner1 bar - picsize = draw_getimagesize(hud_ammo1_bar) * autocvar_cl_vehicles_hudscale; - picloc = '450 69 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * ammo1, vid_conheight); - drawpic(hudloc + picloc, hud_ammo1_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - drawresetcliparea(); - - // Right gunner slot occupied? - if(!AuxiliaryXhair[1].draw2d) - { - shield = (picsize_x * 0.5) - (0.5 * stringwidth(_("No right gunner!"), false, '1 0 0' * picsize_y + '0 1 0' * picsize_y)); - drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL); - drawstring(hudloc + picloc + '1 0 0' * shield, _("No right gunner!"), '1 0 0' * picsize_y + '0 1 0' * picsize_y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL); - } - - // .. and icon - picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale; - picloc = '664 60 0' * autocvar_cl_vehicles_hudscale; - if(ammo1 < 0.2) - drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL); - else - drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - - // Gunner2 bar - picsize = draw_getimagesize(hud_ammo2_bar) * autocvar_cl_vehicles_hudscale; - picloc = '450 140 0' * autocvar_cl_vehicles_hudscale; - drawsetcliparea(hudloc_x + picloc_x, picloc_y, picsize_x * ammo2, vid_conheight); - drawpic(hudloc + picloc, hud_ammo2_bar, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - drawresetcliparea(); - // Left gunner slot occupied? - if(!AuxiliaryXhair[2].draw2d) - { - shield = (picsize_x * 0.5) - (0.5 * stringwidth(_("No left gunner!"), false, '1 0 0' * picsize_y + '0 1 0' * picsize_y)); - drawfill(hudloc + picloc - '0.2 0.2 0', picsize + '0.4 0.4 0', '0.25 0.25 0.25', 0.75, DRAWFLAG_NORMAL); - drawstring(hudloc + picloc + '1 0 0' * shield, _("No left gunner!"), '1 0 0' * picsize_y + '0 1 0' * picsize_y, '1 0 0' + '0 1 1' * sin(time * 10), 1, DRAWFLAG_NORMAL); - } - - // .. and icon - picsize = 1.5 * draw_getimagesize(hud_energy) * autocvar_cl_vehicles_hudscale; - picloc = '664 130 0' * autocvar_cl_vehicles_hudscale; - if(ammo2 < 0.2) - drawpic(hudloc + picloc, hud_energy, picsize, '1 0 0' + '0 1 1' * sin(time * 8), 1, DRAWFLAG_NORMAL); - else - drawpic(hudloc + picloc, hud_energy, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - - if (scoreboard_showscores) - HUD_DrawScoreboard(); - else - { - picsize = draw_getimagesize(waki_xhair); - picsize_x *= 0.5; - picsize_y *= 0.5; - drawpic('0.5 0 0' * (vid_conwidth - picsize_x) + '0 0.5 0' * (vid_conheight - picsize_y), waki_xhair, picsize, '1 1 1', 1, DRAWFLAG_NORMAL); - } + Vehicles_drawHUD("vehicle_bumble", "vehicle_bumble_weapon1", "vehicle_bumble_weapon2", + "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color, + "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color, + vCROSS_HEAL); return true; } case VR_SETUP: { - // raygun-locked - AuxiliaryXhair[0].axh_image = "gfx/vehicles/axh-bracket.tga"; - AuxiliaryXhair[0].axh_scale = 0.5; - - // Gunner1 - AuxiliaryXhair[1].axh_image = "gfx/vehicles/axh-target.tga"; - AuxiliaryXhair[1].axh_scale = 0.75; - - // Gunner2 - AuxiliaryXhair[2].axh_image = "gfx/vehicles/axh-target.tga"; - AuxiliaryXhair[2].axh_scale = 0.75; + AuxiliaryXhair[0].axh_image = vCROSS_LOCK; // Raygun-locked + AuxiliaryXhair[1].axh_image = vCROSS_BURST; // Gunner1 + AuxiliaryXhair[2].axh_image = vCROSS_BURST; // Gunner2 return true; } case VR_PRECACHE: