#include <common/mutators/base.qh>
#include <server/elimination.qh>
#include <server/round_handler.qh>
-#include <server/miscfunctions.qh>
#include <server/command/sv_cmd.qh>
int autocvar_g_ca_point_limit;
#include "cl_ctf.qh"
+#include <common/mutators/base.qh>
#include <client/hud/panel/modicons.qh>
// CTF HUD modicon section
#include "ctf.qh"
+#include <common/items/item/pickup.qh>
+#include <common/mutators/base.qh>
#include <common/gamemodes/sv_rules.qh>
void ctf_Initialize();
#include "cl_cts.qh"
+#include <common/mutators/base.qh>
+
REGISTER_MUTATOR(cl_cts, true);
MUTATOR_HOOKFUNCTION(cl_cts, HUD_Physics_showoptional)
#include "cl_lms.qh"
+#include <common/mutators/base.qh>
+
REGISTER_MUTATOR(cl_lms, true);
MUTATOR_HOOKFUNCTION(cl_lms, DrawInfoMessages)
#include "cl_nexball.qh"
#include <client/hud/panel/modicons.qh>
+#include <common/mutators/base.qh>
// Nexball HUD mod icon
void HUD_Mod_NexBall(vector pos, vector mySize)
#include <server/world.qh>
#include <common/ent_cs.qh>
#include <common/mapobjects/triggers.qh>
+#include <common/mutators/base.qh>
.entity ballcarried;
#include "onslaught.qh"
+#include <common/mutators/base.qh>
+
#ifdef GAMEQC
REGISTER_NET_LINKED(ENT_ONSCAMERA)
#endif
#pragma once
+#include <common/mutators/base.qh>
+
float autocvar_g_onslaught_point_limit;
void ons_Initialize();
#include "cl_race.qh"
+#include <common/mutators/base.qh>
+
// Race/CTS HUD mod icons
float crecordtime_prev; // last remembered crecordtime
float crecordtime_change_time; // time when crecordtime last changed
}
}
+void tdm_Initialize()
+{
+ GameRules_teams(true);
+ GameRules_spawning_teams(autocvar_g_tdm_team_spawns);
+ GameRules_limit_score(autocvar_g_tdm_point_limit);
+ GameRules_limit_lead(autocvar_g_tdm_point_leadlimit);
+
+ InitializeEntity(NULL, tdm_DelayedInit, INITPRIO_GAMETYPE);
+}
+
MUTATOR_HOOKFUNCTION(tdm, TeamBalance_CheckAllowedTeams, CBC_ORDER_EXCLUSIVE)
{
M_ARGV(1, string) = "tdm_team";
int autocvar_g_tdm_point_limit;
int autocvar_g_tdm_point_leadlimit;
bool autocvar_g_tdm_team_spawns;
-void tdm_DelayedInit(entity this);
+void tdm_Initialize();
REGISTER_MUTATOR(tdm, false)
{
MUTATOR_STATIC();
MUTATOR_ONADD
{
- GameRules_teams(true);
- GameRules_spawning_teams(autocvar_g_tdm_team_spawns);
- GameRules_limit_score(autocvar_g_tdm_point_limit);
- GameRules_limit_lead(autocvar_g_tdm_point_leadlimit);
-
- InitializeEntity(NULL, tdm_DelayedInit, INITPRIO_GAMETYPE);
+ tdm_Initialize();
}
return 0;
}
#ifdef SVQC
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
const float LOOP = 1;
#ifdef SVQC
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include <common/net_linked.qh>
#include "subs.qh"
#include "triggers.qh"
#include "spider.qh"
+#if defined(SVQC)
+ #include <common/mutators/base.qh>
+#endif
+
#ifdef SVQC
.float spider_slowness; // effect time of slowness inflicted by spiders
#include "sv_nix.qh"
#include <server/weapons/selection.qh>
+#include <server/world.qh>
//string autocvar_g_nix;
int autocvar_g_balance_nix_ammo_cells;
#ifdef SVQC
#include <server/client.qh>
-#include <server/miscfunctions.qh>
#include <common/mapobjects/defs.qh>
#include "../mapobjects/trigger/viewloc.qh"
#include <server/main.qh>
#pragma once
-#include <server/miscfunctions.qh>
+#include "all.qh"
entity turret_projectile(entity actor, Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
void turret_projectile_explode(entity this);
else
return thename;
}
+
+float trace_hits_box_a0, trace_hits_box_a1;
+
+float trace_hits_box_1d(float end, float thmi, float thma)
+{
+ if (end == 0)
+ {
+ // just check if x is in range
+ if (0 < thmi)
+ return false;
+ if (0 > thma)
+ return false;
+ }
+ else
+ {
+ // do the trace with respect to x
+ // 0 -> end has to stay in thmi -> thma
+ trace_hits_box_a0 = max(trace_hits_box_a0, min(thmi / end, thma / end));
+ trace_hits_box_a1 = min(trace_hits_box_a1, max(thmi / end, thma / end));
+ if (trace_hits_box_a0 > trace_hits_box_a1)
+ return false;
+ }
+ return true;
+}
+
+float trace_hits_box(vector start, vector end, vector thmi, vector thma)
+{
+ end -= start;
+ thmi -= start;
+ thma -= start;
+ // now it is a trace from 0 to end
+
+ trace_hits_box_a0 = 0;
+ trace_hits_box_a1 = 1;
+
+ if (!trace_hits_box_1d(end.x, thmi.x, thma.x))
+ return false;
+ if (!trace_hits_box_1d(end.y, thmi.y, thma.y))
+ return false;
+ if (!trace_hits_box_1d(end.z, thmi.z, thma.z))
+ return false;
+
+ return true;
+}
+
+float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma)
+{
+ return trace_hits_box(start, end, thmi - ma, thma - mi);
+}
#endif
#ifdef GAMEQC
string playername(string thename, int teamid, bool team_colorize);
+
+float trace_hits_box_1d(float end, float thmi, float thma);
+
+float trace_hits_box(vector start, vector end, vector thmi, vector thma);
+
+float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma);
+
+float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma);
#endif
#include <server/main.qc>
#include <server/mapvoting.qc>
#include <server/matrix.qc>
-#include <server/miscfunctions.qc>
#include <server/player.qc>
#include <server/portals.qc>
#include <server/race.qc>
#include <server/main.qh>
#include <server/mapvoting.qh>
#include <server/matrix.qh>
-#include <server/miscfunctions.qh>
#include <server/player.qh>
#include <server/portals.qh>
#include <server/race.qh>
#include <server/client.qh>
#include <server/gamelog.qh>
#include <server/main.qh>
-#include "miscfunctions.qh"
#include "command/common.qh"
#include <common/playerstats.qh>
#include <common/stats.qh>
#include <server/damage.qh>
#include <server/items/items.qh>
-#include <server/miscfunctions.qh>
+#include <server/mutators/_mod.qh>
#include <server/weapons/selection.qh>
#include <server/weapons/weaponsystem.qh>
+#include <server/world.qh>
#include "../cvars.qh"
#include "../aim.qh"
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include <server/items/items.qh>
#include <server/items/spawning.qh>
+#include <server/mutators/_mod.qh>
#include <server/resources.qh>
#include "havocbot.qh"
#include <server/bot/api.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include "cvars.qh"
#include "bot.qh"
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include <server/weapons/selection.qh>
#include <server/weapons/weaponsystem.qh>
#include "cvars.qh"
#include <common/weapons/_all.qh>
#include <common/stats.qh>
#include <server/items/items.qh>
-#include <server/miscfunctions.qh>
#include <server/spawnpoints.qh>
+#include <server/weapons/tracing.qh>
#include "cvars.qh"
#include "bot.qh"
#include "campaign.qh"
+#include <common/mapinfo.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
#include "cheats.qh"
#include <server/intermission.qh>
-#include "miscfunctions.qh"
#include "world.qh"
#include "../common/campaign_common.qh"
#include <server/gamelog.qh>
#include <server/main.qh>
#include <server/mapvoting.qh>
-#include <server/miscfunctions.qh>
+#include <server/mutators/_mod.qh>
+#include <server/weapons/tracing.qh>
+#include <server/world.qh>
/**
* message "": do not say, just test flood control
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include <common/effects/all.qh>
#include <server/resources.qh>
#include <server/main.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
#include <server/chat.qh>
-#include <server/miscfunctions.qh>
#include <common/effects/all.qh>
#include "anticheat.qh"
#include "impulse.qh"
#include "player.qh"
#include "ipban.qh"
-#include "miscfunctions.qh"
#include "portals.qh"
#include "teamplay.qh"
#include "spawnpoints.qh"
#include <server/gamelog.qh>
#include "race.qh"
#include <server/main.qh>
+#include <server/mutators/_mod.qh>
#include "antilag.qh"
#include "campaign.qh"
#include "command/common.qh"
#include <common/stats.qh>
#include <server/client.qh>
#include <server/player.qh>
+#include <server/mutators/_mod.qh>
#include "damage.qh"
#include "teamplay.qh"
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include <common/state.qh>
#include <common/command/_mod.qh>
#include "banning.qh"
#include <server/chat.qh>
#include <server/world.qh>
-#include <server/miscfunctions.qh>
#include <common/command/_mod.qh>
#include <server/chat.qh>
#include <server/client.qh>
+#include <server/mutators/_mod.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
#include <server/world.qh>
-#include <server/miscfunctions.qh>
#include <common/command/_mod.qh>
#include "common.qh"
#include <common/wepent.qh>
#include <common/stats.qh>
#include <server/intermission.qh>
+#include <server/main.qh>
+#include <server/mutators/_mod.qh>
#include <server/world.qh>
-#include <server/miscfunctions.qh>
#include <common/command/_mod.qh>
#include "getreplies.qh"
-#include "../race.qh"
+#include <server/race.qh>
#include <common/constants.qh>
#include <common/gamemodes/_mod.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
#include <server/gamelog.qh>
-#include <server/miscfunctions.qh>
#include <common/command/_mod.qh>
#include "vote.qh"
#include "../damage.qh"
#include <server/intermission.qh>
-#include "../world.qh"
+#include <server/world.qh>
#include "../teamplay.qh"
#include "../race.qh"
#include "../round_handler.qh"
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include <common/weapons/_all.qh>
//***********************
#include <server/client.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include <server/items/items.qh>
#include <server/items/spawning.qh>
#include <server/resources.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include <server/items/spawning.qh>
#include <common/weapons/_all.qh>
#include <server/items/items.qh>
#include <server/mutators/_mod.qh>
#include <server/main.qh>
+#include <server/world.qh>
#include "teamplay.qh"
#include "scores.qh"
#include "spawnpoints.qh"
#include <common/weapons/_all.qh>
#include <common/stats.qh>
#include <server/items/items.qh>
- #include <server/miscfunctions.qh>
#include <lib/warpzone/common.qh>
#include <common/constants.qh>
#include <common/teams.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
#include <server/damage.qh>
-#include <server/miscfunctions.qh>
+#include <server/mutators/_mod.qh>
+#include <server/world.qh>
#include <common/effects/all.qh>
#include "weapons/common.qh"
#include "weapons/csqcprojectile.qh"
#include "client.qh"
#include "clientkill.qh"
#include "damage.qh"
+#include <server/mutators/_mod.qh>
#include "weapons/selection.qh"
#include "weapons/tracing.qh"
#include "weapons/weaponsystem.qh"
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include "autocvars.qh"
+#include <server/main.qh>
#include "command/banning.qh"
#include "../common/constants.qh"
#include "../common/util.qh"
#include "damage.qh"
#include "world.qh"
#include "spawnpoints.qh"
+#include <server/ipban.qh>
#include <server/gamelog.qh>
#include "bot/api.qh"
#include <server/compat/quake3.qh>
#include "../common/constants.qh"
+#include <common/command/generic.qh>
#include "../common/deathtypes/all.qh"
#include "../common/debug.qh"
#include "../common/mapinfo.qh"
delete(tracetest_ent);
}
+/** engine callback */
+void URI_Get_Callback(float id, float status, string data)
+{
+ if(url_URI_Get_Callback(id, status, data))
+ {
+ // handled
+ }
+ else if (id == URI_GET_DISCARD)
+ {
+ // discard
+ }
+ else if (id >= URI_GET_CURL && id <= URI_GET_CURL_END)
+ {
+ // sv_cmd curl
+ Curl_URI_Get_Callback(id, status, data);
+ }
+ else if (id >= URI_GET_IPBAN && id <= URI_GET_IPBAN_END)
+ {
+ // online ban list
+ OnlineBanList_URI_Get_Callback(id, status, data);
+ }
+ else if (MUTATOR_CALLHOOK(URI_GetCallback, id, status, data))
+ {
+ // handled by a mutator
+ }
+ else
+ {
+ LOG_INFO("Received HTTP request data for an invalid id ", ftos(id), ".");
+ }
+}
+
/*
==================
main
void remove_unsafely(entity e);
-bool expr_evaluate(string s);
+// copies a string to a tempstring (so one can strunzone it)
+string strcat1(string s) = #115; // FRIK_FILE
#ifdef PROFILING
float client_cefc_accumulator;
#include <common/stats.qh>
#include <server/gamelog.qh>
#include <server/intermission.qh>
-#include <server/miscfunctions.qh>
#include "world.qh"
#include "command/cmd.qh"
#include "command/getreplies.qh"
+++ /dev/null
-// NOTE: Please do NOT add new functions to this file! It is a dumping ground that is in the process of being cleaned up, please find a proper home for your code!
-
-#include "miscfunctions.qh"
-
-#include "antilag.qh"
-#include "command/common.qh"
-#include "client.qh"
-#include "damage.qh"
-#include "hook.qh"
-#include "world.qh"
-#include <server/gamelog.qh>
-#include "ipban.qh"
-#include <server/intermission.qh>
-#include <server/items/items.qh>
-#include <server/mutators/_mod.qh>
-#include <server/spawnpoints.qh>
-#include <server/main.qh>
-#include "mapvoting.qh"
-#include "resources.qh"
-#include <server/items/spawning.qh>
-#include "player.qh"
-#include "weapons/accuracy.qh"
-#include "weapons/common.qh"
-#include "weapons/csqcprojectile.qh"
-#include "weapons/selection.qh"
-#include "../common/command/_mod.qh"
-#include "../common/constants.qh"
-#include <common/net_linked.qh>
-#include <common/weapons/weapon/crylink.qh>
-#include "../common/deathtypes/all.qh"
-#include "../common/mapinfo.qh"
-#include "../common/notifications/all.qh"
-#include "../common/playerstats.qh"
-#include "../common/teams.qh"
-#include "../common/mapobjects/subs.qh"
-#include <common/mapobjects/trigger/hurt.qh>
-#include <common/mapobjects/target/location.qh>
-#include "../common/util.qh"
-#include "../common/turrets/sv_turrets.qh"
-#include <common/weapons/_all.qh>
-#include "../common/vehicles/sv_vehicles.qh"
-#include "../common/vehicles/vehicle.qh"
-#include "../common/items/_mod.qh"
-#include "../common/state.qh"
-#include "../common/effects/qc/globalsound.qh"
-#include "../common/wepent.qh"
-#include <common/weapons/weapon.qh>
-#include "../lib/csqcmodel/sv_model.qh"
-#include "../lib/warpzone/anglestransform.qh"
-#include "../lib/warpzone/server.qh"
-
-void crosshair_trace(entity pl)
-{
- traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
-}
-
-void crosshair_trace_plusvisibletriggers(entity pl)
-{
- crosshair_trace_plusvisibletriggers__is_wz(pl, false);
-}
-
-void WarpZone_crosshair_trace_plusvisibletriggers(entity pl)
-{
- crosshair_trace_plusvisibletriggers__is_wz(pl, true);
-}
-
-void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz)
-{
- FOREACH_ENTITY_FLOAT(solid, SOLID_TRIGGER,
- {
- if(it.model != "")
- {
- it.solid = SOLID_BSP;
- IL_PUSH(g_ctrace_changed, it);
- }
- });
-
- if (is_wz)
- WarpZone_crosshair_trace(pl);
- else
- crosshair_trace(pl);
-
- IL_EACH(g_ctrace_changed, true, { it.solid = SOLID_TRIGGER; });
-
- IL_CLEAR(g_ctrace_changed);
-}
-
-void WarpZone_crosshair_trace(entity pl)
-{
- WarpZone_traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
-}
-
-float trace_hits_box_a0, trace_hits_box_a1;
-
-float trace_hits_box_1d(float end, float thmi, float thma)
-{
- if (end == 0)
- {
- // just check if x is in range
- if (0 < thmi)
- return false;
- if (0 > thma)
- return false;
- }
- else
- {
- // do the trace with respect to x
- // 0 -> end has to stay in thmi -> thma
- trace_hits_box_a0 = max(trace_hits_box_a0, min(thmi / end, thma / end));
- trace_hits_box_a1 = min(trace_hits_box_a1, max(thmi / end, thma / end));
- if (trace_hits_box_a0 > trace_hits_box_a1)
- return false;
- }
- return true;
-}
-
-float trace_hits_box(vector start, vector end, vector thmi, vector thma)
-{
- end -= start;
- thmi -= start;
- thma -= start;
- // now it is a trace from 0 to end
-
- trace_hits_box_a0 = 0;
- trace_hits_box_a1 = 1;
-
- if (!trace_hits_box_1d(end.x, thmi.x, thma.x))
- return false;
- if (!trace_hits_box_1d(end.y, thmi.y, thma.y))
- return false;
- if (!trace_hits_box_1d(end.z, thmi.z, thma.z))
- return false;
-
- return true;
-}
-
-float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma)
-{
- return trace_hits_box(start, end, thmi - ma, thma - mi);
-}
-
-/** engine callback */
-void URI_Get_Callback(float id, float status, string data)
-{
- if(url_URI_Get_Callback(id, status, data))
- {
- // handled
- }
- else if (id == URI_GET_DISCARD)
- {
- // discard
- }
- else if (id >= URI_GET_CURL && id <= URI_GET_CURL_END)
- {
- // sv_cmd curl
- Curl_URI_Get_Callback(id, status, data);
- }
- else if (id >= URI_GET_IPBAN && id <= URI_GET_IPBAN_END)
- {
- // online ban list
- OnlineBanList_URI_Get_Callback(id, status, data);
- }
- else if (MUTATOR_CALLHOOK(URI_GetCallback, id, status, data))
- {
- // handled by a mutator
- }
- else
- {
- LOG_INFO("Received HTTP request data for an invalid id ", ftos(id), ".");
- }
-}
-
-string uid2name(string myuid)
-{
- string s = db_get(ServerProgsDB, strcat("/uid2name/", myuid));
-
- // FIXME remove this later after 0.6 release
- // convert old style broken records to correct style
- if(s == "")
- {
- s = db_get(ServerProgsDB, strcat("uid2name", myuid));
- if(s != "")
- {
- db_put(ServerProgsDB, strcat("/uid2name/", myuid), s);
- db_remove(ServerProgsDB, strcat("uid2name", myuid));
- }
- }
-
- if(s == "")
- s = "^1Unregistered Player";
- return s;
-}
-
-bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance)
-{
- float m = e.dphitcontentsmask;
- e.dphitcontentsmask = goodcontents | badcontents;
-
- vector org = boundmin;
- vector delta = boundmax - boundmin;
-
- vector start, end;
- start = end = org;
- int j; // used after the loop
- for(j = 0; j < attempts; ++j)
- {
- start.x = org.x + random() * delta.x;
- start.y = org.y + random() * delta.y;
- start.z = org.z + random() * delta.z;
-
- // rule 1: start inside world bounds, and outside
- // solid, and don't start from somewhere where you can
- // fall down to evil
- tracebox(start, e.mins, e.maxs, start - '0 0 1' * delta.z, MOVE_NORMAL, e);
- if (trace_fraction >= 1)
- continue;
- if (trace_startsolid)
- continue;
- if (trace_dphitcontents & badcontents)
- continue;
- if (trace_dphitq3surfaceflags & badsurfaceflags)
- continue;
-
- // rule 2: if we are too high, lower the point
- if (trace_fraction * delta.z > maxaboveground)
- start = trace_endpos + '0 0 1' * maxaboveground;
- vector enddown = trace_endpos;
-
- // rule 3: make sure we aren't outside the map. This only works
- // for somewhat well formed maps. A good rule of thumb is that
- // the map should have a convex outside hull.
- // these can be traceLINES as we already verified the starting box
- vector mstart = start + 0.5 * (e.mins + e.maxs);
- traceline(mstart, mstart + '1 0 0' * delta.x, MOVE_NORMAL, e);
- if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
- continue;
- traceline(mstart, mstart - '1 0 0' * delta.x, MOVE_NORMAL, e);
- if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
- continue;
- traceline(mstart, mstart + '0 1 0' * delta.y, MOVE_NORMAL, e);
- if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
- continue;
- traceline(mstart, mstart - '0 1 0' * delta.y, MOVE_NORMAL, e);
- if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
- continue;
- traceline(mstart, mstart + '0 0 1' * delta.z, MOVE_NORMAL, e);
- if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
- continue;
-
- // rule 4: we must "see" some spawnpoint or item
- entity sp = NULL;
- IL_EACH(g_spawnpoints, checkpvs(mstart, it),
- {
- if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
- {
- sp = it;
- break;
- }
- });
- if(!sp)
- {
- int items_checked = 0;
- IL_EACH(g_items, checkpvs(mstart, it),
- {
- if((traceline(mstart, it.origin + (it.mins + it.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1)
- {
- sp = it;
- break;
- }
-
- ++items_checked;
- if(items_checked >= attempts)
- break; // sanity
- });
-
- if(!sp)
- continue;
- }
-
- // find a random vector to "look at"
- end.x = org.x + random() * delta.x;
- end.y = org.y + random() * delta.y;
- end.z = org.z + random() * delta.z;
- end = start + normalize(end - start) * vlen(delta);
-
- // rule 4: start TO end must not be too short
- tracebox(start, e.mins, e.maxs, end, MOVE_NORMAL, e);
- if(trace_startsolid)
- continue;
- if(trace_fraction < minviewdistance / vlen(delta))
- continue;
-
- // rule 5: don't want to look at sky
- if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
- continue;
-
- // rule 6: we must not end up in trigger_hurt
- if(tracebox_hits_trigger_hurt(start, e.mins, e.maxs, enddown))
- continue;
-
- break;
- }
-
- e.dphitcontentsmask = m;
-
- if(j < attempts)
- {
- setorigin(e, start);
- e.angles = vectoangles(end - start);
- LOG_DEBUG("Needed ", ftos(j + 1), " attempts");
- return true;
- }
- return false;
-}
-
-float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
-{
- return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance);
-}
+++ /dev/null
-#pragma once
-
-#include <common/weapons/_all.qh>
-#include <common/stats.qh>
-#include <server/client.qh>
-#include <server/world.qh>
-
-#include <server/intermission.qh>
-#include <server/items/items.qh>
-
-#include <server/mutators/_mod.qh>
-
-#include <common/constants.qh>
-#include <common/mapinfo.qh>
-#include <common/turrets/all.qh>
-
-float trace_hits_box_1d(float end, float thmi, float thma);
-
-float trace_hits_box(vector start, vector end, vector thmi, vector thma);
-
-float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma);
-
-void crosshair_trace(entity pl);
-
-void crosshair_trace_plusvisibletriggers(entity pl);
-void WarpZone_crosshair_trace_plusvisibletriggers(entity pl);
-void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz);
-
-string uid2name(string myuid);
-
-bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance);
-
-float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance);
-
-float tracebox_hits_box(vector start, vector mi, vector ma, vector end, vector thmi, vector thma);
-
-void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
-
-void WarpZone_crosshair_trace(entity pl);
-
-void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
-
-#define PROJECTILE_TOUCH(e,t) MACRO_BEGIN if (WarpZone_Projectile_Touch(e,t)) return; MACRO_END
-
-// copies a string to a tempstring (so one can strunzone it)
-string strcat1(string s) = #115; // FRIK_FILE
-
-IntrusiveList g_ctrace_changed;
-STATIC_INIT(g_ctrace_changed) { g_ctrace_changed = IL_NEW(); }
#include "loader.qh"
+#include <common/mutators/base.qh>
+#include <common/mapinfo.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
STATIC_INIT_LATE(Gametype) {
Gametype g = MapInfo_CurrentGametype();
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include "pathlib.qh"
#include "utility.qh"
#include <common/turrets/util.qh>
#include <common/mapobjects/triggers.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include "pathlib.qh"
#include "utility.qh"
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include "pathlib.qh"
bool location_isok(vector point, bool waterok, bool air_isok)
#include "client.qh"
#include "clientkill.qh"
#include "damage.qh"
+#include <server/mutators/_mod.qh>
#include "world.qh"
#include "handicap.qh"
-#include "miscfunctions.qh"
#include "portals.qh"
#include "teamplay.qh"
#include <server/main.qh>
#include <server/damage.qh>
#include <server/gamelog.qh>
#include <server/intermission.qh>
+#include <server/main.qh>
+#include <server/mutators/_mod.qh>
#include <server/world.qh>
-#include <server/miscfunctions.qh>
#include <server/weapons/common.qh>
#include "client.qh"
#include "cheats.qh"
#include <common/vehicles/sv_vehicles.qh>
#include "../common/mutators/mutator/waypoints/waypointsprites.qh"
+string uid2name(string myuid)
+{
+ string s = db_get(ServerProgsDB, strcat("/uid2name/", myuid));
+
+ // FIXME remove this later after 0.6 release
+ // convert old style broken records to correct style
+ if(s == "")
+ {
+ s = db_get(ServerProgsDB, strcat("uid2name", myuid));
+ if(s != "")
+ {
+ db_put(ServerProgsDB, strcat("/uid2name/", myuid), s);
+ db_remove(ServerProgsDB, strcat("uid2name", myuid));
+ }
+ }
+
+ if(s == "")
+ s = "^1Unregistered Player";
+ return s;
+}
+
void write_recordmarker(entity pl, float tstart, float dt)
{
GameLogEcho(strcat(":recordset:", ftos(pl.playerid), ":", ftos(dt)));
void race_InitSpectator();
+string uid2name(string myuid);
+
spawnfunc(target_checkpoint);
/// \copyright GNU GPLv2 or any later version.
#include "autocvars.qh"
-#include "miscfunctions.qh"
+#include <server/mutators/_mod.qh>
+#include <server/world.qh>
float GetResourceLimit(entity e, int res_type)
{
#include "round_handler.qh"
#include <server/world.qh>
-#include <server/miscfunctions.qh>
#include "campaign.qh"
#include "command/vote.qh"
#include <common/mapobjects/triggers.qh>
#include "client.qh"
#include <server/intermission.qh>
#include <server/world.qh>
-#include <server/miscfunctions.qh>
#include <server/mutators/_mod.qh>
#include <server/round_handler.qh>
#include <common/net_linked.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include "client.qh"
#include "scores.qh"
#include <common/gamemodes/rules.qh>
#include <server/mutators/_mod.qh>
#include <server/world.qh>
-#include "miscfunctions.qh"
#include "race.qh"
#include <common/weapons/_all.qh>
#include <common/stats.qh>
#pragma once
-#include "miscfunctions.qh"
#include "autocvars.qh"
#include "client.qh"
#include "command/_mod.qh"
#include <common/teams.qh>
#include <common/util.qh>
#include <common/weapons/_all.qh>
+#include <server/world.qh>
int accuracy_byte(float n, float d)
{
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
.bool cvar_cl_accuracy_data_share;
REPLICATE(cvar_cl_accuracy_data_share, bool, "cl_accuracy_data_share");
#include <common/stats.qh>
#include <server/damage.qh>
#include <server/items/items.qh>
-#include <server/miscfunctions.qh>
+#include <server/mutators/_mod.qh>
#include <common/constants.qh>
#include <common/net_linked.qh>
#include <common/deathtypes/all.qh>
.entity realowner;
+#define PROJECTILE_TOUCH(e,t) MACRO_BEGIN if (WarpZone_Projectile_Touch(e,t)) return; MACRO_END
+
#define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_CORPSE; (e).dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_CORPSE
// when doing this, hagar can go through clones
// #define PROJECTILE_MAKETRIGGER(e) (e).solid = SOLID_BBOX
#include <common/weapons/_all.qh>
#include <common/stats.qh>
#include <server/items/items.qh>
-#include <server/miscfunctions.qh>
#include "../command/common.qh"
#include <common/weapons/_all.qh>
#include <common/stats.qh>
#include <server/world.qh>
-#include <server/miscfunctions.qh>
#include "../antilag.qh"
#include <common/weapons/_all.qh>
#include <common/state.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
.int selectweapon; // last selected weapon of the player
#include <server/mutators/_mod.qh>
#include <server/items/items.qh>
#include <server/items/spawning.qh>
+#include <server/world.qh>
#include <common/weapons/_all.qh>
.bool m_isreplaced; ///< Holds whether the weapon has been replaced.
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
string W_Apply_Weaponreplace(string in);
#include <server/mutators/_mod.qh>
#include <server/items/items.qh>
#include "../damage.qh"
+#include <server/world.qh>
#include <common/items/item.qh>
#include <common/mapinfo.qh>
#include <common/notifications/all.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
.float savenextthink;
void thrown_wep_think(entity this);
#include "../damage.qh"
#include <server/main.qh>
-#include "../antilag.qh"
+#include <server/mutators/_mod.qh>
+#include <server/antilag.qh>
#include <common/constants.qh>
#include <common/net_linked.qh>
{
fireBullet_antilag(this, weaponentity, start, dir, spread, max_solid_penetration, damage, headshot_multiplier, force, dtype, tracer_effect, true);
}
+
+void crosshair_trace(entity pl)
+{
+ traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
+}
+
+void crosshair_trace_plusvisibletriggers(entity pl)
+{
+ crosshair_trace_plusvisibletriggers__is_wz(pl, false);
+}
+
+void WarpZone_crosshair_trace_plusvisibletriggers(entity pl)
+{
+ crosshair_trace_plusvisibletriggers__is_wz(pl, true);
+}
+
+void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz)
+{
+ FOREACH_ENTITY_FLOAT(solid, SOLID_TRIGGER,
+ {
+ if(it.model != "")
+ {
+ it.solid = SOLID_BSP;
+ IL_PUSH(g_ctrace_changed, it);
+ }
+ });
+
+ if (is_wz)
+ WarpZone_crosshair_trace(pl);
+ else
+ crosshair_trace(pl);
+
+ IL_EACH(g_ctrace_changed, true, { it.solid = SOLID_TRIGGER; });
+
+ IL_CLEAR(g_ctrace_changed);
+}
+
+void WarpZone_crosshair_trace(entity pl)
+{
+ WarpZone_traceline_antilag(pl, CS(pl).cursor_trace_start, CS(pl).cursor_trace_start + normalize(CS(pl).cursor_trace_endpos - CS(pl).cursor_trace_start) * max_shot_distance, MOVE_NORMAL, pl, ANTILAG_LATENCY(pl));
+}
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
vector w_shotorg;
vector w_shotdir;
void fireBullet_trace_callback(vector start, vector hit, vector end);
void fireBullet_antilag(entity this, .entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float headshot_multiplier, float force, float dtype, entity tracer_effect, bool do_antilag);
void fireBullet(entity this, .entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float headshot_multiplier, float force, float dtype, entity tracer_effect);
+
+void crosshair_trace(entity pl);
+
+void crosshair_trace_plusvisibletriggers(entity pl);
+void WarpZone_crosshair_trace_plusvisibletriggers(entity pl);
+void crosshair_trace_plusvisibletriggers__is_wz(entity pl, bool is_wz);
+
+void traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
+
+void WarpZone_crosshair_trace(entity pl);
+
+void WarpZone_traceline_antilag (entity source, vector v1, vector v2, float nomonst, entity forent, float lag);
+
+IntrusiveList g_ctrace_changed;
+STATIC_INIT(g_ctrace_changed) { g_ctrace_changed = IL_NEW(); }
#include <server/intermission.qh>
#include <common/weapons/_all.qh>
#include <common/stats.qh>
-#include <server/miscfunctions.qh>
#include "../world.qh"
#include <common/weapons/_all.qh>
#pragma once
-#include <server/miscfunctions.qh>
+#include <common/weapons/all.qh>
#define INDEPENDENT_ATTACK_FINISHED 1
#include "../common/stats.qh"
#include "../common/teams.qh"
#include <common/mapobjects/triggers.qh>
+#include <common/mapobjects/trigger/hurt.qh>
#include "../common/mapobjects/trigger/secret.qh"
#include "../common/mapobjects/target/music.qh"
#include "../common/util.qh"
delete(this);
}
+bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance)
+{
+ float m = e.dphitcontentsmask;
+ e.dphitcontentsmask = goodcontents | badcontents;
+
+ vector org = boundmin;
+ vector delta = boundmax - boundmin;
+
+ vector start, end;
+ start = end = org;
+ int j; // used after the loop
+ for(j = 0; j < attempts; ++j)
+ {
+ start.x = org.x + random() * delta.x;
+ start.y = org.y + random() * delta.y;
+ start.z = org.z + random() * delta.z;
+
+ // rule 1: start inside world bounds, and outside
+ // solid, and don't start from somewhere where you can
+ // fall down to evil
+ tracebox(start, e.mins, e.maxs, start - '0 0 1' * delta.z, MOVE_NORMAL, e);
+ if (trace_fraction >= 1)
+ continue;
+ if (trace_startsolid)
+ continue;
+ if (trace_dphitcontents & badcontents)
+ continue;
+ if (trace_dphitq3surfaceflags & badsurfaceflags)
+ continue;
+
+ // rule 2: if we are too high, lower the point
+ if (trace_fraction * delta.z > maxaboveground)
+ start = trace_endpos + '0 0 1' * maxaboveground;
+ vector enddown = trace_endpos;
+
+ // rule 3: make sure we aren't outside the map. This only works
+ // for somewhat well formed maps. A good rule of thumb is that
+ // the map should have a convex outside hull.
+ // these can be traceLINES as we already verified the starting box
+ vector mstart = start + 0.5 * (e.mins + e.maxs);
+ traceline(mstart, mstart + '1 0 0' * delta.x, MOVE_NORMAL, e);
+ if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
+ continue;
+ traceline(mstart, mstart - '1 0 0' * delta.x, MOVE_NORMAL, e);
+ if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
+ continue;
+ traceline(mstart, mstart + '0 1 0' * delta.y, MOVE_NORMAL, e);
+ if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
+ continue;
+ traceline(mstart, mstart - '0 1 0' * delta.y, MOVE_NORMAL, e);
+ if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
+ continue;
+ traceline(mstart, mstart + '0 0 1' * delta.z, MOVE_NORMAL, e);
+ if (trace_fraction >= 1 || trace_dphittexturename == "common/caulk")
+ continue;
+
+ // rule 4: we must "see" some spawnpoint or item
+ entity sp = NULL;
+ IL_EACH(g_spawnpoints, checkpvs(mstart, it),
+ {
+ if((traceline(mstart, it.origin, MOVE_NORMAL, e), trace_fraction) >= 1)
+ {
+ sp = it;
+ break;
+ }
+ });
+ if(!sp)
+ {
+ int items_checked = 0;
+ IL_EACH(g_items, checkpvs(mstart, it),
+ {
+ if((traceline(mstart, it.origin + (it.mins + it.maxs) * 0.5, MOVE_NORMAL, e), trace_fraction) >= 1)
+ {
+ sp = it;
+ break;
+ }
+
+ ++items_checked;
+ if(items_checked >= attempts)
+ break; // sanity
+ });
+
+ if(!sp)
+ continue;
+ }
+
+ // find a random vector to "look at"
+ end.x = org.x + random() * delta.x;
+ end.y = org.y + random() * delta.y;
+ end.z = org.z + random() * delta.z;
+ end = start + normalize(end - start) * vlen(delta);
+
+ // rule 4: start TO end must not be too short
+ tracebox(start, e.mins, e.maxs, end, MOVE_NORMAL, e);
+ if(trace_startsolid)
+ continue;
+ if(trace_fraction < minviewdistance / vlen(delta))
+ continue;
+
+ // rule 5: don't want to look at sky
+ if(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)
+ continue;
+
+ // rule 6: we must not end up in trigger_hurt
+ if(tracebox_hits_trigger_hurt(start, e.mins, e.maxs, enddown))
+ continue;
+
+ break;
+ }
+
+ e.dphitcontentsmask = m;
+
+ if(j < attempts)
+ {
+ setorigin(e, start);
+ e.angles = vectoangles(end - start);
+ LOG_DEBUG("Needed ", ftos(j + 1), " attempts");
+ return true;
+ }
+ return false;
+}
+
+float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance)
+{
+ return MoveToRandomLocationWithinBounds(e, world.mins, world.maxs, goodcontents, badcontents, badsurfaceflags, attempts, maxaboveground, minviewdistance);
+}
+
/*
===============================================================================
void ReadyRestart();
void DumpStats(float final);
+
+bool MoveToRandomLocationWithinBounds(entity e, vector boundmin, vector boundmax, float goodcontents, float badcontents, float badsurfaceflags, int attempts, float maxaboveground, float minviewdistance);
+
+float MoveToRandomMapLocation(entity e, float goodcontents, float badcontents, float badsurfaceflags, float attempts, float maxaboveground, float minviewdistance);
+
void CheckRules_World();
float RedirectionThink();