X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fvehicles%2Fsv_vehicles.qc;h=7f0537eeb502583fdcdd16ab8ebb74e423e9a359;hb=1d70346809dd33b32864b3832662878077588e4b;hp=8f2f7581a215c4c8cb2264dffecfd9cfe355589f;hpb=c0582a52156c4e74e4c5313e5f360275493a8733;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 8f2f7581a..7f0537eeb 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -1,5 +1,4 @@ #include "sv_vehicles.qh" -#include "../effects/effects.qh" #if 0 bool vehicle_send(entity to, int sf) @@ -38,10 +37,10 @@ bool vehicle_send(entity to, int sf) } #endif -bool SendAuxiliaryXhair(entity to, int sf) -{SELFPARAM(); +bool SendAuxiliaryXhair(entity this, entity to, int sf) +{ - WriteByte(MSG_ENTITY, ENT_CLIENT_AUXILIARYXHAIR); + WriteHeader(MSG_ENTITY, ENT_CLIENT_AUXILIARYXHAIR); WriteByte(MSG_ENTITY, self.cnt); @@ -88,8 +87,7 @@ void CSQCVehicleSetup(entity own, int vehicle_id) msg_entity = own; - WriteByte(MSG_ONE, SVC_TEMPENTITY); - WriteByte(MSG_ONE, TE_CSQC_VEHICLESETUP); + WriteHeader(MSG_ONE, TE_CSQC_VEHICLESETUP); WriteByte(MSG_ONE, vehicle_id); } @@ -456,10 +454,8 @@ void vehicles_reset_colors() void vehicles_clearreturn(entity veh) { - entity ret; // Remove "return helper", if any. - ret = findchain(classname, "vehicle_return"); - while(ret) + for (entity ret = findchain(classname, "vehicle_return"); ret; ret = ret.chain) { if(ret.wp00 == veh) { @@ -472,7 +468,6 @@ void vehicles_clearreturn(entity veh) return; } - ret = ret.chain; } } @@ -529,7 +524,7 @@ void vehicles_showwp() rgb = Team_ColorRGB(self.team); else rgb = '1 1 1'; - entity wp = WaypointSprite_Spawn(WP_Vehicle, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_POWERUP); + entity wp = WaypointSprite_Spawn(WP_Vehicle, 0, 0, self, '0 0 64', world, 0, self, waypointsprite_attached, true, RADARICON_Vehicle); wp.colormod = rgb; if(self.waypointsprite_attached) { @@ -549,8 +544,7 @@ void vehicles_setreturn(entity veh) vehicles_clearreturn(veh); - ret = spawn(); - ret.classname = "vehicle_return"; + ret = new(vehicle_return); ret.wp00 = veh; ret.team = veh.team; ret.think = vehicles_showwp; @@ -635,7 +629,7 @@ void vehicles_painframe() float _ftmp; _ftmp = self.owner.vehicle_health / 50; self.pain_frame = time + 0.1 + (random() * 0.5 * _ftmp); - pointparticles(particleeffectnum(EFFECT_SMOKE_SMALL), (self.origin + (randomvec() * 80)), '0 0 0', 1); + pointparticles(EFFECT_SMOKE_SMALL, (self.origin + (randomvec() * 80)), '0 0 0', 1); if(self.vehicle_flags & VHF_DMGSHAKE) self.velocity += randomvec() * 30; @@ -654,22 +648,22 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, int deatht self.dmg_time = time; // WEAPONTODO - if(DEATH_ISWEAPON(deathtype, WEP_VORTEX.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_VORTEX)) damage *= autocvar_g_vehicles_vortex_damagerate; - if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_MACHINEGUN)) damage *= autocvar_g_vehicles_machinegun_damagerate; - if(DEATH_ISWEAPON(deathtype, WEP_RIFLE.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_RIFLE)) damage *= autocvar_g_vehicles_rifle_damagerate; - if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_VAPORIZER)) damage *= autocvar_g_vehicles_vaporizer_damagerate; - if(DEATH_ISWEAPON(deathtype, WEP_SEEKER.m_id)) + if(DEATH_ISWEAPON(deathtype, WEP_SEEKER)) damage *= autocvar_g_vehicles_tag_damagerate; - if(DEATH_WEAPONOFWEAPONDEATH(deathtype)) + if(DEATH_WEAPONOF(deathtype) != WEP_Null) damage *= autocvar_g_vehicles_weapon_damagerate; self.enemy = attacker; @@ -737,7 +731,8 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, int deatht antilag_clear(self); - VEH_ACTION(self.vehicleid, VR_DEATH); + Vehicle info = get_vehicleinfo(self.vehicleid); + info.vr_death(info); vehicles_setreturn(self); } } @@ -766,7 +761,7 @@ void vehicles_impact(float _minspeed, float _speedfac, float _maxpain) if(_minspeed < wc) { float take = min(_speedfac * wc, _maxpain); - Damage (self, world, world, take, DEATH_FALL, self.origin, '0 0 0'); + Damage (self, world, world, take, DEATH_FALL.m_id, self.origin, '0 0 0'); self.play_time = time + 0.25; //dprint("wc: ", ftos(wc), "\n"); @@ -937,13 +932,15 @@ void vehicles_touch() if(vehicles_crushable(other)) { if(vlen(self.velocity) >= 30) - Damage(other, self, self.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH, '0 0 0', normalize(other.origin - self.origin) * autocvar_g_vehicles_crush_force); + Damage(other, self, self.owner, autocvar_g_vehicles_crush_dmg, DEATH_VH_CRUSH.m_id, '0 0 0', normalize(other.origin - self.origin) * autocvar_g_vehicles_crush_force); return; // Dont do selfdamage when hitting "soft targets". } - if(self.play_time < time) - VEH_ACTION(self.vehicleid, VR_IMPACT); + if(self.play_time < time) { + Vehicle info = get_vehicleinfo(self.vehicleid); + info.vr_impact(info); + } return; } @@ -1112,8 +1109,9 @@ void vehicles_enter(entity pl, entity veh) MUTATOR_CALLHOOK(VehicleEnter, pl, veh); setself(veh); - CSQCModel_UnlinkEntity(); - VEH_ACTION(veh.vehicleid, VR_ENTER); + CSQCModel_UnlinkEntity(veh); + Vehicle info = get_vehicleinfo(veh.vehicleid); + info.vr_enter(info); setself(this); antilag_clear(pl); @@ -1126,7 +1124,8 @@ void vehicles_think() if(self.owner) self.owner.vehicle_weapon2mode = self.vehicle_weapon2mode; - VEH_ACTION(self.vehicleid, VR_THINK); + Vehicle info = get_vehicleinfo(self.vehicleid); + info.vr_think(info); CSQCMODEL_AUTOUPDATE(self); } @@ -1177,7 +1176,8 @@ void vehicles_spawn() vehicles_reset_colors(); - VEH_ACTION(self.vehicleid, VR_SPAWN); + Vehicle info = get_vehicleinfo(self.vehicleid); + info.vr_spawn(info); CSQCMODEL_AUTOINIT(self); } @@ -1190,7 +1190,10 @@ bool vehicle_initialize(entity veh, bool nodrop) if(!veh.vehicleid) return false; - if(!veh.tur_head) { VEH_ACTION(veh.vehicleid, VR_PRECACHE); } + if(!veh.tur_head) { + Vehicle info = get_vehicleinfo(veh.vehicleid); + info.vr_precache(info); + } if(self.targetname && self.targetname != "") { @@ -1226,9 +1229,9 @@ bool vehicle_initialize(entity veh, bool nodrop) self.vehicle_flags |= VHF_ISVEHICLE; - self.vehicle_viewport = spawn(); - self.vehicle_hudmodel = spawn(); - self.tur_head = spawn(); + self.vehicle_viewport = new(vehicle_viewport); + self.vehicle_hudmodel = new(vehicle_hudmodel); + self.tur_head = new(tur_head); self.tur_head.owner = self; self.takedamage = DAMAGE_NO; self.bot_attack = true; @@ -1283,7 +1286,8 @@ bool vehicle_initialize(entity veh, bool nodrop) self.pos2 = self.angles; self.tur_head.team = self.team; - VEH_ACTION(veh.vehicleid, VR_SETUP); + Vehicle info = get_vehicleinfo(veh.vehicleid); + info.vr_setup(info); if(self.active == ACTIVE_NOT) self.nextthink = 0; // wait until activated