From: TimePath Date: Sun, 3 Jan 2016 10:39:46 +0000 (+1100) Subject: Vehicles: propagate self X-Git-Tag: xonotic-v0.8.2~1317 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=a665cd1434481e14b353c3a1bec9030b2ceede4f;p=xonotic%2Fxonotic-data.pk3dir.git Vehicles: propagate self --- diff --git a/qcsrc/common/items/item.qh b/qcsrc/common/items/item.qh index 7a12b3050..0db0d0bea 100644 --- a/qcsrc/common/items/item.qh +++ b/qcsrc/common/items/item.qh @@ -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 diff --git a/qcsrc/common/items/item/pickup.qh b/qcsrc/common/items/item/pickup.qh index 199632788..dbc74a062 100644 --- a/qcsrc/common/items/item/pickup.qh +++ b/qcsrc/common/items/item/pickup.qh @@ -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) diff --git a/qcsrc/common/vehicles/cl_vehicles.qc b/qcsrc/common/vehicles/cl_vehicles.qc index 6b900fea6..1733a63cc 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qc +++ b/qcsrc/common/vehicles/cl_vehicles.qc @@ -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); } } diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index a19e6d4b1..dc57e259f 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -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 diff --git a/qcsrc/common/vehicles/vehicle.qh b/qcsrc/common/vehicles/vehicle.qh index 7eef32256..723a98518 100644 --- a/qcsrc/common/vehicles/vehicle.qh +++ b/qcsrc/common/vehicles/vehicle.qh @@ -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) diff --git a/qcsrc/common/vehicles/vehicle/bumblebee.qc b/qcsrc/common/vehicles/vehicle/bumblebee.qc index 2169e8d78..3bad3bcf1 100644 --- a/qcsrc/common/vehicles/vehicle/bumblebee.qc +++ b/qcsrc/common/vehicles/vehicle/bumblebee.qc @@ -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 diff --git a/qcsrc/common/vehicles/vehicle/racer.qc b/qcsrc/common/vehicles/vehicle/racer.qc index d5057c30f..25d07612c 100644 --- a/qcsrc/common/vehicles/vehicle/racer.qc +++ b/qcsrc/common/vehicles/vehicle/racer.qc @@ -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; diff --git a/qcsrc/common/vehicles/vehicle/raptor.qc b/qcsrc/common/vehicles/vehicle/raptor.qc index 41ecab4e9..649977603 100644 --- a/qcsrc/common/vehicles/vehicle/raptor.qc +++ b/qcsrc/common/vehicles/vehicle/raptor.qc @@ -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; } diff --git a/qcsrc/common/vehicles/vehicle/spiderbot.qc b/qcsrc/common/vehicles/vehicle/spiderbot.qc index 4e659e253..dcf8eaec3 100644 --- a/qcsrc/common/vehicles/vehicle/spiderbot.qc +++ b/qcsrc/common/vehicles/vehicle/spiderbot.qc @@ -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