From: TimePath Date: Sat, 22 Aug 2015 03:28:46 +0000 (+1000) Subject: Simplify headers X-Git-Tag: xonotic-v0.8.2~2053^2~5 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=8f935a3cd36d703f480691e5fe61ecaac0ebb5c0;p=xonotic%2Fxonotic-data.pk3dir.git Simplify headers --- diff --git a/qcsrc/client/damage.qc b/qcsrc/client/damage.qc index fb80a52a0..2b22464ba 100644 --- a/qcsrc/client/damage.qc +++ b/qcsrc/client/damage.qc @@ -4,7 +4,7 @@ #include "gibs.qh" #include "prandom.qh" -#include "../common/vehicles/cl_vehicles.qh" +#include "../common/vehicles/all.qh" #include "../common/constants.qh" #include "../common/deathtypes.qh" diff --git a/qcsrc/client/main.qc b/qcsrc/client/main.qc index 231dd6867..84358c4f9 100644 --- a/qcsrc/client/main.qc +++ b/qcsrc/client/main.qc @@ -23,9 +23,7 @@ #include "wall.qh" #include "waypointsprites.qh" -#include "../common/vehicles/unit/bumblebee.qh" -#include "../common/vehicles/cl_vehicles.qh" -#include "../common/vehicles/vehicles.qh" +#include "../common/vehicles/all.qh" #include "weapons/projectile.qh" diff --git a/qcsrc/client/progs.src b/qcsrc/client/progs.src index ea61aed0d..b80d787ca 100644 --- a/qcsrc/client/progs.src +++ b/qcsrc/client/progs.src @@ -68,7 +68,7 @@ weapons/projectile.qc // TODO ../csqcmodellib/cl_player.qc ../csqcmodellib/interpolate.qc -../common/vehicles/vehicles_include.qc +../common/vehicles/all.qc ../server/mutators/mutator_multijump.qc diff --git a/qcsrc/common/monsters/sv_monsters.qc b/qcsrc/common/monsters/sv_monsters.qc index 887ac20ec..f9660c02f 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 "../vehicles/sv_vehicles.qh" + #include "../vehicles/all.qh" #include "../../server/campaign.qh" #include "../../server/command/common.qh" #include "../../server/command/cmd.qh" diff --git a/qcsrc/common/triggers/teleporters.qc b/qcsrc/common/triggers/teleporters.qc index a58371647..25b18dd09 100644 --- a/qcsrc/common/triggers/teleporters.qc +++ b/qcsrc/common/triggers/teleporters.qc @@ -16,7 +16,7 @@ #include "../../server/defs.qh" #include "../deathtypes.qh" #include "../../server/tturrets/include/turrets_early.qh" - #include "../vehicles/sv_vehicles.qh" + #include "../vehicles/all.qh" #include "../mapinfo.qh" #include "../../server/anticheat.qh" #endif diff --git a/qcsrc/common/vehicles/all.inc b/qcsrc/common/vehicles/all.inc new file mode 100644 index 000000000..eda4e00bb --- /dev/null +++ b/qcsrc/common/vehicles/all.inc @@ -0,0 +1,6 @@ +#include "unit/spiderbot.qc" +#include "unit/raptor.qc" +#include "unit/racer.qc" +#ifndef VEHICLES_NO_UNSTABLE + #include "unit/bumblebee.qc" +#endif diff --git a/qcsrc/common/vehicles/all.qc b/qcsrc/common/vehicles/all.qc new file mode 100644 index 000000000..2c45308b4 --- /dev/null +++ b/qcsrc/common/vehicles/all.qc @@ -0,0 +1,102 @@ +#ifndef VEHICLES_ALL_C +#define VEHICLES_ALL_C + +#include "all.qh" + +#if defined(SVQC) + #include "sv_vehicles.qc" +#elif defined(CSQC) + #include "cl_vehicles.qc" +#endif + +#define IMPLEMENTATION +#include "all.inc" +#undef IMPLEMENTATION + +// VEHICLE PLUGIN SYSTEM +entity vehicle_info[VEH_MAXCOUNT]; +entity dummy_vehicle_info; + +void vehicles_common_initialize() +{ +#ifdef CSQC + precache_model("models/vehicles/bomblet.md3"); + precache_model("models/vehicles/clusterbomb.md3"); + precache_model("models/vehicles/clusterbomb_fragment.md3"); + precache_model("models/vehicles/rocket01.md3"); + precache_model("models/vehicles/rocket02.md3"); + + precache_sound ("vehicles/alarm.wav"); + precache_sound ("vehicles/alarm_shield.wav"); +#endif // CSQC +#ifdef SVQC + precache_sound("onslaught/ons_hit2.wav"); + precache_sound("onslaught/electricity_explode.wav"); + + addstat(STAT_HUD, AS_INT, hud); + addstat(STAT_VEHICLESTAT_HEALTH, AS_INT, vehicle_health); + addstat(STAT_VEHICLESTAT_SHIELD, AS_INT, vehicle_shield); + addstat(STAT_VEHICLESTAT_ENERGY, AS_INT, vehicle_energy); + + addstat(STAT_VEHICLESTAT_W2MODE, AS_INT, vehicle_weapon2mode); + + addstat(STAT_VEHICLESTAT_AMMO1, AS_INT, vehicle_ammo1); + addstat(STAT_VEHICLESTAT_RELOAD1, AS_INT, vehicle_reload1); + + addstat(STAT_VEHICLESTAT_AMMO2, AS_INT, vehicle_ammo2); + addstat(STAT_VEHICLESTAT_RELOAD2, AS_INT, vehicle_reload2); +#endif // SVQC +} + +void register_vehicle(float id, float(float) func, float vehicleflags, vector min_s, vector max_s, string modelname, string headmodelname, string hudmodelname, string headtag, string hudtag, string viewtag, string shortname, string vname) +{ + entity e; + vehicle_info[id - 1] = e = spawn(); + e.classname = "vehicle_info"; + e.vehicleid = id; + e.netname = shortname; + e.vehicle_name = vname; + e.vehicle_func = func; + e.mdl = modelname; + e.spawnflags = vehicleflags; + e.mins = min_s; + e.maxs = max_s; + e.model = modelname; + e.head_model = headmodelname; + e.hud_model = hudmodelname; + e.tag_head = headtag; + e.tag_hud = hudtag; + e.tag_view = viewtag; + + #ifndef MENUQC + vehicles_common_initialize(); + #endif +} +float v_null(float dummy) { return 0; } +void register_vehicles_done() +{ + dummy_vehicle_info = spawn(); + dummy_vehicle_info.classname = "vehicle_info"; + dummy_vehicle_info.vehicleid = 0; // you can recognize dummies by this + dummy_vehicle_info.netname = ""; + dummy_vehicle_info.vehicle_name = "Vehicle"; + dummy_vehicle_info.vehicle_func = v_null; + dummy_vehicle_info.mdl = ""; + dummy_vehicle_info.mins = '-0 -0 -0'; + dummy_vehicle_info.maxs = '0 0 0'; + dummy_vehicle_info.model = ""; + dummy_vehicle_info.head_model = ""; + dummy_vehicle_info.hud_model = ""; +} +entity get_vehicleinfo(float id) +{ + entity m; + if(id < VEH_FIRST || id > VEH_LAST) + return dummy_vehicle_info; + m = vehicle_info[id - 1]; + if(m) + return m; + return dummy_vehicle_info; +} + +#endif diff --git a/qcsrc/common/vehicles/all.qh b/qcsrc/common/vehicles/all.qh index 48ff80418..03be2127f 100644 --- a/qcsrc/common/vehicles/all.qh +++ b/qcsrc/common/vehicles/all.qh @@ -1,10 +1,102 @@ +#ifndef VEHICLES_ALL_H +#define VEHICLES_ALL_H + #if defined(SVQC) #include "sv_vehicles.qh" #elif defined(CSQC) #include "cl_vehicles.qh" #endif -# ifndef VEHICLES_NO_UNSTABLE -# include "unit/bumblebee.qh" -# include "unit/raptor.qh" -# endif + +// vehicle requests +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 + +// 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_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 + +// functions: +entity get_vehicleinfo(float id); + +// fields: +.entity tur_head; + + +// entity properties of vehicleinfo: +.int vehicleid; // VEH_... +.string netname; // short name +.string vehicle_name; // human readable name +.int(int) vehicle_func; // v_... +.string mdl; // currently a copy of the model +.string model; // full name of model +.string head_model; // full name of tur_head model +.string hud_model; // cockpit model +.string tag_head; // tur_head model tag +.string tag_hud; // hud model tag +.string tag_view; // cockpit model tag +.int() PlayerPhysplug; // player physics mod +.int spawnflags; +.vector mins, maxs; // vehicle hitbox size + +// other useful macros +#define VEH_ACTION(vehicletype,mrequest) (get_vehicleinfo(vehicletype)).vehicle_func(mrequest) +#define VEH_NAME(vehicletype) (get_vehicleinfo(vehicletype)).vehicle_name + +// ===================== +// Vehicle Registration +// ===================== + +int v_null(int dummy); +void register_vehicle(int id, int(int) func, float vehicleflags, vector min_s, vector max_s, string modelname, string headmodelname, string hudmodelname, string headtag, string hudtag, string viewtag, string shortname, string vname); +void register_vehicles_done(); + +const int VEH_MAXCOUNT = 24; +#define VEH_FIRST 1 +int VEH_COUNT; +int VEH_LAST; + +#define REGISTER_VEHICLE_2(id,func,vehicleflags,min_s,max_s,modelname,headmodelname,hudmodelname,headtag,hudtag,viewtag,shortname,vname) \ + int id; \ + int func(int); \ + void RegisterVehicles_##id() \ + { \ + VEH_LAST = (id = VEH_FIRST + VEH_COUNT); \ + ++VEH_COUNT; \ + register_vehicle(id,func,vehicleflags,min_s,max_s,modelname,headmodelname,hudmodelname,headtag,hudtag,viewtag,shortname,vname); \ + } \ + ACCUMULATE_FUNCTION(RegisterVehicles, RegisterVehicles_##id) +#ifdef MENUQC +#define REGISTER_VEHICLE(id,func,vehicleflags,min_s,max_s,modelname,headmodelname,hudmodelname,headtag,hudtag,viewtag,shortname,vname) \ + REGISTER_VEHICLE_2(VEH_##id,v_null,vehicleflags,min_s,max_s,modelname,headmodelname,hudmodelname,headtag,hudtag,viewtag,shortname,vname) +#else +#define REGISTER_VEHICLE(id,func,vehicleflags,min_s,max_s,modelname,headmodelname,hudmodelname,headtag,hudtag,viewtag,shortname,vname) \ + REGISTER_VEHICLE_2(VEH_##id,func,vehicleflags,min_s,max_s,modelname,headmodelname,hudmodelname,headtag,hudtag,viewtag,shortname,vname) +#endif + +#include "all.inc" + +#undef REGISTER_VEHICLE +ACCUMULATE_FUNCTION(RegisterVehicles, register_vehicles_done); + +#include "all.inc" + +#endif diff --git a/qcsrc/common/vehicles/sv_vehicles.qc b/qcsrc/common/vehicles/sv_vehicles.qc index b06596bbc..c21b0a5cf 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qc +++ b/qcsrc/common/vehicles/sv_vehicles.qc @@ -1,6 +1,5 @@ -#include "../effects.qh" -#include "vehicles.qh" #include "sv_vehicles.qh" +#include "../effects.qh" #if 0 bool vehicle_send(entity to, int sf) diff --git a/qcsrc/common/vehicles/sv_vehicles.qh b/qcsrc/common/vehicles/sv_vehicles.qh index 0de7184fe..c02ccddb5 100644 --- a/qcsrc/common/vehicles/sv_vehicles.qh +++ b/qcsrc/common/vehicles/sv_vehicles.qh @@ -2,8 +2,7 @@ #define VEHICLES_DEF_H #ifdef SVQC -#include "../server/tturrets/include/turrets_early.qh" -#include "sv_vehicles.qh" +#include "../../server/tturrets/include/turrets_early.qh" // #define VEHICLES_USE_ODE @@ -106,5 +105,4 @@ bool vehicle_impulse(int imp); bool vehicles_crushable(entity e); #endif - #endif diff --git a/qcsrc/common/vehicles/unit/all.qh b/qcsrc/common/vehicles/unit/all.qh deleted file mode 100644 index 7dfca83a2..000000000 --- a/qcsrc/common/vehicles/unit/all.qh +++ /dev/null @@ -1,6 +0,0 @@ -#include "spiderbot.qc" -#include "raptor.qc" -#include "racer.qc" -#ifndef VEHICLES_NO_UNSTABLE - #include "bumblebee.qc" -#endif diff --git a/qcsrc/common/vehicles/unit/bumblebee.qc b/qcsrc/common/vehicles/unit/bumblebee.qc index cc52716c7..859a89e13 100644 --- a/qcsrc/common/vehicles/unit/bumblebee.qc +++ b/qcsrc/common/vehicles/unit/bumblebee.qc @@ -1,4 +1,6 @@ -#ifdef REGISTER_VEHICLE +#ifndef VEHICLE_BUMBLEBEE +#define VEHICLE_BUMBLEBEE +#include "bumblebee.qh" REGISTER_VEHICLE( /* VEH_##id */ BUMBLEBEE, /* function */ v_bumblebee, @@ -11,7 +13,9 @@ REGISTER_VEHICLE( /* netname */ "bumblebee", /* fullname */ _("Bumblebee") ); -#else +#endif + +#ifdef IMPLEMENTATION const float BRG_SETUP = 2; const float BRG_START = 4; diff --git a/qcsrc/common/vehicles/unit/racer.qc b/qcsrc/common/vehicles/unit/racer.qc index 80cde0313..6c1f30cc1 100644 --- a/qcsrc/common/vehicles/unit/racer.qc +++ b/qcsrc/common/vehicles/unit/racer.qc @@ -1,4 +1,5 @@ -#ifdef REGISTER_VEHICLE +#ifndef VEHICLE_RACER +#define VEHICLE_RACER REGISTER_VEHICLE( /* VEH_##id */ RACER, /* function */ v_racer, @@ -11,7 +12,9 @@ REGISTER_VEHICLE( /* netname */ "racer", /* fullname */ _("Racer") ); -#else +#endif + +#ifdef IMPLEMENTATION #ifdef SVQC #include "../../effects.qh" #include "../../triggers/trigger/impulse.qh" diff --git a/qcsrc/common/vehicles/unit/raptor.qc b/qcsrc/common/vehicles/unit/raptor.qc index bff81b7d8..4624835a2 100644 --- a/qcsrc/common/vehicles/unit/raptor.qc +++ b/qcsrc/common/vehicles/unit/raptor.qc @@ -1,4 +1,6 @@ -#ifdef REGISTER_VEHICLE +#ifndef VEHICLE_RAPTOR +#define VEHICLE_RAPTOR +#include "raptor.qh" REGISTER_VEHICLE( /* VEH_##id */ RAPTOR, /* function */ v_raptor, @@ -11,7 +13,9 @@ REGISTER_VEHICLE( /* netname */ "raptor", /* fullname */ _("Raptor") ); -#else +#endif + +#ifdef IMPLEMENTATION #ifdef SVQC bool autocvar_g_vehicle_raptor; diff --git a/qcsrc/common/vehicles/unit/spiderbot.qc b/qcsrc/common/vehicles/unit/spiderbot.qc index 0aa2ebe79..511f9964a 100644 --- a/qcsrc/common/vehicles/unit/spiderbot.qc +++ b/qcsrc/common/vehicles/unit/spiderbot.qc @@ -1,4 +1,5 @@ -#ifdef REGISTER_VEHICLE +#ifndef VEHICLE_SPIDERBOT +#define VEHICLE_SPIDERBOT REGISTER_VEHICLE( /* VEH_##id */ SPIDERBOT, /* function */ v_spiderbot, @@ -11,7 +12,9 @@ REGISTER_VEHICLE( /* netname */ "spiderbot", /* fullname */ _("Spiderbot") ); -#else +#endif + +#ifdef IMPLEMENTATION const int SBRM_FIRST = 1; const int SBRM_VOLLY = 1; diff --git a/qcsrc/common/vehicles/vehicles.qc b/qcsrc/common/vehicles/vehicles.qc deleted file mode 100644 index e982c6f39..000000000 --- a/qcsrc/common/vehicles/vehicles.qc +++ /dev/null @@ -1,89 +0,0 @@ -#include "unit/all.qh" - -#include "vehicles_include.qc" - -// VEHICLE PLUGIN SYSTEM -entity vehicle_info[VEH_MAXCOUNT]; -entity dummy_vehicle_info; - -void vehicles_common_initialize() -{ -#ifdef CSQC - precache_model("models/vehicles/bomblet.md3"); - precache_model("models/vehicles/clusterbomb.md3"); - precache_model("models/vehicles/clusterbomb_fragment.md3"); - precache_model("models/vehicles/rocket01.md3"); - precache_model("models/vehicles/rocket02.md3"); - - precache_sound ("vehicles/alarm.wav"); - precache_sound ("vehicles/alarm_shield.wav"); -#endif // CSQC -#ifdef SVQC - precache_sound("onslaught/ons_hit2.wav"); - precache_sound("onslaught/electricity_explode.wav"); - - addstat(STAT_HUD, AS_INT, hud); - addstat(STAT_VEHICLESTAT_HEALTH, AS_INT, vehicle_health); - addstat(STAT_VEHICLESTAT_SHIELD, AS_INT, vehicle_shield); - addstat(STAT_VEHICLESTAT_ENERGY, AS_INT, vehicle_energy); - - addstat(STAT_VEHICLESTAT_W2MODE, AS_INT, vehicle_weapon2mode); - - addstat(STAT_VEHICLESTAT_AMMO1, AS_INT, vehicle_ammo1); - addstat(STAT_VEHICLESTAT_RELOAD1, AS_INT, vehicle_reload1); - - addstat(STAT_VEHICLESTAT_AMMO2, AS_INT, vehicle_ammo2); - addstat(STAT_VEHICLESTAT_RELOAD2, AS_INT, vehicle_reload2); -#endif // SVQC -} - -void register_vehicle(float id, float(float) func, float vehicleflags, vector min_s, vector max_s, string modelname, string headmodelname, string hudmodelname, string headtag, string hudtag, string viewtag, string shortname, string vname) -{ - entity e; - vehicle_info[id - 1] = e = spawn(); - e.classname = "vehicle_info"; - e.vehicleid = id; - e.netname = shortname; - e.vehicle_name = vname; - e.vehicle_func = func; - e.mdl = modelname; - e.spawnflags = vehicleflags; - e.mins = min_s; - e.maxs = max_s; - e.model = modelname; - e.head_model = headmodelname; - e.hud_model = hudmodelname; - e.tag_head = headtag; - e.tag_hud = hudtag; - e.tag_view = viewtag; - - #ifndef MENUQC - vehicles_common_initialize(); - #endif -} -float v_null(float dummy) { return 0; } -void register_vehicles_done() -{ - dummy_vehicle_info = spawn(); - dummy_vehicle_info.classname = "vehicle_info"; - dummy_vehicle_info.vehicleid = 0; // you can recognize dummies by this - dummy_vehicle_info.netname = ""; - dummy_vehicle_info.vehicle_name = "Vehicle"; - dummy_vehicle_info.vehicle_func = v_null; - dummy_vehicle_info.mdl = ""; - dummy_vehicle_info.mins = '-0 -0 -0'; - dummy_vehicle_info.maxs = '0 0 0'; - dummy_vehicle_info.model = ""; - dummy_vehicle_info.head_model = ""; - dummy_vehicle_info.hud_model = ""; -} -entity get_vehicleinfo(float id) -{ - entity m; - if(id < VEH_FIRST || id > VEH_LAST) - return dummy_vehicle_info; - m = vehicle_info[id - 1]; - if(m) - return m; - return dummy_vehicle_info; -} diff --git a/qcsrc/common/vehicles/vehicles.qh b/qcsrc/common/vehicles/vehicles.qh deleted file mode 100644 index b0f28b557..000000000 --- a/qcsrc/common/vehicles/vehicles.qh +++ /dev/null @@ -1,95 +0,0 @@ -#ifndef VEHICLES_H -#define VEHICLES_H - -#include "sv_vehicles.qh" - -// vehicle requests -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 - -// 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_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 - -// functions: -entity get_vehicleinfo(float id); - -// fields: -.entity tur_head; - - -// entity properties of vehicleinfo: -.int vehicleid; // VEH_... -.string netname; // short name -.string vehicle_name; // human readable name -.int(int) vehicle_func; // v_... -.string mdl; // currently a copy of the model -.string model; // full name of model -.string head_model; // full name of tur_head model -.string hud_model; // cockpit model -.string tag_head; // tur_head model tag -.string tag_hud; // hud model tag -.string tag_view; // cockpit model tag -.int() PlayerPhysplug; // player physics mod -.int spawnflags; -.vector mins, maxs; // vehicle hitbox size - -// other useful macros -#define VEH_ACTION(vehicletype,mrequest) (get_vehicleinfo(vehicletype)).vehicle_func(mrequest) -#define VEH_NAME(vehicletype) (get_vehicleinfo(vehicletype)).vehicle_name - -// ===================== -// Vehicle Registration -// ===================== - -int v_null(int dummy); -void register_vehicle(int id, int(int) func, float vehicleflags, vector min_s, vector max_s, string modelname, string headmodelname, string hudmodelname, string headtag, string hudtag, string viewtag, string shortname, string vname); -void register_vehicles_done(); - -const int VEH_MAXCOUNT = 24; -#define VEH_FIRST 1 -int VEH_COUNT; -int VEH_LAST; - -#define REGISTER_VEHICLE_2(id,func,vehicleflags,min_s,max_s,modelname,headmodelname,hudmodelname,headtag,hudtag,viewtag,shortname,vname) \ - int id; \ - int func(int); \ - void RegisterVehicles_##id() \ - { \ - VEH_LAST = (id = VEH_FIRST + VEH_COUNT); \ - ++VEH_COUNT; \ - register_vehicle(id,func,vehicleflags,min_s,max_s,modelname,headmodelname,hudmodelname,headtag,hudtag,viewtag,shortname,vname); \ - } \ - ACCUMULATE_FUNCTION(RegisterVehicles, RegisterVehicles_##id) -#ifdef MENUQC -#define REGISTER_VEHICLE(id,func,vehicleflags,min_s,max_s,modelname,headmodelname,hudmodelname,headtag,hudtag,viewtag,shortname,vname) \ - REGISTER_VEHICLE_2(VEH_##id,v_null,vehicleflags,min_s,max_s,modelname,headmodelname,hudmodelname,headtag,hudtag,viewtag,shortname,vname) -#else -#define REGISTER_VEHICLE(id,func,vehicleflags,min_s,max_s,modelname,headmodelname,hudmodelname,headtag,hudtag,viewtag,shortname,vname) \ - REGISTER_VEHICLE_2(VEH_##id,func,vehicleflags,min_s,max_s,modelname,headmodelname,hudmodelname,headtag,hudtag,viewtag,shortname,vname) -#endif - -#include "unit/all.qh" - -#undef REGISTER_VEHICLE -ACCUMULATE_FUNCTION(RegisterVehicles, register_vehicles_done); - -#endif diff --git a/qcsrc/common/vehicles/vehicles_include.qc b/qcsrc/common/vehicles/vehicles_include.qc deleted file mode 100644 index 1bd181d50..000000000 --- a/qcsrc/common/vehicles/vehicles_include.qc +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef VEHICLES_INCLUDE_C -#define VEHICLES_INCLUDE_C - -#include "vehicles_include.qh" - -#ifdef CSQC -#include "cl_vehicles.qc" -#include "vehicles.qc" -#endif // CSQC -#ifdef SVQC -#include "sv_vehicles.qc" -#include "vehicles.qc" -#endif // SVQC - -#endif diff --git a/qcsrc/common/vehicles/vehicles_include.qh b/qcsrc/common/vehicles/vehicles_include.qh deleted file mode 100644 index 26e52e481..000000000 --- a/qcsrc/common/vehicles/vehicles_include.qh +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef VEHICLES_INCLUDE_H -#define VEHICLES_INCLUDE_H - -#include "all.qh" - -#ifdef CSQC -#include "vehicles.qh" -#include "cl_vehicles.qh" -#elif defined(SVQC) -#include "vehicles.qh" -#include "sv_vehicles.qh" -#endif // SVQC - -#endif diff --git a/qcsrc/server/antilag.qc b/qcsrc/server/antilag.qc index 954950164..c51d3cf5b 100644 --- a/qcsrc/server/antilag.qc +++ b/qcsrc/server/antilag.qc @@ -3,8 +3,7 @@ #elif defined(SVQC) #include "../dpdefs/progsdefs.qh" #include "../dpdefs/dpextensions.qh" - #include "../common/vehicles/sv_vehicles.qh" - #include "../common/vehicles/vehicles.qh" + #include "../common/vehicles/all.qh" #include "antilag.qh" #endif diff --git a/qcsrc/server/cl_client.qc b/qcsrc/server/cl_client.qc index 09d57986f..81ea03e0e 100644 --- a/qcsrc/server/cl_client.qc +++ b/qcsrc/server/cl_client.qc @@ -25,7 +25,7 @@ #include "bot/bot.qh" #include "bot/navigation.qh" -#include "../common/vehicles/sv_vehicles.qh" +#include "../common/vehicles/all.qh" #include "weapons/hitplot.qh" #include "weapons/weaponsystem.qh" diff --git a/qcsrc/server/command/cmd.qc b/qcsrc/server/command/cmd.qc index 8672c3a29..a9bd70763 100644 --- a/qcsrc/server/command/cmd.qc +++ b/qcsrc/server/command/cmd.qc @@ -16,7 +16,7 @@ #include "../mutators/mutators_include.qh" #ifdef SVQC - #include "../../common/vehicles/sv_vehicles.qh" + #include "../../common/vehicles/all.qh" #endif #include "../../common/constants.qh" diff --git a/qcsrc/server/g_damage.qc b/qcsrc/server/g_damage.qc index 42a45b507..104feb688 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 "../common/vehicles/sv_vehicles.qh" +#include "../common/vehicles/all.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 f291fff7a..98e9c9871 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 "../common/vehicles/sv_vehicles.qh" + #include "../common/vehicles/all.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 e28b9b2ae..71c32df39 100644 --- a/qcsrc/server/g_hook.qc +++ b/qcsrc/server/g_hook.qc @@ -8,7 +8,7 @@ #include "cl_player.qh" #include "command/common.qh" #include "round_handler.qh" -#include "../common/vehicles/sv_vehicles.qh" +#include "../common/vehicles/all.qh" #include "../common/constants.qh" #include "../common/util.qh" #include "../common/weapons/all.qh" diff --git a/qcsrc/server/g_world.qc b/qcsrc/server/g_world.qc index da2983c4a..0a3462dca 100644 --- a/qcsrc/server/g_world.qc +++ b/qcsrc/server/g_world.qc @@ -27,7 +27,7 @@ #include "../common/mapinfo.qh" #include "../common/monsters/all.qh" #include "../common/monsters/sv_monsters.qh" -#include "../common/vehicles/vehicles.qh" +#include "../common/vehicles/all.qh" #include "../common/notifications.qh" #include "../common/playerstats.qh" #include "../common/stats.qh" diff --git a/qcsrc/server/mutators/gamemode_ctf.qc b/qcsrc/server/mutators/gamemode_ctf.qc index 31d21116a..4ebd27a45 100644 --- a/qcsrc/server/mutators/gamemode_ctf.qc +++ b/qcsrc/server/mutators/gamemode_ctf.qc @@ -4,7 +4,7 @@ #include "gamemode.qh" #ifdef SVQC -#include "../../common/vehicles/sv_vehicles.qh" +#include "../../common/vehicles/all.qh" #endif #include "../../warpzonelib/common.qh" diff --git a/qcsrc/server/mutators/mutators_include.qc b/qcsrc/server/mutators/mutators_include.qc index ae13c7d02..c6f28cb52 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 "../../common/vehicles/sv_vehicles.qh" + #include "../../common/vehicles/all.qh" #include "../campaign.qh" #include "../../common/campaign_common.qh" #include "../../common/mapinfo.qh" diff --git a/qcsrc/server/progs.src b/qcsrc/server/progs.src index 2ed1e03d6..cda751fa7 100644 --- a/qcsrc/server/progs.src +++ b/qcsrc/server/progs.src @@ -102,7 +102,7 @@ weapons/weaponsystem.qc ../common/triggers/include.qc ../common/urllib.qc ../common/util.qc -../common/vehicles/vehicles_include.qc +../common/vehicles/all.qc ../common/items/all.qc diff --git a/qcsrc/server/sv_main.qc b/qcsrc/server/sv_main.qc index 9e4296539..18ea24d94 100644 --- a/qcsrc/server/sv_main.qc +++ b/qcsrc/server/sv_main.qc @@ -17,7 +17,7 @@ #include "../common/mapinfo.qh" #include "../common/util.qh" -#include "../common/vehicles/sv_vehicles.qh" +#include "../common/vehicles/all.qh" #include "../common/weapons/all.qh" #include "../csqcmodellib/sv_model.qh"