]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/defs.qh
Merge branch 'master' into Mario/fullbright_skins
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / defs.qh
index d0e30bacd5a5693796264e8740f86be2aab01833..8eea0dc203d189b4e4007dfbe8f51a23ea63ba27 100644 (file)
@@ -1,28 +1,14 @@
-#ifndef SERVER_DEFS_H
-#define SERVER_DEFS_H
+#pragma once
 
-#include "../common/weapons/all.qh"
-#include "../common/stats.qh"
+float warmup_limit;
+#include <common/weapons/all.qh>
+#include <common/stats.qh>
 
 #define INDEPENDENT_ATTACK_FINISHED 1
 
-#define BUTTON_ATCK       button0
-#define BUTTON_JUMP       button2
-#define BUTTON_ATCK2      button3
-#define BUTTON_ZOOM       button4
-#define BUTTON_CROUCH     button5
-#define BUTTON_HOOK       button6
-#define BUTTON_INFO       button7
-#define BUTTON_CHAT       buttonchat
-#define BUTTON_USE        buttonuse
-#define BUTTON_DRAG       button8
-#define BUTTON_ZOOMSCRIPT button9
-#define BUTTON_JETPACK    button10
-
 // Globals
 
 float g_footsteps, g_grappling_hook, g_instagib;
-float g_warmup_limit;
 float g_warmup_allguns;
 float g_warmup_allow_timeout;
 float warmup_stage;
@@ -54,14 +40,12 @@ void UpdateFrags(entity player, float f);
 
 float team1_score, team2_score, team3_score, team4_score;
 
-float maxclients;
-
 // flag set on worldspawn so that the code knows if it is dedicated or not
 float server_is_dedicated;
 
 // Fields
 
-.void(entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage;
+.void(entity this, entity inflictor, entity attacker, float damage, int deathtype, vector hitloc, vector force) event_damage;
 
 //.string      wad;
 //.string      map;
@@ -71,15 +55,15 @@ float server_is_dedicated;
 .float inactive; // Clientwall disappears when inactive
 .float alpha_max, alpha_min;
 .float fade_start, fade_end, fade_vertical_offset;
-.float default_solid; // Variable to store default self.solid for clientwalls
+.float default_solid; // Variable to store default .solid for clientwalls
 
 .float pain_finished;                  //Added by Supajoe
 .float pain_frame;                     //"
 .float  crouch;        // Crouching or not?
 
-.float strength_finished;
-.float invincible_finished;
-.float superweapons_finished;
+.float strength_finished = _STAT(STRENGTH_FINISHED);
+.float invincible_finished = _STAT(INVINCIBLE_FINISHED);
+.float superweapons_finished = _STAT(SUPERWEAPONS_FINISHED);
 
 .float cnt; // used in too many places
 .float count;
@@ -93,14 +77,7 @@ float server_is_dedicated;
 .float fade_time;
 .float fade_rate;
 
-// weapon animation vectors:
-.vector anim_fire1;
-.vector anim_fire2;
-.vector anim_idle;
-.vector anim_reload;
-
-void() player_setupanimsformodel;
-void setanim(entity e, vector anim, float looping, float override, float restart);
+void player_setupanimsformodel(entity this);
 
 .string mdl;
 
@@ -112,6 +89,7 @@ void setanim(entity e, vector anim, float looping, float override, float restart
 .float scheduledrespawntime;
 .float respawntime;
 .float respawntimejitter;
+.float respawntimestart;
 //.float       chasecam;
 
 .float damageforcescale;
@@ -138,7 +116,6 @@ const float MAX_DAMAGEEXTRARADIUS = 16;
 .float iscreature;
 .float damagedbycontents;
 .float damagedbytriggers;
-.float pushable;
 .float teleportable;
 .vector oldvelocity;
 
@@ -151,19 +128,9 @@ const float MAX_DAMAGEEXTRARADIUS = 16;
 .entity item_pickupsound_ent;
 .entity item_model_ent;
 
-// definitions for weaponsystem
-// more WEAPONTODO: move these to their proper files
-.entity exteriorweaponentity;
-.vector weaponentity_glowmod;
-
-//.int weapon; // current weapon
-.int switchweapon = _STAT(SWITCHWEAPON);
-.int switchingweapon; // weapon currently being switched to (is copied from switchweapon once switch is possible)
-.string weaponname; // name of .weapon
-
 // WEAPONTODO
 .float autoswitch;
-float client_hasweapon(entity cl, float wpn, float andammo, float complain);
+bool client_hasweapon(entity this, Weapon wpn, float andammo, bool complain);
 void w_clear(Weapon thiswep, entity actor, .entity weaponentity, int fire);
 void w_ready(Weapon thiswep, entity actor, .entity weaponentity, int fire);
 // VorteX: standalone think for weapons, so normal think on weaponentity can be reserved by weaponflashes (which needs update even player dies)
@@ -171,13 +138,6 @@ void w_ready(Weapon thiswep, entity actor, .entity weaponentity, int fire);
 .void(Weapon thiswep, entity actor, .entity weaponentity, int fire) weapon_think;
 
 
-// weapon states (self.weaponentity.state)
-const int WS_CLEAR                     = 0; // no weapon selected
-const int WS_RAISE                     = 1; // raise frame
-const int WS_DROP                              = 2; // deselecting frame
-const int WS_INUSE                     = 3; // fire state
-const int WS_READY                     = 4; // idle frame
-
 // there is 2 weapon tics that can run in one server frame
 const int W_TICSPERFRAME = 2;
 
@@ -195,7 +155,7 @@ float alreadychangedlevel;
 
 float blockSpectators; //if set, new or existing spectators or observers will be removed unless they become a player within g_maxplayers_spectator_blocktime seconds
 .float spectatortime; //point in time since the client is spectating or observing
-void checkSpectatorBlock();
+void checkSpectatorBlock(entity this);
 
 float game_completion_ratio; // 0 at start, 1 near end
 .float winning;
@@ -203,7 +163,7 @@ float game_completion_ratio; // 0 at start, 1 near end
 .float alivetime; // time of being alive
 .float motd_actived_time; // used for both motd and campaign_message
 
-float nJoinAllowed(entity ignore);
+bool nJoinAllowed(entity this, entity ignore);
 
 .float spawnshieldtime;
 .float item_spawnshieldtime;
@@ -211,29 +171,24 @@ float nJoinAllowed(entity ignore);
 .entity flagcarried;
 
 .int playerid;
-float playerid_last;
 .float noalign;                // if set to 1, the item or spawnpoint won't be dropped to the floor
 
-.vector spawnorigin;
-
 .vector death_origin;
 .vector killer_origin;
 
 float default_player_alpha;
 float default_weapon_alpha;
 
-.float() customizeentityforclient;
 .float cvar_cl_handicap;
 .float cvar_cl_clippedspectating;
 .float cvar_cl_autoscreenshot;
 .float cvar_cl_jetpack_jump;
-.float cvar_cl_movement_track_canjump;
+.float cvar_cl_movement_track_canjump = _STAT(MOVEVARS_CL_TRACK_CANJUMP);
 .float cvar_cl_newusekeysupported;
 
 .string cvar_g_xonoticversion;
 .string cvar_cl_weaponpriority;
 .string cvar_cl_weaponpriorities[10];
-.float cvar_cl_gunalign;
 .float cvar_cl_noantilag;
 
 .string weaponorder_byimpulse;
@@ -256,7 +211,7 @@ void FixClientCvars(entity e);
 // WEAPONTODO: remove this
 WepSet weaponsInMap;
 
-.WepSet weaponsinmap;
+#define weapons _STAT(WEAPONS)
 
 .float respawn_countdown; // next number to count
 
@@ -269,7 +224,7 @@ float bot_waypoints_for_items;
 #else
 #define ATTACK_FINISHED_FOR(ent, w, slot) ((ent).attack_finished_single[slot])
 #endif
-#define ATTACK_FINISHED(ent, slot) ATTACK_FINISHED_FOR(ent, (ent).weapon, slot)
+#define ATTACK_FINISHED(ent, slot) ATTACK_FINISHED_FOR(ent, PS(ent).m_weapon.m_id, slot)
 
 // assault game mode: Which team is attacking in this round?
 float assault_attacker_team;
@@ -303,75 +258,6 @@ float tracebox_hits_trigger_hurt(vector start, vector mi, vector ma, vector end)
 
 float next_pingtime;
 
-// player sounds, voice messages
-// TODO implemented fall and falling
-#define ALLPLAYERSOUNDS \
-               _VOICEMSG(death) \
-               _VOICEMSG(drown) \
-               _VOICEMSG(fall) \
-               _VOICEMSG(falling) \
-               _VOICEMSG(gasp) \
-               _VOICEMSG(jump) \
-               _VOICEMSG(pain100) \
-               _VOICEMSG(pain25) \
-               _VOICEMSG(pain50) \
-               _VOICEMSG(pain75)
-
-#define ALLVOICEMSGS \
-               _VOICEMSG(attack) \
-               _VOICEMSG(attackinfive) \
-               _VOICEMSG(coverme) \
-               _VOICEMSG(defend) \
-               _VOICEMSG(freelance) \
-               _VOICEMSG(incoming) \
-               _VOICEMSG(meet) \
-               _VOICEMSG(needhelp) \
-               _VOICEMSG(seenflag) \
-               _VOICEMSG(taunt) \
-               _VOICEMSG(teamshoot)
-
-#define _VOICEMSG(m) .string playersound_##m;
-ALLPLAYERSOUNDS
-ALLVOICEMSGS
-#undef _VOICEMSG
-
-// reserved sound names for the future (some models lack sounds for them):
-//             _VOICEMSG(flagcarriertakingdamage) \
-//             _VOICEMSG(getflag) \
-// reserved sound names for the future (ALL models lack sounds for them):
-//             _VOICEMSG(affirmative) \
-//             _VOICEMSG(attacking) \
-//             _VOICEMSG(defending) \
-//             _VOICEMSG(roaming) \
-//             _VOICEMSG(onmyway) \
-//             _VOICEMSG(droppedflag) \
-//             _VOICEMSG(negative) \
-//             _VOICEMSG(seenenemy) \
-//      /**/
-
-string globalsound_fall;
-string globalsound_metalfall;
-string globalsound_step;
-string globalsound_metalstep;
-
-const float VOICETYPE_PLAYERSOUND = 10;
-const float VOICETYPE_TEAMRADIO = 11;
-const float VOICETYPE_LASTATTACKER = 12;
-const float VOICETYPE_LASTATTACKER_ONLY = 13;
-const float VOICETYPE_AUTOTAUNT = 14;
-const float VOICETYPE_TAUNT = 15;
-
-void PrecachePlayerSounds(string f);
-void PrecacheGlobalSound(string samplestring);
-void UpdatePlayerSounds();
-void ClearPlayerSounds();
-void PlayerSound(.string samplefield, float channel, float voicetype);
-void GlobalSound(string samplestring, float channel, float voicetype);
-void FakeGlobalSound(string samplestring, float channel, float voicetype);
-void VoiceMessage(string type, string message);
-float GetPlayerSoundSampleField_notFound;
-.string GetVoiceMessageSampleField(string type);
-
 // autotaunt system
 .float cvar_cl_autotaunt;
 .float cvar_cl_voice_directional;
@@ -387,7 +273,7 @@ bool independent_players;
 
 string clientstuff;
 .float phase;
-.int pressedkeys;
+.int pressedkeys = _STAT(PRESSED_KEYS);
 
 .string fog;
 
@@ -397,8 +283,6 @@ float cvar_purechanges_count;
 
 float game_starttime; //point in time when the countdown to game start is over
 float round_starttime; //point in time when the countdown to round start is over
-.float stat_game_starttime;
-.float stat_round_starttime;
 
 void W_Porto_Remove (entity p);
 
@@ -406,8 +290,6 @@ void W_Porto_Remove (entity p);
 
 .string message2;
 
-.float stat_allow_oldvortexbeam;
-
 // reset to 0 on weapon switch
 // may be useful to all weapons
 .float bulletcounter;
@@ -416,11 +298,11 @@ void W_Porto_Remove (entity p);
 .entity ballcarried; // Also used for keepaway
 float g_nexball_meter_period;
 
-void SUB_DontUseTargets();
-void SUB_UseTargets();
+void SUB_DontUseTargets(entity this, entity actor, entity trigger);
+void SUB_UseTargets(entity this, entity actor, entity trigger);
 
-.void() reset; // if set, an entity is reset using this
-.void() reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
+.void(entity this) reset; // if set, an entity is reset using this
+.void(entity this) reset2; // if set, an entity is reset using this (after calling ALL the reset functions for other entities)
 
 void ClientData_Touch(entity e);
 
@@ -443,18 +325,16 @@ float servertime, serverprevtime, serverframetime;
 .float floodcontrol_voice;
 .float floodcontrol_voiceteam;
 
-.float stat_shotorg; // networked stat for trueaim HUD
+.float stat_shotorg = _STAT(SHOTORG); // networked stat for trueaim HUD
 
 string matchid;
 
-.float last_pickup;
+.float last_pickup = _STAT(LAST_PICKUP);
 
-.float hit_time;
-.float typehit_time;
+.float hit_time = _STAT(HIT_TIME);
+.float typehit_time = _STAT(TYPEHIT_TIME);
 
-.float damage_dealt_total;
-
-.float stat_leadlimit;
+.float damage_dealt_total = _STAT(DAMAGE_DEALT_TOTAL);
 
 bool radar_showennemies;
 
@@ -465,15 +345,15 @@ float client_cefc_accumulatortime;
 
 .float weapon_load[Weapons_MAX];
 .int ammo_none; // used by the reloading system, must always be 0
-.float clip_load;
+.float clip_load = _STAT(WEAPON_CLIPLOAD);
 .float old_clip_load;
-.float clip_size;
+.float clip_size = _STAT(WEAPON_CLIPSIZE);
 
-.float minelayer_mines;
-.float vortex_charge;
+.float minelayer_mines = _STAT(LAYED_MINES);
+.float vortex_charge = _STAT(VORTEX_CHARGE);
 .float vortex_charge_rottime;
-.float vortex_chargepool_ammo;
-.float hagar_load;
+.float vortex_chargepool_ammo = _STAT(VORTEX_CHARGEPOOL);
+.float hagar_load = _STAT(HAGAR_LOAD);
 
 .int grab; // 0 = can't grab, 1 = owner can grab, 2 = owner and team mates can grab, 3 = anyone can grab
 
@@ -490,7 +370,7 @@ float client_cefc_accumulatortime;
 
 string deathmessage;
 
-.float just_joined;
+.bool just_joined;
 
 .float cvar_cl_weaponimpulsemode;
 .float selectweapon; // last selected weapon of the player
@@ -503,7 +383,7 @@ const float ACTIVE_IDLE     = 2;
 const float ACTIVE_BUSY        = 2;
 const float ACTIVE_TOGGLE      = 3;
 .float active;
-.void (float act_state) setactive;
+.void (entity this, int act_state) setactive;
 .entity realowner;
 
 //float serverflags;
@@ -513,8 +393,8 @@ const float ACTIVE_TOGGLE   = 3;
 .float player_blocked;
 .float weapon_blocked; // weapon use disabled
 
-.float frozen; // for freeze attacks
-.float revive_progress;
+.float frozen = _STAT(FROZEN); // for freeze attacks
+.float revive_progress = _STAT(REVIVE_PROGRESS);
 .float revival_time; // time at which player was last revived
 .float revive_speed; // NOTE: multiplier (anything above 1 is instaheal)
 .entity iceblock;
@@ -523,11 +403,11 @@ const float ACTIVE_TOGGLE         = 3;
 .entity muzzle_flash;
 .float misc_bulletcounter;     // replaces uzi & hlac bullet counter.
 
-.float stat_respawn_time; // shows respawn time, and is negative when awaiting respawn
+.float stat_respawn_time = _STAT(RESPAWN_TIME); // shows respawn time, and is negative when awaiting respawn
 
-void PlayerUseKey();
+void PlayerUseKey(entity this);
 
-typedef vector(entity player, entity spot, vector current) spawn_evalfunc_t;
+USING(spawn_evalfunc_t, vector(entity this, entity player, entity spot, vector current));
 .spawn_evalfunc_t spawn_evalfunc;
 
 string modname;
@@ -560,7 +440,5 @@ const int MIF_GUIDED_CONFUSABLE = MIF_GUIDED_HEAT | MIF_GUIDED_AI;
 
 .string cvar_cl_physics;
 
-.float init_for_player_needed;
-.void(entity) init_for_player;
-
-#endif
+.bool init_for_player_needed;
+.void(entity this, entity player) init_for_player;