Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
utils.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CENTER_OR_VIEWOFS(ent)
#define FOREACH_CLIENT(cond, body)
#define FOREACH_CLIENT_RANDOM(cond, body)
#define FOREACH_CLIENTSLOT(cond, body)
#define IS_BOT_CLIENT(v)
 want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
#define IS_CLIENT(v)
#define IS_DEAD(s)
#define IS_FAKE_CLIENT(v)
#define IS_INVISIBLE(v)
#define IS_MONSTER(v)
#define IS_MOVABLE(v)
#define IS_NOT_A_CLIENT(v)
 was: (clienttype(v) == CLIENTTYPE_NOTACLIENT)
#define IS_OBSERVER(v)
#define IS_PLAYER(v)
#define IS_REAL_CLIENT(v)
#define IS_SPEC(v)
#define IS_TURRET(v)
#define IS_VEHICLE(v)

Variables

entity _FCR_clients [255]
bool _FCR_entered = false
int maxclients
const string STR_OBSERVER = "observer"
const string STR_PLAYER = "player"
const string STR_SPECTATOR = "spectator"

Macro Definition Documentation

◆ CENTER_OR_VIEWOFS

#define CENTER_OR_VIEWOFS ( ent)

◆ FOREACH_CLIENT

#define FOREACH_CLIENT ( cond,
body )
Value:
FOREACH_CLIENTSLOT(IS_CLIENT(it) && (cond), LAMBDA(body))
#define IS_CLIENT(s)
Definition player.qh:242
#define LAMBDA(...)
Definition misc.qh:34
#define FOREACH_CLIENTSLOT(cond, body)
Definition utils.qh:40

Definition at line 50 of file utils.qh.

Referenced by _GlobalSound(), accuracy_add(), AddWinners(), anticheat_endframe(), antilag_restore_all(), antilag_takeback_all(), assault_objective_decrease_use(), autoskill(), bot_cmd_barrier(), bot_fixcount(), bot_relinkplayerlist(), bot_removefromlargestteam(), bot_removenewest(), bot_resetqueues(), bot_serverframe(), bot_setnameandstuff(), botframe_autowaypoints(), botframe_showwaypointlinks(), CA_CheckWinner(), CA_count_alive_players(), ca_LastPlayerForTeam(), CA_PreventStalemate(), CA_RoundStart(), calculate_player_respawn_time(), CampaignPreIntermission(), CheatImpulse(), CheckRules_World(), ClearWinners(), ClientData_Touch(), ClientDisconnect(), CommonCommand_who(), CountSpectators(), ctf_CaptureShield_CheckStatus(), ctf_CheckStalemate(), ctf_Handle_Pickup(), ctf_Handle_Retrieve(), ctf_Immediate_Return_Allowed(), Domination_RoundStart(), dompoint_captured(), DumpStats(), DynamicHandicap_UpdateHandicap(), EndFrame(), entcs_attach(), entcs_update_players(), find_bot_by_name(), FireRailgunBullet(), freezetag_CheckWinner(), freezetag_count_alive_players(), freezetag_Freeze(), freezetag_LastPlayerForTeam(), freezetag_Unfreeze(), GameCommand_allspec(), GameCommand_bot_cmd(), GameCommand_defer_clear_all(), GameCommand_lockteams(), GetFilteredEntity(), GetIndexedEntity(), havocbot_ctf_reset_role(), havocbot_ctf_teamcount(), havocbot_goalrating_enemyplayers(), havocbot_goalrating_ft_freeplayers(), havocbot_goalrating_item_pickable_check_players(), havocbot_goalrating_ons_controlpoints_attack(), havocbot_role_ctf_defense(), havocbot_role_ft_offense(), ignore_clearall(), ignore_list_update_on_connection(), Invasion_CheckWinner(), Invasion_RoundStart(), Item_ItemsTime_SetTimesForAllPlayers(), Item_NotifyWeapon(), Item_RespawnCountdown(), Join(), kh_GetMissingTeams(), kh_Key_Think(), kh_LoserTeam(), kh_StartRound(), kh_update_state(), lms_RemovePlayer(), lms_UpdateLeaders(), MapVote_CheckRules_count(), MapVote_ClearAllVotes(), MapVote_Finished(), MapVote_Tick(), MatchEnd_RestoreSpectatorAndTeamStatus(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), NextLevel(), nJoinAllowed(), ons_camSetup(), ons_ControlPoint_Icon_Damage(), ons_ControlPoint_Icon_Think(), ons_GeneratorDamage(), ons_GeneratorThink(), Onslaught_CheckWinner(), Onslaught_RoundStart(), Pause_TryPause(), play2team(), PlayerScore_Sort(), PlayerState_detach(), PlayerStats_GameReport(), PlayerStats_GameReport_Reset_All(), PlayerStats_GetGametype(), PlayerStats_PlayerBasic(), Portal_Think(), PrintToChatTeam(), QueuedPlayersReady(), QueueNeeded(), queuePlayer(), race_ClearRecords(), race_SendTime(), race_StartCompleting(), ReadyCount(), ReadyRestart_force(), RedirectionThink(), REGISTER_MUTATOR(), reset_map(), round_handler_Think(), sandbox_ObjectFunction_Think(), sandbox_ObjectRemove(), Say(), Score_NicePrint(), Send_Effect_Except(), Send_Notification(), Set_NextMap(), SetWinners(), shuffleteams(), Spawn_Score(), SpawnCasing(), StartFrame(), Surv_CheckPlayers(), Surv_CheckWinner(), surv_LastPlayerForTeam(), Surv_RoundStart(), Surv_UpdateScores(), sv_notice_toall(), target_changelevel_use(), target_invasion_roundend_use(), target_music_use(), target_print_use(), TeamBalance_GetPlayerForTeamSwitch(), TeamBalance_GetTeamCounts(), TeamBalance_RemoveExcessPlayers(), timeout_handler_think(), vehicles_enter(), vehicles_spawn(), viewloc_think(), Violence_GibSplash_At(), visible_to_some_client(), VoteCommand_call(), VoteCount(), VoteReset(), W_MuzzleFlash(), W_Tuba_NoteThink(), WarpZone_StartFrame(), weapon_thinkf(), WinningCondition_Invasion(), WinningCondition_LMS(), WinningCondition_Race(), WinningCondition_RanOutOfSpawns(), WinningConditionHelper(), and WriteSpectators().

◆ FOREACH_CLIENT_RANDOM

#define FOREACH_CLIENT_RANDOM ( cond,
body )
Value:
MACRO_BEGIN \
if (_FCR_entered) LOG_FATAL("FOREACH_CLIENT_RANDOM must not be nested"); \
_FCR_entered = true; \
int _cnt = 0; \
FOREACH_CLIENT(cond, { \
int _j = floor(random() * (_cnt + 1)); \
if (_j != _cnt) \
_FCR_clients[_cnt] = _FCR_clients[_j]; \
_FCR_clients[_j] = it; \
++_cnt; \
}); \
for (int _i = 0; _i < _cnt; ++_i) \
{ \
const noref int i = _i; \
ITER_CONST noref entity it = _FCR_clients[i]; \
if (cond) { LAMBDA(body) } \
} \
_FCR_entered = false; \
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define ITER_CONST
Definition iter.qh:4
#define LOG_FATAL(...)
Definition log.qh:53
#define MACRO_END
Definition macro.qh:7
float random(void)
float floor(float f)
bool _FCR_entered
Definition utils.qh:55
entity _FCR_clients[255]
Definition utils.qh:54

Definition at line 56 of file utils.qh.

56#define FOREACH_CLIENT_RANDOM(cond, body) \
57 MACRO_BEGIN \
58 if (_FCR_entered) LOG_FATAL("FOREACH_CLIENT_RANDOM must not be nested"); \
59 _FCR_entered = true; \
60 int _cnt = 0; \
61 FOREACH_CLIENT(cond, { \
62 int _j = floor(random() * (_cnt + 1)); \
63 if (_j != _cnt) \
64 _FCR_clients[_cnt] = _FCR_clients[_j]; \
65 _FCR_clients[_j] = it; \
66 ++_cnt; \
67 }); \
68 for (int _i = 0; _i < _cnt; ++_i) \
69 { \
70 const noref int i = _i; \
71 ITER_CONST noref entity it = _FCR_clients[i]; \
72 if (cond) { LAMBDA(body) } \
73 } \
74 _FCR_entered = false; \
75 MACRO_END

Referenced by MUTATOR_HOOKFUNCTION(), shuffleteams(), and Surv_RoundStart().

◆ FOREACH_CLIENTSLOT

#define FOREACH_CLIENTSLOT ( cond,
body )
Value:
MACRO_BEGIN \
for(int _i = 1; _i <= maxclients; ++_i) \
{ \
const noref int i = _i; \
ITER_CONST noref entity it = ftoe(i); \
if(cond) { LAMBDA(body) } \
} \
float maxclients
#define ftoe(i)
Definition misc.qh:26

Definition at line 40 of file utils.qh.

40#define FOREACH_CLIENTSLOT(cond, body) \
41 MACRO_BEGIN \
42 for(int _i = 1; _i <= maxclients; ++_i) \
43 { \
44 const noref int i = _i; \
45 ITER_CONST noref entity it = ftoe(i); \
46 if(cond) { LAMBDA(body) } \
47 } \
48 MACRO_END

Referenced by Ban_Enforce(), and Score_ClearAll().

◆ IS_BOT_CLIENT

◆ IS_CLIENT

#define IS_CLIENT ( v)
Value:
(v.flags & FL_CLIENT)
const int FL_CLIENT
Definition constants.qh:72

Definition at line 13 of file utils.qh.

◆ IS_DEAD

#define IS_DEAD ( s)
Value:
((s).deadflag != DEAD_NO)
float DEAD_NO
Definition progsdefs.qc:274

Definition at line 26 of file utils.qh.

◆ IS_FAKE_CLIENT

#define IS_FAKE_CLIENT ( v)
Value:
(clienttype(v) == CLIENTTYPE_NOTACLIENT)
float CLIENTTYPE_NOTACLIENT

Definition at line 16 of file utils.qh.

Referenced by StartFrame().

◆ IS_INVISIBLE

#define IS_INVISIBLE ( v)
Value:
(v.alpha <= 0.25 || StatusEffects_active(STATUSEFFECT_Invisibility, v) || MUTATOR_IS_ENABLED(cloaked))
#define MUTATOR_IS_ENABLED(this)
Definition base.qh:193
bool StatusEffects_active(StatusEffect this, entity actor)

Definition at line 27 of file utils.qh.

Referenced by ctf_Stalemate_Customize(), ka_ballcarrier_waypointsprite_visible_for_player(), kh_KeyCarrier_waypointsprite_visible_for_player(), and tka_ballcarrier_waypointsprite_visible_for_player().

◆ IS_MONSTER

◆ IS_MOVABLE

#define IS_MOVABLE ( v)
Value:
((IS_PLAYER(v) || IS_MONSTER(v)) && !STAT(FROZEN, v) && !StatusEffects_active(STATUSEFFECT_Frozen, v))
#define STAT(...)
Definition stats.qh:82
#define IS_MONSTER(v)
Definition utils.qh:21

Definition at line 25 of file utils.qh.

Referenced by navigation_goalrating_timeout_can_be_anticipated(), navigation_goalrating_timeout_set(), navigation_routetogoal(), and navigation_shortenpath().

◆ IS_NOT_A_CLIENT

#define IS_NOT_A_CLIENT ( v)
Value:
(!IS_CLIENT(v))

was: (clienttype(v) == CLIENTTYPE_NOTACLIENT)

Definition at line 19 of file utils.qh.

◆ IS_OBSERVER

◆ IS_PLAYER

#define IS_PLAYER ( v)
Value:
((v).classname == STR_PLAYER)
const string STR_PLAYER
Definition utils.qh:5

Definition at line 9 of file utils.qh.

◆ IS_REAL_CLIENT

#define IS_REAL_CLIENT ( v)
Value:
(clienttype(v) == CLIENTTYPE_REAL)
float CLIENTTYPE_REAL

Definition at line 17 of file utils.qh.

Referenced by _GlobalSound(), antilag_getlag(), autoskill(), Ban_Enforce(), bot_fixcount(), bot_serverframe(), botframe_autowaypoints(), bumblebee_gunner_enter(), bumblebee_gunner_exit(), CA_count_alive_players(), CampaignPreIntermission(), client_hasweapon(), ClientCommand_ignore(), ClientCommand_tell(), ClientCommand_unignore(), ClientConnect(), ClientData_Touch(), ClientDisconnect(), ClientKill_TeamChange(), CountSpectators(), CSQCVehicleSetup(), ctf_CaptureShield_Touch(), ctf_CheckStalemate(), ctf_FlagcarrierWaypoints(), ctf_Handle_Retrieve(), dompoint_captured(), DumpStats(), EndFrame(), entcs_attach(), FireRailgunBullet(), FixIntermissionClient(), freezetag_count_alive_players(), func_breakable_init_for_player(), func_rotating_init_for_player(), func_vectormamamam_init_for_player(), GameCommand_allspec(), globalsound(), havocbot_goalrating_item_pickable_check_players(), ignore_clearall(), ignore_list_update_on_connection(), IntermissionThink(), IT_Write(), Item_ItemsTime_SetTimesForAllPlayers(), Item_NotifyWeapon(), Item_RespawnCountdown(), join_minigame(), jumppad_push(), KillIndicator_Think(), MapVote_CheckRules_count(), MapVote_Finished(), MapVote_Tick(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), MUTATOR_HOOKFUNCTION(), nade_darkness_think(), nade_entrap_touch(), nade_touch(), nade_veil_touch(), nades_GiveBonus(), Notification_ShouldSend(), ons_CaptureShield_Touch(), ons_GeneratorDamage(), ons_GeneratorThink(), OriginalCallerName(), Pause_TryPause(), Physics_ClientOption(), PingPLReport_Think(), play2team(), play_countdown(), Player_DetermineForcedTeam(), PlayerDamage(), PlayerFrame(), PlayerInIPList(), PlayerPreThink(), playersound(), PlayerStats_GameReport_FinalizePlayer(), PlayerStats_PlayerBasic(), PrintToChatTeam(), PutClientInServer(), PutObserverInServer(), QueuedPlayersReady(), QueueNeeded(), race_ClearTime(), race_ImposePenaltyTime(), race_SendAll(), race_SendNextCheckpoint(), race_SendStatus(), race_SendTime(), ReadyCount(), ReadyRestart_force(), RedirectionThink(), sandbox_ObjectFunction_Think(), sandbox_ObjectRemove(), Say(), Send_Effect_Except(), Send_Notification(), Set_NextMap(), SetSpectatee_status(), sound_allowed(), Spawn_Score(), start_minigame(), StartFrame(), SUB_UseTargets_Ex(), sv_notice_toall(), SV_PlayerPhysics(), target_changelevel_use(), target_invasion_roundend_use(), target_music_use(), target_print_use(), target_speaker_use_activator(), TeamBalance_CompareTeamsInternal(), TeamBalance_RemoveExcessPlayers(), timeout_handler_think(), tracebox_antilag_force_wz(), UpdateAuxiliaryXhair(), vehicles_enter(), vehicles_exit(), VerifyClientEntity(), VerifyKickableEntity(), Violence_GibSplash_At(), visible_to_some_client(), VoteCommand_call(), VoteCount(), W_HitPlotAnalysis(), W_Reload(), W_Tuba_NoteThink(), WarpZone_PlayerPhysics_FixVAngle(), wframe_send(), WinningCondition_LMS(), WinningConditionHelper(), and WriteSpectators().

◆ IS_SPEC

◆ IS_TURRET

#define IS_TURRET ( v)
Value:
(v.turret_flags & TUR_FLAG_ISTURRET)
const int TUR_FLAG_ISTURRET
Definition turret.qh:152

Definition at line 23 of file utils.qh.

Referenced by Damage(), MUTATOR_HOOKFUNCTION(), Teleport_Active(), and vehicles_locktarget().

◆ IS_VEHICLE

Variable Documentation

◆ _FCR_clients

entity _FCR_clients[255]

Definition at line 54 of file utils.qh.

◆ _FCR_entered

bool _FCR_entered = false

Definition at line 55 of file utils.qh.

◆ maxclients

int maxclients

Definition at line 3 of file utils.qh.

◆ STR_OBSERVER

const string STR_OBSERVER = "observer"

Definition at line 7 of file utils.qh.

Referenced by Observer::Observer(), and dropclient_schedule().

◆ STR_PLAYER

const string STR_PLAYER = "player"

◆ STR_SPECTATOR

const string STR_SPECTATOR = "spectator"

Definition at line 6 of file utils.qh.

Referenced by Spectator::Spectator().