]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Store the vehicle definition into a field so that it doesn't need to be pulled from...
authorMario <mario.mario@y7mail.com>
Tue, 2 Jun 2020 13:08:50 +0000 (23:08 +1000)
committerMario <mario.mario@y7mail.com>
Tue, 2 Jun 2020 13:08:50 +0000 (23:08 +1000)
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle.qh

index cc2e13e223fb6c1b827430a67b2b82531c3b4428..7273f5a642220820bd7007cd8720c7aad9f1c1ae 100644 (file)
@@ -450,7 +450,7 @@ void vehicles_reset_colors(entity this, entity player)
        this.velocity  = '0 0 0';
        this.effects   = eff;
 
-       Vehicle info = REGISTRY_GET(Vehicles, this.vehicleid);
+       Vehicle info = this.vehicledef; //REGISTRY_GET(Vehicles, this.vehicleid);
        info.vr_setcolors(info, this);
 }
 
@@ -741,7 +741,7 @@ void vehicles_damage(entity this, entity inflictor, entity attacker, float damag
 
                antilag_clear(this, this);
 
-               Vehicle info = REGISTRY_GET(Vehicles, this.vehicleid);
+               Vehicle info = this.vehicledef; //REGISTRY_GET(Vehicles, this.vehicleid);
                info.vr_death(info, this);
                vehicles_setreturn(this);
        }
@@ -931,7 +931,7 @@ void vehicles_touch(entity this, entity toucher)
                }
 
                if(this.play_time < time) {
-                       Vehicle info = REGISTRY_GET(Vehicles, this.vehicleid);
+                       Vehicle info = this.vehicledef; //REGISTRY_GET(Vehicles, this.vehicleid);
                        info.vr_impact(info, this);
                }
 
@@ -976,7 +976,7 @@ void vehicles_enter(entity pl, entity veh)
        || (pl.vehicle)
        ) { return; }
 
-       Vehicle info = REGISTRY_GET(Vehicles, veh.vehicleid);
+       Vehicle info = veh.vehicledef; //REGISTRY_GET(Vehicles, veh.vehicleid);
 
        if(autocvar_g_vehicles_enter) // vehicle's touch function should handle this if entering via use key is disabled (TODO)
        if(veh.vehicle_flags & VHF_MULTISLOT)
@@ -1115,7 +1115,7 @@ void vehicles_think(entity this)
        if(this.owner)
                STAT(VEHICLESTAT_W2MODE, this.owner) = STAT(VEHICLESTAT_W2MODE, this);
 
-       Vehicle info = REGISTRY_GET(Vehicles, this.vehicleid);
+       Vehicle info = this.vehicledef; //REGISTRY_GET(Vehicles, this.vehicleid);
        info.vr_think(info, this);
 
        vehicles_painframe(this);
@@ -1188,7 +1188,7 @@ void vehicles_spawn(entity this)
        });
 
 
-       Vehicle info = REGISTRY_GET(Vehicles, this.vehicleid);
+       Vehicle info = this.vehicledef; //REGISTRY_GET(Vehicles, this.vehicleid);
        info.vr_spawn(info, this);
 
        vehicles_reset_colors(this, NULL);
@@ -1256,6 +1256,7 @@ bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
        this.damagedbycontents          = true;
        IL_PUSH(g_damagedbycontents, this);
        this.vehicleid                          = info.vehicleid;
+       this.vehicledef                         = info;
        this.PlayerPhysplug                     = info.PlayerPhysplug;
        this.event_damage                       = func_null;
        this.event_heal                         = func_null;
index 5b30b845e1a8d67b18d08fddc4970900e01c276c..8da44a459a991962ac4e601a282dd025e02b59ac 100644 (file)
@@ -77,3 +77,4 @@ const int VHF_PLAYERSLOT              = BIT(14); /// This ent is a player slot on a multi-pe
 
 // fields:
 .entity tur_head;
+.entity vehicledef;