- if(highlightedPanel == HUD_PANEL(CHAT)) // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small.
- {
+ if (highlightedPanel == HUD_PANEL(CHAT)) { // some panels have their own restrictions, like the chat panel (which actually only moves the engine chat print around). Looks bad if it's too small.
// minimum panel size cap, do this once more so we NEVER EVER EVER have a panel smaller than this, JUST IN CASE above code still makes the panel eg negative (impossible to resize back without changing cvars manually then)
mySize.x = max(0.025 * vid_conwidth, mySize.x);
mySize.y = max(0.025 * vid_conheight, mySize.y);
// do another pos check, as size might have changed by now
- if (a > 0.5/255.0) // Otherwise guaranteed invisible - don't show. This is checked a second time after some multiplications with other factors were done so temporary changes of these cannot cause flicker.
+ }
+ if (a > 0.5 / 255.0) { // Otherwise guaranteed invisible - don't show. This is checked a second time after some multiplications with other factors were done so temporary changes of these cannot cause flicker.
drawcolorcodedstring(pos + eY * 0.5 * (1 - sz * hud_scale.x) * fontsize.y, ts, fontsize, a, DRAWFLAG_NORMAL);
- if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
+ if (a < 1 && centerprint_msgID[j] == 0) { // messages with id can be replaced just after they are faded out, so never move over them the next messages
- if (pos.y < panel_pos.y) // check if the next message can be shown
- {
+ if (pos.y < panel_pos.y) { // check if the next message can be shown
drawfontscale = hud_scale;
return;
}
- }
- else
- {
+ } else {
pos.y += CENTERPRINT_SPACING * fontsize.y;
- if (a < 1 && centerprint_msgID[j] == 0) // messages with id can be replaced just after they are faded out, so never move over them the next messages
+ if (a < 1 && centerprint_msgID[j] == 0) { // messages with id can be replaced just after they are faded out, so never move over them the next messages
- frametimeavg = (frametimeavg + frametimeavg1 + frametimeavg2 + currentframetime)/4; // average three frametimes into framecounter for slightly more stable fps readings :P
+ frametimeavg = (frametimeavg + frametimeavg1 + frametimeavg2 + currentframetime) / 4; // average three frametimes into framecounter for slightly more stable fps readings :P
- if(currentframetime > 0.0001) // filter out insane values which sometimes seem to occur and throw off the average? If you are getting 10,000 fps or more, then you don't need a framerate counter.
- {
- if(fabs(prevfps - (1/frametimeavg)) > prevfps * autocvar_hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold) // if there was a big jump in fps, just force prevfps at current (1/currentframetime) to make big updates instant
- prevfps = (1/currentframetime);
- prevfps = (1 - weight) * prevfps + weight * (1/frametimeavg); // framecounter just used so there's no need for a new variable, think of it as "frametime average"
+ if (currentframetime > 0.0001) { // filter out insane values which sometimes seem to occur and throw off the average? If you are getting 10,000 fps or more, then you don't need a framerate counter.
+ if (fabs(prevfps - (1 / frametimeavg)) > prevfps * autocvar_hud_panel_engineinfo_framecounter_exponentialmovingaverage_instantupdate_change_threshold) { // if there was a big jump in fps, just force prevfps at current (1/currentframetime) to make big updates instant
+ prevfps = (1 / currentframetime);
+ }
+ prevfps = (1 - weight) * prevfps + weight * (1 / frametimeavg); // framecounter just used so there's no need for a new variable, think of it as "frametime average"
+ if (time < player.strength_finished && g_instagib) {
player.buff_invisible_prev_alpha = default_player_alpha; // we don't want to save the powerup's alpha, as player may lose the powerup while holding the buff
+ if (!PHYS_MULTIJUMP_ADD(player)) { // in this case we make the z velocity == jumpvelocity
+ if (player.velocity_z < PHYS_JUMPVELOCITY(player)) {
M_ARGV(2, bool) = true;
player.velocity_z = 0;
}
- }
- else
+ } else {
M_ARGV(2, bool) = true;
+ }
- if(M_ARGV(2, bool))
- {
- if(PHYS_MULTIJUMP_DODGING(player))
- if(PHYS_CS(player).movement_x != 0 || PHYS_CS(player).movement_y != 0) // don't remove all speed if player isnt pressing any movement keys
- {
- float curspeed;
- vector wishvel, wishdir;
+ if (M_ARGV(2, bool)) {
+ if (PHYS_MULTIJUMP_DODGING(player)) {
+ if (PHYS_CS(player).movement_x != 0 || PHYS_CS(player).movement_y != 0) { // don't remove all speed if player isnt pressing any movement keys
+ float curspeed;
+ vector wishvel, wishdir;
/*#ifdef SVQC
- curspeed = max(
- vlen(vec2(player.velocity)), // current xy speed
- vlen(vec2(antilag_takebackavgvelocity(player, max(player.lastteleporttime + sys_frametime, time - 0.25), time))) // average xy topspeed over the last 0.25 secs
- );
+ curspeed = max(
+ vlen(vec2(player.velocity)), // current xy speed
+ vlen(vec2(antilag_takebackavgvelocity(player, max(player.lastteleporttime + sys_frametime, time - 0.25), time))) // average xy topspeed over the last 0.25 secs
- //e.effects |= EF_SELECTABLE; // don't do this all the time, maybe just when editing objects?
+ //e.effects |= EF_SELECTABLE; // don't do this all the time, maybe just when editing objects?
- if(!database)
- {
+ if (!database) {
// set the object's owner via player UID
// if the player does not have an UID, the owner cannot be stored and his objects may be edited by anyone
- if(this.crypto_idfp != "")
+ if (this.crypto_idfp != "") {
e.crypto_idfp = strzone(this.crypto_idfp);
- else
+ } else {
print_to(this, "^1SANDBOX - WARNING: ^7You spawned an object, but lack a player UID. ^1Your objects are not secured and can be edited by any player!");
+ }
// set public object information
- e.netname = strzone(this.netname); // name of the owner
- e.message = strzone(strftime(true, "%d-%m-%Y %H:%M:%S")); // creation time
+ e.netname = strzone(this.netname); // name of the owner
+ e.message = strzone(strftime(true, "%d-%m-%Y %H:%M:%S")); // creation time
e.message2 = strzone(strftime(true, "%d-%m-%Y %H:%M:%S")); // last editing time
// set origin and direction based on player position and view angle
+ if (object_count >= autocvar_g_sandbox_editor_maxobjects) {
print_to(player, strcat("^1SANDBOX - WARNING: ^7Cannot spawn any more objects. Up to ^3", ftos(autocvar_g_sandbox_editor_maxobjects), " ^7objects may exist at a time"));
return true;
}
- if(cmd_argc < 3)
- {
+ if (cmd_argc < 3) {
print_to(player, "^1SANDBOX - WARNING: ^7Attempted to spawn an object without specifying a model. Please specify the path to your model file after the 'object_spawn' command");
return true;
}
- if (!(fexists(argv(2))))
- {
+ if (!(fexists(argv(2)))) {
print_to(player, "^1SANDBOX - WARNING: ^7Attempted to spawn an object with a non-existent model. Make sure the path to your model file is correct");
+ if (object_count >= autocvar_g_sandbox_editor_maxobjects) {
print_to(player, strcat("^1SANDBOX - WARNING: ^7Cannot spawn any more objects. Up to ^3", ftos(autocvar_g_sandbox_editor_maxobjects), " ^7objects may exist at a time"));
return true;
}
e = sandbox_ObjectPort_Load(player, argv(3), false);
print_to(player, "^1SANDBOX - WARNING: ^7Object could not be selected for attachment. Make sure you are facing an object that you have edit rights over");
return true;
case "set":
- if(player.object_attach == NULL)
- {
+ if (player.object_attach == NULL) {
print_to(player, "^1SANDBOX - WARNING: ^7No object selected for attachment. Please select an object to be attached first.");
return true;
}
// attaches the previously selected object to e
e = sandbox_ObjectEdit_Get(player, true);
- if(e != NULL)
- {
+ if (e != NULL) {
sandbox_ObjectAttach_Set(player.object_attach, e, argv(3));
player.object_attach = NULL; // object was attached, no longer keep it scheduled for attachment
print_to(player, "^1SANDBOX - WARNING: ^7Object could not be attached to the parent. Make sure you are facing an object that you have edit rights over");
// prints public information about the object to the player
e = sandbox_ObjectEdit_Get(player, false);
- if(e != NULL)
- {
- switch(argv(2))
- {
+ if (e != NULL) {
+ switch (argv(2)) {
case "object":
print_to(player, strcat("^2SANDBOX - INFO: ^7Object is owned by \"^7", e.netname, "^7\", created \"^3", e.message, "^7\", last edited \"^3", e.message2, "^7\""));
return true;
case "mesh":
s = "";
FOR_EACH_TAG(e)
- s = strcat(s, "^7\"^5", gettaginfo_name, "^7\", ");
+ s = strcat(s, "^7\"^5", gettaginfo_name, "^7\", ");
print_to(player, strcat("^2SANDBOX - INFO: ^7Object mesh is \"^3", e.model, "^7\" at animation frame ^3", ftos(e.frame), " ^7containing the following tags: ", s));
// we abuse this method, rather than using normal .touch, because touch isn't reliable with multiple clients inside the same trigger, and can't "untouch" entities
// set myself as current viewloc where possible
- for(e = NULL; (e = findentity(e, viewloc, this)); )
+ for (e = NULL; (e = findentity(e, viewloc, this)); ) {
-.float vehicle_health = _STAT(VEHICLESTAT_HEALTH); /// If ent is player this is 0..100 indicating precentage of health left on vehicle. If ent is vehile, this is the real health value.
-.float vehicle_energy = _STAT(VEHICLESTAT_ENERGY); /// If ent is player this is 0..100 indicating precentage of energy left on vehicle. If ent is vehile, this is the real energy value.
-.float vehicle_shield = _STAT(VEHICLESTAT_SHIELD); /// If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehile, this is the real shield value.
+.float vehicle_health = _STAT(VEHICLESTAT_HEALTH); /// If ent is player this is 0..100 indicating precentage of health left on vehicle. If ent is vehile, this is the real health value.
+.float vehicle_energy = _STAT(VEHICLESTAT_ENERGY); /// If ent is player this is 0..100 indicating precentage of energy left on vehicle. If ent is vehile, this is the real energy value.
+.float vehicle_shield = _STAT(VEHICLESTAT_SHIELD); /// If ent is player this is 0..100 indicating precentage of shield left on vehicle. If ent is vehile, this is the real shield value.
-.float vehicle_ammo1 = _STAT(VEHICLESTAT_AMMO1); /// If ent is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If ent is vehile, this is the real ammo1 value.
+.float vehicle_ammo1 = _STAT(VEHICLESTAT_AMMO1); /// If ent is player this is 0..100 indicating percentage of primary ammo left UNLESS value is already stored in vehicle_energy. If ent is vehile, this is the real ammo1 value.
.float vehicle_reload1 = _STAT(VEHICLESTAT_RELOAD1); /// If ent is player this is 0..100 indicating percentage of primary reload status. If ent is vehile, this is the real reload1 value.
-.float vehicle_ammo2 = _STAT(VEHICLESTAT_AMMO2); /// If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehile, this is the real ammo2 value.
+.float vehicle_ammo2 = _STAT(VEHICLESTAT_AMMO2); /// If ent is player this is 0..100 indicating percentage of secondary ammo left. If ent is vehile, this is the real ammo2 value.
.float vehicle_reload2 = _STAT(VEHICLESTAT_RELOAD2); /// If ent is player this is 0..100 indicating percentage of secondary reload status. If ent is vehile, this is the real reload2 value.
- solution_y = solution_x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0)
- if(zdist == 0)
- solution_x = solution_y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually)
+ solution_y = solution_x; // just in case it is not solvable due to roundoff errors, assume two equal solutions at their center (this is mainly for the usual case with ht == 0)
+ }
+ if (zdist == 0) {
+ solution_x = solution_y; // solution_x is 0 in this case, so don't use it, but rather use solution_y (which will be sqrt(0.5 * jumpheight / grav), actually)
vector AnglesTransform_RightDivide(vector to_transform, vector from_transform); // A B^-1
-vector AnglesTransform_LeftDivide(vector from_transform, vector to_transform); // A^-1 B
+vector AnglesTransform_LeftDivide(vector from_transform, vector to_transform); // A^-1 B
-vector AnglesTransform_Normalize(vector t, float minimize_roll); // makes sure all angles are in their range: yaw in -180..180, pitch in -90..90, roll in -180..180 (or if minimize_roll is set, pitch in -180..180, roll in -90..90)
+vector AnglesTransform_Normalize(vector t, float minimize_roll); // makes sure all angles are in their range: yaw in -180..180, pitch in -90..90, roll in -180..180 (or if minimize_roll is set, pitch in -180..180, roll in -90..90)
-entity WarpZone_trace_forent; // temp, callback is allowed to change it
+entity WarpZone_trace_forent; // temp, callback is allowed to change it
USING(WarpZone_trace_callback_t, void(vector start, vector hit, vector end)); // called on every elementary trace
var WarpZone_trace_callback_t WarpZone_trace_callback_t_null;
-entity WarpZone_trace_transform; // transform accumulator during a trace
-entity WarpZone_trace_firstzone; // first warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone, the trace is aborted then)
-entity WarpZone_trace_lastzone; // first warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone, the trace is aborted then)
-vector WarpZone_tracetoss_velocity; // ending velocity of a tracetoss (post-transform)
-float WarpZone_tracetoss_time; // duration of toss (approximate)
+entity WarpZone_trace_transform; // transform accumulator during a trace
+entity WarpZone_trace_firstzone; // first warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone, the trace is aborted then)
+entity WarpZone_trace_lastzone; // first warpzone hit by a trace (can differ from the requested zone in case of _ThroughZone, the trace is aborted then)
+vector WarpZone_tracetoss_velocity; // ending velocity of a tracetoss (post-transform)
+float WarpZone_tracetoss_time; // duration of toss (approximate)
LOG_INFO("Position target of trigger_warpzone near ", vtos(this.aiment.origin), " points into trigger_warpzone. BEWARE.");
norm = -1 * norm;
}
ang = vectoangles2(norm, v_up); // keep rotation, but turn exactly against plane
ang.x = -ang.x;
- if(norm * v_forward < 0.99)
+ if (norm * v_forward < 0.99) {
LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been turned to match plane orientation (", vtos(this.aiment.angles), " -> ", vtos(ang));
- if(vdist(org - this.aiment.origin, >, 0.5))
+ }
+ if (vdist(org - this.aiment.origin, >, 0.5)) {
LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been moved to match the plane (", vtos(this.aiment.origin), " -> ", vtos(org), ").");
+ }
}
- }
- else if(area > 0)
- {
+ } else if (area > 0) {
org = point;
ang = vectoangles(norm);
ang.x = -ang.x;
- }
- else
+ } else {
error("cannot infer origin/angles for this warpzone, please use a killtarget or a trigger_warpzone_position");
- me.TD(me, 2, 4, e = makeXonoticTextLabel(0, _("Welcome to Xonotic, please select your language preference and enter your player name to get started. You can change these options later through the menu system.")));
- e.allowWrap = 1;
+ me.TDempty(me, 1);
+ me.TD(me, 2, 4, e = makeXonoticTextLabel(0, _("Welcome to Xonotic, please select your language preference and enter your player name to get started. You can change these options later through the menu system.")));
- me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Engine info:")));
+ me.TD(me, 1, 4, e = makeXonoticTextLabel(0, _("Engine info:")));
me.TR(me);
- me.TDempty(me, 0.2);
- me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_engineinfo_framecounter_exponentialmovingaverage", _("Use an averaging algorithm for fps")));
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 3.8, e = makeXonoticCheckBox(0, "hud_panel_engineinfo_framecounter_exponentialmovingaverage", _("Use an averaging algorithm for fps")));
- me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_instagib", "1", _("InstaGib"),
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_instagib", "1", _("InstaGib"),
_("Players will be given only one weapon, which can instantly kill the opponent with a single shot. If the player runs out of ammo, he will have 10 seconds to find some or if he fails to do so, face death. The secondary fire mode does not inflict any damage but is good for doing trickjumps.")));
- e.cvarOffValue = "0";
+ e.cvarOffValue = "0";
me.TR(me);
- me.TDempty(me, 0.2);
- me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_nix", "1", _("NIX"),
+ me.TDempty(me, 0.2);
+ me.TD(me, 1, 1.8, e = makeXonoticRadioButton_T(1, "g_nix", "1", _("NIX"),
_("No items Xonotic - instead of pickup items, everyone plays with the same weapon. After some time, a countdown will start, after which everyone will switch to another weapon.")));
- e.cvarOffValue = "0";
+ e.cvarOffValue = "0";
me.TR(me);
- me.TDempty(me, 0.4);
- me.TD(me, 1, 1.6, e = makeXonoticCheckBox_T(0, "g_nix_with_blaster", _("with blaster"),
+ me.TDempty(me, 0.4);
+ me.TD(me, 1, 1.6, e = makeXonoticCheckBox_T(0, "g_nix_with_blaster", _("with blaster"),
_("Always carry the blaster as an additional weapon in Nix")));
- me.TD(me, 1, 2, e = makeXonoticCheckBox_T(0, "r_shadow_realtime_world", _("Realtime world lighting"),
+ me.TD(me, 1, 2, e = makeXonoticCheckBox_T(0, "r_shadow_realtime_world", _("Realtime world lighting"),
_("Enable rendering of full realtime world lighting on maps that support it. Note that this might have a big impact on performance. (default: disabled)")));
- me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_shadow_realtime_world_shadows", _("Shadows"),
+ me.TD(me, 1, 1, e = makeXonoticCheckBox_T(0, "r_shadow_realtime_world_shadows", _("Shadows"),
_("Enable rendering of shadows from realtime world lights (default: disabled)")));
+ me.TD(me, 1, 3, e = makeXonoticCheckBox(0, "crosshair_effect_scalefade", _("Smooth effects of crosshairs")));
+ setDependent(e, "crosshair_enabled", 1, 2);
+ me.TR(me);
+ me.TD(me, 1, 1, e = makeXonoticTextLabel(0, _("Hit testing:")));
+ setDependent(e, "crosshair_enabled", 1, 2);
+ me.TD(me, 1, 2, e = makeXonoticTextSlider_T("crosshair_hittest",
_("None: do not do hit tests for the crosshair; TrueAim: blur the crosshair when there's an obstacle between your gun and the target; Enemies: also enlarge the crosshair when you would hit an enemy")));
- me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Frag Information")));
+ me.TD(me, 1, 3, e = makeXonoticHeaderLabel(_("Frag Information")));
me.TR(me);
- me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "notification_show_sprees", _("Display information about killing sprees"), "-"));
+ me.TD(me, 1, 3, e = makeXonoticCheckBox_T(0, "notification_show_sprees", _("Display information about killing sprees"), "-"));
me.TR(me);
- me.TDempty(me, 0.2);
- me.TD(me, 1, 2.8, e = makeXonoticCheckBox_T(0, "notification_show_sprees_info_specialonly", _("Only display sprees if they are achievements"), "-"));
+ me.TD(me, 1, 2.8, e = makeXonoticCheckBox_T(0, "notification_show_sprees_info_specialonly", _("Only display sprees if they are achievements"), "-"));
- me.TD(me, 1, 3, e = makeXonoticCheckBoxEx_T(2, 1, "notification_CHOICE_CTF_PICKUP_ENEMY", _("Display name of flag stealer in Capture The Flag"), "-"));
+ me.TD(me, 1, 3, e = makeXonoticCheckBoxEx_T(2, 1, "notification_CHOICE_CTF_PICKUP_ENEMY", _("Display name of flag stealer in Capture The Flag"), "-"));
-void BanCommand_mute(float request, float argc, string command) // TODO: Add a sort of mute-"ban" which allows players to be muted based on IP/cryptokey
+void BanCommand_mute(float request, float argc, string command) // TODO: Add a sort of mute-"ban" which allows players to be muted based on IP/cryptokey
// Do not hard code aliases for these, instead create them in commands.cfg... also: keep in alphabetical order, please ;)
-COMMON_COMMAND(cvar_changes, "Prints a list of all changed server cvars") { CommonCommand_cvar_changes(request, caller); }
-COMMON_COMMAND(cvar_purechanges, "Prints a list of all changed gameplay cvars") { CommonCommand_cvar_purechanges(request, caller); }
-COMMON_COMMAND(editmob, "Modifies a monster or all monsters") { CommonCommand_editmob(request, caller, arguments); }
-COMMON_COMMAND(info, "Request for unique server information set up by admin") { CommonCommand_info(request, caller, arguments); }
-COMMON_COMMAND(ladder, "Get information about top players if supported") { CommonCommand_ladder(request, caller); }
-COMMON_COMMAND(lsmaps, "List maps which can be used with the current game mode") { CommonCommand_lsmaps(request, caller); }
-COMMON_COMMAND(printmaplist, "Display full server maplist reply") { CommonCommand_printmaplist(request, caller); }
-COMMON_COMMAND(rankings, "Print information about rankings") { CommonCommand_rankings(request, caller); }
-COMMON_COMMAND(records, "List top 10 records for the current map") { CommonCommand_records(request, caller); }
-COMMON_COMMAND(teamstatus, "Show information about player and team scores") { CommonCommand_teamstatus(request, caller); }
-COMMON_COMMAND(time, "Print different formats/readouts of time") { CommonCommand_time(request, caller); }
-COMMON_COMMAND(timein, "Resume the game from being paused with a timeout") { CommonCommand_timein(request, caller); }
-COMMON_COMMAND(timeout, "Call a timeout which pauses the game for certain amount of time unless unpaused") { CommonCommand_timeout(request, caller); }
-COMMON_COMMAND(vote, "Request an action to be voted upon by players") { VoteCommand(request, caller, arguments, command); }
-COMMON_COMMAND(who, "Display detailed client information about all players") { CommonCommand_who(request, caller, arguments);}
+COMMON_COMMAND(cvar_changes, "Prints a list of all changed server cvars")
+{
+ CommonCommand_cvar_changes(request, caller);
+}
+COMMON_COMMAND(cvar_purechanges, "Prints a list of all changed gameplay cvars")