]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/common/vehicles/sv_vehicles.qh
Merge new vehicle stuff from combined updates
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / vehicles / sv_vehicles.qh
index 2e8fb4b56626f9d5145aae29d6828082e2b6dec4..36b4f5f3e970431cda92d07acf5068382bcadc1b 100644 (file)
@@ -1,3 +1,10 @@
+#ifndef VEHICLES_DEF_H
+#define VEHICLES_DEF_H
+#ifdef SVQC
+
+#include "../server/tturrets/include/turrets_early.qh"
+#include "sv_vehicles.qh"
+
 // #define VEHICLES_USE_ODE
 
 // vehicle cvars
@@ -12,12 +19,16 @@ float autocvar_g_vehicles_delayspawn;
 float autocvar_g_vehicles_delayspawn_jitter;
 float autocvar_g_vehicles_allow_bots;
 float autocvar_g_vehicles_teams;
-//float autocvar_g_vehicles_teleportable;
-var float autocvar_g_vehicles_nex_damagerate = 0.5;
-var float autocvar_g_vehicles_uzi_damagerate = 0.5;
-var float autocvar_g_vehicles_rifle_damagerate = 0.75;
-var float autocvar_g_vehicles_minstanex_damagerate = 0.001;
-var float autocvar_g_vehicles_tag_damagerate = 5;
+float autocvar_g_vehicles_teleportable;
+float autocvar_g_vehicles_vortex_damagerate = 0.5;
+float autocvar_g_vehicles_machinegun_damagerate = 0.5;
+float autocvar_g_vehicles_rifle_damagerate = 0.75;
+float autocvar_g_vehicles_vaporizer_damagerate = 0.001;
+float autocvar_g_vehicles_tag_damagerate = 5;
+float autocvar_g_vehicles_weapon_damagerate = 1;
+
+// flags:
+.int vehicle_flags;
 
 // vehicle definitions
 .entity gun1;
@@ -42,21 +53,21 @@ var float autocvar_g_vehicles_tag_damagerate = 5;
 .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;
-#define VOL_VEHICLEENGINE 1
+const float VOL_VEHICLEENGINE = 1;
 
 const float SVC_SETVIEWPORT   = 5;   // Net.Protocol 0x05
 const float SVC_SETVIEWANGLES = 10;  // Net.Protocol 0x0A
 const float SVC_UPDATEENTITY  = 128; // Net.Protocol 0x80
 
-#define VHSF_NORMAL 0
-#define VHSF_FACTORY 2
+const float VHSF_NORMAL = 0;
+const float VHSF_FACTORY = 2;
 
-.float hud;
+.int hud;
 .float dmg_time;
 
-.float volly_counter;
+.int volly_counter;
 
-const float MAX_AXH = 4;
+const int MAX_AXH = 4;
 .entity AuxiliaryXhair[MAX_AXH];
 
 .entity wps_intruder;
@@ -67,37 +78,37 @@ const float MAX_AXH = 4;
 .float  lock_soundtime;
 const float    DAMAGE_TARGETDRONE = 10;
 
+// vehicle functions
+.void(int _spawnflag) vehicle_spawn;  /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
+.bool(int _imp) vehicles_impulse;
+.int vehicle_weapon2mode;
+.void(int exit_flags) vehicle_exit;
+.bool() vehicle_enter;
+const int VHEF_NORMAL = 0;  /// User pressed exit key
+const int VHEF_EJECT  = 1;  /// User pressed exit key 3 times fast (not implemented) or vehile is dying
+const int VHEF_RELEASE = 2;  /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
+
 float  force_fromtag_power;
 float  force_fromtag_normpower;
 vector force_fromtag_origin;
 
 float vehicles_exit_running;
 
+// macros
+#define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
+       ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
+
 #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
 
-// functions used outside the vehicle code
-void vehicles_exit(float eject);
-void vehicles_enter(entity pl, entity veh);
+.float vehicle_enter_delay; // prevent players jumping to and from vehicles instantly
 
-// vehicle functions
-.void(float _spawnflag) vehicle_spawn;  /// Vehicles custom fucntion to be efecuted when vehicle (re)spawns
-.float(float _imp) vehicles_impulse;
-.float vehicle_weapon2mode;
-.void(float exit_flags) vehicle_exit;
-.float() vehicle_enter;
-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_RELEASE = 2;  /// Release ownership, client possibly allready dissconnected / went spec / changed team / used "kill" (not implemented)
+void vehicles_exit(float eject);
+float vehicle_initialize(float vehicle_id, float nodrop);
 
-// macros
-#define VEHICLE_UPDATE_PLAYER(ply,fld,vhname) \
-       ply.vehicle_##fld = (self.vehicle_##fld / autocvar_g_vehicle_##vhname##_##fld) * 100
+#endif
 
-#define vehicles_sweap_collision(orig,vel,dt,acm,mult) \
-       traceline(orig, orig + vel * dt, MOVE_NORMAL, self); \
-       if(trace_fraction != 1) \
-               acm += normalize(self.origin - trace_endpos) * (vlen(vel) * mult)
+#endif