]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/commitdiff
Some minor cleanup
authorMario <zacjardine@y7mail.com>
Wed, 25 Feb 2015 01:02:27 +0000 (12:02 +1100)
committerMario <zacjardine@y7mail.com>
Wed, 25 Feb 2015 01:02:27 +0000 (12:02 +1100)
qcsrc/common/vehicles/cl_vehicles.qc
qcsrc/common/vehicles/cl_vehicles.qh
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qh
qcsrc/common/vehicles/unit/bumblebee.qc
qcsrc/common/vehicles/unit/spiderbot.qc
qcsrc/common/vehicles/vehicles.qh
qcsrc/common/vehicles/vehicles_include.qc
qcsrc/common/vehicles/vehicles_include.qh

index 9a2598f8290a390b3f9d294eb1a32ee791179ab5..8c4bd6044bfa7209befd6861e0d60cdaa60d2753 100644 (file)
@@ -13,8 +13,8 @@
 #define hud_energy "gfx/vehicles/energy.tga"
 
 entity dropmark;
 #define hud_energy "gfx/vehicles/energy.tga"
 
 entity dropmark;
-var float autocvar_cl_vehicles_hudscale = 0.5;
-var float autocvar_cl_vehicles_hudalpha = 0.75;
+float autocvar_cl_vehicles_hudscale = 0.5;
+float autocvar_cl_vehicles_hudalpha = 0.75;
 
 const float MAX_AXH = 4;
 entity AuxiliaryXhair[MAX_AXH];
 
 const float MAX_AXH = 4;
 entity AuxiliaryXhair[MAX_AXH];
@@ -52,9 +52,9 @@ void AuxiliaryXhair_Draw2D()
                self.draw2d = func_null;
 }
 
                self.draw2d = func_null;
 }
 
-void Net_AuXair2(float bIsNew)
+void Net_AuXair2(bool bIsNew)
 {
 {
-       float axh_id    = bound(0, ReadByte(), MAX_AXH);
+       int axh_id      = bound(0, ReadByte(), MAX_AXH);
        entity axh              = AuxiliaryXhair[axh_id];
 
        if(axh == world || wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
        entity axh              = AuxiliaryXhair[axh_id];
 
        if(axh == world || wasfreed(axh))  // MADNESS? THIS IS QQQQCCCCCCCCC (wasfreed, why do you exsist?)
index 62682e262a5eb280f303b6d852c8af94734fea6c..3f0d8cfb20b5efd4202b85f0243db4ec2a8e3cd4 100644 (file)
@@ -2,8 +2,8 @@
 #define CL_VEHICLES_H
 
 // vehicle cvars
 #define CL_VEHICLES_H
 
 // vehicle cvars
-var float autocvar_cl_vehicles_alarm = 1;
-var float autocvar_cl_vehicles_hud_tactical = 1;
+bool autocvar_cl_vehicles_alarm = 1;
+bool autocvar_cl_vehicles_hud_tactical = 1;
 
 void Net_AuXair2(float bIsNew);
 void bumble_raygun_read(float bIsNew);
 
 void Net_AuXair2(float bIsNew);
 void bumble_raygun_read(float bIsNew);
@@ -14,13 +14,12 @@ void RaptorCBShellfragDraw();
 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang);
 
 #define HUD_GETVEHICLESTATS \
 void RaptorCBShellfragToss(vector _org, vector _vel, vector _ang);
 
 #define HUD_GETVEHICLESTATS \
-       local noref float vh_health     = getstati(STAT_VEHICLESTAT_HEALTH); \
-       local noref float shield        = getstati(STAT_VEHICLESTAT_SHIELD); \
-       local noref float energy        = getstati(STAT_VEHICLESTAT_ENERGY); \
-       local noref float ammo1         = getstati(STAT_VEHICLESTAT_AMMO1); \
-       local noref float reload1       = getstati(STAT_VEHICLESTAT_RELOAD1); \
-       local noref float ammo2         = getstati(STAT_VEHICLESTAT_AMMO2); \
-       local noref float reload2       = getstati(STAT_VEHICLESTAT_RELOAD2);
+    int vh_health       = getstati(STAT_VEHICLESTAT_HEALTH);  \
+       float shield        = getstati(STAT_VEHICLESTAT_SHIELD);  \
+       noref int energy    = getstati(STAT_VEHICLESTAT_ENERGY);  \
+       noref float ammo1   = getstati(STAT_VEHICLESTAT_AMMO1);   \
+       noref float reload1 = getstati(STAT_VEHICLESTAT_RELOAD1); \
+       noref int ammo2     = getstati(STAT_VEHICLESTAT_AMMO2);   \
+       noref int reload2   = getstati(STAT_VEHICLESTAT_RELOAD2);
 
 #endif
 
 #endif
-       
\ No newline at end of file
index 49d6b3e7db842916f1a9d5804094e3e37e8b8e6f..9ffb1775383552f4c0601a93abdae458d83688c3 100644 (file)
@@ -1,7 +1,5 @@
-// =========================
-//  SVQC Vehicle Properties
-// =========================
-
+#include "vehicles.qh"
+#include "sv_vehicles.qh"
 
 float SendAuxiliaryXhair(entity to, float sf)
 {
 
 float SendAuxiliaryXhair(entity to, float sf)
 {
@@ -271,6 +269,7 @@ void vehicles_gib_explode()
 {
        sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
        pointparticles(particleeffectnum("explosion_small"), randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
 {
        sound (self, CH_SHOTS, "weapons/rocket_impact.wav", VOL_BASE, ATTEN_NORM);
        pointparticles(particleeffectnum("explosion_small"), randomvec() * 80 + (self.origin + '0 0 100'), '0 0 0', 1);
+       pointparticles(particleeffectnum("explosion_small"), self.wp00.origin + '0 0 64', '0 0 0', 1);
        remove(self);
 }
 
        remove(self);
 }
 
@@ -703,7 +702,7 @@ void vehicles_damage(entity inflictor, entity attacker, float damage, float deat
        }
 }
 
        }
 }
 
-bool vehicles_crushable(entity e)
+float vehicles_crushable(entity e)
 {
        if(IS_PLAYER(e) && time >= e.vehicle_enter_delay)
                return true;
 {
        if(IS_PLAYER(e) && time >= e.vehicle_enter_delay)
                return true;
index c10279384481bdad11f372a9c596a0eed2088729..c0e3440449485946075d16f7a686e8d069d7ec56 100644 (file)
@@ -1,5 +1,6 @@
 #ifndef VEHICLES_DEF_H
 #define VEHICLES_DEF_H
 #ifndef VEHICLES_DEF_H
 #define VEHICLES_DEF_H
+#ifdef SVQC
 
 #include "../server/tturrets/include/turrets_early.qh"
 
 
 #include "../server/tturrets/include/turrets_early.qh"
 
@@ -24,6 +25,9 @@ var float autocvar_g_vehicles_rifle_damagerate = 0.75;
 var float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
 var float autocvar_g_vehicles_tag_damagerate = 5;
 
 var float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
 var float autocvar_g_vehicles_tag_damagerate = 5;
 
+// flags:
+.int vehicle_flags;
+
 // vehicle definitions
 .entity gun1;
 .entity gun2;
 // vehicle definitions
 .entity gun1;
 .entity gun2;
@@ -59,7 +63,7 @@ const float VHSF_FACTORY = 2;
 .int hud;
 .float dmg_time;
 
 .int hud;
 .float dmg_time;
 
-.float volly_counter;
+.int volly_counter;
 
 const int MAX_AXH = 4;
 .entity AuxiliaryXhair[MAX_AXH];
 
 const int MAX_AXH = 4;
 .entity AuxiliaryXhair[MAX_AXH];
@@ -72,6 +76,16 @@ const int MAX_AXH = 4;
 .float  lock_soundtime;
 const float    DAMAGE_TARGETDRONE = 10;
 
 .float  lock_soundtime;
 const float    DAMAGE_TARGETDRONE = 10;
 
+// vehicle functions
+.void(int _spawnflag) vehicle_spawn;  /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
+.bool(int _imp) vehicles_impulse;
+.int vehicle_weapon2mode;
+.void(int exit_flags) vehicle_exit;
+.bool() vehicle_enter;
+const int VHEF_NORMAL = 0;  /// User pressed exit key
+const int VHEF_EJECT  = 1;  /// User pressed exit key 3 times fast (not implemented) or vehile is dying
+const int VHEF_RELEASE = 2;  /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
+
 float  force_fromtag_power;
 float  force_fromtag_normpower;
 vector force_fromtag_origin;
 float  force_fromtag_power;
 float  force_fromtag_normpower;
 vector force_fromtag_origin;
@@ -86,20 +100,6 @@ void(entity e, vector torque) physics_addtorque = #542; // add relative torque
 
 .float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
 
 
 .float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
 
-// functions used outside the vehicle code
-void vehicles_exit(bool eject);
-void vehicles_enter(entity pl, entity veh);
-
-// vehicle functions
-.void(int _spawnflag) vehicle_spawn;  /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
-.int(int _imp) vehicles_impulse;
-.float vehicle_weapon2mode;
-.void(int exit_flags) vehicle_exit;
-.float() vehicle_enter;
-const int VHEF_NORMAL = 0;  /// User pressed exit key
-const int VHEF_EJECT  = 1;  /// User pressed exit key 3 times fast (not implemented) or vehile is dying
-const int VHEF_RELEASE = 2;  /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
-
 // macros
 #define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
        ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
 // macros
 #define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
        ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
@@ -109,4 +109,7 @@ const int VHEF_RELEASE = 2;  /// Release ownership, client possibly allready dis
        if(trace_fraction != 1) \
                acm += normalize(self.origin - trace_endpos) * (vlen(vel) * mult)
 
        if(trace_fraction != 1) \
                acm += normalize(self.origin - trace_endpos) * (vlen(vel) * mult)
 
+void vehicles_exit(float eject);
+
+#endif
 #endif
 #endif
index c77947fd80d5bf87cc2b11a0d8d36717cbc49783..cf58a8ca9daf0496d2cfa8b56d58629820841f4d 100644 (file)
@@ -51,7 +51,7 @@ float autocvar_g_vehicle_bumblebee_cannon_ammo;
 float autocvar_g_vehicle_bumblebee_cannon_ammo_regen;
 float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause;
 
 float autocvar_g_vehicle_bumblebee_cannon_ammo_regen;
 float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause;
 
-var float autocvar_g_vehicle_bumblebee_cannon_lock = 0;
+float autocvar_g_vehicle_bumblebee_cannon_lock = 0;
 
 float autocvar_g_vehicle_bumblebee_cannon_turnspeed;
 float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down;
 
 float autocvar_g_vehicle_bumblebee_cannon_turnspeed;
 float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down;
@@ -84,9 +84,9 @@ float autocvar_g_vehicle_bumblebee_blowup_radius;
 float autocvar_g_vehicle_bumblebee_blowup_coredamage;
 float autocvar_g_vehicle_bumblebee_blowup_edgedamage;
 float autocvar_g_vehicle_bumblebee_blowup_forceintensity;
 float autocvar_g_vehicle_bumblebee_blowup_coredamage;
 float autocvar_g_vehicle_bumblebee_blowup_edgedamage;
 float autocvar_g_vehicle_bumblebee_blowup_forceintensity;
-var vector autocvar_g_vehicle_bumblebee_bouncepain;
+vector autocvar_g_vehicle_bumblebee_bouncepain;
 
 
-var float autocvar_g_vehicle_bumblebee = 0;
+bool autocvar_g_vehicle_bumblebee = 0;
 
 float bumble_raygun_send(entity to, int sf);
 
 
 float bumble_raygun_send(entity to, int sf);
 
@@ -873,7 +873,7 @@ float v_bumblebee(float req)
                        _body.enemy = self.enemy;
                        _body.scale = 1.5;
                        _body.angles = self.angles;
                        _body.enemy = self.enemy;
                        _body.scale = 1.5;
                        _body.angles = self.angles;
-                       
+
                        pointparticles(particleeffectnum("explosion_medium"), findbetterlocation(self.origin, 16), '0 0 0', 1);
                        
                        self.health                     = 0;
                        pointparticles(particleeffectnum("explosion_medium"), findbetterlocation(self.origin, 16), '0 0 0', 1);
                        
                        self.health                     = 0;
@@ -1178,7 +1178,7 @@ void bumble_raygun_draw()
        }
 }
 
        }
 }
 
-void bumble_raygun_read(float bIsNew)
+void bumble_raygun_read(bool bIsNew)
 {
        int sf = ReadByte();
 
 {
        int sf = ReadByte();
 
index 0a7685fc654da70738203fd63053440ec42edd67..b3aa75ecd2af45430e3b58bdadc393824701262e 100644 (file)
@@ -13,14 +13,14 @@ REGISTER_VEHICLE(
 );
 #else
 
 );
 #else
 
-const float SBRM_FIRST = 1;
-const float SBRM_VOLLY = 1;
-const float SBRM_GUIDE = 2;
-const float SBRM_ARTILLERY = 3;
-const float SBRM_LAST = 3;
+const int SBRM_FIRST = 1;
+const int SBRM_VOLLY = 1;
+const int SBRM_GUIDE = 2;
+const int SBRM_ARTILLERY = 3;
+const int SBRM_LAST = 3;
 
 #ifdef SVQC
 
 #ifdef SVQC
-float autocvar_g_vehicle_spiderbot;
+bool autocvar_g_vehicle_spiderbot;
 
 float autocvar_g_vehicle_spiderbot_respawntime;
 
 
 float autocvar_g_vehicle_spiderbot_respawntime;
 
@@ -41,20 +41,20 @@ float autocvar_g_vehicle_spiderbot_head_pitchlimit_up;
 float autocvar_g_vehicle_spiderbot_head_turnlimit;
 float autocvar_g_vehicle_spiderbot_head_turnspeed;
 
 float autocvar_g_vehicle_spiderbot_head_turnlimit;
 float autocvar_g_vehicle_spiderbot_head_turnspeed;
 
-float autocvar_g_vehicle_spiderbot_health;
+int autocvar_g_vehicle_spiderbot_health;
 float autocvar_g_vehicle_spiderbot_health_regen;
 float autocvar_g_vehicle_spiderbot_health_regen_pause;
 
 float autocvar_g_vehicle_spiderbot_health_regen;
 float autocvar_g_vehicle_spiderbot_health_regen_pause;
 
-float autocvar_g_vehicle_spiderbot_shield;
+int autocvar_g_vehicle_spiderbot_shield;
 float autocvar_g_vehicle_spiderbot_shield_regen;
 float autocvar_g_vehicle_spiderbot_shield_regen_pause;
 
 float autocvar_g_vehicle_spiderbot_minigun_damage;
 float autocvar_g_vehicle_spiderbot_minigun_refire;
 float autocvar_g_vehicle_spiderbot_minigun_spread;
 float autocvar_g_vehicle_spiderbot_shield_regen;
 float autocvar_g_vehicle_spiderbot_shield_regen_pause;
 
 float autocvar_g_vehicle_spiderbot_minigun_damage;
 float autocvar_g_vehicle_spiderbot_minigun_refire;
 float autocvar_g_vehicle_spiderbot_minigun_spread;
-float autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
-float autocvar_g_vehicle_spiderbot_minigun_ammo_max;
-float autocvar_g_vehicle_spiderbot_minigun_ammo_regen;
+int autocvar_g_vehicle_spiderbot_minigun_ammo_cost;
+int autocvar_g_vehicle_spiderbot_minigun_ammo_max;
+int autocvar_g_vehicle_spiderbot_minigun_ammo_regen;
 float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause;
 float autocvar_g_vehicle_spiderbot_minigun_force;
 float autocvar_g_vehicle_spiderbot_minigun_solidpenetration;
 float autocvar_g_vehicle_spiderbot_minigun_ammo_regen_pause;
 float autocvar_g_vehicle_spiderbot_minigun_force;
 float autocvar_g_vehicle_spiderbot_minigun_solidpenetration;
@@ -495,8 +495,8 @@ float spiderbot_frame()
 
                        self = player;
 
 
                        self = player;
 
-                       // TODO: WTF
-                       ((spider.misc_bulletcounter % 2) ? gun = spider.gun1 : gun = spider.gun2);
+                       gun = (spider.misc_bulletcounter % 2) ? spider.gun1 : spider.gun2;
+
                        v = gettaginfo(gun, gettagindex(gun, "barrels"));
                        v_forward = normalize(v_forward);
                        v += v_forward * 50;
                        v = gettaginfo(gun, gettagindex(gun, "barrels"));
                        v_forward = normalize(v_forward);
                        v += v_forward * 50;
@@ -877,8 +877,8 @@ float v_spiderbot(float req)
 
 #endif // SVQC
 #ifdef CSQC
 
 #endif // SVQC
 #ifdef CSQC
-var float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
-var float autocvar_cl_vehicle_spiderbot_cross_size = 1;
+float autocvar_cl_vehicle_spiderbot_cross_alpha = 0.6;
+float autocvar_cl_vehicle_spiderbot_cross_size = 1;
 
 #define spider_ico  "gfx/vehicles/sbot.tga"
 #define spider_rkt  "gfx/vehicles/sbot_rpods.tga"
 
 #define spider_ico  "gfx/vehicles/sbot.tga"
 #define spider_rkt  "gfx/vehicles/sbot_rpods.tga"
index 2436c5c83699cd116dc7659642eb5d311f1a751b..d5b7e8fe9cc45652fccef952e59700dd9e789376 100644 (file)
@@ -2,23 +2,16 @@
 #define VEHICLES_H
 
 // vehicle requests
 #define VEHICLES_H
 
 // vehicle requests
-#define VR_SETUP          1 // (BOTH) setup vehicle data
-#define VR_THINK                 2 // (SERVER) logic to run every frame
-#define VR_DEATH          3 // (SERVER) called when vehicle dies
-#define VR_PRECACHE       4 // (BOTH) precaches models/sounds used by this vehicle
-#define VR_ENTER          5 // (SERVER) called when a player enters this vehicle
-#define VR_SPAWN          6 // (SERVER) called when the vehicle re-spawns
-#define VR_IMPACT         7 // (SERVER) called when a vehicle hits something
-#define VR_HUD            8 // (CLIENT) logic to run every frame
+const int VR_SETUP          = 1; // (BOTH) setup vehicle data
+const int VR_THINK                     = 2; // (SERVER) logic to run every frame
+const int VR_DEATH          = 3; // (SERVER) called when vehicle dies
+const int VR_PRECACHE       = 4; // (BOTH) precaches models/sounds used by this vehicle
+const int VR_ENTER          = 5; // (SERVER) called when a player enters this vehicle
+const int VR_SPAWN          = 6; // (SERVER) called when the vehicle re-spawns
+const int VR_IMPACT         = 7; // (SERVER) called when a vehicle hits something
+const int VR_HUD            = 8; // (CLIENT) logic to run every frame
 
 
-// functions:
-entity get_vehicleinfo(int id);
-
-// fields:
-.entity tur_head;
-
-// flags:
-.int vehicle_flags;
+// vehicle spawn flags (need them here for common registrations)
 const int VHF_ISVEHICLE                        = 2; /// Indicates vehicle
 const int VHF_HASSHIELD                        = 4; /// Vehicle has shileding
 const int VHF_SHIELDREGEN              = 8; /// Vehicles shield regenerates
 const int VHF_ISVEHICLE                        = 2; /// Indicates vehicle
 const int VHF_HASSHIELD                        = 4; /// Vehicle has shileding
 const int VHF_SHIELDREGEN              = 8; /// Vehicles shield regenerates
@@ -34,6 +27,12 @@ const int VHF_DMGHEADROLL            = 4096; /// Add random head angles each frame if heal
 const int VHF_MULTISLOT                        = 8192; /// Vehicle has multiple player slots
 const int VHF_PLAYERSLOT               = 16384; /// This ent is a player slot on a multi-person vehicle
 
 const int VHF_MULTISLOT                        = 8192; /// Vehicle has multiple player slots
 const int VHF_PLAYERSLOT               = 16384; /// This ent is a player slot on a multi-person vehicle
 
+// functions:
+entity get_vehicleinfo(float id);
+
+// fields:
+.entity tur_head;
+
 
 // entity properties of vehicleinfo:
 .int vehicleid; // VEH_...
 
 // entity properties of vehicleinfo:
 .int vehicleid; // VEH_...
index 85b923afa09ead6fd42669c0d3ac4969205f03da..ac174ae0c73480e7f1c0d3e0397ee6ba208c238a 100644 (file)
@@ -1,3 +1,5 @@
+#include "vehicles_include.qh"
+
 #ifdef CSQC
 #include "cl_vehicles.qc"
 #include "vehicles.qc"
 #ifdef CSQC
 #include "cl_vehicles.qc"
 #include "vehicles.qc"
index 409e94cb2638b5c81f4c140a8310a5cd634e4769..4ed5b51114f2e00558cebb2c6cc009ba82c31d9a 100644 (file)
@@ -4,8 +4,7 @@
 #ifdef CSQC
 #include "vehicles.qh"
 #include "cl_vehicles.qh"
 #ifdef CSQC
 #include "vehicles.qh"
 #include "cl_vehicles.qh"
-#endif // CSQC
-#ifdef SVQC
+#elif defined(SVQC)
 #include "vehicles.qh"
 #include "sv_vehicles.qh"
 #endif // SVQC
 #include "vehicles.qh"
 #include "sv_vehicles.qh"
 #endif // SVQC