]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/tturrets/include/turrets_early.qh
Rename defs to qh
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / tturrets / include / turrets_early.qh
index d52c00307c0474f5ff59b7a6e81c0ddf79291826..5d6d33dce06ee58be131e7a0a3283711e504e1bf 100644 (file)
@@ -1,3 +1,101 @@
+#ifndef TURRETS_EARLY_H
+#define TURRETS_EARLY_H
+
+#if defined(CSQC)
+    #include "../../../common/util-pre.qh"
+    #include "../../../client/sys-pre.qh"
+    #include "../../../dpdefs/csprogsdefs.qh"
+    #include "../../../client/sys-post.qh"
+    #include "../../../client/defs.qh"
+    #include "../../../dpdefs/keycodes.qh"
+    #include "../../../common/constants.qh"
+    #include "../../../common/stats.qh"
+    #include "../../../warpzonelib/anglestransform.qh"
+    #include "../../../warpzonelib/mathlib.qh"
+    #include "../../../warpzonelib/common.qh"
+    #include "../../../warpzonelib/client.qh"
+    #include "../../../common/playerstats.qh"
+    #include "../../../common/teams.qh"
+    #include "../../../common/util.qh"
+    #include "../../../common/nades.qh"
+    #include "../../../common/buffs.qh"
+    #include "../../../common/test.qh"
+    #include "../../../common/counting.qh"
+    #include "../../../common/weapons/weapons.qh"
+    #include "../../../common/mapinfo.qh"
+    #include "../../../common/command/markup.qh"
+    #include "../../../common/command/rpn.qh"
+    #include "../../../common/command/generic.qh"
+    #include "../../../common/command/shared_defs.qh"
+    #include "../../../common/urllib.qh"
+    #include "../../../common/animdecide.qh"
+    #include "../../../client/command/cl_cmd.qh"
+    #include "../../../common/monsters/monsters.qh"
+    #include "../../../client/autocvars.qh"
+    #include "../../../common/notifications.qh"
+    #include "../../../common/deathtypes.qh"
+    #include "../../../client/damage.qh"
+    #include "../../../csqcmodellib/interpolate.qh"
+    #include "../../../client/teamradar.qh"
+    #include "../../../client/hud.qh"
+    #include "../../../client/scoreboard.qh"
+    #include "../../../client/waypointsprites.qh"
+    #include "../../../client/movetypes.qh"
+    #include "../../../client/prandom.qh"
+    #include "../../../client/bgmscript.qh"
+    #include "../../../client/noise.qh"
+    #include "../../../client/tturrets.qh"
+#elif defined(MENUQC)
+#elif defined(SVQC)
+    #include "../../../common/util-pre.qh"
+    #include "../../sys-pre.qh"
+    #include "../../../dpdefs/progsdefs.qh"
+    #include "../../../dpdefs/dpextensions.qh"
+    #include "../../sys-post.qh"
+    #include "../../../warpzonelib/anglestransform.qh"
+    #include "../../../warpzonelib/mathlib.qh"
+    #include "../../../warpzonelib/common.qh"
+    #include "../../../warpzonelib/util_server.qh"
+    #include "../../../warpzonelib/server.qh"
+    #include "../../../common/constants.qh"
+    #include "../../../common/stats.qh"
+    #include "../../../common/teams.qh"
+    #include "../../../common/util.qh"
+    #include "../../../common/nades.qh"
+    #include "../../../common/buffs.qh"
+    #include "../../../common/test.qh"
+    #include "../../../common/counting.qh"
+    #include "../../../common/urllib.qh"
+    #include "../../../common/command/markup.qh"
+    #include "../../../common/command/rpn.qh"
+    #include "../../../common/command/generic.qh"
+    #include "../../../common/command/shared_defs.qh"
+    #include "../../../common/net_notice.qh"
+    #include "../../../common/animdecide.qh"
+    #include "../../../common/monsters/monsters.qh"
+    #include "../../../common/monsters/sv_monsters.qh"
+    #include "../../../common/monsters/spawn.qh"
+    #include "../../../common/weapons/config.qh"
+    #include "../../../common/weapons/weapons.qh"
+    #include "../../weapons/accuracy.qh"
+    #include "../../weapons/common.qh"
+    #include "../../weapons/csqcprojectile.qh"
+    #include "../../weapons/hitplot.qh"
+    #include "../../weapons/selection.qh"
+    #include "../../weapons/spawning.qh"
+    #include "../../weapons/throwing.qh"
+    #include "../../weapons/tracing.qh"
+    #include "../../weapons/weaponstats.qh"
+    #include "../../weapons/weaponsystem.qh"
+    #include "../../t_items.qh"
+    #include "../../autocvars.qh"
+    #include "../../constants.qh"
+    #include "../../defs.qh"
+    #include "../../../common/notifications.qh"
+    #include "../../../common/deathtypes.qh"
+    #include "../../mutators/mutators_include.qh"
+#endif
+
 // Comment out below to skip turrets
 #define TTURRETS_ENABLED
 
@@ -28,91 +126,81 @@ vector real_origin(entity ent);
 .string cvar_basename;
 
 //.float spawnflags
-#define TSF_SUSPENDED     1
+const float TSF_SUSPENDED     = 1;
 /// Spawn a pillar model under the turret to make it look ok on uneven ground surfaces
-#define TSF_TERRAINBASE   2
+const float TSF_TERRAINBASE   = 2;
 /// Disable builtin ammo regeneration
-#define TSF_NO_AMMO_REGEN 4
+const float TSF_NO_AMMO_REGEN = 4;
 /// Dont break path to chase enemys. will still fire at them if possible.
-#define TSF_NO_PATHBREAK  8
+const float TSF_NO_PATHBREAK  = 8;
 /// Dont respawn
-#define TSL_NO_RESPAWN    16
+const float TSL_NO_RESPAWN    = 16;
 /// Let this turret roam when idle.
-#define TSL_ROAM          32
+const float TSL_ROAM          = 32;
 
 /// target selection flags
 .float target_select_flags;
 /// target validatoin flags
 .float target_validate_flags;
 /// Dont select a target on its own.
-#define TFL_TARGETSELECT_NO            2
+const float TFL_TARGETSELECT_NO            = 2;
 /// Need line of sight
-#define TFL_TARGETSELECT_LOS           4
+const float TFL_TARGETSELECT_LOS           = 4;
 /// Players are valid targets
-#define TFL_TARGETSELECT_PLAYERS       8
+const float TFL_TARGETSELECT_PLAYERS       = 8;
 /// Missiles are valid targets
-#define TFL_TARGETSELECT_MISSILES      16
+const float TFL_TARGETSELECT_MISSILES      = 16;
 /// Responds to turret_trigger_target events
-#define TFL_TARGETSELECT_TRIGGERTARGET 32
+const float TFL_TARGETSELECT_TRIGGERTARGET = 32;
 /// Angular limitations of turret head limits target selection
-#define TFL_TARGETSELECT_ANGLELIMITS   64
+const float TFL_TARGETSELECT_ANGLELIMITS   = 64;
 /// Range limits apply in targetselection
-#define TFL_TARGETSELECT_RANGELIMTS    128
+const float TFL_TARGETSELECT_RANGELIMTS    = 128;
 /// DOnt select targets with a .team matching its own
-#define TFL_TARGETSELECT_TEAMCHECK     256
+const float TFL_TARGETSELECT_TEAMCHECK     = 256;
 /// Cant select targets on its own. needs to be triggerd or slaved.
-#define TFL_TARGETSELECT_NOBUILTIN     512
+const float TFL_TARGETSELECT_NOBUILTIN     = 512;
 /// TFL_TARGETSELECT_TEAMCHECK is inverted (selects only mebers of own .team)
-#define TFL_TARGETSELECT_OWNTEAM       1024
+const float TFL_TARGETSELECT_OWNTEAM       = 1024;
 /// Turrets aren't valid targets
-#define TFL_TARGETSELECT_NOTURRETS     2048
+const float TFL_TARGETSELECT_NOTURRETS     = 2048;
 /// Use feild of view
-#define TFL_TARGETSELECT_FOV           4096
+const float TFL_TARGETSELECT_FOV           = 4096;
 
-#define TFL_TARGETSELECT_MISSILESONLY  8192
+const float TFL_TARGETSELECT_MISSILESONLY  = 8192;
 
 /// aim flags
 .float aim_flags;
 /// Dont aim.
-#define TFL_AIM_NO                  1
-/// Go for ground, not direct hit
-//#define TFL_AIM_GROUND              2
+const float TFL_AIM_NO                  = 1;
 /// Go for ground, not direct hit, but only if target is on ground.
-#define TFL_AIM_GROUND2             4
-/// Use balistic aim. FIXME: not implemented
-#define TFL_AIM_BALISTIC            8
+const float TFL_AIM_GROUNDGROUND        = 2;
 /// Try to predict target movement (does not account for gravity)
-#define TFL_AIM_LEAD                16
+const float TFL_AIM_LEAD                = 4;
 /// Compensate for shot traveltime when lead
-#define TFL_AIM_SHOTTIMECOMPENSATE  32
-/// Aim slightly in front of target
-#define TFL_AIM_INFRONT             64
-/// Aim slightly behind target
-#define TFL_AIM_BEHIND              128
-/// blend real and predicted z positions. (fake bounce prediction) 
-// #define TFL_AIM_ZEASE               256 
+const float TFL_AIM_SHOTTIMECOMPENSATE  = 8;
 /// Try to do real prediction of targets z pos at impact.
-#define TFL_AIM_ZPREDICT            512
+const float TFL_AIM_ZPREDICT            = 16;
 /// Simply aim at target's current location
-#define TFL_AIM_SIMPLE              1024
+const float TFL_AIM_SIMPLE              = 32;
 
 /// track (turn and pitch head) flags
 .float track_flags;
 /// Dont move head
-#define TFL_TRACK_NO    2
+const float TFL_TRACK_NO    = 2;
 /// Pitch the head
-#define TFL_TRACK_PITCH 4
+const float TFL_TRACK_PITCH = 4;
 /// Rotate the head
-#define TFL_TRACK_ROT   8
+const float TFL_TRACK_ROT   = 8;
 
 /// How tracking is preformed
 .float track_type;
 /// Hard angle increments. Ugly for fast turning, best accuracy.
-#define TFL_TRACKTYPE_STEPMOTOR    1
+const float TFL_TRACKTYPE_STEPMOTOR    = 1;
 /// Smoth absolute movement. Looks ok, fair accuracy.
-#define TFL_TRACKTYPE_FLUIDPRECISE 2
-/// Simulated inertia. "Wobbly mode" Looks kool, can mean really bad accuracy depending on how the feilds below are set
-#define TFL_TRACKTYPE_FLUIDINERTIA 3
+const float TFL_TRACKTYPE_FLUIDPRECISE = 2;
+/// Simulated inertia. "Wobbly mode" Looks kool, can mean really bad accuracy depending on how the fields below are set
+const float TFL_TRACKTYPE_FLUIDINERTIA = 3;
 /// TFL_TRACKTYPE_FLUIDINERTIA: pitch multiplier
 .float track_accel_pitch;
 /// TFL_TRACKTYPE_FLUIDINERTIA: rotation multiplier
@@ -122,129 +210,126 @@ vector real_origin(entity ent);
 
 /// How prefire check is preformed
 .float firecheck_flags;
-/// Dont kill the world
-#define TFL_FIRECHECK_WORLD       2
 /// Dont kill the dead
-#define TFL_FIRECHECK_DEAD        4
+const float TFL_FIRECHECK_DEAD        = 4;
 /// Range limits apply
-#define TFL_FIRECHECK_DISTANCES   8
+const float TFL_FIRECHECK_DISTANCES   = 8;
 /// Line Of Sight needs to be clear
-#define TFL_FIRECHECK_LOS         16
+const float TFL_FIRECHECK_LOS         = 16;
 /// Consider distance inpactpoint<->aimspot
-#define TFL_FIRECHECK_AIMDIST     32
+const float TFL_FIRECHECK_AIMDIST     = 32;
 /// Consider enemy origin<->impactpoint
-#define TFL_FIRECHECK_REALDIST    64
+const float TFL_FIRECHECK_REALDIST    = 64;
 /// Consider angular diff head<->aimspot
-#define TFL_FIRECHECK_ANGLEDIST  128
+const float TFL_FIRECHECK_ANGLEDIST  = 128;
 /// (re)consider target.team<->self.team
-#define TFL_FIRECHECK_TEAMCECK   256
+const float TFL_FIRECHECK_TEAMCECK   = 256;
 /// Try to avoid friendly fire
-#define TFL_FIRECHECK_AFF        512
+const float TFL_FIRECHECK_AFF        = 512;
 /// Own .ammo needs to be >= then own .shot_dmg
-#define TFL_FIRECHECK_OWM_AMMO   1024
+const float TFL_FIRECHECK_OWM_AMMO   = 1024;
 /// Others ammo need to be < others .ammo_max
-#define TFL_FIRECHECK_OTHER_AMMO 2048
+const float TFL_FIRECHECK_OTHER_AMMO = 2048;
 /// Check own .attack_finished_single vs time
-#define TFL_FIRECHECK_REFIRE     4096
+const float TFL_FIRECHECK_REFIRE     = 4096;
 /// Move the acctual target to aimspot before tracing impact (and back after)
-#define TFL_FIRECHECK_VERIFIED   8192
+//#define TFL_FIRECHECK_VERIFIED   8192
 /// Dont do any chekcs
-#define TFL_FIRECHECK_NO         16384
+const float TFL_FIRECHECK_NO         = 16384;
 
 /// How shooting is done
 .float shoot_flags;
 /// Dont shoot
-#define  TFL_SHOOT_NO          64
+const float  TFL_SHOOT_NO          = 64;
 /// Fire in vollys (partial implementation through .shot_volly)
-#define  TFL_SHOOT_VOLLY       2
+const float  TFL_SHOOT_VOLLY       = 2;
 /// Always do a full volly, even if target is lost or dead. (not implemented)
-#define  TFL_SHOOT_VOLLYALWAYS 4
+const float  TFL_SHOOT_VOLLYALWAYS = 4;
 /// Loop though all valid tarters, and hit them.
-#define  TFL_SHOOT_HITALLVALID 8
+const float  TFL_SHOOT_HITALLVALID = 8;
 /// Fiering makes unit loose target (after volly is done, if in volly mode)
-#define  TFL_SHOOT_CLEARTARGET 16
+const float  TFL_SHOOT_CLEARTARGET = 16;
 ///Custom shooting;
-#define  TFL_SHOOT_CUSTOM 32
+const float  TFL_SHOOT_CUSTOM = 32;
 
 /// Information aboute the units capabilities
 .float turrcaps_flags;
 /// No kown capabilities
-#define  TFL_TURRCAPS_NONE        0
+const float  TFL_TURRCAPS_NONE        = 0;
 /// Capable of sniping
-#define  TFL_TURRCAPS_SNIPER      2
+const float  TFL_TURRCAPS_SNIPER      = 2;
 /// Capable of splasdamage
-#define  TFL_TURRCAPS_RADIUSDMG   4
+const float  TFL_TURRCAPS_RADIUSDMG   = 4;
 /// Has one or more cannons with zero shot traveltime
-#define  TFL_TURRCAPS_HITSCAN     8
+const float  TFL_TURRCAPS_HITSCAN     = 8;
 /// More then one (type of) gun
-#define  TFL_TURRCAPS_MULTIGUN    16
+const float  TFL_TURRCAPS_MULTIGUN    = 16;
 /// Carries at least one guided weapon
-#define  TFL_TURRCAPS_GUIDED      32
+const float  TFL_TURRCAPS_GUIDED      = 32;
 /// At least one gun fiers slow projectiles
-#define  TFL_TURRCAPS_SLOWPROJ    64
+const float  TFL_TURRCAPS_SLOWPROJ    = 64;
 /// At least one gun fiers medium speed projectiles
-#define  TFL_TURRCAPS_MEDPROJ     128
+const float  TFL_TURRCAPS_MEDPROJ     = 128;
 /// At least one gun fiers fast projectiles
-#define  TFL_TURRCAPS_FASTPROJ    256
+const float  TFL_TURRCAPS_FASTPROJ    = 256;
 /// At least one gun capable of damaging players
-#define  TFL_TURRCAPS_PLAYERKILL  512
+const float  TFL_TURRCAPS_PLAYERKILL  = 512;
 /// At least one gun that can shoot town missiles
-#define  TFL_TURRCAPS_MISSILEKILL 1024
+const float  TFL_TURRCAPS_MISSILEKILL = 1024;
 /// Has support capabilities. powerplants and sutch.
-#define  TFL_TURRCAPS_SUPPORT     2048
+const float  TFL_TURRCAPS_SUPPORT     = 2048;
 /// Proveides at least one type of ammmo
-#define  TFL_TURRCAPS_AMMOSOURCE  4096
+const float  TFL_TURRCAPS_AMMOSOURCE  = 4096;
 /// Can recive targets from external sources
-#define TFL_TURRCAPS_RECIVETARGETS 8192
+const float TFL_TURRCAPS_RECIVETARGETS = 8192;
 /// Capable of self-transport
-#define TFL_TURRCAPS_MOVE 16384
+const float TFL_TURRCAPS_MOVE = 16384;
 /// Will roam arround even if not chasing anyting
-#define TFL_TURRCAPS_ROAM 32768
-#define TFL_TURRCAPS_ISTURRET 65536
+const float TFL_TURRCAPS_ROAM = 32768;
+const float TFL_TURRCAPS_ISTURRET = 65536;
 
 /// Ammo types needed and/or provided
-.float ammo_flags;
+//.float ammo_flags;
+#define ammo_flags currentammo
 /// Has and needs no ammo
-#define  TFL_AMMO_NONE     64
+const float  TFL_AMMO_NONE     = 64;
 /// Uses power
-#define  TFL_AMMO_ENERGY   2
+const float  TFL_AMMO_ENERGY   = 2;
 /// Uses bullets
-#define  TFL_AMMO_BULLETS  4
+const float  TFL_AMMO_BULLETS  = 4;
 /// Uses explosives
-#define  TFL_AMMO_ROCKETS  8
+const float  TFL_AMMO_ROCKETS  = 8;
 /// Regenerates ammo on its own
-#define  TFL_AMMO_RECHARGE 16
+const float  TFL_AMMO_RECHARGE = 16;
 /// Can recive ammo from others
-#define  TFL_AMMO_RECIVE   32
+const float  TFL_AMMO_RECIVE   = 32;
 
 /// How incomming damage is handeld
 .float damage_flags;
 /// Cant be hurt
-#define  TFL_DMG_NO              256
+const float  TFL_DMG_NO              = 256;
 /// Can be damaged
-#define  TFL_DMG_YES             2
+const float  TFL_DMG_YES             = 2;
 /// Can be damaged  by teammates
-#define  TFL_DMG_TAKEFROMTEAM    4
+const float  TFL_DMG_TAKEFROMTEAM    = 4;
 /// Traget attackers
-#define  TFL_DMG_RETALIATE       8
+const float  TFL_DMG_RETALIATE       = 8;
 /// Target attackers, even is on own team
-#define  TFL_DMG_RETALIATEONTEAM 16
+const float  TFL_DMG_RETALIATEONTEAM = 16;
 /// Loses target when damaged
-#define  TFL_DMG_TARGETLOSS      32
+const float  TFL_DMG_TARGETLOSS      = 32;
 /// Reciving damage trows off aim (pointless atm, aim gets recalculated to fast). not implemented.
-#define  TFL_DMG_AIMSHAKE        64
+const float  TFL_DMG_AIMSHAKE        = 64;
 /// Reciving damage slaps the head arround
-#define  TFL_DMG_HEADSHAKE       128
+const float  TFL_DMG_HEADSHAKE       = 128;
 /// Die and stay dead.
-#define  TFL_DMG_DEATH_NORESPAWN 256
-/// Supress std turret gibs on death
-#define  TFL_DMG_DEATH_NOGIBS    512
+const float  TFL_DMG_DEATH_NORESPAWN = 256;
 
 // Spawnflags
 /// Spawn in teambased modes
-#define TFL_SPAWN_TEAM      2
+const float TFL_SPAWN_TEAM      = 2;
 /// Spawn in FFA modes
-#define TFL_SPAWN_FFA       4
+const float TFL_SPAWN_FFA       = 4;
 
 
 /*
@@ -265,9 +350,6 @@ vector real_origin(entity ent);
 /// Defend this entity (or ratehr this entitys position)
 .entity     tur_defend;
 
-/// on/off toggle.
-.float      tur_active;
-
 /// and shoot from here. (can be non constant, think MLRS)
 .vector     tur_shotorg;
 
@@ -457,33 +539,32 @@ void turrets_precash();
 #endif // SVQC
 
 // common
-.float turret_type;
-float TID_COMMON        = 1;
-float TID_EWHEEL        = 2;
-float TID_FLAC          = 3;
-float TID_FUSION        = 4;
-float TID_HELLION       = 5;
-float TID_HK            = 6;
-float TID_MACHINEGUN    = 7;
-float TID_MLRS          = 8;
-float TID_PHASER        = 9;
-float TID_PLASMA        = 10;
-float TID_PLASMA_DUAL   = 11;
-float TID_TESLA         = 12;
-float TID_WALKER        = 13;
-float TID_LAST          = 13;
-
-float TNSF_UPDATE       = 2;
-float TNSF_STATUS       = 4;
-float TNSF_SETUP        = 8;
-float TNSF_ANG          = 16;
-float TNSF_AVEL         = 32;
-float TNSF_MOVE         = 64;
+.int turret_type;
+const int TID_COMMON        = 1;
+const int TID_EWHEEL        = 2;
+const int TID_FLAC          = 3;
+const int TID_FUSION        = 4;
+const int TID_HELLION       = 5;
+const int TID_HK            = 6;
+const int TID_MACHINEGUN    = 7;
+const int TID_MLRS          = 8;
+const int TID_PHASER        = 9;
+const int TID_PLASMA        = 10;
+const int TID_PLASMA_DUAL   = 11;
+const int TID_TESLA         = 12;
+const int TID_WALKER        = 13;
+const int TID_LAST          = 13;
+
+const int TNSF_UPDATE       = 2;
+const int TNSF_STATUS       = 4;
+const int TNSF_SETUP        = 8;
+const int TNSF_ANG          = 16;
+const int TNSF_AVEL         = 32;
+const int TNSF_MOVE         = 64;
 .float anim_start_time;
-float TNSF_ANIM         = 128;
+const int TNSF_ANIM         = 128;
 
-float TNSF_FULL_UPDATE  = 16777215;
+const int TNSF_FULL_UPDATE  = 16777215;
 
 #endif // TTURRETS_ENABLED
-
-
+#endif
\ No newline at end of file