]> git.rm.cloudns.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Vehicles: propagate self
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 3 Jan 2016 10:39:46 +0000 (21:39 +1100)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 3 Jan 2016 10:39:46 +0000 (21:39 +1100)
qcsrc/common/items/item.qh
qcsrc/common/items/item/pickup.qh
qcsrc/common/vehicles/cl_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/vehicle.qh
qcsrc/common/vehicles/vehicle/bumblebee.qc
qcsrc/common/vehicles/vehicle/racer.qc
qcsrc/common/vehicles/vehicle/raptor.qc
qcsrc/common/vehicles/vehicle/spiderbot.qc

index 7a12b305006754776fd9ff90af756c916032d594..0db0d0beafd8f54e2ff7a0e9fa00bbf097551fc9 100644 (file)
@@ -50,11 +50,11 @@ CLASS(GameItem, Object)
     ATTRIB(GameItem, m_color, vector, '1 1 1')
     ATTRIB(GameItem, m_waypoint, string, string_null)
     ATTRIB(GameItem, m_waypointblink, int, 1)
-    METHOD(GameItem, display, void(entity this, void(string name, string icon) returns)) {
+    METHOD(GameItem, display, void(GameItem this, void(string name, string icon) returns)) {
         returns(this.m_name, this.m_icon ? sprintf("/gfx/hud/%s/%s", cvar_string("menu_skin"), this.m_icon) : string_null);
     }
-    METHOD(GameItem, show, void(entity this)) { LOG_INFO("A game item\n"); }
-    void ITEM_HANDLE(Show, entity this) { this.show(this); }
+    METHOD(GameItem, show, void(GameItem this)) { LOG_INFO("A game item\n"); }
+    void ITEM_HANDLE(Show, GameItem this) { this.show(this); }
 ENDCLASS(GameItem)
 
 #endif
index 19963278873103d6f8e5386bc8a7b14b7d670ccc..dbc74a0625621bee288da55c946ebbfaf6ab4704 100644 (file)
@@ -8,8 +8,7 @@ CLASS(Pickup, GameItem)
     ATTRIB(Pickup, m_sound, Sound, SND_ITEMPICKUP)
 #endif
     ATTRIB(Pickup, m_name, string, string_null)
-    METHOD(Pickup, show, void(entity this));
-    void Pickup_show(entity this) { LOG_INFOF("%s: %s\n", etos(this), this.m_name); }
+    METHOD(Pickup, show, void(Pickup this)) { LOG_INFOF("%s: %s\n", etos(this), this.m_name); }
 #ifdef SVQC
     ATTRIB(Pickup, m_mins, vector, '-16 -16 0')
     ATTRIB(Pickup, m_maxs, vector, '16 16 32')
@@ -21,7 +20,7 @@ CLASS(Pickup, GameItem)
     ATTRIB(Pickup, m_respawntime, float(), func_null)
     ATTRIB(Pickup, m_respawntimejitter, float(), func_null)
     float Item_GiveTo(entity item, entity player);
-    METHOD(Pickup, giveTo, bool(entity this, entity item, entity player))
+    METHOD(Pickup, giveTo, bool(Pickup this, entity item, entity player))
     {
         bool b = Item_GiveTo(item, player);
         if (b) {
@@ -31,7 +30,7 @@ CLASS(Pickup, GameItem)
         }
         return b;
     }
-    bool ITEM_HANDLE(Pickup, entity this, entity item, entity player);
+    bool ITEM_HANDLE(Pickup, Pickup this, entity item, entity player);
 #endif
 ENDCLASS(Pickup)
 
index 6b900fea6622892f817572435272c4d4041d0c79..1733a63cc39c8bfcad8cf52e6fa3180c6c76a570 100644 (file)
@@ -110,7 +110,7 @@ NET_HANDLE(TE_CSQC_VEHICLESETUP, bool isnew)
                AuxiliaryXhair[1].axh_image = vCROSS_BURST; // Raygun
        } else {
                Vehicle info = Vehicles_from(hud_id);
-       info.vr_setup(info);
+       info.vr_setup(info, NULL);
        }
 }
 
index a19e6d4b177f9fa06964fbe9862d76f1779202d0..dc57e259f9b9cf78268ec4448c2bd6c1d45af253 100644 (file)
@@ -723,7 +723,7 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, int deatht
                antilag_clear(self);
 
                Vehicle info = Vehicles_from(self.vehicleid);
-               info.vr_death(info);
+               info.vr_death(info, self);
                vehicles_setreturn(self);
        }
 }
@@ -930,7 +930,7 @@ void vehicles_touch()
 
                if(self.play_time < time) {
                        Vehicle info = Vehicles_from(self.vehicleid);
-                       info.vr_impact(info);
+                       info.vr_impact(info, self);
                }
 
                return;
@@ -1104,7 +1104,7 @@ void vehicles_enter(entity pl, entity veh)
        setself(veh);
        CSQCModel_UnlinkEntity(veh);
        Vehicle info = Vehicles_from(veh.vehicleid);
-       info.vr_enter(info);
+       info.vr_enter(info, veh);
        setself(this);
 
        antilag_clear(pl);
@@ -1118,7 +1118,7 @@ void vehicles_think()
                self.owner.vehicle_weapon2mode = self.vehicle_weapon2mode;
 
        Vehicle info = Vehicles_from(self.vehicleid);
-       info.vr_think(info);
+       info.vr_think(info, self);
 
        vehicles_painframe(self);
 
@@ -1169,7 +1169,7 @@ void vehicles_spawn()
        vehicles_reset_colors();
 
        Vehicle info = Vehicles_from(self.vehicleid);
-       info.vr_spawn(info);
+       info.vr_spawn(info, self);
 
        CSQCMODEL_AUTOINIT(self);
 }
@@ -1279,7 +1279,7 @@ bool vehicle_initialize(entity veh, bool nodrop)
        self.tur_head.team = self.team;
 
        Vehicle info = Vehicles_from(veh.vehicleid);
-       info.vr_setup(info);
+       info.vr_setup(info, veh);
 
        if(self.active == ACTIVE_NOT)
                self.nextthink = 0; // wait until activated
index 7eef322569d61eb6e59641050aeac26045f43423..723a98518ae651857a4409afc1d4cce3c300c8ec 100644 (file)
@@ -37,23 +37,23 @@ CLASS(Vehicle, Object)
     ATTRIB(Vehicle, height, float, 0)
 
     /** (BOTH) setup vehicle data */
-    METHOD(Vehicle, vr_setup, void(Vehicle)) { }
+    METHOD(Vehicle, vr_setup, void(Vehicle this, entity instance)) { }
     /** (SERVER) logic to run every frame */
-    METHOD(Vehicle, vr_think, void(Vehicle)) { }
+    METHOD(Vehicle, vr_think, void(Vehicle this, entity instance)) { }
     /** (SERVER) called when vehicle dies */
-    METHOD(Vehicle, vr_death, void(Vehicle)) { }
+    METHOD(Vehicle, vr_death, void(Vehicle this, entity instance)) { }
     /** (BOTH) precaches models/sounds used by this vehicle */
-    METHOD(Vehicle, vr_precache, void(Vehicle)) { }
+    METHOD(Vehicle, vr_precache, void(Vehicle this)) { }
     /** (SERVER) called when a player enters this vehicle */
-    METHOD(Vehicle, vr_enter, void(Vehicle)) { }
+    METHOD(Vehicle, vr_enter, void(Vehicle this, entity instance)) { }
     /** (SERVER) called when the vehicle re-spawns */
-    METHOD(Vehicle, vr_spawn, void(Vehicle)) { }
+    METHOD(Vehicle, vr_spawn, void(Vehicle this, entity instance)) { }
     /** (SERVER) called when a vehicle hits something */
-    METHOD(Vehicle, vr_impact, void(Vehicle)) { }
+    METHOD(Vehicle, vr_impact, void(Vehicle this, entity instance)) { }
     /** (CLIENT) logic to run every frame */
-    METHOD(Vehicle, vr_hud, void(Vehicle)) { }
+    METHOD(Vehicle, vr_hud, void(Vehicle this)) { }
     /** (CLIENT) logic to run every frame */
-    METHOD(Vehicle, vr_crosshair, void(Vehicle)) { }
+    METHOD(Vehicle, vr_crosshair, void(Vehicle this)) { }
 ENDCLASS(Vehicle)
 
 // vehicle spawn flags (need them here for common registrations)
index 2169e8d7868ac4313eea2d02868804b03e8c3de7..3bad3bcf10bed23ee603d6c0d9842976a7200647 100644 (file)
@@ -736,19 +736,19 @@ spawnfunc(vehicle_bumblebee)
        if(!vehicle_initialize(VEH_BUMBLEBEE, false)) { remove(self); return; }
 }
 
-               METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh))
+               METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh, entity instance))
                {
                        if(autocvar_g_vehicle_bumblebee_bouncepain)
                                vehicles_impact(autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
                }
-               METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh))
+               METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
                {
                        SELFPARAM();
                        self.touch = bumblebee_touch;
                        self.nextthink = 0;
                        self.movetype = MOVETYPE_BOUNCEMISSILE;
                }
-               METHOD(Bumblebee, vr_think, void(Bumblebee thisveh))
+               METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
                {
                        SELFPARAM();
                        self.angles_z *= 0.8;
@@ -786,7 +786,7 @@ spawnfunc(vehicle_bumblebee)
                                }
                        }
                }
-               METHOD(Bumblebee, vr_death, void(Bumblebee thisveh))
+               METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
                {
                        SELFPARAM();
                        entity oldself = self;
@@ -850,7 +850,7 @@ spawnfunc(vehicle_bumblebee)
 
                        setorigin(self, self.pos1);
                }
-               METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh))
+               METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
                {
                        SELFPARAM();
                        if(!self.gun1)
@@ -928,7 +928,7 @@ spawnfunc(vehicle_bumblebee)
 
                        setorigin(self, self.origin + '0 0 25');
                }
-               METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh))
+               METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
                {
                        SELFPARAM();
                        if(autocvar_g_vehicle_bumblebee_energy)
@@ -989,7 +989,7 @@ void CSQC_BUMBLE_GUN_HUD()
                {
                        Vehicles_drawCrosshair(vCROSS_HEAL);
                }
-               METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh))
+               METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
                {
                        AuxiliaryXhair[0].axh_image = vCROSS_LOCK;  // Raygun-locked
                        AuxiliaryXhair[1].axh_image = vCROSS_BURST; // Gunner1
index d5057c30f2626ea181b47fd06a645c86170a947e..25d07612c6b985c73f5fcae3b71754c91062650a 100644 (file)
@@ -560,7 +560,7 @@ void racer_draw()
 #endif
 #endif
 
-               METHOD(Racer, vr_impact, void(Racer thisveh))
+               METHOD(Racer, vr_impact, void(Racer thisveh, entity instance))
                {
                #ifdef SVQC
                        if(autocvar_g_vehicle_racer_bouncepain)
@@ -568,7 +568,7 @@ void racer_draw()
                #endif
                }
 
-               METHOD(Racer, vr_enter, void(Racer thisveh))
+               METHOD(Racer, vr_enter, void(Racer thisveh, entity instance))
                {
                #ifdef SVQC
                        self.movetype = MOVETYPE_BOUNCE;
@@ -583,7 +583,7 @@ void racer_draw()
                #endif
                }
 
-               METHOD(Racer, vr_spawn, void(Racer thisveh))
+               METHOD(Racer, vr_spawn, void(Racer thisveh, entity instance))
                {
                #ifdef SVQC
                        if(self.scale != 0.5)
@@ -621,7 +621,7 @@ void racer_draw()
                #endif
                }
 
-               METHOD(Racer, vr_death, void(Racer thisveh))
+               METHOD(Racer, vr_death, void(Racer thisveh, entity instance))
                {
                #ifdef SVQC
                        self.SendEntity         = func_null; // stop networking this racer (for now)
@@ -664,7 +664,7 @@ void racer_draw()
                        Vehicles_drawCrosshair(vCROSS_GUIDE);
                }
 #endif
-               METHOD(Racer, vr_setup, void(Racer thisveh))
+               METHOD(Racer, vr_setup, void(Racer thisveh, entity instance))
                {
                #ifdef SVQC
                        self.vehicle_exit = racer_exit;
index 41ecab4e9a698d9747f474b534f7961f19370d0d..649977603b043d53095b7dd91a41f8872886653c 100644 (file)
@@ -617,12 +617,12 @@ spawnfunc(vehicle_raptor)
        if(!vehicle_initialize(VEH_RAPTOR, false)) { remove(self); return; }
 }
 
-               METHOD(Raptor, vr_impact, void(Raptor thisveh))
+               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);
                }
-               METHOD(Raptor, vr_enter, void(Raptor thisveh))
+               METHOD(Raptor, vr_enter, void(Raptor thisveh, entity instance))
                {
                        self.vehicle_weapon2mode = RSM_BOMB;
                        self.owner.PlayerPhysplug = raptor_takeoff;
@@ -641,7 +641,7 @@ spawnfunc(vehicle_raptor)
 
                        CSQCVehicleSetup(self.owner, 0);
                }
-               METHOD(Raptor, vr_death, void(Raptor thisveh))
+               METHOD(Raptor, vr_death, void(Raptor thisveh, entity instance))
                {
                        self.health                             = 0;
                        self.event_damage               = func_null;
@@ -663,7 +663,7 @@ spawnfunc(vehicle_raptor)
                        self.colormod = '-0.5 -0.5 -0.5';
                        self.touch = raptor_blowup;
                }
-               METHOD(Raptor, vr_spawn, void(Raptor thisveh))
+               METHOD(Raptor, vr_spawn, void(Raptor thisveh, entity instance))
                {
                        if(!self.gun1)
                        {
@@ -754,7 +754,7 @@ spawnfunc(vehicle_raptor)
                        self.vehicle_health = autocvar_g_vehicle_raptor_health;
                        self.vehicle_shield = autocvar_g_vehicle_raptor_shield;
                }
-               METHOD(Raptor, vr_setup, void(Raptor thisveh))
+               METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
                {
                        if(autocvar_g_vehicle_raptor_shield)
                                self.vehicle_flags |= VHF_HASSHIELD;
@@ -850,7 +850,7 @@ spawnfunc(vehicle_raptor)
 
                        Vehicles_drawCrosshair(crosshair);
                }
-               METHOD(Raptor, vr_setup, void(Raptor thisveh))
+               METHOD(Raptor, vr_setup, void(Raptor thisveh, entity instance))
                {
                        AuxiliaryXhair[1].axh_image = vCROSS_LOCK;
                }
index 4e659e2539c90a1a8e53da3375610c43e66c60ea..dcf8eaec3273e1b11088a1ac0ba79d042f541186 100644 (file)
@@ -554,12 +554,12 @@ spawnfunc(vehicle_spiderbot)
        if(!vehicle_initialize(VEH_SPIDERBOT, false)) { remove(self); return; }
 }
 
-               METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh))
+               METHOD(Spiderbot, vr_impact, void(Spiderbot thisveh, entity instance))
                {
                        if(autocvar_g_vehicle_spiderbot_bouncepain)
                                vehicles_impact(autocvar_g_vehicle_spiderbot_bouncepain_x, autocvar_g_vehicle_spiderbot_bouncepain_y, autocvar_g_vehicle_spiderbot_bouncepain_z);
                }
-               METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh))
+               METHOD(Spiderbot, vr_enter, void(Spiderbot thisveh, entity instance))
                {
                        self.vehicle_weapon2mode = SBRM_GUIDE;
                        self.movetype = MOVETYPE_WALK;
@@ -573,12 +573,12 @@ spawnfunc(vehicle_spiderbot)
                                setorigin(self.owner.flagcarried, '-20 0 120');
                        }
                }
-               METHOD(Spiderbot, vr_think, void(Spiderbot thisveh))
+               METHOD(Spiderbot, vr_think, void(Spiderbot thisveh, entity instance))
                {
                        if(IS_ONGROUND(self))
                                movelib_brake_simple(autocvar_g_vehicle_spiderbot_speed_stop);
                }
-               METHOD(Spiderbot, vr_death, void(Spiderbot thisveh))
+               METHOD(Spiderbot, vr_death, void(Spiderbot thisveh, entity instance))
                {
                        self.health                             = 0;
                        self.event_damage               = func_null;
@@ -596,7 +596,7 @@ spawnfunc(vehicle_spiderbot)
 
                        CSQCModel_UnlinkEntity(self); // networking the death scene would be a nightmare
                }
-               METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh))
+               METHOD(Spiderbot, vr_spawn, void(Spiderbot thisveh, entity instance))
                {
                        if(!self.gun1)
                        {
@@ -627,7 +627,7 @@ spawnfunc(vehicle_spiderbot)
 
                        self.PlayerPhysplug = spiderbot_frame;
                }
-               METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh))
+               METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
                {
                        if(autocvar_g_vehicle_spiderbot_shield)
                                self.vehicle_flags |= VHF_HASSHIELD;
@@ -670,7 +670,7 @@ float autocvar_cl_vehicle_spiderbot_cross_size = 1;
 
                        Vehicles_drawCrosshair(crosshair);
                }
-               METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh))
+               METHOD(Spiderbot, vr_setup, void(Spiderbot thisveh, entity instance))
                {
                        AuxiliaryXhair[0].axh_image = vCROSS_HINT; // Minigun1
                        AuxiliaryXhair[1].axh_image = vCROSS_HINT; // Minigun2