]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/vehicles/vehicle/raptor.qc
Clean up some more self uses
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / vehicle / raptor.qc
index 6fee43d4e7b9f384083464223d17557aab1cd875..f1f29c55cd4dc94cb7b0e87e3f1a30ced4fdc217 100644 (file)
@@ -170,8 +170,6 @@ bool raptor_frame(entity this)
                return;
        }
 
-       setself(vehic);
-
        vehicles_frame(vehic, this);
 
        float ftmp = 0;
@@ -387,6 +385,9 @@ bool raptor_frame(entity this)
        UpdateAuxiliaryXhair(this, trace_endpos, '0 1 0', 0);
        */
 
+       // TODO: fix wr_checkammo and its use of self!
+       setself(vehic);
+
        Weapon wep1 = WEP_RAPTOR;
        if(!forbidWeaponUse(this))
        if(PHYS_INPUT_BUTTON_ATCK(this))
@@ -431,6 +432,8 @@ bool raptor_frame(entity this)
                }
        }
 
+       setself(this);
+
        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;
@@ -462,8 +465,6 @@ bool raptor_frame(entity this)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
 
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
-
-       setself(this);
 }
 
 bool raptor_takeoff(entity this)
@@ -471,8 +472,6 @@ bool raptor_takeoff(entity this)
        entity vehic = this.vehicle;
        return = true;
 
-       setself(this);
-
        vehic.nextthink = time;
        CSQCMODEL_AUTOUPDATE(vehic);
        vehic.nextthink = 0; // will this work?
@@ -517,8 +516,6 @@ bool raptor_takeoff(entity this)
                VEHICLE_UPDATE_PLAYER(this, vehic, shield, raptor);
 
        PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = PHYS_INPUT_BUTTON_CROUCH(this) = false;
-
-       setself(vehic);
 }
 
 void raptor_blowup()
@@ -608,14 +605,14 @@ float raptor_impulse(float _imp)
 
 spawnfunc(vehicle_raptor)
 {
-       if(!autocvar_g_vehicle_raptor) { remove(self); return; }
-       if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; }
+       if(!autocvar_g_vehicle_raptor) { remove(this); return; }
+       if(!vehicle_initialize(this, VEH_RAPTOR, false)) { remove(this); return; }
 }
 
 METHOD(Raptor, vr_impact, void(Raptor thisveh, entity instance))
 {
     if(autocvar_g_vehicle_raptor_bouncepain)
-        vehicles_impact(autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
+        vehicles_impact(instance, autocvar_g_vehicle_raptor_bouncepain_x, autocvar_g_vehicle_raptor_bouncepain_y, autocvar_g_vehicle_raptor_bouncepain_z);
 }
 METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
 {
@@ -753,24 +750,23 @@ METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
 }
 METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
 {
-    SELFPARAM();
     if(autocvar_g_vehicle_raptor_shield)
-        self.vehicle_flags |= VHF_HASSHIELD;
+        instance.vehicle_flags |= VHF_HASSHIELD;
 
     if(autocvar_g_vehicle_raptor_shield_regen)
-        self.vehicle_flags |= VHF_SHIELDREGEN;
+        instance.vehicle_flags |= VHF_SHIELDREGEN;
 
     if(autocvar_g_vehicle_raptor_health_regen)
-        self.vehicle_flags |= VHF_HEALTHREGEN;
+        instance.vehicle_flags |= VHF_HEALTHREGEN;
 
     if(autocvar_g_vehicle_raptor_energy_regen)
-        self.vehicle_flags |= VHF_ENERGYREGEN;
+        instance.vehicle_flags |= VHF_ENERGYREGEN;
 
-    self.vehicle_exit = raptor_exit;
-    self.respawntime = autocvar_g_vehicle_raptor_respawntime;
-    self.vehicle_health = autocvar_g_vehicle_raptor_health;
-    self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
-    self.max_health = self.vehicle_health;
+    instance.vehicle_exit = raptor_exit;
+    instance.respawntime = autocvar_g_vehicle_raptor_respawntime;
+    instance.vehicle_health = autocvar_g_vehicle_raptor_health;
+    instance.vehicle_shield = autocvar_g_vehicle_raptor_shield;
+    instance.max_health = instance.vehicle_health;
 }
 
 #endif