X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fclient.qh;h=abda1204aba38bed656a63abf7fd76bfce5a62de;hb=67610c5b92e218cc245c040209c1a79ab6b02758;hp=20148933cbc5421d5a87fb56b105c6c022885ef3;hpb=3c08700f00a014d84ffe1bb64305ca5da7594cea;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/client.qh b/qcsrc/server/client.qh index 20148933c..abda1204a 100644 --- a/qcsrc/server/client.qh +++ b/qcsrc/server/client.qh @@ -1,8 +1,34 @@ #pragma once #include "utils.qh" +#include +#include #include +// WEAPONTODO +.string weaponorder_byimpulse; + +.entity clientdata; + +.float jointime; // time of connecting +.float startplaytime; // time of switching from spectator to player +.float alivetime; // time of being alive +.float motd_actived_time; // used for both motd and campaign_message + +.bool wasplayer; + +.int spectatee_status; +.bool zoomstate; + +.bool just_joined; + +.int pressedkeys; + +.int playerid; + +.string playermodel; +.string playerskin; + void ClientState_attach(entity this); IntrusiveList g_players; @@ -114,7 +140,7 @@ CLASS(Client, Object) ATTRIB(Client, cmd_floodtime, float, this.cmd_floodtime); ATTRIB(Client, wasplayer, bool, this.wasplayer); ATTRIB(Client, weaponorder_byimpulse, string, this.weaponorder_byimpulse); - ATTRIB(Client, autojoin_checked, bool, this.wasplayer); + ATTRIB(Client, autojoin_checked, int, this.wasplayer); // networked cvars @@ -231,38 +257,72 @@ METHOD(Client, m_unwind, bool(Client this)) return false; } +int autocvar__independent_players; +bool independent_players; +#define INDEPENDENT_PLAYERS (autocvar__independent_players ? (autocvar__independent_players > 0) : independent_players) +#define IS_INDEPENDENT_PLAYER(e) ((e).solid == SOLID_TRIGGER) +#define MAKE_INDEPENDENT_PLAYER(e) (((e).solid = SOLID_TRIGGER), ((e).frags = FRAGS_PLAYER_OUT_OF_GAME)) + +.int killcount; + +//flood fields +.float nickspamtime; // time of last nick change +.float nickspamcount; + +// respawning +.int respawn_flags; +.float respawn_time; +.float respawn_time_max; + +.float respawn_countdown; // next number to count + +const int RESPAWN_FORCE = BIT(0); +const int RESPAWN_SILENT = BIT(1); +const int RESPAWN_DENY = BIT(2); + +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 + +.bool player_blocked; + +const int SVC_SETVIEW = 5; // TODO: move to dpdefs where this belongs! + +// TODO: standardise resource regeneration +.float pauseregen_finished; +.float pauserothealth_finished; +.float pauserotarmor_finished; +.float pauserotfuel_finished; + +// g__str: +// If 0, default is used. +// If <0, 0 is used. +// Otherwise, g_str (default value) is used. +// For consistency, negative values there are mapped to zero too. +#define GAMETYPE_DEFAULTED_SETTING(str) \ + ((gametype_setting_tmp = cvar(strcat("g_", GetGametype(), "_" #str))), \ + (gametype_setting_tmp < 0) ? 0 \ + : (gametype_setting_tmp == 0 || autocvar_g_respawn_delay_forced) ? max(0, autocvar_g_##str) \ + : gametype_setting_tmp) + +void calculate_player_respawn_time(entity this); + bool PlayerInList(entity player, string list); -/// \brief Print the string to the client's chat. -/// \param[in] client Client to print to. -/// \param[in] text Text to print. -void PrintToChat(entity client, string text); - -/// \brief Print the string to the client's chat if the server cvar "developer" -/// is not 0. -/// \param[in] client Client to print to. -/// \param[in] text Text to print. -void DebugPrintToChat(entity client, string text); - -/// \brief Prints the string to all clients' chat. -/// \param[in] text Text to print. -void PrintToChatAll(string text); - -/// \brief Prints the string to all clients' chat if the server cvar "developer" -/// is not 0. -/// \param[in] text Text to print. -void DebugPrintToChatAll(string text); - -/// \brief Print the string to chat of all clients of the specified team. -/// \param[in] team_num Team to print to. See NUM_TEAM constants. -/// \param[in] text Text to print. -void PrintToChatTeam(int team_num, string text); - -/// \brief Print the string to chat of all clients of the specified team if the -/// server cvar "developer" is not 0. -/// \param[in] team_num Team to print to. See NUM_TEAM constants. -/// \param[in] text Text to print. -void DebugPrintToChatTeam(int team_num, string text); +void ClientData_Touch(entity e); + +int nJoinAllowed(entity this, entity ignore); + +void checkSpectatorBlock(entity this); + +void PlayerUseKey(entity this); + +void FixClientCvars(entity e); + +// called when a client connects, useful for updating sounds and such of static objects +.void(entity this, entity player) init_for_player; + +IntrusiveList g_initforplayer; +STATIC_INIT(g_initforplayer) { g_initforplayer = IL_NEW(); } void play_countdown(entity this, float finished, Sound samp); @@ -283,10 +343,11 @@ void ClientInit_misc(entity this); int GetPlayerLimit(); +const int MIN_SPEC_TIME = 1; bool joinAllowed(entity this); void Join(entity this); #define SPECTATE_COPY() ACCUMULATE void SpectateCopy(entity this, entity spectatee) #define SPECTATE_COPYFIELD(fld) SPECTATE_COPY() { this.(fld) = spectatee.(fld); } -int Say(entity source, int teamsay, entity privatesay, string msgin, bool floodcontrol); +const int MAX_SPECTATORS = 7;