- wget -O data/maps/stormkeep.waypoints https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints
- wget -O data/maps/stormkeep.waypoints.cache https://gitlab.com/xonotic/xonotic-maps.pk3dir/raw/master/maps/stormkeep.waypoints.cache
- make
- - EXPECT=662ab75eeb91d25c2d86ebb81ce8dc02
+ - EXPECT=ed9be8d1b1a544f89bcdd7d36876fede
- HASH=$(${ENGINE} -noconfig -nohome +exec serverbench.cfg
| tee /dev/stderr
| grep '^:'
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
project(xonotic-data ASM)
+set(all qc-all)
+add_custom_target(${all})
+
set(checks qc-checks)
add_custom_target(${checks})
)
add_executable(csprogs qcsrc/client/progs.inc)
+add_dependencies(${all} csprogs)
add_dependencies(csprogs ${checks})
target_compile_definitions(csprogs PRIVATE -DGAMEQC -DCSQC)
add_executable(progs qcsrc/server/progs.inc)
+add_dependencies(${all} progs)
add_dependencies(progs ${checks})
target_compile_definitions(progs PRIVATE -DGAMEQC -DSVQC)
add_executable(menu qcsrc/menu/progs.inc)
+add_dependencies(${all} menu)
add_dependencies(menu ${checks})
target_compile_definitions(menu PRIVATE -DMENUQC)
set g_balance_pause_health_rot_spawn 5
set g_balance_health_regenstable 100
set g_balance_health_rotstable 100
-set g_balance_health_limit 999
+set g_balance_health_limit 200
set g_balance_armor_regen 0
set g_balance_armor_regenlinear 0
set g_balance_armor_rot 0.02
set g_balance_pause_armor_rot_spawn 5
set g_balance_armor_regenstable 100
set g_balance_armor_rotstable 100
-set g_balance_armor_limit 999
+set g_balance_armor_limit 200
set g_balance_armor_blockpercent 0.7
set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
set g_balance_fuel_regenlinear 0
set g_balance_pause_fuel_rot_spawn 10
set g_balance_fuel_regenstable 50
set g_balance_fuel_rotstable 100
-set g_balance_fuel_limit 999
+set g_balance_fuel_limit 100
// }}}
// {{{ misc
set g_balance_pause_health_rot_spawn 5
set g_balance_health_regenstable 100
set g_balance_health_rotstable 200
-set g_balance_health_limit 999
+set g_balance_health_limit 200
set g_balance_armor_regen 0
set g_balance_armor_regenlinear 0
set g_balance_armor_rot 0
set g_balance_pause_armor_rot_spawn 5
set g_balance_armor_regenstable 100
set g_balance_armor_rotstable 0
-set g_balance_armor_limit 999
+set g_balance_armor_limit 200
set g_balance_armor_blockpercent 0.6
set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
set g_balance_fuel_regenlinear 0
set g_balance_pause_fuel_rot_spawn 10
set g_balance_fuel_regenstable 50
set g_balance_fuel_rotstable 100
-set g_balance_fuel_limit 999
+set g_balance_fuel_limit 100
// }}}
// {{{ misc
set g_balance_pause_health_rot_spawn 5
set g_balance_health_regenstable 100
set g_balance_health_rotstable 100
-set g_balance_health_limit 999
+set g_balance_health_limit 200
set g_balance_armor_regen 0
set g_balance_armor_regenlinear 0
set g_balance_armor_rot 0.04
set g_balance_pause_armor_rot_spawn 5
set g_balance_armor_regenstable 100
set g_balance_armor_rotstable 100
-set g_balance_armor_limit 999
+set g_balance_armor_limit 200
set g_balance_armor_blockpercent 0.6
set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
set g_balance_fuel_regenlinear 0
set g_balance_pause_fuel_rot_spawn 10
set g_balance_fuel_regenstable 50
set g_balance_fuel_rotstable 100
-set g_balance_fuel_limit 999
+set g_balance_fuel_limit 100
// }}}
// {{{ misc
set g_balance_pause_health_rot_spawn 5
set g_balance_health_regenstable 100
set g_balance_health_rotstable 100
-set g_balance_health_limit 999
+set g_balance_health_limit 200
set g_balance_armor_regen 0
set g_balance_armor_regenlinear 0
set g_balance_armor_rot 0.02
set g_balance_pause_armor_rot_spawn 5
set g_balance_armor_regenstable 100
set g_balance_armor_rotstable 100
-set g_balance_armor_limit 999
+set g_balance_armor_limit 200
set g_balance_armor_blockpercent 0.7
set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
set g_balance_fuel_regenlinear 0
set g_balance_pause_fuel_rot_spawn 10
set g_balance_fuel_regenstable 50
set g_balance_fuel_rotstable 100
-set g_balance_fuel_limit 999
+set g_balance_fuel_limit 100
// }}}
// {{{ misc
set g_balance_pause_health_rot_spawn 5
set g_balance_health_regenstable 100
set g_balance_health_rotstable 100
-set g_balance_health_limit 999
+set g_balance_health_limit 200
set g_balance_armor_regen 0
set g_balance_armor_regenlinear 0
set g_balance_armor_rot 0.02
set g_balance_pause_armor_rot_spawn 5
set g_balance_armor_regenstable 100
set g_balance_armor_rotstable 100
-set g_balance_armor_limit 999
+set g_balance_armor_limit 200
set g_balance_armor_blockpercent 0.7
set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
set g_balance_fuel_regenlinear 0
set g_balance_pause_fuel_rot_spawn 10
set g_balance_fuel_regenstable 50
set g_balance_fuel_rotstable 100
-set g_balance_fuel_limit 999
+set g_balance_fuel_limit 100
// }}}
// {{{ misc
set g_balance_pause_health_rot_spawn 5
set g_balance_health_regenstable 100
set g_balance_health_rotstable 100
-set g_balance_health_limit 999
+set g_balance_health_limit 200
set g_balance_armor_regen 0
set g_balance_armor_regenlinear 0
set g_balance_armor_rot 0.02
set g_balance_pause_armor_rot_spawn 5
set g_balance_armor_regenstable 100
set g_balance_armor_rotstable 100
-set g_balance_armor_limit 999
+set g_balance_armor_limit 200
set g_balance_armor_blockpercent 0.7
set g_balance_fuel_regen 0.1 "fuel regeneration (only applies if the player owns IT_FUEL_REGEN)"
set g_balance_fuel_regenlinear 0
set g_balance_pause_fuel_rot_spawn 10
set g_balance_fuel_regenstable 50
set g_balance_fuel_rotstable 100
-set g_balance_fuel_limit 999
+set g_balance_fuel_limit 100
// }}}
// {{{ misc
_cl_color "112.211" // same effect as 112, but menuqc can detect this as the default and not intentionally set
_cl_name ""
seta _cl_gender 0 "storage cvar for current player gender (0 = undisclosed, 1 = male, 2 = female)"
-_cl_playermodel models/player/erebus.iqm
_cl_playerskin 0
seta cl_reticle 1 "enable zoom reticles"
// general gameplay
set g_overkill 1
+
+// hack - eventually, we should be able to choose overkill models in menu like for vanilla
+set sv_defaultcharacter 1
+set sv_defaultplayermodel "models/ok_player/okrobot1.dpm models/ok_player/okrobot2.dpm models/ok_player/okrobot3.dpm models/ok_player/okrobot4.dpm models/ok_player/okmale1.dpm models/ok_player/okmale2.dpm models/ok_player/okmale3.dpm models/ok_player/okmale4.dpm"
+set sv_defaultplayermodel_red "models/ok_player/okrobot1.dpm models/ok_player/okrobot2.dpm models/ok_player/okrobot3.dpm models/ok_player/okrobot4.dpm"
+set sv_defaultplayermodel_blue "models/ok_player/okmale1.dpm models/ok_player/okmale2.dpm models/ok_player/okmale3.dpm models/ok_player/okmale4.dpm"
+
set g_respawn_ghosts 0
set g_nades 1
set g_powerups -1 "if set to 0 the strength and shield (invincibility) will not spawn on the map, if 1 they will spawn in all game modes, -1 is game mode default"
set g_use_ammunition 1 "if set to 0 all weapons have unlimited ammunition"
set g_pickup_items -1 "if set to 0 all items (health, armor, ammo, weapons...) are removed from the map, if 1 they are forced to spawn"
+set g_pickup_respawntime_scaling_reciprocal 0 "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `reciprocal` (with `offset` and `linear` set to 0) can be used to achieve a constant number of items spawned *per player*"
+set g_pickup_respawntime_scaling_offset 0 "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `offset` offsets the curve left or right - the results are not intuitive and I recommend plotting the respawn time and the number of items per player to see what's happening"
+set g_pickup_respawntime_scaling_linear 1 "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `linear` can be used to simply scale the respawn time linearly"
set g_weaponarena "0" "put in a list of weapons to enable a weapon arena mode, or try \"all\" or \"most\""
set g_weaponarena_random "0" "if set to a number, only that weapon count is given on every spawn (randomly)"
set g_weaponarena_random_with_blaster "1" "additionally, always provide the blaster in random weapon arena games"
set ekg 0 "Throw huge amounts of gibs"
+_cl_playermodel "models/player/erebus.iqm"
+
locs_enable 0
pausable 0
set samelevel 0 "when 1, always play the same level over and over again"
// =======
set g_nades 0 "enable off-hand grenades"
set g_nades_spread 0.04 "random spread offset of throw direction"
-set g_nades_throw_offset "0 0 0" "nade throwing offset"
+set g_nades_throw_offset "0 -25 0" "nade throwing offset"
set g_nades_spawn 1 "give nades right away when player spawns rather than delaying entire refire"
set g_nades_client_select 0 "allow client side selection of nade type"
set g_nades_pickup 0 "allow picking up thrown nades (not your own)"
e.bgmscriptline = e.bgmscriptline0 = i;
if(i >= bgmscriptbufsize)
{
- LOG_INFOF("ERROR: bgmscript does not define %s\n", e.bgmscript);
+ LOG_INFOF("ERROR: bgmscript does not define %s", e.bgmscript);
strunzone(e.bgmscript);
e.bgmscript = string_null;
}
blurtest_time1 = time + stof(argv(1));
blurtest_radius = stof(argv(2));
blurtest_power = stof(argv(3));
- LOG_INFO("Enabled blurtest\n");
+ LOG_INFO("Enabled blurtest");
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 cl_cmd blurtest\n");
- LOG_INFO(" No arguments required.\n");
+ LOG_INFO("Usage:^3 cl_cmd blurtest");
+ LOG_INFO(" No arguments required.");
return;
}
}
#else
if (request)
{
- LOG_INFO("Blurtest is not enabled on this client.\n");
+ LOG_INFO("Blurtest is not enabled on this client.");
return;
}
#endif
default:
{
- LOG_INFO("Incorrect parameters for ^2boxparticles^7\n");
+ LOG_INFO("Incorrect parameters for ^2boxparticles^7");
}
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 lv_cmd boxparticles effectname own org_from org_to, dir_from, dir_to, countmultiplier, flags\n");
- LOG_INFO(" 'effectname' is the name of a particle effect in effectinfo.txt\n");
- LOG_INFO(" 'own' is the entity number of the owner (negative for csqc ent, positive for svqc ent)\n");
- LOG_INFO(" 'org_from' is the starting origin of the box\n");
- LOG_INFO(" 'org_to' is the ending origin of the box\n");
- LOG_INFO(" 'dir_from' is the minimum velocity\n");
- LOG_INFO(" 'dir_to' is the maximum velocity\n");
- LOG_INFO(" 'countmultiplier' defines a multiplier for the particle count (affects count only, not countabsolute or trailspacing)\n");
- LOG_INFO(" 'flags' can contain:\n");
- LOG_INFO(" 1 to respect globals particles_alphamin, particles_alphamax (set right before via prvm_globalset client)\n");
- LOG_INFO(" 2 to respect globals particles_colormin, particles_colormax (set right before via prvm_globalset client)\n");
- LOG_INFO(" 4 to respect globals particles_fade (set right before via prvm_globalset client)\n");
- LOG_INFO(" 128 to draw a trail, not a box\n");
+ LOG_INFO(
+ "Usage:^3 lv_cmd boxparticles effectname own org_from org_to, dir_from, dir_to, countmultiplier, flags\n"
+ " 'effectname' is the name of a particle effect in effectinfo.txt\n"
+ " 'own' is the entity number of the owner (negative for csqc ent, positive for svqc ent)\n"
+ " 'org_from' is the starting origin of the box\n"
+ " 'org_to' is the ending origin of the box\n"
+ " 'dir_from' is the minimum velocity\n"
+ " 'dir_to' is the maximum velocity\n"
+ " 'countmultiplier' defines a multiplier for the particle count (affects count only, not countabsolute or trailspacing)\n"
+ " 'flags' can contain:\n"
+ " 1 to respect globals particles_alphamin, particles_alphamax (set right before via prvm_globalset client)\n"
+ " 2 to respect globals particles_colormin, particles_colormax (set right before via prvm_globalset client)\n"
+ " 4 to respect globals particles_fade (set right before via prvm_globalset client)\n"
+ " 128 to draw a trail, not a box\n"
+ );
return;
}
}
fputs(fh, strcat("\"angles\" \"", strcat(ftos(view_angles.x), " ", ftos(view_angles.y), " ", ftos(view_angles.z)), "\"\n"));
fputs(fh, "}\n");
- LOG_INFO("Completed screenshot entity dump in ^2data/data/", path, MapInfo_Map_bspname, "_scrshot_ent.txt^7.\n");
+ LOG_INFO("Completed screenshot entity dump in ^2data/data/", path, MapInfo_Map_bspname, "_scrshot_ent.txt^7.");
fclose(fh);
}
else
{
- LOG_INFO("^1Error: ^7Could not dump to file!\n");
+ LOG_INFO("^1Error: ^7Could not dump to file!");
}
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 cl_cmd create_scrshot_ent [path]\n");
- LOG_INFO(" Where 'path' can be the subdirectory of data/data in which the file is saved.\n");
+ LOG_INFO("Usage:^3 cl_cmd create_scrshot_ent [path]");
+ LOG_INFO(" Where 'path' can be the subdirectory of data/data in which the file is saved.");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 cl_cmd debugmodel model\n");
- LOG_INFO(" Where 'model' is a string of the model name to use for the debug model.\n");
+ LOG_INFO("Usage:^3 cl_cmd debugmodel model");
+ LOG_INFO(" Where 'model' is a string of the model name to use for the debug model.");
return;
}
}
default:
{
- LOG_INFO("Incorrect parameters for ^2handlevote^7\n");
+ LOG_INFO("Incorrect parameters for ^2handlevote^7");
}
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 cl_cmd handlevote vote\n");
- LOG_INFO(" Where 'vote' is the selection for either the current poll or uid2name.\n");
+ LOG_INFO("Usage:^3 cl_cmd handlevote vote");
+ LOG_INFO(" Where 'vote' is the selection for either the current poll or uid2name.");
return;
}
}
{
if (argv(2) == "help")
{
- LOG_INFO(" quickmenu [[default | file | \"\"] submenu file]\n");
- LOG_INFO("Called without options (or with \"\") loads either the default quickmenu or a quickmenu file if hud_panel_quickmenu_file is set to a valid filename.\n");
- LOG_INFO("A submenu name can be given to open the quickmenu directly in a submenu; it requires to specify 'default', 'file' or '\"\"' option.\n");
- LOG_INFO("A file name can also be given to open a different quickmenu\n");
+ LOG_INFO(" quickmenu [[default | file | \"\"] submenu file]");
+ LOG_INFO("Called without options (or with \"\") loads either the default quickmenu or a quickmenu file if hud_panel_quickmenu_file is set to a valid filename.");
+ LOG_INFO("A submenu name can be given to open the quickmenu directly in a submenu; it requires to specify 'default', 'file' or '\"\"' option.");
+ LOG_INFO("A file name can also be given to open a different quickmenu");
return;
}
string file = ((argv(4) == "") ? autocvar_hud_panel_quickmenu_file : argv(4));
default:
{
- LOG_INFO("Incorrect parameters for ^2hud^7\n");
+ LOG_INFO("Incorrect parameters for ^2hud^7");
}
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 cl_cmd hud action [configname | radartoggle | layout]\n");
- LOG_INFO(" Where 'action' is the command to complete,\n");
- LOG_INFO(" 'configname' is the name to save to for \"save\" action,\n");
- LOG_INFO(" 'radartoggle' is to control hud_panel_radar_maximized for \"radar\" action,\n");
- LOG_INFO(" and 'layout' is how to organize the scoreboard columns for the set action.\n");
- LOG_INFO(" Full list of commands here: \"configure, quickmenu, minigame, save, scoreboard_columns_help, scoreboard_columns_set, radar.\"\n");
+ LOG_INFO("Usage:^3 cl_cmd hud action [configname | radartoggle | layout]");
+ LOG_INFO(" Where 'action' is the command to complete,");
+ LOG_INFO(" 'configname' is the name to save to for \"save\" action,");
+ LOG_INFO(" 'radartoggle' is to control hud_panel_radar_maximized for \"radar\" action,");
+ LOG_INFO(" and 'layout' is how to organize the scoreboard columns for the set action.");
+ LOG_INFO(" Full list of commands here: \"configure, quickmenu, minigame, save, scoreboard_columns_help, scoreboard_columns_set, radar.\"");
return;
}
}
default:
{
- LOG_INFO("Incorrect parameters for ^2localprint^7\n");
+ LOG_INFO("Incorrect parameters for ^2localprint^7");
}
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 cl_cmd localprint \"message\"\n");
- LOG_INFO(" 'message' is the centerprint message to send to yourself.\n");
+ LOG_INFO("Usage:^3 cl_cmd localprint \"message\"");
+ LOG_INFO(" 'message' is the centerprint message to send to yourself.");
return;
}
}
default:
{
- LOG_INFO("Incorrect parameters for ^2mv_download^7\n");
+ LOG_INFO("Incorrect parameters for ^2mv_download^7");
}
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 cl_cmd mv_download mapid\n");
- LOG_INFO(" Where 'mapid' is the id number of the map to request an image of on the map vote selection menu.\n");
+ LOG_INFO("Usage:^3 cl_cmd mv_download mapid");
+ LOG_INFO(" Where 'mapid' is the id number of the map to request an image of on the map vote selection menu.");
return;
}
}
default:
{
- LOG_INFO("Incorrect parameters for ^2sendcvar^7\n");
+ LOG_INFO("Incorrect parameters for ^2sendcvar^7");
}
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 cl_cmd sendcvar <cvar>\n");
- LOG_INFO(" Where 'cvar' is the cvar plus arguments to send to the server.\n");
+ LOG_INFO("Usage:^3 cl_cmd sendcvar <cvar>");
+ LOG_INFO(" Where 'cvar' is the cvar plus arguments to send to the server.");
return;
}
}
void LocalCommand_macro_help()
{
- FOREACH(CLIENT_COMMANDS, true, LOG_INFOF(" ^2%s^7: %s\n", it.m_name, it.m_description));
+ FOREACH(CLIENT_COMMANDS, true, LOG_INFOF(" ^2%s^7: %s", it.m_name, it.m_description));
}
bool LocalCommand_macro_command(int argc, string command)
{
if (argc == 1)
{
- LOG_INFO("\nClient console commands:\n");
+ LOG_INFO("Client console commands:");
LocalCommand_macro_help();
- LOG_INFO("\nGeneric commands shared by all programs:\n");
+ LOG_INFO("\nGeneric commands shared by all programs:");
GenericCommand_macro_help();
- LOG_INFO("\nUsage:^3 cl_cmd COMMAND...^7, where possible commands are listed above.\n");
- LOG_INFO("For help about a specific command, type cl_cmd help COMMAND\n");
+ LOG_INFO("\nUsage:^3 cl_cmd COMMAND...^7, where possible commands are listed above.");
+ LOG_INFO("For help about a specific command, type cl_cmd help COMMAND");
return;
}
) return;
// nothing above caught the command, must be invalid
- LOG_INFO(((command != "") ? strcat("Unknown client command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try cl_cmd help.\n");
+ LOG_INFO(((command != "") ? strcat("Unknown client command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try cl_cmd help.");
}
this.forceplayermodels_isgoodmodel = fexists(this.forceplayermodels_savemodel);
this.forceplayermodels_isgoodmodel_mdl = this.forceplayermodels_savemodel;
if(!this.forceplayermodels_isgoodmodel)
- LOG_INFOF("Warning: missing model %s has been used\n", this.forceplayermodels_savemodel);
+ LOG_INFOF("Warning: missing model %s has been used", this.forceplayermodels_savemodel);
}
}
void CSQCPlayer_ModelAppearance_Apply(entity this, bool islocalplayer)
HUD_Write("menu_sync\n"); // force the menu to reread the cvars, so that the dialogs are updated
- LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)\n"), filename);
+ LOG_INFOF(_("^2Successfully exported to %s! (Note: It's saved in data/data/)"), filename);
fclose(fh);
}
else
- LOG_INFOF(_("^1Couldn't write to %s\n"), filename);
+ LOG_INFOF(_("^1Couldn't write to %s"), filename);
}
void HUD_Configure_Exit_Force()
if(mode == "file")
{
if(file == "" || file == "0")
- LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu\n");
+ LOG_INFO("No file name is set in hud_panel_quickmenu_file, loading default quickmenu");
else
{
fh = fopen(file, FILE_READ);
if(fh < 0)
- LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu\n", file);
+ LOG_INFOF("Couldn't open file \"%s\", loading default quickmenu", file);
}
if(fh < 0)
mode = "default";
void Cmd_Scoreboard_Help()
{
- LOG_INFO(_("You can modify the scoreboard using the ^2scoreboard_columns_set command.\n"));
- LOG_INFO(_("^3|---------------------------------------------------------------|\n"));
- LOG_INFO(_("Usage:\n"));
- LOG_INFO(_("^2scoreboard_columns_set default\n"));
- LOG_INFO(_("^2scoreboard_columns_set ^7field1 field2 ...\n"));
- LOG_INFO(_("The following field names are recognized (case insensitive):\n"));
- LOG_INFO(_("You can use a ^3|^7 to start the right-aligned fields.\n"));
- LOG_INFO("\n");
-
- LOG_INFO(_("^3name^7 or ^3nick^7 Name of a player\n"));
- LOG_INFO(_("^3ping^7 Ping time\n"));
- LOG_INFO(_("^3pl^7 Packet loss\n"));
- LOG_INFO(_("^3elo^7 Player ELO\n"));
- LOG_INFO(_("^3kills^7 Number of kills\n"));
- LOG_INFO(_("^3deaths^7 Number of deaths\n"));
- LOG_INFO(_("^3suicides^7 Number of suicides\n"));
- LOG_INFO(_("^3frags^7 kills - suicides\n"));
- LOG_INFO(_("^3kd^7 The kill-death ratio\n"));
- LOG_INFO(_("^3dmg^7 The total damage done\n"));
- LOG_INFO(_("^3dmgtaken^7 The total damage taken\n"));
- LOG_INFO(_("^3sum^7 frags - deaths\n"));
- LOG_INFO(_("^3caps^7 How often a flag (CTF) or a key (KeyHunt) was captured\n"));
- LOG_INFO(_("^3pickups^7 How often a flag (CTF) or a key (KeyHunt) or a ball (Keepaway) was picked up\n"));
- LOG_INFO(_("^3captime^7 Time of fastest cap (CTF)\n"));
- LOG_INFO(_("^3fckills^7 Number of flag carrier kills\n"));
- LOG_INFO(_("^3returns^7 Number of flag returns\n"));
- LOG_INFO(_("^3drops^7 Number of flag drops\n"));
- LOG_INFO(_("^3lives^7 Number of lives (LMS)\n"));
- LOG_INFO(_("^3rank^7 Player rank\n"));
- LOG_INFO(_("^3pushes^7 Number of players pushed into void\n"));
- LOG_INFO(_("^3destroyed^7 Number of keys destroyed by pushing them into void\n"));
- LOG_INFO(_("^3kckills^7 Number of keys carrier kills\n"));
- LOG_INFO(_("^3losses^7 Number of times a key was lost\n"));
- LOG_INFO(_("^3laps^7 Number of laps finished (race/cts)\n"));
- LOG_INFO(_("^3time^7 Total time raced (race/cts)\n"));
- LOG_INFO(_("^3fastest^7 Time of fastest lap (race/cts)\n"));
- LOG_INFO(_("^3ticks^7 Number of ticks (DOM)\n"));
- LOG_INFO(_("^3takes^7 Number of domination points taken (DOM)\n"));
- LOG_INFO(_("^3bckills^7 Number of ball carrier kills\n"));
- LOG_INFO(_("^3bctime^7 Total amount of time holding the ball in Keepaway\n"));
- LOG_INFO(_("^3score^7 Total score\n"));
- LOG_INFO("\n");
+ LOG_INFO(_("You can modify the scoreboard using the ^2scoreboard_columns_set command."));
+ LOG_INFO(_("^3|---------------------------------------------------------------|"));
+ LOG_INFO(_("Usage:"));
+ LOG_INFO(_("^2scoreboard_columns_set default"));
+ LOG_INFO(_("^2scoreboard_columns_set ^7field1 field2 ..."));
+ LOG_INFO(_("The following field names are recognized (case insensitive):"));
+ LOG_INFO(_("You can use a ^3|^7 to start the right-aligned fields."));
+ LOG_INFO("");
+
+ LOG_INFO(_("^3name^7 or ^3nick^7 Name of a player"));
+ LOG_INFO(_("^3ping^7 Ping time"));
+ LOG_INFO(_("^3pl^7 Packet loss"));
+ LOG_INFO(_("^3elo^7 Player ELO"));
+ LOG_INFO(_("^3kills^7 Number of kills"));
+ LOG_INFO(_("^3deaths^7 Number of deaths"));
+ LOG_INFO(_("^3suicides^7 Number of suicides"));
+ LOG_INFO(_("^3frags^7 kills - suicides"));
+ LOG_INFO(_("^3kd^7 The kill-death ratio"));
+ LOG_INFO(_("^3dmg^7 The total damage done"));
+ LOG_INFO(_("^3dmgtaken^7 The total damage taken"));
+ LOG_INFO(_("^3sum^7 frags - deaths"));
+ LOG_INFO(_("^3caps^7 How often a flag (CTF) or a key (KeyHunt) was captured"));
+ LOG_INFO(_("^3pickups^7 How often a flag (CTF) or a key (KeyHunt) or a ball (Keepaway) was picked up"));
+ LOG_INFO(_("^3captime^7 Time of fastest cap (CTF)"));
+ LOG_INFO(_("^3fckills^7 Number of flag carrier kills"));
+ LOG_INFO(_("^3returns^7 Number of flag returns"));
+ LOG_INFO(_("^3drops^7 Number of flag drops"));
+ LOG_INFO(_("^3lives^7 Number of lives (LMS)"));
+ LOG_INFO(_("^3rank^7 Player rank"));
+ LOG_INFO(_("^3pushes^7 Number of players pushed into void"));
+ LOG_INFO(_("^3destroyed^7 Number of keys destroyed by pushing them into void"));
+ LOG_INFO(_("^3kckills^7 Number of keys carrier kills"));
+ LOG_INFO(_("^3losses^7 Number of times a key was lost"));
+ LOG_INFO(_("^3laps^7 Number of laps finished (race/cts)"));
+ LOG_INFO(_("^3time^7 Total time raced (race/cts)"));
+ LOG_INFO(_("^3fastest^7 Time of fastest lap (race/cts)"));
+ LOG_INFO(_("^3ticks^7 Number of ticks (DOM)"));
+ LOG_INFO(_("^3takes^7 Number of domination points taken (DOM)"));
+ LOG_INFO(_("^3bckills^7 Number of ball carrier kills"));
+ LOG_INFO(_("^3bctime^7 Total amount of time holding the ball in Keepaway"));
+ LOG_INFO(_("^3score^7 Total score"));
+ LOG_INFO("");
LOG_INFO(_("Before a field you can put a + or - sign, then a comma separated list\n"
"of game types, then a slash, to make the field show up only in these\n"
LOG_INFO(_("The special game type names 'teams' and 'noteams' can be used to\n"
"include/exclude ALL teams/noteams game modes.\n\n"));
- LOG_INFO(_("Example: scoreboard_columns_set name ping pl | +ctf/field3 -dm/field4\n"));
- LOG_INFO(_("will display name, ping and pl aligned to the left, and the fields\n"
+ LOG_INFO(_("Example: scoreboard_columns_set name ping pl | +ctf/field3 -dm/field4"));
+ LOG_INFO(_("will display name, ping and pl aligned to the left, and the fields"
"right of the vertical bar aligned to the right.\n"));
- LOG_INFO(_("'field3' will only be shown in CTF, and 'field4' will be shown in all\n"
- "other gamemodes except DM.\n"));
+ LOG_INFO(_("'field3' will only be shown in CTF, and 'field4' will be shown in all\nother gamemodes except DM.\n"));
}
// NOTE: adding a gametype with ? to not warn for an optional field
else
{
if(!nocomplain)
- LOG_INFOF("^1Error:^7 Unknown score field: '%s'\n", str);
+ LOG_INFOF("^1Error:^7 Unknown score field: '%s'", str);
continue;
}
LABEL(found)
sbt_field_title[0] = strzone(TranslateScoresLabel("name"));
sbt_field[0] = SP_NAME;
++sbt_num_fields;
- LOG_INFO("fixed missing field 'name'\n");
+ LOG_INFO("fixed missing field 'name'");
if(!have_separator)
{
sbt_field[1] = SP_SEPARATOR;
sbt_field_size[1] = stringwidth("|", false, hud_fontsize);
++sbt_num_fields;
- LOG_INFO("fixed missing field '|'\n");
+ LOG_INFO("fixed missing field '|'");
}
}
else if(!have_separator)
sbt_field_size[sbt_num_fields] = stringwidth("|", false, hud_fontsize);
sbt_field[sbt_num_fields] = SP_SEPARATOR;
++sbt_num_fields;
- LOG_INFO("fixed missing field '|'\n");
+ LOG_INFO("fixed missing field '|'");
}
if(!have_secondary)
{
sbt_field_size[sbt_num_fields] = stringwidth(sbt_field_title[sbt_num_fields], false, hud_fontsize);
sbt_field[sbt_num_fields] = ps_secondary;
++sbt_num_fields;
- LOG_INFOF("fixed missing field '%s'\n", scores_label(ps_secondary));
+ LOG_INFOF("fixed missing field '%s'", scores_label(ps_secondary));
}
if(!have_primary)
{
sbt_field_size[sbt_num_fields] = stringwidth(sbt_field_title[sbt_num_fields], false, hud_fontsize);
sbt_field[sbt_num_fields] = ps_primary;
++sbt_num_fields;
- LOG_INFOF("fixed missing field '%s'\n", scores_label(ps_primary));
+ LOG_INFOF("fixed missing field '%s'", scores_label(ps_primary));
}
}
{
vote_yescount = 0;
vote_nocount = 0;
- LOG_INFO(_("^1You must answer before entering hud configure mode\n"));
+ LOG_INFO(_("^1You must answer before entering hud configure mode"));
cvar_set("_hud_configure", "0");
}
if(vote_called_vote)
prvm_language = strzone(cvar_string("prvm_language"));
#ifdef WATERMARK
- LOG_INFOF("^4CSQC Build information: ^1%s\n", WATERMARK);
+ LOG_INFOF("^4CSQC Build information: ^1%s", WATERMARK);
#endif
{
if(!isNew && n != this.sv_entnum)
{
//print("A CSQC entity changed its owner!\n");
- LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)\n", etof(this), this.classname);
+ LOG_INFOF("A CSQC entity changed its owner! (edict: %d, classname: %s)", etof(this), this.classname);
isNew = true;
Ent_Remove(this);
}
{
if (t != this.enttype || isnew)
{
- LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)\n", etof(this), this.entnum, this.enttype, t);
+ LOG_INFOF("A CSQC entity changed its type! (edict: %d, server: %d, type: %d -> %d)", etof(this), this.entnum, this.enttype, t);
Ent_Remove(this);
clearentity(this);
isnew = true;
{
if (!isnew)
{
- LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)\n", etof(this), this.entnum, t);
+ LOG_INFOF("A CSQC entity appeared out of nowhere! (edict: %d, server: %d, type: %d)", etof(this), this.entnum, t);
isnew = true;
}
}
FOREACH(LinkedEntities, it.m_id == t, {
if (isnew) this.classname = it.netname;
if (autocvar_developer_csqcentities)
- LOG_INFOF("CSQC_Ent_Update(%d) at %f with this=%i {.entnum=%d, .enttype=%d} t=%s (%d)\n", isnew, savetime, this, this.entnum, this.enttype, this.classname, t);
+ LOG_INFOF("CSQC_Ent_Update(%d) at %f with this=%i {.entnum=%d, .enttype=%d} t=%s (%d)", isnew, savetime, this, this.entnum, this.enttype, this.classname, t);
done = it.m_read(this, NULL, isnew);
MUTATOR_CALLHOOK(Ent_Update, this, isnew);
break;
// CSQC_Ent_Remove : Called when the server requests a SSQC / CSQC entity to be removed. Essentially call remove(this) as well.
void CSQC_Ent_Remove(entity this)
{
- if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Ent_Remove() with this=%i {.entnum=%d, .enttype=%d}\n", this, this.entnum, this.enttype);
+ if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Ent_Remove() with this=%i {.entnum=%d, .enttype=%d}", this, this.entnum, this.enttype);
if (wasfreed(this))
{
LOG_WARN("CSQC_Ent_Remove called for already removed entity. Packet loss?");
// CSQC_Parse_StuffCmd : Provides the stuffcmd string in the first parameter that the server provided. To execute standard behavior, simply execute localcmd with the string.
void CSQC_Parse_StuffCmd(string strMessage)
{
- if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_StuffCmd(\"%s\")\n", strMessage);
+ if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_StuffCmd(\"%s\")", strMessage);
localcmd(strMessage);
}
// CSQC_Parse_Print : Provides the print string in the first parameter that the server provided. To execute standard behavior, simply execute print with the string.
void CSQC_Parse_Print(string strMessage)
{
- if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_Print(\"%s\")\n", strMessage);
+ if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_Print(\"%s\")", strMessage);
print(ColorTranslateRGB(strMessage));
}
// CSQC_Parse_CenterPrint : Provides the centerprint_hud string in the first parameter that the server provided.
void CSQC_Parse_CenterPrint(string strMessage)
{
- if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_CenterPrint(\"%s\")\n", strMessage);
+ if (autocvar_developer_csqcentities) LOG_INFOF("CSQC_Parse_CenterPrint(\"%s\")", strMessage);
centerprint_hud(strMessage);
}
FOREACH(TempEntities, it.m_id == nTEID, {
if (autocvar_developer_csqcentities)
- LOG_INFOF("CSQC_Parse_TempEntity() nTEID=%s (%d)\n", it.netname, nTEID);
+ LOG_INFOF("CSQC_Parse_TempEntity() nTEID=%s (%d)", it.netname, nTEID);
return it.m_read(NULL, NULL, true);
});
if (autocvar_developer_csqcentities)
- LOG_INFOF("CSQC_Parse_TempEntity() with nTEID=%d\n", nTEID);
+ LOG_INFOF("CSQC_Parse_TempEntity() with nTEID=%d", nTEID);
// No special logic for this temporary entity; return 0 so the engine can handle it
return false;
if(argc != 2 || !mv_pk3list)
{
- LOG_INFO(_("mv_mapdownload: ^3You're not supposed to use this command on your own!\n"));
+ LOG_INFO(_("mv_mapdownload: ^3You're not supposed to use this command on your own!"));
return;
}
break;
if(!pak || pak.sv_entnum != id) {
- LOG_INFO(_("^1Error:^7 Couldn't find pak index.\n"));
+ LOG_INFO(_("^1Error:^7 Couldn't find pak index."));
return;
}
mv_preview[id] = true;
return;
} else {
- LOG_INFO(_("Requesting preview...\n"));
+ LOG_INFO(_("Requesting preview..."));
localcmd(strcat("\ncmd mv_getpicture ", ftos(id), "\n"));
}
}
}
else
{
- LOG_INFOF("Received HTTP request data for an invalid id %d.\n", id);
+ LOG_INFOF("Received HTTP request data for an invalid id %d.", id);
}
}
if(acc_levels > MAX_ACCURACY_LEVELS)
acc_levels = MAX_ACCURACY_LEVELS;
if(acc_levels < 2)
- LOG_INFO("Warning: accuracy_color_levels must contain at least 2 values\n");
+ LOG_INFO("Warning: accuracy_color_levels must contain at least 2 values");
int i;
for(i = 0; i < acc_levels; ++i)
ov_enabled = true;
#if 0
- LOG_INFOF("OrthoView: org = %s, angles = %s, distance = %f, nearest = %f, furthest = %f\n",
+ LOG_INFOF("OrthoView: org = %s, angles = %s, distance = %f, nearest = %f, furthest = %f",
vtos(ov_org),
vtos(getpropertyvec(VF_ANGLES)),
ov_distance,
}
default:
- LOG_INFO("Incorrect parameters for ^2addtolist^7\n");
+ LOG_INFO("Incorrect parameters for ^2addtolist^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " addtolist variable value\n"));
- LOG_INFO(" Where 'variable' is what to add 'value' to.\n");
- LOG_INFO("See also: ^2removefromlist^7\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " addtolist variable value");
+ LOG_INFO(" Where 'variable' is what to add 'value' to.");
+ LOG_INFO("See also: ^2removefromlist^7");
return;
}
}
curl_uri_get_pos = (curl_uri_get_pos + 1) % (URI_GET_CURL_END - URI_GET_CURL + 1);
}
else
- LOG_INFO(_("error creating curl handle\n"));
+ LOG_INFO(_("error creating curl handle"));
buf_del(buf);
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " qc_curl [--key N] [--cvar] [--exec] URL [postargs...]"));
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " qc_curl [--key N] [--cvar] [--exec] URL [postargs...]");
return;
}
}
CMD_Write("\ndump of generic commands:\n");
GenericCommand_macro_write_aliases(fh);
- LOG_INFO("Completed dump of aliases in ^2data/data/", GetProgramCommandPrefix(), "_dump.txt^7.\n");
+ LOG_INFO("Completed dump of aliases in ^2data/data/", GetProgramCommandPrefix(), "_dump.txt^7.");
fclose(fh);
}
else
{
- LOG_INFO("^1Error: ^7Could not dump to file!\n");
+ LOG_INFO("^1Error: ^7Could not dump to file!");
}
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpcommands"));
- LOG_INFO(" No arguments required.\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpcommands");
+ LOG_INFO(" No arguments required.");
return;
}
}
{
if (!fexists(strcat("maps/", argv(2), ".bsp")))
{
- LOG_INFO("maplist: ERROR: ", argv(2), " does not exist!\n");
+ LOG_INFO("maplist: ERROR: ", argv(2), " does not exist!");
break;
}
}
default:
- LOG_INFO("Incorrect parameters for ^2maplist^7\n");
+ LOG_INFO("Incorrect parameters for ^2maplist^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " maplist action [map]\n"));
- LOG_INFO(" Where 'action' is the command to complete,\n");
- LOG_INFO(" and 'map' is what it acts upon (if required).\n");
- LOG_INFO(" Full list of commands here: \"add, cleanup, remove, shuffle.\"\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " maplist action [map]");
+ LOG_INFO(" Where 'action' is the command to complete,");
+ LOG_INFO(" and 'map' is what it acts upon (if required).");
+ LOG_INFO(" Full list of commands here: \"add, cleanup, remove, shuffle.\"");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " nextframe command...\n"));
- LOG_INFO(" Where command will be executed next frame of this VM\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " nextframe command...");
+ LOG_INFO(" Where command will be executed next frame of this VM");
return;
}
}
}
default:
- LOG_INFO("Incorrect parameters for ^2removefromlist^7\n");
+ LOG_INFO("Incorrect parameters for ^2removefromlist^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " removefromlist variable value\n"));
- LOG_INFO(" Where 'variable' is what cvar to remove 'value' from.\n");
- LOG_INFO("See also: ^2addtolist^7\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " removefromlist variable value");
+ LOG_INFO(" Where 'variable' is what cvar to remove 'value' from.");
+ LOG_INFO("See also: ^2addtolist^7");
return;
}
}
int NOTIF_MULTI_COUNT = 0; FOREACH(Notifications, it.nent_type == MSG_MULTI, { ++NOTIF_MULTI_COUNT; });
int NOTIF_CHOICE_COUNT = 0; FOREACH(Notifications, it.nent_type == MSG_CHOICE, { ++NOTIF_CHOICE_COUNT; });
LOG_INFOF(
- strcat(
- "Restart_Notifications(): Restarting %d notifications... ",
- "Counts: MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d\n"
- ),
+ (
+ "Restart_Notifications(): Restarting %d notifications... "
+ "Counts: MSG_ANNCE = %d, MSG_INFO = %d, MSG_CENTER = %d, MSG_MULTI = %d, MSG_CHOICE = %d"
+ ),
(
NOTIF_ANNCE_COUNT +
NOTIF_INFO_COUNT +
Destroy_All_Notifications();
CALL_ACCUMULATED_FUNCTION(RegisterNotifications);
#else
- LOG_INFO(_("Notification restart command only works with cl_cmd and sv_cmd.\n"));
+ LOG_INFO(_("Notification restart command only works with cl_cmd and sv_cmd."));
#endif
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " restartnotifs"));
- LOG_INFO(" No arguments required.\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " restartnotifs");
+ LOG_INFO(" No arguments required.");
return;
}
}
}
default:
- LOG_INFO("Incorrect parameters for ^2settemp^7\n");
+ LOG_INFO("Incorrect parameters for ^2settemp^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " settemp \"cvar\" \"arguments\"\n"));
- LOG_INFO(" Where 'cvar' is the cvar you want to temporarily set with 'arguments'.\n");
- LOG_INFO("See also: ^2settemp_restore^7\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " settemp \"cvar\" \"arguments\"");
+ LOG_INFO(" Where 'cvar' is the cvar you want to temporarily set with 'arguments'.");
+ LOG_INFO("See also: ^2settemp_restore^7");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " settemp_restore\n"));
- LOG_INFO(" No arguments required.\n");
- LOG_INFO("See also: ^2settemp^7\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " settemp_restore");
+ LOG_INFO(" No arguments required.");
+ LOG_INFO("See also: ^2settemp^7");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " [function to run]"));
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " [function to run]");
return;
}
}
void GenericCommand_macro_help()
{
- FOREACH(GENERIC_COMMANDS, true, LOG_INFOF(" ^2%s^7: %s\n", it.m_name, it.m_description));
+ FOREACH(GENERIC_COMMANDS, true, LOG_INFOF(" ^2%s^7: %s", it.m_name, it.m_description));
}
float GenericCommand_macro_command(float argc, string command)
--rpn_sp;
return rpn_stack[rpn_sp];
} else {
- LOG_INFO("rpn: stack underflow\n");
+ LOG_INFO("rpn: stack underflow");
rpn_error = true;
return "";
}
rpn_stack[rpn_sp] = s;
++rpn_sp;
} else {
- LOG_INFO("rpn: stack overflow\n");
+ LOG_INFO("rpn: stack overflow");
rpn_error = true;
}
}
if(rpn_sp > 0) {
return rpn_stack[rpn_sp - 1];
} else {
- LOG_INFO("rpn: empty stack\n");
+ LOG_INFO("rpn: empty stack");
rpn_error = true;
return "";
}
if(rpn_sp > 0) {
rpn_stack[rpn_sp - 1] = s;
} else {
- LOG_INFO("rpn: empty stack\n");
+ LOG_INFO("rpn: empty stack");
rpn_error = true;
}
}
}
else
{
- LOG_INFO("rpn: empty cvar name for 'def'\n");
+ LOG_INFO("rpn: empty cvar name for 'def'");
rpn_error = true;
}
} else if(rpncmd == "defs" || rpncmd == "@") {
}
else
{
- LOG_INFO("rpn: empty cvar name for 'defs'\n");
+ LOG_INFO("rpn: empty cvar name for 'defs'");
rpn_error = true;
}
} else if(rpncmd == "load") {
db_put(rpn_db, "stack.pos", ftos(i-2));
} else {
rpn_error = 1;
- LOG_INFO("rpn: database underflow\n");
+ LOG_INFO("rpn: database underflow");
}
} else if(rpncmd == "dbget") {
rpn_push(db_get(rpn_db, strcat("stack.", ftos(i-1))));
} else {
rpn_error = 1;
- LOG_INFO("rpn: database empty\n");
+ LOG_INFO("rpn: database empty");
}
} else if(rpncmd == "dblen") {
rpn_push(db_get(rpn_db, "stack.pointer"));
if(!j)
{
rpn_error = true;
- LOG_INFO("rpn: empty database\n");
+ LOG_INFO("rpn: empty database");
} else {
--j;
rpn_push(db_get(rpn_db, strcat("stack.", ftos(i))));
rpn_push(db_get(rpn_db, strcat("stack.", s)));
} else {
rpn_error = 1;
- LOG_INFO("rpn: empty database\n");
+ LOG_INFO("rpn: empty database");
}
} else if(rpncmd == "dbat") {
rpn_push(db_get(rpn_db, "stack.pos"));
{
if(i < 0 || i >= j)
{
- LOG_INFO("rpn: database cursor out of bounds\n");
+ LOG_INFO("rpn: database cursor out of bounds");
rpn_error = true;
}
if(!rpn_error)
if(!j)
{
rpn_error = true;
- LOG_INFO("rpn: empty database, cannot move cursor\n");
+ LOG_INFO("rpn: empty database, cannot move cursor");
}
if(!rpn_error)
{
j = stof(db_get(rpn_db, "stack.pointer"));
if(i < 0 || i >= j)
{
- LOG_INFO("rpn: database cursor destination out of bounds\n");
+ LOG_INFO("rpn: database cursor destination out of bounds");
rpn_error = true;
}
if(!rpn_error)
{
if (!fexists(s))
{
- LOG_INFO("rpn: ERROR: ", s, " does not exist!\n");
+ LOG_INFO("rpn: ERROR: ", s, " does not exist!");
rpn_error = true;
}
}
while(rpn_sp > 0)
{
s = rpn_pop();
- LOG_INFO("rpn: still on stack: ", s, "\n");
+ LOG_INFO("rpn: still on stack: ", s);
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " rpn EXPRESSION...\n"));
- LOG_INFO(" Operator description (x: string, s: set, f: float):\n");
- LOG_INFO(" x pop -----------------------------> : removes the top\n");
- LOG_INFO(" x dup -----------------------------> x x : duplicates the top\n");
- LOG_INFO(" x x exch --------------------------> x x : swap the top two\n");
- LOG_INFO(" /cvarname load --------------------> x : loads a cvar\n");
- LOG_INFO(" /cvarname x def -------------------> : writes to a cvar\n");
- LOG_INFO(" f f add|sub|mul|div|mod|pow -------> f : adds/... two numbers\n");
- LOG_INFO(" f f and|or|xor|bitand|bitor|bitxor > f : logical and bitwise operations\n");
- LOG_INFO(" f f eq|ne|gt|ge|lt|le|max|min -----> f : compares two numbers\n");
- LOG_INFO(" f neg|abs|sgn|rand|floor|ceil------> f : negates/... a number\n");
- LOG_INFO(" f not|bitnot ----------------------> f : logical and bitwise negation\n");
- LOG_INFO(" f exp|log|sin|cos -----------------> f : exponential function & Co.\n");
- LOG_INFO(" f f f bound -----------------------> f : bounds the middle number\n");
- LOG_INFO(" f1 f2 b when ----------------------> f : f1 if b, f2 otherwise\n");
- LOG_INFO(" s s union|intersection|difference -> s : set operations\n");
- LOG_INFO(" s shuffle -------------------------> s : randomly arrange elements\n");
- LOG_INFO(" /key /value put -------------------> : set a database key\n");
- LOG_INFO(" /key get --------------------------> s : get a database value\n");
- LOG_INFO(" x dbpush --------------------------> : pushes the top onto the database\n");
- LOG_INFO(" dbpop|dbget -----------------------> x : removes/reads DB's top\n");
- LOG_INFO(" dblen|dbat ------------------------> f : gets the DB's size/cursor pos\n");
- LOG_INFO(" dbclr -----------------------------> : clear the DB\n");
- LOG_INFO(" s dbsave|dbload--------------------> : save/load the DB to/from a file\n");
- LOG_INFO(" x dbins ---------------------------> : moves the top into the DB\n");
- LOG_INFO(" dbext|dbread ----------------------> x : extract/get from the DB's cursor\n");
- LOG_INFO(" f dbmov|dbgoto --------------------> : move or set the DB's cursor\n");
- LOG_INFO(" s localtime -----------------------> s : formats the current local time\n");
- LOG_INFO(" s gmtime --------------------------> s : formats the current UTC time\n");
- LOG_INFO(" time ------------------------------> f : seconds since VM start\n");
- LOG_INFO(" s /MD4 digest ---------------------> s : MD4 digest\n");
- LOG_INFO(" s /SHA256 digest ------------------> s : SHA256 digest\n");
- LOG_INFO(" s /formatstring sprintf1s ---------> s : sprintf with 1 string (pad, cut)\n");
- LOG_INFO(" s eval ----------------------------> : does something eval\n");
- LOG_INFO(" Set operations operate on 'such''strings'.\n");
- LOG_INFO(" Unknown tokens insert their cvar value.\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " rpn EXPRESSION...");
+ LOG_INFO(" Operator description (x: string, s: set, f: float):");
+ LOG_INFO(" x pop -----------------------------> : removes the top");
+ LOG_INFO(" x dup -----------------------------> x x : duplicates the top");
+ LOG_INFO(" x x exch --------------------------> x x : swap the top two");
+ LOG_INFO(" /cvarname load --------------------> x : loads a cvar");
+ LOG_INFO(" /cvarname x def -------------------> : writes to a cvar");
+ LOG_INFO(" f f add|sub|mul|div|mod|pow -------> f : adds/... two numbers");
+ LOG_INFO(" f f and|or|xor|bitand|bitor|bitxor > f : logical and bitwise operations");
+ LOG_INFO(" f f eq|ne|gt|ge|lt|le|max|min -----> f : compares two numbers");
+ LOG_INFO(" f neg|abs|sgn|rand|floor|ceil------> f : negates/... a number");
+ LOG_INFO(" f not|bitnot ----------------------> f : logical and bitwise negation");
+ LOG_INFO(" f exp|log|sin|cos -----------------> f : exponential function & Co.");
+ LOG_INFO(" f f f bound -----------------------> f : bounds the middle number");
+ LOG_INFO(" f1 f2 b when ----------------------> f : f1 if b, f2 otherwise");
+ LOG_INFO(" s s union|intersection|difference -> s : set operations");
+ LOG_INFO(" s shuffle -------------------------> s : randomly arrange elements");
+ LOG_INFO(" /key /value put -------------------> : set a database key");
+ LOG_INFO(" /key get --------------------------> s : get a database value");
+ LOG_INFO(" x dbpush --------------------------> : pushes the top onto the database");
+ LOG_INFO(" dbpop|dbget -----------------------> x : removes/reads DB's top");
+ LOG_INFO(" dblen|dbat ------------------------> f : gets the DB's size/cursor pos");
+ LOG_INFO(" dbclr -----------------------------> : clear the DB");
+ LOG_INFO(" s dbsave|dbload--------------------> : save/load the DB to/from a file");
+ LOG_INFO(" x dbins ---------------------------> : moves the top into the DB");
+ LOG_INFO(" dbext|dbread ----------------------> x : extract/get from the DB's cursor");
+ LOG_INFO(" f dbmov|dbgoto --------------------> : move or set the DB's cursor");
+ LOG_INFO(" s localtime -----------------------> s : formats the current local time");
+ LOG_INFO(" s gmtime --------------------------> s : formats the current UTC time");
+ LOG_INFO(" time ------------------------------> f : seconds since VM start");
+ LOG_INFO(" s /MD4 digest ---------------------> s : MD4 digest");
+ LOG_INFO(" s /SHA256 digest ------------------> s : SHA256 digest");
+ LOG_INFO(" s /formatstring sprintf1s ---------> s : sprintf with 1 string (pad, cut)");
+ LOG_INFO(" s eval ----------------------------> : does something eval");
+ LOG_INFO(" Set operations operate on 'such''strings'.");
+ LOG_INFO(" Unknown tokens insert their cvar value.");
return;
}
}
e.debug = true;
--rem;
}
- LOG_INFOF("%d server entities sent\n", n - rem);
+ LOG_INFOF("%d server entities sent", n - rem);
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " debugdraw_sv"));
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " debugdraw_sv");
return;
}
}
int bufhandle = stof(argv(1));
int string_index = stof(argv(2));
string s = bufstr_get(bufhandle, string_index);
- LOG_INFOF("%s\n", s);
+ LOG_INFOF("%s", s);
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " bufstr_get bufhandle string_index"));
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " bufstr_get bufhandle string_index");
return;
}
}
{
case CMD_REQUEST_COMMAND:
{
- LOG_INFO(WATERMARK "\n");
+ LOG_INFO(WATERMARK);
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " version"));
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " version");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " cvar_localchanges"));
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " cvar_localchanges");
return;
}
}
int entcnt = 0;
FOREACH_ENTITY_CLASS_ORDERED(argv(1), true,
{
- LOG_INFOF("%i (%s)\n", it, it.classname);
+ LOG_INFOF("%i (%s)", it, it.classname);
++entcnt;
});
if(entcnt)
- LOG_INFOF("Found %d entities\n", entcnt);
+ LOG_INFOF("Found %d entities", entcnt);
return;
}
default:
{
- LOG_INFO("Incorrect parameters for ^2find^7\n");
+ LOG_INFO("Incorrect parameters for ^2find^7");
}
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 " GetProgramCommandPrefix() " find classname\n");
- LOG_INFO(" Where 'classname' is the classname to search for.\n");
+ LOG_INFO("Usage:^3 " GetProgramCommandPrefix() " find classname");
+ LOG_INFO(" Where 'classname' is the classname to search for.");
return;
}
}
case CMD_REQUEST_COMMAND:
{
vector match = stov(argv(1));
- FOREACH_ENTITY_ORDERED(it.origin == match, LOG_INFOF("%i (%s)\n", it, it.classname));
+ FOREACH_ENTITY_ORDERED(it.origin == match, LOG_INFOF("%i (%s)", it, it.classname));
return;
}
default:
- LOG_INFO("Incorrect parameters for ^2findat^7\n");
+ LOG_INFO("Incorrect parameters for ^2findat^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 " GetProgramCommandPrefix() " findat \"0 0 0\"\n");
+ LOG_INFO("Usage:^3 " GetProgramCommandPrefix() " findat \"0 0 0\"");
return;
}
}
int fh = fopen(filename, FILE_WRITE);
if (fh >= 0) {
effectinfo_dump(fh, alsoprint);
- LOG_INFOF("Dumping effectinfo... File located at ^2data/data/%s^7.\n", filename);
- LOG_INFOF("Reload with ^2cl_particles_reloadeffects data/%s^7.\n", filename);
+ LOG_INFOF("Dumping effectinfo... File located at ^2data/data/%s^7.", filename);
+ LOG_INFOF("Reload with ^2cl_particles_reloadeffects data/%s^7.", filename);
fclose(fh);
} else {
LOG_WARNF("Could not open file '%s'!", filename);
}
default:
case CMD_REQUEST_USAGE: {
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpeffectinfo [filename]"));
- LOG_INFO(" Where 'filename' is the file to write (default is effectinfo_dump.txt),\n");
- LOG_INFO(" if supplied with '-' output to console as well as default,\n");
- LOG_INFO(" if left blank, it will only write to default.\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpeffectinfo [filename]");
+ LOG_INFO(" Where 'filename' is the file to write (default is effectinfo_dump.txt),");
+ LOG_INFO(" if supplied with '-' output to console as well as default,");
+ LOG_INFO(" if left blank, it will only write to default.");
return;
}
}
// generated file; do not modify
+#include <common/gamemodes/rules.qc>
+#ifdef SVQC
+ #include <common/gamemodes/sv_rules.qc>
+#endif
#include <common/gamemodes/gamemode/_mod.inc>
// generated file; do not modify
+#include <common/gamemodes/rules.qh>
+#ifdef SVQC
+ #include <common/gamemodes/sv_rules.qh>
+#endif
#include <common/gamemodes/gamemode/_mod.qh>
// generated file; do not modify
#include <common/gamemodes/gamemode/nexball/nexball.qc>
#include <common/gamemodes/gamemode/nexball/weapon.qc>
+#ifdef SVQC
+ #include <common/gamemodes/gamemode/nexball/sv_weapon.qc>
+#endif
// generated file; do not modify
#include <common/gamemodes/gamemode/nexball/nexball.qh>
#include <common/gamemodes/gamemode/nexball/weapon.qh>
+#ifdef SVQC
+ #include <common/gamemodes/gamemode/nexball/sv_weapon.qh>
+#endif
#ifdef SVQC
.float metertime = _STAT(NB_METERSTART);
+.entity ballcarried;
+
int autocvar_g_nexball_goalleadlimit;
#define autocvar_g_nexball_goallimit cvar("g_nexball_goallimit")
return e.team;
}
-const float ST_NEXBALL_GOALS = 1;
+const int ST_NEXBALL_GOALS = 1;
void nb_ScoreRules(int teams)
{
- ScoreRules_basics(teams, 0, 0, true);
- ScoreInfo_SetLabel_TeamScore( ST_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore( SP_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER);
- ScoreRules_basics_end();
+ GameRules_scoring(teams, 0, 0, {
+ field_team(ST_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY);
+ field(SP_NEXBALL_GOALS, "goals", SFL_SORT_PRIO_PRIMARY);
+ field(SP_NEXBALL_FAULTS, "faults", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER);
+ });
}
void LogNB(string mode, entity actor)
tracebox(this.origin, BALL_MINS, BALL_MAXS, this.origin, true, this);
if(trace_startsolid)
{
- vector o;
- o = this.origin;
- if(!move_out_of_solid(this))
+ vector o = this.origin;
+ if (!move_out_of_solid(this)) {
objerror(this, "could not get out of solid at all!");
- LOG_INFO("^1NOTE: this map needs FIXING. ", this.classname, " at ", vtos(o - '0 0 1'));
- LOG_INFO(" needs to be moved out of solid, e.g. by '", ftos(this.origin.x - o.x));
- LOG_INFO(" ", ftos(this.origin.y - o.y));
- LOG_INFO(" ", ftos(this.origin.z - o.z), "'\n");
+ }
+ LOG_INFOF(
+ "^1NOTE: this map needs FIXING. %s at %s needs to be moved out of solid, e.g. by %s",
+ this.classname,
+ vtos(o - '0 0 1'),
+ vtos(this.origin - o)
+ );
this.origin = o;
}
}
{
ownr.effects &= ~autocvar_g_nexball_basketball_effects_default;
ownr.ballcarried = NULL;
+ GameRules_scoring_vip(ownr, false);
if(ownr.metertime)
{
ownr.metertime = 0;
ball.weaponentity_fld = weaponentity;
ball.team = plyr.team;
plyr.ballcarried = ball;
+ GameRules_scoring_vip(plyr, true);
ball.nb_dropper = plyr;
plyr.effects |= autocvar_g_nexball_basketball_effects_default;
WaypointSprite_Spawn(WP_NbBall, 0, 0, ball, '0 0 64', NULL, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER); // no health bar please
WaypointSprite_UpdateRule(ball.waypointsprite_attachedforcarrier, 0, SPRITERULE_DEFAULT);
- ball.owner.ballcarried = NULL;
- ball.owner = NULL;
+ entity e = ball.owner; ball.owner = NULL;
+ e.ballcarried = NULL;
+ GameRules_scoring_vip(e, false);
}
void InitBall(entity this)
if(isclient)
{
if(pscore > 0)
- PlayerScore_Add(ball.pusher, SP_NEXBALL_GOALS, pscore);
+ GameRules_scoring_add(ball.pusher, NEXBALL_GOALS, pscore);
else if(pscore < 0)
- PlayerScore_Add(ball.pusher, SP_NEXBALL_FAULTS, -pscore);
+ GameRules_scoring_add(ball.pusher, NEXBALL_FAULTS, -pscore);
}
if(ball.owner) // Happens on spawnflag GOAL_TOUCHPLAYER
spawnfunc_nexball_out(this);
}
-//=======================//
-// Weapon code //
-//=======================//
-
-
-void W_Nexball_Think(entity this)
-{
- //dprint("W_Nexball_Think\n");
- //vector new_dir = steerlib_arrive(this.enemy.origin, 2500);
- vector new_dir = normalize(this.enemy.origin + '0 0 50' - this.origin);
- vector old_dir = normalize(this.velocity);
- float _speed = vlen(this.velocity);
- vector new_vel = normalize(old_dir + (new_dir * autocvar_g_nexball_safepass_turnrate)) * _speed;
- //vector new_vel = (new_dir * autocvar_g_nexball_safepass_turnrate
-
- this.velocity = new_vel;
-
- this.nextthink = time;
-}
-
-void W_Nexball_Touch(entity this, entity toucher)
-{
- entity ball, attacker;
- attacker = this.owner;
- //this.think = func_null;
- //this.enemy = NULL;
-
- PROJECTILE_TOUCH(this, toucher);
- if(attacker.team != toucher.team || autocvar_g_nexball_basketball_teamsteal)
- if((ball = toucher.ballcarried) && !STAT(FROZEN, toucher) && !IS_DEAD(toucher) && (IS_PLAYER(attacker)))
- {
- toucher.velocity = toucher.velocity + normalize(this.velocity) * toucher.damageforcescale * autocvar_g_balance_nexball_secondary_force;
- UNSET_ONGROUND(toucher);
- if(!attacker.ballcarried)
- {
- LogNB("stole", attacker);
- _sound(toucher, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM);
-
- if(SAME_TEAM(attacker, toucher) && time > CS(attacker).teamkill_complain)
- {
- CS(attacker).teamkill_complain = time + 5;
- CS(attacker).teamkill_soundtime = time + 0.4;
- CS(attacker).teamkill_soundsource = toucher;
- }
-
- GiveBall(attacker, toucher.ballcarried);
- }
- }
- delete(this);
-}
-
-void W_Nexball_Attack(entity actor, .entity weaponentity, float t)
-{
- entity ball;
- float mul, mi, ma;
- if(!(ball = actor.ballcarried))
- return;
-
- W_SetupShot(actor, weaponentity, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
- tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, NULL);
- if(trace_startsolid)
- {
- if(actor.metertime)
- actor.metertime = 0; // Shot failed, hide the power meter
- return;
- }
-
- //Calculate multiplier
- if(t < 0)
- mul = 1;
- else
- {
- mi = autocvar_g_nexball_basketball_meter_minpower;
- ma = max(mi, autocvar_g_nexball_basketball_meter_maxpower); // avoid confusion
- //One triangle wave period with 1 as max
- mul = 2 * (t % g_nexball_meter_period) / g_nexball_meter_period;
- if(mul > 1)
- mul = 2 - mul;
- mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
- }
-
- DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(actor, actor.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
-
-
- //TODO: use the speed_up cvar too ??
-}
-
-vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
-
-void W_Nexball_Attack2(entity actor, .entity weaponentity)
-{
- if(actor.ballcarried.enemy)
- {
- entity _ball = actor.ballcarried;
- W_SetupShot(actor, weaponentity, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
- DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
- setthink(_ball, W_Nexball_Think);
- _ball.nextthink = time;
- return;
- }
-
- if(!autocvar_g_nexball_tackling)
- return;
-
- W_SetupShot(actor, weaponentity, false, 2, SND_NB_SHOOT2, CH_WEAPON_A, 0);
- entity missile = new(ballstealer);
-
- missile.owner = actor;
-
- set_movetype(missile, MOVETYPE_FLY);
- PROJECTILE_MAKETRIGGER(missile);
-
- //setmodel(missile, "models/elaser.mdl"); // precision set below
- setsize(missile, '0 0 0', '0 0 0');
- setorigin(missile, w_shotorg);
-
- W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0);
- missile.angles = vectoangles(missile.velocity);
- settouch(missile, W_Nexball_Touch);
- setthink(missile, SUB_Remove);
- missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
-
- missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
- missile.flags = FL_PROJECTILE;
- IL_PUSH(g_projectiles, missile);
- IL_PUSH(g_bot_dodge, missile);
-
- CSQCProjectile(missile, true, PROJECTILE_ELECTRO, true);
-}
-
bool ball_customize(entity this, entity client)
{
if(!this.owner)
return true;
}
-METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity weaponentity, int fire))
-{
- TC(BallStealer, thiswep);
- if(fire & 1)
- if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
- if(autocvar_g_nexball_basketball_meter)
- {
- if(actor.ballcarried && !actor.metertime)
- actor.metertime = time;
- else
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
- }
- else
- {
- W_Nexball_Attack(actor, weaponentity, -1);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
- }
- if(fire & 2)
- if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_nexball_secondary_refire))
- {
- W_Nexball_Attack2(actor, weaponentity);
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
- }
-
- if(!(fire & 1) && actor.metertime && actor.ballcarried)
- {
- W_Nexball_Attack(actor, weaponentity, time - actor.metertime);
- // DropBall or stealing will set metertime back to 0
- weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
- }
-}
-
-METHOD(BallStealer, wr_setup, void(BallStealer this, entity actor, .entity weaponentity))
-{
- TC(BallStealer, this);
- //weapon_setup(WEP_PORTO.m_id);
-}
-
-METHOD(BallStealer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
-{
- TC(BallStealer, this);
-}
-
-METHOD(BallStealer, wr_checkammo1, bool(BallStealer this, entity actor, .entity weaponentity))
-{
- TC(BallStealer, this);
- return true;
-}
-
-METHOD(BallStealer, wr_checkammo2, bool(BallStealer this, entity actor, .entity weaponentity))
-{
- TC(BallStealer, this);
- return true;
-}
-
void nb_DropBall(entity player)
{
if(player.ballcarried && g_nexball)
REGISTER_MUTATOR(nb, g_nexball)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
g_nexball_meter_period = autocvar_g_nexball_meter_period;
InitializeEntity(NULL, nb_delayedinit, INITPRIO_GAMETYPE);
WEP_NEXBALL.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
- ActivateTeamplay();
- SetLimits(autocvar_g_nexball_goallimit, autocvar_g_nexball_goalleadlimit, autocvar_timelimit_override, -1);
- have_team_spawns = -1; // request team spawns
+ GameRules_teams(true);
+ GameRules_limit_score(autocvar_g_nexball_goallimit);
+ GameRules_limit_lead(autocvar_g_nexball_goalleadlimit);
}
MUTATOR_ONROLLBACK_OR_REMOVE
{
WEP_NEXBALL.spawnflags |= WEP_FLAG_MUTATORBLOCKED;
- // we actually cannot roll back nb_delayedinit here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
}
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
- }
-
return 0;
}
--- /dev/null
+#include "sv_weapon.qh"
+
+void W_Nexball_Attack(entity actor, .entity weaponentity, float t);
+void W_Nexball_Attack2(entity actor, .entity weaponentity);
+vector trigger_push_calculatevelocity(vector org, entity tgt, float ht);
+
+METHOD(BallStealer, wr_think, void(BallStealer thiswep, entity actor, .entity weaponentity, int fire))
+{
+ TC(BallStealer, thiswep);
+ if(fire & 1)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, false, autocvar_g_balance_nexball_primary_refire))
+ if(autocvar_g_nexball_basketball_meter)
+ {
+ if(actor.ballcarried && !actor.metertime)
+ actor.metertime = time;
+ else
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+ }
+ else
+ {
+ W_Nexball_Attack(actor, weaponentity, -1);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+ }
+ if(fire & 2)
+ if(weapon_prepareattack(thiswep, actor, weaponentity, true, autocvar_g_balance_nexball_secondary_refire))
+ {
+ W_Nexball_Attack2(actor, weaponentity);
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE2, autocvar_g_balance_nexball_secondary_animtime, w_ready);
+ }
+
+ if(!(fire & 1) && actor.metertime && actor.ballcarried)
+ {
+ W_Nexball_Attack(actor, weaponentity, time - actor.metertime);
+ // DropBall or stealing will set metertime back to 0
+ weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, autocvar_g_balance_nexball_primary_animtime, w_ready);
+ }
+}
+
+METHOD(BallStealer, wr_setup, void(BallStealer this, entity actor, .entity weaponentity))
+{
+ TC(BallStealer, this);
+ //weapon_setup(WEP_PORTO.m_id);
+}
+
+METHOD(BallStealer, wr_reload, void(entity thiswep, entity actor, .entity weaponentity))
+{
+ TC(BallStealer, this);
+}
+
+METHOD(BallStealer, wr_checkammo1, bool(BallStealer this, entity actor, .entity weaponentity))
+{
+ TC(BallStealer, this);
+ return true;
+}
+
+METHOD(BallStealer, wr_checkammo2, bool(BallStealer this, entity actor, .entity weaponentity))
+{
+ TC(BallStealer, this);
+ return true;
+}
+
+void W_Nexball_Think(entity this)
+{
+ //dprint("W_Nexball_Think\n");
+ //vector new_dir = steerlib_arrive(this.enemy.origin, 2500);
+ vector new_dir = normalize(this.enemy.origin + '0 0 50' - this.origin);
+ vector old_dir = normalize(this.velocity);
+ float _speed = vlen(this.velocity);
+ vector new_vel = normalize(old_dir + (new_dir * autocvar_g_nexball_safepass_turnrate)) * _speed;
+ //vector new_vel = (new_dir * autocvar_g_nexball_safepass_turnrate
+
+ this.velocity = new_vel;
+
+ this.nextthink = time;
+}
+
+void W_Nexball_Touch(entity this, entity toucher)
+{
+ entity ball, attacker;
+ attacker = this.owner;
+ //this.think = func_null;
+ //this.enemy = NULL;
+
+ PROJECTILE_TOUCH(this, toucher);
+ if(attacker.team != toucher.team || autocvar_g_nexball_basketball_teamsteal)
+ if((ball = toucher.ballcarried) && !STAT(FROZEN, toucher) && !IS_DEAD(toucher) && (IS_PLAYER(attacker)))
+ {
+ toucher.velocity = toucher.velocity + normalize(this.velocity) * toucher.damageforcescale * autocvar_g_balance_nexball_secondary_force;
+ UNSET_ONGROUND(toucher);
+ if(!attacker.ballcarried)
+ {
+ LogNB("stole", attacker);
+ _sound(toucher, CH_TRIGGER, ball.noise2, VOL_BASE, ATTEN_NORM);
+
+ if(SAME_TEAM(attacker, toucher) && time > CS(attacker).teamkill_complain)
+ {
+ CS(attacker).teamkill_complain = time + 5;
+ CS(attacker).teamkill_soundtime = time + 0.4;
+ CS(attacker).teamkill_soundsource = toucher;
+ }
+
+ GiveBall(attacker, toucher.ballcarried);
+ }
+ }
+ delete(this);
+}
+
+void W_Nexball_Attack(entity actor, .entity weaponentity, float t)
+{
+ entity ball;
+ float mul, mi, ma;
+ if(!(ball = actor.ballcarried))
+ return;
+
+ W_SetupShot(actor, weaponentity, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
+ tracebox(w_shotorg, BALL_MINS, BALL_MAXS, w_shotorg, MOVE_WORLDONLY, NULL);
+ if(trace_startsolid)
+ {
+ if(actor.metertime)
+ actor.metertime = 0; // Shot failed, hide the power meter
+ return;
+ }
+
+ //Calculate multiplier
+ if(t < 0)
+ mul = 1;
+ else
+ {
+ mi = autocvar_g_nexball_basketball_meter_minpower;
+ ma = max(mi, autocvar_g_nexball_basketball_meter_maxpower); // avoid confusion
+ //One triangle wave period with 1 as max
+ mul = 2 * (t % g_nexball_meter_period) / g_nexball_meter_period;
+ if(mul > 1)
+ mul = 2 - mul;
+ mul = mi + (ma - mi) * mul; // range from the minimal power to the maximal power
+ }
+
+ DropBall(ball, w_shotorg, W_CalculateProjectileVelocity(actor, actor.velocity, w_shotdir * autocvar_g_balance_nexball_primary_speed * mul, false));
+
+
+ //TODO: use the speed_up cvar too ??
+}
+
+void W_Nexball_Attack2(entity actor, .entity weaponentity)
+{
+ if(actor.ballcarried.enemy)
+ {
+ entity _ball = actor.ballcarried;
+ W_SetupShot(actor, weaponentity, false, 4, SND_NB_SHOOT1, CH_WEAPON_A, 0);
+ DropBall(_ball, w_shotorg, trigger_push_calculatevelocity(_ball.origin, _ball.enemy, 32));
+ setthink(_ball, W_Nexball_Think);
+ _ball.nextthink = time;
+ return;
+ }
+
+ if(!autocvar_g_nexball_tackling)
+ return;
+
+ W_SetupShot(actor, weaponentity, false, 2, SND_NB_SHOOT2, CH_WEAPON_A, 0);
+ entity missile = new(ballstealer);
+
+ missile.owner = actor;
+
+ set_movetype(missile, MOVETYPE_FLY);
+ PROJECTILE_MAKETRIGGER(missile);
+
+ //setmodel(missile, "models/elaser.mdl"); // precision set below
+ setsize(missile, '0 0 0', '0 0 0');
+ setorigin(missile, w_shotorg);
+
+ W_SetupProjVelocity_Basic(missile, autocvar_g_balance_nexball_secondary_speed, 0);
+ missile.angles = vectoangles(missile.velocity);
+ settouch(missile, W_Nexball_Touch);
+ setthink(missile, SUB_Remove);
+ missile.nextthink = time + autocvar_g_balance_nexball_secondary_lifetime; //FIXME: use a distance instead?
+
+ missile.effects = EF_BRIGHTFIELD | EF_LOWPRECISION;
+ missile.flags = FL_PROJECTILE;
+ IL_PUSH(g_projectiles, missile);
+ IL_PUSH(g_bot_dodge, missile);
+
+ CSQCProjectile(missile, true, PROJECTILE_ELECTRO, true);
+}
--- /dev/null
+#pragma once
pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_CPDESTROYED), this.owner.message, attacker.netname);
- PlayerScore_Add(attacker, SP_ONS_TAKES, 1);
- PlayerScore_Add(attacker, SP_SCORE, 10);
+ GameRules_scoring_add(attacker, ONS_TAKES, 1);
+ GameRules_scoring_add(attacker, SCORE, 10);
this.owner.goalentity = NULL;
this.owner.islinked = false;
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_ONSLAUGHT_CAPTURE, this.owner.ons_toucher.netname, this.owner.message);
Send_Notification(NOTIF_ALL_EXCEPT, this.owner.ons_toucher, MSG_CENTER, APP_TEAM_NUM(this.owner.ons_toucher.team, CENTER_ONS_CAPTURE_TEAM), this.owner.message);
Send_Notification(NOTIF_ONE, this.owner.ons_toucher, MSG_CENTER, CENTER_ONS_CAPTURE, this.owner.message);
- PlayerScore_Add(this.owner.ons_toucher, SP_ONS_CAPS, 1);
- PlayerTeamScore_AddScore(this.owner.ons_toucher, 10);
+ GameRules_scoring_add(this.owner.ons_toucher, ONS_CAPS, 1);
+ GameRules_scoring_add_team(this.owner.ons_toucher, SCORE, 10);
}
this.owner.ons_toucher = NULL;
else
{
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(this.team, INFO_ONSLAUGHT_GENDESTROYED));
- PlayerScore_Add(attacker, SP_SCORE, 100);
+ GameRules_scoring_add(attacker, SCORE, 100);
}
this.iscaptured = false;
this.islinked = false;
if(c2 >= 0) teams |= BIT(1);
if(c3 >= 0) teams |= BIT(2);
if(c4 >= 0) teams |= BIT(3);
- ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
- ScoreInfo_SetLabel_TeamScore (ST_ONS_CAPS, "destroyed", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore(SP_ONS_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
- ScoreInfo_SetLabel_PlayerScore(SP_ONS_TAKES, "takes", 0);
- ScoreRules_basics_end();
+ GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, 0, {
+ field_team(ST_ONS_CAPS, "destroyed", SFL_SORT_PRIO_PRIMARY);
+ field(SP_ONS_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
+ field(SP_ONS_TAKES, "takes", 0);
+ });
}
void ons_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up
REGISTER_MUTATOR(ons, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- ons_Initialize();
-
- ActivateTeamplay();
- SetLimits(autocvar_g_onslaught_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
- have_team_spawns = -1; // request team spawns
- }
+ GameRules_teams(true);
+ GameRules_limit_score(autocvar_g_onslaught_point_limit);
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back ons_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
+ ons_Initialize();
}
-
return false;
}
--- /dev/null
+#include "rules.qh"
--- /dev/null
+#pragma once
+
+#ifdef SVQC
+#include <common/gamemodes/sv_rules.qh>
+#endif
--- /dev/null
+#include "sv_rules.qh"
+
+#include <server/teamplay.qh>
+
+void GameRules_teams(bool value)
+{
+ if (value) {
+ serverflags |= SERVERFLAG_TEAMPLAY;
+ teamplay = 1;
+ cvar_set("teamplay", "2"); // DP needs this for sending proper getstatus replies.
+ GameRules_spawning_teams(true);
+ } else {
+ serverflags &= ~SERVERFLAG_TEAMPLAY;
+ teamplay = 0;
+ cvar_set("teamplay", "0"); // DP needs this for sending proper getstatus replies.
+ GameRules_spawning_teams(false);
+ }
+}
+
+void GameRules_spawning_teams(bool value)
+{
+ have_team_spawns = value ? -1 : 0;
+}
+
+bool _GameRules_score_enabled = true;
+void GameRules_score_enabled(bool value)
+{
+ _GameRules_score_enabled = value;
+}
+
+bool GameRules_limit_score_initialized;
+void GameRules_limit_score(int limit)
+{
+ if (GameRules_limit_score_initialized) return;
+ if (autocvar_g_campaign) return;
+ if (limit < 0) return;
+ cvar_set("fraglimit", ftos(limit));
+ GameRules_limit_score_initialized = true;
+}
+
+bool GameRules_limit_lead_initialized;
+void GameRules_limit_lead(int limit)
+{
+ if (GameRules_limit_lead_initialized) return;
+ if (autocvar_g_campaign) return;
+ if (limit < 0) return;
+ cvar_set("leadlimit", ftos(limit));
+ GameRules_limit_lead_initialized = true;
+}
+
+bool GameRules_limit_time_initialized;
+void GameRules_limit_time(int limit)
+{
+ if (GameRules_limit_time_initialized) return;
+ if (autocvar_g_campaign) return;
+ if (limit < 0) return;
+ cvar_set("timelimit", ftos(limit));
+ GameRules_limit_time_initialized = true;
+}
+
+bool GameRules_limit_time_qualifying_initialized;
+void GameRules_limit_time_qualifying(int limit)
+{
+ if (GameRules_limit_time_qualifying_initialized) return;
+ if (autocvar_g_campaign) return;
+ if (limit < 0) return;
+ cvar_set("g_race_qualifying_timelimit", ftos(limit));
+ GameRules_limit_time_qualifying_initialized = true;
+}
+
+void GameRules_limit_fallbacks()
+{
+ GameRules_limit_score(autocvar_fraglimit_override);
+ GameRules_limit_lead(autocvar_leadlimit_override);
+ GameRules_limit_time(autocvar_timelimit_override);
+}
+
+void _GameRules_scoring_begin(int teams, float spprio, float stprio)
+{
+ ScoreRules_basics(teams, spprio, stprio, _GameRules_score_enabled);
+}
+void _GameRules_scoring_field(entity i, string label, int scoreflags)
+{
+ ScoreInfo_SetLabel_PlayerScore(i, label, scoreflags);
+}
+void _GameRules_scoring_field_team(float i, string label, int scoreflags)
+{
+ ScoreInfo_SetLabel_TeamScore(i, label, scoreflags);
+}
+void _GameRules_scoring_end()
+{
+ ScoreRules_basics_end();
+}
+
+.bool m_GameRules_scoring_vip;
+void GameRules_scoring_vip(entity player, bool value)
+{
+ player.m_GameRules_scoring_vip = value;
+}
+bool GameRules_scoring_is_vip(entity player)
+{
+ return player.m_GameRules_scoring_vip;
+}
+
+float _GameRules_scoring_add(entity client, entity sp, float value)
+{
+ return PlayerScore_Add(client, sp, value);
+}
+float _GameRules_scoring_add_team(entity client, entity sp, int st, float value)
+{
+ return PlayerTeamScore_Add(client, sp, st, value);
+}
--- /dev/null
+#pragma once
+
+// todo: accept the number of teams as a parameter
+void GameRules_teams(bool value);
+
+/**
+ * Used to disable team spawns in team modes
+ */
+void GameRules_spawning_teams(bool value);
+
+/**
+ * Disabling score disables the "score" column on the scoreboard
+ */
+void GameRules_score_enabled(bool value);
+
+void GameRules_limit_score(int limit);
+void GameRules_limit_lead(int limit);
+void GameRules_limit_time(int limit);
+void GameRules_limit_time_qualifying(int limit);
+
+/**
+ * Set any unspecified rules to their defaults
+ */
+void GameRules_limit_fallbacks();
+
+/**
+ * @param teams a bitmask of active teams
+ * @param spprio player score priority (if frags aren't enabled)
+ * @param stprio team score priority (if frags aren't enabled)
+ */
+#define GameRules_scoring(teams, spprio, stprio, fields) MACRO_BEGIN { \
+ _GameRules_scoring_begin((teams), (spprio), (stprio)); \
+ noref void(entity, string, float) field = _GameRules_scoring_field; \
+ /* todo: just have the one `field` function */ \
+ noref void(int, string, float) field_team = _GameRules_scoring_field_team; \
+ LAMBDA(fields); \
+ _GameRules_scoring_end(); \
+} MACRO_END
+
+void _GameRules_scoring_begin(int teams, float spprio, float stprio);
+void _GameRules_scoring_field(entity i, string label, int scoreflags);
+void _GameRules_scoring_field_team(float i, string label, int scoreflags);
+void _GameRules_scoring_end();
+
+/**
+ * Mark a player as being 'important' (flag carrier, ball carrier, etc)
+ * @param player the entity to mark
+ * @param value VIP status
+ */
+void GameRules_scoring_vip(entity player, bool value);
+bool GameRules_scoring_is_vip(entity player);
+
+#define GameRules_scoring_add(client, fld, value) _GameRules_scoring_add(client, SP_##fld, value)
+float _GameRules_scoring_add(entity client, entity sp, float value);
+#define GameRules_scoring_add_team(client, fld, value) _GameRules_scoring_add_team(client, SP_##fld, ST_##fld, value)
+float _GameRules_scoring_add_team(entity client, entity sp, int st, float value);
}
default:
case CMD_REQUEST_USAGE: {
- LOG_INFOF("\nUsage:^3 %s dumpitems", GetProgramCommandPrefix());
+ LOG_INFOF("Usage:^3 %s dumpitems", GetProgramCommandPrefix());
return;
}
}
METHOD(GameItem, show, void(GameItem this))
{
TC(GameItem, this);
- LOG_INFO("A game item\n");
+ LOG_INFO("A game item");
}
void ITEM_HANDLE(Show, GameItem this) { this.show(this); }
ENDCLASS(GameItem)
METHOD(Pickup, show, void(Pickup this))
{
TC(Pickup, this);
- LOG_INFOF("%s: %s\n", etos(this), this.m_name);
+ LOG_INFOF("%s: %s", etos(this), this.m_name);
}
ATTRIB(Pickup, m_itemid, int, 0);
#ifdef SVQC
}
if(fh < 0)
return 0;
- LOG_INFO("Analyzing ", fn, " to generate initial mapinfo\n");
+ LOG_INFO("Analyzing ", fn, " to generate initial mapinfo");
inWorldspawn = 2;
MapInfo_Map_flags = 0;
// MapInfo_SwitchGameType(MAPINFO_TYPE_DEATHMATCH.m_flags);
//}
- LOG_INFO("Switching to map ", s, "\n");
+ LOG_INFO("Switching to map ", s);
cvar_settemp_restore();
if(reinit)
entity dozer = bd_find_dozer(minigame);
if(!dozer)
{
- LOG_INFO("Dozer wasn't found!\n");
+ LOG_INFO("Dozer wasn't found!");
return; // should not happen... TODO: end match?
}
if(boulder_count != target_count)
{
- LOG_INFO("Not enough targets or boulders, fix your level!\n");
+ LOG_INFO("Not enough targets or boulders, fix your level!");
return false;
}
file_get = fopen(file_name, FILE_READ);
if(file_get < 0)
{
- LOG_INFO("^3BULLDOZER: ^7could not find storage file ^3", file_name, "^7, no items were loaded\n");
+ LOG_INFO("^3BULLDOZER: ^7could not find storage file ^3", file_name, "^7, no items were loaded");
}
else
{
entity dozer = bd_find_dozer(minigame);
if(!dozer)
{
- LOG_INFO("You need to place a bulldozer on the level to save it!\n");
+ LOG_INFO("You need to place a bulldozer on the level to save it!");
return;
}
}
else
{
- LOG_INFO("You need to set the level name!\n");
+ LOG_INFO("You need to set the level name!");
return;
}
}
if(IS_PLAYER(attacker))
if(autocvar_g_monsters_score_spawned || !((this.spawnflags & MONSTERFLAG_SPAWNED) || (this.spawnflags & MONSTERFLAG_RESPAWNED)))
- PlayerScore_Add(attacker, SP_SCORE, +autocvar_g_monsters_score_kill);
+ GameRules_scoring_add(attacker, SCORE, +autocvar_g_monsters_score_kill);
if(gibbed)
{
#define MUTATOR_ONADD if (mode == MUTATOR_ADDING)
#define MUTATOR_ONREMOVE if (mode == MUTATOR_REMOVING)
#define MUTATOR_ONROLLBACK_OR_REMOVE if (mode == MUTATOR_REMOVING || mode == MUTATOR_ROLLING_BACK)
+
+#define MUTATOR_STATIC() MACRO_BEGIN { \
+ MUTATOR_ONADD { \
+ /* game loads at time 1 */ \
+ if (time > 1) { \
+ error("This is a game type and it cannot be added at runtime."); \
+ } \
+ } \
+ MUTATOR_ONREMOVE { \
+ LOG_INFO("This is a game type and it cannot be removed at runtime."); \
+ return -1; \
+ } \
+} MACRO_END
+
#define MUTATOR_ADD(name) Mutator_Add(MUTATOR_##name)
#define MUTATOR_REMOVE(name) Mutator_Remove(MUTATOR_##name)
#define MUTATOR_RETURNVALUE CallbackChain_ReturnValue
#define MUTATOR_HOOK(cb, func, order) MACRO_BEGIN { \
MUTATOR_ONADD { \
if (!CallbackChain_Add(HOOK_##cb, CALLBACK_##func, order)) { \
- LOG_INFO("HOOK FAILED: ", #cb, ":", #func, "\n"); \
+ LOG_INFO("HOOK FAILED: ", #cb, ":", #func); \
return true; \
} \
} \
if (this.text) strunzone(this.text);
this.text = strzone(s);
- float size_range = autocvar_cl_damagetext_size_max - autocvar_cl_damagetext_size_min;
- float damage_range = autocvar_cl_damagetext_size_max_damage - autocvar_cl_damagetext_size_min_damage;
- float scale_factor = size_range / damage_range;
- this.m_size = bound(
- autocvar_cl_damagetext_size_min,
- (potential - autocvar_cl_damagetext_size_min_damage) * scale_factor + autocvar_cl_damagetext_size_min,
- autocvar_cl_damagetext_size_max);
+ this.m_size = map_bound_ranges(potential,
+ autocvar_cl_damagetext_size_min_damage, autocvar_cl_damagetext_size_max_damage,
+ autocvar_cl_damagetext_size_min, autocvar_cl_damagetext_size_max);
}
CONSTRUCTOR(DamageText, int _group, vector _origin, bool _screen_coords, int _health, int _armor, int _potential_damage, int _deathtype, bool _friendlyfire) {
.int pressedkeys;
#endif
-// returns 1 if the player is close to a wall
+// returns true if the player is close to a wall
bool check_close_to_wall(entity this, float threshold)
{
if (PHYS_DODGING_WALL == 0) { return false; }
-#define X(OFFSET) \
- tracebox(this.origin, this.mins, this.maxs, this.origin + OFFSET, true, this); \
- if(trace_fraction < 1 && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY) && vdist(this.origin - trace_endpos, <, threshold)) \
+#define X(dir) \
+ tracebox(this.origin, this.mins, this.maxs, this.origin + threshold * dir, true, this); \
+ if (trace_fraction < 1 && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_SKY)) \
return true;
- X(1000*v_right);
- X(-1000*v_right);
- X(1000*v_forward);
- X(-1000*v_forward);
+
+ X(v_right);
+ X(-v_right);
+ X(v_forward);
+ X(-v_forward);
#undef X
return false;
delete(e.fake_nade);
e.fake_nade = NULL;
+ Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
+
makevectors(e.v_angle);
// NOTE: always throw from first weapon entity?
W_SetupShot(e, _nade.weaponentity_fld, false, false, SND_Null, CH_WEAPON_A, 0);
- Kill_Notification(NOTIF_ONE_ONLY, e, MSG_CENTER, CPID_NADES);
-
vector offset = (v_forward * autocvar_g_nades_throw_offset.x)
- + (v_right * autocvar_g_nades_throw_offset.y)
- + (v_up * autocvar_g_nades_throw_offset.z);
- if(autocvar_g_nades_throw_offset == '0 0 0')
- offset = '0 0 0';
+ + (v_right * autocvar_g_nades_throw_offset.y)
+ + (v_up * autocvar_g_nades_throw_offset.z);
- setorigin(_nade, w_shotorg + offset + (v_right * 25) * -1);
+ setorigin(_nade, w_shotorg + offset);
//setmodel(_nade, MDL_PROJECTILE_NADE);
//setattachment(_nade, NULL, "");
PROJECTILE_MAKETRIGGER(_nade);
FOR_EACH_KH_KEY(key) if(key.owner == player) { ++key_count; }
float time_score;
- if(player.flagcarried || player.ballcarried) // this player is important
+ if(GameRules_scoring_is_vip(player))
time_score = autocvar_g_nades_bonus_score_time_flagcarrier;
else
time_score = autocvar_g_nades_bonus_score_time;
if (SAME_TEAM(frag_attacker, frag_target) || frag_attacker == frag_target)
nades_RemoveBonus(frag_attacker);
- else if(frag_target.flagcarried)
+ else if(GameRules_scoring_is_vip(frag_target))
nades_GiveBonus(frag_attacker, autocvar_g_nades_bonus_score_medium);
else if(autocvar_g_nades_bonus_score_spree && CS(frag_attacker).killcount > 1)
{
MUTATOR_ONREMOVE
{
- LOG_INFO("This cannot be removed at runtime\n");
+ LOG_INFO("This cannot be removed at runtime");
return -1;
}
return true;
}
-void ok_SetCvars()
-{
- // hack to force overkill playermodels
- cvar_settemp("sv_defaultcharacter", "1");
- cvar_settemp("sv_defaultplayermodel", "models/ok_player/okrobot1.dpm models/ok_player/okrobot2.dpm models/ok_player/okrobot3.dpm models/ok_player/okrobot4.dpm models/ok_player/okmale1.dpm models/ok_player/okmale2.dpm models/ok_player/okmale3.dpm models/ok_player/okmale4.dpm");
- cvar_settemp("sv_defaultplayermodel_red", "models/ok_player/okrobot1.dpm models/ok_player/okrobot2.dpm models/ok_player/okrobot3.dpm models/ok_player/okrobot4.dpm");
- cvar_settemp("sv_defaultplayermodel_blue", "models/ok_player/okmale1.dpm models/ok_player/okmale2.dpm models/ok_player/okmale3.dpm models/ok_player/okmale4.dpm");
-}
-
void ok_Initialize()
{
- ok_SetCvars();
-
precache_all_playermodels("models/ok_player/*.dpm");
WEP_RPC.spawnflags &= ~WEP_FLAG_MUTATORBLOCKED;
MUTATOR_ONREMOVE
{
- LOG_INFO("This cannot be removed at runtime\n");
+ LOG_INFO("This cannot be removed at runtime");
return -1;
}
if(file_get < 0)
{
if(autocvar_g_sandbox_info > 0)
- LOG_INFO(strcat("^3SANDBOX - SERVER: ^7could not find storage file ^3", file_name, "^7, no objects were loaded\n"));
+ LOG_INFO("^3SANDBOX - SERVER: ^7could not find storage file ^3", file_name, "^7, no objects were loaded");
}
else
{
}
}
if(autocvar_g_sandbox_info > 0)
- LOG_INFO(strcat("^3SANDBOX - SERVER: ^7successfully loaded storage file ^3", file_name, "\n"));
+ LOG_INFO("^3SANDBOX - SERVER: ^7successfully loaded storage file ^3", file_name);
}
fclose(file_get);
}
_setmodel(e, argv(2));
if(autocvar_g_sandbox_info > 0)
- LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", player.netname, " spawned an object at origin ^3", vtos(e.origin), "\n"));
+ LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " spawned an object at origin ^3", vtos(e.origin));
return true;
// ---------------- COMMAND: OBJECT, REMOVE ----------------
if(e != NULL)
{
if(autocvar_g_sandbox_info > 0)
- LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", player.netname, " removed an object at origin ^3", vtos(e.origin), "\n"));
+ LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " removed an object at origin ^3", vtos(e.origin));
sandbox_ObjectRemove(e);
return true;
}
print_to(player, "^2SANDBOX - INFO: ^7Object pasted successfully");
if(autocvar_g_sandbox_info > 0)
- LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", player.netname, " pasted an object at origin ^3", vtos(e.origin), "\n"));
+ LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " pasted an object at origin ^3", vtos(e.origin));
return true;
}
return true;
player.object_attach = NULL; // object was attached, no longer keep it scheduled for attachment
print_to(player, "^2SANDBOX - INFO: ^7Object attached successfully");
if(autocvar_g_sandbox_info > 1)
- LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", player.netname, " attached objects at origin ^3", vtos(e.origin), "\n"));
+ LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " attached objects at origin ^3", vtos(e.origin));
return true;
}
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");
sandbox_ObjectAttach_Remove(e);
print_to(player, "^2SANDBOX - INFO: ^7Child objects detached successfully");
if(autocvar_g_sandbox_info > 1)
- LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", player.netname, " detached objects at origin ^3", vtos(e.origin), "\n"));
+ LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " detached objects at origin ^3", vtos(e.origin));
return true;
}
print_to(player, "^1SANDBOX - WARNING: ^7Child objects could not be detached. Make sure you are facing an object that you have edit rights over");
e.message2 = strzone(strftime(true, "%d-%m-%Y %H:%M:%S"));
if(autocvar_g_sandbox_info > 1)
- LOG_INFO(strcat("^3SANDBOX - SERVER: ^7", player.netname, " edited property ^3", argv(2), " ^7of an object at origin ^3", vtos(e.origin), "\n"));
+ LOG_INFO("^3SANDBOX - SERVER: ^7", player.netname, " edited property ^3", argv(2), " ^7of an object at origin ^3", vtos(e.origin));
return true;
}
if (rgb == '0 0 0')
{
this.teamradar_color = '1 0 1';
- LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage);
+ LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it", spriteimage);
}
if (time - floor(time) > 0.5)
LOG_INFOF(
(
"^1TRAILING NEW LINE AT END OF NOTIFICATION: "
- "^7net_type = %s, net_name = %s, string = %s.\n"
+ "^7net_type = %s, net_name = %s, string = %s."
),
notiftype,
notifname,
LOG_INFOF(
(
"^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
- "^7net_type = %s, net_name = %s, max args = %d.\n"
+ "^7net_type = %s, net_name = %s, max args = %d."
),
notiftype,
notifname,
LOG_INFOF(
(
"^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
- "^7net_type = %s, net_name = %s, args arg = '%s'.\n"
+ "^7net_type = %s, net_name = %s, args arg = '%s'."
),
notiftype,
notifname,
LOG_INFOF(
(
"^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
- "^7net_type = %s, net_name = %s, max hudargs = %d.\n"
+ "^7net_type = %s, net_name = %s, max hudargs = %d."
),
notiftype,
notifname,
LOG_INFOF(
(
"^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
- "^7net_type = %s, net_name = %s, hudargs arg = '%s'.\n"
+ "^7net_type = %s, net_name = %s, hudargs arg = '%s'."
),
notiftype,
notifname,
LOG_INFOF(
(
"^1NOTIFICATION HAS TOO MANY ARGUMENTS: "
- "^7net_type = %s, net_name = %s, max durcnt = %d.\n"
+ "^7net_type = %s, net_name = %s, max durcnt = %d."
),
notiftype,
notifname,
LOG_INFOF(
(
"^1NOTIFICATION WITH UNKNOWN TOKEN IN ARGUMENT STRING: "
- "^7net_type = %s, net_name = %s, durcnt arg = '%s'.\n"
+ "^7net_type = %s, net_name = %s, durcnt arg = '%s'."
),
notiftype,
notifname,
LOG_INFOF(
(
"^1NOTIFICATION WITH IMPROPER TYPE: "
- "^7net_type = %d, net_name = %s.\n"
+ "^7net_type = %d, net_name = %s."
),
typeId,
namestring
LOG_INFOF(
(
"^1NOTIFICATION WITH NO SOUND: "
- "^7net_type = %s, net_name = %s.\n"
+ "^7net_type = %s, net_name = %s."
),
typestring,
namestring
LOG_INFOF(
(
"^1NOTIFICATION HAS ARG COUNTS BUT NO ARGS OR HUDARGS OR DURCNT: "
- "^7net_type = %s, net_name = %s, strnum = %d, flnum = %d\n"
+ "^7net_type = %s, net_name = %s, strnum = %d, flnum = %d"
),
typestring,
namestring,
LOG_INFOF(
(
"^1NOTIFICATION HAS HUDARGS BUT NO ICON: "
- "^7net_type = %s, net_name = %s.\n"
+ "^7net_type = %s, net_name = %s."
),
typestring,
namestring
LOG_INFOF(
(
"^1EMPTY NOTIFICATION: "
- "^7net_type = %s, net_name = %s.\n"
+ "^7net_type = %s, net_name = %s."
),
typestring,
namestring
LOG_INFOF(
(
"^1NOTIFICATION WITH NO SUBCALLS: "
- "^7net_type = %s, net_name = %s.\n"
+ "^7net_type = %s, net_name = %s."
),
typestring,
namestring
LOG_INFOF(
(
"^1NOTIFICATION IS MISSING CHOICE PARAMS: "
- "^7net_type = %s, net_name = %s.\n"
+ "^7net_type = %s, net_name = %s."
),
typestring,
namestring
if (fh >= 0)
{
Dump_Notifications(fh, alsoprint);
- LOG_INFOF("Dumping notifications... File located in ^2data/data/%s^7.\n", filename);
+ LOG_INFOF("Dumping notifications... File located in ^2data/data/%s^7.", filename);
fclose(fh);
}
else
{
- LOG_INFOF("^1Error: ^7Could not open file '%s'!\n", filename);
+ LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename);
}
#else
- LOG_INFO(_("Notification dump command only works with cl_cmd and sv_cmd.\n"));
+ LOG_INFO(_("Notification dump command only works with cl_cmd and sv_cmd."));
#endif
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [filename]"));
- LOG_INFO(" Where 'filename' is the file to write (default is notifications_dump.cfg),\n");
- LOG_INFO(" if supplied with '-' output to console as well as default,\n");
- LOG_INFO(" if left blank, it will only write to default.\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpnotifs [filename]");
+ LOG_INFO(" Where 'filename' is the file to write (default is notifications_dump.cfg),");
+ LOG_INFO(" if supplied with '-' output to console as well as default,");
+ LOG_INFO(" if left blank, it will only write to default.");
return;
}
}
if(autocvar_sv_cheats || this.maycheat)
{
if (!CheatImpulse(this, CHIMPULSE_GIVE_ALL.impulse))
- LOG_INFO("A hollow voice says \"Plugh\".\n");
+ LOG_INFO("A hollow voice says \"Plugh\".");
}
else
STAT(MOVEVARS_SPECIALCOMMAND, this) = true;
case URL_READY_ERROR:
default:
{
- LOG_INFO("Player stats writing failed: ", ftos(status), "\n");
+ LOG_INFO("Player stats writing failed: ", ftos(status));
PlayerStats_GameReport_DelayMapVote = false;
if(PS_GR_OUT_DB >= 0)
{
void PlayerStats_PlayerBasic(entity joiningplayer, float newrequest)
{
- PlayerScore_Add(joiningplayer, SP_ELO, -1);
+ GameRules_scoring_add(joiningplayer, ELO, -1);
// http://stats.xonotic.org/player/GgXRw6piDtFIbMArMuiAi8JG4tiin8VLjZgsKB60Uds=/elo.txt
if(autocvar_g_playerstats_playerbasic_uri != "")
{
string uri = autocvar_g_playerstats_playerbasic_uri;
if (joiningplayer.crypto_idfp == "") {
- PlayerScore_Add(joiningplayer, SP_ELO, -1);
+ GameRules_scoring_add(joiningplayer, ELO, -1);
} else {
// create the database if it doesn't already exist
if(PS_B_IN_DB < 0)
else
{
// server has this disabled, kill the DB and set status to idle
- PlayerScore_Add(joiningplayer, SP_ELO, -1);
+ GameRules_scoring_add(joiningplayer, ELO, -1);
if(PS_B_IN_DB >= 0)
{
db_close(PS_B_IN_DB);
if (gt == PlayerStats_GetGametype()) {
handled = true;
float e = stof(data);
- PlayerScore_Add(p, SP_ELO, +1 + e);
+ GameRules_scoring_add(p, ELO, +1 + e);
}
if (gt == "") {
// PlayerInfo_AddItem(p, value, data);
case URL_READY_CLOSED:
{
// url_fclose has finished
- LOG_INFO("Player stats synchronized with server\n");
+ LOG_INFO("Player stats synchronized with server");
return;
}
case URL_READY_ERROR:
default:
{
- LOG_INFO("Receiving player stats failed: ", ftos(status), "\n");
+ LOG_INFO("Receiving player stats failed: ", ftos(status));
break;
}
}
- PlayerScore_Add(p, SP_ELO, -1);
+ GameRules_scoring_add(p, ELO, -1);
}
#endif // SVQC
float i = 0;
for(e = PS_D_IN_EVL; (en = db_get(PS_D_IN_DB, e)) != ""; e = en)
{
- LOG_INFO(sprintf("%d:%s:%s\n", i, e, db_get(PS_D_IN_DB, sprintf("#%s", e))));
+ LOG_INFOF("%d:%s:%s", i, e, db_get(PS_D_IN_DB, sprintf("#%s", e)));
++i;
}
#endif
float gamecount = cvar("cl_matchcount");
#if 0
- LOG_INFOF("PlayerStats_PlayerDetail_CheckUpdate(): %f >= %f, %d > %d\n",
+ LOG_INFOF("PlayerStats_PlayerDetail_CheckUpdate(): %f >= %f, %d > %d",
time,
PS_D_NEXTUPDATETIME,
PS_D_LASTGAMECOUNT,
"PlayerStats_PlayerDetail_Handler(): ERROR: "
"Key went unhandled? Is our version outdated?\n"
"PlayerStats_PlayerDetail_Handler(): "
- "Key '%s', Event '%s', Data '%s'\n",
+ "Key '%s', Event '%s', Data '%s'",
key,
event,
data
}
#if 0
- LOG_INFO(sprintf(
+ LOG_INFOF(
"PlayerStats_PlayerDetail_Handler(): "
- "Key '%s', Event '%s', Data '%s'\n",
+ "Key '%s', Event '%s', Data '%s'",
key,
event,
data
- ));
+ );
#endif
}
//print("PlayerStats_PlayerDetail_Handler(): End of response.\n");
case URL_READY_CLOSED:
{
// url_fclose has finished
- LOG_INFO("PlayerStats_PlayerDetail_Handler(): Player stats synchronized with server.\n");
+ LOG_INFO("PlayerStats_PlayerDetail_Handler(): Player stats synchronized with server.");
break;
}
case URL_READY_ERROR:
default:
{
- LOG_INFO("PlayerStats_PlayerDetail_Handler(): Receiving player stats failed: ", ftos(status), "\n");
+ LOG_INFO("PlayerStats_PlayerDetail_Handler(): Receiving player stats failed: ", ftos(status));
PlayerStats_PlayerDetail_Status = PS_D_STATUS_ERROR;
if(PS_D_IN_DB >= 0)
{
}
}
+AUTOCVAR(g_pickup_respawntime_scaling_reciprocal, float, 0.0, "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `reciprocal` (with `offset` and `linear` set to 0) can be used to achieve a constant number of items spawned *per player*");
+AUTOCVAR(g_pickup_respawntime_scaling_offset, float, 0.0, "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `offset` offsets the curve left or right - the results are not intuitive and I recommend plotting the respawn time and the number of items per player to see what's happening");
+AUTOCVAR(g_pickup_respawntime_scaling_linear, float, 1.0, "Multiply respawn time by `reciprocal / (p + offset) + linear` where `p` is the current number of players, takes effect with 2 or more players present, `linear` can be used to simply scale the respawn time linearly");
+
+float adjust_respawntime(float normal_respawntime) {
+ float r = autocvar_g_pickup_respawntime_scaling_reciprocal;
+ float o = autocvar_g_pickup_respawntime_scaling_offset;
+ float l = autocvar_g_pickup_respawntime_scaling_linear;
+
+ if (r == 0 && l == 1) {
+ return normal_respawntime;
+ }
+
+ CheckAllowedTeams(NULL);
+ GetTeamCounts(NULL);
+ int players = 0;
+ if (c1 != -1) players += c1;
+ if (c2 != -1) players += c2;
+ if (c3 != -1) players += c3;
+ if (c4 != -1) players += c4;
+
+ if (players >= 2) {
+ return normal_respawntime * (r / (players + o) + l);
+ } else {
+ return normal_respawntime;
+ }
+}
+
void Item_ScheduleRespawn(entity e)
{
if(e.respawntime > 0)
{
Item_Show(e, 0);
- Item_ScheduleRespawnIn(e, ITEM_RESPAWNTIME(e));
+
+ float adjusted_respawntime = adjust_respawntime(e.respawntime);
+ //LOG_INFOF("item %s will respawn in %f", e.classname, adjusted_respawntime);
+
+ // range: adjusted_respawntime - respawntimejitter .. adjusted_respawntime + respawntimejitter
+ float actual_time = adjusted_respawntime + crandom() * e.respawntimejitter;
+ Item_ScheduleRespawnIn(e, actual_time);
}
else // if respawntime is -1, this item does not respawn
Item_Show(e, -1);
autocvar_g_balance_health_limit);
// Correct code:
//player.health = bound(player.health, player.health + amount,
- // min(autocvar_g_balance_health_limit, ITEM_COUNT_HARD_LIMIT));
+ // min(autocvar_g_balance_health_limit,
+ // RESOURCE_AMOUNT_HARD_LIMIT));
player.pauserothealth_finished = max(player.pauserothealth_finished,
time + autocvar_g_balance_pause_health_rot);
return;
// Correct code:
//player.armorvalue = bound(player.armorvalue, player.armorvalue +
// amount, min(autocvar_g_balance_armor_limit,
- // ITEM_COUNT_HARD_LIMIT));
+ // RESOURCE_AMOUNT_HARD_LIMIT));
player.pauserotarmor_finished = max(player.pauserotarmor_finished,
time + autocvar_g_balance_pause_armor_rot);
return;
case ammo_fuel:
{
player.ammo_fuel = bound(player.ammo_fuel, player.ammo_fuel +
- amount, min(g_pickup_fuel_max, ITEM_COUNT_HARD_LIMIT));
+ amount, min(g_pickup_fuel_max, RESOURCE_AMOUNT_HARD_LIMIT));
player.pauserotfuel_finished = max(player.pauserotfuel_finished,
time + autocvar_g_balance_pause_fuel_rot);
return;
{
return;
}
- float maxvalue = ITEM_COUNT_HARD_LIMIT;
+ float maxvalue = RESOURCE_AMOUNT_HARD_LIMIT;
switch (ammotype)
{
case ammo_shells:
}
}
player.(ammotype) = min(player.(ammotype) + amount,
- min(maxvalue, ITEM_COUNT_HARD_LIMIT));
+ min(maxvalue, RESOURCE_AMOUNT_HARD_LIMIT));
}
void GivePlayerFuel(entity player, float amount)
#include <server/defs.qh>
#endif
-/// \brief Unconditional maximum amount of items the player can have.
-const int ITEM_COUNT_HARD_LIMIT = 999;
+/// \brief Unconditional maximum amount of resources the player can have.
+const int RESOURCE_AMOUNT_HARD_LIMIT = 999;
const int AMMO_COUNT = 4; // amount of ammo types to show in the inventory panel
const float ITEM_RESPAWN_TICKS = 10;
-#define ITEM_RESPAWNTIME(i) ((i).respawntime + crandom() * (i).respawntimejitter)
- // range: respawntime - respawntimejitter .. respawntime + respawntimejitter
#define ITEM_RESPAWNTIME_INITIAL(i) (ITEM_RESPAWN_TICKS + random() * ((i).respawntime + (i).respawntimejitter - ITEM_RESPAWN_TICKS))
// range: 10 .. respawntime + respawntimejitter
void button_wait(entity this)
{
this.state = STATE_TOP;
- this.nextthink = this.ltime + this.wait;
- setthink(this, button_return);
+ if(this.wait >= 0)
+ {
+ this.nextthink = this.ltime + this.wait;
+ setthink(this, button_return);
+ }
SUB_UseTargets(this, this.enemy, NULL);
this.frame = 1; // use alternate textures
}
setorigin(this, this.pos1);
this.frame = 0; // use normal textures
this.state = STATE_BOTTOM;
+ this.velocity = '0 0 0';
+ setthink(this, func_null);
+ this.nextthink = 0;
if (this.health)
this.takedamage = DAMAGE_YES; // can be shot again
}
this.pos2 = this.pos1 + this.movedir*(fabs(this.movedir*this.size) - this.lip);
this.flags |= FL_NOTARGET;
+ this.reset = button_reset;
+
button_reset(this);
}
#endif
data = stov(db_get(TemporaryDB, strcat("/target_spawn/field/", key)));
if(data.y == 0) // undefined field, i.e., invalid type
{
- LOG_INFO("target_spawn: invalid/unknown entity key ", key, " specified, ignored!\n");
+ LOG_INFO("target_spawn: invalid/unknown entity key ", key, " specified, ignored!");
continue;
}
}
}
else
{
- LOG_INFO("target_spawn: invalid/unknown variable replacement ", value, " specified, ignored!\n");
+ LOG_INFO("target_spawn: invalid/unknown variable replacement ", value, " specified, ignored!");
continue;
}
{
if(value != "")
{
- LOG_INFO("target_spawn: try to get a field of a non-entity, ignored!\n");
+ LOG_INFO("target_spawn: try to get a field of a non-entity, ignored!");
continue;
}
data2 = stov(db_get(TemporaryDB, strcat("/target_spawn/field/", valuefield)));
if(data2_y == 0) // undefined field, i.e., invalid type
{
- LOG_INFO("target_spawn: invalid/unknown entity key replacement ", valuefield, " specified, ignored!\n");
+ LOG_INFO("target_spawn: invalid/unknown entity key replacement ", valuefield, " specified, ignored!");
continue;
}
value = getentityfieldstring(data2_x, valueent);
value = vtos(stov(value) + stov(valueoffset));
break;
default:
- LOG_INFO("target_spawn: only string, float and vector fields can do calculations, calculation ignored!\n");
+ LOG_INFO("target_spawn: only string, float and vector fields can do calculations, calculation ignored!");
break;
}
}
value = vtos(stov(value) + random() * data2_x * '1 0 0' + random() * data2_y * '0 1 0' + random() * data2_z * '0 0 1');
break;
default:
- LOG_INFO("target_spawn: only float and vector fields can do random calculations, calculation ignored!\n");
+ LOG_INFO("target_spawn: only float and vector fields can do random calculations, calculation ignored!");
break;
}
}
#ifdef SVQC
if(!e) { sprint(player, "Teleport destination vanished. Sorry... please complain to the mapper.\n"); }
#elif defined(CSQC)
- if(!e) { LOG_INFO("Teleport destination could not be found from CSQC.\n"); }
+ if(!e) { LOG_INFO("Teleport destination could not be found from CSQC."); }
#endif
makevectors(e.mangle);
if(e.move_movetype == MOVETYPE_NONE)
waypoint_spawnforteleporter(this, e.origin, 0);
if(e.classname != "info_teleport_destination")
- LOG_INFO("^3MAPPER ERROR: teleporter does target an invalid teleport destination entity. Angles will not work.\n");
+ LOG_INFO("^3MAPPER ERROR: teleporter does target an invalid teleport destination entity. Angles will not work.");
#endif
}
#elif defined(CSQC)
if(!(pl.flags & BIT(15))) // FL_PROJECTILE
#endif
- LOG_INFO("A non-projectile got through a warpzone and its owner cleared. It's a ", pl.classname, ".\n");
+ LOG_INFO("A non-projectile got through a warpzone and its owner cleared. It's a ", pl.classname, ".");
pl.owner = NULL;
}
if(IS_PLAYER(pl))
}
if((!a) == (!b))
- LOG_INFO("Invalid use of trigger_disablerelay: ", ftos(a), " relays were on, ", ftos(b), " relays were off!\n");
+ LOG_INFO("Invalid use of trigger_disablerelay: ", ftos(a), " relays were on, ", ftos(b), " relays were off!");
}
spawnfunc(trigger_disablerelay)
break;
}
- if(!this.enemy) { LOG_INFO("^1FAIL!\n"); delete(this); return; }
+ if(!this.enemy) { LOG_INFO("^1FAIL!"); delete(this); return; }
if(!this.goalentity)
this.goalentity = this.enemy; // make them match so CSQC knows what to do
spawnfunc(trigger_viewlocation)
{
// we won't check target2 here yet, as it may not even need to exist
- if(this.target == "") { LOG_INFO("^1FAIL!\n"); delete(this); return; }
+ if(this.target == "") { LOG_INFO("^1FAIL!"); delete(this); return; }
EXACTTRIGGER_INIT;
InitializeEntity(this, viewloc_init, INITPRIO_FINDTARGET);
if(tur_config_file >= 0)
{
Dump_Turret_Settings();
- LOG_INFO(sprintf("Dumping turrets... File located in ^2data/data/%s^7.\n", filename));
+ LOG_INFOF("Dumping turrets... File located in ^2data/data/%s^7.", filename);
fclose(tur_config_file);
tur_config_file = -1;
tur_config_alsoprint = -1;
}
else
{
- LOG_INFO(sprintf("^1Error: ^7Could not open file '%s'!\n", filename));
+ LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename);
}
#else
- LOG_INFO(_("Turrets dump command only works with sv_cmd.\n"));
+ LOG_INFO(_("Turrets dump command only works with sv_cmd."));
#endif
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]"));
- LOG_INFO(" Where 'filename' is the file to write (default is turrets_dump.cfg),\n");
- LOG_INFO(" if supplied with '-' output to console as well as default,\n");
- LOG_INFO(" if left blank, it will only write to default.\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]");
+ LOG_INFO(" Where 'filename' is the file to write (default is turrets_dump.cfg),");
+ LOG_INFO(" if supplied with '-' output to console as well as default,");
+ LOG_INFO(" if left blank, it will only write to default.");
return;
}
}
if(rgb == '0 0 0')
{
this.teamradar_color = '1 0 1';
- LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it\n", spriteimage);
+ LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it", spriteimage);
}
txt = this.netname;
TUR_CONFIG_WRITETOFILE("// }}}\n")
// step 5: debug info
- LOG_INFO(sprintf("#%d: %s: %d settings...\n", i, it.turret_name, TUR_CONFIG_COUNT));
+ LOG_INFOF("#%d: %s: %d settings...", i, it.turret_name, TUR_CONFIG_COUNT);
totalsettings += TUR_CONFIG_COUNT;
});
config_queue[j] = string_null;
// extra information
- LOG_INFO(sprintf("Totals: %d turrets, %d settings\n", (Turrets_COUNT - 1), totalsettings));
+ LOG_INFOF("Totals: %d turrets, %d settings", (Turrets_COUNT - 1), totalsettings);
}
#endif
if(cvar("developer"))
{
- LOG_INFO("Verifying vector compression table...\n");
+ LOG_INFO("Verifying vector compression table...");
for(i = 0x0F00; i < 0xFFFF; ++i)
if(i != compressShortVector(decompressShortVector(i)))
{
- LOG_INFO("BROKEN vector compression: ", ftos(i));
- LOG_INFO(" -> ", vtos(decompressShortVector(i)));
- LOG_INFO(" -> ", ftos(compressShortVector(decompressShortVector(i))));
- LOG_INFO("\n");
+ LOG_INFOF(
+ "BROKEN vector compression: %s -> %s -> %s",
+ ftos(i),
+ vtos(decompressShortVector(i)),
+ ftos(compressShortVector(decompressShortVector(i)))
+ );
error("b0rk");
}
- LOG_INFO("Done.\n");
+ LOG_INFO("Done.");
}
}
if(!cvar_type(tmp_cvar))
{
- LOG_INFOF("Error: cvar %s doesn't exist!\n", tmp_cvar);
+ LOG_INFOF("Error: cvar %s doesn't exist!", tmp_cvar);
return 0;
}
++j;
}
else
- LOG_INFOF("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.\n", it.netname);
+ LOG_INFOF("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.", it.netname);
});
#else
++j;
}
else
- print(sprintf("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.\n", e.netname));
+ print(sprintf("Error: cvar %s doesn't exist anymore! It can still be restored once it's manually recreated.", e.netname));
}
#endif
{
if(shutdown_running)
{
- LOG_INFO("Recursive shutdown detected! Only restoring cvars...\n");
+ LOG_INFO("Recursive shutdown detected! Only restoring cvars...");
}
else
{
}
default:
{
- LOG_INFOF("Incorrect parameters for ^2%s^7\n", "weapon_find");
+ LOG_INFOF("Incorrect parameters for ^2%s^7", "weapon_find");
}
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 cl_cmd weapon_find weapon\n");
- LOG_INFO(" Where 'weapon' is the lowercase weapon name, 'all' or 'unowned'.\n");
+ LOG_INFO("Usage:^3 cl_cmd weapon_find weapon");
+ LOG_INFO(" Where 'weapon' is the lowercase weapon name, 'all' or 'unowned'.");
return;
}
}
if(wep_config_file >= 0)
{
Dump_Weapon_Settings();
- LOG_INFO(sprintf("Dumping weapons... File located in ^2data/data/%s^7.\n", filename));
+ LOG_INFOF("Dumping weapons... File located in ^2data/data/%s^7.", filename);
fclose(wep_config_file);
wep_config_file = -1;
wep_config_alsoprint = -1;
}
else
{
- LOG_INFO(sprintf("^1Error: ^7Could not open file '%s'!\n", filename));
+ LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename);
}
#else
- LOG_INFO(_("Weapons dump command only works with sv_cmd.\n"));
+ LOG_INFO(_("Weapons dump command only works with sv_cmd."));
#endif
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO(strcat("\nUsage:^3 ", GetProgramCommandPrefix(), " dumpweapons [filename]"));
- LOG_INFO(" Where 'filename' is the file to write (default is weapons_dump.cfg),\n");
- LOG_INFO(" if supplied with '-' output to console as well as default,\n");
- LOG_INFO(" if left blank, it will only write to default.\n");
+ LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpweapons [filename]");
+ LOG_INFO(" Where 'filename' is the file to write (default is weapons_dump.cfg),");
+ LOG_INFO(" if supplied with '-' output to console as well as default,");
+ LOG_INFO(" if left blank, it will only write to default.");
return;
}
}
v = explosion_calcpush(explosion_f * speedfactor, m, target_v, 1, 0);
// the factor we then get is:
// 1
- LOG_INFOF("MASS: %f\nv: %v -> %v\nENERGY BEFORE == %f + %f = %f\nENERGY AFTER >= %f\n",
+ LOG_INFOF("MASS: %f\nv: %v -> %v\nENERGY BEFORE == %f + %f = %f\nENERGY AFTER >= %f",
m,
target_v, target_v + v,
target_v * target_v, m * explosion_f * speedfactor * explosion_f * speedfactor, target_v * target_v + m * explosion_f * speedfactor * explosion_f * speedfactor,
WEP_CONFIG_WRITETOFILE("// }}}\n");
// step 5: debug info
- LOG_INFO(sprintf("#%d: %s: %d settings...\n", i, it.m_name, WEP_CONFIG_COUNT));
+ LOG_INFOF("#%d: %s: %d settings...", i, it.m_name, WEP_CONFIG_COUNT);
totalweapons += 1;
totalsettings += WEP_CONFIG_COUNT;
});
config_queue[x] = string_null;
// extra information
- LOG_INFO(sprintf("Totals: %d weapons, %d settings\n", totalweapons, totalsettings));
+ LOG_INFOF("Totals: %d weapons, %d settings", totalweapons, totalsettings);
}
#if 0
if(actor.rl_release == 0)
{
- LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE\n", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
+ LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: TRUE", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo));
return true;
}
else
{
ammo_amount = actor.(thiswep.ammo_field) >= WEP_CVAR(devastator, ammo);
ammo_amount += actor.(weaponentity).(weapon_load[WEP_DEVASTATOR.m_id]) >= WEP_CVAR(devastator, ammo);
- LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s\n", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
+ LOG_INFOF("W_Devastator(WR_CHECKAMMO1): %d, %.2f, %d: %s", actor.rl_release, actor.(thiswep.ammo_field), WEP_CVAR(devastator, ammo), (ammo_amount ? "TRUE" : "FALSE"));
return ammo_amount;
}
#else
CLASS(MachineGun, Weapon)
/* ammotype */ ATTRIB(MachineGun, ammo_field, .int, ammo_nails);
/* impulse */ ATTRIB(MachineGun, impulse, int, 3);
-/* flags */ ATTRIB(MachineGun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN);
+/* flags */ ATTRIB(MachineGun, spawnflags, int, WEP_FLAG_NORMAL | WEP_FLAG_RELOADABLE | WEP_TYPE_HITSCAN | WEP_FLAG_PENETRATEWALLS);
/* rating */ ATTRIB(MachineGun, bot_pickupbasevalue, float, 7000);
/* color */ ATTRIB(MachineGun, wpcolor, vector, '1 1 0');
/* modelname */ ATTRIB(MachineGun, mdl, string, "uzi");
{ accuracy_add(this.realowner, WEP_SHOCKWAVE.m_id, 0, swing_damage); }
#ifdef DEBUG_SHOCKWAVE
- LOG_INFO(sprintf(
- "MELEE: %s hitting %s with %f damage (factor: %f) at %f time.\n",
+ LOG_INFOF(
+ "MELEE: %s hitting %s with %f damage (factor: %f) at %f time.",
this.realowner.netname,
target_victim.netname,
swing_damage,
swing_factor,
time
- ));
+ );
#endif
// allow multiple hits with one swing, but not against the same player twice
);
#ifdef DEBUG_SHOCKWAVE
- LOG_INFO(sprintf(
+ LOG_INFOF(
"SELF HIT: multiplier = %f, damage = %f, force = %f... "
- "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
+ "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
multiplier,
final_damage,
vlen(final_force),
multiplier_from_accuracy,
multiplier_from_distance
- ));
+ );
#endif
}
else if(distance_to_head <= WEP_CVAR(shockwave, blast_splash_radius))
if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
#ifdef DEBUG_SHOCKWAVE
- LOG_INFO(sprintf(
+ LOG_INFOF(
"SPLASH HIT: multiplier = %f, damage = %f, force = %f... "
- "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
+ "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
multiplier,
final_damage,
vlen(final_force),
multiplier_from_accuracy,
multiplier_from_distance
- ));
+ );
#endif
}
}
if(W_Shockwave_Attack_CheckHit(queue, head, final_force, final_damage)) { queue = min(queue + 1, MAX_SHOCKWAVE_HITS); }
#ifdef DEBUG_SHOCKWAVE
- LOG_INFO(sprintf(
+ LOG_INFOF(
"BLAST HIT: multiplier = %f, damage = %f, force = %f... "
- "multiplier_from_accuracy = %f, multiplier_from_distance = %f.\n",
+ "multiplier_from_accuracy = %f, multiplier_from_distance = %f.",
multiplier,
final_damage,
vlen(final_force),
multiplier_from_accuracy,
multiplier_from_distance
- ));
+ );
#endif
}
}
accuracy_add(actor, WEP_SHOCKWAVE.m_id, 0, final_damage);
#ifdef DEBUG_SHOCKWAVE
- LOG_INFO(sprintf(
- "SHOCKWAVE by %s: damage = %f, force = %f.\n",
+ LOG_INFOF(
+ "SHOCKWAVE by %s: damage = %f, force = %f.",
actor.netname,
final_damage,
vlen(final_force)
- ));
+ );
#endif
shockwave_hit[i-1] = NULL;
{
csqcplayer_moveframe = clientcommandframe;
getinputstate(csqcplayer_moveframe-1);
- LOG_INFO("the Weird code path got hit\n");
+ LOG_INFO("the Weird code path got hit");
return;
}
#endif
#define _LOG_INFO(s) \
MACRO_BEGIN { \
dprint(_LOG_HEADER("^5INFO")); \
- print("\n^7", s); \
+ string __s = s; \
+ print("\n^7", __s); \
+ /* TODO: unconditionally add a newline when possible */ \
+ if (str2chr(__s, strlen(__s) - 1) != '\n') { print("\n"); } \
} MACRO_END
#define LOG_TRACE(...) _LOG_TRACE(strcat1n(__VA_ARGS__))
}
return v;
}
+
+/// Maps values between the src and dest range: src_min to dest_min, src_max to dest_max, values between them
+/// to the curresponding values between and extrapolates for values outside the range.
+///
+/// src_min and src_max must not be the same or division by zero accurs.
+///
+/// dest_max can be smaller than dest_min if you want the resulting range to be inverted, all values can be negative.
+ERASEABLE
+float map_ranges(float value, float src_min, float src_max, float dest_min, float dest_max) {
+ float src_diff = src_max - src_min;
+ float dest_diff = dest_max - dest_min;
+ float ratio = (value - src_min) / src_diff;
+ return dest_min + dest_diff * ratio;
+}
+
+/// Same as `map_ranges` except that values outside the source range are clamped to min or max.
+ERASEABLE
+float map_bound_ranges(float value, float src_min, float src_max, float dest_min, float dest_max) {
+ if (value <= src_min) return dest_min;
+ if (value >= src_max) return dest_max;
+ return map_ranges(value, src_min, src_max, dest_min, dest_max);
+}
int f = TEST_RunAll_accumulated(0);
if (f)
{
- LOG_INFOF("%d tests failed\n", f);
+ LOG_INFOF("%d tests failed", f);
return true;
}
else
{
- LOG_INFO("All tests OK\n");
+ LOG_INFO("All tests OK");
return false;
}
}
bool TEST_Run(string s)
{
- LOG_INFOF("%s: testing...\n", s);
+ LOG_INFOF("%s: testing...", s);
TEST_failed = 0;
TEST_fatal = 0;
TEST_ok = false;
if (isfunction(fn)) callfunction(fn);
if (TEST_failed > 0)
{
- LOG_INFOF("%s: %d items failed.\n", s, TEST_failed);
+ LOG_INFOF("%s: %d items failed.", s, TEST_failed);
return false;
}
else if (!TEST_ok)
{
- LOG_INFOF("%s: did not complete.\n", s);
+ LOG_INFOF("%s: did not complete.", s);
return false;
}
return true;
if (!e) return 0;
if (e.url_rbuf >= 0 || e.url_wbuf >= 0)
{
- LOG_INFOF("WARNING: handle %d (%s) has already received data?!?\n", id + NUM_URL_ID, e.url_url);
+ LOG_INFOF("WARNING: handle %d (%s) has already received data?!?", id + NUM_URL_ID, e.url_url);
return 0;
}
e.url_rbuf = buf_create();
if (e.url_rbuf < 0)
{
- LOG_INFO("url_URI_Get_Callback: out of memory in buf_create\n");
+ LOG_INFO("url_URI_Get_Callback: out of memory in buf_create");
e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
strunzone(e.url_url);
delete(e);
e.url_rbufpos = 0;
if (e.url_rbuf < 0)
{
- LOG_INFO("url_URI_Get_Callback: out of memory in buf_create\n");
+ LOG_INFO("url_URI_Get_Callback: out of memory in buf_create");
e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
strunzone(e.url_url);
delete(e);
e.url_wbuf = buf_create();
if (e.url_wbuf < 0)
{
- LOG_INFO("url_single_fopen: out of memory in buf_create\n");
+ LOG_INFO("url_single_fopen: out of memory in buf_create");
rdy(e, pass, URL_READY_ERROR);
strunzone(e.url_url);
delete(e);
if (url_fromid[i] == NULL) break;
if (i >= autocvar__urllib_nextslot)
{
- LOG_INFO("url_single_fopen: too many concurrent requests\n");
+ LOG_INFO("url_single_fopen: too many concurrent requests");
rdy(NULL, pass, URL_READY_ERROR);
return;
}
// GET the data
if (!crypto_uri_postbuf(url, i + MIN_URL_ID, string_null, string_null, -1, 0))
{
- LOG_INFO("url_single_fopen: failure in crypto_uri_postbuf\n");
+ LOG_INFO("url_single_fopen: failure in crypto_uri_postbuf");
rdy(NULL, pass, URL_READY_ERROR);
return;
}
rdy(e, pass, URL_READY_CANWRITE);
break;
case FILE_READ:
- LOG_INFO("url_single_fopen: cannot open '-' for reading\n");
+ LOG_INFO("url_single_fopen: cannot open '-' for reading");
rdy(NULL, pass, URL_READY_ERROR);
break;
}
if (url_fromid[i] == NULL) break;
if (i >= autocvar__urllib_nextslot)
{
- LOG_INFO("url_fclose: too many concurrent requests\n");
+ LOG_INFO("url_fclose: too many concurrent requests");
e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
buf_del(e.url_wbuf);
strunzone(e.url_url);
// POST the data
if (!crypto_uri_postbuf(e.url_url, i + MIN_URL_ID, e.url_content_type, e.url_verb, e.url_wbuf, 0))
{
- LOG_INFO("url_fclose: failure in crypto_uri_postbuf\n");
+ LOG_INFO("url_fclose: failure in crypto_uri_postbuf");
e.url_ready(e, e.url_ready_pass, URL_READY_ERROR);
buf_del(e.url_wbuf);
strunzone(e.url_url);
{
if (status == -422) // Unprocessable Entity
{
- LOG_INFO("uri_multi_ready: got HTTP error 422, data is in unusable format - not continuing\n");
+ LOG_INFO("uri_multi_ready: got HTTP error 422, data is in unusable format - not continuing");
me.url_ready(fh, me.url_ready_pass, status);
strunzone(me.url_url);
delete(me);
n = tokenize_console(url);
if (n <= 0)
{
- LOG_INFO("url_multi_fopen: need at least one URL\n");
+ LOG_INFO("url_multi_fopen: need at least one URL");
rdy(NULL, pass, URL_READY_ERROR);
return;
}
}
else
{
- LOG_INFO("would have to put player in solid, won't do that\n");
+ LOG_INFO("would have to put player in solid, won't do that");
setorigin(player, o0 - player.view_ofs);
return 0;
}
return 0;
#ifdef WARPZONELIB_REMOVEHACK
- LOG_INFO("impactfilter found something - and it no longer gets handled correctly - please tell divVerent whether anything behaves broken now\n");
+ LOG_INFO("impactfilter found something - and it no longer gets handled correctly - please tell divVerent whether anything behaves broken now");
#else
- LOG_INFO("impactfilter found something - and it even gets handled correctly - please tell divVerent that this code apparently gets triggered again\n");
+ LOG_INFO("impactfilter found something - and it even gets handled correctly - please tell divVerent that this code apparently gets triggered again");
#endif
- LOG_INFO("Entity type: ", player.classname, "\n");
- LOG_INFO("Origin: ", vtos(player.origin), "\n");
- LOG_INFO("Velocity: ", vtos(player.velocity), "\n");
+ LOG_INFO("Entity type: ", player.classname);
+ LOG_INFO("Origin: ", vtos(player.origin));
+ LOG_INFO("Velocity: ", vtos(player.velocity));
#ifdef WARPZONELIB_REMOVEHACK
return 0;
point = point * (1 / (3 * area));
if(vdist(norm, <, 0.99))
{
- LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " is nonplanar. BEWARE.\n");
+ LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " is nonplanar. BEWARE.");
area = 0; // no autofixing in this case
}
norm = normalize(norm);
makevectors(ang);
if(norm * v_forward < 0)
{
- LOG_INFO("Position target of trigger_warpzone near ", vtos(this.aiment.origin), " points into trigger_warpzone. BEWARE.\n");
+ 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)
- LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been turned to match plane orientation (", vtos(this.aiment.angles), " -> ", vtos(ang), "\n");
+ 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))
- LOG_INFO("trigger_warpzone near ", vtos(this.aiment.origin), " has been moved to match the plane (", vtos(this.aiment.origin), " -> ", vtos(org), ").\n");
+ 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)
s = me.toString(me);
if (s == "") s = me.classname;
else s = strcat(me.classname, ": ", s);
- LOG_INFO(_dumptree_space, etos(me), " (", s, ")");
+ print(_dumptree_space, etos(me), " (", s, ")");
if (me.firstChild)
{
- LOG_INFO(" {\n");
+ print(" {\n");
_dumptree_space = strcat(_dumptree_space, " ");
}
else
{
- LOG_INFO("\n");
+ print("\n");
}
}
void _dumptree_close(entity pass, entity me)
if (me.firstChild)
{
_dumptree_space = substring(_dumptree_space, 0, strlen(_dumptree_space) - 2);
- LOG_INFO(_dumptree_space, "}\n");
+ print(_dumptree_space, "}\n");
}
}
if (argv(0) == "help" || argc == 0)
{
- LOG_INFO(_("Usage: menu_cmd command..., where possible commands are:\n"));
- LOG_INFO(_(" sync - reloads all cvars on the current menu page\n"));
- LOG_INFO(_(" directmenu ITEM - select a menu item as main item\n"));
+ LOG_INFO(_("Usage: menu_cmd command..., where possible commands are:"));
+ LOG_INFO(_(" sync - reloads all cvars on the current menu page"));
+ LOG_INFO(_(" directmenu ITEM - select a menu item as main item"));
- LOG_INFO("\nGeneric commands shared by all programs:\n");
+ LOG_INFO("Generic commands shared by all programs:");
GenericCommand_macro_help();
return;
if (argc == 1)
{
- LOG_INFO(_("Available options:\n"));
+ LOG_INFO(_("Available options:"));
FOREACH_ENTITY_ORDERED(it.name != "", {
if (it.classname == "vtbl") continue;
if (!startsWith(s, filter)) continue;
s = substring(s, strlen(filter), strlen(s) - strlen(filter));
}
- LOG_INFOF(" %s\n", s);
+ LOG_INFOF(" %s", s);
});
}
else if (argc == 2 && !isdemo()) // don't allow this command in demos
if(MUTATOR_CALLHOOK(Menu_ConsoleCommand, ss, argc, theCommand)) // handled by a mutator
return;
- LOG_INFO(_("Invalid command. For a list of supported commands, try menu_cmd help.\n"));
+ LOG_INFO(_("Invalid command. For a list of supported commands, try menu_cmd help."));
}
cvar_set("_menu_prvm_language", prvm_language);
#ifdef WATERMARK
- LOG_INFOF("^4MQC Build information: ^1%s\n", WATERMARK);
+ LOG_INFOF("^4MQC Build information: ^1%s", WATERMARK);
#endif
// list all game dirs (TEST)
m = MapInfo_BSPName_ByID(i);
if (!m)
{
- LOG_INFO(_("Huh? Can't play this (m is NULL). Refiltering so this won't happen again.\n"));
+ LOG_INFO(_("Huh? Can't play this (m is NULL). Refiltering so this won't happen again."));
me.refilter(me);
return;
}
}
else
{
- LOG_INFO(_("Huh? Can't play this (invalid game type). Refiltering so this won't happen again.\n"));
+ LOG_INFO(_("Huh? Can't play this (invalid game type). Refiltering so this won't happen again."));
me.refilter(me);
return;
}
else \
{ \
LOG_INFOF( \
- "RegisterSLCategories(): Improper override '%s' for category '%s'!\n", \
+ "RegisterSLCategories(): Improper override '%s' for category '%s'!", \
s, \
categories[i].cat_name \
); \
fh = fopen(s, FILE_READ);
if(fh < 0)
{
- LOG_INFO("Warning: can't open skinvalues.txt file\n");
+ LOG_INFO("Warning: can't open skinvalues.txt file");
continue;
}
while((s = fgets(fh)))
float v = fromDecibelOfSquare(db, -40);
float dbv = toDecibelOfSquare(v, -40);
float d = dbv - db;
- LOG_INFOF("%f -> %f -> %f (diff: %f)\n", db, v, dbv, d);
+ LOG_INFOF("%f -> %f -> %f (diff: %f)", db, v, dbv, d);
EXPECT_GT(fabs(d), 0.02);
}
SUCCEED();
}
else
{
- LOG_INFOF("Received HTTP request data for an invalid id %d.\n", id);
+ LOG_INFOF("Received HTTP request data for an invalid id %d.", id);
}
}
{
// update needed
_Nex_ExtResponseSystem_UpdateTo = strzone(un_version);
- if(un_download) { LOG_INFOF(_("Update can be downloaded at:\n%s\n"), un_download); }
+ if(un_download) { LOG_INFOF(_("Update can be downloaded at:\n%s"), un_download); }
if(un_url) { _Nex_ExtResponseSystem_UpdateToURL = strzone(un_url); }
DisableServerBackwardsCompatibility();
}
cvar_set("gl_texturecompression", "1");
cvar_set("r_texture_dds_load", "1");
if(!can_dds)
- LOG_INFO(_("^1ERROR: Texture compression is required but not supported.\n^1Expect visual problems.\n"));
+ LOG_INFO(_("^1ERROR: Texture compression is required but not supported.\n^1Expect visual problems."));
return 0;
}
else
{
if(me.sendCvars)
{
- LOG_INFOF("Sending cvar: %s -> %s\n", cvarnamestring, cvar_string(cvarnamestring));
+ LOG_INFOF("Sending cvar: %s -> %s", cvarnamestring, cvar_string(cvarnamestring));
if(gamestatus & (GAME_CONNECTED | GAME_ISSERVER))
{
cmd(sprintf("\nsendcvar %s\n", cvarnamestring));
if(file < 0)
{
- LOG_INFO(strcat("Error: Can not open the bot configuration file '",autocvar_bot_config_file,"'\n"));
+ LOG_INFOF("Error: Can not open the bot configuration file '%s'", autocvar_bot_config_file);
readfile = "";
}
else
++realplayers;
});
}
+ if(currentbots == -1)
+ {
+ currentbots = 0;
+ // human players joining early may cause weird issues (bots appearing on
+ // the scoreboard as spectators) when switching map with the gotomap
+ // command, as it doesn't remove bots of the previous match, and with
+ // minplayers > 1, so ignore human players in the first bot frame
+ // TODO maybe find a cleaner solution
+ activerealplayers = 0;
+ }
int bots;
// add/remove bots if needed to make sure there are at least
return;
if (time < 2)
+ {
+ currentbots = -1;
return;
+ }
bot_calculate_stepheightvec();
bot_navigation_movemode = ((autocvar_bot_navigation_ignoreplayers) ? MOVE_NOMONSTERS : MOVE_NORMAL);
}
e = find(NULL, targetname, s);
if(!e)
- LOG_INFO("invalid place ", s, "\n");
+ LOG_INFO("invalid place ", s);
if(i < MAX_BOT_PLACES)
{
this.(bot_placenames[i]) = strzone(placename);
{
e = find(NULL, targetname, placename);
if(!e)
- LOG_INFO("invalid place ", placename, "\n");
+ LOG_INFO("invalid place ", placename);
return e;
}
}
if(cmd_parm_type!=BOT_CMD_PARAMETER_NONE&&parm=="")
{
- LOG_INFO("ERROR: A parameter is required for this command\n");
+ LOG_INFO("ERROR: A parameter is required for this command");
return 0;
}
case BOT_CMD_PARAMETER_VECTOR:
if(substring(parm, 0, 1) != "\'")
{
- LOG_INFOF("ERROR: expected vector type \'x y z\', got %s\n", parm);
+ LOG_INFOF("ERROR: expected vector type \'x y z\', got %s", parm);
return 0;
}
bot_cmd.bot_cmd_parm_vector = stov(parm);
}
return 1;
}
- LOG_INFO("ERROR: No such command '", cmdstring, "'\n");
+ LOG_INFO("ERROR: No such command '", cmdstring, "'");
return 0;
}
break;
}
- LOG_INFO(strcat("Command: ",bot_cmd_string[i],"\nParameter: <",stype,"> \n"));
-
- LOG_INFO("Description: ");
+ string prelude = strcat(
+ "Command: ", bot_cmd_string[i], "\n",
+ "Parameter: <", stype, ">", "\n",
+ "Description: "
+ );
switch(i)
{
case BOT_CMD_PAUSE:
- LOG_INFO("Stops the bot completely. Any command other than 'continue' will be ignored.");
+ LOG_INFO(prelude, "Stops the bot completely. Any command other than 'continue' will be ignored.");
break;
case BOT_CMD_CONTINUE:
- LOG_INFO("Disable paused status");
+ LOG_INFO(prelude, "Disable paused status");
break;
case BOT_CMD_WAIT:
- LOG_INFO("Pause command parsing and bot ai for N seconds. Pressed key will remain pressed");
+ LOG_INFO(prelude, "Pause command parsing and bot ai for N seconds. Pressed key will remain pressed");
break;
case BOT_CMD_WAIT_UNTIL:
- LOG_INFO("Pause command parsing and bot ai until time is N from the last barrier. Pressed key will remain pressed");
+ LOG_INFO(prelude, "Pause command parsing and bot ai until time is N from the last barrier. Pressed key will remain pressed");
break;
case BOT_CMD_BARRIER:
- LOG_INFO("Waits till all bots that have a command queue reach this command. Pressed key will remain pressed");
+ LOG_INFO(prelude, "Waits till all bots that have a command queue reach this command. Pressed key will remain pressed");
break;
case BOT_CMD_TURN:
- LOG_INFO("Look to the right or left N degrees. For turning to the left use positive numbers.");
+ LOG_INFO(prelude, "Look to the right or left N degrees. For turning to the left use positive numbers.");
break;
case BOT_CMD_MOVETO:
- LOG_INFO("Walk to an specific coordinate on the map. Usage: moveto \'x y z\'");
+ LOG_INFO(prelude, "Walk to an specific coordinate on the map. Usage: moveto \'x y z\'");
break;
case BOT_CMD_MOVETOTARGET:
- LOG_INFO("Walk to the specific target on the map");
+ LOG_INFO(prelude, "Walk to the specific target on the map");
break;
case BOT_CMD_RESETGOAL:
- LOG_INFO("Resets the goal stack");
+ LOG_INFO(prelude, "Resets the goal stack");
break;
case BOT_CMD_CC:
- LOG_INFO("Execute client command. Examples: cc \"say something\"; cc god; cc \"name newnickname\"; cc kill;");
+ LOG_INFO(prelude, "Execute client command. Examples: cc \"say something\"; cc god; cc \"name newnickname\"; cc kill;");
break;
case BOT_CMD_IF:
- LOG_INFO("Perform simple conditional execution.\n");
- LOG_INFO("Syntax: \n");
- LOG_INFO(" sv_cmd .. if \"condition\"\n");
- LOG_INFO(" sv_cmd .. <instruction if true>\n");
- LOG_INFO(" sv_cmd .. <instruction if true>\n");
- LOG_INFO(" sv_cmd .. else\n");
- LOG_INFO(" sv_cmd .. <instruction if false>\n");
- LOG_INFO(" sv_cmd .. <instruction if false>\n");
- LOG_INFO(" sv_cmd .. fi\n");
- LOG_INFO("Conditions: a=b, a>b, a<b, a\t\t(spaces not allowed)\n");
- LOG_INFO(" Values in conditions can be numbers, cvars in the form cvar.cvar_string or special fields\n");
- LOG_INFO("Fields: health, speed, flagcarrier\n");
- LOG_INFO("Examples: if health>50; if health>cvar.g_balance_laser_primary_damage; if flagcarrier;");
+ LOG_INFO(prelude, "Perform simple conditional execution.\n"
+ "Syntax: \n"
+ " sv_cmd .. if \"condition\"\n"
+ " sv_cmd .. <instruction if true>\n"
+ " sv_cmd .. <instruction if true>\n"
+ " sv_cmd .. else\n"
+ " sv_cmd .. <instruction if false>\n"
+ " sv_cmd .. <instruction if false>\n"
+ " sv_cmd .. fi\n"
+ "Conditions: a=b, a>b, a<b, a\t\t(spaces not allowed)\n"
+ " Values in conditions can be numbers, cvars in the form cvar.cvar_string or special fields\n"
+ "Fields: health, speed, flagcarrier\n"
+ "Examples: if health>50; if health>cvar.g_balance_laser_primary_damage; if flagcarrier;"
+ );
break;
case BOT_CMD_RESETAIM:
- LOG_INFO("Points the aim to the coordinates x,y 0,0");
+ LOG_INFO(prelude, "Points the aim to the coordinates x,y 0,0");
break;
case BOT_CMD_AIM:
- LOG_INFO("Move the aim x/y (horizontal/vertical) degrees relatives to the bot\n");
- LOG_INFO("There is a 3rd optional parameter telling in how many seconds the aim has to reach the new position\n");
- LOG_INFO("Examples: aim \"90 0\" // Turn 90 degrees inmediately (positive numbers move to the left/up)\n");
- LOG_INFO(" aim \"0 90 2\" // Will gradually look to the sky in the next two seconds");
+ LOG_INFO(prelude, "Move the aim x/y (horizontal/vertical) degrees relatives to the bot\n"
+ "There is a 3rd optional parameter telling in how many seconds the aim has to reach the new position\n"
+ "Examples: aim \"90 0\" // Turn 90 degrees inmediately (positive numbers move to the left/up)\n"
+ " aim \"0 90 2\" // Will gradually look to the sky in the next two seconds"
+ );
break;
case BOT_CMD_AIMTARGET:
- LOG_INFO("Points the aim to given target");
+ LOG_INFO(prelude, "Points the aim to given target");
break;
case BOT_CMD_PRESSKEY:
- LOG_INFO("Press one of the following keys: forward, backward, left, right, jump, crouch, attack1, attack2, use\n");
+ LOG_INFO(prelude, "Press one of the following keys: forward, backward, left, right, jump, crouch, attack1, attack2, use");
LOG_INFO("Multiple keys can be pressed at time (with many presskey calls) and it will remain pressed until the command \"releasekey\" is called");
LOG_INFO("Note: The script will not return the control to the bot ai until all keys are released");
break;
case BOT_CMD_RELEASEKEY:
- LOG_INFO("Release previoulsy used keys. Use the parameter \"all\" to release all keys");
+ LOG_INFO(prelude, "Release previoulsy used keys. Use the parameter \"all\" to release all keys");
break;
case BOT_CMD_SOUND:
- LOG_INFO("play sound file at bot location");
+ LOG_INFO(prelude, "play sound file at bot location");
break;
case BOT_CMD_DEBUG_ASSERT_CANFIRE:
- LOG_INFO("verify the state of the weapon entity");
+ LOG_INFO(prelude, "verify the state of the weapon entity");
break;
default:
- LOG_INFO("This command has no description yet.");
+ LOG_INFO(prelude, "This command has no description yet.");
break;
}
- LOG_INFO("\n");
}
}
if(!bot_cmds_initialized)
bot_commands_init();
- LOG_INFO("List of all available commands:\n");
- LOG_INFO(" Command - Parameter Type\n");
+ LOG_INFO(
+ "List of all available commands:\n"
+ " Command - Parameter Type\n"
+ );
for(i=1;i<BOT_CMD_COUNTER;++i)
{
ptype = "none";
break;
}
- LOG_INFO(strcat(" ",bot_cmd_string[i]," - <",ptype,"> \n"));
+ LOG_INFO(" ", bot_cmd_string[i]," - <", ptype, ">");
}
}
return ((this.flagcarried!=NULL));
}
- LOG_INFO(strcat("ERROR: Unable to convert the expression '",expr,"' into a numeric value\n"));
+ LOG_INFO("ERROR: Unable to convert the expression '", expr, "' into a numeric value");
return 0;
}
if(f)
{
this.colormod = '0 8 8';
- LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, inhibited by weaponentity state\n");
+ LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, inhibited by weaponentity state");
}
}
else if(ATTACK_FINISHED(this, slot) > time)
if(f)
{
this.colormod = '8 0 8';
- LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, inhibited by ATTACK_FINISHED (", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left)\n");
+ LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, inhibited by ATTACK_FINISHED (", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left)");
}
}
else if(this.(weaponentity).tuba_note)
if(f)
{
this.colormod = '8 0 0';
- LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, bot still has an active tuba note\n");
+ LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " wants to fire, bot still has an active tuba note");
}
}
else
if(!f)
{
this.colormod = '8 8 0';
- LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " thinks it has fired, but apparently did not; ATTACK_FINISHED says ", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left\n");
+ LOG_INFO("Bot ", this.netname, " using ", this.(weaponentity).weaponname, " thinks it has fired, but apparently did not; ATTACK_FINISHED says ", ftos(ATTACK_FINISHED(this, slot) - time), " seconds left");
}
}
if(bot_cmd.bot_cmd_type!=BOT_CMD_NULL)
{
bot_command_executed(this, true);
- LOG_INFO( "WARNING: Commands are ignored while the bot is paused. Use the command 'continue' instead.\n");
+ LOG_INFO("WARNING: Commands are ignored while the bot is paused. Use the command 'continue' instead.");
}
return 1;
}
status = bot_cmd_debug_assert_canfire(this);
break;
default:
- LOG_INFO(strcat("ERROR: Invalid command on queue with id '",ftos(bot_cmd.bot_cmd_type),"'\n"));
+ LOG_INFOF("ERROR: Invalid command on queue with id '%s'", ftos(bot_cmd.bot_cmd_type));
return 0;
}
if (status==CMD_STATUS_ERROR)
- LOG_INFO(strcat("ERROR: The command '",bot_cmd_string[bot_cmd.bot_cmd_type],"' returned an error status\n"));
+ LOG_INFOF("ERROR: The command '%s' returned an error status", bot_cmd_string[bot_cmd.bot_cmd_type]);
// Move execution pointer
if(status==CMD_STATUS_EXECUTING)
{
if(autocvar_developer)
{
- LOG_INFO("A generated waypoint is stuck in solid at ", vtos(w.origin), "\n");
+ LOG_INFO("A generated waypoint is stuck in solid at ", vtos(w.origin));
backtrace("Waypoint stuck");
}
}
if(!found)
{
if(!removal_mode)
- LOG_INFO(strcat("NOTICE: Can not find waypoint at ", vtos(wp_from_pos), ". Path skipped\n"));
+ LOG_INFO("NOTICE: Can not find waypoint at ", vtos(wp_from_pos), ". Path skipped");
continue;
}
}
if(!found)
{
if(!removal_mode)
- LOG_INFO(strcat("NOTICE: Can not find waypoint at ", vtos(wp_to_pos), ". Path skipped\n"));
+ LOG_INFO("NOTICE: Can not find waypoint at ", vtos(wp_to_pos), ". Path skipped");
continue;
}
int file = fopen(filename, FILE_WRITE);
if (file < 0)
{
- LOG_INFOF("waypoint link save to %s failed\n", filename);
+ LOG_INFOF("waypoint link save to %s failed", filename);
return;
}
fclose(file);
botframe_cachedwaypointlinks = true;
- LOG_INFOF("saved %d waypoint links to maps/%s.waypoints.cache\n", c, mapname);
+ LOG_INFOF("saved %d waypoint links to maps/%s.waypoints.cache", c, mapname);
waypoint_load_links_hardwired();
}
waypoint_save_links(); // save anyway?
botframe_loadedforcedlinks = false;
- LOG_INFOF("waypoint links: save to %s failed\n", filename);
+ LOG_INFOF("waypoint links: save to %s failed", filename);
return;
}
waypoint_save_links();
botframe_loadedforcedlinks = false;
- LOG_INFOF("saved %d waypoints to maps/%s.waypoints\n", c, mapname);
+ LOG_INFOF("saved %d waypoints to maps/%s.waypoints", c, mapname);
}
// load waypoints from file
});
if(bestdist < maxdist)
{
- LOG_INFO("update chain to new nearest WP ", etos(p.(fld)), "\n");
+ LOG_INFO("update chain to new nearest WP ", etos(p.(fld)));
return 0;
}
tmax = t;
}
- LOG_INFO("spawning a waypoint for connecting to ", etos(wp), "\n");
+ LOG_INFO("spawning a waypoint for connecting to ", etos(wp));
botframe_autowaypoints_createwp(o, p, fld, 0);
return 1;
}
if(r != -1)
return;
- LOG_INFO("emergency: got no good nearby WP to build a link from, starting a new chain\n");
+ LOG_INFO("emergency: got no good nearby WP to build a link from, starting a new chain");
if(!botframe_autowaypoints_fixdown(p.origin))
return; // shouldn't happen, caught above
botframe_autowaypoints_createwp(trace_endpos, p, fld, WAYPOINTFLAG_PROTECTED);
IL_EACH(g_waypoints, !(it.wpflags & (WAYPOINTFLAG_USEFUL | WAYPOINTFLAG_DEAD_END)),
{
- LOG_INFOF("Removed a waypoint at %v. Try again for more!\n", it.origin);
+ LOG_INFOF("Removed a waypoint at %v. Try again for more!", it.origin);
te_explosion(it.origin);
waypoint_remove(it);
break;
cvar_string = cvar_string_normal;
cvar_set = cvar_set_normal;
cvar_set("g_campaign", "0");
- LOG_INFO("^4campaign initialization failed: ", s, "\n");
+ LOG_INFO("^4campaign initialization failed: ", s);
if(autocvar__campaign_testrun)
error("CAMPAIGN FAIL AHAHAHAHAHAHAHAHAH))");
return 1;
RadiusDamage(e2, this, 1000, 0, 128, NULL, NULL, 500, DEATH_CHEAT.m_id, e);
delete(e2);
- LOG_INFO("404 Sportsmanship not found.\n");
+ LOG_INFO("404 Sportsmanship not found.");
DID_CHEAT();
break;
}
PlayerStats_GameReport_AddEvent(sprintf("kills-%d", this.playerid));
// always track bots, don't ask for cl_allow_uidtracking
- if (IS_BOT_CLIENT(this)) PlayerStats_GameReport_AddPlayer(this);
+ if (IS_BOT_CLIENT(this))
+ PlayerStats_GameReport_AddPlayer(this);
+ else
+ CS(this).allowed_timeouts = autocvar_sv_timeout_number;
if (autocvar_sv_eventlog)
GameLogEcho(strcat(":join:", ftos(this.playerid), ":", ftos(etof(this)), ":", ((IS_REAL_CLIENT(this)) ? this.netaddress : "bot"), ":", playername(this, false)));
}
CS(this).jointime = time;
- CS(this).allowed_timeouts = autocvar_sv_timeout_number;
if (IS_REAL_CLIENT(this))
{
this.ammo_fuel = CalcRotRegen(this.ammo_fuel, minf, autocvar_g_balance_fuel_regen, autocvar_g_balance_fuel_regenlinear, frametime * (time > this.pauseregen_finished) * ((this.items & ITEM_JetpackRegen.m_itemid) != 0), maxf, autocvar_g_balance_fuel_rot, autocvar_g_balance_fuel_rotlinear, frametime * (time > this.pauserotfuel_finished), limitf);
}
- // Ugly hack to make sure the haelth and armor don't go beyond hard limit.
+ // Ugly hack to make sure the health and armor don't go beyond hard limit.
// TODO: Remove this hack when all code uses GivePlayerHealth and
// GivePlayerArmor.
- if (this.health > ITEM_COUNT_HARD_LIMIT)
+ if (this.health > RESOURCE_AMOUNT_HARD_LIMIT)
{
- this.health = ITEM_COUNT_HARD_LIMIT;
+ this.health = RESOURCE_AMOUNT_HARD_LIMIT;
}
- if (this.armorvalue > ITEM_COUNT_HARD_LIMIT)
+ if (this.armorvalue > RESOURCE_AMOUNT_HARD_LIMIT)
{
- this.armorvalue = ITEM_COUNT_HARD_LIMIT;
+ this.armorvalue = RESOURCE_AMOUNT_HARD_LIMIT;
}
// End hack.
}
}
default:
- LOG_INFO("Incorrect parameters for ^2ban^7\n");
+ LOG_INFO("Incorrect parameters for ^2ban^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd ban address [bantime] [reason]\n");
- LOG_INFO(" 'address' is the IP address or range of the player to ban,\n");
- LOG_INFO(" 'bantime' is the amount of time that the ban is active (default if not provided),\n");
- LOG_INFO(" and 'reason' is the string to label the ban with as reason for banning.\n");
- LOG_INFO("See also: ^2banlist, kickban, unban^7\n");
+ LOG_INFO("Usage:^3 sv_cmd ban address [bantime] [reason]");
+ LOG_INFO(" 'address' is the IP address or range of the player to ban,");
+ LOG_INFO(" 'bantime' is the amount of time that the ban is active (default if not provided),");
+ LOG_INFO(" and 'reason' is the string to label the ban with as reason for banning.");
+ LOG_INFO("See also: ^2banlist, kickban, unban^7");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd banlist\n");
- LOG_INFO(" No arguments required.\n");
- LOG_INFO("See also: ^2ban, kickban, unban^7\n");
+ LOG_INFO("Usage:^3 sv_cmd banlist");
+ LOG_INFO(" No arguments required.");
+ LOG_INFO("See also: ^2ban, kickban, unban^7");
return;
}
}
}
else
{
- LOG_INFO("kickban: ", GetClientErrorString(accepted, argv(1)), ".\n");
+ LOG_INFO("kickban: ", GetClientErrorString(accepted, argv(1)), ".");
}
}
}
default:
- LOG_INFO("Incorrect parameters for ^2kickban^7\n");
+ LOG_INFO("Incorrect parameters for ^2kickban^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd kickban client [bantime] [masksize] [reason]\n");
- LOG_INFO(" 'client' is the entity number or name of the player to ban,\n");
- LOG_INFO(" 'bantime' is the amount of time that the ban is active (default if not provided),\n");
- LOG_INFO(" 'masksize' is the range of the IP address (1-thru-4, default if not provided),\n");
- LOG_INFO(" and 'reason' is the string to label the ban with as reason for banning.\n");
- LOG_INFO("See also: ^2ban, banlist, unban^7\n");
+ LOG_INFO("Usage:^3 sv_cmd kickban client [bantime] [masksize] [reason]");
+ LOG_INFO(" 'client' is the entity number or name of the player to ban,");
+ LOG_INFO(" 'bantime' is the amount of time that the ban is active (default if not provided),");
+ LOG_INFO(" 'masksize' is the range of the IP address (1-thru-4, default if not provided),");
+ LOG_INFO(" and 'reason' is the string to label the ban with as reason for banning.");
+ LOG_INFO("See also: ^2ban, banlist, unban^7");
return;
}
}
}
else
{
- LOG_INFO("mute: ", GetClientErrorString(accepted, argv(1)), ".\n");
+ LOG_INFO("mute: ", GetClientErrorString(accepted, argv(1)), ".");
}
}
}
default:
- LOG_INFO("Incorrect parameters for ^2mute^7\n");
+ LOG_INFO("Incorrect parameters for ^2mute^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd mute client\n");
- LOG_INFO(" 'client' is the entity number or name of the player to mute.\n");
- LOG_INFO("See also: ^2unmute^7\n");
+ LOG_INFO("Usage:^3 sv_cmd mute client");
+ LOG_INFO(" 'client' is the entity number or name of the player to mute.");
+ LOG_INFO("See also: ^2unmute^7");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd unban banid\n");
- LOG_INFO(" Where 'banid' is the ID of the ban of which to remove.\n");
- LOG_INFO("See also: ^2ban, banlist, kickban^7\n");
+ LOG_INFO("Usage:^3 sv_cmd unban banid");
+ LOG_INFO(" Where 'banid' is the ID of the ban of which to remove.");
+ LOG_INFO("See also: ^2ban, banlist, kickban^7");
return;
}
}
}
else
{
- LOG_INFO("unmute: ", GetClientErrorString(accepted, argv(1)), ".\n");
+ LOG_INFO("unmute: ", GetClientErrorString(accepted, argv(1)), ".");
}
}
}
default:
- LOG_INFO("Incorrect parameters for ^2mute^7\n");
+ LOG_INFO("Incorrect parameters for ^2mute^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd unmute client\n");
- LOG_INFO(" 'client' is the entity number or name of the player to unmute.\n");
- LOG_INFO("See also: ^2mute^7\n");
+ LOG_INFO("Usage:^3 sv_cmd unmute client");
+ LOG_INFO(" 'client' is the entity number or name of the player to unmute.");
+ LOG_INFO("See also: ^2mute^7");
return;
}
}
void BanCommand_macro_help()
{
#define BAN_COMMAND(name, function, description) \
- { if (strtolower(description) != "") { LOG_INFO(" ^2", name, "^7: ", description, "\n"); } }
+ { if (strtolower(description) != "") { LOG_INFO(" ^2", name, "^7: ", description); } }
BAN_COMMANDS(0, 0, "");
#undef BAN_COMMAND
void print_to(entity to, string input)
{
if (to) sprint(to, strcat(input, "\n"));
- else LOG_INFO(input, "\n");
+ else print(input, "\n");
}
// ==========================================
case "butcher":
{
if (caller) { print_to(caller, "This command is not available to players"); return; }
- if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFO(M_ARGV(0, string), "\n"); return; }
+ if (MUTATOR_CALLHOOK(AllowMobButcher)) { LOG_INFOF("%s", M_ARGV(0, string)); return; }
int tmp_remcount = 0;
this.maxs_x = (mi_picmax.x - mi_picmin.x) / this.size.x;
this.maxs_y = (mi_picmax.y - mi_picmin.y) / this.size.y;
this.maxs_z = mi_max.z - mi_min.z;
- LOG_INFO("Picture mins/maxs: ", ftos(this.maxs.x), " and ", ftos(this.maxs.y), " should match\n");
+ LOG_INFO("Picture mins/maxs: ", ftos(this.maxs.x), " and ", ftos(this.maxs.y), " should match");
this.netname = strzone(strcat("gfx/", mi_shortname, "_radar.xpm"));
if (!(this.count & 1))
{
{
fclose(this.cnt);
- LOG_INFO(this.netname, " already exists, aborting (you may want to specify --force)\n");
+ LOG_INFO(this.netname, " already exists, aborting (you may want to specify --force)");
RadarMap_Next();
return;
}
this.cnt = fopen(this.netname, FILE_WRITE);
if (this.cnt < 0)
{
- LOG_INFO("Error writing ", this.netname, "\n");
+ LOG_INFO("Error writing ", this.netname);
delete(this);
radarmapper = NULL;
return;
}
- LOG_INFO("Writing to ", this.netname, "...\n");
+ LOG_INFO("Writing to ", this.netname, "...");
fputs(this.cnt, "/* XPM */\n");
fputs(this.cnt, "static char *RadarMap[] = {\n");
fputs(this.cnt, "/* columns rows colors chars-per-pixel */\n");
else
{
fputs(this.cnt, "\",\n");
- LOG_INFO(ftos(this.size.y - this.frame), " lines left\n");
+ LOG_INFO(ftos(this.size.y - this.frame), " lines left");
}
}
else
{
fputs(this.cnt, "\",\n");
- LOG_INFO(ftos(this.size.y - this.frame), " lines left\n");
+ LOG_INFO(ftos(this.size.y - this.frame), " lines left");
}
}
// close the file
fputs(this.cnt, "};\n");
fclose(this.cnt);
- LOG_INFO("Finished. Please edit data/", this.netname, " with an image editing application and place it in the TGA format in the gfx folder.\n");
+ LOG_INFO("Finished. Please edit data/", this.netname, " with an image editing application and place it in the TGA format in the gfx folder.");
RadarMap_Next();
}
}
if (radarmapper) // after doing the arguments, see if we successfully went forward.
{
- LOG_INFO("Radarmap entity spawned.\n");
+ LOG_INFO("Radarmap entity spawned.");
return true; // if so, don't print usage.
}
}
#pragma once
#ifndef RADARMAP
-bool RadarMap_Make(float argc) { LOG_INFO("radarmap is disabled, compile with -DRADARMAP to enable it.\n"); return true; }
+bool RadarMap_Make(float argc) { LOG_INFO("radarmap is disabled, compile with -DRADARMAP to enable it."); return true; }
#else
// ===========================================
{
if (_MapInfo_FilterGametype(MAPINFO_TYPE_ALL, 0, 0, 0, 1))
{
- LOG_INFO("Done rebuiling mapinfos.\n");
+ LOG_INFO("Done rebuiling mapinfos.");
MapInfo_FilterGametype(MapInfo_CurrentGametype(), MapInfo_CurrentFeatures(), MapInfo_RequiredFlags(), MapInfo_ForbiddenFlags(), 0);
delete(this);
}
if (accepted <= 0)
{
- LOG_INFO("adminmsg: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n"));
+ LOG_INFO("adminmsg: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : "."));
continue;
}
}
if (successful) bprint("Successfully sent message '", admin_message, "' to ", successful, ".\n");
- else LOG_INFO("No players given (", original_targets, ") could receive the message.\n");
+ else LOG_INFO("No players given (", original_targets, ") could receive the message.");
return;
}
}
default:
- LOG_INFO("Incorrect parameters for ^2adminmsg^7\n");
+ LOG_INFO("Incorrect parameters for ^2adminmsg^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd adminmsg clients \"message\" [infobartime]\n");
- LOG_INFO(" 'clients' is a list (separated by commas) of player entity ID's or nicknames\n");
- LOG_INFO(" If infobartime is provided, the message will be sent to infobar.\n");
- LOG_INFO(" Otherwise, it will just be sent as a centerprint message.\n");
- LOG_INFO("Examples: adminmsg 2,4 \"this infomessage will last for ten seconds\" 10\n");
- LOG_INFO(" adminmsg 2,5 \"this message will be a centerprint\"\n");
+ LOG_INFO("Usage:^3 sv_cmd adminmsg clients \"message\" [infobartime]");
+ LOG_INFO(" 'clients' is a list (separated by commas) of player entity ID's or nicknames");
+ LOG_INFO(" If infobartime is provided, the message will be sent to infobar.");
+ LOG_INFO(" Otherwise, it will just be sent as a centerprint message.");
+ LOG_INFO("Examples: adminmsg 2,4 \"this infomessage will last for ten seconds\" 10");
+ LOG_INFO(" adminmsg 2,5 \"this message will be a centerprint\"");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd allready\n");
- LOG_INFO(" No arguments required.\n");
+ LOG_INFO("Usage:^3 sv_cmd allready");
+ LOG_INFO(" No arguments required.");
return;
}
}
++n;
});
if (n) bprint(strcat("Successfully forced all (", ftos(n), ") players to spectate", (reason ? strcat(" for reason: '", reason, "'") : ""), ".\n"));
- else LOG_INFO("No players found to spectate.\n");
+ else LOG_INFO("No players found to spectate.");
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd allspec [reason]\n");
- LOG_INFO(" Where 'reason' is an optional argument for explanation of allspec command.\n");
- LOG_INFO("See also: ^2moveplayer, shuffleteams^7\n");
+ LOG_INFO("Usage:^3 sv_cmd allspec [reason]");
+ LOG_INFO(" Where 'reason' is an optional argument for explanation of allspec command.");
+ LOG_INFO("See also: ^2moveplayer, shuffleteams^7");
return;
}
}
}
else
{
- LOG_INFO("anticheat: ", GetClientErrorString(accepted, argv(1)), ".\n");
+ LOG_INFO("anticheat: ", GetClientErrorString(accepted, argv(1)), ".");
}
}
default:
- LOG_INFO("Incorrect parameters for ^2anticheat^7\n");
+ LOG_INFO("Incorrect parameters for ^2anticheat^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd anticheat client\n");
- LOG_INFO(" 'client' is the entity number or name of the player.\n");
+ LOG_INFO("Usage:^3 sv_cmd anticheat client");
+ LOG_INFO(" 'client' is the entity number or name of the player.");
return;
}
}
NULL);
size_max.z = (trace_startsolid) ? world.absmax.z : trace_endpos.z;
- LOG_INFOF("Original size: %v %v\n", world.absmin, world.absmax);
- LOG_INFOF("Currently set size: %v %v\n", world.mins, world.maxs);
- LOG_INFOF("Solid bounding box size: %v %v\n", size_min, size_max);
+ LOG_INFOF("Original size: %v %v", world.absmin, world.absmax);
+ LOG_INFOF("Currently set size: %v %v", world.mins, world.maxs);
+ LOG_INFOF("Solid bounding box size: %v %v", size_min, size_max);
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd bbox\n");
- LOG_INFO(" No arguments required.\n");
- LOG_INFO("See also: ^2gettaginfo, trace^7\n");
+ LOG_INFO("Usage:^3 sv_cmd bbox");
+ LOG_INFO(" No arguments required.");
+ LOG_INFO("See also: ^2gettaginfo, trace^7");
return;
}
}
cvar_settemp("bot_number", "0");
bot_fixcount();
cvar_settemp("bot_number", argv(2));
- if (!bot_fixcount()) LOG_INFO("Sorry, could not set requested bot count\n");
+ if (!bot_fixcount()) LOG_INFO("Sorry, could not set requested bot count");
return;
}
else if (argv(1) == "load" && argc == 3)
fh = fopen(argv(2), FILE_READ);
if (fh < 0)
{
- LOG_INFO("cannot open the file\n");
+ LOG_INFO("cannot open the file");
return;
}
cvar_settemp("bot_number", "0");
bot_fixcount();
cvar_settemp("bot_number", argv(3));
- if (!bot_fixcount()) LOG_INFO("Sorry, could not set requested bot count\n");
+ if (!bot_fixcount()) LOG_INFO("Sorry, could not set requested bot count");
}
else
{
++i;
}
- LOG_INFO(ftos(i), " commands read\n");
+ LOG_INFO(ftos(i), " commands read");
fclose(fh);
return;
}
bot_num++;
});
if(bot_num)
- LOG_INFO(strcat("Command '", substring(command, argv_start_index(2), -1), "' sent to all bots (", ftos(bot_num), ")\n"));
+ LOG_INFO("Command '", substring(command, argv_start_index(2), -1), "' sent to all bots (", ftos(bot_num), ")");
return;
}
else
if (bot == NULL) bot = find_bot_by_name(argv(1));
if (bot)
{
- LOG_INFO(strcat("Command '", substring(command, argv_start_index(2), -1), "' sent to bot ", bot.netname, "\n"));
+ LOG_INFO("Command '", substring(command, argv_start_index(2), -1), "' sent to bot ", bot.netname);
bot_queuecommand(bot, substring(command, argv_start_index(2), -1));
return;
}
else
{
- LOG_INFO(strcat("Error: Can't find bot with the name or id '", argv(1), "' - Did you mistype the command?\n")); // don't return so that usage is shown
+ LOG_INFO("Error: Can't find bot with the name or id '", argv(1), "' - Did you mistype the command?"); // don't return so that usage is shown
}
}
}
}
default:
- LOG_INFO("Incorrect parameters for ^2bot_cmd^7\n");
+ LOG_INFO("Incorrect parameters for ^2bot_cmd^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd bot_cmd client command [argument]\n");
- LOG_INFO(" 'client' can be either the name of the bot or a progressive number (not the entity number!)\n");
- LOG_INFO(" can also be '*' or 'all' to allow sending the command to all the bots\n");
- LOG_INFO(" For full list of commands, see bot_cmd help [command].\n");
- LOG_INFO("Examples: sv_cmd bot_cmd 1 cc \"say something\"\n");
- LOG_INFO(" sv_cmd bot_cmd 1 presskey jump\n");
- LOG_INFO(" sv_cmd bot_cmd * pause\n");
+ LOG_INFO("Usage:^3 sv_cmd bot_cmd client command [argument]");
+ LOG_INFO(" 'client' can be either the name of the bot or a progressive number (not the entity number!)");
+ LOG_INFO(" can also be '*' or 'all' to allow sending the command to all the bots");
+ LOG_INFO(" For full list of commands, see bot_cmd help [command].");
+ LOG_INFO("Examples: sv_cmd bot_cmd 1 cc \"say something\"");
+ LOG_INFO(" sv_cmd bot_cmd 1 presskey jump");
+ LOG_INFO(" sv_cmd bot_cmd * pause");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd cointoss [result1 result2]\n");
- LOG_INFO(" Where 'result1' and 'result2' are user created options.\n");
+ LOG_INFO("Usage:^3 sv_cmd cointoss [result1 result2]");
+ LOG_INFO(" Where 'result1' and 'result2' are user created options.");
return;
}
}
if (argv(1) == "save")
{
db_save(ServerProgsDB, argv(2));
- LOG_INFO(strcat("Copied serverprogs database to '", argv(2), "' in the data directory.\n"));
+ LOG_INFO("Copied serverprogs database to '", argv(2), "' in the data directory.");
return;
}
else if (argv(1) == "dump")
{
db_dump(ServerProgsDB, argv(2));
- LOG_INFO("DB dumped.\n"); // wtf does this do?
+ LOG_INFO("DB dumped."); // wtf does this do?
return;
}
else if (argv(1) == "load")
{
db_close(ServerProgsDB);
ServerProgsDB = db_load(argv(2));
- LOG_INFO(strcat("Loaded '", argv(2), "' as new serverprogs database.\n"));
+ LOG_INFO("Loaded '", argv(2), "' as new serverprogs database.");
return;
}
}
}
default:
- LOG_INFO("Incorrect parameters for ^2database^7\n");
+ LOG_INFO("Incorrect parameters for ^2database^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd database action filename\n");
- LOG_INFO(" Where 'action' is the command to complete,\n");
- LOG_INFO(" and 'filename' is what it acts upon.\n");
- LOG_INFO(" Full list of commands here: \"save, dump, load.\"\n");
+ LOG_INFO("Usage:^3 sv_cmd database action filename");
+ LOG_INFO(" Where 'action' is the command to complete,");
+ LOG_INFO(" and 'filename' is what it acts upon.");
+ LOG_INFO(" Full list of commands here: \"save, dump, load.\"");
return;
}
}
if (accepted > 0)
{
stuffcmd(client, "defer clear\n");
- LOG_INFO("defer clear stuffed to ", playername(client, false), "\n");
+ LOG_INFO("defer clear stuffed to ", playername(client, false));
}
- else { LOG_INFO("defer_clear: ", GetClientErrorString(accepted, argv(1)), ".\n"); }
+ else { LOG_INFO("defer_clear: ", GetClientErrorString(accepted, argv(1)), "."); }
return;
}
}
default:
- LOG_INFO("Incorrect parameters for ^2defer_clear^7\n");
+ LOG_INFO("Incorrect parameters for ^2defer_clear^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd defer_clear client\n");
- LOG_INFO(" 'client' is the entity number or name of the player.\n");
- LOG_INFO("See also: ^2defer_clear_all^7\n");
+ LOG_INFO("Usage:^3 sv_cmd defer_clear client");
+ LOG_INFO(" 'client' is the entity number or name of the player.");
+ LOG_INFO("See also: ^2defer_clear_all^7");
return;
}
}
GameCommand_defer_clear(CMD_REQUEST_COMMAND, argc);
++n;
});
- if (n) LOG_INFO(strcat("Successfully stuffed defer clear to all clients (", ftos(n), ")\n")); // should a message be added if no players were found?
+ if (n) LOG_INFO("Successfully stuffed defer clear to all clients (", ftos(n), ")"); // should a message be added if no players were found?
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd defer_clear_all\n");
- LOG_INFO(" No arguments required.\n");
- LOG_INFO("See also: ^2defer_clear^7\n");
+ LOG_INFO("Usage:^3 sv_cmd defer_clear_all");
+ LOG_INFO(" No arguments required.");
+ LOG_INFO("See also: ^2defer_clear^7");
return;
}
}
}
default:
- LOG_INFO("Incorrect parameters for ^2delrec^7\n");
+ LOG_INFO("Incorrect parameters for ^2delrec^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd delrec ranking [map]\n");
- LOG_INFO(" 'ranking' is which ranking level to clear up to, \n");
- LOG_INFO(" it will clear all records up to nth place.\n");
- LOG_INFO(" if 'map' is not provided it will use current map.\n");
+ LOG_INFO("Usage:^3 sv_cmd delrec ranking [map]");
+ LOG_INFO(" 'ranking' is which ranking level to clear up to, ");
+ LOG_INFO(" it will clear all records up to nth place.");
+ LOG_INFO(" if 'map' is not provided it will use current map.");
return;
}
}
string s;
d = db_create();
- LOG_INFO("begin of effects list\n");
+ LOG_INFO("begin of effects list");
db_put(d, "TE_GUNSHOT", "1");
- LOG_INFO("effect TE_GUNSHOT is ", ftos(_particleeffectnum("TE_GUNSHOT")), "\n");
+ LOG_INFO("effect TE_GUNSHOT is ", ftos(_particleeffectnum("TE_GUNSHOT")));
db_put(d, "TE_GUNSHOTQUAD", "1");
- LOG_INFO("effect TE_GUNSHOTQUAD is ", ftos(_particleeffectnum("TE_GUNSHOTQUAD")), "\n");
+ LOG_INFO("effect TE_GUNSHOTQUAD is ", ftos(_particleeffectnum("TE_GUNSHOTQUAD")));
db_put(d, "TE_SPIKE", "1");
- LOG_INFO("effect TE_SPIKE is ", ftos(_particleeffectnum("TE_SPIKE")), "\n");
+ LOG_INFO("effect TE_SPIKE is ", ftos(_particleeffectnum("TE_SPIKE")));
db_put(d, "TE_SPIKEQUAD", "1");
- LOG_INFO("effect TE_SPIKEQUAD is ", ftos(_particleeffectnum("TE_SPIKEQUAD")), "\n");
+ LOG_INFO("effect TE_SPIKEQUAD is ", ftos(_particleeffectnum("TE_SPIKEQUAD")));
db_put(d, "TE_SUPERSPIKE", "1");
- LOG_INFO("effect TE_SUPERSPIKE is ", ftos(_particleeffectnum("TE_SUPERSPIKE")), "\n");
+ LOG_INFO("effect TE_SUPERSPIKE is ", ftos(_particleeffectnum("TE_SUPERSPIKE")));
db_put(d, "TE_SUPERSPIKEQUAD", "1");
- LOG_INFO("effect TE_SUPERSPIKEQUAD is ", ftos(_particleeffectnum("TE_SUPERSPIKEQUAD")), "\n");
+ LOG_INFO("effect TE_SUPERSPIKEQUAD is ", ftos(_particleeffectnum("TE_SUPERSPIKEQUAD")));
db_put(d, "TE_WIZSPIKE", "1");
- LOG_INFO("effect TE_WIZSPIKE is ", ftos(_particleeffectnum("TE_WIZSPIKE")), "\n");
+ LOG_INFO("effect TE_WIZSPIKE is ", ftos(_particleeffectnum("TE_WIZSPIKE")));
db_put(d, "TE_KNIGHTSPIKE", "1");
- LOG_INFO("effect TE_KNIGHTSPIKE is ", ftos(_particleeffectnum("TE_KNIGHTSPIKE")), "\n");
+ LOG_INFO("effect TE_KNIGHTSPIKE is ", ftos(_particleeffectnum("TE_KNIGHTSPIKE")));
db_put(d, "TE_EXPLOSION", "1");
- LOG_INFO("effect TE_EXPLOSION is ", ftos(_particleeffectnum("TE_EXPLOSION")), "\n");
+ LOG_INFO("effect TE_EXPLOSION is ", ftos(_particleeffectnum("TE_EXPLOSION")));
db_put(d, "TE_EXPLOSIONQUAD", "1");
- LOG_INFO("effect TE_EXPLOSIONQUAD is ", ftos(_particleeffectnum("TE_EXPLOSIONQUAD")), "\n");
+ LOG_INFO("effect TE_EXPLOSIONQUAD is ", ftos(_particleeffectnum("TE_EXPLOSIONQUAD")));
db_put(d, "TE_TAREXPLOSION", "1");
- LOG_INFO("effect TE_TAREXPLOSION is ", ftos(_particleeffectnum("TE_TAREXPLOSION")), "\n");
+ LOG_INFO("effect TE_TAREXPLOSION is ", ftos(_particleeffectnum("TE_TAREXPLOSION")));
db_put(d, "TE_TELEPORT", "1");
- LOG_INFO("effect TE_TELEPORT is ", ftos(_particleeffectnum("TE_TELEPORT")), "\n");
+ LOG_INFO("effect TE_TELEPORT is ", ftos(_particleeffectnum("TE_TELEPORT")));
db_put(d, "TE_LAVASPLASH", "1");
- LOG_INFO("effect TE_LAVASPLASH is ", ftos(_particleeffectnum("TE_LAVASPLASH")), "\n");
+ LOG_INFO("effect TE_LAVASPLASH is ", ftos(_particleeffectnum("TE_LAVASPLASH")));
db_put(d, "TE_SMALLFLASH", "1");
- LOG_INFO("effect TE_SMALLFLASH is ", ftos(_particleeffectnum("TE_SMALLFLASH")), "\n");
+ LOG_INFO("effect TE_SMALLFLASH is ", ftos(_particleeffectnum("TE_SMALLFLASH")));
db_put(d, "TE_FLAMEJET", "1");
- LOG_INFO("effect TE_FLAMEJET is ", ftos(_particleeffectnum("TE_FLAMEJET")), "\n");
+ LOG_INFO("effect TE_FLAMEJET is ", ftos(_particleeffectnum("TE_FLAMEJET")));
db_put(d, "EF_FLAME", "1");
- LOG_INFO("effect EF_FLAME is ", ftos(_particleeffectnum("EF_FLAME")), "\n");
+ LOG_INFO("effect EF_FLAME is ", ftos(_particleeffectnum("EF_FLAME")));
db_put(d, "TE_BLOOD", "1");
- LOG_INFO("effect TE_BLOOD is ", ftos(_particleeffectnum("TE_BLOOD")), "\n");
+ LOG_INFO("effect TE_BLOOD is ", ftos(_particleeffectnum("TE_BLOOD")));
db_put(d, "TE_SPARK", "1");
- LOG_INFO("effect TE_SPARK is ", ftos(_particleeffectnum("TE_SPARK")), "\n");
+ LOG_INFO("effect TE_SPARK is ", ftos(_particleeffectnum("TE_SPARK")));
db_put(d, "TE_PLASMABURN", "1");
- LOG_INFO("effect TE_PLASMABURN is ", ftos(_particleeffectnum("TE_PLASMABURN")), "\n");
+ LOG_INFO("effect TE_PLASMABURN is ", ftos(_particleeffectnum("TE_PLASMABURN")));
db_put(d, "TE_TEI_G3", "1");
- LOG_INFO("effect TE_TEI_G3 is ", ftos(_particleeffectnum("TE_TEI_G3")), "\n");
+ LOG_INFO("effect TE_TEI_G3 is ", ftos(_particleeffectnum("TE_TEI_G3")));
db_put(d, "TE_TEI_SMOKE", "1");
- LOG_INFO("effect TE_TEI_SMOKE is ", ftos(_particleeffectnum("TE_TEI_SMOKE")), "\n");
+ LOG_INFO("effect TE_TEI_SMOKE is ", ftos(_particleeffectnum("TE_TEI_SMOKE")));
db_put(d, "TE_TEI_BIGEXPLOSION", "1");
- LOG_INFO("effect TE_TEI_BIGEXPLOSION is ", ftos(_particleeffectnum("TE_TEI_BIGEXPLOSION")), "\n");
+ LOG_INFO("effect TE_TEI_BIGEXPLOSION is ", ftos(_particleeffectnum("TE_TEI_BIGEXPLOSION")));
db_put(d, "TE_TEI_PLASMAHIT", "1");
- LOG_INFO("effect TE_TEI_PLASMAHIT is ", ftos(_particleeffectnum("TE_TEI_PLASMAHIT")), "\n");
+ LOG_INFO("effect TE_TEI_PLASMAHIT is ", ftos(_particleeffectnum("TE_TEI_PLASMAHIT")));
db_put(d, "EF_STARDUST", "1");
- LOG_INFO("effect EF_STARDUST is ", ftos(_particleeffectnum("EF_STARDUST")), "\n");
+ LOG_INFO("effect EF_STARDUST is ", ftos(_particleeffectnum("EF_STARDUST")));
db_put(d, "TR_ROCKET", "1");
- LOG_INFO("effect TR_ROCKET is ", ftos(_particleeffectnum("TR_ROCKET")), "\n");
+ LOG_INFO("effect TR_ROCKET is ", ftos(_particleeffectnum("TR_ROCKET")));
db_put(d, "TR_GRENADE", "1");
- LOG_INFO("effect TR_GRENADE is ", ftos(_particleeffectnum("TR_GRENADE")), "\n");
+ LOG_INFO("effect TR_GRENADE is ", ftos(_particleeffectnum("TR_GRENADE")));
db_put(d, "TR_BLOOD", "1");
- LOG_INFO("effect TR_BLOOD is ", ftos(_particleeffectnum("TR_BLOOD")), "\n");
+ LOG_INFO("effect TR_BLOOD is ", ftos(_particleeffectnum("TR_BLOOD")));
db_put(d, "TR_WIZSPIKE", "1");
- LOG_INFO("effect TR_WIZSPIKE is ", ftos(_particleeffectnum("TR_WIZSPIKE")), "\n");
+ LOG_INFO("effect TR_WIZSPIKE is ", ftos(_particleeffectnum("TR_WIZSPIKE")));
db_put(d, "TR_SLIGHTBLOOD", "1");
- LOG_INFO("effect TR_SLIGHTBLOOD is ", ftos(_particleeffectnum("TR_SLIGHTBLOOD")), "\n");
+ LOG_INFO("effect TR_SLIGHTBLOOD is ", ftos(_particleeffectnum("TR_SLIGHTBLOOD")));
db_put(d, "TR_KNIGHTSPIKE", "1");
- LOG_INFO("effect TR_KNIGHTSPIKE is ", ftos(_particleeffectnum("TR_KNIGHTSPIKE")), "\n");
+ LOG_INFO("effect TR_KNIGHTSPIKE is ", ftos(_particleeffectnum("TR_KNIGHTSPIKE")));
db_put(d, "TR_VORESPIKE", "1");
- LOG_INFO("effect TR_VORESPIKE is ", ftos(_particleeffectnum("TR_VORESPIKE")), "\n");
+ LOG_INFO("effect TR_VORESPIKE is ", ftos(_particleeffectnum("TR_VORESPIKE")));
db_put(d, "TR_NEHAHRASMOKE", "1");
- LOG_INFO("effect TR_NEHAHRASMOKE is ", ftos(_particleeffectnum("TR_NEHAHRASMOKE")), "\n");
+ LOG_INFO("effect TR_NEHAHRASMOKE is ", ftos(_particleeffectnum("TR_NEHAHRASMOKE")));
db_put(d, "TR_NEXUIZPLASMA", "1");
- LOG_INFO("effect TR_NEXUIZPLASMA is ", ftos(_particleeffectnum("TR_NEXUIZPLASMA")), "\n");
+ LOG_INFO("effect TR_NEXUIZPLASMA is ", ftos(_particleeffectnum("TR_NEXUIZPLASMA")));
db_put(d, "TR_GLOWTRAIL", "1");
- LOG_INFO("effect TR_GLOWTRAIL is ", ftos(_particleeffectnum("TR_GLOWTRAIL")), "\n");
+ LOG_INFO("effect TR_GLOWTRAIL is ", ftos(_particleeffectnum("TR_GLOWTRAIL")));
db_put(d, "TR_SEEKER", "1");
- LOG_INFO("effect TR_SEEKER is ", ftos(_particleeffectnum("TR_SEEKER")), "\n");
+ LOG_INFO("effect TR_SEEKER is ", ftos(_particleeffectnum("TR_SEEKER")));
db_put(d, "SVC_PARTICLE", "1");
- LOG_INFO("effect SVC_PARTICLE is ", ftos(_particleeffectnum("SVC_PARTICLE")), "\n");
+ LOG_INFO("effect SVC_PARTICLE is ", ftos(_particleeffectnum("SVC_PARTICLE")));
fh = fopen("effectinfo.txt", FILE_READ);
while ((s = fgets(fh)))
if (db_get(d, argv(1)) != "1")
{
int i = _particleeffectnum(argv(1));
- if (i >= 0) LOG_INFO("effect ", argv(1), " is ", ftos(i), "\n");
+ if (i >= 0) LOG_INFO("effect ", argv(1), " is ", ftos(i));
db_put(d, argv(1), "1");
}
}
}
- LOG_INFO("end of effects list\n");
+ LOG_INFO("end of effects list");
db_close(d);
return;
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd effectindexdump\n");
- LOG_INFO(" No arguments required.\n");
+ LOG_INFO("Usage:^3 sv_cmd effectindexdump");
+ LOG_INFO(" No arguments required.");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd extendmatchtime\n");
- LOG_INFO(" No arguments required.\n");
- LOG_INFO("See also: ^2reducematchtime^7\n");
+ LOG_INFO("Usage:^3 sv_cmd extendmatchtime");
+ LOG_INFO(" No arguments required.");
+ LOG_INFO("See also: ^2reducematchtime^7");
return;
}
}
}
default:
- LOG_INFO("Incorrect parameters for ^2gametype^7\n");
+ LOG_INFO("Incorrect parameters for ^2gametype^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd gametype mode\n");
- LOG_INFO(" Where 'mode' is the gametype mode to switch to.\n");
- LOG_INFO("See also: ^2gotomap^7\n");
+ LOG_INFO("Usage:^3 sv_cmd gametype mode");
+ LOG_INFO(" Where 'mode' is the gametype mode to switch to.");
+ LOG_INFO("See also: ^2gotomap^7");
return;
}
}
if (i)
{
v = gettaginfo(tmp_entity, i);
- LOG_INFO("model ", tmp_entity.model, " frame ", ftos(tmp_entity.frame), " tag ", gettaginfo_name);
- LOG_INFO(" index ", ftos(i), " parent ", ftos(gettaginfo_parent), "\n");
- LOG_INFO(" vector = ", ftos(v.x), " ", ftos(v.y), " ", ftos(v.z), "\n");
- LOG_INFO(" offset = ", ftos(gettaginfo_offset.x), " ", ftos(gettaginfo_offset.y), " ", ftos(gettaginfo_offset.z), "\n");
- LOG_INFO(" forward = ", ftos(gettaginfo_forward.x), " ", ftos(gettaginfo_forward.y), " ", ftos(gettaginfo_forward.z), "\n");
- LOG_INFO(" right = ", ftos(gettaginfo_right.x), " ", ftos(gettaginfo_right.y), " ", ftos(gettaginfo_right.z), "\n");
- LOG_INFO(" up = ", ftos(gettaginfo_up.x), " ", ftos(gettaginfo_up.y), " ", ftos(gettaginfo_up.z), "\n");
+ LOG_INFOF(
+ "model %s frame %s tag %s index %s parent %s",
+ tmp_entity.model, ftos(tmp_entity.frame), gettaginfo_name, ftos(i), ftos(gettaginfo_parent)
+ );
+ LOG_INFOF(" vector = %s %s %s", ftos(v.x), ftos(v.y), ftos(v.z));
+ LOG_INFOF(" offset = %s %s %s", ftos(gettaginfo_offset.x), ftos(gettaginfo_offset.y), ftos(gettaginfo_offset.z));
+ LOG_INFOF(" forward = %s %s %s", ftos(gettaginfo_forward.x), ftos(gettaginfo_forward.y), ftos(gettaginfo_forward.z));
+ LOG_INFOF(" right = %s %s %s", ftos(gettaginfo_right.x), ftos(gettaginfo_right.y), ftos(gettaginfo_right.z));
+ LOG_INFOF(" up = %s %s %s", ftos(gettaginfo_up.x), ftos(gettaginfo_up.y), ftos(gettaginfo_up.z));
if (argc >= 6)
{
v.y = -v.y;
}
else
{
- LOG_INFO("bone not found\n");
+ LOG_INFO("bone not found");
}
delete(tmp_entity);
}
default:
- LOG_INFO("Incorrect parameters for ^2gettaginfo^7\n");
+ LOG_INFO("Incorrect parameters for ^2gettaginfo^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd gettaginfo model frame index [command one] [command two]\n");
- LOG_INFO("See also: ^2bbox, trace^7\n");
+ LOG_INFO("Usage:^3 sv_cmd gettaginfo model frame index [command one] [command two]");
+ LOG_INFO("See also: ^2bbox, trace^7");
return;
}
}
t2 += gettime(GETTIME_HIRES) - t0;
n += 1;
}
- LOG_INFO("model ", tmp_entity.model, " frame ", ftos(f1), " animtime ", ftos(n / t1), "/s\n");
- LOG_INFO("model ", tmp_entity.model, " frame ", ftos(f2), " animtime ", ftos(n / t2), "/s\n");
+ LOG_INFO("model ", tmp_entity.model, " frame ", ftos(f1), " animtime ", ftos(n / t1), "/s");
+ LOG_INFO("model ", tmp_entity.model, " frame ", ftos(f2), " animtime ", ftos(n / t2), "/s");
delete(tmp_entity);
return;
}
default:
- LOG_INFO("Incorrect parameters for ^2gettaginfo^7\n");
+ LOG_INFO("Incorrect parameters for ^2gettaginfo^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd gettaginfo model frame index [command one] [command two]\n");
- LOG_INFO("See also: ^2bbox, trace^7\n");
+ LOG_INFO("Usage:^3 sv_cmd gettaginfo model frame index [command one] [command two]");
+ LOG_INFO("See also: ^2bbox, trace^7");
return;
}
}
{
if (argv(1))
{
- LOG_INFO(GotoMap(argv(1)), "\n");
+ LOG_INFO(GotoMap(argv(1)));
return;
}
}
default:
- LOG_INFO("Incorrect parameters for ^2gotomap^7\n");
+ LOG_INFO("Incorrect parameters for ^2gotomap^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd gotomap map\n");
- LOG_INFO(" Where 'map' is the *.bsp file to change to.\n");
- LOG_INFO("See also: ^2gametype^7\n");
+ LOG_INFO("Usage:^3 sv_cmd gotomap map");
+ LOG_INFO(" Where 'map' is the *.bsp file to change to.");
+ LOG_INFO("See also: ^2gametype^7");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd lockteams\n");
- LOG_INFO(" No arguments required.\n");
- LOG_INFO("See also: ^2unlockteams^7\n");
+ LOG_INFO("Usage:^3 sv_cmd lockteams");
+ LOG_INFO(" No arguments required.");
+ LOG_INFO("See also: ^2unlockteams^7");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd make_mapinfo\n");
- LOG_INFO(" No arguments required.\n");
- LOG_INFO("See also: ^2radarmap^7\n");
+ LOG_INFO("Usage:^3 sv_cmd make_mapinfo");
+ LOG_INFO(" No arguments required.");
+ LOG_INFO("See also: ^2radarmap^7");
return;
}
}
if (accepted <= 0)
{
- LOG_INFO("moveplayer: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : ".\n"));
+ LOG_INFO("moveplayer: ", GetClientErrorString(accepted, t), (targets ? ", skipping to next player.\n" : "."));
continue;
}
}
else
{
- LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already spectating.\n");
+ LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already spectating.");
}
continue;
}
if (team_id == client.team) // already on the destination team
{
// keep the forcing undone
- LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7.\n"));
+ LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") is already on the ", Team_ColoredFullName(client.team), (targets ? "^7, skipping to next player.\n" : "^7."));
continue;
}
else if (team_id == 0) // auto team
// Check to see if the destination team is even available
switch (team_id)
{
- case NUM_TEAM_1: if (c1 == -1) { LOG_INFO("Sorry, can't move player to red team if it doesn't exist.\n"); return; } break;
- case NUM_TEAM_2: if (c2 == -1) { LOG_INFO("Sorry, can't move player to blue team if it doesn't exist.\n"); return; } break;
- case NUM_TEAM_3: if (c3 == -1) { LOG_INFO("Sorry, can't move player to yellow team if it doesn't exist.\n"); return; } break;
- case NUM_TEAM_4: if (c4 == -1) { LOG_INFO("Sorry, can't move player to pink team if it doesn't exist.\n"); return; } break;
+ case NUM_TEAM_1: if (c1 == -1) { LOG_INFO("Sorry, can't move player to red team if it doesn't exist."); return; } break;
+ case NUM_TEAM_2: if (c2 == -1) { LOG_INFO("Sorry, can't move player to blue team if it doesn't exist."); return; } break;
+ case NUM_TEAM_3: if (c3 == -1) { LOG_INFO("Sorry, can't move player to yellow team if it doesn't exist."); return; } break;
+ case NUM_TEAM_4: if (c4 == -1) { LOG_INFO("Sorry, can't move player to pink team if it doesn't exist."); return; } break;
- default: LOG_INFO("Sorry, can't move player here if team ", destination, " doesn't exist.\n");
+ default: LOG_INFO("Sorry, can't move player here if team ", destination, " doesn't exist.");
return;
}
client.team_forced = 0;
MoveToTeam(client, team_id, 6);
successful = strcat(successful, (successful ? ", " : ""), playername(client, false));
- LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") has been moved to the ", Team_ColoredFullName(team_id), "^7.\n");
+ LOG_INFO("Player ", ftos(GetFilteredNumber(t)), " (", playername(client, false), ") has been moved to the ", Team_ColoredFullName(team_id), "^7.");
continue;
}
else
{
- LOG_INFO("Can't change teams when currently not playing a team game.\n");
+ LOG_INFO("Can't change teams when currently not playing a team game.");
return;
}
}
else
{
- LOG_INFO("Can't change teams if the player isn't in the game.\n"); // well technically we could, but should we allow that? :P
+ LOG_INFO("Can't change teams if the player isn't in the game."); // well technically we could, but should we allow that? :P
return;
}
}
}
if (successful) bprint("Successfully moved players ", successful, " to destination ", destination, ".\n");
- else LOG_INFO("No players given (", original_targets, ") are able to move.\n");
+ else LOG_INFO("No players given (", original_targets, ") are able to move.");
return; // still correct parameters so return to avoid usage print
}
}
default:
- LOG_INFO("Incorrect parameters for ^2moveplayer^7\n");
+ LOG_INFO("Incorrect parameters for ^2moveplayer^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd moveplayer clients destination\n");
- LOG_INFO(" 'clients' is a list (separated by commas) of player entity ID's or nicknames\n");
- LOG_INFO(" 'destination' is what to send the player to, be it team or spectating\n");
- LOG_INFO(" Full list of destinations here: \"spec, spectator, red, blue, yellow, pink, auto.\"\n");
- LOG_INFO("Examples: sv_cmd moveplayer 1,3,5 red 3\n");
- LOG_INFO(" sv_cmd moveplayer 2 spec \n");
- LOG_INFO("See also: ^2allspec, shuffleteams^7\n");
+ LOG_INFO("Usage:^3 sv_cmd moveplayer clients destination");
+ LOG_INFO(" 'clients' is a list (separated by commas) of player entity ID's or nicknames");
+ LOG_INFO(" 'destination' is what to send the player to, be it team or spectating");
+ LOG_INFO(" Full list of destinations here: \"spec, spectator, red, blue, yellow, pink, auto.\"");
+ LOG_INFO("Examples: sv_cmd moveplayer 1,3,5 red 3");
+ LOG_INFO(" sv_cmd moveplayer 2 spec ");
+ LOG_INFO("See also: ^2allspec, shuffleteams^7");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd nospectators\n");
- LOG_INFO(" No arguments required.\n");
+ LOG_INFO("Usage:^3 sv_cmd nospectators");
+ LOG_INFO(" No arguments required.");
return;
}
}
if (accepted <= 0)
{
- LOG_INFO("playerdemo: read: ", GetClientErrorString(accepted, argv(2)), ".\n");
+ LOG_INFO("playerdemo: read: ", GetClientErrorString(accepted, argv(2)), ".");
return;
}
if (accepted <= 0)
{
- LOG_INFO("playerdemo: write: ", GetClientErrorString(accepted, argv(2)), ".\n");
+ LOG_INFO("playerdemo: write: ", GetClientErrorString(accepted, argv(2)), ".");
return;
}
}
default:
- LOG_INFO("Incorrect parameters for ^2playerdemo^7\n");
+ LOG_INFO("Incorrect parameters for ^2playerdemo^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd playerdemo command (entitynumber filename | entitynumber botnumber)\n");
- LOG_INFO(" Full list of commands here: \"read, write, auto_read_and_write, auto_read.\"\n");
+ LOG_INFO("Usage:^3 sv_cmd playerdemo command (entitynumber filename | entitynumber botnumber)");
+ LOG_INFO(" Full list of commands here: \"read, write, auto_read_and_write, auto_read.\"");
return;
}
}
case CMD_REQUEST_COMMAND:
{
DumpStats(false);
- LOG_INFO("stats dumped.\n");
+ LOG_INFO("stats dumped.");
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd printstats\n");
- LOG_INFO(" No arguments required.\n");
+ LOG_INFO("Usage:^3 sv_cmd printstats");
+ LOG_INFO(" No arguments required.");
return;
}
}
}
default:
- LOG_INFO("Incorrect parameters for ^2radarmap^7\n");
+ LOG_INFO("Incorrect parameters for ^2radarmap^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd radarmap [--force] [--loop] [--quit] [--block | --trace | --sample | --lineblock] [--sharpen N] [--res W H] [--qual Q]\n");
- LOG_INFO(" The quality factor Q is roughly proportional to the time taken.\n");
- LOG_INFO(" trace supports no quality factor; its result should look like --block with infinite quality factor.\n");
- LOG_INFO("See also: ^2make_mapinfo^7\n");
+ LOG_INFO("Usage:^3 sv_cmd radarmap [--force] [--loop] [--quit] [--block | --trace | --sample | --lineblock] [--sharpen N] [--res W H] [--qual Q]");
+ LOG_INFO(" The quality factor Q is roughly proportional to the time taken.");
+ LOG_INFO(" trace supports no quality factor; its result should look like --block with infinite quality factor.");
+ LOG_INFO("See also: ^2make_mapinfo^7");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd reducematchtime\n");
- LOG_INFO(" No arguments required.\n");
- LOG_INFO("See also: ^2extendmatchtime^7\n");
+ LOG_INFO("Usage:^3 sv_cmd reducematchtime");
+ LOG_INFO(" No arguments required.");
+ LOG_INFO("See also: ^2extendmatchtime^7");
return;
}
}
}
default:
- LOG_INFO("Incorrect parameters for ^2setbots^7\n");
+ LOG_INFO("Incorrect parameters for ^2setbots^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd setbots botnumber\n");
- LOG_INFO(" Where 'botnumber' is the amount of bots to set bot_number cvar to.\n");
- LOG_INFO("See also: ^2bot_cmd^7\n");
+ LOG_INFO("Usage:^3 sv_cmd setbots botnumber");
+ LOG_INFO(" Where 'botnumber' is the amount of bots to set bot_number cvar to.");
+ LOG_INFO("See also: ^2bot_cmd^7");
return;
}
}
{
if (!teamplay)
{
- LOG_INFO("Can't shuffle teams when currently not playing a team game.\n");
+ LOG_INFO("Can't shuffle teams when currently not playing a team game.");
return;
}
// we could theoretically assign forced players to their teams
// and shuffle the rest to fill the empty spots but in practise
// either all players or none are gonna have forced teams
- LOG_INFO("Can't shuffle teams because at least one player has a forced team.\n");
+ LOG_INFO("Can't shuffle teams because at least one player has a forced team.");
return;
}
});
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd shuffleteams\n");
- LOG_INFO(" No arguments required.\n");
- LOG_INFO("See also: ^2moveplayer, allspec^7\n");
+ LOG_INFO("Usage:^3 sv_cmd shuffleteams");
+ LOG_INFO(" No arguments required.");
+ LOG_INFO("See also: ^2moveplayer, allspec^7");
return;
}
}
if (accepted > 0)
{
stuffcmd(client, strcat("\n", argv(next_token), "\n"));
- LOG_INFO(strcat("Command: \"", argv(next_token), "\" sent to ", GetCallerName(client), " (", argv(1), ").\n"));
+ LOG_INFO("Command: \"", argv(next_token), "\" sent to ", GetCallerName(client), " (", argv(1), ").");
}
else
{
- LOG_INFO("stuffto: ", GetClientErrorString(accepted, argv(1)), ".\n");
+ LOG_INFO("stuffto: ", GetClientErrorString(accepted, argv(1)), ".");
}
return;
}
default:
- LOG_INFO("Incorrect parameters for ^2stuffto^7\n");
+ LOG_INFO("Incorrect parameters for ^2stuffto^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd stuffto client \"command\"\n");
- LOG_INFO(" 'client' is the entity number or name of the player,\n");
- LOG_INFO(" and 'command' is the command to be sent to that player.\n");
+ LOG_INFO("Usage:^3 sv_cmd stuffto client \"command\"");
+ LOG_INFO(" 'client' is the entity number or name of the player,");
+ LOG_INFO(" and 'command' is the command to be sent to that player.");
return;
}
}
#else
if (request)
{
- LOG_INFO("stuffto command is not enabled on this server.\n");
+ LOG_INFO("stuffto command is not enabled on this server.");
return;
}
#endif
case "debug":
{
float hitcount = 0;
- LOG_INFO("TEST CASE. If this returns the runaway loop counter error, possibly everything is oaky.\n");
+ LOG_INFO("TEST CASE. If this returns the runaway loop counter error, possibly everything is oaky.");
float worst_endpos_bug = 0;
for ( ; ; )
{
}
}
- LOG_INFO("safe distance to back off: ", ftos(safe * vlen(p - start)), "qu\n");
- LOG_INFO("unsafe distance to back off: ", ftos(unsafe * vlen(p - start)), "qu\n");
+ LOG_INFO("safe distance to back off: ", ftos(safe * vlen(p - start)), "qu");
+ LOG_INFO("unsafe distance to back off: ", ftos(unsafe * vlen(p - start)), "qu");
tracebox(p, PL_MIN_CONST + '0.1 0.1 0.1', PL_MAX_CONST - '0.1 0.1 0.1', p, MOVE_NOMONSTERS, NULL);
- if (trace_startsolid) LOG_INFO("trace_endpos much in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
- else LOG_INFO("trace_endpos just in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
+ if (trace_startsolid) LOG_INFO("trace_endpos much in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p));
+ else LOG_INFO("trace_endpos just in solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p));
if (++hitcount >= 10) break;
}
else
if (dq > worst_endpos_bug)
{
worst_endpos_bug = dq;
- LOG_INFO("trace_endpos still before solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p), "\n");
- LOG_INFO("could go ", ftos(dq), " units further to ", vtos(q), "\n");
+ LOG_INFO("trace_endpos still before solid when tracing from ", vtos(start), " to ", vtos(end), " endpos ", vtos(p));
+ LOG_INFO("could go ", ftos(dq), " units further to ", vtos(q));
if (++hitcount >= 10) break;
}
}
vv = trace_endpos;
if (trace_fraction == 1)
{
- LOG_INFO("not above ground, aborting\n");
+ LOG_INFO("not above ground, aborting");
return;
}
f = 0;
dv = randomvec();
if (dv.z > 0) dv = -1 * dv;
tracebox(vv, e.mins, e.maxs, vv + dv, MOVE_NORMAL, e);
- if (trace_startsolid) LOG_INFO("bug 1\n");
+ if (trace_startsolid) LOG_INFO("bug 1");
if (trace_fraction == 1)
{
if (dv.z < f)
{
LOG_INFO("bug 2: ", ftos(dv.x), " ", ftos(dv.y), " ", ftos(dv.z));
- LOG_INFO(" (", ftos(asin(dv.z / vlen(dv)) * 180 / M_PI), " degrees)\n");
+ LOG_INFO(" (", ftos(asin(dv.z / vlen(dv)) * 180 / M_PI), " degrees)");
f = dv.z;
}
}
}
- LOG_INFO("highest possible dist: ", ftos(f), "\n");
+ LOG_INFO("highest possible dist: ", ftos(f));
return;
}
if (argc == 4)
{
e = nextent(NULL);
- if (tracewalk(e, stov(argv(2)), e.mins, e.maxs, stov(argv(3)), MOVE_NORMAL)) LOG_INFO("can walk\n");
- else LOG_INFO("cannot walk\n");
+ if (tracewalk(e, stov(argv(2)), e.mins, e.maxs, stov(argv(3)), MOVE_NORMAL)) LOG_INFO("can walk");
+ else LOG_INFO("cannot walk");
return;
}
}
}
default:
- LOG_INFO("Incorrect parameters for ^2trace^7\n");
+ LOG_INFO("Incorrect parameters for ^2trace^7");
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd trace command (startpos endpos)\n");
- LOG_INFO(" Full list of commands here: \"debug, debug2, walk, showline.\"\n");
- LOG_INFO("See also: ^2bbox, gettaginfo^7\n");
+ LOG_INFO("Usage:^3 sv_cmd trace command (startpos endpos)");
+ LOG_INFO(" Full list of commands here: \"debug, debug2, walk, showline.\"");
+ LOG_INFO("See also: ^2bbox, gettaginfo^7");
return;
}
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd unlockteams\n");
- LOG_INFO(" No arguments required.\n");
- LOG_INFO("See also: ^2lockteams^7\n");
+ LOG_INFO("Usage:^3 sv_cmd unlockteams");
+ LOG_INFO(" No arguments required.");
+ LOG_INFO("See also: ^2lockteams^7");
return;
}
}
if (argc >= 2)
{
CampaignLevelWarp(stof(argv(1)));
- LOG_INFO("Successfully warped to campaign level ", argv(1), ".\n");
+ LOG_INFO("Successfully warped to campaign level ", argv(1), ".");
}
else
{
CampaignLevelWarp(-1);
- LOG_INFO("Successfully warped to next campaign level.\n");
+ LOG_INFO("Successfully warped to next campaign level.");
}
}
else
{
- LOG_INFO("Not in campaign, can't level warp\n");
+ LOG_INFO("Not in campaign, can't level warp");
}
return;
}
default:
case CMD_REQUEST_USAGE:
{
- LOG_INFO("\nUsage:^3 sv_cmd warp [level]\n");
- LOG_INFO(" 'level' is the level to change campaign mode to.\n");
- LOG_INFO(" if 'level' is not provided it will change to the next level.\n");
+ LOG_INFO("Usage:^3 sv_cmd warp [level]");
+ LOG_INFO(" 'level' is the level to change campaign mode to.");
+ LOG_INFO(" if 'level' is not provided it will change to the next level.");
return;
}
}
void GameCommand_macro_help()
{
- FOREACH(SERVER_COMMANDS, true, { LOG_INFOF(" ^2%s^7: %s\n", it.m_name, it.m_description); });
+ FOREACH(SERVER_COMMANDS, true, { LOG_INFOF(" ^2%s^7: %s", it.m_name, it.m_description); });
}
float GameCommand_macro_command(float argc, string command)
{
if (argc == 1)
{
- LOG_INFO("\nServer console commands:\n");
+ LOG_INFO("Server console commands:");
GameCommand_macro_help();
- LOG_INFO("\nBanning commands:\n");
+ LOG_INFO("\nBanning commands:");
BanCommand_macro_help();
- LOG_INFO("\nCommon networked commands:\n");
+ LOG_INFO("\nCommon networked commands:");
CommonCommand_macro_help(NULL);
- LOG_INFO("\nGeneric commands shared by all programs:\n");
+ LOG_INFO("\nGeneric commands shared by all programs:");
GenericCommand_macro_help();
- LOG_INFO("\nUsage:^3 sv_cmd COMMAND...^7, where possible commands are listed above.\n");
- LOG_INFO("For help about a specific command, type sv_cmd help COMMAND\n");
+ LOG_INFO(
+ "\nUsage:^3 sv_cmd COMMAND...^7, where possible commands are listed above.\n"
+ "For help about a specific command, type sv_cmd help COMMAND"
+ );
return;
}
}
// nothing above caught the command, must be invalid
- LOG_INFO(((command != "") ? strcat("Unknown server command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try sv_cmd help.\n");
+ LOG_INFO(((command != "") ? strcat("Unknown server command \"", command, "\"") : "No command provided"), ". For a list of supported commands, try sv_cmd help.");
}
if(cvar_type(cvarname) & CVAR_TYPEFLAG_EXISTS)
cmdrestriction = cvar_string(cvarname);
else
- LOG_INFO("NOTE: ", cvarname, " does not exist, no restrictions will be applied.\n");
+ LOG_INFO("NOTE: ", cvarname, " does not exist, no restrictions will be applied.");
if (cmdrestriction == "") return true;
.float bulletcounter;
// Nexball
-.entity ballcarried; // Also used for keepaway
float g_nexball_meter_period;
void SUB_DontUseTargets(entity this, entity actor, entity trigger);
void UpdateFrags(entity player, int f)
{
- PlayerTeamScore_AddScore(player, f);
+ GameRules_scoring_add_team(player, SCORE, f);
}
void GiveFrags (entity attacker, entity targ, float f, int deathtype)
if(targ == attacker)
{
// suicide
- PlayerScore_Add(attacker, SP_SUICIDES, 1);
+ GameRules_scoring_add(attacker, SUICIDES, 1);
}
else
{
// teamkill
- PlayerScore_Add(attacker, SP_KILLS, -1); // or maybe add a teamkills field?
+ GameRules_scoring_add(attacker, KILLS, -1); // or maybe add a teamkills field?
}
}
else
{
// regular frag
- PlayerScore_Add(attacker, SP_KILLS, 1);
+ GameRules_scoring_add(attacker, KILLS, 1);
if(targ.playerid)
PS_GR_P_ADDVAL(attacker, sprintf("kills-%d", targ.playerid), 1);
}
- PlayerScore_Add(targ, SP_DEATHS, 1);
+ GameRules_scoring_add(targ, DEATHS, 1);
.entity weaponentity = weaponentities[0]; // TODO: unhardcode
LogDeath("accident", deathtype, targ, targ);
GiveFrags(targ, targ, -1, deathtype);
- if(PlayerScore_Add(targ, SP_SCORE, 0) == -5)
+ if(GameRules_scoring_add(targ, SCORE, 0) == -5)
{
Send_Notification(NOTIF_ONE, targ, MSG_ANNCE, ANNCE_ACHIEVEMENT_BOTLIKE);
PS_GR_P_ADDVAL(attacker, PLAYERSTATS_ACHIEVEMENT_BOTLIKE, 1);
force = force * a;
if(autocvar_g_throughfloor_debug)
- LOG_INFOF(" D=%f F=%f\n", finaldmg, vlen(force));
+ LOG_INFOF(" D=%f F=%f", finaldmg, vlen(force));
}
//if (targ == attacker)
else
{
this.nextthink = time + 1;
- LOG_INFO("Waiting for _sv_init being set to 1 by initialization scripts...\n");
+ LOG_INFO("Waiting for _sv_init being set to 1 by initialization scripts...");
}
}
tracebox(o, '-1 -1 -1' * i, '1 1 1' * i, o - '0 0 32768', MOVE_WORLDONLY, NULL);
if(trace_fraction == 1)
continue;
- LOG_INFO(ftos(i), " -> ", vtos(trace_endpos), "\n");
+ LOG_INFO(ftos(i), " -> ", vtos(trace_endpos));
}
break;
MapInfo_Shutdown();
}
-void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override)
-{
- if(!autocvar_g_campaign)
- {
- if(fraglimit_override >= 0) cvar_set("fraglimit", ftos(fraglimit_override));
- if(timelimit_override >= 0) cvar_set("timelimit", ftos(timelimit_override));
- if(leadlimit_override >= 0) cvar_set("leadlimit", ftos(leadlimit_override));
- if(qualifying_override >= 0) cvar_set("g_race_qualifying_timelimit", ftos(qualifying_override));
- }
- limits_are_set = true;
-}
-
void Map_MarkAsRecent(string m);
float world_already_spawned;
void Nagger_Init();
fclose(sentinel);
if (switchversion != "" && switchversion != WATERMARK)
{
- LOG_INFOF("Switching progs: " WATERMARK " -> %s\n", switchversion);
+ LOG_INFOF("Switching progs: " WATERMARK " -> %s", switchversion);
// if it doesn't exist, assume either:
// a) the current program was overwritten
// b) this is a client only update
}
if (wantrestart)
{
- LOG_INFOF("Restart requested\n");
+ LOG_INFOF("Restart requested");
changelevel(mapname);
// let initialization continue, shutdown depends on it
}
readlevelcvars();
GrappleHookInit();
- if(!limits_are_set)
- SetLimits(autocvar_fraglimit_override, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
+ GameRules_limit_fallbacks();
if(warmup_limit == 0)
warmup_limit = (autocvar_timelimit > 0) ? autocvar_timelimit * 60 : autocvar_timelimit;
continue;
if(argv(0) == "cd")
{
- LOG_INFO("Found ^1UNSUPPORTED^7 cd loop command in .cfg file; put this line in mapinfo instead:\n");
- LOG_INFO(" cdtrack ", argv(2), "\n");
+ LOG_INFO("Found ^1UNSUPPORTED^7 cd loop command in .cfg file; put this line in mapinfo instead:");
+ LOG_INFO(" cdtrack ", argv(2));
}
else if(argv(0) == "fog")
{
- LOG_INFO("Found ^1UNSUPPORTED^7 fog command in .cfg file; put this line in worldspawn in the .map/.bsp/.ent file instead:\n");
- LOG_INFO(" \"fog\" \"", s, "\"\n");
+ LOG_INFO("Found ^1UNSUPPORTED^7 fog command in .cfg file; put this line in worldspawn in the .map/.bsp/.ent file instead:");
+ LOG_INFO(" \"fog\" \"", s, "\"");
}
else if(argv(0) == "set")
{
- LOG_INFO("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:\n");
- LOG_INFO(" clientsettemp_for_type all ", argv(1), " ", argv(2), "\n");
+ LOG_INFO("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:");
+ LOG_INFO(" clientsettemp_for_type all ", argv(1), " ", argv(2));
}
else if(argv(0) != "//")
{
- LOG_INFO("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:\n");
- LOG_INFO(" clientsettemp_for_type all ", argv(0), " ", argv(1), "\n");
+ LOG_INFO("Found ^1UNSUPPORTED^7 set command in .cfg file; put this line in mapinfo instead:");
+ LOG_INFO(" clientsettemp_for_type all ", argv(0), " ", argv(1));
}
}
fclose(fd);
s = strcat(s, GetGametype(), "_", GetMapname(), ":", ftos(rint(time)));
if(to_console)
- LOG_INFO(s, "\n");
+ LOG_INFO(s);
if(to_eventlog)
GameLogEcho(s);
s = strcat(":labels:player:", GetPlayerScoreString(NULL, 0));
if(to_console)
- LOG_INFO(s, "\n");
+ LOG_INFO(s);
if(to_eventlog)
GameLogEcho(s);
if(to_file)
s = strcat(s, "spectator:");
if(to_console)
- LOG_INFO(s, playername(it, false), "\n");
+ LOG_INFO(s, playername(it, false));
if(to_eventlog)
GameLogEcho(strcat(s, ftos(it.playerid), ":", playername(it, false)));
if(to_file)
{
s = strcat(":labels:teamscores:", GetTeamScoreString(0, 0));
if(to_console)
- LOG_INFO(s, "\n");
+ LOG_INFO(s);
if(to_eventlog)
GameLogEcho(s);
if(to_file)
s = strcat(":teamscores:see-labels:", GetTeamScoreString(i, 0));
s = strcat(s, ":", ftos(i));
if(to_console)
- LOG_INFO(s, "\n");
+ LOG_INFO(s);
if(to_eventlog)
GameLogEcho(s);
if(to_file)
}
if(to_console)
- LOG_INFO(":end\n");
+ LOG_INFO(":end");
if(to_eventlog)
GameLogEcho(":end");
if(to_file)
totalplayers = playerswithlaps = readyplayers = 0;
FOREACH_CLIENT(IS_PLAYER(it), {
++totalplayers;
- if(PlayerScore_Add(it, SP_RACE_FASTEST, 0))
+ if(GameRules_scoring_add(it, RACE_FASTEST, 0))
++playerswithlaps;
if(it.ready)
++readyplayers;
clients_found = 0;
FOREACH_CLIENT(IS_REAL_CLIENT(it), {
// TODO add timer
- LOG_INFO("Redirecting: sending connect command to ", it.netname, "\n");
+ LOG_INFO("Redirecting: sending connect command to ", it.netname);
if(redirection_target == "self")
stuffcmd(it, "\ndisconnect; defer ", ftos(autocvar_quit_and_redirect_timer), " reconnect\n");
else
++clients_found;
});
- LOG_INFO("Redirecting: ", ftos(clients_found), " clients left.\n");
+ LOG_INFO("Redirecting: ", ftos(clients_found), " clients left.");
if(time > redirection_timeout || clients_found == 0)
localcmd("\nwait; wait; wait; quit\n");
}
else if(world_initialized == 0)
{
- LOG_INFO("NOTE: crashed before even initializing the world, not saving persistent data\n");
+ LOG_INFO("NOTE: crashed before even initializing the world, not saving persistent data");
}
else
{
const int WINNING_NEVER = 2; // no winner, enter overtime if time limit is reached
const int WINNING_STARTSUDDENDEATHOVERTIME = 3; // no winner, enter suddendeath overtime NOW
-bool limits_are_set = false;
-void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override);
-
float WinningCondition_Scores(float limit, float leadlimit);
void SetWinners(.float field, float value);
void IntermissionThink(entity this);
if (e.wphardwired)
{
- LOG_INFO("^1Warning: ^7Removal of hardwired waypoints is not allowed in the editor. Please remove links from/to this waypoint (", vtos(e.origin), ") by hand from maps/", mapname, ".waypoints.hardwired\n");
+ LOG_INFO("^1Warning: ^7Removal of hardwired waypoints is not allowed in the editor. Please remove links from/to this waypoint (", vtos(e.origin), ") by hand from maps/", mapname, ".waypoints.hardwired");
return;
}
m = 0;
IL_EACH(g_waypoints, it.wpcost >= 10000000,
{
- LOG_INFO("unreachable: ", etos(it), " ", vtos(it.origin), "\n");
+ LOG_INFO("unreachable: ", etos(it), " ", vtos(it.origin));
it.colormod_z = 8;
it.effects |= EF_NODEPTHTEST | EF_BLUE;
++j;
++m;
});
- if (j) LOG_INFOF("%d waypoints cannot be reached from here in any way (marked with blue light)\n", j);
+ if (j) LOG_INFOF("%d waypoints cannot be reached from here in any way (marked with blue light)", j);
navigation_markroutes_inverted(e2);
j = 0;
IL_EACH(g_waypoints, it.wpcost >= 10000000,
{
- LOG_INFO("cannot reach me: ", etos(it), " ", vtos(it.origin), "\n");
+ LOG_INFO("cannot reach me: ", etos(it), " ", vtos(it.origin));
it.colormod_x = 8;
if (!(it.effects & EF_NODEPTHTEST)) // not already reported before
++m;
it.effects |= EF_NODEPTHTEST | EF_RED;
++j;
});
- if (j) LOG_INFOF("%d waypoints cannot walk to here in any way (marked with red light)\n", j);
- if (m) LOG_INFOF("%d waypoints have been marked total\n", m);
+ if (j) LOG_INFOF("%d waypoints cannot walk to here in any way (marked with red light)", j);
+ if (m) LOG_INFOF("%d waypoints have been marked total", m);
j = 0;
IL_EACH(g_spawnpoints, true,
else
{
setorigin(it, org);
- LOG_INFO("spawn without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
+ LOG_INFO("spawn without waypoint: ", etos(it), " ", vtos(it.origin));
it.effects |= EF_NODEPTHTEST;
_setmodel(it, this.model);
it.frame = this.frame;
++j;
}
});
- if (j) LOG_INFOF("%d spawnpoints have no nearest waypoint (marked by player model)\n", j);
+ if (j) LOG_INFOF("%d spawnpoints have no nearest waypoint (marked by player model)", j);
j = 0;
IL_EACH(g_items, true,
IL_EACH(g_items, true,
{
if (navigation_findnearestwaypoint(it, false)) continue;
- LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
+ LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin));
it.effects |= EF_NODEPTHTEST | EF_RED;
it.colormod_x = 8;
++j;
});
- if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked away from (marked with red light)\n", j);
+ if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked away from (marked with red light)", j);
j = 0;
IL_EACH(g_items, true,
{
if (navigation_findnearestwaypoint(it, true)) continue;
- LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin), "\n");
+ LOG_INFO("item without waypoint: ", etos(it), " ", vtos(it.origin));
it.effects |= EF_NODEPTHTEST | EF_BLUE;
it.colormod_z = 8;
++j;
});
- if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked to (marked with blue light)\n", j);
+ if (j) LOG_INFOF("%d items have no nearest waypoint and cannot be walked to (marked with blue light)", j);
}
if(id >= MAX_IPBAN_URIS)
{
- LOG_INFO("Received ban list for invalid ID\n");
+ LOG_INFO("Received ban list for invalid ID");
return;
}
tokenize_console(autocvar_g_ban_sync_uri);
uri = argv(id);
- LOG_INFO("Received ban list from ", uri, ": ");
+ string prelude = strcat("Received ban list from ", uri, ": ");
if(OnlineBanList_RequestWaiting[id] == 0)
{
- LOG_INFO("rejected (unexpected)\n");
+ LOG_INFO(prelude, "rejected (unexpected)");
return;
}
if(time > OnlineBanList_Timeout)
{
- LOG_INFO("rejected (too late)\n");
+ LOG_INFO(prelude, "rejected (too late)");
return;
}
syncinterval = autocvar_g_ban_sync_interval;
if(syncinterval == 0)
{
- LOG_INFO("rejected (syncing disabled)\n");
+ LOG_INFO(prelude, "rejected (syncing disabled)");
return;
}
if(syncinterval > 0)
if(status != 0)
{
- LOG_INFO("error: status is ", ftos(status), "\n");
+ LOG_INFO(prelude, "error: status is ", ftos(status));
return;
}
if(substring(data, 0, 1) == "<")
{
- LOG_INFO("error: received HTML instead of a ban list\n");
+ LOG_INFO(prelude, "error: received HTML instead of a ban list");
return;
}
if(strstrofs(data, "\r", 0) != -1)
{
- LOG_INFO("error: received carriage returns\n");
+ LOG_INFO(prelude, "error: received carriage returns");
return;
}
if((n % 4) != 0)
{
- LOG_INFO("error: received invalid item count: ", ftos(n), "\n");
+ LOG_INFO(prelude, "error: received invalid item count: ", ftos(n));
return;
}
- LOG_INFO("OK, ", ftos(n / 4), " items\n");
+ LOG_INFO(prelude, "OK, ", ftos(n / 4), " items");
for(i = 0; i < n; i += 4)
{
for(j = 0; j < l; ++j)
if(strstrofs("0123456789.", substring(ip, j, 1), 0) == -1)
{
- LOG_INFO("Invalid character ", substring(ip, j, 1), " in IP address ", ip, ". Skipping this ban.\n");
+ LOG_INFO("Invalid character ", substring(ip, j, 1), " in IP address ", ip, ". Skipping this ban.");
goto skip;
}
}
// the ban will be prolonged on the next sync
// or expire 5 seconds after the next timeout
Ban_Insert(ip, timeleft, strcat("ban synced from ", serverip, " at ", uri), 0);
- LOG_INFO("Ban list syncing: accepted ban of ", ip, " by ", serverip, " at ", uri, ": ");
- LOG_INFO(reason, "\n");
+ LOG_INFO("Ban list syncing: accepted ban of ", ip, " by ", serverip, " at ", uri, ": ", reason);
LABEL(skip)
}
float i, n;
string msg;
- LOG_INFO("^2Listing all existing active bans:\n");
+ LOG_INFO("^2Listing all existing active bans:");
n = 0;
for(i = 0; i < ban_count; ++i)
msg = strcat(msg, ban_ip[i], " is still banned for ");
msg = strcat(msg, ftos(ban_expire[i] - time), " seconds");
- LOG_INFO(" ", msg, "\n");
+ LOG_INFO(" ", msg);
}
- LOG_INFO("^2Done listing all active (", ftos(n), ") bans.\n");
+ LOG_INFO("^2Done listing all active (", ftos(n), ") bans.");
}
float Ban_GetClientIP(entity client)
if(i < ban_count)
if(ban_expire[i] > time + bantime)
{
- LOG_INFO(ip, " could not get banned due to no free ban slot\n");
+ LOG_INFO(ip, " could not get banned due to no free ban slot");
return false;
}
// okay, insert our new victim as i
}
else
{
- LOG_INFO("Received HTTP request data for an invalid id ", ftos(id), ".\n");
+ LOG_INFO("Received HTTP request data for an invalid id ", ftos(id), ".");
}
}
#include <server/scores.qh>
#include <server/scores_rules.qh>
#include <server/teamplay.qh>
+#include <common/gamemodes/rules.qh>
#include "mutator.qh"
{
if(this.enemy.health - this.dmg > 0.5)
{
- PlayerTeamScore_Add(actor, SP_SCORE, ST_SCORE, this.dmg);
+ GameRules_scoring_add_team(actor, SCORE, this.dmg);
this.enemy.health = this.enemy.health - this.dmg;
}
else
{
- PlayerTeamScore_Add(actor, SP_SCORE, ST_SCORE, this.enemy.health);
- PlayerTeamScore_Add(actor, SP_ASSAULT_OBJECTIVES, ST_ASSAULT_OBJECTIVES, 1);
+ GameRules_scoring_add_team(actor, SCORE, this.enemy.health);
+ GameRules_scoring_add_team(actor, ASSAULT_OBJECTIVES, 1);
this.enemy.health = -1;
if(this.enemy.message)
// readyrestart not supported (yet)
return true;
}
-
-// scoreboard setup
-void assault_ScoreRules()
-{
- int teams = 0;
- teams |= BIT(0);
- teams |= BIT(1); // always red vs blue
-
- ScoreRules_basics(teams, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, true);
- ScoreInfo_SetLabel_TeamScore( ST_ASSAULT_OBJECTIVES, "objectives", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore(SP_ASSAULT_OBJECTIVES, "objectives", SFL_SORT_PRIO_PRIMARY);
- ScoreRules_basics_end();
-}
#include "../gamemode.qh"
-void assault_ScoreRules();
+const int ST_ASSAULT_OBJECTIVES = 1;
REGISTER_MUTATOR(as, false)
{
- ActivateTeamplay();
- have_team_spawns = -1; // request team spawns
-
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- assault_ScoreRules();
+ GameRules_teams(true);
+ int teams = BITS(2); // always red vs blue
+ GameRules_scoring(teams, SFL_SORT_PRIO_SECONDARY, SFL_SORT_PRIO_SECONDARY, {
+ field_team(ST_ASSAULT_OBJECTIVES, "objectives", SFL_SORT_PRIO_PRIMARY);
+ field(SP_ASSAULT_OBJECTIVES, "objectives", SFL_SORT_PRIO_PRIMARY);
+ });
}
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back assault_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
- }
-
return 0;
}
void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_items;
void(entity this, float ratingscale, vector org, float sradius) havocbot_goalrating_enemyplayers;
-// scoreboard stuff
-const float ST_ASSAULT_OBJECTIVES = 1;
-
// predefined spawnfuncs
void target_objective_decrease_activate(entity this);
float excess = max(0, frag_damage - damage_take - damage_save);
if (frag_target != frag_attacker && IS_PLAYER(frag_attacker))
- PlayerTeamScore_Add(frag_attacker, SP_SCORE, ST_SCORE, (frag_damage - excess) * autocvar_g_ca_damage2score_multiplier);
+ GameRules_scoring_add_team(frag_attacker, SCORE, (frag_damage - excess) * autocvar_g_ca_damage2score_multiplier);
}
MUTATOR_HOOKFUNCTION(ca, PlayerRegen)
void CA_RoundStart();
bool ca_isEliminated(entity e);
-void SetLimits(int fraglimit_override, int leadlimit_override, float timelimit_override, float qualifying_override);
-
REGISTER_MUTATOR(ca, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- // game loads at time 1
- if (time > 1) error("This is a game type and it cannot be added at runtime.");
-
- allowed_to_spawn = true;
+ GameRules_teams(true);
+ GameRules_spawning_teams(autocvar_g_ca_team_spawns);
+ GameRules_limit_score(autocvar_g_ca_point_limit);
+ GameRules_limit_lead(autocvar_g_ca_point_leadlimit);
ca_teams = autocvar_g_ca_teams_override;
if (ca_teams < 2)
ca_teams = cvar("g_ca_teams"); // read the cvar directly as it gets written earlier in the same frame
- ca_teams = bound(2, ca_teams, 4);
-
- int teams = 0;
- if(ca_teams >= 1) teams |= BIT(0);
- if(ca_teams >= 2) teams |= BIT(1);
- if(ca_teams >= 3) teams |= BIT(2);
- if(ca_teams >= 4) teams |= BIT(3);
- ca_teams = teams; // now set it?
-
- ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
- ScoreInfo_SetLabel_TeamScore(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
- ScoreRules_basics_end();
+ ca_teams = BITS(bound(2, ca_teams, 4));
+ GameRules_scoring(ca_teams, SFL_SORT_PRIO_PRIMARY, 0, {
+ field_team(ST_CA_ROUNDS, "rounds", SFL_SORT_PRIO_PRIMARY);
+ });
+ allowed_to_spawn = true;
round_handler_Spawn(CA_CheckTeams, CA_CheckWinner, CA_RoundStart);
round_handler_Init(5, autocvar_g_ca_warmup, autocvar_g_ca_round_timelimit);
-
EliminatedPlayers_Init(ca_isEliminated);
-
- ActivateTeamplay();
- SetLimits(autocvar_g_ca_point_limit, autocvar_g_ca_point_leadlimit, autocvar_timelimit_override, -1);
-
- if (autocvar_g_ca_team_spawns)
- have_team_spawns = -1; // request team spawns
- }
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
}
-
return 0;
}
#include "gamemode_ctf.qh"
-#ifndef CSQC
#include <common/effects/all.qh>
-void ctf_Initialize();
-
-REGISTER_MUTATOR(ctf, false)
-{
- MUTATOR_ONADD
- {
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- ctf_Initialize();
-
- ActivateTeamplay();
- SetLimits(autocvar_capturelimit_override, autocvar_captureleadlimit_override, autocvar_timelimit_override, -1);
- have_team_spawns = -1; // request team spawns
- }
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back ctf_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
- }
-
- return 0;
-}
-#endif
-
-#ifdef SVQC
#include <common/vehicles/all.qh>
#include <server/teamplay.qh>
-#endif
#include <lib/warpzone/common.qh>
if(ctf_captureshield_max_ratio <= 0)
return false;
- s = PlayerScore_Add(p, SP_CTF_CAPS, 0);
- s2 = PlayerScore_Add(p, SP_CTF_PICKUPS, 0);
- s3 = PlayerScore_Add(p, SP_CTF_RETURNS, 0);
- s4 = PlayerScore_Add(p, SP_CTF_FCKILLS, 0);
+ s = GameRules_scoring_add(p, CTF_CAPS, 0);
+ s2 = GameRules_scoring_add(p, CTF_PICKUPS, 0);
+ s3 = GameRules_scoring_add(p, CTF_RETURNS, 0);
+ s4 = GameRules_scoring_add(p, CTF_FCKILLS, 0);
sr = ((s - s2) + (s3 + s4));
FOREACH_CLIENT(IS_PLAYER(it), {
if(DIFF_TEAM(it, p))
continue;
- se = PlayerScore_Add(it, SP_CTF_CAPS, 0);
- se2 = PlayerScore_Add(it, SP_CTF_PICKUPS, 0);
- se3 = PlayerScore_Add(it, SP_CTF_RETURNS, 0);
- se4 = PlayerScore_Add(it, SP_CTF_FCKILLS, 0);
+ se = GameRules_scoring_add(it, CTF_CAPS, 0);
+ se2 = GameRules_scoring_add(it, CTF_PICKUPS, 0);
+ se3 = GameRules_scoring_add(it, CTF_RETURNS, 0);
+ se4 = GameRules_scoring_add(it, CTF_FCKILLS, 0);
ser = ((se - se2) + (se3 + se4));
ctf_EventLog("dropped", player.team, player);
// scoring
- PlayerTeamScore_AddScore(player, -((flag.score_drop) ? flag.score_drop : autocvar_g_ctf_score_penalty_drop));
- PlayerScore_Add(player, SP_CTF_DROPS, 1);
+ GameRules_scoring_add_team(player, SCORE, -((flag.score_drop) ? flag.score_drop : autocvar_g_ctf_score_penalty_drop));
+ GameRules_scoring_add(player, CTF_DROPS, 1);
// waypoints
if(autocvar_g_ctf_flag_dropped_waypoint) {
// transfer flag to player
flag.owner = player;
flag.owner.flagcarried = flag;
+ GameRules_scoring_vip(player, true);
// reset flag
if(player.vehicle)
setattachment(flag, NULL, "");
setorigin(flag, player.origin + FLAG_DROP_OFFSET);
flag.owner.flagcarried = NULL;
+ GameRules_scoring_vip(flag.owner, false);
flag.owner = NULL;
flag.solid = SOLID_TRIGGER;
flag.ctf_dropper = player;
float pscore = 0;
if(enemy_flag.score_capture || flag.score_capture)
pscore = floor((max(1, enemy_flag.score_capture) + max(1, flag.score_capture)) * 0.5);
- PlayerTeamScore_AddScore(player, ((pscore) ? pscore : autocvar_g_ctf_score_capture));
+ GameRules_scoring_add_team(player, SCORE, ((pscore) ? pscore : autocvar_g_ctf_score_capture));
float capscore = 0;
if(enemy_flag.score_team_capture || flag.score_team_capture)
capscore = floor((max(1, enemy_flag.score_team_capture) + max(1, flag.score_team_capture)) * 0.5);
- PlayerTeamScore_Add(player, SP_CTF_CAPS, ST_CTF_CAPS, ((capscore) ? capscore : 1));
+ GameRules_scoring_add_team(player, CTF_CAPS, ((capscore) ? capscore : 1));
- old_time = PlayerScore_Add(player, SP_CTF_CAPTIME, 0);
+ old_time = GameRules_scoring_add(player, CTF_CAPTIME, 0);
new_time = TIME_ENCODE(time - enemy_flag.ctf_pickuptime);
if(!old_time || new_time < old_time)
- PlayerScore_Add(player, SP_CTF_CAPTIME, new_time - old_time);
+ GameRules_scoring_add(player, CTF_CAPTIME, new_time - old_time);
// effects
Send_Effect_(flag.capeffect, flag.origin, '0 0 0', 1);
if(flag.speedrunning) { ctf_FakeTimeLimit(player, -1); }
if((enemy_flag.ctf_dropper) && (player != enemy_flag.ctf_dropper))
- { PlayerTeamScore_AddScore(enemy_flag.ctf_dropper, ((enemy_flag.score_assist) ? enemy_flag.score_assist : autocvar_g_ctf_score_capture_assist)); }
+ { GameRules_scoring_add_team(enemy_flag.ctf_dropper, SCORE, ((enemy_flag.score_assist) ? enemy_flag.score_assist : autocvar_g_ctf_score_capture_assist)); }
}
// reset the flag
// scoring
if(IS_PLAYER(player))
{
- PlayerTeamScore_AddScore(player, ((flag.score_return) ? flag.score_return : autocvar_g_ctf_score_return)); // reward for return
- PlayerScore_Add(player, SP_CTF_RETURNS, 1); // add to count of returns
+ GameRules_scoring_add_team(player, SCORE, ((flag.score_return) ? flag.score_return : autocvar_g_ctf_score_return)); // reward for return
+ GameRules_scoring_add(player, CTF_RETURNS, 1); // add to count of returns
nades_GiveBonus(player,autocvar_g_nades_bonus_score_medium);
}
if(flag.ctf_dropper)
{
- PlayerScore_Add(flag.ctf_dropper, SP_SCORE, -autocvar_g_ctf_score_penalty_returned); // punish the player who dropped the flag
+ GameRules_scoring_add(flag.ctf_dropper, SCORE, -autocvar_g_ctf_score_penalty_returned); // punish the player who dropped the flag
ctf_CaptureShield_Update(flag.ctf_dropper, 0); // shield player from picking up flag
flag.ctf_dropper.next_take_time = time + autocvar_g_ctf_flag_collect_delay; // set next take time
}
// attach the flag to the player
flag.owner = player;
player.flagcarried = flag;
+ GameRules_scoring_vip(player, true);
if(player.vehicle)
{
setattachment(flag, player.vehicle, "");
_sound(player, CH_TRIGGER, flag.snd_flag_taken, VOL_BASE, ATTEN_NONE);
// scoring
- PlayerScore_Add(player, SP_CTF_PICKUPS, 1);
+ GameRules_scoring_add(player, CTF_PICKUPS, 1);
nades_GiveBonus(player, autocvar_g_nades_bonus_score_minor);
switch(pickuptype)
{
case PICKUP_BASE:
{
- PlayerTeamScore_AddScore(player, ((flag.score_pickup) ? flag.score_pickup : autocvar_g_ctf_score_pickup_base));
+ GameRules_scoring_add_team(player, SCORE, ((flag.score_pickup) ? flag.score_pickup : autocvar_g_ctf_score_pickup_base));
ctf_EventLog("steal", flag.team, player);
break;
}
pickup_dropped_score = (autocvar_g_ctf_flag_return_time ? bound(0, ((flag.ctf_droptime + autocvar_g_ctf_flag_return_time) - time) / autocvar_g_ctf_flag_return_time, 1) : 1);
pickup_dropped_score = floor((autocvar_g_ctf_score_pickup_dropped_late * (1 - pickup_dropped_score) + autocvar_g_ctf_score_pickup_dropped_early * pickup_dropped_score) + 0.5);
LOG_TRACE("pickup_dropped_score is ", ftos(pickup_dropped_score));
- PlayerTeamScore_AddScore(player, pickup_dropped_score);
+ GameRules_scoring_add_team(player, SCORE, pickup_dropped_score);
ctf_EventLog("pickup", flag.team, player);
break;
}
WaypointSprite_Kill(flag.wps_flagcarrier);
flag.owner.flagcarried = NULL;
+ GameRules_scoring_vip(flag.owner, false);
if(flag.speedrunning)
ctf_FakeTimeLimit(flag.owner, -1);
if((frag_attacker != frag_target) && (IS_PLAYER(frag_attacker)) && (frag_target.flagcarried))
{
- PlayerTeamScore_AddScore(frag_attacker, ((SAME_TEAM(frag_attacker, frag_target)) ? -autocvar_g_ctf_score_kill : autocvar_g_ctf_score_kill));
- PlayerScore_Add(frag_attacker, SP_CTF_FCKILLS, 1);
+ GameRules_scoring_add_team(frag_attacker, SCORE, ((SAME_TEAM(frag_attacker, frag_target)) ? -autocvar_g_ctf_score_kill : autocvar_g_ctf_score_kill));
+ GameRules_scoring_add(frag_attacker, CTF_FCKILLS, 1);
}
if(frag_target.flagcarried)
void ctf_ScoreRules(int teams)
{
CheckAllowedTeams(NULL);
- ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
- ScoreInfo_SetLabel_TeamScore (ST_CTF_CAPS, "caps", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore(SP_CTF_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
- ScoreInfo_SetLabel_PlayerScore(SP_CTF_CAPTIME, "captime", SFL_LOWER_IS_BETTER | SFL_TIME);
- ScoreInfo_SetLabel_PlayerScore(SP_CTF_PICKUPS, "pickups", 0);
- ScoreInfo_SetLabel_PlayerScore(SP_CTF_FCKILLS, "fckills", 0);
- ScoreInfo_SetLabel_PlayerScore(SP_CTF_RETURNS, "returns", 0);
- ScoreInfo_SetLabel_PlayerScore(SP_CTF_DROPS, "drops", SFL_LOWER_IS_BETTER);
- ScoreRules_basics_end();
+ GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, 0, {
+ field_team(ST_CTF_CAPS, "caps", SFL_SORT_PRIO_PRIMARY);
+ field(SP_CTF_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
+ field(SP_CTF_CAPTIME, "captime", SFL_LOWER_IS_BETTER | SFL_TIME);
+ field(SP_CTF_PICKUPS, "pickups", 0);
+ field(SP_CTF_FCKILLS, "fckills", 0);
+ field(SP_CTF_RETURNS, "returns", 0);
+ field(SP_CTF_DROPS, "drops", SFL_LOWER_IS_BETTER);
+ });
}
// code from here on is just to support maps that don't have flag and team entities
#ifdef SVQC
#include "../gamemode.qh"
+
+void ctf_Initialize();
+
+REGISTER_MUTATOR(ctf, false)
+{
+ MUTATOR_STATIC();
+ MUTATOR_ONADD
+ {
+ GameRules_teams(true);
+ GameRules_limit_score(autocvar_capturelimit_override);
+ GameRules_limit_lead(autocvar_captureleadlimit_override);
+
+ ctf_Initialize();
+ }
+ return 0;
+}
+
// used in cheats.qc
void ctf_RespawnFlag(entity flag);
void cts_ScoreRules()
{
- ScoreRules_basics(0, 0, 0, false);
- if(g_race_qualifying)
- {
- ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest", SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME);
- }
- else
- {
- ScoreInfo_SetLabel_PlayerScore(SP_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore(SP_RACE_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
- ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME);
- }
- ScoreRules_basics_end();
+ GameRules_score_enabled(false);
+ GameRules_scoring(0, 0, 0, {
+ if (g_race_qualifying) {
+ field(SP_RACE_FASTEST, "fastest", SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME);
+ } else {
+ field(SP_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
+ field(SP_RACE_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
+ field(SP_RACE_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME);
+ }
+ });
}
void cts_EventLog(string mode, entity actor) // use an alias for easy changing and quick editing later
FOREACH_CLIENT(true, {
if(it.race_place)
{
- s = PlayerScore_Add(it, SP_RACE_FASTEST, 0);
+ s = GameRules_scoring_add(it, RACE_FASTEST, 0);
if(!s)
it.race_place = 0;
}
{
entity player = M_ARGV(0, entity);
- if(PlayerScore_Add(player, SP_RACE_FASTEST, 0))
+ if(GameRules_scoring_add(player, RACE_FASTEST, 0))
player.frags = FRAGS_LMS_LOSER;
else
player.frags = FRAGS_SPECTATOR;
REGISTER_MUTATOR(cts, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
-
g_race_qualifying = true;
independent_players = 1;
- SetLimits(0, 0, autocvar_timelimit_override, -1);
+ GameRules_limit_score(0);
+ GameRules_limit_lead(0);
cts_Initialize();
}
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back cts_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
- }
-
return 0;
}
REGISTER_MUTATOR(dm, false)
{
- MUTATOR_ONADD
- {
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- }
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back dm_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
-
- MUTATOR_ONREMOVE
- {
- error("This is a game type and it cannot be removed at runtime.");
- return -1;
- }
-
+ MUTATOR_STATIC();
return 0;
}
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_DOMINATION_CAPTURE_TIME, head.netname, this.message, points, wait_time);
if(this.enemy.playerid == this.enemy_playerid)
- PlayerScore_Add(this.enemy, SP_DOM_TAKES, 1);
+ GameRules_scoring_add(this.enemy, DOM_TAKES, 1);
else
this.enemy = NULL;
// give credit to the individual player, if he is still there
if (this.enemy.playerid == this.enemy_playerid)
{
- PlayerScore_Add(this.enemy, SP_SCORE, fragamt);
- PlayerScore_Add(this.enemy, SP_DOM_TICKS, fragamt);
+ GameRules_scoring_add(this.enemy, SCORE, fragamt);
+ GameRules_scoring_add(this.enemy, DOM_TICKS, fragamt);
}
else
this.enemy = NULL;
{
if(domination_roundbased)
{
- ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, 0, true);
- ScoreInfo_SetLabel_TeamScore (ST_DOM_CAPS, "caps", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore(SP_DOM_TAKES, "takes", 0);
- ScoreRules_basics_end();
+ GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, 0, {
+ field_team(ST_DOM_CAPS, "caps", SFL_SORT_PRIO_PRIMARY);
+ field(SP_DOM_TAKES, "takes", 0);
+ });
}
else
{
sp_domticks = SFL_SORT_PRIO_PRIMARY;
else
sp_score = SFL_SORT_PRIO_PRIMARY;
- ScoreRules_basics(teams, sp_score, sp_score, true);
- ScoreInfo_SetLabel_TeamScore (ST_DOM_TICKS, "ticks", sp_domticks);
- ScoreInfo_SetLabel_PlayerScore(SP_DOM_TICKS, "ticks", sp_domticks);
- ScoreInfo_SetLabel_PlayerScore(SP_DOM_TAKES, "takes", 0);
- ScoreRules_basics_end();
+ GameRules_scoring(teams, sp_score, sp_score, {
+ field_team(ST_DOM_TICKS, "ticks", sp_domticks);
+ field(SP_DOM_TICKS, "ticks", sp_domticks);
+ field(SP_DOM_TAKES, "takes", 0);
+ });
}
}
REGISTER_MUTATOR(dom, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- dom_Initialize();
-
int fraglimit_override = autocvar_g_domination_point_limit;
if (autocvar_g_domination_roundbased && autocvar_g_domination_roundbased_point_limit)
fraglimit_override = autocvar_g_domination_roundbased_point_limit;
- ActivateTeamplay();
- SetLimits(fraglimit_override, autocvar_g_domination_point_leadlimit, autocvar_timelimit_override, -1);
- have_team_spawns = -1; // request team spawns
- }
+ GameRules_teams(true);
+ GameRules_limit_score(fraglimit_override);
+ GameRules_limit_lead(autocvar_g_domination_point_leadlimit);
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
+ dom_Initialize();
}
-
return 0;
}
int autocvar_g_freezetag_teams_override;
float autocvar_g_freezetag_warmup;
-void freezetag_ScoreRules(int teams)
-{
- ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true); // SFL_SORT_PRIO_PRIMARY
- ScoreInfo_SetLabel_PlayerScore(SP_FREEZETAG_REVIVALS, "revivals", 0);
- ScoreRules_basics_end();
-}
-
void freezetag_count_alive_players()
{
total_players = redalive = bluealive = yellowalive = pinkalive = 0;
{
// you froze your own dumb targ
// counted as "suicide" already
- PlayerScore_Add(targ, SP_SCORE, -1);
+ GameRules_scoring_add(targ, SCORE, -1);
}
else if(IS_PLAYER(attacker))
{
// got frozen by an enemy
// counted as "kill" and "death" already
- PlayerScore_Add(targ, SP_SCORE, -1);
- PlayerScore_Add(attacker, SP_SCORE, +1);
+ GameRules_scoring_add(targ, SCORE, -1);
+ GameRules_scoring_add(attacker, SCORE, +1);
}
// else nothing - got frozen by the game type rules themselves
}
// EVERY team mate nearby gets a point (even if multiple!)
FOREACH_CLIENT(IS_PLAYER(it) && it.reviving, {
- PlayerScore_Add(it, SP_FREEZETAG_REVIVALS, +1);
- PlayerScore_Add(it, SP_SCORE, +1);
+ GameRules_scoring_add(it, FREEZETAG_REVIVALS, +1);
+ GameRules_scoring_add(it, SCORE, +1);
nades_GiveBonus(it,autocvar_g_nades_bonus_score_low);
});
freezetag_teams = autocvar_g_freezetag_teams_override;
if(freezetag_teams < 2)
freezetag_teams = cvar("g_freezetag_teams"); // read the cvar directly as it gets written earlier in the same frame
- freezetag_teams = bound(2, freezetag_teams, 4);
- int teams = 0;
- if(freezetag_teams >= 1) teams |= BIT(0);
- if(freezetag_teams >= 2) teams |= BIT(1);
- if(freezetag_teams >= 3) teams |= BIT(2);
- if(freezetag_teams >= 4) teams |= BIT(3);
-
- freezetag_teams = teams; // now set it?
- freezetag_ScoreRules(freezetag_teams);
+ freezetag_teams = BITS(bound(2, freezetag_teams, 4));
+ GameRules_scoring(freezetag_teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, {
+ field(SP_FREEZETAG_REVIVALS, "revivals", 0);
+ });
round_handler_Spawn(freezetag_CheckTeams, freezetag_CheckWinner, func_null);
round_handler_Init(5, autocvar_g_freezetag_warmup, autocvar_g_freezetag_round_timelimit);
REGISTER_MUTATOR(ft, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- freezetag_Initialize();
-
- ActivateTeamplay();
- SetLimits(autocvar_g_freezetag_point_limit, autocvar_g_freezetag_point_leadlimit, autocvar_timelimit_override, -1);
-
- if (autocvar_g_freezetag_team_spawns)
- have_team_spawns = -1; // request team spawns
- }
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back freezetag_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
+ GameRules_teams(true);
+ GameRules_spawning_teams(autocvar_g_freezetag_team_spawns);
+ GameRules_limit_score(autocvar_g_freezetag_point_limit);
+ GameRules_limit_lead(autocvar_g_freezetag_point_leadlimit);
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
+ freezetag_Initialize();
}
-
return 0;
}
else
{
FOREACH_CLIENT(IS_PLAYER(it), {
- float cs = PlayerScore_Add(it, SP_KILLS, 0);
+ float cs = GameRules_scoring_add(it, KILLS, 0);
if(cs > winning_score)
{
winning_score = cs;
if(IS_PLAYER(frag_attacker))
if(SAME_TEAM(frag_attacker, frag_target)) // in non-teamplay modes, same team = same player, so this works
- PlayerScore_Add(frag_attacker, SP_KILLS, -1);
+ GameRules_scoring_add(frag_attacker, KILLS, -1);
else
{
- PlayerScore_Add(frag_attacker, SP_KILLS, +1);
+ GameRules_scoring_add(frag_attacker, KILLS, +1);
if(teamplay)
TeamScore_AddToTeam(frag_attacker.team, ST_INV_KILLS, +1);
}
void invasion_ScoreRules(int inv_teams)
{
if(inv_teams) { CheckAllowedTeams(NULL); }
- ScoreRules_basics(inv_teams, 0, 0, false);
- if(inv_teams) ScoreInfo_SetLabel_TeamScore(ST_INV_KILLS, "frags", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore(SP_KILLS, "frags", ((inv_teams) ? SFL_SORT_PRIO_SECONDARY : SFL_SORT_PRIO_PRIMARY));
- ScoreRules_basics_end();
+ GameRules_score_enabled(false);
+ GameRules_scoring(inv_teams, 0, 0, {
+ if (inv_teams) {
+ field_team(ST_INV_KILLS, "frags", SFL_SORT_PRIO_PRIMARY);
+ }
+ field(SP_KILLS, "frags", ((inv_teams) ? SFL_SORT_PRIO_SECONDARY : SFL_SORT_PRIO_PRIMARY));
+ });
}
void invasion_DelayedInit(entity this) // Do this check with a delay so we can wait for teams to be set up.
if(autocvar_g_invasion_teams)
{
- invasion_teams = bound(2, autocvar_g_invasion_teams, 4);
- int teams = 0;
- if(invasion_teams >= 1) teams |= BIT(0);
- if(invasion_teams >= 2) teams |= BIT(1);
- if(invasion_teams >= 3) teams |= BIT(2);
- if(invasion_teams >= 4) teams |= BIT(3);
-
- invasion_teams = teams; // now set it?
+ invasion_teams = BITS(bound(2, autocvar_g_invasion_teams, 4));
}
else
invasion_teams = 0;
REGISTER_MUTATOR(inv, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- g_invasion = true;
- invasion_Initialize();
-
- cvar_settemp("g_monsters", "1");
-
- SetLimits(autocvar_g_invasion_point_limit, autocvar_leadlimit_override, autocvar_timelimit_override, -1);
- if (autocvar_g_invasion_teams >= 2)
- {
- ActivateTeamplay();
- if (autocvar_g_invasion_team_spawns)
- have_team_spawns = -1; // request team spawns
+ if (autocvar_g_invasion_teams >= 2) {
+ GameRules_teams(true);
+ GameRules_spawning_teams(autocvar_g_invasion_team_spawns);
}
- }
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back invasion_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
+ GameRules_limit_score(autocvar_g_invasion_point_limit);
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
+ g_invasion = true;
+ cvar_settemp("g_monsters", "1");
+ invasion_Initialize();
}
-
return 0;
}
#include <common/effects/all.qh>
+.entity ballcarried;
+
int autocvar_g_keepaway_ballcarrier_effects;
float autocvar_g_keepaway_ballcarrier_damage;
float autocvar_g_keepaway_ballcarrier_force;
if(this.owner.ballcarried)
{ // add points for holding the ball after a certain amount of time
if(autocvar_g_keepaway_score_timepoints)
- PlayerScore_Add(this.owner, SP_SCORE, autocvar_g_keepaway_score_timepoints);
+ GameRules_scoring_add(this.owner, SCORE, autocvar_g_keepaway_score_timepoints);
- PlayerScore_Add(this.owner, SP_KEEPAWAY_BCTIME, (autocvar_g_keepaway_score_timeinterval / 1)); // interval is divided by 1 so that time always shows "seconds"
+ GameRules_scoring_add(this.owner, KEEPAWAY_BCTIME, (autocvar_g_keepaway_score_timeinterval / 1)); // interval is divided by 1 so that time always shows "seconds"
this.nextthink = time + autocvar_g_keepaway_score_timeinterval;
}
}
// attach the ball to the player
this.owner = toucher;
toucher.ballcarried = this;
+ GameRules_scoring_vip(toucher, true);
setattachment(this, toucher, "");
setorigin(this, '0 0 0');
sound(this.owner, CH_TRIGGER, SND_KA_PICKEDUP, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
// scoring
- PlayerScore_Add(toucher, SP_KEEPAWAY_PICKUPS, 1);
+ GameRules_scoring_add(toucher, KEEPAWAY_PICKUPS, 1);
// waypoints
WaypointSprite_AttachCarrier(WP_KaBallCarrier, toucher, RADARICON_FLAGCARRIER);
ball.effects &= ~EF_NODRAW;
setorigin(ball, plyr.origin + '0 0 10');
ball.velocity = '0 0 200' + '0 100 0'*crandom() + '100 0 0'*crandom();
- ball.owner.ballcarried = world; // I hope nothing checks to see if the world has the ball in the rest of my code :P
- ball.owner = NULL;
+ entity e = ball.owner; ball.owner = NULL;
+ e.ballcarried = NULL;
+ GameRules_scoring_vip(e, false);
navigation_dynamicgoal_set(ball);
// reset the player effects
sound(NULL, CH_TRIGGER, SND_KA_DROPPED, VOL_BASE, ATTEN_NONE); // ATTEN_NONE (it's a sound intended to be heard anywhere)
// scoring
- // PlayerScore_Add(plyr, SP_KEEPAWAY_DROPS, 1); Not anymore, this is 100% the same as pickups and is useless.
+ // GameRules_scoring_add(plyr, KEEPAWAY_DROPS, 1); Not anymore, this is 100% the same as pickups and is useless.
// waypoints
WaypointSprite_Spawn(WP_KaBall, 0, 0, ball, '0 0 64', NULL, ball.team, ball, waypointsprite_attachedforcarrier, false, RADARICON_FLAGCARRIER);
if((frag_attacker != frag_target) && (IS_PLAYER(frag_attacker)))
{
if(frag_target.ballcarried) { // add to amount of times killing carrier
- PlayerScore_Add(frag_attacker, SP_KEEPAWAY_CARRIERKILLS, 1);
+ GameRules_scoring_add(frag_attacker, KEEPAWAY_CARRIERKILLS, 1);
if(autocvar_g_keepaway_score_bckill) // add bckills to the score
- PlayerScore_Add(frag_attacker, SP_SCORE, autocvar_g_keepaway_score_bckill);
+ GameRules_scoring_add(frag_attacker, SCORE, autocvar_g_keepaway_score_bckill);
}
else if(!frag_attacker.ballcarried)
if(autocvar_g_keepaway_noncarrier_warn)
Send_Notification(NOTIF_ONE_ONLY, frag_attacker, MSG_CENTER, CENTER_KEEPAWAY_WARN);
if(frag_attacker.ballcarried) // add to amount of kills while ballcarrier
- PlayerScore_Add(frag_attacker, SP_SCORE, autocvar_g_keepaway_score_killac);
+ GameRules_scoring_add(frag_attacker, SCORE, autocvar_g_keepaway_score_killac);
}
if(frag_target.ballcarried) { ka_DropEvent(frag_target); } // a player with the ball has died, drop it
// Initialization
// ==============
+MODEL(KA_BALL, "models/orbs/orbblue.md3");
+
void ka_SpawnBall() // loads various values for the ball, runs only once at start of match
{
entity e = new(keepawayball);
- e.model = "models/orbs/orbblue.md3";
- precache_model(e.model);
- _setmodel(e, e.model);
+ setmodel(e, MDL_KA_BALL);
setsize(e, '-16 -16 -20', '16 16 20'); // 20 20 20 was too big, player is only 16 16 24... gotta cheat with the Z (20) axis so that the particle isn't cut off
e.damageforcescale = autocvar_g_keepawayball_damageforcescale;
e.takedamage = DAMAGE_YES;
InitializeEntity(e, ka_RespawnBall, INITPRIO_SETLOCATION); // is this the right priority? Neh, I have no idea.. Well-- it works! So.
}
-void ka_ScoreRules()
-{
- ScoreRules_basics(0, SFL_SORT_PRIO_PRIMARY, 0, true); // SFL_SORT_PRIO_PRIMARY
- ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_PICKUPS, "pickups", 0);
- ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_CARRIERKILLS, "bckills", 0);
- ScoreInfo_SetLabel_PlayerScore(SP_KEEPAWAY_BCTIME, "bctime", SFL_SORT_PRIO_SECONDARY);
- ScoreRules_basics_end();
-}
-
void ka_Initialize() // run at the start of a match, initiates game mode
{
- ka_ScoreRules();
ka_SpawnBall();
}
REGISTER_MUTATOR(ka, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- ka_Initialize();
- }
-
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back ka_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
+ GameRules_scoring(0, SFL_SORT_PRIO_PRIMARY, 0, {
+ field(SP_KEEPAWAY_PICKUPS, "pickups", 0);
+ field(SP_KEEPAWAY_CARRIERKILLS, "bckills", 0);
+ field(SP_KEEPAWAY_BCTIME, "bctime", SFL_SORT_PRIO_SECONDARY);
+ });
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
+ ka_Initialize();
}
-
return false;
}
int kh_Key_AllOwnedByWhichTeam();
-const float ST_KH_CAPS = 1;
+const int ST_KH_CAPS = 1;
void kh_ScoreRules(int teams)
{
- ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
- ScoreInfo_SetLabel_TeamScore( ST_KH_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
- ScoreInfo_SetLabel_PlayerScore(SP_KH_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
- ScoreInfo_SetLabel_PlayerScore(SP_KH_PUSHES, "pushes", 0);
- ScoreInfo_SetLabel_PlayerScore(SP_KH_DESTROYS, "destroyed", SFL_LOWER_IS_BETTER);
- ScoreInfo_SetLabel_PlayerScore(SP_KH_PICKUPS, "pickups", 0);
- ScoreInfo_SetLabel_PlayerScore(SP_KH_KCKILLS, "kckills", 0);
- ScoreInfo_SetLabel_PlayerScore(SP_KH_LOSSES, "losses", SFL_LOWER_IS_BETTER);
- ScoreRules_basics_end();
+ GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, {
+ field_team(ST_KH_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
+ field(SP_KH_CAPS, "caps", SFL_SORT_PRIO_SECONDARY);
+ field(SP_KH_PUSHES, "pushes", 0);
+ field(SP_KH_DESTROYS, "destroyed", SFL_LOWER_IS_BETTER);
+ field(SP_KH_PICKUPS, "pickups", 0);
+ field(SP_KH_KCKILLS, "kckills", 0);
+ field(SP_KH_LOSSES, "losses", SFL_LOWER_IS_BETTER);
+ });
}
bool kh_KeyCarrier_waypointsprite_visible_for_player(entity this, entity player, entity view) // runs all the time
if(key.kh_dropperteam != player.team)
{
kh_Scores_Event(player, key, "collect", autocvar_g_balance_keyhunt_score_collect, 0);
- PlayerScore_Add(player, SP_KH_PICKUPS, 1);
+ GameRules_scoring_add(player, KH_PICKUPS, 1);
}
key.kh_dropperteam = 0;
int realteam = kh_Team_ByID(key.count);
{
float f = DistributeEvenly_Get(1);
kh_Scores_Event(key.owner, key, "capture", f, 0);
- PlayerTeamScore_Add(key.owner, SP_KH_CAPS, ST_KH_CAPS, 1);
+ GameRules_scoring_add_team(key.owner, KH_CAPS, 1);
nades_GiveBonus(key.owner, autocvar_g_nades_bonus_score_high);
}
kh_Scores_Event(lostkey.kh_previous_owner, NULL, "pushed", 0, -autocvar_g_balance_keyhunt_score_push);
// don't actually GIVE him the -nn points, just log
kh_Scores_Event(attacker, NULL, "push", autocvar_g_balance_keyhunt_score_push, 0);
- PlayerScore_Add(attacker, SP_KH_PUSHES, 1);
+ GameRules_scoring_add(attacker, KH_PUSHES, 1);
//centerprint(attacker, "Your push is the best!"); // does this really need to exist?
}
else
// don't actually GIVE him the -nn points, just log
if(lostkey.kh_previous_owner.playerid == lostkey.kh_previous_owner_playerid)
- PlayerScore_Add(lostkey.kh_previous_owner, SP_KH_DESTROYS, 1);
+ GameRules_scoring_add(lostkey.kh_previous_owner, KH_DESTROYS, 1);
DistributeEvenly_Init(autocvar_g_balance_keyhunt_score_destroyed, keys * of + players);
key.enemy = player;
kh_Scores_Event(player, key, "dropkey", 0, 0);
- PlayerScore_Add(player, SP_KH_LOSSES, 1);
+ GameRules_scoring_add(player, KH_LOSSES, 1);
int realteam = kh_Team_ByID(key.count);
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_DROP), player.netname);
while((key = player.kh_next))
{
kh_Scores_Event(player, key, "losekey", 0, 0);
- PlayerScore_Add(player, SP_KH_LOSSES, 1);
+ GameRules_scoring_add(player, KH_LOSSES, 1);
int realteam = kh_Team_ByID(key.count);
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, APP_TEAM_NUM(realteam, INFO_KEYHUNT_LOST), player.netname);
kh_Key_AssignTo(key, NULL);
else
{
kh_Scores_Event(attacker, targ.kh_next, "carrierfrag", autocvar_g_balance_keyhunt_score_carrierfrag-1, 0);
- PlayerScore_Add(attacker, SP_KH_KCKILLS, 1);
+ GameRules_scoring_add(attacker, KH_KCKILLS, 1);
// the frag gets added later
}
}
kh_teams = autocvar_g_keyhunt_teams_override;
if(kh_teams < 2)
kh_teams = cvar("g_keyhunt_teams"); // read the cvar directly as it gets written earlier in the same frame
- kh_teams = bound(2, kh_teams, 4);
-
- int teams = 0;
- if(kh_teams >= 1) teams |= BIT(0);
- if(kh_teams >= 2) teams |= BIT(1);
- if(kh_teams >= 3) teams |= BIT(2);
- if(kh_teams >= 4) teams |= BIT(3);
-
- kh_teams = teams; // now set it?
+ kh_teams = BITS(bound(2, kh_teams, 4));
// make a KH entity for controlling the game
kh_controller = spawn();
REGISTER_MUTATOR(kh, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- kh_Initialize();
-
- ActivateTeamplay();
- SetLimits(autocvar_g_keyhunt_point_limit, autocvar_g_keyhunt_point_leadlimit, autocvar_timelimit_override, -1);
- if (autocvar_g_keyhunt_team_spawns)
- have_team_spawns = -1; // request team spawns
- }
+ GameRules_teams(true);
+ GameRules_spawning_teams(autocvar_g_keyhunt_team_spawns);
+ GameRules_limit_score(autocvar_g_keyhunt_point_limit);
+ GameRules_limit_lead(autocvar_g_keyhunt_point_leadlimit);
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back kh_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
+ kh_Initialize();
}
-
return 0;
}
{
// a winner!
// and assign him his first place
- PlayerScore_Add(head, SP_LMS_RANK, 1);
+ GameRules_scoring_add(head, LMS_RANK, 1);
if(warmup_stage)
return WINNING_NO;
else
FOREACH_CLIENT(true, {
TRANSMUTE(Player, it);
it.frags = FRAGS_PLAYER;
- PlayerScore_Add(it, SP_LMS_LIVES, LMS_NewPlayerLives());
+ GameRules_scoring_add(it, LMS_LIVES, LMS_NewPlayerLives());
PutClientInServer(it);
});
}
TRANSMUTE(Observer, player);
else
{
- float tl = PlayerScore_Add(player, SP_LMS_LIVES, 0);
+ float tl = GameRules_scoring_add(player, LMS_LIVES, 0);
if(tl < lms_lowest_lives)
lms_lowest_lives = tl;
if(tl <= 0)
TRANSMUTE(Observer, player);
if(warmup_stage)
- PlayerScore_Add(player, SP_LMS_RANK, -PlayerScore_Add(player, SP_LMS_RANK, 0));
+ GameRules_scoring_add(player, LMS_RANK, -GameRules_scoring_add(player, LMS_RANK, 0));
}
}
return false;
if(player.frags == FRAGS_SPECTATOR)
return true;
- if(PlayerScore_Add(player, SP_LMS_LIVES, 0) <= 0)
+ if(GameRules_scoring_add(player, LMS_LIVES, 0) <= 0)
{
Send_Notification(NOTIF_ONE, player, MSG_CENTER, CENTER_LMS_NOLIVES);
return true;
void lms_RemovePlayer(entity player)
{
static int quitters = 0;
- float player_rank = PlayerScore_Add(player, SP_LMS_RANK, 0);
+ float player_rank = GameRules_scoring_add(player, LMS_RANK, 0);
if (!player_rank)
{
int pl_cnt = 0;
if(IS_BOT_CLIENT(player))
bot_clear(player);
player.frags = FRAGS_LMS_LOSER;
- PlayerScore_Add(player, SP_LMS_RANK, pl_cnt + 1);
+ GameRules_scoring_add(player, LMS_RANK, pl_cnt + 1);
}
else
{
FOREACH_CLIENT(true, {
if (it.frags == FRAGS_LMS_LOSER)
{
- float it_rank = PlayerScore_Add(it, SP_LMS_RANK, 0);
+ float it_rank = GameRules_scoring_add(it, LMS_RANK, 0);
if (it_rank > player_rank && it_rank <= 256)
- PlayerScore_Add(it, SP_LMS_RANK, -1);
+ GameRules_scoring_add(it, LMS_RANK, -1);
lms_lowest_lives = 0;
}
else if (it.frags != FRAGS_SPECTATOR)
{
- float tl = PlayerScore_Add(it, SP_LMS_LIVES, 0);
+ float tl = GameRules_scoring_add(it, LMS_LIVES, 0);
if(tl < lms_lowest_lives)
lms_lowest_lives = tl;
}
});
- PlayerScore_Add(player, SP_LMS_RANK, 665 - quitters); // different from 666
+ GameRules_scoring_add(player, LMS_RANK, 665 - quitters); // different from 666
if(!warmup_stage)
{
- PlayerScore_Add(player, SP_LMS_LIVES, -PlayerScore_Add(player, SP_LMS_LIVES, 0));
+ GameRules_scoring_add(player, LMS_LIVES, -GameRules_scoring_add(player, LMS_LIVES, 0));
++quitters;
}
player.frags = FRAGS_LMS_LOSER;
}
if(CS(player).killcount != FRAGS_SPECTATOR)
- if(PlayerScore_Add(player, SP_LMS_RANK, 0) > 0 && player.lms_spectate_warning != 2)
+ if(GameRules_scoring_add(player, LMS_RANK, 0) > 0 && player.lms_spectate_warning != 2)
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_LMS_NOLIVES, player.netname);
else
Send_Notification(NOTIF_ALL, NULL, MSG_INFO, INFO_LMS_FORFEIT, player.netname);
TRANSMUTE(Player, player);
campaign_bots_may_start = true;
- if(PlayerScore_Add(player, SP_LMS_LIVES, LMS_NewPlayerLives()) <= 0)
+ if(GameRules_scoring_add(player, LMS_LIVES, LMS_NewPlayerLives()) <= 0)
{
- PlayerScore_Add(player, SP_LMS_RANK, 666); // mark as forced spectator for the hud code
+ GameRules_scoring_add(player, LMS_RANK, 666); // mark as forced spectator for the hud code
player.frags = FRAGS_SPECTATOR;
}
}
if (!warmup_stage)
{
// remove a life
- int tl = PlayerScore_Add(frag_target, SP_LMS_LIVES, -1);
+ int tl = GameRules_scoring_add(frag_target, LMS_LIVES, -1);
if(tl < lms_lowest_lives)
lms_lowest_lives = tl;
if(tl <= 0)
if(IS_BOT_CLIENT(frag_target))
bot_clear(frag_target);
frag_target.frags = FRAGS_LMS_LOSER;
- PlayerScore_Add(frag_target, SP_LMS_RANK, pl_cnt);
+ GameRules_scoring_add(frag_target, LMS_RANK, pl_cnt);
}
}
M_ARGV(2, float) = 0; // frag score
if(item.itemdef == ITEM_ExtraLife)
{
Send_Notification(NOTIF_ONE, toucher, MSG_CENTER, CENTER_EXTRALIVES);
- PlayerScore_Add(toucher, SP_LMS_LIVES, autocvar_g_lms_extra_lives);
+ GameRules_scoring_add(toucher, LMS_LIVES, autocvar_g_lms_extra_lives);
return MUT_ITEMTOUCH_PICKUP;
}
return true; // allow writing to this field in intermission as it is needed for newly joining players
}
-// scoreboard stuff
-void lms_ScoreRules()
-{
- ScoreRules_basics(0, 0, 0, false);
- ScoreInfo_SetLabel_PlayerScore(SP_LMS_LIVES, "lives", SFL_SORT_PRIO_SECONDARY);
- ScoreInfo_SetLabel_PlayerScore(SP_LMS_RANK, "rank", SFL_LOWER_IS_BETTER | SFL_RANK | SFL_SORT_PRIO_PRIMARY | SFL_ALLOW_HIDE);
- ScoreRules_basics_end();
-}
-
void lms_Initialize()
{
lms_lowest_lives = 9999;
-
- lms_ScoreRules();
}
REGISTER_MUTATOR(lms, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- lms_Initialize();
-
- SetLimits(((!autocvar_g_lms_lives_override) ? -1 : autocvar_g_lms_lives_override), 0, autocvar_timelimit_override, -1);
- }
+ GameRules_limit_score(((!autocvar_g_lms_lives_override) ? -1 : autocvar_g_lms_lives_override));
+ GameRules_limit_lead(0);
+ GameRules_score_enabled(false);
+ GameRules_scoring(0, 0, 0, {
+ field(SP_LMS_LIVES, "lives", SFL_SORT_PRIO_SECONDARY);
+ field(SP_LMS_RANK, "rank", SFL_LOWER_IS_BETTER | SFL_RANK | SFL_SORT_PRIO_PRIMARY | SFL_ALLOW_HIDE);
+ });
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back lms_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
+ lms_Initialize();
}
-
return 0;
}
void race_ScoreRules()
{
- ScoreRules_basics(race_teams, 0, 0, false);
- if(race_teams)
- {
- ScoreInfo_SetLabel_TeamScore( ST_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore(SP_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore(SP_RACE_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
- ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME);
- }
- else if(g_race_qualifying)
- {
- ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest", SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME);
- }
- else
- {
- ScoreInfo_SetLabel_PlayerScore(SP_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
- ScoreInfo_SetLabel_PlayerScore(SP_RACE_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
- ScoreInfo_SetLabel_PlayerScore(SP_RACE_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME);
- }
- ScoreRules_basics_end();
+ GameRules_score_enabled(false);
+ GameRules_scoring(race_teams, 0, 0, {
+ if (race_teams) {
+ field_team(ST_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
+ field(SP_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
+ field(SP_RACE_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
+ field(SP_RACE_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME);
+ } else if (g_race_qualifying) {
+ field(SP_RACE_FASTEST, "fastest", SFL_SORT_PRIO_PRIMARY | SFL_LOWER_IS_BETTER | SFL_TIME);
+ } else {
+ field(SP_RACE_LAPS, "laps", SFL_SORT_PRIO_PRIMARY);
+ field(SP_RACE_TIME, "time", SFL_SORT_PRIO_SECONDARY | SFL_LOWER_IS_BETTER | SFL_TIME);
+ field(SP_RACE_FASTEST, "fastest", SFL_LOWER_IS_BETTER | SFL_TIME);
+ }
+ });
}
void race_EventLog(string mode, entity actor) // use an alias for easy changing and quick editing later
FOREACH_CLIENT(true, {
if(it.race_place)
{
- s = PlayerScore_Add(it, SP_RACE_FASTEST, 0);
+ s = GameRules_scoring_add(it, RACE_FASTEST, 0);
if(!s)
it.race_place = 0;
}
entity player = M_ARGV(0, entity);
if(g_race_qualifying)
- if(PlayerScore_Add(player, SP_RACE_FASTEST, 0))
+ if(GameRules_scoring_add(player, RACE_FASTEST, 0))
player.frags = FRAGS_LMS_LOSER;
else
player.frags = FRAGS_SPECTATOR;
if(autocvar_g_race_teams)
{
- ActivateTeamplay();
- race_teams = bound(2, autocvar_g_race_teams, 4);
- int teams = 0;
- if(race_teams >= 1) teams |= BIT(0);
- if(race_teams >= 2) teams |= BIT(1);
- if(race_teams >= 3) teams |= BIT(2);
- if(race_teams >= 4) teams |= BIT(3);
-
- race_teams = teams; // now set it?
-
- have_team_spawns = -1; // request team spawns
+ GameRules_teams(true);
+ race_teams = BITS(bound(2, autocvar_g_race_teams, 4));
}
else
race_teams = 0;
}
else
g_race_qualifying = 0;
- SetLimits(fraglimit_override, leadlimit_override, timelimit_override, qualifying_override);
+ GameRules_limit_score(fraglimit_override);
+ GameRules_limit_lead(leadlimit_override);
+ GameRules_limit_time(timelimit_override);
+ GameRules_limit_time_qualifying(qualifying_override);
}
REGISTER_MUTATOR(rc, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
-
rc_SetLimits();
- race_Initialize();
- }
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back race_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
+ race_Initialize();
}
-
return 0;
}
LOG_TRACE("No \"tdm_team\" entities found on this map, creating them anyway.");
int numteams = autocvar_g_tdm_teams_override;
-
if(numteams < 2) { numteams = autocvar_g_tdm_teams; }
- numteams = bound(2, numteams, 4);
-
- int teams = 0;
- if(numteams >= 1) teams |= BIT(0);
- if(numteams >= 2) teams |= BIT(1);
- if(numteams >= 3) teams |= BIT(2);
- if(numteams >= 4) teams |= BIT(3);
+ int teams = BITS(bound(2, numteams, 4));
if(teams & BIT(0))
tdm_SpawnTeam("Red", NUM_TEAM_1);
if(teams & BIT(1))
REGISTER_MUTATOR(tdm, false)
{
+ MUTATOR_STATIC();
MUTATOR_ONADD
{
- if (time > 1) // game loads at time 1
- error("This is a game type and it cannot be added at runtime.");
- InitializeEntity(NULL, tdm_DelayedInit, INITPRIO_GAMETYPE);
-
- ActivateTeamplay();
- SetLimits(autocvar_g_tdm_point_limit, autocvar_g_tdm_point_leadlimit, autocvar_timelimit_override, -1);
- if (autocvar_g_tdm_team_spawns)
- have_team_spawns = -1; // request team spawns
- }
+ 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);
- MUTATOR_ONROLLBACK_OR_REMOVE
- {
- // we actually cannot roll back tdm_Initialize here
- // BUT: we don't need to! If this gets called, adding always
- // succeeds.
- }
-
- MUTATOR_ONREMOVE
- {
- LOG_INFO("This is a game type and it cannot be removed at runtime.");
- return -1;
+ InitializeEntity(NULL, tdm_DelayedInit, INITPRIO_GAMETYPE);
}
-
return 0;
}
if (this != attacker) {
float realdmg = damage - excess;
if (IS_PLAYER(attacker)) {
- PlayerScore_Add(attacker, SP_DMG, realdmg);
+ GameRules_scoring_add(attacker, DMG, realdmg);
}
if (IS_PLAYER(this)) {
- PlayerScore_Add(this, SP_DMGTAKEN, realdmg);
+ GameRules_scoring_add(this, DMGTAKEN, realdmg);
}
}
}
if(flood)
- LOG_INFO("NOTE: ", playername(source, true), "^7 is flooding.\n");
+ LOG_INFO("NOTE: ", playername(source, true), "^7 is flooding.");
// build sourcemsgstr by cutting off a prefix and replacing it by the other one
if(privatesay)
{
if(this.playerdemo_mode != PLAYERDEMO_MODE_OFF)
{
- LOG_INFO("playerdemo: ", this.netname, " closed\n");
+ LOG_INFO("playerdemo: ", this.netname, " closed");
fclose(this.playerdemo_fh);
}
this.playerdemo_mode = 0;
this.playerdemo_time = stof(fgets(this.playerdemo_fh));
this.playerdemo_time += this.playerdemo_starttime;
set_movetype(this, MOVETYPE_NONE);
- LOG_INFO("playerdemo: ", this.netname, " reading from ", f, "\n");
+ LOG_INFO("playerdemo: ", this.netname, " reading from ", f);
}
void playerdemo_open_write(entity this, string f)
{
this.playerdemo_mode = PLAYERDEMO_MODE_WRITING;
this.playerdemo_fh = fopen(f, FILE_WRITE);
this.playerdemo_starttime = time - 1;
- LOG_INFO("playerdemo: ", this.netname, " writing to ", f, "\n");
- LOG_INFO("WARNING: playerdemo file format is incomplete and not stable yet. DO NOT RELY ON IT!\n");
+ LOG_INFO("playerdemo: ", this.netname, " writing to ", f);
+ LOG_INFO("WARNING: playerdemo file format is incomplete and not stable yet. DO NOT RELY ON IT!");
}
#define PLAYERDEMO_FIELD(ent,func,t,f) func##t(ent,f,#f);
#define PLAYERDEMO_FIELDS(ent,func) \
tracebox(safe, player.mins - SAFENUDGE, player.maxs + SAFENUDGE, step, MOVE_NOMONSTERS, player);
if(trace_startsolid)
{
- LOG_INFO("'safe' teleport location is not safe!\n");
+ LOG_INFO("'safe' teleport location is not safe!");
// FAIL TODO why does this happen?
return 0;
}
tracebox(safe, player.mins - SAFENUDGE, player.maxs + SAFENUDGE, to, MOVE_NOMONSTERS, player);
if(trace_startsolid)
{
- LOG_INFO("trace_endpos in solid, this can't be!\n");
+ LOG_INFO("trace_endpos in solid, this can't be!");
// FAIL TODO why does this happen? (reported by MrBougo)
return 0;
}
if(!move_out_of_solid(portal))
{
#ifdef DEBUG
- LOG_INFO("NO SAFE ORIGIN\n");
+ LOG_INFO("NO SAFE ORIGIN");
#endif
return 0;
}
#include "../common/deathtypes/all.qh"
#include "../common/notifications/all.qh"
#include "../common/mapinfo.qh"
+#include <common/gamemodes/rules.qh>
#include <common/net_linked.qh>
#include <common/state.qh>
#include "../common/triggers/subs.qh"
float s;
if(g_race_qualifying)
{
- s = PlayerScore_Add(e, SP_RACE_FASTEST, 0);
+ s = GameRules_scoring_add(e, RACE_FASTEST, 0);
if(!s || t < s)
- PlayerScore_Add(e, SP_RACE_FASTEST, t - s);
+ GameRules_scoring_add(e, RACE_FASTEST, t - s);
}
else
{
- s = PlayerScore_Add(e, SP_RACE_FASTEST, 0);
+ s = GameRules_scoring_add(e, RACE_FASTEST, 0);
if(!s || t < s)
- PlayerScore_Add(e, SP_RACE_FASTEST, t - s);
+ GameRules_scoring_add(e, RACE_FASTEST, t - s);
- s = PlayerScore_Add(e, SP_RACE_TIME, 0);
+ s = GameRules_scoring_add(e, RACE_TIME, 0);
snew = TIME_ENCODE(time - game_starttime);
- PlayerScore_Add(e, SP_RACE_TIME, snew - s);
- l = PlayerTeamScore_Add(e, SP_RACE_LAPS, ST_RACE_LAPS, 1);
+ GameRules_scoring_add(e, RACE_TIME, snew - s);
+ l = GameRules_scoring_add_team(e, RACE_LAPS, 1);
if(autocvar_fraglimit)
if(l >= autocvar_fraglimit)
entity oth = race_checkpoint_lastplayers[cp];
if(oth)
{
- mylaps = PlayerScore_Add(e, SP_RACE_LAPS, 0);
+ mylaps = GameRules_scoring_add(e, RACE_LAPS, 0);
lother = race_checkpoint_lastlaps[cp];
othtime = race_checkpoint_lasttimes[cp];
}
// links on CP entities)
float l;
- l = PlayerScore_Add(e, SP_RACE_LAPS, 0);
+ l = GameRules_scoring_add(e, RACE_LAPS, 0);
if(CS(e).race_completed)
return l; // not fractional
*/
float PlayerTeamScore_Add(entity player, PlayerScoreField pscorefield, float tscorefield, float score);
-/**
- * Adds to the generic score fields for both the player and the team.
- */
-#define PlayerTeamScore_AddScore(p, s) PlayerTeamScore_Add(p, SP_SCORE, ST_SCORE, s)
-
/**
* Set the label of a team score item, as well as the scoring flags.
*/
#include <server/miscfunctions.qh>
#include "client.qh"
#include "scores.qh"
+#include <common/gamemodes/rules.qh>
int ScoreRules_teams;
}
void ScoreRules_generic()
{
- if(teamplay)
- {
+ int teams = 0;
+ if (teamplay) {
CheckAllowedTeams(NULL);
- int teams = 0;
- if(c1 >= 0) teams |= BIT(0);
- if(c2 >= 0) teams |= BIT(1);
- if(c3 >= 0) teams |= BIT(2);
- if(c4 >= 0) teams |= BIT(3);
- ScoreRules_basics(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
+ if (c1 >= 0) teams |= BIT(0);
+ if (c2 >= 0) teams |= BIT(1);
+ if (c3 >= 0) teams |= BIT(2);
+ if (c4 >= 0) teams |= BIT(3);
}
- else
- ScoreRules_basics(0, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, true);
- ScoreRules_basics_end();
+ GameRules_scoring(teams, SFL_SORT_PRIO_PRIMARY, SFL_SORT_PRIO_PRIMARY, {});
}
this.maxs = PL_MAX_CONST;
if (!move_out_of_solid(this))
objerror(this, "could not get out of solid at all!");
- LOG_INFO("^1NOTE: this map needs FIXING. Spawnpoint at ", vtos(o - '0 0 1'));
- LOG_INFO(" needs to be moved out of solid, e.g. by '", ftos(this.origin.x - o.x));
- LOG_INFO(" ", ftos(this.origin.y - o.y));
- LOG_INFO(" ", ftos(this.origin.z - o.z), "'\n");
+ LOG_INFOF(
+ "^1NOTE: this map needs FIXING. Spawnpoint at %s needs to be moved out of solid, e.g. by %s",
+ vtos(o - '0 0 1'),
+ vtos(this.origin - o)
+ );
if (autocvar_g_spawnpoints_auto_move_out_of_solid)
{
if (!spawnpoint_nag)
- LOG_INFO("\{1}^1NOTE: this map needs FIXING (it contains spawnpoints in solid, see server log)\n");
+ LOG_INFO("\{1}^1NOTE: this map needs FIXING (it contains spawnpoints in solid, see server log)");
spawnpoint_nag = 1;
}
else
if(time > client_cefc_accumulatortime + 1)
{
float t = client_cefc_accumulator / (time - client_cefc_accumulatortime);
- LOG_INFO("CEFC time: ", ftos(t * 1000), "ms; ");
int c_seeing = 0;
int c_seen = 0;
FOREACH_CLIENT(true, {
if(IS_PLAYER(it))
++c_seen;
});
- LOG_INFO("CEFC calls per second: ", ftos(c_seeing * (c_seen - 1) / t), "; ");
- LOG_INFO("CEFC 100% load at: ", ftos(solve_quadratic(t, -t, -1) * '0 1 0'), "\n");
-
+ LOG_INFO(
+ "CEFC time: ", ftos(t * 1000), "ms; ",
+ "CEFC calls per second: ", ftos(c_seeing * (c_seen - 1) / t), "; ",
+ "CEFC 100% load at: ", ftos(solve_quadratic(t, -t, -1) * '0 1 0')
+ );
client_cefc_accumulatortime = time;
client_cefc_accumulator = 0;
}
ScoreRules_generic();
}
-void ActivateTeamplay()
-{
- serverflags |= SERVERFLAG_TEAMPLAY;
- teamplay = 1;
- cvar_set("teamplay", "2"); // DP needs this for sending proper getstatus replies.
-}
-
void InitGameplayMode()
{
VoteReset();
max_shot_distance = min(230000, vlen(world.maxs - world.mins));
MapInfo_LoadMapSettings(mapname);
- serverflags &= ~SERVERFLAG_TEAMPLAY;
- teamplay = 0;
- cvar_set("teamplay", "0"); // DP needs this for sending proper getstatus replies.
+ GameRules_teams(false);
if (!cvar_value_issafe(world.fog))
{
- LOG_INFO("The current map contains a potentially harmful fog setting, ignored\n");
+ LOG_INFO("The current map contains a potentially harmful fog setting, ignored");
world.fog = string_null;
}
if(MapInfo_Map_fog != "")
void default_delayedinit(entity this);
-void ActivateTeamplay();
-
void InitGameplayMode();
string GetClientVersionMessage(entity this);
if (trace_ent == CS(ent).cursor_trace_ent)
w_shotdir = normalize(CS(ent).cursor_trace_ent.origin - w_shotorg);
else
- LOG_INFO("antilag fail\n");
+ LOG_INFO("antilag fail");
}
}
}
#if 0
mspercallsum += gettime(GETTIME_HIRES);
mspercallcount += 1;
- LOG_INFO("avg: ", ftos(mspercallcount / mspercallsum), " per sec\n");
+ LOG_INFO("avg: ", ftos(mspercallcount / mspercallsum), " per sec");
#endif
proj.velocity = W_CalculateProjectileVelocity(proj.owner, proj.owner.velocity, pSpeed * dir, forceAbsolute);
case URL_READY_CANREAD:
// url_fclose is processing, we got a response for writing the data
// this must come from HTTP
- LOG_INFO("Got response from weapon stats server:\n");
+ LOG_INFO("Got response from weapon stats server:");
while((s = url_fgets(fh)))
- LOG_INFO(" ", s, "\n");
- LOG_INFO("End of response.\n");
+ LOG_INFO(" ", s);
+ LOG_INFO("End of response.");
url_fclose(fh);
break;
case URL_READY_CLOSED:
// url_fclose has finished
- LOG_INFO("Weapon stats written\n");
+ LOG_INFO("Weapon stats written");
buf_del(weaponstats_buffer);
weaponstats_buffer = -1;
break;
case URL_READY_ERROR:
default:
- LOG_INFO("Weapon stats writing failed: ", ftos(status), "\n");
+ LOG_INFO("Weapon stats writing failed: ", ftos(status));
buf_del(weaponstats_buffer);
weaponstats_buffer = -1;
break;