41#define DP_CSQC_ENTITY_REMOVE_IS_B0RKED
46void CSQC_Init(
float apilevel,
string enginename,
float engineversion)
51 LOG_TRACEF(
"^4CSQC Build information: ^1%s", WATERMARK);
59 if (getplayerkeyvalue(i,
"viewentity") ==
"")
101 registercvar(
"cl_weapon_switch_fallback_to_impulse",
"1");
109 cvar_settemp(
"_scoreboard_team_selection_available",
"1");
110 cvar_set(
"_scoreboard_team_selection",
"0");
113 registercvar(
"hud_panel_checkpoints_pos",
"0.700000 0.190000");
114 registercvar(
"hud_panel_checkpoints_size",
"0.250000 0.170000");
191 localcmd(
"\n_cl_hook_gamestart nop\n");
203 int gamecount =
cvar(
"cl_matchcount");
231 for(e =
prev.sort_next; e;
prev = e, e = e.sort_next)
233 if(
prev != e.sort_prev)
234 error(
strcat(
"sort list chain error\nplease submit the output of 'prvm_edicts client' to the developers"));
238 for(e =
prev.sort_next; e;
prev = e, e = e.sort_next)
240 if(
prev != e.sort_prev)
241 error(
strcat(
"sort list chain error\nplease submit the output of 'prvm_edicts client' to the developers"));
249 for(pl =
players.sort_next; pl; pl = pl.sort_next)
251 error(
"Player already registered!");
252 player.sort_next =
players.sort_next;
255 players.sort_next.sort_prev = player;
266 for(pl =
players.sort_next; pl && pl != player; pl = pl.sort_next)
271 error(
"Trying to remove a player which is not in the playerlist!");
274 parent.sort_next = player.sort_next;
276 player.sort_next.sort_prev =
parent;
297 for(tm =
teams.sort_next; tm; tm = tm.sort_next)
299 error(
"Team already registered!");
300 Team.sort_next =
teams.sort_next;
301 Team.sort_prev =
teams;
303 teams.sort_next.sort_prev = Team;
304 teams.sort_next = Team;
316 for(tm =
teams.sort_next; tm && tm != Team; tm = tm.sort_next)
321 LOG_INFO(_(
"Trying to remove a team which is not in the teamlist!"));
324 parent.sort_next = Team.sort_next;
326 Team.sort_next.sort_prev =
parent;
334 TC(
int, Team);
TC(
bool, add);
366 LOG_TRACEF(
"trying to switch to unsupported team %d", Team);
382 LOG_TRACEF(
"trying to switch to unsupported team %d", Team);
408 else if(Team != o.team)
450 e.ping_packetloss = 0;
451 e.ping_movementloss = 0;
467 playerchecker.nextthink =
time + 0.2;
472 ReplicateVars_Start();
500 bool override =
false;
527 if(bInputType == 3 || bInputType == 2)
531 bool key_pressed = (bInputType == 0);
556 localcmd(
"\nmenu_showgamemenudialog\n");
574 this.
owner.gotscores = 0;
576 this.
owner.(scores(it)) = 0;
578 this.
owner.ready = 0;
579 this.
owner.eliminated = 0;
580 this.
owner.ignored =
false;
581 this.
owner.colormap = 0;
583 this.
owner.survival_status = 0;
594 bool isNew = !this.
owner;
597#ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
622 int sf = ReadShort();
623 int lf = ReadShort();
631 o.(scores(it)) = ReadChar();
651#if MAX_TEAMSCORE <= 8
655 int sf = ReadShort();
656 int lf = ReadShort();
664 o.(teamscores(i)) = ReadChar();
685 int ignore_id =
stoi(it);
688 if (ignore_id == pl.sv_entnum + 1)
707 int newspectatee_status;
717 newspectatee_status = -1;
720 newspectatee_status = 0;
735 for(i = 0; i < limit; ++i)
835 for (
int b = 0; b < 8; ++b) {
836 if (f &
BIT(b))
continue;
851 float s = ReadShort();
877 f = (f == 0x800000) ? 1 : f * 2;
890 float savetime =
time;
902#ifdef DP_CSQC_ENTITY_REMOVE_IS_B0RKED
905 if (t != this.
enttype || isnew)
907 LOG_INFOF(
"A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)",
etof(
this), this.
entnum, this.
enttype, t);
918 LOG_INFOF(
"A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)",
etof(
this), this.
entnum, t);
925 FOREACH(LinkedEntities, it.m_id == t, {
926 if (isnew) this.classname = it.netname;
927 if (autocvar_developer_csqcentities)
928 LOG_INFOF(
"CSQC_Ent_Update(%i, %d) at %f {.entnum=%d, .enttype=%d} t=%s (%d)", this, isnew, savetime, this.entnum, this.enttype, this.classname, t);
929 done = it.m_read(this, NULL, isnew);
930 MUTATOR_CALLHOOK(Ent_Update, this, isnew);
945 if(this.entremove) this.entremove(
this);
971 LOG_WARN(
"CSQC_Ent_Remove called for already removed entity. Packet loss?");
1021 FOREACH(TempEntities, it.m_id == nTEID, {
1022 if (autocvar_developer_csqcentities)
1023 LOG_INFOF(
"CSQC_Parse_TempEntity() nTEID=%s (%d)", it.netname, nTEID);
1024 return it.m_read(NULL, NULL, true);
1028 LOG_INFOF(
"CSQC_Parse_TempEntity() with nTEID=%d", nTEID);
1073 if (welcome_msg_too)
1115 case 2:
return 0.0254;
1116 case 3:
return 0.0254 * 3.6;
1117 case 4:
return 0.0254 * 3.6 * 0.6213711922;
1118 case 5:
return 0.0254 * 1.943844492;
1128 case 1:
return strcat(
" ", _(
"qu/s"));
1129 case 2:
return strcat(
" ", _(
"m/s"));
1130 case 3:
return strcat(
" ", _(
"km/h"));
1131 case 4:
return strcat(
" ", _(
"mph"));
1132 case 5:
return strcat(
" ", _(
"knots"));
1233 if (reason ==
"missing a checkpoint")
1234 reason = _(
"missing a checkpoint");
1256 int pos = ReadShort();
1257 prevpos = ReadShort();
1264 for (i=m-1; i>pos-1; --i) {
1308 int pi = ReadShort();
1315 e.ping_packetloss = pl / 255.0;
1316 e.ping_movementloss = ml / 255.0;
1339 return build_mutator_list(s);
1344 if (s ==
"")
return s;
1345 if (s ==
"All Weapons Arena")
return _(
"All Weapons Arena");
1346 if (s ==
"All Available Weapons Arena")
return _(
"All Available Weapons Arena");
1347 if (s ==
"Most Weapons Arena")
return _(
"Most Weapons Arena");
1348 if (s ==
"Most Available Weapons Arena")
return _(
"Most Available Weapons Arena");
1349 if (s ==
"Dev All Weapons Arena")
return s;
1350 if (s ==
"Dev All Available Weapons Arena")
return s;
1351 if (s ==
"No Weapons Arena")
return _(
"No Weapons Arena");
1354 string wpn_list =
"";
1355 for (
int i = 0; i < n; ++i)
1358 if (wep == WEP_Null)
1359 LOG_INFO(
"^3Warning: ^7server sent an invalid weapon name\n");
1363 return sprintf(_(
"%s Arena"), wpn_list);
1365 return _(
"No Weapons Arena");
1370 string xonotic_hostversion =
strcat(
"Xonotic ", hostversion);
1371 if (version_mismatch)
1374 return strcat(sprintf(_(
"This is %s"), xonotic_hostversion),
"\n^3",
1375 _(
"Your client version is outdated."),
"\n\n\n",
1376 _(
"### YOU WON'T BE ABLE TO PLAY ON THIS SERVER ###"),
"\n\n\n",
1377 _(
"Please update!"));
1379 return strcat(sprintf(_(
"This is %s"), xonotic_hostversion),
"\n^3",
1380 _(
"This server is using an outdated Xonotic version."),
"\n\n\n",
1381 _(
"### THIS SERVER IS INCOMPATIBLE AND THUS YOU CANNOT JOIN ###"));
1383 return sprintf(_(
"Welcome to %s"), xonotic_hostversion);
1400 sprintf(
CCR(
" ^BG%s\n\n"),
"_LEVEL_DESC"),
1401 sprintf(
CCR(_(
"^BGPress ^F2%s^BG to enter the game")), key));
1405 localcmd(
"\nmenu_cmd directmenu Welcome ", welcomedialog_args,
"\n");
1411 bool version_mismatch =
flags & 2;
1412 bool version_check =
flags & 4;
1432 msg =
strcat(msg,
"\n", _(
"This match supports"),
" ^5");
1443 modifications =
cons_mid(modifications,
", ", weaponarena_list);
1444 if(modifications !=
"")
1445 msg =
strcat(msg,
"\n", _(
"Active modifications:"),
" ^3", modifications,
"\n");
1449 string mutator_msg =
"";
1451 mutator_msg =
M_ARGV(0,
string);
1452 msg =
strcat(msg, mutator_msg);
1455 msg =
strcat(msg,
"\n^9↓ ", _(
"Server's message"),
" ↓\n", motd);
1470 if (
cvar(
"_menu_welcome_dialog_available"))
1472 string welcomedialog_args =
strcat(
"HOSTNAME \"",
hostname,
"\"");
1474 welcomedialog_args =
strcat(welcomedialog_args,
" WELCOME \"", msg,
"\"");
1478 if (
cvar(
"_menu_cmd_closemenu_available"))
1481 localcmd(
"\nmenu_cmd closemenu Welcome ", welcomedialog_args,
"\n");
1488 localcmd(
"\nmenu_cmd directmenu Welcome ", welcomedialog_args,
"\n");
1494 localcmd(
"\nmenu_cmd directmenu Welcome ", welcomedialog_args,
"\n");
1513 int n, j, found = 0;
1518 const bool joy_active =
cvar(
"joy_active");
1519 n =
tokenize(findkeysforcommand(command, 0));
1520 for (j = 0; j < n; ++j)
1539 if (keys ==
"NO_KEY")
1542 return sprintf(_(
"%s (not bound)"),
cmd_name);
1547 return sprintf(
"%s (%s)",
cmd_name, keys);
1554 TC(
int,
id);
TC(
int, status);
1570 LOG_INFOF(
"Received HTTP request data for an invalid id %d.",
id);
#define MUTATOR_CALLHOOK(id,...)
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
void centerprint_AddStandard(string strMessage)
void CheckEngineExtensions(void)
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void ConsoleCommand_macro_init()
void deactivate_minigame()
void HUD_MinigameMenu_Close(entity this, entity actor, entity trigger)
float HUD_Minigame_InputEvent(float bInputType, float nPrimary, float nSecondary)
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
string m_name
M: wepname : human readable name.
#define draw_endBoldFont()
float HUD_Panel_Chat_InputEvent(float bInputType, float nPrimary, float nSecondary)
string _getcommandkey(string cmd_name, string command, bool forcename)
void CSQC_Parse_CenterPrint(string strMessage)
void Ent_Remove(entity this)
void RemovePlayer(entity player)
string GetVersionMessage(string hostversion, bool version_mismatch, bool version_check)
void Welcome_Message_Show_Try()
string GetSpeedUnit(int speed_unit)
void Release_Common_Keys()
void Ent_RemovePlayerScore(entity this)
bool net_handle_ServerWelcome()
float RegisterTeam(entity Team)
void Playerchecker_Think(entity this)
bool CSQC_Parse_TempEntity()
string translate_modifications(string s)
void CSQC_Parse_Print(string strMessage)
string translate_weaponarena(string s)
entity GetTeam(int Team, bool add)
void MoveToLast(entity e)
bool SetTeam(entity o, int Team)
void URI_Get_Callback(int id, int status, string data)
engine callback
void CSQC_Parse_StuffCmd(string strMessage)
float RegisterPlayer(entity player)
void RemoveTeam(entity Team)
float GetSpeedUnitFactor(int speed_unit)
float spectatee_status_changed_time
bool autocvar_developer_csqcentities
bool autocvar_cl_db_saveasdump
float grecordtime[RANKINGS_CNT]
bool autocvar_cl_race_cptimes_onlyself
bool autocvar_menu_gamemenu
int spectatorlist[MAX_SPECTATORS]
string gametype_custom_name
#define getcommandkey(cmd_name, command)
float chase_active_backup
float welcome_msg_menu_check_maxtime
bool autocvar_hud_showbinds
int spectatee_status
the -1 disables HUD panels before CSQC receives necessary data
string grecordholder[RANKINGS_CNT]
vector hook_shotorigin[4]
float RANKINGS_DISPLAY_CNT
float damagepush_speedfactor
bool autocvar_hud_showbinds_limit
bool spectatorbutton_zoom
bool ignore_list_apply_time
bool ready_waiting_for_me
float MapVote_InputEvent(int bInputType, float nPrimary, float nSecondary)
#define scores_label(this)
#define teamscores_flags(i)
#define teamscores_label(i)
#define scores_flags(this)
void get_mi_min_max_texcoords(float mode)
string translate_key(string key)
float cvar_settemp(string tmp_cvar, string tmp_value)
vector decompressShotOrigin(int f)
float CVAR_TYPEFLAG_EXISTS
float autocvar_cl_jetpack_attenuation
ERASEABLE string MakeConsoleSafe(string input)
escape the string to make it safe for consoles
#define tokenizebyseparator
string entcs_GetName(int i)
int entcs_GetScoreTeam(int i)
Same as entcs_GetTeam, but returns -1 for no team in teamplay.
void Curl_URI_Get_Callback(int id, float status, string data)
bool autocvar_hud_panel_healtharmor_progressbar_gfx
void LoadMenuSkinValues()
float HUD_Radar_InputEvent(float bInputType, float nPrimary, float nSecondary)
float hud_dynamic_shake_factor
void HUD_ModIcons_SetFunc()
float complain_weapon_time
int weapon_accuracy[REGISTRY_MAX(Weapons)]
float HUD_Panel_InputEvent(float bInputType, float nPrimary, float nSecondary)
#define FOREACH_WORD(words, cond, body)
#define FOREACH(list, cond, body)
#define NET_HANDLE(id, param)
#define serialize(T, stream,...)
#define ReadRegistered(r)
const int REPLICATEVARS_DESTROY
#define assert_once(expr,...)
ERASEABLE void db_close(int db)
ERASEABLE int db_load(string filename)
ERASEABLE int db_create()
ERASEABLE void db_save(int db, string filename)
ERASEABLE string db_get(int db, string key)
ERASEABLE void db_put(int db, string key, string value)
ERASEABLE void db_dump(int db, string filename)
string MapInfo_Type_ToString(Gametype t)
string MapInfo_Type_ToText(Gametype t)
float _MapInfo_GetTeamPlayBool(Gametype t)
string MapInfo_Map_author
string MapInfo_Map_titlestring
const int RACE_NET_CHECKPOINT_HIT_QUALIFYING
const int RACE_NET_SERVER_RECORD
const int RACE_NET_CHECKPOINT_HIT_RACE_BY_OPPONENT
const int RACE_NET_SPEED_AWARD
const int RACE_NET_CHECKPOINT_HIT_RACE
const int RACE_NET_PENALTY_RACE
const int RACE_NET_SERVER_STATUS
const int RACE_NET_PENALTY_QUALIFYING
const int RACE_NET_SPEED_AWARD_BEST
const int RACE_NET_CHECKPOINT_NEXT_QUALIFYING
const int RACE_NET_RANKINGS_CNT
const int RACE_NET_CHECKPOINT_NEXT_SPEC_QUALIFYING
const int RACE_NET_CHECKPOINT_CLEAR
const int RACE_NET_SERVER_RANKINGS
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
void Local_Notification(MSG net_type, Notification net_name,...count)
void ReplicateVars(bool would_destroy)
#define make_pure(e)
direct use is
void clearentity(entity e)
#define new_pure(class)
purely logical entities (not linked to the area grid)
string sourceLoc
Location entity was spawned from in source.
float race_othercheckpointtime
string race_othercheckpointenemy
float race_nextcheckpoint
float race_othercheckpoint
float race_penaltyaccumulator
float race_speedaward_alltimebest
float race_mycheckpointlapsdelta
string race_penaltyreason
string race_speedaward_holder
string race_speedaward_alltimebest_holder
bool scoreboard_showscores_force
string race_mycheckpointenemy
float race_othercheckpointdelta
float race_previousbesttime
float race_mypreviousbesttime
float race_checkpointtime
float race_mycheckpointtime
float race_othercheckpointlapsdelta
float race_penaltyeventtime
float race_mycheckpointdelta
string race_previousbestname
void psrandom(float seed)
#define REGISTRY_GET(id, i)
void Scoreboard_UpdatePlayerPos(entity player)
void Scoreboard_InitScores()
float HUD_Scoreboard_InputEvent(float bInputType, float nPrimary, float nSecondary)
void Scoreboard_UI_Enable(int mode)
void Scoreboard_UpdateTeamPos(entity Team)
ERASEABLE entity Sort_Spawn()
#define SORT_SWAP(a, b)
Swap two neighbours in a sortlist.
#define sound(e, c, s, v, a)
#define static_init_late()
#define static_init_precache()
void ONREMOVE(entity this)
ERASEABLE string ColorTranslateRGB(string s)
string CCR(string input)
color code replace, place inside of sprintf and parse the string
ERASEABLE string cons_mid(string a, string mid, string b)
#define startsWith(haystack, needle)
ERASEABLE float url_URI_Get_Callback(int id, float status, string data)
const int URI_GET_DISCARD
const int URI_GET_CURL_END
bool View_InputEvent(int bInputType, float nPrimary, float nSecondary)
bool autocvar_cl_orthoview
bool autocvar_cl_orthoview_nofog
int autocvar_chase_active
bool autocvar_r_drawviewmodel
bool autocvar_cl_lockview
Weapon Weapon_from_name(string s)