Merge branch 'master' into TimePath/vehicles_cleanup
authorTimePath <andrew.hardaker1995@gmail.com>
Sun, 23 Aug 2015 07:13:46 +0000 (17:13 +1000)
committerTimePath <andrew.hardaker1995@gmail.com>
Sun, 23 Aug 2015 07:13:46 +0000 (17:13 +1000)
# Conflicts:
# qcsrc/client/main.qc
# qcsrc/client/progs.src
# qcsrc/server/progs.src

33 files changed:
qcsrc/client/damage.qc
qcsrc/client/main.qc
qcsrc/client/progs.src
qcsrc/common/monsters/sv_monsters.qc
qcsrc/common/triggers/teleporters.qc
qcsrc/common/vehicles/all.inc [new file with mode: 0644]
qcsrc/common/vehicles/all.qc [new file with mode: 0644]
qcsrc/common/vehicles/all.qh
qcsrc/common/vehicles/cl_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qc
qcsrc/common/vehicles/sv_vehicles.qh
qcsrc/common/vehicles/unit/all.qh [deleted file]
qcsrc/common/vehicles/unit/bumblebee.qc
qcsrc/common/vehicles/unit/racer.qc
qcsrc/common/vehicles/unit/raptor.qc
qcsrc/common/vehicles/unit/spiderbot.qc
qcsrc/common/vehicles/vehicle.qh [new file with mode: 0644]
qcsrc/common/vehicles/vehicles.qc [deleted file]
qcsrc/common/vehicles/vehicles.qh [deleted file]
qcsrc/common/vehicles/vehicles_include.qc [deleted file]
qcsrc/common/vehicles/vehicles_include.qh [deleted file]
qcsrc/menu/progs.src
qcsrc/server/antilag.qc
qcsrc/server/cl_client.qc
qcsrc/server/command/cmd.qc
qcsrc/server/g_damage.qc
qcsrc/server/g_damage.qh
qcsrc/server/g_hook.qc
qcsrc/server/g_world.qc
qcsrc/server/mutators/gamemode_ctf.qc
qcsrc/server/mutators/mutators_include.qc
qcsrc/server/progs.src
qcsrc/server/sv_main.qc

index fb80a52..2b22464 100644 (file)
@@ -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"
index a585a13..ca3fb30 100644 (file)
 #include "wall.qh"
 #include "waypointsprites.qh"
 
-#include "mutators/events.qh"
-
-#include "../common/vehicles/unit/bumblebee.qh"
-#include "../common/vehicles/cl_vehicles.qh"
-#include "../common/vehicles/vehicles.qh"
+#include "../common/vehicles/all.qh"
 
 #include "mutators/events.qh"
 
@@ -153,7 +149,6 @@ void CSQC_Init(void)
        CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
        CALL_ACCUMULATED_FUNCTION(RegisterHUD_Panels);
        CALL_ACCUMULATED_FUNCTION(RegisterEffects);
-       CALL_ACCUMULATED_FUNCTION(RegisterVehicles);
 
        WaypointSprite_Load();
 
index 43c056a..88eba6d 100644 (file)
@@ -57,12 +57,10 @@ weapons/projectile.qc // TODO
 ../common/viewloc.qc
 
 ../common/items/all.qc
-
 ../common/monsters/all.qc
-
 ../common/mutators/all.qc
-
-../common/weapons/all.qc // TODO
+../common/vehicles/all.qc
+../common/weapons/all.qc
 
 ../common/triggers/include.qc
 
@@ -70,8 +68,6 @@ weapons/projectile.qc // TODO
 ../csqcmodellib/cl_player.qc
 ../csqcmodellib/interpolate.qc
 
-../common/vehicles/vehicles_include.qc
-
 ../server/mutators/mutator_multijump.qc
 
 ../warpzonelib/anglestransform.qc
index 887ac20..f9660c0 100644 (file)
@@ -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"
index a583716..25b18dd 100644 (file)
@@ -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 (file)
index 0000000..eda4e00
--- /dev/null
@@ -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 (file)
index 0000000..f0316ab
--- /dev/null
@@ -0,0 +1,56 @@
+#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
+
+#ifndef MENUQC
+STATIC_INIT(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
+}
+#endif
+
+entity get_vehicleinfo(int id)
+{
+       if (id < VEH_FIRST || id > VEH_LAST) return VEH_NULL;
+       entity m = vehicle_info[id];
+       return m ? m : VEH_NULL;
+}
+
+#endif
index 48ff804..ccb3a05 100644 (file)
@@ -1,10 +1,84 @@
+#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;
+
+
+// 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, func, 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.vehicle_func = func;           \
+       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"
+
+#endif
index 2511def..141f8fc 100644 (file)
@@ -295,7 +295,7 @@ void Vehicles_drawHUD(
        }
 
        // Bumblebee gunner crosshairs
-       if(hud == VEH_BUMBLEBEE)
+       if(hud == VEH_BUMBLEBEE.vehicleid)
        {
                tmpSize = '1 1 1' * hud_fontsize;
                tmpPos.x = hudPos.x + hudSize.x * (520/768);
@@ -314,7 +314,7 @@ void Vehicles_drawHUD(
        }
 
        // Raptor bomb crosshair
-       if(hud == VEH_RAPTOR && weapon2mode != RSM_FLARE)
+       if(hud == VEH_RAPTOR.vehicleid && weapon2mode != RSM_FLARE)
        {
                vector where;
 
index b06596b..79f5901 100644 (file)
@@ -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)
@@ -1184,17 +1183,15 @@ void vehicles_spawn()
        CSQCMODEL_AUTOINIT();
 }
 
-bool vehicle_initialize(int vehicle_id, bool nodrop)
+bool vehicle_initialize(entity veh, bool nodrop)
 {
        if(!autocvar_g_vehicles)
                return false;
 
-       entity veh = get_vehicleinfo(vehicle_id);
-
        if(!veh.vehicleid)
                return false;
        
-       if(!veh.tur_head) { VEH_ACTION(vehicle_id, VR_PRECACHE); }
+       if(!veh.tur_head) { VEH_ACTION(veh.vehicleid, VR_PRECACHE); }
 
        if(self.targetname && self.targetname != "")
        {
@@ -1239,7 +1236,7 @@ bool vehicle_initialize(int vehicle_id, bool nodrop)
        self.iscreature                         = true;
        self.teleportable                       = false; // no teleporting for vehicles, too buggy
        self.damagedbycontents          = true;
-       self.vehicleid                          = vehicle_id;
+       self.vehicleid                          = veh.vehicleid;
        self.PlayerPhysplug                     = veh.PlayerPhysplug;
        self.event_damage                       = func_null;
        self.touch                                      = vehicles_touch;
@@ -1287,7 +1284,7 @@ bool vehicle_initialize(int vehicle_id, bool nodrop)
        self.pos2 = self.angles;
        self.tur_head.team = self.team;
 
-       VEH_ACTION(vehicle_id, VR_SETUP);
+       VEH_ACTION(veh.vehicleid, VR_SETUP);
 
        if(self.active == ACTIVE_NOT)
                self.nextthink = 0; // wait until activated
index 0de7184..b192137 100644 (file)
@@ -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
 
@@ -101,10 +100,9 @@ float vehicles_exit_running;
 .float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
 
 void vehicles_exit(float eject);
-float vehicle_initialize(float vehicle_id, float nodrop);
+float vehicle_initialize(entity vehicle, float nodrop);
 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 (file)
index 7dfca83..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include "spiderbot.qc"
-#include "raptor.qc"
-#include "racer.qc"
-#ifndef VEHICLES_NO_UNSTABLE
-       #include "bumblebee.qc"
-#endif
index cc52716..ba0db54 100644 (file)
@@ -1,5 +1,8 @@
-#ifdef REGISTER_VEHICLE
-REGISTER_VEHICLE(
+#ifndef VEHICLE_BUMBLEBEE
+#define VEHICLE_BUMBLEBEE
+#include "bumblebee.qh"
+int v_bumblebee(int);
+REGISTER_VEHICLE_SIMPLE(
 /* VEH_##id   */ BUMBLEBEE,
 /* function   */ v_bumblebee,
 /* spawnflags */ VHF_DMGSHAKE,
@@ -10,8 +13,12 @@ REGISTER_VEHICLE(
 /* tags                  */ "", "", "tag_viewport",
 /* netname       */ "bumblebee",
 /* fullname   */ _("Bumblebee")
-);
-#else
+) {
+    this.m_icon = "vehicle_bumble";
+}
+#endif
+
+#ifdef IMPLEMENTATION
 
 const float BRG_SETUP = 2;
 const float BRG_START = 4;
@@ -656,7 +663,7 @@ void bumblebee_land()
 
 void bumblebee_exit(float eject)
 {
-       if(self.owner.vehicleid == VEH_BUMBLEBEE)
+       if(self.owner.vehicleid == VEH_BUMBLEBEE.vehicleid)
        {
                bumblebee_gunner_exit(eject);
                return;
@@ -1096,7 +1103,7 @@ float v_bumblebee(float req)
        {
                case VR_HUD:
                {
-                       Vehicles_drawHUD("vehicle_bumble", "vehicle_bumble_weapon1", "vehicle_bumble_weapon2",
+                       Vehicles_drawHUD(VEH_BUMBLEBEE.m_icon, "vehicle_bumble_weapon1", "vehicle_bumble_weapon2",
                                                         "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
                                                         "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
                                                         vCROSS_HEAL);
index 80cde03..41a0b12 100644 (file)
@@ -1,5 +1,7 @@
-#ifdef REGISTER_VEHICLE
-REGISTER_VEHICLE(
+#ifndef VEHICLE_RACER
+#define VEHICLE_RACER
+int v_racer(int);
+REGISTER_VEHICLE_SIMPLE(
 /* VEH_##id   */ RACER,
 /* function   */ v_racer,
 /* spawnflags */ VHF_DMGSHAKE | VHF_DMGROLL,
@@ -10,8 +12,12 @@ REGISTER_VEHICLE(
 /* tags                  */ "", "", "tag_viewport",
 /* netname       */ "racer",
 /* fullname   */ _("Racer")
-);
-#else
+) {
+    this.m_icon = "vehicle_racer";
+}
+#endif
+
+#ifdef IMPLEMENTATION
 #ifdef SVQC
 #include "../../effects.qh"
 #include "../../triggers/trigger/impulse.qh"
@@ -804,7 +810,7 @@ bool v_racer(int req)
 #ifdef CSQC
                case VR_HUD:
                {
-                       Vehicles_drawHUD("vehicle_racer", "vehicle_racer_weapon1", "vehicle_racer_weapon2",
+                       Vehicles_drawHUD(VEH_RACER.m_icon, "vehicle_racer_weapon1", "vehicle_racer_weapon2",
                                                         "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
                                                         "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color,
                                                         vCROSS_GUIDE);
@@ -856,9 +862,10 @@ bool v_racer(int req)
 
                        precache_model ("models/vhshield.md3");
                #endif
-
+               #ifndef MENUQC
                        precache_model ("models/vehicles/wakizashi.dpm");
                        precache_model ("models/vehicles/wakizashi_cockpit.dpm");
+               #endif
                        return true;
                }
        }
index bff81b7..2ea8949 100644 (file)
@@ -1,5 +1,8 @@
-#ifdef REGISTER_VEHICLE
-REGISTER_VEHICLE(
+#ifndef VEHICLE_RAPTOR
+#define VEHICLE_RAPTOR
+#include "raptor.qh"
+int v_raptor(int);
+REGISTER_VEHICLE_SIMPLE(
 /* VEH_##id   */ RAPTOR,
 /* function   */ v_raptor,
 /* spawnflags */ VHF_DMGSHAKE | VHF_DMGROLL,
@@ -10,8 +13,12 @@ REGISTER_VEHICLE(
 /* tags                  */ "", "tag_hud", "tag_camera",
 /* netname       */ "raptor",
 /* fullname   */ _("Raptor")
-);
-#else
+) {
+    this.m_icon = "vehicle_raptor";
+}
+#endif
+
+#ifdef IMPLEMENTATION
 
 #ifdef SVQC
 bool autocvar_g_vehicle_raptor;
@@ -1038,7 +1045,7 @@ float v_raptor(float req)
                                default:        crosshair = vCROSS_BURST;
                        }
                        
-                       Vehicles_drawHUD("vehicle_raptor", "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
+                       Vehicles_drawHUD(VEH_RAPTOR.m_icon, "vehicle_raptor_weapon1", "vehicle_raptor_weapon2",
                                                         "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
                                                         "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color,
                                                         crosshair);
index 0aa2ebe..939dd28 100644 (file)
@@ -1,5 +1,7 @@
-#ifdef REGISTER_VEHICLE
-REGISTER_VEHICLE(
+#ifndef VEHICLE_SPIDERBOT
+#define VEHICLE_SPIDERBOT
+int v_spiderbot(int);
+REGISTER_VEHICLE_SIMPLE(
 /* VEH_##id   */ SPIDERBOT,
 /* function   */ v_spiderbot,
 /* spawnflags */ VHF_DMGSHAKE,
@@ -10,8 +12,12 @@ REGISTER_VEHICLE(
 /* tags                  */ "tag_head", "tag_hud", "",
 /* netname       */ "spiderbot",
 /* fullname   */ _("Spiderbot")
-);
-#else
+) {
+    this.m_icon = "vehicle_spider";
+}
+#endif
+
+#ifdef IMPLEMENTATION
 
 const int SBRM_FIRST = 1;
 const int SBRM_VOLLY = 1;
@@ -959,7 +965,7 @@ float v_spiderbot(float req)
                                default:             crosshair = vCROSS_BURST;
                        }
 
-                       Vehicles_drawHUD("vehicle_spider", "vehicle_spider_weapon1", "vehicle_spider_weapon2",
+                       Vehicles_drawHUD(VEH_SPIDERBOT.m_icon, "vehicle_spider_weapon1", "vehicle_spider_weapon2",
                                                         "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
                                                         "vehicle_icon_ammo2", autocvar_hud_progressbar_vehicles_ammo2_color,
                                                         crosshair);
diff --git a/qcsrc/common/vehicles/vehicle.qh b/qcsrc/common/vehicles/vehicle.qh
new file mode 100644 (file)
index 0000000..7df3420
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef VEHICLE_H
+#define VEHICLE_H
+
+int v_null(int) { return 0; }
+
+CLASS(Vehicle, Object)
+    ATTRIB(Vehicle, vehicleid, int, 0)
+    /** hud icon */
+    ATTRIB(Vehicle, m_icon, string, string_null)
+    /** short name */
+    ATTRIB(Vehicle, netname, string, "")
+    /** human readable name */
+    ATTRIB(Vehicle, vehicle_name, string, "Vehicle")
+    /**  */
+    ATTRIB(Vehicle, vehicle_func, int(int), v_null)
+    /** full name of model */
+    ATTRIB(Vehicle, model, string, "")
+    /** currently a copy of the model */
+    ATTRIB(Vehicle, mdl, string, "")
+    /** full name of tur_head model */
+    ATTRIB(Vehicle, head_model, string, "")
+    /** cockpit model */
+    ATTRIB(Vehicle, hud_model, string, "")
+    /** tur_head model tag */
+    ATTRIB(Vehicle, tag_head, string, string_null)
+    /** hud model tag */
+    ATTRIB(Vehicle, tag_hud, string, string_null)
+    /** cockpit model tag */
+    ATTRIB(Vehicle, tag_view, string, string_null)
+    /** player physics mod */
+    ATTRIB(Vehicle, PlayerPhysplug, int(), func_null)
+    /**  */
+    ATTRIB(Vehicle, spawnflags, int, 0)
+    /** vehicle hitbox size */
+    ATTRIB(Vehicle, mins, vector, '-0 -0 -0')
+    /** vehicle hitbox size */
+    ATTRIB(Vehicle, maxs, vector, '0 0 0')
+ENDCLASS(Vehicle)
+
+#endif
diff --git a/qcsrc/common/vehicles/vehicles.qc b/qcsrc/common/vehicles/vehicles.qc
deleted file mode 100644 (file)
index e982c6f..0000000
+++ /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 (file)
index b0f28b5..0000000
+++ /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 (file)
index 1bd181d..0000000
+++ /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 (file)
index 26e52e4..0000000
+++ /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
index 64f1247..2bde451 100644 (file)
@@ -23,10 +23,9 @@ xonotic/util.qc
 ../common/util.qc
 
 ../common/items/all.qc
-
 ../common/monsters/all.qc
-
-../common/weapons/all.qc // TODO
+../common/vehicles/all.qc
+../common/weapons/all.qc
 
 ../warpzonelib/mathlib.qc
 
index 9549501..c51d3cf 100644 (file)
@@ -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
 
index 09d5798..81ea03e 100644 (file)
@@ -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"
index 8672c3a..a9bd707 100644 (file)
@@ -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"
index 1f10217..0721e88 100644 (file)
@@ -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"
index f291fff..98e9c98 100644 (file)
@@ -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"
index e28b9b2..71c32df 100644 (file)
@@ -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"
index da2983c..2df126d 100644 (file)
@@ -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"
@@ -565,7 +565,6 @@ void spawnfunc___init_dedicated_server(void)
        CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
        CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
        CALL_ACCUMULATED_FUNCTION(RegisterEffects);
-       CALL_ACCUMULATED_FUNCTION(RegisterVehicles);
 
        MapInfo_Enumerate();
        MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
@@ -614,7 +613,6 @@ void spawnfunc_worldspawn (void)
        CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
        CALL_ACCUMULATED_FUNCTION(RegisterDeathtypes);
        CALL_ACCUMULATED_FUNCTION(RegisterEffects);
-       CALL_ACCUMULATED_FUNCTION(RegisterVehicles);
 
        ServerProgsDB = db_load(strcat("server.db", autocvar_sessionid));
 
index 31d2111..4ebd27a 100644 (file)
@@ -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"
index ae13c7d..c6f28cb 100644 (file)
@@ -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"
index bb62881..e5251be 100644 (file)
@@ -87,8 +87,6 @@ weapons/weaponsystem.qc
 ../common/campaign_setup.qc
 ../common/effects.qc
 ../common/mapinfo.qc
-../common/monsters/all.qc
-../common/mutators/all.qc
 ../common/monsters/spawn.qc
 ../common/monsters/sv_monsters.qc
 ../common/movetypes/include.qc
@@ -103,12 +101,14 @@ weapons/weaponsystem.qc
 ../common/triggers/include.qc
 ../common/urllib.qc
 ../common/util.qc
-../common/vehicles/vehicles_include.qc
 
 ../common/items/all.qc
+../common/monsters/all.qc
+../common/mutators/all.qc
+../common/vehicles/all.qc
+../common/weapons/all.qc // TODO
 
 ../common/weapons/config.qc
-../common/weapons/all.qc // TODO
 
 ../csqcmodellib/sv_model.qc
 
index 9e42965..18ea24d 100644 (file)
@@ -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"