X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fvehicles%2Fspiderbot.qc;h=d51775787be8e85888a7ece1f9da185b4d278305;hb=6c4f62990980e74d4a0963b7179c7c964f535398;hp=bdbcb828870829577254ea87fe569ad792acd51a;hpb=0ab7132eba1a94b5ec19efe5a3f5f63071ed80ff;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/vehicles/spiderbot.qc b/qcsrc/server/vehicles/spiderbot.qc index bdbcb8288..d51775787 100644 --- a/qcsrc/server/vehicles/spiderbot.qc +++ b/qcsrc/server/vehicles/spiderbot.qc @@ -43,8 +43,7 @@ float autocvar_g_vehicle_spiderbot_minigun_ammo_max; float autocvar_g_vehicle_spiderbot_minigun_ammo_regen; float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause; float autocvar_g_vehicle_spiderbot_minigun_force; -float autocvar_g_vehicle_spiderbot_minigun_speed; -float autocvar_g_vehicle_spiderbot_minigun_bulletconstant; +float autocvar_g_vehicle_spiderbot_minigun_solidpenetration; float autocvar_g_vehicle_spiderbot_rocket_damage; float autocvar_g_vehicle_spiderbot_rocket_force; @@ -59,17 +58,22 @@ float autocvar_g_vehicle_spiderbot_rocket_noise; float autocvar_g_vehicle_spiderbot_rocket_turnrate; float autocvar_g_vehicle_spiderbot_rocket_lifetime; +float autocvar_g_vehicle_spiderbot_blowup_radius; +float autocvar_g_vehicle_spiderbot_blowup_coredamage; +float autocvar_g_vehicle_spiderbot_blowup_edgedamage; +float autocvar_g_vehicle_spiderbot_blowup_forceintensity; + vector autocvar_g_vehicle_spiderbot_bouncepain; void spiderbot_exit(float eject); void spiderbot_enter(); void spiderbot_spawn(float); -#define SBRM_FIRST 0 -#define SBRM_VOLLY 0 -#define SBRM_GUIDE 1 -#define SBRM_ARTILLERY 2 -#define SBRM_LAST 2 +const float SBRM_FIRST = 0; +const float SBRM_VOLLY = 0; +const float SBRM_GUIDE = 1; +const float SBRM_ARTILLERY = 2; +const float SBRM_LAST = 2; void spiderbot_rocket_artillery() { @@ -139,7 +143,7 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht) vector sdir; grav = autocvar_sv_gravity; - zdist = tgt_z - org_z; + zdist = tgt.z - org.z; sdist = vlen(tgt - org - zdist * '0 0 1'); sdir = normalize(tgt - org - zdist * '0 0 1'); @@ -159,10 +163,10 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht) vector solution; solution = solve_quadratic(0.5 * grav, -vz, zdist); // equation "z(ti) = zdist" // ALWAYS solvable because jumpheight >= zdist - if(!solution_z) - solution_y = solution_x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0) + if(!solution.z) + solution_y = solution.x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0) if(zdist == 0) - solution_x = solution_y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually) + solution_x = solution.y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually) if(zdist < 0) { @@ -172,14 +176,14 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht) // almost straight line type // jump apex is before the jump // we must take the larger one - spiberbot_calcartillery_flighttime = solution_y; + spiberbot_calcartillery_flighttime = solution.y; } else { // regular jump // jump apex is during the jump // we must take the larger one too - spiberbot_calcartillery_flighttime = solution_y; + spiberbot_calcartillery_flighttime = solution.y; } } else @@ -190,14 +194,14 @@ vector spiberbot_calcartillery(vector org, vector tgt, float ht) // almost straight line type // jump apex is after the jump // we must take the smaller one - spiberbot_calcartillery_flighttime = solution_x; + spiberbot_calcartillery_flighttime = solution.x; } else { // regular jump // jump apex is during the jump // we must take the larger one - spiberbot_calcartillery_flighttime = solution_y; + spiberbot_calcartillery_flighttime = solution.y; } } vs = sdist / spiberbot_calcartillery_flighttime; @@ -288,7 +292,7 @@ void spiderbot_rocket_do() crosshair_trace(self.owner); rocket.pos1 = trace_endpos + randomvec() * (0.75 * autocvar_g_vehicle_spiderbot_rocket_radius); - rocket.pos1_z = trace_endpos_z; + rocket.pos1_z = trace_endpos.z; traceline(v, v + '0 0 1' * MAX_SHOT_DISTANCE, MOVE_WORLDONLY, self); float h1 = 0.75 * vlen(v - trace_endpos); @@ -370,16 +374,16 @@ float spiderbot_frame() // Rotate head ftmp = autocvar_g_vehicle_spiderbot_head_turnspeed * sys_frametime; - ad_y = bound(-ftmp, ad_y, ftmp); - spider.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, spider.tur_head.angles_y + ad_y, autocvar_g_vehicle_spiderbot_head_turnlimit); + ad_y = bound(-ftmp, ad.y, ftmp); + spider.tur_head.angles_y = bound(autocvar_g_vehicle_spiderbot_head_turnlimit * -1, spider.tur_head.angles.y + ad.y, autocvar_g_vehicle_spiderbot_head_turnlimit); // Pitch head - ad_x = bound(ftmp * -1, ad_x, ftmp); - spider.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, spider.tur_head.angles_x + ad_x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up); + ad_x = bound(ftmp * -1, ad.x, ftmp); + spider.tur_head.angles_x = bound(autocvar_g_vehicle_spiderbot_head_pitchlimit_down, spider.tur_head.angles.x + ad.x, autocvar_g_vehicle_spiderbot_head_pitchlimit_up); //fixedmakevectors(spider.angles); - makevectors(spider.angles + '-2 0 0' * spider.angles_x); + makevectors(spider.angles + '-2 0 0' * spider.angles.x); movelib_groundalign4point(autocvar_g_vehicle_spiderbot_springlength, autocvar_g_vehicle_spiderbot_springup, autocvar_g_vehicle_spiderbot_springblend, autocvar_g_vehicle_spiderbot_tiltlimit); @@ -419,29 +423,29 @@ float spiderbot_frame() else { // Turn Body - if(player.movement_x == 0 && player.movement_y != 0) + if(player.movement_x == 0 && player.movement.y != 0) ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * sys_frametime; else ftmp = autocvar_g_vehicle_spiderbot_turnspeed * sys_frametime; - ftmp = bound(-ftmp, spider.tur_head.angles_y, ftmp); - spider.angles_y = anglemods(spider.angles_y + ftmp); + ftmp = bound(-ftmp, spider.tur_head.angles.y, ftmp); + spider.angles_y = anglemods(spider.angles.y + ftmp); spider.tur_head.angles_y -= ftmp; - if(player.movement_x != 0) + if(player.movement.x != 0) { - if(player.movement_x > 0) + if(player.movement.x > 0) { player.movement_x = 1; spider.frame = 0; } - else if(player.movement_x < 0) + else if(player.movement.x < 0) { player.movement_x = -1; spider.frame = 1; } 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); + 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) { @@ -451,19 +455,19 @@ float spiderbot_frame() //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n"); } } - else if(player.movement_y != 0) + else if(player.movement.y != 0) { - if(player.movement_y < 0) + if(player.movement.y < 0) { player.movement_y = -1; spider.frame = 2; } - else if(player.movement_y > 0) + else if(player.movement.y > 0) { player.movement_y = 1; spider.frame = 3; } - movelib_move_simple(normalize(v_right * player.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia); + 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; @@ -476,8 +480,8 @@ float spiderbot_frame() } } - self.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_x, autocvar_g_vehicle_spiderbot_tiltlimit); - self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles_z, autocvar_g_vehicle_spiderbot_tiltlimit); + self.angles_x = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles.x, autocvar_g_vehicle_spiderbot_tiltlimit); + self.angles_z = bound(-autocvar_g_vehicle_spiderbot_tiltlimit, self.angles.z, autocvar_g_vehicle_spiderbot_tiltlimit); if(player.BUTTON_ATCK) { @@ -490,17 +494,13 @@ float spiderbot_frame() self = player; - mod(spider.misc_bulletcounter, 2) ? gun = spider.gun1 : gun = spider.gun2; + (spider.misc_bulletcounter % 2) ? gun = spider.gun1 : gun = spider.gun2; v = gettaginfo(gun, gettagindex(gun, "barrels")); v_forward = normalize(v_forward); v += v_forward * 50; -//void fireBallisticBullet(vector start, vector dir, float spread, float pSpeed, float lifetime, float damage, float force, float dtype, float tracereffects, float bulletconstant) - - fireBallisticBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_speed, - 5, autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN, 0, autocvar_g_vehicle_spiderbot_minigun_bulletconstant); - - endFireBallisticBullet(); + fireBullet(v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_solidpenetration, + autocvar_g_vehicle_spiderbot_minigun_damage, autocvar_g_vehicle_spiderbot_minigun_force, DEATH_VH_SPID_MINIGUN, 0); // fireBullet (v, v_forward, autocvar_g_vehicle_spiderbot_minigun_spread, autocvar_g_vehicle_spiderbot_minigun_damage, // autocvar_g_vehicle_spiderbot_minigun_spread, DEATH_VH_SPID_MINIGUN, 0); @@ -516,7 +516,7 @@ float spiderbot_frame() player.vehicle_ammo1 = (spider.vehicle_ammo1 / autocvar_g_vehicle_spiderbot_minigun_ammo_max) * 100; spider.gun1.angles_z += 45; spider.gun2.angles_z -= 45; - if(spider.gun1.angles_z >= 360) + if(spider.gun1.angles.z >= 360) { spider.gun1.angles_z = 0; spider.gun2.angles_z = 0; @@ -639,8 +639,8 @@ void spiderbot_exit(float eject) void spider_impact() { - if(autocvar_g_vehicle_spiderbot_bouncepain_x) - vehilces_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z); + if(autocvar_g_vehicle_spiderbot_bouncepain.x) + vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain.x, autocvar_g_vehicle_spiderbot_bouncepain.y, autocvar_g_vehicle_spiderbot_bouncepain.z); } void spiderbot_headfade() @@ -723,14 +723,18 @@ void spiderbot_blowup() SUB_SetFade(g1, time, min(autocvar_g_vehicle_spiderbot_respawntime, 10)); SUB_SetFade(g2, time, min(autocvar_g_vehicle_spiderbot_respawntime, 10)); - RadiusDamage (self, self.enemy, 250, 15, 250, world, 250, DEATH_VH_SPID_DEATH, world); + RadiusDamage(self, self.enemy, autocvar_g_vehicle_spiderbot_blowup_coredamage, + autocvar_g_vehicle_spiderbot_blowup_edgedamage, + autocvar_g_vehicle_spiderbot_blowup_radius, world, world, + autocvar_g_vehicle_spiderbot_blowup_forceintensity, DEATH_VH_SPID_DEATH, world); self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = -1; self.movetype = MOVETYPE_NONE; self.deadflag = DEAD_DEAD; self.solid = SOLID_NOT; self.tur_head.effects &= ~EF_FLAME; - self.vehicle_hudmodel.viewmodelforclient = self; + self.vehicle_hudmodel.viewmodelforclient = self; + setorigin(self, self.pos1); } void spiderbot_die() @@ -789,7 +793,7 @@ void spiderbot_spawn(float _f) { if(!self.gun1) { - self.vehicles_impusle = spiderbot_impulse; + self.vehicles_impulse = spiderbot_impulse; self.gun1 = spawn(); self.gun2 = spawn(); setmodel(self.gun1, "models/vehicles/spiderbot_barrels.dpm");