From fc82c845c5bcd6b0c837ed82db072b0b7eba0239 Mon Sep 17 00:00:00 2001 From: TimePath Date: Sun, 3 May 2015 15:00:21 +1000 Subject: [PATCH] Cleanup vehicle #includes --- qcsrc/Makefile | 5 + qcsrc/common/command/generic.qc | 2 + qcsrc/common/monsters/sv_monsters.qc | 2 +- qcsrc/common/weapons/{all.qh => all.inc} | 13 -- qcsrc/common/weapons/weapons.qc | 2 +- qcsrc/common/weapons/weapons.qh | 6 +- qcsrc/server/antilag.qc | 2 +- qcsrc/server/cl_client.qc | 2 +- qcsrc/server/cl_impulse.qc | 2 +- qcsrc/server/command/cmd.qc | 4 +- qcsrc/server/g_damage.qc | 2 +- qcsrc/server/g_damage.qh | 2 +- qcsrc/server/g_hook.qc | 2 +- qcsrc/server/miscfunctions.qc | 2 +- qcsrc/server/mutators/gamemode_ctf.qc | 4 +- qcsrc/server/mutators/mutators_include.qc | 4 +- qcsrc/server/progs.src | 2 + qcsrc/server/sv_main.qc | 2 +- qcsrc/server/t_halflife.qc | 2 +- qcsrc/server/t_items.qh | 14 +- qcsrc/server/t_teleporters.qc | 2 +- qcsrc/server/vehicles/{vehicles.qh => all.qc} | 9 +- qcsrc/server/vehicles/all.qh | 14 ++ qcsrc/server/vehicles/bumblebee.qc | 1 + qcsrc/server/vehicles/racer.qc | 1 + qcsrc/server/vehicles/raptor.qc | 1 + qcsrc/server/vehicles/spiderbot.qc | 1 + .../vehicles/{vehicles.qc => vehicle.qc} | 29 +-- qcsrc/server/vehicles/vehicle.qh | 197 ++++++++++++++++++ qcsrc/server/vehicles/vehicles_def.qh | 79 ------- qcsrc/test/compilationunit.sh | 6 +- 31 files changed, 267 insertions(+), 149 deletions(-) rename qcsrc/common/weapons/{all.qh => all.inc} (80%) rename qcsrc/server/vehicles/{vehicles.qh => all.qc} (61%) create mode 100644 qcsrc/server/vehicles/all.qh rename qcsrc/server/vehicles/{vehicles.qc => vehicle.qc} (98%) create mode 100644 qcsrc/server/vehicles/vehicle.qh delete mode 100644 qcsrc/server/vehicles/vehicles_def.qh diff --git a/qcsrc/Makefile b/qcsrc/Makefile index abbd25ffd8..f53707e829 100644 --- a/qcsrc/Makefile +++ b/qcsrc/Makefile @@ -15,8 +15,13 @@ QCCFLAGS ?= \ -Werror -fno-bail-on-werror -Wall \ -fftepp -fftepp-predefs -Wcpp -futf8 \ $(QCCFLAGS_WTFS) \ + $(QCCFLAGS_FEATURES) \ $(QCCFLAGS_EXTRA) $(QCCFLAGS_WATERMARK) +QCCFLAGS_FEATURES ?= \ + -DVEHICLES_ENABLED=1 \ + -DVEHICLES_USE_ODE=0 + # xonotic build system overrides this by command line argument to turn off the update-cvarcount step XON_BUILDSYSTEM = diff --git a/qcsrc/common/command/generic.qc b/qcsrc/common/command/generic.qc index dac268d7ed..f0b6d0de5a 100644 --- a/qcsrc/common/command/generic.qc +++ b/qcsrc/common/command/generic.qc @@ -20,6 +20,8 @@ #include "../../server/command/cmd.qh" #include "../../server/command/common.qh" #include "../../server/command/sv_cmd.qh" + + #include "../../common/weapons/config.qh" #endif // ========================================================= diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 225c00fde9..3ff926bf61 100644 --- a/qcsrc/common/monsters/sv_monsters.qc +++ b/qcsrc/common/monsters/sv_monsters.qc @@ -15,7 +15,7 @@ #include "../deathtypes.qh" #include "../../server/mutators/mutators_include.qh" #include "../../server/tturrets/include/turrets_early.qh" - #include "../../server/vehicles/vehicles_def.qh" + #include "../../server/vehicles/vehicle.qh" #include "../../server/campaign.qh" #include "../../server/command/common.qh" #include "../../server/command/cmd.qh" diff --git a/qcsrc/common/weapons/all.qh b/qcsrc/common/weapons/all.inc similarity index 80% rename from qcsrc/common/weapons/all.qh rename to qcsrc/common/weapons/all.inc index b4ee1e25d9..4f4cd2b3d8 100644 --- a/qcsrc/common/weapons/all.qh +++ b/qcsrc/common/weapons/all.inc @@ -1,14 +1,3 @@ -// TODO: include once -//#ifndef WEAPONS_ALL_H -//#define WEAPONS_ALL_H - -#include "../util.qh" - -#ifdef SVQC -# include "config.qh" -# include "../../server/bot/aim.qh" -#endif - // ONLY EVER ADD NEW WEAPONS AT THE END. IF YOU REMOVE ONE, PUT THE LAST ONE ON // ITS PLACE. THIS IS TO AVOID UNNECESSARY RENUMBERING OF WEAPON IMPULSES. // IF YOU DISREGARD THIS NOTICE, I'LL KILL YOU WITH THE @!#%'N TUBA @@ -38,5 +27,3 @@ #include "w_arc.qc" #include "w_hmg.qc" #include "w_rpc.qc" - -//#endif diff --git a/qcsrc/common/weapons/weapons.qc b/qcsrc/common/weapons/weapons.qc index 3ab584fc1e..58fdbaed44 100644 --- a/qcsrc/common/weapons/weapons.qc +++ b/qcsrc/common/weapons/weapons.qc @@ -54,7 +54,7 @@ #ifndef MENUQC #include "calculations.qc" #endif -#include "all.qh" +#include "all.inc" // WEAPON PLUGIN SYSTEM entity weapon_info[WEP_MAXCOUNT]; diff --git a/qcsrc/common/weapons/weapons.qh b/qcsrc/common/weapons/weapons.qh index 593a40e3e8..5f17ccb8f1 100644 --- a/qcsrc/common/weapons/weapons.qh +++ b/qcsrc/common/weapons/weapons.qh @@ -5,6 +5,10 @@ #include "calculations.qh" #endif +#include "../util.qh" +#ifdef SVQC +#include "../../server/bot/aim.qh" +#endif const int MAX_SHOT_DISTANCE = 32768; // weapon pickup ratings for bot logic @@ -199,7 +203,7 @@ void register_weapons_done(); REGISTER_WEAPON_2(WEP_##id,WEPSET_##id,function,ammotype,impulse,flags,rating,color,modelname,simplemdl,crosshair,wepimg,refname,wepname) #endif -#include "all.qh" +#include "all.inc" #undef WEP_ADD_CVAR_MO_PRI #undef WEP_ADD_CVAR_MO_SEC diff --git a/qcsrc/server/antilag.qc b/qcsrc/server/antilag.qc index f9829960d4..f4fe2058b9 100644 --- a/qcsrc/server/antilag.qc +++ b/qcsrc/server/antilag.qc @@ -3,7 +3,7 @@ #elif defined(SVQC) #include "../dpdefs/progsdefs.qh" #include "../dpdefs/dpextensions.qh" - #include "vehicles/vehicles_def.qh" + #include "vehicles/vehicle.qh" #include "antilag.qh" #endif diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 61565b7674..259b7e260c 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -28,7 +28,7 @@ #include "bot/bot.qh" #include "bot/navigation.qh" -#include "vehicles/vehicles_def.qh" +#include "vehicles/vehicle.qh" #include "weapons/hitplot.qh" #include "weapons/weaponsystem.qh" diff --git a/qcsrc/server/cl_impulse.qc b/qcsrc/server/cl_impulse.qc index 8b40f9cf94..2169139c1a 100644 --- a/qcsrc/server/cl_impulse.qc +++ b/qcsrc/server/cl_impulse.qc @@ -10,7 +10,7 @@ #include "weapons/selection.qh" #include "weapons/tracing.qh" #include "weapons/weaponsystem.qh" -#include "vehicles/vehicles_def.qh" +#include "vehicles/vehicle.qh" #include "waypointsprites.qh" #include "../common/weapons/weapons.qh" diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 13bf15e88a..eadb8ecff4 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -16,7 +16,9 @@ #include "../mutators/mutators_include.qh" -#include "../vehicles/vehicles_def.qh" +#ifdef SVQC + #include "../vehicles/vehicle.qh" +#endif #include "../../common/constants.qh" #include "../../common/deathtypes.qh" diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index beed2e1b3e..42bce3e619 100644 --- a/qcsrc/server/g_damage.qc +++ b/qcsrc/server/g_damage.qc @@ -8,7 +8,7 @@ #include "spawnpoints.qh" #include "tturrets/include/turrets_early.qh" #include "t_items.qh" -#include "vehicles/vehicles_def.qh" +#include "vehicles/vehicle.qh" #include "weapons/accuracy.qh" #include "weapons/csqcprojectile.qh" #include "weapons/selection.qh" diff --git a/qcsrc/server/g_damage.qh b/qcsrc/server/g_damage.qh index b98693de6c..49f495bc4a 100644 --- a/qcsrc/server/g_damage.qh +++ b/qcsrc/server/g_damage.qh @@ -22,7 +22,7 @@ #include "../common/deathtypes.qh" #include "mutators/mutators_include.qh" #include "tturrets/include/turrets_early.qh" - #include "vehicles/vehicles_def.qh" + #include "vehicles/vehicle.qh" #include "../csqcmodellib/sv_model.qh" #include "../common/playerstats.qh" #include "g_hook.qh" diff --git a/qcsrc/server/g_hook.qc b/qcsrc/server/g_hook.qc index 1c6c3a7d86..3445b65c5f 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -9,7 +9,7 @@ #include "t_teleporters.qh" #include "command/common.qh" #include "round_handler.qh" -#include "vehicles/vehicles_def.qh" +#include "vehicles/vehicle.qh" #include "../common/constants.qh" #include "../common/util.qh" #include "../common/weapons/weapons.qh" diff --git a/qcsrc/server/miscfunctions.qc b/qcsrc/server/miscfunctions.qc index 4a0139080c..970c051c12 100644 --- a/qcsrc/server/miscfunctions.qc +++ b/qcsrc/server/miscfunctions.qc @@ -4,6 +4,7 @@ #include "antilag.qh" #include "command/common.qh" #include "constants.qh" +#include "g_hook.qh" #include "ipban.qh" #include "mutators/mutators_include.qh" #include "tturrets/include/turrets_early.qh" @@ -1461,7 +1462,6 @@ float SUB_NoImpactCheck() #define SUB_OwnerCheck() (other && (other == self.owner)) -void RemoveGrapplingHook(entity pl); void W_Crylink_Dequeue(entity e); float WarpZone_Projectile_Touch_ImpactFilter_Callback() { diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index d40263fb72..99a85d11e8 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -3,7 +3,9 @@ #include "gamemode.qh" -#include "../vehicles/vehicles_def.qh" +#ifdef SVQC +#include "../vehicles/vehicle.qh" +#endif #include "../../warpzonelib/common.qh" #include "../../warpzonelib/mathlib.qh" diff --git a/qcsrc/server/mutators/mutators_include.qc b/qcsrc/server/mutators/mutators_include.qc index 350f10a72a..4c591446b7 100644 --- a/qcsrc/server/mutators/mutators_include.qc +++ b/qcsrc/server/mutators/mutators_include.qc @@ -46,7 +46,7 @@ #include "../../common/deathtypes.qh" #include "mutators_include.qh" #include "../tturrets/include/turrets_early.qh" - #include "../vehicles/vehicles_def.qh" + #include "../vehicles/vehicle.qh" #include "../campaign.qh" #include "../../common/campaign_common.qh" #include "../../common/mapinfo.qh" @@ -77,7 +77,7 @@ #include "../secret.qh" #include "../pathlib/pathlib.qh" #include "../tturrets/include/turrets.qh" - #include "../vehicles/vehicles.qh" + #include "../vehicles/all.qh" #endif #include "base.qc" diff --git a/qcsrc/server/progs.src b/qcsrc/server/progs.src index 6b93a92b72..9d86a375f9 100644 --- a/qcsrc/server/progs.src +++ b/qcsrc/server/progs.src @@ -83,6 +83,8 @@ pathlib/movenode.qc pathlib/path_waypoint.qc pathlib/utility.qc +vehicles/all.qc + weapons/accuracy.qc weapons/common.qc weapons/csqcprojectile.qc // TODO diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 5779a511db..b52c2d7db9 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -10,7 +10,7 @@ #include "command/common.qh" #include "mutators/mutators_include.qh" -#include "vehicles/vehicles_def.qh" +#include "vehicles/vehicle.qh" #include "weapons/csqcprojectile.qh" #include "../common/constants.qh" diff --git a/qcsrc/server/t_halflife.qc b/qcsrc/server/t_halflife.qc index 754c52b49a..299db79734 100644 --- a/qcsrc/server/t_halflife.qc +++ b/qcsrc/server/t_halflife.qc @@ -1,7 +1,7 @@ #include "_.qh" #include "../warpzonelib/util_server.qh" -#include "vehicles/vehicles_def.qh" +#include "vehicles/vehicle.qh" .float ladder_time; .entity ladder_entity; diff --git a/qcsrc/server/t_items.qh b/qcsrc/server/t_items.qh index 143395ba86..ef5813c6ba 100644 --- a/qcsrc/server/t_items.qh +++ b/qcsrc/server/t_items.qh @@ -63,13 +63,6 @@ const int ISF_SIZE = 128; .int ItemStatus; -void spawnfunc_item_strength(); -void spawnfunc_item_invincible(); -void spawnfunc_item_armor_small(); -void spawnfunc_item_shells(); -void spawnfunc_item_bullets(); -void spawnfunc_item_rockets(); - #ifdef CSQC float autocvar_cl_animate_items = 1; @@ -91,6 +84,13 @@ void ItemRead(float _IsNew); #endif #ifdef SVQC +void spawnfunc_item_strength(); +void spawnfunc_item_invincible(); +void spawnfunc_item_armor_small(); +void spawnfunc_item_shells(); +void spawnfunc_item_bullets(); +void spawnfunc_item_rockets(); + float autocvar_sv_simple_items; bool ItemSend(entity to, int sf); diff --git a/qcsrc/server/t_teleporters.qc b/qcsrc/server/t_teleporters.qc index b3266f38d6..e9f381d317 100644 --- a/qcsrc/server/t_teleporters.qc +++ b/qcsrc/server/t_teleporters.qc @@ -6,7 +6,7 @@ #include "g_hook.qh" #include "bot/waypoints.qh" #include "tturrets/include/turrets_early.qh" -#include "vehicles/vehicles_def.qh" +#include "vehicles/vehicle.qh" #include "weapons/csqcprojectile.qh" #include "../common/constants.qh" #include "../common/deathtypes.qh" diff --git a/qcsrc/server/vehicles/vehicles.qh b/qcsrc/server/vehicles/all.qc similarity index 61% rename from qcsrc/server/vehicles/vehicles.qh rename to qcsrc/server/vehicles/all.qc index ec152d7f7b..33e0c710c3 100644 --- a/qcsrc/server/vehicles/vehicles.qh +++ b/qcsrc/server/vehicles/all.qc @@ -1,8 +1,5 @@ -#ifndef VEHICLES_H -#define VEHICLES_H - -#ifdef VEHICLES_ENABLED -# include "vehicles.qc" +#if VEHICLES_ENABLED +# include "vehicle.qc" # include "racer.qc" # include "raptor.qc" @@ -12,5 +9,3 @@ # include "bumblebee.qc" # endif #endif - -#endif diff --git a/qcsrc/server/vehicles/all.qh b/qcsrc/server/vehicles/all.qh new file mode 100644 index 0000000000..c675c9cbfd --- /dev/null +++ b/qcsrc/server/vehicles/all.qh @@ -0,0 +1,14 @@ +#ifndef VEHICLES_H +#define VEHICLES_H + +#if VEHICLES_ENABLED +# include "racer.qh" +# include "raptor.qh" +# include "spiderbot.qh" + +# ifndef VEHICLES_NO_UNSTABLE +# include "bumblebee.qh" +# endif +#endif + +#endif diff --git a/qcsrc/server/vehicles/bumblebee.qc b/qcsrc/server/vehicles/bumblebee.qc index dfbcd4c36e..3fd45ee7c4 100644 --- a/qcsrc/server/vehicles/bumblebee.qc +++ b/qcsrc/server/vehicles/bumblebee.qc @@ -1,3 +1,4 @@ +#include "vehicle.qh" #include "bumblebee.qh" #ifdef SVQC diff --git a/qcsrc/server/vehicles/racer.qc b/qcsrc/server/vehicles/racer.qc index 49cebfc46b..545e309e4f 100644 --- a/qcsrc/server/vehicles/racer.qc +++ b/qcsrc/server/vehicles/racer.qc @@ -1,3 +1,4 @@ +#include "vehicle.qh" #include "racer.qh" #ifdef SVQC diff --git a/qcsrc/server/vehicles/raptor.qc b/qcsrc/server/vehicles/raptor.qc index 74d3c7a689..5c14fb7935 100644 --- a/qcsrc/server/vehicles/raptor.qc +++ b/qcsrc/server/vehicles/raptor.qc @@ -1,3 +1,4 @@ +#include "vehicle.qh" #include "raptor.qh" #ifdef SVQC diff --git a/qcsrc/server/vehicles/spiderbot.qc b/qcsrc/server/vehicles/spiderbot.qc index 10ab353ec8..c2a59fd183 100644 --- a/qcsrc/server/vehicles/spiderbot.qc +++ b/qcsrc/server/vehicles/spiderbot.qc @@ -1,3 +1,4 @@ +#include "vehicle.qh" #include "spiderbot.qh" #ifdef SVQC diff --git a/qcsrc/server/vehicles/vehicles.qc b/qcsrc/server/vehicles/vehicle.qc similarity index 98% rename from qcsrc/server/vehicles/vehicles.qc rename to qcsrc/server/vehicles/vehicle.qc index 3778b04055..b7ec7685cf 100644 --- a/qcsrc/server/vehicles/vehicles.qc +++ b/qcsrc/server/vehicles/vehicle.qc @@ -1,12 +1,12 @@ -#include "vehicles.qh" +#include "vehicle.qh" +#include "../_.qh" #include "../cl_player.qh" +#include "../../common/constants.qh" #include "../waypointsprites.qh" #include "../bot/waypoints.qh" -.float() PlayerPhysplug; - float autocvar_g_vehicles_crush_dmg; float autocvar_g_vehicles_crush_force; float autocvar_g_vehicles_delayspawn; @@ -23,7 +23,6 @@ float autocvar_g_vehicles; void vehicles_damage(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force); void vehicles_return(); void vehicles_enter(); -void vehicles_touch(); void vehicles_reset_colors(); void vehicles_clearreturn(); void vehicles_setreturn(); @@ -123,23 +122,7 @@ void CSQCVehicleSetup(entity own, float vehicle_id) WriteByte(MSG_ONE, 1 + own.vehicle.vehicle_weapon2mode + HUD_VEHICLE_LAST); } -/** vehicles_locktarget - - Generic target locking. - - Figure out if what target is "locked" (if any), for missile tracking as such. - after calling, "if(self.lock_target != world && self.lock_strength == 1)" mean - you have a locked in target. - - Exspects a crosshair_trace() or equivalent to be - dont before calling. - -**/ -.entity lock_target; -.float lock_strength; -.float lock_time; -.float lock_soundtime; const float DAMAGE_TARGETDRONE = 10; vector targetdrone_getnewspot() @@ -328,8 +311,6 @@ void vehicles_locktarget(float incr, float decr, float _lock_time) } } -#define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \ -ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100 #define vehicles_sweap_collision(orig,vel,dt,acm,mult) \ traceline(orig, orig + vel * dt, MOVE_NORMAL, self); \ @@ -338,7 +319,6 @@ if(trace_fraction != 1) \ // Hover movement support float force_fromtag_power; -float force_fromtag_normpower; vector force_fromtag_origin; vector vehicles_force_fromtag_hover(string tag_name, float spring_length, float max_power) { @@ -568,7 +548,6 @@ void vehicles_impact(float _minspeed, float _speedfac, float _maxpain) } } -.void() vehicle_impact; void vehicles_touch() { if(MUTATOR_CALLHOOK(VehicleTouch)) @@ -604,7 +583,7 @@ void vehicles_touch() vehicles_enter(); } -float autocvar_g_vehicles_allow_bots = 0; +.float monster_attack; void vehicles_enter() { // Remove this when bots know how to use vehicles diff --git a/qcsrc/server/vehicles/vehicle.qh b/qcsrc/server/vehicles/vehicle.qh new file mode 100644 index 0000000000..3b9368bf11 --- /dev/null +++ b/qcsrc/server/vehicles/vehicle.qh @@ -0,0 +1,197 @@ +#ifndef VEHICLE_H +#define VEHICLE_H + +#include "../_.qh" + +#include "../antilag.qh" +#include "../cl_player.qh" +#include "../g_damage.qh" +#include "../g_hook.qh" +#include "../g_subs.qh" +#include "../movelib.qh" + +#include "../bot/bot.qh" + +#include "../command/common.qh" + +#include "../tturrets/include/turrets_early.qh" + +#include "../weapons/tracing.qh" + +#include "../../common/deathtypes.qh" +#include "../../common/stats.qh" + +#include "../../warpzonelib/anglestransform.qh" +#include "../../warpzonelib/server.qh" + +entity vehicles_projectile(string _mzlfx, string _mzlsound, + vector _org, vector _vel, + float _dmg, float _radi, float _force, float _size, + float _deahtype, float _projtype, float _health, + float _cull, float _clianim, entity _owner); + +vector vehicles_findgoodexit(vector prefer_spot); + + + +/** vehicles_locktarget + + Generic target locking. + + Figure out if what target is "locked" (if any), for missile tracking as such. + + after calling, "if(self.lock_target != world && self.lock_strength == 1)" mean + you have a locked in target. + + Exspects a crosshair_trace() or equivalent to be + dont before calling. + +**/ +.entity lock_target; +.float lock_strength; +.float lock_time; +.float lock_soundtime; + +void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, int axh_id); + +vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string _tagname, + float _pichlimit_min, float _pichlimit_max, + float _rotlimit_min, float _rotlimit_max, float _aimspeed); + +#define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \ +ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100 + +void CSQCVehicleSetup(entity own, float vehicle_id); + +.float() PlayerPhysplug; + +float autocvar_g_vehicles_allow_bots = 0; + +void vehicles_touch(); + +void vehicles_regen(float timer, .float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale); + +float shortangle_f(float ang1, float ang2); +float anglemods(float v); + +entity vehicle_tossgib(entity _template, vector _vel, string _tag, float _burn, float _explode, float _maxtime, vector _rot); + +void vehicles_impact(float _minspeed, float _speedfac, float _maxpain); + +void shieldhit_think(); + +float vehicle_addplayerslot( entity _owner, + entity _slot, + float _hud, + string _hud_model, + float() _framefunc, + void(float) _exitfunc); + +.void() vehicle_impact; + +float vehicle_initialize(string net_name, + string bodymodel, + string topmodel, + string hudmodel, + string toptag, + string hudtag, + string viewtag, + float vhud, + vector min_s, + vector max_s, + float nodrop, + void(float _spawnflag) spawnproc, + float _respawntime, + float() physproc, + void() enterproc, + void(float extflag) exitfunc, + void() dieproc, + void() thinkproc, + float use_csqc, + float _max_health, + float _max_shield); + +float force_fromtag_normpower; + +void vehicles_painframe(); + +void vehicles_locktarget(float incr, float decr, float _lock_time); + +vector vehicles_force_fromtag_maglev(string tag_name, float spring_length, float max_power); + +vector vehicles_force_fromtag_hover(string tag_name, float spring_length, float max_power); + +void vehicles_projectile_explode(); + +#if VEHICLES_ENABLED + +.int vehicle_flags; +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_HEALTHREGEN = 16; /// Vehicles health regenerates +const int VHF_ENERGYREGEN = 32; /// Vehicles energy regenerates +const int VHF_DEATHEJECT = 64; /// Vehicle ejects pilot upon fatal damage +const int VHF_MOVE_GROUND = 128; /// Vehicle moves on gound +const int VHF_MOVE_HOVER = 256; /// Vehicle hover close to gound +const int VHF_MOVE_FLY = 512; /// Vehicle is airborn +const int VHF_DMGSHAKE = 1024; /// Add random velocity each frame if health < 50% +const int VHF_DMGROLL = 2048; /// Add random angles each frame if health < 50% +const int VHF_DMGHEADROLL = 4096; /// Add random head angles each frame if health < 50% +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 + +.entity gun1; +.entity gun2; +.entity gun3; +.entity vehicle_shieldent; /// Entity to disply the shild effect on damage +.entity vehicle; +.entity vehicle_viewport; +.entity vehicle_hudmodel; +.entity vehicle_controller; + +.entity gunner1; +.entity gunner2; + +.float vehicle_health; /// If self is player this is 0..100 indicating precentage of health left on vehicle. If self is vehile, this is the real health value. +.float vehicle_energy; /// If self is player this is 0..100 indicating precentage of energy left on vehicle. If self is vehile, this is the real energy value. +.float vehicle_shield; /// If self is player this is 0..100 indicating precentage of shield left on vehicle. If self is vehile, this is the real shield value. + +.float vehicle_ammo1; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real ammo1 value. +.float vehicle_reload1; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload1 value. +.float vehicle_ammo2; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real ammo2 value. +.float vehicle_reload2; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload2 value. + +.float sound_nexttime; +const float VOL_VEHICLEENGINE = 1; + +.float hud; +.float dmg_time; +.float vehicle_respawntime; +//.void() vehicle_spawn; + +void vehicles_exit(float eject); +.void(float exit_flags) vehicle_exit; +const float VHEF_NORMAL = 0; /// User pressed exit key +const float VHEF_EJECT = 1; /// User pressed exit key 3 times fast (not implemented) or vehile is dying +const float VHEF_RELESE = 2; /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented) + +const float SVC_SETVIEWPORT = 5; // Net.Protocol 0x05 +const float SVC_SETVIEWANGLES = 10; // Net.Protocol 0x0A +const float SVC_UPDATEENTITY = 128; // Net.Protocol 0x80 + +.void() vehicle_enter; /// Vehicles custom funciton to be executed when owner exit it +.void() vehicle_die; /// Vehicles custom function to be executed when vehile die +const float VHSF_NORMAL = 0; +const float VHSF_FACTORY = 2; +.void(float _spawnflag) vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns +.float(float _imp) vehicles_impulse; +.float vehicle_weapon2mode; + +#if VEHICLES_USE_ODE +void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object +void(entity e, vector force, vector force_pos) physics_addforce = #541; // apply a force from certain origin, length of force vector is power of force +void(entity e, vector torque) physics_addtorque = #542; // add relative torque +#endif // VEHICLES_USE_ODE +#endif // VEHICLES_ENABLED +#endif diff --git a/qcsrc/server/vehicles/vehicles_def.qh b/qcsrc/server/vehicles/vehicles_def.qh deleted file mode 100644 index 20f7ade398..0000000000 --- a/qcsrc/server/vehicles/vehicles_def.qh +++ /dev/null @@ -1,79 +0,0 @@ -#ifndef VEHICLES_DEF_H -#define VEHICLES_DEF_H - -#include "../tturrets/include/turrets_early.qh" - -// #define VEHICLES_USE_ODE -#define VEHICLES_ENABLED -#ifdef VEHICLES_ENABLED - -.int vehicle_flags; -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_HEALTHREGEN = 16; /// Vehicles health regenerates -const int VHF_ENERGYREGEN = 32; /// Vehicles energy regenerates -const int VHF_DEATHEJECT = 64; /// Vehicle ejects pilot upon fatal damage -const int VHF_MOVE_GROUND = 128; /// Vehicle moves on gound -const int VHF_MOVE_HOVER = 256; /// Vehicle hover close to gound -const int VHF_MOVE_FLY = 512; /// Vehicle is airborn -const int VHF_DMGSHAKE = 1024; /// Add random velocity each frame if health < 50% -const int VHF_DMGROLL = 2048; /// Add random angles each frame if health < 50% -const int VHF_DMGHEADROLL = 4096; /// Add random head angles each frame if health < 50% -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 - -.entity gun1; -.entity gun2; -.entity gun3; -.entity vehicle_shieldent; /// Entity to disply the shild effect on damage -.entity vehicle; -.entity vehicle_viewport; -.entity vehicle_hudmodel; -.entity vehicle_controller; - -.entity gunner1; -.entity gunner2; - -.float vehicle_health; /// If self is player this is 0..100 indicating precentage of health left on vehicle. If self is vehile, this is the real health value. -.float vehicle_energy; /// If self is player this is 0..100 indicating precentage of energy left on vehicle. If self is vehile, this is the real energy value. -.float vehicle_shield; /// If self is player this is 0..100 indicating precentage of shield left on vehicle. If self is vehile, this is the real shield value. - -.float vehicle_ammo1; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real ammo1 value. -.float vehicle_reload1; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload1 value. -.float vehicle_ammo2; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real ammo2 value. -.float vehicle_reload2; /// If self is player this field's use depends on the individual vehile. If self is vehile, this is the real reload2 value. - -.float sound_nexttime; -const float VOL_VEHICLEENGINE = 1; - -.float hud; -.float dmg_time; -.float vehicle_respawntime; -//.void() vehicle_spawn; - -void vehicles_exit(float eject); -.void(float exit_flags) vehicle_exit; -const float VHEF_NORMAL = 0; /// User pressed exit key -const float VHEF_EJECT = 1; /// User pressed exit key 3 times fast (not implemented) or vehile is dying -const float VHEF_RELESE = 2; /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented) - -const float SVC_SETVIEWPORT = 5; // Net.Protocol 0x05 -const float SVC_SETVIEWANGLES = 10; // Net.Protocol 0x0A -const float SVC_UPDATEENTITY = 128; // Net.Protocol 0x80 - -.void() vehicle_enter; /// Vehicles custom funciton to be executed when owner exit it -.void() vehicle_die; /// Vehicles custom function to be executed when vehile die -const float VHSF_NORMAL = 0; -const float VHSF_FACTORY = 2; -.void(float _spawnflag) vehicle_spawn; /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns -.float(float _imp) vehicles_impulse; -.float vehicle_weapon2mode; - -#ifdef VEHICLES_USE_ODE -void(entity e, float physics_enabled) physics_enable = #540; // enable or disable physics on object -void(entity e, vector force, vector force_pos) physics_addforce = #541; // apply a force from certain origin, length of force vector is power of force -void(entity e, vector torque) physics_addtorque = #542; // add relative torque -#endif // VEHICLES_USE_ODE -#endif // VEHICLES_ENABLED -#endif diff --git a/qcsrc/test/compilationunit.sh b/qcsrc/test/compilationunit.sh index 09539c6d7e..784784f3b1 100755 --- a/qcsrc/test/compilationunit.sh +++ b/qcsrc/test/compilationunit.sh @@ -8,6 +8,10 @@ declare -a NOWARN=( '-Wno-unused-variable' '-Wno-implicit-function-pointer' ) +declare -a FEATURES=( + '-DVEHICLES_ENABLED=1' + '-DVEHICLES_USE_ODE=0' +) declare QCC=../../../gmqcc/gmqcc function check() { @@ -15,7 +19,7 @@ function check() { declare -la predefs=("${!2}") find "$base" -type f -name '*.qc' -print0 | sort -z | while IFS= read -r -d '' file; do echo "$file" - ${QCC} -std=gmqcc -fftepp -fftepp-predefs -Werror -Wall "${NOWARN[@]}" -futf8 -O3 "${predefs[@]}" "$file" >/dev/null + ${QCC} -std=gmqcc -fftepp -fftepp-predefs -Werror -Wall "${NOWARN[@]}" "${FEATURES[@]}" -futf8 -O3 "${predefs[@]}" "$file" >/dev/null done } -- 2.39.2