From: Mario Date: Wed, 25 Feb 2015 01:02:27 +0000 (+1100) Subject: Some minor cleanup X-Git-Tag: xonotic-v0.8.2~2059^2~10 X-Git-Url: https://git.xonotic.org/?a=commitdiff_plain;h=4e615efc30160e953002afd04d3eaad8a9881db2;p=xonotic%2Fxonotic-data.pk3dir.git Some minor cleanup --- diff --git a/qcsrc/common/vehicles/cl_vehicles.qc b/qcsrc/common/vehicles/cl_vehicles.qc index 9a2598f82..8c4bd6044 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qc +++ b/qcsrc/common/vehicles/cl_vehicles.qc @@ -13,8 +13,8 @@ #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]; @@ -52,9 +52,9 @@ void AuxiliaryXhair_Draw2D() 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?) diff --git a/qcsrc/common/vehicles/cl_vehicles.qh b/qcsrc/common/vehicles/cl_vehicles.qh index 62682e262..3f0d8cfb2 100644 --- a/qcsrc/common/vehicles/cl_vehicles.qh +++ b/qcsrc/common/vehicles/cl_vehicles.qh @@ -2,8 +2,8 @@ #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); @@ -14,13 +14,12 @@ void RaptorCBShellfragDraw(); 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 - \ No newline at end of file diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index 49d6b3e7d..9ffb17753 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -1,7 +1,5 @@ -// ========================= -// SVQC Vehicle Properties -// ========================= - +#include "vehicles.qh" +#include "sv_vehicles.qh" 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); + pointparticles(particleeffectnum("explosion_small"), self.wp00.origin + '0 0 64', '0 0 0', 1); 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; diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index c10279384..c0e344044 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -1,5 +1,6 @@ #ifndef VEHICLES_DEF_H #define VEHICLES_DEF_H +#ifdef SVQC #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; +// flags: +.int vehicle_flags; + // vehicle definitions .entity gun1; .entity gun2; @@ -59,7 +63,7 @@ const float VHSF_FACTORY = 2; .int hud; .float dmg_time; -.float volly_counter; +.int volly_counter; 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; +// 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; @@ -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 -// 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 @@ -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) +void vehicles_exit(float eject); + +#endif #endif diff --git a/qcsrc/common/vehicles/unit/bumblebee.qc b/qcsrc/common/vehicles/unit/bumblebee.qc index c77947fd8..cf58a8ca9 100644 --- a/qcsrc/common/vehicles/unit/bumblebee.qc +++ b/qcsrc/common/vehicles/unit/bumblebee.qc @@ -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; -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; @@ -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; -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); @@ -873,7 +873,7 @@ float v_bumblebee(float req) _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; @@ -1178,7 +1178,7 @@ void bumble_raygun_draw() } } -void bumble_raygun_read(float bIsNew) +void bumble_raygun_read(bool bIsNew) { int sf = ReadByte(); diff --git a/qcsrc/common/vehicles/unit/spiderbot.qc b/qcsrc/common/vehicles/unit/spiderbot.qc index 0a7685fc6..b3aa75ecd 100644 --- a/qcsrc/common/vehicles/unit/spiderbot.qc +++ b/qcsrc/common/vehicles/unit/spiderbot.qc @@ -13,14 +13,14 @@ REGISTER_VEHICLE( ); #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 -float autocvar_g_vehicle_spiderbot; +bool autocvar_g_vehicle_spiderbot; 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_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_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_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; @@ -495,8 +495,8 @@ float spiderbot_frame() 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; @@ -877,8 +877,8 @@ float v_spiderbot(float req) #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" diff --git a/qcsrc/common/vehicles/vehicles.qh b/qcsrc/common/vehicles/vehicles.qh index 2436c5c83..d5b7e8fe9 100644 --- a/qcsrc/common/vehicles/vehicles.qh +++ b/qcsrc/common/vehicles/vehicles.qh @@ -2,23 +2,16 @@ #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 @@ -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 +// functions: +entity get_vehicleinfo(float id); + +// fields: +.entity tur_head; + // entity properties of vehicleinfo: .int vehicleid; // VEH_... diff --git a/qcsrc/common/vehicles/vehicles_include.qc b/qcsrc/common/vehicles/vehicles_include.qc index 85b923afa..ac174ae0c 100644 --- a/qcsrc/common/vehicles/vehicles_include.qc +++ b/qcsrc/common/vehicles/vehicles_include.qc @@ -1,3 +1,5 @@ +#include "vehicles_include.qh" + #ifdef CSQC #include "cl_vehicles.qc" #include "vehicles.qc" diff --git a/qcsrc/common/vehicles/vehicles_include.qh b/qcsrc/common/vehicles/vehicles_include.qh index 409e94cb2..4ed5b5111 100644 --- a/qcsrc/common/vehicles/vehicles_include.qh +++ b/qcsrc/common/vehicles/vehicles_include.qh @@ -4,8 +4,7 @@ #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