From 91d232de8279a43dcc127d1e19a8731fa0e136b6 Mon Sep 17 00:00:00 2001 From: Mario Date: Tue, 5 Jan 2016 03:45:23 +1000 Subject: [PATCH] Fix crash --- qcsrc/common/vehicles/vehicle/bumblebee.qc | 4 ++- qcsrc/common/vehicles/vehicle/racer.qc | 40 +++++++++++----------- qcsrc/common/vehicles/vehicle/raptor.qc | 30 ++++++++-------- qcsrc/common/vehicles/vehicle/spiderbot.qc | 30 ++++++++-------- 4 files changed, 53 insertions(+), 51 deletions(-) diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index cd2804a33..f65bb0cd5 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -788,8 +788,8 @@ spawnfunc(vehicle_bumblebee) } METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance)) { - SELFPARAM(); entity oldself = self; + setself(instance); CSQCModel_UnlinkEntity(self); @@ -849,6 +849,8 @@ spawnfunc(vehicle_bumblebee) self.nextthink = 0; setorigin(self, self.pos1); + + setself(oldself); } METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance)) { diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index 848fa2ff7..7e9632d96 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -624,31 +624,31 @@ void racer_draw() METHOD(Racer, vr_death, void(Racer thisveh, entity instance)) { #ifdef SVQC - self.SendEntity = func_null; // stop networking this racer (for now) - self.health = 0; - self.event_damage = func_null; - self.solid = SOLID_CORPSE; - self.takedamage = DAMAGE_NO; - self.deadflag = DEAD_DYING; - self.movetype = MOVETYPE_BOUNCE; - self.wait = time; - self.delay = 2 + time + random() * 3; - self.cnt = 1 + random() * 2; - self.touch = racer_deadtouch; - - Send_Effect(EFFECT_EXPLOSION_MEDIUM, self.origin, '0 0 0', 1); + instance.SendEntity = func_null; // stop networking this racer (for now) + instance.health = 0; + instance.event_damage = func_null; + instance.solid = SOLID_CORPSE; + instance.takedamage = DAMAGE_NO; + instance.deadflag = DEAD_DYING; + instance.movetype = MOVETYPE_BOUNCE; + instance.wait = time; + instance.delay = 2 + time + random() * 3; + instance.cnt = 1 + random() * 2; + instance.touch = racer_deadtouch; + + Send_Effect(EFFECT_EXPLOSION_MEDIUM, instance.origin, '0 0 0', 1); if(random() < 0.5) - self.avelocity_z = 32; + instance.avelocity_z = 32; else - self.avelocity_z = -32; + instance.avelocity_z = -32; - self.avelocity_x = -vlen(self.velocity) * 0.2; - self.velocity += '0 0 700'; - self.colormod = '-0.5 -0.5 -0.5'; + instance.avelocity_x = -vlen(instance.velocity) * 0.2; + instance.velocity += '0 0 700'; + instance.colormod = '-0.5 -0.5 -0.5'; - self.think = racer_blowup_think; - self.nextthink = time; + instance.think = racer_blowup_think; + instance.nextthink = time; #endif } diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index d012bd573..67c67d948 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -643,25 +643,25 @@ spawnfunc(vehicle_raptor) } METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance)) { - self.health = 0; - self.event_damage = func_null; - self.solid = SOLID_CORPSE; - self.takedamage = DAMAGE_NO; - self.deadflag = DEAD_DYING; - self.movetype = MOVETYPE_BOUNCE; - self.think = raptor_diethink; - self.nextthink = time; - self.wait = time + 5 + (random() * 5); + instance.health = 0; + instance.event_damage = func_null; + instance.solid = SOLID_CORPSE; + instance.takedamage = DAMAGE_NO; + instance.deadflag = DEAD_DYING; + instance.movetype = MOVETYPE_BOUNCE; + instance.think = raptor_diethink; + instance.nextthink = time; + instance.wait = time + 5 + (random() * 5); - Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (self.origin, 16), '0 0 0', 1); + Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation (instance.origin, 16), '0 0 0', 1); - self.velocity_z += 600; + instance.velocity_z += 600; - self.avelocity = '0 0.5 1' * (random() * 400); - self.avelocity -= '0 0.5 1' * (random() * 400); + instance.avelocity = '0 0.5 1' * (random() * 400); + instance.avelocity -= '0 0.5 1' * (random() * 400); - self.colormod = '-0.5 -0.5 -0.5'; - self.touch = raptor_blowup; + instance.colormod = '-0.5 -0.5 -0.5'; + instance.touch = raptor_blowup; } METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance)) { diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index edb2a4758..5bb26070d 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -580,21 +580,21 @@ spawnfunc(vehicle_spiderbot) } METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance)) { - self.health = 0; - self.event_damage = func_null; - self.takedamage = DAMAGE_NO; - self.touch = func_null; - self.cnt = 3.4 + time + random() * 2; - self.think = spiderbot_blowup; - self.nextthink = time; - self.deadflag = DEAD_DYING; - self.frame = 5; - self.tur_head.effects |= EF_FLAME; - self.colormod = self.tur_head.colormod = '-1 -1 -1'; - self.frame = 10; - self.movetype = MOVETYPE_TOSS; - - CSQCModel_UnlinkEntity(self); // networking the death scene would be a nightmare + instance.health = 0; + instance.event_damage = func_null; + instance.takedamage = DAMAGE_NO; + instance.touch = func_null; + instance.cnt = 3.4 + time + random() * 2; + instance.think = spiderbot_blowup; + instance.nextthink = time; + instance.deadflag = DEAD_DYING; + instance.frame = 5; + instance.tur_head.effects |= EF_FLAME; + instance.colormod = instance.tur_head.colormod = '-1 -1 -1'; + instance.frame = 10; + instance.movetype = MOVETYPE_TOSS; + + CSQCModel_UnlinkEntity(instance); // networking the death scene would be a nightmare } METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance)) { -- 2.39.2