X-Git-Url: https://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fcommon%2Fvehicles%2Fall.qh;h=b58389d4abb7955feb7c3c80934583fadd4f6f1b;hb=d271f27a5ac351a3a7b39636932f6d661492be1d;hp=fa9e83f48531fa66231691391eade3a57781808f;hpb=8d10ea819c27736320d03e75134af341f8127199;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/common/vehicles/all.qh b/qcsrc/common/vehicles/all.qh index fa9e83f48..b58389d4a 100644 --- a/qcsrc/common/vehicles/all.qh +++ b/qcsrc/common/vehicles/all.qh @@ -1,83 +1,26 @@ #ifndef VEHICLES_ALL_H #define VEHICLES_ALL_H +#include "vehicle.qh" + +REGISTRY(Vehicles, BITS(4)) +#define Vehicles_from(i) _Vehicles_from(i, VEH_Null) +REGISTER_REGISTRY(Vehicles) +REGISTRY_CHECK(Vehicles) + +const int VEH_FIRST = 1; +#define VEH_LAST (Vehicles_COUNT - 1) + +#define REGISTER_VEHICLE(id, inst) REGISTER(Vehicles, VEH, id, vehicleid, inst) + #if defined(SVQC) #include "sv_vehicles.qh" #elif defined(CSQC) #include "cl_vehicles.qh" #endif +REGISTER_VEHICLE(Null, NEW(Vehicle)); -// 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; - - -// 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 -// ===================== - -void RegisterVehicles(); -const int VEH_MAXCOUNT = 24; -entity vehicle_info[VEH_MAXCOUNT], vehicle_info_first, vehicle_info_last; -int VEH_COUNT; -const int VEH_FIRST = 1; -#define VEH_LAST (VEH_FIRST + VEH_COUNT - 1) -/** If you register a new vehicle, make sure to add it to all.inc */ -#define REGISTER_VEHICLE(id, class) REGISTER(RegisterVehicles, VEH, vehicle_info, VEH_COUNT, id, vehicleid, NEW(class)) -#include "vehicle.qh" -#define REGISTER_VEHICLE_SIMPLE(id, vehicleflags, min_s, max_s, modelname, headmodelname, hudmodelname, headtag, hudtag, viewtag, shortname, vname) \ - REGISTER_VEHICLE(id, Vehicle) { \ - this.netname = shortname; \ - this.vehicle_name = vname; \ - this.mdl = modelname; \ - this.spawnflags = vehicleflags; \ - this.mins = min_s; \ - this.maxs = max_s; \ - this.model = modelname; \ - this.head_model = headmodelname; \ - this.hud_model = hudmodelname; \ - this.tag_head = headtag; \ - this.tag_hud = hudtag; \ - this.tag_view = viewtag; \ - } \ - REGISTER_INIT(VEH, id) -REGISTER_REGISTRY(RegisterVehicles) - -REGISTER_VEHICLE(NULL, Vehicle); - -#include "all.inc" +#include "vehicle/_mod.inc" #endif