X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fvehicles%2Fvehicle%2Fspiderbot.qc;h=a0954b5013078f6ec3e552b5ca923efc7f20a730;hb=83093a5626b3ec25a2dc4f87b24eda2a95a8335f;hp=ccc509c6bca9f7f2c5b76933ae6d408f487c78a1;hpb=50d8efb863874f811bdcc118d7e873836902e453;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index ccc509c6b..a0954b501 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -1,7 +1,5 @@ #include "spiderbot.qh" -#ifdef IMPLEMENTATION - const int SBRM_FIRST = 1; const int SBRM_VOLLY = 1; const int SBRM_GUIDE = 2; @@ -48,7 +46,7 @@ bool spiderbot_frame(entity this, float dt) entity vehic = this.vehicle; return = true; - if(gameover) + if(game_stopped) { vehic.solid = SOLID_NOT; vehic.takedamage = DAMAGE_NO; @@ -123,9 +121,9 @@ bool spiderbot_frame(entity this, float dt) } if (!PHYS_INPUT_BUTTON_JUMP(this)) - PHYS_INPUT_BUTTON_JUMP(vehic) = false; + vehic.button2 = false; - if((IS_ONGROUND(vehic)) && PHYS_INPUT_BUTTON_JUMP(this) && !PHYS_INPUT_BUTTON_JUMP(vehic) && vehic.tur_head.wait < time) + if((IS_ONGROUND(vehic)) && PHYS_INPUT_BUTTON_JUMP(this) && !vehic.button2 && vehic.tur_head.wait < time) { sound (vehic, CH_TRIGGER_SINGLE, SND_VEH_SPIDERBOT_JUMP, VOL_VEHICLEENGINE, ATTEN_NORM); //dprint("spiderbot_jump:", ftos(soundlength("vehicles/spiderbot_jump.wav")), "\n"); @@ -133,14 +131,14 @@ bool spiderbot_frame(entity this, float dt) vehic.tur_head.wait = time + 2; vehic.jump_delay = time + 2; - PHYS_INPUT_BUTTON_JUMP(vehic) = true; // set spider's jump + vehic.button2 = true; // set spider's jump //PHYS_INPUT_BUTTON_JUMP(this) = false; vector movefix = '0 0 0'; - if(this.movement_x > 0) movefix_x = 1; - if(this.movement_x < 0) movefix_x = -1; - if(this.movement_y > 0) movefix_y = 1; - if(this.movement_y < 0) movefix_y = -1; + if(CS(this).movement_x > 0) movefix_x = 1; + if(CS(this).movement_x < 0) movefix_x = -1; + if(CS(this).movement_y > 0) movefix_y = 1; + if(CS(this).movement_y < 0) movefix_y = -1; vector rt = movefix_y * v_right; vector sd = movefix_x * v_forward; @@ -154,7 +152,7 @@ bool spiderbot_frame(entity this, float dt) } else if(time >= vehic.jump_delay) { - if(!this.movement) + if(!CS(this).movement) { if(IS_ONGROUND(vehic)) { @@ -172,7 +170,7 @@ bool spiderbot_frame(entity this, float dt) else { // Turn Body - if(this.movement_x == 0 && this.movement_y != 0) + if(CS(this).movement_x == 0 && CS(this).movement_y != 0) ftmp = autocvar_g_vehicle_spiderbot_turnspeed_strafe * PHYS_INPUT_FRAMETIME; else ftmp = autocvar_g_vehicle_spiderbot_turnspeed * PHYS_INPUT_FRAMETIME; @@ -181,23 +179,23 @@ bool spiderbot_frame(entity this, float dt) vehic.angles_y = anglemods(vehic.angles_y + ftmp); vehic.tur_head.angles_y -= ftmp; - if(this.movement_x != 0) + if(CS(this).movement_x != 0) { - if(this.movement_x > 0) + if(CS(this).movement_x > 0) { - this.movement_x = 1; + CS(this).movement_x = 1; if(IS_ONGROUND(vehic)) vehic.frame = 0; } - else if(this.movement_x < 0) + else if(CS(this).movement_x < 0) { - this.movement_x = -1; + CS(this).movement_x = -1; if(IS_ONGROUND(vehic)) vehic.frame = 1; } - this.movement_y = 0; + CS(this).movement_y = 0; float oldvelz = vehic.velocity_z; - movelib_move_simple(vehic, normalize(v_forward * this.movement_x),((PHYS_INPUT_BUTTON_JUMP(this)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia); + movelib_move_simple(vehic, normalize(v_forward * CS(this).movement_x),((PHYS_INPUT_BUTTON_JUMP(this)) ? autocvar_g_vehicle_spiderbot_speed_run : autocvar_g_vehicle_spiderbot_speed_walk),autocvar_g_vehicle_spiderbot_movement_inertia); vehic.velocity_z = oldvelz; float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1); if(vehic.velocity_z <= 20) // not while jumping @@ -211,23 +209,23 @@ bool spiderbot_frame(entity this, float dt) //dprint("spiderbot_walk:", ftos(soundlength("vehicles/spiderbot_walk.wav")), "\n"); } } - else if(this.movement_y != 0) + else if(CS(this).movement_y != 0) { - if(this.movement_y < 0) + if(CS(this).movement_y < 0) { - this.movement_y = -1; + CS(this).movement_y = -1; if(IS_ONGROUND(vehic)) vehic.frame = 2; } - else if(this.movement_y > 0) + else if(CS(this).movement_y > 0) { - this.movement_y = 1; + CS(this).movement_y = 1; if(IS_ONGROUND(vehic)) vehic.frame = 3; } float oldvelz = vehic.velocity_z; - movelib_move_simple(vehic, normalize(v_right * this.movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia); + movelib_move_simple(vehic, normalize(v_right * CS(this).movement_y),autocvar_g_vehicle_spiderbot_speed_strafe,autocvar_g_vehicle_spiderbot_movement_inertia); vehic.velocity_z = oldvelz; float g = ((autocvar_sv_gameplayfix_gravityunaffectedbyticrate) ? 0.5 : 1); if(vehic.velocity_z <= 20) // not while jumping @@ -308,6 +306,7 @@ bool spiderbot_frame(entity this, float dt) this.vehicle_reload2 = 100 - ((vehic.gun2.cnt - time) / vehic.attack_finished_single[0]) * 100; setorigin(this, vehic.origin + '0 0 1' * vehic.maxs_z); + this.oldorigin = this.origin; // negate fall damage this.velocity = vehic.velocity; VEHICLE_UPDATE_PLAYER(this, vehic, health, spiderbot); @@ -318,11 +317,11 @@ bool spiderbot_frame(entity this, float dt) void spiderbot_exit(entity this, int eject) { - vector spot; + entity player = this.owner; - IL_EACH(g_projectiles, it.owner == this.owner && it.classname == "spiderbot_rocket", + IL_EACH(g_projectiles, it.owner == player && it.classname == "spiderbot_rocket", { - it.realowner = this.owner; + it.realowner = player; it.owner = NULL; }); @@ -331,39 +330,43 @@ void spiderbot_exit(entity this, int eject) this.frame = 5; set_movetype(this, MOVETYPE_WALK); - if(!this.owner) + if(!player) + { + this.owner = NULL; // reset owner anyway? return; + } makevectors(this.angles); + vector spot; if(eject) { spot = this.origin + v_forward * 100 + '0 0 64'; - spot = vehicles_findgoodexit(this, spot); - setorigin(this.owner , spot); - this.owner.velocity = (v_up + v_forward * 0.25) * 750; - this.owner.oldvelocity = this.owner.velocity; + spot = vehicles_findgoodexit(this, player, spot); + setorigin(player, spot); + player.velocity = (v_up + v_forward * 0.25) * 750; + player.oldvelocity = player.velocity; } else { if(vdist(this.velocity, >, autocvar_g_vehicle_spiderbot_speed_strafe)) { - this.owner.velocity = normalize(this.velocity) * vlen(this.velocity); - this.owner.velocity_z += 200; + player.velocity = normalize(this.velocity) * vlen(this.velocity); + player.velocity_z += 200; spot = this.origin + v_forward * 128 + '0 0 64'; - spot = vehicles_findgoodexit(this, spot); + spot = vehicles_findgoodexit(this, player, spot); } else { - this.owner.velocity = this.velocity * 0.5; - this.owner.velocity_z += 10; + player.velocity = this.velocity * 0.5; + player.velocity_z += 10; spot = this.origin + v_forward * 256 + '0 0 64'; - spot = vehicles_findgoodexit(this, spot); + spot = vehicles_findgoodexit(this, player, spot); } - this.owner.oldvelocity = this.owner.velocity; - setorigin(this.owner , spot); + player.oldvelocity = player.velocity; + setorigin(player, spot); } - antilag_clear(this.owner, CS(this.owner)); + antilag_clear(player, CS(player)); this.owner = NULL; } @@ -397,11 +400,7 @@ void spiderbot_blowup(entity this) return; } - entity h, g1, g2, b; - b = spawn(); - h = spawn(); - g1 = spawn(); - g2 = spawn(); + entity h = spawn(), g1 = spawn(), g2 = spawn(), b = spawn(); setmodel(b, MDL_VEH_SPIDERBOT_BODY); setmodel(h, MDL_VEH_SPIDERBOT_TOP); @@ -450,7 +449,7 @@ void spiderbot_blowup(entity this) SUB_SetFade(g1, time, min(this.respawntime, 10)); SUB_SetFade(g2, time, min(this.respawntime, 10)); - RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_SPID_DEATH.m_id, NULL); + RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_SPID_DEATH.m_id, DMG_NOWEP, NULL); this.alpha = this.tur_head.alpha = this.gun1.alpha = this.gun2.alpha = -1; set_movetype(this, MOVETYPE_NONE); @@ -638,4 +637,3 @@ METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance)) } #endif -#endif