X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fvehicles%2Fvehicle%2Fraptor.qc;h=838376e5160af34619e5e41347e70ecaed924161;hb=45d8904a100765555e622598a39967963733df1d;hp=eb64943c8e737b677d5f1511699522d0491666cb;hpb=e556c9445f29cc9b1bc05884cb44001220225270;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index eb64943c8..6e9144168 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -1,32 +1,5 @@ -#ifndef VEHICLE_RAPTOR -#define VEHICLE_RAPTOR #include "raptor.qh" -#include "raptor_weapons.qh" - -CLASS(Raptor, Vehicle) -/* spawnflags */ ATTRIB(Raptor, spawnflags, int, VHF_DMGSHAKE | VHF_DMGROLL); -/* mins */ ATTRIB(Raptor, mins, vector, '-80 -80 0'); -/* maxs */ ATTRIB(Raptor, maxs, vector, '80 80 70'); -/* view offset*/ ATTRIB(Raptor, view_ofs, vector, '0 0 160'); -/* view dist */ ATTRIB(Raptor, height, float, 200); -/* model */ ATTRIB(Raptor, mdl, string, "models/vehicles/raptor.dpm"); -/* model */ ATTRIB(Raptor, model, string, "models/vehicles/raptor.dpm"); -/* head_model */ ATTRIB(Raptor, head_model, string, ""); -/* hud_model */ ATTRIB(Raptor, hud_model, string, "models/vehicles/raptor_cockpit.dpm"); -/* tags */ ATTRIB(Raptor, tag_head, string, ""); -/* tags */ ATTRIB(Raptor, tag_hud, string, "tag_hud"); -/* tags */ ATTRIB(Raptor, tag_view, string, "tag_camera"); -/* netname */ ATTRIB(Raptor, netname, string, "raptor"); -/* fullname */ ATTRIB(Raptor, vehicle_name, string, _("Raptor")); -/* icon */ ATTRIB(Raptor, m_icon, string, "vehicle_raptor"); -ENDCLASS(Raptor) -REGISTER_VEHICLE(RAPTOR, NEW(Raptor)); - -#endif - -#ifdef IMPLEMENTATION - #ifdef SVQC bool autocvar_g_vehicle_raptor = true; @@ -42,9 +15,9 @@ float autocvar_g_vehicle_raptor_pitchspeed = 50; float autocvar_g_vehicle_raptor_pitchlimit = 45; float autocvar_g_vehicle_raptor_speed_forward = 1700; -float autocvar_g_vehicle_raptor_speed_strafe = 900; -float autocvar_g_vehicle_raptor_speed_up = 1700; -float autocvar_g_vehicle_raptor_speed_down = 1700; +float autocvar_g_vehicle_raptor_speed_strafe = 2200; +float autocvar_g_vehicle_raptor_speed_up = 2300; +float autocvar_g_vehicle_raptor_speed_down = 2000; float autocvar_g_vehicle_raptor_friction = 2; bool autocvar_g_vehicle_raptor_swim = false; @@ -54,7 +27,7 @@ float autocvar_g_vehicle_raptor_cannon_turnlimit = 20; float autocvar_g_vehicle_raptor_cannon_pitchlimit_up = 12; float autocvar_g_vehicle_raptor_cannon_pitchlimit_down = 32; -float autocvar_g_vehicle_raptor_cannon_locktarget = 0; +bool autocvar_g_vehicle_raptor_cannon_locktarget = true; float autocvar_g_vehicle_raptor_cannon_locking_time = 0.2; float autocvar_g_vehicle_raptor_cannon_locking_releasetime = 0.45; float autocvar_g_vehicle_raptor_cannon_locked_time = 1; @@ -64,11 +37,11 @@ float autocvar_g_vehicle_raptor_energy = 100; float autocvar_g_vehicle_raptor_energy_regen = 25; float autocvar_g_vehicle_raptor_energy_regen_pause = 0.25; -float autocvar_g_vehicle_raptor_health = 150; +float autocvar_g_vehicle_raptor_health = 250; float autocvar_g_vehicle_raptor_health_regen = 0; float autocvar_g_vehicle_raptor_health_regen_pause = 0; -float autocvar_g_vehicle_raptor_shield = 75; +float autocvar_g_vehicle_raptor_shield = 200; float autocvar_g_vehicle_raptor_shield_regen = 25; float autocvar_g_vehicle_raptor_shield_regen_pause = 1.5; @@ -84,7 +57,7 @@ void raptor_land(entity this) float hgt; hgt = vehicle_altitude(this, 512); - this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime); + this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * PHYS_INPUT_FRAMETIME); this.angles_x *= 0.95; this.angles_z *= 0.95; @@ -96,7 +69,7 @@ void raptor_land(entity this) if(hgt < 16) { - this.movetype = MOVETYPE_TOSS; + set_movetype(this, MOVETYPE_TOSS); setthink(this, vehicles_think); this.frame = 0; } @@ -108,6 +81,8 @@ void raptor_land(entity this) void raptor_exit(entity this, int eject) { + entity player = this.owner; + this.tur_head.exteriormodeltoclient = NULL; if(!IS_DEAD(this)) @@ -116,7 +91,7 @@ void raptor_exit(entity this, int eject) this.nextthink = time; } - if(!this.owner) + if(!player) return; makevectors(this.angles); @@ -124,44 +99,45 @@ void raptor_exit(entity this, int eject) 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, >, 2 * autocvar_sv_maxairspeed)) { - this.owner.velocity = normalize(this.velocity) * autocvar_sv_maxairspeed * 2; - this.owner.velocity_z += 200; + player.velocity = normalize(this.velocity) * autocvar_sv_maxairspeed * 2; + player.velocity_z += 200; spot = this.origin + v_forward * 32 + '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 * 200 + '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)); this.owner = NULL; + antilag_clear(player, CS(player)); } -bool raptor_frame(entity this) +bool raptor_frame(entity this, float dt) { entity vehic = this.vehicle; return = true; - if(intermission_running) + if(game_stopped) { - vehic.velocity = '0 0 0'; - vehic.avelocity = '0 0 0'; + vehic.solid = SOLID_NOT; + vehic.takedamage = DAMAGE_NO; + set_movetype(vehic, MOVETYPE_NONE); return; } @@ -226,8 +202,8 @@ bool raptor_frame(entity this) // Pitch ftmp = 0; - if(this.movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5; - else if(this.movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20; + if(CS(this).movement_x > 0 && vang_x < autocvar_g_vehicle_raptor_pitchlimit) ftmp = 5; + else if(CS(this).movement_x < 0 && vang_x > -autocvar_g_vehicle_raptor_pitchlimit) ftmp = -20; df_x = bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x , autocvar_g_vehicle_raptor_pitchlimit); ftmp = vang_x - bound(-autocvar_g_vehicle_raptor_pitchlimit, df_x + ftmp, autocvar_g_vehicle_raptor_pitchlimit); @@ -244,22 +220,22 @@ bool raptor_frame(entity this) df = vehic.velocity * -autocvar_g_vehicle_raptor_friction; - if(this.movement_x != 0) + if(CS(this).movement_x != 0) { - if(this.movement_x > 0) + if(CS(this).movement_x > 0) df += v_forward * autocvar_g_vehicle_raptor_speed_forward; - else if(this.movement_x < 0) + else if(CS(this).movement_x < 0) df -= v_forward * autocvar_g_vehicle_raptor_speed_forward; } - if(this.movement_y != 0) + if(CS(this).movement_y != 0) { - if(this.movement_y < 0) + if(CS(this).movement_y < 0) df -= v_right * autocvar_g_vehicle_raptor_speed_strafe; - else if(this.movement_y > 0) + else if(CS(this).movement_y > 0) df += v_right * autocvar_g_vehicle_raptor_speed_strafe; - vehic.angles_z = bound(-30,vehic.angles_z + (this.movement_y / autocvar_g_vehicle_raptor_speed_strafe),30); + vehic.angles_z = bound(-30,vehic.angles_z + (CS(this).movement_y / autocvar_g_vehicle_raptor_speed_strafe),30); } else { @@ -273,11 +249,12 @@ bool raptor_frame(entity this) else if (PHYS_INPUT_BUTTON_JUMP(this)) df += v_up * autocvar_g_vehicle_raptor_speed_up; - vehic.velocity += df * frametime; - this.velocity = this.movement = vehic.velocity; + vehic.velocity += df * dt; + this.velocity = CS(this).movement = vehic.velocity; setorigin(this, vehic.origin + '0 0 32'); + this.oldorigin = this.origin; // negate fall damage - this.vehicle_weapon2mode = vehic.vehicle_weapon2mode; + STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic); vector vf, ad; // Target lock & predict @@ -287,7 +264,7 @@ bool raptor_frame(entity this) vehic.gun1.enemy = NULL; if(trace_ent) - if(trace_ent.movetype) + if(trace_ent.move_movetype) if(trace_ent.takedamage) if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent)) { @@ -313,7 +290,7 @@ bool raptor_frame(entity this) vf = real_origin(vehic.gun1.enemy); UpdateAuxiliaryXhair(this, vf, '1 0 0', 1); vector _vel = vehic.gun1.enemy.velocity; - if(vehic.gun1.enemy.movetype == MOVETYPE_WALK) + if(vehic.gun1.enemy.move_movetype == MOVETYPE_WALK) _vel_z *= 0.1; if(autocvar_g_vehicle_raptor_cannon_predicttarget) @@ -331,8 +308,8 @@ bool raptor_frame(entity this) else if(autocvar_g_vehicle_raptor_cannon_locktarget == 1) { - vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * frametime, - (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * frametime, + vehicles_locktarget(vehic, (1 / autocvar_g_vehicle_raptor_cannon_locking_time) * dt, + (1 / autocvar_g_vehicle_raptor_cannon_locking_releasetime) * dt, autocvar_g_vehicle_raptor_cannon_locked_time); if(vehic.lock_target != NULL) @@ -366,40 +343,40 @@ bool raptor_frame(entity this) vehicle_aimturret(vehic, trace_endpos, vehic.gun1, "fire1", autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up, - autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed); + autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed, dt); vehicle_aimturret(vehic, trace_endpos, vehic.gun2, "fire1", autocvar_g_vehicle_raptor_cannon_pitchlimit_down * -1, autocvar_g_vehicle_raptor_cannon_pitchlimit_up, - autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed); + autocvar_g_vehicle_raptor_cannon_turnlimit * -1, autocvar_g_vehicle_raptor_cannon_turnlimit, autocvar_g_vehicle_raptor_cannon_turnspeed, dt); /* ad = ad * 0.5; v_forward = vf * 0.5; - traceline(ad, ad + v_forward * MAX_SHOT_DISTANCE, MOVE_NORMAL, vehic); + traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, vehic); UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0); */ Weapon wep1 = WEP_RAPTOR; - if(!forbidWeaponUse(this)) + .entity weaponentity = weaponentities[0]; + if(!weaponLocked(this)) if(PHYS_INPUT_BUTTON_ATCK(this)) - if (wep1.wr_checkammo1(wep1, vehic)) + if (wep1.wr_checkammo1(wep1, vehic, weaponentity)) { - .entity weaponentity = weaponentities[0]; wep1.wr_think(wep1, vehic, weaponentity, 1); } if(vehic.vehicle_flags & VHF_SHIELDREGEN) - vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, true); + vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, dt, true); if(vehic.vehicle_flags & VHF_HEALTHREGEN) - vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, false); + vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt, false, RES_HEALTH); if(vehic.vehicle_flags & VHF_ENERGYREGEN) - vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, false); + vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, dt, false); Weapon wep2a = WEP_RAPTOR_BOMB; - if(!forbidWeaponUse(this)) - if(vehic.vehicle_weapon2mode == RSM_BOMB) + if(!weaponLocked(this)) + if(STAT(VEHICLESTAT_W2MODE, vehic) == RSM_BOMB) { if(time > vehic.lip + autocvar_g_vehicle_raptor_bombs_refire) if(PHYS_INPUT_BUTTON_ATCK2(this)) @@ -430,9 +407,8 @@ bool raptor_frame(entity this) if(vehic.bomb1.cnt < time) { bool incoming = false; - FOREACH_ENTITY_ENT(enemy, vehic, + IL_EACH(g_projectiles, it.enemy == vehic, { - if(it.flags & FL_PROJECTILE) if(MISSILE_IS_TRACKING(it)) if(vdist(vehic.origin - it.origin, <, 2 * autocvar_g_vehicle_raptor_flare_range)) { @@ -451,7 +427,7 @@ bool raptor_frame(entity this) } - VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor); + VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, raptor, RES_HEALTH); VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor); if(vehic.vehicle_flags & VHF_HASSHIELD) VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor); @@ -459,7 +435,7 @@ bool raptor_frame(entity this) PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false; } -bool raptor_takeoff(entity this) +bool raptor_takeoff(entity this, float dt) { entity vehic = this.vehicle; return = true; @@ -477,32 +453,35 @@ bool raptor_takeoff(entity this) // Takeoff sequense if(vehic.frame < 25) { - vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / sys_frametime); + vehic.frame += 25 / (autocvar_g_vehicle_raptor_takeofftime / PHYS_INPUT_FRAMETIME); vehic.velocity_z = min(vehic.velocity_z * 1.5, 256); vehic.bomb1.gun1.avelocity_y = 90 + ((vehic.frame / 25) * 25000); vehic.bomb1.gun2.avelocity_y = -vehic.bomb1.gun1.avelocity_y; PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false; setorigin(this, vehic.origin + '0 0 32'); + this.oldorigin = this.origin; } else this.PlayerPhysplug = raptor_frame; + STAT(VEHICLESTAT_W2MODE, this) = STAT(VEHICLESTAT_W2MODE, vehic); + if(vehic.vehicle_flags & VHF_SHIELDREGEN) - vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, frametime, true); + vehicles_regen(vehic, vehic.dmg_time, vehicle_shield, autocvar_g_vehicle_raptor_shield, autocvar_g_vehicle_raptor_shield_regen_pause, autocvar_g_vehicle_raptor_shield_regen, dt, true); if(vehic.vehicle_flags & VHF_HEALTHREGEN) - vehicles_regen(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, frametime, false); + vehicles_regen_resource(vehic, vehic.dmg_time, vehicle_health, autocvar_g_vehicle_raptor_health, autocvar_g_vehicle_raptor_health_regen_pause, autocvar_g_vehicle_raptor_health_regen, dt, false, RES_HEALTH); if(vehic.vehicle_flags & VHF_ENERGYREGEN) - vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, frametime, false); + vehicles_regen(vehic, vehic.cnt, vehicle_energy, autocvar_g_vehicle_raptor_energy, autocvar_g_vehicle_raptor_energy_regen_pause, autocvar_g_vehicle_raptor_energy_regen, dt, false); vehic.bomb1.alpha = vehic.bomb2.alpha = (time - vehic.lip) / (vehic.delay - vehic.lip); this.vehicle_reload2 = bound(0, vehic.bomb1.alpha * 100, 100); this.vehicle_ammo2 = (this.vehicle_reload2 == 100) ? 100 : 0; - VEHICLE_UPDATE_PLAYER(this, vehic, health, raptor); + VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, raptor, RES_HEALTH); VEHICLE_UPDATE_PLAYER(this, vehic, energy, raptor); if(vehic.vehicle_flags & VHF_HASSHIELD) VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor); @@ -514,10 +493,10 @@ void raptor_blowup(entity this, entity toucher) { this.deadflag = DEAD_DEAD; this.vehicle_exit(this, VHEF_NORMAL); - RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, NULL); + RadiusDamage (this, this.enemy, 250, 15, 250, NULL, NULL, 250, DEATH_VH_RAPT_DEATH.m_id, DMG_NOWEP, NULL); this.alpha = -1; - this.movetype = MOVETYPE_NONE; + set_movetype(this, MOVETYPE_NONE); this.effects = EF_NODRAW; this.colormod = '0 0 0'; this.avelocity = '0 0 0'; @@ -560,20 +539,20 @@ bool raptor_impulse(entity this, int _imp) switch(_imp) { case IMP_weapon_group_1.impulse: - this.vehicle.vehicle_weapon2mode = RSM_BOMB; + STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_BOMB; CSQCVehicleSetup(this, 0); return true; case IMP_weapon_group_2.impulse: - this.vehicle.vehicle_weapon2mode = RSM_FLARE; + STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_FLARE; CSQCVehicleSetup(this, 0); return true; case IMP_weapon_next_byid.impulse: case IMP_weapon_next_bypriority.impulse: case IMP_weapon_next_bygroup.impulse: - this.vehicle.vehicle_weapon2mode += 1; - if(this.vehicle.vehicle_weapon2mode > RSM_LAST) - this.vehicle.vehicle_weapon2mode = RSM_FIRST; + STAT(VEHICLESTAT_W2MODE, this.vehicle) += 1; + if(STAT(VEHICLESTAT_W2MODE, this.vehicle) > RSM_LAST) + STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_FIRST; CSQCVehicleSetup(this, 0); return true; @@ -581,9 +560,9 @@ bool raptor_impulse(entity this, int _imp) case IMP_weapon_prev_byid.impulse: case IMP_weapon_prev_bypriority.impulse: case IMP_weapon_prev_bygroup.impulse: - this.vehicle.vehicle_weapon2mode -= 1; - if(this.vehicle.vehicle_weapon2mode < RSM_FIRST) - this.vehicle.vehicle_weapon2mode = RSM_LAST; + STAT(VEHICLESTAT_W2MODE, this.vehicle) -= 1; + if(STAT(VEHICLESTAT_W2MODE, this.vehicle) < RSM_FIRST) + STAT(VEHICLESTAT_W2MODE, this.vehicle) = RSM_LAST; CSQCVehicleSetup(this, 0); return true; @@ -600,8 +579,8 @@ bool raptor_impulse(entity this, int _imp) spawnfunc(vehicle_raptor) { - if(!autocvar_g_vehicle_raptor) { remove(this); return; } - if(!vehicle_initialize(this, VEH_RAPTOR, false)) { remove(this); return; } + if(!autocvar_g_vehicle_raptor) { delete(this); return; } + if(!vehicle_initialize(this, VEH_RAPTOR, false)) { delete(this); return; } } METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance)) @@ -611,11 +590,11 @@ METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance)) } METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance)) { - instance.vehicle_weapon2mode = RSM_BOMB; + STAT(VEHICLESTAT_W2MODE, instance) = RSM_BOMB; instance.owner.PlayerPhysplug = raptor_takeoff; - instance.movetype = MOVETYPE_BOUNCEMISSILE; + set_movetype(instance, MOVETYPE_BOUNCEMISSILE); instance.solid = SOLID_SLIDEBOX; - instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_raptor_health) * 100; + instance.owner.vehicle_health = (GetResource(instance, RES_HEALTH) / autocvar_g_vehicle_raptor_health) * 100; instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100; instance.velocity = '0 0 1'; // nudge upwards so takeoff sequence can work instance.tur_head.exteriormodeltoclient = instance.owner; @@ -630,12 +609,12 @@ METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance)) } METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance)) { - instance.health = 0; + SetResourceExplicit(instance, RES_HEALTH, 0); instance.event_damage = func_null; instance.solid = SOLID_CORPSE; instance.takedamage = DAMAGE_NO; instance.deadflag = DEAD_DYING; - instance.movetype = MOVETYPE_BOUNCE; + set_movetype(instance, MOVETYPE_BOUNCE); setthink(instance, raptor_diethink); instance.nextthink = time; instance.wait = time + 5 + (random() * 5); @@ -702,7 +681,7 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance)) spinner.owner = instance; setmodel(spinner, MDL_VEH_RAPTOR_PROP); setattachment(spinner, instance, "engine_left"); - spinner.movetype = MOVETYPE_NOCLIP; + set_movetype(spinner, MOVETYPE_NOCLIP); spinner.avelocity = '0 90 0'; instance.bomb1.gun1 = spinner; @@ -710,7 +689,7 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance)) spinner.owner = instance; setmodel(spinner, MDL_VEH_RAPTOR_PROP); setattachment(spinner, instance, "engine_right"); - spinner.movetype = MOVETYPE_NOCLIP; + set_movetype(spinner, MOVETYPE_NOCLIP); spinner.avelocity = '0 -90 0'; instance.bomb1.gun2 = spinner; @@ -722,9 +701,9 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance)) } instance.frame = 0; - instance.vehicle_health = autocvar_g_vehicle_raptor_health; + SetResourceExplicit(instance, RES_HEALTH, autocvar_g_vehicle_raptor_health); instance.vehicle_shield = autocvar_g_vehicle_raptor_shield; - instance.movetype = MOVETYPE_TOSS; + set_movetype(instance, MOVETYPE_TOSS); instance.solid = SOLID_SLIDEBOX; instance.vehicle_energy = 1; @@ -741,7 +720,7 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance)) instance.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor; instance.bouncestop = autocvar_g_vehicle_raptor_bouncestop; instance.damageforcescale = 0.25; - instance.vehicle_health = autocvar_g_vehicle_raptor_health; + SetResourceExplicit(instance, RES_HEALTH, autocvar_g_vehicle_raptor_health); instance.vehicle_shield = autocvar_g_vehicle_raptor_shield; } METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance)) @@ -760,9 +739,12 @@ METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance)) instance.vehicle_exit = raptor_exit; instance.respawntime = autocvar_g_vehicle_raptor_respawntime; - instance.vehicle_health = autocvar_g_vehicle_raptor_health; + SetResourceExplicit(instance, RES_HEALTH, autocvar_g_vehicle_raptor_health); instance.vehicle_shield = autocvar_g_vehicle_raptor_shield; - instance.max_health = instance.vehicle_health; + instance.max_health = GetResource(instance, RES_HEALTH); + + if(!autocvar_g_vehicle_raptor_swim) + instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK; } #endif @@ -795,6 +777,9 @@ METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player)) dropmark = spawn(); dropmark.owner = player; dropmark.gravity = 1; + dropmark.dphitcontentsmask = DPCONTENTS_SOLID; + dropmark.solid = SOLID_CORPSE; + set_movetype(dropmark, MOVETYPE_BOUNCE); } float reload2 = STAT(VEHICLESTAT_RELOAD2) * 0.01; @@ -807,10 +792,10 @@ METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player)) where = project_3d_to_2d(trace_endpos); setorigin(dropmark, trace_endpos); - tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size; if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight)) { + tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size; where.x -= tmpSize.x * 0.5; where.y -= tmpSize.y * 0.5; where.z = 0; @@ -824,10 +809,10 @@ METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player)) if(dropmark.cnt > time) { where = project_3d_to_2d(dropmark.origin); - tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25; if (!(where.z < 0 || where.x < 0 || where.y < 0 || where.x > vid_conwidth || where.y > vid_conheight)) { + tmpSize = draw_getimagesize(vCROSS_DROP) * autocvar_cl_vehicles_crosshair_size * 1.25; where.x -= tmpSize.x * 0.5; where.y -= tmpSize.y * 0.5; where.z = 0; @@ -846,4 +831,3 @@ METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance)) } #endif -#endif