]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Fix auxiliary crosshairs
authorTimePath <andrew.hardaker1995@gmail.com>
Sat, 22 Aug 2015 11:45:07 +0000 (21:45 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sat, 22 Aug 2015 11:45:07 +0000 (21:45 +1000)
qcsrc/common/vehicles/all.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qh
qcsrc/common/vehicles/unit/bumblebee.qc
qcsrc/common/vehicles/unit/racer.qc
qcsrc/common/vehicles/unit/raptor.qc
qcsrc/common/vehicles/unit/spiderbot.qc

index d90e0696be77010bcc862af5b56f0c1b2373cc6e..f0316ab1fac7f2da65c7269dcd43b56b345ff060 100644 (file)
@@ -46,15 +46,11 @@ STATIC_INIT(vehicles_common_initialize)
 }
 #endif
 
-entity get_vehicleinfo(float id)
+entity get_vehicleinfo(int id)
 {
-       entity m;
-       if(id < VEH_FIRST || id > VEH_LAST)
-               return VEH_NULL;
-       m = vehicle_info[id - 1];
-       if(m)
-               return m;
-       return VEH_NULL;
+       if (id < VEH_FIRST || id > VEH_LAST) return VEH_NULL;
+       entity m = vehicle_info[id];
+       return m ? m : VEH_NULL;
 }
 
 #endif
index c21b0a5cf165eb1d97c5f51cc3abdeb811d05453..79f59018d218dd937e86aaa58e1124598b8c5122 100644 (file)
@@ -1183,17 +1183,15 @@ void vehicles_spawn()
        CSQCMODEL_AUTOINIT();
 }
 
-bool vehicle_initialize(int vehicle_id, bool nodrop)
+bool vehicle_initialize(entity veh, bool nodrop)
 {
        if(!autocvar_g_vehicles)
                return false;
 
-       entity veh = get_vehicleinfo(vehicle_id);
-
        if(!veh.vehicleid)
                return false;
        
-       if(!veh.tur_head) { VEH_ACTION(vehicle_id, VR_PRECACHE); }
+       if(!veh.tur_head) { VEH_ACTION(veh.vehicleid, VR_PRECACHE); }
 
        if(self.targetname && self.targetname != "")
        {
@@ -1238,7 +1236,7 @@ bool vehicle_initialize(int vehicle_id, bool nodrop)
        self.iscreature                         = true;
        self.teleportable                       = false; // no teleporting for vehicles, too buggy
        self.damagedbycontents          = true;
-       self.vehicleid                          = vehicle_id;
+       self.vehicleid                          = veh.vehicleid;
        self.PlayerPhysplug                     = veh.PlayerPhysplug;
        self.event_damage                       = func_null;
        self.touch                                      = vehicles_touch;
@@ -1286,7 +1284,7 @@ bool vehicle_initialize(int vehicle_id, bool nodrop)
        self.pos2 = self.angles;
        self.tur_head.team = self.team;
 
-       VEH_ACTION(vehicle_id, VR_SETUP);
+       VEH_ACTION(veh.vehicleid, VR_SETUP);
 
        if(self.active == ACTIVE_NOT)
                self.nextthink = 0; // wait until activated
index c02ccddb5d4af81c15eddb5ac5afb5939cb07c90..b1921371eeb4aef14f19e57ec427ccd08c464a78 100644 (file)
@@ -100,7 +100,7 @@ float vehicles_exit_running;
 .float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
 
 void vehicles_exit(float eject);
-float vehicle_initialize(float vehicle_id, float nodrop);
+float vehicle_initialize(entity vehicle, float nodrop);
 bool vehicle_impulse(int imp);
 bool vehicles_crushable(entity e);
 
index 3d8eff20eabaf7b405fcd35974dd1a94c034b566..ba0db541a9634130a64160f235aa064465bcf4d0 100644 (file)
@@ -767,7 +767,7 @@ float bumble_raygun_send(entity to, float sf)
 void spawnfunc_vehicle_bumblebee()
 {
        if(!autocvar_g_vehicle_bumblebee) { remove(self); return; }
-       if(!vehicle_initialize(VEH_BUMBLEBEE.vehicleid, false)) { remove(self); return; }
+       if(!vehicle_initialize(VEH_BUMBLEBEE, false)) { remove(self); return; }
 }
 
 float v_bumblebee(float req)
index 3cf6215bee3a99ad6a7fd4509cac657c85f1db19..41a0b12ff71eaf2811fc826d9991226c3f734a7c 100644 (file)
@@ -666,7 +666,7 @@ void racer_deadtouch()
 void spawnfunc_vehicle_racer()
 {
        if(!autocvar_g_vehicle_racer) { remove(self); return; }
-       if(!vehicle_initialize(VEH_RACER.vehicleid, false)) { remove(self); return; }
+       if(!vehicle_initialize(VEH_RACER, false)) { remove(self); return; }
 }
 
 #endif // SVQC
index 1e92fa1959aae5e31c90d07a08c7a5d5d18df4f9..2ea89491bb21317f61637ab6480ef3a9d48bfddb 100644 (file)
@@ -788,7 +788,7 @@ float raptor_impulse(float _imp)
 void spawnfunc_vehicle_raptor()
 {
        if(!autocvar_g_vehicle_raptor) { remove(self); return; }
-       if(!vehicle_initialize(VEH_RAPTOR.vehicleid, false)) { remove(self); return; }
+       if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; }
 }
 
 float v_raptor(float req)
index 0c134acd455ef89d06061221dd0b85c14696bb7a..939dd28a63a557b5226b51b5ee12ebe9cf6087b7 100644 (file)
@@ -810,7 +810,7 @@ bool spiderbot_impulse(int _imp)
 void spawnfunc_vehicle_spiderbot()
 {
        if(!autocvar_g_vehicle_spiderbot) { remove(self); return; }
-       if(!vehicle_initialize(VEH_SPIDERBOT.vehicleid, false)) { remove(self); return; }
+       if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
 }
 
 float v_spiderbot(float req)