From: Mario Date: Fri, 10 Jun 2016 11:36:23 +0000 (+1000) Subject: Cleanse vehicles of SELFPARAM X-Git-Tag: xonotic-v0.8.2~852 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=1127e8bfbc6407f16f31261c1d0c7e559fe78edd;p=xonotic%2Fxonotic-data.pk3dir.git Cleanse vehicles of SELFPARAM --- diff --git a/qcsrc/client/view.qc b/qcsrc/client/view.qc index 828853243..9ba1114b6 100644 --- a/qcsrc/client/view.qc +++ b/qcsrc/client/view.qc @@ -766,12 +766,12 @@ bool WantEventchase(entity this) return false; } -void HUD_Crosshair_Vehicle() +void HUD_Crosshair_Vehicle(entity this) { if(hud != HUD_BUMBLEBEE_GUN) { Vehicle info = Vehicles_from(hud); - info.vr_crosshair(info); + info.vr_crosshair(info, this); } } @@ -860,7 +860,7 @@ vector crosshair_getcolor(entity this, float health_stat) { case 1: // crosshair_color_per_weapon { - if(this) + if(this != WEP_Null) { wcross_color = this.wpcolor; break; @@ -944,7 +944,7 @@ void HUD_Crosshair(entity this) if (hud != HUD_NORMAL) { - HUD_Crosshair_Vehicle(); + HUD_Crosshair_Vehicle(this); return; } @@ -989,7 +989,7 @@ void HUD_Crosshair(entity this) string wcross_name = ""; float wcross_scale, wcross_blur; - entity e = this; // wtf? + entity e = WEP_Null; if(autocvar_crosshair_per_weapon || (autocvar_crosshair_color_special == 1)) { e = switchingweapon; @@ -2184,7 +2184,7 @@ void CSQC_UpdateView(float w, float h) scoreboard_active = HUD_WouldDrawScoreboard(); - HUD_Draw(this); + HUD_Draw(this); // this parameter for deep vehicle function if(NextFrameCommand) { diff --git a/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc b/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc index f4678e1db..9bb88a2f8 100644 --- a/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc +++ b/qcsrc/common/mutators/mutator/bloodloss/bloodloss.qc @@ -15,7 +15,7 @@ MUTATOR_HOOKFUNCTION(bloodloss, PlayerPreThink) if(time >= player.bloodloss_timer) { if(player.vehicle) - vehicles_exit(VHEF_RELEASE); + vehicles_exit(player.vehicle, VHEF_RELEASE); if(player.event_damage) player.event_damage(player, player, player, 1, DEATH_ROT.m_id, player.origin, '0 0 0'); player.bloodloss_timer = time + 0.5 + random() * 0.5; diff --git a/qcsrc/common/vehicles/cl_vehicles.qc b/qcsrc/common/vehicles/cl_vehicles.qc index 9659ea5f8..bd9130a26 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qc +++ b/qcsrc/common/vehicles/cl_vehicles.qc @@ -124,7 +124,6 @@ void Vehicles_drawHUD( string iconAmmo2, vector colorAmmo2) { - SELFPARAM(); // Initialize vector tmpSize = '0 0 0'; vector tmpPos = '0 0 0'; @@ -232,7 +231,7 @@ void Vehicles_drawHUD( if(alarm1time < time) { alarm1time = time + 2; - vehicle_alarm(self, CH_PAIN_SINGLE, SND_VEH_ALARM); + vehicle_alarm(world, CH_PAIN_SINGLE, SND_VEH_ALARM); } drawpic_skin(tmpPos, "vehicle_icon_health", tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL); } @@ -240,7 +239,7 @@ void Vehicles_drawHUD( { if(alarm1time) { - vehicle_alarm(self, CH_PAIN_SINGLE, SND_Null); + vehicle_alarm(world, CH_PAIN_SINGLE, SND_Null); alarm1time = 0; } drawpic_skin(tmpPos, "vehicle_icon_health", tmpSize, '1 1 1', hudAlpha, DRAWFLAG_NORMAL); @@ -254,7 +253,7 @@ void Vehicles_drawHUD( if(alarm2time < time) { alarm2time = time + 1; - vehicle_alarm(self, CH_TRIGGER_SINGLE, SND_VEH_ALARM_SHIELD); + vehicle_alarm(world, CH_TRIGGER_SINGLE, SND_VEH_ALARM_SHIELD); } drawpic_skin(tmpPos, "vehicle_icon_shield", tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL); } @@ -262,7 +261,7 @@ void Vehicles_drawHUD( { if(alarm2time) { - vehicle_alarm(self, CH_TRIGGER_SINGLE, SND_Null); + vehicle_alarm(world, CH_TRIGGER_SINGLE, SND_Null); alarm2time = 0; } drawpic_skin(tmpPos, "vehicle_icon_shield", tmpSize, '1 1 1', hudAlpha, DRAWFLAG_NORMAL); diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 6f1d2d918..3d94aa51f 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -344,7 +344,7 @@ bool vehicle_addplayerslot( entity _owner, int _hud, Model _hud_model, bool(entity) _framefunc, - void(bool) _exitfunc, float(entity, entity) _enterfunc) + void(entity,bool) _exitfunc, float(entity, entity) _enterfunc) { if(!(_owner.vehicle_flags & VHF_MULTISLOT)) _owner.vehicle_flags |= VHF_MULTISLOT; @@ -708,9 +708,9 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag { if(this.owner) if(this.vehicle_flags & VHF_DEATHEJECT) - WITHSELF(this, vehicles_exit(VHEF_EJECT)); + vehicles_exit(this, VHEF_EJECT); else - WITHSELF(this, vehicles_exit(VHEF_RELEASE)); + vehicles_exit(this, VHEF_RELEASE); antilag_clear(this, this); @@ -755,149 +755,139 @@ void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpa } // vehicle enter/exit handling -vector vehicles_findgoodexit(vector prefer_spot) -{SELFPARAM(); +vector vehicles_findgoodexit(entity this, vector prefer_spot) +{ //vector exitspot; float mysize; - tracebox(self.origin + '0 0 32', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), prefer_spot, MOVE_NORMAL, self.owner); + tracebox(this.origin + '0 0 32', STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), prefer_spot, MOVE_NORMAL, this.owner); if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid) return prefer_spot; - mysize = 1.5 * vlen(self.maxs - self.mins); + mysize = 1.5 * vlen(this.maxs - this.mins); float i; vector v, v2; - v2 = 0.5 * (self.absmin + self.absmax); + v2 = 0.5 * (this.absmin + this.absmax); for(i = 0; i < 100; ++i) { v = randomvec(); v_z = 0; v = v2 + normalize(v) * mysize; - tracebox(v2, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), v, MOVE_NORMAL, self.owner); + tracebox(v2, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL), v, MOVE_NORMAL, this.owner); if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid) return v; } /* - exitspot = (self.origin + '0 0 48') + v_forward * mysize; - tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, self.owner); + exitspot = (this.origin + '0 0 48') + v_forward * mysize; + tracebox(this.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, this.owner); if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid) return exitspot; - exitspot = (self.origin + '0 0 48') - v_forward * mysize; - tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, self.owner); + exitspot = (this.origin + '0 0 48') - v_forward * mysize; + tracebox(this.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, this.owner); if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid) return exitspot; - exitspot = (self.origin + '0 0 48') + v_right * mysize; - tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, self.owner); + exitspot = (this.origin + '0 0 48') + v_right * mysize; + tracebox(this.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, this.owner); if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid) return exitspot; - exitspot = (self.origin + '0 0 48') - v_right * mysize; - tracebox(self.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, self.owner); + exitspot = (this.origin + '0 0 48') - v_right * mysize; + tracebox(this.origin + '0 0 32', PL_MIN, PL_MAX, exitspot, MOVE_NORMAL, this.owner); if(trace_fraction == 1.0 && !trace_startsolid && !trace_allsolid) return exitspot; */ - return self.origin; + return this.origin; } -void vehicles_exit(bool eject) -{SELFPARAM(); - entity _vehicle; - entity _player; +void vehicles_exit(entity vehic, bool eject) +{ + entity player = vehic.owner; if(vehicles_exit_running) { - LOG_TRACE("^1vehicles_exit allready running! this is not good..\n"); + LOG_TRACE("^1vehicles_exit already running! this is not good...\n"); return; } vehicles_exit_running = true; - if(IS_CLIENT(self)) - { - _vehicle = self.vehicle; - if (_vehicle.vehicle_flags & VHF_PLAYERSLOT) - { - _vehicle.vehicle_exit(eject); - vehicles_exit_running = false; - return; - } + // TODO: this was in an IS_CLIENT check, make sure it isn't actually needed! + if(vehic.vehicle_flags & VHF_PLAYERSLOT) + { + vehic.vehicle_exit(vehic, eject); + vehicles_exit_running = false; + return; } - else - _vehicle = self; - - _player = _vehicle.owner; - - setself(_vehicle); - if (_player) + if (player) { - if (IS_REAL_CLIENT(_player)) + if (IS_REAL_CLIENT(player)) { - msg_entity = _player; + msg_entity = player; WriteByte (MSG_ONE, SVC_SETVIEWPORT); - WriteEntity( MSG_ONE, _player); + WriteEntity( MSG_ONE, player); WriteByte (MSG_ONE, SVC_SETVIEWANGLES); WriteAngle(MSG_ONE, 0); - WriteAngle(MSG_ONE, _vehicle.angles_y); + WriteAngle(MSG_ONE, vehic.angles_y); WriteAngle(MSG_ONE, 0); } - setsize(_player, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL)); - - _player.takedamage = DAMAGE_AIM; - _player.solid = SOLID_SLIDEBOX; - _player.movetype = MOVETYPE_WALK; - _player.effects &= ~EF_NODRAW; - _player.teleportable = TELEPORT_NORMAL; - _player.alpha = 1; - _player.PlayerPhysplug = func_null; - _player.vehicle = world; - _player.view_ofs = STAT(PL_VIEW_OFS, NULL); - _player.event_damage = PlayerDamage; - _player.hud = HUD_NORMAL; - PS(_player).m_switchweapon = _vehicle.m_switchweapon; - _player.last_vehiclecheck = time + 3; - _player.vehicle_enter_delay = time + 2; - - CSQCVehicleSetup(_player, HUD_NORMAL); + setsize(player, STAT(PL_MIN, NULL), STAT(PL_MAX, NULL)); + + player.takedamage = DAMAGE_AIM; + player.solid = SOLID_SLIDEBOX; + player.movetype = MOVETYPE_WALK; + player.effects &= ~EF_NODRAW; + player.teleportable = TELEPORT_NORMAL; + player.alpha = 1; + player.PlayerPhysplug = func_null; + player.vehicle = world; + player.view_ofs = STAT(PL_VIEW_OFS, NULL); + player.event_damage = PlayerDamage; + player.hud = HUD_NORMAL; + PS(player).m_switchweapon = vehic.m_switchweapon; + player.last_vehiclecheck = time + 3; + player.vehicle_enter_delay = time + 2; + + CSQCVehicleSetup(player, HUD_NORMAL); + + Kill_Notification(NOTIF_ONE, player, MSG_CENTER, CPID_VEHICLES); + Kill_Notification(NOTIF_ONE, player, MSG_CENTER, CPID_VEHICLES_OTHER); // kill all vehicle notifications when exiting a vehicle? } - _vehicle.flags |= FL_NOTARGET; - if(!IS_DEAD(_vehicle)) - _vehicle.avelocity = '0 0 0'; + vehic.flags |= FL_NOTARGET; - _vehicle.tur_head.nodrawtoclient = world; + if(!IS_DEAD(vehic)) + vehic.avelocity = '0 0 0'; - if(!teamplay) - _vehicle.team = 0; + vehic.tur_head.nodrawtoclient = world; - Kill_Notification(NOTIF_ONE, _player, MSG_CENTER, CPID_VEHICLES); - Kill_Notification(NOTIF_ONE, _player, MSG_CENTER, CPID_VEHICLES_OTHER); // kill all vehicle notifications when exiting a vehicle? + if(!teamplay) + vehic.team = 0; - WaypointSprite_Kill(_vehicle.wps_intruder); + WaypointSprite_Kill(vehic.wps_intruder); - MUTATOR_CALLHOOK(VehicleExit, _player, _vehicle); + MUTATOR_CALLHOOK(VehicleExit, player, vehic); - _vehicle.team = _vehicle.tur_head.team; + vehic.team = vehic.tur_head.team; - sound (_vehicle, CH_TRIGGER_SINGLE, SND_Null, 1, ATTEN_NORM); - _vehicle.vehicle_hudmodel.viewmodelforclient = _vehicle; - _vehicle.phase = time + 1; + sound (vehic, CH_TRIGGER_SINGLE, SND_Null, 1, ATTEN_NORM); + vehic.vehicle_hudmodel.viewmodelforclient = vehic; + vehic.phase = time + 1; - _vehicle.vehicle_exit(eject); + vehic.vehicle_exit(vehic, eject); - vehicles_setreturn(_vehicle); - vehicles_reset_colors(_vehicle); - _vehicle.owner = world; + vehicles_setreturn(vehic); + vehicles_reset_colors(vehic); + vehic.owner = world; - CSQCMODEL_AUTOINIT(self); + CSQCMODEL_AUTOINIT(vehic); - setself(this); vehicles_exit_running = false; } @@ -939,8 +929,8 @@ bool vehicle_impulse(entity this, int imp) entity v = this.vehicle; if (!v) return false; if (IS_DEAD(v)) return false; - bool(int) f = v.vehicles_impulse; - if (f && f(imp)) return true; + bool(entity,int) f = v.vehicles_impulse; + if (f && f(this,imp)) return true; switch (imp) { case IMP_weapon_drop.impulse: diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index 165ae07e6..54550c509 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -81,9 +81,9 @@ const float DAMAGE_TARGETDRONE = 10; // vehicle functions .void(int _spawnflag) vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns -.bool(int _imp) vehicles_impulse; +.bool(entity this, int _imp) vehicles_impulse; .int vehicle_weapon2mode = _STAT(VEHICLESTAT_W2MODE); -.void(int exit_flags) vehicle_exit; +.void(entity this, int exit_flags) vehicle_exit; .bool(entity this, entity player) vehicle_enter; const int VHEF_NORMAL = 0; /// User pressed exit key const int VHEF_EJECT = 1; /// User pressed exit key 3 times fast (not implemented) or vehile is dying @@ -101,7 +101,7 @@ float vehicles_exit_running; .float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly -void vehicles_exit(float eject); +void vehicles_exit(entity vehic, int eject); bool vehicle_initialize(entity this, Vehicle info, float nodrop); bool vehicle_impulse(entity this, int imp); bool vehicles_crushable(entity e); diff --git a/qcsrc/common/vehicles/vehicle.qh b/qcsrc/common/vehicles/vehicle.qh index c49218db1..45cdacf39 100644 --- a/qcsrc/common/vehicles/vehicle.qh +++ b/qcsrc/common/vehicles/vehicle.qh @@ -53,7 +53,7 @@ CLASS(Vehicle, Object) /** (CLIENT) logic to run every frame */ METHOD(Vehicle, vr_hud, void(Vehicle this)) { } /** (CLIENT) logic to run every frame */ - METHOD(Vehicle, vr_crosshair, void(Vehicle this)) { } + METHOD(Vehicle, vr_crosshair, void(Vehicle thisveh, entity player)) { } ENDCLASS(Vehicle) // vehicle spawn flags (need them here for common registrations) diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index 945c0964f..daa2865d4 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -233,9 +233,9 @@ vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity p return prefer_spot; // this should be considered a fallback?! } -void bumblebee_gunner_exit(int _exitflag) -{SELFPARAM(); - entity player = self; +void bumblebee_gunner_exit(entity this, int _exitflag) +{ + entity player = this; entity gunner = player.vehicle; entity vehic = gunner.owner; @@ -355,15 +355,15 @@ bool bumblebee_gunner_enter(entity this, entity player) return true; } -bool vehicles_valid_pilot() -{SELFPARAM(); - if(IS_BOT_CLIENT(other) && !autocvar_g_vehicles_allow_bots) +bool vehicles_valid_pilot(entity this, entity toucher) +{ + if(IS_BOT_CLIENT(toucher) && !autocvar_g_vehicles_allow_bots) return false; - if((!IS_PLAYER(other)) - || (IS_DEAD(other)) - || (other.vehicle) - || (DIFF_TEAM(other, self)) + if((!IS_PLAYER(toucher)) + || (IS_DEAD(toucher)) + || (toucher.vehicle) + || (DIFF_TEAM(toucher, this)) ) { return false; } return true; @@ -373,22 +373,22 @@ void bumblebee_touch(entity this) { if(autocvar_g_vehicles_enter) { return; } - if(self.gunner1 != world && self.gunner2 != world) + if(this.gunner1 != world && this.gunner2 != world) { - vehicles_touch(self); + vehicles_touch(this); return; } - if(vehicles_valid_pilot()) + if(vehicles_valid_pilot(this, other)) { - float phase_time = (time >= self.gun1.phase) + (time >= self.gun2.phase); + float phase_time = (time >= this.gun1.phase) + (time >= this.gun2.phase); if(time >= other.vehicle_enter_delay && phase_time) - if(bumblebee_gunner_enter(self, other)) + if(bumblebee_gunner_enter(this, other)) return; } - vehicles_touch(self); + vehicles_touch(this); } void bumblebee_regen(entity this) @@ -629,7 +629,7 @@ void bumblebee_land(entity this) { float hgt; - hgt = raptor_altitude(512); + hgt = raptor_altitude(this, 512); self.velocity = (self.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime); self.angles_x *= 0.95; self.angles_z *= 0.95; @@ -642,47 +642,46 @@ void bumblebee_land(entity this) CSQCMODEL_AUTOUPDATE(self); } -void bumblebee_exit(float eject) -{SELFPARAM(); - if(self.owner.vehicleid == VEH_BUMBLEBEE.vehicleid) +void bumblebee_exit(entity this, int eject) +{ + if(this.owner.vehicleid == VEH_BUMBLEBEE.vehicleid) { - bumblebee_gunner_exit(eject); + bumblebee_gunner_exit(this, eject); return; } - settouch(self, vehicles_touch); + settouch(this, vehicles_touch); - if(!IS_DEAD(self)) + if(!IS_DEAD(this)) { - setthink(self, bumblebee_land); - self.nextthink = time; + setthink(this, bumblebee_land); + this.nextthink = time; } - self.movetype = MOVETYPE_TOSS; + this.movetype = MOVETYPE_TOSS; - if(!self.owner) + if(!this.owner) return; - fixedmakevectors(self.angles); + fixedmakevectors(this.angles); vector spot; - if(vdist(self.velocity, >, autocvar_g_vehicle_bumblebee_speed_forward * 0.5)) - spot = self.origin + v_up * 128 + v_forward * 300; + if(vdist(this.velocity, >, autocvar_g_vehicle_bumblebee_speed_forward * 0.5)) + spot = this.origin + v_up * 128 + v_forward * 300; else - spot = self.origin + v_up * 128 - v_forward * 300; + spot = this.origin + v_up * 128 - v_forward * 300; - spot = vehicles_findgoodexit(spot); + spot = vehicles_findgoodexit(this, spot); // Hide beam - if(self.gun3.enemy || !wasfreed(self.gun3.enemy)) { - self.gun3.enemy.effects |= EF_NODRAW; - } + if(this.gun3.enemy || !wasfreed(this.gun3.enemy)) + this.gun3.enemy.effects |= EF_NODRAW; - self.owner.velocity = 0.75 * self.vehicle.velocity + normalize(spot - self.vehicle.origin) * 200; - self.owner.velocity_z += 10; - setorigin(self.owner, spot); + this.owner.velocity = 0.75 * this.vehicle.velocity + normalize(spot - this.vehicle.origin) * 200; + this.owner.velocity_z += 10; + setorigin(this.owner, spot); - antilag_clear(self.owner, CS(self.owner)); - self.owner = world; + antilag_clear(this.owner, CS(this.owner)); + this.owner = world; } void bumblebee_blowup(entity this) @@ -729,41 +728,39 @@ METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh, entity instance)) } METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance)) { - SELFPARAM(); - settouch(self, bumblebee_touch); - self.nextthink = 0; - self.movetype = MOVETYPE_BOUNCEMISSILE; + settouch(instance, bumblebee_touch); + instance.nextthink = 0; + instance.movetype = MOVETYPE_BOUNCEMISSILE; } METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance)) { - SELFPARAM(); - self.angles_z *= 0.8; - self.angles_x *= 0.8; + instance.angles_z *= 0.8; + instance.angles_x *= 0.8; - self.nextthink = time; + instance.nextthink = time; - if(!self.owner) + if(!instance.owner) { - if(self.gunner1) + if(instance.gunner1) { - entity e = self.gunner1; - WITHSELF(e, self.gun1.vehicle_exit(VHEF_EJECT)); + entity e = instance.gunner1; + instance.gun1.vehicle_exit(e, VHEF_EJECT); entity oldother = other; other = e; - self.phase = 0; - gettouch(self)(self); + instance.phase = 0; + gettouch(instance)(instance); other = oldother; return; } - if(self.gunner2) + if(instance.gunner2) { - entity e = self.gunner2; - WITHSELF(e, self.gun2.vehicle_exit(VHEF_EJECT)); + entity e = instance.gunner2; + instance.gun2.vehicle_exit(e, VHEF_EJECT); entity oldother = other; other = e; - self.phase = 0; - gettouch(self)(self); + instance.phase = 0; + gettouch(instance)(instance); other = oldother; return; } @@ -778,12 +775,12 @@ METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance)) instance.gun3.enemy.effects |= EF_NODRAW; if(instance.gunner1) - WITHSELF(instance.gunner1, instance.gun1.vehicle_exit(VHEF_EJECT)); + instance.gun1.vehicle_exit(instance.gunner1, VHEF_EJECT); if(instance.gunner2) - WITHSELF(instance.gunner2, instance.gun2.vehicle_exit(VHEF_EJECT)); + instance.gun2.vehicle_exit(instance.gunner2, VHEF_EJECT); - WITHSELF(instance, instance.vehicle_exit(VHEF_EJECT)); + instance.vehicle_exit(instance, VHEF_EJECT); fixedmakevectors(instance.angles); vehicle_tossgib(instance, instance.gun1, instance.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200); @@ -824,81 +821,80 @@ METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance)) } METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance)) { - SELFPARAM(); - if(!self.gun1) + if(!instance.gun1) { // for some reason, autosizing of the shield entity refuses to work for this one so set it up in advance. - self.vehicle_shieldent = spawn(); - self.vehicle_shieldent.effects = EF_LOWPRECISION; - setmodel(self.vehicle_shieldent, MDL_VEH_BUMBLEBEE_SHIELD); - setattachment(self.vehicle_shieldent, self, ""); - setorigin(self.vehicle_shieldent, real_origin(self) - self.origin); - self.vehicle_shieldent.scale = 512 / vlen(self.maxs - self.mins); - setthink(self.vehicle_shieldent, shieldhit_think); - self.vehicle_shieldent.alpha = -1; - self.vehicle_shieldent.effects = EF_LOWPRECISION | EF_NODRAW; + instance.vehicle_shieldent = spawn(); + instance.vehicle_shieldent.effects = EF_LOWPRECISION; + setmodel(instance.vehicle_shieldent, MDL_VEH_BUMBLEBEE_SHIELD); + setattachment(instance.vehicle_shieldent, instance, ""); + setorigin(instance.vehicle_shieldent, real_origin(instance) - instance.origin); + instance.vehicle_shieldent.scale = 512 / vlen(instance.maxs - instance.mins); + setthink(instance.vehicle_shieldent, shieldhit_think); + instance.vehicle_shieldent.alpha = -1; + instance.vehicle_shieldent.effects = EF_LOWPRECISION | EF_NODRAW; - self.gun1 = new(vehicle_playerslot); - self.gun2 = new(vehicle_playerslot); - self.gun3 = new(bumblebee_raygun); + instance.gun1 = new(vehicle_playerslot); + instance.gun2 = new(vehicle_playerslot); + instance.gun3 = new(bumblebee_raygun); - self.vehicle_flags |= VHF_MULTISLOT; + instance.vehicle_flags |= VHF_MULTISLOT; - self.gun1.owner = self; - self.gun2.owner = self; - self.gun3.owner = self; + instance.gun1.owner = instance; + instance.gun2.owner = instance; + instance.gun3.owner = instance; - setmodel(self.gun1, MDL_VEH_BUMBLEBEE_CANNON_RIGHT); - setmodel(self.gun2, MDL_VEH_BUMBLEBEE_CANNON_LEFT); - setmodel(self.gun3, MDL_VEH_BUMBLEBEE_CANNON_CENTER); + setmodel(instance.gun1, MDL_VEH_BUMBLEBEE_CANNON_RIGHT); + setmodel(instance.gun2, MDL_VEH_BUMBLEBEE_CANNON_LEFT); + setmodel(instance.gun3, MDL_VEH_BUMBLEBEE_CANNON_CENTER); - setattachment(self.gun1, self, "cannon_right"); - setattachment(self.gun2, self, "cannon_left"); + setattachment(instance.gun1, instance, "cannon_right"); + setattachment(instance.gun2, instance, "cannon_left"); // Angled bones are no fun, messes up gun-aim; so work arround it. - self.gun3.pos1 = self.angles; - self.angles = '0 0 0'; - vector ofs = gettaginfo(self, gettagindex(self, "raygun")); - ofs -= self.origin; - setattachment(self.gun3, self, ""); - setorigin(self.gun3, ofs); - self.angles = self.gun3.pos1; + instance.gun3.pos1 = instance.angles; + instance.angles = '0 0 0'; + vector ofs = gettaginfo(instance, gettagindex(instance, "raygun")); + ofs -= instance.origin; + setattachment(instance.gun3, instance, ""); + setorigin(instance.gun3, ofs); + instance.angles = instance.gun3.pos1; - vehicle_addplayerslot(self, self.gun1, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter); - vehicle_addplayerslot(self, self.gun2, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter); + vehicle_addplayerslot(instance, instance.gun1, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter); + vehicle_addplayerslot(instance, instance.gun2, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter); - setorigin(self.vehicle_hudmodel, '50 0 -5'); // Move cockpit forward - down. - setorigin(self.vehicle_viewport, '5 0 2'); // Move camera forward up + setorigin(instance.vehicle_hudmodel, '50 0 -5'); // Move cockpit forward - down. + setorigin(instance.vehicle_viewport, '5 0 2'); // Move camera forward up //fixme-model-bones - setorigin(self.gun1.vehicle_hudmodel, '90 -27 -23'); - setorigin(self.gun1.vehicle_viewport, '-85 0 50'); + setorigin(instance.gun1.vehicle_hudmodel, '90 -27 -23'); + setorigin(instance.gun1.vehicle_viewport, '-85 0 50'); //fixme-model-bones - setorigin(self.gun2.vehicle_hudmodel, '90 27 -23'); - setorigin(self.gun2.vehicle_viewport, '-85 0 50'); + setorigin(instance.gun2.vehicle_hudmodel, '90 27 -23'); + setorigin(instance.gun2.vehicle_viewport, '-85 0 50'); - self.scale = 1.5; + instance.scale = 1.5; // Raygun beam - if(self.gun3.enemy == world) + if(instance.gun3.enemy == world) { - self.gun3.enemy = spawn(); - Net_LinkEntity(self.gun3.enemy, true, 0, bumble_raygun_send); - self.gun3.enemy.SendFlags = BRG_SETUP; - self.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun; - self.gun3.enemy.effects = EF_NODRAW | EF_LOWPRECISION; + instance.gun3.enemy = spawn(); + Net_LinkEntity(instance.gun3.enemy, true, 0, bumble_raygun_send); + instance.gun3.enemy.SendFlags = BRG_SETUP; + instance.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun; + instance.gun3.enemy.effects = EF_NODRAW | EF_LOWPRECISION; } } - self.vehicle_health = autocvar_g_vehicle_bumblebee_health; - self.vehicle_shield = autocvar_g_vehicle_bumblebee_shield; - self.solid = SOLID_BBOX; - self.movetype = MOVETYPE_TOSS; - self.damageforcescale = 0.025; + instance.vehicle_health = autocvar_g_vehicle_bumblebee_health; + instance.vehicle_shield = autocvar_g_vehicle_bumblebee_shield; + instance.solid = SOLID_BBOX; + instance.movetype = MOVETYPE_TOSS; + instance.damageforcescale = 0.025; - self.PlayerPhysplug = bumblebee_pilot_frame; + instance.PlayerPhysplug = bumblebee_pilot_frame; - setorigin(self, self.origin + '0 0 25'); + setorigin(instance, instance.origin + '0 0 25'); } METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance)) { @@ -956,7 +952,7 @@ METHOD(Bumblebee, vr_hud, void(Bumblebee thisveh)) drawstring(tmpPos, _("No left gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL); } } -METHOD(Bumblebee, vr_crosshair, void(Bumblebee thisveh)) +METHOD(Bumblebee, vr_crosshair, void(Bumblebee thisveh, entity player)) { Vehicles_drawCrosshair(vCROSS_HEAL); } diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qh b/qcsrc/common/vehicles/vehicle/bumblebee.qh index 37dfaef1d..7a9fc2ccb 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qh +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qh @@ -7,7 +7,7 @@ void CSQC_BUMBLE_GUN_HUD(); #endif #ifdef SVQC -float raptor_altitude(float amax); +float raptor_altitude(entity this, float amax); #endif #endif diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index bcbe5be70..24a0682d9 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -433,90 +433,90 @@ void racer_think(entity this) CSQCMODEL_AUTOUPDATE(this); } -void racer_exit(float eject) -{SELFPARAM(); +void racer_exit(entity this, int eject) +{ vector spot; - setthink(self, racer_think); - self.nextthink = time; - self.movetype = MOVETYPE_BOUNCE; - sound (self.tur_head, CH_TRIGGER_SINGLE, SND_Null, VOL_VEHICLEENGINE, ATTEN_NORM); + setthink(this, racer_think); + this.nextthink = time; + this.movetype = MOVETYPE_BOUNCE; + sound (this.tur_head, CH_TRIGGER_SINGLE, SND_Null, VOL_VEHICLEENGINE, ATTEN_NORM); - if(!self.owner) + if(!this.owner) return; - makevectors(self.angles); + makevectors(this.angles); if(eject) { - spot = self.origin + v_forward * 100 + '0 0 64'; - spot = vehicles_findgoodexit(spot); - setorigin(self.owner , spot); - self.owner.velocity = (v_up + v_forward * 0.25) * 750; - self.owner.oldvelocity = self.owner.velocity; + 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; } else { - if(vdist(self.velocity, >, 2 * autocvar_sv_maxairspeed)) + if(vdist(this.velocity, >, 2 * autocvar_sv_maxairspeed)) { - self.owner.velocity = normalize(self.velocity) * autocvar_sv_maxairspeed * 2; - self.owner.velocity_z += 200; - spot = self.origin + v_forward * 32 + '0 0 32'; - spot = vehicles_findgoodexit(spot); + this.owner.velocity = normalize(this.velocity) * autocvar_sv_maxairspeed * 2; + this.owner.velocity_z += 200; + spot = this.origin + v_forward * 32 + '0 0 32'; + spot = vehicles_findgoodexit(this, spot); } else { - self.owner.velocity = self.velocity * 0.5; - self.owner.velocity_z += 10; - spot = self.origin - v_forward * 200 + '0 0 32'; - spot = vehicles_findgoodexit(spot); + this.owner.velocity = this.velocity * 0.5; + this.owner.velocity_z += 10; + spot = this.origin - v_forward * 200 + '0 0 32'; + spot = vehicles_findgoodexit(this, spot); } - self.owner.oldvelocity = self.owner.velocity; - setorigin(self.owner , spot); + this.owner.oldvelocity = this.owner.velocity; + setorigin(this.owner , spot); } - antilag_clear(self.owner, CS(self.owner)); - self.owner = world; + antilag_clear(this.owner, CS(this.owner)); + this.owner = world; } -void racer_blowup() -{SELFPARAM(); - self.deadflag = DEAD_DEAD; - self.vehicle_exit(VHEF_NORMAL); +void racer_blowup(entity this) +{ + this.deadflag = DEAD_DEAD; + this.vehicle_exit(this, VHEF_NORMAL); - RadiusDamage (self, self.enemy, autocvar_g_vehicle_racer_blowup_coredamage, + RadiusDamage (this, this.enemy, autocvar_g_vehicle_racer_blowup_coredamage, autocvar_g_vehicle_racer_blowup_edgedamage, autocvar_g_vehicle_racer_blowup_radius, world, world, autocvar_g_vehicle_racer_blowup_forceintensity, DEATH_VH_WAKI_DEATH.m_id, world); - self.nextthink = time + autocvar_g_vehicle_racer_respawntime; - setthink(self, vehicles_spawn); - self.movetype = MOVETYPE_NONE; - self.effects = EF_NODRAW; - self.solid = SOLID_NOT; + this.nextthink = time + autocvar_g_vehicle_racer_respawntime; + setthink(this, vehicles_spawn); + this.movetype = MOVETYPE_NONE; + this.effects = EF_NODRAW; + this.solid = SOLID_NOT; - self.colormod = '0 0 0'; - self.avelocity = '0 0 0'; - self.velocity = '0 0 0'; + this.colormod = '0 0 0'; + this.avelocity = '0 0 0'; + this.velocity = '0 0 0'; - setorigin(self, self.pos1); + setorigin(this, this.pos1); } void racer_blowup_think(entity this) { - self.nextthink = time; + this.nextthink = time; - if(time >= self.delay) - racer_blowup(); + if(time >= this.delay) + racer_blowup(this); - CSQCMODEL_AUTOUPDATE(self); + CSQCMODEL_AUTOUPDATE(this); } void racer_deadtouch(entity this) { - self.avelocity_x *= 0.7; - self.cnt -= 1; - if(self.cnt <= 0) - racer_blowup(); + this.avelocity_x *= 0.7; + this.cnt -= 1; + if(this.cnt <= 0) + racer_blowup(this); } spawnfunc(vehicle_racer) @@ -529,35 +529,35 @@ spawnfunc(vehicle_racer) #ifdef CSQC #if 0 -void racer_draw() -{SELFPARAM(); - float pushdeltatime = time - self.lastpushtime; +void racer_draw(entity this) +{ + float pushdeltatime = time - this.lastpushtime; if (pushdeltatime > 0.15) pushdeltatime = 0; - self.lastpushtime = time; + this.lastpushtime = time; if(!pushdeltatime) return; - tracebox(self.move_origin, self.mins, self.maxs, self.move_origin - ('0 0 1' * STAT(VEH_RACER_SPRINGLENGTH)), MOVE_NOMONSTERS, self); + tracebox(this.move_origin, this.mins, this.maxs, this.move_origin - ('0 0 1' * STAT(VEH_RACER_SPRINGLENGTH)), MOVE_NOMONSTERS, this); - vector df = self.move_velocity * -STAT(VEH_RACER_FRICTION); + vector df = this.move_velocity * -STAT(VEH_RACER_FRICTION); df_z += (1 - trace_fraction) * STAT(VEH_RACER_HOVERPOWER) + sin(time * 2) * (STAT(VEH_RACER_SPRINGLENGTH) * 2); float forced = STAT(VEH_RACER_UPFORCEDAMPER); - int cont = pointcontents(self.move_origin - '0 0 64'); + int cont = pointcontents(this.move_origin - '0 0 64'); if(cont == CONTENT_WATER || cont == CONTENT_LAVA || cont == CONTENT_SLIME) { forced = STAT(VEH_RACER_WATER_UPFORCEDAMPER); - self.move_velocity_z += 200; + this.move_velocity_z += 200; } - self.move_velocity += df * pushdeltatime; - if(self.move_velocity_z > 0) - self.move_velocity_z *= 1 - forced * pushdeltatime; + this.move_velocity += df * pushdeltatime; + if(this.move_velocity_z > 0) + this.move_velocity_z *= 1 - forced * pushdeltatime; - self.move_angles_x *= 1 - (STAT(VEH_RACER_ANGLESTABILIZER) * pushdeltatime); - self.move_angles_z *= 1 - (STAT(VEH_RACER_ANGLESTABILIZER) * pushdeltatime); + this.move_angles_x *= 1 - (STAT(VEH_RACER_ANGLESTABILIZER) * pushdeltatime); + this.move_angles_z *= 1 - (STAT(VEH_RACER_ANGLESTABILIZER) * pushdeltatime); - Movetype_Physics_MatchServer(false); + Movetype_Physics_MatchServer(this, false); } #endif #endif @@ -573,24 +573,21 @@ METHOD(Racer, vr_impact, void(Racer thisveh, entity instance)) METHOD(Racer, vr_enter, void(Racer thisveh, entity instance)) { #ifdef SVQC - SELFPARAM(); - self.movetype = MOVETYPE_BOUNCE; - self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_racer_health) * 100; - self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_racer_shield) * 100; + instance.movetype = MOVETYPE_BOUNCE; + instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_racer_health) * 100; + instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_racer_shield) * 100; - if(self.owner.flagcarried) - setorigin(self.owner.flagcarried, '-190 0 96'); + if(instance.owner.flagcarried) + setorigin(instance.owner.flagcarried, '-190 0 96'); #elif defined(CSQC) - SELFPARAM(); - self.move_movetype = MOVETYPE_BOUNCE; + instance.move_movetype = MOVETYPE_BOUNCE; #endif } METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance)) { #ifdef SVQC - SELFPARAM(); - if(self.scale != 0.5) + if(instance.scale != 0.5) { if(autocvar_g_vehicle_racer_hovertype != 0) racer_force_from_tag = vehicles_force_fromtag_maglev; @@ -598,30 +595,30 @@ METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance)) racer_force_from_tag = vehicles_force_fromtag_hover; // FIXME: this be hakkz, fix the models insted (scale body, add tag_viewport to the hudmodel). - self.scale = 0.5; - setattachment(self.vehicle_hudmodel, self, ""); - setattachment(self.vehicle_viewport, self, "tag_viewport"); + instance.scale = 0.5; + setattachment(instance.vehicle_hudmodel, instance, ""); + setattachment(instance.vehicle_viewport, instance, "tag_viewport"); - self.mass = 900; + instance.mass = 900; } - setthink(self, racer_think); - self.nextthink = time; - self.vehicle_health = autocvar_g_vehicle_racer_health; - self.vehicle_shield = autocvar_g_vehicle_racer_shield; + setthink(instance, racer_think); + instance.nextthink = time; + instance.vehicle_health = autocvar_g_vehicle_racer_health; + instance.vehicle_shield = autocvar_g_vehicle_racer_shield; - self.movetype = MOVETYPE_TOSS; - self.solid = SOLID_SLIDEBOX; - self.delay = time; - self.scale = 0.5; + instance.movetype = MOVETYPE_TOSS; + instance.solid = SOLID_SLIDEBOX; + instance.delay = time; + instance.scale = 0.5; - self.PlayerPhysplug = racer_frame; + instance.PlayerPhysplug = racer_frame; - self.bouncefactor = autocvar_g_vehicle_racer_bouncefactor; - self.bouncestop = autocvar_g_vehicle_racer_bouncestop; - self.damageforcescale = 0.5; - self.vehicle_health = autocvar_g_vehicle_racer_health; - self.vehicle_shield = autocvar_g_vehicle_racer_shield; + instance.bouncefactor = autocvar_g_vehicle_racer_bouncefactor; + instance.bouncestop = autocvar_g_vehicle_racer_bouncestop; + instance.damageforcescale = 0.5; + instance.vehicle_health = autocvar_g_vehicle_racer_health; + instance.vehicle_shield = autocvar_g_vehicle_racer_shield; #endif } @@ -663,7 +660,7 @@ METHOD(Racer, vr_hud, void(Racer thisveh)) "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color, "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color); } -METHOD(Racer, vr_crosshair, void(Racer thisveh)) +METHOD(Racer, vr_crosshair, void(Racer thisveh, entity player)) { Vehicles_drawCrosshair(vCROSS_GUIDE); } diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 3a2401989..b0c8863df 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -77,85 +77,85 @@ vector autocvar_g_vehicle_raptor_bouncepain = '1 4 1000'; .entity bomb1; .entity bomb2; -float raptor_altitude(float amax) -{SELFPARAM(); - tracebox(self.origin, self.mins, self.maxs, self.origin - ('0 0 1' * amax), MOVE_WORLDONLY, self); - return vlen(self.origin - trace_endpos); +float raptor_altitude(entity this, float amax) +{ + tracebox(this.origin, this.mins, this.maxs, this.origin - ('0 0 1' * amax), MOVE_WORLDONLY, this); + return vlen(this.origin - trace_endpos); } void raptor_land(entity this) { float hgt; - hgt = raptor_altitude(512); - self.velocity = (self.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime); - self.angles_x *= 0.95; - self.angles_z *= 0.95; + hgt = raptor_altitude(this, 512); + this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * sys_frametime); + this.angles_x *= 0.95; + this.angles_z *= 0.95; if(hgt < 128) if(hgt > 0) - self.frame = (hgt / 128) * 25; + this.frame = (hgt / 128) * 25; - self.bomb1.gun1.avelocity_y = 90 + ((self.frame / 25) * 2000); - self.bomb1.gun2.avelocity_y = -self.bomb1.gun1.avelocity_y; + this.bomb1.gun1.avelocity_y = 90 + ((this.frame / 25) * 2000); + this.bomb1.gun2.avelocity_y = -this.bomb1.gun1.avelocity_y; if(hgt < 16) { - self.movetype = MOVETYPE_TOSS; - setthink(self, vehicles_think); - self.frame = 0; + this.movetype = MOVETYPE_TOSS; + setthink(this, vehicles_think); + this.frame = 0; } - self.nextthink = time; + this.nextthink = time; - CSQCMODEL_AUTOUPDATE(self); + CSQCMODEL_AUTOUPDATE(this); } -void raptor_exit(float eject) -{SELFPARAM(); +void raptor_exit(entity this, int eject) +{ vector spot; - self.tur_head.exteriormodeltoclient = world; + this.tur_head.exteriormodeltoclient = world; - if(!IS_DEAD(self)) + if(!IS_DEAD(this)) { - setthink(self, raptor_land); - self.nextthink = time; + setthink(this, raptor_land); + this.nextthink = time; } - if(!self.owner) + if(!this.owner) return; - makevectors(self.angles); + makevectors(this.angles); if(eject) { - spot = self.origin + v_forward * 100 + '0 0 64'; - spot = vehicles_findgoodexit(spot); - setorigin(self.owner , spot); - self.owner.velocity = (v_up + v_forward * 0.25) * 750; - self.owner.oldvelocity = self.owner.velocity; + 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; } else { - if(vdist(self.velocity, >, 2 * autocvar_sv_maxairspeed)) + if(vdist(this.velocity, >, 2 * autocvar_sv_maxairspeed)) { - self.owner.velocity = normalize(self.velocity) * autocvar_sv_maxairspeed * 2; - self.owner.velocity_z += 200; - spot = self.origin + v_forward * 32 + '0 0 64'; - spot = vehicles_findgoodexit(spot); + this.owner.velocity = normalize(this.velocity) * autocvar_sv_maxairspeed * 2; + this.owner.velocity_z += 200; + spot = this.origin + v_forward * 32 + '0 0 64'; + spot = vehicles_findgoodexit(this, spot); } else { - self.owner.velocity = self.velocity * 0.5; - self.owner.velocity_z += 10; - spot = self.origin - v_forward * 200 + '0 0 64'; - spot = vehicles_findgoodexit(spot); + this.owner.velocity = this.velocity * 0.5; + this.owner.velocity_z += 10; + spot = this.origin - v_forward * 200 + '0 0 64'; + spot = vehicles_findgoodexit(this, spot); } - self.owner.oldvelocity = self.owner.velocity; - setorigin(self.owner , spot); + this.owner.oldvelocity = this.owner.velocity; + setorigin(this.owner , spot); } - antilag_clear(self.owner, CS(self.owner)); - self.owner = world; + antilag_clear(this.owner, CS(this.owner)); + this.owner = world; } bool raptor_frame(entity this) @@ -522,20 +522,20 @@ bool raptor_takeoff(entity this) void raptor_blowup(entity this) { - self.deadflag = DEAD_DEAD; - self.vehicle_exit(VHEF_NORMAL); - RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_RAPT_DEATH.m_id, world); - - self.alpha = -1; - self.movetype = MOVETYPE_NONE; - self.effects = EF_NODRAW; - self.colormod = '0 0 0'; - self.avelocity = '0 0 0'; - self.velocity = '0 0 0'; - - setorigin(self, self.pos1); - settouch(self, func_null); - self.nextthink = 0; + this.deadflag = DEAD_DEAD; + this.vehicle_exit(this, VHEF_NORMAL); + RadiusDamage (this, this.enemy, 250, 15, 250, world, world, 250, DEATH_VH_RAPT_DEATH.m_id, world); + + this.alpha = -1; + this.movetype = MOVETYPE_NONE; + this.effects = EF_NODRAW; + this.colormod = '0 0 0'; + this.avelocity = '0 0 0'; + this.velocity = '0 0 0'; + + setorigin(this, this.pos1); + settouch(this, func_null); + this.nextthink = 0; } void raptor_diethink(entity this) @@ -562,37 +562,37 @@ void raptor_rotor_anglefix(entity this) self.nextthink = time + 15; } -float raptor_impulse(float _imp) -{SELFPARAM(); +bool raptor_impulse(entity this, int _imp) +{ switch(_imp) { case IMP_weapon_group_1.impulse: - self.vehicle.vehicle_weapon2mode = RSM_BOMB; - CSQCVehicleSetup(self, 0); + this.vehicle.vehicle_weapon2mode = RSM_BOMB; + CSQCVehicleSetup(this, 0); return true; case IMP_weapon_group_2.impulse: - self.vehicle.vehicle_weapon2mode = RSM_FLARE; - CSQCVehicleSetup(self, 0); + this.vehicle.vehicle_weapon2mode = 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: - self.vehicle.vehicle_weapon2mode += 1; - if(self.vehicle.vehicle_weapon2mode > RSM_LAST) - self.vehicle.vehicle_weapon2mode = RSM_FIRST; + this.vehicle.vehicle_weapon2mode += 1; + if(this.vehicle.vehicle_weapon2mode > RSM_LAST) + this.vehicle.vehicle_weapon2mode = RSM_FIRST; - CSQCVehicleSetup(self, 0); + CSQCVehicleSetup(this, 0); return true; case IMP_weapon_last.impulse: case IMP_weapon_prev_byid.impulse: case IMP_weapon_prev_bypriority.impulse: case IMP_weapon_prev_bygroup.impulse: - self.vehicle.vehicle_weapon2mode -= 1; - if(self.vehicle.vehicle_weapon2mode < RSM_FIRST) - self.vehicle.vehicle_weapon2mode = RSM_LAST; + this.vehicle.vehicle_weapon2mode -= 1; + if(this.vehicle.vehicle_weapon2mode < RSM_FIRST) + this.vehicle.vehicle_weapon2mode = RSM_LAST; - CSQCVehicleSetup(self, 0); + CSQCVehicleSetup(this, 0); return true; /* @@ -618,23 +618,22 @@ METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance)) } METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance)) { - SELFPARAM(); - self.vehicle_weapon2mode = RSM_BOMB; - self.owner.PlayerPhysplug = raptor_takeoff; - self.movetype = MOVETYPE_BOUNCEMISSILE; - self.solid = SOLID_SLIDEBOX; - self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_raptor_health) * 100; - self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100; - self.velocity_z = 1; // Nudge upwards to takeoff sequense can work. - self.tur_head.exteriormodeltoclient = self.owner; - - self.delay = time + autocvar_g_vehicle_raptor_bombs_refire; - self.lip = time; - - if(self.owner.flagcarried) - setorigin(self.owner.flagcarried, '-20 0 96'); - - CSQCVehicleSetup(self.owner, 0); + instance.vehicle_weapon2mode = RSM_BOMB; + instance.owner.PlayerPhysplug = raptor_takeoff; + instance.movetype = MOVETYPE_BOUNCEMISSILE; + instance.solid = SOLID_SLIDEBOX; + instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_raptor_health) * 100; + instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_raptor_shield) * 100; + instance.velocity_z = 1; // Nudge upwards to takeoff sequense can work. + instance.tur_head.exteriormodeltoclient = instance.owner; + + instance.delay = time + autocvar_g_vehicle_raptor_bombs_refire; + instance.lip = time; + + if(instance.owner.flagcarried) + setorigin(instance.owner.flagcarried, '-20 0 96'); + + CSQCVehicleSetup(instance.owner, 0); } METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance)) { @@ -660,95 +659,94 @@ METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance)) } METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance)) { - SELFPARAM(); - if(!self.gun1) + if(!instance.gun1) { entity spinner; vector ofs; //FIXME: Camera is in a bad place in HUD model. - //setorigin(self.vehicle_viewport, '25 0 5'); + //setorigin(instance.vehicle_viewport, '25 0 5'); - self.vehicles_impulse = raptor_impulse; + instance.vehicles_impulse = raptor_impulse; - self.frame = 0; + instance.frame = 0; - self.bomb1 = new(raptor_bomb); - self.bomb2 = new(raptor_bomb); - self.gun1 = new(raptor_gun); - self.gun2 = new(raptor_gun); + instance.bomb1 = new(raptor_bomb); + instance.bomb2 = new(raptor_bomb); + instance.gun1 = new(raptor_gun); + instance.gun2 = new(raptor_gun); - setmodel(self.bomb1, MDL_VEH_RAPTOR_CB_FOLDED); - setmodel(self.bomb2, MDL_VEH_RAPTOR_CB_FOLDED); - setmodel(self.gun1, MDL_VEH_RAPTOR_GUN); - setmodel(self.gun2, MDL_VEH_RAPTOR_GUN); - setmodel(self.tur_head, MDL_VEH_RAPTOR_TAIL); + setmodel(instance.bomb1, MDL_VEH_RAPTOR_CB_FOLDED); + setmodel(instance.bomb2, MDL_VEH_RAPTOR_CB_FOLDED); + setmodel(instance.gun1, MDL_VEH_RAPTOR_GUN); + setmodel(instance.gun2, MDL_VEH_RAPTOR_GUN); + setmodel(instance.tur_head, MDL_VEH_RAPTOR_TAIL); - setattachment(self.bomb1, self, "bombmount_left"); - setattachment(self.bomb2, self, "bombmount_right"); - setattachment(self.tur_head, self,"root"); + setattachment(instance.bomb1, instance, "bombmount_left"); + setattachment(instance.bomb2, instance, "bombmount_right"); + setattachment(instance.tur_head, instance,"root"); // FIXMODEL Guns mounts to angled bones - self.bomb1.angles = self.angles; - self.angles = '0 0 0'; + instance.bomb1.angles = instance.angles; + instance.angles = '0 0 0'; // This messes up gun-aim, so work arround it. - //setattachment(self.gun1, self, "gunmount_left"); - ofs = gettaginfo(self, gettagindex(self, "gunmount_left")); - ofs -= self.origin; - setattachment(self.gun1, self, ""); - setorigin(self.gun1, ofs); + //setattachment(instance.gun1, instance, "gunmount_left"); + ofs = gettaginfo(instance, gettagindex(instance, "gunmount_left")); + ofs -= instance.origin; + setattachment(instance.gun1, instance, ""); + setorigin(instance.gun1, ofs); - //setattachment(self.gun2, self, "gunmount_right"); - ofs = gettaginfo(self, gettagindex(self, "gunmount_right")); - ofs -= self.origin; - setattachment(self.gun2, self, ""); - setorigin(self.gun2, ofs); + //setattachment(instance.gun2, instance, "gunmount_right"); + ofs = gettaginfo(instance, gettagindex(instance, "gunmount_right")); + ofs -= instance.origin; + setattachment(instance.gun2, instance, ""); + setorigin(instance.gun2, ofs); - self.angles = self.bomb1.angles; - self.bomb1.angles = '0 0 0'; + instance.angles = instance.bomb1.angles; + instance.bomb1.angles = '0 0 0'; spinner = new(raptor_spinner); - spinner.owner = self; + spinner.owner = instance; setmodel(spinner, MDL_VEH_RAPTOR_PROP); - setattachment(spinner, self, "engine_left"); + setattachment(spinner, instance, "engine_left"); spinner.movetype = MOVETYPE_NOCLIP; spinner.avelocity = '0 90 0'; - self.bomb1.gun1 = spinner; + instance.bomb1.gun1 = spinner; spinner = new(raptor_spinner); - spinner.owner = self; + spinner.owner = instance; setmodel(spinner, MDL_VEH_RAPTOR_PROP); - setattachment(spinner, self, "engine_right"); + setattachment(spinner, instance, "engine_right"); spinner.movetype = MOVETYPE_NOCLIP; spinner.avelocity = '0 -90 0'; - self.bomb1.gun2 = spinner; + instance.bomb1.gun2 = spinner; // Sigh. - setthink(self.bomb1, raptor_rotor_anglefix); - self.bomb1.nextthink = time; + setthink(instance.bomb1, raptor_rotor_anglefix); + instance.bomb1.nextthink = time; - self.mass = 1 ; + instance.mass = 1 ; } - self.frame = 0; - self.vehicle_health = autocvar_g_vehicle_raptor_health; - self.vehicle_shield = autocvar_g_vehicle_raptor_shield; - self.movetype = MOVETYPE_TOSS; - self.solid = SOLID_SLIDEBOX; - self.vehicle_energy = 1; + instance.frame = 0; + instance.vehicle_health = autocvar_g_vehicle_raptor_health; + instance.vehicle_shield = autocvar_g_vehicle_raptor_shield; + instance.movetype = MOVETYPE_TOSS; + instance.solid = SOLID_SLIDEBOX; + instance.vehicle_energy = 1; - self.PlayerPhysplug = raptor_frame; + instance.PlayerPhysplug = raptor_frame; - self.bomb1.gun1.avelocity_y = 90; - self.bomb1.gun2.avelocity_y = -90; + instance.bomb1.gun1.avelocity_y = 90; + instance.bomb1.gun2.avelocity_y = -90; - self.delay = time; + instance.delay = time; - self.bouncefactor = autocvar_g_vehicle_raptor_bouncefactor; - self.bouncestop = autocvar_g_vehicle_raptor_bouncestop; - self.damageforcescale = 0.25; - self.vehicle_health = autocvar_g_vehicle_raptor_health; - self.vehicle_shield = autocvar_g_vehicle_raptor_shield; + 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; + instance.vehicle_shield = autocvar_g_vehicle_raptor_shield; } METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance)) { @@ -780,9 +778,8 @@ METHOD(Raptor, vr_hud, void(Raptor thisveh)) "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color, "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color); } -METHOD(Raptor, vr_crosshair, void(Raptor thisveh)) +METHOD(Raptor, vr_crosshair, void(Raptor thisveh, entity player)) { - SELFPARAM(); string crosshair; switch(weapon2mode) @@ -800,7 +797,7 @@ METHOD(Raptor, vr_crosshair, void(Raptor thisveh)) if(!dropmark) { dropmark = spawn(); - dropmark.owner = self; + dropmark.owner = player; dropmark.gravity = 1; } @@ -809,7 +806,7 @@ METHOD(Raptor, vr_crosshair, void(Raptor thisveh)) { setorigin(dropmark, pmove_org); dropmark.velocity = pmove_vel; - tracetoss(dropmark, self); + tracetoss(dropmark, player); where = project_3d_to_2d(trace_endpos); diff --git a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc index fc439734c..1aca46381 100644 --- a/qcsrc/common/vehicles/vehicle/raptor_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/raptor_weapons.qc @@ -38,7 +38,7 @@ METHOD(RaptorCannon, wr_checkammo1, bool(RacerAttack thiswep, entity actor)) { } -void raptor_bombdrop(); +void raptor_bombdrop(entity this); METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, .entity weaponentity, int fire)) { bool isPlayer = IS_PLAYER(actor); entity player = isPlayer ? actor : actor.owner; @@ -46,7 +46,7 @@ METHOD(RaptorBomb, wr_think, void(entity thiswep, entity actor, .entity weaponen if (fire & 2) if (!isPlayer || weapon_prepareattack(thiswep, player, weaponentity, true, autocvar_g_vehicle_raptor_bombs_refire)) { entity e = (veh) ? veh : player; - WITHSELF(e, raptor_bombdrop()); + raptor_bombdrop(e); weapon_thinkf(player, weaponentity, WFRAME_FIRE2, 0, w_ready); } } @@ -143,20 +143,20 @@ void raptor_bomb_burst(entity this) remove(self); } -void raptor_bombdrop() -{SELFPARAM(); +void raptor_bombdrop(entity this) +{ entity bomb_1, bomb_2; bomb_1 = spawn(); bomb_2 = spawn(); - vector org = gettaginfo(self, gettagindex(self, "bombmount_left")); + vector org = gettaginfo(this, gettagindex(this, "bombmount_left")); setorigin(bomb_1, org); - org = gettaginfo(self, gettagindex(self, "bombmount_right")); + org = gettaginfo(this, gettagindex(this, "bombmount_right")); setorigin(bomb_2, org); bomb_1.movetype = bomb_2.movetype = MOVETYPE_BOUNCE; - bomb_1.velocity = bomb_2.velocity = self.velocity; + bomb_1.velocity = bomb_2.velocity = this.velocity; settouch(bomb_1, raptor_bomb_burst); settouch(bomb_2, raptor_bomb_burst); setthink(bomb_1, raptor_bomb_burst); @@ -168,8 +168,8 @@ void raptor_bombdrop() else bomb_1.nextthink = bomb_2.nextthink = time + autocvar_g_vehicle_raptor_bomblet_time; - bomb_1.owner = bomb_2.owner = self; - bomb_1.realowner = bomb_2.realowner = self.owner; + bomb_1.owner = bomb_2.owner = this; + bomb_1.realowner = bomb_2.realowner = this.owner; bomb_1.solid = bomb_2.solid = SOLID_BBOX; bomb_1.gravity = bomb_2.gravity = 1; @@ -182,7 +182,7 @@ void raptor_bombdrop() void raptor_flare_touch(entity this) { - remove(self); + remove(this); } void raptor_flare_damage(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) @@ -230,10 +230,8 @@ void RaptorCBShellfragDraw(entity this) } void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang) -{SELFPARAM(); - entity sfrag; - - sfrag = spawn(); +{ + entity sfrag = spawn(); setmodel(sfrag, MDL_VEH_RAPTOR_CB_FRAGMENT); setorigin(sfrag, _org); @@ -246,7 +244,7 @@ void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang) sfrag.move_origin = sfrag.origin = _org; sfrag.move_velocity = _vel; sfrag.move_avelocity = prandomvec() * vlen(sfrag.move_velocity); - sfrag.angles = self.move_angles = _ang; + sfrag.angles = sfrag.move_angles = _ang; sfrag.move_time = time; sfrag.damageforcescale = 4; diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index 1b2758739..8c7c4f7fd 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -335,90 +335,90 @@ bool spiderbot_frame(entity this) VEHICLE_UPDATE_PLAYER(this, vehic, shield, spiderbot); } -void spiderbot_exit(float eject) -{SELFPARAM(); +void spiderbot_exit(entity this, int eject) +{ entity e; vector spot; e = findchain(classname,"spiderbot_rocket"); while(e) { - if(e.owner == self.owner) + if(e.owner == this.owner) { - e.realowner = self.owner; + e.realowner = this.owner; e.owner = world; } e = e.chain; } - setthink(self, vehicles_think); - self.nextthink = time; - self.frame = 5; - self.movetype = MOVETYPE_WALK; + setthink(this, vehicles_think); + this.nextthink = time; + this.frame = 5; + this.movetype = MOVETYPE_WALK; - if(!self.owner) + if(!this.owner) return; - makevectors(self.angles); + makevectors(this.angles); if(eject) { - spot = self.origin + v_forward * 100 + '0 0 64'; - spot = vehicles_findgoodexit(spot); - setorigin(self.owner , spot); - self.owner.velocity = (v_up + v_forward * 0.25) * 750; - self.owner.oldvelocity = self.owner.velocity; + 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; } else { - if(vdist(self.velocity, >, autocvar_g_vehicle_spiderbot_speed_strafe)) + if(vdist(this.velocity, >, autocvar_g_vehicle_spiderbot_speed_strafe)) { - self.owner.velocity = normalize(self.velocity) * vlen(self.velocity); - self.owner.velocity_z += 200; - spot = self.origin + v_forward * 128 + '0 0 64'; - spot = vehicles_findgoodexit(spot); + this.owner.velocity = normalize(this.velocity) * vlen(this.velocity); + this.owner.velocity_z += 200; + spot = this.origin + v_forward * 128 + '0 0 64'; + spot = vehicles_findgoodexit(this, spot); } else { - self.owner.velocity = self.velocity * 0.5; - self.owner.velocity_z += 10; - spot = self.origin + v_forward * 256 + '0 0 64'; - spot = vehicles_findgoodexit(spot); + this.owner.velocity = this.velocity * 0.5; + this.owner.velocity_z += 10; + spot = this.origin + v_forward * 256 + '0 0 64'; + spot = vehicles_findgoodexit(this, spot); } - self.owner.oldvelocity = self.owner.velocity; - setorigin(self.owner , spot); + this.owner.oldvelocity = this.owner.velocity; + setorigin(this.owner , spot); } - antilag_clear(self.owner, CS(self.owner)); - self.owner = world; + antilag_clear(this.owner, CS(this.owner)); + this.owner = world; } void spiderbot_headfade(entity this) { - setthink(self, spiderbot_headfade); - self.nextthink = self.fade_time; - self.alpha = 1 - (time - self.fade_time) * self.fade_rate; + setthink(this, spiderbot_headfade); + this.nextthink = this.fade_time; + this.alpha = 1 - (time - this.fade_time) * this.fade_rate; - if(self.cnt < time || self.alpha < 0.1) + if(this.cnt < time || this.alpha < 0.1) { - if(self.alpha > 0.1) + if(this.alpha > 0.1) { - sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); - Send_Effect(EFFECT_EXPLOSION_BIG, self.origin + '0 0 100', '0 0 0', 1); + sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); + Send_Effect(EFFECT_EXPLOSION_BIG, this.origin + '0 0 100', '0 0 0', 1); } - remove(self); + remove(this); } } void spiderbot_blowup(entity this) { - if(self.cnt > time) + if(this.cnt > time) { if(random() < 0.1) { - sound (self, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); - Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1); + sound (this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM); + Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1); } - self.nextthink = time + 0.1; + this.nextthink = time + 0.1; return; } @@ -433,12 +433,12 @@ void spiderbot_blowup(entity this) setmodel(g1, MDL_VEH_SPIDERBOT_GUN); setmodel(g2, MDL_VEH_SPIDERBOT_GUN); - setorigin(b, self.origin); + setorigin(b, this.origin); b.frame = 11; - b.angles = self.angles; - setsize(b, self.mins, self.maxs); + b.angles = this.angles; + setsize(b, this.mins, this.maxs); - vector org = gettaginfo(self, gettagindex(self, "tag_head")); + vector org = gettaginfo(this, gettagindex(this, "tag_head")); setorigin(h, org); h.movetype = MOVETYPE_BOUNCE; h.solid = SOLID_BBOX; @@ -449,19 +449,19 @@ void spiderbot_blowup(entity this) h.alpha = 1; h.cnt = time + (3.5 * random()); - h.fade_rate = 1 / min(self.respawntime, 10); + h.fade_rate = 1 / min(this.respawntime, 10); h.fade_time = time; setthink(h, spiderbot_headfade); h.nextthink = time; - org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint01")); + org = gettaginfo(this.tur_head, gettagindex(this.tur_head, "tag_hardpoint01")); setorigin(g1, org); g1.movetype = MOVETYPE_TOSS; g1.solid = SOLID_CORPSE; g1.velocity = v_forward * 700 + (randomvec() * 32); g1.avelocity = randomvec() * 180; - org = gettaginfo(self.tur_head, gettagindex(self.tur_head, "tag_hardpoint02")); + org = gettaginfo(this.tur_head, gettagindex(this.tur_head, "tag_hardpoint02")); setorigin(g2, org); g2.movetype = MOVETYPE_TOSS; g2.solid = SOLID_CORPSE; @@ -470,58 +470,58 @@ void spiderbot_blowup(entity this) h.colormod = b.colormod = g1.colormod = g2.colormod = '-2 -2 -2'; - SUB_SetFade(b, time + 5, min(self.respawntime, 1)); - //SUB_SetFade(h, time, min(self.respawntime, 10)); - SUB_SetFade(g1, time, min(self.respawntime, 10)); - SUB_SetFade(g2, time, min(self.respawntime, 10)); + SUB_SetFade(b, time + 5, min(this.respawntime, 1)); + //SUB_SetFade(h, time, min(this.respawntime, 10)); + SUB_SetFade(g1, time, min(this.respawntime, 10)); + SUB_SetFade(g2, time, min(this.respawntime, 10)); - RadiusDamage (self, self.enemy, 250, 15, 250, world, world, 250, DEATH_VH_SPID_DEATH.m_id, world); + RadiusDamage (this, this.enemy, 250, 15, 250, world, world, 250, DEATH_VH_SPID_DEATH.m_id, 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; + this.alpha = this.tur_head.alpha = this.gun1.alpha = this.gun2.alpha = -1; + this.movetype = MOVETYPE_NONE; + this.deadflag = DEAD_DEAD; + this.solid = SOLID_NOT; + this.tur_head.effects &= ~EF_FLAME; + this.vehicle_hudmodel.viewmodelforclient = this; } -bool spiderbot_impulse(int _imp) -{SELFPARAM(); +bool spiderbot_impulse(entity this, int _imp) +{ switch(_imp) { case IMP_weapon_group_1.impulse: - self.vehicle.vehicle_weapon2mode = SBRM_VOLLY; - CSQCVehicleSetup(self, 0); + this.vehicle.vehicle_weapon2mode = SBRM_VOLLY; + CSQCVehicleSetup(this, 0); return true; case IMP_weapon_group_2.impulse: - self.vehicle.vehicle_weapon2mode = SBRM_GUIDE; - CSQCVehicleSetup(self, 0); + this.vehicle.vehicle_weapon2mode = SBRM_GUIDE; + CSQCVehicleSetup(this, 0); return true; case IMP_weapon_group_3.impulse: - self.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY; - CSQCVehicleSetup(self, 0); + this.vehicle.vehicle_weapon2mode = SBRM_ARTILLERY; + CSQCVehicleSetup(this, 0); return true; case IMP_weapon_next_byid.impulse: case IMP_weapon_next_bypriority.impulse: case IMP_weapon_next_bygroup.impulse: - self.vehicle.vehicle_weapon2mode += 1; - if(self.vehicle.vehicle_weapon2mode > SBRM_LAST) - self.vehicle.vehicle_weapon2mode = SBRM_FIRST; + this.vehicle.vehicle_weapon2mode += 1; + if(this.vehicle.vehicle_weapon2mode > SBRM_LAST) + this.vehicle.vehicle_weapon2mode = SBRM_FIRST; - //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode))); - CSQCVehicleSetup(self, 0); + //centerprint(this, strcat("Rocket mode is ", ftos(this.vehicle.vehicle_weapon2mode))); + CSQCVehicleSetup(this, 0); return true; case IMP_weapon_last.impulse: case IMP_weapon_prev_byid.impulse: case IMP_weapon_prev_bypriority.impulse: case IMP_weapon_prev_bygroup.impulse: - self.vehicle.vehicle_weapon2mode -= 1; - if(self.vehicle.vehicle_weapon2mode < SBRM_FIRST) - self.vehicle.vehicle_weapon2mode = SBRM_LAST; + this.vehicle.vehicle_weapon2mode -= 1; + if(this.vehicle.vehicle_weapon2mode < SBRM_FIRST) + this.vehicle.vehicle_weapon2mode = SBRM_LAST; - //centerprint(self, strcat("Rocket mode is ", ftos(self.vehicle.vehicle_weapon2mode))); - CSQCVehicleSetup(self, 0); + //centerprint(this, strcat("Rocket mode is ", ftos(this.vehicle.vehicle_weapon2mode))); + CSQCVehicleSetup(this, 0); return true; /* @@ -547,24 +547,22 @@ METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance)) } METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance)) { - SELFPARAM(); - self.vehicle_weapon2mode = SBRM_GUIDE; - self.movetype = MOVETYPE_WALK; - CSQCVehicleSetup(self.owner, 0); - self.owner.vehicle_health = (self.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100; - self.owner.vehicle_shield = (self.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100; - - if(self.owner.flagcarried) + instance.vehicle_weapon2mode = SBRM_GUIDE; + instance.movetype = MOVETYPE_WALK; + CSQCVehicleSetup(instance.owner, 0); + instance.owner.vehicle_health = (instance.vehicle_health / autocvar_g_vehicle_spiderbot_health) * 100; + instance.owner.vehicle_shield = (instance.vehicle_shield / autocvar_g_vehicle_spiderbot_shield) * 100; + + if(instance.owner.flagcarried) { - setattachment(self.owner.flagcarried, self.tur_head, ""); - setorigin(self.owner.flagcarried, '-20 0 120'); + setattachment(instance.owner.flagcarried, instance.tur_head, ""); + setorigin(instance.owner.flagcarried, '-20 0 120'); } } METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance)) { - SELFPARAM(); - if(IS_ONGROUND(self)) - movelib_brake_simple(self, autocvar_g_vehicle_spiderbot_speed_stop); + if(IS_ONGROUND(instance)) + movelib_brake_simple(instance, autocvar_g_vehicle_spiderbot_speed_stop); } METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance)) { @@ -586,35 +584,34 @@ METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance)) } METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance)) { - SELFPARAM(); - if(!self.gun1) + if(!instance.gun1) { - self.vehicles_impulse = spiderbot_impulse; - self.gun1 = spawn(); - self.gun2 = spawn(); - setmodel(self.gun1, MDL_VEH_SPIDERBOT_GUN); - setmodel(self.gun2, MDL_VEH_SPIDERBOT_GUN); - setattachment(self.gun1, self.tur_head, "tag_hardpoint01"); - setattachment(self.gun2, self.tur_head, "tag_hardpoint02"); - self.gravity = 2; - self.mass = 5000; + instance.vehicles_impulse = spiderbot_impulse; + instance.gun1 = spawn(); + instance.gun2 = spawn(); + setmodel(instance.gun1, MDL_VEH_SPIDERBOT_GUN); + setmodel(instance.gun2, MDL_VEH_SPIDERBOT_GUN); + setattachment(instance.gun1, instance.tur_head, "tag_hardpoint01"); + setattachment(instance.gun2, instance.tur_head, "tag_hardpoint02"); + instance.gravity = 2; + instance.mass = 5000; } - self.frame = 5; - self.tur_head.frame = 1; - self.movetype = MOVETYPE_WALK; - self.solid = SOLID_SLIDEBOX; - self.alpha = self.tur_head.alpha = self.gun1.alpha = self.gun2.alpha = 1; - self.tur_head.angles = '0 0 0'; - self.vehicle_exit = spiderbot_exit; - - setorigin(self, self.pos1 + '0 0 128'); - self.angles = self.pos2; - self.damageforcescale = 0.03; - self.vehicle_health = autocvar_g_vehicle_spiderbot_health; - self.vehicle_shield = autocvar_g_vehicle_spiderbot_shield; - - self.PlayerPhysplug = spiderbot_frame; + instance.frame = 5; + instance.tur_head.frame = 1; + instance.movetype = MOVETYPE_WALK; + instance.solid = SOLID_SLIDEBOX; + instance.alpha = instance.tur_head.alpha = instance.gun1.alpha = instance.gun2.alpha = 1; + instance.tur_head.angles = '0 0 0'; + instance.vehicle_exit = spiderbot_exit; + + setorigin(instance, instance.pos1 + '0 0 128'); + instance.angles = instance.pos2; + instance.damageforcescale = 0.03; + instance.vehicle_health = autocvar_g_vehicle_spiderbot_health; + instance.vehicle_shield = autocvar_g_vehicle_spiderbot_shield; + + instance.PlayerPhysplug = spiderbot_frame; } METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance)) { @@ -645,7 +642,7 @@ METHOD(Spiderbot, vr_hud, void(Spiderbot thisveh)) "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color, "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color); } -METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh)) +METHOD(Spiderbot, vr_crosshair, void(Spiderbot thisveh, entity player)) { string crosshair; diff --git a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc index ae8c6c6f9..1c808b13e 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot_weapons.qc @@ -4,10 +4,10 @@ #ifdef SVQC -void spiderbot_rocket_artillery() -{SELFPARAM(); - self.nextthink = time; - UpdateCSQCProjectile(self); +void spiderbot_rocket_artillery(entity this) +{ + this.nextthink = time; + UpdateCSQCProjectile(this); } void spiderbot_rocket_unguided(entity this) @@ -234,7 +234,7 @@ void spiderbot_rocket_do(entity this) rocket.velocity = spiberbot_calcartillery(v, rocket.pos1, ((h1 < h2) ? h1 : h2)); rocket.movetype = MOVETYPE_TOSS; rocket.gravity = 1; - //rocket.think = spiderbot_rocket_artillery; + //setthink(rocket, spiderbot_rocket_artillery); break; } rocket.classname = "spiderbot_rocket"; diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index d826c2a35..e34c85ad8 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -234,7 +234,7 @@ void PutObserverInServer() this.alivetime = 0; } - if (this.vehicle) vehicles_exit(VHEF_RELEASE); + if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE); WaypointSprite_PlayerDead(this); @@ -789,7 +789,7 @@ void ClientKill_Now() {SELFPARAM(); if(this.vehicle) { - vehicles_exit(VHEF_RELEASE); + vehicles_exit(this.vehicle, VHEF_RELEASE); if(!this.killindicator_teamchange) { this.vehicle_health = -1; @@ -1182,7 +1182,7 @@ void ClientDisconnect() assert(IS_CLIENT(this), return); PlayerStats_GameReport_FinalizePlayer(this); - if (this.vehicle) vehicles_exit(VHEF_RELEASE); + if (this.vehicle) vehicles_exit(this.vehicle, VHEF_RELEASE); if (this.active_minigame) part_minigame(this); if (IS_PLAYER(this)) Send_Effect(EFFECT_SPAWN_NEUTRAL, this.origin, '0 0 0', 1); @@ -1523,7 +1523,7 @@ void player_regen () if(this.health < 1) { if(this.vehicle) - vehicles_exit(VHEF_RELEASE); + vehicles_exit(this.vehicle, VHEF_RELEASE); if(this.event_damage) this.event_damage(this, this, this, 1, DEATH_ROT.m_id, this.origin, '0 0 0'); } @@ -2015,7 +2015,7 @@ void PlayerUseKey() { if(!gameover) { - vehicles_exit(VHEF_NORMAL); + vehicles_exit(this.vehicle, VHEF_NORMAL); return; } } @@ -2145,7 +2145,7 @@ void PlayerPreThink () if (this.health < 1) { if (this.vehicle) - vehicles_exit(VHEF_RELEASE); + vehicles_exit(this.vehicle, VHEF_RELEASE); this.event_damage(this, this, this.frozen_by, 1, DEATH_NADE_ICE_FREEZE.m_id, this.origin, '0 0 0'); } else if (this.revive_progress <= 0) diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index adfd5ddd8..2deab23d7 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -612,7 +612,7 @@ void Damage (entity targ, entity inflictor, entity attacker, float damage, int d { // exit the vehicle before killing (fixes a crash) if(IS_PLAYER(targ) && targ.vehicle) - WITHSELF(targ, vehicles_exit(VHEF_RELEASE)); + vehicles_exit(targ.vehicle, VHEF_RELEASE); // These are ALWAYS lethal // No damage modification here diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index fa798be10..0b05a47c6 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -915,7 +915,7 @@ spawnfunc(worldspawn) // save it for later modname = strzone(modname); - WinningConditionHelper(); // set worldstatus + WinningConditionHelper(this); // set worldstatus world_initialized = 1; } @@ -1682,7 +1682,7 @@ float WinningCondition_Scores(float limit, float leadlimit) float limitreached; // TODO make everything use THIS winning condition (except LMS) - WinningConditionHelper(); + WinningConditionHelper(NULL); if(teamplay) { diff --git a/qcsrc/server/mutators/mutator/gamemode_assault.qc b/qcsrc/server/mutators/mutator/gamemode_assault.qc index d737330a5..9446080bc 100644 --- a/qcsrc/server/mutators/mutator/gamemode_assault.qc +++ b/qcsrc/server/mutators/mutator/gamemode_assault.qc @@ -258,7 +258,7 @@ void assault_new_round(entity this) //bprint("ASSAULT: new round\n"); // Eject players from vehicles - FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, WITHSELF(it, vehicles_exit(VHEF_RELEASE))); + FOREACH_CLIENT(IS_PLAYER(it) && it.vehicle, vehicles_exit(it.vehicle, VHEF_RELEASE)); FOREACH_ENTITY_FLAGS(vehicle_flags, VHF_ISVEHICLE, LAMBDA( vehicles_clearreturn(it); @@ -288,7 +288,7 @@ void assault_new_round(entity this) // they win. Otherwise the defending team wins once the timelimit passes. int WinningCondition_Assault() { - WinningConditionHelper(); // set worldstatus + WinningConditionHelper(NULL); // set worldstatus int status = WINNING_NO; // as the timelimit has not yet passed just assume the defending team will win diff --git a/qcsrc/server/mutators/mutator/gamemode_lms.qc b/qcsrc/server/mutators/mutator/gamemode_lms.qc index dada01677..d0ef8e1d4 100644 --- a/qcsrc/server/mutators/mutator/gamemode_lms.qc +++ b/qcsrc/server/mutators/mutator/gamemode_lms.qc @@ -139,7 +139,7 @@ int WinningCondition_LMS() // When we get here, we have at least two players who are actually LIVING, // now check if the top two players have equal score. - WinningConditionHelper(); + WinningConditionHelper(NULL); ClearWinners(); if(WinningConditionHelper_winner) diff --git a/qcsrc/server/scores.qc b/qcsrc/server/scores.qc index 8c4126cf4..8be145b01 100644 --- a/qcsrc/server/scores.qc +++ b/qcsrc/server/scores.qc @@ -385,9 +385,8 @@ float PlayerScore_Compare(entity t1, entity t2, float strict) return result.x; } -void WinningConditionHelper() +void WinningConditionHelper(entity this) { - SELFPARAM(); float c; string s; float fullstatus; @@ -406,7 +405,7 @@ void WinningConditionHelper() s = GetGametype(); s = strcat(s, ":", autocvar_g_xonoticversion); s = strcat(s, ":P", ftos(cvar_purechanges_count)); - s = strcat(s, ":S", ftos(nJoinAllowed(this, world))); // note: self/this is most likely world in this case + s = strcat(s, ":S", ftos(nJoinAllowed(this, world))); s = strcat(s, ":F", ftos(serverflags)); s = strcat(s, ":M", modname); s = strcat(s, "::", GetPlayerScoreString(world, (fullstatus ? 1 : 2))); diff --git a/qcsrc/server/scores.qh b/qcsrc/server/scores.qh index b547730ef..eb014e44e 100644 --- a/qcsrc/server/scores.qh +++ b/qcsrc/server/scores.qh @@ -93,7 +93,7 @@ void Score_NicePrint(entity to); /** * Sets the following results for the current scores entities. */ -void WinningConditionHelper(); +void WinningConditionHelper(entity this); float WinningConditionHelper_topscore; ///< highest score float WinningConditionHelper_secondscore; ///< second highest score float WinningConditionHelper_winnerteam; ///< the color of the winning team, or -1 if none